Message ID | 1463922152-2709-2-git-send-email-chris@chris-wilson.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 22/05/16 14:02, Chris Wilson wrote: > Our goal is to rename the anonymous per-engine struct beneath the > current intel_context. However, after a lively debate resolving around > the confusion between intel_context_engine and intel_engine_context, the > realisation is that the two structs target different users. The outer > struct is API / user facing, and so carries the higher level GEM > information. The inner struct is hw facing. Thus we want to name the > inner struct intel_context and the outer one i915_gem_context. As the > first step, we need to rename the current struct: > > s/struct intel_context/struct i915_gem_context/ > > which fits much better with its constructors already conveying the > i915_gem_context prefix! Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Regards, Tvrtko > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Dave Gordon <david.s.gordon@intel.com> > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > --- > drivers/gpu/drm/i915/i915_debugfs.c | 10 +++--- > drivers/gpu/drm/i915/i915_drv.h | 22 ++++++------- > drivers/gpu/drm/i915/i915_gem.c | 8 ++--- > drivers/gpu/drm/i915/i915_gem_context.c | 52 +++++++++++++++--------------- > drivers/gpu/drm/i915/i915_gem_execbuffer.c | 10 +++--- > drivers/gpu/drm/i915/i915_guc_submission.c | 12 +++---- > drivers/gpu/drm/i915/i915_sysfs.c | 2 +- > drivers/gpu/drm/i915/i915_trace.h | 12 +++---- > drivers/gpu/drm/i915/intel_guc.h | 2 +- > drivers/gpu/drm/i915/intel_lrc.c | 22 ++++++------- > drivers/gpu/drm/i915/intel_lrc.h | 10 +++--- > drivers/gpu/drm/i915/intel_ringbuffer.h | 4 +-- > 12 files changed, 84 insertions(+), 82 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c > index 4c6b48dbd6e2..ae28e6e9d603 100644 > --- a/drivers/gpu/drm/i915/i915_debugfs.c > +++ b/drivers/gpu/drm/i915/i915_debugfs.c > @@ -199,7 +199,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) > seq_printf(m, " (frontbuffer: 0x%03x)", obj->frontbuffer_bits); > } > > -static void describe_ctx(struct seq_file *m, struct intel_context *ctx) > +static void describe_ctx(struct seq_file *m, struct i915_gem_context *ctx) > { > seq_putc(m, ctx->legacy_hw_ctx.initialized ? 'I' : 'i'); > seq_putc(m, ctx->remap_slice ? 'R' : 'r'); > @@ -2000,7 +2000,7 @@ static int i915_context_status(struct seq_file *m, void *unused) > struct drm_device *dev = node->minor->dev; > struct drm_i915_private *dev_priv = dev->dev_private; > struct intel_engine_cs *engine; > - struct intel_context *ctx; > + struct i915_gem_context *ctx; > enum intel_engine_id id; > int ret; > > @@ -2046,7 +2046,7 @@ static int i915_context_status(struct seq_file *m, void *unused) > } > > static void i915_dump_lrc_obj(struct seq_file *m, > - struct intel_context *ctx, > + struct i915_gem_context *ctx, > struct intel_engine_cs *engine) > { > struct page *page; > @@ -2094,7 +2094,7 @@ static int i915_dump_lrc(struct seq_file *m, void *unused) > struct drm_device *dev = node->minor->dev; > struct drm_i915_private *dev_priv = dev->dev_private; > struct intel_engine_cs *engine; > - struct intel_context *ctx; > + struct i915_gem_context *ctx; > int ret; > > if (!i915.enable_execlists) { > @@ -2274,7 +2274,7 @@ static int i915_swizzle_info(struct seq_file *m, void *data) > > static int per_file_ctx(int id, void *ptr, void *data) > { > - struct intel_context *ctx = ptr; > + struct i915_gem_context *ctx = ptr; > struct seq_file *m = data; > struct i915_hw_ppgtt *ppgtt = ctx->ppgtt; > > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > index e2abd9eb352b..8380102bbdd8 100644 > --- a/drivers/gpu/drm/i915/i915_drv.h > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -831,7 +831,7 @@ struct i915_ctx_hang_stats { > > #define CONTEXT_NO_ZEROMAP (1<<0) > /** > - * struct intel_context - as the name implies, represents a context. > + * struct i915_gem_context - as the name implies, represents a context. > * @ref: reference count. > * @user_handle: userspace tracking identity for this context. > * @remap_slice: l3 row remapping information. > @@ -849,7 +849,7 @@ struct i915_ctx_hang_stats { > * Contexts are memory images used by the hardware to store copies of their > * internal state. > */ > -struct intel_context { > +struct i915_gem_context { > struct kref ref; > int user_handle; > uint8_t remap_slice; > @@ -1710,7 +1710,7 @@ struct i915_execbuffer_params { > uint64_t batch_obj_vm_offset; > struct intel_engine_cs *engine; > struct drm_i915_gem_object *batch_obj; > - struct intel_context *ctx; > + struct i915_gem_context *ctx; > struct drm_i915_gem_request *request; > }; > > @@ -2013,7 +2013,7 @@ struct drm_i915_private { > void (*stop_engine)(struct intel_engine_cs *engine); > } gt; > > - struct intel_context *kernel_context; > + struct i915_gem_context *kernel_context; > > /* perform PHY state sanity checks? */ > bool chv_phy_assert[2]; > @@ -2381,7 +2381,7 @@ struct drm_i915_gem_request { > * i915_gem_request_free() will then decrement the refcount on the > * context. > */ > - struct intel_context *ctx; > + struct i915_gem_context *ctx; > struct intel_ringbuffer *ringbuf; > > /** > @@ -2393,7 +2393,7 @@ struct drm_i915_gem_request { > * we keep the previous context pinned until the following (this) > * request is retired. > */ > - struct intel_context *previous_context; > + struct i915_gem_context *previous_context; > > /** Batch buffer related to this request if any (used for > error state dump only) */ > @@ -2437,7 +2437,7 @@ struct drm_i915_gem_request { > > struct drm_i915_gem_request * __must_check > i915_gem_request_alloc(struct intel_engine_cs *engine, > - struct intel_context *ctx); > + struct i915_gem_context *ctx); > void i915_gem_request_free(struct kref *req_ref); > int i915_gem_request_add_to_client(struct drm_i915_gem_request *req, > struct drm_file *file); > @@ -3417,22 +3417,22 @@ void i915_gem_context_reset(struct drm_device *dev); > int i915_gem_context_open(struct drm_device *dev, struct drm_file *file); > void i915_gem_context_close(struct drm_device *dev, struct drm_file *file); > int i915_switch_context(struct drm_i915_gem_request *req); > -struct intel_context * > +struct i915_gem_context * > i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id); > void i915_gem_context_free(struct kref *ctx_ref); > struct drm_i915_gem_object * > i915_gem_alloc_context_obj(struct drm_device *dev, size_t size); > -static inline void i915_gem_context_reference(struct intel_context *ctx) > +static inline void i915_gem_context_reference(struct i915_gem_context *ctx) > { > kref_get(&ctx->ref); > } > > -static inline void i915_gem_context_unreference(struct intel_context *ctx) > +static inline void i915_gem_context_unreference(struct i915_gem_context *ctx) > { > kref_put(&ctx->ref, i915_gem_context_free); > } > > -static inline bool i915_gem_context_is_default(const struct intel_context *c) > +static inline bool i915_gem_context_is_default(const struct i915_gem_context *c) > { > return c->user_handle == DEFAULT_CONTEXT_HANDLE; > } > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c > index c4af57ada378..728b66911840 100644 > --- a/drivers/gpu/drm/i915/i915_gem.c > +++ b/drivers/gpu/drm/i915/i915_gem.c > @@ -2689,7 +2689,7 @@ void __i915_add_request(struct drm_i915_gem_request *request, > } > > static bool i915_context_is_banned(struct drm_i915_private *dev_priv, > - const struct intel_context *ctx) > + const struct i915_gem_context *ctx) > { > unsigned long elapsed; > > @@ -2714,7 +2714,7 @@ static bool i915_context_is_banned(struct drm_i915_private *dev_priv, > } > > static void i915_set_reset_status(struct drm_i915_private *dev_priv, > - struct intel_context *ctx, > + struct i915_gem_context *ctx, > const bool guilty) > { > struct i915_ctx_hang_stats *hs; > @@ -2742,7 +2742,7 @@ void i915_gem_request_free(struct kref *req_ref) > > static inline int > __i915_gem_request_alloc(struct intel_engine_cs *engine, > - struct intel_context *ctx, > + struct i915_gem_context *ctx, > struct drm_i915_gem_request **req_out) > { > struct drm_i915_private *dev_priv = engine->i915; > @@ -2818,7 +2818,7 @@ err: > */ > struct drm_i915_gem_request * > i915_gem_request_alloc(struct intel_engine_cs *engine, > - struct intel_context *ctx) > + struct i915_gem_context *ctx) > { > struct drm_i915_gem_request *req; > int err; > diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c > index 2aedd188473d..8484da26b5d4 100644 > --- a/drivers/gpu/drm/i915/i915_gem_context.c > +++ b/drivers/gpu/drm/i915/i915_gem_context.c > @@ -134,7 +134,7 @@ static int get_context_size(struct drm_i915_private *dev_priv) > return ret; > } > > -static void i915_gem_context_clean(struct intel_context *ctx) > +static void i915_gem_context_clean(struct i915_gem_context *ctx) > { > struct i915_hw_ppgtt *ppgtt = ctx->ppgtt; > struct i915_vma *vma, *next; > @@ -151,7 +151,7 @@ static void i915_gem_context_clean(struct intel_context *ctx) > > void i915_gem_context_free(struct kref *ctx_ref) > { > - struct intel_context *ctx = container_of(ctx_ref, typeof(*ctx), ref); > + struct i915_gem_context *ctx = container_of(ctx_ref, typeof(*ctx), ref); > > trace_i915_context_free(ctx); > > @@ -234,12 +234,12 @@ static int assign_hw_id(struct drm_i915_private *dev_priv, unsigned *out) > return 0; > } > > -static struct intel_context * > +static struct i915_gem_context * > __create_hw_context(struct drm_device *dev, > struct drm_i915_file_private *file_priv) > { > struct drm_i915_private *dev_priv = dev->dev_private; > - struct intel_context *ctx; > + struct i915_gem_context *ctx; > int ret; > > ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); > @@ -296,12 +296,12 @@ err_out: > * context state of the GPU for applications that don't utilize HW contexts, as > * well as an idle case. > */ > -static struct intel_context * > +static struct i915_gem_context * > i915_gem_create_context(struct drm_device *dev, > struct drm_i915_file_private *file_priv) > { > const bool is_global_default_ctx = file_priv == NULL; > - struct intel_context *ctx; > + struct i915_gem_context *ctx; > int ret = 0; > > BUG_ON(!mutex_is_locked(&dev->struct_mutex)); > @@ -352,7 +352,7 @@ err_destroy: > return ERR_PTR(ret); > } > > -static void i915_gem_context_unpin(struct intel_context *ctx, > +static void i915_gem_context_unpin(struct i915_gem_context *ctx, > struct intel_engine_cs *engine) > { > if (i915.enable_execlists) { > @@ -369,7 +369,7 @@ void i915_gem_context_reset(struct drm_device *dev) > struct drm_i915_private *dev_priv = dev->dev_private; > > if (i915.enable_execlists) { > - struct intel_context *ctx; > + struct i915_gem_context *ctx; > > list_for_each_entry(ctx, &dev_priv->context_list, link) > intel_lr_context_reset(dev_priv, ctx); > @@ -381,7 +381,7 @@ void i915_gem_context_reset(struct drm_device *dev) > int i915_gem_context_init(struct drm_device *dev) > { > struct drm_i915_private *dev_priv = dev->dev_private; > - struct intel_context *ctx; > + struct i915_gem_context *ctx; > > /* Init should only be called once per module load. Eventually the > * restriction on the context_disabled check can be loosened. */ > @@ -449,7 +449,7 @@ void i915_gem_context_lost(struct drm_i915_private *dev_priv) > void i915_gem_context_fini(struct drm_device *dev) > { > struct drm_i915_private *dev_priv = dev->dev_private; > - struct intel_context *dctx = dev_priv->kernel_context; > + struct i915_gem_context *dctx = dev_priv->kernel_context; > > if (dctx->legacy_hw_ctx.rcs_state) > i915_gem_object_ggtt_unpin(dctx->legacy_hw_ctx.rcs_state); > @@ -462,7 +462,7 @@ void i915_gem_context_fini(struct drm_device *dev) > > static int context_idr_cleanup(int id, void *p, void *data) > { > - struct intel_context *ctx = p; > + struct i915_gem_context *ctx = p; > > i915_gem_context_unreference(ctx); > return 0; > @@ -471,7 +471,7 @@ static int context_idr_cleanup(int id, void *p, void *data) > int i915_gem_context_open(struct drm_device *dev, struct drm_file *file) > { > struct drm_i915_file_private *file_priv = file->driver_priv; > - struct intel_context *ctx; > + struct i915_gem_context *ctx; > > idr_init(&file_priv->context_idr); > > @@ -495,12 +495,12 @@ void i915_gem_context_close(struct drm_device *dev, struct drm_file *file) > idr_destroy(&file_priv->context_idr); > } > > -struct intel_context * > +struct i915_gem_context * > i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id) > { > - struct intel_context *ctx; > + struct i915_gem_context *ctx; > > - ctx = (struct intel_context *)idr_find(&file_priv->context_idr, id); > + ctx = idr_find(&file_priv->context_idr, id); > if (!ctx) > return ERR_PTR(-ENOENT); > > @@ -641,7 +641,7 @@ static int remap_l3(struct drm_i915_gem_request *req, int slice) > > static inline bool skip_rcs_switch(struct i915_hw_ppgtt *ppgtt, > struct intel_engine_cs *engine, > - struct intel_context *to) > + struct i915_gem_context *to) > { > if (to->remap_slice) > return false; > @@ -658,7 +658,7 @@ static inline bool skip_rcs_switch(struct i915_hw_ppgtt *ppgtt, > static bool > needs_pd_load_pre(struct i915_hw_ppgtt *ppgtt, > struct intel_engine_cs *engine, > - struct intel_context *to) > + struct i915_gem_context *to) > { > if (!ppgtt) > return false; > @@ -683,7 +683,7 @@ needs_pd_load_pre(struct i915_hw_ppgtt *ppgtt, > > static bool > needs_pd_load_post(struct i915_hw_ppgtt *ppgtt, > - struct intel_context *to, > + struct i915_gem_context *to, > u32 hw_flags) > { > if (!ppgtt) > @@ -700,10 +700,10 @@ needs_pd_load_post(struct i915_hw_ppgtt *ppgtt, > > static int do_rcs_switch(struct drm_i915_gem_request *req) > { > - struct intel_context *to = req->ctx; > + struct i915_gem_context *to = req->ctx; > struct intel_engine_cs *engine = req->engine; > struct i915_hw_ppgtt *ppgtt = to->ppgtt ?: req->i915->mm.aliasing_ppgtt; > - struct intel_context *from; > + struct i915_gem_context *from; > u32 hw_flags; > int ret, i; > > @@ -859,7 +859,7 @@ int i915_switch_context(struct drm_i915_gem_request *req) > > if (engine->id != RCS || > req->ctx->legacy_hw_ctx.rcs_state == NULL) { > - struct intel_context *to = req->ctx; > + struct i915_gem_context *to = req->ctx; > struct i915_hw_ppgtt *ppgtt = > to->ppgtt ?: req->i915->mm.aliasing_ppgtt; > > @@ -897,7 +897,7 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data, > { > struct drm_i915_gem_context_create *args = data; > struct drm_i915_file_private *file_priv = file->driver_priv; > - struct intel_context *ctx; > + struct i915_gem_context *ctx; > int ret; > > if (!contexts_enabled(dev)) > @@ -926,7 +926,7 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, > { > struct drm_i915_gem_context_destroy *args = data; > struct drm_i915_file_private *file_priv = file->driver_priv; > - struct intel_context *ctx; > + struct i915_gem_context *ctx; > int ret; > > if (args->pad != 0) > @@ -958,7 +958,7 @@ int i915_gem_context_getparam_ioctl(struct drm_device *dev, void *data, > { > struct drm_i915_file_private *file_priv = file->driver_priv; > struct drm_i915_gem_context_param *args = data; > - struct intel_context *ctx; > + struct i915_gem_context *ctx; > int ret; > > ret = i915_mutex_lock_interruptible(dev); > @@ -1001,7 +1001,7 @@ int i915_gem_context_setparam_ioctl(struct drm_device *dev, void *data, > { > struct drm_i915_file_private *file_priv = file->driver_priv; > struct drm_i915_gem_context_param *args = data; > - struct intel_context *ctx; > + struct i915_gem_context *ctx; > int ret; > > ret = i915_mutex_lock_interruptible(dev); > @@ -1047,7 +1047,7 @@ int i915_gem_context_reset_stats_ioctl(struct drm_device *dev, > struct drm_i915_private *dev_priv = dev->dev_private; > struct drm_i915_reset_stats *args = data; > struct i915_ctx_hang_stats *hs; > - struct intel_context *ctx; > + struct i915_gem_context *ctx; > int ret; > > if (args->flags || args->pad) > diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c > index a54a243ccaac..e61b92d7b0bc 100644 > --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c > +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c > @@ -716,7 +716,7 @@ eb_vma_misplaced(struct i915_vma *vma) > static int > i915_gem_execbuffer_reserve(struct intel_engine_cs *engine, > struct list_head *vmas, > - struct intel_context *ctx, > + struct i915_gem_context *ctx, > bool *need_relocs) > { > struct drm_i915_gem_object *obj; > @@ -828,7 +828,7 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev, > struct intel_engine_cs *engine, > struct eb_vmas *eb, > struct drm_i915_gem_exec_object2 *exec, > - struct intel_context *ctx) > + struct i915_gem_context *ctx) > { > struct drm_i915_gem_relocation_entry *reloc; > struct i915_address_space *vm; > @@ -1065,11 +1065,11 @@ validate_exec_list(struct drm_device *dev, > return 0; > } > > -static struct intel_context * > +static struct i915_gem_context * > i915_gem_validate_context(struct drm_device *dev, struct drm_file *file, > struct intel_engine_cs *engine, const u32 ctx_id) > { > - struct intel_context *ctx = NULL; > + struct i915_gem_context *ctx = NULL; > struct i915_ctx_hang_stats *hs; > > if (engine->id != RCS && ctx_id != DEFAULT_CONTEXT_HANDLE) > @@ -1430,7 +1430,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, > struct drm_i915_gem_object *batch_obj; > struct drm_i915_gem_exec_object2 shadow_exec_entry; > struct intel_engine_cs *engine; > - struct intel_context *ctx; > + struct i915_gem_context *ctx; > struct i915_address_space *vm; > struct i915_execbuffer_params params_master; /* XXX: will be removed later */ > struct i915_execbuffer_params *params = ¶ms_master; > diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c > index 169242a8adff..a292672f36d5 100644 > --- a/drivers/gpu/drm/i915/i915_guc_submission.c > +++ b/drivers/gpu/drm/i915/i915_guc_submission.c > @@ -360,7 +360,7 @@ static void guc_init_ctx_desc(struct intel_guc *guc, > struct drm_i915_gem_object *client_obj = client->client_obj; > struct drm_i915_private *dev_priv = guc_to_i915(guc); > struct intel_engine_cs *engine; > - struct intel_context *ctx = client->owner; > + struct i915_gem_context *ctx = client->owner; > struct guc_context_desc desc; > struct sg_table *sg; > enum intel_engine_id id; > @@ -426,7 +426,7 @@ static void guc_init_ctx_desc(struct intel_guc *guc, > desc.wq_size = client->wq_size; > > /* > - * XXX: Take LRCs from an existing intel_context if this is not an > + * XXX: Take LRCs from an existing context if this is not an > * IsKMDCreatedContext client > */ > desc.desc_private = (uintptr_t)client; > @@ -677,7 +677,7 @@ static void guc_client_free(struct drm_device *dev, > */ > static struct i915_guc_client *guc_client_alloc(struct drm_device *dev, > uint32_t priority, > - struct intel_context *ctx) > + struct i915_gem_context *ctx) > { > struct i915_guc_client *client; > struct drm_i915_private *dev_priv = dev->dev_private; > @@ -915,7 +915,7 @@ int i915_guc_submission_enable(struct drm_device *dev) > { > struct drm_i915_private *dev_priv = dev->dev_private; > struct intel_guc *guc = &dev_priv->guc; > - struct intel_context *ctx = dev_priv->kernel_context; > + struct i915_gem_context *ctx = dev_priv->kernel_context; > struct i915_guc_client *client; > > /* client for execbuf submission */ > @@ -966,7 +966,7 @@ int intel_guc_suspend(struct drm_device *dev) > { > struct drm_i915_private *dev_priv = dev->dev_private; > struct intel_guc *guc = &dev_priv->guc; > - struct intel_context *ctx; > + struct i915_gem_context *ctx; > u32 data[3]; > > if (!i915.enable_guc_submission) > @@ -992,7 +992,7 @@ int intel_guc_resume(struct drm_device *dev) > { > struct drm_i915_private *dev_priv = dev->dev_private; > struct intel_guc *guc = &dev_priv->guc; > - struct intel_context *ctx; > + struct i915_gem_context *ctx; > u32 data[3]; > > if (!i915.enable_guc_submission) > diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c > index 37b6444b8e22..02507bfc8def 100644 > --- a/drivers/gpu/drm/i915/i915_sysfs.c > +++ b/drivers/gpu/drm/i915/i915_sysfs.c > @@ -203,7 +203,7 @@ i915_l3_write(struct file *filp, struct kobject *kobj, > struct drm_minor *dminor = dev_to_drm_minor(dev); > struct drm_device *drm_dev = dminor->dev; > struct drm_i915_private *dev_priv = drm_dev->dev_private; > - struct intel_context *ctx; > + struct i915_gem_context *ctx; > u32 *temp = NULL; /* Just here to make handling failures easy */ > int slice = (int)(uintptr_t)attr->private; > int ret; > diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h > index 20b2e4039792..6768db032f84 100644 > --- a/drivers/gpu/drm/i915/i915_trace.h > +++ b/drivers/gpu/drm/i915/i915_trace.h > @@ -734,12 +734,12 @@ DEFINE_EVENT(i915_ppgtt, i915_ppgtt_release, > * the context. > */ > DECLARE_EVENT_CLASS(i915_context, > - TP_PROTO(struct intel_context *ctx), > + TP_PROTO(struct i915_gem_context *ctx), > TP_ARGS(ctx), > > TP_STRUCT__entry( > __field(u32, dev) > - __field(struct intel_context *, ctx) > + __field(struct i915_gem_context *, ctx) > __field(struct i915_address_space *, vm) > ), > > @@ -754,12 +754,12 @@ DECLARE_EVENT_CLASS(i915_context, > ) > > DEFINE_EVENT(i915_context, i915_context_create, > - TP_PROTO(struct intel_context *ctx), > + TP_PROTO(struct i915_gem_context *ctx), > TP_ARGS(ctx) > ); > > DEFINE_EVENT(i915_context, i915_context_free, > - TP_PROTO(struct intel_context *ctx), > + TP_PROTO(struct i915_gem_context *ctx), > TP_ARGS(ctx) > ); > > @@ -771,13 +771,13 @@ DEFINE_EVENT(i915_context, i915_context_free, > * called only if full ppgtt is enabled. > */ > TRACE_EVENT(switch_mm, > - TP_PROTO(struct intel_engine_cs *engine, struct intel_context *to), > + TP_PROTO(struct intel_engine_cs *engine, struct i915_gem_context *to), > > TP_ARGS(engine, to), > > TP_STRUCT__entry( > __field(u32, ring) > - __field(struct intel_context *, to) > + __field(struct i915_gem_context *, to) > __field(struct i915_address_space *, vm) > __field(u32, dev) > ), > diff --git a/drivers/gpu/drm/i915/intel_guc.h b/drivers/gpu/drm/i915/intel_guc.h > index 9d79c4c3e256..c9c757ef003f 100644 > --- a/drivers/gpu/drm/i915/intel_guc.h > +++ b/drivers/gpu/drm/i915/intel_guc.h > @@ -55,7 +55,7 @@ struct drm_i915_gem_request; > struct i915_guc_client { > struct drm_i915_gem_object *client_obj; > void *client_base; /* first page (only) of above */ > - struct intel_context *owner; > + struct i915_gem_context *owner; > struct intel_guc *guc; > uint32_t priority; > uint32_t ctx_index; > diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c > index affca6d5ce7e..426dc90aceed 100644 > --- a/drivers/gpu/drm/i915/intel_lrc.c > +++ b/drivers/gpu/drm/i915/intel_lrc.c > @@ -231,9 +231,9 @@ enum { > /* Typical size of the average request (2 pipecontrols and a MI_BB) */ > #define EXECLISTS_REQUEST_SIZE 64 /* bytes */ > > -static int execlists_context_deferred_alloc(struct intel_context *ctx, > +static int execlists_context_deferred_alloc(struct i915_gem_context *ctx, > struct intel_engine_cs *engine); > -static int intel_lr_context_pin(struct intel_context *ctx, > +static int intel_lr_context_pin(struct i915_gem_context *ctx, > struct intel_engine_cs *engine); > > /** > @@ -315,7 +315,7 @@ logical_ring_init_platform_invariants(struct intel_engine_cs *engine) > * bits 55-63: group ID, currently unused and set to 0 > */ > static void > -intel_lr_context_descriptor_update(struct intel_context *ctx, > +intel_lr_context_descriptor_update(struct i915_gem_context *ctx, > struct intel_engine_cs *engine) > { > u64 desc; > @@ -330,7 +330,7 @@ intel_lr_context_descriptor_update(struct intel_context *ctx, > ctx->engine[engine->id].lrc_desc = desc; > } > > -uint64_t intel_lr_context_descriptor(struct intel_context *ctx, > +uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx, > struct intel_engine_cs *engine) > { > return ctx->engine[engine->id].lrc_desc; > @@ -932,7 +932,7 @@ int logical_ring_flush_all_caches(struct drm_i915_gem_request *req) > return 0; > } > > -static int intel_lr_context_pin(struct intel_context *ctx, > +static int intel_lr_context_pin(struct i915_gem_context *ctx, > struct intel_engine_cs *engine) > { > struct drm_i915_private *dev_priv = ctx->i915; > @@ -988,7 +988,7 @@ err: > return ret; > } > > -void intel_lr_context_unpin(struct intel_context *ctx, > +void intel_lr_context_unpin(struct i915_gem_context *ctx, > struct intel_engine_cs *engine) > { > struct drm_i915_gem_object *ctx_obj; > @@ -2049,7 +2049,7 @@ logical_ring_setup(struct drm_device *dev, enum intel_engine_id id) > static int > logical_ring_init(struct intel_engine_cs *engine) > { > - struct intel_context *dctx = engine->i915->kernel_context; > + struct i915_gem_context *dctx = engine->i915->kernel_context; > int ret; > > ret = i915_cmd_parser_init_ring(engine); > @@ -2273,7 +2273,7 @@ static u32 intel_lr_indirect_ctx_offset(struct intel_engine_cs *engine) > } > > static int > -populate_lr_context(struct intel_context *ctx, > +populate_lr_context(struct i915_gem_context *ctx, > struct drm_i915_gem_object *ctx_obj, > struct intel_engine_cs *engine, > struct intel_ringbuffer *ringbuf) > @@ -2421,7 +2421,7 @@ populate_lr_context(struct intel_context *ctx, > * takes care of the bits that are LRC related: the per-engine backing > * objects and the logical ringbuffer. > */ > -void intel_lr_context_free(struct intel_context *ctx) > +void intel_lr_context_free(struct i915_gem_context *ctx) > { > int i; > > @@ -2489,7 +2489,7 @@ uint32_t intel_lr_context_size(struct intel_engine_cs *engine) > * > * Return: non-zero on error. > */ > -static int execlists_context_deferred_alloc(struct intel_context *ctx, > +static int execlists_context_deferred_alloc(struct i915_gem_context *ctx, > struct intel_engine_cs *engine) > { > struct drm_i915_gem_object *ctx_obj; > @@ -2539,7 +2539,7 @@ error_deref_obj: > } > > void intel_lr_context_reset(struct drm_i915_private *dev_priv, > - struct intel_context *ctx) > + struct i915_gem_context *ctx) > { > struct intel_engine_cs *engine; > > diff --git a/drivers/gpu/drm/i915/intel_lrc.h b/drivers/gpu/drm/i915/intel_lrc.h > index 1afba0331dc6..eb2e1d157fed 100644 > --- a/drivers/gpu/drm/i915/intel_lrc.h > +++ b/drivers/gpu/drm/i915/intel_lrc.h > @@ -99,16 +99,18 @@ static inline void intel_logical_ring_emit_reg(struct intel_ringbuffer *ringbuf, > #define LRC_PPHWSP_PN (LRC_GUCSHR_PN + 1) > #define LRC_STATE_PN (LRC_PPHWSP_PN + 1) > > -void intel_lr_context_free(struct intel_context *ctx); > +struct i915_gem_context; > + > +void intel_lr_context_free(struct i915_gem_context *ctx); > uint32_t intel_lr_context_size(struct intel_engine_cs *engine); > -void intel_lr_context_unpin(struct intel_context *ctx, > +void intel_lr_context_unpin(struct i915_gem_context *ctx, > struct intel_engine_cs *engine); > > struct drm_i915_private; > > void intel_lr_context_reset(struct drm_i915_private *dev_priv, > - struct intel_context *ctx); > -uint64_t intel_lr_context_descriptor(struct intel_context *ctx, > + struct i915_gem_context *ctx); > +uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx, > struct intel_engine_cs *engine); > > /* Execlists */ > diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h > index 929e7b4af2a4..b33c876fed20 100644 > --- a/drivers/gpu/drm/i915/intel_ringbuffer.h > +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h > @@ -119,7 +119,7 @@ struct intel_ringbuffer { > u32 last_retired_head; > }; > > -struct intel_context; > +struct i915_gem_context; > struct drm_i915_reg_table; > > /* > @@ -310,7 +310,7 @@ struct intel_engine_cs { > > wait_queue_head_t irq_queue; > > - struct intel_context *last_context; > + struct i915_gem_context *last_context; > > struct intel_ring_hangcheck hangcheck; > >
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 4c6b48dbd6e2..ae28e6e9d603 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -199,7 +199,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) seq_printf(m, " (frontbuffer: 0x%03x)", obj->frontbuffer_bits); } -static void describe_ctx(struct seq_file *m, struct intel_context *ctx) +static void describe_ctx(struct seq_file *m, struct i915_gem_context *ctx) { seq_putc(m, ctx->legacy_hw_ctx.initialized ? 'I' : 'i'); seq_putc(m, ctx->remap_slice ? 'R' : 'r'); @@ -2000,7 +2000,7 @@ static int i915_context_status(struct seq_file *m, void *unused) struct drm_device *dev = node->minor->dev; struct drm_i915_private *dev_priv = dev->dev_private; struct intel_engine_cs *engine; - struct intel_context *ctx; + struct i915_gem_context *ctx; enum intel_engine_id id; int ret; @@ -2046,7 +2046,7 @@ static int i915_context_status(struct seq_file *m, void *unused) } static void i915_dump_lrc_obj(struct seq_file *m, - struct intel_context *ctx, + struct i915_gem_context *ctx, struct intel_engine_cs *engine) { struct page *page; @@ -2094,7 +2094,7 @@ static int i915_dump_lrc(struct seq_file *m, void *unused) struct drm_device *dev = node->minor->dev; struct drm_i915_private *dev_priv = dev->dev_private; struct intel_engine_cs *engine; - struct intel_context *ctx; + struct i915_gem_context *ctx; int ret; if (!i915.enable_execlists) { @@ -2274,7 +2274,7 @@ static int i915_swizzle_info(struct seq_file *m, void *data) static int per_file_ctx(int id, void *ptr, void *data) { - struct intel_context *ctx = ptr; + struct i915_gem_context *ctx = ptr; struct seq_file *m = data; struct i915_hw_ppgtt *ppgtt = ctx->ppgtt; diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index e2abd9eb352b..8380102bbdd8 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -831,7 +831,7 @@ struct i915_ctx_hang_stats { #define CONTEXT_NO_ZEROMAP (1<<0) /** - * struct intel_context - as the name implies, represents a context. + * struct i915_gem_context - as the name implies, represents a context. * @ref: reference count. * @user_handle: userspace tracking identity for this context. * @remap_slice: l3 row remapping information. @@ -849,7 +849,7 @@ struct i915_ctx_hang_stats { * Contexts are memory images used by the hardware to store copies of their * internal state. */ -struct intel_context { +struct i915_gem_context { struct kref ref; int user_handle; uint8_t remap_slice; @@ -1710,7 +1710,7 @@ struct i915_execbuffer_params { uint64_t batch_obj_vm_offset; struct intel_engine_cs *engine; struct drm_i915_gem_object *batch_obj; - struct intel_context *ctx; + struct i915_gem_context *ctx; struct drm_i915_gem_request *request; }; @@ -2013,7 +2013,7 @@ struct drm_i915_private { void (*stop_engine)(struct intel_engine_cs *engine); } gt; - struct intel_context *kernel_context; + struct i915_gem_context *kernel_context; /* perform PHY state sanity checks? */ bool chv_phy_assert[2]; @@ -2381,7 +2381,7 @@ struct drm_i915_gem_request { * i915_gem_request_free() will then decrement the refcount on the * context. */ - struct intel_context *ctx; + struct i915_gem_context *ctx; struct intel_ringbuffer *ringbuf; /** @@ -2393,7 +2393,7 @@ struct drm_i915_gem_request { * we keep the previous context pinned until the following (this) * request is retired. */ - struct intel_context *previous_context; + struct i915_gem_context *previous_context; /** Batch buffer related to this request if any (used for error state dump only) */ @@ -2437,7 +2437,7 @@ struct drm_i915_gem_request { struct drm_i915_gem_request * __must_check i915_gem_request_alloc(struct intel_engine_cs *engine, - struct intel_context *ctx); + struct i915_gem_context *ctx); void i915_gem_request_free(struct kref *req_ref); int i915_gem_request_add_to_client(struct drm_i915_gem_request *req, struct drm_file *file); @@ -3417,22 +3417,22 @@ void i915_gem_context_reset(struct drm_device *dev); int i915_gem_context_open(struct drm_device *dev, struct drm_file *file); void i915_gem_context_close(struct drm_device *dev, struct drm_file *file); int i915_switch_context(struct drm_i915_gem_request *req); -struct intel_context * +struct i915_gem_context * i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id); void i915_gem_context_free(struct kref *ctx_ref); struct drm_i915_gem_object * i915_gem_alloc_context_obj(struct drm_device *dev, size_t size); -static inline void i915_gem_context_reference(struct intel_context *ctx) +static inline void i915_gem_context_reference(struct i915_gem_context *ctx) { kref_get(&ctx->ref); } -static inline void i915_gem_context_unreference(struct intel_context *ctx) +static inline void i915_gem_context_unreference(struct i915_gem_context *ctx) { kref_put(&ctx->ref, i915_gem_context_free); } -static inline bool i915_gem_context_is_default(const struct intel_context *c) +static inline bool i915_gem_context_is_default(const struct i915_gem_context *c) { return c->user_handle == DEFAULT_CONTEXT_HANDLE; } diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index c4af57ada378..728b66911840 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -2689,7 +2689,7 @@ void __i915_add_request(struct drm_i915_gem_request *request, } static bool i915_context_is_banned(struct drm_i915_private *dev_priv, - const struct intel_context *ctx) + const struct i915_gem_context *ctx) { unsigned long elapsed; @@ -2714,7 +2714,7 @@ static bool i915_context_is_banned(struct drm_i915_private *dev_priv, } static void i915_set_reset_status(struct drm_i915_private *dev_priv, - struct intel_context *ctx, + struct i915_gem_context *ctx, const bool guilty) { struct i915_ctx_hang_stats *hs; @@ -2742,7 +2742,7 @@ void i915_gem_request_free(struct kref *req_ref) static inline int __i915_gem_request_alloc(struct intel_engine_cs *engine, - struct intel_context *ctx, + struct i915_gem_context *ctx, struct drm_i915_gem_request **req_out) { struct drm_i915_private *dev_priv = engine->i915; @@ -2818,7 +2818,7 @@ err: */ struct drm_i915_gem_request * i915_gem_request_alloc(struct intel_engine_cs *engine, - struct intel_context *ctx) + struct i915_gem_context *ctx) { struct drm_i915_gem_request *req; int err; diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index 2aedd188473d..8484da26b5d4 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c @@ -134,7 +134,7 @@ static int get_context_size(struct drm_i915_private *dev_priv) return ret; } -static void i915_gem_context_clean(struct intel_context *ctx) +static void i915_gem_context_clean(struct i915_gem_context *ctx) { struct i915_hw_ppgtt *ppgtt = ctx->ppgtt; struct i915_vma *vma, *next; @@ -151,7 +151,7 @@ static void i915_gem_context_clean(struct intel_context *ctx) void i915_gem_context_free(struct kref *ctx_ref) { - struct intel_context *ctx = container_of(ctx_ref, typeof(*ctx), ref); + struct i915_gem_context *ctx = container_of(ctx_ref, typeof(*ctx), ref); trace_i915_context_free(ctx); @@ -234,12 +234,12 @@ static int assign_hw_id(struct drm_i915_private *dev_priv, unsigned *out) return 0; } -static struct intel_context * +static struct i915_gem_context * __create_hw_context(struct drm_device *dev, struct drm_i915_file_private *file_priv) { struct drm_i915_private *dev_priv = dev->dev_private; - struct intel_context *ctx; + struct i915_gem_context *ctx; int ret; ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); @@ -296,12 +296,12 @@ err_out: * context state of the GPU for applications that don't utilize HW contexts, as * well as an idle case. */ -static struct intel_context * +static struct i915_gem_context * i915_gem_create_context(struct drm_device *dev, struct drm_i915_file_private *file_priv) { const bool is_global_default_ctx = file_priv == NULL; - struct intel_context *ctx; + struct i915_gem_context *ctx; int ret = 0; BUG_ON(!mutex_is_locked(&dev->struct_mutex)); @@ -352,7 +352,7 @@ err_destroy: return ERR_PTR(ret); } -static void i915_gem_context_unpin(struct intel_context *ctx, +static void i915_gem_context_unpin(struct i915_gem_context *ctx, struct intel_engine_cs *engine) { if (i915.enable_execlists) { @@ -369,7 +369,7 @@ void i915_gem_context_reset(struct drm_device *dev) struct drm_i915_private *dev_priv = dev->dev_private; if (i915.enable_execlists) { - struct intel_context *ctx; + struct i915_gem_context *ctx; list_for_each_entry(ctx, &dev_priv->context_list, link) intel_lr_context_reset(dev_priv, ctx); @@ -381,7 +381,7 @@ void i915_gem_context_reset(struct drm_device *dev) int i915_gem_context_init(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; - struct intel_context *ctx; + struct i915_gem_context *ctx; /* Init should only be called once per module load. Eventually the * restriction on the context_disabled check can be loosened. */ @@ -449,7 +449,7 @@ void i915_gem_context_lost(struct drm_i915_private *dev_priv) void i915_gem_context_fini(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; - struct intel_context *dctx = dev_priv->kernel_context; + struct i915_gem_context *dctx = dev_priv->kernel_context; if (dctx->legacy_hw_ctx.rcs_state) i915_gem_object_ggtt_unpin(dctx->legacy_hw_ctx.rcs_state); @@ -462,7 +462,7 @@ void i915_gem_context_fini(struct drm_device *dev) static int context_idr_cleanup(int id, void *p, void *data) { - struct intel_context *ctx = p; + struct i915_gem_context *ctx = p; i915_gem_context_unreference(ctx); return 0; @@ -471,7 +471,7 @@ static int context_idr_cleanup(int id, void *p, void *data) int i915_gem_context_open(struct drm_device *dev, struct drm_file *file) { struct drm_i915_file_private *file_priv = file->driver_priv; - struct intel_context *ctx; + struct i915_gem_context *ctx; idr_init(&file_priv->context_idr); @@ -495,12 +495,12 @@ void i915_gem_context_close(struct drm_device *dev, struct drm_file *file) idr_destroy(&file_priv->context_idr); } -struct intel_context * +struct i915_gem_context * i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id) { - struct intel_context *ctx; + struct i915_gem_context *ctx; - ctx = (struct intel_context *)idr_find(&file_priv->context_idr, id); + ctx = idr_find(&file_priv->context_idr, id); if (!ctx) return ERR_PTR(-ENOENT); @@ -641,7 +641,7 @@ static int remap_l3(struct drm_i915_gem_request *req, int slice) static inline bool skip_rcs_switch(struct i915_hw_ppgtt *ppgtt, struct intel_engine_cs *engine, - struct intel_context *to) + struct i915_gem_context *to) { if (to->remap_slice) return false; @@ -658,7 +658,7 @@ static inline bool skip_rcs_switch(struct i915_hw_ppgtt *ppgtt, static bool needs_pd_load_pre(struct i915_hw_ppgtt *ppgtt, struct intel_engine_cs *engine, - struct intel_context *to) + struct i915_gem_context *to) { if (!ppgtt) return false; @@ -683,7 +683,7 @@ needs_pd_load_pre(struct i915_hw_ppgtt *ppgtt, static bool needs_pd_load_post(struct i915_hw_ppgtt *ppgtt, - struct intel_context *to, + struct i915_gem_context *to, u32 hw_flags) { if (!ppgtt) @@ -700,10 +700,10 @@ needs_pd_load_post(struct i915_hw_ppgtt *ppgtt, static int do_rcs_switch(struct drm_i915_gem_request *req) { - struct intel_context *to = req->ctx; + struct i915_gem_context *to = req->ctx; struct intel_engine_cs *engine = req->engine; struct i915_hw_ppgtt *ppgtt = to->ppgtt ?: req->i915->mm.aliasing_ppgtt; - struct intel_context *from; + struct i915_gem_context *from; u32 hw_flags; int ret, i; @@ -859,7 +859,7 @@ int i915_switch_context(struct drm_i915_gem_request *req) if (engine->id != RCS || req->ctx->legacy_hw_ctx.rcs_state == NULL) { - struct intel_context *to = req->ctx; + struct i915_gem_context *to = req->ctx; struct i915_hw_ppgtt *ppgtt = to->ppgtt ?: req->i915->mm.aliasing_ppgtt; @@ -897,7 +897,7 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data, { struct drm_i915_gem_context_create *args = data; struct drm_i915_file_private *file_priv = file->driver_priv; - struct intel_context *ctx; + struct i915_gem_context *ctx; int ret; if (!contexts_enabled(dev)) @@ -926,7 +926,7 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, { struct drm_i915_gem_context_destroy *args = data; struct drm_i915_file_private *file_priv = file->driver_priv; - struct intel_context *ctx; + struct i915_gem_context *ctx; int ret; if (args->pad != 0) @@ -958,7 +958,7 @@ int i915_gem_context_getparam_ioctl(struct drm_device *dev, void *data, { struct drm_i915_file_private *file_priv = file->driver_priv; struct drm_i915_gem_context_param *args = data; - struct intel_context *ctx; + struct i915_gem_context *ctx; int ret; ret = i915_mutex_lock_interruptible(dev); @@ -1001,7 +1001,7 @@ int i915_gem_context_setparam_ioctl(struct drm_device *dev, void *data, { struct drm_i915_file_private *file_priv = file->driver_priv; struct drm_i915_gem_context_param *args = data; - struct intel_context *ctx; + struct i915_gem_context *ctx; int ret; ret = i915_mutex_lock_interruptible(dev); @@ -1047,7 +1047,7 @@ int i915_gem_context_reset_stats_ioctl(struct drm_device *dev, struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_reset_stats *args = data; struct i915_ctx_hang_stats *hs; - struct intel_context *ctx; + struct i915_gem_context *ctx; int ret; if (args->flags || args->pad) diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index a54a243ccaac..e61b92d7b0bc 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -716,7 +716,7 @@ eb_vma_misplaced(struct i915_vma *vma) static int i915_gem_execbuffer_reserve(struct intel_engine_cs *engine, struct list_head *vmas, - struct intel_context *ctx, + struct i915_gem_context *ctx, bool *need_relocs) { struct drm_i915_gem_object *obj; @@ -828,7 +828,7 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev, struct intel_engine_cs *engine, struct eb_vmas *eb, struct drm_i915_gem_exec_object2 *exec, - struct intel_context *ctx) + struct i915_gem_context *ctx) { struct drm_i915_gem_relocation_entry *reloc; struct i915_address_space *vm; @@ -1065,11 +1065,11 @@ validate_exec_list(struct drm_device *dev, return 0; } -static struct intel_context * +static struct i915_gem_context * i915_gem_validate_context(struct drm_device *dev, struct drm_file *file, struct intel_engine_cs *engine, const u32 ctx_id) { - struct intel_context *ctx = NULL; + struct i915_gem_context *ctx = NULL; struct i915_ctx_hang_stats *hs; if (engine->id != RCS && ctx_id != DEFAULT_CONTEXT_HANDLE) @@ -1430,7 +1430,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, struct drm_i915_gem_object *batch_obj; struct drm_i915_gem_exec_object2 shadow_exec_entry; struct intel_engine_cs *engine; - struct intel_context *ctx; + struct i915_gem_context *ctx; struct i915_address_space *vm; struct i915_execbuffer_params params_master; /* XXX: will be removed later */ struct i915_execbuffer_params *params = ¶ms_master; diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c index 169242a8adff..a292672f36d5 100644 --- a/drivers/gpu/drm/i915/i915_guc_submission.c +++ b/drivers/gpu/drm/i915/i915_guc_submission.c @@ -360,7 +360,7 @@ static void guc_init_ctx_desc(struct intel_guc *guc, struct drm_i915_gem_object *client_obj = client->client_obj; struct drm_i915_private *dev_priv = guc_to_i915(guc); struct intel_engine_cs *engine; - struct intel_context *ctx = client->owner; + struct i915_gem_context *ctx = client->owner; struct guc_context_desc desc; struct sg_table *sg; enum intel_engine_id id; @@ -426,7 +426,7 @@ static void guc_init_ctx_desc(struct intel_guc *guc, desc.wq_size = client->wq_size; /* - * XXX: Take LRCs from an existing intel_context if this is not an + * XXX: Take LRCs from an existing context if this is not an * IsKMDCreatedContext client */ desc.desc_private = (uintptr_t)client; @@ -677,7 +677,7 @@ static void guc_client_free(struct drm_device *dev, */ static struct i915_guc_client *guc_client_alloc(struct drm_device *dev, uint32_t priority, - struct intel_context *ctx) + struct i915_gem_context *ctx) { struct i915_guc_client *client; struct drm_i915_private *dev_priv = dev->dev_private; @@ -915,7 +915,7 @@ int i915_guc_submission_enable(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; struct intel_guc *guc = &dev_priv->guc; - struct intel_context *ctx = dev_priv->kernel_context; + struct i915_gem_context *ctx = dev_priv->kernel_context; struct i915_guc_client *client; /* client for execbuf submission */ @@ -966,7 +966,7 @@ int intel_guc_suspend(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; struct intel_guc *guc = &dev_priv->guc; - struct intel_context *ctx; + struct i915_gem_context *ctx; u32 data[3]; if (!i915.enable_guc_submission) @@ -992,7 +992,7 @@ int intel_guc_resume(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; struct intel_guc *guc = &dev_priv->guc; - struct intel_context *ctx; + struct i915_gem_context *ctx; u32 data[3]; if (!i915.enable_guc_submission) diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c index 37b6444b8e22..02507bfc8def 100644 --- a/drivers/gpu/drm/i915/i915_sysfs.c +++ b/drivers/gpu/drm/i915/i915_sysfs.c @@ -203,7 +203,7 @@ i915_l3_write(struct file *filp, struct kobject *kobj, struct drm_minor *dminor = dev_to_drm_minor(dev); struct drm_device *drm_dev = dminor->dev; struct drm_i915_private *dev_priv = drm_dev->dev_private; - struct intel_context *ctx; + struct i915_gem_context *ctx; u32 *temp = NULL; /* Just here to make handling failures easy */ int slice = (int)(uintptr_t)attr->private; int ret; diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h index 20b2e4039792..6768db032f84 100644 --- a/drivers/gpu/drm/i915/i915_trace.h +++ b/drivers/gpu/drm/i915/i915_trace.h @@ -734,12 +734,12 @@ DEFINE_EVENT(i915_ppgtt, i915_ppgtt_release, * the context. */ DECLARE_EVENT_CLASS(i915_context, - TP_PROTO(struct intel_context *ctx), + TP_PROTO(struct i915_gem_context *ctx), TP_ARGS(ctx), TP_STRUCT__entry( __field(u32, dev) - __field(struct intel_context *, ctx) + __field(struct i915_gem_context *, ctx) __field(struct i915_address_space *, vm) ), @@ -754,12 +754,12 @@ DECLARE_EVENT_CLASS(i915_context, ) DEFINE_EVENT(i915_context, i915_context_create, - TP_PROTO(struct intel_context *ctx), + TP_PROTO(struct i915_gem_context *ctx), TP_ARGS(ctx) ); DEFINE_EVENT(i915_context, i915_context_free, - TP_PROTO(struct intel_context *ctx), + TP_PROTO(struct i915_gem_context *ctx), TP_ARGS(ctx) ); @@ -771,13 +771,13 @@ DEFINE_EVENT(i915_context, i915_context_free, * called only if full ppgtt is enabled. */ TRACE_EVENT(switch_mm, - TP_PROTO(struct intel_engine_cs *engine, struct intel_context *to), + TP_PROTO(struct intel_engine_cs *engine, struct i915_gem_context *to), TP_ARGS(engine, to), TP_STRUCT__entry( __field(u32, ring) - __field(struct intel_context *, to) + __field(struct i915_gem_context *, to) __field(struct i915_address_space *, vm) __field(u32, dev) ), diff --git a/drivers/gpu/drm/i915/intel_guc.h b/drivers/gpu/drm/i915/intel_guc.h index 9d79c4c3e256..c9c757ef003f 100644 --- a/drivers/gpu/drm/i915/intel_guc.h +++ b/drivers/gpu/drm/i915/intel_guc.h @@ -55,7 +55,7 @@ struct drm_i915_gem_request; struct i915_guc_client { struct drm_i915_gem_object *client_obj; void *client_base; /* first page (only) of above */ - struct intel_context *owner; + struct i915_gem_context *owner; struct intel_guc *guc; uint32_t priority; uint32_t ctx_index; diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index affca6d5ce7e..426dc90aceed 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c @@ -231,9 +231,9 @@ enum { /* Typical size of the average request (2 pipecontrols and a MI_BB) */ #define EXECLISTS_REQUEST_SIZE 64 /* bytes */ -static int execlists_context_deferred_alloc(struct intel_context *ctx, +static int execlists_context_deferred_alloc(struct i915_gem_context *ctx, struct intel_engine_cs *engine); -static int intel_lr_context_pin(struct intel_context *ctx, +static int intel_lr_context_pin(struct i915_gem_context *ctx, struct intel_engine_cs *engine); /** @@ -315,7 +315,7 @@ logical_ring_init_platform_invariants(struct intel_engine_cs *engine) * bits 55-63: group ID, currently unused and set to 0 */ static void -intel_lr_context_descriptor_update(struct intel_context *ctx, +intel_lr_context_descriptor_update(struct i915_gem_context *ctx, struct intel_engine_cs *engine) { u64 desc; @@ -330,7 +330,7 @@ intel_lr_context_descriptor_update(struct intel_context *ctx, ctx->engine[engine->id].lrc_desc = desc; } -uint64_t intel_lr_context_descriptor(struct intel_context *ctx, +uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx, struct intel_engine_cs *engine) { return ctx->engine[engine->id].lrc_desc; @@ -932,7 +932,7 @@ int logical_ring_flush_all_caches(struct drm_i915_gem_request *req) return 0; } -static int intel_lr_context_pin(struct intel_context *ctx, +static int intel_lr_context_pin(struct i915_gem_context *ctx, struct intel_engine_cs *engine) { struct drm_i915_private *dev_priv = ctx->i915; @@ -988,7 +988,7 @@ err: return ret; } -void intel_lr_context_unpin(struct intel_context *ctx, +void intel_lr_context_unpin(struct i915_gem_context *ctx, struct intel_engine_cs *engine) { struct drm_i915_gem_object *ctx_obj; @@ -2049,7 +2049,7 @@ logical_ring_setup(struct drm_device *dev, enum intel_engine_id id) static int logical_ring_init(struct intel_engine_cs *engine) { - struct intel_context *dctx = engine->i915->kernel_context; + struct i915_gem_context *dctx = engine->i915->kernel_context; int ret; ret = i915_cmd_parser_init_ring(engine); @@ -2273,7 +2273,7 @@ static u32 intel_lr_indirect_ctx_offset(struct intel_engine_cs *engine) } static int -populate_lr_context(struct intel_context *ctx, +populate_lr_context(struct i915_gem_context *ctx, struct drm_i915_gem_object *ctx_obj, struct intel_engine_cs *engine, struct intel_ringbuffer *ringbuf) @@ -2421,7 +2421,7 @@ populate_lr_context(struct intel_context *ctx, * takes care of the bits that are LRC related: the per-engine backing * objects and the logical ringbuffer. */ -void intel_lr_context_free(struct intel_context *ctx) +void intel_lr_context_free(struct i915_gem_context *ctx) { int i; @@ -2489,7 +2489,7 @@ uint32_t intel_lr_context_size(struct intel_engine_cs *engine) * * Return: non-zero on error. */ -static int execlists_context_deferred_alloc(struct intel_context *ctx, +static int execlists_context_deferred_alloc(struct i915_gem_context *ctx, struct intel_engine_cs *engine) { struct drm_i915_gem_object *ctx_obj; @@ -2539,7 +2539,7 @@ error_deref_obj: } void intel_lr_context_reset(struct drm_i915_private *dev_priv, - struct intel_context *ctx) + struct i915_gem_context *ctx) { struct intel_engine_cs *engine; diff --git a/drivers/gpu/drm/i915/intel_lrc.h b/drivers/gpu/drm/i915/intel_lrc.h index 1afba0331dc6..eb2e1d157fed 100644 --- a/drivers/gpu/drm/i915/intel_lrc.h +++ b/drivers/gpu/drm/i915/intel_lrc.h @@ -99,16 +99,18 @@ static inline void intel_logical_ring_emit_reg(struct intel_ringbuffer *ringbuf, #define LRC_PPHWSP_PN (LRC_GUCSHR_PN + 1) #define LRC_STATE_PN (LRC_PPHWSP_PN + 1) -void intel_lr_context_free(struct intel_context *ctx); +struct i915_gem_context; + +void intel_lr_context_free(struct i915_gem_context *ctx); uint32_t intel_lr_context_size(struct intel_engine_cs *engine); -void intel_lr_context_unpin(struct intel_context *ctx, +void intel_lr_context_unpin(struct i915_gem_context *ctx, struct intel_engine_cs *engine); struct drm_i915_private; void intel_lr_context_reset(struct drm_i915_private *dev_priv, - struct intel_context *ctx); -uint64_t intel_lr_context_descriptor(struct intel_context *ctx, + struct i915_gem_context *ctx); +uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx, struct intel_engine_cs *engine); /* Execlists */ diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 929e7b4af2a4..b33c876fed20 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h @@ -119,7 +119,7 @@ struct intel_ringbuffer { u32 last_retired_head; }; -struct intel_context; +struct i915_gem_context; struct drm_i915_reg_table; /* @@ -310,7 +310,7 @@ struct intel_engine_cs { wait_queue_head_t irq_queue; - struct intel_context *last_context; + struct i915_gem_context *last_context; struct intel_ring_hangcheck hangcheck;
Our goal is to rename the anonymous per-engine struct beneath the current intel_context. However, after a lively debate resolving around the confusion between intel_context_engine and intel_engine_context, the realisation is that the two structs target different users. The outer struct is API / user facing, and so carries the higher level GEM information. The inner struct is hw facing. Thus we want to name the inner struct intel_context and the outer one i915_gem_context. As the first step, we need to rename the current struct: s/struct intel_context/struct i915_gem_context/ which fits much better with its constructors already conveying the i915_gem_context prefix! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Dave Gordon <david.s.gordon@intel.com> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> --- drivers/gpu/drm/i915/i915_debugfs.c | 10 +++--- drivers/gpu/drm/i915/i915_drv.h | 22 ++++++------- drivers/gpu/drm/i915/i915_gem.c | 8 ++--- drivers/gpu/drm/i915/i915_gem_context.c | 52 +++++++++++++++--------------- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 10 +++--- drivers/gpu/drm/i915/i915_guc_submission.c | 12 +++---- drivers/gpu/drm/i915/i915_sysfs.c | 2 +- drivers/gpu/drm/i915/i915_trace.h | 12 +++---- drivers/gpu/drm/i915/intel_guc.h | 2 +- drivers/gpu/drm/i915/intel_lrc.c | 22 ++++++------- drivers/gpu/drm/i915/intel_lrc.h | 10 +++--- drivers/gpu/drm/i915/intel_ringbuffer.h | 4 +-- 12 files changed, 84 insertions(+), 82 deletions(-)