mirror of
https://github.com/X11Libre/xf86-video-amdgpu.git
synced 2026-03-24 01:24:31 +00:00
Pass reference CRTC to amdgpu_do_pageflip directly
Simplifies the code slightly. (Ported from radeon commit 49cc61ab970ee28d4509b4e2dd0a57165136889f) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Michel Dänzer
parent
87a1f577f1
commit
24b2718992
@@ -541,7 +541,6 @@ amdgpu_dri2_schedule_flip(xf86CrtcPtr crtc, ClientPtr client,
|
||||
AMDGPUInfoPtr info = AMDGPUPTR(scrn);
|
||||
struct dri2_buffer_priv *back_priv;
|
||||
DRI2FrameEventPtr flip_info;
|
||||
int ref_crtc_hw_id = drmmode_get_crtc_id(crtc);
|
||||
|
||||
flip_info = calloc(1, sizeof(DRI2FrameEventRec));
|
||||
if (!flip_info)
|
||||
@@ -561,8 +560,7 @@ amdgpu_dri2_schedule_flip(xf86CrtcPtr crtc, ClientPtr client,
|
||||
/* Page flip the full screen buffer */
|
||||
back_priv = back->driverPrivate;
|
||||
if (amdgpu_do_pageflip(scrn, client, back_priv->pixmap,
|
||||
AMDGPU_DRM_QUEUE_ID_DEFAULT, flip_info,
|
||||
ref_crtc_hw_id,
|
||||
AMDGPU_DRM_QUEUE_ID_DEFAULT, flip_info, crtc,
|
||||
amdgpu_dri2_flip_event_handler,
|
||||
amdgpu_dri2_flip_event_abort, FLIP_VSYNC,
|
||||
target_msc - amdgpu_get_msc_delta(draw, crtc))) {
|
||||
|
||||
@@ -308,8 +308,6 @@ amdgpu_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc,
|
||||
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
|
||||
AMDGPUInfoPtr info = AMDGPUPTR(scrn);
|
||||
struct amdgpu_present_vblank_event *event;
|
||||
xf86CrtcPtr xf86_crtc = crtc->devPrivate;
|
||||
int crtc_id = xf86_crtc ? drmmode_get_crtc_id(xf86_crtc) : -1;
|
||||
Bool ret;
|
||||
|
||||
if (!amdgpu_present_check_flip(crtc, screen->root, pixmap, sync_flip))
|
||||
@@ -324,7 +322,7 @@ amdgpu_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc,
|
||||
amdgpu_glamor_flush(scrn);
|
||||
|
||||
ret = amdgpu_do_pageflip(scrn, AMDGPU_DRM_QUEUE_CLIENT_DEFAULT,
|
||||
pixmap, event_id, event, crtc_id,
|
||||
pixmap, event_id, event, crtc->devPrivate,
|
||||
amdgpu_present_flip_event,
|
||||
amdgpu_present_flip_abort,
|
||||
sync_flip ? FLIP_VSYNC : FLIP_ASYNC,
|
||||
@@ -367,7 +365,7 @@ amdgpu_present_unflip(ScreenPtr screen, uint64_t event_id)
|
||||
|
||||
amdgpu_glamor_flush(scrn);
|
||||
if (amdgpu_do_pageflip(scrn, AMDGPU_DRM_QUEUE_CLIENT_DEFAULT, pixmap,
|
||||
event_id, event, -1, amdgpu_present_flip_event,
|
||||
event_id, event, NULL, amdgpu_present_flip_event,
|
||||
amdgpu_present_flip_abort, flip_sync, 0))
|
||||
return;
|
||||
|
||||
|
||||
@@ -2759,7 +2759,7 @@ void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode)
|
||||
|
||||
Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
|
||||
PixmapPtr new_front, uint64_t id, void *data,
|
||||
int ref_crtc_hw_id, amdgpu_drm_handler_proc handler,
|
||||
xf86CrtcPtr ref_crtc, amdgpu_drm_handler_proc handler,
|
||||
amdgpu_drm_abort_proc abort,
|
||||
enum drmmode_flip_sync flip_sync,
|
||||
uint32_t target_msc)
|
||||
@@ -2800,6 +2800,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
|
||||
flipdata->event_data = data;
|
||||
flipdata->handler = handler;
|
||||
flipdata->abort = abort;
|
||||
flipdata->fe_crtc = ref_crtc;
|
||||
|
||||
for (i = 0; i < config->num_crtc; i++) {
|
||||
crtc = config->crtc[i];
|
||||
@@ -2810,12 +2811,6 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
|
||||
flipdata->flip_count++;
|
||||
drmmode_crtc = crtc->driver_private;
|
||||
|
||||
/* Only the reference crtc will finally deliver its page flip
|
||||
* completion event. All other crtc's events will be discarded.
|
||||
*/
|
||||
if (drmmode_crtc->hw_id == ref_crtc_hw_id)
|
||||
flipdata->fe_crtc = crtc;
|
||||
|
||||
drm_queue_seq = amdgpu_drm_queue_alloc(crtc, client, id,
|
||||
flipdata,
|
||||
drmmode_flip_handler,
|
||||
@@ -2826,7 +2821,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (drmmode_crtc->hw_id == ref_crtc_hw_id) {
|
||||
if (crtc == ref_crtc) {
|
||||
if (drmmode_page_flip_target_absolute(pAMDGPUEnt,
|
||||
drmmode_crtc,
|
||||
fb->handle,
|
||||
|
||||
@@ -209,7 +209,7 @@ extern int drmmode_get_pitch_align(ScrnInfoPtr scrn, int bpe);
|
||||
extern void drmmode_clear_pending_flip(xf86CrtcPtr crtc);
|
||||
Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
|
||||
PixmapPtr new_front, uint64_t id, void *data,
|
||||
int ref_crtc_hw_id, amdgpu_drm_handler_proc handler,
|
||||
xf86CrtcPtr ref_crtc, amdgpu_drm_handler_proc handler,
|
||||
amdgpu_drm_abort_proc abort,
|
||||
enum drmmode_flip_sync flip_sync,
|
||||
uint32_t target_msc);
|
||||
|
||||
Reference in New Issue
Block a user