[PATCH v3 3/4] xfree86/dri2: wrap drm bits with macros and change drm_magic type
Mark Kettenis
mark.kettenis at xs4all.nl
Wed Apr 21 02:53:04 PDT 2010
> From: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
> Date: Wed, 21 Apr 2010 11:40:37 +0300
I'll reiterate an opinion stated here before. We should really try to
*reduce* the number of #ifdefs in the code base, not introduce new
ones.
> diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
> index 8d2acf0..e60b3a4 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 "scrnintstr.h"
> #include "windowstr.h"
> @@ -791,7 +793,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);
>
> @@ -848,8 +850,11 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
> }
>
> 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)
> @@ -886,6 +891,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);
> + xfree(ds);
> + return FALSE;
> }
>
> void
> diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
> index ea48ee9..0a14094 100644
> --- a/hw/xfree86/dri2/dri2.h
> +++ b/hw/xfree86/dri2/dri2.h
> @@ -202,7 +202,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(DrawablePtr pDraw);
>
> diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
> index 17df130..e8fd749 100644
> --- a/hw/xfree86/dri2/dri2ext.c
> +++ b/hw/xfree86/dri2/dri2ext.c
> @@ -42,7 +42,9 @@
> #include "scrnintstr.h"
> #include "pixmapstr.h"
> #include "extnsionst.h"
> +#ifdef WITH_LIBDRM
> #include "xf86drm.h"
> +#endif
> #include "xfixes.h"
> #include "dri2.h"
> #include "protocol-versions.h"
More information about the xorg-devel
mailing list