Commit 0a5c1e61 authored by Robert Noland's avatar Robert Noland Committed by Dave Airlie

drm/radeon: A bit of cleanup work on radeon_freelist_get()

Fix the main loop to search all buffers before sleeping.
Remove dead code
Signed-off-by: default avatarRobert Noland <rnoland@2hip.net>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 3e5cb98d
...@@ -1941,8 +1941,8 @@ struct drm_buf *radeon_freelist_get(struct drm_device * dev) ...@@ -1941,8 +1941,8 @@ struct drm_buf *radeon_freelist_get(struct drm_device * dev)
for (t = 0; t < dev_priv->usec_timeout; t++) { for (t = 0; t < dev_priv->usec_timeout; t++) {
u32 done_age = GET_SCRATCH(dev_priv, 1); u32 done_age = GET_SCRATCH(dev_priv, 1);
DRM_DEBUG("done_age = %d\n", done_age); DRM_DEBUG("done_age = %d\n", done_age);
for (i = start; i < dma->buf_count; i++) { for (i = 0; i < dma->buf_count; i++) {
buf = dma->buflist[i]; buf = dma->buflist[start];
buf_priv = buf->dev_private; buf_priv = buf->dev_private;
if (buf->file_priv == NULL || (buf->pending && if (buf->file_priv == NULL || (buf->pending &&
buf_priv->age <= buf_priv->age <=
...@@ -1951,6 +1951,7 @@ struct drm_buf *radeon_freelist_get(struct drm_device * dev) ...@@ -1951,6 +1951,7 @@ struct drm_buf *radeon_freelist_get(struct drm_device * dev)
buf->pending = 0; buf->pending = 0;
return buf; return buf;
} }
if (++start >= dma->buf_count)
start = 0; start = 0;
} }
...@@ -1960,46 +1961,8 @@ struct drm_buf *radeon_freelist_get(struct drm_device * dev) ...@@ -1960,46 +1961,8 @@ struct drm_buf *radeon_freelist_get(struct drm_device * dev)
} }
} }
DRM_DEBUG("returning NULL!\n");
return NULL;
}
#if 0
struct drm_buf *radeon_freelist_get(struct drm_device * dev)
{
struct drm_device_dma *dma = dev->dma;
drm_radeon_private_t *dev_priv = dev->dev_private;
drm_radeon_buf_priv_t *buf_priv;
struct drm_buf *buf;
int i, t;
int start;
u32 done_age;
done_age = radeon_read_ring_rptr(dev_priv, RADEON_SCRATCHOFF(1));
if (++dev_priv->last_buf >= dma->buf_count)
dev_priv->last_buf = 0;
start = dev_priv->last_buf;
dev_priv->stats.freelist_loops++;
for (t = 0; t < 2; t++) {
for (i = start; i < dma->buf_count; i++) {
buf = dma->buflist[i];
buf_priv = buf->dev_private;
if (buf->file_priv == 0 || (buf->pending &&
buf_priv->age <=
done_age)) {
dev_priv->stats.requested_bufs++;
buf->pending = 0;
return buf;
}
}
start = 0;
}
return NULL; return NULL;
} }
#endif
void radeon_freelist_reset(struct drm_device * dev) void radeon_freelist_reset(struct drm_device * dev)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment