[PATCH] xfree: dri2: wrap drm bits with macros and change drm_magic type

Kristian Høgsberg krh at bitplanet.net
Mon Feb 1 17:19:44 PST 2010


On Fri, Jan 22, 2010 at 12:04 PM, Tiago Vignatti
<tiago.vignatti at nokia.com> wrote:
> Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
> ---
>  hw/xfree86/dri2/dri2.c    |    7 +++++--
>  hw/xfree86/dri2/dri2.h    |    2 +-
>  hw/xfree86/dri2/dri2ext.c |    2 ++
>  3 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
> index 9505401..845e0e4 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"
> @@ -787,7 +789,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);
>
> @@ -798,9 +800,10 @@ DRI2Authenticate(ScreenPtr pScreen, drm_magic_t magic)
>         if ((*ds->AuthMagic)(ds->fd, magic))
>             return FALSE;
>     }
> +#ifdef WITH_LIBDRM
>     else if (drmAuthMagic(ds->fd, magic))
>         return FALSE;
> -
> +#endif

I would just set ds->AuthMagic = drmAuthMagic in DRI2ScreenInit if the
driver doesn't provide an AuthMagic function or the info struct
version is too low.  And fail DRI2ScreenInit if we're compiling
without libdrm and the driver doesn't provide an AuthMagic
implementation.

cheers,
Kristian


More information about the xorg-devel mailing list