Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_output.cpp
Show First 20 Lines • Show All 260 Lines • ▼ Show 20 Line(s) | 246 | { | |||
---|---|---|---|---|---|
261 | if (isInternal()) { | 261 | if (isInternal()) { | ||
262 | connect(kwinApp(), &Application::screensCreated, this, | 262 | connect(kwinApp(), &Application::screensCreated, this, | ||
263 | [this] { | 263 | [this] { | ||
264 | connect(screens()->orientationSensor(), &OrientationSensor::orientationChanged, this, &DrmOutput::automaticRotation); | 264 | connect(screens()->orientationSensor(), &OrientationSensor::orientationChanged, this, &DrmOutput::automaticRotation); | ||
265 | } | 265 | } | ||
266 | ); | 266 | ); | ||
267 | } | 267 | } | ||
268 | 268 | | |||
269 | QSize physicalSize = !m_edid.physicalSize().isEmpty() ? m_edid.physicalSize() : QSize(connector->mmWidth, connector->mmHeight); | | |||
270 | // the size might be completely borked. E.g. Samsung SyncMaster 2494HS reports 160x90 while in truth it's 520x292 | | |||
271 | // as this information is used to calculate DPI info, it's going to result in everything being huge | | |||
272 | const QByteArray unknown = QByteArrayLiteral("unknown"); | | |||
273 | KConfigGroup group = kwinApp()->config()->group("EdidOverwrite").group(m_edid.eisaId().isEmpty() ? unknown : m_edid.eisaId()) | | |||
274 | .group(m_edid.monitorName().isEmpty() ? unknown : m_edid.monitorName()) | | |||
275 | .group(m_edid.serialNumber().isEmpty() ? unknown : m_edid.serialNumber()); | | |||
276 | if (group.hasKey("PhysicalSize")) { | | |||
277 | const QSize overwriteSize = group.readEntry("PhysicalSize", physicalSize); | | |||
278 | qCWarning(KWIN_DRM) << "Overwriting monitor physical size for" << m_edid.eisaId() << "/" << m_edid.monitorName() << "/" << m_edid.serialNumber() << " from " << physicalSize << "to " << overwriteSize; | | |||
279 | physicalSize = overwriteSize; | | |||
280 | } | | |||
281 | setRawPhysicalSize(physicalSize); | | |||
282 | | ||||
283 | initOutputDevice(connector); | 269 | initOutputDevice(connector); | ||
284 | 270 | | |||
285 | setEnabled(true); | 271 | setEnabled(true); | ||
286 | return true; | 272 | return true; | ||
287 | } | 273 | } | ||
288 | 274 | | |||
289 | void DrmOutput::initUuid() | 275 | void DrmOutput::initUuid() | ||
290 | { | 276 | { | ||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | 312 | for (int i = 0; i < connector->count_modes; ++i) { | |||
338 | KWayland::Server::OutputDeviceInterface::Mode mode; | 324 | KWayland::Server::OutputDeviceInterface::Mode mode; | ||
339 | mode.id = i; | 325 | mode.id = i; | ||
340 | mode.size = QSize(m->hdisplay, m->vdisplay); | 326 | mode.size = QSize(m->hdisplay, m->vdisplay); | ||
341 | mode.flags = deviceflags; | 327 | mode.flags = deviceflags; | ||
342 | mode.refreshRate = refreshRateForMode(m); | 328 | mode.refreshRate = refreshRateForMode(m); | ||
343 | modes << mode; | 329 | modes << mode; | ||
344 | } | 330 | } | ||
345 | 331 | | |||
346 | AbstractWaylandOutput::initWaylandOutputDevice(model, manufacturer, m_uuid, modes); | 332 | QSize physicalSize = !m_edid.physicalSize().isEmpty() ? m_edid.physicalSize() : QSize(connector->mmWidth, connector->mmHeight); | ||
333 | // the size might be completely borked. E.g. Samsung SyncMaster 2494HS reports 160x90 while in truth it's 520x292 | ||||
334 | // as this information is used to calculate DPI info, it's going to result in everything being huge | ||||
335 | const QByteArray unknown = QByteArrayLiteral("unknown"); | ||||
336 | KConfigGroup group = kwinApp()->config()->group("EdidOverwrite").group(m_edid.eisaId().isEmpty() ? unknown : m_edid.eisaId()) | ||||
337 | .group(m_edid.monitorName().isEmpty() ? unknown : m_edid.monitorName()) | ||||
338 | .group(m_edid.serialNumber().isEmpty() ? unknown : m_edid.serialNumber()); | ||||
339 | if (group.hasKey("PhysicalSize")) { | ||||
340 | const QSize overwriteSize = group.readEntry("PhysicalSize", physicalSize); | ||||
341 | qCWarning(KWIN_DRM) << "Overwriting monitor physical size for" << m_edid.eisaId() << "/" << m_edid.monitorName() << "/" << m_edid.serialNumber() << " from " << physicalSize << "to " << overwriteSize; | ||||
342 | physicalSize = overwriteSize; | ||||
343 | } | ||||
344 | | ||||
345 | initWaylandOutputDevice(model, manufacturer, m_uuid, physicalSize, modes); | ||||
347 | } | 346 | } | ||
348 | 347 | | |||
349 | bool DrmOutput::isCurrentMode(const drmModeModeInfo *mode) const | 348 | bool DrmOutput::isCurrentMode(const drmModeModeInfo *mode) const | ||
350 | { | 349 | { | ||
351 | return mode->clock == m_mode.clock | 350 | return mode->clock == m_mode.clock | ||
352 | && mode->hdisplay == m_mode.hdisplay | 351 | && mode->hdisplay == m_mode.hdisplay | ||
353 | && mode->hsync_start == m_mode.hsync_start | 352 | && mode->hsync_start == m_mode.hsync_start | ||
354 | && mode->hsync_end == m_mode.hsync_end | 353 | && mode->hsync_end == m_mode.hsync_end | ||
▲ Show 20 Lines • Show All 718 Lines • Show Last 20 Lines |