[Mesa-dev] [PATCH 2/5] i965/fs: fix stride and type for hw_reg's in regs_read()

Jason Ekstrand jason at jlekstrand.net
Wed Jul 1 14:58:33 PDT 2015


Personally, I think this is sensible given that, in the generator, we
just copy+paste the fixed_hw_reg field.  However, I'd like a second
opinion.
--Jason

On Wed, Jul 1, 2015 at 11:51 AM, Connor Abbott <cwabbott0 at gmail.com> wrote:
> sources with file == HW_REG get all their information from the
> fixed_hw_reg field, so we need to get the stride and type from there
> when computing the size.
>
> Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp | 24 ++++++++++++++++++------
>  1 file changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 38b9095..64f093b 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -696,24 +696,36 @@ fs_inst::regs_read(int arg) const
>        break;
>     }
>
> +   unsigned stride;
> +   enum brw_reg_type type;
> +
>     switch (src[arg].file) {
>     case BAD_FILE:
>     case UNIFORM:
>     case IMM:
>        return 1;
> +
>     case GRF:
> +      stride = src[arg].stride;
> +      type = src[arg].type;
> +      break;
> +
>     case HW_REG:
> -      if (src[arg].stride == 0) {
> -         return 1;
> -      } else {
> -         int size = components * this->exec_size * type_sz(src[arg].type);
> -         return DIV_ROUND_UP(size * src[arg].stride, 32);
> -      }
> +      stride = src[arg].fixed_hw_reg.hstride;
> +      type = src[arg].fixed_hw_reg.type;
> +      break;
> +
>     case MRF:
>        unreachable("MRF registers are not allowed as sources");
>     default:
>        unreachable("Invalid register file");
>     }
> +
> +   if (stride == 0)
> +      return 1;
> +
> +   int size = components * this->exec_size * type_sz(type);
> +   return DIV_ROUND_UP(size * stride, 32);
>  }
>
>  bool
> --
> 2.4.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list