[RFC][PATCH 4/5] libdrm: reduce number of reallocations in drmModeAtomicAddProperty
Emil Velikov
emil.l.velikov at gmail.com
Tue Apr 23 10:12:37 UTC 2019
On Sat, 20 Apr 2019 at 05:25, John Stultz <john.stultz at linaro.org> wrote:
>
> From: Adrian Salido <salidoa at google.com>
>
> When calling drmModeAtomicAddProperty allocation of memory happens as
> needed in increments of 16 elements. This can be very slow if there are
> multiple properties to be updated in an Atomic Commit call.
>
> Increase this to as many as can fit in a memory PAGE to avoid having to
> reallocate memory too often.
>
> Cc: Emil Velikov <emil.velikov at collabora.com>
> Cc: Sean Paul <seanpaul at chromium.org>
> Cc: Alistair Strachan <astrachan at google.com>
> Cc: Marissa Wall <marissaw at google.com>
> Signed-off-by: John Stultz <john.stultz at linaro.org>
> ---
> xf86drmMode.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/xf86drmMode.c b/xf86drmMode.c
> index 8f8633e..c878d9e 100644
> --- a/xf86drmMode.c
> +++ b/xf86drmMode.c
> @@ -1259,7 +1259,7 @@ drm_public drmModeAtomicReqPtr drmModeAtomicDuplicate(drmModeAtomicReqPtr old)
> return NULL;
> }
> memcpy(new->items, old->items,
> - old->size_items * sizeof(*new->items));
> + old->cursor * sizeof(*new->items));
This seems like another (unrelated) perf. tweak. Splitting to separate
patch may be an overkill, so a trivial mention in the commit message
will do.
With that:
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
-Emil
More information about the dri-devel
mailing list