OSDN Git Service

gralloc4: Add DRM_FORMAT_ARGB4444 format layout
authorRoman Stratiienko <r.stratiienko@gmail.com>
Sat, 26 Dec 2020 23:34:52 +0000 (01:34 +0200)
committerRoman Stratiienko <r.stratiienko@gmail.com>
Tue, 29 Dec 2020 10:36:43 +0000 (12:36 +0200)
Slow mobile GPUs performance can be boosted in exchange
of reducing image quality by resolving DRM_FORMAT_ARGB8888 to
DRM_FORMAT_ABGR4444 and DRM_FORMAT_XBGR8888 to DRM_FORMAT_RGB565.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Change-Id: Iae155bfdaf21fff98f34635cc24165f365c62afc

cros_gralloc/gralloc4/CrosGralloc4Utils.cc

index 5e37b7e..1296b07 100644 (file)
@@ -459,6 +459,25 @@ const std::unordered_map<uint32_t, std::vector<PlaneLayout>>& GetPlaneLayoutsMap
                              .verticalSubsampling = 1,
                      }}},
 
+                    {DRM_FORMAT_ARGB4444,
+                     {{
+                             .components = {{.type = android::gralloc4::PlaneLayoutComponentType_R,
+                                             .offsetInBits = 0,
+                                             .sizeInBits = 4},
+                                            {.type = android::gralloc4::PlaneLayoutComponentType_G,
+                                             .offsetInBits = 4,
+                                             .sizeInBits = 4},
+                                            {.type = android::gralloc4::PlaneLayoutComponentType_B,
+                                             .offsetInBits = 8,
+                                             .sizeInBits = 4},
+                                            {.type = android::gralloc4::PlaneLayoutComponentType_A,
+                                             .offsetInBits = 12,
+                                             .sizeInBits = 4}},
+                             .sampleIncrementInBits = 16,
+                             .horizontalSubsampling = 1,
+                             .verticalSubsampling = 1,
+                     }}},
+
                     {DRM_FORMAT_NV12,
                      {{
                               .components = {{.type = android::gralloc4::PlaneLayoutComponentType_Y,