From 98f1a10ef35858e04eb63c1dc092da559606aeec Mon Sep 17 00:00:00 2001 From: Mateusz Majewski Date: Wed, 20 Mar 2024 11:56:48 +0100 Subject: WIDTH_HACK --- src/tbm_backend_dumb.c | 53 +++++++------------------------------------------- 1 file changed, 7 insertions(+), 46 deletions(-) diff --git a/src/tbm_backend_dumb.c b/src/tbm_backend_dumb.c index 34498c4..fe52d37 100644 --- a/src/tbm_backend_dumb.c +++ b/src/tbm_backend_dumb.c @@ -66,6 +66,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define TBM_SURFACE_ALIGNMENT_PITCH_RGB (128) #define TBM_SURFACE_ALIGNMENT_PITCH_YUV (16) +#define WIDTH_HACK 1024 + typedef struct _tbm_dumb_bufmgr tbm_dumb_bufmgr; typedef struct _tbm_dumb_bo tbm_dumb_bo; @@ -697,47 +699,13 @@ 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.format = 3; // ARGB; XRGB would be 4 - if (size <= 16384) { + if (size % (WIDTH_HACK * 4) == 0) { + create_dumb_arg.width = WIDTH_HACK; + create_dumb_arg.height = size / (WIDTH_HACK * 4); + } else if (size <= 16384) { create_dumb_arg.height = 1; create_dumb_arg.width = (size + 4 - 1) / 4; } else { @@ -747,13 +715,6 @@ 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.depth = 1; create_dumb_arg.size = create_dumb_arg.width * create_dumb_arg.height; create_dumb_arg.stride = create_dumb_arg.width * 4; @@ -1523,4 +1484,4 @@ hal_backend hal_backend_tbm_data = { HAL_ABI_VERSION_TIZEN_6_5, hal_backend_tbm_dumb_init, hal_backend_tbm_dumb_exit -}; \ No newline at end of file +}; -- cgit v1.2.3