summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2018-12-20 18:48:19 +0100
committerMichel Dänzer <michel@daenzer.net>2018-12-28 12:04:35 +0100
commitf450632077843a95a6ef269febbfb64a605045ed (patch)
treefe1e08d7ecd8a0f35b2fb347233ab604ae4f47ec /src
parent189b6facb3988c00c96d970f8c13ed8d58fa3998 (diff)
Explicitly keep track of whether a DRM event is for a flip or not
When an async flip is performed, and TearFree is enabled on the CRTC used for timing, we schedule a vblank event for completing the page flip. The DRM event queuing code treated this event like a vblank event, but it needs to be treated like a page flip event. (Ported from amdgpu commit e2c7369cae65069aa93eed1c0b678f975ce5c274)
Diffstat (limited to 'src')
-rw-r--r--src/drmmode_display.c3
-rw-r--r--src/radeon_dri2.c4
-rw-r--r--src/radeon_drm_queue.c39
-rw-r--r--src/radeon_drm_queue.h3
-rw-r--r--src/radeon_kms.c10
-rw-r--r--src/radeon_present.c3
6 files changed, 25 insertions, 37 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 831394d4..134b0f72 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -3397,7 +3397,8 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
drm_queue_seq = radeon_drm_queue_alloc(crtc, client, id,
flipdata,
drmmode_flip_handler,
- drmmode_flip_abort);
+ drmmode_flip_abort,
+ TRUE);
if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"Allocating DRM queue event entry failed.\n");
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 4d12fc09..922ed4fb 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -1076,7 +1076,7 @@ static int radeon_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw,
drm_queue_seq = radeon_drm_queue_alloc(crtc, client, RADEON_DRM_QUEUE_ID_DEFAULT,
wait_info, radeon_dri2_frame_event_handler,
- radeon_dri2_frame_event_abort);
+ radeon_dri2_frame_event_abort, FALSE);
if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"Allocating DRM queue event entry failed.\n");
@@ -1215,7 +1215,7 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,
drm_queue_seq = radeon_drm_queue_alloc(crtc, client, RADEON_DRM_QUEUE_ID_DEFAULT,
swap_info, radeon_dri2_frame_event_handler,
- radeon_dri2_frame_event_abort);
+ radeon_dri2_frame_event_abort, FALSE);
if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"Allocating DRM queue entry failed.\n");
diff --git a/src/radeon_drm_queue.c b/src/radeon_drm_queue.c
index ebc6a5b6..acfea3da 100644
--- a/src/radeon_drm_queue.c
+++ b/src/radeon_drm_queue.c
@@ -48,6 +48,7 @@ struct radeon_drm_queue_entry {
xf86CrtcPtr crtc;
radeon_drm_handler_proc handler;
radeon_drm_abort_proc abort;
+ Bool is_flip;
unsigned int frame;
};
@@ -86,8 +87,8 @@ radeon_drm_abort_one(struct radeon_drm_queue_entry *e)
}
static void
-radeon_drm_queue_handler(struct xorg_list *signalled, unsigned int frame,
- unsigned int sec, unsigned int usec, void *user_ptr)
+radeon_drm_queue_handler(int fd, unsigned int frame, unsigned int sec,
+ unsigned int usec, void *user_ptr)
{
uintptr_t seq = (uintptr_t)user_ptr;
struct radeon_drm_queue_entry *e, *tmp;
@@ -102,35 +103,15 @@ radeon_drm_queue_handler(struct xorg_list *signalled, unsigned int frame,
xorg_list_del(&e->list);
e->usec = (uint64_t)sec * 1000000 + usec;
e->frame = frame;
- xorg_list_append(&e->list, signalled);
+ xorg_list_append(&e->list, e->is_flip ?
+ &radeon_drm_flip_signalled :
+ &radeon_drm_vblank_signalled);
break;
}
}
}
/*
- * Signal a DRM page flip event
- */
-static void
-radeon_drm_page_flip_handler(int fd, unsigned int frame, unsigned int sec,
- unsigned int usec, void *user_ptr)
-{
- radeon_drm_queue_handler(&radeon_drm_flip_signalled, frame, sec, usec,
- user_ptr);
-}
-
-/*
- * Signal a DRM vblank event
- */
-static void
-radeon_drm_vblank_handler(int fd, unsigned int frame, unsigned int sec,
- unsigned int usec, void *user_ptr)
-{
- radeon_drm_queue_handler(&radeon_drm_vblank_signalled, frame, sec, usec,
- user_ptr);
-}
-
-/*
* Handle deferred DRM vblank events
*
* This function must be called after radeon_drm_wait_pending_flip, once
@@ -162,7 +143,8 @@ uintptr_t
radeon_drm_queue_alloc(xf86CrtcPtr crtc, ClientPtr client,
uint64_t id, void *data,
radeon_drm_handler_proc handler,
- radeon_drm_abort_proc abort)
+ radeon_drm_abort_proc abort,
+ Bool is_flip)
{
struct radeon_drm_queue_entry *e;
@@ -180,6 +162,7 @@ radeon_drm_queue_alloc(xf86CrtcPtr crtc, ClientPtr client,
e->data = data;
e->handler = handler;
e->abort = abort;
+ e->is_flip = is_flip;
xorg_list_append(&e->list, &radeon_drm_queue);
@@ -306,8 +289,8 @@ radeon_drm_queue_init(ScrnInfoPtr scrn)
drmmode_ptr drmmode = &info->drmmode;
drmmode->event_context.version = 2;
- drmmode->event_context.vblank_handler = radeon_drm_vblank_handler;
- drmmode->event_context.page_flip_handler = radeon_drm_page_flip_handler;
+ drmmode->event_context.vblank_handler = radeon_drm_queue_handler;
+ drmmode->event_context.page_flip_handler = radeon_drm_queue_handler;
if (radeon_drm_queue_refcnt++)
return;
diff --git a/src/radeon_drm_queue.h b/src/radeon_drm_queue.h
index 334c4ca6..19d42e93 100644
--- a/src/radeon_drm_queue.h
+++ b/src/radeon_drm_queue.h
@@ -44,7 +44,8 @@ void radeon_drm_queue_handle_deferred(xf86CrtcPtr crtc);
uintptr_t radeon_drm_queue_alloc(xf86CrtcPtr crtc, ClientPtr client,
uint64_t id, void *data,
radeon_drm_handler_proc handler,
- radeon_drm_abort_proc abort);
+ radeon_drm_abort_proc abort,
+ Bool is_flip);
void radeon_drm_abort_client(ClientPtr client);
void radeon_drm_abort_entry(uintptr_t seq);
void radeon_drm_abort_id(uint64_t id);
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index cd5efd53..a7aade70 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -769,7 +769,8 @@ radeon_prime_scanout_update(PixmapDirtyUpdatePtr dirty)
RADEON_DRM_QUEUE_CLIENT_DEFAULT,
RADEON_DRM_QUEUE_ID_DEFAULT, NULL,
radeon_prime_scanout_update_handler,
- radeon_prime_scanout_update_abort);
+ radeon_prime_scanout_update_abort,
+ FALSE);
if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"radeon_drm_queue_alloc failed for PRIME update\n");
@@ -817,7 +818,7 @@ radeon_prime_scanout_flip(PixmapDirtyUpdatePtr ent)
RADEON_DRM_QUEUE_ID_DEFAULT,
NULL,
radeon_scanout_flip_handler,
- radeon_scanout_flip_abort);
+ radeon_scanout_flip_abort, TRUE);
if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"Allocating DRM event queue entry failed for PRIME flip.\n");
@@ -1053,7 +1054,8 @@ radeon_scanout_update(xf86CrtcPtr xf86_crtc)
RADEON_DRM_QUEUE_ID_DEFAULT,
drmmode_crtc,
radeon_scanout_update_handler,
- radeon_scanout_update_abort);
+ radeon_scanout_update_abort,
+ FALSE);
if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"radeon_drm_queue_alloc failed for scanout update\n");
@@ -1102,7 +1104,7 @@ radeon_scanout_flip(ScreenPtr pScreen, RADEONInfoPtr info,
RADEON_DRM_QUEUE_ID_DEFAULT,
NULL,
radeon_scanout_flip_handler,
- radeon_scanout_flip_abort);
+ radeon_scanout_flip_abort, TRUE);
if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"Allocating DRM event queue entry failed.\n");
diff --git a/src/radeon_present.c b/src/radeon_present.c
index d0a0c68c..0b55117e 100644
--- a/src/radeon_present.c
+++ b/src/radeon_present.c
@@ -157,7 +157,8 @@ radeon_present_queue_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc)
RADEON_DRM_QUEUE_CLIENT_DEFAULT,
event_id, event,
radeon_present_vblank_handler,
- radeon_present_vblank_abort);
+ radeon_present_vblank_abort,
+ FALSE);
if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
free(event);
return BadAlloc;