Re: [igt-dev] [RFC v2 01/43] test/i915: gem_bad_reloc: use the gem_engine_topology library

Tvrtko Ursulin
2019-06-21T10:05:48Z

On 21/06/2019 11:02, Chris Wilson wrote:
> Quoting Ramalingam C (2019-06-21 11:03:03)
>> Replace the legacy for_each_engine* defines with the ones
>> implemented in the gem_engine_topology library.
>>
>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>> ---
>> tests/i915/gem_bad_reloc.c | 14 +++++++-------
>> 1 file changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/tests/i915/gem_bad_reloc.c b/tests/i915/gem_bad_reloc.c
>> index 7624cd8e0949..26a932a3a933 100644
>> --- a/tests/i915/gem_bad_reloc.c
>> +++ b/tests/i915/gem_bad_reloc.c
>> @@ -50,7 +50,8 @@ IGT_TEST_DESCRIPTION("Simulates SNA behaviour using negative self-relocations"
>> * than the total size of the GTT), the GPU will hang.
>> * See https://bugs.freedesktop.org/show_bug.cgi?id=78533
>> */
>> -static void negative_reloc(int fd, unsigned engine, unsigned flags)
>> +static void negative_reloc(int fd, const struct intel_execution_engine2 *e,
>> + unsigned flags)
>> {
>> struct drm_i915_gem_execbuffer2 execbuf;
>> struct drm_i915_gem_exec_object2 obj;
>> @@ -60,7 +61,6 @@ static void negative_reloc(int fd, unsigned engine, unsigned flags)
>> uint64_t *offsets;
>> int i;
>>
>> - gem_require_ring(fd, engine);
>> igt_require(intel_gen(intel_get_drm_devid(fd)) >= 7);
>>
>> memset(&obj, 0, sizeof(obj));
>> @@ -70,7 +70,7 @@ static void negative_reloc(int fd, unsigned engine, unsigned flags)
>> memset(&execbuf, 0, sizeof(execbuf));
>> execbuf.buffers_ptr = (uintptr_t)&obj;
>> execbuf.buffer_count = 1;
>> - execbuf.flags = engine | (flags & USE_LUT);
>> + execbuf.flags = e->flags | (flags & USE_LUT);
>> igt_require(__gem_execbuf(fd, &execbuf) == 0);
>>
>> igt_info("Found offset %lld for 4k batch\n", (long long)obj.offset);
>> @@ -185,7 +185,7 @@ static void negative_reloc_blt(int fd)
>>
>> igt_main
>> {
>> - const struct intel_execution_engine *e;
>> + const struct intel_execution_engine2 *e;
>> int fd = -1;
>>
>> igt_fixture {
>> @@ -193,12 +193,12 @@ igt_main
>> igt_require_gem(fd);
>> }
>>
>> - for (e = intel_execution_engines; e->name; e++) {
>> + __for_each_physical_engine(fd, e) {
>
> uABI testing not physical engines.

Should we add something like for_each_legacy_abi_engine to use in these
tests so it is more self-documenting? (And get rid of raw access to
intel_execution_engines.)

Regards,

Tvrtko