Commit 7ea9b059 authored by Matti Kosola's avatar Matti Kosola

Merge branch 'jb46191-eglfs-override' into 'mer-5.6'

Allow overriding eglfs kms screen sizes.

See merge request !49
parents 148a5c7b 9cb443d0
......@@ -280,12 +280,18 @@ QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, dr
qCDebug(qLcEglfsKmsDebug) << "Selected mode" << selected_mode << ":" << width << "x" << height
<< '@' << refresh << "hz for output" << connectorName;
}
static const int width = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_WIDTH");
static const int height = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_HEIGHT");
QSizeF size(width, height);
if (size.isEmpty()) {
size.setWidth(connector->mmWidth);
size.setHeight(connector->mmHeight);
}
QEglFSKmsOutput output = {
QString::fromUtf8(connectorName),
connector->connector_id,
crtc_id,
QSizeF(connector->mmWidth, connector->mmHeight),
size,
selected_mode,
false,
drmModeGetCrtc(m_dri_fd, crtc_id),
......
......@@ -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