summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2016-06-16 17:59:07 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-06-16 17:59:12 +0300
commit34e63f641195019e903104c8b9e6eb855efeee2c (patch)
tree71054520c956ec9ce9f7a588a913921fa4175b2f
parenta17a7364011f30d40c8ef214addda814c0513fb8 (diff)
Support RGB888
-rw-r--r--kms++/inc/kms++/pixelformats.h2
-rw-r--r--kms++/src/pixelformats.cpp2
-rw-r--r--kms++util/src/drawing.cpp9
-rw-r--r--kms++util/src/testpat.cpp1
-rw-r--r--py/pykmsbase.cpp2
5 files changed, 16 insertions, 0 deletions
diff --git a/kms++/inc/kms++/pixelformats.h b/kms++/inc/kms++/pixelformats.h
index 813eaef..8ecfcb3 100644
--- a/kms++/inc/kms++/pixelformats.h
+++ b/kms++/inc/kms++/pixelformats.h
@@ -27,6 +27,8 @@ enum class PixelFormat : uint32_t
ARGB8888 = MakeFourCC("AR24"),
ABGR8888 = MakeFourCC("AB24"),
+ RGB888 = MakeFourCC("RG24"),
+
RGB565 = MakeFourCC("RG16"),
};
diff --git a/kms++/src/pixelformats.cpp b/kms++/src/pixelformats.cpp
index f2b1137..ee2356d 100644
--- a/kms++/src/pixelformats.cpp
+++ b/kms++/src/pixelformats.cpp
@@ -17,6 +17,8 @@ static const map<PixelFormat, PixelFormatInfo> format_info_array = {
{ PixelFormat::NV21, { 2, { { 8, 1, 1, }, { 8, 2, 2 } }, } },
/* RGB16 */
{ PixelFormat::RGB565, { 1, { { 16, 1, 1 } }, } },
+ /* RGB24 */
+ { PixelFormat::RGB888, { 1, { { 24, 1, 1 } }, } },
/* RGB32 */
{ PixelFormat::XRGB8888, { 1, { { 32, 1, 1 } }, } },
{ PixelFormat::XBGR8888, { 1, { { 32, 1, 1 } }, } },
diff --git a/kms++util/src/drawing.cpp b/kms++util/src/drawing.cpp
index cb6fbf6..157c799 100644
--- a/kms++util/src/drawing.cpp
+++ b/kms++util/src/drawing.cpp
@@ -23,6 +23,14 @@ void draw_rgb_pixel(IMappedFramebuffer& buf, unsigned x, unsigned y, RGB color)
*p = color.abgr8888();
break;
}
+ case PixelFormat::RGB888:
+ {
+ uint8_t *p = buf.map(0) + buf.stride(0) * y + x * 3;
+ p[0] = color.r;
+ p[1] = color.g;
+ p[2] = color.b;
+ break;
+ }
case PixelFormat::RGB565:
{
uint16_t *p = (uint16_t*)(buf.map(0) + buf.stride(0) * y + x * 2);
@@ -150,6 +158,7 @@ static void draw_char(IMappedFramebuffer& buf, uint32_t xpos, uint32_t ypos, cha
case PixelFormat::XBGR8888:
case PixelFormat::ARGB8888:
case PixelFormat::ABGR8888:
+ case PixelFormat::RGB888:
case PixelFormat::RGB565:
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++) {
diff --git a/kms++util/src/testpat.cpp b/kms++util/src/testpat.cpp
index cbe611d..1297e61 100644
--- a/kms++util/src/testpat.cpp
+++ b/kms++util/src/testpat.cpp
@@ -104,6 +104,7 @@ static void draw_test_pattern_part(IMappedFramebuffer& fb, unsigned start_y, uns
case PixelFormat::XBGR8888:
case PixelFormat::ARGB8888:
case PixelFormat::ABGR8888:
+ case PixelFormat::RGB888:
case PixelFormat::RGB565:
for (y = start_y; y < end_y; y++) {
for (x = 0; x < w; x++) {
diff --git a/py/pykmsbase.cpp b/py/pykmsbase.cpp
index c218c81..f1e0c5c 100644
--- a/py/pykmsbase.cpp
+++ b/py/pykmsbase.cpp
@@ -114,6 +114,8 @@ void init_pykmsbase(py::module &m)
.value("ARGB8888", PixelFormat::ARGB8888)
.value("ABGR8888", PixelFormat::ABGR8888)
+ .value("RGB888", PixelFormat::RGB888)
+
.value("RGB565", PixelFormat::RGB565)
;