Commit 90b79a1d authored by Andrew den Exter's avatar Andrew den Exter

[qtbase] Honor the EGLFS size environment variable in the kms integration. JB#46191

parent eef21594
......@@ -137,10 +137,17 @@ QEglFSKmsScreen::~QEglFSKmsScreen()
QRect QEglFSKmsScreen::geometry() const
{
const int mode = m_output.mode;
return QRect(m_pos.x(), m_pos.y(),
m_output.modes[mode].hdisplay,
m_output.modes[mode].vdisplay);
static const int width = qEnvironmentVariableIntValue("QT_QPA_EGLFS_WIDTH");
static const int height = qEnvironmentVariableIntValue("QT_QPA_EGLFS_HEIGHT");
if (width != 0 && height != 0) {
return QRect(0, 0, width, height);
} else {
const int mode = m_output.mode;
return QRect(m_pos.x(), m_pos.y(),
m_output.modes[mode].hdisplay,
m_output.modes[mode].vdisplay);
}
}
int QEglFSKmsScreen::depth() const
......@@ -158,10 +165,18 @@ QSizeF QEglFSKmsScreen::physicalSize() const
return m_output.physical_size;
}
QSize QEglFSKmsScreen::screenSize() const
{
const int mode = m_output.mode;
return QSize(m_output.modes[mode].hdisplay,
m_output.modes[mode].vdisplay);
}
QDpi QEglFSKmsScreen::logicalDpi() const
{
const QSizeF ps = physicalSize();
const QSize s = geometry().size();
const QSize s = screenSize();
if (!ps.isEmpty() && !s.isEmpty())
return QDpi(25.4 * s.width() / ps.width(),
......@@ -207,8 +222,8 @@ gbm_surface *QEglFSKmsScreen::createSurface()
if (!m_gbm_surface) {
qCDebug(qLcEglfsKmsDebug) << "Creating window for screen" << name();
m_gbm_surface = gbm_surface_create(m_device->device(),
geometry().width(),
geometry().height(),
screenSize().width(),
screenSize().height(),
GBM_FORMAT_XRGB8888,
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
}
......
......@@ -78,6 +78,7 @@ public:
QImage::Format format() const Q_DECL_OVERRIDE;
QSizeF physicalSize() const Q_DECL_OVERRIDE;
QSize screenSize() const;
QDpi logicalDpi() const Q_DECL_OVERRIDE;
Qt::ScreenOrientation nativeOrientation() const Q_DECL_OVERRIDE;
Qt::ScreenOrientation orientation() const Q_DECL_OVERRIDE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment