intel: Reduce intel_renderbuffer_tile_offsets to a thin wrapper.
authorEric Anholt <eric@anholt.net>
Mon, 4 Feb 2013 18:05:51 +0000 (10:05 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 28 May 2013 19:40:15 +0000 (12:40 -0700)
Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
src/mesa/drivers/dri/intel/intel_fbo.c
src/mesa/drivers/dri/intel/intel_fbo.h

index 69f862930d6c2048e77b013a48759ff1190821a9..34f31fb0a8814d4c6ac349c5398e5a6c0cfef801 100644 (file)
@@ -534,32 +534,6 @@ intel_renderbuffer_set_draw_offset(struct intel_renderbuffer *irb)
    irb->draw_y = dst_y;
 }
 
-/**
- * Rendering to tiled buffers requires that the base address of the
- * buffer be aligned to a page boundary.  We generally render to
- * textures by pointing the surface at the mipmap image level, which
- * may not be aligned to a tile boundary.
- *
- * This function returns an appropriately-aligned base offset
- * according to the tiling restrictions, plus any required x/y offset
- * from there.
- */
-uint32_t
-intel_renderbuffer_tile_offsets(struct intel_renderbuffer *irb,
-                               uint32_t *tile_x,
-                               uint32_t *tile_y)
-{
-   struct intel_region *region = irb->mt->region;
-   uint32_t mask_x, mask_y;
-
-   intel_region_get_tile_masks(region, &mask_x, &mask_y, false);
-
-   *tile_x = irb->draw_x & mask_x;
-   *tile_y = irb->draw_y & mask_y;
-   return intel_region_get_aligned_offset(region, irb->draw_x & ~mask_x,
-                                          irb->draw_y & ~mask_y, false);
-}
-
 /**
  * Called by glFramebufferTexture[123]DEXT() (and other places) to
  * prepare for rendering into texture memory.  This might be called
index aa52b979f88d17f4ba2eaedb7720ff0c783ad0d4..5d6dc7ef7df5a6d92c32fe12a4cf21398dbe262d 100644 (file)
@@ -33,6 +33,7 @@
 #include "main/formats.h"
 #include "main/macros.h"
 #include "intel_context.h"
+#include "intel_mipmap_tree.h"
 #include "intel_screen.h"
 
 #ifdef __cplusplus
@@ -148,10 +149,14 @@ intel_flip_renderbuffers(struct gl_framebuffer *fb);
 void
 intel_renderbuffer_set_draw_offset(struct intel_renderbuffer *irb);
 
-uint32_t
+static inline uint32_t
 intel_renderbuffer_tile_offsets(struct intel_renderbuffer *irb,
                                uint32_t *tile_x,
-                               uint32_t *tile_y);
+                               uint32_t *tile_y)
+{
+   return intel_miptree_get_tile_offsets(irb->mt, irb->mt_level, irb->mt_layer,
+                                         tile_x, tile_y);
+}
 
 struct intel_region*
 intel_get_rb_region(struct gl_framebuffer *fb, GLuint attIndex);