Fix for virtio-gpu
authorŁukasz Stelmach <l.stelmach@samsung.com>
Fri, 13 Oct 2023 13:22:48 +0000 (15:22 +0200)
committerŁukasz Stelmach <l.stelmach@samsung.com>
Fri, 24 Nov 2023 12:35:08 +0000 (13:35 +0100)
virtio-gpu kernel driver accepts only requests for 32-bit aligned
allocations.

Change-Id: I5127f0ccb55c9cccb64efa066557991fe2fbff6f
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
src/tbm_backend_dumb.c

index a908ca68861eadd97391060012a8b1f7bea160c8..5963f4925fdf175451dd5ecc87acbec38ac99d80 100644 (file)
@@ -663,8 +663,8 @@ tbm_dumb_bufmgr_alloc_bo(hal_tbm_bufmgr *bufmgr, unsigned int size,
        //as we know only size for new bo set height=1 and bpp=8 and in this case
        //width will by equal to size in bytes;
        create_dumb_arg.height = 1;
-       create_dumb_arg.bpp = 8;
-       create_dumb_arg.width = size;
+       create_dumb_arg.bpp = 32; // virtio-gpu refuses to accept bpp=8
+       create_dumb_arg.width = (size + 4 - 1) / 4;
        create_dumb_arg.flags = dumb_flags;
        if (drmIoctl(bufmgr_data->fd, DRM_IOCTL_MODE_CREATE_DUMB, &create_dumb_arg)) {
                TBM_BACKEND_ERR("fail to DRM_IOCTL_MODE_CREATE_DUMB flag:%x size:%d",