mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 01:50:42 -05:00
glx: Depend on libdrm
DRM is available on more platforms than Linux (e.g. kFreeBSD), but Clutter currently FTBFS there because of not being an alternative to the __linux__ code (where it should be HAVE_DRM). Instead of copying the DRM data structures, we should use libdrm when falling back to directly requesting to wait for the vblank. http://bugzilla.clutter-project.org/show_bug.cgi?id=2225 Based on a patch by: Emilio Pozuelo Monfort <pochu27@gmail.com> Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
parent
28378f1bb4
commit
1943b8e544
@ -53,32 +53,9 @@
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#define DRM_VBLANK_RELATIVE 0x1;
|
||||
|
||||
struct drm_wait_vblank_request {
|
||||
int type;
|
||||
unsigned int sequence;
|
||||
unsigned long signal;
|
||||
};
|
||||
|
||||
struct drm_wait_vblank_reply {
|
||||
int type;
|
||||
unsigned int sequence;
|
||||
long tval_sec;
|
||||
long tval_usec;
|
||||
};
|
||||
|
||||
typedef union drm_wait_vblank {
|
||||
struct drm_wait_vblank_request request;
|
||||
struct drm_wait_vblank_reply reply;
|
||||
} drm_wait_vblank_t;
|
||||
|
||||
#define DRM_IOCTL_BASE 'd'
|
||||
#define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type)
|
||||
#define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, drm_wait_vblank_t)
|
||||
|
||||
#endif /* __linux__ */
|
||||
#ifdef HAVE_DRM
|
||||
#include <drm.h>
|
||||
#endif
|
||||
|
||||
static void clutter_stage_window_iface_init (ClutterStageWindowIface *iface);
|
||||
|
||||
@ -462,7 +439,7 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
|
||||
/* the rest is inherited from ClutterStageX11 */
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef HAVE_DRM
|
||||
static int
|
||||
drm_wait_vblank(int fd, drm_wait_vblank_t *vbl)
|
||||
{
|
||||
@ -471,14 +448,14 @@ drm_wait_vblank(int fd, drm_wait_vblank_t *vbl)
|
||||
do
|
||||
{
|
||||
ret = ioctl(fd, DRM_IOCTL_WAIT_VBLANK, vbl);
|
||||
vbl->request.type &= ~DRM_VBLANK_RELATIVE;
|
||||
vbl->request.type &= ~_DRM_VBLANK_RELATIVE;
|
||||
rc = errno;
|
||||
}
|
||||
while (ret && rc == EINTR);
|
||||
|
||||
return rc;
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
#endif /* HAVE_DRM */
|
||||
|
||||
static void
|
||||
wait_for_vblank (ClutterBackendGLX *backend_glx)
|
||||
@ -496,18 +473,20 @@ wait_for_vblank (ClutterBackendGLX *backend_glx)
|
||||
(retraceCount + 1) % 2,
|
||||
&retraceCount);
|
||||
}
|
||||
#ifdef __linux__
|
||||
else
|
||||
{
|
||||
#ifdef HAVE_DRM
|
||||
drm_wait_vblank_t blank;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Waiting for vblank (drm)");
|
||||
blank.request.type = DRM_VBLANK_RELATIVE;
|
||||
blank.request.type = _DRM_VBLANK_RELATIVE;
|
||||
blank.request.sequence = 1;
|
||||
blank.request.signal = 0;
|
||||
drm_wait_vblank (backend_glx->dri_fd, &blank);
|
||||
#else
|
||||
CLUTTER_NOTE (BACKEND, "No vblank mechanism found");
|
||||
#endif /* HAVE_DRM */
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -180,6 +180,14 @@ AS_CASE([$CLUTTER_FLAVOUR],
|
||||
# if a pkg-config file isn't found just add -lGL
|
||||
# and hope for the best.
|
||||
[FLAVOUR_LIBS="$FLAVOUR_LIBS -lGL"])
|
||||
|
||||
# We might fall back to DRM for sync-to-vblank on GLX
|
||||
PKG_CHECK_EXISTS([libdrm],
|
||||
[
|
||||
AC_DEFINE([HAVE_DRM], [1], [Have libdrm support])
|
||||
BACKEND_PC_FILES="$BACKEND_PC_FILES libdrm"
|
||||
],
|
||||
[])
|
||||
],
|
||||
|
||||
[opengl-egl-xlib],
|
||||
|
Loading…
Reference in New Issue
Block a user