summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2017-08-18 15:03:52 +0900
committerMichel Dänzer <michel@daenzer.net>2017-08-22 18:32:05 +0900
commit24b2718992e4bbc859c07e5b29b571f53314045d (patch)
treed307a9e5b2d873667438fb92896507a9ac71fbce
parent87a1f577f1de62f6b628bbe221cd8d551531e708 (diff)
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>
-rw-r--r--src/amdgpu_dri2.c4
-rw-r--r--src/amdgpu_present.c6
-rw-r--r--src/drmmode_display.c11
-rw-r--r--src/drmmode_display.h2
4 files changed, 7 insertions, 16 deletions
diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index dfbc999..52fac03 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -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))) {
diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index 550b702..7769e1f 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -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;
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 108fb68..93f6d27 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -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,
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index 7071a74..bece0ce 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -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);