summaryrefslogtreecommitdiff
path: root/src/radeon_dri2.h
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2012-07-13 11:15:25 +0200
committerMichel Dänzer <michel@daenzer.net>2012-07-13 11:15:25 +0200
commit6ef1ad6a46348d3aecd8d1f5e94431ca2298853c (patch)
treeec19a154ec7a0b5d8393d6b8556eb600b04a21be /src/radeon_dri2.h
parentef8a404391036d8aa814dbda2407c789b8a64b92 (diff)
Deal more gracefully with DRI2 being unavailable at build or run time.
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Diffstat (limited to 'src/radeon_dri2.h')
-rw-r--r--src/radeon_dri2.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/radeon_dri2.h b/src/radeon_dri2.h
index 0dd2a33c..aaad0ca9 100644
--- a/src/radeon_dri2.h
+++ b/src/radeon_dri2.h
@@ -27,13 +27,18 @@
#ifndef RADEON_DRI2_H
#define RADEON_DRI2_H
+#include <xorg-server.h>
+
struct radeon_dri2 {
drmVersionPtr pKernelDRMVersion;
int drm_fd;
+ Bool available;
Bool enabled;
char *device_name;
};
+#ifdef DRI2
+
#include "dri2.h"
Bool radeon_dri2_screen_init(ScreenPtr pScreen);
void radeon_dri2_close_screen(ScreenPtr pScreen);
@@ -46,4 +51,42 @@ void radeon_dri2_frame_event_handler(unsigned int frame, unsigned int tv_sec,
void radeon_dri2_flip_event_handler(unsigned int frame, unsigned int tv_sec,
unsigned int tv_usec, void *event_data);
+#else
+
+static inline Bool radeon_dri2_screen_init(ScreenPtr pScreen) { return FALSE; }
+static inline void radeon_dri2_close_screen(ScreenPtr pScreen) {}
+
+static inline void
+radeon_dri2_dummy_event_handler(unsigned int frame, unsigned int tv_sec,
+ unsigned int tv_usec, void *event_data,
+ const char *name)
+{
+ static Bool warned;
+
+ if (!warned) {
+ ErrorF("%s called but DRI2 disabled at build time\n", name);
+ warned = TRUE;
+ }
+
+ free(event_data);
+}
+
+static inline void
+radeon_dri2_frame_event_handler(unsigned int frame, unsigned int tv_sec,
+ unsigned int tv_usec, void *event_data)
+{
+ radeon_dri2_dummy_event_handler(frame, tv_sec, tv_usec, event_data,
+ __func__);
+}
+
+static inline void
+radeon_dri2_flip_event_handler(unsigned int frame, unsigned int tv_sec,
+ unsigned int tv_usec, void *event_data)
+{
+ radeon_dri2_dummy_event_handler(frame, tv_sec, tv_usec, event_data,
+ __func__);
+}
+
#endif
+
+#endif /* RADEON_DRI2_H */