[igt-dev] [PATCH i-g-t v3 1/4] lib/intel_batchbuffer: Extend intel_bb

Chris Wilson chris at chris-wilson.co.uk
Tue Jun 23 13:35:42 UTC 2020


Quoting Zbigniew Kempczyński (2020-06-23 14:00:53)
> -static void __intel_bb_destroy_objects(struct intel_bb *ibb)
> +static void __intel_bb_destroy_relocations(struct intel_bb *ibb)
>  {
>         uint32_t i;
>  
>         /* Free relocations */
> -       for (i = 0; i < ibb->num_objects; i++)
> +       for (i = 0; i < ibb->num_objects; i++) {
>                 free(from_user_pointer(ibb->objects[i].relocs_ptr));
> +               ibb->objects[i].relocs_ptr = to_user_pointer(NULL);

Reset ibb->objects[i].relocation_count = 0 as well, for completeness?

> +       }
>  
> -       free(ibb->objects);
> -       tdestroy(ibb->root, __do_nothing);
> +       ibb->relocs = NULL;
> +       ibb->num_relocs = 0;
> +       ibb->allocated_relocs = 0;
> +}

> +void intel_bb_flush_on_ring(struct intel_bb *ibb, int ring)
> +{
> +       unsigned int used = intel_bb_out_flush(ibb);
> +       uint32_t ctx;
> +
> +       if (used == 0)
> +               return;
> +
> +       /* XXX bad kernel API */
> +       ctx = ibb->ctx;
> +       if (ring != I915_EXEC_RENDER)
> +               ctx = 0;

Boo :)

> +
> +       intel_bb_exec_with_context(ibb, intel_bb_offset(ibb), ctx,
> +                                  ring | I915_EXEC_NO_RELOC,
> +                                  true);
> +       intel_bb_reset(ibb, false);


More information about the igt-dev mailing list