From bf262b43007050180d336defd48251de80894801 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 26 Jan 2015 21:25:58 -0800 Subject: [PATCH] modesetting: Implement an ms_drm_abort_seq() function. This is a specialization of ms_drm_abort that matches based on the drm event queue's sequence number. Based on code by Keith Packard. Reviewed-by: Eric Anholt Reviewed-by: Dave Airlie Signed-off-by: Kenneth Graunke --- hw/xfree86/drivers/modesetting/driver.h | 1 + hw/xfree86/drivers/modesetting/vblank.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h index 4b6ae87fa..843a105ed 100644 --- a/hw/xfree86/drivers/modesetting/driver.h +++ b/hw/xfree86/drivers/modesetting/driver.h @@ -117,6 +117,7 @@ uint32_t ms_drm_queue_alloc(xf86CrtcPtr crtc, void ms_drm_abort(ScrnInfoPtr scrn, Bool (*match)(void *data, void *match_data), void *match_data); +void ms_drm_abort_seq(ScrnInfoPtr scrn, uint32_t seq); Bool ms_crtc_on(xf86CrtcPtr crtc); diff --git a/hw/xfree86/drivers/modesetting/vblank.c b/hw/xfree86/drivers/modesetting/vblank.c index 91cfcf2d5..776dcef9b 100644 --- a/hw/xfree86/drivers/modesetting/vblank.c +++ b/hw/xfree86/drivers/modesetting/vblank.c @@ -323,6 +323,22 @@ ms_drm_abort_scrn(ScrnInfoPtr scrn) } } +/** + * Abort by drm queue sequence number. + */ +void +ms_drm_abort_seq(ScrnInfoPtr scrn, uint32_t seq) +{ + struct ms_drm_queue *q, *tmp; + + xorg_list_for_each_entry_safe(q, tmp, &ms_drm_queue, list) { + if (q->seq == seq) { + ms_drm_abort_one(q); + break; + } + } +} + /* * Externally usable abort function that uses a callback to match a single * queued entry to abort