From cb747ea27451266c6d340a018aedcd0675a18b00 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Fri, 23 Sep 2016 14:54:39 +0300 Subject: Add OmapCard and OmapFramebuffer Add OmapCard and OmapFramebuffer classes to utilize omap_bos. Only non-tiled framebuffer is implemented for now. Signed-off-by: Tomi Valkeinen --- kms++/inc/kms++/omap/omapcard.h | 21 ++++++++++++++ kms++/inc/kms++/omap/omapframebuffer.h | 52 ++++++++++++++++++++++++++++++++++ kms++/inc/kms++/omap/omapkms++.h | 4 +++ 3 files changed, 77 insertions(+) create mode 100644 kms++/inc/kms++/omap/omapcard.h create mode 100644 kms++/inc/kms++/omap/omapframebuffer.h create mode 100644 kms++/inc/kms++/omap/omapkms++.h (limited to 'kms++/inc') diff --git a/kms++/inc/kms++/omap/omapcard.h b/kms++/inc/kms++/omap/omapcard.h new file mode 100644 index 0000000..5c2f3a5 --- /dev/null +++ b/kms++/inc/kms++/omap/omapcard.h @@ -0,0 +1,21 @@ +#pragma once + +#include + +struct omap_device; + +namespace kms +{ +class OmapCard : public Card +{ +public: + OmapCard(); + OmapCard(const std::string& device); + virtual ~OmapCard(); + + struct omap_device* dev() const { return m_omap_dev; } + +private: + struct omap_device* m_omap_dev; +}; +} diff --git a/kms++/inc/kms++/omap/omapframebuffer.h b/kms++/inc/kms++/omap/omapframebuffer.h new file mode 100644 index 0000000..b39ede6 --- /dev/null +++ b/kms++/inc/kms++/omap/omapframebuffer.h @@ -0,0 +1,52 @@ +#pragma once + +#include +#include + +struct omap_bo; + +namespace kms +{ +class OmapCard; + +class OmapFramebuffer : public MappedFramebuffer +{ +public: + OmapFramebuffer(OmapCard& card, uint32_t width, uint32_t height, PixelFormat format); + virtual ~OmapFramebuffer(); + + uint32_t width() const { return Framebuffer::width(); } + uint32_t height() const { return Framebuffer::height(); } + + PixelFormat format() const { return m_format; } + unsigned num_planes() const { return m_num_planes; } + + uint32_t handle(unsigned plane) const { return m_planes[plane].handle; } + uint32_t stride(unsigned plane) const { return m_planes[plane].stride; } + 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); + int prime_fd(unsigned plane); + +private: + OmapCard& m_omap_card; + + struct FramebufferPlane { + struct omap_bo* omap_bo; + uint32_t handle; + int prime_fd; + uint32_t size; + uint32_t stride; + uint32_t offset; + uint8_t* map; + }; + + void Create(); + void Destroy(); + + unsigned m_num_planes; + struct FramebufferPlane m_planes[3]; + + PixelFormat m_format; +}; +} diff --git a/kms++/inc/kms++/omap/omapkms++.h b/kms++/inc/kms++/omap/omapkms++.h new file mode 100644 index 0000000..0d86841 --- /dev/null +++ b/kms++/inc/kms++/omap/omapkms++.h @@ -0,0 +1,4 @@ +#pragma once + +#include +#include -- cgit v1.2.3