modesetting: Indirect the shadow API through LoaderSymbol

Prerequisite for building all of xserver with -z now.

Gitlab: https://gitlab.freedesktop.org/xorg/xserver/issues/692
This commit is contained in:
Adam Jackson 2019-10-08 12:52:28 -04:00 committed by Adam Jackson
parent 8760fab0a1
commit 45f35a0c66
2 changed files with 26 additions and 20 deletions

View File

@ -50,7 +50,6 @@
#include "xf86Crtc.h" #include "xf86Crtc.h"
#include "miscstruct.h" #include "miscstruct.h"
#include "dixstruct.h" #include "dixstruct.h"
#include "shadow.h"
#include "xf86xv.h" #include "xf86xv.h"
#include <X11/extensions/Xv.h> #include <X11/extensions/Xv.h>
#include <xorg-config.h> #include <xorg-config.h>
@ -60,7 +59,6 @@
#ifdef XSERVER_LIBPCIACCESS #ifdef XSERVER_LIBPCIACCESS
#include <pciaccess.h> #include <pciaccess.h>
#endif #endif
#include "driver.h" #include "driver.h"
static void AdjustFrame(ScrnInfoPtr pScrn, int x, int y); static void AdjustFrame(ScrnInfoPtr pScrn, int x, int y);
@ -1084,9 +1082,16 @@ PreInit(ScrnInfoPtr pScrn, int flags)
} }
if (ms->drmmode.shadow_enable) { if (ms->drmmode.shadow_enable) {
if (!xf86LoadSubModule(pScrn, "shadow")) { void *mod = xf86LoadSubModule(pScrn, "shadow");
if (!mod)
return FALSE; return FALSE;
}
ms->shadow.Setup = LoaderSymbolFromModule(mod, "shadowSetup");
ms->shadow.Add = LoaderSymbolFromModule(mod, "shadowAdd");
ms->shadow.Remove = LoaderSymbolFromModule(mod, "shadowRemove");
ms->shadow.Update32to24 = LoaderSymbolFromModule(mod, "shadowUpdate32to24");
ms->shadow.UpdatePacked = LoaderSymbolFromModule(mod, "shadowUpdatePacked");
} }
return TRUE; return TRUE;
@ -1191,9 +1196,9 @@ msUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf)
} while (0); } while (0);
if (use_3224) if (use_3224)
shadowUpdate32to24(pScreen, pBuf); ms->shadow.Update32to24(pScreen, pBuf);
else else
shadowUpdatePacked(pScreen, pBuf); ms->shadow.UpdatePacked(pScreen, pBuf);
} }
static Bool static Bool
@ -1381,7 +1386,7 @@ CreateScreenResources(ScreenPtr pScreen)
FatalError("Couldn't adjust screen pixmap\n"); FatalError("Couldn't adjust screen pixmap\n");
if (ms->drmmode.shadow_enable) { if (ms->drmmode.shadow_enable) {
if (!shadowAdd(pScreen, rootPixmap, msUpdatePacked, msShadowWindow, if (!ms->shadow.Add(pScreen, rootPixmap, msUpdatePacked, msShadowWindow,
0, 0)) 0, 0))
return FALSE; return FALSE;
} }
@ -1412,15 +1417,6 @@ CreateScreenResources(ScreenPtr pScreen)
return ret; return ret;
} }
static Bool
msShadowInit(ScreenPtr pScreen)
{
if (!shadowSetup(pScreen)) {
return FALSE;
}
return TRUE;
}
static Bool static Bool
msSharePixmapBacking(PixmapPtr ppix, ScreenPtr screen, void **handle) msSharePixmapBacking(PixmapPtr ppix, ScreenPtr screen, void **handle)
{ {
@ -1640,7 +1636,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
return FALSE; return FALSE;
} }
if (ms->drmmode.shadow_enable && !msShadowInit(pScreen)) { if (ms->drmmode.shadow_enable && !ms->shadow.Setup(pScreen)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "shadow fb init failed\n"); xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "shadow fb init failed\n");
return FALSE; return FALSE;
} }
@ -1854,7 +1850,7 @@ CloseScreen(ScreenPtr pScreen)
} }
if (ms->drmmode.shadow_enable) { if (ms->drmmode.shadow_enable) {
shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen)); ms->shadow.Remove(pScreen, pScreen->GetScreenPixmap(pScreen));
free(ms->drmmode.shadow_fb); free(ms->drmmode.shadow_fb);
ms->drmmode.shadow_fb = NULL; ms->drmmode.shadow_fb = NULL;
free(ms->drmmode.shadow_fb2); free(ms->drmmode.shadow_fb2);

View File

@ -33,7 +33,7 @@
#include <xf86Crtc.h> #include <xf86Crtc.h>
#include <damage.h> #include <damage.h>
#include <X11/extensions/dpmsconst.h> #include <X11/extensions/dpmsconst.h>
#include <shadow.h>
#ifdef GLAMOR_HAS_GBM #ifdef GLAMOR_HAS_GBM
#define GLAMOR_FOR_XORG 1 #define GLAMOR_FOR_XORG 1
#include "glamor.h" #include "glamor.h"
@ -122,6 +122,16 @@ typedef struct _modesettingRec {
Bool kms_has_modifiers; Bool kms_has_modifiers;
/* shadow API */
struct {
Bool (*Setup)(ScreenPtr);
Bool (*Add)(ScreenPtr, PixmapPtr, ShadowUpdateProc, ShadowWindowProc,
int, void *);
void (*Remove)(ScreenPtr, PixmapPtr);
void (*Update32to24)(ScreenPtr, shadowBufPtr);
void (*UpdatePacked)(ScreenPtr, shadowBufPtr);
} shadow;
} modesettingRec, *modesettingPtr; } modesettingRec, *modesettingPtr;
#define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate)) #define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))