summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_exec.c
diff options
context:
space:
mode:
authorMaxime Ripard <mripard@kernel.org>2024-01-29 16:20:23 +0300
committerMaxime Ripard <mripard@kernel.org>2024-01-29 16:20:23 +0300
commit4db102dcb0396a4ccf89b1eac0f4eb3fd167a080 (patch)
treeea47469abffb236c5ba305c8a406e1f8209c6f34 /drivers/gpu/drm/drm_exec.c
parentaeb262c353354eab81ab0d3242afa70984b7dc34 (diff)
parent6613476e225e090cc9aad49be7fa504e290dd33d (diff)
downloadlinux-4db102dcb0396a4ccf89b1eac0f4eb3fd167a080.tar.xz
Merge drm/drm-next into drm-misc-next
Kickstart 6.9 development cycle. Signed-off-by: Maxime Ripard <mripard@kernel.org>
Diffstat (limited to 'drivers/gpu/drm/drm_exec.c')
-rw-r--r--drivers/gpu/drm/drm_exec.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_exec.c b/drivers/gpu/drm/drm_exec.c
index 20e59d88218d..2da094bdf8a4 100644
--- a/drivers/gpu/drm/drm_exec.c
+++ b/drivers/gpu/drm/drm_exec.c
@@ -69,16 +69,23 @@ static void drm_exec_unlock_all(struct drm_exec *exec)
* drm_exec_init - initialize a drm_exec object
* @exec: the drm_exec object to initialize
* @flags: controls locking behavior, see DRM_EXEC_* defines
+ * @nr: the initial # of objects
*
* Initialize the object and make sure that we can track locked objects.
+ *
+ * If nr is non-zero then it is used as the initial objects table size.
+ * In either case, the table will grow (be re-allocated) on demand.
*/
-void drm_exec_init(struct drm_exec *exec, u32 flags)
+void drm_exec_init(struct drm_exec *exec, u32 flags, unsigned nr)
{
+ if (!nr)
+ nr = PAGE_SIZE / sizeof(void *);
+
exec->flags = flags;
- exec->objects = kmalloc(PAGE_SIZE, GFP_KERNEL);
+ exec->objects = kvmalloc_array(nr, sizeof(void *), GFP_KERNEL);
/* If allocation here fails, just delay that till the first use */
- exec->max_objects = exec->objects ? PAGE_SIZE / sizeof(void *) : 0;
+ exec->max_objects = exec->objects ? nr : 0;
exec->num_objects = 0;
exec->contended = DRM_EXEC_DUMMY;
exec->prelocked = NULL;