From c47c73293d359c00abb34c39d1163b4c55f531de Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 10 Mar 2010 22:58:51 +0800 Subject: i915g: Prevent NULL dereference. bind_vertex_elements_state may be called with NULL velems. Do nothing if that is the case. --- src/gallium/drivers/i915/i915_state.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index 8927dfc33d..377d8425a5 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -770,7 +770,10 @@ i915_bind_vertex_elements_state(struct pipe_context *pipe, draw_flush(i915->draw); /* pass-through to draw module */ - draw_set_vertex_elements(i915->draw, i915_velems->count, i915_velems->velem); + if (i915_velems) { + draw_set_vertex_elements(i915->draw, + i915_velems->count, i915_velems->velem); + } } static void -- cgit v1.2.3 From 8c34437deda2ff8659fecdf3ea687820c9e57261 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Wed, 10 Mar 2010 16:53:07 +0100 Subject: cell: handle NULL cso vertex_elements state object on bind drivers need to handle NULL cso vertex elements (and others) objects. It is possible the cso code saves/restores NULL objects (if no normal cso object was bound before this was invoked). This led to segfaults (for example demos/cubemap) for apps which were using things like creating mipmaps before drawing anything. --- src/gallium/drivers/cell/ppu/cell_state_vertex.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/cell/ppu/cell_state_vertex.c b/src/gallium/drivers/cell/ppu/cell_state_vertex.c index d3efb8ecea..9510ea9ac2 100644 --- a/src/gallium/drivers/cell/ppu/cell_state_vertex.c +++ b/src/gallium/drivers/cell/ppu/cell_state_vertex.c @@ -62,7 +62,8 @@ cell_bind_vertex_elements_state(struct pipe_context *pipe, cell->dirty |= CELL_NEW_VERTEX; - draw_set_vertex_elements(cell->draw, cell_velems->count, cell_velems->velem); + if (cell_velems) + draw_set_vertex_elements(cell->draw, cell_velems->count, cell_velems->velem); } void -- cgit v1.2.3 From 7069dff80f25d0ac532c9f76634d1cd382d4fac1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 10 Mar 2010 13:09:00 -0700 Subject: softpipe: fix memcpy params to avoid static analysis warnings See fd.o bug 26970. Also added sanity check assertions. --- src/gallium/drivers/softpipe/sp_fs_exec.c | 7 ++++++- src/gallium/drivers/softpipe/sp_fs_sse.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c b/src/gallium/drivers/softpipe/sp_fs_exec.c index 27fa126b7c..67e2c8f8bc 100644 --- a/src/gallium/drivers/softpipe/sp_fs_exec.c +++ b/src/gallium/drivers/softpipe/sp_fs_exec.c @@ -145,8 +145,13 @@ exec_run( const struct sp_fragment_shader *base, case TGSI_SEMANTIC_COLOR: { uint cbuf = sem_index[i]; + + assert(sizeof(quad->output.color[cbuf]) == + sizeof(machine->Outputs[i])); + + /* copy float[4][4] result */ memcpy(quad->output.color[cbuf], - &machine->Outputs[i].xyzw[0].f[0], + &machine->Outputs[i], sizeof(quad->output.color[0]) ); } break; diff --git a/src/gallium/drivers/softpipe/sp_fs_sse.c b/src/gallium/drivers/softpipe/sp_fs_sse.c index acee213670..daa158df7c 100644 --- a/src/gallium/drivers/softpipe/sp_fs_sse.c +++ b/src/gallium/drivers/softpipe/sp_fs_sse.c @@ -156,8 +156,13 @@ fs_sse_run( const struct sp_fragment_shader *base, case TGSI_SEMANTIC_COLOR: { uint cbuf = sem_index[i]; + + assert(sizeof(quad->output.color[cbuf]) == + sizeof(machine->Outputs[i])); + + /* copy float[4][4] result */ memcpy(quad->output.color[cbuf], - &machine->Outputs[i].xyzw[0].f[0], + &machine->Outputs[i], sizeof(quad->output.color[0]) ); } break; -- cgit v1.2.3 From 19371fb60da8ec27a6024d0bf38b82cf3ca787e4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 10 Mar 2010 15:11:49 -0700 Subject: llvmpipe: fix loop over mipmap levels --- src/gallium/drivers/llvmpipe/lp_setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index fbe14924cb..d6d37c4809 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -475,7 +475,7 @@ lp_setup_set_sampler_textures( struct setup_context *setup, if (!lp_tex->dt) { /* regular texture - setup array of mipmap level pointers */ int j; - for (j = 0; j < LP_MAX_TEXTURE_2D_LEVELS; j++) { + for (j = 0; j <= tex->last_level; j++) { jit_tex->data[j] = (ubyte *) lp_tex->data + lp_tex->level_offset[j]; } -- cgit v1.2.3 From 4c5c442f127419d4ea780fbc60bf58f4ed17d71e Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 11 Mar 2010 11:43:04 +0000 Subject: softpipe: Dummy fence functions. --- src/gallium/drivers/softpipe/Makefile | 1 + src/gallium/drivers/softpipe/SConscript | 1 + src/gallium/drivers/softpipe/sp_fence.c | 70 ++++++++++++++++++++++++++++++++ src/gallium/drivers/softpipe/sp_fence.h | 40 ++++++++++++++++++ src/gallium/drivers/softpipe/sp_screen.c | 2 + 5 files changed, 114 insertions(+) create mode 100644 src/gallium/drivers/softpipe/sp_fence.c create mode 100644 src/gallium/drivers/softpipe/sp_fence.h (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/softpipe/Makefile b/src/gallium/drivers/softpipe/Makefile index 1c6e4ae076..239655d628 100644 --- a/src/gallium/drivers/softpipe/Makefile +++ b/src/gallium/drivers/softpipe/Makefile @@ -8,6 +8,7 @@ C_SOURCES = \ sp_fs_sse.c \ sp_buffer.c \ sp_clear.c \ + sp_fence.c \ sp_flush.c \ sp_query.c \ sp_context.c \ diff --git a/src/gallium/drivers/softpipe/SConscript b/src/gallium/drivers/softpipe/SConscript index 27ab00b036..9949a53adf 100644 --- a/src/gallium/drivers/softpipe/SConscript +++ b/src/gallium/drivers/softpipe/SConscript @@ -11,6 +11,7 @@ softpipe = env.ConvenienceLibrary( 'sp_clear.c', 'sp_context.c', 'sp_draw_arrays.c', + 'sp_fence.c', 'sp_flush.c', 'sp_prim_vbuf.c', 'sp_setup.c', diff --git a/src/gallium/drivers/softpipe/sp_fence.c b/src/gallium/drivers/softpipe/sp_fence.c new file mode 100644 index 0000000000..66c5214113 --- /dev/null +++ b/src/gallium/drivers/softpipe/sp_fence.c @@ -0,0 +1,70 @@ +/************************************************************************** + * + * Copyright 2010 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + **************************************************************************/ + + +#include "pipe/p_screen.h" +#include "util/u_debug.h" +#include "sp_fence.h" + + +static void +softpipe_fence_reference(struct pipe_screen *screen, + struct pipe_fence_handle **ptr, + struct pipe_fence_handle *fence) +{ + assert(!*ptr); + assert(!fence); +} + + +static int +softpipe_fence_signalled(struct pipe_screen *screen, + struct pipe_fence_handle *fence, + unsigned flags) +{ + assert(!fence); + return 0; +} + + +static int +softpipe_fence_finish(struct pipe_screen *screen, + struct pipe_fence_handle *fence, + unsigned flags) +{ + assert(!fence); + return 0; +} + + +void +softpipe_init_screen_fence_funcs(struct pipe_screen *screen) +{ + screen->fence_reference = softpipe_fence_reference; + screen->fence_finish = softpipe_fence_finish; + screen->fence_signalled = softpipe_fence_signalled; +} diff --git a/src/gallium/drivers/softpipe/sp_fence.h b/src/gallium/drivers/softpipe/sp_fence.h new file mode 100644 index 0000000000..39c33243bd --- /dev/null +++ b/src/gallium/drivers/softpipe/sp_fence.h @@ -0,0 +1,40 @@ +/************************************************************************** + * + * Copyright 2010 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + **************************************************************************/ + + +#ifndef SP_FENCE_H_ +#define SP_FENCE_H_ + + +struct pipe_screen; + + +void +softpipe_init_screen_fence_funcs(struct pipe_screen *screen); + + +#endif /* SP_FENCE_H_ */ diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index e0a2ef604e..d62bfa3d63 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -36,6 +36,7 @@ #include "sp_screen.h" #include "sp_context.h" #include "sp_buffer.h" +#include "sp_fence.h" #include "sp_public.h" @@ -239,6 +240,7 @@ softpipe_create_screen(struct sw_winsys *winsys) softpipe_init_screen_texture_funcs(&screen->base); softpipe_init_screen_buffer_funcs(&screen->base); + softpipe_init_screen_fence_funcs(&screen->base); return &screen->base; } -- cgit v1.2.3 From b43c182f19c6291c88420fa12714f952c2b461fb Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 11 Mar 2010 15:23:16 +0000 Subject: Squashed commit of gallium-context-transfers: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit 7a2ee04629681e59ea147b440856c4f9a33ae9f8 Author: Keith Whitwell Date: Thu Mar 11 14:19:17 2010 +0000 nv: convert to context transfers commit 188a3f5331c8e5966729fd59d02975afb7324adc Author: Keith Whitwell Date: Thu Mar 11 14:11:10 2010 +0000 nouveau: remove unused variable commit 5c8e880ab4dc020358c08728b8adb1637d2dc5bc Author: Keith Whitwell Date: Thu Mar 11 12:31:21 2010 +0000 mesa/st: fix compilation after merge commit c552595333f860c2a4807e195596acdf5d6a5ef8 Author: Keith Whitwell Date: Thu Mar 11 12:31:06 2010 +0000 util: fix compilation after merge commit e80836878a3617b0e350d2a8f92311832a1476cb Author: Keith Whitwell Date: Thu Mar 11 12:30:47 2010 +0000 r300g: fix compilation after merge commit 0e4883e9511b9db4e75a4dbc78d7bb970badc15d Author: Keith Whitwell Date: Thu Mar 11 12:18:45 2010 +0000 i965g: fix incorrect merge commit 17d74133d8168eebf93bf1390de79930fc8da231 Merge: cb81c79 aa311ae Author: Keith Whitwell Date: Thu Mar 11 12:08:32 2010 +0000 Merge commit 'origin/master' into gallium-context-transfers Conflicts: src/gallium/drivers/i965/brw_screen_texture.c src/gallium/drivers/r300/r300_screen.c src/gallium/drivers/softpipe/sp_texture.c src/gallium/drivers/svga/svga_screen_texture.c src/gallium/state_trackers/egl/x11/native_ximage.c commit cb81c79098bc3a92a4d2a3dcc0edc972dfb407be Author: Keith Whitwell Date: Tue Mar 2 16:04:01 2010 +0000 egl/x11: hack for context transfers There is a better approach to this in the winsys-handle branch, but for now avoid using transfers at all by always allocating our own backing store directly. commit f44a24e1d4ad7563f3eedd6b3a5688f53a36265c Author: Keith Whitwell Date: Tue Mar 2 16:03:16 2010 +0000 llvmpipe: context transfers commit 4d7475ef8104b3b478c7c6ce77cd3506c57e25d1 Author: Keith Whitwell Date: Tue Mar 2 16:02:50 2010 +0000 llvmpipe: disable testprogs build Not working. commit a9bf98c4d36bd92a76f81e83747eb9b8f0a0515f Merge: ee0f97e 0c616da Author: Keith Whitwell Date: Tue Mar 2 15:28:25 2010 +0000 Merge commit 'origin/master' into gallium-context-transfers Conflicts: src/mesa/state_tracker/st_cb_accum.c src/mesa/state_tracker/st_cb_bitmap.c commit ee0f97e8d9fd5ef57211a8e1268f505c9829e246 Merge: a7f078e 828f545 Author: Keith Whitwell Date: Fri Feb 19 13:00:29 2010 +0000 Merge commit 'origin/master' into gallium-context-transfers Conflicts: src/gallium/auxiliary/util/u_debug.h src/gallium/drivers/i915/i915_context.h src/gallium/drivers/llvmpipe/lp_flush.c src/gallium/drivers/nv30/nv30_screen.h src/gallium/drivers/nv40/nv40_context.h src/gallium/drivers/nv40/nv40_screen.h src/gallium/drivers/nv50/nv50_context.h src/gallium/drivers/r300/r300_screen.c src/gallium/drivers/r300/r300_winsys.h src/gallium/drivers/softpipe/sp_context.c src/gallium/drivers/trace/tr_context.c src/gallium/state_trackers/dri/dri_context.c src/gallium/state_trackers/egl/common/egl_g3d.c src/gallium/state_trackers/python/st_device.c src/gallium/winsys/drm/radeon/core/radeon_drm.c commit a7f078e16d851b53ef316066dcced46eb39ebe24 Author: Keith Whitwell Date: Fri Feb 5 14:16:11 2010 +0000 gallium: move texture transfers to pipe_context commit 7b2ffc2019d72e833afea7eebf3e80121187375d Merge: 51e190e c036d13 Author: Keith Whitwell Date: Fri Feb 5 09:55:02 2010 +0000 Merge commit 'origin/master' into gallium-screen-context Conflicts: src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c This branch has got a pretty tortured history now, I expect a squash merge will be appropriate when it is done. commit 51e190e95acf120f72768fafb29e9721e358df1b Author: Keith Whitwell Date: Thu Feb 4 17:58:02 2010 +0000 gallium: fix some build issues commit f524bdaa723fb181637ad30c6ad708aeedabe25b Merge: f906212 3aba0a2 Author: Keith Whitwell Date: Thu Feb 4 17:51:32 2010 +0000 Merge commit 'origin/master' into gallium-screen-context commit f9062126883199eabf045714c717cd35f4b7b313 Author: Keith Whitwell Date: Thu Feb 4 17:17:12 2010 +0000 gallium/docs: small description of screen::create_context commit efcb37bd3d5ed37f06c6105bd2d750b374ec0927 Author: Keith Whitwell Date: Thu Feb 4 16:42:42 2010 +0000 drm/radeon: more dead create_context wrapper removal commit 6badc0dd9e06cf2ec936940bcf12b9ef5324b301 Author: Keith Whitwell Date: Thu Feb 4 16:42:30 2010 +0000 drm/i965: more dead create_context wrapper removal commit cf04ebd5a54b18b2d894cfdab2b0f2fd55626ffc Author: Keith Whitwell Date: Thu Feb 4 16:42:05 2010 +0000 st/python: more dead create_context wrapper removal commit 444f114c3516abf71c430e6e9d0d2ae3b80679d3 Author: Keith Whitwell Date: Thu Feb 4 16:37:58 2010 +0000 idenity: wrapped context creation commit 5a6d09cb9e468d1ee6c8d54b887618819d8d94f2 Author: Keith Whitwell Date: Thu Feb 4 16:28:47 2010 +0000 ws/gdi: remove dead context_create wrapper commit 132b55f4bec39386ac625f09aaa11f609664024c Author: Keith Whitwell Date: Thu Feb 4 16:27:52 2010 +0000 ws/gdi: remove dead context_create wrapper commit 56d2d21a0cdcb197a364049d354c2f15a4fc026a Author: Keith Whitwell Date: Thu Feb 4 16:25:38 2010 +0000 st/xorg: use screen::context_create commit 838c5cfe56b2af6c644909bed3c5e7cdd64c336a Author: Keith Whitwell Date: Thu Feb 4 16:23:20 2010 +0000 glx/xlib: simplify creation of trace-wrapped contexts Trace screen knows how to properly wrap context creation in the wrapped screen, so nothing special to do here. commit c99404c03ebaec4175f08a2f363e43c9085f2635 Author: Keith Whitwell Date: Thu Feb 4 16:18:24 2010 +0000 st/python: no need to special case context creation for trace commit 193a527a682b6877bb1faecd8092df4dfd055a18 Author: Keith Whitwell Date: Thu Feb 4 16:15:30 2010 +0000 drm/radeon: remove dead create_context declaration commit bb984eecc25cf23bc77e1c818b81165ba1a07c9a Author: Keith Whitwell Date: Thu Feb 4 16:14:58 2010 +0000 nv/drm: remove dead create_context ref commit e809313a44287dc4e16c28e9e74ef3b2b5271aa1 Author: Keith Whitwell Date: Thu Feb 4 16:12:51 2010 +0000 st/egl: remove a layer of wrappers around screen::create_context commit 39caa6672a04122f185c22e17aab86d1c40938bf Author: Keith Whitwell Date: Thu Feb 4 16:05:28 2010 +0000 r300g: fill in screen::context_create commit 407f12556d16ba0656774d8a1d9ebda22f82f473 Author: Keith Whitwell Date: Thu Feb 4 16:04:04 2010 +0000 cell: adapt for screen::create_context, untested commit d02b0c6ce321a04c76fdabb09e0e4380ce1c1376 Author: Keith Whitwell Date: Thu Feb 4 15:50:24 2010 +0000 drm/nv: adapt for screen::create_context All contexts now created directly through the screen, so remove equivalent code here. Remove apparently un-needed array of contexts in the winsys. commit 53eec5b1349aa1b6892a75a7bff7e7530957aeae Author: Keith Whitwell Date: Thu Feb 4 15:50:08 2010 +0000 stw: adapt for screen::create_context, untested commit c6a64de3eb381bc9a88e9fbdecbf87d77925aaf5 Author: Keith Whitwell Date: Thu Feb 4 15:49:20 2010 +0000 trace: expose the wrapped context's priv data If we are going to keep this priv idea, really want an accessor function for it so that trace and other drivers can wrap that. commit 75d6104e11d86ec2b0749627ed58e35f856ee6eb Author: Keith Whitwell Date: Thu Feb 4 15:47:55 2010 +0000 nv30: adapt to screen::context_create commit 12f5deb6ed9723e9b5d34577052b8365813ca14e Author: Keith Whitwell Date: Thu Feb 4 15:44:47 2010 +0000 nv40: adapt to screen::context_create commit 14baccaa3b6bbb3b91056126f6521828e786dc62 Author: Keith Whitwell Date: Thu Feb 4 15:35:27 2010 +0000 nv50: adapt to screen::create_context Not build tested. Need to figure out how to build nouveau. commit a0e94505ccd2d7f3e604465a2ac302f1286b73b6 Author: Keith Whitwell Date: Thu Feb 4 15:22:27 2010 +0000 llvmpipe: update for screen::create_context, untested commit 0eae17107c950346030e4f7e0ec232f868d3893d Author: Keith Whitwell Date: Thu Feb 4 15:16:57 2010 +0000 xlib/llvmpipe: remove dead winsys context creation path commit 2f69f9ffaa7e2a01d2483277246ed13051ae4ca3 Author: Keith Whitwell Date: Thu Feb 4 14:58:27 2010 +0000 gallium: convert most code to use screen::create_context I wish I could build all of gallium at once to find breakages. commit d7b57f4061b82322cbcae176125913d9f0dea6c1 Author: Keith Whitwell Date: Thu Feb 4 12:46:21 2010 +0000 glx: permit building with older protocol headers I'd like to be able to build mesa on current distro releases without having to upgrade from the standard dri2proto and glproto headers. With this change I'm able to build on ancient releases such as Ubuntu 9-10... In general, it would be nice to be able to build-test mesa to check for unintended breakages without having to follow the external dependencies of every group working on the codebase. commit 57adedd6fb06c98572ed8d4aef19203df4c4eea2 Merge: da71847 e1906ae Author: Keith Whitwell Date: Thu Feb 4 11:38:15 2010 +0000 Merge commit 'origin/master' into gallium-screen-context Conflicts: src/gallium/drivers/softpipe/sp_video_context.h src/gallium/drivers/trace/tr_context.c src/gallium/state_trackers/wgl/shared/stw_context.c src/gallium/winsys/gdi/gdi_softpipe_winsys.c commit da71847ea6414d7e352c6094f8963bb4eda344dc Author: José Fonseca Date: Sat May 2 08:57:39 2009 +0100 wgl: Use pipe_screen::context_create. commit 2595a188f93fd903600ef5d8517737ee0592035d Author: José Fonseca Date: Sat May 2 08:56:47 2009 +0100 trace: Implement pipe_screen::context_create. commit f3640e4ae37a5260cbfba999d079f827de0a313a Author: José Fonseca Date: Sat May 2 08:56:17 2009 +0100 softpipe: Implement pipe_screen::context_create. commit 347266bddc8bd39c711bacb2193793759d0f3696 Author: José Fonseca Date: Sat May 2 08:55:31 2009 +0100 gallium: New pipe_screen::context_create callback. --- src/gallium/auxiliary/draw/draw_pipe_aaline.c | 8 +- src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 14 ++- src/gallium/auxiliary/util/u_debug.c | 44 ++++---- src/gallium/auxiliary/util/u_debug.h | 14 ++- src/gallium/auxiliary/util/u_gen_mipmap.c | 50 ++++----- src/gallium/auxiliary/util/u_inlines.h | 12 +- src/gallium/auxiliary/util/u_rect.c | 26 ++--- src/gallium/auxiliary/util/u_tile.c | 24 ++-- src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 10 +- src/gallium/drivers/i915/i915_context.c | 1 + src/gallium/drivers/i915/i915_context.h | 6 + src/gallium/drivers/i915/i915_texture.c | 23 ++-- src/gallium/drivers/i965/brw_screen.h | 5 +- src/gallium/drivers/i965/brw_screen_texture.c | 25 +++-- src/gallium/drivers/identity/id_context.c | 72 ++++++++++++ src/gallium/drivers/identity/id_objects.c | 10 +- src/gallium/drivers/identity/id_objects.h | 4 +- src/gallium/drivers/identity/id_screen.c | 69 ------------ src/gallium/drivers/llvmpipe/Makefile | 6 +- src/gallium/drivers/llvmpipe/lp_context.c | 1 + src/gallium/drivers/llvmpipe/lp_flush.c | 4 +- src/gallium/drivers/llvmpipe/lp_scene.c | 20 ++-- src/gallium/drivers/llvmpipe/lp_texture.c | 25 +++-- src/gallium/drivers/llvmpipe/lp_texture.h | 2 + src/gallium/drivers/nouveau/nv04_surface_2d.c | 1 - src/gallium/drivers/nv30/nv30_context.c | 1 + src/gallium/drivers/nv30/nv30_context.h | 1 + src/gallium/drivers/nv30/nv30_screen.c | 1 - src/gallium/drivers/nv30/nv30_screen.h | 3 - src/gallium/drivers/nv30/nv30_transfer.c | 19 ++-- src/gallium/drivers/nv40/nv40_context.c | 1 + src/gallium/drivers/nv40/nv40_context.h | 1 + src/gallium/drivers/nv40/nv40_screen.c | 1 - src/gallium/drivers/nv40/nv40_screen.h | 3 - src/gallium/drivers/nv40/nv40_transfer.c | 19 ++-- src/gallium/drivers/nv50/nv50_context.c | 1 + src/gallium/drivers/nv50/nv50_context.h | 1 + src/gallium/drivers/nv50/nv50_transfer.c | 17 +-- src/gallium/drivers/r300/r300_context.c | 3 + src/gallium/drivers/r300/r300_context.h | 1 + src/gallium/drivers/r300/r300_screen.c | 4 +- src/gallium/drivers/r300/r300_transfer.c | 39 ++++--- src/gallium/drivers/r300/r300_transfer.h | 4 +- src/gallium/drivers/softpipe/sp_context.c | 10 +- src/gallium/drivers/softpipe/sp_flush.c | 4 +- src/gallium/drivers/softpipe/sp_tex_tile_cache.c | 30 ++--- src/gallium/drivers/softpipe/sp_tex_tile_cache.h | 4 +- src/gallium/drivers/softpipe/sp_texture.c | 27 +++-- src/gallium/drivers/softpipe/sp_texture.h | 3 + src/gallium/drivers/softpipe/sp_tile_cache.c | 26 ++--- src/gallium/drivers/softpipe/sp_tile_cache.h | 4 +- src/gallium/drivers/svga/svga_screen_texture.c | 45 +++++--- src/gallium/drivers/svga/svga_screen_texture.h | 3 + src/gallium/drivers/trace/tr_context.c | 136 +++++++++++++++++++++++ src/gallium/drivers/trace/tr_rbug.c | 16 +-- src/gallium/drivers/trace/tr_screen.c | 136 +---------------------- src/gallium/drivers/trace/tr_screen.h | 1 + src/gallium/drivers/trace/tr_texture.c | 13 ++- src/gallium/drivers/trace/tr_texture.h | 6 +- src/gallium/include/pipe/p_context.h | 26 +++++ src/gallium/include/pipe/p_screen.h | 17 --- src/gallium/include/pipe/p_state.h | 2 + src/gallium/state_trackers/vega/api_filters.c | 14 +-- src/gallium/state_trackers/vega/api_images.c | 5 +- src/gallium/state_trackers/vega/image.c | 13 +-- src/gallium/state_trackers/vega/paint.c | 6 +- src/gallium/state_trackers/vega/st_inlines.h | 9 +- src/mesa/state_tracker/st_atom_pixeltransfer.c | 7 +- src/mesa/state_tracker/st_cb_accum.c | 9 +- src/mesa/state_tracker/st_cb_bitmap.c | 23 ++-- src/mesa/state_tracker/st_cb_drawpixels.c | 30 +++-- src/mesa/state_tracker/st_cb_readpixels.c | 20 ++-- src/mesa/state_tracker/st_cb_texture.c | 19 ++-- src/mesa/state_tracker/st_gen_mipmap.c | 13 +-- src/mesa/state_tracker/st_inlines.h | 10 +- src/mesa/state_tracker/st_texture.c | 17 ++- 76 files changed, 690 insertions(+), 610 deletions(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index 8f6ca15dfa..2cb76b25ae 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -422,9 +422,9 @@ aaline_create_texture(struct aaline_stage *aaline) /* This texture is new, no need to flush. */ - transfer = screen->get_tex_transfer(screen, aaline->texture, 0, level, 0, + transfer = pipe->get_tex_transfer(pipe, aaline->texture, 0, level, 0, PIPE_TRANSFER_WRITE, 0, 0, size, size); - data = screen->transfer_map(screen, transfer); + data = pipe->transfer_map(pipe, transfer); if (data == NULL) return FALSE; @@ -448,8 +448,8 @@ aaline_create_texture(struct aaline_stage *aaline) } /* unmap */ - screen->transfer_unmap(screen, transfer); - screen->tex_transfer_destroy(transfer); + pipe->transfer_unmap(pipe, transfer); + pipe->tex_transfer_destroy(transfer); } return TRUE; } diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index d0d99aa331..479777e807 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -374,19 +374,21 @@ pstip_update_texture(struct pstip_stage *pstip) { static const uint bit31 = 1 << 31; struct pipe_context *pipe = pstip->pipe; - struct pipe_screen *screen = pipe->screen; struct pipe_transfer *transfer; const uint *stipple = pstip->state.stipple->stipple; uint i, j; ubyte *data; /* XXX: want to avoid flushing just because we use stipple: + * + * Flush should no longer be necessary if driver is properly + * interleaving drawing and transfers on a given context: */ pipe->flush( pipe, PIPE_FLUSH_TEXTURE_CACHE, NULL ); - transfer = screen->get_tex_transfer(screen, pstip->texture, 0, 0, 0, - PIPE_TRANSFER_WRITE, 0, 0, 32, 32); - data = screen->transfer_map(screen, transfer); + transfer = pipe->get_tex_transfer(pipe, pstip->texture, 0, 0, 0, + PIPE_TRANSFER_WRITE, 0, 0, 32, 32); + data = pipe->transfer_map(pipe, transfer); /* * Load alpha texture. @@ -408,8 +410,8 @@ pstip_update_texture(struct pstip_stage *pstip) } /* unmap */ - screen->transfer_unmap(screen, transfer); - screen->tex_transfer_destroy(transfer); + pipe->transfer_unmap(pipe, transfer); + pipe->tex_transfer_destroy(transfer); } diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index 94be682c4b..de775a2dbc 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -421,26 +421,31 @@ void debug_dump_image(const char *prefix, #endif } -void debug_dump_surface(const char *prefix, +void debug_dump_surface(struct pipe_context *pipe, + const char *prefix, struct pipe_surface *surface) { struct pipe_texture *texture; - struct pipe_screen *screen; struct pipe_transfer *transfer; void *data; if (!surface) return; + /* XXX: this doesn't necessarily work, as the driver may be using + * temporary storage for the surface which hasn't been propagated + * back into the texture. Need to nail down the semantics of views + * and transfers a bit better before we can say if extra work needs + * to be done here: + */ texture = surface->texture; - screen = texture->screen; - transfer = screen->get_tex_transfer(screen, texture, surface->face, - surface->level, surface->zslice, - PIPE_TRANSFER_READ, 0, 0, surface->width, - surface->height); + transfer = pipe->get_tex_transfer(pipe, texture, surface->face, + surface->level, surface->zslice, + PIPE_TRANSFER_READ, 0, 0, surface->width, + surface->height); - data = screen->transfer_map(screen, transfer); + data = pipe->transfer_map(pipe, transfer); if(!data) goto error; @@ -452,13 +457,14 @@ void debug_dump_surface(const char *prefix, transfer->stride, data); - screen->transfer_unmap(screen, transfer); + pipe->transfer_unmap(pipe, transfer); error: - screen->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(transfer); } -void debug_dump_texture(const char *prefix, +void debug_dump_texture(struct pipe_context *pipe, + const char *prefix, struct pipe_texture *texture) { struct pipe_surface *surface; @@ -473,7 +479,7 @@ void debug_dump_texture(const char *prefix, surface = screen->get_tex_surface(screen, texture, 0, 0, 0, PIPE_TEXTURE_USAGE_SAMPLER); if (surface) { - debug_dump_surface(prefix, surface); + debug_dump_surface(pipe, prefix, surface); screen->tex_surface_destroy(surface); } } @@ -511,22 +517,22 @@ struct bmp_rgb_quad { }; void -debug_dump_surface_bmp(const char *filename, +debug_dump_surface_bmp(struct pipe_context *pipe, + const char *filename, struct pipe_surface *surface) { #ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT struct pipe_transfer *transfer; struct pipe_texture *texture = surface->texture; - struct pipe_screen *screen = texture->screen; - transfer = screen->get_tex_transfer(screen, texture, surface->face, - surface->level, surface->zslice, - PIPE_TRANSFER_READ, 0, 0, surface->width, - surface->height); + transfer = pipe->get_tex_transfer(pipe, texture, surface->face, + surface->level, surface->zslice, + PIPE_TRANSFER_READ, 0, 0, surface->width, + surface->height); debug_dump_transfer_bmp(filename, transfer); - screen->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(transfer); #endif } diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h index 0f4768f344..a383837743 100644 --- a/src/gallium/auxiliary/util/u_debug.h +++ b/src/gallium/auxiliary/util/u_debug.h @@ -312,6 +312,7 @@ debug_memory_end(unsigned long beginning); #ifdef DEBUG +struct pipe_context; struct pipe_surface; struct pipe_transfer; struct pipe_texture; @@ -321,11 +322,14 @@ void debug_dump_image(const char *prefix, unsigned width, unsigned height, unsigned stride, const void *data); -void debug_dump_surface(const char *prefix, +void debug_dump_surface(struct pipe_context *pipe, + const char *prefix, struct pipe_surface *surface); -void debug_dump_texture(const char *prefix, +void debug_dump_texture(struct pipe_context *pipe, + const char *prefix, struct pipe_texture *texture); -void debug_dump_surface_bmp(const char *filename, +void debug_dump_surface_bmp(struct pipe_context *pipe, + const char *filename, struct pipe_surface *surface); void debug_dump_transfer_bmp(const char *filename, struct pipe_transfer *transfer); @@ -334,8 +338,8 @@ void debug_dump_float_rgba_bmp(const char *filename, float *rgba, unsigned stride); #else #define debug_dump_image(prefix, format, cpp, width, height, stride, data) ((void)0) -#define debug_dump_surface(prefix, surface) ((void)0) -#define debug_dump_surface_bmp(filename, surface) ((void)0) +#define debug_dump_surface(pipe, prefix, surface) ((void)0) +#define debug_dump_surface_bmp(pipe, filename, surface) ((void)0) #define debug_dump_transfer_bmp(filename, transfer) ((void)0) #define debug_dump_float_rgba_bmp(filename, width, height, rgba, stride) ((void)0) #endif diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index d421bee8ef..46fbde3f4a 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -1119,7 +1119,6 @@ make_1d_mipmap(struct gen_mipmap_state *ctx, uint face, uint baseLevel, uint lastLevel) { struct pipe_context *pipe = ctx->pipe; - struct pipe_screen *screen = pipe->screen; const uint zslice = 0; uint dstLevel; @@ -1128,27 +1127,27 @@ make_1d_mipmap(struct gen_mipmap_state *ctx, struct pipe_transfer *srcTrans, *dstTrans; void *srcMap, *dstMap; - srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice, + srcTrans = pipe->get_tex_transfer(pipe, pt, face, srcLevel, zslice, PIPE_TRANSFER_READ, 0, 0, u_minify(pt->width0, srcLevel), u_minify(pt->height0, srcLevel)); - dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice, + dstTrans = pipe->get_tex_transfer(pipe, pt, face, dstLevel, zslice, PIPE_TRANSFER_WRITE, 0, 0, u_minify(pt->width0, dstLevel), u_minify(pt->height0, dstLevel)); - srcMap = (ubyte *) screen->transfer_map(screen, srcTrans); - dstMap = (ubyte *) screen->transfer_map(screen, dstTrans); + srcMap = (ubyte *) pipe->transfer_map(pipe, srcTrans); + dstMap = (ubyte *) pipe->transfer_map(pipe, dstTrans); reduce_1d(pt->format, srcTrans->width, srcMap, dstTrans->width, dstMap); - screen->transfer_unmap(screen, srcTrans); - screen->transfer_unmap(screen, dstTrans); + pipe->transfer_unmap(pipe, srcTrans); + pipe->transfer_unmap(pipe, dstTrans); - screen->tex_transfer_destroy(srcTrans); - screen->tex_transfer_destroy(dstTrans); + pipe->tex_transfer_destroy(srcTrans); + pipe->tex_transfer_destroy(dstTrans); } } @@ -1159,7 +1158,6 @@ make_2d_mipmap(struct gen_mipmap_state *ctx, uint face, uint baseLevel, uint lastLevel) { struct pipe_context *pipe = ctx->pipe; - struct pipe_screen *screen = pipe->screen; const uint zslice = 0; uint dstLevel; @@ -1171,17 +1169,17 @@ make_2d_mipmap(struct gen_mipmap_state *ctx, struct pipe_transfer *srcTrans, *dstTrans; ubyte *srcMap, *dstMap; - srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice, + srcTrans = pipe->get_tex_transfer(pipe, pt, face, srcLevel, zslice, PIPE_TRANSFER_READ, 0, 0, u_minify(pt->width0, srcLevel), u_minify(pt->height0, srcLevel)); - dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice, + dstTrans = pipe->get_tex_transfer(pipe, pt, face, dstLevel, zslice, PIPE_TRANSFER_WRITE, 0, 0, u_minify(pt->width0, dstLevel), u_minify(pt->height0, dstLevel)); - srcMap = (ubyte *) screen->transfer_map(screen, srcTrans); - dstMap = (ubyte *) screen->transfer_map(screen, dstTrans); + srcMap = (ubyte *) pipe->transfer_map(pipe, srcTrans); + dstMap = (ubyte *) pipe->transfer_map(pipe, dstTrans); reduce_2d(pt->format, srcTrans->width, srcTrans->height, @@ -1189,11 +1187,11 @@ make_2d_mipmap(struct gen_mipmap_state *ctx, dstTrans->width, dstTrans->height, dstTrans->stride, dstMap); - screen->transfer_unmap(screen, srcTrans); - screen->transfer_unmap(screen, dstTrans); + pipe->transfer_unmap(pipe, srcTrans); + pipe->transfer_unmap(pipe, dstTrans); - screen->tex_transfer_destroy(srcTrans); - screen->tex_transfer_destroy(dstTrans); + pipe->tex_transfer_destroy(srcTrans); + pipe->tex_transfer_destroy(dstTrans); } } @@ -1216,17 +1214,17 @@ make_3d_mipmap(struct gen_mipmap_state *ctx, struct pipe_transfer *srcTrans, *dstTrans; ubyte *srcMap, *dstMap; - srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice, + srcTrans = pipe->get_tex_transfer(pipe, pt, face, srcLevel, zslice, PIPE_TRANSFER_READ, 0, 0, u_minify(pt->width0, srcLevel), u_minify(pt->height0, srcLevel)); - dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice, + dstTrans = pipe->get_tex_transfer(pipe, pt, face, dstLevel, zslice, PIPE_TRANSFER_WRITE, 0, 0, u_minify(pt->width0, dstLevel), u_minify(pt->height0, dstLevel)); - srcMap = (ubyte *) screen->transfer_map(screen, srcTrans); - dstMap = (ubyte *) screen->transfer_map(screen, dstTrans); + srcMap = (ubyte *) pipe->transfer_map(pipe, srcTrans); + dstMap = (ubyte *) pipe->transfer_map(pipe, dstTrans); reduce_3d(pt->format, srcTrans->width, srcTrans->height, @@ -1234,11 +1232,11 @@ make_3d_mipmap(struct gen_mipmap_state *ctx, dstTrans->width, dstTrans->height, dstTrans->stride, dstMap); - screen->transfer_unmap(screen, srcTrans); - screen->transfer_unmap(screen, dstTrans); + pipe->transfer_unmap(pipe, srcTrans); + pipe->transfer_unmap(pipe, dstTrans); - screen->tex_transfer_destroy(srcTrans); - screen->tex_transfer_destroy(dstTrans); + pipe->tex_transfer_destroy(srcTrans); + pipe->tex_transfer_destroy(dstTrans); } #else (void) reduce_3d; diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index 0cb3432c6e..ada31b8182 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -266,22 +266,22 @@ pipe_buffer_read(struct pipe_screen *screen, static INLINE void * pipe_transfer_map( struct pipe_transfer *transf ) { - struct pipe_screen *screen = transf->texture->screen; - return screen->transfer_map(screen, transf); + struct pipe_context *context = transf->pipe; + return context->transfer_map(context, transf); } static INLINE void pipe_transfer_unmap( struct pipe_transfer *transf ) { - struct pipe_screen *screen = transf->texture->screen; - screen->transfer_unmap(screen, transf); + struct pipe_context *context = transf->pipe; + context->transfer_unmap(context, transf); } static INLINE void pipe_transfer_destroy( struct pipe_transfer *transf ) { - struct pipe_screen *screen = transf->texture->screen; - screen->tex_transfer_destroy(transf); + struct pipe_context *context = transf->pipe; + context->tex_transfer_destroy(transf); } static INLINE unsigned diff --git a/src/gallium/auxiliary/util/u_rect.c b/src/gallium/auxiliary/util/u_rect.c index 8479161c74..0b8405d01f 100644 --- a/src/gallium/auxiliary/util/u_rect.c +++ b/src/gallium/auxiliary/util/u_rect.c @@ -169,7 +169,6 @@ util_surface_copy(struct pipe_context *pipe, unsigned src_x, unsigned src_y, unsigned w, unsigned h) { - struct pipe_screen *screen = pipe->screen; struct pipe_transfer *src_trans, *dst_trans; void *dst_map; const void *src_map; @@ -182,7 +181,7 @@ util_surface_copy(struct pipe_context *pipe, src_format = src->texture->format; dst_format = dst->texture->format; - src_trans = screen->get_tex_transfer(screen, + src_trans = pipe->get_tex_transfer(pipe, src->texture, src->face, src->level, @@ -190,7 +189,7 @@ util_surface_copy(struct pipe_context *pipe, PIPE_TRANSFER_READ, src_x, src_y, w, h); - dst_trans = screen->get_tex_transfer(screen, + dst_trans = pipe->get_tex_transfer(pipe, dst->texture, dst->face, dst->level, @@ -202,8 +201,8 @@ util_surface_copy(struct pipe_context *pipe, assert(util_format_get_blockwidth(dst_format) == util_format_get_blockwidth(src_format)); assert(util_format_get_blockheight(dst_format) == util_format_get_blockheight(src_format)); - src_map = pipe->screen->transfer_map(screen, src_trans); - dst_map = pipe->screen->transfer_map(screen, dst_trans); + src_map = pipe->transfer_map(pipe, src_trans); + dst_map = pipe->transfer_map(pipe, dst_trans); assert(src_map); assert(dst_map); @@ -221,11 +220,11 @@ util_surface_copy(struct pipe_context *pipe, do_flip ? h - 1 : 0); } - pipe->screen->transfer_unmap(pipe->screen, src_trans); - pipe->screen->transfer_unmap(pipe->screen, dst_trans); + pipe->transfer_unmap(pipe, src_trans); + pipe->transfer_unmap(pipe, dst_trans); - screen->tex_transfer_destroy(src_trans); - screen->tex_transfer_destroy(dst_trans); + pipe->tex_transfer_destroy(src_trans); + pipe->tex_transfer_destroy(dst_trans); } @@ -243,14 +242,13 @@ util_surface_fill(struct pipe_context *pipe, unsigned dstx, unsigned dsty, unsigned width, unsigned height, unsigned value) { - struct pipe_screen *screen = pipe->screen; struct pipe_transfer *dst_trans; void *dst_map; assert(dst->texture); if (!dst->texture) return; - dst_trans = screen->get_tex_transfer(screen, + dst_trans = pipe->get_tex_transfer(pipe, dst->texture, dst->face, dst->level, @@ -258,7 +256,7 @@ util_surface_fill(struct pipe_context *pipe, PIPE_TRANSFER_WRITE, dstx, dsty, width, height); - dst_map = pipe->screen->transfer_map(screen, dst_trans); + dst_map = pipe->transfer_map(pipe, dst_trans); assert(dst_map); @@ -302,6 +300,6 @@ util_surface_fill(struct pipe_context *pipe, } } - pipe->screen->transfer_unmap(pipe->screen, dst_trans); - screen->tex_transfer_destroy(dst_trans); + pipe->transfer_unmap(pipe, dst_trans); + pipe->tex_transfer_destroy(dst_trans); } diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index 79481b710b..70a6d97385 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -49,7 +49,7 @@ pipe_get_tile_raw(struct pipe_transfer *pt, uint x, uint y, uint w, uint h, void *dst, int dst_stride) { - struct pipe_screen *screen = pt->texture->screen; + struct pipe_context *pipe = pt->pipe; const void *src; if (dst_stride == 0) @@ -58,14 +58,14 @@ pipe_get_tile_raw(struct pipe_transfer *pt, if (pipe_clip_tile(x, y, &w, &h, pt)) return; - src = screen->transfer_map(screen, pt); + src = pipe->transfer_map(pipe, pt); assert(src); if(!src) return; util_copy_rect(dst, pt->texture->format, dst_stride, 0, 0, w, h, src, pt->stride, x, y); - screen->transfer_unmap(screen, pt); + pipe->transfer_unmap(pipe, pt); } @@ -77,7 +77,7 @@ pipe_put_tile_raw(struct pipe_transfer *pt, uint x, uint y, uint w, uint h, const void *src, int src_stride) { - struct pipe_screen *screen = pt->texture->screen; + struct pipe_context *pipe = pt->pipe; void *dst; enum pipe_format format = pt->texture->format; @@ -87,14 +87,14 @@ pipe_put_tile_raw(struct pipe_transfer *pt, if (pipe_clip_tile(x, y, &w, &h, pt)) return; - dst = screen->transfer_map(screen, pt); + dst = pipe->transfer_map(pipe, pt); assert(dst); if(!dst) return; util_copy_rect(dst, format, pt->stride, x, y, w, h, src, src_stride, 0, 0); - screen->transfer_unmap(screen, pt); + pipe->transfer_unmap(pipe, pt); } @@ -1377,7 +1377,7 @@ pipe_get_tile_z(struct pipe_transfer *pt, uint x, uint y, uint w, uint h, uint *z) { - struct pipe_screen *screen = pt->texture->screen; + struct pipe_context *pipe = pt->pipe; const uint dstStride = w; ubyte *map; uint *pDest = z; @@ -1387,7 +1387,7 @@ pipe_get_tile_z(struct pipe_transfer *pt, if (pipe_clip_tile(x, y, &w, &h, pt)) return; - map = (ubyte *)screen->transfer_map(screen, pt); + map = (ubyte *)pipe->transfer_map(pipe, pt); if (!map) { assert(0); return; @@ -1453,7 +1453,7 @@ pipe_get_tile_z(struct pipe_transfer *pt, assert(0); } - screen->transfer_unmap(screen, pt); + pipe->transfer_unmap(pipe, pt); } @@ -1462,7 +1462,7 @@ pipe_put_tile_z(struct pipe_transfer *pt, uint x, uint y, uint w, uint h, const uint *zSrc) { - struct pipe_screen *screen = pt->texture->screen; + struct pipe_context *pipe = pt->pipe; const uint srcStride = w; const uint *ptrc = zSrc; ubyte *map; @@ -1472,7 +1472,7 @@ pipe_put_tile_z(struct pipe_transfer *pt, if (pipe_clip_tile(x, y, &w, &h, pt)) return; - map = (ubyte *)screen->transfer_map(screen, pt); + map = (ubyte *)pipe->transfer_map(pipe, pt); if (!map) { assert(0); return; @@ -1560,7 +1560,7 @@ pipe_put_tile_z(struct pipe_transfer *pt, assert(0); } - screen->transfer_unmap(screen, pt); + pipe->transfer_unmap(pipe, pt); } diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 0763b5bb0e..dcc0014479 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -680,14 +680,14 @@ xfer_buffers_map(struct vl_mpeg12_mc_renderer *r) assert(r); for (i = 0; i < 3; ++i) { - r->tex_transfer[i] = r->pipe->screen->get_tex_transfer + r->tex_transfer[i] = r->pipe->get_tex_transfer ( - r->pipe->screen, r->textures.all[i], + r->pipe, r->textures.all[i], 0, 0, 0, PIPE_TRANSFER_WRITE, 0, 0, r->textures.all[i]->width0, r->textures.all[i]->height0 ); - r->texels[i] = r->pipe->screen->transfer_map(r->pipe->screen, r->tex_transfer[i]); + r->texels[i] = r->pipe->transfer_map(r->pipe, r->tex_transfer[i]); } } @@ -699,8 +699,8 @@ xfer_buffers_unmap(struct vl_mpeg12_mc_renderer *r) assert(r); for (i = 0; i < 3; ++i) { - r->pipe->screen->transfer_unmap(r->pipe->screen, r->tex_transfer[i]); - r->pipe->screen->tex_transfer_destroy(r->tex_transfer[i]); + r->pipe->transfer_unmap(r->pipe, r->tex_transfer[i]); + r->pipe->tex_transfer_destroy(r->tex_transfer[i]); } } diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c index 3d45a22b7e..130519ffa5 100644 --- a/src/gallium/drivers/i915/i915_context.c +++ b/src/gallium/drivers/i915/i915_context.c @@ -221,6 +221,7 @@ i915_create_context(struct pipe_screen *screen, void *priv) i915_init_surface_functions(i915); i915_init_state_functions(i915); i915_init_flush_functions(i915); + i915_init_texture_functions(i915); draw_install_aaline_stage(i915->draw, &i915->base); draw_install_aapoint_stage(i915->draw, &i915->base); diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h index 4994537683..039165b63f 100644 --- a/src/gallium/drivers/i915/i915_context.h +++ b/src/gallium/drivers/i915/i915_context.h @@ -349,6 +349,12 @@ struct pipe_context *i915_create_context(struct pipe_screen *screen, void *priv); +/*********************************************************************** + * i915_texture.c + */ +void i915_init_texture_functions(struct i915_context *i915 ); + + /*********************************************************************** * Inline conversion functions. These are better-typed than the * macros used previously: diff --git a/src/gallium/drivers/i915/i915_texture.c b/src/gallium/drivers/i915/i915_texture.c index 3ce52cdcdb..3435f7797f 100644 --- a/src/gallium/drivers/i915/i915_texture.c +++ b/src/gallium/drivers/i915/i915_texture.c @@ -795,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, @@ -825,6 +825,7 @@ i915_get_tex_transfer(struct pipe_screen *screen, trans = CALLOC_STRUCT(i915_transfer); if (trans) { pipe_texture_reference(&trans->base.texture, texture); + trans->base.pipe = pipe; trans->base.x = x; trans->base.y = y; trans->base.width = w; @@ -837,7 +838,7 @@ 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; @@ -859,7 +860,7 @@ i915_transfer_map(struct pipe_screen *screen, } 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; @@ -879,6 +880,14 @@ 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) @@ -889,8 +898,4 @@ i915_init_screen_texture_functions(struct i915_screen *is) 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; } diff --git a/src/gallium/drivers/i965/brw_screen.h b/src/gallium/drivers/i965/brw_screen.h index e0f3cd2a9f..23e052d0b9 100644 --- a/src/gallium/drivers/i965/brw_screen.h +++ b/src/gallium/drivers/i965/brw_screen.h @@ -181,6 +181,10 @@ void brw_update_texture( struct brw_screen *brw_screen, struct brw_texture *tex ); +/* brw_screen_texture.h + */ +struct brw_context; +void brw_tex_init( struct brw_context *brw ); void brw_screen_tex_init( struct brw_screen *brw_screen ); void brw_screen_tex_surface_init( struct brw_screen *brw_screen ); @@ -198,5 +202,4 @@ boolean brw_is_buffer_referenced_by_bo( struct brw_screen *brw_screen, struct brw_winsys_buffer *bo ); - #endif /* BRW_SCREEN_H */ diff --git a/src/gallium/drivers/i965/brw_screen_texture.c b/src/gallium/drivers/i965/brw_screen_texture.c index cc79bfc771..52bf9b3c1c 100644 --- a/src/gallium/drivers/i965/brw_screen_texture.c +++ b/src/gallium/drivers/i965/brw_screen_texture.c @@ -37,6 +37,8 @@ #include "brw_defines.h" #include "brw_structs.h" #include "brw_winsys.h" +#include "brw_context.h" + @@ -479,7 +481,7 @@ boolean brw_is_texture_referenced_by_bo( struct brw_screen *brw_screen, */ static struct pipe_transfer* -brw_get_tex_transfer(struct pipe_screen *screen, +brw_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, @@ -502,6 +504,7 @@ brw_get_tex_transfer(struct pipe_screen *screen, trans = CALLOC_STRUCT(brw_transfer); if (trans) { pipe_texture_reference(&trans->base.texture, texture); + trans->base.pipe = pipe; trans->base.x = x; trans->base.y = y; trans->base.width = w; @@ -514,11 +517,11 @@ brw_get_tex_transfer(struct pipe_screen *screen, } static void * -brw_transfer_map(struct pipe_screen *screen, +brw_transfer_map(struct pipe_context *pipe, struct pipe_transfer *transfer) { struct brw_texture *tex = brw_texture(transfer->texture); - struct brw_winsys_screen *sws = brw_screen(screen)->sws; + struct brw_winsys_screen *sws = brw_screen(pipe->screen)->sws; char *map; unsigned usage = transfer->usage; @@ -541,11 +544,11 @@ brw_transfer_map(struct pipe_screen *screen, } static void -brw_transfer_unmap(struct pipe_screen *screen, +brw_transfer_unmap(struct pipe_context *pipe, struct pipe_transfer *transfer) { struct brw_texture *tex = brw_texture(transfer->texture); - struct brw_winsys_screen *sws = brw_screen(screen)->sws; + struct brw_winsys_screen *sws = brw_screen(pipe->screen)->sws; sws->bo_unmap(tex->bo); } @@ -558,6 +561,14 @@ brw_tex_transfer_destroy(struct pipe_transfer *trans) } +void brw_tex_init( struct brw_context *brw ) +{ + brw->base.get_tex_transfer = brw_get_tex_transfer; + brw->base.transfer_map = brw_transfer_map; + brw->base.transfer_unmap = brw_transfer_unmap; + brw->base.tex_transfer_destroy = brw_tex_transfer_destroy; +} + void brw_screen_tex_init( struct brw_screen *brw_screen ) { brw_screen->base.is_format_supported = brw_is_format_supported; @@ -565,8 +576,4 @@ void brw_screen_tex_init( struct brw_screen *brw_screen ) brw_screen->base.texture_from_handle = brw_texture_from_handle; brw_screen->base.texture_get_handle = brw_texture_get_handle; brw_screen->base.texture_destroy = brw_texture_destroy; - brw_screen->base.get_tex_transfer = brw_get_tex_transfer; - brw_screen->base.transfer_map = brw_transfer_map; - brw_screen->base.transfer_unmap = brw_transfer_unmap; - brw_screen->base.tex_transfer_destroy = brw_tex_transfer_destroy; } diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c index baf0ae4401..5e371c47c8 100644 --- a/src/gallium/drivers/identity/id_context.c +++ b/src/gallium/drivers/identity/id_context.c @@ -711,6 +711,74 @@ identity_is_buffer_referenced(struct pipe_context *_pipe, buffer); } + + +static struct pipe_transfer * +identity_context_get_tex_transfer(struct pipe_context *_context, + struct pipe_texture *_texture, + unsigned face, + unsigned level, + unsigned zslice, + enum pipe_transfer_usage usage, + unsigned x, + unsigned y, + unsigned w, + unsigned h) +{ + struct identity_context *id_context = identity_context(_context); + struct identity_texture *id_texture = identity_texture(_texture); + struct pipe_context *context = id_context->pipe; + struct pipe_texture *texture = id_texture->texture; + struct pipe_transfer *result; + + result = context->get_tex_transfer(context, + texture, + face, + level, + zslice, + usage, + x, + y, + w, + h); + + if (result) + return identity_transfer_create(id_context, id_texture, result); + return NULL; +} + +static void +identity_context_tex_transfer_destroy(struct pipe_transfer *_transfer) +{ + identity_transfer_destroy(identity_transfer(_transfer)); +} + +static void * +identity_context_transfer_map(struct pipe_context *_context, + struct pipe_transfer *_transfer) +{ + struct identity_context *id_context = identity_context(_context); + struct identity_transfer *id_transfer = identity_transfer(_transfer); + struct pipe_context *context = id_context->pipe; + struct pipe_transfer *transfer = id_transfer->transfer; + + return context->transfer_map(context, + transfer); +} + +static void +identity_context_transfer_unmap(struct pipe_context *_context, + struct pipe_transfer *_transfer) +{ + struct identity_context *id_context = identity_context(_context); + struct identity_transfer *id_transfer = identity_transfer(_transfer); + struct pipe_context *context = id_context->pipe; + struct pipe_transfer *transfer = id_transfer->transfer; + + context->transfer_unmap(context, + transfer); +} + struct pipe_context * identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) { @@ -775,6 +843,10 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) id_pipe->base.flush = identity_flush; id_pipe->base.is_texture_referenced = identity_is_texture_referenced; id_pipe->base.is_buffer_referenced = identity_is_buffer_referenced; + id_pipe->base.get_tex_transfer = identity_context_get_tex_transfer; + id_pipe->base.tex_transfer_destroy = identity_context_tex_transfer_destroy; + id_pipe->base.transfer_map = identity_context_transfer_map; + id_pipe->base.transfer_unmap = identity_context_transfer_unmap; id_pipe->pipe = pipe; diff --git a/src/gallium/drivers/identity/id_objects.c b/src/gallium/drivers/identity/id_objects.c index 2b1a60c1bf..91831404b8 100644 --- a/src/gallium/drivers/identity/id_objects.c +++ b/src/gallium/drivers/identity/id_objects.c @@ -142,7 +142,8 @@ identity_surface_destroy(struct identity_surface *id_surface) struct pipe_transfer * -identity_transfer_create(struct identity_texture *id_texture, +identity_transfer_create(struct identity_context *id_context, + struct identity_texture *id_texture, struct pipe_transfer *transfer) { struct identity_transfer *id_transfer; @@ -166,18 +167,15 @@ identity_transfer_create(struct identity_texture *id_texture, return &id_transfer->base; error: - transfer->texture->screen->tex_transfer_destroy(transfer); + transfer->pipe->tex_transfer_destroy(transfer); return NULL; } void identity_transfer_destroy(struct identity_transfer *id_transfer) { - struct identity_screen *id_screen = identity_screen(id_transfer->base.texture->screen); - struct pipe_screen *screen = id_screen->screen; - pipe_texture_reference(&id_transfer->base.texture, NULL); - screen->tex_transfer_destroy(id_transfer->transfer); + id_transfer->transfer->pipe->tex_transfer_destroy(id_transfer->transfer); FREE(id_transfer); } diff --git a/src/gallium/drivers/identity/id_objects.h b/src/gallium/drivers/identity/id_objects.h index 77cc719079..3c4e6d3f8c 100644 --- a/src/gallium/drivers/identity/id_objects.h +++ b/src/gallium/drivers/identity/id_objects.h @@ -35,6 +35,7 @@ #include "id_screen.h" +struct identity_context; struct identity_buffer { @@ -177,7 +178,8 @@ void identity_surface_destroy(struct identity_surface *id_surface); struct pipe_transfer * -identity_transfer_create(struct identity_texture *id_texture, +identity_transfer_create(struct identity_context *id_context, + struct identity_texture *id_texture, struct pipe_transfer *transfer); void diff --git a/src/gallium/drivers/identity/id_screen.c b/src/gallium/drivers/identity/id_screen.c index b9d0f003d7..419b146578 100644 --- a/src/gallium/drivers/identity/id_screen.c +++ b/src/gallium/drivers/identity/id_screen.c @@ -207,71 +207,6 @@ identity_screen_tex_surface_destroy(struct pipe_surface *_surface) identity_surface_destroy(identity_surface(_surface)); } -static struct pipe_transfer * -identity_screen_get_tex_transfer(struct pipe_screen *_screen, - struct pipe_texture *_texture, - unsigned face, - unsigned level, - unsigned zslice, - enum pipe_transfer_usage usage, - unsigned x, - unsigned y, - unsigned w, - unsigned h) -{ - struct identity_screen *id_screen = identity_screen(_screen); - struct identity_texture *id_texture = identity_texture(_texture); - struct pipe_screen *screen = id_screen->screen; - struct pipe_texture *texture = id_texture->texture; - struct pipe_transfer *result; - - result = screen->get_tex_transfer(screen, - texture, - face, - level, - zslice, - usage, - x, - y, - w, - h); - - if (result) - return identity_transfer_create(id_texture, result); - return NULL; -} - -static void -identity_screen_tex_transfer_destroy(struct pipe_transfer *_transfer) -{ - identity_transfer_destroy(identity_transfer(_transfer)); -} - -static void * -identity_screen_transfer_map(struct pipe_screen *_screen, - struct pipe_transfer *_transfer) -{ - struct identity_screen *id_screen = identity_screen(_screen); - struct identity_transfer *id_transfer = identity_transfer(_transfer); - struct pipe_screen *screen = id_screen->screen; - struct pipe_transfer *transfer = id_transfer->transfer; - - return screen->transfer_map(screen, - transfer); -} - -static void -identity_screen_transfer_unmap(struct pipe_screen *_screen, - struct pipe_transfer *_transfer) -{ - struct identity_screen *id_screen = identity_screen(_screen); - struct identity_transfer *id_transfer = identity_transfer(_transfer); - struct pipe_screen *screen = id_screen->screen; - struct pipe_transfer *transfer = id_transfer->transfer; - - screen->transfer_unmap(screen, - transfer); -} static struct pipe_buffer * identity_screen_buffer_create(struct pipe_screen *_screen, @@ -488,10 +423,6 @@ identity_screen_create(struct pipe_screen *screen) id_screen->base.texture_destroy = identity_screen_texture_destroy; id_screen->base.get_tex_surface = identity_screen_get_tex_surface; id_screen->base.tex_surface_destroy = identity_screen_tex_surface_destroy; - id_screen->base.get_tex_transfer = identity_screen_get_tex_transfer; - id_screen->base.tex_transfer_destroy = identity_screen_tex_transfer_destroy; - id_screen->base.transfer_map = identity_screen_transfer_map; - id_screen->base.transfer_unmap = identity_screen_transfer_unmap; id_screen->base.buffer_create = identity_screen_buffer_create; id_screen->base.user_buffer_create = identity_screen_user_buffer_create; if (screen->buffer_map) diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile index 41ac1cee72..89c06ea3ad 100644 --- a/src/gallium/drivers/llvmpipe/Makefile +++ b/src/gallium/drivers/llvmpipe/Makefile @@ -55,7 +55,7 @@ testprogs := lp_test_format \ LIBS += $(GL_LIB_DEPS) -L. -lllvmpipe -L../../auxiliary/ -lgallium -$(testprogs): lp_test_% : lp_test_%.o lp_test_main.o libllvmpipe.a - $(LD) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS) -Wl,--end-group +#$(testprogs): lp_test_% : lp_test_%.o lp_test_main.o libllvmpipe.a +# $(LD) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS) -Wl,--end-group -default: $(testprogs) +#default: $(testprogs) diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index d94efec16a..945e3e0558 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -173,6 +173,7 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv ) llvmpipe->pipe.is_buffer_referenced = llvmpipe_is_buffer_referenced; llvmpipe_init_query_funcs( llvmpipe ); + llvmpipe_init_context_texture_funcs( &llvmpipe->pipe ); /* * Create drawing context and plug our rendering stage into it. diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c index bf832433be..1b4e889935 100644 --- a/src/gallium/drivers/llvmpipe/lp_flush.c +++ b/src/gallium/drivers/llvmpipe/lp_flush.c @@ -79,12 +79,12 @@ llvmpipe_flush( struct pipe_context *pipe, for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++) { util_snprintf(filename, sizeof(filename), "cbuf%u_%u", i, frame_no); - debug_dump_surface(filename, llvmpipe->framebuffer.cbufs[i]); + debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.cbufs[0]); } if (0) { util_snprintf(filename, sizeof(filename), "zsbuf_%u", frame_no); - debug_dump_surface(filename, llvmpipe->framebuffer.zsbuf); + debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.zsbuf); } ++frame_no; diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c index 72492c0f0c..bfe53d4106 100644 --- a/src/gallium/drivers/llvmpipe/lp_scene.c +++ b/src/gallium/drivers/llvmpipe/lp_scene.c @@ -397,7 +397,7 @@ end: static boolean lp_scene_map_buffers( struct lp_scene *scene ) { - struct pipe_screen *screen = scene->pipe->screen; + struct pipe_context *pipe = scene->pipe; struct pipe_surface *cbuf, *zsbuf; int i; @@ -409,7 +409,7 @@ lp_scene_map_buffers( struct lp_scene *scene ) for (i = 0; i < scene->fb.nr_cbufs; i++) { cbuf = scene->fb.cbufs[i]; if (cbuf) { - scene->cbuf_transfer[i] = screen->get_tex_transfer(screen, + scene->cbuf_transfer[i] = pipe->get_tex_transfer(pipe, cbuf->texture, cbuf->face, cbuf->level, @@ -421,7 +421,7 @@ lp_scene_map_buffers( struct lp_scene *scene ) if (!scene->cbuf_transfer[i]) goto fail; - scene->cbuf_map[i] = screen->transfer_map(screen, + scene->cbuf_map[i] = pipe->transfer_map(pipe, scene->cbuf_transfer[i]); if (!scene->cbuf_map[i]) goto fail; @@ -432,7 +432,7 @@ lp_scene_map_buffers( struct lp_scene *scene ) */ zsbuf = scene->fb.zsbuf; if (zsbuf) { - scene->zsbuf_transfer = screen->get_tex_transfer(screen, + scene->zsbuf_transfer = pipe->get_tex_transfer(pipe, zsbuf->texture, zsbuf->face, zsbuf->level, @@ -444,7 +444,7 @@ lp_scene_map_buffers( struct lp_scene *scene ) if (!scene->zsbuf_transfer) goto fail; - scene->zsbuf_map = screen->transfer_map(screen, + scene->zsbuf_map = pipe->transfer_map(pipe, scene->zsbuf_transfer); if (!scene->zsbuf_map) goto fail; @@ -469,25 +469,25 @@ fail: static void lp_scene_unmap_buffers( struct lp_scene *scene ) { - struct pipe_screen *screen = scene->pipe->screen; + struct pipe_context *pipe = scene->pipe; unsigned i; for (i = 0; i < scene->fb.nr_cbufs; i++) { if (scene->cbuf_map[i]) - screen->transfer_unmap(screen, scene->cbuf_transfer[i]); + pipe->transfer_unmap(pipe, scene->cbuf_transfer[i]); if (scene->cbuf_transfer[i]) - screen->tex_transfer_destroy(scene->cbuf_transfer[i]); + pipe->tex_transfer_destroy(scene->cbuf_transfer[i]); scene->cbuf_transfer[i] = NULL; scene->cbuf_map[i] = NULL; } if (scene->zsbuf_map) - screen->transfer_unmap(screen, scene->zsbuf_transfer); + pipe->transfer_unmap(pipe, scene->zsbuf_transfer); if (scene->zsbuf_transfer) - screen->tex_transfer_destroy(scene->zsbuf_transfer); + pipe->tex_transfer_destroy(scene->zsbuf_transfer); scene->zsbuf_transfer = NULL; scene->zsbuf_map = NULL; diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 74b7b4ec5e..65f7994e0e 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -243,7 +243,7 @@ llvmpipe_tex_surface_destroy(struct pipe_surface *surf) static struct pipe_transfer * -llvmpipe_get_tex_transfer(struct pipe_screen *screen, +llvmpipe_get_tex_transfer(struct pipe_context *pipe, struct pipe_texture *texture, unsigned face, unsigned level, unsigned zslice, enum pipe_transfer_usage usage, @@ -307,10 +307,10 @@ llvmpipe_tex_transfer_destroy(struct pipe_transfer *transfer) static void * -llvmpipe_transfer_map( struct pipe_screen *_screen, +llvmpipe_transfer_map( struct pipe_context *pipe, struct pipe_transfer *transfer ) { - struct llvmpipe_screen *screen = llvmpipe_screen(_screen); + struct llvmpipe_screen *screen = llvmpipe_screen(pipe->screen); ubyte *map, *xfer_map; struct llvmpipe_texture *lpt; enum pipe_format format; @@ -351,10 +351,10 @@ llvmpipe_transfer_map( struct pipe_screen *_screen, static void -llvmpipe_transfer_unmap(struct pipe_screen *screen, - struct pipe_transfer *transfer) +llvmpipe_transfer_unmap(struct pipe_context *pipe, + struct pipe_transfer *transfer) { - struct llvmpipe_screen *lp_screen = llvmpipe_screen(screen); + struct llvmpipe_screen *lp_screen = llvmpipe_screen(pipe->screen); struct llvmpipe_texture *lpt; assert(transfer->texture); @@ -376,9 +376,14 @@ llvmpipe_init_screen_texture_funcs(struct pipe_screen *screen) screen->get_tex_surface = llvmpipe_get_tex_surface; screen->tex_surface_destroy = llvmpipe_tex_surface_destroy; +} + - screen->get_tex_transfer = llvmpipe_get_tex_transfer; - screen->tex_transfer_destroy = llvmpipe_tex_transfer_destroy; - screen->transfer_map = llvmpipe_transfer_map; - screen->transfer_unmap = llvmpipe_transfer_unmap; +void +llvmpipe_init_context_texture_funcs(struct pipe_context *pipe) +{ + pipe->get_tex_transfer = llvmpipe_get_tex_transfer; + pipe->tex_transfer_destroy = llvmpipe_tex_transfer_destroy; + pipe->transfer_map = llvmpipe_transfer_map; + pipe->transfer_unmap = llvmpipe_transfer_unmap; } diff --git a/src/gallium/drivers/llvmpipe/lp_texture.h b/src/gallium/drivers/llvmpipe/lp_texture.h index b23f929b16..94b667abf3 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.h +++ b/src/gallium/drivers/llvmpipe/lp_texture.h @@ -98,5 +98,7 @@ llvmpipe_transfer(struct pipe_transfer *pt) extern void llvmpipe_init_screen_texture_funcs(struct pipe_screen *screen); +extern void +llvmpipe_init_context_texture_funcs(struct pipe_context *pipe); #endif /* LP_TEXTURE_H */ diff --git a/src/gallium/drivers/nouveau/nv04_surface_2d.c b/src/gallium/drivers/nouveau/nv04_surface_2d.c index b074547c4d..93114465d5 100644 --- a/src/gallium/drivers/nouveau/nv04_surface_2d.c +++ b/src/gallium/drivers/nouveau/nv04_surface_2d.c @@ -518,7 +518,6 @@ nv04_surface_wrap_for_render(struct pipe_screen *pscreen, struct nv04_surface_2d ns->base.usage = PIPE_BUFFER_USAGE_GPU_WRITE | NOUVEAU_BUFFER_USAGE_NO_RENDER | PIPE_BUFFER_USAGE_GPU_READ; } - struct nv40_screen* screen = (struct nv40_screen*)pscreen; ns->base.usage = PIPE_BUFFER_USAGE_GPU_READ | PIPE_BUFFER_USAGE_GPU_WRITE; struct pipe_texture templ; diff --git a/src/gallium/drivers/nv30/nv30_context.c b/src/gallium/drivers/nv30/nv30_context.c index 279b74445c..825c167b01 100644 --- a/src/gallium/drivers/nv30/nv30_context.c +++ b/src/gallium/drivers/nv30/nv30_context.c @@ -74,6 +74,7 @@ nv30_create(struct pipe_screen *pscreen, void *priv) nv30_init_query_functions(nv30); nv30_init_surface_functions(nv30); nv30_init_state_functions(nv30); + nv30_init_transfer_functions(nv30); /* Create, configure, and install fallback swtnl path */ nv30->draw = draw_create(); diff --git a/src/gallium/drivers/nv30/nv30_context.h b/src/gallium/drivers/nv30/nv30_context.h index 1786460aec..4a164f3b1f 100644 --- a/src/gallium/drivers/nv30/nv30_context.h +++ b/src/gallium/drivers/nv30/nv30_context.h @@ -167,6 +167,7 @@ struct nv30_state_entry { extern void nv30_init_state_functions(struct nv30_context *nv30); extern void nv30_init_surface_functions(struct nv30_context *nv30); extern void nv30_init_query_functions(struct nv30_context *nv30); +extern void nv30_init_transfer_functions(struct nv30_context *nv30); extern void nv30_screen_init_miptree_functions(struct pipe_screen *pscreen); diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c index 85433d2095..db24335b7c 100644 --- a/src/gallium/drivers/nv30/nv30_screen.c +++ b/src/gallium/drivers/nv30/nv30_screen.c @@ -214,7 +214,6 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) pscreen->context_create = nv30_create; nv30_screen_init_miptree_functions(pscreen); - nv30_screen_init_transfer_functions(pscreen); /* 3D object */ switch (dev->chipset & 0xf0) { diff --git a/src/gallium/drivers/nv30/nv30_screen.h b/src/gallium/drivers/nv30/nv30_screen.h index 8591cd31ca..b7856cdf00 100644 --- a/src/gallium/drivers/nv30/nv30_screen.h +++ b/src/gallium/drivers/nv30/nv30_screen.h @@ -35,7 +35,4 @@ nv30_screen(struct pipe_screen *screen) return (struct nv30_screen *)screen; } -void -nv30_screen_init_transfer_functions(struct pipe_screen *pscreen); - #endif diff --git a/src/gallium/drivers/nv30/nv30_transfer.c b/src/gallium/drivers/nv30/nv30_transfer.c index 3aeda51ea1..1318c60ae4 100644 --- a/src/gallium/drivers/nv30/nv30_transfer.c +++ b/src/gallium/drivers/nv30/nv30_transfer.c @@ -33,11 +33,12 @@ nv30_compatible_transfer_tex(struct pipe_texture *pt, unsigned width, unsigned h } static struct pipe_transfer * -nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, +nv30_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt, unsigned face, unsigned level, unsigned zslice, enum pipe_transfer_usage usage, unsigned x, unsigned y, unsigned w, unsigned h) { + struct pipe_screen *pscreen = pcontext->screen; struct nv30_miptree *mt = (struct nv30_miptree *)pt; struct nv30_transfer *tx; struct pipe_texture tx_tex_template, *tx_tex; @@ -145,8 +146,9 @@ nv30_transfer_del(struct pipe_transfer *ptx) } static void * -nv30_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) +nv30_transfer_map(struct pipe_context *pcontext, struct pipe_transfer *ptx) { + struct pipe_screen *pscreen = pcontext->screen; struct nv30_transfer *tx = (struct nv30_transfer *)ptx; struct nv04_surface *ns = (struct nv04_surface *)tx->surface; struct nv30_miptree *mt = (struct nv30_miptree *)tx->surface->texture; @@ -160,8 +162,9 @@ nv30_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) } static void -nv30_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx) +nv30_transfer_unmap(struct pipe_context *pcontext, struct pipe_transfer *ptx) { + struct pipe_screen *pscreen = pcontext->screen; struct nv30_transfer *tx = (struct nv30_transfer *)ptx; struct nv30_miptree *mt = (struct nv30_miptree *)tx->surface->texture; @@ -169,10 +172,10 @@ nv30_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx) } void -nv30_screen_init_transfer_functions(struct pipe_screen *pscreen) +nv30_init_transfer_functions(struct nv30_context *nv30) { - pscreen->get_tex_transfer = nv30_transfer_new; - pscreen->tex_transfer_destroy = nv30_transfer_del; - pscreen->transfer_map = nv30_transfer_map; - pscreen->transfer_unmap = nv30_transfer_unmap; + nv30->pipe.get_tex_transfer = nv30_transfer_new; + nv30->pipe.tex_transfer_destroy = nv30_transfer_del; + nv30->pipe.transfer_map = nv30_transfer_map; + nv30->pipe.transfer_unmap = nv30_transfer_unmap; } diff --git a/src/gallium/drivers/nv40/nv40_context.c b/src/gallium/drivers/nv40/nv40_context.c index 65dc73e88b..e828f17643 100644 --- a/src/gallium/drivers/nv40/nv40_context.c +++ b/src/gallium/drivers/nv40/nv40_context.c @@ -74,6 +74,7 @@ nv40_create(struct pipe_screen *pscreen, void *priv) nv40_init_query_functions(nv40); nv40_init_surface_functions(nv40); nv40_init_state_functions(nv40); + nv40_init_transfer_functions(nv40); /* Create, configure, and install fallback swtnl path */ nv40->draw = draw_create(); diff --git a/src/gallium/drivers/nv40/nv40_context.h b/src/gallium/drivers/nv40/nv40_context.h index 2550ec654b..cb5d9e2d9d 100644 --- a/src/gallium/drivers/nv40/nv40_context.h +++ b/src/gallium/drivers/nv40/nv40_context.h @@ -183,6 +183,7 @@ struct nv40_state_entry { extern void nv40_init_state_functions(struct nv40_context *nv40); extern void nv40_init_surface_functions(struct nv40_context *nv40); extern void nv40_init_query_functions(struct nv40_context *nv40); +extern void nv40_init_transfer_functions(struct nv40_context *nv40); extern void nv40_screen_init_miptree_functions(struct pipe_screen *pscreen); diff --git a/src/gallium/drivers/nv40/nv40_screen.c b/src/gallium/drivers/nv40/nv40_screen.c index b216c5e38c..dbcc33d8d9 100644 --- a/src/gallium/drivers/nv40/nv40_screen.c +++ b/src/gallium/drivers/nv40/nv40_screen.c @@ -201,7 +201,6 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) pscreen->context_create = nv40_create; nv40_screen_init_miptree_functions(pscreen); - nv40_screen_init_transfer_functions(pscreen); /* 3D object */ switch (dev->chipset & 0xf0) { diff --git a/src/gallium/drivers/nv40/nv40_screen.h b/src/gallium/drivers/nv40/nv40_screen.h index 9437aa050d..2765ab764a 100644 --- a/src/gallium/drivers/nv40/nv40_screen.h +++ b/src/gallium/drivers/nv40/nv40_screen.h @@ -34,7 +34,4 @@ nv40_screen(struct pipe_screen *screen) return (struct nv40_screen *)screen; } -void -nv40_screen_init_transfer_functions(struct pipe_screen *pscreen); - #endif diff --git a/src/gallium/drivers/nv40/nv40_transfer.c b/src/gallium/drivers/nv40/nv40_transfer.c index 0462a042c3..2ca9b94388 100644 --- a/src/gallium/drivers/nv40/nv40_transfer.c +++ b/src/gallium/drivers/nv40/nv40_transfer.c @@ -33,11 +33,12 @@ nv40_compatible_transfer_tex(struct pipe_texture *pt, unsigned width, unsigned h } static struct pipe_transfer * -nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, +nv40_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt, unsigned face, unsigned level, unsigned zslice, enum pipe_transfer_usage usage, unsigned x, unsigned y, unsigned w, unsigned h) { + struct pipe_screen *pscreen = pcontext->screen; struct nv40_miptree *mt = (struct nv40_miptree *)pt; struct nv40_transfer *tx; struct pipe_texture tx_tex_template, *tx_tex; @@ -145,8 +146,9 @@ nv40_transfer_del(struct pipe_transfer *ptx) } static void * -nv40_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) +nv40_transfer_map(struct pipe_context *pcontext, struct pipe_transfer *ptx) { + struct pipe_screen *pscreen = pcontext->screen; struct nv40_transfer *tx = (struct nv40_transfer *)ptx; struct nv04_surface *ns = (struct nv04_surface *)tx->surface; struct nv40_miptree *mt = (struct nv40_miptree *)tx->surface->texture; @@ -160,8 +162,9 @@ nv40_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) } static void -nv40_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx) +nv40_transfer_unmap(struct pipe_context *pcontext, struct pipe_transfer *ptx) { + struct pipe_screen *pscreen = pcontext->screen; struct nv40_transfer *tx = (struct nv40_transfer *)ptx; struct nv40_miptree *mt = (struct nv40_miptree *)tx->surface->texture; @@ -169,10 +172,10 @@ nv40_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx) } void -nv40_screen_init_transfer_functions(struct pipe_screen *pscreen) +nv40_init_transfer_functions(struct nv40_context *nv40) { - pscreen->get_tex_transfer = nv40_transfer_new; - pscreen->tex_transfer_destroy = nv40_transfer_del; - pscreen->transfer_map = nv40_transfer_map; - pscreen->transfer_unmap = nv40_transfer_unmap; + nv40->pipe.get_tex_transfer = nv40_transfer_new; + nv40->pipe.tex_transfer_destroy = nv40_transfer_del; + nv40->pipe.transfer_map = nv40_transfer_map; + nv40->pipe.transfer_unmap = nv40_transfer_unmap; } diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c index 0eb42f323f..aa14e17872 100644 --- a/src/gallium/drivers/nv50/nv50_context.c +++ b/src/gallium/drivers/nv50/nv50_context.c @@ -97,6 +97,7 @@ nv50_create(struct pipe_screen *pscreen, void *priv) nv50_init_surface_functions(nv50); nv50_init_state_functions(nv50); nv50_init_query_functions(nv50); + nv50_init_transfer_functions(nv50); nv50->draw = draw_create(); assert(nv50->draw); diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index 8793c2aac5..1743f6fb39 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -175,6 +175,7 @@ nv50_context(struct pipe_context *pipe) extern void nv50_init_surface_functions(struct nv50_context *nv50); extern void nv50_init_state_functions(struct nv50_context *nv50); extern void nv50_init_query_functions(struct nv50_context *nv50); +extern void nv50_init_transfer_functions(struct nv50_context *nv50); extern void nv50_screen_init_miptree_functions(struct pipe_screen *pscreen); diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index 7c360e9e73..b7f2ac1b1c 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -121,11 +121,12 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, } static struct pipe_transfer * -nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, +nv50_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt, unsigned face, unsigned level, unsigned zslice, enum pipe_transfer_usage usage, unsigned x, unsigned y, unsigned w, unsigned h) { + struct pipe_screen *pscreen = pcontext->screen; struct nouveau_device *dev = nouveau_screen(pscreen)->device; struct nv50_miptree *mt = nv50_miptree(pt); struct nv50_miptree_level *lvl = &mt->level[level]; @@ -218,7 +219,7 @@ nv50_transfer_del(struct pipe_transfer *ptx) } static void * -nv50_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) +nv50_transfer_map(struct pipe_context *pcontext, struct pipe_transfer *ptx) { struct nv50_transfer *tx = (struct nv50_transfer *)ptx; unsigned flags = 0; @@ -236,7 +237,7 @@ nv50_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) } static void -nv50_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx) +nv50_transfer_unmap(struct pipe_context *pcontext, struct pipe_transfer *ptx) { struct nv50_transfer *tx = (struct nv50_transfer *)ptx; @@ -244,12 +245,12 @@ nv50_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx) } void -nv50_transfer_init_screen_functions(struct pipe_screen *pscreen) +nv50_init_transfer_functions(struct nv50_context *nv50) { - pscreen->get_tex_transfer = nv50_transfer_new; - pscreen->tex_transfer_destroy = nv50_transfer_del; - pscreen->transfer_map = nv50_transfer_map; - pscreen->transfer_unmap = nv50_transfer_unmap; + nv50->pipe.get_tex_transfer = nv50_transfer_new; + nv50->pipe.tex_transfer_destroy = nv50_transfer_del; + nv50->pipe.transfer_map = nv50_transfer_map; + nv50->pipe.transfer_unmap = nv50_transfer_unmap; } void diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 923e1e541f..8606c0004e 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -34,6 +34,7 @@ #include "r300_screen.h" #include "r300_state_invariant.h" #include "r300_texture.h" +#include "r300_transfer.h" #include "radeon_winsys.h" @@ -209,6 +210,8 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300_init_query_functions(r300); + r300_init_transfer_functions(r300); + /* r300_init_surface_functions(r300); */ r300_init_state_functions(r300); diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 985e339112..03b09603c7 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -404,6 +404,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, struct draw_stage* r300_draw_stage(struct r300_context* r300); void r300_init_state_functions(struct r300_context* r300); void r300_init_surface_functions(struct r300_context* r300); +void r300_init_tex_functions( struct pipe_context *pipe ); static INLINE boolean CTX_DBG_ON(struct r300_context * ctx, unsigned flags) { diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 5880eecd5f..69c0ab496c 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -27,7 +27,6 @@ #include "r300_context.h" #include "r300_texture.h" -#include "r300_transfer.h" #include "radeon_winsys.h" #include "r300_winsys.h" @@ -252,6 +251,8 @@ static boolean r300_is_format_supported(struct pipe_screen* screen, return retval == usage; } + + static void r300_destroy_screen(struct pipe_screen* pscreen) { struct r300_screen* r300screen = r300_screen(pscreen); @@ -290,7 +291,6 @@ struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys) r300screen->screen.context_create = r300_create_context; r300_init_screen_texture_functions(&r300screen->screen); - r300_init_screen_transfer_functions(&r300screen->screen); u_simple_screen_init(&r300screen->screen); return &r300screen->screen; diff --git a/src/gallium/drivers/r300/r300_transfer.c b/src/gallium/drivers/r300/r300_transfer.c index ec89681a3c..7dd707ff8e 100644 --- a/src/gallium/drivers/r300/r300_transfer.c +++ b/src/gallium/drivers/r300/r300_transfer.c @@ -118,15 +118,15 @@ static void r300_copy_into_tiled_texture(struct pipe_context *ctx, } static struct pipe_transfer* -r300_get_tex_transfer(struct pipe_screen *screen, +r300_get_tex_transfer(struct pipe_context *ctx, struct pipe_texture *texture, unsigned face, unsigned level, unsigned zslice, enum pipe_transfer_usage usage, unsigned x, unsigned y, unsigned w, unsigned h) { struct r300_texture *tex = (struct r300_texture *)texture; + struct r300_screen *r300screen = r300_screen(ctx->screen); struct r300_transfer *trans; - struct r300_screen *r300screen = r300_screen(screen); struct pipe_texture template; trans = CALLOC_STRUCT(r300_transfer); @@ -136,7 +136,7 @@ r300_get_tex_transfer(struct pipe_screen *screen, trans->transfer.usage = usage; trans->transfer.width = w; trans->transfer.height = h; - trans->ctx = r300screen->ctx; + trans->ctx = ctx; trans->x = x; trans->y = y; trans->level = level; @@ -174,8 +174,10 @@ r300_get_tex_transfer(struct pipe_screen *screen, } /* Create the temporary texture. */ - trans->detiled_texture = - (struct r300_texture*)screen->texture_create(screen, &template); + trans->detiled_texture = (struct r300_texture*) + ctx->screen->texture_create(ctx->screen, + &template); + assert(!trans->detiled_texture->microtile && !trans->detiled_texture->macrotile); @@ -187,7 +189,7 @@ r300_get_tex_transfer(struct pipe_screen *screen, if (usage & PIPE_TRANSFER_READ) { /* We cannot map a tiled texture directly because the data is * in a different order, therefore we do detiling using a blit. */ - r300_copy_from_tiled_texture(r300screen->ctx, trans); + r300_copy_from_tiled_texture(ctx, trans); } } else { trans->transfer.x = x; @@ -219,7 +221,7 @@ static void r300_tex_transfer_destroy(struct pipe_transfer *trans) FREE(trans); } -static void* r300_transfer_map(struct pipe_screen *screen, +static void* r300_transfer_map(struct pipe_context *ctx, struct pipe_transfer *transfer) { struct r300_transfer *r300transfer = r300_transfer(transfer); @@ -230,12 +232,12 @@ static void* r300_transfer_map(struct pipe_screen *screen, if (r300transfer->detiled_texture) { /* The detiled texture is of the same size as the region being mapped * (no offset needed). */ - return pipe_buffer_map(screen, + return pipe_buffer_map(ctx->screen, r300transfer->detiled_texture->buffer, pipe_transfer_buffer_flags(transfer)); } else { /* Tiling is disabled. */ - map = pipe_buffer_map(screen, tex->buffer, + map = pipe_buffer_map(ctx->screen, tex->buffer, pipe_transfer_buffer_flags(transfer)); if (!map) { @@ -248,23 +250,26 @@ static void* r300_transfer_map(struct pipe_screen *screen, } } -static void r300_transfer_unmap(struct pipe_screen *screen, +static void r300_transfer_unmap(struct pipe_context *ctx, struct pipe_transfer *transfer) { struct r300_transfer *r300transfer = r300_transfer(transfer); struct r300_texture *tex = (struct r300_texture*)transfer->texture; if (r300transfer->detiled_texture) { - pipe_buffer_unmap(screen, r300transfer->detiled_texture->buffer); + pipe_buffer_unmap(ctx->screen, r300transfer->detiled_texture->buffer); } else { - pipe_buffer_unmap(screen, tex->buffer); + pipe_buffer_unmap(ctx->screen, tex->buffer); } } -void r300_init_screen_transfer_functions(struct pipe_screen *screen) + +void r300_init_transfer_functions( struct r300_context *r300ctx ) { - screen->get_tex_transfer = r300_get_tex_transfer; - screen->tex_transfer_destroy = r300_tex_transfer_destroy; - screen->transfer_map = r300_transfer_map; - screen->transfer_unmap = r300_transfer_unmap; + struct pipe_context *ctx = &r300ctx->context; + + ctx->get_tex_transfer = r300_get_tex_transfer; + ctx->tex_transfer_destroy = r300_tex_transfer_destroy; + ctx->transfer_map = r300_transfer_map; + ctx->transfer_unmap = r300_transfer_unmap; } diff --git a/src/gallium/drivers/r300/r300_transfer.h b/src/gallium/drivers/r300/r300_transfer.h index 60d1d3dc85..79baf6d048 100644 --- a/src/gallium/drivers/r300/r300_transfer.h +++ b/src/gallium/drivers/r300/r300_transfer.h @@ -26,6 +26,8 @@ #include "pipe/p_screen.h" -void r300_init_screen_transfer_functions(struct pipe_screen *screen); +struct r300_context; + +void r300_init_transfer_functions(struct r300_context *r300ctx); #endif diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 30494719f7..de92a0cd2c 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -44,6 +44,7 @@ #include "sp_surface.h" #include "sp_tile_cache.h" #include "sp_tex_tile_cache.h" +#include "sp_texture.h" #include "sp_query.h" @@ -275,6 +276,7 @@ softpipe_create_context( struct pipe_screen *screen, softpipe->pipe.is_buffer_referenced = softpipe_is_buffer_referenced; softpipe_init_query_funcs( softpipe ); + softpipe_init_texture_funcs( &softpipe->pipe ); softpipe->pipe.render_condition = softpipe_render_condition; @@ -283,13 +285,13 @@ softpipe_create_context( struct pipe_screen *screen, * Must be before quad stage setup! */ for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) - softpipe->cbuf_cache[i] = sp_create_tile_cache( screen ); - softpipe->zsbuf_cache = sp_create_tile_cache( screen ); + softpipe->cbuf_cache[i] = sp_create_tile_cache( &softpipe->pipe ); + softpipe->zsbuf_cache = sp_create_tile_cache( &softpipe->pipe ); for (i = 0; i < PIPE_MAX_SAMPLERS; i++) - softpipe->tex_cache[i] = sp_create_tex_tile_cache( screen ); + softpipe->tex_cache[i] = sp_create_tex_tile_cache( &softpipe->pipe ); for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { - softpipe->vertex_tex_cache[i] = sp_create_tex_tile_cache(screen); + softpipe->vertex_tex_cache[i] = sp_create_tex_tile_cache( &softpipe->pipe ); } /* setup quad rendering stages */ diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c index e8952bf4fb..3d76af4d8c 100644 --- a/src/gallium/drivers/softpipe/sp_flush.c +++ b/src/gallium/drivers/softpipe/sp_flush.c @@ -93,9 +93,9 @@ softpipe_flush( struct pipe_context *pipe, static unsigned frame_no = 1; static char filename[256]; util_snprintf(filename, sizeof(filename), "cbuf_%u.bmp", frame_no); - debug_dump_surface_bmp(filename, softpipe->framebuffer.cbufs[0]); + debug_dump_surface_bmp(softpipe, filename, softpipe->framebuffer.cbufs[0]); util_snprintf(filename, sizeof(filename), "zsbuf_%u.bmp", frame_no); - debug_dump_surface_bmp(filename, softpipe->framebuffer.zsbuf); + debug_dump_surface_bmp(softpipe, filename, softpipe->framebuffer.zsbuf); ++frame_no; } #endif diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c index a0b95c8884..a9f5b51a41 100644 --- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c @@ -43,14 +43,14 @@ struct softpipe_tex_tile_cache * -sp_create_tex_tile_cache( struct pipe_screen *screen ) +sp_create_tex_tile_cache( struct pipe_context *pipe ) { struct softpipe_tex_tile_cache *tc; uint pos; tc = CALLOC_STRUCT( softpipe_tex_tile_cache ); if (tc) { - tc->screen = screen; + tc->pipe = pipe; for (pos = 0; pos < NUM_ENTRIES; pos++) { tc->entries[pos].addr.bits.invalid = 1; } @@ -63,19 +63,16 @@ sp_create_tex_tile_cache( struct pipe_screen *screen ) void sp_destroy_tex_tile_cache(struct softpipe_tex_tile_cache *tc) { - struct pipe_screen *screen; uint pos; for (pos = 0; pos < NUM_ENTRIES; pos++) { /*assert(tc->entries[pos].x < 0);*/ } if (tc->transfer) { - screen = tc->transfer->texture->screen; - screen->tex_transfer_destroy(tc->transfer); + tc->pipe->tex_transfer_destroy(tc->transfer); } if (tc->tex_trans) { - screen = tc->tex_trans->texture->screen; - screen->tex_transfer_destroy(tc->tex_trans); + tc->pipe->tex_transfer_destroy(tc->tex_trans); } FREE( tc ); @@ -88,7 +85,7 @@ void sp_tex_tile_cache_map_transfers(struct softpipe_tex_tile_cache *tc) { if (tc->tex_trans && !tc->tex_trans_map) - tc->tex_trans_map = tc->screen->transfer_map(tc->screen, tc->tex_trans); + tc->tex_trans_map = tc->pipe->transfer_map(tc->pipe, tc->tex_trans); } @@ -96,7 +93,7 @@ void sp_tex_tile_cache_unmap_transfers(struct softpipe_tex_tile_cache *tc) { if (tc->tex_trans_map) { - tc->screen->transfer_unmap(tc->screen, tc->tex_trans); + tc->pipe->transfer_unmap(tc->pipe, tc->tex_trans); tc->tex_trans_map = NULL; } } @@ -133,14 +130,12 @@ sp_tex_tile_cache_set_texture(struct softpipe_tex_tile_cache *tc, pipe_texture_reference(&tc->texture, texture); if (tc->tex_trans) { - struct pipe_screen *screen = tc->tex_trans->texture->screen; - if (tc->tex_trans_map) { - screen->transfer_unmap(screen, tc->tex_trans); + tc->pipe->transfer_unmap(tc->pipe, tc->tex_trans); tc->tex_trans_map = NULL; } - screen->tex_transfer_destroy(tc->tex_trans); + tc->pipe->tex_transfer_destroy(tc->tex_trans); tc->tex_trans = NULL; } @@ -204,7 +199,6 @@ const struct softpipe_tex_cached_tile * sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc, union tex_tile_address addr ) { - struct pipe_screen *screen = tc->screen; struct softpipe_tex_cached_tile *tile; tile = tc->entries + tex_cache_pos( addr ); @@ -232,16 +226,16 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc, if (tc->tex_trans) { if (tc->tex_trans_map) { - tc->screen->transfer_unmap(tc->screen, tc->tex_trans); + tc->pipe->transfer_unmap(tc->pipe, tc->tex_trans); tc->tex_trans_map = NULL; } - screen->tex_transfer_destroy(tc->tex_trans); + tc->pipe->tex_transfer_destroy(tc->tex_trans); tc->tex_trans = NULL; } tc->tex_trans = - screen->get_tex_transfer(screen, tc->texture, + tc->pipe->get_tex_transfer(tc->pipe, tc->texture, addr.bits.face, addr.bits.level, addr.bits.z, @@ -249,7 +243,7 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc, u_minify(tc->texture->width0, addr.bits.level), u_minify(tc->texture->height0, addr.bits.level)); - tc->tex_trans_map = screen->transfer_map(screen, tc->tex_trans); + tc->tex_trans_map = tc->pipe->transfer_map(tc->pipe, tc->tex_trans); tc->tex_face = addr.bits.face; tc->tex_level = addr.bits.level; diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.h b/src/gallium/drivers/softpipe/sp_tex_tile_cache.h index ac6886a3df..b116397258 100644 --- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.h +++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.h @@ -70,7 +70,7 @@ struct softpipe_tex_cached_tile struct softpipe_tex_tile_cache { - struct pipe_screen *screen; + struct pipe_context *pipe; struct pipe_transfer *transfer; void *transfer_map; @@ -88,7 +88,7 @@ struct softpipe_tex_tile_cache extern struct softpipe_tex_tile_cache * -sp_create_tex_tile_cache( struct pipe_screen *screen ); +sp_create_tex_tile_cache( struct pipe_context *pipe ); extern void sp_destroy_tex_tile_cache(struct softpipe_tex_tile_cache *tc); diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 11d184effb..adae48c474 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -256,7 +256,7 @@ softpipe_tex_surface_destroy(struct pipe_surface *surf) * \param height height of region to read/write */ static struct pipe_transfer * -softpipe_get_tex_transfer(struct pipe_screen *screen, +softpipe_get_tex_transfer(struct pipe_context *pipe, struct pipe_texture *texture, unsigned face, unsigned level, unsigned zslice, enum pipe_transfer_usage usage, @@ -277,6 +277,7 @@ softpipe_get_tex_transfer(struct pipe_screen *screen, struct pipe_transfer *pt = &spt->base; int nblocksy = util_format_get_nblocksy(texture->format, u_minify(texture->height0, level)); pipe_texture_reference(&pt->texture, texture); + pt->pipe = pipe; pt->x = x; pt->y = y; pt->width = w; @@ -326,7 +327,7 @@ softpipe_tex_transfer_destroy(struct pipe_transfer *transfer) * Create memory mapping for given pipe_transfer object. */ static void * -softpipe_transfer_map( struct pipe_screen *screen, +softpipe_transfer_map( struct pipe_context *pipe, struct pipe_transfer *transfer ) { ubyte *map, *xfer_map; @@ -339,7 +340,7 @@ softpipe_transfer_map( struct pipe_screen *screen, if (spt->dt) { /* display target */ - struct sw_winsys *winsys = softpipe_screen(screen)->winsys; + struct sw_winsys *winsys = softpipe_screen(pipe->screen)->winsys; map = winsys->displaytarget_map(winsys, spt->dt, pipe_transfer_buffer_flags(transfer)); @@ -359,7 +360,7 @@ softpipe_transfer_map( struct pipe_screen *screen, /* Do something to notify sharing contexts of a texture change. * In softpipe, that would mean flushing the texture cache. */ - softpipe_screen(screen)->timestamp++; + softpipe_screen(pipe->screen)->timestamp++; } xfer_map = map + softpipe_transfer(transfer)->offset + @@ -374,7 +375,7 @@ softpipe_transfer_map( struct pipe_screen *screen, * Unmap memory mapping for given pipe_transfer object. */ static void -softpipe_transfer_unmap(struct pipe_screen *screen, +softpipe_transfer_unmap(struct pipe_context *pipe, struct pipe_transfer *transfer) { struct softpipe_texture *spt; @@ -384,7 +385,7 @@ softpipe_transfer_unmap(struct pipe_screen *screen, if (spt->dt) { /* display target */ - struct sw_winsys *winsys = softpipe_screen(screen)->winsys; + struct sw_winsys *winsys = softpipe_screen(pipe->screen)->winsys; winsys->displaytarget_unmap(winsys, spt->dt); } @@ -447,6 +448,15 @@ softpipe_video_surface_destroy(struct pipe_video_surface *vsfc) } +void +softpipe_init_texture_funcs(struct pipe_context *pipe) +{ + pipe->get_tex_transfer = softpipe_get_tex_transfer; + pipe->tex_transfer_destroy = softpipe_tex_transfer_destroy; + pipe->transfer_map = softpipe_transfer_map; + pipe->transfer_unmap = softpipe_transfer_unmap; +} + void softpipe_init_screen_texture_funcs(struct pipe_screen *screen) { @@ -456,11 +466,6 @@ softpipe_init_screen_texture_funcs(struct pipe_screen *screen) screen->get_tex_surface = softpipe_get_tex_surface; screen->tex_surface_destroy = softpipe_tex_surface_destroy; - screen->get_tex_transfer = softpipe_get_tex_transfer; - screen->tex_transfer_destroy = softpipe_tex_transfer_destroy; - screen->transfer_map = softpipe_transfer_map; - screen->transfer_unmap = softpipe_transfer_unmap; - screen->video_surface_create = softpipe_video_surface_create; screen->video_surface_destroy = softpipe_video_surface_destroy; } diff --git a/src/gallium/drivers/softpipe/sp_texture.h b/src/gallium/drivers/softpipe/sp_texture.h index 1c8636d1d5..c0e6ba8a86 100644 --- a/src/gallium/drivers/softpipe/sp_texture.h +++ b/src/gallium/drivers/softpipe/sp_texture.h @@ -107,5 +107,8 @@ softpipe_video_surface(struct pipe_video_surface *pvs) extern void softpipe_init_screen_texture_funcs(struct pipe_screen *screen); +void +softpipe_init_texture_funcs(struct pipe_context *pipe); + #endif /* SP_TEXTURE */ diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index aedfdf1b46..d779816790 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -79,20 +79,20 @@ clear_clear_flag(uint *bitvec, union tile_address addr) struct softpipe_tile_cache * -sp_create_tile_cache( struct pipe_screen *screen ) +sp_create_tile_cache( struct pipe_context *pipe ) { struct softpipe_tile_cache *tc; uint pos; int maxLevels, maxTexSize; /* sanity checking: max sure MAX_WIDTH/HEIGHT >= largest texture image */ - maxLevels = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS); + maxLevels = pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS); maxTexSize = 1 << (maxLevels - 1); assert(MAX_WIDTH >= maxTexSize); tc = CALLOC_STRUCT( softpipe_tile_cache ); if (tc) { - tc->screen = screen; + tc->pipe = pipe; for (pos = 0; pos < NUM_ENTRIES; pos++) { tc->entries[pos].addr.bits.invalid = 1; } @@ -115,15 +115,13 @@ sp_create_tile_cache( struct pipe_screen *screen ) void sp_destroy_tile_cache(struct softpipe_tile_cache *tc) { - struct pipe_screen *screen; uint pos; for (pos = 0; pos < NUM_ENTRIES; pos++) { /*assert(tc->entries[pos].x < 0);*/ } if (tc->transfer) { - screen = tc->transfer->texture->screen; - screen->tex_transfer_destroy(tc->transfer); + tc->pipe->tex_transfer_destroy(tc->transfer); } FREE( tc ); @@ -137,27 +135,25 @@ void sp_tile_cache_set_surface(struct softpipe_tile_cache *tc, struct pipe_surface *ps) { - if (tc->transfer) { - struct pipe_screen *screen = tc->transfer->texture->screen; + struct pipe_context *pipe = tc->pipe; + if (tc->transfer) { if (ps == tc->surface) return; if (tc->transfer_map) { - screen->transfer_unmap(screen, tc->transfer); + pipe->transfer_unmap(pipe, tc->transfer); tc->transfer_map = NULL; } - screen->tex_transfer_destroy(tc->transfer); + pipe->tex_transfer_destroy(tc->transfer); tc->transfer = NULL; } tc->surface = ps; if (ps) { - struct pipe_screen *screen = ps->texture->screen; - - tc->transfer = screen->get_tex_transfer(screen, ps->texture, ps->face, + tc->transfer = pipe->get_tex_transfer(pipe, ps->texture, ps->face, ps->level, ps->zslice, PIPE_TRANSFER_READ_WRITE, 0, 0, ps->width, ps->height); @@ -187,7 +183,7 @@ void sp_tile_cache_map_transfers(struct softpipe_tile_cache *tc) { if (tc->transfer && !tc->transfer_map) - tc->transfer_map = tc->screen->transfer_map(tc->screen, tc->transfer); + tc->transfer_map = tc->pipe->transfer_map(tc->pipe, tc->transfer); } @@ -195,7 +191,7 @@ void sp_tile_cache_unmap_transfers(struct softpipe_tile_cache *tc) { if (tc->transfer_map) { - tc->screen->transfer_unmap(tc->screen, tc->transfer); + tc->pipe->transfer_unmap(tc->pipe, tc->transfer); tc->transfer_map = NULL; } } diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.h b/src/gallium/drivers/softpipe/sp_tile_cache.h index a12092702a..753d8c0daa 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.h +++ b/src/gallium/drivers/softpipe/sp_tile_cache.h @@ -80,7 +80,7 @@ struct softpipe_cached_tile struct softpipe_tile_cache { - struct pipe_screen *screen; + struct pipe_context *pipe; struct pipe_surface *surface; /**< the surface we're caching */ struct pipe_transfer *transfer; void *transfer_map; @@ -98,7 +98,7 @@ struct softpipe_tile_cache extern struct softpipe_tile_cache * -sp_create_tile_cache( struct pipe_screen *screen ); +sp_create_tile_cache( struct pipe_context *pipe ); extern void sp_destroy_tile_cache(struct softpipe_tile_cache *tc); diff --git a/src/gallium/drivers/svga/svga_screen_texture.c b/src/gallium/drivers/svga/svga_screen_texture.c index 5b581debfc..065b8748a3 100644 --- a/src/gallium/drivers/svga/svga_screen_texture.c +++ b/src/gallium/drivers/svga/svga_screen_texture.c @@ -783,15 +783,17 @@ svga_surface_needs_propagation(struct pipe_surface *surf) return s->dirty && s->handle != tex->handle; } - +/* XXX: Still implementing this as if it was a screen function, but + * can now modify it to queue transfers on the context. + */ static struct pipe_transfer * -svga_get_tex_transfer(struct pipe_screen *screen, - struct pipe_texture *texture, - unsigned face, unsigned level, unsigned zslice, - enum pipe_transfer_usage usage, unsigned x, unsigned y, - unsigned w, unsigned h) +svga_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, + unsigned w, unsigned h) { - struct svga_screen *ss = svga_screen(screen); + struct svga_screen *ss = svga_screen(pipe->screen); struct svga_winsys_screen *sws = ss->sws; struct svga_transfer *st; unsigned nblocksx = util_format_get_nblocksx(texture->format, w); @@ -859,11 +861,14 @@ no_hwbuf: } +/* XXX: Still implementing this as if it was a screen function, but + * can now modify it to queue transfers on the context. + */ static void * -svga_transfer_map( struct pipe_screen *screen, +svga_transfer_map( struct pipe_context *pipe, struct pipe_transfer *transfer ) { - struct svga_screen *ss = svga_screen(screen); + struct svga_screen *ss = svga_screen(pipe->screen); struct svga_winsys_screen *sws = ss->sws; struct svga_transfer *st = svga_transfer(transfer); @@ -877,11 +882,14 @@ svga_transfer_map( struct pipe_screen *screen, } +/* XXX: Still implementing this as if it was a screen function, but + * can now modify it to queue transfers on the context. + */ static void -svga_transfer_unmap(struct pipe_screen *screen, +svga_transfer_unmap(struct pipe_context *pipe, struct pipe_transfer *transfer) { - struct svga_screen *ss = svga_screen(screen); + struct svga_screen *ss = svga_screen(pipe->screen); struct svga_winsys_screen *sws = ss->sws; struct svga_transfer *st = svga_transfer(transfer); @@ -911,6 +919,17 @@ svga_tex_transfer_destroy(struct pipe_transfer *transfer) FREE(st); } + +void +svga_init_texture_functions(struct pipe_context *pipe) +{ + pipe->get_tex_transfer = svga_get_tex_transfer; + pipe->transfer_map = svga_transfer_map; + pipe->transfer_unmap = svga_transfer_unmap; + pipe->tex_transfer_destroy = svga_tex_transfer_destroy; +} + + void svga_screen_init_texture_functions(struct pipe_screen *screen) { @@ -920,10 +939,6 @@ svga_screen_init_texture_functions(struct pipe_screen *screen) screen->texture_destroy = svga_texture_destroy; screen->get_tex_surface = svga_get_tex_surface; screen->tex_surface_destroy = svga_tex_surface_destroy; - screen->get_tex_transfer = svga_get_tex_transfer; - screen->transfer_map = svga_transfer_map; - screen->transfer_unmap = svga_transfer_unmap; - screen->tex_transfer_destroy = svga_tex_transfer_destroy; } /*********************************************************************** diff --git a/src/gallium/drivers/svga/svga_screen_texture.h b/src/gallium/drivers/svga/svga_screen_texture.h index ca6602b436..96d035b12d 100644 --- a/src/gallium/drivers/svga/svga_screen_texture.h +++ b/src/gallium/drivers/svga/svga_screen_texture.h @@ -186,6 +186,9 @@ svga_surface_needs_propagation(struct pipe_surface *surf); extern void svga_screen_init_texture_functions(struct pipe_screen *screen); +void +svga_init_texture_functions(struct pipe_context *pipe); + enum SVGA3dSurfaceFormat svga_translate_format(enum pipe_format format); diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 133521f45e..4a0e9ac17d 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -27,7 +27,9 @@ #include "util/u_memory.h" #include "util/u_simple_list.h" +#include "util/u_format.h" +#include "pipe/p_format.h" #include "pipe/p_screen.h" #include "tr_dump.h" @@ -1283,6 +1285,135 @@ trace_is_buffer_referenced( struct pipe_context *_pipe, return referenced; } + +/******************************************************************** + * transfer + */ + + +static struct pipe_transfer * +trace_context_get_tex_transfer(struct pipe_context *_context, + struct pipe_texture *_texture, + unsigned face, unsigned level, + unsigned zslice, + enum pipe_transfer_usage usage, + unsigned x, unsigned y, unsigned w, unsigned h) +{ + struct trace_context *tr_context = trace_context(_context); + struct trace_texture *tr_tex = trace_texture(_texture); + struct pipe_context *context = tr_context->pipe; + struct pipe_texture *texture = tr_tex->texture; + struct pipe_transfer *result = NULL; + + assert(texture->screen == context->screen); + + trace_dump_call_begin("pipe_context", "get_tex_transfer"); + + trace_dump_arg(ptr, context); + trace_dump_arg(ptr, texture); + trace_dump_arg(uint, face); + trace_dump_arg(uint, level); + trace_dump_arg(uint, zslice); + trace_dump_arg(uint, usage); + + trace_dump_arg(uint, x); + trace_dump_arg(uint, y); + trace_dump_arg(uint, w); + trace_dump_arg(uint, h); + + result = context->get_tex_transfer(context, texture, face, level, zslice, usage, + x, y, w, h); + + trace_dump_ret(ptr, result); + + trace_dump_call_end(); + + if (result) + result = trace_transfer_create(tr_context, tr_tex, result); + + return result; +} + + +static void +trace_context_tex_transfer_destroy(struct pipe_transfer *_transfer) +{ + struct trace_context *tr_ctx = trace_context(_transfer->pipe); + struct trace_transfer *tr_trans = trace_transfer(_transfer); + struct pipe_context *context = tr_ctx->pipe; + struct pipe_transfer *transfer = tr_trans->transfer; + + trace_dump_call_begin("pipe_context", "tex_transfer_destroy"); + + trace_dump_arg(ptr, context); + trace_dump_arg(ptr, transfer); + + trace_dump_call_end(); + + trace_transfer_destroy(tr_trans); +} + + +static void * +trace_context_transfer_map(struct pipe_context *_context, + struct pipe_transfer *_transfer) +{ + struct trace_context *tr_context = trace_context(_context); + struct trace_transfer *tr_trans = trace_transfer(_transfer); + struct pipe_context *context = tr_context->pipe; + struct pipe_transfer *transfer = tr_trans->transfer; + void *map; + + map = context->transfer_map(context, transfer); + if(map) { + if(transfer->usage & PIPE_TRANSFER_WRITE) { + assert(!tr_trans->map); + tr_trans->map = map; + } + } + + return map; +} + + +static void +trace_context_transfer_unmap(struct pipe_context *_context, + struct pipe_transfer *_transfer) +{ + struct trace_context *tr_ctx = trace_context(_context); + struct trace_transfer *tr_trans = trace_transfer(_transfer); + struct pipe_context *context = tr_ctx->pipe; + struct pipe_transfer *transfer = tr_trans->transfer; + + if(tr_trans->map) { + size_t size = util_format_get_nblocksy(transfer->texture->format, transfer->height) * transfer->stride; + + trace_dump_call_begin("pipe_context", "transfer_write"); + + trace_dump_arg(ptr, context); + + trace_dump_arg(ptr, transfer); + + trace_dump_arg_begin("stride"); + trace_dump_uint(transfer->stride); + trace_dump_arg_end(); + + trace_dump_arg_begin("data"); + trace_dump_bytes(tr_trans->map, size); + trace_dump_arg_end(); + + trace_dump_arg_begin("size"); + trace_dump_uint(size); + trace_dump_arg_end(); + + trace_dump_call_end(); + + tr_trans->map = NULL; + } + + context->transfer_unmap(context, transfer); +} + static const struct debug_named_value rbug_blocker_flags[] = { {"before", 1}, {"after", 2}, @@ -1367,6 +1498,11 @@ trace_context_create(struct trace_screen *tr_scr, tr_ctx->base.is_texture_referenced = trace_is_texture_referenced; tr_ctx->base.is_buffer_referenced = trace_is_buffer_referenced; + tr_ctx->base.get_tex_transfer = trace_context_get_tex_transfer; + tr_ctx->base.tex_transfer_destroy = trace_context_tex_transfer_destroy; + tr_ctx->base.transfer_map = trace_context_transfer_map; + tr_ctx->base.transfer_unmap = trace_context_transfer_unmap; + tr_ctx->pipe = pipe; trace_screen_add_to_list(tr_scr, contexts, tr_ctx); diff --git a/src/gallium/drivers/trace/tr_rbug.c b/src/gallium/drivers/trace/tr_rbug.c index a43adac694..b36865400d 100644 --- a/src/gallium/drivers/trace/tr_rbug.c +++ b/src/gallium/drivers/trace/tr_rbug.c @@ -219,7 +219,7 @@ trace_rbug_texture_read(struct trace_rbug *tr_rbug, struct rbug_header *header, struct trace_texture *tr_tex = NULL; struct tr_list *ptr; - struct pipe_screen *screen = tr_scr->screen; + struct pipe_context *context = tr_scr->private_context; struct pipe_texture *tex; struct pipe_transfer *t; @@ -239,12 +239,12 @@ trace_rbug_texture_read(struct trace_rbug *tr_rbug, struct rbug_header *header, } tex = tr_tex->texture; - t = screen->get_tex_transfer(tr_scr->screen, tex, - gptr->face, gptr->level, gptr->zslice, - PIPE_TRANSFER_READ, - gptr->x, gptr->y, gptr->w, gptr->h); + t = context->get_tex_transfer(context, tex, + gptr->face, gptr->level, gptr->zslice, + PIPE_TRANSFER_READ, + gptr->x, gptr->y, gptr->w, gptr->h); - map = screen->transfer_map(screen, t); + map = context->transfer_map(context, t); rbug_send_texture_read_reply(tr_rbug->con, serial, t->texture->format, @@ -256,8 +256,8 @@ trace_rbug_texture_read(struct trace_rbug *tr_rbug, struct rbug_header *header, t->stride, NULL); - screen->transfer_unmap(screen, t); - screen->tex_transfer_destroy(t); + context->transfer_unmap(context, t); + context->tex_transfer_destroy(t); pipe_mutex_unlock(tr_scr->list_mutex); diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index 86ddb99540..25990bdac7 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -353,133 +353,7 @@ trace_screen_tex_surface_destroy(struct pipe_surface *_surface) } -/******************************************************************** - * transfer - */ - - -static struct pipe_transfer * -trace_screen_get_tex_transfer(struct pipe_screen *_screen, - struct pipe_texture *_texture, - unsigned face, unsigned level, - unsigned zslice, - enum pipe_transfer_usage usage, - unsigned x, unsigned y, unsigned w, unsigned h) -{ - struct trace_screen *tr_scr = trace_screen(_screen); - struct trace_texture *tr_tex = trace_texture(_texture); - struct pipe_screen *screen = tr_scr->screen; - struct pipe_texture *texture = tr_tex->texture; - struct pipe_transfer *result = NULL; - - assert(texture->screen == screen); - - trace_dump_call_begin("pipe_screen", "get_tex_transfer"); - - trace_dump_arg(ptr, screen); - trace_dump_arg(ptr, texture); - trace_dump_arg(uint, face); - trace_dump_arg(uint, level); - trace_dump_arg(uint, zslice); - trace_dump_arg(uint, usage); - - trace_dump_arg(uint, x); - trace_dump_arg(uint, y); - trace_dump_arg(uint, w); - trace_dump_arg(uint, h); - - result = screen->get_tex_transfer(screen, texture, face, level, zslice, usage, - x, y, w, h); - - trace_dump_ret(ptr, result); - - trace_dump_call_end(); - - if (result) - result = trace_transfer_create(tr_tex, result); - - return result; -} - - -static void -trace_screen_tex_transfer_destroy(struct pipe_transfer *_transfer) -{ - struct trace_screen *tr_scr = trace_screen(_transfer->texture->screen); - struct trace_transfer *tr_trans = trace_transfer(_transfer); - struct pipe_screen *screen = tr_scr->screen; - struct pipe_transfer *transfer = tr_trans->transfer; - - trace_dump_call_begin("pipe_screen", "tex_transfer_destroy"); - - trace_dump_arg(ptr, screen); - trace_dump_arg(ptr, transfer); - - trace_dump_call_end(); - - trace_transfer_destroy(tr_trans); -} - - -static void * -trace_screen_transfer_map(struct pipe_screen *_screen, - struct pipe_transfer *_transfer) -{ - struct trace_screen *tr_scr = trace_screen(_screen); - struct trace_transfer *tr_trans = trace_transfer(_transfer); - struct pipe_screen *screen = tr_scr->screen; - struct pipe_transfer *transfer = tr_trans->transfer; - void *map; - - map = screen->transfer_map(screen, transfer); - if(map) { - if(transfer->usage & PIPE_TRANSFER_WRITE) { - assert(!tr_trans->map); - tr_trans->map = map; - } - } - - return map; -} - - -static void -trace_screen_transfer_unmap(struct pipe_screen *_screen, - struct pipe_transfer *_transfer) -{ - struct trace_screen *tr_scr = trace_screen(_screen); - struct trace_transfer *tr_trans = trace_transfer(_transfer); - struct pipe_screen *screen = tr_scr->screen; - struct pipe_transfer *transfer = tr_trans->transfer; - - if(tr_trans->map) { - size_t size = util_format_get_nblocksy(transfer->texture->format, transfer->height) * transfer->stride; - - trace_dump_call_begin("pipe_screen", "transfer_write"); - - trace_dump_arg(ptr, screen); - - trace_dump_arg(ptr, transfer); - - trace_dump_arg_begin("stride"); - trace_dump_uint(transfer->stride); - trace_dump_arg_end(); - - trace_dump_arg_begin("data"); - trace_dump_bytes(tr_trans->map, size); - trace_dump_arg_end(); - trace_dump_arg_begin("size"); - trace_dump_uint(size); - trace_dump_arg_end(); - - trace_dump_call_end(); - - tr_trans->map = NULL; - } - - screen->transfer_unmap(screen, transfer); -} /******************************************************************** @@ -901,10 +775,6 @@ trace_screen_create(struct pipe_screen *screen) tr_scr->base.texture_destroy = trace_screen_texture_destroy; tr_scr->base.get_tex_surface = trace_screen_get_tex_surface; tr_scr->base.tex_surface_destroy = trace_screen_tex_surface_destroy; - tr_scr->base.get_tex_transfer = trace_screen_get_tex_transfer; - tr_scr->base.tex_transfer_destroy = trace_screen_tex_transfer_destroy; - tr_scr->base.transfer_map = trace_screen_transfer_map; - tr_scr->base.transfer_unmap = trace_screen_transfer_unmap; tr_scr->base.buffer_create = trace_screen_buffer_create; tr_scr->base.user_buffer_create = trace_screen_user_buffer_create; if (screen->buffer_map) @@ -920,7 +790,11 @@ trace_screen_create(struct pipe_screen *screen) tr_scr->base.fence_signalled = trace_screen_fence_signalled; tr_scr->base.fence_finish = trace_screen_fence_finish; tr_scr->base.flush_frontbuffer = trace_screen_flush_frontbuffer; + tr_scr->screen = screen; + tr_scr->private_context = screen->context_create(screen, NULL); + if (tr_scr->private_context == NULL) + goto error3; trace_dump_ret(ptr, screen); trace_dump_call_end(); @@ -930,10 +804,8 @@ trace_screen_create(struct pipe_screen *screen) return &tr_scr->base; -#if 0 error3: FREE(tr_scr); -#endif error2: trace_dump_ret(ptr, screen); trace_dump_call_end(); diff --git a/src/gallium/drivers/trace/tr_screen.h b/src/gallium/drivers/trace/tr_screen.h index 597e2fc265..9bfbe72e2c 100644 --- a/src/gallium/drivers/trace/tr_screen.h +++ b/src/gallium/drivers/trace/tr_screen.h @@ -56,6 +56,7 @@ struct trace_screen struct pipe_screen base; struct pipe_screen *screen; + struct pipe_context *private_context; /* remote debugger */ struct trace_rbug *rbug; diff --git a/src/gallium/drivers/trace/tr_texture.c b/src/gallium/drivers/trace/tr_texture.c index 5321d68ec0..b70ccb9ce8 100644 --- a/src/gallium/drivers/trace/tr_texture.c +++ b/src/gallium/drivers/trace/tr_texture.c @@ -31,6 +31,7 @@ #include "util/u_simple_list.h" #include "tr_screen.h" +#include "tr_context.h" #include "tr_texture.h" @@ -124,8 +125,9 @@ trace_surface_destroy(struct trace_surface *tr_surf) struct pipe_transfer * -trace_transfer_create(struct trace_texture *tr_tex, - struct pipe_transfer *transfer) +trace_transfer_create(struct trace_context *tr_ctx, + struct trace_texture *tr_tex, + struct pipe_transfer *transfer) { struct trace_screen *tr_scr = trace_screen(tr_tex->base.screen); struct trace_transfer *tr_trans; @@ -141,6 +143,7 @@ trace_transfer_create(struct trace_texture *tr_tex, memcpy(&tr_trans->base, transfer, sizeof(struct pipe_transfer)); + tr_trans->base.pipe = &tr_ctx->base; tr_trans->base.texture = NULL; pipe_texture_reference(&tr_trans->base.texture, &tr_tex->base); tr_trans->transfer = transfer; @@ -151,7 +154,7 @@ trace_transfer_create(struct trace_texture *tr_tex, return &tr_trans->base; error: - transfer->texture->screen->tex_transfer_destroy(transfer); + tr_ctx->pipe->tex_transfer_destroy(transfer); return NULL; } @@ -160,12 +163,12 @@ void trace_transfer_destroy(struct trace_transfer *tr_trans) { struct trace_screen *tr_scr = trace_screen(tr_trans->base.texture->screen); - struct pipe_screen *screen = tr_trans->transfer->texture->screen; + struct pipe_context *context = tr_trans->transfer->pipe; trace_screen_remove_from_list(tr_scr, transfers, tr_trans); pipe_texture_reference(&tr_trans->base.texture, NULL); - screen->tex_transfer_destroy(tr_trans->transfer); + context->tex_transfer_destroy(tr_trans->transfer); FREE(tr_trans); } diff --git a/src/gallium/drivers/trace/tr_texture.h b/src/gallium/drivers/trace/tr_texture.h index 395e523e73..ab284eeef3 100644 --- a/src/gallium/drivers/trace/tr_texture.h +++ b/src/gallium/drivers/trace/tr_texture.h @@ -34,6 +34,7 @@ #include "tr_screen.h" +struct trace_context; struct trace_texture { @@ -112,8 +113,9 @@ void trace_surface_destroy(struct trace_surface *tr_surf); struct pipe_transfer * -trace_transfer_create(struct trace_texture *tr_tex, - struct pipe_transfer *transfer); +trace_transfer_create(struct trace_context *tr_ctx, + struct trace_texture *tr_tex, + struct pipe_transfer *transfer); void trace_transfer_destroy(struct trace_transfer *tr_trans); diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 376b01aa69..494b53e912 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -306,6 +306,32 @@ struct pipe_context { */ unsigned int (*is_buffer_referenced)(struct pipe_context *pipe, struct pipe_buffer *buf); + + + + /** + * Get a transfer object for transferring data to/from a texture. + * + * Transfers are (by default) context-private and allow uploads to be + * interleaved with + */ + struct pipe_transfer *(*get_tex_transfer)(struct pipe_context *, + struct pipe_texture *texture, + unsigned face, unsigned level, + unsigned zslice, + enum pipe_transfer_usage usage, + unsigned x, unsigned y, + unsigned w, unsigned h); + + void (*tex_transfer_destroy)(struct pipe_transfer *); + + void *(*transfer_map)( struct pipe_context *, + struct pipe_transfer *transfer ); + + void (*transfer_unmap)( struct pipe_context *, + struct pipe_transfer *transfer ); + + }; diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index b771bfe85e..b7cb83abbe 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -142,23 +142,6 @@ struct pipe_screen { void (*tex_surface_destroy)(struct pipe_surface *); - /** Get a transfer object for transferring data to/from a texture */ - struct pipe_transfer *(*get_tex_transfer)(struct pipe_screen *, - struct pipe_texture *texture, - unsigned face, unsigned level, - unsigned zslice, - enum pipe_transfer_usage usage, - unsigned x, unsigned y, - unsigned w, unsigned h); - - void (*tex_transfer_destroy)(struct pipe_transfer *); - - void *(*transfer_map)( struct pipe_screen *, - struct pipe_transfer *transfer ); - - void (*transfer_unmap)( struct pipe_screen *, - struct pipe_transfer *transfer ); - /** * Create a new buffer. diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 3a97d888ce..2af933207d 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -304,6 +304,8 @@ struct pipe_surface */ struct pipe_transfer { + struct pipe_context *pipe; + unsigned x; /**< x offset from start of texture image */ unsigned y; /**< y offset from start of texture image */ unsigned width; /**< logical width in pixels */ diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c index 02248ad433..6e79dd370f 100644 --- a/src/gallium/state_trackers/vega/api_filters.c +++ b/src/gallium/state_trackers/vega/api_filters.c @@ -78,14 +78,14 @@ static INLINE struct pipe_texture *create_texture_1d(struct vg_context *ctx, { /* upload color_data */ struct pipe_transfer *transfer = - screen->get_tex_transfer(screen, tex, - 0, 0, 0, - PIPE_TRANSFER_READ_WRITE , - 0, 0, tex->width0, tex->height0); - void *map = screen->transfer_map(screen, transfer); + pipe->get_tex_transfer(pipe, tex, + 0, 0, 0, + PIPE_TRANSFER_READ_WRITE , + 0, 0, tex->width0, tex->height0); + void *map = pipe->transfer_map(pipe, transfer); memcpy(map, color_data, sizeof(VGint)*color_data_len); - screen->transfer_unmap(screen, transfer); - screen->tex_transfer_destroy(transfer); + pipe->transfer_unmap(pipe, transfer); + pipe->tex_transfer_destroy(transfer); } return tex; diff --git a/src/gallium/state_trackers/vega/api_images.c b/src/gallium/state_trackers/vega/api_images.c index 015241498e..432ba68139 100644 --- a/src/gallium/state_trackers/vega/api_images.c +++ b/src/gallium/state_trackers/vega/api_images.c @@ -397,7 +397,6 @@ void vgReadPixels(void * data, VGint dataStride, { struct vg_context *ctx = vg_current_context(); struct pipe_context *pipe = ctx->pipe; - struct pipe_screen *screen = pipe->screen; struct st_framebuffer *stfb = ctx->draw_buffer; struct st_renderbuffer *strb = stfb->strb; @@ -442,7 +441,7 @@ void vgReadPixels(void * data, VGint dataStride, { struct pipe_transfer *transfer; - transfer = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0, + transfer = pipe->get_tex_transfer(pipe, strb->texture, 0, 0, 0, PIPE_TRANSFER_READ, 0, 0, width, height); @@ -458,7 +457,7 @@ void vgReadPixels(void * data, VGint dataStride, dst += dataStride; } - screen->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(transfer); } } diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c index 41c979bfec..604a86aeb8 100644 --- a/src/gallium/state_trackers/vega/image.c +++ b/src/gallium/state_trackers/vega/image.c @@ -378,7 +378,7 @@ void image_sub_data(struct vg_image *image, VGfloat *df = (VGfloat*)temp; VGint i; struct vg_context *ctx = vg_current_context(); - struct pipe_screen *screen = ctx->pipe->screen; + struct pipe_context *pipe = ctx->pipe; struct pipe_texture *texture = image_texture(image); VGint xoffset = 0, yoffset = 0; @@ -412,8 +412,8 @@ void image_sub_data(struct vg_image *image, } { /* upload color_data */ - struct pipe_transfer *transfer = screen->get_tex_transfer( - screen, texture, 0, 0, 0, + struct pipe_transfer *transfer = pipe->get_tex_transfer( + pipe, texture, 0, 0, 0, PIPE_TRANSFER_WRITE, 0, 0, texture->width0, texture->height0); src += (dataStride * yoffset); for (i = 0; i < height; i++) { @@ -422,7 +422,7 @@ void image_sub_data(struct vg_image *image, y += yStep; src += dataStride; } - screen->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(transfer); } } @@ -435,7 +435,6 @@ void image_get_sub_data(struct vg_image * image, { struct vg_context *ctx = vg_current_context(); struct pipe_context *pipe = ctx->pipe; - struct pipe_screen *screen = pipe->screen; VGfloat temp[VEGA_MAX_IMAGE_WIDTH][4]; VGfloat *df = (VGfloat*)temp; VGint y = 0, yStep = 1; @@ -444,7 +443,7 @@ void image_get_sub_data(struct vg_image * image, { struct pipe_transfer *transfer = - screen->get_tex_transfer(screen, + pipe->get_tex_transfer(pipe, image->texture, 0, 0, 0, PIPE_TRANSFER_READ, 0, 0, @@ -461,7 +460,7 @@ void image_get_sub_data(struct vg_image * image, dst += dataStride; } - screen->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(transfer); } } diff --git a/src/gallium/state_trackers/vega/paint.c b/src/gallium/state_trackers/vega/paint.c index cdb87d3bf6..47a7710d3e 100644 --- a/src/gallium/state_trackers/vega/paint.c +++ b/src/gallium/state_trackers/vega/paint.c @@ -164,10 +164,10 @@ static INLINE struct pipe_texture *create_gradient_texture(struct vg_paint *p) struct pipe_transfer *transfer = st_no_flush_get_tex_transfer(p->base.ctx, tex, 0, 0, 0, PIPE_TRANSFER_WRITE, 0, 0, 1024, 1); - void *map = screen->transfer_map(screen, transfer); + void *map = pipe->transfer_map(pipe, transfer); memcpy(map, p->gradient.color_data, sizeof(VGint)*1024); - screen->transfer_unmap(screen, transfer); - screen->tex_transfer_destroy(transfer); + pipe->transfer_unmap(pipe, transfer); + pipe->tex_transfer_destroy(transfer); } return tex; diff --git a/src/gallium/state_trackers/vega/st_inlines.h b/src/gallium/state_trackers/vega/st_inlines.h index 419151c3ae..4d12a4efdd 100644 --- a/src/gallium/state_trackers/vega/st_inlines.h +++ b/src/gallium/state_trackers/vega/st_inlines.h @@ -51,7 +51,6 @@ st_cond_flush_get_tex_transfer(struct vg_context *st, unsigned int x, unsigned int y, unsigned int w, unsigned int h) { - struct pipe_screen *screen = st->pipe->screen; struct pipe_context *pipe = st->pipe; unsigned referenced = pipe->is_texture_referenced(pipe, pt, face, level); @@ -60,7 +59,7 @@ st_cond_flush_get_tex_transfer(struct vg_context *st, (usage & PIPE_TRANSFER_WRITE))) vgFlush(); - return screen->get_tex_transfer(screen, pt, face, level, zslice, usage, + return pipe->get_tex_transfer(pipe, pt, face, level, zslice, usage, x, y, w, h); } @@ -74,10 +73,10 @@ st_no_flush_get_tex_transfer(struct vg_context *st, unsigned int x, unsigned int y, unsigned int w, unsigned int h) { - struct pipe_screen *screen = st->pipe->screen; + struct pipe_context *pipe = st->pipe; - return screen->get_tex_transfer(screen, pt, face, level, - zslice, usage, x, y, w, h); + return pipe->get_tex_transfer(pipe, pt, face, level, + zslice, usage, x, y, w, h); } static INLINE void * diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c index 0b2e3f5381..b066f5c94b 100644 --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -138,7 +138,6 @@ static void load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt) { struct pipe_context *pipe = ctx->st->pipe; - struct pipe_screen *screen = pipe->screen; struct pipe_transfer *transfer; const GLuint rSize = ctx->PixelMaps.RtoR.Size; const GLuint gSize = ctx->PixelMaps.GtoG.Size; @@ -151,7 +150,7 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt) transfer = st_cond_flush_get_tex_transfer(st_context(ctx), pt, 0, 0, 0, PIPE_TRANSFER_WRITE, 0, 0, texSize, texSize); - dest = (uint *) screen->transfer_map(screen, transfer); + dest = (uint *) pipe->transfer_map(pipe, transfer); /* Pack four 1D maps into a 2D texture: * R map is placed horizontally, indexed by S, in channel 0 @@ -172,8 +171,8 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt) } } - screen->transfer_unmap(screen, transfer); - screen->tex_transfer_destroy(transfer); + pipe->transfer_unmap(pipe, transfer); + pipe->tex_transfer_destroy(transfer); } diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c index 33e43ddcc4..69a96e5d10 100644 --- a/src/mesa/state_tracker/st_cb_accum.c +++ b/src/mesa/state_tracker/st_cb_accum.c @@ -129,7 +129,6 @@ accum_accum(struct st_context *st, GLfloat value, struct st_renderbuffer *color_strb) { struct pipe_context *pipe = st->pipe; - struct pipe_screen *screen = pipe->screen; struct pipe_transfer *color_trans; size_t stride = acc_strb->stride; GLubyte *data = acc_strb->data; @@ -166,7 +165,7 @@ accum_accum(struct st_context *st, GLfloat value, } free(buf); - screen->tex_transfer_destroy(color_trans); + pipe->tex_transfer_destroy(color_trans); } @@ -177,7 +176,6 @@ accum_load(struct st_context *st, GLfloat value, struct st_renderbuffer *color_strb) { struct pipe_context *pipe = st->pipe; - struct pipe_screen *screen = pipe->screen; struct pipe_transfer *color_trans; size_t stride = acc_strb->stride; GLubyte *data = acc_strb->data; @@ -215,7 +213,7 @@ accum_load(struct st_context *st, GLfloat value, } free(buf); - screen->tex_transfer_destroy(color_trans); + pipe->tex_transfer_destroy(color_trans); } @@ -226,7 +224,6 @@ accum_return(GLcontext *ctx, GLfloat value, struct st_renderbuffer *color_strb) { struct pipe_context *pipe = ctx->st->pipe; - struct pipe_screen *screen = pipe->screen; const GLubyte *colormask = ctx->Color.ColorMask[0]; enum pipe_transfer_usage usage; struct pipe_transfer *color_trans; @@ -283,7 +280,7 @@ accum_return(GLcontext *ctx, GLfloat value, pipe_put_tile_rgba(color_trans, 0, 0, width, height, buf); free(buf); - screen->tex_transfer_destroy(color_trans); + pipe->tex_transfer_destroy(color_trans); } diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index f326601c3b..723c5f180b 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -259,7 +259,6 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height, const GLubyte *bitmap) { struct pipe_context *pipe = ctx->st->pipe; - struct pipe_screen *screen = pipe->screen; struct pipe_transfer *transfer; ubyte *dest; struct pipe_texture *pt; @@ -285,7 +284,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height, PIPE_TRANSFER_WRITE, 0, 0, width, height); - dest = screen->transfer_map(screen, transfer); + dest = pipe->transfer_map(pipe, transfer); /* Put image into texture transfer */ memset(dest, 0xff, height * transfer->stride); @@ -295,8 +294,8 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height, _mesa_unmap_pbo_source(ctx, unpack); /* Release transfer */ - screen->transfer_unmap(screen, transfer); - screen->tex_transfer_destroy(transfer); + pipe->transfer_unmap(pipe, transfer); + pipe->tex_transfer_destroy(transfer); return pt; } @@ -520,7 +519,6 @@ static void reset_cache(struct st_context *st) { struct pipe_context *pipe = st->pipe; - struct pipe_screen *screen = pipe->screen; struct bitmap_cache *cache = st->bitmap.cache; /*memset(cache->buffer, 0xff, sizeof(cache->buffer));*/ @@ -532,7 +530,7 @@ reset_cache(struct st_context *st) cache->ymax = -1000000; if (cache->trans) { - screen->tex_transfer_destroy(cache->trans); + pipe->tex_transfer_destroy(cache->trans); cache->trans = NULL; } @@ -570,7 +568,6 @@ static void create_cache_trans(struct st_context *st) { struct pipe_context *pipe = st->pipe; - struct pipe_screen *screen = pipe->screen; struct bitmap_cache *cache = st->bitmap.cache; if (cache->trans) @@ -583,7 +580,7 @@ create_cache_trans(struct st_context *st) PIPE_TRANSFER_WRITE, 0, 0, BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT); - cache->buffer = screen->transfer_map(screen, cache->trans); + cache->buffer = pipe->transfer_map(pipe, cache->trans); /* init image to all 0xff */ memset(cache->buffer, 0xff, cache->trans->stride * BITMAP_CACHE_HEIGHT); @@ -601,7 +598,6 @@ st_flush_bitmap_cache(struct st_context *st) if (st->ctx->DrawBuffer) { struct pipe_context *pipe = st->pipe; - struct pipe_screen *screen = pipe->screen; assert(cache->xmin <= cache->xmax); @@ -617,10 +613,10 @@ st_flush_bitmap_cache(struct st_context *st) if (cache->trans) { if (0) print_cache(cache); - screen->transfer_unmap(screen, cache->trans); + pipe->transfer_unmap(pipe, cache->trans); cache->buffer = NULL; - screen->tex_transfer_destroy(cache->trans); + pipe->tex_transfer_destroy(cache->trans); cache->trans = NULL; } @@ -823,7 +819,6 @@ void st_destroy_bitmap(struct st_context *st) { struct pipe_context *pipe = st->pipe; - struct pipe_screen *screen = pipe->screen; struct bitmap_cache *cache = st->bitmap.cache; @@ -840,8 +835,8 @@ st_destroy_bitmap(struct st_context *st) if (cache) { if (cache->trans) { - screen->transfer_unmap(screen, cache->trans); - screen->tex_transfer_destroy(cache->trans); + pipe->transfer_unmap(pipe, cache->trans); + pipe->tex_transfer_destroy(cache->trans); } pipe_texture_reference(&st->bitmap.cache->texture, NULL); free(st->bitmap.cache); diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 8eb76f4131..3fa6d12f1c 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -349,7 +349,6 @@ make_texture(struct st_context *st, { GLcontext *ctx = st->ctx; struct pipe_context *pipe = st->pipe; - struct pipe_screen *screen = pipe->screen; gl_format mformat; struct pipe_texture *pt; enum pipe_format pipeFormat; @@ -391,7 +390,7 @@ make_texture(struct st_context *st, width, height); /* map texture transfer */ - dest = screen->transfer_map(screen, transfer); + dest = pipe->transfer_map(pipe, transfer); /* Put image into texture transfer. @@ -411,8 +410,8 @@ make_texture(struct st_context *st, unpack); /* unmap */ - screen->transfer_unmap(screen, transfer); - screen->tex_transfer_destroy(transfer); + pipe->transfer_unmap(pipe, transfer); + pipe->tex_transfer_destroy(transfer); assert(success); @@ -658,7 +657,6 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, { struct st_context *st = st_context(ctx); struct pipe_context *pipe = st->pipe; - struct pipe_screen *screen = pipe->screen; struct st_renderbuffer *strb; enum pipe_transfer_usage usage; struct pipe_transfer *pt; @@ -692,7 +690,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, usage, x, y, width, height); - stmap = screen->transfer_map(screen, pt); + stmap = pipe->transfer_map(pipe, pt); pixels = _mesa_map_pbo_source(ctx, &clippedUnpack, pixels); assert(pixels); @@ -792,8 +790,8 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, _mesa_unmap_pbo_source(ctx, &clippedUnpack); /* unmap the stencil buffer */ - screen->transfer_unmap(screen, pt); - screen->tex_transfer_destroy(pt); + pipe->transfer_unmap(pipe, pt); + pipe->tex_transfer_destroy(pt); } @@ -856,7 +854,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, GLint dstx, GLint dsty) { struct st_renderbuffer *rbDraw = st_renderbuffer(ctx->DrawBuffer->_StencilBuffer); - struct pipe_screen *screen = ctx->st->pipe->screen; + struct pipe_context *pipe = ctx->st->pipe; enum pipe_transfer_usage usage; struct pipe_transfer *ptDraw; ubyte *drawMap; @@ -892,7 +890,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, assert(util_format_get_blockheight(ptDraw->texture->format) == 1); /* map the stencil buffer */ - drawMap = screen->transfer_map(screen, ptDraw); + drawMap = pipe->transfer_map(pipe, ptDraw); /* draw */ /* XXX PixelZoom not handled yet */ @@ -945,8 +943,8 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, free(buffer); /* unmap the stencil buffer */ - screen->transfer_unmap(screen, ptDraw); - screen->tex_transfer_destroy(ptDraw); + pipe->transfer_unmap(pipe, ptDraw); + pipe->tex_transfer_destroy(ptDraw); } @@ -1084,8 +1082,8 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, if (0) { /* debug */ - debug_dump_surface("copypixsrcsurf", psRead); - debug_dump_surface("copypixtemptex", psTex); + debug_dump_surface(pipe, "copypixsrcsurf", psRead); + debug_dump_surface(pipe, "copypixtemptex", psTex); } pipe_surface_reference(&psRead, NULL); @@ -1128,8 +1126,8 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, free(buf); } - screen->tex_transfer_destroy(ptRead); - screen->tex_transfer_destroy(ptTex); + pipe->tex_transfer_destroy(ptRead); + pipe->tex_transfer_destroy(ptTex); } /* draw textured quad */ diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 8cc9cfac76..98ccda821c 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -63,7 +63,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y, GLvoid *pixels) { struct gl_framebuffer *fb = ctx->ReadBuffer; - struct pipe_screen *screen = ctx->st->pipe->screen; + struct pipe_context *pipe = ctx->st->pipe; struct st_renderbuffer *strb = st_renderbuffer(fb->_StencilBuffer); struct pipe_transfer *pt; ubyte *stmap; @@ -81,7 +81,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y, width, height); /* map the stencil buffer */ - stmap = screen->transfer_map(screen, pt); + stmap = pipe->transfer_map(pipe, pt); /* width should never be > MAX_WIDTH since we did clipping earlier */ ASSERT(width <= MAX_WIDTH); @@ -161,8 +161,8 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y, } /* unmap the stencil buffer */ - screen->transfer_unmap(screen, pt); - screen->tex_transfer_destroy(pt); + pipe->transfer_unmap(pipe, pt); + pipe->tex_transfer_destroy(pt); } @@ -234,7 +234,6 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb, { struct pipe_context *pipe = ctx->st->pipe; - struct pipe_screen *screen = pipe->screen; struct pipe_transfer *trans; const GLubyte *map; GLubyte *dst; @@ -253,9 +252,9 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb, return GL_FALSE; } - map = screen->transfer_map(screen, trans); + map = pipe->transfer_map(pipe, trans); if (!map) { - screen->tex_transfer_destroy(trans); + pipe->tex_transfer_destroy(trans); return GL_FALSE; } @@ -317,8 +316,8 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb, ; /* nothing */ } - screen->transfer_unmap(screen, trans); - screen->tex_transfer_destroy(trans); + pipe->transfer_unmap(pipe, trans); + pipe->tex_transfer_destroy(trans); } return GL_TRUE; @@ -337,7 +336,6 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLvoid *dest) { struct pipe_context *pipe = ctx->st->pipe; - struct pipe_screen *screen = pipe->screen; GLfloat temp[MAX_WIDTH][4]; const GLbitfield transferOps = ctx->_ImageTransferState; GLsizei i, j; @@ -541,7 +539,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, } } - screen->tex_transfer_destroy(trans); + pipe->tex_transfer_destroy(trans); _mesa_unmap_pbo_dest(ctx, &clippedPacking); } diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index c849132e74..1b20b615d0 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -371,7 +371,8 @@ compress_with_blit(GLcontext * ctx, { const GLuint dstImageOffsets[1] = {0}; struct st_texture_image *stImage = st_texture_image(texImage); - struct pipe_screen *screen = ctx->st->pipe->screen; + struct pipe_context *pipe = ctx->st->pipe; + struct pipe_screen *screen = pipe->screen; gl_format mesa_format; struct pipe_texture templ; struct pipe_texture *src_tex; @@ -421,7 +422,7 @@ compress_with_blit(GLcontext * ctx, 0, 0, 0, /* face, level are zero */ PIPE_TRANSFER_WRITE, 0, 0, width, height); /* x, y, w, h */ - map = screen->transfer_map(screen, tex_xfer); + map = pipe->transfer_map(pipe, tex_xfer); _mesa_texstore(ctx, 2, GL_RGBA, mesa_format, map, /* dest ptr */ @@ -433,8 +434,8 @@ compress_with_blit(GLcontext * ctx, pixels, /* source data */ unpack); /* source data packing */ - screen->transfer_unmap(screen, tex_xfer); - screen->tex_transfer_destroy(tex_xfer); + pipe->transfer_unmap(pipe, tex_xfer); + pipe->tex_transfer_destroy(tex_xfer); /* copy / compress image */ util_blit_pixels_tex(ctx->st->blit, @@ -809,7 +810,8 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - struct pipe_screen *screen = ctx->st->pipe->screen; + struct pipe_context *pipe = ctx->st->pipe; + struct pipe_screen *screen = pipe->screen; struct st_texture_image *stImage = st_texture_image(texImage); const GLuint width = texImage->Width; const GLuint height = texImage->Height; @@ -848,7 +850,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level, if (st_equal_formats(stImage->pt->format, format, type)) { /* memcpy */ const uint bytesPerRow = width * util_format_get_blocksize(stImage->pt->format); - ubyte *map = screen->transfer_map(screen, tex_xfer); + ubyte *map = pipe->transfer_map(pipe, tex_xfer); GLuint row; for (row = 0; row < height; row++) { GLvoid *dest = _mesa_image_address2d(&ctx->Pack, pixels, width, @@ -856,7 +858,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level, memcpy(dest, map, bytesPerRow); map += tex_xfer->stride; } - screen->transfer_unmap(screen, tex_xfer); + pipe->transfer_unmap(pipe, tex_xfer); } else { /* format translation via floats */ @@ -1256,7 +1258,6 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, GLsizei width, GLsizei height) { struct pipe_context *pipe = ctx->st->pipe; - struct pipe_screen *screen = pipe->screen; struct pipe_transfer *src_trans; GLvoid *texDest; enum pipe_transfer_usage transfer_usage; @@ -1363,7 +1364,7 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, } st_texture_image_unmap(ctx->st, stImage); - screen->tex_transfer_destroy(src_trans); + pipe->tex_transfer_destroy(src_trans); } diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index f67d7b4cb5..a73b8ed8fe 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -106,7 +106,6 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj) { struct pipe_context *pipe = ctx->st->pipe; - struct pipe_screen *screen = pipe->screen; struct pipe_texture *pt = st_get_texobj_texture(texObj); const uint baseLevel = texObj->BaseLevel; const uint lastLevel = pt->last_level; @@ -142,8 +141,8 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, u_minify(pt->width0, dstLevel), u_minify(pt->height0, dstLevel)); - srcData = (ubyte *) screen->transfer_map(screen, srcTrans); - dstData = (ubyte *) screen->transfer_map(screen, dstTrans); + srcData = (ubyte *) pipe->transfer_map(pipe, srcTrans); + dstData = (ubyte *) pipe->transfer_map(pipe, dstTrans); srcStride = srcTrans->stride / util_format_get_blocksize(srcTrans->texture->format); dstStride = dstTrans->stride / util_format_get_blocksize(dstTrans->texture->format); @@ -161,11 +160,11 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, dstData, dstStride); /* stride in texels */ - screen->transfer_unmap(screen, srcTrans); - screen->transfer_unmap(screen, dstTrans); + pipe->transfer_unmap(pipe, srcTrans); + pipe->transfer_unmap(pipe, dstTrans); - screen->tex_transfer_destroy(srcTrans); - screen->tex_transfer_destroy(dstTrans); + pipe->tex_transfer_destroy(srcTrans); + pipe->tex_transfer_destroy(dstTrans); } } diff --git a/src/mesa/state_tracker/st_inlines.h b/src/mesa/state_tracker/st_inlines.h index e105870bc7..7fcde7b1a9 100644 --- a/src/mesa/state_tracker/st_inlines.h +++ b/src/mesa/state_tracker/st_inlines.h @@ -53,11 +53,11 @@ st_cond_flush_get_tex_transfer(struct st_context *st, unsigned int x, unsigned int y, unsigned int w, unsigned int h) { - struct pipe_screen *screen = st->pipe->screen; + struct pipe_context *context = st->pipe; st_teximage_flush_before_map(st, pt, face, level, usage); - return screen->get_tex_transfer(screen, pt, face, level, zslice, usage, - x, y, w, h); + return context->get_tex_transfer(context, pt, face, level, zslice, usage, + x, y, w, h); } static INLINE struct pipe_transfer * @@ -70,9 +70,9 @@ st_no_flush_get_tex_transfer(struct st_context *st, unsigned int x, unsigned int y, unsigned int w, unsigned int h) { - struct pipe_screen *screen = st->pipe->screen; + struct pipe_context *context = st->pipe; - return screen->get_tex_transfer(screen, pt, face, level, + return context->get_tex_transfer(context, pt, face, level, zslice, usage, x, y, w, h); } diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 5a45c4358a..f1eef768eb 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -192,7 +192,6 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage, GLuint x, GLuint y, GLuint w, GLuint h) { struct pipe_context *pipe = st->pipe; - struct pipe_screen *screen = pipe->screen; struct pipe_texture *pt = stImage->pt; DBG("%s \n", __FUNCTION__); @@ -202,7 +201,7 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage, usage, x, y, w, h); if (stImage->transfer) - return screen->transfer_map(screen, stImage->transfer); + return pipe->transfer_map(pipe, stImage->transfer); else return NULL; } @@ -212,13 +211,13 @@ void st_texture_image_unmap(struct st_context *st, struct st_texture_image *stImage) { - struct pipe_screen *screen = st->pipe->screen; + struct pipe_context *pipe = st->pipe; DBG("%s\n", __FUNCTION__); - screen->transfer_unmap(screen, stImage->transfer); + pipe->transfer_unmap(pipe, stImage->transfer); - screen->tex_transfer_destroy(stImage->transfer); + pipe->tex_transfer_destroy(stImage->transfer); } @@ -238,8 +237,7 @@ st_surface_data(struct pipe_context *pipe, const void *src, unsigned src_stride, unsigned srcx, unsigned srcy, unsigned width, unsigned height) { - struct pipe_screen *screen = pipe->screen; - void *map = screen->transfer_map(screen, dst); + void *map = pipe->transfer_map(pipe, dst); assert(dst->texture); util_copy_rect(map, @@ -250,7 +248,7 @@ st_surface_data(struct pipe_context *pipe, src, src_stride, srcx, srcy); - screen->transfer_unmap(screen, dst); + pipe->transfer_unmap(pipe, dst); } @@ -265,7 +263,6 @@ st_texture_image_data(struct st_context *st, GLuint src_row_stride, GLuint src_image_stride) { struct pipe_context *pipe = st->pipe; - struct pipe_screen *screen = pipe->screen; GLuint depth = u_minify(dst->depth0, level); GLuint i; const GLubyte *srcUB = src; @@ -287,7 +284,7 @@ st_texture_image_data(struct st_context *st, u_minify(dst->width0, level), u_minify(dst->height0, level)); /* width, height */ - screen->tex_transfer_destroy(dst_transfer); + pipe->tex_transfer_destroy(dst_transfer); srcUB += src_image_stride; } -- cgit v1.2.3 From 25ba04c891ce959470d55a258243b5c105de8ff5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 11 Mar 2010 08:50:39 -0700 Subject: svga: use memset() to initialize u to avoid warnings --- src/gallium/drivers/svga/svgadump/svga_shader_dump.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c index 705ca29e8f..4ee1bf2c35 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c +++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c @@ -360,7 +360,9 @@ dump_dstreg(struct sh_dstreg dstreg, union { struct sh_reg reg; struct sh_dstreg dstreg; - } u = { { 0 } }; + } u; + + memset(&u, 0, sizeof(u)); assert( (dstreg.modifier & (SVGA3DDSTMOD_SATURATE | SVGA3DDSTMOD_PARTIALPRECISION)) == dstreg.modifier ); -- cgit v1.2.3 From d35ecca5ee231c072687578642e0c22c6c0590b1 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 11 Mar 2010 16:10:25 +0000 Subject: gallium: remove pipe_context member from pipe_transfer There was very little use for this beyond permitting the pipe_context::tex_transfer_destroy() function to omit the pipe_context argument. This change adds the pipe_context argument into tex_transfer_destroy() so that it looks like other pipe_context functions, and removes the pipe_context pointer from pipe_transfer. --- src/gallium/auxiliary/draw/draw_pipe_aaline.c | 2 +- src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 2 +- src/gallium/auxiliary/util/u_debug.c | 11 +++++----- src/gallium/auxiliary/util/u_debug.h | 3 ++- src/gallium/auxiliary/util/u_gen_mipmap.c | 12 +++++------ src/gallium/auxiliary/util/u_inlines.h | 14 ++++++------- src/gallium/auxiliary/util/u_rect.c | 6 +++--- src/gallium/auxiliary/util/u_tile.c | 26 +++++++++++++----------- src/gallium/auxiliary/util/u_tile.h | 18 ++++++++++------ src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 2 +- src/gallium/drivers/i915/i915_texture.c | 4 ++-- src/gallium/drivers/i965/brw_screen.h | 1 + src/gallium/drivers/i965/brw_screen_texture.c | 4 ++-- src/gallium/drivers/identity/id_context.c | 6 ++++-- src/gallium/drivers/identity/id_objects.c | 12 +++++++---- src/gallium/drivers/identity/id_objects.h | 4 +++- src/gallium/drivers/llvmpipe/lp_scene.c | 4 ++-- src/gallium/drivers/llvmpipe/lp_texture.c | 3 ++- src/gallium/drivers/nv30/nv30_transfer.c | 5 +++-- src/gallium/drivers/nv40/nv40_transfer.c | 4 ++-- src/gallium/drivers/nv50/nv50_transfer.c | 4 ++-- src/gallium/drivers/r300/r300_screen.c | 2 -- src/gallium/drivers/r300/r300_transfer.c | 3 ++- src/gallium/drivers/softpipe/sp_tex_tile_cache.c | 11 +++++----- src/gallium/drivers/softpipe/sp_texture.c | 4 ++-- src/gallium/drivers/softpipe/sp_tile_cache.c | 19 +++++++++-------- src/gallium/drivers/svga/svga_screen_texture.c | 5 +++-- src/gallium/drivers/trace/tr_context.c | 9 ++++---- src/gallium/drivers/trace/tr_rbug.c | 2 +- src/gallium/drivers/trace/tr_texture.c | 16 ++++++++------- src/gallium/drivers/trace/tr_texture.h | 4 +++- src/gallium/include/pipe/p_context.h | 3 ++- src/gallium/include/pipe/p_state.h | 2 -- src/gallium/state_trackers/vega/api_filters.c | 2 +- src/gallium/state_trackers/vega/api_images.c | 4 ++-- src/gallium/state_trackers/vega/image.c | 8 ++++---- src/gallium/state_trackers/vega/paint.c | 2 +- src/mesa/state_tracker/st_atom_pixeltransfer.c | 2 +- src/mesa/state_tracker/st_cb_accum.c | 14 ++++++------- src/mesa/state_tracker/st_cb_bitmap.c | 8 ++++---- src/mesa/state_tracker/st_cb_drawpixels.c | 18 ++++++++-------- src/mesa/state_tracker/st_cb_readpixels.c | 22 ++++++++++---------- src/mesa/state_tracker/st_cb_texture.c | 12 +++++------ src/mesa/state_tracker/st_gen_mipmap.c | 4 ++-- src/mesa/state_tracker/st_texture.c | 4 ++-- 45 files changed, 177 insertions(+), 150 deletions(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index 2cb76b25ae..1c07ab1365 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -449,7 +449,7 @@ aaline_create_texture(struct aaline_stage *aaline) /* unmap */ pipe->transfer_unmap(pipe, transfer); - pipe->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(pipe, transfer); } return TRUE; } diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index 479777e807..38c22bf4e9 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -411,7 +411,7 @@ pstip_update_texture(struct pstip_stage *pstip) /* unmap */ pipe->transfer_unmap(pipe, transfer); - pipe->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(pipe, transfer); } diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index de775a2dbc..e997cfa8a3 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -459,7 +459,7 @@ void debug_dump_surface(struct pipe_context *pipe, pipe->transfer_unmap(pipe, transfer); error: - pipe->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(pipe, transfer); } @@ -530,14 +530,15 @@ debug_dump_surface_bmp(struct pipe_context *pipe, PIPE_TRANSFER_READ, 0, 0, surface->width, surface->height); - debug_dump_transfer_bmp(filename, transfer); + debug_dump_transfer_bmp(pipe, filename, transfer); - pipe->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(pipe, transfer); #endif } void -debug_dump_transfer_bmp(const char *filename, +debug_dump_transfer_bmp(struct pipe_context *pipe, + const char *filename, struct pipe_transfer *transfer) { #ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT @@ -550,7 +551,7 @@ debug_dump_transfer_bmp(const char *filename, if(!rgba) goto error1; - pipe_get_tile_rgba(transfer, 0, 0, + pipe_get_tile_rgba(pipe, transfer, 0, 0, transfer->width, transfer->height, rgba); diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h index a383837743..98addeb372 100644 --- a/src/gallium/auxiliary/util/u_debug.h +++ b/src/gallium/auxiliary/util/u_debug.h @@ -331,7 +331,8 @@ void debug_dump_texture(struct pipe_context *pipe, void debug_dump_surface_bmp(struct pipe_context *pipe, const char *filename, struct pipe_surface *surface); -void debug_dump_transfer_bmp(const char *filename, +void debug_dump_transfer_bmp(struct pipe_context *pipe, + const char *filename, struct pipe_transfer *transfer); void debug_dump_float_rgba_bmp(const char *filename, unsigned width, unsigned height, diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index 46fbde3f4a..5c51b53d7b 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -1146,8 +1146,8 @@ make_1d_mipmap(struct gen_mipmap_state *ctx, pipe->transfer_unmap(pipe, srcTrans); pipe->transfer_unmap(pipe, dstTrans); - pipe->tex_transfer_destroy(srcTrans); - pipe->tex_transfer_destroy(dstTrans); + pipe->tex_transfer_destroy(pipe, srcTrans); + pipe->tex_transfer_destroy(pipe, dstTrans); } } @@ -1190,8 +1190,8 @@ make_2d_mipmap(struct gen_mipmap_state *ctx, pipe->transfer_unmap(pipe, srcTrans); pipe->transfer_unmap(pipe, dstTrans); - pipe->tex_transfer_destroy(srcTrans); - pipe->tex_transfer_destroy(dstTrans); + pipe->tex_transfer_destroy(pipe, srcTrans); + pipe->tex_transfer_destroy(pipe, dstTrans); } } @@ -1235,8 +1235,8 @@ make_3d_mipmap(struct gen_mipmap_state *ctx, pipe->transfer_unmap(pipe, srcTrans); pipe->transfer_unmap(pipe, dstTrans); - pipe->tex_transfer_destroy(srcTrans); - pipe->tex_transfer_destroy(dstTrans); + pipe->tex_transfer_destroy(pipe, srcTrans); + pipe->tex_transfer_destroy(pipe, dstTrans); } #else (void) reduce_3d; diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index ada31b8182..e7255e3baa 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -264,24 +264,24 @@ pipe_buffer_read(struct pipe_screen *screen, } static INLINE void * -pipe_transfer_map( struct pipe_transfer *transf ) +pipe_transfer_map( struct pipe_context *context, + struct pipe_transfer *transf ) { - struct pipe_context *context = transf->pipe; return context->transfer_map(context, transf); } static INLINE void -pipe_transfer_unmap( struct pipe_transfer *transf ) +pipe_transfer_unmap( struct pipe_context *context, + struct pipe_transfer *transf ) { - struct pipe_context *context = transf->pipe; context->transfer_unmap(context, transf); } static INLINE void -pipe_transfer_destroy( struct pipe_transfer *transf ) +pipe_transfer_destroy( struct pipe_context *context, + struct pipe_transfer *transfer ) { - struct pipe_context *context = transf->pipe; - context->tex_transfer_destroy(transf); + context->tex_transfer_destroy(context, transfer); } static INLINE unsigned diff --git a/src/gallium/auxiliary/util/u_rect.c b/src/gallium/auxiliary/util/u_rect.c index 0b8405d01f..e73797f1b7 100644 --- a/src/gallium/auxiliary/util/u_rect.c +++ b/src/gallium/auxiliary/util/u_rect.c @@ -223,8 +223,8 @@ util_surface_copy(struct pipe_context *pipe, pipe->transfer_unmap(pipe, src_trans); pipe->transfer_unmap(pipe, dst_trans); - pipe->tex_transfer_destroy(src_trans); - pipe->tex_transfer_destroy(dst_trans); + pipe->tex_transfer_destroy(pipe, src_trans); + pipe->tex_transfer_destroy(pipe, dst_trans); } @@ -301,5 +301,5 @@ util_surface_fill(struct pipe_context *pipe, } pipe->transfer_unmap(pipe, dst_trans); - pipe->tex_transfer_destroy(dst_trans); + pipe->tex_transfer_destroy(pipe, dst_trans); } diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index 70a6d97385..e445895efc 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -45,11 +45,11 @@ * Move raw block of pixels from transfer object to user memory. */ void -pipe_get_tile_raw(struct pipe_transfer *pt, +pipe_get_tile_raw(struct pipe_context *pipe, + struct pipe_transfer *pt, uint x, uint y, uint w, uint h, void *dst, int dst_stride) { - struct pipe_context *pipe = pt->pipe; const void *src; if (dst_stride == 0) @@ -73,11 +73,11 @@ pipe_get_tile_raw(struct pipe_transfer *pt, * Move raw block of pixels from user memory to transfer object. */ void -pipe_put_tile_raw(struct pipe_transfer *pt, +pipe_put_tile_raw(struct pipe_context *pipe, + struct pipe_transfer *pt, uint x, uint y, uint w, uint h, const void *src, int src_stride) { - struct pipe_context *pipe = pt->pipe; void *dst; enum pipe_format format = pt->texture->format; @@ -1246,7 +1246,8 @@ pipe_tile_raw_to_rgba(enum pipe_format format, void -pipe_get_tile_rgba(struct pipe_transfer *pt, +pipe_get_tile_rgba(struct pipe_context *pipe, + struct pipe_transfer *pt, uint x, uint y, uint w, uint h, float *p) { @@ -1265,7 +1266,7 @@ pipe_get_tile_rgba(struct pipe_transfer *pt, if(format == PIPE_FORMAT_UYVY || format == PIPE_FORMAT_YUYV) assert((x & 1) == 0); - pipe_get_tile_raw(pt, x, y, w, h, packed, 0); + pipe_get_tile_raw(pipe, pt, x, y, w, h, packed, 0); pipe_tile_raw_to_rgba(format, packed, w, h, p, dst_stride); @@ -1274,7 +1275,8 @@ pipe_get_tile_rgba(struct pipe_transfer *pt, void -pipe_put_tile_rgba(struct pipe_transfer *pt, +pipe_put_tile_rgba(struct pipe_context *pipe, + struct pipe_transfer *pt, uint x, uint y, uint w, uint h, const float *p) { @@ -1363,7 +1365,7 @@ pipe_put_tile_rgba(struct pipe_transfer *pt, 0, 0, w, h); } - pipe_put_tile_raw(pt, x, y, w, h, packed, 0); + pipe_put_tile_raw(pipe, pt, x, y, w, h, packed, 0); FREE(packed); } @@ -1373,11 +1375,11 @@ pipe_put_tile_rgba(struct pipe_transfer *pt, * Get a block of Z values, converted to 32-bit range. */ void -pipe_get_tile_z(struct pipe_transfer *pt, +pipe_get_tile_z(struct pipe_context *pipe, + struct pipe_transfer *pt, uint x, uint y, uint w, uint h, uint *z) { - struct pipe_context *pipe = pt->pipe; const uint dstStride = w; ubyte *map; uint *pDest = z; @@ -1458,11 +1460,11 @@ pipe_get_tile_z(struct pipe_transfer *pt, void -pipe_put_tile_z(struct pipe_transfer *pt, +pipe_put_tile_z(struct pipe_context *pipe, + struct pipe_transfer *pt, uint x, uint y, uint w, uint h, const uint *zSrc) { - struct pipe_context *pipe = pt->pipe; const uint srcStride = w; const uint *ptrc = zSrc; ubyte *map; diff --git a/src/gallium/auxiliary/util/u_tile.h b/src/gallium/auxiliary/util/u_tile.h index 1453af38b8..8329087cfa 100644 --- a/src/gallium/auxiliary/util/u_tile.h +++ b/src/gallium/auxiliary/util/u_tile.h @@ -56,34 +56,40 @@ extern "C" { #endif void -pipe_get_tile_raw(struct pipe_transfer *pt, +pipe_get_tile_raw(struct pipe_context *pipe, + struct pipe_transfer *pt, uint x, uint y, uint w, uint h, void *p, int dst_stride); void -pipe_put_tile_raw(struct pipe_transfer *pt, +pipe_put_tile_raw(struct pipe_context *pipe, + struct pipe_transfer *pt, uint x, uint y, uint w, uint h, const void *p, int src_stride); void -pipe_get_tile_rgba(struct pipe_transfer *pt, +pipe_get_tile_rgba(struct pipe_context *pipe, + struct pipe_transfer *pt, uint x, uint y, uint w, uint h, float *p); void -pipe_put_tile_rgba(struct pipe_transfer *pt, +pipe_put_tile_rgba(struct pipe_context *pipe, + struct pipe_transfer *pt, uint x, uint y, uint w, uint h, const float *p); void -pipe_get_tile_z(struct pipe_transfer *pt, +pipe_get_tile_z(struct pipe_context *pipe, + struct pipe_transfer *pt, uint x, uint y, uint w, uint h, uint *z); void -pipe_put_tile_z(struct pipe_transfer *pt, +pipe_put_tile_z(struct pipe_context *pipe, + struct pipe_transfer *pt, uint x, uint y, uint w, uint h, const uint *z); diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index dcc0014479..beb4722901 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -700,7 +700,7 @@ xfer_buffers_unmap(struct vl_mpeg12_mc_renderer *r) for (i = 0; i < 3; ++i) { r->pipe->transfer_unmap(r->pipe, r->tex_transfer[i]); - r->pipe->tex_transfer_destroy(r->tex_transfer[i]); + r->pipe->tex_transfer_destroy(r->pipe, r->tex_transfer[i]); } } diff --git a/src/gallium/drivers/i915/i915_texture.c b/src/gallium/drivers/i915/i915_texture.c index 3435f7797f..b252fb5330 100644 --- a/src/gallium/drivers/i915/i915_texture.c +++ b/src/gallium/drivers/i915/i915_texture.c @@ -825,7 +825,6 @@ i915_get_tex_transfer(struct pipe_context *pipe, trans = CALLOC_STRUCT(i915_transfer); if (trans) { pipe_texture_reference(&trans->base.texture, texture); - trans->base.pipe = pipe; trans->base.x = x; trans->base.y = y; trans->base.width = w; @@ -869,7 +868,8 @@ i915_transfer_unmap(struct pipe_context *pipe, } 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); diff --git a/src/gallium/drivers/i965/brw_screen.h b/src/gallium/drivers/i965/brw_screen.h index 23e052d0b9..e3a7c64d48 100644 --- a/src/gallium/drivers/i965/brw_screen.h +++ b/src/gallium/drivers/i965/brw_screen.h @@ -202,4 +202,5 @@ boolean brw_is_buffer_referenced_by_bo( struct brw_screen *brw_screen, struct brw_winsys_buffer *bo ); + #endif /* BRW_SCREEN_H */ diff --git a/src/gallium/drivers/i965/brw_screen_texture.c b/src/gallium/drivers/i965/brw_screen_texture.c index 52bf9b3c1c..cadcb7cee2 100644 --- a/src/gallium/drivers/i965/brw_screen_texture.c +++ b/src/gallium/drivers/i965/brw_screen_texture.c @@ -504,7 +504,6 @@ brw_get_tex_transfer(struct pipe_context *pipe, trans = CALLOC_STRUCT(brw_transfer); if (trans) { pipe_texture_reference(&trans->base.texture, texture); - trans->base.pipe = pipe; trans->base.x = x; trans->base.y = y; trans->base.width = w; @@ -554,7 +553,8 @@ brw_transfer_unmap(struct pipe_context *pipe, } static void -brw_tex_transfer_destroy(struct pipe_transfer *trans) +brw_tex_transfer_destroy(struct pipe_context *pipe, + struct pipe_transfer *trans) { pipe_texture_reference(&trans->texture, NULL); FREE(trans); diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c index 5e371c47c8..26770d6b1e 100644 --- a/src/gallium/drivers/identity/id_context.c +++ b/src/gallium/drivers/identity/id_context.c @@ -748,9 +748,11 @@ identity_context_get_tex_transfer(struct pipe_context *_context, } static void -identity_context_tex_transfer_destroy(struct pipe_transfer *_transfer) +identity_context_tex_transfer_destroy(struct pipe_context *_pipe, + struct pipe_transfer *_transfer) { - identity_transfer_destroy(identity_transfer(_transfer)); + identity_transfer_destroy(identity_context(_pipe), + identity_transfer(_transfer)); } static void * diff --git a/src/gallium/drivers/identity/id_objects.c b/src/gallium/drivers/identity/id_objects.c index 91831404b8..d37fb0042e 100644 --- a/src/gallium/drivers/identity/id_objects.c +++ b/src/gallium/drivers/identity/id_objects.c @@ -30,6 +30,7 @@ #include "id_screen.h" #include "id_objects.h" +#include "id_context.h" struct pipe_buffer * identity_buffer_create(struct identity_screen *id_screen, @@ -160,22 +161,25 @@ identity_transfer_create(struct identity_context *id_context, memcpy(&id_transfer->base, transfer, sizeof(struct pipe_transfer)); id_transfer->base.texture = NULL; - pipe_texture_reference(&id_transfer->base.texture, &id_texture->base); id_transfer->transfer = transfer; + + pipe_texture_reference(&id_transfer->base.texture, &id_texture->base); assert(id_transfer->base.texture == &id_texture->base); return &id_transfer->base; error: - transfer->pipe->tex_transfer_destroy(transfer); + id_context->pipe->tex_transfer_destroy(id_context->pipe, transfer); return NULL; } void -identity_transfer_destroy(struct identity_transfer *id_transfer) +identity_transfer_destroy(struct identity_context *id_context, + struct identity_transfer *id_transfer) { pipe_texture_reference(&id_transfer->base.texture, NULL); - id_transfer->transfer->pipe->tex_transfer_destroy(id_transfer->transfer); + id_context->pipe->tex_transfer_destroy(id_context->pipe, + id_transfer->transfer); FREE(id_transfer); } diff --git a/src/gallium/drivers/identity/id_objects.h b/src/gallium/drivers/identity/id_objects.h index 3c4e6d3f8c..7333ecfb7f 100644 --- a/src/gallium/drivers/identity/id_objects.h +++ b/src/gallium/drivers/identity/id_objects.h @@ -65,6 +65,7 @@ struct identity_transfer { struct pipe_transfer base; + struct pipe_context *pipe; struct pipe_transfer *transfer; }; @@ -183,7 +184,8 @@ identity_transfer_create(struct identity_context *id_context, struct pipe_transfer *transfer); void -identity_transfer_destroy(struct identity_transfer *id_transfer); +identity_transfer_destroy(struct identity_context *id_context, + struct identity_transfer *id_transfer); struct pipe_video_surface * identity_video_surface_create(struct identity_screen *id_screen, diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c index bfe53d4106..505cb21503 100644 --- a/src/gallium/drivers/llvmpipe/lp_scene.c +++ b/src/gallium/drivers/llvmpipe/lp_scene.c @@ -477,7 +477,7 @@ lp_scene_unmap_buffers( struct lp_scene *scene ) pipe->transfer_unmap(pipe, scene->cbuf_transfer[i]); if (scene->cbuf_transfer[i]) - pipe->tex_transfer_destroy(scene->cbuf_transfer[i]); + pipe->tex_transfer_destroy(pipe, scene->cbuf_transfer[i]); scene->cbuf_transfer[i] = NULL; scene->cbuf_map[i] = NULL; @@ -487,7 +487,7 @@ lp_scene_unmap_buffers( struct lp_scene *scene ) pipe->transfer_unmap(pipe, scene->zsbuf_transfer); if (scene->zsbuf_transfer) - pipe->tex_transfer_destroy(scene->zsbuf_transfer); + pipe->tex_transfer_destroy(pipe, scene->zsbuf_transfer); scene->zsbuf_transfer = NULL; scene->zsbuf_map = NULL; diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 65f7994e0e..f2c6dbd088 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -294,7 +294,8 @@ llvmpipe_get_tex_transfer(struct pipe_context *pipe, static void -llvmpipe_tex_transfer_destroy(struct pipe_transfer *transfer) +llvmpipe_tex_transfer_destroy(struct pipe_context *pipe, + struct pipe_transfer *transfer) { /* Effectively do the texture_update work here - if texture images * needed post-processing to put them into hardware layout, this is diff --git a/src/gallium/drivers/nv30/nv30_transfer.c b/src/gallium/drivers/nv30/nv30_transfer.c index 1318c60ae4..cfc109bb74 100644 --- a/src/gallium/drivers/nv30/nv30_transfer.c +++ b/src/gallium/drivers/nv30/nv30_transfer.c @@ -118,12 +118,13 @@ nv30_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt, } static void -nv30_transfer_del(struct pipe_transfer *ptx) +nv30_transfer_del(struct pipe_context *pcontext, + struct pipe_transfer *ptx) { struct nv30_transfer *tx = (struct nv30_transfer *)ptx; if (!tx->direct && (ptx->usage & PIPE_TRANSFER_WRITE)) { - struct pipe_screen *pscreen = ptx->texture->screen; + struct pipe_screen *pscreen = pcontext->screen; struct nv30_screen *nvscreen = nv30_screen(pscreen); struct pipe_surface *dst; diff --git a/src/gallium/drivers/nv40/nv40_transfer.c b/src/gallium/drivers/nv40/nv40_transfer.c index 2ca9b94388..c552a68113 100644 --- a/src/gallium/drivers/nv40/nv40_transfer.c +++ b/src/gallium/drivers/nv40/nv40_transfer.c @@ -118,12 +118,12 @@ nv40_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt, } static void -nv40_transfer_del(struct pipe_transfer *ptx) +nv40_transfer_del(struct pipe_context *pcontext, struct pipe_transfer *ptx) { struct nv40_transfer *tx = (struct nv40_transfer *)ptx; if (!tx->direct && (ptx->usage & PIPE_TRANSFER_WRITE)) { - struct pipe_screen *pscreen = ptx->texture->screen; + struct pipe_screen *pscreen = pcontext->screen; struct nv40_screen *nvscreen = nv40_screen(pscreen); struct pipe_surface *dst; diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index b7f2ac1b1c..9eb223eca6 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -187,7 +187,7 @@ nv50_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt, } static void -nv50_transfer_del(struct pipe_transfer *ptx) +nv50_transfer_del(struct pipe_context *pcontext, struct pipe_transfer *ptx) { struct nv50_transfer *tx = (struct nv50_transfer *)ptx; struct nv50_miptree *mt = nv50_miptree(ptx->texture); @@ -197,7 +197,7 @@ nv50_transfer_del(struct pipe_transfer *ptx) unsigned ny = util_format_get_nblocksy(pt->format, tx->base.height); if (ptx->usage & PIPE_TRANSFER_WRITE) { - struct pipe_screen *pscreen = pt->screen; + struct pipe_screen *pscreen = pcontext->screen; nv50_transfer_rect_m2mf(pscreen, tx->bo, 0, tx->base.stride, tx->bo->tile_mode, diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 69c0ab496c..64d1909a38 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -251,8 +251,6 @@ static boolean r300_is_format_supported(struct pipe_screen* screen, return retval == usage; } - - static void r300_destroy_screen(struct pipe_screen* pscreen) { struct r300_screen* r300screen = r300_screen(pscreen); diff --git a/src/gallium/drivers/r300/r300_transfer.c b/src/gallium/drivers/r300/r300_transfer.c index 7dd707ff8e..495e3dee76 100644 --- a/src/gallium/drivers/r300/r300_transfer.c +++ b/src/gallium/drivers/r300/r300_transfer.c @@ -205,7 +205,8 @@ r300_get_tex_transfer(struct pipe_context *ctx, return &trans->transfer; } -static void r300_tex_transfer_destroy(struct pipe_transfer *trans) +static void r300_tex_transfer_destroy(struct pipe_context *ctx, + struct pipe_transfer *trans) { struct r300_transfer *r300transfer = r300_transfer(trans); diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c index a9f5b51a41..e3a5e37ce4 100644 --- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c @@ -69,10 +69,10 @@ sp_destroy_tex_tile_cache(struct softpipe_tex_tile_cache *tc) /*assert(tc->entries[pos].x < 0);*/ } if (tc->transfer) { - tc->pipe->tex_transfer_destroy(tc->transfer); + tc->pipe->tex_transfer_destroy(tc->pipe, tc->transfer); } if (tc->tex_trans) { - tc->pipe->tex_transfer_destroy(tc->tex_trans); + tc->pipe->tex_transfer_destroy(tc->pipe, tc->tex_trans); } FREE( tc ); @@ -135,7 +135,7 @@ sp_tex_tile_cache_set_texture(struct softpipe_tex_tile_cache *tc, tc->tex_trans_map = NULL; } - tc->pipe->tex_transfer_destroy(tc->tex_trans); + tc->pipe->tex_transfer_destroy(tc->pipe, tc->tex_trans); tc->tex_trans = NULL; } @@ -230,7 +230,7 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc, tc->tex_trans_map = NULL; } - tc->pipe->tex_transfer_destroy(tc->tex_trans); + tc->pipe->tex_transfer_destroy(tc->pipe, tc->tex_trans); tc->tex_trans = NULL; } @@ -251,7 +251,8 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc, } /* get tile from the transfer (view into texture) */ - pipe_get_tile_rgba(tc->tex_trans, + pipe_get_tile_rgba(tc->pipe, + tc->tex_trans, addr.bits.x * TILE_SIZE, addr.bits.y * TILE_SIZE, TILE_SIZE, TILE_SIZE, diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index adae48c474..da8529c154 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -277,7 +277,6 @@ softpipe_get_tex_transfer(struct pipe_context *pipe, struct pipe_transfer *pt = &spt->base; int nblocksy = util_format_get_nblocksy(texture->format, u_minify(texture->height0, level)); pipe_texture_reference(&pt->texture, texture); - pt->pipe = pipe; pt->x = x; pt->y = y; pt->width = w; @@ -311,7 +310,8 @@ softpipe_get_tex_transfer(struct pipe_context *pipe, * softpipe_get_tex_transfer(). */ static void -softpipe_tex_transfer_destroy(struct pipe_transfer *transfer) +softpipe_tex_transfer_destroy(struct pipe_context *pipe, + struct pipe_transfer *transfer) { /* Effectively do the texture_update work here - if texture images * needed post-processing to put them into hardware layout, this is diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index d779816790..1c3c2667d7 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -121,7 +121,7 @@ sp_destroy_tile_cache(struct softpipe_tile_cache *tc) /*assert(tc->entries[pos].x < 0);*/ } if (tc->transfer) { - tc->pipe->tex_transfer_destroy(tc->transfer); + tc->pipe->tex_transfer_destroy(tc->pipe, tc->transfer); } FREE( tc ); @@ -146,7 +146,7 @@ sp_tile_cache_set_surface(struct softpipe_tile_cache *tc, tc->transfer_map = NULL; } - pipe->tex_transfer_destroy(tc->transfer); + pipe->tex_transfer_destroy(pipe, tc->transfer); tc->transfer = NULL; } @@ -291,7 +291,8 @@ sp_tile_cache_flush_clear(struct softpipe_tile_cache *tc) union tile_address addr = tile_address(x, y); if (is_clear_flag_set(tc->clear_flags, addr)) { - pipe_put_tile_raw(pt, + pipe_put_tile_raw(tc->pipe, + pt, x, y, TILE_SIZE, TILE_SIZE, tc->tile.data.color32, 0/*STRIDE*/); @@ -325,14 +326,14 @@ sp_flush_tile_cache(struct softpipe_tile_cache *tc) struct softpipe_cached_tile *tile = tc->entries + pos; if (!tile->addr.bits.invalid) { if (tc->depth_stencil) { - pipe_put_tile_raw(pt, + pipe_put_tile_raw(tc->pipe, pt, tile->addr.bits.x * TILE_SIZE, tile->addr.bits.y * TILE_SIZE, TILE_SIZE, TILE_SIZE, tile->data.depth32, 0/*STRIDE*/); } else { - pipe_put_tile_rgba(pt, + pipe_put_tile_rgba(tc->pipe, pt, tile->addr.bits.x * TILE_SIZE, tile->addr.bits.y * TILE_SIZE, TILE_SIZE, TILE_SIZE, @@ -375,14 +376,14 @@ sp_find_cached_tile(struct softpipe_tile_cache *tc, if (tile->addr.bits.invalid == 0) { /* put dirty tile back in framebuffer */ if (tc->depth_stencil) { - pipe_put_tile_raw(pt, + pipe_put_tile_raw(tc->pipe, pt, tile->addr.bits.x * TILE_SIZE, tile->addr.bits.y * TILE_SIZE, TILE_SIZE, TILE_SIZE, tile->data.depth32, 0/*STRIDE*/); } else { - pipe_put_tile_rgba(pt, + pipe_put_tile_rgba(tc->pipe, pt, tile->addr.bits.x * TILE_SIZE, tile->addr.bits.y * TILE_SIZE, TILE_SIZE, TILE_SIZE, @@ -405,14 +406,14 @@ sp_find_cached_tile(struct softpipe_tile_cache *tc, else { /* get new tile data from transfer */ if (tc->depth_stencil) { - pipe_get_tile_raw(pt, + pipe_get_tile_raw(tc->pipe, pt, tile->addr.bits.x * TILE_SIZE, tile->addr.bits.y * TILE_SIZE, TILE_SIZE, TILE_SIZE, tile->data.depth32, 0/*STRIDE*/); } else { - pipe_get_tile_rgba(pt, + pipe_get_tile_rgba(tc->pipe, pt, tile->addr.bits.x * TILE_SIZE, tile->addr.bits.y * TILE_SIZE, TILE_SIZE, TILE_SIZE, diff --git a/src/gallium/drivers/svga/svga_screen_texture.c b/src/gallium/drivers/svga/svga_screen_texture.c index 065b8748a3..107e4a3962 100644 --- a/src/gallium/drivers/svga/svga_screen_texture.c +++ b/src/gallium/drivers/svga/svga_screen_texture.c @@ -899,10 +899,11 @@ svga_transfer_unmap(struct pipe_context *pipe, static void -svga_tex_transfer_destroy(struct pipe_transfer *transfer) +svga_tex_transfer_destroy(struct pipe_context *pipe, + struct pipe_transfer *transfer) { struct svga_texture *tex = svga_texture(transfer->texture); - struct svga_screen *ss = svga_screen(transfer->texture->screen); + struct svga_screen *ss = svga_screen(pipe->screen); struct svga_winsys_screen *sws = ss->sws; struct svga_transfer *st = svga_transfer(transfer); diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 4a0e9ac17d..b7e6bbac68 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -1336,11 +1336,12 @@ trace_context_get_tex_transfer(struct pipe_context *_context, static void -trace_context_tex_transfer_destroy(struct pipe_transfer *_transfer) +trace_context_tex_transfer_destroy(struct pipe_context *_context, + struct pipe_transfer *_transfer) { - struct trace_context *tr_ctx = trace_context(_transfer->pipe); + struct trace_context *tr_context = trace_context(_context); struct trace_transfer *tr_trans = trace_transfer(_transfer); - struct pipe_context *context = tr_ctx->pipe; + struct pipe_context *context = tr_context->pipe; struct pipe_transfer *transfer = tr_trans->transfer; trace_dump_call_begin("pipe_context", "tex_transfer_destroy"); @@ -1350,7 +1351,7 @@ trace_context_tex_transfer_destroy(struct pipe_transfer *_transfer) trace_dump_call_end(); - trace_transfer_destroy(tr_trans); + trace_transfer_destroy(tr_context, tr_trans); } diff --git a/src/gallium/drivers/trace/tr_rbug.c b/src/gallium/drivers/trace/tr_rbug.c index b36865400d..f4f17566fd 100644 --- a/src/gallium/drivers/trace/tr_rbug.c +++ b/src/gallium/drivers/trace/tr_rbug.c @@ -257,7 +257,7 @@ trace_rbug_texture_read(struct trace_rbug *tr_rbug, struct rbug_header *header, NULL); context->transfer_unmap(context, t); - context->tex_transfer_destroy(t); + context->tex_transfer_destroy(context, t); pipe_mutex_unlock(tr_scr->list_mutex); diff --git a/src/gallium/drivers/trace/tr_texture.c b/src/gallium/drivers/trace/tr_texture.c index b70ccb9ce8..d818e21bb8 100644 --- a/src/gallium/drivers/trace/tr_texture.c +++ b/src/gallium/drivers/trace/tr_texture.c @@ -143,10 +143,10 @@ trace_transfer_create(struct trace_context *tr_ctx, memcpy(&tr_trans->base, transfer, sizeof(struct pipe_transfer)); - tr_trans->base.pipe = &tr_ctx->base; tr_trans->base.texture = NULL; - pipe_texture_reference(&tr_trans->base.texture, &tr_tex->base); tr_trans->transfer = transfer; + + pipe_texture_reference(&tr_trans->base.texture, &tr_tex->base); assert(tr_trans->base.texture == &tr_tex->base); trace_screen_add_to_list(tr_scr, transfers, tr_trans); @@ -154,21 +154,23 @@ trace_transfer_create(struct trace_context *tr_ctx, return &tr_trans->base; error: - tr_ctx->pipe->tex_transfer_destroy(transfer); + tr_ctx->pipe->tex_transfer_destroy(tr_ctx->pipe, transfer); return NULL; } void -trace_transfer_destroy(struct trace_transfer *tr_trans) +trace_transfer_destroy(struct trace_context *tr_context, + struct trace_transfer *tr_trans) { - struct trace_screen *tr_scr = trace_screen(tr_trans->base.texture->screen); - struct pipe_context *context = tr_trans->transfer->pipe; + struct trace_screen *tr_scr = trace_screen(tr_context->base.screen); + struct pipe_context *context = tr_context->pipe; + struct pipe_transfer *transfer = tr_trans->transfer; trace_screen_remove_from_list(tr_scr, transfers, tr_trans); pipe_texture_reference(&tr_trans->base.texture, NULL); - context->tex_transfer_destroy(tr_trans->transfer); + context->tex_transfer_destroy(context, transfer); FREE(tr_trans); } diff --git a/src/gallium/drivers/trace/tr_texture.h b/src/gallium/drivers/trace/tr_texture.h index ab284eeef3..4dc95308a7 100644 --- a/src/gallium/drivers/trace/tr_texture.h +++ b/src/gallium/drivers/trace/tr_texture.h @@ -61,6 +61,7 @@ struct trace_transfer struct pipe_transfer base; struct pipe_transfer *transfer; + struct pipe_context *pipe; struct tr_list list; @@ -118,7 +119,8 @@ trace_transfer_create(struct trace_context *tr_ctx, struct pipe_transfer *transfer); void -trace_transfer_destroy(struct trace_transfer *tr_trans); +trace_transfer_destroy(struct trace_context *tr_ctx, + struct trace_transfer *tr_trans); #endif /* TR_TEXTURE_H_ */ diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 494b53e912..a7f12fb81e 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -323,7 +323,8 @@ struct pipe_context { unsigned x, unsigned y, unsigned w, unsigned h); - void (*tex_transfer_destroy)(struct pipe_transfer *); + void (*tex_transfer_destroy)(struct pipe_context *, + struct pipe_transfer *); void *(*transfer_map)( struct pipe_context *, struct pipe_transfer *transfer ); diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 2af933207d..3a97d888ce 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -304,8 +304,6 @@ struct pipe_surface */ struct pipe_transfer { - struct pipe_context *pipe; - unsigned x; /**< x offset from start of texture image */ unsigned y; /**< y offset from start of texture image */ unsigned width; /**< logical width in pixels */ diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c index 6e79dd370f..18e2cc1f25 100644 --- a/src/gallium/state_trackers/vega/api_filters.c +++ b/src/gallium/state_trackers/vega/api_filters.c @@ -85,7 +85,7 @@ static INLINE struct pipe_texture *create_texture_1d(struct vg_context *ctx, void *map = pipe->transfer_map(pipe, transfer); memcpy(map, color_data, sizeof(VGint)*color_data_len); pipe->transfer_unmap(pipe, transfer); - pipe->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(pipe, transfer); } return tex; diff --git a/src/gallium/state_trackers/vega/api_images.c b/src/gallium/state_trackers/vega/api_images.c index 432ba68139..fec473d9d2 100644 --- a/src/gallium/state_trackers/vega/api_images.c +++ b/src/gallium/state_trackers/vega/api_images.c @@ -450,14 +450,14 @@ void vgReadPixels(void * data, VGint dataStride, #if 0 debug_printf("%d-%d == %d\n", sy, height, y); #endif - pipe_get_tile_rgba(transfer, sx, y, width, 1, df); + pipe_get_tile_rgba(pipe, transfer, sx, y, width, 1, df); y += yStep; _vega_pack_rgba_span_float(ctx, width, temp, dataFormat, dst + yoffset + xoffset); dst += dataStride; } - pipe->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(pipe, transfer); } } diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c index 604a86aeb8..a71579cd26 100644 --- a/src/gallium/state_trackers/vega/image.c +++ b/src/gallium/state_trackers/vega/image.c @@ -418,11 +418,11 @@ void image_sub_data(struct vg_image *image, src += (dataStride * yoffset); for (i = 0; i < height; i++) { _vega_unpack_float_span_rgba(ctx, width, xoffset, src, dataFormat, temp); - pipe_put_tile_rgba(transfer, x+image->x, y+image->y, width, 1, df); + pipe_put_tile_rgba(pipe, transfer, x+image->x, y+image->y, width, 1, df); y += yStep; src += dataStride; } - pipe->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(pipe, transfer); } } @@ -454,13 +454,13 @@ void image_get_sub_data(struct vg_image * image, #if 0 debug_printf("%d-%d == %d\n", sy, height, y); #endif - pipe_get_tile_rgba(transfer, sx+image->x, y, width, 1, df); + pipe_get_tile_rgba(pipe, transfer, sx+image->x, y, width, 1, df); y += yStep; _vega_pack_rgba_span_float(ctx, width, temp, dataFormat, dst); dst += dataStride; } - pipe->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(pipe, transfer); } } diff --git a/src/gallium/state_trackers/vega/paint.c b/src/gallium/state_trackers/vega/paint.c index 47a7710d3e..dc56b8c5f3 100644 --- a/src/gallium/state_trackers/vega/paint.c +++ b/src/gallium/state_trackers/vega/paint.c @@ -167,7 +167,7 @@ static INLINE struct pipe_texture *create_gradient_texture(struct vg_paint *p) void *map = pipe->transfer_map(pipe, transfer); memcpy(map, p->gradient.color_data, sizeof(VGint)*1024); pipe->transfer_unmap(pipe, transfer); - pipe->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(pipe, transfer); } return tex; diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c index b066f5c94b..b446b2079c 100644 --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -172,7 +172,7 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt) } pipe->transfer_unmap(pipe, transfer); - pipe->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(pipe, transfer); } diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c index 69a96e5d10..01aba3e3dd 100644 --- a/src/mesa/state_tracker/st_cb_accum.c +++ b/src/mesa/state_tracker/st_cb_accum.c @@ -144,7 +144,7 @@ accum_accum(struct st_context *st, GLfloat value, buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf); + pipe_get_tile_rgba(pipe, color_trans, 0, 0, width, height, buf); switch (acc_strb->format) { case PIPE_FORMAT_R16G16B16A16_SNORM: @@ -165,7 +165,7 @@ accum_accum(struct st_context *st, GLfloat value, } free(buf); - pipe->tex_transfer_destroy(color_trans); + pipe->tex_transfer_destroy(pipe, color_trans); } @@ -192,7 +192,7 @@ accum_load(struct st_context *st, GLfloat value, buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf); + pipe_get_tile_rgba(pipe, color_trans, 0, 0, width, height, buf); switch (acc_strb->format) { case PIPE_FORMAT_R16G16B16A16_SNORM: @@ -213,7 +213,7 @@ accum_load(struct st_context *st, GLfloat value, } free(buf); - pipe->tex_transfer_destroy(color_trans); + pipe->tex_transfer_destroy(pipe, color_trans); } @@ -248,7 +248,7 @@ accum_return(GLcontext *ctx, GLfloat value, width, height); if (usage & PIPE_TRANSFER_READ) - pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf); + pipe_get_tile_rgba(pipe, color_trans, 0, 0, width, height, buf); switch (acc_strb->format) { case PIPE_FORMAT_R16G16B16A16_SNORM: @@ -277,10 +277,10 @@ accum_return(GLcontext *ctx, GLfloat value, _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()"); } - pipe_put_tile_rgba(color_trans, 0, 0, width, height, buf); + pipe_put_tile_rgba(pipe, color_trans, 0, 0, width, height, buf); free(buf); - pipe->tex_transfer_destroy(color_trans); + pipe->tex_transfer_destroy(pipe, color_trans); } diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 723c5f180b..dfd8925edf 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -295,7 +295,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height, /* Release transfer */ pipe->transfer_unmap(pipe, transfer); - pipe->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(pipe, transfer); return pt; } @@ -530,7 +530,7 @@ reset_cache(struct st_context *st) cache->ymax = -1000000; if (cache->trans) { - pipe->tex_transfer_destroy(cache->trans); + pipe->tex_transfer_destroy(pipe, cache->trans); cache->trans = NULL; } @@ -616,7 +616,7 @@ st_flush_bitmap_cache(struct st_context *st) pipe->transfer_unmap(pipe, cache->trans); cache->buffer = NULL; - pipe->tex_transfer_destroy(cache->trans); + pipe->tex_transfer_destroy(pipe, cache->trans); cache->trans = NULL; } @@ -836,7 +836,7 @@ st_destroy_bitmap(struct st_context *st) if (cache) { if (cache->trans) { pipe->transfer_unmap(pipe, cache->trans); - pipe->tex_transfer_destroy(cache->trans); + pipe->tex_transfer_destroy(pipe, cache->trans); } pipe_texture_reference(&st->bitmap.cache->texture, NULL); free(st->bitmap.cache); diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 3fa6d12f1c..c44d0fc3e8 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -411,7 +411,7 @@ make_texture(struct st_context *st, /* unmap */ pipe->transfer_unmap(pipe, transfer); - pipe->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(pipe, transfer); assert(success); @@ -791,7 +791,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, /* unmap the stencil buffer */ pipe->transfer_unmap(pipe, pt); - pipe->tex_transfer_destroy(pt); + pipe->tex_transfer_destroy(pipe, pt); } @@ -944,7 +944,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, /* unmap the stencil buffer */ pipe->transfer_unmap(pipe, ptDraw); - pipe->tex_transfer_destroy(ptDraw); + pipe->tex_transfer_destroy(pipe, ptDraw); } @@ -1113,21 +1113,21 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, /* alternate path using get/put_tile() */ GLfloat *buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - pipe_get_tile_rgba(ptRead, 0, 0, width, height, buf); - pipe_put_tile_rgba(ptTex, 0, 0, width, height, buf); + pipe_get_tile_rgba(pipe, ptRead, 0, 0, width, height, buf); + pipe_put_tile_rgba(pipe, ptTex, 0, 0, width, height, buf); free(buf); } else { /* GL_DEPTH */ GLuint *buf = (GLuint *) malloc(width * height * sizeof(GLuint)); - pipe_get_tile_z(ptRead, 0, 0, width, height, buf); - pipe_put_tile_z(ptTex, 0, 0, width, height, buf); + pipe_get_tile_z(pipe, ptRead, 0, 0, width, height, buf); + pipe_put_tile_z(pipe, ptTex, 0, 0, width, height, buf); free(buf); } - pipe->tex_transfer_destroy(ptRead); - pipe->tex_transfer_destroy(ptTex); + pipe->tex_transfer_destroy(pipe, ptRead); + pipe->tex_transfer_destroy(pipe, ptTex); } /* draw textured quad */ diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 98ccda821c..080a5f9bfb 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -162,7 +162,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y, /* unmap the stencil buffer */ pipe->transfer_unmap(pipe, pt); - pipe->tex_transfer_destroy(pt); + pipe->tex_transfer_destroy(pipe, pt); } @@ -254,7 +254,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb, map = pipe->transfer_map(pipe, trans); if (!map) { - pipe->tex_transfer_destroy(trans); + pipe->tex_transfer_destroy(pipe, trans); return GL_FALSE; } @@ -317,7 +317,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb, } pipe->transfer_unmap(pipe, trans); - pipe->tex_transfer_destroy(trans); + pipe->tex_transfer_destroy(pipe, trans); } return GL_TRUE; @@ -441,7 +441,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLuint ztemp[MAX_WIDTH]; GLfloat zfloat[MAX_WIDTH]; const double scale = 1.0 / ((1 << 24) - 1); - pipe_get_tile_raw(trans, 0, y, width, 1, ztemp, 0); + pipe_get_tile_raw(pipe, trans, 0, y, width, 1, ztemp, 0); y += yStep; for (j = 0; j < width; j++) { zfloat[j] = (float) (scale * (ztemp[j] & 0xffffff)); @@ -456,7 +456,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, assert(format == GL_DEPTH_STENCIL_EXT); for (i = 0; i < height; i++) { GLuint *zshort = (GLuint *)dst; - pipe_get_tile_raw(trans, 0, y, width, 1, dst, 0); + pipe_get_tile_raw(pipe, trans, 0, y, width, 1, dst, 0); y += yStep; /* Reverse into 24/8 */ for (j = 0; j < width; j++) { @@ -473,7 +473,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLuint ztemp[MAX_WIDTH]; GLfloat zfloat[MAX_WIDTH]; const double scale = 1.0 / ((1 << 24) - 1); - pipe_get_tile_raw(trans, 0, y, width, 1, ztemp, 0); + pipe_get_tile_raw(pipe, trans, 0, y, width, 1, ztemp, 0); y += yStep; for (j = 0; j < width; j++) { zfloat[j] = (float) (scale * ((ztemp[j] >> 8) & 0xffffff)); @@ -487,7 +487,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, /* XXX: unreachable code -- should be before st_read_stencil_pixels */ assert(format == GL_DEPTH_STENCIL_EXT); for (i = 0; i < height; i++) { - pipe_get_tile_raw(trans, 0, y, width, 1, dst, 0); + pipe_get_tile_raw(pipe, trans, 0, y, width, 1, dst, 0); y += yStep; dst += dstStride; } @@ -498,7 +498,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLushort ztemp[MAX_WIDTH]; GLfloat zfloat[MAX_WIDTH]; const double scale = 1.0 / 0xffff; - pipe_get_tile_raw(trans, 0, y, width, 1, ztemp, 0); + pipe_get_tile_raw(pipe, trans, 0, y, width, 1, ztemp, 0); y += yStep; for (j = 0; j < width; j++) { zfloat[j] = (float) (scale * ztemp[j]); @@ -513,7 +513,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLuint ztemp[MAX_WIDTH]; GLfloat zfloat[MAX_WIDTH]; const double scale = 1.0 / 0xffffffff; - pipe_get_tile_raw(trans, 0, y, width, 1, ztemp, 0); + pipe_get_tile_raw(pipe, trans, 0, y, width, 1, ztemp, 0); y += yStep; for (j = 0; j < width; j++) { zfloat[j] = (float) (scale * ztemp[j]); @@ -527,7 +527,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, /* RGBA format */ /* Do a row at a time to flip image data vertically */ for (i = 0; i < height; i++) { - pipe_get_tile_rgba(trans, 0, y, width, 1, df); + pipe_get_tile_rgba(pipe, trans, 0, y, width, 1, df); y += yStep; df += dfStride; if (!dfStride) { @@ -539,7 +539,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, } } - pipe->tex_transfer_destroy(trans); + pipe->tex_transfer_destroy(pipe, trans); _mesa_unmap_pbo_dest(ctx, &clippedPacking); } diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 1b20b615d0..626e6ad660 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -435,7 +435,7 @@ compress_with_blit(GLcontext * ctx, unpack); /* source data packing */ pipe->transfer_unmap(pipe, tex_xfer); - pipe->tex_transfer_destroy(tex_xfer); + pipe->tex_transfer_destroy(pipe, tex_xfer); /* copy / compress image */ util_blit_pixels_tex(ctx->st->blit, @@ -873,7 +873,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level, debug_printf("%s: fallback format translation\n", __FUNCTION__); /* get float[4] rgba row from surface */ - pipe_get_tile_rgba(tex_xfer, 0, row, width, 1, rgba); + pipe_get_tile_rgba(pipe, tex_xfer, 0, row, width, 1, rgba); _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, format, type, dest, &ctx->Pack, transferOps); @@ -1310,11 +1310,11 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, /* To avoid a large temp memory allocation, do copy row by row */ for (row = 0; row < height; row++, srcY += yStep) { uint data[MAX_WIDTH]; - pipe_get_tile_z(src_trans, 0, srcY, width, 1, data); + pipe_get_tile_z(pipe, src_trans, 0, srcY, width, 1, data); if (scaleOrBias) { _mesa_scale_and_bias_depth_uint(ctx, width, data); } - pipe_put_tile_z(stImage->transfer, 0, row, width, 1, data); + pipe_put_tile_z(pipe, stImage->transfer, 0, row, width, 1, data); } } else { @@ -1336,7 +1336,7 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, /* XXX this usually involves a lot of int/float conversion. * try to avoid that someday. */ - pipe_get_tile_rgba(src_trans, 0, 0, width, height, tempSrc); + pipe_get_tile_rgba(pipe, src_trans, 0, 0, width, height, tempSrc); /* Store into texture memory. * Note that this does some special things such as pixel transfer @@ -1364,7 +1364,7 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, } st_texture_image_unmap(ctx->st, stImage); - pipe->tex_transfer_destroy(src_trans); + pipe->tex_transfer_destroy(pipe, src_trans); } diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index a73b8ed8fe..b2521433c8 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -163,8 +163,8 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, pipe->transfer_unmap(pipe, srcTrans); pipe->transfer_unmap(pipe, dstTrans); - pipe->tex_transfer_destroy(srcTrans); - pipe->tex_transfer_destroy(dstTrans); + pipe->tex_transfer_destroy(pipe, srcTrans); + pipe->tex_transfer_destroy(pipe, dstTrans); } } diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index f1eef768eb..10a38befb4 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -217,7 +217,7 @@ st_texture_image_unmap(struct st_context *st, pipe->transfer_unmap(pipe, stImage->transfer); - pipe->tex_transfer_destroy(stImage->transfer); + pipe->tex_transfer_destroy(pipe, stImage->transfer); } @@ -284,7 +284,7 @@ st_texture_image_data(struct st_context *st, u_minify(dst->width0, level), u_minify(dst->height0, level)); /* width, height */ - pipe->tex_transfer_destroy(dst_transfer); + pipe->tex_transfer_destroy(pipe, dst_transfer); srcUB += src_image_stride; } -- cgit v1.2.3 From dfeab49a96fb520b5cb21b4cb5a8a5a0c1bf61e1 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 11 Mar 2010 18:40:25 +0100 Subject: cell: adapt to context texture transfers (untested) --- src/gallium/drivers/cell/ppu/cell_context.c | 1 + src/gallium/drivers/cell/ppu/cell_texture.c | 23 +++++++++++++---------- src/gallium/drivers/cell/ppu/cell_texture.h | 2 ++ 3 files changed, 16 insertions(+), 10 deletions(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/cell/ppu/cell_context.c b/src/gallium/drivers/cell/ppu/cell_context.c index afcea616d5..f6cb1fc9be 100644 --- a/src/gallium/drivers/cell/ppu/cell_context.c +++ b/src/gallium/drivers/cell/ppu/cell_context.c @@ -158,6 +158,7 @@ cell_create_context(struct pipe_screen *screen, cell_init_shader_functions(cell); cell_init_surface_functions(cell); cell_init_vertex_functions(cell); + cell_init_texture_transfer_funcs(cell); cell->draw = cell_draw_create(cell); diff --git a/src/gallium/drivers/cell/ppu/cell_texture.c b/src/gallium/drivers/cell/ppu/cell_texture.c index c8a1acd86a..c65c3b4f88 100644 --- a/src/gallium/drivers/cell/ppu/cell_texture.c +++ b/src/gallium/drivers/cell/ppu/cell_texture.c @@ -355,7 +355,7 @@ cell_tex_surface_destroy(struct pipe_surface *surf) * back out for glGetTexImage). */ static struct pipe_transfer * -cell_get_tex_transfer(struct pipe_screen *screen, +cell_get_tex_transfer(struct pipe_context *ctx, struct pipe_texture *texture, unsigned face, unsigned level, unsigned zslice, enum pipe_transfer_usage usage, @@ -402,7 +402,7 @@ cell_get_tex_transfer(struct pipe_screen *screen, static void -cell_tex_transfer_destroy(struct pipe_transfer *t) +cell_tex_transfer_destroy(struct pipe_context *ctx, struct pipe_transfer *t) { struct cell_transfer *transfer = cell_transfer(t); /* Effectively do the texture_update work here - if texture images @@ -419,7 +419,7 @@ cell_tex_transfer_destroy(struct pipe_transfer *t) * Return pointer to texture image data in linear layout. */ static void * -cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer) +cell_transfer_map(struct pipe_context *ctx, struct pipe_transfer *transfer) { struct cell_transfer *ctrans = cell_transfer(transfer); struct pipe_texture *pt = transfer->texture; @@ -471,7 +471,7 @@ cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer) * to tiled data. */ static void -cell_transfer_unmap(struct pipe_screen *screen, +cell_transfer_unmap(struct pipe_context *ctx, struct pipe_transfer *transfer) { struct cell_transfer *ctrans = cell_transfer(transfer); @@ -560,11 +560,14 @@ cell_init_screen_texture_funcs(struct pipe_screen *screen) screen->get_tex_surface = cell_get_tex_surface; screen->tex_surface_destroy = cell_tex_surface_destroy; - screen->get_tex_transfer = cell_get_tex_transfer; - screen->tex_transfer_destroy = cell_tex_transfer_destroy; - - screen->transfer_map = cell_transfer_map; - screen->transfer_unmap = cell_transfer_unmap; - screen->flush_frontbuffer = cell_flush_frontbuffer; } + +void +cell_init_texture_transfer_funcs(struct cell_context *cell) +{ + cell->pipe.get_tex_transfer = cell_get_tex_transfer; + cell->pipe.tex_transfer_destroy = cell_tex_transfer_destroy; + cell->pipe.transfer_map = cell_transfer_map; + cell->pipe.transfer_unmap = cell_transfer_unmap; +} diff --git a/src/gallium/drivers/cell/ppu/cell_texture.h b/src/gallium/drivers/cell/ppu/cell_texture.h index 2be0579312..ac0b916775 100644 --- a/src/gallium/drivers/cell/ppu/cell_texture.h +++ b/src/gallium/drivers/cell/ppu/cell_texture.h @@ -95,5 +95,7 @@ cell_transfer(struct pipe_transfer *pt) extern void cell_init_screen_texture_funcs(struct pipe_screen *screen); +extern void +cell_init_texture_transfer_funcs(struct cell_context *cell); #endif /* CELL_TEXTURE_H */ -- cgit v1.2.3 From 489af2a3ba467e4341cb8504a0e59cf5828864d4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 11 Mar 2010 13:57:52 -0700 Subject: gallivm/llvmpipe: include os_llvm.h instead of llvm-c/Core.h --- src/gallium/auxiliary/gallivm/lp_bld_alpha.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_arit.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_blend.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_const.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_conv.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_debug.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_depth.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_flow.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_format.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_interp.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_intr.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_logic.c | 2 +- src/gallium/auxiliary/gallivm/lp_bld_logic.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_pack.c | 2 +- src/gallium/auxiliary/gallivm/lp_bld_pack.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_sample.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_struct.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_swizzle.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_tgsi.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_type.h | 2 +- src/gallium/drivers/llvmpipe/lp_screen.h | 4 +--- src/gallium/drivers/llvmpipe/lp_state.h | 2 +- src/gallium/drivers/llvmpipe/lp_state_fs.c | 3 +++ src/gallium/drivers/llvmpipe/lp_test.h | 2 +- src/gallium/drivers/llvmpipe/lp_test_format.c | 2 +- src/gallium/drivers/llvmpipe/lp_tex_sample.h | 2 +- 26 files changed, 28 insertions(+), 27 deletions(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_alpha.h b/src/gallium/auxiliary/gallivm/lp_bld_alpha.h index 634575670d..fe3cedcc48 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_alpha.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_alpha.h @@ -35,7 +35,7 @@ #define LP_BLD_ALPHA_H -#include +#include "os/os_llvm.h" struct pipe_alpha_state; struct lp_type; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.h b/src/gallium/auxiliary/gallivm/lp_bld_arit.h index 55385e3a66..f14b01e05f 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.h @@ -37,7 +37,7 @@ #define LP_BLD_ARIT_H -#include +#include "os/os_llvm.h" struct lp_type; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_blend.h b/src/gallium/auxiliary/gallivm/lp_bld_blend.h index da272e549f..5a9e1c1fb2 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_blend.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_blend.h @@ -40,7 +40,7 @@ * for a standalone example. */ -#include +#include "os/os_llvm.h" #include "pipe/p_format.h" diff --git a/src/gallium/auxiliary/gallivm/lp_bld_const.h b/src/gallium/auxiliary/gallivm/lp_bld_const.h index cb8e1c7b00..4078636103 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_const.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_const.h @@ -37,7 +37,7 @@ #define LP_BLD_CONST_H -#include +#include "os/os_llvm.h" #include diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.h b/src/gallium/auxiliary/gallivm/lp_bld_conv.h index 948e68fae4..78e8155ff7 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_conv.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.h @@ -37,7 +37,7 @@ #define LP_BLD_CONV_H -#include +#include "os/os_llvm.h" struct lp_type; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.h b/src/gallium/auxiliary/gallivm/lp_bld_debug.h index 583e6132b4..441ad94786 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.h @@ -30,7 +30,7 @@ #define LP_BLD_DEBUG_H -#include +#include "os/os_llvm.h" #include "pipe/p_compiler.h" #include "util/u_string.h" diff --git a/src/gallium/auxiliary/gallivm/lp_bld_depth.h b/src/gallium/auxiliary/gallivm/lp_bld_depth.h index 79d6981bb5..8be80024ae 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_depth.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_depth.h @@ -36,7 +36,7 @@ #define LP_BLD_DEPTH_H -#include +#include "os/os_llvm.h" struct pipe_depth_state; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.h b/src/gallium/auxiliary/gallivm/lp_bld_flow.h index 8bb22543ee..e158836549 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_flow.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.h @@ -35,7 +35,7 @@ #define LP_BLD_FLOW_H -#include +#include "os/os_llvm.h" struct lp_type; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format.h b/src/gallium/auxiliary/gallivm/lp_bld_format.h index 970bee379f..8972c0dc17 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_format.h @@ -34,7 +34,7 @@ * Pixel format helpers. */ -#include +#include "os/os_llvm.h" #include "pipe/p_format.h" diff --git a/src/gallium/auxiliary/gallivm/lp_bld_interp.h b/src/gallium/auxiliary/gallivm/lp_bld_interp.h index ca958cdf34..177b5e943e 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_interp.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_interp.h @@ -41,7 +41,7 @@ #define LP_BLD_INTERP_H -#include +#include "os/os_llvm.h" #include "tgsi/tgsi_exec.h" diff --git a/src/gallium/auxiliary/gallivm/lp_bld_intr.h b/src/gallium/auxiliary/gallivm/lp_bld_intr.h index f813f27074..7d5506c733 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_intr.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_intr.h @@ -37,7 +37,7 @@ #define LP_BLD_INTR_H -#include +#include "os/os_llvm.h" /** diff --git a/src/gallium/auxiliary/gallivm/lp_bld_logic.c b/src/gallium/auxiliary/gallivm/lp_bld_logic.c index 1308076b3e..f3df3dd138 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_logic.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_logic.c @@ -92,7 +92,7 @@ lp_build_compare(LLVMBuilderRef builder, /* XXX: It is not clear if we should use the ordered or unordered operators */ -#if !defined(HAVE_LLVM) || HAVE_LLVM < 0x0207 +#if HAVE_LLVM < 0x0207 #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) if(type.width * type.length == 128) { if(type.floating && util_cpu_caps.has_sse) { diff --git a/src/gallium/auxiliary/gallivm/lp_bld_logic.h b/src/gallium/auxiliary/gallivm/lp_bld_logic.h index a399ebf39e..b54ec13b70 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_logic.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_logic.h @@ -37,7 +37,7 @@ #define LP_BLD_LOGIC_H -#include +#include "os/os_llvm.h" #include "pipe/p_defines.h" /* For PIPE_FUNC_xxx */ diff --git a/src/gallium/auxiliary/gallivm/lp_bld_pack.c b/src/gallium/auxiliary/gallivm/lp_bld_pack.c index 4c61d10749..23398f41f9 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_pack.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_pack.c @@ -256,7 +256,7 @@ lp_build_pack2(LLVMBuilderRef builder, LLVMValueRef lo, LLVMValueRef hi) { -#if !(HAVE_LLVM >= 0x0207) +#if HAVE_LLVM < 0x0207 LLVMTypeRef src_vec_type = lp_build_vec_type(src_type); #endif LLVMTypeRef dst_vec_type = lp_build_vec_type(dst_type); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_pack.h b/src/gallium/auxiliary/gallivm/lp_bld_pack.h index fb2a34984a..346a17d580 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_pack.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_pack.h @@ -37,7 +37,7 @@ #define LP_BLD_PACK_H -#include +#include "os/os_llvm.h" struct lp_type; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index 5b8da5dbf2..9e88ea54d7 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -36,7 +36,7 @@ #define LP_BLD_SAMPLE_H -#include +#include "os/os_llvm.h" struct pipe_texture; struct pipe_sampler_state; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_struct.h b/src/gallium/auxiliary/gallivm/lp_bld_struct.h index 740392f561..34478c10f5 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_struct.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_struct.h @@ -37,7 +37,7 @@ #define LP_BLD_STRUCT_H -#include +#include "os/os_llvm.h" #include #include "util/u_debug.h" diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.h b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.h index b9472127a6..57b5cc079f 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.h @@ -37,7 +37,7 @@ #define LP_BLD_SWIZZLE_H -#include +#include "os/os_llvm.h" struct lp_type; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h index eddb7a83fa..0f2f8a65b1 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h @@ -35,7 +35,7 @@ #ifndef LP_BLD_TGSI_H #define LP_BLD_TGSI_H -#include +#include "os/os_llvm.h" struct tgsi_token; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_type.h b/src/gallium/auxiliary/gallivm/lp_bld_type.h index 4daa904e63..5b351476ac 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_type.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_type.h @@ -37,7 +37,7 @@ #define LP_BLD_TYPE_H -#include +#include "os/os_llvm.h" #include diff --git a/src/gallium/drivers/llvmpipe/lp_screen.h b/src/gallium/drivers/llvmpipe/lp_screen.h index f4e62cbf08..d977f98cfa 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.h +++ b/src/gallium/drivers/llvmpipe/lp_screen.h @@ -34,9 +34,7 @@ #ifndef LP_SCREEN_H #define LP_SCREEN_H -#include -#include -#include +#include "os/os_llvm.h" #include #include "pipe/p_screen.h" diff --git a/src/gallium/drivers/llvmpipe/lp_state.h b/src/gallium/drivers/llvmpipe/lp_state.h index 6dbdc195bf..a5a1a72074 100644 --- a/src/gallium/drivers/llvmpipe/lp_state.h +++ b/src/gallium/drivers/llvmpipe/lp_state.h @@ -31,7 +31,7 @@ #ifndef LP_STATE_H #define LP_STATE_H -#include +#include "os/os_llvm.h" #include "pipe/p_state.h" #include "tgsi/tgsi_scan.h" diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index c4b79dd415..ea6f056bb0 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -95,6 +95,9 @@ #include "lp_tex_sample.h" +#include + + static const unsigned char quad_offset_x[4] = {0, 1, 0, 1}; static const unsigned char quad_offset_y[4] = {0, 0, 1, 1}; diff --git a/src/gallium/drivers/llvmpipe/lp_test.h b/src/gallium/drivers/llvmpipe/lp_test.h index a9b99945f9..1df9897898 100644 --- a/src/gallium/drivers/llvmpipe/lp_test.h +++ b/src/gallium/drivers/llvmpipe/lp_test.h @@ -41,7 +41,7 @@ #include #include -#include +#include "os/os_llvm.h" #include #include #include diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index d05157991b..2c4d7fb6e1 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -29,7 +29,7 @@ #include #include -#include +#include "os/os_llvm.h" #include #include #include diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample.h b/src/gallium/drivers/llvmpipe/lp_tex_sample.h index cb59a94464..799df182b6 100644 --- a/src/gallium/drivers/llvmpipe/lp_tex_sample.h +++ b/src/gallium/drivers/llvmpipe/lp_tex_sample.h @@ -29,7 +29,7 @@ #define LP_TEX_SAMPLE_H -#include +#include "os/os_llvm.h" struct lp_sampler_static_state; -- cgit v1.2.3 From 272f399434ad6b33a8444c287c5126987a222864 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 11 Mar 2010 14:03:33 -0700 Subject: llvmpipe: fix comment typo --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index ea6f056bb0..9a8de0edfd 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -40,7 +40,7 @@ * - depth/stencil test (stencil TBI) * - blending * - * This file has only the glue to assembly the fragment pipeline. The actual + * This file has only the glue to assemble the fragment pipeline. The actual * plumbing of converting Gallium state into LLVM IR is done elsewhere, in the * lp_bld_*.[ch] files, and in a complete generic and reusable way. Here we * muster the LLVM JIT execution engine to create a function that follows an -- cgit v1.2.3 From 53efb634a0c134feebb5a3e47fc33660694be9c3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 11 Mar 2010 14:46:06 -0700 Subject: gallivm/llvmpipe: replace 'int stride' with 'int row_stride[MAX_LEVELS]' The stride depends on the mipmap level. Rename to row_stride to distinguish from img_stride for 3D textures. Fixes incorrect texel addressing in small mipmap levels. --- src/gallium/auxiliary/gallivm/lp_bld_sample.h | 6 +-- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 50 +++++++++++++++++++---- src/gallium/drivers/llvmpipe/lp_jit.c | 7 ++-- src/gallium/drivers/llvmpipe/lp_jit.h | 4 +- src/gallium/drivers/llvmpipe/lp_setup.c | 3 +- src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c | 4 +- 6 files changed, 54 insertions(+), 20 deletions(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index 9e88ea54d7..7f08bfaac1 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -113,9 +113,9 @@ struct lp_sampler_dynamic_state unsigned unit); LLVMValueRef - (*stride)( struct lp_sampler_dynamic_state *state, - LLVMBuilderRef builder, - unsigned unit); + (*row_stride)( struct lp_sampler_dynamic_state *state, + LLVMBuilderRef builder, + unsigned unit); LLVMValueRef (*data_ptr)( struct lp_sampler_dynamic_state *state, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 9358ad3860..2fc22fb1fd 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -138,6 +138,34 @@ lp_build_get_const_mipmap_level(struct lp_build_sample_context *bld, } +/** + * Dereference stride_array[mipmap_level] array to get a stride. + * Return stride as a vector. + */ +static LLVMValueRef +lp_build_get_level_stride_vec(struct lp_build_sample_context *bld, + LLVMValueRef stride_array, LLVMValueRef level) +{ + LLVMValueRef indexes[2], stride; + indexes[0] = LLVMConstInt(LLVMInt32Type(), 0, 0); + indexes[1] = level; + stride = LLVMBuildGEP(bld->builder, stride_array, indexes, 2, ""); + stride = LLVMBuildLoad(bld->builder, stride, ""); + stride = lp_build_broadcast_scalar(&bld->int_coord_bld, stride); + return stride; +} + + +/** Dereference stride_array[0] array to get a stride (as vector). */ +static LLVMValueRef +lp_build_get_const_level_stride_vec(struct lp_build_sample_context *bld, + LLVMValueRef stride_array, int level) +{ + LLVMValueRef lvl = LLVMConstInt(LLVMInt32Type(), level, 0); + return lp_build_get_level_stride_vec(bld, stride_array, lvl); +} + + static int texture_dims(enum pipe_texture_target tex) { @@ -1190,7 +1218,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld, LLVMValueRef width_vec, LLVMValueRef height_vec, LLVMValueRef depth_vec, - LLVMValueRef row_stride_vec, + LLVMValueRef row_stride_array, LLVMValueRef img_stride_vec, LLVMValueRef data_array, LLVMValueRef *colors_out) @@ -1248,7 +1276,8 @@ lp_build_sample_general(struct lp_build_sample_context *bld, width0_vec = lp_build_minify(bld, width_vec, ilevel0_vec); if (dims >= 2) { height0_vec = lp_build_minify(bld, height_vec, ilevel0_vec); - row_stride0_vec = lp_build_minify(bld, row_stride_vec, ilevel0_vec); + row_stride0_vec = lp_build_get_level_stride_vec(bld, row_stride_array, + ilevel0); if (dims == 3) { depth0_vec = lp_build_minify(bld, depth_vec, ilevel0_vec); } @@ -1258,7 +1287,8 @@ lp_build_sample_general(struct lp_build_sample_context *bld, width1_vec = lp_build_minify(bld, width_vec, ilevel1_vec); if (dims >= 2) { height1_vec = lp_build_minify(bld, height_vec, ilevel1_vec); - row_stride1_vec = lp_build_minify(bld, row_stride_vec, ilevel1_vec); + row_stride1_vec = lp_build_get_level_stride_vec(bld, row_stride_array, + ilevel1); if (dims == 3) { depth1_vec = lp_build_minify(bld, depth_vec, ilevel1_vec); } @@ -1380,7 +1410,7 @@ lp_build_sample_2d_linear_aos(struct lp_build_sample_context *bld, LLVMValueRef t, LLVMValueRef width, LLVMValueRef height, - LLVMValueRef stride, + LLVMValueRef stride_array, LLVMValueRef data_array, LLVMValueRef *texel) { @@ -1397,6 +1427,7 @@ lp_build_sample_2d_linear_aos(struct lp_build_sample_context *bld, LLVMValueRef neighbors_hi[2][2]; LLVMValueRef packed, packed_lo, packed_hi; LLVMValueRef unswizzled[4]; + LLVMValueRef stride; lp_build_context_init(&i32, builder, lp_type_int_vec(32)); lp_build_context_init(&h16, builder, lp_type_ufixed(16)); @@ -1504,6 +1535,8 @@ lp_build_sample_2d_linear_aos(struct lp_build_sample_context *bld, t_fpart_hi = LLVMBuildShuffleVector(builder, t_fpart, h16.undef, shuffle_hi, ""); } + stride = lp_build_get_const_level_stride_vec(bld, stride_array, 0); + /* * Fetch the pixels as 4 x 32bit (rgba order might differ): * @@ -1628,7 +1661,7 @@ lp_build_sample_soa(LLVMBuilderRef builder, LLVMValueRef width, width_vec; LLVMValueRef height, height_vec; LLVMValueRef depth, depth_vec; - LLVMValueRef stride, stride_vec; + LLVMValueRef stride_array; LLVMValueRef data_array; LLVMValueRef s; LLVMValueRef t; @@ -1664,7 +1697,7 @@ lp_build_sample_soa(LLVMBuilderRef builder, width = dynamic_state->width(dynamic_state, builder, unit); height = dynamic_state->height(dynamic_state, builder, unit); depth = dynamic_state->depth(dynamic_state, builder, unit); - stride = dynamic_state->stride(dynamic_state, builder, unit); + stride_array = dynamic_state->row_stride(dynamic_state, builder, unit); data_array = dynamic_state->data_ptr(dynamic_state, builder, unit); /* Note that data_array is an array[level] of pointers to texture images */ @@ -1675,7 +1708,6 @@ lp_build_sample_soa(LLVMBuilderRef builder, width_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, width); height_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, height); depth_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, depth); - stride_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, stride); if (lp_format_is_rgba8(bld.format_desc) && static_state->min_img_filter == PIPE_TEX_FILTER_LINEAR && @@ -1685,13 +1717,13 @@ lp_build_sample_soa(LLVMBuilderRef builder, is_simple_wrap_mode(static_state->wrap_t)) { /* special case */ lp_build_sample_2d_linear_aos(&bld, s, t, width_vec, height_vec, - stride_vec, data_array, texel); + stride_array, data_array, texel); } else { lp_build_sample_general(&bld, unit, s, t, r, width, height, depth, width_vec, height_vec, depth_vec, - stride_vec, NULL, data_array, + stride_array, NULL, data_array, texel); } diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c index 08c8f93794..5887613120 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.c +++ b/src/gallium/drivers/llvmpipe/lp_jit.c @@ -57,7 +57,8 @@ lp_jit_init_globals(struct llvmpipe_screen *screen) elem_types[LP_JIT_TEXTURE_HEIGHT] = LLVMInt32Type(); elem_types[LP_JIT_TEXTURE_DEPTH] = LLVMInt32Type(); elem_types[LP_JIT_TEXTURE_LAST_LEVEL] = LLVMInt32Type(); - elem_types[LP_JIT_TEXTURE_STRIDE] = LLVMInt32Type(); + elem_types[LP_JIT_TEXTURE_ROW_STRIDE] = + LLVMArrayType(LLVMInt32Type(), LP_MAX_TEXTURE_2D_LEVELS); elem_types[LP_JIT_TEXTURE_DATA] = LLVMArrayType(LLVMPointerType(LLVMInt8Type(), 0), LP_MAX_TEXTURE_2D_LEVELS); @@ -76,9 +77,9 @@ lp_jit_init_globals(struct llvmpipe_screen *screen) LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, last_level, screen->target, texture_type, LP_JIT_TEXTURE_LAST_LEVEL); - LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, stride, + LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, row_stride, screen->target, texture_type, - LP_JIT_TEXTURE_STRIDE); + LP_JIT_TEXTURE_ROW_STRIDE); LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, data, screen->target, texture_type, LP_JIT_TEXTURE_DATA); diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h index 5cc7a12c03..13167ae3bf 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.h +++ b/src/gallium/drivers/llvmpipe/lp_jit.h @@ -51,7 +51,7 @@ struct lp_jit_texture uint32_t height; uint32_t depth; uint32_t last_level; - uint32_t stride; + uint32_t row_stride[LP_MAX_TEXTURE_2D_LEVELS]; const void *data[LP_MAX_TEXTURE_2D_LEVELS]; }; @@ -61,7 +61,7 @@ enum { LP_JIT_TEXTURE_HEIGHT, LP_JIT_TEXTURE_DEPTH, LP_JIT_TEXTURE_LAST_LEVEL, - LP_JIT_TEXTURE_STRIDE, + LP_JIT_TEXTURE_ROW_STRIDE, LP_JIT_TEXTURE_DATA }; diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index d6d37c4809..c870f89d01 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -471,13 +471,13 @@ lp_setup_set_sampler_textures( struct setup_context *setup, jit_tex->height = tex->height0; jit_tex->depth = tex->depth0; jit_tex->last_level = tex->last_level; - jit_tex->stride = lp_tex->stride[0]; if (!lp_tex->dt) { /* regular texture - setup array of mipmap level pointers */ int j; for (j = 0; j <= tex->last_level; j++) { jit_tex->data[j] = (ubyte *) lp_tex->data + lp_tex->level_offset[j]; + jit_tex->row_stride[j] = lp_tex->stride[j]; } } else { @@ -490,6 +490,7 @@ lp_setup_set_sampler_textures( struct setup_context *setup, struct sw_winsys *winsys = screen->winsys; jit_tex->data[0] = winsys->displaytarget_map(winsys, lp_tex->dt, PIPE_BUFFER_USAGE_CPU_READ); + jit_tex->row_stride[0] = lp_tex->stride[0]; assert(jit_tex->data[0]); } diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c b/src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c index 5a3cf37d6d..662508af61 100644 --- a/src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c +++ b/src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c @@ -147,7 +147,7 @@ LP_LLVM_TEXTURE_MEMBER(width, LP_JIT_TEXTURE_WIDTH, TRUE) LP_LLVM_TEXTURE_MEMBER(height, LP_JIT_TEXTURE_HEIGHT, TRUE) LP_LLVM_TEXTURE_MEMBER(depth, LP_JIT_TEXTURE_DEPTH, TRUE) LP_LLVM_TEXTURE_MEMBER(last_level, LP_JIT_TEXTURE_LAST_LEVEL, TRUE) -LP_LLVM_TEXTURE_MEMBER(stride, LP_JIT_TEXTURE_STRIDE, TRUE) +LP_LLVM_TEXTURE_MEMBER(row_stride, LP_JIT_TEXTURE_ROW_STRIDE, FALSE) LP_LLVM_TEXTURE_MEMBER(data_ptr, LP_JIT_TEXTURE_DATA, FALSE) @@ -204,7 +204,7 @@ lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state, sampler->dynamic_state.base.height = lp_llvm_texture_height; sampler->dynamic_state.base.depth = lp_llvm_texture_depth; sampler->dynamic_state.base.last_level = lp_llvm_texture_last_level; - sampler->dynamic_state.base.stride = lp_llvm_texture_stride; + sampler->dynamic_state.base.row_stride = lp_llvm_texture_row_stride; sampler->dynamic_state.base.data_ptr = lp_llvm_texture_data_ptr; sampler->dynamic_state.static_state = static_state; sampler->dynamic_state.context_ptr = context_ptr; -- cgit v1.2.3 From 9ffdc78d1a308bb21a8627abb7bfc9da8abd2f81 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 11 Mar 2010 15:29:11 -0700 Subject: softpipe: tighten up the code in sample_cube() --- src/gallium/drivers/softpipe/sp_tex_sample.c | 100 ++++++++++----------------- 1 file changed, 38 insertions(+), 62 deletions(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index ef7ccf4189..1ce21b6ca0 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -1614,7 +1614,6 @@ sample_cube(struct tgsi_sampler *tgsi_sampler, struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); unsigned j; float ssss[4], tttt[4]; - unsigned face; /* major axis @@ -1628,7 +1627,8 @@ sample_cube(struct tgsi_sampler *tgsi_sampler, -rz TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT -rx -ry rz */ - /* First choose the cube face. + /* Choose the cube face and compute new s/t coords for the 2D face. + * * Use the same cube face for all four pixels in the quad. * * This isn't ideal, but if we want to use a different cube face @@ -1648,84 +1648,60 @@ sample_cube(struct tgsi_sampler *tgsi_sampler, if (arx >= ary && arx >= arz) { if (rx >= 0.0F) { - face = PIPE_TEX_FACE_POS_X; + for (j = 0; j < QUAD_SIZE; j++) { + const float ima = 1.0 / fabsf(s[j]); + ssss[j] = (-p[j] * ima + 1.0F) * 0.5F; + tttt[j] = (-t[j] * ima + 1.0F) * 0.5F; + samp->faces[j] = PIPE_TEX_FACE_POS_X; + } } else { - face = PIPE_TEX_FACE_NEG_X; + for (j = 0; j < QUAD_SIZE; j++) { + const float ima = 1.0 / fabsf(s[j]); + ssss[j] = ( p[j] * ima + 1.0F) * 0.5F; + tttt[j] = (-t[j] * ima + 1.0F) * 0.5F; + samp->faces[j] = PIPE_TEX_FACE_NEG_X; + } } } else if (ary >= arx && ary >= arz) { if (ry >= 0.0F) { - face = PIPE_TEX_FACE_POS_Y; + for (j = 0; j < QUAD_SIZE; j++) { + const float ima = 1.0 / fabsf(t[j]); + ssss[j] = (s[j] * ima + 1.0F) * 0.5F; + tttt[j] = (p[j] * ima + 1.0F) * 0.5F; + samp->faces[j] = PIPE_TEX_FACE_POS_Y; + } } else { - face = PIPE_TEX_FACE_NEG_Y; + for (j = 0; j < QUAD_SIZE; j++) { + const float ima = 1.0 / fabsf(t[j]); + ssss[j] = ( s[j] * ima + 1.0F) * 0.5F; + tttt[j] = (-p[j] * ima + 1.0F) * 0.5F; + samp->faces[j] = PIPE_TEX_FACE_NEG_Y; + } } } else { if (rz > 0.0F) { - face = PIPE_TEX_FACE_POS_Z; + for (j = 0; j < QUAD_SIZE; j++) { + const float ima = 1.0 / fabsf(p[j]); + ssss[j] = ( s[j] * ima + 1.0F) * 0.5F; + tttt[j] = (-t[j] * ima + 1.0F) * 0.5F; + samp->faces[j] = PIPE_TEX_FACE_POS_Z; + } } else { - face = PIPE_TEX_FACE_NEG_Z; + for (j = 0; j < QUAD_SIZE; j++) { + const float ima = 1.0 / fabsf(p[j]); + ssss[j] = (-s[j] * ima + 1.0F) * 0.5F; + tttt[j] = (-t[j] * ima + 1.0F) * 0.5F; + samp->faces[j] = PIPE_TEX_FACE_NEG_Z; + } } } } - /* Now compute the 2D _face_ texture coords from the - * 3D _cube_ texture coords. - */ - for (j = 0; j < QUAD_SIZE; j++) { - const float rx = s[j], ry = t[j], rz = p[j]; - const float arx = fabsf(rx), ary = fabsf(ry), arz = fabsf(rz); - float sc, tc, ma; - - switch (face) { - case PIPE_TEX_FACE_POS_X: - sc = -rz; - tc = -ry; - ma = arx; - break; - case PIPE_TEX_FACE_NEG_X: - sc = rz; - tc = -ry; - ma = arx; - break; - case PIPE_TEX_FACE_POS_Y: - sc = rx; - tc = rz; - ma = ary; - break; - case PIPE_TEX_FACE_NEG_Y: - sc = rx; - tc = -rz; - ma = ary; - break; - case PIPE_TEX_FACE_POS_Z: - sc = rx; - tc = -ry; - ma = arz; - break; - case PIPE_TEX_FACE_NEG_Z: - sc = -rx; - tc = -ry; - ma = arz; - break; - default: - assert(0 && "bad cube face"); - sc = 0.0F; - tc = 0.0F; - ma = 0.0F; - } - - { - const float ima = 1.0 / ma; - ssss[j] = ( sc * ima + 1.0F ) * 0.5F; - tttt[j] = ( tc * ima + 1.0F ) * 0.5F; - samp->faces[j] = face; - } - } - /* In our little pipeline, the compare stage is next. If compare * is not active, this will point somewhere deeper into the * pipeline, eg. to mip_filter or even img_filter. -- cgit v1.2.3 From c72a3b4f2ffe0673e753ad144d1b5557a42c670f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 11 Mar 2010 16:23:36 -0700 Subject: softpipe: further tighen up sample_cube() The code can fairly easily be translated to llvm... --- src/gallium/drivers/softpipe/sp_tex_sample.c | 66 +++++++++------------------- 1 file changed, 21 insertions(+), 45 deletions(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 1ce21b6ca0..fa9e19b282 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -1647,57 +1647,33 @@ sample_cube(struct tgsi_sampler *tgsi_sampler, const float arx = fabsf(rx), ary = fabsf(ry), arz = fabsf(rz); if (arx >= ary && arx >= arz) { - if (rx >= 0.0F) { - for (j = 0; j < QUAD_SIZE; j++) { - const float ima = 1.0 / fabsf(s[j]); - ssss[j] = (-p[j] * ima + 1.0F) * 0.5F; - tttt[j] = (-t[j] * ima + 1.0F) * 0.5F; - samp->faces[j] = PIPE_TEX_FACE_POS_X; - } - } - else { - for (j = 0; j < QUAD_SIZE; j++) { - const float ima = 1.0 / fabsf(s[j]); - ssss[j] = ( p[j] * ima + 1.0F) * 0.5F; - tttt[j] = (-t[j] * ima + 1.0F) * 0.5F; - samp->faces[j] = PIPE_TEX_FACE_NEG_X; - } + float sign = (rx >= 0.0F) ? 1.0F : -1.0F; + uint face = (rx >= 0.0F) ? PIPE_TEX_FACE_POS_X : PIPE_TEX_FACE_NEG_X; + for (j = 0; j < QUAD_SIZE; j++) { + const float ima = -0.5F / fabsf(s[j]); + ssss[j] = sign * p[j] * ima + 0.5F; + tttt[j] = t[j] * ima + 0.5F; + samp->faces[j] = face; } } else if (ary >= arx && ary >= arz) { - if (ry >= 0.0F) { - for (j = 0; j < QUAD_SIZE; j++) { - const float ima = 1.0 / fabsf(t[j]); - ssss[j] = (s[j] * ima + 1.0F) * 0.5F; - tttt[j] = (p[j] * ima + 1.0F) * 0.5F; - samp->faces[j] = PIPE_TEX_FACE_POS_Y; - } - } - else { - for (j = 0; j < QUAD_SIZE; j++) { - const float ima = 1.0 / fabsf(t[j]); - ssss[j] = ( s[j] * ima + 1.0F) * 0.5F; - tttt[j] = (-p[j] * ima + 1.0F) * 0.5F; - samp->faces[j] = PIPE_TEX_FACE_NEG_Y; - } + float sign = (ry >= 0.0F) ? 1.0F : -1.0F; + uint face = (ry >= 0.0F) ? PIPE_TEX_FACE_POS_Y : PIPE_TEX_FACE_NEG_Y; + for (j = 0; j < QUAD_SIZE; j++) { + const float ima = -0.5F / fabsf(t[j]); + ssss[j] = -s[j] * ima + 0.5F; + tttt[j] = sign * -p[j] * ima + 0.5F; + samp->faces[j] = face; } } else { - if (rz > 0.0F) { - for (j = 0; j < QUAD_SIZE; j++) { - const float ima = 1.0 / fabsf(p[j]); - ssss[j] = ( s[j] * ima + 1.0F) * 0.5F; - tttt[j] = (-t[j] * ima + 1.0F) * 0.5F; - samp->faces[j] = PIPE_TEX_FACE_POS_Z; - } - } - else { - for (j = 0; j < QUAD_SIZE; j++) { - const float ima = 1.0 / fabsf(p[j]); - ssss[j] = (-s[j] * ima + 1.0F) * 0.5F; - tttt[j] = (-t[j] * ima + 1.0F) * 0.5F; - samp->faces[j] = PIPE_TEX_FACE_NEG_Z; - } + float sign = (rz >= 0.0F) ? 1.0F : -1.0F; + uint face = (rz >= 0.0F) ? PIPE_TEX_FACE_POS_Z : PIPE_TEX_FACE_NEG_Z; + for (j = 0; j < QUAD_SIZE; j++) { + const float ima = -0.5 / fabsf(p[j]); + ssss[j] = sign * -s[j] * ima + 0.5F; + tttt[j] = t[j] * ima + 0.5F; + samp->faces[j] = face; } } } -- cgit v1.2.3 From e4d10dada0a04245a444257112b2f0df7372e76d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 11 Mar 2010 20:52:38 -0800 Subject: llvmpipe: Remove unnecessary header. --- src/gallium/drivers/llvmpipe/lp_buffer.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/llvmpipe/lp_buffer.c b/src/gallium/drivers/llvmpipe/lp_buffer.c index dab20cb639..6e0f37393e 100644 --- a/src/gallium/drivers/llvmpipe/lp_buffer.c +++ b/src/gallium/drivers/llvmpipe/lp_buffer.c @@ -33,7 +33,6 @@ #include "lp_screen.h" #include "lp_buffer.h" -#include "state_tracker/sw_winsys.h" static void * llvmpipe_buffer_map(struct pipe_screen *screen, -- cgit v1.2.3 From e42b2f768509b6984c7186805c6a8afdaebf3a06 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 12 Mar 2010 02:47:44 -0800 Subject: r300g: Properly clamp index limits. Make the kernel even less likely to barf on us. --- src/gallium/drivers/r300/r300_render.c | 2 +- src/gallium/drivers/r300/r300_state.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 9c001ae186..ef1b7510e1 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -280,7 +280,7 @@ static void r300_emit_draw_elements(struct r300_context *r300, DBG(r300, DBG_DRAW, "r300: Indexbuf of %u indices, min %u max %u\n", count, minIndex, maxIndex); - maxIndex = MIN2(maxIndex, r300->vertex_buffer_max_index); + maxIndex = MIN3(maxIndex, r300->vertex_buffer_max_index, (1 << 24) - 1); if (alt_num_verts) { BEGIN_CS(15); diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index bd4c2766cb..ced6c810ec 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1031,7 +1031,7 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe, const struct pipe_vertex_buffer* buffers) { struct r300_context* r300 = r300_context(pipe); - unsigned i, max_index = ~0; + unsigned i, max_index = (1 << 24) - 1; memcpy(r300->vertex_buffer, buffers, sizeof(struct pipe_vertex_buffer) * count); -- cgit v1.2.3 From fab1f07d6ad01463897ae792f4b33738afb07369 Mon Sep 17 00:00:00 2001 From: Jeff Smith Date: Fri, 13 Jun 2008 09:50:43 -0500 Subject: Grammar and spelling fixes Signed-off-by: Jeff Smith Signed-off-by: Brian Paul --- docs/README.3DFX | 2 +- docs/egl.html | 2 +- progs/objviewer/glm.c | 2 +- progs/objviewer/glm.h | 2 +- progs/tests/vao-01.c | 2 +- progs/tests/vao-02.c | 2 +- src/gallium/auxiliary/os/os_time.h | 2 +- src/gallium/drivers/cell/ppu/cell_gen_fragment.c | 2 +- src/gallium/drivers/cell/ppu/cell_spu.c | 2 +- src/gallium/drivers/nv40/nv40_vertprog.c | 2 +- src/gallium/drivers/r300/r300_reg.h | 4 ++-- src/gallium/state_trackers/wgl/stw_framebuffer.h | 2 +- src/glu/sgi/libnurbs/nurbtess/partitionY.h | 2 +- src/glu/sgi/libtess/normal.c | 2 +- src/mesa/drivers/dri/common/dri_util.c | 2 +- src/mesa/drivers/dri/r128/r128_tex.c | 2 +- src/mesa/drivers/dri/r200/r200_reg.h | 2 +- src/mesa/drivers/dri/r300/r300_reg.h | 4 ++-- src/mesa/drivers/dri/radeon/radeon_state.c | 2 +- src/mesa/drivers/x11/xmesa.h | 2 +- src/mesa/drivers/x11/xmesaP.h | 2 +- src/mesa/main/dd.h | 2 +- src/mesa/main/texcompress_fxt1.c | 2 +- src/mesa/math/m_debug_util.h | 2 +- src/mesa/math/m_matrix.c | 2 +- src/mesa/shader/prog_instruction.h | 4 ++-- src/mesa/shader/program_parser.h | 2 +- src/mesa/shader/slang/library/slang_common_builtin.gc | 2 +- src/mesa/swrast/s_depth.c | 2 +- src/mesa/vbo/vbo_save_loopback.c | 2 +- 30 files changed, 33 insertions(+), 33 deletions(-) (limited to 'src/gallium/drivers') diff --git a/docs/README.3DFX b/docs/README.3DFX index 037e8fa7cc..7feda6f33f 100644 --- a/docs/README.3DFX +++ b/docs/README.3DFX @@ -644,7 +644,7 @@ Hints and Special Features: - The Voodoo driver supports the GL_EXT_paletted_texture. it works only with GL_COLOR_INDEX8_EXT, GL_RGBA palettes and the alpha value - is ignored because this is a limitation of the the current Glide + is ignored because this is a limitation of the current Glide version and of the Voodoo hardware. See Mesa-3.1/3Dfx/demos/paltex.c for a demo of this extension. diff --git a/docs/egl.html b/docs/egl.html index 82cc06600b..55907f6cfa 100644 --- a/docs/egl.html +++ b/docs/egl.html @@ -28,7 +28,7 @@ cards.

  1. -

    Run configure with the desired state trackers and and enable +

    Run configure with the desired state trackers and enable the Gallium driver for your hardware. For example

    diff --git a/progs/objviewer/glm.c b/progs/objviewer/glm.c
    index 7c964e489d..77e62bfab1 100644
    --- a/progs/objviewer/glm.c
    +++ b/progs/objviewer/glm.c
    @@ -1041,7 +1041,7 @@ glmFacetNormals(GLMmodel* model)
     
     /* glmVertexNormals: Generates smooth vertex normals for a model.
      * First builds a list of all the triangles each vertex is in.  Then
    - * loops through each vertex in the the list averaging all the facet
    + * loops through each vertex in the list averaging all the facet
      * normals of the triangles each vertex is in.  Finally, sets the
      * normal index in the triangle for the vertex to the generated smooth
      * normal.  If the dot product of a facet normal and the facet normal
    diff --git a/progs/objviewer/glm.h b/progs/objviewer/glm.h
    index 8740b3684d..1a5646fa4c 100644
    --- a/progs/objviewer/glm.h
    +++ b/progs/objviewer/glm.h
    @@ -153,7 +153,7 @@ glmFacetNormals(GLMmodel* model);
     
     /* glmVertexNormals: Generates smooth vertex normals for a model.
      * First builds a list of all the triangles each vertex is in.  Then
    - * loops through each vertex in the the list averaging all the facet
    + * loops through each vertex in the list averaging all the facet
      * normals of the triangles each vertex is in.  Finally, sets the
      * normal index in the triangle for the vertex to the generated smooth
      * normal.  If the dot product of a facet normal and the facet normal
    diff --git a/progs/tests/vao-01.c b/progs/tests/vao-01.c
    index e4a89cb19d..ee528d2243 100644
    --- a/progs/tests/vao-01.c
    +++ b/progs/tests/vao-01.c
    @@ -30,7 +30,7 @@
      * it (via \c glPopClientAttrib).  After popping, the state of the VAO is
      * examined.
      * 
    - * According the the APPLE_vertex_array_object spec, the contents of the VAO
    + * According to the APPLE_vertex_array_object spec, the contents of the VAO
      * should be restored to the values that they had when pushed.
      * 
      * \author Ian Romanick 
    diff --git a/progs/tests/vao-02.c b/progs/tests/vao-02.c
    index 9f7f5c2779..c23b4ab05a 100644
    --- a/progs/tests/vao-02.c
    +++ b/progs/tests/vao-02.c
    @@ -30,7 +30,7 @@
      * it (via \c glPopClientAttrib).  After popping, the state of the VAO is
      * examined.
      * 
    - * According the the APPLE_vertex_array_object spec, the contents of the VAO
    + * According to the APPLE_vertex_array_object spec, the contents of the VAO
      * should be restored to the values that they had when pushed.
      * 
      * \author Ian Romanick 
    diff --git a/src/gallium/auxiliary/os/os_time.h b/src/gallium/auxiliary/os/os_time.h
    index 5b55c1b374..7e0f67a76b 100644
    --- a/src/gallium/auxiliary/os/os_time.h
    +++ b/src/gallium/auxiliary/os/os_time.h
    @@ -71,7 +71,7 @@ os_time_sleep(int64_t usecs);
     /*
      * Helper function for detecting time outs, taking in account overflow.
      *
    - * Returns true the the current time has elapsed beyond the specified interval.
    + * Returns true if the current time has elapsed beyond the specified interval.
      */
     static INLINE boolean
     os_time_timeout(int64_t start,
    diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
    index 576d514741..c54576b3c3 100644
    --- a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
    +++ b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
    @@ -1352,7 +1352,7 @@ gen_stencil_values(struct spe_function *f,
         */
        ASSERT(fbS_reg != newS_reg);
     
    -   /* The code also assumes the the stencil_max_value is of the form 
    +   /* The code also assumes that the stencil_max_value is of the form
         * 2^n-1 and can therefore be used as a mask for the valid bits in 
         * addition to a maximum.  Make sure this is the case as well.
         * The clever math below exploits the fact that incrementing a 
    diff --git a/src/gallium/drivers/cell/ppu/cell_spu.c b/src/gallium/drivers/cell/ppu/cell_spu.c
    index 28e5e6d706..39284f3a5d 100644
    --- a/src/gallium/drivers/cell/ppu/cell_spu.c
    +++ b/src/gallium/drivers/cell/ppu/cell_spu.c
    @@ -135,7 +135,7 @@ cell_thread_function(void *arg)
     
     /**
      * Create the SPU threads.  This is done once during driver initialization.
    - * This involves setting the the "init" message which is sent to each SPU.
    + * This involves setting the "init" message which is sent to each SPU.
      * The init message specifies an SPU id, total number of SPUs, location
      * and number of batch buffers, etc.
      */
    diff --git a/src/gallium/drivers/nv40/nv40_vertprog.c b/src/gallium/drivers/nv40/nv40_vertprog.c
    index b289eef0fc..c93c5d127c 100644
    --- a/src/gallium/drivers/nv40/nv40_vertprog.c
    +++ b/src/gallium/drivers/nv40/nv40_vertprog.c
    @@ -742,7 +742,7 @@ nv40_vertprog_translate(struct nv40_context *nv40,
     	}
     
     	/* Redirect post-transform vertex position to a temp if user clip
    -	 * planes are enabled.  We need to append code the the vtxprog
    +	 * planes are enabled.  We need to append code to the vtxprog
     	 * to handle clip planes later.
     	 */
     	if (vp->ucp.nr)  {
    diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h
    index a249e8b36b..c67cc86871 100644
    --- a/src/gallium/drivers/r300/r300_reg.h
    +++ b/src/gallium/drivers/r300/r300_reg.h
    @@ -540,7 +540,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
     #       define R300_PVS_FIRST_INST(x)            ((x) << 0)
     #       define R300_PVS_XYZW_VALID_INST(x)       ((x) << 10)
     #       define R300_PVS_LAST_INST(x)             ((x) << 20)
    -/* Addresses are relative the the vertex program parameters area. */
    +/* Addresses are relative to the vertex program parameters area. */
     #define R300_VAP_PVS_CONST_CNTL             0x22D4
     #       define R300_PVS_CONST_BASE_OFFSET_SHIFT  0
     #       define R300_PVS_MAX_CONST_ADDR_SHIFT     16
    @@ -1857,7 +1857,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
      * The destination register index is in FPI1 (color) and FPI3 (alpha)
      * together with enable bits.
      * There are separate enable bits for writing into temporary registers
    - * (DSTC_REG_* /DSTA_REG) and and program output registers (DSTC_OUTPUT_*
    + * (DSTC_REG_* /DSTA_REG) and program output registers (DSTC_OUTPUT_*
      * /DSTA_OUTPUT). You can write to both at once, or not write at all (the
      * same index must be used for both).
      *
    diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.h b/src/gallium/state_trackers/wgl/stw_framebuffer.h
    index 08cc4973bc..e61e9bf9c2 100644
    --- a/src/gallium/state_trackers/wgl/stw_framebuffer.h
    +++ b/src/gallium/state_trackers/wgl/stw_framebuffer.h
    @@ -45,7 +45,7 @@ struct stw_framebuffer
        /**
         * This mutex has two purposes:
         * - protect the access to the mutable data members below
    -    * - prevent the the framebuffer from being deleted while being accessed.
    +    * - prevent the framebuffer from being deleted while being accessed.
         * 
         * It is OK to lock this mutex while holding the stw_device::fb_mutex lock, 
         * but the opposite must never happen.
    diff --git a/src/glu/sgi/libnurbs/nurbtess/partitionY.h b/src/glu/sgi/libnurbs/nurbtess/partitionY.h
    index 8dda409de1..5570c183d7 100644
    --- a/src/glu/sgi/libnurbs/nurbtess/partitionY.h
    +++ b/src/glu/sgi/libnurbs/nurbtess/partitionY.h
    @@ -39,7 +39,7 @@
      *or both at or below v. In addition, at least one of the ajacent verteces is
      *strictly below or above v. 
      * A vertex is a relex vertex if the internals angle is strictly greater than 
    - *180. In other words, if the the signed area is negative:
    + *180. In other words, if the signed area is negative:
      *(x1, y1), (x2, y2), (x3, y3) are the three vertices along a polygon, the 
      *order is such that left hand side is inside the polygon. Then (x2,y2) is
      *reflex if: 
    diff --git a/src/glu/sgi/libtess/normal.c b/src/glu/sgi/libtess/normal.c
    index 0a2494be34..7ab83167bb 100644
    --- a/src/glu/sgi/libtess/normal.c
    +++ b/src/glu/sgi/libtess/normal.c
    @@ -142,7 +142,7 @@ static void CheckOrientation( GLUtesselator *tess )
       GLUhalfEdge *e;
     
       /* When we compute the normal automatically, we choose the orientation
    -   * so that the the sum of the signed areas of all contours is non-negative.
    +   * so that the sum of the signed areas of all contours is non-negative.
        */
       area = 0;
       for( f = fHead->next; f != fHead; f = f->next ) {
    diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
    index 890ae51339..75c98825b7 100644
    --- a/src/mesa/drivers/dri/common/dri_util.c
    +++ b/src/mesa/drivers/dri/common/dri_util.c
    @@ -698,7 +698,7 @@ setupLoaderExtensions(__DRIscreen *psp,
      * \param drm_version Version of the kernel DRM.
      * \param frame_buffer Data describing the location and layout of the
      *                     framebuffer.
    - * \param pSAREA       Pointer the the SAREA.
    + * \param pSAREA       Pointer to the SAREA.
      * \param fd           Device handle for the DRM.
      * \param extensions   ??
      * \param driver_modes  Returns modes suppoted by the driver
    diff --git a/src/mesa/drivers/dri/r128/r128_tex.c b/src/mesa/drivers/dri/r128/r128_tex.c
    index 24fbf8f519..4ec4be9a47 100644
    --- a/src/mesa/drivers/dri/r128/r128_tex.c
    +++ b/src/mesa/drivers/dri/r128/r128_tex.c
    @@ -468,7 +468,7 @@ static void r128TexEnv( GLcontext *ctx, GLenum target,
     	  * certain point.  It is better than completely ignoring the LOD
     	  * bias.  Unfortunately there isn't much range in the bias, the
     	  * spec mentions strides that vary between 0.5 and 2.0 but these
    -	  * numbers don't seem to relate the the GL LOD bias value at all.
    +	  * numbers don't seem to relate to the GL LOD bias value at all.
     	  */
     	 if ( param[0] >= 1.0 ) {
     	    bias = -128;
    diff --git a/src/mesa/drivers/dri/r200/r200_reg.h b/src/mesa/drivers/dri/r200/r200_reg.h
    index 59115212ce..b3a4940a7a 100644
    --- a/src/mesa/drivers/dri/r200/r200_reg.h
    +++ b/src/mesa/drivers/dri/r200/r200_reg.h
    @@ -690,7 +690,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     #       define R200_PVS_CNTL_1_PROGRAM_START_SHIFT   0
     #       define R200_PVS_CNTL_1_POS_END_SHIFT         10
     #       define R200_PVS_CNTL_1_PROGRAM_END_SHIFT     20
    -/* Addresses are relative the the vertex program parameters area. */
    +/* Addresses are relative to the vertex program parameters area. */
     #define R200_VAP_PVS_CNTL_2                 0x22d4
     #       define R200_PVS_CNTL_2_PARAM_OFFSET_SHIFT 0
     #       define R200_PVS_CNTL_2_PARAM_COUNT_SHIFT  16
    diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h
    index d18ebab8ff..ac93563ed9 100644
    --- a/src/mesa/drivers/dri/r300/r300_reg.h
    +++ b/src/mesa/drivers/dri/r300/r300_reg.h
    @@ -482,7 +482,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
     #       define R300_PVS_FIRST_INST_SHIFT         0
     #       define R300_PVS_XYZW_VALID_INST_SHIFT    10
     #       define R300_PVS_LAST_INST_SHIFT          20
    -/* Addresses are relative the the vertex program parameters area. */
    +/* Addresses are relative to the vertex program parameters area. */
     #define R300_VAP_PVS_CONST_CNTL             0x22D4
     #       define R300_PVS_CONST_BASE_OFFSET_SHIFT  0
     #       define R300_PVS_MAX_CONST_ADDR_SHIFT     16
    @@ -1760,7 +1760,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
      * The destination register index is in FPI1 (color) and FPI3 (alpha)
      * together with enable bits.
      * There are separate enable bits for writing into temporary registers
    - * (DSTC_REG_* /DSTA_REG) and and program output registers (DSTC_OUTPUT_*
    + * (DSTC_REG_* /DSTA_REG) and program output registers (DSTC_OUTPUT_*
      * /DSTA_OUTPUT). You can write to both at once, or not write at all (the
      * same index must be used for both).
      *
    diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
    index 0ce97e8697..583751d64d 100644
    --- a/src/mesa/drivers/dri/radeon/radeon_state.c
    +++ b/src/mesa/drivers/dri/radeon/radeon_state.c
    @@ -1900,7 +1900,7 @@ void radeonUploadTexMatrix( r100ContextPtr rmesa,
        So: if we need the q coord in the end (solely determined by the texture
        target, i.e. 2d / 1d / texrect targets) we swap the third and 4th row.
        Additionally, if we don't have texgen but 4 tex coords submitted, we swap
    -   column 3 and 4 (for the 2d / 1d / texrect targets) since the the q coord
    +   column 3 and 4 (for the 2d / 1d / texrect targets) since the q coord
        will get submitted in the "wrong", i.e. 3rd, slot.
        If an app submits 3 coords for 2d targets, we assume it is saving on vertex
        size and using the texture matrix to swap the r and q coords around (ut2k3
    diff --git a/src/mesa/drivers/x11/xmesa.h b/src/mesa/drivers/x11/xmesa.h
    index 98139af833..f63626a970 100644
    --- a/src/mesa/drivers/x11/xmesa.h
    +++ b/src/mesa/drivers/x11/xmesa.h
    @@ -287,7 +287,7 @@ extern void XMesaCopySubBuffer( XMesaBuffer b,
     
     
     /*
    - * Return a pointer to the the Pixmap or XImage being used as the back
    + * Return a pointer to the Pixmap or XImage being used as the back
      * color buffer of an XMesaBuffer.  This function is a way to get "under
      * the hood" of X/Mesa so one can manipulate the back buffer directly.
      * Input:  b - the XMesaBuffer
    diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h
    index 3ffd7661e3..e0a6908228 100644
    --- a/src/mesa/drivers/x11/xmesaP.h
    +++ b/src/mesa/drivers/x11/xmesaP.h
    @@ -431,7 +431,7 @@ extern const int xmesa_kernel8[DITH_DY * DITH_DX];
      * If pixelformat==PF_HPCR:
      *
      *      HP Color Recovery dithering               (ad@lms.be 30/08/95)
    - *      HP has on it's 8-bit 700-series computers, a feature called
    + *      HP has on its 8-bit 700-series computers, a feature called
      *      'Color Recovery'.  This allows near 24-bit output (so they say).
      *      It is enabled by selecting the 8-bit  TrueColor  visual AND
      *      corresponding  colormap (see tkInitWindow) AND doing some special
    diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
    index 197de09b22..7c02faaa53 100644
    --- a/src/mesa/main/dd.h
    +++ b/src/mesa/main/dd.h
    @@ -1072,7 +1072,7 @@ struct dd_function_table {
      * These are the initial values to be installed into dispatch by
      * mesa.  If the T&L driver wants to modify the dispatch table
      * while installed, it must do so itself.  It would be possible for
    - * the vertexformat to install it's own initial values for these
    + * the vertexformat to install its own initial values for these
      * functions, but this way there is an obvious list of what is
      * expected of the driver.
      *
    diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c
    index 149853f7ac..04acf05e52 100644
    --- a/src/mesa/main/texcompress_fxt1.c
    +++ b/src/mesa/main/texcompress_fxt1.c
    @@ -476,7 +476,7 @@ fxt1_lloyd (GLfloat vec[][MAX_COMP], GLint nv,
         *     for each sample color
         *         sort to nearest vector.
         *
    -    *     replace each vector with the centroid of it's matching colors.
    +    *     replace each vector with the centroid of its matching colors.
         *
         *     repeat until RMS doesn't improve.
         *
    diff --git a/src/mesa/math/m_debug_util.h b/src/mesa/math/m_debug_util.h
    index 2e67db8e55..ed11c849ec 100644
    --- a/src/mesa/math/m_debug_util.h
    +++ b/src/mesa/math/m_debug_util.h
    @@ -61,7 +61,7 @@ extern long counter_overhead;
      */
     extern char *mesa_profile;
     
    -/* Modify the the number of tests if you like.
    +/* Modify the number of tests if you like.
      * We take the minimum of all results, because every error should be
      * positive (time used by other processes, task switches etc).
      * It is assumed that all calculations are done in the cache.
    diff --git a/src/mesa/math/m_matrix.c b/src/mesa/math/m_matrix.c
    index ef8a40fbec..4b33d0bbb3 100644
    --- a/src/mesa/math/m_matrix.c
    +++ b/src/mesa/math/m_matrix.c
    @@ -889,7 +889,7 @@ _math_matrix_rotate( GLmatrix *mat,
            *  Y-axis to bring the axis vector parallel with the X-axis.  The
            *  rotation about the X-axis is then performed.  Ry and Rz are
            *  simply the respective inverse transforms to bring the arbitrary
    -       *  axis back to it's original orientation.  The first transforms
    +       *  axis back to its original orientation.  The first transforms
            *  Rz' and Ry' are considered inverses, since the data from the
            *  arbitrary axis gives you info on how to get to it, not how
            *  to get away from it, and an inverse must be applied.
    diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h
    index 224350caac..28c797a4ba 100644
    --- a/src/mesa/shader/prog_instruction.h
    +++ b/src/mesa/shader/prog_instruction.h
    @@ -97,8 +97,8 @@
     #define COND_EQ  2  /**< equal to zero */
     #define COND_LT  3  /**< less than zero */
     #define COND_UN  4  /**< unordered (NaN) */
    -#define COND_GE  5  /**< greater then or equal to zero */
    -#define COND_LE  6  /**< less then or equal to zero */
    +#define COND_GE  5  /**< greater than or equal to zero */
    +#define COND_LE  6  /**< less than or equal to zero */
     #define COND_NE  7  /**< not equal to zero */
     #define COND_TR  8  /**< always true */
     #define COND_FL  9  /**< always false */
    diff --git a/src/mesa/shader/program_parser.h b/src/mesa/shader/program_parser.h
    index 730466c30f..be952d4b9c 100644
    --- a/src/mesa/shader/program_parser.h
    +++ b/src/mesa/shader/program_parser.h
    @@ -62,7 +62,7 @@ struct asm_symbol {
         */
        unsigned param_binding_swizzle;
     
    -   /* This is how many entries in the the program_parameter_list we take up
    +   /* This is how many entries in the program_parameter_list we take up
         * with our state tokens or constants. Note that this is _not_ the same as
         * the number of param registers we eventually use.
         */
    diff --git a/src/mesa/shader/slang/library/slang_common_builtin.gc b/src/mesa/shader/slang/library/slang_common_builtin.gc
    index 8b7771c284..a25ca55bc4 100644
    --- a/src/mesa/shader/slang/library/slang_common_builtin.gc
    +++ b/src/mesa/shader/slang/library/slang_common_builtin.gc
    @@ -695,7 +695,7 @@ vec3 normalize(const vec3 v)
     {
     //   const float s = inversesqrt(dot(v, v));
     //   __retVal = v * s;
    -// XXX note, we _could_ use __retVal.w instead of tmp and and save a
    +// XXX note, we _could_ use __retVal.w instead of tmp and save a
     // register, but that's actually a compilation error because v is a vec3
     // and the .w suffix is illegal.  Oh well.
        float tmp;
    diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c
    index 3e36cf9a7e..ed637cac12 100644
    --- a/src/mesa/swrast/s_depth.c
    +++ b/src/mesa/swrast/s_depth.c
    @@ -526,7 +526,7 @@ _swrast_depth_clamp_span( GLcontext *ctx, SWspan *span )
     
        /* Convert floating point values in [0,1] to device Z coordinates in
         * [0, DepthMax].
    -    * ex: If the the Z buffer has 24 bits, DepthMax = 0xffffff.
    +    * ex: If the Z buffer has 24 bits, DepthMax = 0xffffff.
         * 
         * XXX this all falls apart if we have 31 or more bits of Z because
         * the triangle rasterization code produces unsigned Z values.  Negative
    diff --git a/src/mesa/vbo/vbo_save_loopback.c b/src/mesa/vbo/vbo_save_loopback.c
    index f253c854d2..3f581ea02d 100644
    --- a/src/mesa/vbo/vbo_save_loopback.c
    +++ b/src/mesa/vbo/vbo_save_loopback.c
    @@ -78,7 +78,7 @@ struct loopback_attr {
     };
     
     /* Don't emit ends and begins on wrapped primitives.  Don't replay
    - * wrapped vertices.  If we get here, it's probably because the the
    + * wrapped vertices.  If we get here, it's probably because the
      * precalculated wrapping is wrong.
      */
     static void loopback_prim( GLcontext *ctx,
    -- 
    cgit v1.2.3
    
    
    From 13a13fcb8054ed2d1138f6754fc67b014cc5cd5d Mon Sep 17 00:00:00 2001
    From: Michel Dänzer 
    Date: Fri, 12 Mar 2010 19:52:24 +0100
    Subject: svga: Fix up for context transfers.
    
    ---
     src/gallium/drivers/svga/svga_context.c | 2 ++
     1 file changed, 2 insertions(+)
    
    (limited to 'src/gallium/drivers')
    
    diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c
    index d499ae6acc..adb7840182 100644
    --- a/src/gallium/drivers/svga/svga_context.c
    +++ b/src/gallium/drivers/svga/svga_context.c
    @@ -164,6 +164,8 @@ struct pipe_context *svga_context_create( struct pipe_screen *screen,
        svga_init_constbuffer_functions(svga);
        svga_init_query_functions(svga);
     
    +   svga_init_texture_functions(&svga->pipe);
    +
        /* debug */
        svga->debug.no_swtnl = debug_get_bool_option("SVGA_NO_SWTNL", FALSE);
        svga->debug.force_swtnl = debug_get_bool_option("SVGA_FORCE_SWTNL", FALSE);
    -- 
    cgit v1.2.3
    
    
    From 2764a5191ffcaf93a77beff464ac8eca15163fcc Mon Sep 17 00:00:00 2001
    From: Corbin Simpson 
    Date: Fri, 12 Mar 2010 18:13:18 -0800
    Subject: r300g: Forcibly sanitize max index.
    
    Not perfect, but the kernel should shut up now.
    ---
     src/gallium/drivers/r300/r300_render.c | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)
    
    (limited to 'src/gallium/drivers')
    
    diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
    index ef1b7510e1..ccf39876a5 100644
    --- a/src/gallium/drivers/r300/r300_render.c
    +++ b/src/gallium/drivers/r300/r300_render.c
    @@ -274,14 +274,14 @@ static void r300_emit_draw_elements(struct r300_context *r300,
     #endif
         CS_LOCALS(r300);
     
    -    assert((start * indexSize)  % 4 == 0);
    +    assert((start * indexSize) % 4 == 0);
         assert(count < (1 << 24));
     
    +    maxIndex = MIN3(maxIndex, r300->vertex_buffer_max_index, count - minIndex);
    +
         DBG(r300, DBG_DRAW, "r300: Indexbuf of %u indices, min %u max %u\n",
             count, minIndex, maxIndex);
     
    -    maxIndex = MIN3(maxIndex, r300->vertex_buffer_max_index, (1 << 24) - 1);
    -
         if (alt_num_verts) {
             BEGIN_CS(15);
             OUT_CS_REG(R500_VAP_ALT_NUM_VERTICES, count);
    -- 
    cgit v1.2.3
    
    
    From 83fe7149eaea7ca607a5aa74e092b9cf86f12b73 Mon Sep 17 00:00:00 2001
    From: Xavier Chantry 
    Date: Sat, 13 Mar 2010 11:33:27 +0100
    Subject: nv50: fixup after gallium-context-transfers merge
    
    ---
     src/gallium/drivers/nv50/nv50_screen.c | 1 -
     src/gallium/drivers/nv50/nv50_screen.h | 2 --
     2 files changed, 3 deletions(-)
    
    (limited to 'src/gallium/drivers')
    
    diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
    index 7e2e8aa336..adf0d3b374 100644
    --- a/src/gallium/drivers/nv50/nv50_screen.c
    +++ b/src/gallium/drivers/nv50/nv50_screen.c
    @@ -234,7 +234,6 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
     	pscreen->context_create = nv50_create;
     
     	nv50_screen_init_miptree_functions(pscreen);
    -	nv50_transfer_init_screen_functions(pscreen);
     
     	/* DMA engine object */
     	ret = nouveau_grobj_alloc(chan, 0xbeef5039,
    diff --git a/src/gallium/drivers/nv50/nv50_screen.h b/src/gallium/drivers/nv50/nv50_screen.h
    index d1bc80cb9e..ec19ea655b 100644
    --- a/src/gallium/drivers/nv50/nv50_screen.h
    +++ b/src/gallium/drivers/nv50/nv50_screen.h
    @@ -38,6 +38,4 @@ nv50_screen(struct pipe_screen *screen)
     	return (struct nv50_screen *)screen;
     }
     
    -void nv50_transfer_init_screen_functions(struct pipe_screen *);
    -
     #endif
    -- 
    cgit v1.2.3
    
    
    From 3160cbabccf1f7d8bdf344242507b9c3082f15c6 Mon Sep 17 00:00:00 2001
    From: José Fonseca 
    Date: Sat, 13 Mar 2010 10:45:52 +0000
    Subject: llvmpipe: setup_context -> lp_setup_context
    
    Otherwise IDEs and debuggers have trouble distinguishing from softpipe's
    setup_context.
    ---
     src/gallium/drivers/llvmpipe/lp_context.h       |  4 +-
     src/gallium/drivers/llvmpipe/lp_rast.h          |  2 +-
     src/gallium/drivers/llvmpipe/lp_setup.c         | 58 ++++++++++++-------------
     src/gallium/drivers/llvmpipe/lp_setup.h         | 32 +++++++-------
     src/gallium/drivers/llvmpipe/lp_setup_context.h | 22 +++++-----
     src/gallium/drivers/llvmpipe/lp_setup_line.c    |  4 +-
     src/gallium/drivers/llvmpipe/lp_setup_point.c   |  4 +-
     src/gallium/drivers/llvmpipe/lp_setup_tri.c     | 14 +++---
     src/gallium/drivers/llvmpipe/lp_setup_vbuf.c    | 24 +++++-----
     9 files changed, 82 insertions(+), 82 deletions(-)
    
    (limited to 'src/gallium/drivers')
    
    diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h
    index 217ec59b68..f391871b0e 100644
    --- a/src/gallium/drivers/llvmpipe/lp_context.h
    +++ b/src/gallium/drivers/llvmpipe/lp_context.h
    @@ -45,7 +45,7 @@ struct draw_stage;
     struct lp_fragment_shader;
     struct lp_vertex_shader;
     struct lp_blend_state;
    -struct setup_context;
    +struct lp_setup_context;
     struct lp_velems_state;
     
     struct llvmpipe_context {
    @@ -98,7 +98,7 @@ struct llvmpipe_context {
        int psize_slot;
     
        /** The tiling engine */
    -   struct setup_context *setup;
    +   struct lp_setup_context *setup;
     
        /** The primitive drawing context */
        struct draw_context *draw;
    diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h
    index dc5fc5fc7d..303f6e3f7e 100644
    --- a/src/gallium/drivers/llvmpipe/lp_rast.h
    +++ b/src/gallium/drivers/llvmpipe/lp_rast.h
    @@ -95,7 +95,7 @@ struct lp_rast_shader_inputs {
      * Rasterization information for a triangle known to be in this bin,
      * plus inputs to run the shader:
      * These fields are tile- and bin-independent.
    - * Objects of this type are put into the setup_context::data buffer.
    + * Objects of this type are put into the lp_setup_context::data buffer.
      */
     struct lp_rast_triangle {
     #ifdef DEBUG
    diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
    index c870f89d01..ba55daf78f 100644
    --- a/src/gallium/drivers/llvmpipe/lp_setup.c
    +++ b/src/gallium/drivers/llvmpipe/lp_setup.c
    @@ -52,11 +52,11 @@
     #include "draw/draw_vbuf.h"
     
     
    -static void set_scene_state( struct setup_context *, unsigned );
    +static void set_scene_state( struct lp_setup_context *, unsigned );
     
     
     struct lp_scene *
    -lp_setup_get_current_scene(struct setup_context *setup)
    +lp_setup_get_current_scene(struct lp_setup_context *setup)
     {
        if (!setup->scene) {
     
    @@ -74,7 +74,7 @@ lp_setup_get_current_scene(struct setup_context *setup)
     
     
     static void
    -first_triangle( struct setup_context *setup,
    +first_triangle( struct lp_setup_context *setup,
                     const float (*v0)[4],
                     const float (*v1)[4],
                     const float (*v2)[4])
    @@ -85,7 +85,7 @@ first_triangle( struct setup_context *setup,
     }
     
     static void
    -first_line( struct setup_context *setup,
    +first_line( struct lp_setup_context *setup,
     	    const float (*v0)[4],
     	    const float (*v1)[4])
     {
    @@ -95,7 +95,7 @@ first_line( struct setup_context *setup,
     }
     
     static void
    -first_point( struct setup_context *setup,
    +first_point( struct lp_setup_context *setup,
     	     const float (*v0)[4])
     {
        set_scene_state( setup, SETUP_ACTIVE );
    @@ -103,7 +103,7 @@ first_point( struct setup_context *setup,
        setup->point( setup, v0 );
     }
     
    -static void reset_context( struct setup_context *setup )
    +static void reset_context( struct lp_setup_context *setup )
     {
        LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
     
    @@ -131,7 +131,7 @@ static void reset_context( struct setup_context *setup )
     
     /** Rasterize all scene's bins */
     static void
    -lp_setup_rasterize_scene( struct setup_context *setup,
    +lp_setup_rasterize_scene( struct lp_setup_context *setup,
                               boolean write_depth )
     {
        struct lp_scene *scene = lp_setup_get_current_scene(setup);
    @@ -148,7 +148,7 @@ lp_setup_rasterize_scene( struct setup_context *setup,
     
     
     static void
    -begin_binning( struct setup_context *setup )
    +begin_binning( struct lp_setup_context *setup )
     {
        struct lp_scene *scene = lp_setup_get_current_scene(setup);
     
    @@ -184,7 +184,7 @@ begin_binning( struct setup_context *setup )
      * TODO: fast path for fullscreen clears and no triangles.
      */
     static void
    -execute_clears( struct setup_context *setup )
    +execute_clears( struct lp_setup_context *setup )
     {
        LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
     
    @@ -194,7 +194,7 @@ execute_clears( struct setup_context *setup )
     
     
     static void
    -set_scene_state( struct setup_context *setup,
    +set_scene_state( struct lp_setup_context *setup,
                unsigned new_state )
     {
        unsigned old_state = setup->state;
    @@ -229,7 +229,7 @@ set_scene_state( struct setup_context *setup,
     
     
     void
    -lp_setup_flush( struct setup_context *setup,
    +lp_setup_flush( struct lp_setup_context *setup,
                     unsigned flags )
     {
        LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
    @@ -239,7 +239,7 @@ lp_setup_flush( struct setup_context *setup,
     
     
     void
    -lp_setup_bind_framebuffer( struct setup_context *setup,
    +lp_setup_bind_framebuffer( struct lp_setup_context *setup,
                                const struct pipe_framebuffer_state *fb )
     {
        LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
    @@ -256,7 +256,7 @@ lp_setup_bind_framebuffer( struct setup_context *setup,
     
     
     void
    -lp_setup_clear( struct setup_context *setup,
    +lp_setup_clear( struct lp_setup_context *setup,
                     const float *color,
                     double depth,
                     unsigned stencil,
    @@ -314,7 +314,7 @@ lp_setup_clear( struct setup_context *setup,
      * Emit a fence.
      */
     struct pipe_fence_handle *
    -lp_setup_fence( struct setup_context *setup )
    +lp_setup_fence( struct lp_setup_context *setup )
     {
        struct lp_scene *scene = lp_setup_get_current_scene(setup);
        const unsigned rank = lp_scene_get_num_bins( scene ); /* xxx */
    @@ -334,7 +334,7 @@ lp_setup_fence( struct setup_context *setup )
     
     
     void 
    -lp_setup_set_triangle_state( struct setup_context *setup,
    +lp_setup_set_triangle_state( struct lp_setup_context *setup,
                                  unsigned cull_mode,
                                  boolean ccw_is_frontface,
                                  boolean scissor )
    @@ -350,7 +350,7 @@ lp_setup_set_triangle_state( struct setup_context *setup,
     
     
     void
    -lp_setup_set_fs_inputs( struct setup_context *setup,
    +lp_setup_set_fs_inputs( struct lp_setup_context *setup,
                             const struct lp_shader_input *input,
                             unsigned nr )
     {
    @@ -361,7 +361,7 @@ lp_setup_set_fs_inputs( struct setup_context *setup,
     }
     
     void
    -lp_setup_set_fs_functions( struct setup_context *setup,
    +lp_setup_set_fs_functions( struct lp_setup_context *setup,
                                lp_jit_frag_func jit_function0,
                                lp_jit_frag_func jit_function1,
                                boolean opaque )
    @@ -376,7 +376,7 @@ lp_setup_set_fs_functions( struct setup_context *setup,
     }
     
     void
    -lp_setup_set_fs_constants(struct setup_context *setup,
    +lp_setup_set_fs_constants(struct lp_setup_context *setup,
                               struct pipe_buffer *buffer)
     {
        LP_DBG(DEBUG_SETUP, "%s %p\n", __FUNCTION__, (void *) buffer);
    @@ -388,7 +388,7 @@ lp_setup_set_fs_constants(struct setup_context *setup,
     
     
     void
    -lp_setup_set_alpha_ref_value( struct setup_context *setup,
    +lp_setup_set_alpha_ref_value( struct lp_setup_context *setup,
                                   float alpha_ref_value )
     {
        LP_DBG(DEBUG_SETUP, "%s %f\n", __FUNCTION__, alpha_ref_value);
    @@ -400,7 +400,7 @@ lp_setup_set_alpha_ref_value( struct setup_context *setup,
     }
     
     void
    -lp_setup_set_blend_color( struct setup_context *setup,
    +lp_setup_set_blend_color( struct lp_setup_context *setup,
                               const struct pipe_blend_color *blend_color )
     {
        LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
    @@ -415,7 +415,7 @@ lp_setup_set_blend_color( struct setup_context *setup,
     
     
     void
    -lp_setup_set_scissor( struct setup_context *setup,
    +lp_setup_set_scissor( struct lp_setup_context *setup,
                           const struct pipe_scissor_state *scissor )
     {
        LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
    @@ -430,7 +430,7 @@ lp_setup_set_scissor( struct setup_context *setup,
     
     
     void 
    -lp_setup_set_flatshade_first( struct setup_context *setup,
    +lp_setup_set_flatshade_first( struct lp_setup_context *setup,
                                   boolean flatshade_first )
     {
        setup->flatshade_first = flatshade_first;
    @@ -438,7 +438,7 @@ lp_setup_set_flatshade_first( struct setup_context *setup,
     
     
     void 
    -lp_setup_set_vertex_info( struct setup_context *setup,
    +lp_setup_set_vertex_info( struct lp_setup_context *setup,
                               struct vertex_info *vertex_info )
     {
        /* XXX: just silently holding onto the pointer:
    @@ -451,7 +451,7 @@ lp_setup_set_vertex_info( struct setup_context *setup,
      * Called during state validation when LP_NEW_TEXTURE is set.
      */
     void
    -lp_setup_set_sampler_textures( struct setup_context *setup,
    +lp_setup_set_sampler_textures( struct lp_setup_context *setup,
                                    unsigned num, struct pipe_texture **texture)
     {
        unsigned i;
    @@ -512,7 +512,7 @@ lp_setup_set_sampler_textures( struct setup_context *setup,
      * being rendered and the current scene being built.
      */
     unsigned
    -lp_setup_is_texture_referenced( const struct setup_context *setup,
    +lp_setup_is_texture_referenced( const struct lp_setup_context *setup,
                                     const struct pipe_texture *texture )
     {
        unsigned i;
    @@ -541,7 +541,7 @@ lp_setup_is_texture_referenced( const struct setup_context *setup,
      * Called by vbuf code when we're about to draw something.
      */
     void
    -lp_setup_update_state( struct setup_context *setup )
    +lp_setup_update_state( struct lp_setup_context *setup )
     {
        struct lp_scene *scene = lp_setup_get_current_scene(setup);
     
    @@ -659,7 +659,7 @@ lp_setup_update_state( struct setup_context *setup )
     /* Only caller is lp_setup_vbuf_destroy()
      */
     void 
    -lp_setup_destroy( struct setup_context *setup )
    +lp_setup_destroy( struct lp_setup_context *setup )
     {
        reset_context( setup );
     
    @@ -684,12 +684,12 @@ lp_setup_destroy( struct setup_context *setup )
      * the draw module.  Currently also creates a rasterizer to use with
      * it.
      */
    -struct setup_context *
    +struct lp_setup_context *
     lp_setup_create( struct pipe_context *pipe,
                      struct draw_context *draw )
     {
        unsigned i;
    -   struct setup_context *setup = CALLOC_STRUCT(setup_context);
    +   struct lp_setup_context *setup = CALLOC_STRUCT(lp_setup_context);
     
        if (!setup)
           return NULL;
    diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h
    index 17c112b528..71244869a9 100644
    --- a/src/gallium/drivers/llvmpipe/lp_setup.h
    +++ b/src/gallium/drivers/llvmpipe/lp_setup.h
    @@ -61,78 +61,78 @@ struct pipe_framebuffer_state;
     struct lp_fragment_shader;
     struct lp_jit_context;
     
    -struct setup_context *
    +struct lp_setup_context *
     lp_setup_create( struct pipe_context *pipe,
                      struct draw_context *draw );
     
     void
    -lp_setup_clear(struct setup_context *setup,
    +lp_setup_clear(struct lp_setup_context *setup,
                    const float *clear_color,
                    double clear_depth,
                    unsigned clear_stencil,
                    unsigned flags);
     
     struct pipe_fence_handle *
    -lp_setup_fence( struct setup_context *setup );
    +lp_setup_fence( struct lp_setup_context *setup );
     
     
     void
    -lp_setup_flush( struct setup_context *setup,
    +lp_setup_flush( struct lp_setup_context *setup,
                     unsigned flags );
     
     
     void
    -lp_setup_bind_framebuffer( struct setup_context *setup,
    +lp_setup_bind_framebuffer( struct lp_setup_context *setup,
                                const struct pipe_framebuffer_state *fb );
     
     void 
    -lp_setup_set_triangle_state( struct setup_context *setup,
    +lp_setup_set_triangle_state( struct lp_setup_context *setup,
                                  unsigned cullmode,
                                  boolean front_is_ccw,
                                  boolean scissor );
     
     void
    -lp_setup_set_fs_inputs( struct setup_context *setup,
    +lp_setup_set_fs_inputs( struct lp_setup_context *setup,
                             const struct lp_shader_input *interp,
                             unsigned nr );
     
     void
    -lp_setup_set_fs_functions( struct setup_context *setup,
    +lp_setup_set_fs_functions( struct lp_setup_context *setup,
                                lp_jit_frag_func jit_function0,
                                lp_jit_frag_func jit_function1,
                                boolean opaque );
     
     void
    -lp_setup_set_fs_constants(struct setup_context *setup,
    +lp_setup_set_fs_constants(struct lp_setup_context *setup,
                               struct pipe_buffer *buffer);
     
     
     void
    -lp_setup_set_alpha_ref_value( struct setup_context *setup,
    +lp_setup_set_alpha_ref_value( struct lp_setup_context *setup,
                                   float alpha_ref_value );
     
     void
    -lp_setup_set_blend_color( struct setup_context *setup,
    +lp_setup_set_blend_color( struct lp_setup_context *setup,
                               const struct pipe_blend_color *blend_color );
     
     void
    -lp_setup_set_scissor( struct setup_context *setup,
    +lp_setup_set_scissor( struct lp_setup_context *setup,
                           const struct pipe_scissor_state *scissor );
     
     void
    -lp_setup_set_sampler_textures( struct setup_context *setup,
    +lp_setup_set_sampler_textures( struct lp_setup_context *setup,
                                    unsigned num, struct pipe_texture **texture);
     
     unsigned
    -lp_setup_is_texture_referenced( const struct setup_context *setup,
    +lp_setup_is_texture_referenced( const struct lp_setup_context *setup,
                                     const struct pipe_texture *texture );
     
     void
    -lp_setup_set_flatshade_first( struct setup_context *setup, 
    +lp_setup_set_flatshade_first( struct lp_setup_context *setup, 
                                   boolean flatshade_first );
     
     void
    -lp_setup_set_vertex_info( struct setup_context *setup, 
    +lp_setup_set_vertex_info( struct lp_setup_context *setup, 
                               struct vertex_info *info );
     
     
    diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h
    index a5fc34e54a..d3c9949dc8 100644
    --- a/src/gallium/drivers/llvmpipe/lp_setup_context.h
    +++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h
    @@ -65,7 +65,7 @@ struct lp_scene_queue;
      * Subclass of vbuf_render, plugged directly into the draw module as
      * the rendering backend.
      */
    -struct setup_context
    +struct lp_setup_context
     {
        struct vbuf_render base;
     
    @@ -131,29 +131,29 @@ struct setup_context
     
        unsigned dirty;   /**< bitmask of LP_SETUP_NEW_x bits */
     
    -   void (*point)( struct setup_context *,
    +   void (*point)( struct lp_setup_context *,
                       const float (*v0)[4]);
     
    -   void (*line)( struct setup_context *,
    +   void (*line)( struct lp_setup_context *,
                      const float (*v0)[4],
                      const float (*v1)[4]);
     
    -   void (*triangle)( struct setup_context *,
    +   void (*triangle)( struct lp_setup_context *,
                          const float (*v0)[4],
                          const float (*v1)[4],
                          const float (*v2)[4]);
     };
     
    -void lp_setup_choose_triangle( struct setup_context *setup );
    -void lp_setup_choose_line( struct setup_context *setup );
    -void lp_setup_choose_point( struct setup_context *setup );
    +void lp_setup_choose_triangle( struct lp_setup_context *setup );
    +void lp_setup_choose_line( struct lp_setup_context *setup );
    +void lp_setup_choose_point( struct lp_setup_context *setup );
     
    -struct lp_scene *lp_setup_get_current_scene(struct setup_context *setup);
    +struct lp_scene *lp_setup_get_current_scene(struct lp_setup_context *setup);
     
    -void lp_setup_init_vbuf(struct setup_context *setup);
    +void lp_setup_init_vbuf(struct lp_setup_context *setup);
     
    -void lp_setup_update_state( struct setup_context *setup );
    +void lp_setup_update_state( struct lp_setup_context *setup );
     
    -void lp_setup_destroy( struct setup_context *setup );
    +void lp_setup_destroy( struct lp_setup_context *setup );
     
     #endif
    diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c
    index feea79d394..be41c44e6f 100644
    --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c
    +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c
    @@ -31,7 +31,7 @@
     
     #include "lp_setup_context.h"
     
    -static void line_nop( struct setup_context *setup,
    +static void line_nop( struct lp_setup_context *setup,
                           const float (*v0)[4],
                           const float (*v1)[4] )
     {
    @@ -39,7 +39,7 @@ static void line_nop( struct setup_context *setup,
     
     
     void 
    -lp_setup_choose_line( struct setup_context *setup )
    +lp_setup_choose_line( struct lp_setup_context *setup )
     {
        setup->line = line_nop;
     }
    diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c
    index f03ca729b2..9f69e6c5ce 100644
    --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c
    +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c
    @@ -31,14 +31,14 @@
     
     #include "lp_setup_context.h"
     
    -static void point_nop( struct setup_context *setup,
    +static void point_nop( struct lp_setup_context *setup,
                            const float (*v0)[4] )
     {
     }
     
     
     void 
    -lp_setup_choose_point( struct setup_context *setup )
    +lp_setup_choose_point( struct lp_setup_context *setup )
     {
        setup->point = point_nop;
     }
    diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
    index e75412ac9a..8d781e358f 100644
    --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
    +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
    @@ -173,7 +173,7 @@ static void setup_facing_coef( struct lp_rast_triangle *tri,
     /**
      * Compute the tri->coef[] array dadx, dady, a0 values.
      */
    -static void setup_tri_coefficients( struct setup_context *setup,
    +static void setup_tri_coefficients( struct lp_setup_context *setup,
     				    struct lp_rast_triangle *tri,
                                         float oneoverarea,
     				    const float (*v1)[4],
    @@ -274,7 +274,7 @@ alloc_triangle(struct lp_scene *scene, unsigned nr_inputs, unsigned *tri_size)
      * bins for the tiles which we overlap.
      */
     static void 
    -do_triangle_ccw(struct setup_context *setup,
    +do_triangle_ccw(struct lp_setup_context *setup,
     		const float (*v1)[4],
     		const float (*v2)[4],
     		const float (*v3)[4],
    @@ -565,7 +565,7 @@ do_triangle_ccw(struct setup_context *setup,
     }
     
     
    -static void triangle_cw( struct setup_context *setup,
    +static void triangle_cw( struct lp_setup_context *setup,
     			 const float (*v0)[4],
     			 const float (*v1)[4],
     			 const float (*v2)[4] )
    @@ -574,7 +574,7 @@ static void triangle_cw( struct setup_context *setup,
     }
     
     
    -static void triangle_ccw( struct setup_context *setup,
    +static void triangle_ccw( struct lp_setup_context *setup,
     			 const float (*v0)[4],
     			 const float (*v1)[4],
     			 const float (*v2)[4] )
    @@ -583,7 +583,7 @@ static void triangle_ccw( struct setup_context *setup,
     }
     
     
    -static void triangle_both( struct setup_context *setup,
    +static void triangle_both( struct lp_setup_context *setup,
     			   const float (*v0)[4],
     			   const float (*v1)[4],
     			   const float (*v2)[4] )
    @@ -602,7 +602,7 @@ static void triangle_both( struct setup_context *setup,
     }
     
     
    -static void triangle_nop( struct setup_context *setup,
    +static void triangle_nop( struct lp_setup_context *setup,
     			  const float (*v0)[4],
     			  const float (*v1)[4],
     			  const float (*v2)[4] )
    @@ -611,7 +611,7 @@ static void triangle_nop( struct setup_context *setup,
     
     
     void 
    -lp_setup_choose_triangle( struct setup_context *setup )
    +lp_setup_choose_triangle( struct lp_setup_context *setup )
     {
        switch (setup->cullmode) {
        case PIPE_WINDING_NONE:
    diff --git a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c
    index 671e74465c..d7336d82b2 100644
    --- a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c
    +++ b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c
    @@ -48,10 +48,10 @@
       
     
     /** cast wrapper */
    -static struct setup_context *
    -setup_context(struct vbuf_render *vbr)
    +static struct lp_setup_context *
    +lp_setup_context(struct vbuf_render *vbr)
     {
    -   return (struct setup_context *) vbr;
    +   return (struct lp_setup_context *) vbr;
     }
     
     
    @@ -59,7 +59,7 @@ setup_context(struct vbuf_render *vbr)
     static const struct vertex_info *
     lp_setup_get_vertex_info(struct vbuf_render *vbr)
     {
    -   struct setup_context *setup = setup_context(vbr);
    +   struct lp_setup_context *setup = lp_setup_context(vbr);
        return setup->vertex_info;
     }
     
    @@ -68,7 +68,7 @@ static boolean
     lp_setup_allocate_vertices(struct vbuf_render *vbr,
                               ushort vertex_size, ushort nr_vertices)
     {
    -   struct setup_context *setup = setup_context(vbr);
    +   struct lp_setup_context *setup = lp_setup_context(vbr);
        unsigned size = vertex_size * nr_vertices;
     
        if (setup->vertex_buffer_size < size) {
    @@ -92,7 +92,7 @@ lp_setup_release_vertices(struct vbuf_render *vbr)
     static void *
     lp_setup_map_vertices(struct vbuf_render *vbr)
     {
    -   struct setup_context *setup = setup_context(vbr);
    +   struct lp_setup_context *setup = lp_setup_context(vbr);
        return setup->vertex_buffer;
     }
     
    @@ -101,7 +101,7 @@ lp_setup_unmap_vertices(struct vbuf_render *vbr,
                            ushort min_index,
                            ushort max_index )
     {
    -   struct setup_context *setup = setup_context(vbr);
    +   struct lp_setup_context *setup = lp_setup_context(vbr);
        assert( setup->vertex_buffer_size >= (max_index+1) * setup->vertex_size );
        /* do nothing */
     }
    @@ -110,7 +110,7 @@ lp_setup_unmap_vertices(struct vbuf_render *vbr,
     static boolean
     lp_setup_set_primitive(struct vbuf_render *vbr, unsigned prim)
     {
    -   setup_context(vbr)->prim = prim;
    +   lp_setup_context(vbr)->prim = prim;
        return TRUE;
     }
     
    @@ -129,7 +129,7 @@ static INLINE const_float4_ptr get_vert( const void *vertex_buffer,
     static void
     lp_setup_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
     {
    -   struct setup_context *setup = setup_context(vbr);
    +   struct lp_setup_context *setup = lp_setup_context(vbr);
        const unsigned stride = setup->vertex_info->size * sizeof(float);
        const void *vertex_buffer = setup->vertex_buffer;
        unsigned i;
    @@ -284,7 +284,7 @@ lp_setup_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
     static void
     lp_setup_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
     {
    -   struct setup_context *setup = setup_context(vbr);
    +   struct lp_setup_context *setup = lp_setup_context(vbr);
        const unsigned stride = setup->vertex_info->size * sizeof(float);
        const void *vertex_buffer =
           (void *) get_vert(setup->vertex_buffer, start, stride);
    @@ -436,7 +436,7 @@ lp_setup_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
     static void
     lp_setup_vbuf_destroy(struct vbuf_render *vbr)
     {
    -   lp_setup_destroy(setup_context(vbr));
    +   lp_setup_destroy(lp_setup_context(vbr));
     }
     
     
    @@ -444,7 +444,7 @@ lp_setup_vbuf_destroy(struct vbuf_render *vbr)
      * Create the post-transform vertex handler for the given context.
      */
     void
    -lp_setup_init_vbuf(struct setup_context *setup)
    +lp_setup_init_vbuf(struct lp_setup_context *setup)
     {
        setup->base.max_indices = LP_MAX_VBUF_INDEXES;
        setup->base.max_vertex_buffer_bytes = LP_MAX_VBUF_SIZE;
    -- 
    cgit v1.2.3
    
    
    From a80e33f40731f07e8a39896bfdcd1b1504aedc1f Mon Sep 17 00:00:00 2001
    From: José Fonseca 
    Date: Sat, 13 Mar 2010 11:22:39 +0000
    Subject: llvmpipe: Obey rasterization rules.
    
    Replicates softpipe.
    ---
     src/gallium/drivers/llvmpipe/lp_setup.c            |  4 +-
     src/gallium/drivers/llvmpipe/lp_setup.h            |  3 +-
     src/gallium/drivers/llvmpipe/lp_setup_context.h    |  1 +
     src/gallium/drivers/llvmpipe/lp_setup_tri.c        | 59 ++++++++++++----------
     src/gallium/drivers/llvmpipe/lp_state_rasterizer.c |  3 +-
     5 files changed, 40 insertions(+), 30 deletions(-)
    
    (limited to 'src/gallium/drivers')
    
    diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
    index ba55daf78f..16128c34c8 100644
    --- a/src/gallium/drivers/llvmpipe/lp_setup.c
    +++ b/src/gallium/drivers/llvmpipe/lp_setup.c
    @@ -337,7 +337,8 @@ void
     lp_setup_set_triangle_state( struct lp_setup_context *setup,
                                  unsigned cull_mode,
                                  boolean ccw_is_frontface,
    -                             boolean scissor )
    +                             boolean scissor,
    +                             boolean gl_rasterization_rules)
     {
        LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
     
    @@ -345,6 +346,7 @@ lp_setup_set_triangle_state( struct lp_setup_context *setup,
        setup->cullmode = cull_mode;
        setup->triangle = first_triangle;
        setup->scissor_test = scissor;
    +   setup->pixel_offset = gl_rasterization_rules ? 0.5f : 0.0f;
     }
     
     
    diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h
    index 71244869a9..be1bf96f12 100644
    --- a/src/gallium/drivers/llvmpipe/lp_setup.h
    +++ b/src/gallium/drivers/llvmpipe/lp_setup.h
    @@ -89,7 +89,8 @@ void
     lp_setup_set_triangle_state( struct lp_setup_context *setup,
                                  unsigned cullmode,
                                  boolean front_is_ccw,
    -                             boolean scissor );
    +                             boolean scissor,
    +                             boolean gl_rasterization_rules );
     
     void
     lp_setup_set_fs_inputs( struct lp_setup_context *setup,
    diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h
    index d3c9949dc8..464fb36984 100644
    --- a/src/gallium/drivers/llvmpipe/lp_setup_context.h
    +++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h
    @@ -89,6 +89,7 @@ struct lp_setup_context
        boolean ccw_is_frontface;
        boolean scissor_test;
        unsigned cullmode;
    +   float pixel_offset;
     
        struct pipe_framebuffer_state fb;
     
    diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
    index 8d781e358f..ac6264dc73 100644
    --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
    +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
    @@ -41,7 +41,8 @@
     /**
      * Compute a0 for a constant-valued coefficient (GL_FLAT shading).
      */
    -static void constant_coef( struct lp_rast_triangle *tri,
    +static void constant_coef( struct lp_setup_context *setup,
    +                           struct lp_rast_triangle *tri,
                                unsigned slot,
     			   const float value,
                                unsigned i )
    @@ -56,7 +57,8 @@ static void constant_coef( struct lp_rast_triangle *tri,
      * Compute a0, dadx and dady for a linearly interpolated coefficient,
      * for a triangle.
      */
    -static void linear_coef( struct lp_rast_triangle *tri,
    +static void linear_coef( struct lp_setup_context *setup,
    +                         struct lp_rast_triangle *tri,
                              float oneoverarea,
                              unsigned slot,
                              const float (*v1)[4],
    @@ -90,8 +92,8 @@ static void linear_coef( struct lp_rast_triangle *tri,
         * instead - i'll switch to this later.
         */
        tri->inputs.a0[slot][i] = (a1 -
    -                              (dadx * (v1[0][0] - 0.5f) +
    -                               dady * (v1[0][1] - 0.5f)));
    +                              (dadx * (v1[0][0] - setup->pixel_offset) +
    +                               dady * (v1[0][1] - setup->pixel_offset)));
     }
     
     
    @@ -103,7 +105,8 @@ static void linear_coef( struct lp_rast_triangle *tri,
      * Later, when we compute the value at a particular fragment position we'll
      * divide the interpolated value by the interpolated W at that fragment.
      */
    -static void perspective_coef( struct lp_rast_triangle *tri,
    +static void perspective_coef( struct lp_setup_context *setup,
    +                              struct lp_rast_triangle *tri,
                                   float oneoverarea,
                                   unsigned slot,
     			      const float (*v1)[4],
    @@ -125,8 +128,8 @@ static void perspective_coef( struct lp_rast_triangle *tri,
        tri->inputs.dadx[slot][i] = dadx;
        tri->inputs.dady[slot][i] = dady;
        tri->inputs.a0[slot][i] = (a1 -
    -                              (dadx * (v1[0][0] - 0.5f) +
    -                               dady * (v1[0][1] - 0.5f)));
    +                              (dadx * (v1[0][0] - setup->pixel_offset) +
    +                               dady * (v1[0][1] - setup->pixel_offset)));
     }
     
     
    @@ -137,7 +140,8 @@ static void perspective_coef( struct lp_rast_triangle *tri,
      * We could do a bit less work if we'd examine gl_FragCoord's swizzle mask.
      */
     static void
    -setup_fragcoord_coef(struct lp_rast_triangle *tri,
    +setup_fragcoord_coef(struct lp_setup_context *setup,
    +                     struct lp_rast_triangle *tri,
                          float oneoverarea,
                          unsigned slot,
                          const float (*v1)[4],
    @@ -153,20 +157,21 @@ setup_fragcoord_coef(struct lp_rast_triangle *tri,
        tri->inputs.dadx[slot][1] = 0.0;
        tri->inputs.dady[slot][1] = 1.0;
        /*Z*/
    -   linear_coef(tri, oneoverarea, slot, v1, v2, v3, 0, 2);
    +   linear_coef(setup, tri, oneoverarea, slot, v1, v2, v3, 0, 2);
        /*W*/
    -   linear_coef(tri, oneoverarea, slot, v1, v2, v3, 0, 3);
    +   linear_coef(setup, tri, oneoverarea, slot, v1, v2, v3, 0, 3);
     }
     
     
    -static void setup_facing_coef( struct lp_rast_triangle *tri,
    +static void setup_facing_coef( struct lp_setup_context *setup,
    +                               struct lp_rast_triangle *tri,
                                    unsigned slot,
                                    boolean frontface )
     {
    -   constant_coef( tri, slot, 1.0f - frontface, 0 );
    -   constant_coef( tri, slot, 0.0f, 1 ); /* wasted */
    -   constant_coef( tri, slot, 0.0f, 2 ); /* wasted */
    -   constant_coef( tri, slot, 0.0f, 3 ); /* wasted */
    +   constant_coef( setup, tri, slot, 1.0f - frontface, 0 );
    +   constant_coef( setup, tri, slot, 0.0f, 1 ); /* wasted */
    +   constant_coef( setup, tri, slot, 0.0f, 2 ); /* wasted */
    +   constant_coef( setup, tri, slot, 0.0f, 3 ); /* wasted */
     }
     
     
    @@ -185,7 +190,7 @@ static void setup_tri_coefficients( struct lp_setup_context *setup,
     
        /* The internal position input is in slot zero:
         */
    -   setup_fragcoord_coef(tri, oneoverarea, 0, v1, v2, v3);
    +   setup_fragcoord_coef(setup, tri, oneoverarea, 0, v1, v2, v3);
     
        /* setup interpolation for all the remaining attributes:
         */
    @@ -196,27 +201,27 @@ static void setup_tri_coefficients( struct lp_setup_context *setup,
           switch (setup->fs.input[slot].interp) {
           case LP_INTERP_CONSTANT:
              for (i = 0; i < NUM_CHANNELS; i++)
    -            constant_coef(tri, slot+1, v3[vert_attr][i], i);
    +            constant_coef(setup, tri, slot+1, v3[vert_attr][i], i);
              break;
     
           case LP_INTERP_LINEAR:
              for (i = 0; i < NUM_CHANNELS; i++)
    -            linear_coef(tri, oneoverarea, slot+1, v1, v2, v3, vert_attr, i);
    +            linear_coef(setup, tri, oneoverarea, slot+1, v1, v2, v3, vert_attr, i);
              break;
     
           case LP_INTERP_PERSPECTIVE:
              for (i = 0; i < NUM_CHANNELS; i++)
    -            perspective_coef(tri, oneoverarea, slot+1, v1, v2, v3, vert_attr, i);
    +            perspective_coef(setup, tri, oneoverarea, slot+1, v1, v2, v3, vert_attr, i);
              break;
     
           case LP_INTERP_POSITION:
              /* XXX: fix me - duplicates the values in slot zero.
               */
    -         setup_fragcoord_coef(tri, oneoverarea, slot+1, v1, v2, v3);
    +         setup_fragcoord_coef(setup, tri, oneoverarea, slot+1, v1, v2, v3);
              break;
     
           case LP_INTERP_FACING:
    -         setup_facing_coef(tri, slot+1, frontface);
    +         setup_facing_coef(setup, tri, slot+1, frontface);
              break;
     
           default:
    @@ -281,12 +286,12 @@ do_triangle_ccw(struct lp_setup_context *setup,
     		boolean frontfacing )
     {
        /* x/y positions in fixed point */
    -   const int x1 = subpixel_snap(v1[0][0]);
    -   const int x2 = subpixel_snap(v2[0][0]);
    -   const int x3 = subpixel_snap(v3[0][0]);
    -   const int y1 = subpixel_snap(v1[0][1]);
    -   const int y2 = subpixel_snap(v2[0][1]);
    -   const int y3 = subpixel_snap(v3[0][1]);
    +   const int x1 = subpixel_snap(v1[0][0] + 0.5 - setup->pixel_offset);
    +   const int x2 = subpixel_snap(v2[0][0] + 0.5 - setup->pixel_offset);
    +   const int x3 = subpixel_snap(v3[0][0] + 0.5 - setup->pixel_offset);
    +   const int y1 = subpixel_snap(v1[0][1] + 0.5 - setup->pixel_offset);
    +   const int y2 = subpixel_snap(v2[0][1] + 0.5 - setup->pixel_offset);
    +   const int y3 = subpixel_snap(v3[0][1] + 0.5 - setup->pixel_offset);
     
        struct lp_scene *scene = lp_setup_get_current_scene(setup);
        struct lp_rast_triangle *tri;
    diff --git a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
    index feb012816c..6df3ef25b0 100644
    --- a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
    +++ b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
    @@ -62,7 +62,8 @@ void llvmpipe_bind_rasterizer_state(struct pipe_context *pipe,
           lp_setup_set_triangle_state( llvmpipe->setup,
                        llvmpipe->rasterizer->cull_mode,
                        llvmpipe->rasterizer->front_winding == PIPE_WINDING_CCW,
    -                   llvmpipe->rasterizer->scissor);
    +                   llvmpipe->rasterizer->scissor,
    +                   llvmpipe->rasterizer->gl_rasterization_rules);
        }
     
        llvmpipe->dirty |= LP_NEW_RASTERIZER;
    -- 
    cgit v1.2.3