Skip to content

Commit 0e997a3

Browse files
committed
drm/i915/gem: clear userspace buffers for LMEM
All userspace objects must be cleared when allocating the backing store, before they are potentially visible to userspace. For now use simple CPU based clearing to do this for device local-memory objects, note that in the near future this will instead use the blitter engine. Signed-off-by: Matthew Auld <[email protected]> Cc: Joonas Lahtinen <[email protected]> Cc: Thomas Hellström <[email protected]> Cc: Daniele Ceraolo Spurio <[email protected]> Cc: Lionel Landwerlin <[email protected]> Cc: Jon Bloomfield <[email protected]> Cc: Jordan Justen <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Kenneth Graunke <[email protected]> Cc: Jason Ekstrand <[email protected]> Cc: Dave Airlie <[email protected]> Cc: [email protected] Cc: [email protected] Reviewed-by: Kenneth Graunke <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 4f869f1 commit 0e997a3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/gpu/drm/i915/gem/i915_gem_create.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ static int
7171
i915_gem_setup(struct drm_i915_gem_object *obj, u64 size)
7272
{
7373
struct intel_memory_region *mr = obj->mm.placements[0];
74+
unsigned int flags;
7475
int ret;
7576

7677
size = round_up(size, object_max_page_size(obj));
@@ -83,7 +84,16 @@ i915_gem_setup(struct drm_i915_gem_object *obj, u64 size)
8384
if (i915_gem_object_size_2big(size))
8485
return -E2BIG;
8586

86-
ret = mr->ops->init_object(mr, obj, size, 0);
87+
/*
88+
* For now resort to CPU based clearing for device local-memory, in the
89+
* near future this will use the blitter engine for accelerated, GPU
90+
* based clearing.
91+
*/
92+
flags = 0;
93+
if (mr->type == INTEL_MEMORY_LOCAL)
94+
flags = I915_BO_ALLOC_CPU_CLEAR;
95+
96+
ret = mr->ops->init_object(mr, obj, size, flags);
8797
if (ret)
8898
return ret;
8999

0 commit comments

Comments
 (0)