Support RGB888
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Thu, 16 Jun 2016 14:59:07 +0000 (17:59 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Thu, 16 Jun 2016 14:59:12 +0000 (17:59 +0300)
kms++/inc/kms++/pixelformats.h
kms++/src/pixelformats.cpp
kms++util/src/drawing.cpp
kms++util/src/testpat.cpp
py/pykmsbase.cpp

index 813eaef7dbef45f4918d381e635733246d87e149..8ecfcb3c3f2b79ac25e9b6fba5cc4e259e8fc194 100644 (file)
@@ -27,6 +27,8 @@ enum class PixelFormat : uint32_t
        ARGB8888 = MakeFourCC("AR24"),
        ABGR8888 = MakeFourCC("AB24"),
 
+       RGB888 = MakeFourCC("RG24"),
+
        RGB565 = MakeFourCC("RG16"),
 };
 
index f2b1137db41a77222db1ceda53d231e5fbc84d19..ee2356debfa64afedf616250bcce9a77809174a4 100644 (file)
@@ -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 } }, } },
index cb6fbf657bc5bb44b514fa3ea9753c8ca87a1d61..157c7994faf095f8728a6725467153e065f87aee 100644 (file)
@@ -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++) {
index cbe611d53caa7c6f985f514f0fc7e038739f4ea7..1297e61730ec18d8d08a0c8c52b280fb7c20ef31 100644 (file)
@@ -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++) {
index c218c81c33e3bbe3a5714ce6900ef1f25ff14b35..f1e0c5ce11f6b05410e23eb49691838f8158e612 100644 (file)
@@ -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)
                        ;