Fix shadow framebuffer implementation.

Tested by  Martijn van Duren and mpi@.
This commit is contained in:
matthieu 2013-11-18 19:45:41 +00:00
parent 5707a4cc2a
commit 53ea49d9a5
5 changed files with 56 additions and 3 deletions

View File

@ -2070,7 +2070,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
/* Load shadowfb if needed */
if (pNv->ShadowFB) {
if (!xf86LoadSubModule(pScrn, "shadowfb")) {
if (!xf86LoadSubModule(pScrn, "shadow")) {
xf86FreeInt10(pNv->pInt);
NVFreeRec(pScrn);
return FALSE;
@ -2378,6 +2378,44 @@ NVDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags)
hwp->writeCrtc(hwp, 0x1A, crtc1A);
}
static Bool
NVCreateScreenResources(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
NVPtr pNv = NVPTR(pScrn);
PixmapPtr pPixmap;
Bool ret;
pScreen->CreateScreenResources = pNv->CreateScreenResources;
ret = pScreen->CreateScreenResources(pScreen);
pScreen->CreateScreenResources = NVCreateScreenResources;
if (!ret)
return FALSE;
pPixmap = pScreen->GetScreenPixmap(pScreen);
if (!shadowAdd(pScreen, pPixmap, NVShadowUpdate,
NULL, 0, NULL)) {
return FALSE;
}
return TRUE;
}
static Bool
NVShadowInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
NVPtr pNv = NVPTR(pScrn);
if (!shadowSetup(pScreen))
return FALSE;
pNv->CreateScreenResources = pScreen->CreateScreenResources;
pScreen->CreateScreenResources = NVCreateScreenResources;
return TRUE;
}
/* Mandatory */
@ -2599,8 +2637,8 @@ NVScreenInit(SCREEN_INIT_ARGS_DECL)
"Driver rotation enabled, RandR disabled\n");
}
}
ShadowFBInit(pScreen, refreshArea);
pNv->refreshArea = refreshArea;
NVShadowInit(pScreen);
}
if(pNv->FlatPanel)

View File

@ -32,6 +32,7 @@
#include "compiler.h"
#include "xf86_OSproc.h"
#include "shadow.h"
/*
* Typedefs to force certain sized values.
*/

View File

@ -49,6 +49,7 @@ int NVShowHideCursor(NVPtr,int);
void NVLockUnlock(NVPtr,int);
/* in nv_shadow.c */
void NVShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf);
void NVRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
void NVRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
void NVRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox);

View File

@ -13,6 +13,17 @@
#include "shadowfb.h"
#include "servermd.h"
void
NVShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf)
{
RegionPtr damage = DamageRegion(pBuf->pDamage);
ScrnInfoPtr pScrn;
pScrn = xf86ScreenToScrn(pScreen);
(NVPTR(pScrn))->refreshArea (pScrn, REGION_NUM_RECTS(damage),
REGION_RECTS(damage));
}
void
NVRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)

View File

@ -133,6 +133,8 @@ typedef struct {
int numDGAModes;
Bool DGAactive;
int DGAViewportStatus;
CreateScreenResourcesProcPtr CreateScreenResources;
RefreshAreaFuncPtr refreshArea;
void (*PointerMoved)(SCRN_ARG_TYPE arg, int x, int y);
ScreenBlockHandlerProcPtr BlockHandler;
CloseScreenProcPtr CloseScreen;