drm_hwcomposer: libdrmgetter: fix RGB565 format translation

FOSS graphic components (gbm_gralloc, mesa3d) are translating
HAL_PIXEL_FORMAT_RGB_565 to DRM_FORMAT_RGB565 without swapping
the R and B components. Same must be done here.

Fixes wrong colors in some games (i.e. Pixel Wheels).

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
diff --git a/bufferinfo/legacy/BufferInfoLibdrm.cpp b/bufferinfo/legacy/BufferInfoLibdrm.cpp
index 3f6a6fd..bd51d0e 100644
--- a/bufferinfo/legacy/BufferInfoLibdrm.cpp
+++ b/bufferinfo/legacy/BufferInfoLibdrm.cpp
@@ -184,7 +184,18 @@
   } else {
     bo->pitches[0] = gr_handle->stride;
     bo->offsets[0] = 0;
-    bo->format = ConvertHalFormatToDrm(gr_handle->format);
+
+    /* FOSS graphic components (gbm_gralloc, mesa3d) are translating
+     * HAL_PIXEL_FORMAT_RGB_565 to DRM_FORMAT_RGB565 without swapping
+     * the R and B components. Same must be done here. */
+    switch (bo->hal_format) {
+      case HAL_PIXEL_FORMAT_RGB_565:
+        bo->format = DRM_FORMAT_RGB565;
+        break;
+      default:
+        bo->format = ConvertHalFormatToDrm(gr_handle->format);
+    }
+
     if (bo->format == DRM_FORMAT_INVALID)
       return -EINVAL;
   }