diff options
author | Xiang, Haihao <haihao.xiang@intel.com> | 2010-09-15 22:43:12 -0400 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-09-21 06:19:56 -0400 |
commit | d46eefa29724b1be0e8e90a3a51a190b912ebfab (patch) | |
tree | 9a26e7b09969f0b992596e3af486d4a02ee70999 /drivers | |
parent | 5c1143bbecf50184ff7cad6287b4e0993bacbd9f (diff) |
drm/i915: add set_tail hook in struct intel_ring_buffer
This is prepared for video codec ring buffer on Sandybridge. It is
needed to read/write more than one register to move the tail pointer of
the video codec ring on Sandybridge.
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.c | 22 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.h | 2 |
2 files changed, 19 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 178e2cea9835..7debb1972eb2 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -132,6 +132,12 @@ static unsigned int render_ring_get_tail(struct drm_device *dev, | |||
132 | return I915_READ(PRB0_TAIL) & TAIL_ADDR; | 132 | return I915_READ(PRB0_TAIL) & TAIL_ADDR; |
133 | } | 133 | } |
134 | 134 | ||
135 | static inline void render_ring_set_tail(struct drm_device *dev, u32 value) | ||
136 | { | ||
137 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
138 | I915_WRITE(PRB0_TAIL, value); | ||
139 | } | ||
140 | |||
135 | static unsigned int render_ring_get_active_head(struct drm_device *dev, | 141 | static unsigned int render_ring_get_active_head(struct drm_device *dev, |
136 | struct intel_ring_buffer *ring) | 142 | struct intel_ring_buffer *ring) |
137 | { | 143 | { |
@@ -144,8 +150,7 @@ static unsigned int render_ring_get_active_head(struct drm_device *dev, | |||
144 | static void render_ring_advance_ring(struct drm_device *dev, | 150 | static void render_ring_advance_ring(struct drm_device *dev, |
145 | struct intel_ring_buffer *ring) | 151 | struct intel_ring_buffer *ring) |
146 | { | 152 | { |
147 | drm_i915_private_t *dev_priv = dev->dev_private; | 153 | render_ring_set_tail(dev, ring->tail); |
148 | I915_WRITE(PRB0_TAIL, ring->tail); | ||
149 | } | 154 | } |
150 | 155 | ||
151 | static int init_ring_common(struct drm_device *dev, | 156 | static int init_ring_common(struct drm_device *dev, |
@@ -159,7 +164,7 @@ static int init_ring_common(struct drm_device *dev, | |||
159 | /* Stop the ring if it's running. */ | 164 | /* Stop the ring if it's running. */ |
160 | I915_WRITE(ring->regs.ctl, 0); | 165 | I915_WRITE(ring->regs.ctl, 0); |
161 | I915_WRITE(ring->regs.head, 0); | 166 | I915_WRITE(ring->regs.head, 0); |
162 | I915_WRITE(ring->regs.tail, 0); | 167 | ring->set_tail(dev, 0); |
163 | 168 | ||
164 | /* Initialize the ring. */ | 169 | /* Initialize the ring. */ |
165 | I915_WRITE(ring->regs.start, obj_priv->gtt_offset); | 170 | I915_WRITE(ring->regs.start, obj_priv->gtt_offset); |
@@ -400,6 +405,12 @@ static inline unsigned int bsd_ring_get_tail(struct drm_device *dev, | |||
400 | return I915_READ(BSD_RING_TAIL) & TAIL_ADDR; | 405 | return I915_READ(BSD_RING_TAIL) & TAIL_ADDR; |
401 | } | 406 | } |
402 | 407 | ||
408 | static inline void bsd_ring_set_tail(struct drm_device *dev, u32 value) | ||
409 | { | ||
410 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
411 | I915_WRITE(BSD_RING_TAIL, value); | ||
412 | } | ||
413 | |||
403 | static inline unsigned int bsd_ring_get_active_head(struct drm_device *dev, | 414 | static inline unsigned int bsd_ring_get_active_head(struct drm_device *dev, |
404 | struct intel_ring_buffer *ring) | 415 | struct intel_ring_buffer *ring) |
405 | { | 416 | { |
@@ -410,8 +421,7 @@ static inline unsigned int bsd_ring_get_active_head(struct drm_device *dev, | |||
410 | static inline void bsd_ring_advance_ring(struct drm_device *dev, | 421 | static inline void bsd_ring_advance_ring(struct drm_device *dev, |
411 | struct intel_ring_buffer *ring) | 422 | struct intel_ring_buffer *ring) |
412 | { | 423 | { |
413 | drm_i915_private_t *dev_priv = dev->dev_private; | 424 | bsd_ring_set_tail(dev, ring->tail); |
414 | I915_WRITE(BSD_RING_TAIL, ring->tail); | ||
415 | } | 425 | } |
416 | 426 | ||
417 | static int init_bsd_ring(struct drm_device *dev, | 427 | static int init_bsd_ring(struct drm_device *dev, |
@@ -817,6 +827,7 @@ static struct intel_ring_buffer render_ring = { | |||
817 | .init = init_render_ring, | 827 | .init = init_render_ring, |
818 | .get_head = render_ring_get_head, | 828 | .get_head = render_ring_get_head, |
819 | .get_tail = render_ring_get_tail, | 829 | .get_tail = render_ring_get_tail, |
830 | .set_tail = render_ring_set_tail, | ||
820 | .get_active_head = render_ring_get_active_head, | 831 | .get_active_head = render_ring_get_active_head, |
821 | .advance_ring = render_ring_advance_ring, | 832 | .advance_ring = render_ring_advance_ring, |
822 | .flush = render_ring_flush, | 833 | .flush = render_ring_flush, |
@@ -855,6 +866,7 @@ static struct intel_ring_buffer bsd_ring = { | |||
855 | .init = init_bsd_ring, | 866 | .init = init_bsd_ring, |
856 | .get_head = bsd_ring_get_head, | 867 | .get_head = bsd_ring_get_head, |
857 | .get_tail = bsd_ring_get_tail, | 868 | .get_tail = bsd_ring_get_tail, |
869 | .set_tail = bsd_ring_set_tail, | ||
858 | .get_active_head = bsd_ring_get_active_head, | 870 | .get_active_head = bsd_ring_get_active_head, |
859 | .advance_ring = bsd_ring_advance_ring, | 871 | .advance_ring = bsd_ring_advance_ring, |
860 | .flush = bsd_ring_flush, | 872 | .flush = bsd_ring_flush, |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 5603d6e945e9..7bd571c796ae 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h | |||
@@ -48,6 +48,8 @@ struct intel_ring_buffer { | |||
48 | struct intel_ring_buffer *ring); | 48 | struct intel_ring_buffer *ring); |
49 | unsigned int (*get_tail)(struct drm_device *dev, | 49 | unsigned int (*get_tail)(struct drm_device *dev, |
50 | struct intel_ring_buffer *ring); | 50 | struct intel_ring_buffer *ring); |
51 | void (*set_tail)(struct drm_device *dev, | ||
52 | u32 value); | ||
51 | unsigned int (*get_active_head)(struct drm_device *dev, | 53 | unsigned int (*get_active_head)(struct drm_device *dev, |
52 | struct intel_ring_buffer *ring); | 54 | struct intel_ring_buffer *ring); |
53 | void (*advance_ring)(struct drm_device *dev, | 55 | void (*advance_ring)(struct drm_device *dev, |