[Mesa-dev] [PATCH 12/59] i965: add brw_imm_df
Francisco Jerez
currojerez at riseup.net
Wed May 11 03:56:32 UTC 2016
Samuel Iglesias Gonsálvez <siglesias at igalia.com> writes:
> From: Connor Abbott <connor.w.abbott at intel.com>
>
> v2 (Iago)
> - Fixup accessibility in backend_reg
>
> Signed-off-by: Iago Toral Quiroga <itoral at igalia.com>
I've just noticed (while running valgrind) that this patch causes
serious breakage in the back-end. The reason is that the extra bits
required to make room for the df field of the union don't get
initialized in all codepaths, so backend_reg comparisons done using
memcmp() can basically return random results now. Can you please look
into this? Some ways to fix it would be to make sure we zero-initialize
the whole brw_reg in all cases (or at least the union padding), or stop
using memcmp() to compare registers -- I guess the latter might be
somewhat less intrusive and increase the likelihood that we can get this
sorted out timely.
> ---
> src/mesa/drivers/dri/i965/brw_reg.h | 9 +++++++++
> src/mesa/drivers/dri/i965/brw_shader.h | 1 +
> 2 files changed, 10 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_reg.h b/src/mesa/drivers/dri/i965/brw_reg.h
> index b84c709..6d51623 100644
> --- a/src/mesa/drivers/dri/i965/brw_reg.h
> +++ b/src/mesa/drivers/dri/i965/brw_reg.h
> @@ -254,6 +254,7 @@ struct brw_reg {
> unsigned pad1:1;
> };
>
> + double df;
> float f;
> int d;
> unsigned ud;
> @@ -544,6 +545,14 @@ brw_imm_reg(enum brw_reg_type type)
>
> /** Construct float immediate register */
> static inline struct brw_reg
> +brw_imm_df(double df)
> +{
> + struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_DF);
> + imm.df = df;
> + return imm;
> +}
> +
> +static inline struct brw_reg
> brw_imm_f(float f)
> {
> struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_F);
> diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
> index fc228f6..f6f6167 100644
> --- a/src/mesa/drivers/dri/i965/brw_shader.h
> +++ b/src/mesa/drivers/dri/i965/brw_shader.h
> @@ -90,6 +90,7 @@ struct backend_reg : private brw_reg
> using brw_reg::width;
> using brw_reg::hstride;
>
> + using brw_reg::df;
> using brw_reg::f;
> using brw_reg::d;
> using brw_reg::ud;
> --
> 2.5.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160510/82f33439/attachment.sig>
More information about the mesa-dev
mailing list