gldownloadelement: fix export of BGR/BGRA textures

GStreamer always stores data in RGBA textures, then uses shaders to
swizzle and convert between formats. When we get a texture GStreamer
says is BGR, it's really an RGB texture as far as the driver is
concerned. If we ask the driver to export it as BGR, driver will
see that source is RGB (according to its internal bookkeeping) and
destination is BGR, so it swizzles B and R. When GStreamer gets the
output intended to be BGR, it's therefore really RGB because it
was swizzled when texture was generated, and then again on export.

Solution is simple; always export the data as RGB/A to get the bytes
exactly as GStreamer stored them in the texture, as they're already in
the correct format.

Bug: 161191133
Change-Id: Ia63a5c585d4e70baef481929f0a71f96d0a80701
diff --git a/ext/gl/gstgldownloadelement.c b/ext/gl/gstgldownloadelement.c
index 053da30..b98c6cb 100644
--- a/ext/gl/gstgldownloadelement.c
+++ b/ext/gl/gstgldownloadelement.c
@@ -932,19 +932,21 @@
     goto beach;
   }
 
+  /* GL has no notion of BGR/BGRA so GStreamer stores its data labeled RGBA
+   * and swizzles with shaders. The driver doesn't know what the texture
+   * contains based on its internal book keeping, it's always RGBA as far as
+   * it knows. So we always export as RGB/A to get the output of GStreamer
+   * shaders in the intended format.
+   */
   export_format = GST_VIDEO_INFO_FORMAT (&dl->export_info);
   switch (export_format) {
     case GST_VIDEO_FORMAT_RGBA:
+    case GST_VIDEO_FORMAT_BGRA:
       params.fourcc = DRM_FORMAT_ABGR8888;
       break;
-    case GST_VIDEO_FORMAT_BGRA:
-      params.fourcc = DRM_FORMAT_ARGB8888;
-      break;
     case GST_VIDEO_FORMAT_RGB:
-      params.fourcc = DRM_FORMAT_BGR888;
-      break;
     case GST_VIDEO_FORMAT_BGR:
-      params.fourcc = DRM_FORMAT_RGB888;
+      params.fourcc = DRM_FORMAT_BGR888;
       break;
     default:
       goto beach;