summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2010-11-21 20:25:33 +0100
committerJakob Bornecrantz <wallbraker@gmail.com>2010-12-02 01:34:13 +0100
commit2ff0879a6365e7f7d7e5277274bc965ad57a82b4 (patch)
treeb702ac199b53ea193b3a6e4fa249ed8b5d7ce118
parent135b083461f8a5a220d86f57af018f6f0316d2bb (diff)
i915g: return tiling in iws->buffer_from_handle
This is needed to properly implement tiling flags. And the gem implemention fo buffer_from_handle already calls get_tiling, so it's for free. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Jakob Bornecrantz <wallbraker@gmail.com> Signed-off-by: Jakob Bornecrantz <wallbraker@gmail.com>
-rw-r--r--src/gallium/drivers/i915/i915_resource_texture.c4
-rw-r--r--src/gallium/drivers/i915/i915_winsys.h2
-rw-r--r--src/gallium/winsys/i915/drm/i915_drm_buffer.c6
3 files changed, 9 insertions, 3 deletions
diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c
index ce95e263813..ae34477ec27 100644
--- a/src/gallium/drivers/i915/i915_resource_texture.c
+++ b/src/gallium/drivers/i915/i915_resource_texture.c
@@ -812,10 +812,11 @@ i915_texture_from_handle(struct pipe_screen * screen,
struct i915_winsys *iws = is->iws;
struct i915_winsys_buffer *buffer;
unsigned stride;
+ enum i915_winsys_buffer_tile tiling;
assert(screen);
- buffer = iws->buffer_from_handle(iws, whandle, &stride);
+ buffer = iws->buffer_from_handle(iws, whandle, &tiling, &stride);
/* Only supports one type */
if ((template->target != PIPE_TEXTURE_2D &&
@@ -835,6 +836,7 @@ i915_texture_from_handle(struct pipe_screen * screen,
tex->b.b.screen = screen;
tex->stride = stride;
+ tex->tiling = tiling;
tex->total_nblocksy = align_nblocksy(tex->b.b.format, tex->b.b.height0, 8);
i915_texture_set_level_info(tex, 0, 1);
diff --git a/src/gallium/drivers/i915/i915_winsys.h b/src/gallium/drivers/i915/i915_winsys.h
index ddf8a906348..24ea416f015 100644
--- a/src/gallium/drivers/i915/i915_winsys.h
+++ b/src/gallium/drivers/i915/i915_winsys.h
@@ -53,6 +53,7 @@ enum i915_winsys_buffer_type
I915_NEW_VERTEX
};
+/* These need to be in sync with the definitions of libdrm-intel! */
enum i915_winsys_buffer_tile
{
I915_TILE_NONE,
@@ -156,6 +157,7 @@ struct i915_winsys {
struct i915_winsys_buffer *
(*buffer_from_handle)(struct i915_winsys *iws,
struct winsys_handle *whandle,
+ enum i915_winsys_buffer_tile *tiling,
unsigned *stride);
/**
diff --git a/src/gallium/winsys/i915/drm/i915_drm_buffer.c b/src/gallium/winsys/i915/drm/i915_drm_buffer.c
index 70f55fca873..01dd4bf062f 100644
--- a/src/gallium/winsys/i915/drm/i915_drm_buffer.c
+++ b/src/gallium/winsys/i915/drm/i915_drm_buffer.c
@@ -90,8 +90,9 @@ err:
static struct i915_winsys_buffer *
i915_drm_buffer_from_handle(struct i915_winsys *iws,
- struct winsys_handle *whandle,
- unsigned *stride)
+ struct winsys_handle *whandle,
+ enum i915_winsys_buffer_tile *tiling,
+ unsigned *stride)
{
struct i915_drm_winsys *idws = i915_drm_winsys(iws);
struct i915_drm_buffer *buf = CALLOC_STRUCT(i915_drm_buffer);
@@ -111,6 +112,7 @@ i915_drm_buffer_from_handle(struct i915_winsys *iws,
drm_intel_bo_get_tiling(buf->bo, &tile, &swizzle);
*stride = whandle->stride;
+ *tiling = tile;
return (struct i915_winsys_buffer *)buf;