diff options
author | Roland Scheidegger <[email protected]> | 2010-05-17 21:28:14 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2010-05-17 21:28:14 +0200 |
commit | b59b23a51dc17da59ccff0b3f8a73009056746e5 (patch) | |
tree | 766f29aef605a90ff9ec61535ba761d857e79537 /src | |
parent | 433701a7214fb792c3e8bdd71a0d025c09328f87 (diff) |
nouveau: adapt to interface changes
this probably needs further cleanup (just getting a surface for the resource
seems quite nonoptimal and potentially cause unnecessary copies I think)
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/nouveau/nouveau_screen.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/nv50/nv50_screen.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/nv50/nv50_surface.c | 38 | ||||
-rw-r--r-- | src/gallium/drivers/nvfx/nv04_surface_2d.c | 9 | ||||
-rw-r--r-- | src/gallium/drivers/nvfx/nvfx_miptree.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/nvfx/nvfx_screen.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/nvfx/nvfx_surface.c | 37 | ||||
-rw-r--r-- | src/gallium/drivers/nvfx/nvfx_transfer.c | 6 |
8 files changed, 72 insertions, 30 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index 233a91a2ffd..89d5ffa8aa3 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -51,8 +51,6 @@ nouveau_screen_bo_new(struct pipe_screen *pscreen, unsigned alignment, if (bind & (PIPE_BIND_RENDER_TARGET | PIPE_BIND_DEPTH_STENCIL | - PIPE_BIND_BLIT_SOURCE | - PIPE_BIND_BLIT_DESTINATION | PIPE_BIND_SCANOUT | PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SAMPLER_VIEW)) diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 2dd10424245..a8cb1e25d81 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -32,8 +32,12 @@ static boolean nv50_screen_is_format_supported(struct pipe_screen *pscreen, enum pipe_format format, enum pipe_texture_target target, + unsigned sample_count, unsigned tex_usage, unsigned geom_flags) { + if (sample_count > 1) + return FALSE; + if (tex_usage & PIPE_BIND_RENDER_TARGET) { switch (format) { case PIPE_FORMAT_B8G8R8X8_UNORM: diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index d905d95354f..40b8d255335 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -195,27 +195,40 @@ nv50_surface_do_copy(struct nv50_screen *screen, struct pipe_surface *dst, static void nv50_surface_copy(struct pipe_context *pipe, - struct pipe_surface *dest, unsigned destx, unsigned desty, - struct pipe_surface *src, unsigned srcx, unsigned srcy, + struct pipe_resource *dest, struct pipe_subresource subdst, + unsigned destx, unsigned desty, unsigned destz, + struct pipe_resource *src, struct pipe_subresource subsrc, + unsigned srcx, unsigned srcy, unsigned srcz, unsigned width, unsigned height) { struct nv50_context *nv50 = nv50_context(pipe); struct nv50_screen *screen = nv50->screen; + struct pipe_surface *ps_dst, *ps_src; assert((src->format == dest->format) || (nv50_2d_format_faithful(src->format) && nv50_2d_format_faithful(dest->format))); - nv50_surface_do_copy(screen, dest, destx, desty, src, srcx, - srcy, width, height); + ps_src = nv50_miptree_surface_new(pipe->screen, dest, subsrc.face, + subsrc.level, srcz, 0 /* bind flags */); + ps_dst = nv50_miptree_surface_new(pipe->screen, dest, subdst.face, + subdst.level, destz, 0 /* bindflags */); + + nv50_surface_do_copy(screen, ps_dst, destx, desty, ps_src, srcx, + srcy, width, height); + + nv50_miptree_surface_del(ps_src); + nv50_miptree_surface_del(ps_dst); } static void -nv50_surface_fill(struct pipe_context *pipe, struct pipe_surface *dest, - unsigned destx, unsigned desty, unsigned width, - unsigned height, unsigned value) +nv50_surface_fill(struct pipe_context *pipe, struct pipe_resource *dest, + struct pipe_subresource subdst, + unsigned destx, unsigned desty, unsigned destz, + unsigned width, unsigned height, unsigned value) { struct nv50_context *nv50 = nv50_context(pipe); + struct pipe_surface *ps; struct nv50_screen *screen = nv50->screen; struct nouveau_channel *chan = screen->eng2d->channel; struct nouveau_grobj *eng2d = screen->eng2d; @@ -225,9 +238,12 @@ nv50_surface_fill(struct pipe_context *pipe, struct pipe_surface *dest, if (format < 0) return; + ps = nv50_miptree_surface_new(pipe->screen, dest, subdst.face, + subdst.level, destz, 0 /* bind flags */); + WAIT_RING (chan, 32); - ret = nv50_surface_set(screen, dest, 1); + ret = nv50_surface_set(screen, ps, 1); if (ret) return; @@ -240,13 +256,15 @@ nv50_surface_fill(struct pipe_context *pipe, struct pipe_surface *dest, OUT_RING (chan, desty); OUT_RING (chan, width); OUT_RING (chan, height); + + nv50_miptree_surface_del(ps); } void nv50_init_surface_functions(struct nv50_context *nv50) { - nv50->pipe.surface_copy = nv50_surface_copy; - nv50->pipe.surface_fill = nv50_surface_fill; + nv50->pipe.resource_copy_region = nv50_surface_copy; + nv50->pipe.resource_fill_region = nv50_surface_fill; } diff --git a/src/gallium/drivers/nvfx/nv04_surface_2d.c b/src/gallium/drivers/nvfx/nv04_surface_2d.c index 4ed574227d6..7acbb505df3 100644 --- a/src/gallium/drivers/nvfx/nv04_surface_2d.c +++ b/src/gallium/drivers/nvfx/nv04_surface_2d.c @@ -502,12 +502,9 @@ nv04_surface_wrap_for_render(struct pipe_screen *pscreen, struct nv04_surface* temp_ns; int temp_flags; - temp_flags = (ns->base.usage | - PIPE_BIND_BLIT_SOURCE | - PIPE_BIND_BLIT_DESTINATION); + temp_flags = ns->base.usage; - ns->base.usage = (PIPE_BIND_BLIT_SOURCE | - PIPE_BIND_BLIT_DESTINATION); + ns->base.usage = 0; memset(&templ, 0, sizeof(templ)); templ.format = ns->base.texture->format; @@ -526,7 +523,7 @@ nv04_surface_wrap_for_render(struct pipe_screen *pscreen, temp_ns = (struct nv04_surface*)pscreen->get_tex_surface(pscreen, temp_tex, 0, 0, 0, temp_flags); temp_ns->backing = ns; - if(ns->base.usage & PIPE_BIND_BLIT_SOURCE) + if(1) /* hmm */ eng2d->copy(eng2d, &temp_ns->backing->base, 0, 0, &ns->base, 0, 0, ns->base.width, ns->base.height); diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c index aeb88e9ac96..b5639bb4645 100644 --- a/src/gallium/drivers/nvfx/nvfx_miptree.c +++ b/src/gallium/drivers/nvfx/nvfx_miptree.c @@ -300,7 +300,7 @@ nvfx_miptree_surface_del(struct pipe_surface *ps) if(ns->backing) { struct nvfx_screen* screen = (struct nvfx_screen*)ps->texture->screen; - if(ns->backing->base.usage & PIPE_BIND_BLIT_DESTINATION) + if(1 /*ns->backing->base.usage & PIPE_BIND_BLIT_DESTINATION*/) screen->eng2d->copy(screen->eng2d, &ns->backing->base, 0, 0, ps, 0, 0, ns->base.width, ns->base.height); nvfx_miptree_surface_del(&ns->backing->base); } diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c index 9f03ab1833b..1786af776aa 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.c +++ b/src/gallium/drivers/nvfx/nvfx_screen.c @@ -115,11 +115,15 @@ static boolean nvfx_screen_surface_format_supported(struct pipe_screen *pscreen, enum pipe_format format, enum pipe_texture_target target, + unsigned sample_count, unsigned tex_usage, unsigned geom_flags) { struct nvfx_screen *screen = nvfx_screen(pscreen); struct pipe_surface *front = ((struct nouveau_winsys *) pscreen->winsys)->front; + if (sample_count > 1) + return FALSE; + if (tex_usage & PIPE_BIND_RENDER_TARGET) { switch (format) { case PIPE_FORMAT_B8G8R8A8_UNORM: diff --git a/src/gallium/drivers/nvfx/nvfx_surface.c b/src/gallium/drivers/nvfx/nvfx_surface.c index 2e115650aeb..fc3a670d400 100644 --- a/src/gallium/drivers/nvfx/nvfx_surface.c +++ b/src/gallium/drivers/nvfx/nvfx_surface.c @@ -27,35 +27,54 @@ **************************************************************************/ #include "nvfx_context.h" +#include "nvfx_resource.h" #include "pipe/p_defines.h" #include "util/u_inlines.h" static void nvfx_surface_copy(struct pipe_context *pipe, - struct pipe_surface *dest, unsigned destx, unsigned desty, - struct pipe_surface *src, unsigned srcx, unsigned srcy, + struct pipe_resource *dest, struct pipe_subresource subdst, + unsigned destx, unsigned desty, unsigned destz, + struct pipe_resource *src, struct pipe_subresource subsrc, + unsigned srcx, unsigned srcy, unsigned srcz, unsigned width, unsigned height) { struct nvfx_context *nvfx = nvfx_context(pipe); struct nv04_surface_2d *eng2d = nvfx->screen->eng2d; + struct pipe_surface *ps_dst, *ps_src; - eng2d->copy(eng2d, dest, destx, desty, src, srcx, srcy, width, height); + ps_src = nvfx_miptree_surface_new(pipe->screen, dest, subsrc.face, + subsrc.level, srcz, 0 /* bind flags */); + ps_dst = nvfx_miptree_surface_new(pipe->screen, dest, subdst.face, + subdst.level, destz, 0 /* bindflags */); + + eng2d->copy(eng2d, ps_dst, destx, desty, ps_src, srcx, srcy, width, height); + + nvfx_miptree_surface_del(ps_src); + nvfx_miptree_surface_del(ps_dst); } static void -nvfx_surface_fill(struct pipe_context *pipe, struct pipe_surface *dest, - unsigned destx, unsigned desty, unsigned width, - unsigned height, unsigned value) +nvfx_surface_fill(struct pipe_context *pipe, struct pipe_resource *dest, + struct pipe_subresource subdst, + unsigned destx, unsigned desty, unsigned destz, + unsigned width, unsigned height, unsigned value) { struct nvfx_context *nvfx = nvfx_context(pipe); + struct pipe_surface *ps; struct nv04_surface_2d *eng2d = nvfx->screen->eng2d; - eng2d->fill(eng2d, dest, destx, desty, width, height, value); + ps = nvfx_miptree_surface_new(pipe->screen, dest, subdst.face, + subdst.level, destz, 0 /* bind flags */); + + eng2d->fill(eng2d, ps, destx, desty, width, height, value); + + nvfx_miptree_surface_del(ps); } void nvfx_init_surface_functions(struct nvfx_context *nvfx) { - nvfx->pipe.surface_copy = nvfx_surface_copy; - nvfx->pipe.surface_fill = nvfx_surface_fill; + nvfx->pipe.resource_copy_region = nvfx_surface_copy; + nvfx->pipe.resource_fill_region = nvfx_surface_fill; } diff --git a/src/gallium/drivers/nvfx/nvfx_transfer.c b/src/gallium/drivers/nvfx/nvfx_transfer.c index b2ef27cf579..9ff0a93d307 100644 --- a/src/gallium/drivers/nvfx/nvfx_transfer.c +++ b/src/gallium/drivers/nvfx/nvfx_transfer.c @@ -40,11 +40,13 @@ static unsigned nvfx_transfer_bind_flags( unsigned transfer_usage ) { unsigned bind = 0; +#if 0 if (transfer_usage & PIPE_TRANSFER_WRITE) bind |= PIPE_BIND_BLIT_SOURCE; if (transfer_usage & PIPE_TRANSFER_READ) bind |= PIPE_BIND_BLIT_DESTINATION; +#endif return bind; } @@ -128,7 +130,7 @@ nvfx_miptree_transfer_new(struct pipe_context *pipe, src = pscreen->get_tex_surface(pscreen, pt, sr.face, sr.level, box->z, - PIPE_BIND_BLIT_SOURCE); + 0 /*PIPE_BIND_BLIT_SOURCE*/); /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ /* TODO: Check if SIFM can un-swizzle */ @@ -160,7 +162,7 @@ nvfx_miptree_transfer_del(struct pipe_context *pipe, ptx->sr.face, ptx->sr.level, ptx->box.z, - PIPE_BIND_BLIT_DESTINATION); + 0 /*PIPE_BIND_BLIT_DESTINATION*/); /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ nvscreen->eng2d->copy(nvscreen->eng2d, |