summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2018-07-20 17:07:23 +0200
committerMichel Dänzer <michel@daenzer.net>2018-08-16 17:11:23 +0200
commit6029794e8a35417faf825491a89b85f713c77fc1 (patch)
tree5729a202787b2b5c24f677e9fdf4c4f170ee28bb
parent0148283984c77f7a6e97026edc3093497547e0a4 (diff)
Add amdgpu_drm_wait_pending_flip function
Replacing the drmmode_crtc_wait_pending_event macro. Acked-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--src/amdgpu_drm_queue.c13
-rw-r--r--src/amdgpu_drm_queue.h1
-rw-r--r--src/drmmode_display.c22
3 files changed, 18 insertions, 18 deletions
diff --git a/src/amdgpu_drm_queue.c b/src/amdgpu_drm_queue.c
index dfe0148..9c01661 100644
--- a/src/amdgpu_drm_queue.c
+++ b/src/amdgpu_drm_queue.c
@@ -178,6 +178,19 @@ amdgpu_drm_abort_id(uint64_t id)
}
/*
+ * Wait for pending page flip on given CRTC to complete
+ */
+void amdgpu_drm_wait_pending_flip(xf86CrtcPtr crtc)
+{
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(crtc->scrn);
+ drmmode_ptr drmmode = drmmode_crtc->drmmode;
+
+ while (drmmode_crtc->flip_pending &&
+ drmHandleEvent(pAMDGPUEnt->fd, &drmmode->event_context) > 0);
+}
+
+/*
* Initialize the DRM event queue
*/
void
diff --git a/src/amdgpu_drm_queue.h b/src/amdgpu_drm_queue.h
index 328b5e6..cb6d5ff 100644
--- a/src/amdgpu_drm_queue.h
+++ b/src/amdgpu_drm_queue.h
@@ -49,6 +49,7 @@ uintptr_t amdgpu_drm_queue_alloc(xf86CrtcPtr crtc, ClientPtr client,
void amdgpu_drm_abort_client(ClientPtr client);
void amdgpu_drm_abort_entry(uintptr_t seq);
void amdgpu_drm_abort_id(uint64_t id);
+void amdgpu_drm_wait_pending_flip(xf86CrtcPtr crtc);
void amdgpu_drm_queue_init(ScrnInfoPtr scrn);
void amdgpu_drm_queue_close(ScrnInfoPtr scrn);
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index e1b6b72..7f521b6 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -97,13 +97,6 @@ AMDGPUZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name)
}
-/* Wait for the boolean condition to be FALSE */
-#define drmmode_crtc_wait_pending_event(drmmode_crtc, fd, condition) \
- do {} while ((condition) && \
- drmHandleEvent(fd, &drmmode_crtc->drmmode->event_context) \
- > 0);
-
-
static PixmapPtr drmmode_create_bo_pixmap(ScrnInfoPtr pScrn,
int width, int height,
int depth, int bpp,
@@ -287,8 +280,7 @@ drmmode_do_crtc_dpms(xf86CrtcPtr crtc, int mode)
if (drmmode_crtc->dpms_mode == DPMSModeOn && mode != DPMSModeOn) {
uint32_t seq;
- drmmode_crtc_wait_pending_event(drmmode_crtc, pAMDGPUEnt->fd,
- drmmode_crtc->flip_pending);
+ amdgpu_drm_wait_pending_flip(crtc);
/*
* On->Off transition: record the last vblank time,
@@ -1361,8 +1353,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
goto done;
}
- drmmode_crtc_wait_pending_event(drmmode_crtc, pAMDGPUEnt->fd,
- drmmode_crtc->flip_pending);
+ amdgpu_drm_wait_pending_flip(crtc);
if (!drmmode_set_mode(crtc, fb, mode, x, y))
goto done;
@@ -2329,15 +2320,11 @@ drmmode_output_set_tear_free(AMDGPUEntPtr pAMDGPUEnt,
drmmode_output->tear_free = tear_free;
if (crtc) {
- drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
-
/* Wait for pending flips before drmmode_set_mode_major calls
* drmmode_crtc_update_tear_free, to prevent a nested
* drmHandleEvent call, which would hang
*/
- drmmode_crtc_wait_pending_event(drmmode_crtc,
- pAMDGPUEnt->fd,
- drmmode_crtc->flip_pending);
+ amdgpu_drm_wait_pending_flip(crtc);
drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation,
crtc->x, crtc->y);
}
@@ -3958,8 +3945,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
amdgpu_glamor_flush(crtc->scrn);
if (drmmode_crtc->scanout_update_pending) {
- drmmode_crtc_wait_pending_event(drmmode_crtc, pAMDGPUEnt->fd,
- drmmode_crtc->flip_pending);
+ amdgpu_drm_wait_pending_flip(crtc);
amdgpu_drm_abort_entry(drmmode_crtc->scanout_update_pending);
drmmode_crtc->scanout_update_pending = 0;
}