radeon: enable tiling fallbacks in 3D driver.
authorDave Airlie <airlied@redhat.com>
Fri, 7 Aug 2009 09:40:05 +0000 (19:40 +1000)
committerDave Airlie <airlied@redhat.com>
Fri, 7 Aug 2009 09:40:59 +0000 (19:40 +1000)
Only really got good testing on r500 so far, need to enable in
DDX and play some more.

src/mesa/drivers/dri/radeon/radeon_bo_drm.h
src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
src/mesa/drivers/dri/radeon/radeon_common_context.c

index 8eeaea1cb20640c6ee757ff80a57a9a7b8f4bd26..d52fb017d8afc1dd1c6b77a66fb2bae3ea657c35 100644 (file)
@@ -83,6 +83,10 @@ struct radeon_bo_funcs {
     int (*bo_unmap)(struct radeon_bo *bo);
     int (*bo_wait)(struct radeon_bo *bo);
     int (*bo_is_static)(struct radeon_bo *bo);
+    int (*bo_set_tiling)(struct radeon_bo *bo, uint32_t tiling_flags,
+                         uint32_t pitch);
+    int (*bo_get_tiling)(struct radeon_bo *bo, uint32_t *tiling_flags,
+                         uint32_t *pitch);
 };
 
 struct radeon_bo_manager {
@@ -187,6 +191,18 @@ static inline int _radeon_bo_wait(struct radeon_bo *bo,
     return bo->bom->funcs->bo_wait(bo);
 }
 
+static inline int radeon_bo_set_tiling(struct radeon_bo *bo,
+                                      uint32_t tiling_flags, uint32_t pitch)
+{
+    return bo->bom->funcs->bo_set_tiling(bo, tiling_flags, pitch);
+}
+
+static inline int radeon_bo_get_tiling(struct radeon_bo *bo,
+                                      uint32_t *tiling_flags, uint32_t *pitch)
+{
+    return bo->bom->funcs->bo_get_tiling(bo, tiling_flags, pitch);
+}
+
 static inline int radeon_bo_is_static(struct radeon_bo *bo)
 {
        if (bo->bom->funcs->bo_is_static)
index e608520a6e304aa59c6be00a9b8902f6b2aeaba0..8c19f30106506a389ac090feee9075b81bd01bde 100644 (file)
@@ -577,6 +577,8 @@ static struct radeon_bo_funcs bo_legacy_funcs = {
     bo_unmap,
     NULL,
     bo_is_static,
+    NULL,
+    NULL,
 };
 
 static int bo_vram_validate(struct radeon_bo *bo,
index 2a017b59cfcc4fc124d35f4105b4bab7e972d51f..5e744f9deb724490a7dc621c8217c1f0bef896f5 100644 (file)
@@ -762,8 +762,10 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
                        bo = depth_bo;
                        radeon_bo_ref(bo);
                } else {
+                       uint32_t tiling_flags = 0, pitch = 0;
+                       int ret;
 #ifdef RADEON_DEBUG_BO
-            bo = radeon_bo_open(radeon->radeonScreen->bom,
+                       bo = radeon_bo_open(radeon->radeonScreen->bom,
                                                buffers[i].name,
                                                0,
                                                0,
@@ -784,6 +786,13 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
                                        regname, buffers[i].name);
 
                        }
+
+                       ret = radeon_bo_get_tiling(bo, &tiling_flags, &pitch);
+                       if (tiling_flags & RADEON_TILING_MACRO)
+                               bo->flags |= RADEON_BO_FLAGS_MACRO_TILE;
+                       if (tiling_flags & RADEON_TILING_MICRO)
+                               bo->flags |= RADEON_BO_FLAGS_MICRO_TILE;
+                       
                }
 
                if (buffers[i].attachment == __DRI_BUFFER_DEPTH) {