Compare commits
4 Commits
master
...
wip/privat
Author | SHA1 | Date | |
---|---|---|---|
|
7b00d306b3 | ||
|
2ad1d1d6cb | ||
|
14c785aa6f | ||
|
fda404fd15 |
16
Xext/shm.c
16
Xext/shm.c
|
@ -96,6 +96,7 @@ in this Software without prior written authorization from The Open Group.
|
||||||
#endif /* XINERAMA */
|
#endif /* XINERAMA */
|
||||||
|
|
||||||
typedef struct _ShmScrPrivateRec {
|
typedef struct _ShmScrPrivateRec {
|
||||||
|
Bool initialized;
|
||||||
CloseScreenProcPtr CloseScreen;
|
CloseScreenProcPtr CloseScreen;
|
||||||
ShmFuncsPtr shmFuncs;
|
ShmFuncsPtr shmFuncs;
|
||||||
DestroyPixmapProcPtr destroyPixmap;
|
DestroyPixmapProcPtr destroyPixmap;
|
||||||
|
@ -199,10 +200,10 @@ static Bool
|
||||||
ShmCloseScreen(ScreenPtr pScreen)
|
ShmCloseScreen(ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
|
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
|
||||||
|
if (screen_priv->initialized) {
|
||||||
pScreen->CloseScreen = screen_priv->CloseScreen;
|
pScreen->CloseScreen = screen_priv->CloseScreen;
|
||||||
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL);
|
screen_priv->initialized = FALSE;
|
||||||
free(screen_priv);
|
}
|
||||||
return (*pScreen->CloseScreen) (pScreen);
|
return (*pScreen->CloseScreen) (pScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,11 +212,10 @@ ShmInitScreenPriv(ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
|
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
|
||||||
|
|
||||||
if (!screen_priv) {
|
if (!screen_priv->initialized) {
|
||||||
screen_priv = calloc(1, sizeof(ShmScrPrivateRec));
|
|
||||||
screen_priv->CloseScreen = pScreen->CloseScreen;
|
screen_priv->CloseScreen = pScreen->CloseScreen;
|
||||||
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
|
|
||||||
pScreen->CloseScreen = ShmCloseScreen;
|
pScreen->CloseScreen = ShmCloseScreen;
|
||||||
|
screen_priv->initialized = TRUE;
|
||||||
}
|
}
|
||||||
return screen_priv;
|
return screen_priv;
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ ShmInitScreenPriv(ScreenPtr pScreen)
|
||||||
static Bool
|
static Bool
|
||||||
ShmRegisterPrivates(void)
|
ShmRegisterPrivates(void)
|
||||||
{
|
{
|
||||||
if (!dixRegisterPrivateKey(&shmScrPrivateKeyRec, PRIVATE_SCREEN, 0))
|
if (!dixRegisterPrivateKey(&shmScrPrivateKeyRec, PRIVATE_SCREEN, sizeof(ShmScrPrivateRec)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!dixRegisterPrivateKey(&shmPixmapPrivateKeyRec, PRIVATE_PIXMAP, 0))
|
if (!dixRegisterPrivateKey(&shmPixmapPrivateKeyRec, PRIVATE_PIXMAP, 0))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -103,7 +103,7 @@ SOFTWARE.
|
||||||
#include "xvdisp.h"
|
#include "xvdisp.h"
|
||||||
|
|
||||||
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
|
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
|
||||||
dixLookupPrivate(&(pScreen)->devPrivates, XvScreenKey))->field)
|
dixLookupPrivate(&(pScreen)->devPrivates, &XvScreenKeyRec))->field)
|
||||||
|
|
||||||
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
|
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
|
||||||
((pScreen)->field = wrapper)
|
((pScreen)->field = wrapper)
|
||||||
|
@ -119,7 +119,6 @@ static DevPrivateKeyRec XvScreenKeyRec;
|
||||||
|
|
||||||
Bool noXvExtension = FALSE;
|
Bool noXvExtension = FALSE;
|
||||||
|
|
||||||
#define XvScreenKey (&XvScreenKeyRec)
|
|
||||||
static unsigned long XvExtensionGeneration = 0;
|
static unsigned long XvExtensionGeneration = 0;
|
||||||
static unsigned long XvScreenGeneration = 0;
|
static unsigned long XvScreenGeneration = 0;
|
||||||
static unsigned long XvResourceGeneration = 0;
|
static unsigned long XvResourceGeneration = 0;
|
||||||
|
@ -164,7 +163,7 @@ XvExtensionInit(void)
|
||||||
{
|
{
|
||||||
ExtensionEntry *extEntry;
|
ExtensionEntry *extEntry;
|
||||||
|
|
||||||
if (!dixRegisterPrivateKey(&XvScreenKeyRec, PRIVATE_SCREEN, 0))
|
if (!dixRegisterPrivateKey(&XvScreenKeyRec, PRIVATE_SCREEN, sizeof(XvScreenPtr)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Look to see if any screens were initialized; if not then
|
/* Look to see if any screens were initialized; if not then
|
||||||
|
@ -260,8 +259,6 @@ CreateResourceTypes(void)
|
||||||
int
|
int
|
||||||
XvScreenInit(ScreenPtr pScreen)
|
XvScreenInit(ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
XvScreenPtr pxvs;
|
|
||||||
|
|
||||||
if (XvScreenGeneration != serverGeneration) {
|
if (XvScreenGeneration != serverGeneration) {
|
||||||
if (!CreateResourceTypes()) {
|
if (!CreateResourceTypes()) {
|
||||||
ErrorF("XvScreenInit: Unable to allocate resource types\n");
|
ErrorF("XvScreenInit: Unable to allocate resource types\n");
|
||||||
|
@ -273,22 +270,14 @@ XvScreenInit(ScreenPtr pScreen)
|
||||||
XvScreenGeneration = serverGeneration;
|
XvScreenGeneration = serverGeneration;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dixRegisterPrivateKey(&XvScreenKeyRec, PRIVATE_SCREEN, 0))
|
if (!dixRegisterPrivateKey(&XvScreenKeyRec, PRIVATE_SCREEN, sizeof(XvScreenPtr)))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
if (dixLookupPrivate(&pScreen->devPrivates, XvScreenKey)) {
|
if (dixLookupPrivate(&pScreen->devPrivates, &XvScreenKeyRec)) {
|
||||||
ErrorF("XvScreenInit: screen devPrivates ptr non-NULL before init\n");
|
ErrorF("XvScreenInit: screen devPrivates ptr non-NULL before init\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ALLOCATE SCREEN PRIVATE RECORD */
|
XvScreenPtr pxvs = dixLookupPrivate(&pScreen->devPrivates, &XvScreenKeyRec);
|
||||||
|
|
||||||
pxvs = malloc(sizeof(XvScreenRec));
|
|
||||||
if (!pxvs) {
|
|
||||||
ErrorF("XvScreenInit: Unable to allocate screen private structure\n");
|
|
||||||
return BadAlloc;
|
|
||||||
}
|
|
||||||
|
|
||||||
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs);
|
|
||||||
|
|
||||||
pxvs->DestroyPixmap = pScreen->DestroyPixmap;
|
pxvs->DestroyPixmap = pScreen->DestroyPixmap;
|
||||||
pxvs->DestroyWindow = pScreen->DestroyWindow;
|
pxvs->DestroyWindow = pScreen->DestroyWindow;
|
||||||
|
@ -304,19 +293,12 @@ XvScreenInit(ScreenPtr pScreen)
|
||||||
static Bool
|
static Bool
|
||||||
XvCloseScreen(ScreenPtr pScreen)
|
XvCloseScreen(ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
|
XvScreenPtr pxvs = dixLookupPrivate(&pScreen->devPrivates, &XvScreenKeyRec);
|
||||||
XvScreenPtr pxvs;
|
|
||||||
|
|
||||||
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
|
|
||||||
|
|
||||||
pScreen->DestroyPixmap = pxvs->DestroyPixmap;
|
pScreen->DestroyPixmap = pxvs->DestroyPixmap;
|
||||||
pScreen->DestroyWindow = pxvs->DestroyWindow;
|
pScreen->DestroyWindow = pxvs->DestroyWindow;
|
||||||
pScreen->CloseScreen = pxvs->CloseScreen;
|
pScreen->CloseScreen = pxvs->CloseScreen;
|
||||||
|
|
||||||
free(pxvs);
|
|
||||||
|
|
||||||
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
|
|
||||||
|
|
||||||
return (*pScreen->CloseScreen) (pScreen);
|
return (*pScreen->CloseScreen) (pScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,7 +311,7 @@ XvResetProc(ExtensionEntry * extEntry)
|
||||||
DevPrivateKey
|
DevPrivateKey
|
||||||
XvGetScreenKey(void)
|
XvGetScreenKey(void)
|
||||||
{
|
{
|
||||||
return XvScreenKey;
|
return &XvScreenKeyRec;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long
|
unsigned long
|
||||||
|
@ -342,7 +324,7 @@ static void
|
||||||
XvStopAdaptors(DrawablePtr pDrawable)
|
XvStopAdaptors(DrawablePtr pDrawable)
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = pDrawable->pScreen;
|
ScreenPtr pScreen = pDrawable->pScreen;
|
||||||
XvScreenPtr pxvs = dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
|
XvScreenPtr pxvs = dixLookupPrivate(&pScreen->devPrivates, &XvScreenKeyRec);
|
||||||
XvAdaptorPtr pa = pxvs->pAdaptors;
|
XvAdaptorPtr pa = pxvs->pAdaptors;
|
||||||
int na = pxvs->nAdaptors;
|
int na = pxvs->nAdaptors;
|
||||||
|
|
||||||
|
|
|
@ -107,15 +107,13 @@ static DevPrivateKeyRec XF86XVWindowKeyRec;
|
||||||
|
|
||||||
#define XF86XVWindowKey (&XF86XVWindowKeyRec)
|
#define XF86XVWindowKey (&XF86XVWindowKeyRec)
|
||||||
|
|
||||||
/* dixmain.c XvScreenPtr screen private */
|
|
||||||
DevPrivateKey XF86XvScreenKey;
|
|
||||||
/** xf86xv.c XF86XVScreenPtr screen private */
|
/** xf86xv.c XF86XVScreenPtr screen private */
|
||||||
static DevPrivateKeyRec XF86XVScreenPrivateKey;
|
static DevPrivateKeyRec XF86XVScreenPrivateKey;
|
||||||
|
|
||||||
static unsigned long PortResource = 0;
|
static unsigned long PortResource = 0;
|
||||||
|
|
||||||
#define GET_XV_SCREEN(pScreen) \
|
#define GET_XV_SCREEN(pScreen) \
|
||||||
((XvScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XF86XvScreenKey))
|
((XvScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XvGetScreenKey()))
|
||||||
|
|
||||||
#define GET_XF86XV_SCREEN(pScreen) \
|
#define GET_XF86XV_SCREEN(pScreen) \
|
||||||
((XF86XVScreenPtr)(dixGetPrivate(&pScreen->devPrivates, &XF86XVScreenPrivateKey)))
|
((XF86XVScreenPtr)(dixGetPrivate(&pScreen->devPrivates, &XF86XVScreenPrivateKey)))
|
||||||
|
@ -241,8 +239,6 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
|
||||||
if (!dixRegisterPrivateKey(&XF86XVScreenPrivateKey, PRIVATE_SCREEN, 0))
|
if (!dixRegisterPrivateKey(&XF86XVScreenPrivateKey, PRIVATE_SCREEN, 0))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
XF86XvScreenKey = XvGetScreenKey();
|
|
||||||
|
|
||||||
PortResource = XvGetRTPort();
|
PortResource = XvGetRTPort();
|
||||||
|
|
||||||
ScreenPriv = malloc(sizeof(XF86XVScreenRec));
|
ScreenPriv = malloc(sizeof(XF86XVScreenRec));
|
||||||
|
|
|
@ -148,8 +148,7 @@ xf86XvMCScreenInit(ScreenPtr pScreen,
|
||||||
{
|
{
|
||||||
XvMCAdaptorPtr pAdapt;
|
XvMCAdaptorPtr pAdapt;
|
||||||
xf86XvMCScreenPtr pScreenPriv;
|
xf86XvMCScreenPtr pScreenPriv;
|
||||||
XvScreenPtr pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
|
XvScreenPtr pxvs = dixLookupPrivate(&pScreen->devPrivates, XvGetScreenKey());
|
||||||
XF86XvScreenKey);
|
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
if (noXvExtension)
|
if (noXvExtension)
|
||||||
|
|
|
@ -34,8 +34,6 @@
|
||||||
|
|
||||||
/*** These are DDX layer privates ***/
|
/*** These are DDX layer privates ***/
|
||||||
|
|
||||||
extern _X_EXPORT DevPrivateKey XF86XvScreenKey;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
DestroyWindowProcPtr DestroyWindow;
|
DestroyWindowProcPtr DestroyWindow;
|
||||||
ClipNotifyProcPtr ClipNotify;
|
ClipNotifyProcPtr ClipNotify;
|
||||||
|
|
|
@ -124,8 +124,6 @@ typedef struct _CursorScreen {
|
||||||
} CursorScreenRec, *CursorScreenPtr;
|
} CursorScreenRec, *CursorScreenPtr;
|
||||||
|
|
||||||
#define GetCursorScreen(s) ((CursorScreenPtr)dixLookupPrivate(&(s)->devPrivates, CursorScreenPrivateKey))
|
#define GetCursorScreen(s) ((CursorScreenPtr)dixLookupPrivate(&(s)->devPrivates, CursorScreenPrivateKey))
|
||||||
#define GetCursorScreenIfSet(s) GetCursorScreen(s)
|
|
||||||
#define SetCursorScreen(s,p) dixSetPrivate(&(s)->devPrivates, CursorScreenPrivateKey, p)
|
|
||||||
#define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func)
|
#define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func)
|
||||||
#define Unwrap(as,s,elt,backup) (((backup) = (s)->elt), (s)->elt = (as)->elt)
|
#define Unwrap(as,s,elt,backup) (((backup) = (s)->elt), (s)->elt = (as)->elt)
|
||||||
|
|
||||||
|
@ -197,16 +195,14 @@ static Bool
|
||||||
CursorCloseScreen(ScreenPtr pScreen)
|
CursorCloseScreen(ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
CursorScreenPtr cs = GetCursorScreen(pScreen);
|
CursorScreenPtr cs = GetCursorScreen(pScreen);
|
||||||
Bool ret;
|
|
||||||
_X_UNUSED CloseScreenProcPtr close_proc;
|
_X_UNUSED CloseScreenProcPtr close_proc;
|
||||||
_X_UNUSED DisplayCursorProcPtr display_proc;
|
_X_UNUSED DisplayCursorProcPtr display_proc;
|
||||||
|
|
||||||
Unwrap(cs, pScreen, CloseScreen, close_proc);
|
Unwrap(cs, pScreen, CloseScreen, close_proc);
|
||||||
Unwrap(cs, pScreen, DisplayCursor, display_proc);
|
Unwrap(cs, pScreen, DisplayCursor, display_proc);
|
||||||
deleteCursorHideCountsForScreen(pScreen);
|
deleteCursorHideCountsForScreen(pScreen);
|
||||||
ret = (*pScreen->CloseScreen) (pScreen);
|
return pScreen->CloseScreen(pScreen);
|
||||||
free(cs);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CursorAllEvents (XFixesDisplayCursorNotifyMask)
|
#define CursorAllEvents (XFixesDisplayCursorNotifyMask)
|
||||||
|
@ -1059,20 +1055,15 @@ XFixesCursorInit(void)
|
||||||
else
|
else
|
||||||
CursorVisible = FALSE;
|
CursorVisible = FALSE;
|
||||||
|
|
||||||
if (!dixRegisterPrivateKey(&CursorScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
|
if (!dixRegisterPrivateKey(&CursorScreenPrivateKeyRec, PRIVATE_SCREEN, sizeof(CursorScreenRec)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||||
ScreenPtr pScreen = screenInfo.screens[i];
|
ScreenPtr pScreen = screenInfo.screens[i];
|
||||||
CursorScreenPtr cs;
|
CursorScreenPtr cs = GetCursorScreen(pScreen);
|
||||||
|
|
||||||
cs = (CursorScreenPtr) calloc(1, sizeof(CursorScreenRec));
|
|
||||||
if (!cs)
|
|
||||||
return FALSE;
|
|
||||||
Wrap(cs, pScreen, CloseScreen, CursorCloseScreen);
|
Wrap(cs, pScreen, CloseScreen, CursorCloseScreen);
|
||||||
Wrap(cs, pScreen, DisplayCursor, CursorDisplayCursor);
|
Wrap(cs, pScreen, DisplayCursor, CursorDisplayCursor);
|
||||||
cs->pCursorHideCounts = NULL;
|
cs->pCursorHideCounts = NULL;
|
||||||
SetCursorScreen(pScreen, cs);
|
|
||||||
}
|
}
|
||||||
CursorClientType = CreateNewResourceType(CursorFreeClient,
|
CursorClientType = CreateNewResourceType(CursorFreeClient,
|
||||||
"XFixesCursorClient");
|
"XFixesCursorClient");
|
||||||
|
|
Loading…
Reference in New Issue