[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 14:50:07 PDT 2009


This looks ok overall, but I don't like the rename, because it looses
the reference to devPrivates.

On Thu, Sep 10, 2009 at 12:34 AM, Otavio
Salvador<otavio at ossystems.com.br> wrote:
> Most of dependent code is now located in a single place. The macro has
> been changed to use a cleaner name to be easier to spot why it is
> needed.
>
> 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
>
> _______________________________________________
> Xorg-driver-geode mailing list
> Xorg-driver-geode at lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-driver-geode
>


More information about the Xorg-driver-geode mailing list