Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93ea7cdb authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "graphics: Add 12 bits and 14 bits formats" into main

parents 5c1593ee 1f3e4ff1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ cc_library {
    ],

    export_shared_lib_headers: [
        "android.hardware.graphics.common-V6-ndk",
        "android.hardware.graphics.common-V7-ndk",
        "android.hardware.graphics.mapper@4.0",
        "libhidlbase",
    ],
+42 −43
Original line number Diff line number Diff line
@@ -91,11 +91,10 @@ static const char* kLlndkLibrariesTxtPath = "/system/etc/llndk.libraries.txt";
// On modern devices that lack the VNDK APEX, the device no longer
// contains a helpful list of these libraries on the filesystem as above.
// See system/sepolicy/vendor/file_contexts
static const char* kFormerlyVndkspLibrariesList =
    "android.hardware.common-V2-ndk.so:"
static const char* kFormerlyVndkspLibrariesList = "android.hardware.common-V2-ndk.so:"
                                                  "android.hardware.common.fmq-V1-ndk.so:"
                                                  "android.hardware.graphics.allocator-V2-ndk.so:"
    "android.hardware.graphics.common-V6-ndk.so:"
                                                  "android.hardware.graphics.common-V7-ndk.so:"
                                                  "android.hardware.graphics.common@1.0.so:"
                                                  "android.hardware.graphics.common@1.1.so:"
                                                  "android.hardware.graphics.common@1.2.so:"
+22 −0
Original line number Diff line number Diff line
@@ -116,6 +116,28 @@ static_assert(
        static_cast<int>(aidl::android::hardware::graphics::common::PixelFormat::YCBCR_P210) ==
                AHARDWAREBUFFER_FORMAT_YCbCr_P210,
        "HAL and AHardwareBuffer pixel format don't match");
static_assert(static_cast<int>(aidl::android::hardware::graphics::common::PixelFormat::R_12_UINT) ==
                      AHARDWAREBUFFER_FORMAT_R12_UINT,
              "HAL and AHardwareBuffer pixel format don't match");
static_assert(static_cast<int>(aidl::android::hardware::graphics::common::PixelFormat::R_14_UINT) ==
                      AHARDWAREBUFFER_FORMAT_R14_UINT,
              "HAL and AHardwareBuffer pixel format don't match");
static_assert(
        static_cast<int>(aidl::android::hardware::graphics::common::PixelFormat::RG_1212_UINT) ==
                AHARDWAREBUFFER_FORMAT_R12G12_UINT,
        "HAL and AHardwareBuffer pixel format don't match");
static_assert(
        static_cast<int>(aidl::android::hardware::graphics::common::PixelFormat::RG_1414_UINT) ==
                AHARDWAREBUFFER_FORMAT_R14G14_UINT,
        "HAL and AHardwareBuffer pixel format don't match");
static_assert(static_cast<int>(
                      aidl::android::hardware::graphics::common::PixelFormat::RGBA_12121212_UINT) ==
                      AHARDWAREBUFFER_FORMAT_R12G12B12A12_UINT,
              "HAL and AHardwareBuffer pixel format don't match");
static_assert(static_cast<int>(
                      aidl::android::hardware::graphics::common::PixelFormat::RGBA_14141414_UINT) ==
                      AHARDWAREBUFFER_FORMAT_R14G14B14A14_UINT,
              "HAL and AHardwareBuffer pixel format don't match");

static enum AHardwareBufferStatus filterStatus(status_t status) {
    switch (status) {
+42 −0
Original line number Diff line number Diff line
@@ -209,6 +209,48 @@ enum AHardwareBuffer_Format {
     *   OpenGL ES: N/A
     */
    AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM       = 0x3b,

    /**
     * Corresponding formats:
     *   Vulkan: VK_FORMAT_R12X4_UINT
     *   OpenGL ES: N/A
     */
    AHARDWAREBUFFER_FORMAT_R12_UINT       	    = 0x3d,

    /**
     * Corresponding formats:
     *   Vulkan: VK_FORMAT_R14X2_UINT
     *   OpenGL ES: N/A
     */
    AHARDWAREBUFFER_FORMAT_R14_UINT               = 0x3e,

    /**
     * Corresponding formats:
     *   Vulkan: VK_FORMAT_R12X4G12X4_UINT
     *   OpenGL ES: N/A
     */
    AHARDWAREBUFFER_FORMAT_R12G12_UINT          = 0x3f,

    /**
     * Corresponding formats:
     *   Vulkan: VK_FORMAT_R14X2G14X2_UINT
     *   OpenGL ES: N/A
     */
    AHARDWAREBUFFER_FORMAT_R14G14_UINT          = 0x40,

    /**
     * Corresponding formats:
     *   Vulkan: VK_FORMAT_R12X4G12X4B12X4A12X4_UINT
     *   OpenGL ES: N/A
     */
    AHARDWAREBUFFER_FORMAT_R12G12B12A12_UINT= 0x41,

    /**
     * Corresponding formats:
     *   Vulkan: VK_FORMAT_R14X2G14X2B14X2A14X2_UINT
     *   OpenGL ES: N/A
     */
    AHARDWAREBUFFER_FORMAT_R14G14B14A14_UINT= 0x42,
};

/**
+14 −2
Original line number Diff line number Diff line
@@ -617,11 +617,19 @@ void getNativePixelFormat(EGLDisplay dpy, egl_connection_t* cnx, EGLConfig confi
    if (a == 0) {
        if (8 == r && 0 == g && 0 == b) {
            *format = PixelFormat::R_8;
        } else if (12 == r && 0 == g && 0 == b) {
            *format = PixelFormat::R_12_UINT;
        } else if (14 == r && 0 == g && 0 == b) {
            *format = PixelFormat::R_14_UINT;
        } else if (colorDepth <= 16) {
            *format = PixelFormat::RGB_565;
        } else {
            if (componentType == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT) {
                if (colorDepth > 24) {
                if (12 == r && 12 == g && 0 == b) {
                    *format = PixelFormat::RG_1212_UINT;
                } else if (14 == r && 14 == g && 0 == b) {
                    *format = PixelFormat::RG_1414_UINT;
                } else if (colorDepth > 24) {
                    *format = PixelFormat::RGBA_1010102;
                } else {
                    *format = PixelFormat::RGBX_8888;
@@ -632,7 +640,11 @@ void getNativePixelFormat(EGLDisplay dpy, egl_connection_t* cnx, EGLConfig confi
        }
    } else {
        if (componentType == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT) {
            if (colorDepth > 24) {
            if (12 == r && 12 == g && 12 == b) {
                *format = PixelFormat::RGBA_12121212_UINT;
            } else if (14 == r && 14 == g && 14 == b) {
                *format = PixelFormat::RGBA_14141414_UINT;
            } else if (colorDepth > 24) {
                *format = PixelFormat::RGBA_1010102;
            } else {
                *format = PixelFormat::RGBA_8888;
Loading