From a5c28bcb2ead34e921617711ebf94ffcb5d72878 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Mon, 23 May 2016 09:54:08 +0300 Subject: File/dir renames --- libkmstest/CMakeLists.txt | 5 - libkmstest/color.cpp | 93 ------------- libkmstest/color.h | 39 ------ libkmstest/colorbar.cpp | 128 ----------------- libkmstest/cpuframebuffer.cpp | 36 ----- libkmstest/cpuframebuffer.h | 44 ------ libkmstest/extcpuframebuffer.cpp | 50 ------- libkmstest/extcpuframebuffer.h | 42 ------ libkmstest/kmstest.h | 15 -- libkmstest/opts.cpp | 117 ---------------- libkmstest/opts.h | 38 ----- libkmstest/test.h | 32 ----- libkmstest/testpat.cpp | 291 --------------------------------------- 13 files changed, 930 deletions(-) delete mode 100644 libkmstest/CMakeLists.txt delete mode 100644 libkmstest/color.cpp delete mode 100644 libkmstest/color.h delete mode 100644 libkmstest/colorbar.cpp delete mode 100644 libkmstest/cpuframebuffer.cpp delete mode 100644 libkmstest/cpuframebuffer.h delete mode 100644 libkmstest/extcpuframebuffer.cpp delete mode 100644 libkmstest/extcpuframebuffer.h delete mode 100644 libkmstest/kmstest.h delete mode 100644 libkmstest/opts.cpp delete mode 100644 libkmstest/opts.h delete mode 100644 libkmstest/test.h delete mode 100644 libkmstest/testpat.cpp (limited to 'libkmstest') diff --git a/libkmstest/CMakeLists.txt b/libkmstest/CMakeLists.txt deleted file mode 100644 index e7980ee..0000000 --- a/libkmstest/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -file(GLOB SRCS "*.cpp" "*.h") -add_library(kmstest ${SRCS}) - -target_link_libraries(kmstest kms++) -target_include_directories(kmstest PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/libkmstest/color.cpp b/libkmstest/color.cpp deleted file mode 100644 index 490ff64..0000000 --- a/libkmstest/color.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include "color.h" - -namespace kms -{ -RGB::RGB() -{ - r = g = b = 0; - a = 255; -} - -RGB::RGB(uint8_t r, uint8_t g, uint8_t b) - :RGB(255, r, g, b) -{ -} - -RGB::RGB(uint8_t a, uint8_t r, uint8_t g, uint8_t b) -{ - this->r = r; - this->g = g; - this->b = b; - this->a = a; -} - -RGB::RGB(uint32_t argb) -{ - this->b = (argb >> 0) & 0xff; - this->g = (argb >> 8) & 0xff; - this->r = (argb >> 16) & 0xff; - this->a = (argb >> 24) & 0xff; -} - -uint32_t RGB::rgb888() const -{ - return (r << 16) | (g << 8) | (b << 0); -} - -uint32_t RGB::argb8888() const -{ - return (a << 24) | (r << 16) | (g << 8) | (b << 0); -} - -uint32_t RGB::abgr8888() const -{ - return (a << 24) | (b << 16) | (g << 8) | (r << 0); -} - -uint16_t RGB::rgb565() const -{ - return ((r >> 3) << 11) | ((g >> 2) << 5) | ((b >> 3) << 0); -} - -YUV RGB::yuv() const -{ - return YUV(*this); -} - - -YUV::YUV() -{ - y = u = v = a = 0; -} - -YUV::YUV(uint8_t y, uint8_t u, uint8_t v) -{ - this->y = y; - this->u = u; - this->v = v; - this->a = 0; -} - -static inline uint8_t MAKE_YUV_601_Y(uint8_t r, uint8_t g, uint8_t b) -{ - return (((66 * r + 129 * g + 25 * b + 128) >> 8) + 16); -} - -static inline uint8_t MAKE_YUV_601_U(uint8_t r, uint8_t g, uint8_t b) -{ - return (((-38 * r - 74 * g + 112 * b + 128) >> 8) + 128); -} - -static inline uint8_t MAKE_YUV_601_V(uint8_t r, uint8_t g, uint8_t b) -{ - return (((112 * r - 94 * g - 18 * b + 128) >> 8) + 128); -} - -YUV::YUV(const RGB& rgb) -{ - this->y = MAKE_YUV_601_Y(rgb.r, rgb.g, rgb.b); - this->u = MAKE_YUV_601_U(rgb.r, rgb.g, rgb.b); - this->v = MAKE_YUV_601_V(rgb.r, rgb.g, rgb.b); - this->a = rgb.a; -} -} diff --git a/libkmstest/color.h b/libkmstest/color.h deleted file mode 100644 index ef85a67..0000000 --- a/libkmstest/color.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include - -namespace kms -{ -struct YUV; - -struct RGB -{ - RGB(); - RGB(uint8_t r, uint8_t g, uint8_t b); - RGB(uint8_t a, uint8_t r, uint8_t g, uint8_t b); - RGB(uint32_t argb); - - uint32_t rgb888() const; - uint32_t argb8888() const; - uint32_t abgr8888() const; - uint16_t rgb565() const; - YUV yuv() const; - - uint8_t b; - uint8_t g; - uint8_t r; - uint8_t a; -}; - -struct YUV -{ - YUV(); - YUV(uint8_t y, uint8_t u, uint8_t v); - YUV(const RGB& rgb); - - uint8_t v; - uint8_t u; - uint8_t y; - uint8_t a; -}; -} diff --git a/libkmstest/colorbar.cpp b/libkmstest/colorbar.cpp deleted file mode 100644 index 9fbec28..0000000 --- a/libkmstest/colorbar.cpp +++ /dev/null @@ -1,128 +0,0 @@ -#include - -#include - -#include "test.h" - -namespace kms -{ -static const RGB colors32[] = { - RGB(255, 255, 255), - RGB(255, 0, 0), - RGB(255, 255, 255), - RGB(0, 255, 0), - RGB(255, 255, 255), - RGB(0, 0, 255), - RGB(255, 255, 255), - RGB(200, 200, 200), - RGB(255, 255, 255), - RGB(100, 100, 100), - RGB(255, 255, 255), - RGB(50, 50, 50), -}; - -static const uint16_t colors16[] = { - colors32[0].rgb565(), - colors32[1].rgb565(), - colors32[2].rgb565(), - colors32[3].rgb565(), - colors32[4].rgb565(), - colors32[5].rgb565(), - colors32[6].rgb565(), - colors32[7].rgb565(), - colors32[8].rgb565(), - colors32[9].rgb565(), - colors32[10].rgb565(), - colors32[11].rgb565(), -}; - -static void drm_draw_color_bar_rgb888(IMappedFramebuffer& buf, int old_xpos, int xpos, int width) -{ - for (unsigned y = 0; y < buf.height(); ++y) { - RGB bcol = colors32[y * ARRAY_SIZE(colors32) / buf.height()]; - uint32_t *line = (uint32_t*)(buf.map(0) + buf.stride(0) * y); - - if (old_xpos >= 0) { - for (int x = old_xpos; x < old_xpos + width; ++x) - line[x] = 0; - } - - for (int x = xpos; x < xpos + width; ++x) - line[x] = bcol.argb8888(); - } -} - -static void drm_draw_color_bar_rgb565(IMappedFramebuffer& buf, int old_xpos, int xpos, int width) -{ - static_assert(ARRAY_SIZE(colors32) == ARRAY_SIZE(colors16), "bad colors arrays"); - - for (unsigned y = 0; y < buf.height(); ++y) { - uint16_t bcol = colors16[y * ARRAY_SIZE(colors16) / buf.height()]; - uint16_t *line = (uint16_t*)(buf.map(0) + buf.stride(0) * y); - - if (old_xpos >= 0) { - for (int x = old_xpos; x < old_xpos + width; ++x) - line[x] = 0; - } - - for (int x = xpos; x < xpos + width; ++x) - line[x] = bcol; - } -} - -static void drm_draw_color_bar_semiplanar_yuv(IMappedFramebuffer& buf, int old_xpos, int xpos, int width) -{ - const uint8_t colors[] = { - 0xff, - 0x00, - 0xff, - 0x20, - 0xff, - 0x40, - 0xff, - 0x80, - 0xff, - }; - - for (unsigned y = 0; y < buf.height(); ++y) { - unsigned int bcol = colors[y * ARRAY_SIZE(colors) / buf.height()]; - uint8_t *line = (uint8_t*)(buf.map(0) + buf.stride(0) * y); - - if (old_xpos >= 0) { - for (int x = old_xpos; x < old_xpos + width; ++x) - line[x] = 0; - } - - for (int x = xpos; x < xpos + width; ++x) - line[x] = bcol; - } -} - -void draw_color_bar(IMappedFramebuffer& buf, int old_xpos, int xpos, int width) -{ - switch (buf.format()) { - case PixelFormat::NV12: - case PixelFormat::NV21: - // XXX not right but gets something on the screen - drm_draw_color_bar_semiplanar_yuv(buf, old_xpos, xpos, width); - break; - - case PixelFormat::YUYV: - case PixelFormat::UYVY: - // XXX not right but gets something on the screen - drm_draw_color_bar_rgb565(buf, old_xpos, xpos, width); - break; - - case PixelFormat::RGB565: - drm_draw_color_bar_rgb565(buf, old_xpos, xpos, width); - break; - - case PixelFormat::XRGB8888: - drm_draw_color_bar_rgb888(buf, old_xpos, xpos, width); - break; - - default: - ASSERT(false); - } -} -} diff --git a/libkmstest/cpuframebuffer.cpp b/libkmstest/cpuframebuffer.cpp deleted file mode 100644 index 1f14ddc..0000000 --- a/libkmstest/cpuframebuffer.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include - -#include "cpuframebuffer.h" - -using namespace std; - -namespace kms { - -CPUFramebuffer::CPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format) - : m_width(width), m_height(height), m_format(format) -{ - const PixelFormatInfo& format_info = get_pixel_format_info(m_format); - - 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 = width * pi.bitspp / 8; - plane.size = plane.stride * height/ pi.ysub; - plane.offset = 0; - plane.map = new uint8_t[plane.size]; - } -} - -CPUFramebuffer::~CPUFramebuffer() -{ - for (unsigned i = 0; i < m_num_planes; ++i) { - FramebufferPlane& plane = m_planes[i]; - - delete plane.map; - } -} - -} diff --git a/libkmstest/cpuframebuffer.h b/libkmstest/cpuframebuffer.h deleted file mode 100644 index d2073bc..0000000 --- a/libkmstest/cpuframebuffer.h +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -#include "kms++.h" - -namespace kms -{ - -class CPUFramebuffer : public IMappedFramebuffer { -public: - CPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format); - - virtual ~CPUFramebuffer(); - - CPUFramebuffer(const CPUFramebuffer& other) = delete; - CPUFramebuffer& operator=(const CPUFramebuffer& other) = delete; - - uint32_t width() const { return m_width; } - uint32_t height() const { return m_height; } - - PixelFormat format() const { return m_format; } - unsigned num_planes() const { return m_num_planes; } - - 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) { return m_planes[plane].map; } - -private: - struct FramebufferPlane { - uint32_t size; - uint32_t stride; - uint32_t offset; - uint8_t *map; - }; - - uint32_t m_width; - uint32_t m_height; - PixelFormat m_format; - - unsigned m_num_planes; - struct FramebufferPlane m_planes[4]; -}; - -} diff --git a/libkmstest/extcpuframebuffer.cpp b/libkmstest/extcpuframebuffer.cpp deleted file mode 100644 index 145168f..0000000 --- a/libkmstest/extcpuframebuffer.cpp +++ /dev/null @@ -1,50 +0,0 @@ - -#include "extcpuframebuffer.h" -#include "test.h" - -using namespace std; - -namespace kms -{ - -ExtCPUFramebuffer::ExtCPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format, - uint8_t* buffer, uint32_t pitch) - : m_width(width), m_height(height), m_format(format) -{ - const PixelFormatInfo& format_info = get_pixel_format_info(m_format); - - m_num_planes = format_info.num_planes; - - 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.map = buffer; -} - -ExtCPUFramebuffer::ExtCPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format, - uint8_t* buffers[4], uint32_t pitches[4]) - : m_width(width), m_height(height), m_format(format) -{ - const PixelFormatInfo& format_info = get_pixel_format_info(m_format); - - 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.map = buffers[i]; - } -} - -ExtCPUFramebuffer::~ExtCPUFramebuffer() -{ -} - -} diff --git a/libkmstest/extcpuframebuffer.h b/libkmstest/extcpuframebuffer.h deleted file mode 100644 index 172841f..0000000 --- a/libkmstest/extcpuframebuffer.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include "kms++.h" - -namespace kms -{ - -class ExtCPUFramebuffer : public IMappedFramebuffer -{ -public: - ExtCPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format, - uint8_t* buffer, uint32_t pitch); - ExtCPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format, - uint8_t* buffers[4], uint32_t pitches[4]); - virtual ~ExtCPUFramebuffer(); - - uint32_t width() const { return m_width; } - uint32_t height() const { return m_height; } - - PixelFormat format() const { return m_format; } - unsigned num_planes() const { return m_num_planes; } - - 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; } - uint8_t* map(unsigned plane) { return m_planes[plane].map; } - -private: - struct FramebufferPlane { - uint32_t size; - uint32_t stride; - uint8_t *map; - }; - - uint32_t m_width; - uint32_t m_height; - PixelFormat m_format; - - unsigned m_num_planes; - struct FramebufferPlane m_planes[4]; -}; -} diff --git a/libkmstest/kmstest.h b/libkmstest/kmstest.h deleted file mode 100644 index aed40fe..0000000 --- a/libkmstest/kmstest.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include "color.h" -#include "framebuffer.h" - -namespace kms -{ -class IMappedFramebuffer; - -void draw_color_bar(IMappedFramebuffer& buf, int old_xpos, int xpos, int width); - -void draw_test_pattern(IMappedFramebuffer &fb); - -void draw_rect(IMappedFramebuffer &fb, uint32_t x, uint32_t y, uint32_t w, uint32_t h, RGB color); -} diff --git a/libkmstest/opts.cpp b/libkmstest/opts.cpp deleted file mode 100644 index 4ea31f8..0000000 --- a/libkmstest/opts.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include - -#include -#include - -#include "opts.h" - -using namespace std; - -Option::Option(const string& str, function func) - : m_void_func(func) -{ - parse(str); -} - -Option::Option(const string& str, function func) - : m_func(func) -{ - parse(str); -} - -void Option::parse(const string& str) -{ - auto iend = str.end(); - if (*(iend - 1) == '=') { - iend--; - m_has_arg = 1; - } else if (*(iend - 1) == '?') { - iend--; - m_has_arg = 2; - } else { - m_has_arg = 0; - } - - auto isplit = find(str.begin(), iend, '|'); - - if (isplit != str.begin()) - m_short = str[0]; - else - m_short = 0; - - if (isplit != iend) - m_long = string(isplit + 1, iend); -} - -OptionSet::OptionSet(initializer_list