diff options
-rw-r--r-- | kms++/inc/kms++/omap/omapframebuffer.h | 2 | ||||
-rw-r--r-- | kms++/src/omap/omapframebuffer.cpp | 20 | ||||
-rw-r--r-- | utils/kmstest.cpp | 3 | ||||
-rw-r--r-- | utils/kmstouch.cpp | 2 | ||||
-rw-r--r-- | utils/kmsview.cpp | 3 |
5 files changed, 19 insertions, 11 deletions
diff --git a/kms++/inc/kms++/omap/omapframebuffer.h b/kms++/inc/kms++/omap/omapframebuffer.h index 72329b4..b102a76 100644 --- a/kms++/inc/kms++/omap/omapframebuffer.h +++ b/kms++/inc/kms++/omap/omapframebuffer.h @@ -50,7 +50,7 @@ private: uint8_t* map; }; - void Create(Flags buffer_flags); + void Create(uint32_t width, uint32_t height, PixelFormat format, Flags buffer_flags); void Destroy(); unsigned m_num_planes; diff --git a/kms++/src/omap/omapframebuffer.cpp b/kms++/src/omap/omapframebuffer.cpp index eac45e2..3bea13e 100644 --- a/kms++/src/omap/omapframebuffer.cpp +++ b/kms++/src/omap/omapframebuffer.cpp @@ -33,7 +33,7 @@ OmapFramebuffer::OmapFramebuffer(OmapCard& card, uint32_t width, uint32_t height 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) { - Create(flags); + Create(width, height, format, flags); } OmapFramebuffer::~OmapFramebuffer() @@ -41,9 +41,9 @@ OmapFramebuffer::~OmapFramebuffer() Destroy(); } -void OmapFramebuffer::Create(Flags buffer_flags) +void OmapFramebuffer::Create(uint32_t width, uint32_t height, PixelFormat format, Flags buffer_flags) { - const PixelFormatInfo& format_info = get_pixel_format_info(m_format); + const PixelFormatInfo& format_info = get_pixel_format_info(format); m_num_planes = format_info.num_planes; @@ -67,9 +67,9 @@ void OmapFramebuffer::Create(Flags buffer_flags) uint32_t stride; if (!(buffer_flags & Flags::Tiled)) { - stride = width() * pi.bitspp / 8; + stride = width * pi.bitspp / 8; - uint32_t size = stride * height() / pi.ysub; + uint32_t size = stride * height / pi.ysub; bo = omap_bo_new(m_omap_card.dev(), size, flags); if (!bo) @@ -77,7 +77,7 @@ void OmapFramebuffer::Create(Flags buffer_flags) } else { unsigned bitspertiler; - switch (m_format) { + switch (format) { case PixelFormat::NV12: bitspertiler = i == 0 ? 8 : 16; break; @@ -110,13 +110,13 @@ void OmapFramebuffer::Create(Flags buffer_flags) throw invalid_argument("bad bitspertiler"); } - uint32_t width_tiler = width() * pi.bitspp / bitspertiler; + uint32_t width_tiler = width * pi.bitspp / bitspertiler; - bo = omap_bo_new_tiled(m_omap_card.dev(), width_tiler, height(), flags); + 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 = round_up(width * pi.bitspp / 8, PAGE_SIZE); } plane.omap_bo = bo; @@ -133,7 +133,7 @@ void OmapFramebuffer::Create(Flags buffer_flags) 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, (uint32_t)format, bo_handles, pitches, offsets, &id, 0); if (r) throw invalid_argument(string("drmModeAddFB2 failed: ") + strerror(errno)); diff --git a/utils/kmstest.cpp b/utils/kmstest.cpp index 981a2fd..3f1716f 100644 --- a/utils/kmstest.cpp +++ b/utils/kmstest.cpp @@ -1055,6 +1055,8 @@ private: static void main_flip(Card& card, const vector<OutputInfo>& outputs) { +// clang-tidy does not seem to handle FD_xxx macros +#ifndef __clang_analyzer__ fd_set fds; FD_ZERO(&fds); @@ -1101,6 +1103,7 @@ static void main_flip(Card& card, const vector<OutputInfo>& outputs) card.call_page_flip_handlers(); } } +#endif } int main(int argc, char** argv) diff --git a/utils/kmstouch.cpp b/utils/kmstouch.cpp index fbe0f3d..8afcee5 100644 --- a/utils/kmstouch.cpp +++ b/utils/kmstouch.cpp @@ -288,4 +288,6 @@ int main(int argc, char** argv) handle_event(ev, fb); } while (rc == 1 || rc == 0 || rc == -EAGAIN); + + delete fb; } diff --git a/utils/kmsview.cpp b/utils/kmsview.cpp index 952c643..c2654b0 100644 --- a/utils/kmsview.cpp +++ b/utils/kmsview.cpp @@ -1,6 +1,7 @@ #include <cstdio> #include <fstream> #include <unistd.h> +#include <cassert> #include <kms++/kms++.h> #include <kms++util/kms++util.h> @@ -92,6 +93,8 @@ int main(int argc, char** argv) for (unsigned i = 0; i < fb->num_planes(); ++i) frame_size += fb->size(i); + assert(frame_size); + unsigned num_frames = fsize / frame_size; printf("file size %u, frame size %u, frames %u\n", fsize, frame_size, num_frames); |