summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2010-05-17 21:24:04 +0200
committerRoland Scheidegger <[email protected]>2010-05-17 21:24:04 +0200
commitbccf31bf5f2d6c9516a4c073d735b5056ff1d608 (patch)
tree22e7c60bc0c16036904f32cb9de10e7350f0ca15 /src/gallium
parent6c32670706e8ed3855ff2187f0eadee43b5b8742 (diff)
i915g: adapt to interface changes
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/i915/i915_screen.c19
-rw-r--r--src/gallium/drivers/i915/i915_surface.c69
2 files changed, 67 insertions, 21 deletions
diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
index 9086f9fc3b1..c10ba25d2d5 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -159,9 +159,10 @@ i915_get_paramf(struct pipe_screen *screen, int param)
static boolean
i915_is_format_supported(struct pipe_screen *screen,
- enum pipe_format format,
+ enum pipe_format format,
enum pipe_texture_target target,
- unsigned tex_usage,
+ unsigned sample_count,
+ unsigned tex_usage,
unsigned geom_flags)
{
static const enum pipe_format tex_supported[] = {
@@ -181,17 +182,25 @@ i915_is_format_supported(struct pipe_screen *screen,
PIPE_FORMAT_Z24_UNORM_S8_USCALED,
PIPE_FORMAT_NONE /* list terminator */
};
- static const enum pipe_format surface_supported[] = {
+ static const enum pipe_format render_supported[] = {
PIPE_FORMAT_B8G8R8A8_UNORM,
PIPE_FORMAT_B5G6R5_UNORM,
+ PIPE_FORMAT_NONE /* list terminator */
+ };
+ static const enum pipe_format depth_supported[] = {
PIPE_FORMAT_Z24_UNORM_S8_USCALED,
PIPE_FORMAT_NONE /* list terminator */
};
const enum pipe_format *list;
uint i;
- if(tex_usage & PIPE_BIND_RENDER_TARGET)
- list = surface_supported;
+ if (sample_count > 1)
+ return FALSE;
+
+ if(tex_usage & PIPE_BIND_DEPTH_STENCIL)
+ list = depth_supported;
+ else if (tex_usage & PIPE_BIND_RENDER_TARGET)
+ list = render_supported;
else
list = tex_supported;
diff --git a/src/gallium/drivers/i915/i915_surface.c b/src/gallium/drivers/i915/i915_surface.c
index 453437b8090..0deee24754f 100644
--- a/src/gallium/drivers/i915/i915_surface.c
+++ b/src/gallium/drivers/i915/i915_surface.c
@@ -41,15 +41,41 @@
*/
static void
i915_surface_copy(struct pipe_context *pipe,
- struct pipe_surface *dst,
- unsigned dstx, unsigned dsty,
- struct pipe_surface *src,
- unsigned srcx, unsigned srcy, unsigned width, unsigned height)
+ struct pipe_resource *dst, struct pipe_subresource subdst,
+ unsigned dstx, unsigned dsty, unsigned dstz,
+ struct pipe_resource *src, struct pipe_subresource subsrc,
+ unsigned srcx, unsigned srcy, unsigned srcz,
+ unsigned width, unsigned height)
{
- struct i915_texture *dst_tex = i915_texture(dst->texture);
- struct i915_texture *src_tex = i915_texture(src->texture);
+ struct i915_texture *dst_tex = i915_texture(dst);
+ struct i915_texture *src_tex = i915_texture(src);
struct pipe_resource *dpt = &dst_tex->b.b;
struct pipe_resource *spt = &src_tex->b.b;
+ unsigned dst_offset, src_offset; /* in bytes */
+
+ if (dst->target == PIPE_TEXTURE_CUBE) {
+ dst_offset = dst_tex->image_offset[subdst.level][subdst.face];
+ }
+ else if (dst->target == PIPE_TEXTURE_3D) {
+ dst_offset = dst_tex->image_offset[subdst.level][dstz];
+ }
+ else {
+ dst_offset = dst_tex->image_offset[subdst.level][0];
+ assert(subdst.face == 0);
+ assert(dstz == 0);
+ }
+ if (src->target == PIPE_TEXTURE_CUBE) {
+ src_offset = src_tex->image_offset[subsrc.level][subsrc.face];
+ }
+ else if (src->target == PIPE_TEXTURE_3D) {
+ src_offset = src_tex->image_offset[subsrc.level][srcz];
+ }
+ else {
+ src_offset = src_tex->image_offset[subsrc.level][0];
+ assert(subsrc.face == 0);
+ assert(srcz == 0);
+ }
+
assert( dst != src );
assert( util_format_get_blocksize(dpt->format) == util_format_get_blocksize(spt->format) );
@@ -61,20 +87,33 @@ i915_surface_copy(struct pipe_context *pipe,
i915_copy_blit( i915_context(pipe),
FALSE,
util_format_get_blocksize(dpt->format),
- (unsigned short) src_tex->stride, src_tex->buffer, src->offset,
- (unsigned short) dst_tex->stride, dst_tex->buffer, dst->offset,
+ (unsigned short) src_tex->stride, src_tex->buffer, src_offset,
+ (unsigned short) dst_tex->stride, dst_tex->buffer, dst_offset,
(short) srcx, (short) srcy, (short) dstx, (short) dsty, (short) width, (short) height );
}
static void
i915_surface_fill(struct pipe_context *pipe,
- struct pipe_surface *dst,
- unsigned dstx, unsigned dsty,
+ struct pipe_resource *dst, struct pipe_subresource subdst,
+ unsigned dstx, unsigned dsty, unsigned dstz,
unsigned width, unsigned height, unsigned value)
{
- struct i915_texture *tex = i915_texture(dst->texture);
+ struct i915_texture *tex = i915_texture(dst);
struct pipe_resource *pt = &tex->b.b;
+ unsigned dst_offset; /* in bytes */
+
+ if (dst->target == PIPE_TEXTURE_CUBE) {
+ dst_offset = tex->image_offset[subdst.level][subdst.face];
+ }
+ else if (dst->target == PIPE_TEXTURE_3D) {
+ dst_offset = tex->image_offset[subdst.level][dstz];
+ }
+ else {
+ dst_offset = tex->image_offset[subdst.level][0];
+ assert(subdst.face == 0);
+ assert(dstz == 0);
+ }
assert(util_format_get_blockwidth(pt->format) == 1);
assert(util_format_get_blockheight(pt->format) == 1);
@@ -82,7 +121,7 @@ i915_surface_fill(struct pipe_context *pipe,
i915_fill_blit( i915_context(pipe),
util_format_get_blocksize(pt->format),
(unsigned short) tex->stride,
- tex->buffer, dst->offset,
+ tex->buffer, dst_offset,
(short) dstx, (short) dsty,
(short) width, (short) height,
value );
@@ -137,13 +176,11 @@ i915_tex_surface_destroy(struct pipe_surface *surf)
}
-/* Probably going to make blits work on textures rather than surfaces.
- */
void
i915_init_surface_functions(struct i915_context *i915)
{
- i915->base.surface_copy = i915_surface_copy;
- i915->base.surface_fill = i915_surface_fill;
+ i915->base.resource_copy_region = i915_surface_copy;
+ i915->base.resource_fill_region = i915_surface_fill;
}
/* No good reason for these to be in the screen.