From 9cb56229bcd96448ae133c5b42622e1c1e740197 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 7 May 2026 22:18:39 +0300 Subject: kms++: Update pixel formats to latest upstream --- kms++/inc/kms++/pixelformats.h | 8 ++++---- kms++/src/pixelformats.cpp | 29 ++++++++++++++--------------- kms++util/src/conv-gray.h | 2 +- kms++util/src/conv-yuv-planar-packed.h | 4 ++-- kms++util/src/conv-yuv-semiplanar.h | 6 +++--- kms++util/src/testpat.cpp | 8 ++++---- 6 files changed, 28 insertions(+), 29 deletions(-) diff --git a/kms++/inc/kms++/pixelformats.h b/kms++/inc/kms++/pixelformats.h index 2d97b32..17b05c0 100644 --- a/kms++/inc/kms++/pixelformats.h +++ b/kms++/inc/kms++/pixelformats.h @@ -74,8 +74,8 @@ enum class PixelFormat { NV21, NV16, NV61, - XV15, - XV20, + P030, + P230, XVUY2101010, YUV420, YVU420, @@ -83,13 +83,13 @@ enum class PixelFormat { YVU422, YUV444, YVU444, - X403, + T430, Y8, Y10, Y10P, Y12, Y12P, - Y10_P32, + XYYY2101010, SBGGR8, SGBRG8, SGRBG8, diff --git a/kms++/src/pixelformats.cpp b/kms++/src/pixelformats.cpp index 95a7153..cf730ba 100644 --- a/kms++/src/pixelformats.cpp +++ b/kms++/src/pixelformats.cpp @@ -502,10 +502,10 @@ static map format_info_array = { } }, { - PixelFormat::XV15, { + PixelFormat::P030, { PixelFormatInfo { - "XV15", - "XV15", + "P030", + "P030", "", PixelColorType::YUV, { 6, 2 }, @@ -514,10 +514,10 @@ static map format_info_array = { } }, { - PixelFormat::XV20, { + PixelFormat::P230, { PixelFormatInfo { - "XV20", - "XV20", + "P230", + "P230", "", PixelColorType::YUV, { 6, 2 }, @@ -610,10 +610,10 @@ static map format_info_array = { } }, { - PixelFormat::X403, { + PixelFormat::T430, { PixelFormatInfo { - "X403", - "X403", + "T430", + "T430", "", PixelColorType::YUV, { 1, 1 }, @@ -682,9 +682,9 @@ static map format_info_array = { } }, { - PixelFormat::Y10_P32, { + PixelFormat::XYYY2101010, { PixelFormatInfo { - "Y10_P32", + "XYYY2101010", "YPA4", "", PixelColorType::YUV, @@ -987,7 +987,7 @@ static map format_info_array = { "MJPEG", "MJPG", "MJPG", - PixelColorType::YUV, + PixelColorType::Undefined, { 1, 1 }, { { 1, 1, 1, 1 } }, } @@ -1087,8 +1087,7 @@ uint32_t PixelFormatInfo::planesize(uint32_t stride, uint32_t height, return stride * (height / pi.vsub); } -uint32_t PixelFormatInfo::framesize(uint32_t width, uint32_t height, - uint32_t align) const +uint32_t PixelFormatInfo::framesize(uint32_t width, uint32_t height, uint32_t align) const { uint32_t size = 0; @@ -1113,7 +1112,7 @@ std::tuple PixelFormatInfo::dumb_size(uint32_t wid DRM_IOCTL_MODE_CREATE_DUMB takes a 'bpp' (bits-per-pixel) argument, which is then used with the width and height to allocate the buffer. This doesn't work for pixel formats where the average bits-per-pixel - is not an integer (e.g. XV15) + is not an integer (e.g. P030) So, we instead use the bytes_per_block (in bits) as the 'bpp' argument, and adjust the width accordingly. diff --git a/kms++util/src/conv-gray.h b/kms++util/src/conv-gray.h index fed8c5c..7fead46 100644 --- a/kms++util/src/conv-gray.h +++ b/kms++util/src/conv-gray.h @@ -28,7 +28,7 @@ using Y12_Layout = FormatLayout>>; -using Y10_P32_Layout = FormatLayout, // Y0 ComponentLayout, // Y1 ComponentLayout, // Y2 diff --git a/kms++util/src/conv-yuv-planar-packed.h b/kms++util/src/conv-yuv-planar-packed.h index 4475100..481b594 100644 --- a/kms++util/src/conv-yuv-planar-packed.h +++ b/kms++util/src/conv-yuv-planar-packed.h @@ -9,9 +9,9 @@ namespace kms { -/* YUV Planar Packed (only X403 for now) */ +/* YUV Planar Packed (only T430 for now) */ -struct X403_Layout : FormatLayout < +struct T430_Layout : FormatLayout < PlaneLayout, ComponentLayout, diff --git a/kms++util/src/conv-yuv-semiplanar.h b/kms++util/src/conv-yuv-semiplanar.h index f9d771d..81117c1 100644 --- a/kms++util/src/conv-yuv-semiplanar.h +++ b/kms++util/src/conv-yuv-semiplanar.h @@ -35,7 +35,7 @@ using NV16_Layout = NV12_Family_Layout; template -struct XV15_Family_Layout +struct P030_Family_Layout : public FormatLayout< PlaneLayout, @@ -56,8 +56,8 @@ struct XV15_Family_Layout static constexpr size_t v_sub = VSub; }; -using XV15_Layout = XV15_Family_Layout<2, 2>; -using XV20_Layout = XV15_Family_Layout<2, 1>; +using P030_Layout = P030_Family_Layout<2, 2>; +using P230_Layout = P030_Family_Layout<2, 1>; template struct SubsampleHelper { diff --git a/kms++util/src/testpat.cpp b/kms++util/src/testpat.cpp index e424103..b9f1e56 100644 --- a/kms++util/src/testpat.cpp +++ b/kms++util/src/testpat.cpp @@ -379,8 +379,8 @@ static void draw_test_pattern_part(IFramebuffer& fb, size_t start_y, size_t end_ break; switch (fb.format()) { - CASE_YUV_SEMI(XV20); - CASE_YUV_SEMI(XV15); + CASE_YUV_SEMI(P230); + CASE_YUV_SEMI(P030); CASE_YUV_SEMI(NV12); CASE_YUV_SEMI(NV21); CASE_YUV_SEMI(NV16); @@ -429,9 +429,9 @@ static void draw_test_pattern_part(IFramebuffer& fb, size_t start_y, size_t end_ CASE_YUV_PLANAR(YVU420); CASE_Y_ONLY(Y8); - CASE_Y_ONLY(Y10_P32); + CASE_Y_ONLY(XYYY2101010); - CASE_YUV_PLANAR_PACKED(X403); + CASE_YUV_PLANAR_PACKED(T430); CASE_RAW(SRGGB8); CASE_RAW(SGBRG8); -- cgit v1.2.3