xf86-video-intel: uxa/uxa.c uxa/uxa-priv.h uxa/uxa-render.c

Eric Anholt anholt at kemper.freedesktop.org
Fri Dec 5 12:14:31 PST 2008


 uxa/uxa-priv.h   |    5 ++++-
 uxa/uxa-render.c |    2 +-
 uxa/uxa.c        |   22 ++++++++++++++++++++++
 3 files changed, 27 insertions(+), 2 deletions(-)

New commits:
commit 261c20a479f6ec1e94c2ba801323072227cc3ade
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Dec 5 12:13:26 2008 -0800

    uxa: Add in EnableDisableFBAccess handling like examodule.c did.
    
    This fixes assertion failures when rendering text while VT switched.

diff --git a/uxa/uxa-priv.h b/uxa/uxa-priv.h
index 1353587..0f9cfbf 100644
--- a/uxa/uxa-priv.h
+++ b/uxa/uxa-priv.h
@@ -31,6 +31,7 @@
 #else
 #include <xorg-server.h>
 #endif
+#include "xf86.h"
 
 #include "uxa.h"
 
@@ -117,6 +118,7 @@ typedef struct {
 
 #define UXA_NUM_GLYPH_CACHES 4
 
+typedef void (*EnableDisableFBAccessProcPtr)(int, Bool);
 typedef struct {
     uxa_driver_t		*info;
     CreateGCProcPtr 		 SavedCreateGC;
@@ -135,7 +137,8 @@ typedef struct {
     TrapezoidsProcPtr            SavedTrapezoids;
     AddTrapsProcPtr		 SavedAddTraps;
 #endif
-  
+    EnableDisableFBAccessProcPtr SavedEnableDisableFBAccess;
+
     Bool			 swappedOut;
     unsigned			 disableFbCount;
     unsigned			 offScreenCounter;
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 94e18a5..b2d3297 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -323,7 +323,7 @@ uxa_try_driver_composite_rects(CARD8		    op,
     int src_off_x, src_off_y, dst_off_x, dst_off_y;
     PixmapPtr pSrcPix, pDstPix;
 
-    if (!uxa_screen->info->prepare_composite)
+    if (!uxa_screen->info->prepare_composite || uxa_screen->swappedOut)
 	return -1;
 
     if (uxa_screen->info->check_composite &&
diff --git a/uxa/uxa.c b/uxa/uxa.c
index 8658406..5b6f537 100644
--- a/uxa/uxa.c
+++ b/uxa/uxa.c
@@ -310,6 +310,22 @@ uxa_bitmap_to_region(PixmapPtr pPix)
   return ret;
 }
 
+static void
+uxa_xorg_enable_disable_fb_access (int index, Bool enable)
+{
+    ScreenPtr screen = screenInfo.screens[index];
+    uxa_screen_t *uxa_screen = uxa_get_screen(screen);
+
+    if (!enable && uxa_screen->disableFbCount++ == 0)
+	uxa_screen->swappedOut = TRUE;
+
+    if (enable && --uxa_screen->disableFbCount == 0)
+	uxa_screen->swappedOut = FALSE;
+
+    if (uxa_screen->SavedEnableDisableFBAccess)
+       uxa_screen->SavedEnableDisableFBAccess(index, enable);
+}
+
 /**
  * uxa_close_screen() unwraps its wrapped screen functions and tears down UXA's
  * screen private, before calling down to the next CloseSccreen.
@@ -318,6 +334,7 @@ static Bool
 uxa_close_screen(int i, ScreenPtr pScreen)
 {
     uxa_screen_t	*uxa_screen = uxa_get_screen(pScreen);
+    ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
 #ifdef RENDER
     PictureScreenPtr	ps = GetPictureScreenIfSet(pScreen);
 #endif
@@ -333,6 +350,7 @@ uxa_close_screen(int i, ScreenPtr pScreen)
     pScreen->CopyWindow = uxa_screen->SavedCopyWindow;
     pScreen->ChangeWindowAttributes = uxa_screen->SavedChangeWindowAttributes;
     pScreen->BitmapToRegion = uxa_screen->SavedBitmapToRegion;
+    scrn->EnableDisableFBAccess = uxa_screen->SavedEnableDisableFBAccess;
 #ifdef RENDER
     if (ps) {
 	ps->Composite = uxa_screen->SavedComposite;
@@ -378,6 +396,7 @@ Bool
 uxa_driver_init(ScreenPtr screen, uxa_driver_t *uxa_driver)
 {
     uxa_screen_t	*uxa_screen;
+    ScrnInfoPtr scrn = xf86Screens[screen->myNum];
 #ifdef RENDER
     PictureScreenPtr	ps;
 #endif
@@ -450,6 +469,9 @@ uxa_driver_init(ScreenPtr screen, uxa_driver_t *uxa_driver)
     uxa_screen->SavedBitmapToRegion = screen->BitmapToRegion;
     screen->BitmapToRegion = uxa_bitmap_to_region;
 
+    uxa_screen->SavedEnableDisableFBAccess = scrn->EnableDisableFBAccess;
+    scrn->EnableDisableFBAccess = uxa_xorg_enable_disable_fb_access;
+
 #ifdef RENDER
     if (ps) {
         uxa_screen->SavedComposite = ps->Composite;


More information about the xorg-commit mailing list