summaryrefslogtreecommitdiff
path: root/src/via_ums.c
diff options
context:
space:
mode:
authorKevin Brace <kevinbrace@gmx.com>2020-02-12 13:41:53 -0800
committerKevin Brace <kevinbrace@gmx.com>2020-02-12 13:41:53 -0800
commit8a0d281263abcf8c970687946af8280f4d3c59cb (patch)
tree1861b7bbbe9e1cc3e3e482e9d15b95caf99cbe03 /src/via_ums.c
parentce80786883910e1b1de9a8732d2bc44ba252a1ca (diff)
Handle more of screen initialization inside viaUMSCreate()
Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
Diffstat (limited to 'src/via_ums.c')
-rw-r--r--src/via_ums.c101
1 files changed, 55 insertions, 46 deletions
diff --git a/src/via_ums.c b/src/via_ums.c
index 1ddd74b..c646796 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -698,63 +698,72 @@ viaUMSCreate(ScrnInfoPtr pScrn)
#ifdef HAVE_DRI
if (pVia->directRenderingType == DRI_1) {
- /* In the case of DRI we handle all VRAM by the DRI ioctls */
- if (pVia->useEXA)
- goto exit;
-
- /* XAA has to use FBManager so we have to split the space with DRI */
- maxY = pScrn->virtualY + (pVia->driSize / pVia->Bpl);
+ if (!VIADRIKernelInit(pScrn)) {
+ return FALSE;
+ }
} else
#endif
+ {
maxY = pVia->FBFreeEnd / pVia->Bpl;
- /* FBManager can't handle more than 32767 scan lines */
- if (maxY > 32767)
- maxY = 32767;
+ /* 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(pScreen, &AvailFBArea);
+ if (!ret) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "xf86InitFBManager initialization failed.\n");
+ goto exit;
+ }
- AvailFBArea.x1 = 0;
- AvailFBArea.y1 = 0;
- AvailFBArea.x2 = pScrn->displayWidth;
- AvailFBArea.y2 = maxY;
- pVia->FBFreeStart = (AvailFBArea.y2 + 1) * pVia->Bpl;
+ 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(pScreen, offset, size);
+ if (!ret) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "xf86InitFBManagerLinear initialization "
+ "failed.\n");
+ goto exit;
+ }
+ }
- /*
- * Initialization of the XFree86 framebuffer manager is done via
- * Bool xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox)
- * FullBox represents the area of the framebuffer 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(pScreen, &AvailFBArea);
- if (!ret) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "xf86InitFBManager initialization failed.\n");
- goto exit;
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Using %d lines for off screen memory.\n",
+ AvailFBArea.y2 - pScrn->virtualY));
}
- 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(pScreen, offset, size);
- if (!ret) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "xf86InitFBManagerLinear initialization "
- "failed.\n");
- goto exit;
+ if ((!pVia->NoAccel) && (pVia->useEXA)) {
+ if (!viaInitExa(pScreen)) {
+ ret = FALSE;
}
}
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Using %d lines for off screen memory.\n",
- AvailFBArea.y2 - pScrn->virtualY));
+
exit:
return ret;
}