[openchrome-devel] xf86-video-openchrome: 2 commits - configure.ac src/via_driver.c src/via_memmgr.c src/via_memmgr.h
Kevin Brace
kevinbrace at kemper.freedesktop.org
Tue Jan 14 01:31:53 UTC 2020
configure.ac | 2 -
src/via_driver.c | 101 +++++++++++++++++++++++++++++++++++--------------------
src/via_memmgr.c | 45 ------------------------
src/via_memmgr.h | 3 -
4 files changed, 67 insertions(+), 84 deletions(-)
New commits:
commit 4e4a424d943530458c1b5c240d32cad475e4d35d
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Jan 13 19:31:24 2020 -0600
Version bumped to 0.6.206
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/configure.ac b/configure.ac
index bdb6848..e35e73f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xf86-video-openchrome],
- [0.6.205],
+ [0.6.206],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
[xf86-video-openchrome])
commit 3b1ad115a4750fb764da77c9bb6ff538962c57d5
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Jan 13 19:15:04 2020 -0600
Phase out drm_bo_alloc_surface()
Call drm_bo_alloc() directly instead. Also, convert map_legacy_formats()
to viaConvertDepthToBpp().
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_driver.c b/src/via_driver.c
index 1949665..826aaba 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -620,33 +620,56 @@ VIAGetRec(ScrnInfoPtr pScrn)
return ret;
} /* VIAGetRec */
-static int
-map_legacy_formats(int bpp, int depth)
+static unsigned int
+viaConvertDepthToBpp(int bpp, int depth)
{
- int fmt = DRM_FORMAT_XRGB8888;
-
- switch (bpp) {
- case 8:
- fmt = DRM_FORMAT_C8;
- break;
- case 16:
- if (depth == 15)
- fmt = DRM_FORMAT_XRGB1555;
- else
- fmt = DRM_FORMAT_RGB565;
- break;
- case 24:
- fmt = DRM_FORMAT_RGB888;
- break;
- case 32:
- if (depth == 24)
- fmt = DRM_FORMAT_XRGB8888;
- else if (depth == 30)
- fmt = DRM_FORMAT_XRGB2101010;
- default:
- break;
- }
- return fmt;
+ unsigned int format = DRM_FORMAT_XRGB8888;
+ unsigned int bppSize;
+
+ switch (bpp) {
+ case 8:
+ format = DRM_FORMAT_C8;
+ break;
+ case 16:
+ if (depth == 15)
+ format = DRM_FORMAT_XRGB1555;
+ else
+ format = DRM_FORMAT_RGB565;
+ break;
+ case 24:
+ format = DRM_FORMAT_RGB888;
+ break;
+ case 32:
+ if (depth == 24)
+ format = DRM_FORMAT_XRGB8888;
+ else if (depth == 30)
+ format = DRM_FORMAT_XRGB2101010;
+ break;
+ default:
+ break;
+ }
+
+ switch (format) {
+ case DRM_FORMAT_C8:
+ bppSize = 1;
+ break;
+ case DRM_FORMAT_XRGB1555:
+ case DRM_FORMAT_RGB565:
+ bppSize = 2;
+ break;
+ case DRM_FORMAT_RGB888:
+ bppSize = 3;
+ break;
+ case DRM_FORMAT_XRGB2101010:
+ case DRM_FORMAT_XRGB8888:
+ bppSize = 4;
+ break;
+ default:
+ bppSize = 0;
+ break;
+ }
+
+ return bppSize;
}
static Bool
@@ -667,7 +690,7 @@ via_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
void *new_pixels;
VIAPtr pVia = VIAPTR(scrn);
xf86CrtcPtr crtc = NULL;
- int format;
+ unsigned int bppSize, alignedPitch;
DEBUG(xf86DrvMsg(scrn->scrnIndex, X_INFO,
"Entered %s.\n", __func__));
@@ -689,13 +712,16 @@ via_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
old_fb_id = drmmode->fb_id;
old_front = drmmode->front_bo;
- format = map_legacy_formats(scrn->bitsPerPixel, scrn->depth);
- drmmode->front_bo = drm_bo_alloc_surface(scrn, width, height, format,
- 16, TTM_PL_FLAG_VRAM);
+ bppSize = viaConvertDepthToBpp(scrn->bitsPerPixel,
+ scrn->depth);
+ alignedPitch = width * bppSize;
+ alignedPitch = ALIGN_TO(alignedPitch, 16);
+ drmmode->front_bo = drm_bo_alloc(scrn,
+ alignedPitch * height,
+ 16, TTM_PL_FLAG_VRAM);
if (!drmmode->front_bo) {
goto fail;
}
-
scrn->virtualX = width;
scrn->virtualY = height;
scrn->displayWidth = width;
@@ -1380,7 +1406,7 @@ VIAScreenInit(SCREEN_INIT_ARGS_DECL)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
VIAPtr pVia = VIAPTR(pScrn);
- int format;
+ unsigned int bppSize, alignedPitch;
pScrn->displayWidth = pScrn->virtualX;
@@ -1538,9 +1564,14 @@ VIAScreenInit(SCREEN_INIT_ARGS_DECL)
}
}
- format = map_legacy_formats(pScrn->bitsPerPixel, pScrn->depth);
- pVia->drmmode.front_bo = drm_bo_alloc_surface(pScrn, pScrn->virtualX, pScrn->virtualY,
- format, 16, TTM_PL_FLAG_VRAM);
+ bppSize = viaConvertDepthToBpp(pScrn->bitsPerPixel,
+ pScrn->depth);
+ alignedPitch = pScrn->virtualX * bppSize;
+ alignedPitch = ALIGN_TO(alignedPitch, 16);
+ pVia->drmmode.front_bo = drm_bo_alloc(pScrn,
+ alignedPitch *
+ pScrn->virtualY,
+ 16, TTM_PL_FLAG_VRAM);
if (!pVia->drmmode.front_bo)
return FALSE;
diff --git a/src/via_memmgr.c b/src/via_memmgr.c
index d37c917..1375969 100644
--- a/src/via_memmgr.c
+++ b/src/via_memmgr.c
@@ -70,51 +70,6 @@ viaOffScreenLinear(struct buffer_object *obj, ScrnInfoPtr pScrn,
return Success;
}
-struct buffer_object *
-drm_bo_alloc_surface(ScrnInfoPtr pScrn, unsigned int width, unsigned int height,
- int format, unsigned int alignment, int domain)
-{
- struct buffer_object *obj = NULL;
- int pitch;
-
- switch (format) {
- case DRM_FORMAT_C8:
- pitch = width;
- break;
-
- case DRM_FORMAT_XRGB1555:
- case DRM_FORMAT_RGB565:
- pitch = width * 2;
- break;
-
- case DRM_FORMAT_RGB888:
- pitch = width * 3;
- break;
-
- case DRM_FORMAT_XRGB2101010:
- case DRM_FORMAT_XRGB8888:
- pitch = width * 4;
- break;
- default:
- pitch = 0;
- break;
- }
-
- if (pitch == 0) {
- goto exit;
- }
-
- pitch = ALIGN_TO(pitch, alignment);
- obj = drm_bo_alloc(pScrn, pitch * height, alignment, domain);
- if (!obj)
- goto exit;
-
- if (!obj->pitch)
- obj->pitch = pitch;
-exit:
- return obj;
-}
-
struct buffer_object *
drm_bo_alloc(ScrnInfoPtr pScrn, unsigned int size, unsigned int alignment, int domain)
{
diff --git a/src/via_memmgr.h b/src/via_memmgr.h
index c7f72fc..5e78e4e 100644
--- a/src/via_memmgr.h
+++ b/src/via_memmgr.h
@@ -41,9 +41,6 @@ struct buffer_object {
};
-struct buffer_object *
-drm_bo_alloc_surface(ScrnInfoPtr pScrn, unsigned int width, unsigned int height,
- int format, unsigned int alignment, int domain);
struct buffer_object *
drm_bo_alloc(ScrnInfoPtr pScrn, unsigned int size, unsigned int alignment,
int domain);
More information about the openchrome-devel
mailing list