Hi,

the patch below fixes shadowfb in the xf86-video-nv driver. It should
be useable without an xorg.conf to disable shadowfb now.
Those who are stuck to using nVidia cards with -current, please test.

Apply in /usr/xenocara/driver/xf86-video-nv then rebuid using
make -f Makefile.bsd-wrapper obj
make -f Makefile.bsd-wrapper build

and restart X.

Index: src/nv_driver.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-nv/src/nv_driver.c,v
retrieving revision 1.15
diff -u -r1.15 nv_driver.c
--- src/nv_driver.c     12 May 2013 13:06:25 -0000      1.15
+++ src/nv_driver.c     17 Nov 2013 18:28:05 -0000
@@ -2070,7 +2070,7 @@
 
     /* Load shadowfb if needed */
     if (pNv->ShadowFB) {
-       if (!xf86LoadSubModule(pScrn, "shadowfb")) {
+       if (!xf86LoadSubModule(pScrn, "shadow")) {
            xf86FreeInt10(pNv->pInt);
            NVFreeRec(pScrn);
            return FALSE;
@@ -2378,6 +2378,44 @@
   hwp->writeCrtc(hwp, 0x1A, crtc1A);
 }
 
+static Bool
+NVCreateScreenResources(ScreenPtr pScreen)
+{
+       ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+       NVPtr pNv = NVPTR(pScrn);
+       PixmapPtr pPixmap;
+       Bool ret;
+
+       pScreen->CreateScreenResources = pNv->CreateScreenResources;
+       ret = pScreen->CreateScreenResources(pScreen);
+       pScreen->CreateScreenResources = NVCreateScreenResources;
+
+       if (!ret)
+               return FALSE;
+
+       pPixmap = pScreen->GetScreenPixmap(pScreen);
+
+       if (!shadowAdd(pScreen, pPixmap, NVShadowUpdate,
+               NULL, 0, NULL)) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+static Bool
+NVShadowInit(ScreenPtr pScreen)
+{
+       ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+       NVPtr pNv = NVPTR(pScrn);
+
+       if (!shadowSetup(pScreen))
+               return FALSE;
+       pNv->CreateScreenResources = pScreen->CreateScreenResources;
+       pScreen->CreateScreenResources = NVCreateScreenResources;
+
+       return TRUE;
+}
+
 
 /* Mandatory */
 
@@ -2599,8 +2637,8 @@
                           "Driver rotation enabled, RandR disabled\n");
            }
        }
-
-       ShadowFBInit(pScreen, refreshArea);
+        pNv->refreshArea = refreshArea;
+       NVShadowInit(pScreen);
     }
 
     if(pNv->FlatPanel)
Index: src/nv_local.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-nv/src/nv_local.h,v
retrieving revision 1.2
diff -u -r1.2 nv_local.h
--- src/nv_local.h      29 Jul 2008 20:04:57 -0000      1.2
+++ src/nv_local.h      17 Nov 2013 18:28:05 -0000
@@ -32,6 +32,7 @@
 #include "compiler.h"
 #include "xf86_OSproc.h"
 
+#include "shadow.h"
 /*
  * Typedefs to force certain sized values.
  */
Index: src/nv_proto.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-nv/src/nv_proto.h,v
retrieving revision 1.2
diff -u -r1.2 nv_proto.h
--- src/nv_proto.h      16 Aug 2012 16:35:27 -0000      1.2
+++ src/nv_proto.h      17 Nov 2013 18:28:05 -0000
@@ -49,6 +49,7 @@
 void NVLockUnlock(NVPtr,int);
 
 /* in nv_shadow.c */
+void NVShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf);
 void NVRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
 void NVRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
 void NVRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
Index: src/nv_shadow.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-nv/src/nv_shadow.c,v
retrieving revision 1.2
diff -u -r1.2 nv_shadow.c
--- src/nv_shadow.c     16 Aug 2012 16:35:27 -0000      1.2
+++ src/nv_shadow.c     17 Nov 2013 18:28:05 -0000
@@ -13,6 +13,17 @@
 #include "shadowfb.h"
 #include "servermd.h"
 
+void
+NVShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+    RegionPtr damage = DamageRegion(pBuf->pDamage);
+    ScrnInfoPtr pScrn;
+    pScrn = xf86ScreenToScrn(pScreen);
+
+    (NVPTR(pScrn))->refreshArea (pScrn, REGION_NUM_RECTS(damage),
+       REGION_RECTS(damage));
+}
+
 
 void
 NVRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
Index: src/nv_type.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-nv/src/nv_type.h,v
retrieving revision 1.3
diff -u -r1.3 nv_type.h
--- src/nv_type.h       16 Aug 2012 16:35:27 -0000      1.3
+++ src/nv_type.h       17 Nov 2013 18:28:05 -0000
@@ -133,6 +133,8 @@
     int                 numDGAModes;
     Bool                DGAactive;
     int                 DGAViewportStatus;
+    CreateScreenResourcesProcPtr CreateScreenResources;
+    RefreshAreaFuncPtr refreshArea;
     void               (*PointerMoved)(SCRN_ARG_TYPE arg, int x, int y);
     ScreenBlockHandlerProcPtr BlockHandler;
     CloseScreenProcPtr  CloseScreen;

-- 
Matthieu Herrb

Reply via email to