Commit 4d5fb495 authored by Thomas Hellstrom's avatar Thomas Hellstrom

Fix GBM image formats v2

When the GBM BOs are created, they are created using a bo with a correct
memory requirement but with an incorrect channel layout. This makes
drivers that are picky about matching formats (svga/vmwgfx) complain.

Use the correct GBM formats and require GBM >= 13.0 to make sure they
are available.

v2: Remove a couple of stale comments
Signed-off-by: 's avatarThomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: 's avatarEmil Velikov <emil.velikov@collabora.com>
parent 961c85f6
......@@ -36,7 +36,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# Obtain compiler/linker options for depedencies
PKG_CHECK_MODULES(DRM, libdrm)
PKG_CHECK_MODULES(GBM, gbm)
PKG_CHECK_MODULES(GBM, gbm >= 13.0)
PKG_CHECK_MODULES(EGL, egl)
PKG_CHECK_MODULES(GLES2, glesv2)
......
......@@ -223,7 +223,7 @@ static int get_fd_rgba(uint32_t *pstride)
int fd;
/* NOTE: do not actually use GBM_BO_USE_WRITE since that gets us a dumb buffer: */
bo = gbm_bo_create(gl.gbm->dev, texw, texh, GBM_FORMAT_ARGB8888, GBM_BO_USE_LINEAR);
bo = gbm_bo_create(gl.gbm->dev, texw, texh, GBM_FORMAT_ABGR8888, GBM_BO_USE_LINEAR);
map = gbm_bo_map(bo, 0, 0, texw, texh, GBM_BO_TRANSFER_WRITE, &stride, &map_data);
......@@ -253,10 +253,9 @@ static int get_fd_y(uint32_t *pstride)
int fd;
/* NOTE: do not actually use GBM_BO_USE_WRITE since that gets us a dumb buffer: */
/* hmm, no R8/R8G8 gbm formats?? */
bo = gbm_bo_create(gl.gbm->dev, texw/4, texh, GBM_FORMAT_ARGB8888, GBM_BO_USE_LINEAR);
bo = gbm_bo_create(gl.gbm->dev, texw, texh, GBM_FORMAT_R8, GBM_BO_USE_LINEAR);
map = gbm_bo_map(bo, 0, 0, texw/4, texh, GBM_BO_TRANSFER_WRITE, &stride, &map_data);
map = gbm_bo_map(bo, 0, 0, texw, texh, GBM_BO_TRANSFER_WRITE, &stride, &map_data);
for (uint32_t i = 0; i < texh; i++) {
memcpy(&map[stride * i], &src[texw * i], texw);
......@@ -284,10 +283,9 @@ static int get_fd_uv(uint32_t *pstride)
int fd;
/* NOTE: do not actually use GBM_BO_USE_WRITE since that gets us a dumb buffer: */
/* hmm, no R8/R8G8 gbm formats?? */
bo = gbm_bo_create(gl.gbm->dev, texw/2/2, texh/2, GBM_FORMAT_ARGB8888, GBM_BO_USE_LINEAR);
bo = gbm_bo_create(gl.gbm->dev, texw/2, texh/2, GBM_FORMAT_GR88, GBM_BO_USE_LINEAR);
map = gbm_bo_map(bo, 0, 0, texw/2/2, texh/2, GBM_BO_TRANSFER_WRITE, &stride, &map_data);
map = gbm_bo_map(bo, 0, 0, texw/2, texh/2, GBM_BO_TRANSFER_WRITE, &stride, &map_data);
for (uint32_t i = 0; i < texh/2; i++) {
memcpy(&map[stride * i], &src[texw * i], texw);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment