[Intel-gfx] [PATCH 6/8] drm/i915: Introduce execlist_port_* accessors

Chris Wilson chris at chris-wilson.co.uk
Tue Sep 12 10:37:11 UTC 2017


Quoting Mika Kuoppala (2017-09-12 09:36:16)
> Instead of trusting that first available port is at index 0,
> use accessor to hide this. This allows us to just move the head
> on port completion instead of memmoving the array.

Ah. Even after a re-read, I wasn't expecting to see the advance in this
path. "This allows" is too passive, sounds like you are describing a
future optimisation.

> -static bool execlists_elsp_ready(const struct intel_engine_cs *engine)
> +static bool execlists_elsp_ready(struct intel_engine_execlist * const el)
>  {
> -       const struct execlist_port *port = engine->execlist.port;
> +       struct execlist_port * const port = execlist_port_head(el);

For readability
struct execlist_port * const port0 = execlist_port_head(el);
struct execlist_port * const port1 = execlist_port_next(el, port0);

> -       return port_count(&port[0]) + port_count(&port[1]) < 2;
> +       return port_count(port) + port_count(execlist_port_next(el, port)) < 2;
return port_count(port0) + port_count(port1) < 2;
-Chris


More information about the Intel-gfx mailing list