gallium/vl: remove remaining softpipe video functions
[mesa.git] / src / gallium / drivers / softpipe / sp_context.c
index e2e32b9bd8cc05b9196d520e9a726b2e0f13074b..34d2b80f19b1c1cf0c2d2b0a4ea7b53d5efc9b1f 100644 (file)
@@ -1,6 +1,6 @@
 /**************************************************************************
  * 
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2007 VMware, Inc.
  * All Rights Reserved.
  * Copyright 2008 VMware, Inc.  All rights reserved.
  * 
@@ -19,7 +19,7 @@
  * 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * IN NO EVENT SHALL VMWARE 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.
@@ -27,7 +27,7 @@
  **************************************************************************/
 
 /* Author:
- *    Keith Whitwell <keith@tungstengraphics.com>
+ *    Keith Whitwell <keithw@vmware.com>
  */
 
 #include "draw/draw_context.h"
@@ -38,8 +38,6 @@
 #include "util/u_pstipple.h"
 #include "util/u_inlines.h"
 #include "tgsi/tgsi_exec.h"
-#include "vl/vl_decoder.h"
-#include "vl/vl_video_buffer.h"
 #include "sp_clear.h"
 #include "sp_context.h"
 #include "sp_flush.h"
 #include "sp_texture.h"
 #include "sp_query.h"
 #include "sp_screen.h"
-
-
-/**
- * Map any drawing surfaces which aren't already mapped
- */
-void
-softpipe_map_transfers(struct softpipe_context *sp)
-{
-   unsigned i;
-
-   for (i = 0; i < sp->framebuffer.nr_cbufs; i++) {
-      sp_tile_cache_map_transfers(sp->cbuf_cache[i]);
-   }
-
-   sp_tile_cache_map_transfers(sp->zsbuf_cache);
-}
-
-
-/**
- * Unmap any mapped drawing surfaces
- */
-void
-softpipe_unmap_transfers(struct softpipe_context *sp)
-{
-   uint i;
-
-   for (i = 0; i < sp->framebuffer.nr_cbufs; i++) {
-      sp_tile_cache_unmap_transfers(sp->cbuf_cache[i]);
-   }
-
-   sp_tile_cache_unmap_transfers(sp->zsbuf_cache);
-}
+#include "sp_tex_sample.h"
 
 
 static void
@@ -99,6 +66,10 @@ softpipe_destroy( struct pipe_context *pipe )
    pipe_sampler_view_reference(&softpipe->pstipple.sampler_view, NULL);
 #endif
 
+   if (softpipe->blitter) {
+      util_blitter_destroy(softpipe->blitter);
+   }
+
    if (softpipe->draw)
       draw_destroy( softpipe->draw );
 
@@ -143,6 +114,10 @@ softpipe_destroy( struct pipe_context *pipe )
 
    tgsi_exec_machine_destroy(softpipe->fs_machine);
 
+   for (i = 0; i < PIPE_SHADER_TYPES; i++) {
+      FREE(softpipe->tgsi.sampler[i]);
+   }
+
    FREE( softpipe );
 }
 
@@ -198,12 +173,14 @@ softpipe_is_resource_referenced( struct pipe_context *pipe,
 static void
 softpipe_render_condition( struct pipe_context *pipe,
                            struct pipe_query *query,
+                           boolean condition,
                            uint mode )
 {
    struct softpipe_context *softpipe = softpipe_context( pipe );
 
    softpipe->render_cond_query = query;
    softpipe->render_cond_mode = mode;
+   softpipe->render_cond_cond = condition;
 }
 
 
@@ -216,12 +193,12 @@ softpipe_create_context( struct pipe_screen *screen,
    struct softpipe_context *softpipe = CALLOC_STRUCT(softpipe_context);
    uint i, sh;
 
-   /* Check since we have arrays[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS] */
-   STATIC_ASSERT(PIPE_MAX_SAMPLERS == PIPE_MAX_VERTEX_SAMPLERS);
-   STATIC_ASSERT(PIPE_MAX_SAMPLERS == PIPE_MAX_GEOMETRY_SAMPLERS);
-
    util_init_math();
 
+   for (i = 0; i < PIPE_SHADER_TYPES; i++) {
+      softpipe->tgsi.sampler[i] = sp_create_tgsi_sampler();
+   }
+
    softpipe->dump_fs = debug_get_bool_option( "SOFTPIPE_DUMP_FS", FALSE );
    softpipe->dump_gs = debug_get_bool_option( "SOFTPIPE_DUMP_GS", FALSE );
 
@@ -249,9 +226,6 @@ softpipe_create_context( struct pipe_screen *screen,
 
    softpipe->pipe.render_condition = softpipe_render_condition;
    
-   softpipe->pipe.create_video_decoder = vl_create_decoder;
-   softpipe->pipe.create_video_buffer = vl_video_buffer_create;
-
    /*
     * Alloc caches for accessing drawing surfaces and textures.
     * Must be before quad stage setup!
@@ -288,17 +262,15 @@ softpipe_create_context( struct pipe_screen *screen,
    if (!softpipe->draw) 
       goto fail;
 
-   draw_texture_samplers(softpipe->draw,
-                         PIPE_SHADER_VERTEX,
-                         PIPE_MAX_VERTEX_SAMPLERS,
-                         (struct tgsi_sampler **)
-                            softpipe->tgsi.samplers_list[PIPE_SHADER_VERTEX]);
+   draw_texture_sampler(softpipe->draw,
+                        PIPE_SHADER_VERTEX,
+                        (struct tgsi_sampler *)
+                           softpipe->tgsi.sampler[PIPE_SHADER_VERTEX]);
 
-   draw_texture_samplers(softpipe->draw,
-                         PIPE_SHADER_GEOMETRY,
-                         PIPE_MAX_GEOMETRY_SAMPLERS,
-                         (struct tgsi_sampler **)
-                            softpipe->tgsi.samplers_list[PIPE_SHADER_GEOMETRY]);
+   draw_texture_sampler(softpipe->draw,
+                        PIPE_SHADER_GEOMETRY,
+                        (struct tgsi_sampler *)
+                           softpipe->tgsi.sampler[PIPE_SHADER_GEOMETRY]);
 
    if (debug_get_bool_option( "SOFTPIPE_NO_RAST", FALSE ))
       softpipe->no_rast = TRUE;
@@ -314,6 +286,13 @@ softpipe_create_context( struct pipe_screen *screen,
    draw_set_rasterize_stage(softpipe->draw, softpipe->vbuf);
    draw_set_render(softpipe->draw, softpipe->vbuf_backend);
 
+   softpipe->blitter = util_blitter_create(&softpipe->pipe);
+   if (!softpipe->blitter) {
+      goto fail;
+   }
+
+   /* must be done before installing Draw stages */
+   util_blitter_cache_all_shaders(softpipe->blitter);
 
    /* plug in AA line/point stages */
    draw_install_aaline_stage(softpipe->draw, &softpipe->pipe);