From 13bec7666295dd591868d01b1eec95522a03a2f4 Mon Sep 17 00:00:00 2001 From: tangrobin Date: Tue, 7 Aug 2018 17:23:31 +0800 Subject: Fix the DRM_FORMAT match with corresponding PixelFormat The DRM_FORMAT settings in DrmCreateSurface should match with the correct PixelFormat Bug: 112245291 Test: build and flash boot image to device. Change-Id: I3ee0de38256d1109cd5174b666e2f47dceb637e6 --- minui/graphics_drm.cpp | 10 +++++++--- 1 file 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; } -- cgit v1.2.3