[Xorg-driver-geode] [PATCH 2/3] GX: refactor code that allow backward compatibility with old video interfaces

Martin-Éric Racine q-funk at iki.fi
Wed Sep 9 03:07:57 PDT 2009


Can you please submit these to the Geode list for comments?
Thanks!

2009/9/9 Otavio Salvador <otavio at ossystems.com.br>:
> Most of dependent code is not located in a single place. The macro
> that is defined is also with a cleaner name to makes easier to spot
> why it is there.
>
> Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
> ---
>  src/gx_randr.c |   23 +++++++++++------------
>  1 files changed, 11 insertions(+), 12 deletions(-)
>
> diff --git a/src/gx_randr.c b/src/gx_randr.c
> index 2669912..91ca43e 100644
> --- a/src/gx_randr.c
> +++ b/src/gx_randr.c
> @@ -56,15 +56,17 @@ typedef struct _GXRandRInfo
>     Rotation supported_rotations;      /* driver supported */
>  } XF86RandRInfoRec, *XF86RandRInfoPtr;
>
> -#define AMD_OLDPRIV (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 4)
> -
>  static int GXRandRIndex;
>
> -#if AMD_OLDPRIV
> -#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) (p)->devPrivates[GXRandRIndex].ptr)
> +#define OLD_VIDEODRV_INTERFACE (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 4)
> +
> +#if OLD_VIDEODRV_INTERFACE
> +#define XF86RANDRINFO(p)   ((XF86RandRInfoPtr) (p)->devPrivates[GXRandRIndex].ptr)
> +#define XF86RANDRSET(p, v) (p)->devPrivates[GXRandRIndex].ptr = v
>  #else
> -#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \
> -                         dixLookupPrivate(&(p)->devPrivates, &GXRandRIndex));
> +#define XF86RANDRINFO(p) ((XF86RandRInfoPtr)                                           \
> +                         dixLookupPrivate(&(p)->devPrivates, &GXRandRIndex))
> +#define XF86RANDRSET(p, v) dixSetPrivate(&(p)->devPrivates, &GXRandRIndex, v)
>  #endif
>
>  static int
> @@ -327,7 +329,7 @@ GXRandRInit(ScreenPtr pScreen, int rotation)
>     if (GXRandRGeneration != serverGeneration) {
>        GXRandRGeneration = serverGeneration;
>     }
> -#if AMD_OLDPRIV
> +#if OLD_VIDEODRV_INTERFACE
>     GXRandRIndex = AllocateScreenPrivateIndex();
>  #endif
>
> @@ -354,10 +356,7 @@ GXRandRInit(ScreenPtr pScreen, int rotation)
>     pRandr->supported_rotations = rotation;
>     pRandr->maxX = pRandr->maxY = 0;
>
> -#if AMD_OLDPRIV
> -    pScreen->devPrivates[GXRandRIndex].ptr = pRandr;
> -#else
> -    dixSetPrivate(&pScreen->devPrivates, &GXRandRIndex, pRandr);
> -#endif
> +    XF86RANDRSET(pScreen, pRandr);
> +
>     return TRUE;
>  }
> --
> 1.6.3.3.385.g60647
>
>


More information about the Xorg-driver-geode mailing list