summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bloomfield <jon.bloomfield@intel.com>2018-08-01 12:45:50 -0400
committerJon Bloomfield <jon.bloomfield@intel.com>2019-11-05 14:37:54 -0500
commit435e8fc059dbe0eec823a75c22da2972390ba9e0 (patch)
tree17a5ec06632e3e96e0fd0d57255b87dd7b781376
parent4f7af1948abcb18b4772fe1bcd84d7d27d96258c (diff)
drm/i915: Allow parsing of unsized batches
In "drm/i915: Add support for mandatory cmdparsing" we introduced the concept of mandatory parsing. This allows the cmdparser to be invoked even when user passes batch_len=0 to the execbuf ioctl's. However, the cmdparser needs to know the extents of the buffer being scanned. Refactor the code to ensure the cmdparser uses the actual object size, instead of the incoming length, if user passes 0. Signed-off-by: Jon Bloomfield <jon.bloomfield@intel.com> Cc: Tony Luck <tony.luck@intel.com> Cc: Dave Airlie <airlied@redhat.com> Cc: Takashi Iwai <tiwai@suse.de> Cc: Tyler Hicks <tyhicks@canonical.com> Reviewed-by: Chris Wilson <chris.p.wilson@intel.com>
-rw-r--r--drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index 1f423bb2d644..8237b2935b5f 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -297,7 +297,8 @@ static inline u64 gen8_noncanonical_addr(u64 address)
297static inline bool eb_use_cmdparser(const struct i915_execbuffer *eb) 297static inline bool eb_use_cmdparser(const struct i915_execbuffer *eb)
298{ 298{
299 return intel_engine_requires_cmd_parser(eb->engine) || 299 return intel_engine_requires_cmd_parser(eb->engine) ||
300 (intel_engine_using_cmd_parser(eb->engine) && eb->batch_len); 300 (intel_engine_using_cmd_parser(eb->engine) &&
301 eb->args->batch_len);
301} 302}
302 303
303static int eb_create(struct i915_execbuffer *eb) 304static int eb_create(struct i915_execbuffer *eb)
@@ -2577,6 +2578,9 @@ i915_gem_do_execbuffer(struct drm_device *dev,
2577 goto err_vma; 2578 goto err_vma;
2578 } 2579 }
2579 2580
2581 if (eb.batch_len == 0)
2582 eb.batch_len = eb.batch->size - eb.batch_start_offset;
2583
2580 if (eb_use_cmdparser(&eb)) { 2584 if (eb_use_cmdparser(&eb)) {
2581 struct i915_vma *vma; 2585 struct i915_vma *vma;
2582 2586
@@ -2587,9 +2591,6 @@ i915_gem_do_execbuffer(struct drm_device *dev,
2587 } 2591 }
2588 } 2592 }
2589 2593
2590 if (eb.batch_len == 0)
2591 eb.batch_len = eb.batch->size - eb.batch_start_offset;
2592
2593 /* 2594 /*
2594 * snb/ivb/vlv conflate the "batch in ppgtt" bit with the "non-secure 2595 * snb/ivb/vlv conflate the "batch in ppgtt" bit with the "non-secure
2595 * batch" bit. Hence we need to pin secure batches into the global gtt. 2596 * batch" bit. Hence we need to pin secure batches into the global gtt.