[igt-dev] [PATCH i-g-t v5] lib/igt_dummyload: add igt_cork

Chris Wilson chris at chris-wilson.co.uk
Thu Feb 22 00:46:47 UTC 2018


Quoting Antonio Argenziano (2018-02-22 00:31:44)
> From: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
> 
> The "cork" bo (imported bo with attached fence) and fence is used in several
> tests to stall execution. Moving it to a common place makes the codebase
> cleaner.
> 
> Note that the actual test updates is done in follow up patches as it is
> simpler to do in one go after one more common function is added in the
> next patch.
> 
> v2: don't use new/free naming, don't use dynamic alloc (Chris)
> v3: add sw_sync common functions. (Chris)
> v4: squash sw_sync and vgem cork structs into one. (Chris)
> v5: use anonymous enum in cork struct. (Chris)
> 
> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
> Signed-off-by: Antonio Argenziano <antonio.argenziano at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
> ---
> +static void unplug_vgem_handle(struct igt_cork *cork)
> +{
> +       vgem_fence_signal(cork->vgem.device, cork->vgem.fence);
> +       close(cork->vgem.device);
> +       cork->vgem.device = -1;
> +}
> +
> +static uint32_t plug_sync_fd(struct igt_cork *cork)
> +{
> +       int fence;
> +
> +       igt_require_sw_sync();
> +
> +       cork->sw_sync.timeline = sw_sync_timeline_create();
> +       fence = sw_sync_timeline_create_fence(cork->sw_sync.timeline, 1);
> +
> +       return fence;
> +}
> +
> +static void unplug_sync_fd(struct igt_cork *cork)
> +{
> +       sw_sync_timeline_inc(cork->sw_sync.timeline, 1);
> +       close(cork->sw_sync.timeline);

Either reset fd to -1 here, or don't for vgem. Resetting is handy if we
want to reuse the cork (or we may then just move it to init but would
need a fini to complete) and ties into the asserts.

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the igt-dev mailing list