i965: add support for sampling from AYUV
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Thu, 8 Nov 2018 17:26:36 +0000 (17:26 +0000)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Mon, 12 Nov 2018 13:22:54 +0000 (13:22 +0000)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
src/intel/compiler/brw_compiler.h
src/intel/compiler/brw_nir.c
src/mesa/drivers/dri/i965/brw_wm.c
src/mesa/drivers/dri/i965/intel_screen.c

index d8c9499065f7867cdc7a83966e84acaa31814551..8adc1ff8115d6cc47b5e0dd295424dc569945457 100644 (file)
@@ -195,6 +195,7 @@ struct brw_sampler_prog_key_data {
    uint32_t y_uv_image_mask;
    uint32_t yx_xuxv_image_mask;
    uint32_t xy_uxvx_image_mask;
+   uint32_t ayuv_image_mask;
 };
 
 /**
index cf5a4a96d678ff46f7603ac725d20cfe6978d85b..26a5ea046055a106c19f4e902bc82b26cca5f195 100644 (file)
@@ -877,6 +877,7 @@ brw_nir_apply_sampler_key(nir_shader *nir,
    tex_options.lower_y_u_v_external = key_tex->y_u_v_image_mask;
    tex_options.lower_yx_xuxv_external = key_tex->yx_xuxv_image_mask;
    tex_options.lower_xy_uxvx_external = key_tex->xy_uxvx_image_mask;
+   tex_options.lower_ayuv_external = key_tex->ayuv_image_mask;
 
    if (nir_lower_tex(nir, &tex_options)) {
       nir_validate_shader(nir, "after nir_lower_tex");
index 139ca910f9f4ce0d280a58275f09e080cb6503d8..fc64f38c1566a08d577ea57390bd89ea54830c3a 100644 (file)
@@ -263,6 +263,9 @@ brw_debug_recompile_sampler_key(struct brw_context *brw,
    found |= key_debug(brw, "xy_uxvx image bound",
                       old_key->xy_uxvx_image_mask,
                       key->xy_uxvx_image_mask);
+   found |= key_debug(brw, "ayuv image bound",
+                      old_key->ayuv_image_mask,
+                      key->ayuv_image_mask);
 
 
    for (unsigned int i = 0; i < MAX_SAMPLERS; i++) {
@@ -412,6 +415,9 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
             case __DRI_IMAGE_COMPONENTS_Y_UXVX:
                key->xy_uxvx_image_mask |= 1 << s;
                break;
+            case __DRI_IMAGE_COMPONENTS_AYUV:
+               key->ayuv_image_mask |= 1 << s;
+               break;
             default:
                break;
             }
index a205a49a1bdc61eafe43c8ebe0764b5eb3338064..8838f977bb61af7be5fd19c9f951fca2df034bf2 100644 (file)
@@ -286,6 +286,9 @@ static const struct intel_image_format intel_image_formats[] = {
      { { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 },
        { 1, 1, 0, __DRI_IMAGE_FORMAT_GR88, 2 } } },
 
+   { __DRI_IMAGE_FOURCC_AYUV, __DRI_IMAGE_COMPONENTS_AYUV, 1,
+     { { 0, 0, 0, __DRI_IMAGE_FORMAT_ABGR8888, 4 } } },
+
    /* For YUYV and UYVY buffers, we set up two overlapping DRI images
     * and treat them as planar buffers in the compositors.
     * Plane 0 is GR88 and samples YU or YV pairs and places Y into