[Mesa-dev] [PATCH v2 2/4] si_compute: check NULL return from u_upload_alloc

Marek Olšák maraeo at gmail.com
Tue Mar 28 17:10:39 UTC 2017


On Tue, Mar 28, 2017 at 6:52 PM, Julien Isorce <julien.isorce at gmail.com> wrote:
> -       if (program->input_size || program->ir_type ==
> PIPE_SHADER_IR_NATIVE)
> -               si_upload_compute_input(sctx, code_object, info);
> +       if ((program->input_size ||
> +            program->ir_type == PIPE_SHADER_IR_NATIVE) &&
> +            unlikely(!si_upload_compute_input(sctx, code_object, info))) {
> +               return false;
> +       }
>
> is the indentation ok ?

The "unlikely" line should have one less space character at the beginning.

Marek

>
>
> On 27 March 2017 at 16:39, Marek Olšák <maraeo at gmail.com> wrote:
>>
>> "&&" at the end of the previous line please.
>>
>> Reviewed-by: Marek Olšák <marek.olsak at amd.com>
>>
>> Marek
>>
>> On Mon, Mar 27, 2017 at 3:46 PM, Julien Isorce <julien.isorce at gmail.com>
>> wrote:
>> > Signed-off-by: Julien Isorce <jisorce at oblong.com>
>> > ---
>> >  src/gallium/drivers/radeonsi/si_compute.c | 13 ++++++++++---
>> >  1 file changed, 10 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/src/gallium/drivers/radeonsi/si_compute.c
>> > b/src/gallium/drivers/radeonsi/si_compute.c
>> > index 46476b6..a38138f 100644
>> > --- a/src/gallium/drivers/radeonsi/si_compute.c
>> > +++ b/src/gallium/drivers/radeonsi/si_compute.c
>> > @@ -579,7 +579,7 @@ static void si_setup_user_sgprs_co_v2(struct
>> > si_context *sctx,
>> >         }
>> >  }
>> >
>> > -static void si_upload_compute_input(struct si_context *sctx,
>> > +static bool si_upload_compute_input(struct si_context *sctx,
>> >                                     const amd_kernel_code_t
>> > *code_object,
>> >                                     const struct pipe_grid_info *info)
>> >  {
>> > @@ -602,6 +602,9 @@ static void si_upload_compute_input(struct
>> > si_context *sctx,
>> >                        &kernel_args_offset,
>> >                        (struct pipe_resource**)&input_buffer,
>> > &kernel_args_ptr);
>> >
>> > +       if (unlikely(!kernel_args_ptr))
>> > +               return false;
>> > +
>> >         kernel_args = (uint32_t*)kernel_args_ptr;
>> >         kernel_args_va = input_buffer->gpu_address + kernel_args_offset;
>> >
>> > @@ -636,6 +639,8 @@ static void si_upload_compute_input(struct
>> > si_context *sctx,
>> >         }
>> >
>> >         r600_resource_reference(&input_buffer, NULL);
>> > +
>> > +       return true;
>> >  }
>> >
>> >  static void si_setup_tgsi_grid(struct si_context *sctx,
>> > @@ -790,8 +795,10 @@ static void si_launch_grid(
>> >                 si_set_atom_dirty(sctx, sctx->atoms.s.render_cond,
>> > false);
>> >         }
>> >
>> > -       if (program->input_size || program->ir_type ==
>> > PIPE_SHADER_IR_NATIVE)
>> > -               si_upload_compute_input(sctx, code_object, info);
>> > +       if ((program->input_size || program->ir_type ==
>> > PIPE_SHADER_IR_NATIVE)
>> > +            && unlikely(!si_upload_compute_input(sctx, code_object,
>> > info))) {
>> > +               return false;
>> > +       }
>> >
>> >         /* Global buffers */
>> >         for (i = 0; i < MAX_GLOBAL_BUFFERS; i++) {
>> > --
>> > 2.7.4
>> >
>> > _______________________________________________
>> > 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