]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm/i915: s/i915_hw_context/intel_context
authorOscar Mateo <oscar.mateo@intel.com>
Thu, 22 May 2014 13:13:37 +0000 (14:13 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 22 May 2014 21:41:17 +0000 (23:41 +0200)
Up until now, contexts had one (and only one) backing object that was
used by the hardware to save/restore render ring contexts (via the
MI_SET_CONTEXT command). Other rings did not have or need this, so
our i915_hw_context struct had a 1:1 relationship with a a real HW
context.

With Logical Ring Contexts and Execlists, this is not possible anymore:
all rings need a backing object, and it cannot be reused. To prepare
for that, rename our contexts to the more generic term intel_context.

No functional changes.

Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_debugfs.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_context.c
drivers/gpu/drm/i915/i915_gem_execbuffer.c
drivers/gpu/drm/i915/i915_gem_gtt.h
drivers/gpu/drm/i915/i915_sysfs.c
drivers/gpu/drm/i915/intel_ringbuffer.h
drivers/gpu/drm/i915/intel_uncore.c

index 833fdd2d10711339f6eec27d76b4a4cc7819e61a..4f0f697363a29f12351d357ef5d8bff2e984885c 100644 (file)
@@ -172,7 +172,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
                seq_printf(m, " (%s)", obj->ring->name);
 }
 
-static void describe_ctx(struct seq_file *m, struct i915_hw_context *ctx)
+static void describe_ctx(struct seq_file *m, struct intel_context *ctx)
 {
        seq_putc(m, ctx->is_initialized ? 'I' : 'i');
        seq_putc(m, ctx->remap_slice ? 'R' : 'r');
@@ -1718,7 +1718,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 *ring;
-       struct i915_hw_context *ctx;
+       struct intel_context *ctx;
        int ret, i;
 
        ret = mutex_lock_interruptible(&dev->mode_config.mutex);
@@ -1854,7 +1854,7 @@ static int i915_swizzle_info(struct seq_file *m, void *data)
 
 static int per_file_ctx(int id, void *ptr, void *data)
 {
-       struct i915_hw_context *ctx = ptr;
+       struct intel_context *ctx = ptr;
        struct seq_file *m = data;
        struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(ctx);
 
index ca5bd572a34da5981a0c95ca7fcf339787d2e998..f422ed37c7fe322d01d93735ea8d86ac6d72379a 100644 (file)
@@ -599,7 +599,7 @@ struct i915_ctx_hang_stats {
 
 /* This must match up with the value previously used for execbuf2.rsvd1. */
 #define DEFAULT_CONTEXT_ID 0
-struct i915_hw_context {
+struct intel_context {
        struct kref ref;
        int id;
        bool is_initialized;
@@ -1753,7 +1753,7 @@ struct drm_i915_gem_request {
        u32 tail;
 
        /** Context related to this request */
-       struct i915_hw_context *ctx;
+       struct intel_context *ctx;
 
        /** Batch buffer related to this request if any */
        struct drm_i915_gem_object *batch_obj;
@@ -1780,7 +1780,7 @@ struct drm_i915_file_private {
        } mm;
        struct idr context_idr;
 
-       struct i915_hw_context *private_default_ctx;
+       struct intel_context *private_default_ctx;
        atomic_t rps_wait_boost;
        struct  intel_engine_cs *bsd_ring;
 };
@@ -2399,21 +2399,21 @@ int i915_gem_context_open(struct drm_device *dev, struct drm_file *file);
 int i915_gem_context_enable(struct drm_i915_private *dev_priv);
 void i915_gem_context_close(struct drm_device *dev, struct drm_file *file);
 int i915_switch_context(struct intel_engine_cs *ring,
-                       struct i915_hw_context *to);
-struct i915_hw_context *
+                       struct intel_context *to);
+struct intel_context *
 i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id);
 void i915_gem_context_free(struct kref *ctx_ref);
-static inline void i915_gem_context_reference(struct i915_hw_context *ctx)
+static inline void i915_gem_context_reference(struct intel_context *ctx)
 {
        kref_get(&ctx->ref);
 }
 
-static inline void i915_gem_context_unreference(struct i915_hw_context *ctx)
+static inline void i915_gem_context_unreference(struct intel_context *ctx)
 {
        kref_put(&ctx->ref, i915_gem_context_free);
 }
 
-static inline bool i915_gem_context_is_default(const struct i915_hw_context *c)
+static inline bool i915_gem_context_is_default(const struct intel_context *c)
 {
        return c->id == DEFAULT_CONTEXT_ID;
 }
index db7796beca5070394ad4e9c866d3e5c49ec6fd45..87e9b349ebef03a94df1ae2ef93f1359e8ebd393 100644 (file)
@@ -2304,7 +2304,7 @@ i915_gem_request_remove_from_client(struct drm_i915_gem_request *request)
 }
 
 static bool i915_context_is_banned(struct drm_i915_private *dev_priv,
-                                  const struct i915_hw_context *ctx)
+                                  const struct intel_context *ctx)
 {
        unsigned long elapsed;
 
@@ -2328,7 +2328,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 i915_hw_context *ctx,
+                                 struct intel_context *ctx,
                                  const bool guilty)
 {
        struct i915_ctx_hang_stats *hs;
index 8e57e1d63fb1dc139f686c7928c2cee7ba2ac5cc..2100f6e8a703cc620a3a7ecb4753e59ce79e8ec6 100644 (file)
@@ -178,7 +178,7 @@ static int get_context_size(struct drm_device *dev)
 
 void i915_gem_context_free(struct kref *ctx_ref)
 {
-       struct i915_hw_context *ctx = container_of(ctx_ref,
+       struct intel_context *ctx = container_of(ctx_ref,
                                                   typeof(*ctx), ref);
        struct i915_hw_ppgtt *ppgtt = NULL;
 
@@ -199,7 +199,7 @@ void i915_gem_context_free(struct kref *ctx_ref)
 }
 
 static struct i915_hw_ppgtt *
-create_vm_for_ctx(struct drm_device *dev, struct i915_hw_context *ctx)
+create_vm_for_ctx(struct drm_device *dev, struct intel_context *ctx)
 {
        struct i915_hw_ppgtt *ppgtt;
        int ret;
@@ -218,12 +218,12 @@ create_vm_for_ctx(struct drm_device *dev, struct i915_hw_context *ctx)
        return ppgtt;
 }
 
-static struct i915_hw_context *
+static struct intel_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 i915_hw_context *ctx;
+       struct intel_context *ctx;
        int ret;
 
        ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
@@ -285,14 +285,14 @@ err_out:
  * context state of the GPU for applications that don't utilize HW contexts, as
  * well as an idle case.
  */
-static struct i915_hw_context *
+static struct intel_context *
 i915_gem_create_context(struct drm_device *dev,
                        struct drm_i915_file_private *file_priv,
                        bool create_vm)
 {
        const bool is_global_default_ctx = file_priv == NULL;
        struct drm_i915_private *dev_priv = dev->dev_private;
-       struct i915_hw_context *ctx;
+       struct intel_context *ctx;
        int ret = 0;
 
        BUG_ON(!mutex_is_locked(&dev->struct_mutex));
@@ -365,7 +365,7 @@ void i915_gem_context_reset(struct drm_device *dev)
         * the next switch */
        for (i = 0; i < I915_NUM_RINGS; i++) {
                struct intel_engine_cs *ring = &dev_priv->ring[i];
-               struct i915_hw_context *dctx = ring->default_context;
+               struct intel_context *dctx = ring->default_context;
 
                /* Do a fake switch to the default context */
                if (ring->last_context == dctx)
@@ -391,7 +391,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 i915_hw_context *ctx;
+       struct intel_context *ctx;
        int i;
 
        /* Init should only be called once per module load. Eventually the
@@ -426,7 +426,7 @@ int i915_gem_context_init(struct drm_device *dev)
 void i915_gem_context_fini(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
-       struct i915_hw_context *dctx = dev_priv->ring[RCS].default_context;
+       struct intel_context *dctx = dev_priv->ring[RCS].default_context;
        int i;
 
        if (dctx->obj) {
@@ -495,7 +495,7 @@ int i915_gem_context_enable(struct drm_i915_private *dev_priv)
 
 static int context_idr_cleanup(int id, void *p, void *data)
 {
-       struct i915_hw_context *ctx = p;
+       struct intel_context *ctx = p;
 
        /* Ignore the default context because close will handle it */
        if (i915_gem_context_is_default(ctx))
@@ -534,12 +534,12 @@ void i915_gem_context_close(struct drm_device *dev, struct drm_file *file)
        i915_gem_context_unreference(file_priv->private_default_ctx);
 }
 
-struct i915_hw_context *
+struct intel_context *
 i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id)
 {
-       struct i915_hw_context *ctx;
+       struct intel_context *ctx;
 
-       ctx = (struct i915_hw_context *)idr_find(&file_priv->context_idr, id);
+       ctx = (struct intel_context *)idr_find(&file_priv->context_idr, id);
        if (!ctx)
                return ERR_PTR(-ENOENT);
 
@@ -548,7 +548,7 @@ i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id)
 
 static inline int
 mi_set_context(struct intel_engine_cs *ring,
-              struct i915_hw_context *new_context,
+              struct intel_context *new_context,
               u32 hw_flags)
 {
        int ret;
@@ -598,10 +598,10 @@ mi_set_context(struct intel_engine_cs *ring,
 }
 
 static int do_switch(struct intel_engine_cs *ring,
-                    struct i915_hw_context *to)
+                    struct intel_context *to)
 {
        struct drm_i915_private *dev_priv = ring->dev->dev_private;
-       struct i915_hw_context *from = ring->last_context;
+       struct intel_context *from = ring->last_context;
        struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(to);
        u32 hw_flags = 0;
        int ret, i;
@@ -734,7 +734,7 @@ unpin_out:
  * object while letting the normal object tracking destroy the backing BO.
  */
 int i915_switch_context(struct intel_engine_cs *ring,
-                       struct i915_hw_context *to)
+                       struct intel_context *to)
 {
        struct drm_i915_private *dev_priv = ring->dev->dev_private;
 
@@ -763,7 +763,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 i915_hw_context *ctx;
+       struct intel_context *ctx;
        int ret;
 
        if (!hw_context_enabled(dev))
@@ -789,7 +789,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 i915_hw_context *ctx;
+       struct intel_context *ctx;
        int ret;
 
        if (args->ctx_id == DEFAULT_CONTEXT_ID)
index 7829b9074ee4912a09789dd19dde28f0338cadd3..008e208e9a3a0739d1dbf3b631ddcd38028ca0bc 100644 (file)
@@ -912,11 +912,11 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec,
        return 0;
 }
 
-static struct i915_hw_context *
+static struct intel_context *
 i915_gem_validate_context(struct drm_device *dev, struct drm_file *file,
                          struct intel_engine_cs *ring, const u32 ctx_id)
 {
-       struct i915_hw_context *ctx = NULL;
+       struct intel_context *ctx = NULL;
        struct i915_ctx_hang_stats *hs;
 
        if (ring->id != RCS && ctx_id != DEFAULT_CONTEXT_ID)
@@ -1051,7 +1051,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
        struct drm_i915_gem_object *batch_obj;
        struct drm_clip_rect *cliprects = NULL;
        struct intel_engine_cs *ring;
-       struct i915_hw_context *ctx;
+       struct intel_context *ctx;
        struct i915_address_space *vm;
        const u32 ctx_id = i915_execbuffer2_get_context_id(*args);
        u64 exec_start = args->batch_start_offset, exec_len;
index d187c0282860df0c2bc3514abf79e3913e4b7af9..1b96a06be3cb4f4872103c04d437e966c7b10f4f 100644 (file)
@@ -257,7 +257,7 @@ struct i915_hw_ppgtt {
                dma_addr_t *gen8_pt_dma_addr[4];
        };
 
-       struct i915_hw_context *ctx;
+       struct intel_context *ctx;
 
        int (*enable)(struct i915_hw_ppgtt *ppgtt);
        int (*switch_mm)(struct i915_hw_ppgtt *ppgtt,
index 3620997e43f50bd3089f760cc2a50e374a6fd502..86ce39aad0ffd25e5502bf616f1349b387922f3e 100644 (file)
@@ -186,7 +186,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 i915_hw_context *ctx;
+       struct intel_context *ctx;
        u32 *temp = NULL; /* Just here to make handling failures easy */
        int slice = (int)(uintptr_t)attr->private;
        int ret;
index 5c509e74c722c4efc8ed8122357cef97009e0347..910c83cf7d441e26d226e4c975ad712949d32f0a 100644 (file)
@@ -174,8 +174,8 @@ struct  intel_engine_cs {
 
        wait_queue_head_t irq_queue;
 
-       struct i915_hw_context *default_context;
-       struct i915_hw_context *last_context;
+       struct intel_context *default_context;
+       struct intel_context *last_context;
 
        struct intel_ring_hangcheck hangcheck;
 
index e7aa42d10f6ca3632b7eeec9791aaa6ed185ca73..9cd99d9676fdeb8ab84595d1912e82f859b33b12 100644 (file)
@@ -921,7 +921,7 @@ int i915_get_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 i915_hw_context *ctx;
+       struct intel_context *ctx;
        int ret;
 
        if (args->flags || args->pad)