From f3a478951ac576c69a5828d80ff23d02e0940b9e Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 8 Dec 2016 01:44:33 +0200 Subject: omap: Add support for cached GEM objects OMAP buffers are mapped to userspace in write-combining mode by default. Add support for cached mappings. Signed-off-by: Laurent Pinchart --- kms++/src/omap/omapframebuffer.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'kms++/src/omap/omapframebuffer.cpp') diff --git a/kms++/src/omap/omapframebuffer.cpp b/kms++/src/omap/omapframebuffer.cpp index 312552c..0c8489e 100644 --- a/kms++/src/omap/omapframebuffer.cpp +++ b/kms++/src/omap/omapframebuffer.cpp @@ -19,15 +19,15 @@ using namespace std; namespace kms { -OmapFramebuffer::OmapFramebuffer(OmapCard& card, uint32_t width, uint32_t height, const string& fourcc) - : OmapFramebuffer(card, width, height, FourCCToPixelFormat(fourcc)) +OmapFramebuffer::OmapFramebuffer(OmapCard& card, uint32_t width, uint32_t height, const string& fourcc, bool cached) + : OmapFramebuffer(card, width, height, FourCCToPixelFormat(fourcc), cached) { } -OmapFramebuffer::OmapFramebuffer(OmapCard& card, uint32_t width, uint32_t height, PixelFormat format) +OmapFramebuffer::OmapFramebuffer(OmapCard& card, uint32_t width, uint32_t height, PixelFormat format, bool cached) : MappedFramebuffer(card, width, height), m_format(format) { - Create(); + Create(cached); } OmapFramebuffer::~OmapFramebuffer() @@ -35,7 +35,7 @@ OmapFramebuffer::~OmapFramebuffer() Destroy(); } -void OmapFramebuffer::Create() +void OmapFramebuffer::Create(bool cached) { const PixelFormatInfo& format_info = get_pixel_format_info(m_format); @@ -49,8 +49,9 @@ void OmapFramebuffer::Create() uint32_t size = stride * height(); struct drm_omap_gem_new creq = { .size = { .bytes = size }, - .flags = OMAP_BO_SCANOUT | OMAP_BO_WC, }; + creq.flags = (cached ? OMAP_BO_CACHED : OMAP_BO_WC) + | OMAP_BO_SCANOUT; int r = drmIoctl(card().fd(), DRM_IOCTL_OMAP_GEM_NEW, &creq); if (r) throw invalid_argument(string("DRM_IOCTL_OMAP_GEM_NEW failed: ") + strerror(errno)); -- cgit v1.2.3