[Mesa-dev] [PATCH 16/21] intel/isl: Support Ys and Yf in isl_surf_get_uncompressed_surf

Jason Ekstrand jason at jlekstrand.net
Wed Feb 28 17:55:07 UTC 2018


On February 28, 2018 09:37:15 "Pohjolainen, Topi" 
<topi.pohjolainen at gmail.com> wrote:

> On Thu, Feb 22, 2018 at 11:06:56PM -0800, Jason Ekstrand wrote:
>> ---
>>  src/intel/isl/isl.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
>>  1 file changed, 46 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
>> index 74e248d..f93db0c 100644
>> --- a/src/intel/isl/isl.c
>> +++ b/src/intel/isl/isl.c
>> @@ -2419,7 +2419,52 @@ isl_surf_get_uncompressed_surf(const struct 
>> isl_device *dev,
>>     const uint32_t ucompr_width = isl_align_div_npot(view_width, fmtl->bw);
>>     const uint32_t ucompr_height = isl_align_div_npot(view_height, fmtl->bh);
>>
>> -   {
>> +   if (isl_tiling_is_std_y(surf->tiling)) {
>> +      /* Offset to the given miplevel.  Because we're using standard tilings
>> +       * with no miptail, arrays and 3D textures should just work so long as
>> +       * we have the right array stride in the end.
>> +       */
>> +      isl_surf_get_image_offset_B_tile_el(surf, view->base_level, 0, 0,
>> +                                          offset_B, x_offset_sa, y_offset_sa);
>> +      /* Ys and Yf should have no intratile X or Y offset */
>> +      assert(*x_offset_sa == 0 && *y_offset_sa == 0);
>> +
>> +      /* Save off the array pitch */
>> +      const uint32_t array_pitch_el_rows = surf->array_pitch_el_rows;
>
> We are not modifying 'surf' and we can just use "surf->array_pitch_el_rows"
> directly later on?

I wanted the function to be something you can call with surf == 
ucompr_surf.  BLORP takes advantage of this.

> Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
>
>> +
>> +      const uint32_t view_depth =
>> +         isl_minify(surf->logical_level0_px.depth, view->base_level);
>> +      const uint32_t ucompr_depth = isl_align_div_npot(view_depth, fmtl->bd);
>> +
>> +      bool ok UNUSED;
>> +      ok = isl_surf_init(dev, ucompr_surf,
>> +                         .dim = surf->dim,
>> +                         .format = view->format,
>> +                         .width = ucompr_width,
>> +                         .height = ucompr_height,
>> +                         .depth = ucompr_depth,
>> +                         .levels = 1,
>> +                         .array_len = surf->logical_level0_px.array_len,
>> +                         .samples = surf->samples,
>> +                         .row_pitch = surf->row_pitch,
>> +                         .usage = surf->usage,
>> +                         .tiling_flags = (1u << surf->tiling));
>> +      assert(ok);
>> +
>> +      /* Use the array pitch from the original surface.  This way 2D arrays
>> +       * and 3D textures should work properly, just with one LOD.
>> +       */
>> +      assert(ucompr_surf->array_pitch_el_rows <= array_pitch_el_rows);
>> +      ucompr_surf->array_pitch_el_rows = array_pitch_el_rows;
>> +
>> +      /* The newly created image represents only the one miplevel so we
>> +       * need to adjust the view accordingly.  Because we offset it to
>> +       * miplevel but used a Z and array slice of 0, the array range can be
>> +       * left alone.
>> +       */
>> +      *ucompr_view = *view;
>> +      ucompr_view->base_level = 0;
>> +   } else {
>>        /* For legacy tilings, we just make a new 2D surface which represents
>>         * the single slice of the main surface.  Due to hardware restrictions
>>         * with intratile offsets, we can only handle a single slice.
>> --
>> 2.5.0.400.gff86faf
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev




More information about the mesa-dev mailing list