summaryrefslogtreecommitdiff
path: root/kms++
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2025-02-05 12:03:34 +0200
committerTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2025-03-26 15:44:00 +0200
commita35d57fa9088fbccd468ad095c89aba096b2494e (patch)
tree24b73249e7e741e36ed1b03a9b92461fd36bfa72 /kms++
parent1936a703bf1a3b27db9bb4d503b861f6d1fa2e74 (diff)
Use the fourcc helpers
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Diffstat (limited to 'kms++')
-rw-r--r--kms++/src/dmabufframebuffer.cpp4
-rw-r--r--kms++/src/dumbframebuffer.cpp2
-rw-r--r--kms++/src/extframebuffer.cpp4
-rw-r--r--kms++/src/framebuffer.cpp2
-rw-r--r--kms++/src/omap/omapframebuffer.cpp2
-rw-r--r--kms++/src/plane.cpp6
6 files changed, 11 insertions, 9 deletions
diff --git a/kms++/src/dmabufframebuffer.cpp b/kms++/src/dmabufframebuffer.cpp
index e5d06ed..f303799 100644
--- a/kms++/src/dmabufframebuffer.cpp
+++ b/kms++/src/dmabufframebuffer.cpp
@@ -58,13 +58,13 @@ DmabufFramebuffer::DmabufFramebuffer(Card& card, uint32_t width, uint32_t height
offsets.resize(4);
if (modifiers.empty()) {
- r = drmModeAddFB2(card.fd(), width, height, (uint32_t)format,
+ r = drmModeAddFB2(card.fd(), width, height, pixel_format_to_fourcc(format),
bo_handles, pitches.data(), offsets.data(), &id, 0);
if (r)
throw invalid_argument(string("drmModeAddFB2 failed: ") + strerror(errno));
} else {
modifiers.resize(4);
- r = drmModeAddFB2WithModifiers(card.fd(), width, height, (uint32_t)format,
+ r = drmModeAddFB2WithModifiers(card.fd(), width, height, pixel_format_to_fourcc(format),
bo_handles, pitches.data(), offsets.data(), modifiers.data(), &id, DRM_MODE_FB_MODIFIERS);
if (r)
throw invalid_argument(string("drmModeAddFB2WithModifiers failed: ") + strerror(errno));
diff --git a/kms++/src/dumbframebuffer.cpp b/kms++/src/dumbframebuffer.cpp
index bdc584e..e035061 100644
--- a/kms++/src/dumbframebuffer.cpp
+++ b/kms++/src/dumbframebuffer.cpp
@@ -75,7 +75,7 @@ DumbFramebuffer::DumbFramebuffer(Card& card, uint32_t width, uint32_t height, Pi
m_planes[3].offset,
};
uint32_t id;
- r = drmModeAddFB2(card.fd(), width, height, (uint32_t)format,
+ r = drmModeAddFB2(card.fd(), width, height, pixel_format_to_fourcc(format),
bo_handles, pitches, offsets, &id, 0);
if (r)
throw invalid_argument(string("drmModeAddFB2 failed: ") + strerror(errno));
diff --git a/kms++/src/extframebuffer.cpp b/kms++/src/extframebuffer.cpp
index 78b6fbb..d67cbad 100644
--- a/kms++/src/extframebuffer.cpp
+++ b/kms++/src/extframebuffer.cpp
@@ -44,10 +44,10 @@ ExtFramebuffer::ExtFramebuffer(Card& card, uint32_t width, uint32_t height, Pixe
int r;
if (modifiers.empty()) {
- r = drmModeAddFB2(card.fd(), width, height, (uint32_t)format, handles.data(), pitches.data(), offsets.data(), &id, 0);
+ r = drmModeAddFB2(card.fd(), width, height, pixel_format_to_fourcc(format), handles.data(), pitches.data(), offsets.data(), &id, 0);
} else {
modifiers.resize(4);
- r = drmModeAddFB2WithModifiers(card.fd(), width, height, (uint32_t)format, handles.data(), pitches.data(), offsets.data(), modifiers.data(), &id, DRM_MODE_FB_MODIFIERS);
+ r = drmModeAddFB2WithModifiers(card.fd(), width, height, pixel_format_to_fourcc(format), handles.data(), pitches.data(), offsets.data(), modifiers.data(), &id, DRM_MODE_FB_MODIFIERS);
}
if (r)
diff --git a/kms++/src/framebuffer.cpp b/kms++/src/framebuffer.cpp
index 3a76b73..773cf4b 100644
--- a/kms++/src/framebuffer.cpp
+++ b/kms++/src/framebuffer.cpp
@@ -25,7 +25,7 @@ Framebuffer::Framebuffer(Card& card, uint32_t id)
if (fb) {
m_width = fb->width;
m_height = fb->height;
- m_format = (PixelFormat)fb->pixel_format;
+ m_format = fourcc_to_pixel_format(fb->pixel_format);
drmModeFreeFB2(fb);
} else {
diff --git a/kms++/src/omap/omapframebuffer.cpp b/kms++/src/omap/omapframebuffer.cpp
index 35852bf..9f9d7c7 100644
--- a/kms++/src/omap/omapframebuffer.cpp
+++ b/kms++/src/omap/omapframebuffer.cpp
@@ -133,7 +133,7 @@ void OmapFramebuffer::Create(uint32_t width, uint32_t height, PixelFormat format
uint32_t pitches[4] = { m_planes[0].stride, m_planes[1].stride };
uint32_t offsets[4] = { m_planes[0].offset, m_planes[1].offset };
uint32_t id;
- int r = drmModeAddFB2(card().fd(), width, height, (uint32_t)format,
+ int r = drmModeAddFB2(card().fd(), width, height, pixel_format_to_fourcc(format),
bo_handles, pitches, offsets, &id, 0);
if (r)
throw invalid_argument(string("drmModeAddFB2 failed: ") + strerror(errno));
diff --git a/kms++/src/plane.cpp b/kms++/src/plane.cpp
index bd426dd..93b3479 100644
--- a/kms++/src/plane.cpp
+++ b/kms++/src/plane.cpp
@@ -40,8 +40,10 @@ bool Plane::supports_format(PixelFormat fmt) const
{
auto p = m_priv->drm_plane;
+ uint32_t fcc = pixel_format_to_fourcc(fmt);
+
for (unsigned i = 0; i < p->count_formats; ++i)
- if ((uint32_t)fmt == p->formats[i])
+ if (fcc == p->formats[i])
return true;
return false;
@@ -94,7 +96,7 @@ vector<PixelFormat> Plane::get_formats() const
vector<PixelFormat> r;
for (unsigned i = 0; i < p->count_formats; ++i)
- r.push_back((PixelFormat)p->formats[i]);
+ r.push_back(fourcc_to_pixel_format(p->formats[i]));
return r;
}