diff options
author | Tiago Vignatti <tiago.vignatti@nokia.com> | 2010-01-22 18:34:36 +0200 |
---|---|---|
committer | Tiago Vignatti <tiago.vignatti@nokia.com> | 2010-06-03 11:56:03 +0300 |
commit | 6eef70dc56bcc1e3047e4e488bcd6ae62c8ffac6 (patch) | |
tree | 853c72d47df5b4433bcf879c86acf0a51df91294 /hw | |
parent | cdcb575664d3d60b662c542e782de83a047165c9 (diff) |
DRI2: Allow building without libdrm
Some drivers use DRI protocol but implement their own kernel rendering
manager. For these drivers, libdrm becomes useless. --disable-libdrm
configure parameter can be used to disable libdrm support in dri2.
To provide ABI/API compatibility for libdrm based drivers, libdrm call
is wrapped in ifdef.
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xfree86/dri2/dri2.c | 19 | ||||
-rw-r--r-- | hw/xfree86/dri2/dri2.h | 2 | ||||
-rw-r--r-- | hw/xfree86/dri2/dri2ext.c | 1 |
3 files changed, 18 insertions, 4 deletions
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 03255a25d..e1ccdae93 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -35,7 +35,9 @@ #endif #include <errno.h> +#ifdef WITH_LIBDRM #include <xf86drm.h> +#endif #include "xf86Module.h" #include "list.h" #include "scrnintstr.h" @@ -965,7 +967,7 @@ DRI2Connect(ScreenPtr pScreen, unsigned int driverType, int *fd, } Bool -DRI2Authenticate(ScreenPtr pScreen, drm_magic_t magic) +DRI2Authenticate(ScreenPtr pScreen, uint32_t magic) { DRI2ScreenPtr ds = DRI2GetScreen(pScreen); @@ -1045,9 +1047,16 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) ds->AuthMagic = info->AuthMagic; } + /* + * if the driver doesn't provide an AuthMagic function or the info struct + * version is too low, it relies on the old method (using libdrm) or fail + */ if (!ds->AuthMagic) +#ifdef WITH_LIBDRM ds->AuthMagic = drmAuthMagic; - +#else + goto err_out; +#endif /* Initialize minor if needed and set to minimum provied by DDX */ if (!dri2_minor || dri2_minor > cur_minor) @@ -1087,6 +1096,12 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) } return TRUE; + +err_out: + xf86DrvMsg(pScreen->myNum, X_WARNING, + "[DRI2] Initialization failed for info version %d.\n", info->version); + free(ds); + return FALSE; } void diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h index 29b1d9b2e..f08ca29f3 100644 --- a/hw/xfree86/dri2/dri2.h +++ b/hw/xfree86/dri2/dri2.h @@ -206,7 +206,7 @@ extern _X_EXPORT Bool DRI2Connect(ScreenPtr pScreen, const char **driverName, const char **deviceName); -extern _X_EXPORT Bool DRI2Authenticate(ScreenPtr pScreen, drm_magic_t magic); +extern _X_EXPORT Bool DRI2Authenticate(ScreenPtr pScreen, uint32_t magic); extern _X_EXPORT int DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c index e6d98f53b..db04268cb 100644 --- a/hw/xfree86/dri2/dri2ext.c +++ b/hw/xfree86/dri2/dri2ext.c @@ -42,7 +42,6 @@ #include "scrnintstr.h" #include "pixmapstr.h" #include "extnsionst.h" -#include "xf86drm.h" #include "xfixes.h" #include "dri2.h" #include "protocol-versions.h" |