summaryrefslogtreecommitdiff
path: root/kms++/src/omap/omapframebuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kms++/src/omap/omapframebuffer.cpp')
-rw-r--r--kms++/src/omap/omapframebuffer.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/kms++/src/omap/omapframebuffer.cpp b/kms++/src/omap/omapframebuffer.cpp
index f33a286..eac45e2 100644
--- a/kms++/src/omap/omapframebuffer.cpp
+++ b/kms++/src/omap/omapframebuffer.cpp
@@ -18,21 +18,20 @@ extern "C" {
}
#define __round_mask(x, y) ((__typeof__(x))((y)-1))
-#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
+#define round_up(x, y) ((((x)-1) | __round_mask(x, y)) + 1)
#define PAGE_SIZE 4096
using namespace std;
namespace kms
{
-
OmapFramebuffer::OmapFramebuffer(OmapCard& card, uint32_t width, uint32_t height, const string& fourcc, Flags flags)
: OmapFramebuffer(card, width, height, FourCCToPixelFormat(fourcc), flags)
{
}
OmapFramebuffer::OmapFramebuffer(OmapCard& card, uint32_t width, uint32_t height, PixelFormat format, Flags flags)
- :Framebuffer(card, width, height), m_omap_card(card), m_format(format)
+ : Framebuffer(card, width, height), m_omap_card(card), m_format(format)
{
Create(flags);
}
@@ -80,23 +79,33 @@ void OmapFramebuffer::Create(Flags buffer_flags)
switch (m_format) {
case PixelFormat::NV12:
- bitspertiler = i == 0 ? 8 : 16; break;
+ bitspertiler = i == 0 ? 8 : 16;
+ break;
case PixelFormat::YUYV:
case PixelFormat::UYVY:
- bitspertiler = 32; break;
+ bitspertiler = 32;
+ break;
case PixelFormat::ARGB8888:
case PixelFormat::XRGB8888:
- bitspertiler = 32; break;
+ bitspertiler = 32;
+ break;
case PixelFormat::RGB565:
- bitspertiler = 16; break;
+ bitspertiler = 16;
+ break;
default:
throw invalid_argument("unimplemented format");
}
switch (bitspertiler) {
- case 8: flags |= OMAP_BO_TILED_8; break;
- case 16: flags |= OMAP_BO_TILED_16; break;
- case 32: flags |= OMAP_BO_TILED_32; break;
+ case 8:
+ flags |= OMAP_BO_TILED_8;
+ break;
+ case 16:
+ flags |= OMAP_BO_TILED_16;
+ break;
+ case 32:
+ flags |= OMAP_BO_TILED_32;
+ break;
default:
throw invalid_argument("bad bitspertiler");
}
@@ -125,7 +134,7 @@ void OmapFramebuffer::Create(Flags buffer_flags)
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(),
- bo_handles, pitches, offsets, &id, 0);
+ bo_handles, pitches, offsets, &id, 0);
if (r)
throw invalid_argument(string("drmModeAddFB2 failed: ") + strerror(errno));
@@ -181,4 +190,4 @@ int OmapFramebuffer::prime_fd(unsigned int plane)
return fd;
}
-}
+} // namespace kms