drm/i915: add relative ring register macros
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 2 Aug 2010 14:24:01 +0000 (16:24 +0200)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 21 Sep 2010 10:20:01 +0000 (11:20 +0100)
Documentation explicitly mentions that the ring registers are
designed to have the same offsets relative to a base registers.

Use this to fight the code beaurocratic in intel_ringbuffer.c.

No code changes in this patch, just the new definitions.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/i915/intel_ringbuffer.c
drivers/gpu/drm/i915/intel_ringbuffer.h

index 8b8ac60cc839c70e326336bcb4e3a9050fbd246a..77c9191f3fd61989e1bdcb73575872fecfac1256 100644 (file)
 #define PRB0_HEAD      0x02034
 #define PRB0_START     0x02038
 #define PRB0_CTL       0x0203c
+#define RENDER_RING_BASE       0x02000
+#define BSD_RING_BASE          0x04000
+#define GEN6_BSD_RING_BASE     0x12000
+#define RING_TAIL(base)                (base)+0x30
+#define RING_HEAD(base)                (base)+0x34
+#define RING_START(base)       (base)+0x38
+#define RING_CTL(base)         (base)+0x3c
+#define RING_HWS_PGA(base)     (base)+0x80
 #define   TAIL_ADDR            0x001FFFF8
 #define   HEAD_WRAP_COUNT      0xFFE00000
 #define   HEAD_WRAP_ONE                0x00200000
index f0b44d3ba9580b028e684763b7512a842dd3d7ee..c1517b2d2f08e03e6223c0f6464ab71710d67638 100644 (file)
@@ -801,6 +801,7 @@ static const struct intel_ring_buffer render_ring = {
                .tail = PRB0_TAIL,
                .start = PRB0_START
        },
+       .mmio_base              = RENDER_RING_BASE,
        .size                   = 32 * PAGE_SIZE,
        .alignment              = PAGE_SIZE,
        .virtual_start          = NULL,
@@ -839,6 +840,7 @@ static const struct intel_ring_buffer bsd_ring = {
                .tail = BSD_RING_TAIL,
                .start = BSD_RING_START
        },
+       .mmio_base              = BSD_RING_BASE,
        .size                   = 32 * PAGE_SIZE,
        .alignment              = PAGE_SIZE,
        .virtual_start          = NULL,
@@ -957,6 +959,7 @@ static const struct intel_ring_buffer gen6_bsd_ring = {
                .tail   = GEN6_BSD_RING_TAIL,
                .start  = GEN6_BSD_RING_START
        },
+       .mmio_base              = GEN6_BSD_RING_BASE,
        .size                   = 32 * PAGE_SIZE,
        .alignment              = PAGE_SIZE,
        .virtual_start          = NULL,
index be1fd9b370880c3491339013ae21cdc3c5220feb..3917d8b1c1a9bf9acded5c5c6bf3576f04676968 100644 (file)
@@ -20,6 +20,7 @@ struct  intel_ring_buffer {
                        u32 tail;
                        u32 start;
        } regs;
+       u32             mmio_base;
        unsigned long   size;
        unsigned int    alignment;
        void            *virtual_start;