summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-05-24 16:03:31 +0100
committerDave Airlie <airlied@redhat.com>2012-06-25 11:55:02 +0100
commit22d3d893665e76906d566c298469af59dca480f8 (patch)
tree1ef14dcfcbed3883b285a32ff385b81fc8490970
parent3615945fcdad6db6f17578176d6c2290ee4bb16d (diff)
exa: pixmap sharing infrastructure
This just adds exa interfaces for mixed exa so drivers can share and set shared pixmaps up correctly. Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--exa/exa.c7
-rw-r--r--exa/exa.h6
-rw-r--r--exa/exa_mixed.c34
-rw-r--r--exa/exa_priv.h7
4 files changed, 53 insertions, 1 deletions
diff --git a/exa/exa.c b/exa/exa.c
index 0f90e593c..007495583 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -784,6 +784,10 @@ exaCloseScreen(ScreenPtr pScreen)
unwrap(pExaScr, pScreen, ChangeWindowAttributes);
unwrap(pExaScr, pScreen, BitmapToRegion);
unwrap(pExaScr, pScreen, CreateScreenResources);
+ if (pExaScr->SavedSharePixmapBacking)
+ unwrap(pExaScr, pScreen, SharePixmapBacking);
+ if (pExaScr->SavedSetSharedPixmapBacking)
+ unwrap(pExaScr, pScreen, SetSharedPixmapBacking);
unwrap(pExaScr, ps, Composite);
if (pExaScr->SavedGlyphs)
unwrap(pExaScr, ps, Glyphs);
@@ -978,6 +982,9 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo)
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_mixed);
wrap(pExaScr, pScreen, ModifyPixmapHeader,
exaModifyPixmapHeader_mixed);
+ wrap(pExaScr, pScreen, SharePixmapBacking, exaSharePixmapBacking_mixed);
+ wrap(pExaScr, pScreen, SetSharedPixmapBacking, exaSetSharedPixmapBacking_mixed);
+
pExaScr->do_migration = exaDoMigration_mixed;
pExaScr->pixmap_has_gpu_copy = exaPixmapHasGpuCopy_mixed;
pExaScr->do_move_in_pixmap = exaMoveInPixmap_mixed;
diff --git a/exa/exa.h b/exa/exa.h
index 8a6539f65..ac9806337 100644
--- a/exa/exa.h
+++ b/exa/exa.h
@@ -39,7 +39,7 @@
#include "fb.h"
#define EXA_VERSION_MAJOR 2
-#define EXA_VERSION_MINOR 5
+#define EXA_VERSION_MINOR 6
#define EXA_VERSION_RELEASE 0
typedef struct _ExaOffscreenArea ExaOffscreenArea;
@@ -694,6 +694,10 @@ typedef struct _ExaDriver {
int depth, int usage_hint, int bitsPerPixel,
int *new_fb_pitch);
/** @} */
+ Bool (*SharePixmapBacking)(PixmapPtr pPixmap, int *handle_p);
+
+ Bool (*SetSharedPixmapBacking)(PixmapPtr pPixmap, int handle);
+
} ExaDriverRec, *ExaDriverPtr;
/** @name EXA driver flags
diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c
index 06817313f..79533d1d7 100644
--- a/exa/exa_mixed.c
+++ b/exa/exa_mixed.c
@@ -294,3 +294,37 @@ exaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap)
return ret;
}
+
+Bool
+exaSharePixmapBacking_mixed(PixmapPtr pPixmap, int *handle_p)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ ExaScreenPriv(pScreen);
+ Bool ret = FALSE;
+
+ exaMoveInPixmap(pPixmap);
+ /* get the driver to give us a handle */
+ if (pExaScr->info->SharePixmapBacking)
+ ret = pExaScr->info->SharePixmapBacking(pPixmap, handle_p);
+
+ ErrorF("shared pixmap\n");
+ return ret;
+}
+
+Bool
+exaSetSharedPixmapBacking_mixed(PixmapPtr pPixmap, int handle)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ ExaScreenPriv(pScreen);
+ Bool ret = FALSE;
+
+ if (pExaScr->info->SetSharedPixmapBacking)
+ ret = pExaScr->info->SetSharedPixmapBacking(pPixmap, handle);
+
+ if (ret == TRUE)
+ exaMoveInPixmap(pPixmap);
+
+ return ret;
+}
+
+
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index f980fea6d..77a96986d 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -163,6 +163,8 @@ typedef struct {
BitmapToRegionProcPtr SavedBitmapToRegion;
CreateScreenResourcesProcPtr SavedCreateScreenResources;
ModifyPixmapHeaderProcPtr SavedModifyPixmapHeader;
+ SharePixmapBackingProcPtr SavedSharePixmapBacking;
+ SetSharedPixmapBackingProcPtr SavedSetSharedPixmapBacking;
SourceValidateProcPtr SavedSourceValidate;
CompositeProcPtr SavedComposite;
TrianglesProcPtr SavedTriangles;
@@ -662,6 +664,11 @@ void
void
exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg);
+Bool
+exaSetSharedPixmapBacking_mixed(PixmapPtr pPixmap, int handle);
+Bool
+exaSharePixmapBacking_mixed(PixmapPtr pPixmap, int *handle_p);
+
/* exa_render.c */
Bool
exaOpReadsDestination(CARD8 op);