From a9e7ecab862183399c5947931f2bad69ecec393d Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 5 Feb 2025 11:28:23 +0200 Subject: PixelFormats: New PixelFormatInfo code New pixel format code, from Python pixutils library. Signed-off-by: Tomi Valkeinen --- kms++/src/omap/omapframebuffer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'kms++/src/omap/omapframebuffer.cpp') diff --git a/kms++/src/omap/omapframebuffer.cpp b/kms++/src/omap/omapframebuffer.cpp index 3bea13e..2efe1ec 100644 --- a/kms++/src/omap/omapframebuffer.cpp +++ b/kms++/src/omap/omapframebuffer.cpp @@ -67,9 +67,9 @@ void OmapFramebuffer::Create(uint32_t width, uint32_t height, PixelFormat format uint32_t stride; if (!(buffer_flags & Flags::Tiled)) { - stride = width * pi.bitspp / 8; + stride = format_info.stride(width, i); - uint32_t size = stride * height / pi.ysub; + uint32_t size = format_info.planesize(stride, height, i); bo = omap_bo_new(m_omap_card.dev(), size, flags); if (!bo) @@ -110,13 +110,13 @@ void OmapFramebuffer::Create(uint32_t width, uint32_t height, PixelFormat format throw invalid_argument("bad bitspertiler"); } - uint32_t width_tiler = width * pi.bitspp / bitspertiler; + uint32_t width_tiler = format_info.stride(width, i) / pi.bytes_per_block; bo = omap_bo_new_tiled(m_omap_card.dev(), width_tiler, height, flags); if (!bo) throw invalid_argument(string("omap_bo_new_tiled failed: ") + strerror(errno)); - stride = round_up(width * pi.bitspp / 8, PAGE_SIZE); + stride = format_info.stride(width, i, PAGE_SIZE); } plane.omap_bo = bo; -- cgit v1.2.3