]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm/i915: intel_ring.engine is unused
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 3 Apr 2017 11:34:25 +0000 (12:34 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 3 Apr 2017 12:52:58 +0000 (13:52 +0100)
Or rather it is used only by intel_ring_pin() to extract the
drm_i915_private which we can easily pass in. As this is a relatively
rare operation, save the space in the struct, and as such it is even
break even in the extra code for passing around the parameter:

add/remove: 0/0 grow/shrink: 2/3 up/down: 15/-15 (0)
function                                     old     new   delta
intel_init_ring_buffer                       906     918     +12
execlists_context_pin                       1308    1311      +3
mock_engine                                  407     403      -4
intel_engine_create_ring                     367     363      -4
intel_ring_pin                               326     319      -7
Total: Before=1261794, After=1261794, chg +0.00%

v2: Reorder intel_init_ring_buffer to keep the ring setup together:

add/remove: 0/0 grow/shrink: 2/3 up/down: 9/-15 (-6)
function                                     old     new   delta
intel_init_ring_buffer                       906     912      +6
execlists_context_pin                       1308    1311      +3
mock_engine                                  407     403      -4
intel_engine_create_ring                     367     363      -4
intel_ring_pin                               326     319      -7
Total: Before=1261794, After=1261788, chg -0.00%

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170403113426.25707-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/intel_lrc.c
drivers/gpu/drm/i915/intel_ringbuffer.c
drivers/gpu/drm/i915/intel_ringbuffer.h
drivers/gpu/drm/i915/selftests/mock_engine.c

index c8f7c631fc1f8e354cac0038c80aa35d0a1dd0d2..0dc1cc4ad6e7aa52f2f3300f7d141ea773c71785 100644 (file)
@@ -771,7 +771,7 @@ static int execlists_context_pin(struct intel_engine_cs *engine,
                goto unpin_vma;
        }
 
-       ret = intel_ring_pin(ce->ring, ctx->ggtt_offset_bias);
+       ret = intel_ring_pin(ce->ring, ctx->i915, ctx->ggtt_offset_bias);
        if (ret)
                goto unpin_map;
 
index 66a2b8b83972691d04f2737337e7ea6cf6a72851..5e7634c00cbdde33d497b0cb78e932cd226ee6ef 100644 (file)
@@ -1270,17 +1270,18 @@ static int init_phys_status_page(struct intel_engine_cs *engine)
        return 0;
 }
 
-int intel_ring_pin(struct intel_ring *ring, unsigned int offset_bias)
+int intel_ring_pin(struct intel_ring *ring,
+                  struct drm_i915_private *i915,
+                  unsigned int offset_bias)
 {
-       unsigned int flags;
-       enum i915_map_type map;
+       enum i915_map_type map = HAS_LLC(i915) ? I915_MAP_WB : I915_MAP_WC;
        struct i915_vma *vma = ring->vma;
+       unsigned int flags;
        void *addr;
        int ret;
 
        GEM_BUG_ON(ring->vaddr);
 
-       map = HAS_LLC(ring->engine->i915) ? I915_MAP_WB : I915_MAP_WC;
 
        flags = PIN_GLOBAL;
        if (offset_bias)
@@ -1369,8 +1370,6 @@ intel_engine_create_ring(struct intel_engine_cs *engine, int size)
        if (!ring)
                return ERR_PTR(-ENOMEM);
 
-       ring->engine = engine;
-
        INIT_LIST_HEAD(&ring->request_list);
 
        ring->size = size;
@@ -1481,7 +1480,6 @@ static void intel_ring_context_unpin(struct intel_engine_cs *engine,
 
 static int intel_init_ring_buffer(struct intel_engine_cs *engine)
 {
-       struct drm_i915_private *dev_priv = engine->i915;
        struct intel_ring *ring;
        int ret;
 
@@ -1493,13 +1491,7 @@ static int intel_init_ring_buffer(struct intel_engine_cs *engine)
        if (ret)
                goto error;
 
-       ring = intel_engine_create_ring(engine, 32 * PAGE_SIZE);
-       if (IS_ERR(ring)) {
-               ret = PTR_ERR(ring);
-               goto error;
-       }
-
-       if (HWS_NEEDS_PHYSICAL(dev_priv)) {
+       if (HWS_NEEDS_PHYSICAL(engine->i915)) {
                WARN_ON(engine->id != RCS);
                ret = init_phys_status_page(engine);
                if (ret)
@@ -1510,8 +1502,14 @@ static int intel_init_ring_buffer(struct intel_engine_cs *engine)
                        goto error;
        }
 
+       ring = intel_engine_create_ring(engine, 32 * PAGE_SIZE);
+       if (IS_ERR(ring)) {
+               ret = PTR_ERR(ring);
+               goto error;
+       }
+
        /* Ring wraparound at offset 0 sometimes hangs. No idea why. */
-       ret = intel_ring_pin(ring, I915_GTT_PAGE_SIZE);
+       ret = intel_ring_pin(ring, engine->i915, I915_GTT_PAGE_SIZE);
        if (ret) {
                intel_ring_free(ring);
                goto error;
index a82a0807f64dbd0624728fe3c65215abe3647565..cbe61d3f31da9cc0a5bbf10b8350df2d3b112d2e 100644 (file)
@@ -139,8 +139,6 @@ struct intel_ring {
        struct i915_vma *vma;
        void *vaddr;
 
-       struct intel_engine_cs *engine;
-
        struct list_head request_list;
 
        u32 head;
@@ -487,7 +485,9 @@ intel_write_status_page(struct intel_engine_cs *engine, int reg, u32 value)
 
 struct intel_ring *
 intel_engine_create_ring(struct intel_engine_cs *engine, int size);
-int intel_ring_pin(struct intel_ring *ring, unsigned int offset_bias);
+int intel_ring_pin(struct intel_ring *ring,
+                  struct drm_i915_private *i915,
+                  unsigned int offset_bias);
 void intel_ring_unpin(struct intel_ring *ring);
 void intel_ring_free(struct intel_ring *ring);
 
index 0ad624a1db90a0315a19fc1a973d49f7ccfe68b9..b89050e0de480bf7c20823c260209d6c0f9fdaee 100644 (file)
@@ -112,7 +112,6 @@ static struct intel_ring *mock_ring(struct intel_engine_cs *engine)
        if (!ring)
                return NULL;
 
-       ring->engine = engine;
        ring->size = sz;
        ring->effective_size = sz;
        ring->vaddr = (void *)(ring + 1);