Commit 05e5cf18 authored by Jon Bloomfield's avatar Jon Bloomfield Committed by Greg Kroah-Hartman

drm/i915: Allow parsing of unsized batches

commit 435e8fc0 upstream.

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: default avatarJon 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: default avatarChris Wilson <chris.p.wilson@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9f5fb6f2
......@@ -55,6 +55,7 @@ struct i915_execbuffer_params {
struct i915_vma *batch;
u32 dispatch_flags;
u32 args_batch_start_offset;
u64 args_batch_len;
struct intel_engine_cs *engine;
struct i915_gem_context *ctx;
struct drm_i915_gem_request *request;
......@@ -1506,13 +1507,10 @@ execbuf_submit(struct i915_execbuffer_params *params,
return ret;
}
exec_len = args->batch_len;
exec_len = params->args_batch_len;
exec_start = params->batch->node.start +
params->args_batch_start_offset;
if (exec_len == 0)
exec_len = params->batch->size - params->args_batch_start_offset;
ret = params->engine->emit_bb_start(params->request,
exec_start, exec_len,
params->dispatch_flags);
......@@ -1748,6 +1746,10 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
}
params->args_batch_start_offset = args->batch_start_offset;
params->args_batch_len = args->batch_len;
if (args->batch_len == 0)
params->args_batch_len = params->batch->size - params->args_batch_start_offset;
if (intel_engine_requires_cmd_parser(engine) ||
(intel_engine_using_cmd_parser(engine) && args->batch_len)) {
struct i915_vma *vma;
......@@ -1755,8 +1757,8 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
vma = i915_gem_execbuffer_parse(engine, &shadow_exec_entry,
params->batch->obj,
eb, vm,
args->batch_start_offset,
args->batch_len);
params->args_batch_start_offset,
params->args_batch_len);
if (IS_ERR(vma)) {
ret = PTR_ERR(vma);
goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment