[igt-dev] [PATCH i-g-t v3 3/7] lib/intel_batchbuffer: Introduce intel_bb

Chris Wilson chris at chris-wilson.co.uk
Mon May 18 10:07:40 UTC 2020


Quoting Zbigniew Kempczyński (2020-05-18 10:09:15)
> +static void intel_bb_add_handle(struct intel_bb *ibb,
> +                               uint32_t handle,
> +                               uint64_t offset)
> +{
> +       uint32_t i;
> +
> +       /* Skip bb as object, it will be added before exec */

So what we tend to end up doing is just adding the batch whenever it
makes sense then swapping it at the end. You could insist upon having
I915_EXEC_BATCH_FIRST so that you can put into the execobj[] at creation
time, but doing a swap() at submit is easy as well.

> +       if (ibb->handle == handle) {
> +               igt_assert(ibb->batch_offset == 0 ||
> +                          ibb->batch_offset == offset);
> +               ibb->batch_offset = offset;
> +               return;
> +       }
> +
> +       for (i = 0; i < ibb->num_objects; i++)
> +               if (ibb->objects[i].handle == handle)
> +                       return;

Really tempted to say insertion sort and bsearch. I wonder if we have
enough objects for that to be worthwhile. Brb, off to try that idea out
in iris....
-Chris


More information about the igt-dev mailing list