Skip to content

Commit

Permalink
pi4: hack: Try to hide pixel wrap issue
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Jan 25, 2021
1 parent 8c752a8 commit 36ca126
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,20 @@ void CVideoLayerBridgeDRMPRIME::SetVideoPlane(CVideoBufferDRMPRIME* buffer, cons
auto plane = m_DRM->GetVideoPlane();
m_DRM->AddProperty(plane, "FB_ID", buffer->m_fb_id);
m_DRM->AddProperty(plane, "CRTC_ID", m_DRM->GetCrtc()->GetCrtcId());

uint32_t srcw = buffer->GetWidth() << 16;
uint32_t dstw = static_cast<uint32_t>(destRect.Width());
double scalex = (double)srcw / (double)dstw;
dstw -= 2;
srcw = (uint32_t)(srcw - 2.0 * scalex + 0.5);

m_DRM->AddProperty(plane, "SRC_X", 0);
m_DRM->AddProperty(plane, "SRC_Y", 0);
m_DRM->AddProperty(plane, "SRC_W", buffer->GetWidth() << 16);
m_DRM->AddProperty(plane, "SRC_W", srcw);
m_DRM->AddProperty(plane, "SRC_H", buffer->GetHeight() << 16);
m_DRM->AddProperty(plane, "CRTC_X", static_cast<int32_t>(destRect.x1) & ~1);
m_DRM->AddProperty(plane, "CRTC_Y", static_cast<int32_t>(destRect.y1) & ~1);
m_DRM->AddProperty(plane, "CRTC_W", (static_cast<uint32_t>(destRect.Width()) + 1) & ~1);
m_DRM->AddProperty(plane, "CRTC_W", (dstw + 1) & ~1);
m_DRM->AddProperty(plane, "CRTC_H", (static_cast<uint32_t>(destRect.Height()) + 1) & ~1);
}

Expand Down
10 changes: 8 additions & 2 deletions xbmc/windowing/gbm/drm/DRMAtomic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,19 @@ void CDRMAtomic::DrmAtomicCommit(int fb_id, int flags, bool rendered, bool video
return;
}

uint32_t srcw = m_width << 16;
uint32_t dstw = m_mode->hdisplay;
double scalex = (double)srcw / (double)dstw;
dstw -= 2;
srcw = (uint32_t)(srcw - 2.0 * scalex + 0.5);

if (rendered)
{
AddProperty(m_gui_plane, "FB_ID", fb_id);
AddProperty(m_gui_plane, "CRTC_ID", m_crtc->GetCrtcId());
AddProperty(m_gui_plane, "SRC_X", 0);
AddProperty(m_gui_plane, "SRC_Y", 0);
AddProperty(m_gui_plane, "SRC_W", m_width << 16);
AddProperty(m_gui_plane, "SRC_W", srcw);
AddProperty(m_gui_plane, "SRC_H", m_height << 16);
AddProperty(m_gui_plane, "CRTC_X", 0);
AddProperty(m_gui_plane, "CRTC_Y", 0);
Expand All @@ -109,7 +115,7 @@ void CDRMAtomic::DrmAtomicCommit(int fb_id, int flags, bool rendered, bool video
// }
// else
{
AddProperty(m_gui_plane, "CRTC_W", m_mode->hdisplay);
AddProperty(m_gui_plane, "CRTC_W", dstw);
AddProperty(m_gui_plane, "CRTC_H", m_mode->vdisplay);
}

Expand Down

0 comments on commit 36ca126

Please sign in to comment.