diff options
Diffstat (limited to 'kms++util')
-rw-r--r-- | kms++util/CMakeLists.txt | 13 | ||||
-rw-r--r-- | kms++util/inc/kms++util/extcpuframebuffer.h | 7 | ||||
-rw-r--r-- | kms++util/inc/kms++util/resourcemanager.h | 1 | ||||
-rw-r--r-- | kms++util/src/extcpuframebuffer.cpp | 12 |
4 files changed, 22 insertions, 11 deletions
diff --git a/kms++util/CMakeLists.txt b/kms++util/CMakeLists.txt index 3977f70..2fc15e3 100644 --- a/kms++util/CMakeLists.txt +++ b/kms++util/CMakeLists.txt @@ -1,5 +1,6 @@ -file(GLOB SRCS "src/*.cpp" "src/*.h" "inc/kms++util/*.h") -add_library(kms++util ${SRCS}) +file(GLOB SRCS "src/*.cpp" "src/*.h") +file(GLOB PUB_HDRS "inc/kms++util/*.h") +add_library(kms++util ${SRCS} ${PUB_HDRS}) target_include_directories(kms++util PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc> @@ -7,3 +8,11 @@ target_include_directories(kms++util PUBLIC PRIVATE src) target_link_libraries(kms++util kms++ pthread) + +set_target_properties(kms++util PROPERTIES + PUBLIC_HEADER "${PUB_HDRS}") + +install(TARGETS kms++util + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + PUBLIC_HEADER DESTINATION include/kms++util) diff --git a/kms++util/inc/kms++util/extcpuframebuffer.h b/kms++util/inc/kms++util/extcpuframebuffer.h index 5d3be74..3652ec4 100644 --- a/kms++util/inc/kms++util/extcpuframebuffer.h +++ b/kms++util/inc/kms++util/extcpuframebuffer.h @@ -9,9 +9,9 @@ class ExtCPUFramebuffer : public IMappedFramebuffer { public: ExtCPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format, - uint8_t* buffer, uint32_t pitch); + uint8_t* buffer, uint32_t size, uint32_t pitch, uint32_t offset); ExtCPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format, - uint8_t* buffers[4], uint32_t pitches[4]); + uint8_t* buffers[4], uint32_t sizes[4], uint32_t pitches[4], uint32_t offsets[4]); virtual ~ExtCPUFramebuffer(); uint32_t width() const { return m_width; } @@ -22,13 +22,14 @@ public: 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 0; } + uint32_t offset(unsigned plane) const { return m_planes[plane].offset; } uint8_t* map(unsigned plane) { return m_planes[plane].map; } private: struct FramebufferPlane { uint32_t size; uint32_t stride; + uint32_t offset; uint8_t *map; }; diff --git a/kms++util/inc/kms++util/resourcemanager.h b/kms++util/inc/kms++util/resourcemanager.h index 92e7b93..42e5000 100644 --- a/kms++util/inc/kms++util/resourcemanager.h +++ b/kms++util/inc/kms++util/resourcemanager.h @@ -11,6 +11,7 @@ public: void reset(); + Card& card() const { return m_card; } Connector* reserve_connector(const std::string& name = ""); Crtc* reserve_crtc(Connector* conn); Plane* reserve_plane(Crtc* crtc, PlaneType type, PixelFormat format = PixelFormat::Undefined); diff --git a/kms++util/src/extcpuframebuffer.cpp b/kms++util/src/extcpuframebuffer.cpp index 232c778..feb3add 100644 --- a/kms++util/src/extcpuframebuffer.cpp +++ b/kms++util/src/extcpuframebuffer.cpp @@ -7,7 +7,7 @@ namespace kms { ExtCPUFramebuffer::ExtCPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format, - uint8_t* buffer, uint32_t pitch) + uint8_t* buffer, uint32_t size, uint32_t pitch, uint32_t offset) : m_width(width), m_height(height), m_format(format) { const PixelFormatInfo& format_info = get_pixel_format_info(m_format); @@ -16,16 +16,16 @@ ExtCPUFramebuffer::ExtCPUFramebuffer(uint32_t width, uint32_t height, PixelForma ASSERT(m_num_planes == 1); - const PixelFormatPlaneInfo& pi = format_info.planes[0]; FramebufferPlane& plane = m_planes[0]; plane.stride = pitch; - plane.size = plane.stride * height / pi.ysub; + plane.size = size; + plane.offset = offset; plane.map = buffer; } ExtCPUFramebuffer::ExtCPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format, - uint8_t* buffers[4], uint32_t pitches[4]) + uint8_t* buffers[4], uint32_t sizes[4], uint32_t pitches[4], uint32_t offsets[4]) : m_width(width), m_height(height), m_format(format) { const PixelFormatInfo& format_info = get_pixel_format_info(m_format); @@ -33,11 +33,11 @@ ExtCPUFramebuffer::ExtCPUFramebuffer(uint32_t width, uint32_t height, PixelForma m_num_planes = format_info.num_planes; for (unsigned i = 0; i < format_info.num_planes; ++i) { - const PixelFormatPlaneInfo& pi = format_info.planes[i]; FramebufferPlane& plane = m_planes[i]; plane.stride = pitches[i]; - plane.size = plane.stride * height / pi.ysub; + plane.size = sizes[i]; + plane.offset = offsets[i]; plane.map = buffers[i]; } } |