[Intel-gfx] [RFC 4/5] drm/i915: move execlists selftests to their own file

Daniele Ceraolo Spurio daniele.ceraolospurio at intel.com
Wed Dec 11 22:07:08 UTC 2019



On 12/11/19 1:26 PM, Chris Wilson wrote:
> Quoting Daniele Ceraolo Spurio (2019-12-11 21:12:43)
>> Done ahead of splitting the lrc file as well, to keep that patch
>> smaller. Just a straight copy, with the exception of create_scratch()
>> that has been made common to avoid having 3 instances of it.
>>
>> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
>> Cc: Chris Wilson <chris at chris-wilson.co.uk>
>> Cc: Tvrtko Ursulin <tvrtko.ursulin at linux.intel.com>
>> Cc: Matthew Brost <matthew.brost at intel.com>
>> ---
>>   .../drm/i915/gem/selftests/igt_gem_utils.c    |   27 +
>>   .../drm/i915/gem/selftests/igt_gem_utils.h    |    3 +
>>   drivers/gpu/drm/i915/gt/intel_lrc.c           |    1 +
>>   drivers/gpu/drm/i915/gt/selftest_execlists.c  | 3316 ++++++++++++++++
>>   drivers/gpu/drm/i915/gt/selftest_lrc.c        | 3333 +----------------
>>   drivers/gpu/drm/i915/gt/selftest_mocs.c       |   30 +-
>>   6 files changed, 3351 insertions(+), 3359 deletions(-)
>>   create mode 100644 drivers/gpu/drm/i915/gt/selftest_execlists.c
>>
>> diff --git a/drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.c b/drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.c
>> index 6718da20f35d..88109333cb79 100644
>> --- a/drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.c
>> +++ b/drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.c
>> @@ -15,6 +15,33 @@
>>   
>>   #include "i915_request.h"
>>   
>> +struct i915_vma *igt_create_scratch(struct intel_gt *gt)
> 
> _ggtt_scratch(size, coherency, pin) ?
> 
> As it stands, it's not general enough...
> 

ack.

>> +{
>> +       struct drm_i915_gem_object *obj;
>> +       struct i915_vma *vma;
>> +       int err;
>> +
>> +       obj = i915_gem_object_create_internal(gt->i915, PAGE_SIZE);
>> +       if (IS_ERR(obj))
>> +               return ERR_CAST(obj);
>> +
>> +       i915_gem_object_set_cache_coherency(obj, I915_CACHING_CACHED);
>> +
>> +       vma = i915_vma_instance(obj, &gt->ggtt->vm, NULL);
>> +       if (IS_ERR(vma)) {
>> +               i915_gem_object_put(obj);
>> +               return vma;
>> +       }
>> +
>> +       err = i915_vma_pin(vma, 0, 0, PIN_GLOBAL);
>> +       if (err) {
>> +               i915_gem_object_put(obj);
>> +               return ERR_PTR(err);
>> +       }
>> +
>> +       return vma;
>> +}
>> +
>>   struct i915_request *
>>   igt_request_alloc(struct i915_gem_context *ctx, struct intel_engine_cs *engine)
>>   {
>> diff --git a/drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.h b/drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.h
>> index 4221cf84d175..aae781f59cfc 100644
>> --- a/drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.h
>> +++ b/drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.h
>> @@ -15,6 +15,9 @@ struct i915_vma;
>>   
>>   struct intel_context;
>>   struct intel_engine_cs;
>> +struct intel_gt;
>> +
>> +struct i915_vma *igt_create_scratch(struct intel_gt *gt);
>>   
>>   struct i915_request *
>>   igt_request_alloc(struct i915_gem_context *ctx, struct intel_engine_cs *engine);
>> diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
>> index 3afae9a44911..fbdd3bdd06f1 100644
>> --- a/drivers/gpu/drm/i915/gt/intel_lrc.c
>> +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
>> @@ -4446,4 +4446,5 @@ intel_engine_in_execlists_submission_mode(const struct intel_engine_cs *engine)
>>   
>>   #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
>>   #include "selftest_lrc.c"
>> +#include "selftest_execlists.c"
>>   #endif
>> diff --git a/drivers/gpu/drm/i915/gt/selftest_execlists.c b/drivers/gpu/drm/i915/gt/selftest_execlists.c
>> new file mode 100644
>> index 000000000000..b58a4feb2ec4
>> --- /dev/null
>> +++ b/drivers/gpu/drm/i915/gt/selftest_execlists.c
> 
> Note that many if not all (there are a few where the guc being a black
> box we cannot poke at internals) of these should also be used for guc
> submission as a BAT.
> -Chris
> 

True, but several of them might also need minor updates due to GuC 
taking control of some scheduling decisions (e.g. timeslicing, 
pre-emption), so IMO better sort them out as we get the GuC flows in place.

Daniele


More information about the Intel-gfx mailing list