drm/radeon: Move more code out of line
authorAndi Kleen <ak@linux.intel.com>
Thu, 13 Oct 2011 23:08:47 +0000 (16:08 -0700)
committerDave Airlie <airlied@redhat.com>
Tue, 18 Oct 2011 08:53:05 +0000 (09:53 +0100)
With this patch I'm only about 50k larger with DRM debugging
enables (why is that enabled by default?!?), and slightly
smaller without.

[airlied: moved r100.c additions to radeon_ring.c]

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/r300_cmdbuf.c
drivers/gpu/drm/radeon/r600.c
drivers/gpu/drm/radeon/r600_blit_kms.c
drivers/gpu/drm/radeon/radeon.h
drivers/gpu/drm/radeon/radeon_atombios.c
drivers/gpu/drm/radeon/radeon_irq.c
drivers/gpu/drm/radeon/radeon_legacy_tv.c
drivers/gpu/drm/radeon/radeon_object.c
drivers/gpu/drm/radeon/radeon_object.h
drivers/gpu/drm/radeon/radeon_ring.c
drivers/gpu/drm/radeon/radeon_state.c

index c5c2742e41405514364b34bfdbc39c725bc195b7..1fe98b421c9b6f2cb524b258bd31270f9024f082 100644 (file)
@@ -791,7 +791,7 @@ static __inline__ int r300_emit_packet3(drm_radeon_private_t *dev_priv,
 /**
  * Emit the sequence to pacify R300.
  */
-static __inline__ void r300_pacify(drm_radeon_private_t *dev_priv)
+static void r300_pacify(drm_radeon_private_t *dev_priv)
 {
        uint32_t cache_z, cache_3d, cache_2d;
        RING_LOCALS;
index 334aee6eab7ce03b4ed7cf9e151f4977755dce28..c4de1610088c03999c953e599a49d854339e7ce5 100644 (file)
@@ -3138,7 +3138,7 @@ int r600_irq_set(struct radeon_device *rdev)
        return 0;
 }
 
-static inline void r600_irq_ack(struct radeon_device *rdev)
+static void r600_irq_ack(struct radeon_device *rdev)
 {
        u32 tmp;
 
@@ -3239,7 +3239,7 @@ void r600_irq_disable(struct radeon_device *rdev)
        r600_disable_interrupt_state(rdev);
 }
 
-static inline u32 r600_get_ih_wptr(struct radeon_device *rdev)
+static u32 r600_get_ih_wptr(struct radeon_device *rdev)
 {
        u32 wptr, tmp;
 
index 9aa74c3f8cb641f79b262a62db58a162f39fc357..bbbafe685543ffdfed3036f6bfc353101cf39f0e 100644 (file)
@@ -450,7 +450,7 @@ set_default_state(struct radeon_device *rdev)
        radeon_ring_write(rdev, sq_stack_resource_mgmt_2);
 }
 
-static inline uint32_t i2f(uint32_t input)
+static uint32_t i2f(uint32_t input)
 {
        u32 result, i, exponent, fraction;
 
index ff5424e43d1b8180bff1486dbfb3b799511eff7b..f3260f7136a9c2b36d82811f475e6cf220f566b2 100644 (file)
@@ -600,32 +600,7 @@ struct radeon_cs_parser {
 
 extern int radeon_cs_update_pages(struct radeon_cs_parser *p, int pg_idx);
 extern int radeon_cs_finish_pages(struct radeon_cs_parser *p);
-
-
-static inline u32 radeon_get_ib_value(struct radeon_cs_parser *p, int idx)
-{
-       struct radeon_cs_chunk *ibc = &p->chunks[p->chunk_ib_idx];
-       u32 pg_idx, pg_offset;
-       u32 idx_value = 0;
-       int new_page;
-
-       pg_idx = (idx * 4) / PAGE_SIZE;
-       pg_offset = (idx * 4) % PAGE_SIZE;
-
-       if (ibc->kpage_idx[0] == pg_idx)
-               return ibc->kpage[0][pg_offset/4];
-       if (ibc->kpage_idx[1] == pg_idx)
-               return ibc->kpage[1][pg_offset/4];
-
-       new_page = radeon_cs_update_pages(p, pg_idx);
-       if (new_page < 0) {
-               p->parser_error = new_page;
-               return 0;
-       }
-
-       idx_value = ibc->kpage[new_page][pg_offset/4];
-       return idx_value;
-}
+extern u32 radeon_get_ib_value(struct radeon_cs_parser *p, int idx);
 
 struct radeon_cs_packet {
        unsigned        idx;
@@ -1414,19 +1389,19 @@ void radeon_atombios_fini(struct radeon_device *rdev);
 /*
  * RING helpers.
  */
+
+#if DRM_DEBUG_CODE == 0
 static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v)
 {
-#if DRM_DEBUG_CODE
-       if (rdev->cp.count_dw <= 0) {
-               DRM_ERROR("radeon: writting more dword to ring than expected !\n");
-       }
-#endif
        rdev->cp.ring[rdev->cp.wptr++] = v;
        rdev->cp.wptr &= rdev->cp.ptr_mask;
        rdev->cp.count_dw--;
        rdev->cp.ring_free_dw--;
 }
-
+#else
+/* With debugging this is just too big to inline */
+void radeon_ring_write(struct radeon_device *rdev, uint32_t v);
+#endif
 
 /*
  * ASICs macro.
index bf2b61584cdb5a70fc06fbc41dd2ca51733532fc..08d0b94332e6f19c72babaedd8828e69444b4ea1 100644 (file)
@@ -62,7 +62,7 @@ union atom_supported_devices {
        struct _ATOM_SUPPORTED_DEVICES_INFO_2d1 info_2d1;
 };
 
-static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_device *rdev,
+static struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_device *rdev,
                                                               uint8_t id)
 {
        struct atom_context *ctx = rdev->mode_info.atom_context;
@@ -228,7 +228,7 @@ void radeon_atombios_i2c_init(struct radeon_device *rdev)
        }
 }
 
-static inline struct radeon_gpio_rec radeon_lookup_gpio(struct radeon_device *rdev,
+static struct radeon_gpio_rec radeon_lookup_gpio(struct radeon_device *rdev,
                                                        u8 id)
 {
        struct atom_context *ctx = rdev->mode_info.atom_context;
index 465746bd51b76e4b88cbb1812f7729be430a6da7..00da38424dfcf0756d5c802fe46ab9700823f6cd 100644 (file)
@@ -129,7 +129,7 @@ void radeon_disable_vblank(struct drm_device *dev, int crtc)
        }
 }
 
-static inline u32 radeon_acknowledge_irqs(drm_radeon_private_t *dev_priv, u32 *r500_disp_int)
+static u32 radeon_acknowledge_irqs(drm_radeon_private_t *dev_priv, u32 *r500_disp_int)
 {
        u32 irqs = RADEON_READ(RADEON_GEN_INT_STATUS);
        u32 irq_mask = RADEON_SW_INT_TEST;
index c7b6cb428d096de2f0efdba0082357c9bae569f6..b37ec0f1413a954417c89bba13f49ef05d975bf8 100644 (file)
@@ -864,7 +864,7 @@ void radeon_legacy_tv_adjust_crtc_reg(struct drm_encoder *encoder,
        *v_sync_strt_wid = tmp;
 }
 
-static inline int get_post_div(int value)
+static int get_post_div(int value)
 {
        int post_div;
        switch (value) {
index 976c3b1b1b6e5aacd053bc1307a8a1313be64a45..138839312e8b6b2f0dcbfbcfe35e1a963b8e2c5b 100644 (file)
@@ -515,3 +515,45 @@ int radeon_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
        }
        return 0;
 }
+
+int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type, bool no_wait,
+                  enum ttm_buffer_usage usage)
+{
+       int r;
+
+       r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0);
+       if (unlikely(r != 0))
+               return r;
+       spin_lock(&bo->tbo.bdev->fence_lock);
+       if (mem_type)
+               *mem_type = bo->tbo.mem.mem_type;
+       if (bo->tbo.sync_obj)
+               r = ttm_bo_wait(&bo->tbo, true, true, no_wait, usage);
+       spin_unlock(&bo->tbo.bdev->fence_lock);
+       ttm_bo_unreserve(&bo->tbo);
+       return r;
+}
+
+
+/**
+ * radeon_bo_reserve - reserve bo
+ * @bo:                bo structure
+ * @no_wait:           don't sleep while trying to reserve (return -EBUSY)
+ *
+ * Returns:
+ * -EBUSY: buffer is busy and @no_wait is true
+ * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by
+ * a signal. Release all buffer reservations and return to user-space.
+ */
+int radeon_bo_reserve(struct radeon_bo *bo, bool no_wait)
+{
+       int r;
+
+       r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0);
+       if (unlikely(r != 0)) {
+               if (r != -ERESTARTSYS)
+                       dev_err(bo->rdev->dev, "%p reserve failed\n", bo);
+               return r;
+       }
+       return 0;
+}
index a057a8e5a6e685d6666f9df6108832c2cf24e89b..c6c8e43e6d9aa68bfd70ca2ea4f720f5ec8a3fa0 100644 (file)
@@ -52,28 +52,7 @@ static inline unsigned radeon_mem_type_to_domain(u32 mem_type)
        return 0;
 }
 
-/**
- * radeon_bo_reserve - reserve bo
- * @bo:                bo structure
- * @no_wait:           don't sleep while trying to reserve (return -EBUSY)
- *
- * Returns:
- * -EBUSY: buffer is busy and @no_wait is true
- * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by
- * a signal. Release all buffer reservations and return to user-space.
- */
-static inline int radeon_bo_reserve(struct radeon_bo *bo, bool no_wait)
-{
-       int r;
-
-       r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0);
-       if (unlikely(r != 0)) {
-               if (r != -ERESTARTSYS)
-                       dev_err(bo->rdev->dev, "%p reserve failed\n", bo);
-               return r;
-       }
-       return 0;
-}
+int radeon_bo_reserve(struct radeon_bo *bo, bool no_wait);
 
 static inline void radeon_bo_unreserve(struct radeon_bo *bo)
 {
@@ -118,23 +97,8 @@ static inline u64 radeon_bo_mmap_offset(struct radeon_bo *bo)
        return bo->tbo.addr_space_offset;
 }
 
-static inline int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type,
-                                bool no_wait, enum ttm_buffer_usage usage)
-{
-       int r;
-
-       r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0);
-       if (unlikely(r != 0))
-               return r;
-       spin_lock(&bo->tbo.bdev->fence_lock);
-       if (mem_type)
-               *mem_type = bo->tbo.mem.mem_type;
-       if (bo->tbo.sync_obj)
-               r = ttm_bo_wait(&bo->tbo, true, true, no_wait, usage);
-       spin_unlock(&bo->tbo.bdev->fence_lock);
-       ttm_bo_unreserve(&bo->tbo);
-       return r;
-}
+extern int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type,
+                         bool no_wait, enum ttm_buffer_usage usage);
 
 extern int radeon_bo_create(struct radeon_device *rdev,
                                unsigned long size, int byte_align,
index 08c0233db1b8d24a38c9b8d90e5c9ccde74bc993..49d58202202c8dc4cf3808e7b48c4c13ac620e6b 100644 (file)
 
 int radeon_debugfs_ib_init(struct radeon_device *rdev);
 
+u32 radeon_get_ib_value(struct radeon_cs_parser *p, int idx)
+{
+       struct radeon_cs_chunk *ibc = &p->chunks[p->chunk_ib_idx];
+       u32 pg_idx, pg_offset;
+       u32 idx_value = 0;
+       int new_page;
+
+       pg_idx = (idx * 4) / PAGE_SIZE;
+       pg_offset = (idx * 4) % PAGE_SIZE;
+
+       if (ibc->kpage_idx[0] == pg_idx)
+               return ibc->kpage[0][pg_offset/4];
+       if (ibc->kpage_idx[1] == pg_idx)
+               return ibc->kpage[1][pg_offset/4];
+
+       new_page = radeon_cs_update_pages(p, pg_idx);
+       if (new_page < 0) {
+               p->parser_error = new_page;
+               return 0;
+       }
+
+       idx_value = ibc->kpage[new_page][pg_offset/4];
+       return idx_value;
+}
+
+void radeon_ring_write(struct radeon_device *rdev, uint32_t v)
+{
+#if DRM_DEBUG_CODE
+       if (rdev->cp.count_dw <= 0) {
+               DRM_ERROR("radeon: writting more dword to ring than expected !\n");
+       }
+#endif
+       rdev->cp.ring[rdev->cp.wptr++] = v;
+       rdev->cp.wptr &= rdev->cp.ptr_mask;
+       rdev->cp.count_dw--;
+       rdev->cp.ring_free_dw--;
+}
+
 void radeon_ib_bogus_cleanup(struct radeon_device *rdev)
 {
        struct radeon_ib *ib, *n;
index 92e7ea73b7c5eae76536f5bbab183e513f1426b8..e8422ae7fe746de2e7f4121a45827d70bbdd4275 100644 (file)
@@ -272,12 +272,12 @@ static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t *
        return 0;
 }
 
-static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t *
-                                                    dev_priv,
-                                                    struct drm_file *file_priv,
-                                                    drm_radeon_kcmd_buffer_t *
-                                                    cmdbuf,
-                                                    unsigned int *cmdsz)
+static int radeon_check_and_fixup_packet3(drm_radeon_private_t *
+                                         dev_priv,
+                                         struct drm_file *file_priv,
+                                         drm_radeon_kcmd_buffer_t *
+                                         cmdbuf,
+                                         unsigned int *cmdsz)
 {
        u32 *cmd = drm_buffer_pointer_to_dword(cmdbuf->buffer, 0);
        u32 offset, narrays;
@@ -446,8 +446,8 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t *
  * CP hardware state programming functions
  */
 
-static __inline__ void radeon_emit_clip_rect(drm_radeon_private_t * dev_priv,
-                                            struct drm_clip_rect * box)
+static void radeon_emit_clip_rect(drm_radeon_private_t * dev_priv,
+                                 struct drm_clip_rect * box)
 {
        RING_LOCALS;