summaryrefslogtreecommitdiffstats
path: root/minui/graphics_drm.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-08-08 20:06:30 +0200
committerandroid-build-merger <android-build-merger@google.com>2018-08-08 20:06:30 +0200
commit53bca233b14e7eeedfa5dc483374ef03dcf3b986 (patch)
tree7454936d78363a5d865f44b43554b8c133ce0bac /minui/graphics_drm.cpp
parentMerge "Build and use minadbd as a shared library." am: ea38c4160a am: 479dd68d9e (diff)
parentMerge "Fix the DRM_FORMAT match with corresponding PixelFormat" am: 1e4f9c0477 (diff)
downloadandroid_bootable_recovery-53bca233b14e7eeedfa5dc483374ef03dcf3b986.tar
android_bootable_recovery-53bca233b14e7eeedfa5dc483374ef03dcf3b986.tar.gz
android_bootable_recovery-53bca233b14e7eeedfa5dc483374ef03dcf3b986.tar.bz2
android_bootable_recovery-53bca233b14e7eeedfa5dc483374ef03dcf3b986.tar.lz
android_bootable_recovery-53bca233b14e7eeedfa5dc483374ef03dcf3b986.tar.xz
android_bootable_recovery-53bca233b14e7eeedfa5dc483374ef03dcf3b986.tar.zst
android_bootable_recovery-53bca233b14e7eeedfa5dc483374ef03dcf3b986.zip
Diffstat (limited to 'minui/graphics_drm.cpp')
-rw-r--r--minui/graphics_drm.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/minui/graphics_drm.cpp b/minui/graphics_drm.cpp
index 9336a1e63..630b80180 100644
--- a/minui/graphics_drm.cpp
+++ b/minui/graphics_drm.cpp
@@ -117,12 +117,16 @@ GRSurfaceDrm* MinuiBackendDrm::DrmCreateSurface(int width, int height) {
uint32_t format;
PixelFormat pixel_format = gr_pixel_format();
+ // PixelFormat comes in byte order, whereas DRM_FORMAT_* uses little-endian
+ // (external/libdrm/include/drm/drm_fourcc.h). Note that although drm_fourcc.h also defines a
+ // macro of DRM_FORMAT_BIG_ENDIAN, it doesn't seem to be actually supported (see the discussion
+ // in https://lists.freedesktop.org/archives/amd-gfx/2017-May/008560.html).
if (pixel_format == PixelFormat::ABGR) {
- format = DRM_FORMAT_ABGR8888;
+ format = DRM_FORMAT_RGBA8888;
} else if (pixel_format == PixelFormat::BGRA) {
- format = DRM_FORMAT_BGRA8888;
+ format = DRM_FORMAT_ARGB8888;
} else if (pixel_format == PixelFormat::RGBX) {
- format = DRM_FORMAT_RGBX8888;
+ format = DRM_FORMAT_XBGR8888;
} else {
format = DRM_FORMAT_RGB565;
}