[PATCH v2 xserver] modesetting: fix compile error when --disable-glamor
Qiang Yu
Qiang.Yu at amd.com
Tue Sep 6 03:16:44 UTC 2016
Move ms_flush_drm_events out of GLAMOR ifdef.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97586
Signed-off-by: Qiang Yu <Qiang.Yu at amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
---
hw/xfree86/drivers/modesetting/driver.h | 4 +-
hw/xfree86/drivers/modesetting/pageflip.c | 68 +++++++++++++++----------------
2 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h
index 761490a..5c6e7ce 100644
--- a/hw/xfree86/drivers/modesetting/driver.h
+++ b/hw/xfree86/drivers/modesetting/driver.h
@@ -154,6 +154,8 @@ void ms_vblank_close_screen(ScreenPtr screen);
Bool ms_present_screen_init(ScreenPtr screen);
+int ms_flush_drm_events(ScreenPtr screen);
+
#ifdef GLAMOR
typedef void (*ms_pageflip_handler_proc)(modesettingPtr ms,
@@ -163,8 +165,6 @@ typedef void (*ms_pageflip_handler_proc)(modesettingPtr ms,
typedef void (*ms_pageflip_abort_proc)(modesettingPtr ms, void *data);
-int ms_flush_drm_events(ScreenPtr screen);
-
Bool ms_do_pageflip(ScreenPtr screen,
PixmapPtr new_front,
void *event,
diff --git a/hw/xfree86/drivers/modesetting/pageflip.c b/hw/xfree86/drivers/modesetting/pageflip.c
index a82e0d6..4dc05ec 100644
--- a/hw/xfree86/drivers/modesetting/pageflip.c
+++ b/hw/xfree86/drivers/modesetting/pageflip.c
@@ -29,6 +29,40 @@
#include "driver.h"
+/*
+ * Flush the DRM event queue when full; makes space for new events.
+ *
+ * Returns a negative value on error, 0 if there was nothing to process,
+ * or 1 if we handled any events.
+ */
+int
+ms_flush_drm_events(ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ modesettingPtr ms = modesettingPTR(scrn);
+
+ struct pollfd p = { .fd = ms->fd, .events = POLLIN };
+ int r;
+
+ do {
+ r = xserver_poll(&p, 1, 0);
+ } while (r == -1 && (errno == EINTR || errno == EAGAIN));
+
+ /* If there was an error, r will be < 0. Return that. If there was
+ * nothing to process, r == 0. Return that.
+ */
+ if (r <= 0)
+ return r;
+
+ /* Try to handle the event. If there was an error, return it. */
+ r = drmHandleEvent(ms->fd, &ms->event_context);
+ if (r < 0)
+ return r;
+
+ /* Otherwise return 1 to indicate that we handled an event. */
+ return 1;
+}
+
#ifdef GLAMOR
/*
@@ -125,40 +159,6 @@ ms_pageflip_abort(void *data)
ms_pageflip_free(flip);
}
-/*
- * Flush the DRM event queue when full; makes space for new events.
- *
- * Returns a negative value on error, 0 if there was nothing to process,
- * or 1 if we handled any events.
- */
-int
-ms_flush_drm_events(ScreenPtr screen)
-{
- ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
- modesettingPtr ms = modesettingPTR(scrn);
-
- struct pollfd p = { .fd = ms->fd, .events = POLLIN };
- int r;
-
- do {
- r = xserver_poll(&p, 1, 0);
- } while (r == -1 && (errno == EINTR || errno == EAGAIN));
-
- /* If there was an error, r will be < 0. Return that. If there was
- * nothing to process, r == 0. Return that.
- */
- if (r <= 0)
- return r;
-
- /* Try to handle the event. If there was an error, return it. */
- r = drmHandleEvent(ms->fd, &ms->event_context);
- if (r < 0)
- return r;
-
- /* Otherwise return 1 to indicate that we handled an event. */
- return 1;
-}
-
static Bool
queue_flip_on_crtc(ScreenPtr screen, xf86CrtcPtr crtc,
struct ms_flipdata *flipdata,
--
2.7.4
More information about the xorg-devel
mailing list