Skip to content

Commit

Permalink
drm/i915/gvt: Factor out prepare_workload()
Browse files Browse the repository at this point in the history
Factor out prepare_workload() for the following re-factor.

Signed-off-by: Zhi Wang <[email protected]>
  • Loading branch information
zhiwang1 authored and zhenyw committed Nov 16, 2017
1 parent 21527a8 commit 497aa3f
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions drivers/gpu/drm/i915/gvt/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,16 @@ int intel_gvt_scan_and_shadow_workload(struct intel_vgpu_workload *workload)
return ret;
}

static int prepare_workload(struct intel_vgpu_workload *workload)
{
int ret = 0;

if (workload->prepare)
ret = workload->prepare(workload);

return ret;
}

static int dispatch_workload(struct intel_vgpu_workload *workload)
{
struct intel_vgpu *vgpu = workload->vgpu;
Expand All @@ -344,12 +354,10 @@ static int dispatch_workload(struct intel_vgpu_workload *workload)
if (ret)
goto out;

if (workload->prepare) {
ret = workload->prepare(workload);
if (ret) {
engine->context_unpin(engine, shadow_ctx);
goto out;
}
ret = prepare_workload(workload);
if (ret) {
engine->context_unpin(engine, shadow_ctx);
goto out;
}

out:
Expand Down

0 comments on commit 497aa3f

Please sign in to comment.