mirror of
https://github.com/X11Libre/xf86-video-amdgpu.git
synced 2026-04-14 11:04:42 +00:00
Factor out amdgpu_prime_dirty_to_crtc helper
Cleanup in preparation for the following change, no functional change intended. (Ported from radeon commit 649644a88347a6d03de68f8c41db03a82deeb23b) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Michel Dänzer
parent
a6d363008e
commit
d25cc3b2b3
@@ -549,6 +549,27 @@ call_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty)
|
||||
#endif /* HAS_SYNC_SHARED_PIXMAPS */
|
||||
|
||||
|
||||
static xf86CrtcPtr
|
||||
amdgpu_prime_dirty_to_crtc(PixmapDirtyUpdatePtr dirty)
|
||||
{
|
||||
ScreenPtr screen = dirty->slave_dst->drawable.pScreen;
|
||||
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
|
||||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||
int c;
|
||||
|
||||
/* Find the CRTC which is scanning out from this slave pixmap */
|
||||
for (c = 0; c < xf86_config->num_crtc; c++) {
|
||||
xf86CrtcPtr xf86_crtc = xf86_config->crtc[c];
|
||||
drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
|
||||
|
||||
if (drmmode_crtc->scanout[0].pixmap == dirty->slave_dst ||
|
||||
drmmode_crtc->scanout[1].pixmap == dirty->slave_dst)
|
||||
return xf86_crtc;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Bool
|
||||
amdgpu_prime_scanout_do_update(xf86CrtcPtr crtc, unsigned scanout_id)
|
||||
{
|
||||
@@ -608,24 +629,16 @@ amdgpu_prime_scanout_update(PixmapDirtyUpdatePtr dirty)
|
||||
ScreenPtr screen = dirty->slave_dst->drawable.pScreen;
|
||||
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
|
||||
AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn);
|
||||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||
xf86CrtcPtr xf86_crtc = NULL;
|
||||
drmmode_crtc_private_ptr drmmode_crtc = NULL;
|
||||
xf86CrtcPtr xf86_crtc = amdgpu_prime_dirty_to_crtc(dirty);
|
||||
drmmode_crtc_private_ptr drmmode_crtc;
|
||||
uintptr_t drm_queue_seq;
|
||||
drmVBlank vbl;
|
||||
int c;
|
||||
|
||||
/* Find the CRTC which is scanning out from this slave pixmap */
|
||||
for (c = 0; c < xf86_config->num_crtc; c++) {
|
||||
xf86_crtc = xf86_config->crtc[c];
|
||||
drmmode_crtc = xf86_crtc->driver_private;
|
||||
if (drmmode_crtc->scanout[0].pixmap == dirty->slave_dst)
|
||||
break;
|
||||
}
|
||||
if (!xf86_crtc || !xf86_crtc->enabled)
|
||||
return;
|
||||
|
||||
if (c == xf86_config->num_crtc ||
|
||||
!xf86_crtc->enabled ||
|
||||
drmmode_crtc->scanout_update_pending ||
|
||||
drmmode_crtc = xf86_crtc->driver_private;
|
||||
if (drmmode_crtc->scanout_update_pending ||
|
||||
!drmmode_crtc->scanout[0].pixmap ||
|
||||
drmmode_crtc->pending_dpms_mode != DPMSModeOn)
|
||||
return;
|
||||
@@ -671,25 +684,16 @@ amdgpu_prime_scanout_flip(PixmapDirtyUpdatePtr ent)
|
||||
ScreenPtr screen = ent->slave_dst->drawable.pScreen;
|
||||
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
|
||||
AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn);
|
||||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||
xf86CrtcPtr crtc = NULL;
|
||||
drmmode_crtc_private_ptr drmmode_crtc = NULL;
|
||||
xf86CrtcPtr crtc = amdgpu_prime_dirty_to_crtc(ent);
|
||||
drmmode_crtc_private_ptr drmmode_crtc;
|
||||
uintptr_t drm_queue_seq;
|
||||
unsigned scanout_id;
|
||||
int c;
|
||||
|
||||
/* Find the CRTC which is scanning out from this slave pixmap */
|
||||
for (c = 0; c < xf86_config->num_crtc; c++) {
|
||||
crtc = xf86_config->crtc[c];
|
||||
drmmode_crtc = crtc->driver_private;
|
||||
scanout_id = drmmode_crtc->scanout_id;
|
||||
if (drmmode_crtc->scanout[scanout_id].pixmap == ent->slave_dst)
|
||||
break;
|
||||
}
|
||||
if (!crtc || !crtc->enabled)
|
||||
return;
|
||||
|
||||
if (c == xf86_config->num_crtc ||
|
||||
!crtc->enabled ||
|
||||
drmmode_crtc->scanout_update_pending ||
|
||||
drmmode_crtc = crtc->driver_private;
|
||||
if (drmmode_crtc->scanout_update_pending ||
|
||||
!drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap ||
|
||||
drmmode_crtc->pending_dpms_mode != DPMSModeOn)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user