diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2017-04-04 13:30:31 +0200 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2017-04-05 13:02:25 +0200 |
commit | 4d5fb49585bf10dcb3d06d0129745c116f236d35 (patch) | |
tree | 37e5264a80e43eb0dedf500d037dc4c703d766e6 /cube-tex.c | |
parent | 961c85f6eb42e4445513044c9944c83a0d9cb324 (diff) | |
download | kmscube-4d5fb49585bf10dcb3d06d0129745c116f236d35.tar.gz |
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>
Diffstat (limited to 'cube-tex.c')
-rw-r--r-- | cube-tex.c | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -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); |