summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKevin Brace <kevinbrace@gmx.com>2020-02-13 16:00:03 -0800
committerKevin Brace <kevinbrace@gmx.com>2020-02-13 16:00:03 -0800
commitb1ac666462c2987777dfab5d7fd998c7a9d843df (patch)
treee4e245f21e5578226f859df0593fe5290876b0f0 /src
parent6c51445bdbcd17dbc17243ffd08564f52474cd02 (diff)
Use EXA offscreen memory manger when EXA is in use
EXA offscreen memory manager is used when DRM is not available. Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
Diffstat (limited to 'src')
-rw-r--r--src/via_memmgr.c76
-rw-r--r--src/via_ums.c25
2 files changed, 77 insertions, 24 deletions
diff --git a/src/via_memmgr.c b/src/via_memmgr.c
index 4fc42b7..6c3aa18 100644
--- a/src/via_memmgr.c
+++ b/src/via_memmgr.c
@@ -67,6 +67,30 @@ exit:
return ret;
}
+static int
+viaEXAOffscreenAlloc(ScrnInfoPtr pScrn, struct buffer_object *obj,
+ unsigned long size)
+{
+ ExaOffscreenArea *pArea;
+ int newSize = size;
+ int ret = 0;
+
+ pArea = exaOffscreenAlloc(pScrn->pScreen, newSize,
+ 32, TRUE, NULL, NULL);
+ if (!pArea) {
+ ret = -ENOMEM;
+ goto exit;
+ }
+
+ obj->offset = pArea->offset;
+ obj->handle = (unsigned long) pArea;
+ obj->domain = TTM_PL_FLAG_VRAM;
+ obj->size = newSize;
+
+exit:
+ return ret;
+}
+
struct buffer_object *
drm_bo_alloc(ScrnInfoPtr pScrn, unsigned int size, unsigned int alignment, int domain)
{
@@ -86,18 +110,35 @@ drm_bo_alloc(ScrnInfoPtr pScrn, unsigned int size, unsigned int alignment, int d
case TTM_PL_FLAG_TT:
case TTM_PL_FLAG_VRAM:
if (pVia->directRenderingType == DRI_NONE) {
- ret = viaOffScreenLinear(pScrn, obj, size);
- if (ret) {
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Linear memory allocation "
- "failed.\n"));
- } else
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "%lu bytes of linear memory "
- "allocated at 0x%lx, "
- "handle 0x%lx.\n",
- obj->size, obj->offset,
- obj->handle));
+ if (!pVia->useEXA) {
+ ret = viaOffScreenLinear(pScrn, obj, size);
+ if (ret) {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Linear memory allocation "
+ "failed.\n"));
+ } else {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%lu bytes of linear memory "
+ "allocated at 0x%lx, handle "
+ "0x%lx.\n",
+ obj->size, obj->offset,
+ obj->handle));
+ }
+ } else {
+ ret = viaEXAOffscreenAlloc(pScrn, obj, size);
+ if (ret) {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "EXA offscreen memory "
+ "allocation failed.\n"));
+ } else {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%lu bytes of EXA offscreen "
+ "memory allocated at 0x%lx, "
+ "handle 0x%lx.\n",
+ obj->size, obj->offset,
+ obj->handle));
+ }
+ }
#ifdef HAVE_DRI
} else if (pVia->directRenderingType == DRI_1) {
drm_via_mem_t drm;
@@ -223,9 +264,16 @@ drm_bo_free(ScrnInfoPtr pScrn, struct buffer_object *obj)
case TTM_PL_FLAG_VRAM:
case TTM_PL_FLAG_TT:
if (pVia->directRenderingType == DRI_NONE) {
- FBLinearPtr linear = (FBLinearPtr) obj->handle;
+ if (!pVia->useEXA) {
+ FBLinearPtr linear = (FBLinearPtr) obj->handle;
+
+ xf86FreeOffscreenLinear(linear);
+ } else {
+ ExaOffscreenArea *pArea =
+ (ExaOffscreenArea *)obj->handle;
- xf86FreeOffscreenLinear(linear);
+ exaOffscreenFree(pScrn->pScreen, pArea);
+ }
#ifdef HAVE_DRI
} else if (pVia->directRenderingType == DRI_1) {
drm_via_mem_t drm;
diff --git a/src/via_ums.c b/src/via_ums.c
index 83d8578..d0a9c12 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -769,22 +769,27 @@ viaUMSCreate(ScrnInfoPtr pScrn)
ret = FALSE;
goto exit;
}
+
+ if ((!pVia->NoAccel) && (pVia->useEXA)) {
+ if (!viaInitExa(pScrn->pScreen)) {
+ ret = FALSE;
+ goto exit;
+ }
+ }
} else
#endif
{
- if (!viaInitFB(pScrn)) {
- ret = FALSE;
- goto exit;
- }
- }
-
- if ((!pVia->NoAccel) && (pVia->useEXA)) {
- if (!viaInitExa(pScrn->pScreen)) {
- ret = FALSE;
+ if (!pVia->useEXA) {
+ if (!viaInitFB(pScrn)) {
+ ret = FALSE;
+ }
+ } else {
+ if (!viaInitExa(pScrn->pScreen)) {
+ ret = FALSE;
+ }
}
}
-
exit:
return ret;
}