From e1b78c7b484a5025d854d8f1e5d0cc3f2cc3113e Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 12 Nov 2015 20:20:04 +0200 Subject: dumbfb: move prime_fd() and fix its return type --- libkms++/dumbframebuffer.cpp | 26 +++++++++++++------------- libkms++/dumbframebuffer.h | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'libkms++') diff --git a/libkms++/dumbframebuffer.cpp b/libkms++/dumbframebuffer.cpp index 730d297..ec0fefb 100644 --- a/libkms++/dumbframebuffer.cpp +++ b/libkms++/dumbframebuffer.cpp @@ -35,19 +35,6 @@ DumbFramebuffer::~DumbFramebuffer() Destroy(); } -uint32_t DumbFramebuffer::prime_fd(unsigned int plane) -{ - if (m_planes[plane].prime_fd >= 0) - return m_planes[plane].prime_fd; - - int r = drmPrimeHandleToFD(card().fd(), m_planes[plane].handle, - DRM_CLOEXEC, &m_planes[plane].prime_fd); - if (r) - throw std::runtime_error("drmPrimeHandleToFD failed\n"); - - return m_planes[plane].prime_fd; -} - struct FormatPlaneInfo { uint8_t bitspp; /* bits per (macro) pixel */ @@ -164,4 +151,17 @@ uint8_t* DumbFramebuffer::map(unsigned plane) return p.map; } +int DumbFramebuffer::prime_fd(unsigned int plane) +{ + if (m_planes[plane].prime_fd >= 0) + return m_planes[plane].prime_fd; + + int r = drmPrimeHandleToFD(card().fd(), m_planes[plane].handle, + DRM_CLOEXEC, &m_planes[plane].prime_fd); + if (r) + throw std::runtime_error("drmPrimeHandleToFD failed\n"); + + return m_planes[plane].prime_fd; +} + } diff --git a/libkms++/dumbframebuffer.h b/libkms++/dumbframebuffer.h index c221421..226a8dc 100644 --- a/libkms++/dumbframebuffer.h +++ b/libkms++/dumbframebuffer.h @@ -20,7 +20,7 @@ public: uint32_t size(unsigned plane) const { return m_planes[plane].size; } uint32_t offset(unsigned plane) const { return m_planes[plane].offset; } uint8_t* map(unsigned plane); - uint32_t prime_fd(unsigned plane); + int prime_fd(unsigned plane); private: struct FramebufferPlane { -- cgit v1.2.3