r300g: align the height of NPOT textures to POT
[mesa.git] / src / gallium / drivers / i915 / i915_texture.c
index c7b86dd4c57dd5b3f54b656c852d94bb815db140..8c405c2443e36147d7e5de211c301a530543fba6 100644 (file)
 #include "pipe/p_state.h"
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
-#include "pipe/p_inlines.h"
-#include "pipe/internal/p_winsys_screen.h"
+#include "util/u_inlines.h"
+#include "util/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 
 #include "i915_context.h"
 #include "i915_texture.h"
-#include "i915_debug.h"
 #include "i915_screen.h"
-#include "intel_winsys.h"
+#include "i915_winsys.h"
 
 
 /*
@@ -74,6 +73,9 @@ static const int step_offsets[6][2] = {
    {-1, 1}
 };
 
+/* XXX really need twice the size if x is already pot?
+   Otherwise just use util_next_power_of_two?
+*/
 static unsigned
 power_of_two(unsigned x)
 {
@@ -83,13 +85,6 @@ power_of_two(unsigned x)
    return value;
 }
 
-static unsigned
-round_up(unsigned n, unsigned multiple)
-{
-   return (n + multiple - 1) & ~(multiple - 1);
-}
-
-
 /*
  * More advanced helper funcs
  */
@@ -101,12 +96,7 @@ i915_miptree_set_level_info(struct i915_texture *tex,
                              unsigned nr_images,
                              unsigned w, unsigned h, unsigned d)
 {
-   struct pipe_texture *pt = &tex->base;
-
-   assert(level < PIPE_MAX_TEXTURE_LEVELS);
-
-   pt->nblocksx[level] = pf_get_nblocksx(&pt->block, w);
-   pt->nblocksy[level] = pf_get_nblocksy(&pt->block, h);
+   assert(level < Elements(tex->nr_images));
 
    tex->nr_images[level] = nr_images;
 
@@ -138,7 +128,7 @@ i915_miptree_set_image_offset(struct i915_texture *tex,
 
    assert(img < tex->nr_images[level]);
 
-   tex->image_offset[level][img] = y * tex->stride + x * tex->base.block.size;
+   tex->image_offset[level][img] = y * tex->stride + x * util_format_get_blocksize(tex->base.format);
 
    /*
    printf("%s level %d img %d pos %d,%d image_offset %x\n",
@@ -160,28 +150,28 @@ i915_scanout_layout(struct i915_texture *tex)
 {
    struct pipe_texture *pt = &tex->base;
 
-   if (pt->last_level > 0 || pt->block.size != 4)
+   if (pt->last_level > 0 || util_format_get_blocksize(pt->format) != 4)
       return FALSE;
 
    i915_miptree_set_level_info(tex, 0, 1,
-                               tex->base.width0,
-                               tex->base.height0,
+                               pt->width0,
+                               pt->height0,
                                1);
    i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
 
-   if (tex->base.width0 >= 240) {
-      tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size);
-      tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8);
-      tex->hw_tiled = INTEL_TILE_X;
-   } else if (tex->base.width0 == 64 && tex->base.height0 == 64) {
-      tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size);
-      tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8);
+   if (pt->width0 >= 240) {
+      tex->stride = power_of_two(util_format_get_stride(pt->format, pt->width0));
+      tex->total_nblocksy = align(util_format_get_nblocksy(pt->format, pt->height0), 8);
+      tex->hw_tiled = I915_TILE_X;
+   } else if (pt->width0 == 64 && pt->height0 == 64) {
+      tex->stride = power_of_two(util_format_get_stride(pt->format, pt->width0));
+      tex->total_nblocksy = align(util_format_get_nblocksy(pt->format, pt->height0), 8);
    } else {
       return FALSE;
    }
 
    debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__,
-      tex->base.width0, tex->base.height0, pt->block.size,
+      pt->width0, pt->height0, util_format_get_blocksize(pt->format),
       tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy);
 
    return TRUE;
@@ -195,25 +185,25 @@ i915_display_target_layout(struct i915_texture *tex)
 {
    struct pipe_texture *pt = &tex->base;
 
-   if (pt->last_level > 0 || pt->block.size != 4)
+   if (pt->last_level > 0 || util_format_get_blocksize(pt->format) != 4)
       return FALSE;
 
    /* fallback to normal textures for small textures */
-   if (tex->base.width0 < 240)
+   if (pt->width0 < 240)
       return FALSE;
 
    i915_miptree_set_level_info(tex, 0, 1,
-                               tex->base.width0,
-                               tex->base.height0,
+                               pt->width0,
+                               pt->height0,
                                1);
    i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
 
-   tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size);
-   tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8);
-   tex->hw_tiled = INTEL_TILE_X;
+   tex->stride = power_of_two(util_format_get_stride(pt->format, pt->width0));
+   tex->total_nblocksy = align(util_format_get_nblocksy(pt->format, pt->height0), 8);
+   tex->hw_tiled = I915_TILE_X;
 
    debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__,
-      tex->base.width0, tex->base.height0, pt->block.size,
+      pt->width0, pt->height0, util_format_get_blocksize(pt->format),
       tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy);
 
    return TRUE;
@@ -226,34 +216,32 @@ i915_miptree_layout_2d(struct i915_texture *tex)
    unsigned level;
    unsigned width = pt->width0;
    unsigned height = pt->height0;
-   unsigned nblocksx = pt->nblocksx[0];
-   unsigned nblocksy = pt->nblocksy[0];
+   unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->width0);
 
    /* used for scanouts that need special layouts */
-   if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_PRIMARY)
+   if (pt->tex_usage & PIPE_TEXTURE_USAGE_SCANOUT)
       if (i915_scanout_layout(tex))
          return;
 
-   /* for shared buffers we use some very like scanout */
-   if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET)
+   /* shared buffers needs to be compatible with X servers */
+   if (pt->tex_usage & PIPE_TEXTURE_USAGE_SHARED)
       if (i915_display_target_layout(tex))
          return;
 
-   tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4);
+   tex->stride = align(util_format_get_stride(pt->format, pt->width0), 4);
    tex->total_nblocksy = 0;
 
    for (level = 0; level <= pt->last_level; level++) {
       i915_miptree_set_level_info(tex, level, 1, width, height, 1);
       i915_miptree_set_image_offset(tex, level, 0, 0, tex->total_nblocksy);
 
-      nblocksy = round_up(MAX2(2, nblocksy), 2);
+      nblocksy = align(MAX2(2, nblocksy), 2);
 
       tex->total_nblocksy += nblocksy;
 
       width = u_minify(width, 1);
       height = u_minify(height, 1);
-      nblocksx = pf_get_nblocksx(&pt->block, width);
-      nblocksy = pf_get_nblocksy(&pt->block, height);
+      nblocksy = util_format_get_nblocksy(pt->format, height);
    }
 }
 
@@ -266,13 +254,12 @@ i915_miptree_layout_3d(struct i915_texture *tex)
    unsigned width = pt->width0;
    unsigned height = pt->height0;
    unsigned depth = pt->depth0;
-   unsigned nblocksx = pt->nblocksx[0];
-   unsigned nblocksy = pt->nblocksy[0];
+   unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->height0);
    unsigned stack_nblocksy = 0;
 
    /* Calculate the size of a single slice. 
     */
-   tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4);
+   tex->stride = align(util_format_get_stride(pt->format, pt->width0), 4);
 
    /* XXX: hardware expects/requires 9 levels at minimum.
     */
@@ -283,8 +270,7 @@ i915_miptree_layout_3d(struct i915_texture *tex)
 
       width = u_minify(width, 1);
       height = u_minify(height, 1);
-      nblocksx = pf_get_nblocksx(&pt->block, width);
-      nblocksy = pf_get_nblocksy(&pt->block, height);
+      nblocksy = util_format_get_nblocksy(pt->format, height);
    }
 
    /* Fixup depth image_offsets: 
@@ -309,14 +295,14 @@ i915_miptree_layout_cube(struct i915_texture *tex)
 {
    struct pipe_texture *pt = &tex->base;
    unsigned width = pt->width0, height = pt->height0;
-   const unsigned nblocks = pt->nblocksx[0];
+   const unsigned nblocks = util_format_get_nblocksx(pt->format, pt->width0);
    unsigned level;
    unsigned face;
 
    assert(width == height); /* cubemap images are square */
 
    /* double pitch for cube layouts */
-   tex->stride = round_up(nblocks * pt->block.size * 2, 4);
+   tex->stride = align(nblocks * util_format_get_blocksize(pt->format) * 2, 4);
    tex->total_nblocksy = nblocks * 4;
 
    for (level = 0; level <= pt->last_level; level++) {
@@ -379,20 +365,20 @@ i945_miptree_layout_2d(struct i915_texture *tex)
    unsigned y = 0;
    unsigned width = pt->width0;
    unsigned height = pt->height0;
-   unsigned nblocksx = pt->nblocksx[0];
-   unsigned nblocksy = pt->nblocksy[0];
+   unsigned nblocksx = util_format_get_nblocksx(pt->format, pt->width0);
+   unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->height0);
 
    /* used for scanouts that need special layouts */
-   if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_PRIMARY)
+   if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_SCANOUT)
       if (i915_scanout_layout(tex))
          return;
 
-   /* for shared buffers we use some very like scanout */
-   if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET)
+   /* shared buffers needs to be compatible with X servers */
+   if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_SHARED)
       if (i915_display_target_layout(tex))
          return;
 
-   tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4);
+   tex->stride = align(util_format_get_stride(pt->format, pt->width0), 4);
 
    /* May need to adjust pitch to accomodate the placement of
     * the 2nd mipmap level.  This occurs when the alignment
@@ -401,11 +387,11 @@ i945_miptree_layout_2d(struct i915_texture *tex)
     */
    if (pt->last_level > 0) {
       unsigned mip1_nblocksx 
-         = align(pf_get_nblocksx(&pt->block, u_minify(width, 1)), align_x)
-         + pf_get_nblocksx(&pt->block, u_minify(width, 2));
+         = align(util_format_get_nblocksx(pt->format, u_minify(width, 1)), align_x)
+         + util_format_get_nblocksx(pt->format, u_minify(width, 2));
 
       if (mip1_nblocksx > nblocksx)
-         tex->stride = mip1_nblocksx * pt->block.size;
+         tex->stride = mip1_nblocksx * util_format_get_blocksize(pt->format);
    }
 
    /* Pitch must be a whole number of dwords
@@ -435,8 +421,8 @@ i945_miptree_layout_2d(struct i915_texture *tex)
 
       width  = u_minify(width, 1);
       height = u_minify(height, 1);
-      nblocksx = pf_get_nblocksx(&pt->block, width);
-      nblocksy = pf_get_nblocksy(&pt->block, height);
+      nblocksx = util_format_get_nblocksx(pt->format, width);
+      nblocksy = util_format_get_nblocksy(pt->format, height);
    }
 }
 
@@ -447,17 +433,16 @@ i945_miptree_layout_3d(struct i915_texture *tex)
    unsigned width = pt->width0;
    unsigned height = pt->height0;
    unsigned depth = pt->depth0;
-   unsigned nblocksx = pt->nblocksx[0];
-   unsigned nblocksy = pt->nblocksy[0];
+   unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->width0);
    unsigned pack_x_pitch, pack_x_nr;
    unsigned pack_y_pitch;
    unsigned level;
 
-   tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4);
+   tex->stride = align(util_format_get_stride(pt->format, pt->width0), 4);
    tex->total_nblocksy = 0;
 
-   pack_y_pitch = MAX2(pt->nblocksy[0], 2);
-   pack_x_pitch = tex->stride / pt->block.size;
+   pack_y_pitch = MAX2(nblocksy, 2);
+   pack_x_pitch = tex->stride / util_format_get_blocksize(pt->format);
    pack_x_nr = 1;
 
    for (level = 0; level <= pt->last_level; level++) {
@@ -482,7 +467,7 @@ i945_miptree_layout_3d(struct i915_texture *tex)
       if (pack_x_pitch > 4) {
          pack_x_pitch >>= 1;
          pack_x_nr <<= 1;
-         assert(pack_x_pitch * pack_x_nr * pt->block.size <= tex->stride);
+         assert(pack_x_pitch * pack_x_nr * util_format_get_blocksize(pt->format) <= tex->stride);
       }
 
       if (pack_y_pitch > 2) {
@@ -492,8 +477,7 @@ i945_miptree_layout_3d(struct i915_texture *tex)
       width = u_minify(width, 1);
       height = u_minify(height, 1);
       depth = u_minify(depth, 1);
-      nblocksx = pf_get_nblocksx(&pt->block, width);
-      nblocksy = pf_get_nblocksy(&pt->block, height);
+      nblocksy = util_format_get_nblocksy(pt->format, height);
    }
 }
 
@@ -503,7 +487,7 @@ i945_miptree_layout_cube(struct i915_texture *tex)
    struct pipe_texture *pt = &tex->base;
    unsigned level;
 
-   const unsigned nblocks = pt->nblocksx[0];
+   const unsigned nblocks = util_format_get_nblocksx(pt->format, pt->width0);
    unsigned face;
    unsigned width = pt->width0;
    unsigned height = pt->height0;
@@ -523,9 +507,9 @@ i945_miptree_layout_cube(struct i915_texture *tex)
     * or the final row of 4x4, 2x2 and 1x1 faces below this.
     */
    if (nblocks > 32)
-      tex->stride = round_up(nblocks * pt->block.size * 2, 4);
+      tex->stride = align(nblocks * util_format_get_blocksize(pt->format) * 2, 4);
    else
-      tex->stride = 14 * 8 * pt->block.size;
+      tex->stride = 14 * 8 * util_format_get_blocksize(pt->format);
 
    tex->total_nblocksy = nblocks * 4;
 
@@ -633,7 +617,7 @@ i915_texture_create(struct pipe_screen *screen,
                     const struct pipe_texture *templat)
 {
    struct i915_screen *is = i915_screen(screen);
-   struct intel_winsys *iws = is->iws;
+   struct i915_winsys *iws = is->iws;
    struct i915_texture *tex = CALLOC_STRUCT(i915_texture);
    size_t tex_size;
    unsigned buf_usage = 0;
@@ -645,9 +629,6 @@ i915_texture_create(struct pipe_screen *screen,
    pipe_reference_init(&tex->base.reference, 1);
    tex->base.screen = screen;
 
-   tex->base.nblocksx[0] = pf_get_nblocksx(&tex->base.block, tex->base.width0);
-   tex->base.nblocksy[0] = pf_get_nblocksy(&tex->base.block, tex->base.height0);
-   
    if (is->is_i945) {
       if (!i945_miptree_layout(tex))
          goto fail;
@@ -661,10 +642,10 @@ i915_texture_create(struct pipe_screen *screen,
 
 
    /* for scanouts and cursors, cursors arn't scanouts */
-   if (templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY && templat->width0 != 64)
-      buf_usage = INTEL_NEW_SCANOUT;
+   if (templat->tex_usage & PIPE_TEXTURE_USAGE_SCANOUT && templat->width0 != 64)
+      buf_usage = I915_NEW_SCANOUT;
    else
-      buf_usage = INTEL_NEW_TEXTURE;
+      buf_usage = I915_NEW_TEXTURE;
 
    tex->buffer = iws->buffer_create(iws, tex_size, 64, buf_usage);
    if (!tex->buffer)
@@ -672,7 +653,7 @@ i915_texture_create(struct pipe_screen *screen,
 
    /* setup any hw fences */
    if (tex->hw_tiled) {
-      assert(tex->sw_tiled == INTEL_TILE_NONE);
+      assert(tex->sw_tiled == I915_TILE_NONE);
       iws->buffer_set_fence_reg(iws, tex->buffer, tex->stride, tex->hw_tiled);
    }
 
@@ -692,19 +673,24 @@ fail:
 }
 
 static struct pipe_texture *
-i915_texture_blanket(struct pipe_screen * screen,
-                     const struct pipe_texture *base,
-                     const unsigned *stride,
-                     struct pipe_buffer *buffer)
+i915_texture_from_handle(struct pipe_screen * screen,
+                         const struct pipe_texture *templat,
+                         struct winsys_handle *whandle)
 {
-#if 0
+   struct i915_screen *is = i915_screen(screen);
    struct i915_texture *tex;
+   struct i915_winsys *iws = is->iws;
+   struct i915_winsys_buffer *buffer;
+   unsigned stride;
+
    assert(screen);
 
+   buffer = iws->buffer_from_handle(iws, whandle, &stride);
+
    /* Only supports one type */
-   if (base->target != PIPE_TEXTURE_2D ||
-       base->last_level != 0 ||
-       base->depth0 != 1) {
+   if (templat->target != PIPE_TEXTURE_2D ||
+       templat->last_level != 0 ||
+       templat->depth0 != 1) {
       return NULL;
    }
 
@@ -712,28 +698,38 @@ i915_texture_blanket(struct pipe_screen * screen,
    if (!tex)
       return NULL;
 
-   tex->base = *base;
+   tex->base = *templat;
    pipe_reference_init(&tex->base.reference, 1);
    tex->base.screen = screen;
 
-   tex->stride = stride[0];
+   tex->stride = stride;
 
-   i915_miptree_set_level_info(tex, 0, 1, base->width0, base->height0, 1);
+   i915_miptree_set_level_info(tex, 0, 1, templat->width0, templat->height0, 1);
    i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
 
-   pipe_buffer_reference(&tex->buffer, buffer);
+   tex->buffer = buffer;
 
    return &tex->base;
-#else
-   return NULL;
-#endif
 }
 
+static boolean
+i915_texture_get_handle(struct pipe_screen * screen,
+                        struct pipe_texture *texture,
+                        struct winsys_handle *whandle)
+{
+   struct i915_screen *is = i915_screen(screen);
+   struct i915_texture *tex = (struct i915_texture *)texture;
+   struct i915_winsys *iws = is->iws;
+
+   return iws->buffer_get_handle(iws, tex->buffer, whandle, tex->stride);
+}
+
+
 static void
 i915_texture_destroy(struct pipe_texture *pt)
 {
    struct i915_texture *tex = (struct i915_texture *)pt;
-   struct intel_winsys *iws = i915_screen(pt->screen)->iws;
+   struct i915_winsys *iws = i915_screen(pt->screen)->iws;
    uint i;
 
    /*
@@ -742,7 +738,7 @@ i915_texture_destroy(struct pipe_texture *pt)
 
    iws->buffer_destroy(iws, tex->buffer);
 
-   for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++)
+   for (i = 0; i < Elements(tex->image_offset); i++)
       if (tex->image_offset[i])
          FREE(tex->image_offset[i]);
 
@@ -799,12 +795,12 @@ i915_tex_surface_destroy(struct pipe_surface *surf)
 
 
 /*
- * Screen transfer functions
+ * Texture transfer functions
  */
 
 
-static struct pipe_transfer*
-i915_get_tex_transfer(struct pipe_screen *screen,
+static struct pipe_transfer *
+i915_get_tex_transfer(struct pipe_context *pipe,
                       struct pipe_texture *texture,
                       unsigned face, unsigned level, unsigned zslice,
                       enum pipe_transfer_usage usage, unsigned x, unsigned y,
@@ -829,14 +825,10 @@ i915_get_tex_transfer(struct pipe_screen *screen,
    trans = CALLOC_STRUCT(i915_transfer);
    if (trans) {
       pipe_texture_reference(&trans->base.texture, texture);
-      trans->base.format = trans->base.format;
       trans->base.x = x;
       trans->base.y = y;
       trans->base.width = w;
       trans->base.height = h;
-      trans->base.block = texture->block;
-      trans->base.nblocksx = texture->nblocksx[level];
-      trans->base.nblocksy = texture->nblocksy[level];
       trans->base.stride = tex->stride;
       trans->offset = offset;
       trans->base.usage = usage;
@@ -845,13 +837,14 @@ i915_get_tex_transfer(struct pipe_screen *screen,
 }
 
 static void *
-i915_transfer_map(struct pipe_screen *screen,
+i915_transfer_map(struct pipe_context *pipe,
                   struct pipe_transfer *transfer)
 {
    struct i915_texture *tex = (struct i915_texture *)transfer->texture;
-   struct intel_winsys *iws = i915_screen(tex->base.screen)->iws;
+   struct i915_winsys *iws = i915_screen(tex->base.screen)->iws;
    char *map;
    boolean write = FALSE;
+   enum pipe_format format = tex->base.format;
 
    if (transfer->usage & PIPE_TRANSFER_WRITE)
       write = TRUE;
@@ -861,21 +854,22 @@ i915_transfer_map(struct pipe_screen *screen,
       return NULL;
 
    return map + i915_transfer(transfer)->offset +
-      transfer->y / transfer->block.height * transfer->stride +
-      transfer->x / transfer->block.width * transfer->block.size;
+      transfer->y / util_format_get_blockheight(format) * transfer->stride +
+      transfer->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
 }
 
 static void
-i915_transfer_unmap(struct pipe_screen *screen,
+i915_transfer_unmap(struct pipe_context *pipe,
                     struct pipe_transfer *transfer)
 {
    struct i915_texture *tex = (struct i915_texture *)transfer->texture;
-   struct intel_winsys *iws = i915_screen(tex->base.screen)->iws;
+   struct i915_winsys *iws = i915_screen(tex->base.screen)->iws;
    iws->buffer_unmap(iws, tex->buffer);
 }
 
 static void
-i915_tex_transfer_destroy(struct pipe_transfer *trans)
+i915_tex_transfer_destroy(struct pipe_context *pipe,
+                          struct pipe_transfer *trans)
 {
    pipe_texture_reference(&trans->texture, NULL);
    FREE(trans);
@@ -886,67 +880,22 @@ i915_tex_transfer_destroy(struct pipe_transfer *trans)
  * Other texture functions
  */
 
+void
+i915_init_texture_functions(struct i915_context *i915 )
+{
+   i915->base.get_tex_transfer = i915_get_tex_transfer;
+   i915->base.transfer_map = i915_transfer_map;
+   i915->base.transfer_unmap = i915_transfer_unmap;
+   i915->base.tex_transfer_destroy = i915_tex_transfer_destroy;
+}
 
 void
 i915_init_screen_texture_functions(struct i915_screen *is)
 {
    is->base.texture_create = i915_texture_create;
-   is->base.texture_blanket = i915_texture_blanket;
+   is->base.texture_from_handle = i915_texture_from_handle;
+   is->base.texture_get_handle = i915_texture_get_handle;
    is->base.texture_destroy = i915_texture_destroy;
    is->base.get_tex_surface = i915_get_tex_surface;
    is->base.tex_surface_destroy = i915_tex_surface_destroy;
-   is->base.get_tex_transfer = i915_get_tex_transfer;
-   is->base.transfer_map = i915_transfer_map;
-   is->base.transfer_unmap = i915_transfer_unmap;
-   is->base.tex_transfer_destroy = i915_tex_transfer_destroy;
-}
-
-struct pipe_texture *
-i915_texture_blanket_intel(struct pipe_screen *screen,
-                           struct pipe_texture *base,
-                           unsigned stride,
-                           struct intel_buffer *buffer)
-{
-   struct i915_texture *tex;
-   assert(screen);
-
-   /* Only supports one type */
-   if (base->target != PIPE_TEXTURE_2D ||
-       base->last_level != 0 ||
-       base->depth0 != 1) {
-      return NULL;
-   }
-
-   tex = CALLOC_STRUCT(i915_texture);
-   if (!tex)
-      return NULL;
-
-   tex->base = *base;
-   pipe_reference_init(&tex->base.reference, 1);
-   tex->base.screen = screen;
-
-   tex->stride = stride;
-
-   i915_miptree_set_level_info(tex, 0, 1, base->width0, base->height0, 1);
-   i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
-
-   tex->buffer = buffer;
-
-   return &tex->base;
-}
-
-boolean
-i915_get_texture_buffer_intel(struct pipe_texture *texture,
-                              struct intel_buffer **buffer,
-                              unsigned *stride)
-{
-   struct i915_texture *tex = (struct i915_texture *)texture;
-
-   if (!texture)
-      return FALSE;
-
-   *stride = tex->stride;
-   *buffer = tex->buffer;
-
-   return TRUE;
 }