[Intel-gfx] [PATCH 2/3] drm/i915: Split out i915_priolist_types into its own header

Chris Wilson chris at chris-wilson.co.uk
Tue Apr 2 14:51:57 UTC 2019


Quoting Tvrtko Ursulin (2019-04-02 15:47:34)
> 
> On 01/04/2019 17:26, Chris Wilson wrote:
> > For more intel_engine_mask_t detangling. This time so that we can use
> > intel_engine_mask_t inside the scheduling structs.
> > 
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > ---
> >   drivers/gpu/drm/i915/Makefile                 |  1 +
> >   drivers/gpu/drm/i915/i915_priolist_types.h    | 43 +++++++++++++++++++
> >   drivers/gpu/drm/i915/i915_scheduler_types.h   | 30 +------------
> >   drivers/gpu/drm/i915/intel_engine_types.h     |  2 +-
> >   .../test_i915_priolist_types_standalone.c     |  7 +++
> >   5 files changed, 53 insertions(+), 30 deletions(-)
> >   create mode 100644 drivers/gpu/drm/i915/i915_priolist_types.h
> >   create mode 100644 drivers/gpu/drm/i915/test_i915_priolist_types_standalone.c
> > 
> > diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> > index 1f3e8b145fc0..30bf3301ea24 100644
> > --- a/drivers/gpu/drm/i915/Makefile
> > +++ b/drivers/gpu/drm/i915/Makefile
> > @@ -61,6 +61,7 @@ i915-$(CONFIG_PERF_EVENTS) += i915_pmu.o
> >   i915-$(CONFIG_DRM_I915_WERROR) += \
> >       test_i915_active_types_standalone.o \
> >       test_i915_gem_context_types_standalone.o \
> > +     test_i915_priolist_types_standalone.o \
> >       test_i915_scheduler_types_standalone.o \
> >       test_i915_timeline_types_standalone.o \
> >       test_intel_context_types_standalone.o \
> > diff --git a/drivers/gpu/drm/i915/i915_priolist_types.h b/drivers/gpu/drm/i915/i915_priolist_types.h
> > new file mode 100644
> > index 000000000000..de328a9f83f1
> > --- /dev/null
> > +++ b/drivers/gpu/drm/i915/i915_priolist_types.h
> > @@ -0,0 +1,43 @@
> > +/*
> > + * SPDX-License-Identifier: MIT
> > + *
> > + * Copyright © 2018 Intel Corporation
> > + */
> > +
> > +#ifndef _I915_PRIOLIST_TYPES_H_
> > +#define _I915_PRIOLIST_TYPES_H_
> > +
> > +#include <linux/list.h>
> > +#include <linux/rbtree.h>
> > +
> > +#include <uapi/drm/i915_drm.h>
> > +
> > +enum {
> > +     I915_PRIORITY_MIN = I915_CONTEXT_MIN_USER_PRIORITY - 1,
> > +     I915_PRIORITY_NORMAL = I915_CONTEXT_DEFAULT_PRIORITY,
> > +     I915_PRIORITY_MAX = I915_CONTEXT_MAX_USER_PRIORITY + 1,
> > +
> > +     I915_PRIORITY_INVALID = INT_MIN
> > +};
> > +
> > +#define I915_USER_PRIORITY_SHIFT 3
> > +#define I915_USER_PRIORITY(x) ((x) << I915_USER_PRIORITY_SHIFT)
> > +
> > +#define I915_PRIORITY_COUNT BIT(I915_USER_PRIORITY_SHIFT)
> > +#define I915_PRIORITY_MASK (I915_PRIORITY_COUNT - 1)
> > +
> > +#define I915_PRIORITY_WAIT           ((u8)BIT(0))
> > +#define I915_PRIORITY_NEWCLIENT              ((u8)BIT(1))
> > +#define I915_PRIORITY_NOSEMAPHORE    ((u8)BIT(2))
> > +
> > +#define __NO_PREEMPTION (I915_PRIORITY_WAIT)
> > +
> > +
> > +struct i915_priolist {
> > +     struct list_head requests[I915_PRIORITY_COUNT];
> > +     struct rb_node node;
> > +     unsigned long used;
> > +     int priority;
> > +};
> > +
> > +#endif /* _I915_PRIOLIST_TYPES_H_ */
> > diff --git a/drivers/gpu/drm/i915/i915_scheduler_types.h b/drivers/gpu/drm/i915/i915_scheduler_types.h
> > index 5c94b3eb5c81..76a004a17b2e 100644
> > --- a/drivers/gpu/drm/i915/i915_scheduler_types.h
> > +++ b/drivers/gpu/drm/i915/i915_scheduler_types.h
> > @@ -8,34 +8,13 @@
> >   #define _I915_SCHEDULER_TYPES_H_
> >   
> >   #include <linux/list.h>
> > -#include <linux/rbtree.h>
> >   
> > -#include <uapi/drm/i915_drm.h>
> > +#include "i915_priolist_types.h"
> >   
> >   struct drm_i915_private;
> >   struct i915_request;
> >   struct intel_engine_cs;
> >   
> > -enum {
> > -     I915_PRIORITY_MIN = I915_CONTEXT_MIN_USER_PRIORITY - 1,
> > -     I915_PRIORITY_NORMAL = I915_CONTEXT_DEFAULT_PRIORITY,
> > -     I915_PRIORITY_MAX = I915_CONTEXT_MAX_USER_PRIORITY + 1,
> > -
> > -     I915_PRIORITY_INVALID = INT_MIN
> > -};
> > -
> > -#define I915_USER_PRIORITY_SHIFT 3
> > -#define I915_USER_PRIORITY(x) ((x) << I915_USER_PRIORITY_SHIFT)
> > -
> > -#define I915_PRIORITY_COUNT BIT(I915_USER_PRIORITY_SHIFT)
> > -#define I915_PRIORITY_MASK (I915_PRIORITY_COUNT - 1)
> > -
> > -#define I915_PRIORITY_WAIT           ((u8)BIT(0))
> > -#define I915_PRIORITY_NEWCLIENT              ((u8)BIT(1))
> > -#define I915_PRIORITY_NOSEMAPHORE    ((u8)BIT(2))
> > -
> > -#define __NO_PREEMPTION (I915_PRIORITY_WAIT)
> > -
> >   struct i915_sched_attr {
> >       /**
> >        * @priority: execution and service priority
> > @@ -88,11 +67,4 @@ struct i915_dependency {
> >   #define I915_DEPENDENCY_ALLOC BIT(0)
> >   };
> >   
> > -struct i915_priolist {
> > -     struct list_head requests[I915_PRIORITY_COUNT];
> > -     struct rb_node node;
> > -     unsigned long used;
> > -     int priority;
> > -};
> > -
> >   #endif /* _I915_SCHEDULER_TYPES_H_ */
> > diff --git a/drivers/gpu/drm/i915/intel_engine_types.h b/drivers/gpu/drm/i915/intel_engine_types.h
> > index 232e37c1f312..14ad5263ea1e 100644
> > --- a/drivers/gpu/drm/i915/intel_engine_types.h
> > +++ b/drivers/gpu/drm/i915/intel_engine_types.h
> > @@ -14,7 +14,7 @@
> >   #include <linux/types.h>
> >   
> >   #include "i915_gem.h"
> > -#include "i915_scheduler_types.h"
> > +#include "i915_priolist_types.h"
> >   #include "i915_selftest.h"
> >   #include "i915_timeline_types.h"
> >   #include "intel_workarounds_types.h"
> > diff --git a/drivers/gpu/drm/i915/test_i915_priolist_types_standalone.c b/drivers/gpu/drm/i915/test_i915_priolist_types_standalone.c
> > new file mode 100644
> > index 000000000000..f465eb99bb47
> > --- /dev/null
> > +++ b/drivers/gpu/drm/i915/test_i915_priolist_types_standalone.c
> > @@ -0,0 +1,7 @@
> > +/*
> > + * SPDX-License-Identifier: MIT
> > + *
> > + * Copyright © 2019 Intel Corporation
> > + */
> > +
> > +#include "i915_priolist_types.h"
> > 
> 
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Thank you for your patience, one day we'll have cleaner header files!
-Chris


More information about the Intel-gfx mailing list