summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv50/nv50_surface.c
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2012-07-31 15:56:09 +0200
committerChristoph Bumiller <[email protected]>2012-08-01 15:39:46 +0200
commit6286d9810b7ebae588060370cd7a63c327478a2f (patch)
tree615439a67beb92f629bfeffe27217257a94679c1 /src/gallium/drivers/nv50/nv50_surface.c
parentbe2dcc5e9f61d380aec93eeb01227cbb6b5037c1 (diff)
Revert "gallium: specify resource_resolve destination via a pipe_surface"
This reverts commit 5d5af7d359e0060fa00b90a8f04900b96f9058b0. It turns out the issue this was supposed to fix merely counter-acted a bug in the hardware driver that I wasn't aware of. The resource_resolve is not supposed to do sRGB conversion, period. (This would violate the requirement that source and destination must be of the same format).
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_surface.c')
-rw-r--r--src/gallium/drivers/nv50/nv50_surface.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c
index ed5223b2085..0872f8d0dc4 100644
--- a/src/gallium/drivers/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nv50/nv50_surface.c
@@ -436,7 +436,6 @@ struct nv50_blitctx
unsigned num_samplers[3];
struct pipe_sampler_view *texture[2];
struct nv50_tsc_entry *sampler[2];
- enum pipe_format format;
unsigned dirty;
} saved;
struct nv50_program vp;
@@ -662,19 +661,26 @@ nv50_blitctx_get_color_mask_and_fp(struct nv50_blitctx *blit,
}
static void
-nv50_blit_set_dst(struct nv50_context *nv50, struct pipe_surface *surf,
- struct nv50_blitctx *blit)
+nv50_blit_set_dst(struct nv50_context *nv50,
+ struct pipe_resource *res, unsigned level, unsigned layer)
{
- blit->saved.format = surf->format;
+ struct pipe_context *pipe = &nv50->base.pipe;
+ struct pipe_surface templ;
- if (util_format_is_depth_or_stencil(surf->format))
- surf->format = nv50_blit_zeta_to_colour_format(surf->format);
+ if (util_format_is_depth_or_stencil(res->format))
+ templ.format = nv50_blit_zeta_to_colour_format(res->format);
+ else
+ templ.format = res->format;
+
+ templ.usage = PIPE_USAGE_STREAM;
+ templ.u.tex.level = level;
+ templ.u.tex.first_layer = templ.u.tex.last_layer = layer;
- nv50->framebuffer.cbufs[0] = surf;
+ nv50->framebuffer.cbufs[0] = nv50_miptree_surface_new(pipe, res, &templ);
nv50->framebuffer.nr_cbufs = 1;
nv50->framebuffer.zsbuf = NULL;
- nv50->framebuffer.width = surf->width;
- nv50->framebuffer.height = surf->height;
+ nv50->framebuffer.width = nv50->framebuffer.cbufs[0]->width;
+ nv50->framebuffer.height = nv50->framebuffer.cbufs[0]->height;
}
static INLINE void
@@ -816,7 +822,7 @@ nv50_blitctx_post_blit(struct nv50_context *nv50, struct nv50_blitctx *blit)
{
int s;
- nv50->framebuffer.cbufs[0]->format = blit->saved.format;
+ pipe_surface_reference(&nv50->framebuffer.cbufs[0], NULL);
nv50->framebuffer.width = blit->saved.fb.width;
nv50->framebuffer.height = blit->saved.fb.height;
@@ -856,7 +862,7 @@ nv50_resource_resolve(struct pipe_context *pipe,
struct nv50_blitctx *blit = screen->blitctx;
struct nouveau_pushbuf *push = nv50->base.pushbuf;
struct pipe_resource *src = info->src.res;
- struct pipe_resource *dst = info->dst.surface->texture;
+ struct pipe_resource *dst = info->dst.res;
float x0, x1, y0, y1, z;
float x_range, y_range;
@@ -866,8 +872,8 @@ nv50_resource_resolve(struct pipe_context *pipe,
nv50_blitctx_pre_blit(blit, nv50);
- nv50_blit_set_dst(nv50, info->dst.surface, blit);
- nv50_blit_set_src(nv50, src, 0, info->src.layer);
+ nv50_blit_set_dst(nv50, dst, info->dst.level, info->dst.layer);
+ nv50_blit_set_src(nv50, src, 0, info->src.layer);
nv50_blitctx_prepare_state(blit);