From e3c7c50a0a17953d1993907901b8d4439fe1dc91 Mon Sep 17 00:00:00 2001 From: George Fufutos Date: Thu, 20 Apr 2006 03:40:41 +0300 Subject: [PATCH] Consolidate ATIXVInitializeAdaptor with ATIMach64XVInitialiseAdaptor. From nobody Mon Sep 17 00:00:00 2001 From: George Fufutos Date: Thu Apr 20 03:51:18 2006 +0300 Subject: [PATCH] Move ATIInitializeXVideo to atimach64xv.c . --- src/Makefile.am | 3 +- src/atimach64xv.c | 51 +++++++++++++++++++++++++++++++++ src/atimach64xv.h | 2 + src/atipreinit.c | 2 + src/atiscreen.c | 6 ++-- src/atixv.c | 81 ----------------------------------------------------- src/atixv.h | 34 ---------------------- 7 files changed, 58 insertions(+), 121 deletions(-) delete mode 100644 src/atixv.c delete mode 100644 src/atixv.h 61013bf6da0159776d349ca78d6e0076d2fded3e diff --git a/src/Makefile.am b/src/Makefile.am index 2c5f122..9c8304a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -53,7 +53,7 @@ mach64_drv_la_SOURCES = \ atidecoder.c atidsp.c atii2c.c atilock.c atimach64.c atimach64accel.c \ atimach64cursor.c atimach64i2c.c atimach64io.c atimach64xv.c \ atimode.c atipreinit.c atiprint.c atirgb514.c atiscreen.c \ - atituner.c atiutil.c ativalid.c atixv.c atiload.c ati.c \ + atituner.c atiutil.c ativalid.c atiload.c ati.c \ $(ATIMISC_DRI_SRCS) $(ATIMISC_DGA_SOURCES) $(ATI_CPIO_SOURCES) \ $(ATIMISC_EXA_SOURCES) @@ -102,7 +102,6 @@ EXTRA_DIST = \ atividmem.h \ atiwonder.h \ atiwonderio.h \ - atixv.h \ mach64_common.h \ mach64_dri.h \ mach64_sarea.h diff --git a/src/atimach64xv.c b/src/atimach64xv.c index 9a3d034..5309ce6 100644 --- a/src/atimach64xv.c +++ b/src/atimach64xv.c @@ -1513,6 +1513,27 @@ ( } /* + * ATIXVFreeAdaptorInfo -- + * + * Free XVideo adaptor information. + */ +static void +ATIXVFreeAdaptorInfo +( + XF86VideoAdaptorPtr *ppAdaptor, + int nAdaptor +) +{ + if (!ppAdaptor) + return; + + while (nAdaptor > 0) + xfree(ppAdaptor[--nAdaptor]); + + xfree(ppAdaptor); +} + +/* * ATIXVPreInit -- * * This function is called by ATIPreInit() to set up the environment required @@ -1531,6 +1552,36 @@ #ifndef AVOID_CPIO #endif /* AVOID_CPIO */ (void)xf86XVRegisterGenericAdaptorDriver(ATIMach64XVInitialiseAdaptor); +} + +/* + * ATIInitializeXVideo -- + * + * This function is called to initialise XVideo extension support on a screen. + */ +Bool +ATIInitializeXVideo +( + ScreenPtr pScreen, + ScrnInfoPtr pScreenInfo, + ATIPtr pATI +) +{ + XF86VideoAdaptorPtr *ppAdaptor; + int nAdaptor; + Bool result; + + if (!(pScreenInfo->memPhysBase = pATI->LinearBase)) + return FALSE; + + pScreenInfo->fbOffset = 0; + + nAdaptor = xf86XVListGenericAdaptors(pScreenInfo, &ppAdaptor); + result = xf86XVScreenInit(pScreen, ppAdaptor, nAdaptor); + + ATIXVFreeAdaptorInfo(ppAdaptor, nAdaptor); + + return result; } /* diff --git a/src/atimach64xv.h b/src/atimach64xv.h index bed7048..6aaed2f 100644 --- a/src/atimach64xv.h +++ b/src/atimach64xv.h @@ -29,6 +29,8 @@ #include "atipriv.h" #include "xf86str.h" #include "xf86xv.h" +extern void ATIXVPreInit(ATIPtr); +extern Bool ATIInitializeXVideo(ScreenPtr, ScrnInfoPtr, ATIPtr); extern void ATIMach64CloseXVideo(ScreenPtr, ScrnInfoPtr, ATIPtr); #endif /* ___ATIMACH64XV_H___ */ diff --git a/src/atipreinit.c b/src/atipreinit.c index 6297c5f..f334b27 100644 --- a/src/atipreinit.c +++ b/src/atipreinit.c @@ -46,12 +46,12 @@ #include "atimach64.h" #include "atimach64accel.h" #include "atimach64cursor.h" #include "atimach64io.h" +#include "atimach64xv.h" #include "atimode.h" #include "atipreinit.h" #include "atiprint.h" #include "atividmem.h" #include "atiwonderio.h" -#include "atixv.h" #include "vbe.h" #include "xf86RAC.h" diff --git a/src/atiscreen.c b/src/atiscreen.c index 05fb43c..537622f 100644 --- a/src/atiscreen.c +++ b/src/atiscreen.c @@ -39,12 +39,12 @@ #include "atidac.h" #include "atidga.h" #include "atidri.h" #include "atimach64.h" +#include "atimach64accel.h" +#include "atimach64cursor.h" +#include "atimach64xv.h" #include "atimode.h" #include "atiscreen.h" #include "atistruct.h" -#include "atixv.h" -#include "atimach64accel.h" -#include "atimach64cursor.h" #ifdef XF86DRI_DEVEL #include "mach64_dri.h" diff --git a/src/atixv.c b/src/atixv.c deleted file mode 100644 index bd0cb83..0000000 --- a/src/atixv.c +++ /dev/null @@ -1,81 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.c,v 1.5 2003/04/25 04:09:54 tsi Exp $ */ -/* - * Copyright 2001 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of Marc Aurele La France not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Marc Aurele La France makes no representations - * about the suitability of this software for any purpose. It is provided - * "as-is" without express or implied warranty. - * - * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO - * EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "atimach64xv.h" -#include "atistruct.h" -#include "atixv.h" - -/* - * ATIXVFreeAdaptorInfo -- - * - * Free XVideo adaptor information. - */ -static void -ATIXVFreeAdaptorInfo -( - XF86VideoAdaptorPtr *ppAdaptor, - int nAdaptor -) -{ - if (!ppAdaptor) - return; - - while (nAdaptor > 0) - xfree(ppAdaptor[--nAdaptor]); - - xfree(ppAdaptor); -} - -/* - * ATIInitializeXVideo -- - * - * This function is called to initialise XVideo extension support on a screen. - */ -Bool -ATIInitializeXVideo -( - ScreenPtr pScreen, - ScrnInfoPtr pScreenInfo, - ATIPtr pATI -) -{ - XF86VideoAdaptorPtr *ppAdaptor; - int nAdaptor; - Bool result; - - if (!(pScreenInfo->memPhysBase = pATI->LinearBase)) - return FALSE; - - pScreenInfo->fbOffset = 0; - - nAdaptor = xf86XVListGenericAdaptors(pScreenInfo, &ppAdaptor); - result = xf86XVScreenInit(pScreen, ppAdaptor, nAdaptor); - - ATIXVFreeAdaptorInfo(ppAdaptor, nAdaptor); - - return result; -} diff --git a/src/atixv.h b/src/atixv.h deleted file mode 100644 index fe5d119..0000000 --- a/src/atixv.h +++ /dev/null @@ -1,34 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.h,v 1.4 2003/04/23 21:51:31 tsi Exp $ */ -/* - * Copyright 2001 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of Marc Aurele La France not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Marc Aurele La France makes no representations - * about the suitability of this software for any purpose. It is provided - * "as-is" without express or implied warranty. - * - * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO - * EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef ___ATIXV_H___ -#define ___ATIXV_H___ 1 - -#include "atipriv.h" - -#include "xf86str.h" - -extern void ATIXVPreInit(ATIPtr); -extern Bool ATIInitializeXVideo(ScreenPtr, ScrnInfoPtr, ATIPtr); - -#endif /* ___ATIXV_H___ */ -- 1.3.0.rc3.g944e-dirty --- src/atimach64xv.c | 53 +++++++++++++++++++++++++++++++++-------- src/atimach64xv.h | 3 --- src/atiscreen.c | 2 +- src/atixv.c | 70 ------------------------------------------------------- src/atixv.h | 1 - 5 files changed, 44 insertions(+), 85 deletions(-) diff --git a/src/atimach64xv.c b/src/atimach64xv.c index 9c8f8a1..9a3d034 100644 --- a/src/atimach64xv.c +++ b/src/atimach64xv.c @@ -1405,26 +1405,27 @@ static XF86OffscreenImageRec ATIMach64Surface_C[] = * This function is called to make a Mach64's hardware overlay support * available as an XVideo adaptor. */ -int +static int ATIMach64XVInitialiseAdaptor ( - ScreenPtr pScreen, ScrnInfoPtr pScreenInfo, - ATIPtr pATI, XF86VideoAdaptorPtr **pppAdaptor ) { - XF86VideoAdaptorPtr pAdaptor; - int Index; + ScreenPtr pScreen = screenInfo.screens[pScreenInfo->scrnIndex]; + ATIPtr pATI = ATIPTR(pScreenInfo); + XF86VideoAdaptorPtr pAdaptor; + XF86VideoAdaptorPtr *ppAdaptor = NULL; if (!pATI->Block1Base) return 0; - if (!(pAdaptor = xf86XVAllocateVideoAdaptorRec(pScreenInfo))) + pAdaptor = xf86XVAllocateVideoAdaptorRec(pScreenInfo); + if (!pAdaptor) return 0; - *pppAdaptor = xnfalloc(sizeof(pAdaptor)); - **pppAdaptor = pAdaptor; + ppAdaptor = xnfalloc(sizeof(pAdaptor)); + ppAdaptor[0] = pAdaptor; pAdaptor->nPorts = 1; pAdaptor->pPortPrivates = pATI->XVPortPrivate; @@ -1471,8 +1472,9 @@ ATIMach64XVInitialiseAdaptor REGION_NULL(pScreen, &pATI->VideoClip); pATI->ActiveSurface = FALSE; - if (ATIMach64XVAtomGeneration != serverGeneration) - { + if (ATIMach64XVAtomGeneration != serverGeneration) { + int Index; + /* Refresh static data */ ATIMach64XVAtomGeneration = serverGeneration; @@ -1500,9 +1502,37 @@ ATIMach64XVInitialiseAdaptor ATIMach64Surface_C, nATIMach64Surface_C); } + if (pppAdaptor) + *pppAdaptor = ppAdaptor; + else { + xfree(ppAdaptor[0]); + xfree(ppAdaptor); + } + return 1; } +/* + * ATIXVPreInit -- + * + * This function is called by ATIPreInit() to set up the environment required + * to support the XVideo extension. + */ +void +ATIXVPreInit(ATIPtr pATI) +{ + +#ifndef AVOID_CPIO + + /* Currently a linear aperture is needed ... */ + if (!pATI->LinearBase) + return; + +#endif /* AVOID_CPIO */ + + (void)xf86XVRegisterGenericAdaptorDriver(ATIMach64XVInitialiseAdaptor); +} + /* * ATIMach64CloseXVideo -- * @@ -1522,6 +1552,9 @@ ATIMach64CloseXVideo REGION_UNINIT(pScreen, &pATI->VideoClip); } +/* + * Offscreen memory management functions for Mach64 XVideo support. + */ #ifdef USE_XAA static FBLinearPtr ATIResizeOffscreenLinear diff --git a/src/atimach64xv.h b/src/atimach64xv.h index 8f5257c..bed7048 100644 --- a/src/atimach64xv.h +++ b/src/atimach64xv.h @@ -29,9 +29,6 @@ #include "xf86str.h" #include "xf86xv.h" -extern int ATIMach64XVInitialiseAdaptor(ScreenPtr, ScrnInfoPtr, ATIPtr, - XF86VideoAdaptorPtr **); - extern void ATIMach64CloseXVideo(ScreenPtr, ScrnInfoPtr, ATIPtr); #endif /* ___ATIMACH64XV_H___ */ diff --git a/src/atiscreen.c b/src/atiscreen.c index b907f46..05fb43c 100644 --- a/src/atiscreen.c +++ b/src/atiscreen.c @@ -663,7 +663,7 @@ ATICloseScreen #endif /* XF86DRI_DEVEL */ - ATICloseXVideo(pScreen, pScreenInfo, pATI); + ATIMach64CloseXVideo(pScreen, pScreenInfo, pATI); #ifdef USE_EXA if (pATI->pExa) diff --git a/src/atixv.c b/src/atixv.c index c0c258c..bd0cb83 100644 --- a/src/atixv.c +++ b/src/atixv.c @@ -50,59 +50,6 @@ ATIXVFreeAdaptorInfo xfree(ppAdaptor); } -/* - * ATIXVInitializeAdaptor -- - * - * This is called by the server's XVideo support layer to initialise an XVideo - * adapter. - */ -static int -ATIXVInitializeAdaptor -( - ScrnInfoPtr pScreenInfo, - XF86VideoAdaptorPtr **pppAdaptor -) -{ - ScreenPtr pScreen = screenInfo.screens[pScreenInfo->scrnIndex]; - ATIPtr pATI = ATIPTR(pScreenInfo); - XF86VideoAdaptorPtr *ppAdaptor = NULL; - int nAdaptor; - - nAdaptor = ATIMach64XVInitialiseAdaptor(pScreen, pScreenInfo, pATI, - &ppAdaptor); - - if (pppAdaptor) - *pppAdaptor = ppAdaptor; - else - ATIXVFreeAdaptorInfo(ppAdaptor, nAdaptor); - - return nAdaptor; -} - -/* - * ATIXVPreInit -- - * - * This function is called by ATIPreInit() to set up the environment required - * to support the XVideo extension. - */ -void -ATIXVPreInit -( - ATIPtr pATI -) -{ - -#ifndef AVOID_CPIO - - /* Currently a linear aperture is needed ... */ - if (!pATI->LinearBase) - return; - -#endif /* AVOID_CPIO */ - - (void)xf86XVRegisterGenericAdaptorDriver(ATIXVInitializeAdaptor); -} - /* * ATIInitializeXVideo -- * @@ -132,20 +79,3 @@ ATIInitializeXVideo return result; } - -/* - * ATICloseXVideo -- - * - * This function is called during screen termination to clean up after XVideo - * initialisation. - */ -void -ATICloseXVideo -( - ScreenPtr pScreen, - ScrnInfoPtr pScreenInfo, - ATIPtr pATI -) -{ - ATIMach64CloseXVideo(pScreen, pScreenInfo, pATI); -} diff --git a/src/atixv.h b/src/atixv.h index 64674de..fe5d119 100644 --- a/src/atixv.h +++ b/src/atixv.h @@ -30,6 +30,5 @@ extern void ATIXVPreInit(ATIPtr); extern Bool ATIInitializeXVideo(ScreenPtr, ScrnInfoPtr, ATIPtr); -extern void ATICloseXVideo(ScreenPtr, ScrnInfoPtr, ATIPtr); #endif /* ___ATIXV_H___ */ -- cgit v1.2.3