diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2019-11-06 15:13:41 +0200 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2019-11-06 17:16:23 +0200 |
commit | 04aabd4740d9915a72898d8a1c286e8288ec5983 (patch) | |
tree | fb6f7725126f968ce7f4f0be6383edff0775855f | |
parent | 0281f19937bc31b43276c68aff27af1e291cdd97 (diff) |
dumbfb: cleanup to avoid calls to virtual funcs via constructor
-rw-r--r-- | kms++/inc/kms++/dumbframebuffer.h | 3 | ||||
-rw-r--r-- | kms++/src/dumbframebuffer.cpp | 20 |
2 files changed, 5 insertions, 18 deletions
diff --git a/kms++/inc/kms++/dumbframebuffer.h b/kms++/inc/kms++/dumbframebuffer.h index fb99d0e..9051c03 100644 --- a/kms++/inc/kms++/dumbframebuffer.h +++ b/kms++/inc/kms++/dumbframebuffer.h @@ -36,9 +36,6 @@ private: uint8_t *map; }; - void Create(); - void Destroy(); - unsigned m_num_planes; struct FramebufferPlane m_planes[4]; diff --git a/kms++/src/dumbframebuffer.cpp b/kms++/src/dumbframebuffer.cpp index 4419687..2b74c35 100644 --- a/kms++/src/dumbframebuffer.cpp +++ b/kms++/src/dumbframebuffer.cpp @@ -28,16 +28,6 @@ DumbFramebuffer::DumbFramebuffer(Card &card, uint32_t width, uint32_t height, co DumbFramebuffer::DumbFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format) :Framebuffer(card, width, height), m_format(format) { - Create(); -} - -DumbFramebuffer::~DumbFramebuffer() -{ - Destroy(); -} - -void DumbFramebuffer::Create() -{ int r; const PixelFormatInfo& format_info = get_pixel_format_info(m_format); @@ -50,10 +40,10 @@ void DumbFramebuffer::Create() /* create dumb buffer */ struct drm_mode_create_dumb creq = drm_mode_create_dumb(); - creq.width = width(); - creq.height = height() / pi.ysub; + creq.width = width; + creq.height = height / pi.ysub; creq.bpp = pi.bitspp; - r = drmIoctl(card().fd(), DRM_IOCTL_MODE_CREATE_DUMB, &creq); + r = drmIoctl(card.fd(), DRM_IOCTL_MODE_CREATE_DUMB, &creq); if (r) throw invalid_argument(string("DRM_IOCTL_MODE_CREATE_DUMB failed: ") + strerror(errno)); @@ -70,7 +60,7 @@ void DumbFramebuffer::Create() 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; - r = drmModeAddFB2(card().fd(), width(), height(), (uint32_t)format(), + 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)); @@ -78,7 +68,7 @@ void DumbFramebuffer::Create() set_id(id); } -void DumbFramebuffer::Destroy() +DumbFramebuffer::~DumbFramebuffer() { /* delete framebuffer */ drmModeRmFB(card().fd(), id()); |