summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tbm_backend_dumb.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/tbm_backend_dumb.c b/src/tbm_backend_dumb.c
index 0edb5dc..0f7eea6 100644
--- a/src/tbm_backend_dumb.c
+++ b/src/tbm_backend_dumb.c
@@ -678,6 +678,43 @@ tbm_dumb_bufmgr_alloc_bo(hal_tbm_bufmgr *bufmgr, unsigned int size,
dumb_flags = _get_dumb_flag_from_tbm(flags);
+ const struct {
+ int w;
+ int h;
+ } hardcoded_sizes[] = {
+ // These are the modes that are available.
+ { 640, 480 },
+ { 800, 600 },
+ { 1024, 768 },
+ { 1280, 1024 },
+ { 1280, 768 },
+ { 1280, 960 },
+ { 1360, 768 },
+ { 1400, 1050 },
+ { 1440, 900 },
+ { 1600, 1200 },
+ { 1680, 1050 },
+ { 1792, 1344 },
+ { 1856, 1392 },
+ { 1920, 1080 },
+ { 1920, 1200 },
+ { 1920, 1440 },
+ { 2048, 1152 },
+ { 2560, 1080 },
+ { 3840, 2160 },
+ { 4096, 2160 },
+ { 5120, 2160 },
+
+ // This are some random sizes that Enlightenment creates.
+ { 1, 1 },
+ { 190, 32 },
+ { 245, 137 },
+ { 408, 32 },
+ { 409, 32 },
+ { 1024, 256 },
+ };
+ const int hardcoded_sizes_count = sizeof(hardcoded_sizes) / sizeof(hardcoded_sizes[0]);
+
//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.bpp = 32; // virtio-gpu refuses to accept bpp=8
@@ -691,6 +728,13 @@ tbm_dumb_bufmgr_alloc_bo(hal_tbm_bufmgr *bufmgr, unsigned int size,
create_dumb_arg.height = root;
create_dumb_arg.width = (words + root - 1) / root;
}
+ for (int i = 0; i < hardcoded_sizes_count; ++i) {
+ if (hardcoded_sizes[i].w * hardcoded_sizes[i].h * 4 == size) {
+ create_dumb_arg.height = hardcoded_sizes[i].h;
+ create_dumb_arg.width = hardcoded_sizes[i].w;
+ break;
+ }
+ }
create_dumb_arg.flags = dumb_flags;
if (drmIoctl(bufmgr_data->fd, DRM_IOCTL_MODE_CREATE_DUMB, &create_dumb_arg)) {