OSDN Git Service

libdrm: reduce number of reallocations in drmModeAtomicAddProperty
authorAdrian Salido <salidoa@google.com>
Wed, 24 Apr 2019 17:08:40 +0000 (10:08 -0700)
committerEmil Velikov <emil.l.velikov@gmail.com>
Thu, 25 Apr 2019 09:58:16 +0000 (10:58 +0100)
commit763f646d7fee7c2457469d681b97029d4fd5e9d4
treee54d91c31adaec9cc742068f0377ecabc71910bc
parent225d73fd3bdd68ec8e41081f34109e2814c7aaba
libdrm: reduce number of reallocations in drmModeAtomicAddProperty

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.

Also this patch has a small one line perf tweak in
drmModeAtomicDuplicate() to only memcpy items to the cursor
position in order avoid copying the entire item array if its
mostly empty.

Cc: Sean Paul <seanpaul@chromium.org>
Cc: Alistair Strachan <astrachan@google.com>
Cc: Marissa Wall <marissaw@google.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
[jstultz: Expanded commit message]
Signed-off-by: John Stultz <john.stultz@linaro.org>
xf86drmMode.c