mirror of
https://github.com/X11Libre/xf86-video-ati.git
synced 2026-03-24 01:24:43 +00:00
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)
This commit is contained in:
committed by
Michel Dänzer
parent
189b6facb3
commit
f450632077
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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,34 +103,14 @@ 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
|
||||
*
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user