Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
set canDoBGNoneRoot if building against new enough server
  • Loading branch information
Ben Skeggs committed Dec 14, 2010
1 parent 11510f9 commit b6cb21b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
40 changes: 20 additions & 20 deletions src/drmmode_display.c
Expand Up @@ -187,22 +187,18 @@ void
drmmode_fbcon_copy(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
NVPtr pNv = NVPTR(pScrn);
#if XORG_VERSION_CURRENT >= 10999001
ExaDriverPtr exa = pNv->EXADriverPtr;
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
struct nouveau_bo *bo = NULL;
PixmapPtr pspix, pdpix;
drmModeFBPtr fb;
unsigned w = pScrn->virtualX, h = pScrn->virtualY;
int i, ret, fbcon_id = 0;

if (pNv->NoAccel) {
if (nouveau_bo_map(pNv->scanout, NOUVEAU_BO_WR))
return;
memset(pNv->scanout->map, 0x00, pNv->scanout->size);
nouveau_bo_unmap(pNv->scanout);
return;
}
if (pNv->NoAccel)
goto fallback;

for (i = 0; i < xf86_config->num_crtc; i++) {
drmmode_crtc_private_ptr drmmode_crtc =
Expand All @@ -213,32 +209,27 @@ drmmode_fbcon_copy(ScreenPtr pScreen)
}

if (!fbcon_id)
return;
goto fallback;

fb = drmModeGetFB(nouveau_device(pNv->dev)->fd, fbcon_id);
if (!fb) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Failed to retrieve fbcon fb: id %d\n", fbcon_id);
return;
goto fallback;
}

if (fb->depth != pScrn->depth) {
if (fb->depth != pScrn->depth || fb->width != w || fb->height != h) {
drmFree(fb);
return;
goto fallback;
}

if (w > fb->width)
w = fb->width;
if (h > fb->height)
h = fb->height;

ret = nouveau_bo_wrap(pNv->dev, fb->handle, &bo);
if (ret) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Failed to retrieve fbcon buffer: handle=0x%08x\n",
fb->handle);
drmFree(fb);
return;
goto fallback;
}

pspix = drmmode_pixmap_wrap(pScreen, fb->width, fb->height,
Expand All @@ -248,7 +239,7 @@ drmmode_fbcon_copy(ScreenPtr pScreen)
if (!pspix) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Failed to create pixmap for fbcon contents\n");
return;
goto fallback;
}

pdpix = drmmode_pixmap_wrap(pScreen, pScrn->virtualX,
Expand All @@ -260,7 +251,7 @@ drmmode_fbcon_copy(ScreenPtr pScreen)
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Failed to init scanout pixmap for fbcon mirror\n");
pScreen->DestroyPixmap(pspix);
return;
goto fallback;
}

exa->PrepareCopy(pspix, pdpix, 0, 0, GXcopy, ~0);
Expand All @@ -276,6 +267,15 @@ drmmode_fbcon_copy(ScreenPtr pScreen)

pScreen->DestroyPixmap(pdpix);
pScreen->DestroyPixmap(pspix);
pScreen->canDoBGNoneRoot = TRUE;
return;

fallback:
#endif
if (nouveau_bo_map(pNv->scanout, NOUVEAU_BO_WR))
return;
memset(pNv->scanout->map, 0x00, pNv->scanout->size);
nouveau_bo_unmap(pNv->scanout);
}

static Bool
Expand Down
1 change: 0 additions & 1 deletion src/nv_driver.c
Expand Up @@ -1210,7 +1210,6 @@ NVScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);

drmmode_screen_init(pScreen);

return TRUE;
}

Expand Down

0 comments on commit b6cb21b

Please sign in to comment.