st/dri: allow direct YUYV import
authorLucas Stach <l.stach@pengutronix.de>
Tue, 30 May 2017 13:07:13 +0000 (15:07 +0200)
committerLucas Stach <dev@lynxeye.de>
Wed, 20 Dec 2017 15:54:37 +0000 (16:54 +0100)
Push this format to the pipe driver unchanged.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
include/GL/internal/dri_interface.h
src/gallium/state_trackers/dri/dri2.c

index b47947380c4a88be85a07bcdf18412ebffbda43e..5b6cc8d70e4f3f573424220edf0ad285983c3ba4 100644 (file)
@@ -1226,6 +1226,7 @@ struct __DRIdri2ExtensionRec {
 #define __DRI_IMAGE_FORMAT_ARGB1555     0x100c
 #define __DRI_IMAGE_FORMAT_R16          0x100d
 #define __DRI_IMAGE_FORMAT_GR1616       0x100e
+#define __DRI_IMAGE_FORMAT_YUYV         0x100f
 
 #define __DRI_IMAGE_USE_SHARE          0x0001
 #define __DRI_IMAGE_USE_SCANOUT                0x0002
index d5ae9cbd69b4ca4d6fe12345ed8e64779e382c9b..3388b17da53838c92dc78ebd16111d35a98fa20f 100644 (file)
@@ -121,6 +121,10 @@ static int convert_fourcc(int format, int *dri_components_p)
       format = __DRI_IMAGE_FORMAT_GR1616;
       dri_components = __DRI_IMAGE_COMPONENTS_RG;
       break;
+   case __DRI_IMAGE_FOURCC_YUYV:
+      format = __DRI_IMAGE_FORMAT_YUYV;
+      dri_components = __DRI_IMAGE_COMPONENTS_Y_XUXV;
+      break;
    /*
     * For multi-planar YUV formats, we return the format of the first
     * plane only.  Since there is only one caller which supports multi-
@@ -210,6 +214,9 @@ static enum pipe_format dri2_format_to_pipe_format (int format)
    case __DRI_IMAGE_FORMAT_GR1616:
       pf = PIPE_FORMAT_R16G16_UNORM;
       break;
+   case __DRI_IMAGE_FORMAT_YUYV:
+      pf = PIPE_FORMAT_YUYV;
+      break;
    default:
       pf = PIPE_FORMAT_NONE;
       break;