summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--uxa/uxa-priv.h5
-rw-r--r--uxa/uxa-render.c2
-rw-r--r--uxa/uxa.c22
3 files changed, 27 insertions, 2 deletions
diff --git a/uxa/uxa-priv.h b/uxa/uxa-priv.h
index 13535876..0f9cfbf4 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 94e18a55..b2d32976 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 8658406a..5b6f537e 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;