i965: Add support for sampling from XYUV images
authorKasireddy, Vivek <vivek.kasireddy@intel.com>
Wed, 13 Feb 2019 01:03:52 +0000 (17:03 -0800)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Tue, 26 Feb 2019 13:08:52 +0000 (13:08 +0000)
Add support to the i965 DRI driver to sample from XYUV8888 buffers.

Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
Reviewed-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 b894c47ed6b938c0be686d324dffd335c4bc5ca5..7ae38e103c6c19d8cbf9321186918268c41e0c13 100644 (file)
@@ -196,6 +196,7 @@ struct brw_sampler_prog_key_data {
    uint32_t yx_xuxv_image_mask;
    uint32_t xy_uxvx_image_mask;
    uint32_t ayuv_image_mask;
+   uint32_t xyuv_image_mask;
 
    /* Scale factor for each texture. */
    float scale_factors[32];
index d0b1ba6e3d21afd39ad48c488fb4e8fca1afef1c..00e3879b4dc67ba43dcc8f89773cb568bdb0751a 100644 (file)
@@ -963,6 +963,7 @@ brw_nir_apply_sampler_key(nir_shader *nir,
    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;
+   tex_options.lower_xyuv_external = key_tex->xyuv_image_mask;
 
    /* Setup array of scaling factors for each texture. */
    memcpy(&tex_options.scale_factors, &key_tex->scale_factors,
index 3cd8f18e794c0d9531a39e11be37120ab39a9344..47905ca55498d4183165966baa0887f587ca283e 100644 (file)
@@ -270,6 +270,9 @@ brw_debug_recompile_sampler_key(struct brw_context *brw,
    found |= key_debug(brw, "ayuv image bound",
                       old_key->ayuv_image_mask,
                       key->ayuv_image_mask);
+   found |= key_debug(brw, "xyuv image bound",
+                      old_key->xyuv_image_mask,
+                      key->xyuv_image_mask);
 
    for (unsigned int i = 0; i < MAX_SAMPLERS; i++) {
       found |= key_debug(brw, "textureGather workarounds",
@@ -432,6 +435,9 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
             case __DRI_IMAGE_COMPONENTS_AYUV:
                key->ayuv_image_mask |= 1 << s;
                break;
+            case __DRI_IMAGE_COMPONENTS_XYUV:
+               key->xyuv_image_mask |= 1 << s;
+               break;
             default:
                break;
             }
index 5041acd9a7185e064e1a44b6986349625b1ff985..d34b161f41e71302f1fb9c631ec8b17d4709a530 100644 (file)
@@ -302,6 +302,9 @@ static const struct intel_image_format intel_image_formats[] = {
    { __DRI_IMAGE_FOURCC_AYUV, __DRI_IMAGE_COMPONENTS_AYUV, 1,
      { { 0, 0, 0, __DRI_IMAGE_FORMAT_ABGR8888, 4 } } },
 
+   { __DRI_IMAGE_FOURCC_XYUV8888, __DRI_IMAGE_COMPONENTS_XYUV, 1,
+     { { 0, 0, 0, __DRI_IMAGE_FORMAT_XBGR8888, 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