On Wed, 2017-09-27 at 19:47 +0100, Chris Wilson wrote:
> Michal wants to limit machines that can do preemption, which means that
> we no longer can assume that if we have a scheduler for execbuf, that
> implies we have preemption.
> 
> v2: Try a capability mask instead
> v3: Pretty print the caps.
> 
> Signed-off-by: Chris Wilson <[email protected]>

<SNIP>

> +++ b/tests/gem_exec_schedule.c
> @@ -32,7 +32,12 @@
>  #include "igt_rand.h"
>  #include "igt_sysfs.h"
>  
> +#define BIT(x) (1ul << (x))
> +
>  #define LOCAL_PARAM_HAS_SCHEDULER 41
> +#define   HAS_SCHEDULER              BIT(0)
> +#define   HAS_PRIORITY               BIT(1)
> +#define   HAS_PREEMPTION     BIT(2)

This seems to be all spaces?

> +static unsigned int has_scheduler(int fd)
>  {
>       drm_i915_getparam_t gp;
> -     int has = -1;
> +     unsigned int caps = 0;
> +     char buf[200];
> +     size_t len = 0;
>  
>       gp.param = LOCAL_PARAM_HAS_SCHEDULER;
> -     gp.value = &has;
> +     gp.value = (int *)&caps;
>       drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
>  
> -     return has > 0;
> +     if (!caps)
> +             return 0;
> +
> +     len = snprintf(buf, sizeof(buf), "Has kernel scheduler");
> +     if (caps & HAS_PRIORITY)
> +             len += snprintf(buf + len, sizeof(buf) - len,
> +                             "%s context priorities",
> +                             caps & (HAS_PRIORITY - 2) ? "," : " with");
> +
> +     if (caps & HAS_PREEMPTION)
> +             len += snprintf(buf + len, sizeof(buf) - len,
> +                             "%s batchbuffer preemption",
> +                             caps & (HAS_PREEMPTION - 2) ? "," : " with");

The output is not going to be published in PEOPLE magazine, maybe we
can do a simpler indented "- with ..." prints :P

Reviewed-by: Joonas Lahtinen <[email protected]>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to