diff options
| author | Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> | 2025-02-05 11:28:23 +0200 |
|---|---|---|
| committer | Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> | 2025-03-26 15:44:00 +0200 |
| commit | a9e7ecab862183399c5947931f2bad69ecec393d (patch) | |
| tree | 6c02b4e7a4cb19f9af1421afccd87eef1b084d3a /kms++/src/dumbframebuffer.cpp | |
| parent | 8b1c053359ed7593e43222daccb8c0db8fcc441f (diff) | |
PixelFormats: New PixelFormatInfo code
New pixel format code, from Python pixutils library.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Diffstat (limited to 'kms++/src/dumbframebuffer.cpp')
| -rw-r--r-- | kms++/src/dumbframebuffer.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/kms++/src/dumbframebuffer.cpp b/kms++/src/dumbframebuffer.cpp index fc50586..28039b6 100644 --- a/kms++/src/dumbframebuffer.cpp +++ b/kms++/src/dumbframebuffer.cpp @@ -34,22 +34,15 @@ DumbFramebuffer::DumbFramebuffer(Card& card, uint32_t width, uint32_t height, Pi m_num_planes = format_info.num_planes; for (int i = 0; i < format_info.num_planes; ++i) { - const PixelFormatPlaneInfo& pi = format_info.planes[i]; FramebufferPlane& plane = m_planes.at(i); + auto [w, h, bpp] = format_info.dumb_size(width, height); + /* create dumb buffer */ struct drm_mode_create_dumb creq = drm_mode_create_dumb(); - creq.width = width; - creq.height = height / pi.ysub; - /* - * For fully planar YUV buffers, the chroma planes don't combine - * U and V components, their width must thus be divided by the - * horizontal subsampling factor. - */ - if (format_info.type == PixelColorType::YUV && - format_info.num_planes == 3) - creq.width /= pi.xsub; - creq.bpp = pi.bitspp; + creq.width = w; + creq.height = h; + creq.bpp = bpp; r = drmIoctl(card.fd(), DRM_IOCTL_MODE_CREATE_DUMB, &creq); if (r) throw invalid_argument(string("DRM_IOCTL_MODE_CREATE_DUMB failed: ") + strerror(errno)); |
