summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-07-29 18:05:11 +1000
committerDave Airlie <airlied@redhat.com>2008-07-29 18:05:11 +1000
commit0452be882607f2d1601f4e592a11ccf543f5f9ca (patch)
tree1009f88f5969147114374224b12b3d7548d829fd /linux-core
parent4234f82acc70f41e005d8cc301da56634352425c (diff)
radeon: move code around putting emit into cs
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/radeon_gem.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/linux-core/radeon_gem.c b/linux-core/radeon_gem.c
index 859c1656..9d122ac5 100644
--- a/linux-core/radeon_gem.c
+++ b/linux-core/radeon_gem.c
@@ -700,7 +700,7 @@ int radeon_gem_object_pin(struct drm_gem_object *obj,
#define RADEON_NUM_IB (RADEON_IB_MEMORY / RADEON_IB_SIZE)
-int radeon_gem_ib_get(struct drm_device *dev, void **ib, uint32_t dwords)
+int radeon_gem_ib_get(struct drm_device *dev, void **ib, uint32_t dwords, uint32_t *card_offset)
{
int i, index = -1;
int ret;
@@ -738,6 +738,15 @@ int radeon_gem_ib_get(struct drm_device *dev, void **ib, uint32_t dwords)
if (dwords > RADEON_IB_SIZE / sizeof(uint32_t))
return -EINVAL;
+ ret = drm_bo_do_validate(dev_priv->ib_objs[index]->bo, 0,
+ DRM_BO_FLAG_NO_EVICT,
+ 0, 0, NULL);
+ if (ret) {
+ DRM_ERROR("Failed to validate IB %d\n", index);
+ return -EINVAL;
+ }
+
+ *card_offset = dev_priv->gart_vm_start + dev_priv->ib_objs[index]->bo->offset;
*ib = dev_priv->ib_objs[index]->kmap.virtual;
dev_priv->ib_alloc_bitmap |= (1 << i);
return 0;
@@ -754,24 +763,6 @@ static void radeon_gem_ib_free(struct drm_device *dev, void *ib, uint32_t dwords
for (i = 0; i < RADEON_NUM_IB; i++) {
if (dev_priv->ib_objs[i]->kmap.virtual == ib) {
- ret = drm_bo_do_validate(dev_priv->ib_objs[i]->bo, 0,
- DRM_BO_FLAG_NO_EVICT,
- 0, 0, NULL);
- if (ret)
- DRM_ERROR("FAiled to validate\n");
-
- DRM_DEBUG("validated IB %x, %d\n", dev_priv->ib_objs[i]->bo->offset, dwords);
- BEGIN_RING(4);
-
- OUT_RING(CP_PACKET0(RADEON_CP_IB_BASE, 1));
- OUT_RING(dev_priv->gart_vm_start + dev_priv->ib_objs[i]->bo->offset);
- OUT_RING(dwords);
- OUT_RING(CP_PACKET2());
-
- ADVANCE_RING();
-
- COMMIT_RING();
-
/* emit a fence object */
ret = drm_fence_buffer_objects(dev, NULL, 0, NULL, &fence);
if (ret) {