summaryrefslogtreecommitdiff
path: root/hw/kdrive/src
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2014-04-04 17:54:58 +0100
committerEric Anholt <eric@anholt.net>2014-08-06 20:12:20 -0700
commite7dde86f2343832c52ef74f5c4fe44a72054c79b (patch)
tree1b0b129c927b3b68464bc52e81f3a6d492e60284 /hw/kdrive/src
parenta146c6d4212ed199002e40419b4aa22da8f49e3a (diff)
xv: Move the DDX XV screen private allocation into the DDXes.
XV was going against convention by having the core infrastructure allocate the private on behalf of the DDX. I was interested in this because I was trying to make multiple pieces of DDX be able to allocate adaptors, and that wasn't going to work if DDX-specific code was hung off of a single global screen private. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'hw/kdrive/src')
-rw-r--r--hw/kdrive/src/kxv.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index 0896c8170..ad51cf971 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -103,6 +103,7 @@ static DevPrivateKeyRec KdXVWindowKeyRec;
#define KdXVWindowKey (&KdXVWindowKeyRec)
static DevPrivateKey KdXvScreenKey;
+static DevPrivateKeyRec KdXVScreenPrivateKey;
static unsigned long KdXVGeneration = 0;
static unsigned long PortResource = 0;
@@ -110,7 +111,7 @@ static unsigned long PortResource = 0;
dixLookupPrivate(&(pScreen)->devPrivates, KdXvScreenKey))
#define GET_KDXV_SCREEN(pScreen) \
- ((KdXVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr))
+ ((KdXVScreenPtr)(dixGetPrivate(&pScreen->devPrivates, &KdXVScreenPrivateKey)))
#define GET_KDXV_WINDOW(pWin) ((KdXVWindowPtr) \
dixLookupPrivate(&(pWin)->devPrivates, KdXVWindowKey))
@@ -143,6 +144,8 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
if (!dixRegisterPrivateKey(&KdXVWindowKeyRec, PRIVATE_WINDOW, 0))
return FALSE;
+ if (!dixRegisterPrivateKey(&KdXVScreenPrivateKey, PRIVATE_SCREEN, 0))
+ return FALSE;
if (Success != XvScreenInit(pScreen))
return FALSE;
@@ -157,13 +160,8 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
pxvs->ddCloseScreen = KdXVCloseScreen;
- /* The Xv di layer provides us with a private hook so that we don't
- have to allocate our own screen private. They also provide
- a CloseScreen hook so that we don't have to wrap it. I'm not
- sure that I appreciate that. */
-
ScreenPriv = malloc(sizeof(KdXVScreenRec));
- pxvs->devPriv.ptr = (void *) ScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, &KdXVScreenPrivateKey, ScreenPriv);
if (!ScreenPriv)
return FALSE;