diff options
author | Kevin Brace <kevinbrace@gmx.com> | 2020-02-13 15:53:32 -0800 |
---|---|---|
committer | Kevin Brace <kevinbrace@gmx.com> | 2020-02-13 15:53:32 -0800 |
commit | 6c51445bdbcd17dbc17243ffd08564f52474cd02 (patch) | |
tree | 309c0e6576f35219f7511ce5863e8178151f9cca /src | |
parent | e1fac6888dacf74dbf749e54880da449d4667900 (diff) |
Move no DRM UMS FB initialization code into viaInitFB()
Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/via_ums.c | 123 |
1 files changed, 72 insertions, 51 deletions
diff --git a/src/via_ums.c b/src/via_ums.c index 9dfbf6f..83d8578 100644 --- a/src/via_ums.c +++ b/src/via_ums.c @@ -686,8 +686,8 @@ err: return ret; } -Bool -viaUMSCreate(ScrnInfoPtr pScrn) +static Bool +viaInitFB(ScrnInfoPtr pScrn) { VIAPtr pVia = VIAPTR(pScrn); BoxRec AvailFBArea; @@ -695,6 +695,74 @@ viaUMSCreate(ScrnInfoPtr pScrn) int maxY; Bool ret = TRUE; + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Entered %s.\n", __func__)); + + maxY = pVia->FBFreeEnd / pVia->Bpl; + + /* + * FBManager can't handle more than 32767 scan lines. + */ + if (maxY > 32767) + maxY = 32767; + + AvailFBArea.x1 = 0; + AvailFBArea.y1 = 0; + AvailFBArea.x2 = pScrn->displayWidth; + AvailFBArea.y2 = maxY; + pVia->FBFreeStart = (AvailFBArea.y2 + 1) * pVia->Bpl; + + /* + * Initialization of the XFree86 framebuffer manager is done via + * Bool xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox). + * FullBox represents the area of the frame buffer that the + * manager is allowed to manage. This is typically a box with a + * width of pScrn->displayWidth and a height of as many lines as + * can be fit within the total video memory. + */ + ret = xf86InitFBManager(pScrn->pScreen, &AvailFBArea); + if (!ret) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "xf86InitFBManager initialization failed.\n"); + goto exit; + } + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Frame buffer from (%d,%d) to (%d,%d).\n", + AvailFBArea.x1, AvailFBArea.y1, + AvailFBArea.x2, AvailFBArea.y2)); + + offset = (pVia->FBFreeStart + + ((pScrn->bitsPerPixel >> 3) - 1)) / + (pScrn->bitsPerPixel >> 3); + size = (pVia->FBFreeEnd / (pScrn->bitsPerPixel >> 3)) - offset; + + if (size > 0) { + ret = xf86InitFBManagerLinear(pScrn->pScreen, offset, size); + if (!ret) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "xf86InitFBManagerLinear initialization " + "failed.\n"); + goto exit; + } + } + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using %d lines for off screen memory.\n", + AvailFBArea.y2 - pScrn->virtualY)); + +exit: + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Exiting %s.\n", __func__)); + return ret; +} + +Bool +viaUMSCreate(ScrnInfoPtr pScrn) +{ + VIAPtr pVia = VIAPTR(pScrn); + Bool ret = TRUE; + #ifdef HAVE_DRI if (pVia->directRenderingType == DRI_1) { if (!VIADRIKernelInit(pScrn)) { @@ -704,57 +772,10 @@ viaUMSCreate(ScrnInfoPtr pScrn) } else #endif { - maxY = pVia->FBFreeEnd / pVia->Bpl; - - /* FBManager can't handle more than 32767 scan lines */ - if (maxY > 32767) - maxY = 32767; - - AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - AvailFBArea.y2 = maxY; - pVia->FBFreeStart = (AvailFBArea.y2 + 1) * pVia->Bpl; - - /* - * Initialization of the XFree86 framebuffer manager is done - * via Bool xf86InitFBManager(ScreenPtr pScreen, - * BoxPtr FullBox). FullBox represents the area of the - * frame buffer that the manager is allowed to manage. - * This is typically a box with a width of pScrn->displayWidth - * and a height of as many lines as can be fit within the - * total video memory. - */ - ret = xf86InitFBManager(pScrn->pScreen, &AvailFBArea); - if (!ret) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "xf86InitFBManager initialization failed.\n"); + if (!viaInitFB(pScrn)) { + ret = FALSE; goto exit; } - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Frame buffer from (%d,%d) to (%d,%d).\n", - AvailFBArea.x1, AvailFBArea.y1, - AvailFBArea.x2, AvailFBArea.y2)); - - offset = (pVia->FBFreeStart + - ((pScrn->bitsPerPixel >> 3) - 1)) / - (pScrn->bitsPerPixel >> 3); - size = (pVia->FBFreeEnd / (pScrn->bitsPerPixel >> 3)) - offset; - - if (size > 0) { - ret = xf86InitFBManagerLinear(pScrn->pScreen, offset, size); - if (!ret) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "xf86InitFBManagerLinear initialization " - "failed.\n"); - goto exit; - } - } - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %d lines for off screen memory.\n", - AvailFBArea.y2 - pScrn->virtualY)); } if ((!pVia->NoAccel) && (pVia->useEXA)) { |