summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2017-04-04 13:30:31 +0200
committerThomas Hellstrom <thellstrom@vmware.com>2017-04-05 13:02:25 +0200
commit4d5fb49585bf10dcb3d06d0129745c116f236d35 (patch)
tree37e5264a80e43eb0dedf500d037dc4c703d766e6
parent961c85f6eb42e4445513044c9944c83a0d9cb324 (diff)
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: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
-rw-r--r--configure.ac2
-rw-r--r--cube-tex.c12
2 files changed, 6 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index 242164f..aa0ef36 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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)
diff --git a/cube-tex.c b/cube-tex.c
index b11023f..9316ffb 100644
--- a/cube-tex.c
+++ b/cube-tex.c
@@ -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);