[-]
[+]
|
Changed |
_service:tar_git:qt5-qpa-hwcomposer-plugin.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:qt5-qpa-hwcomposer-plugin.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<service name="tar_git">
<param name="url">https://github.com/mer-hybris/qt5-qpa-hwcomposer-plugin.git</param>
<param name="branch">master</param>
- <param name="revision">283be54a035343b7aad1f12e499933f69981779f</param>
+ <param name="revision">9295f09437001d7fbbfb25fe93f31b32c371e944</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Changed |
_service:tar_git:qt5-qpa-hwcomposer-plugin-5.6.2.7.tar.bz2/hwcomposer/hwcomposer_backend.h
^
|
@@ -109,6 +109,8 @@
virtual void sleepDisplay(bool sleep) = 0;
virtual float refreshRate() = 0;
+ virtual bool getScreenSizes(int *width, int *height, float *physical_width, float *physical_height) = 0;
+
virtual bool requestUpdate(QEglFSWindow *) { return false; }
protected:
|
[-]
[+]
|
Changed |
_service:tar_git:qt5-qpa-hwcomposer-plugin-5.6.2.7.tar.bz2/hwcomposer/hwcomposer_backend_v0.h
^
|
@@ -56,6 +56,15 @@
virtual void swap(EGLNativeDisplayType display, EGLSurface surface);
virtual void sleepDisplay(bool sleep);
virtual float refreshRate();
+ virtual bool getScreenSizes(int *width, int *height, float *physical_width, float *physical_height)
+ {
+ *width = 0;
+ *height = 0;
+ *physical_width = 0;
+ *physical_height = 0;
+ // N/A
+ return false;
+ }
private:
hwc_composer_device_t *hwc_device;
|
[-]
[+]
|
Changed |
_service:tar_git:qt5-qpa-hwcomposer-plugin-5.6.2.7.tar.bz2/hwcomposer/hwcomposer_backend_v10.h
^
|
@@ -60,6 +60,15 @@
virtual void swap(EGLNativeDisplayType display, EGLSurface surface);
virtual void sleepDisplay(bool sleep);
virtual float refreshRate();
+ virtual bool getScreenSizes(int *width, int *height, float *physical_width, float *physical_height)
+ {
+ *width = 0;
+ *height = 0;
+ *physical_width = 0;
+ *physical_height = 0;
+ // N/A
+ return false;
+ }
private:
hwc_composer_device_1_t *hwc_device;
|
[-]
[+]
|
Changed |
_service:tar_git:qt5-qpa-hwcomposer-plugin-5.6.2.7.tar.bz2/hwcomposer/hwcomposer_backend_v11.cpp
^
|
@@ -381,15 +381,80 @@
}
}
+int HwComposerBackend_v11::getSingleAttribute(uint32_t attribute)
+{
+ uint32_t config;
+
+ if (hwc_version == HWC_DEVICE_API_VERSION_1_1
+#ifdef HWC_DEVICE_API_VERSION_1_2
+ || hwc_version == HWC_DEVICE_API_VERSION_1_2
+#endif
+#ifdef HWC_DEVICE_API_VERSION_1_3
+ || hwc_version == HWC_DEVICE_API_VERSION_1_3
+#endif
+)
+ {
+ /* 1.3 or lower, currently active config is the first config */
+ size_t numConfigs = 1;
+ hwc_device->getDisplayConfigs(hwc_device, 0, &config, &numConfigs);
+ }
+#ifdef HWC_DEVICE_API_VERSION_1_4
+ else {
+ /* 1.4 or higher */
+ config = hwc_device->getActiveConfig(hwc_device, 0);
+ }
+#endif
+
+ const uint32_t attributes[] = {
+ attribute,
+ HWC_DISPLAY_NO_ATTRIBUTE,
+ };
+
+ int32_t values[] = {
+ 0,
+ 0,
+ };
+
+ hwc_device->getDisplayAttributes(hwc_device, 0, config, attributes, values);
+
+ for (unsigned int i = 0; i < sizeof(attributes) / sizeof(uint32_t); i++) {
+ if (attributes[i] == attribute) {
+ return values[i];
+ }
+ }
+
+ return 0;
+}
+
float
HwComposerBackend_v11::refreshRate()
{
- // TODO: Implement new hwc 1.1 querying of vsync period per-display
- //
- // from hwcomposer_defs.h:
- // "This query is not used for HWC_DEVICE_API_VERSION_1_1 and later.
- // Instead, the per-display attribute HWC_DISPLAY_VSYNC_PERIOD is used."
- return 60.0;
+ float value = (float)getSingleAttribute(HWC_DISPLAY_VSYNC_PERIOD);
+
+ value = (1000000000.0 / value);
+
+ // make sure the value is "reasonable", otherwise fallback to 60.0.
+ return (value > 0 && value <= 1000) ? value : 60.0;
+}
+
+bool
+HwComposerBackend_v11::getScreenSizes(int *width, int *height, float *physical_width, float *physical_height)
+{
+ int dpi_x = getSingleAttribute(HWC_DISPLAY_DPI_X) / 1000;
+ int dpi_y = getSingleAttribute(HWC_DISPLAY_DPI_Y) / 1000;
+
+ *width = getSingleAttribute(HWC_DISPLAY_WIDTH);
+ *height = getSingleAttribute(HWC_DISPLAY_HEIGHT);
+
+ if (dpi_x == 0 || dpi_y == 0 || *width == 0 || *height == 0) {
+ qWarning() << "failed to read screen size from hwc1.x backend";
+ return false;
+ }
+
+ *physical_width = (((float)*width) * 25.4) / (float)dpi_x;
+ *physical_height = (((float)*height) * 25.4) / (float)dpi_y;
+
+ return true;
}
void HwComposerBackend_v11::timerEvent(QTimerEvent *e)
|
[-]
[+]
|
Changed |
_service:tar_git:qt5-qpa-hwcomposer-plugin-5.6.2.7.tar.bz2/hwcomposer/hwcomposer_backend_v11.h
^
|
@@ -65,6 +65,7 @@
virtual void swap(EGLNativeDisplayType display, EGLSurface surface);
virtual void sleepDisplay(bool sleep);
virtual float refreshRate();
+ virtual bool getScreenSizes(int *width, int *height, float *physical_width, float *physical_height);
virtual bool requestUpdate(QEglFSWindow *window) Q_DECL_OVERRIDE;
@@ -73,6 +74,7 @@
bool event(QEvent *e) Q_DECL_OVERRIDE;
private:
+ int getSingleAttribute(uint32_t attribute);
hwc_composer_device_1_t *hwc_device;
hwc_display_contents_1_t *hwc_list;
hwc_display_contents_1_t **hwc_mList;
|
[-]
[+]
|
Changed |
_service:tar_git:qt5-qpa-hwcomposer-plugin-5.6.2.7.tar.bz2/hwcomposer/hwcomposer_backend_v20.cpp
^
|
@@ -344,12 +344,37 @@
float
HwComposerBackend_v20::refreshRate()
{
- // TODO: Implement new hwc 1.1 querying of vsync period per-display
- //
- // from hwcomposer_defs.h:
- // "This query is not used for HWC_DEVICE_API_VERSION_1_1 and later.
- // Instead, the per-display attribute HWC_DISPLAY_VSYNC_PERIOD is used."
- return 60.0;
+ float value = (float)hwc2_compat_display_get_active_config(hwc2_primary_display)->vsyncPeriod;
+
+ value = (1000000000.0 / value);
+
+ // make sure the value is "reasonable", otherwise fallback to 60.0.
+ return (value > 0 && value <= 1000.0) ? value : 60.0;
+}
+
+bool
+HwComposerBackend_v20::getScreenSizes(int *width, int *height, float *physical_width, float *physical_height)
+{
+ HWC2DisplayConfig *config = hwc2_compat_display_get_active_config(hwc2_primary_display);
+
+ // should not happen
+ if (!config) return false;
+
+ int dpi_x = config->dpiX;
+ int dpi_y = config->dpiY;
+
+ *width = config->width;
+ *height = config->height;
+
+ if (dpi_x == 0 || dpi_y == 0 || *width == 0 || *height == 0) {
+ qWarning() << "failed to read screen size from hwc1.x backend";
+ return false;
+ }
+
+ *physical_width = (((float)*width) * 25.4) / (float)dpi_x;
+ *physical_height = (((float)*height) * 25.4) / (float)dpi_y;
+
+ return true;
}
void HwComposerBackend_v20::timerEvent(QTimerEvent *e)
|
[-]
[+]
|
Changed |
_service:tar_git:qt5-qpa-hwcomposer-plugin-5.6.2.7.tar.bz2/hwcomposer/hwcomposer_backend_v20.h
^
|
@@ -66,6 +66,7 @@
virtual void swap(EGLNativeDisplayType display, EGLSurface surface);
virtual void sleepDisplay(bool sleep);
virtual float refreshRate();
+ virtual bool getScreenSizes(int *width, int *height, float *physical_width, float *physical_height);
virtual bool requestUpdate(QEglFSWindow *window) Q_DECL_OVERRIDE;
|
[-]
[+]
|
Changed |
_service:tar_git:qt5-qpa-hwcomposer-plugin-5.6.2.7.tar.bz2/hwcomposer/hwcomposer_context.cpp
^
|
@@ -71,7 +71,7 @@
}
HwComposerContext::HwComposerContext()
- : info(new HwComposerScreenInfo())
+ : info(NULL)
, backend(NULL)
, display_off(false)
, window_created(false)
@@ -92,6 +92,8 @@
HWC_PLUGIN_ASSERT_NOT_NULL(backend);
fps = backend->refreshRate();
+
+ info = new HwComposerScreenInfo(backend);
}
HwComposerContext::~HwComposerContext()
|
[-]
[+]
|
Changed |
_service:tar_git:qt5-qpa-hwcomposer-plugin-5.6.2.7.tar.bz2/hwcomposer/hwcomposer_screeninfo.cpp
^
|
@@ -40,6 +40,7 @@
****************************************************************************/
#include "hwcomposer_screeninfo.h"
+#include "hwcomposer_backend.h"
#include <private/qmath_p.h>
#include <private/qcore_unix_p.h>
@@ -205,13 +206,48 @@
int m_depth;
};
+class HwComposerScreenInfoHWCSource {
+public:
+ HwComposerScreenInfoHWCSource(HwComposerBackend *backend) {
+ m_have_values = backend->getScreenSizes(&m_width, &m_height, &m_physicalWidth, &m_physicalHeight);
+ m_depth = 32;
+ }
+
+ QSizeF physicalScreenSize()
+ {
+ return QSizeF(m_physicalWidth, m_physicalHeight);
+ }
+
+ QSize screenSize()
+ {
+ return QSize(m_width, m_height);
+ }
+
+ int screenDepth()
+ {
+ return m_depth;
+ }
+
+ bool isValid()
+ {
+ return m_have_values;
+ }
+
+private:
+ float m_physicalWidth;
+ float m_physicalHeight;
+ int m_width;
+ int m_height;
+ int m_depth;
+ bool m_have_values;
+};
} /* empty namespace */
QT_BEGIN_NAMESPACE
-HwComposerScreenInfo::HwComposerScreenInfo()
+HwComposerScreenInfo::HwComposerScreenInfo(HwComposerBackend *backend)
{
/**
* Look up the values in the following order of preference:
@@ -220,12 +256,15 @@
* 2. fbdev via FBIOGET_VSCREENINFO is preferred otherwise
* 3. Fallback values (with warnings) if 1. and 2. fail
**/
+ HwComposerScreenInfoHWCSource hwcSource(backend);
HwComposerScreenInfoEnvironmentSource envSource;
HwComposerScreenInfoFbDevSource fbdevSource;
HwComposerScreenInfoFallbackSource fallbackSource;
if (envSource.hasScreenSize()) {
m_screenSize = envSource.screenSize();
+ } else if (hwcSource.isValid()) {
+ m_screenSize = hwcSource.screenSize();
} else if (fbdevSource.isValid()) {
m_screenSize = fbdevSource.screenSize();
} else {
@@ -234,6 +273,8 @@
if (envSource.hasPhysicalScreenSize()) {
m_physicalScreenSize = envSource.physicalScreenSize();
+ } else if (hwcSource.isValid()) {
+ m_physicalScreenSize = hwcSource.physicalScreenSize();
} else if (fbdevSource.isValid()) {
m_physicalScreenSize = fbdevSource.physicalScreenSize();
} else {
@@ -242,6 +283,8 @@
if (envSource.hasScreenDepth()) {
m_screenDepth = envSource.screenDepth();
+ } else if (hwcSource.isValid()) {
+ m_screenDepth = hwcSource.screenDepth();
} else if (fbdevSource.isValid()) {
m_screenDepth = fbdevSource.screenDepth();
} else {
|
[-]
[+]
|
Changed |
_service:tar_git:qt5-qpa-hwcomposer-plugin-5.6.2.7.tar.bz2/hwcomposer/hwcomposer_screeninfo.h
^
|
@@ -46,11 +46,13 @@
#include <QSizeF>
#include <QSize>
+class HwComposerBackend;
+
QT_BEGIN_NAMESPACE
class HwComposerScreenInfo {
public:
- HwComposerScreenInfo();
+ HwComposerScreenInfo(HwComposerBackend *backend);
QSizeF physicalScreenSize() const { return m_physicalScreenSize; }
QSize screenSize() const { return m_screenSize; }
|