i965: add P0x formats and propagate required scaling factors
authorTapani Pälli <tapani.palli@intel.com>
Mon, 11 Feb 2019 08:12:45 +0000 (10:12 +0200)
committerTapani Pälli <tapani.palli@intel.com>
Tue, 12 Feb 2019 06:43:04 +0000 (08:43 +0200)
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Lin Johnson <johnson.lin@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/mesa/drivers/dri/i965/brw_wm.c
src/mesa/drivers/dri/i965/intel_image.h
src/mesa/drivers/dri/i965/intel_screen.c

index 9092c560451c618a0cf4042077b4db72c1a88b34..9f88d625d63d60aa1e70e575a9e380fb0efa4932 100644 (file)
@@ -407,6 +407,10 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
          }
 
          if (t->Target == GL_TEXTURE_EXTERNAL_OES && intel_tex->planar_format) {
+
+            /* Setup possible scaling factor. */
+            key->scale_factors[s] = intel_tex->planar_format->scaling_factor;
+
             switch (intel_tex->planar_format->components) {
             case __DRI_IMAGE_COMPONENTS_Y_UV:
                key->y_uv_image_mask |= 1 << s;
index ca604159dc202af48d0778af387a3ece8c86dfdd..4ab8a49b8bbff4d40a2ffe483aa4133e93d6e34e 100644 (file)
@@ -62,6 +62,7 @@ struct intel_image_format {
       uint32_t dri_format;
       int cpp;
    } planes[3];
+   float scaling_factor;
 };
 
 struct __DRIimageRec {
index 0821d30f3d848545e3e9c69e7930afa7e03a7821..ece4ce0e334c09d7283fc48d7918998eee7b6668 100644 (file)
@@ -282,6 +282,18 @@ static const struct intel_image_format intel_image_formats[] = {
      { { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 },
        { 1, 1, 1, __DRI_IMAGE_FORMAT_GR88, 2 } } },
 
+   { __DRI_IMAGE_FOURCC_P010, __DRI_IMAGE_COMPONENTS_Y_UV, 2,
+     { { 0, 0, 0, __DRI_IMAGE_FORMAT_R16, 2 },
+       { 1, 1, 1, __DRI_IMAGE_FORMAT_GR1616, 4 } } , 65535.0f/1023.0f },
+
+   { __DRI_IMAGE_FOURCC_P012, __DRI_IMAGE_COMPONENTS_Y_UV, 2,
+     { { 0, 0, 0, __DRI_IMAGE_FORMAT_R16, 2 },
+       { 1, 1, 1, __DRI_IMAGE_FORMAT_GR1616, 4 } } , 65535.0f/4095.0f },
+
+   { __DRI_IMAGE_FOURCC_P016, __DRI_IMAGE_COMPONENTS_Y_UV, 2,
+     { { 0, 0, 0, __DRI_IMAGE_FORMAT_R16, 2 },
+       { 1, 1, 1, __DRI_IMAGE_FORMAT_GR1616, 4 } } },
+
    { __DRI_IMAGE_FOURCC_NV16, __DRI_IMAGE_COMPONENTS_Y_UV, 2,
      { { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 },
        { 1, 1, 0, __DRI_IMAGE_FORMAT_GR88, 2 } } },