[Mesa-dev] [PATCH 08/41] SQUASH: i965/fs: Change regs_read to be in hardware registers

Matt Turner mattst88 at gmail.com
Tue Sep 23 10:31:23 PDT 2014


On Sat, Sep 20, 2014 at 10:22 AM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp               | 27 ++++++++++++++++++----
>  .../drivers/dri/i965/brw_schedule_instructions.cpp |  4 ++--
>  2 files changed, 24 insertions(+), 7 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 588e5f0..33214fd 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -802,12 +802,29 @@ int
>  fs_inst::regs_read(fs_visitor *v, int arg) const
>  {
>     if (is_tex() && arg == 0 && src[0].file == GRF) {
> -      if (v->dispatch_width == 16)
> -        return (mlen + 1) / 2;
> -      else
> -        return mlen;
> +      return ALIGN(mlen, v->dispatch_width / 8);
> +   }
> +
> +   switch (src[arg].file) {
> +   case BAD_FILE:
> +   case UNIFORM:
> +   case IMM:
> +      return 1;
> +   case GRF:
> +   case HW_REG:
> +      if (src[arg].stride == 0) {
> +         return 1;
> +      } else {
> +         int size = src[arg].width * src[arg].stride * type_sz(src[arg].type);
> +         return (size + 31) / 32;
> +      }
> +   case MRF:
> +      unreachable("MRF registers are not allowed as sources");
> +      break;

No need for break after unreachable().

> +   default:
> +      unreachable("Invalid register file");
> +      break;

and here.


More information about the mesa-dev mailing list