[PATCH 1/2] Use screen privates for Xv offscreen images.

Jamey Sharp jamey at minilop.net
Wed Apr 21 21:08:28 PDT 2010


The DIX-layer Xv implementation provides a DDX-private hook for
per-screen data, which the xfree86 DDX was already using.

This extends that use to include offscreen surface records, replacing a
globally-allocated array that depended on MAXSCREENS.

Signed-off-by: Jamey Sharp <jamey at minilop.net>
---
 hw/xfree86/common/xf86xv.c     |   20 ++++++--------------
 hw/xfree86/common/xf86xvpriv.h |    2 ++
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index bdcc4fc..8367f44 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -181,21 +181,15 @@ xf86XVListGenericAdaptors(
 
 /****************  Offscreen surface stuff *******************/
 
-typedef struct {
-   XF86OffscreenImagePtr images;
-   int num;
-} OffscreenImageRec;
-
-static OffscreenImageRec OffscreenImages[MAXSCREENS];
-
 Bool
 xf86XVRegisterOffscreenImages(
     ScreenPtr pScreen,
     XF86OffscreenImagePtr images,
     int num
 ){
-    OffscreenImages[pScreen->myNum].num = num;
-    OffscreenImages[pScreen->myNum].images = images;
+    XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
+    ScreenPriv->num = num;
+    ScreenPriv->images = images;
 
     return TRUE;
 }
@@ -205,8 +199,9 @@ xf86XVQueryOffscreenImages(
    ScreenPtr pScreen,
    int *num
 ){
-   *num = OffscreenImages[pScreen->myNum].num;
-   return OffscreenImages[pScreen->myNum].images;
+   XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
+   *num = ScreenPriv->num;
+   return ScreenPriv->images;
 }
 
 
@@ -1177,9 +1172,6 @@ xf86XVCloseScreen(int i, ScreenPtr pScreen)
   XvAdaptorPtr pa;
   int c;
 
-  /* Clear offscreen images */
-  memset(&OffscreenImages[pScreen->myNum], 0, sizeof(OffscreenImages[0]));
-
   if(!ScreenPriv) return TRUE;
 
   if(ScreenPriv->videoGC) {
diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h
index 7623d29..7ac38a3 100644
--- a/hw/xfree86/common/xf86xvpriv.h
+++ b/hw/xfree86/common/xf86xvpriv.h
@@ -44,6 +44,8 @@ typedef struct {
    Bool                         (*EnterVT)(int, int);
    void                         (*LeaveVT)(int, int);
    GCPtr			videoGC;
+   XF86OffscreenImagePtr        images;
+   int                          num;
 } XF86XVScreenRec, *XF86XVScreenPtr;
 
 typedef struct {
-- 
1.7.0



More information about the xorg-devel mailing list