[Mesa-dev] [PATCH] blorp: Use designated initializers in surf_convert_to_single_slice

Jason Ekstrand jason at jlekstrand.net
Wed Nov 16 01:30:07 UTC 2016


On Tue, Nov 15, 2016 at 2:38 PM, Jordan Justen <jordan.l.justen at intel.com>
wrote:

> On 2016-11-15 11:36:33, Jason Ekstrand wrote:
> >    Of you want to make it simpler, we have a macro wrapper called
> >    isl_surf_init that will turn those fields into named parameters.
> Either
> >    way, thanks for fixing this up.  Rb
> >
> >    On Nov 15, 2016 11:23 AM, "Jordan Justen" <jordan.l.justen at intel.com>
> >    wrote:
> >
> >      Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> >      ---
> >       src/intel/blorp/blorp_blit.c | 29 +++++++++++++----------------
> >       1 file changed, 13 insertions(+), 16 deletions(-)
> >
> >      diff --git a/src/intel/blorp/blorp_blit.c
> b/src/intel/blorp/blorp_blit.c
> >      index 1108335..c0b56c3 100644
> >      --- a/src/intel/blorp/blorp_blit.c
> >      +++ b/src/intel/blorp/blorp_blit.c
> >      @@ -1347,22 +1347,19 @@ surf_convert_to_single_slice(const struct
> >      isl_device *isl_dev,
> >          uint32_t tile_x_px, tile_y_px;
> >          surf_get_intratile_offset_px(info, &tile_x_px, &tile_y_px);
> >
> >      -   /* TODO: Once this file gets converted to C, we shouls just use
> >      designated
> >      -    * initializers.
> >      -    */
> >      -   struct isl_surf_init_info init_info = { 0, };
> >      -
> >      -   init_info.dim = ISL_SURF_DIM_2D;
> >      -   init_info.format = info->surf.format;
> >      -   init_info.width = slice_width_px + tile_x_px;
> >      -   init_info.height = slice_height_px + tile_y_px;
> >      -   init_info.depth = 1;
> >      -   init_info.levels = 1;
> >      -   init_info.array_len = 1;
> >      -   init_info.samples = info->surf.samples;
> >      -   init_info.min_pitch = info->surf.row_pitch;
> >      -   init_info.usage = info->surf.usage;
> >      -   init_info.tiling_flags = 1 << info->surf.tiling;
> >      +   struct isl_surf_init_info init_info = {
> >      +      .dim = ISL_SURF_DIM_2D,
> >      +      .format = info->surf.format,
> >      +      .width = slice_width_px + tile_x_px,
> >      +      .height = slice_height_px + tile_y_px,
> >      +      .depth = 1,
> >      +      .levels = 1,
> >      +      .array_len = 1,
> >      +      .samples = info->surf.samples,
> >      +      .min_pitch = info->surf.row_pitch,
> >      +      .usage = info->surf.usage,
> >      +      .tiling_flags = 1 << info->surf.tiling,
> >      +   };
> >
> >          isl_surf_init_s(isl_dev, &info->surf, &init_info);
> >          assert(info->surf.row_pitch == init_info.min_pitch);
>
> Regarding the isl_surf_init wrapper, this assert uses the init
> structure. I could change to use the wrapper if we think it is okay to
> drop the assert.
>

We shouldn't drop the assert.  I suppose we could copy that one field out
etc.  Meh.  Let's just keep using the _s version and call it good for now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161115/2fff100f/attachment.html>


More information about the mesa-dev mailing list