|
11 | 11 | #include "cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.h" |
12 | 12 | #include "utils/log.h" |
13 | 13 | #include "windowing/gbm/drm/DRMAtomic.h" |
| 14 | +#include "settings/DisplaySettings.h" |
14 | 15 |
|
15 | 16 | #include <utility> |
16 | 17 |
|
@@ -264,13 +265,24 @@ void CVideoLayerBridgeDRMPRIME::SetVideoPlane(CVideoBufferDRMPRIME* buffer, cons |
264 | 265 | auto plane = m_DRM->GetVideoPlane(); |
265 | 266 | m_DRM->AddProperty(plane, "FB_ID", buffer->m_fb_id); |
266 | 267 | m_DRM->AddProperty(plane, "CRTC_ID", m_DRM->GetCrtc()->GetCrtcId()); |
| 268 | + |
| 269 | + uint32_t srcw = buffer->GetWidth() << 16; |
| 270 | + uint32_t dstw = static_cast<uint32_t>(destRect.Width()); |
| 271 | + uint32_t dstx = static_cast<int32_t>(destRect.x1); |
| 272 | + double scalex = (double)srcw / (double)dstw; |
| 273 | + RESOLUTION_INFO &res = CDisplaySettings::GetInstance().GetCurrentResolutionInfo(); |
| 274 | + if (dstw > 2 && dstx + dstw > (uint32_t)res.iScreenWidth - 2) |
| 275 | + { |
| 276 | + dstw -= 2; |
| 277 | + srcw = (uint32_t)(srcw - 2.0 * scalex + 0.5); |
| 278 | + } |
267 | 279 | m_DRM->AddProperty(plane, "SRC_X", 0); |
268 | 280 | m_DRM->AddProperty(plane, "SRC_Y", 0); |
269 | | - m_DRM->AddProperty(plane, "SRC_W", buffer->GetWidth() << 16); |
| 281 | + m_DRM->AddProperty(plane, "SRC_W", srcw); |
270 | 282 | m_DRM->AddProperty(plane, "SRC_H", buffer->GetHeight() << 16); |
271 | | - m_DRM->AddProperty(plane, "CRTC_X", static_cast<int32_t>(destRect.x1) & ~1); |
| 283 | + m_DRM->AddProperty(plane, "CRTC_X", (dstx + 1) & ~1); |
272 | 284 | m_DRM->AddProperty(plane, "CRTC_Y", static_cast<int32_t>(destRect.y1) & ~1); |
273 | | - m_DRM->AddProperty(plane, "CRTC_W", (static_cast<uint32_t>(destRect.Width()) + 1) & ~1); |
| 285 | + m_DRM->AddProperty(plane, "CRTC_W", (dstw + 1) & ~1); |
274 | 286 | m_DRM->AddProperty(plane, "CRTC_H", (static_cast<uint32_t>(destRect.Height()) + 1) & ~1); |
275 | 287 | } |
276 | 288 |
|
|
0 commit comments