summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/svga/svga_context.c2
-rw-r--r--src/gallium/drivers/svga/svga_context.h2
-rw-r--r--src/gallium/drivers/svga/svga_pipe_blit.c64
-rw-r--r--src/gallium/drivers/svga/svga_swtnl_draw.c10
4 files changed, 78 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c
index cc1ac84adfc..7147d5a8f87 100644
--- a/src/gallium/drivers/svga/svga_context.c
+++ b/src/gallium/drivers/svga/svga_context.c
@@ -56,6 +56,8 @@ static void svga_destroy( struct pipe_context *pipe )
struct svga_context *svga = svga_context( pipe );
unsigned shader;
+ util_blitter_destroy(svga->blitter);
+
svga_cleanup_framebuffer( svga );
svga_cleanup_tss_binding( svga );
diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h
index f243b4f5da6..f2f26da1cd5 100644
--- a/src/gallium/drivers/svga/svga_context.h
+++ b/src/gallium/drivers/svga/svga_context.h
@@ -31,6 +31,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
+#include "util/u_blitter.h"
#include "util/u_double_list.h"
#include "tgsi/tgsi_scan.h"
@@ -314,6 +315,7 @@ struct svga_context
{
struct pipe_context pipe;
struct svga_winsys_context *swc;
+ struct blitter_context *blitter;
struct {
boolean no_swtnl;
diff --git a/src/gallium/drivers/svga/svga_pipe_blit.c b/src/gallium/drivers/svga/svga_pipe_blit.c
index 8e114d3e30e..34ac995ef60 100644
--- a/src/gallium/drivers/svga/svga_pipe_blit.c
+++ b/src/gallium/drivers/svga/svga_pipe_blit.c
@@ -29,6 +29,7 @@
#include "svga_cmd.h"
#include "svga_surface.h"
+#include "util/u_format.h"
#include "util/u_surface.h"
#define FILE_DEBUG_FLAG DEBUG_BLIT
@@ -150,8 +151,71 @@ static void svga_surface_copy(struct pipe_context *pipe,
}
+static void svga_blit(struct pipe_context *pipe,
+ const struct pipe_blit_info *blit_info)
+{
+ struct svga_context *svga = svga_context(pipe);
+ struct pipe_blit_info info = *blit_info;
+
+ if (info.src.resource->nr_samples > 1 &&
+ info.dst.resource->nr_samples <= 1 &&
+ !util_format_is_depth_or_stencil(info.src.resource->format) &&
+ !util_format_is_pure_integer(info.src.resource->format)) {
+ debug_printf("svga: color resolve unimplemented\n");
+ return;
+ }
+
+ if (util_try_blit_via_copy_region(pipe, &info)) {
+ return; /* done */
+ }
+
+ if (info.mask & PIPE_MASK_S) {
+ debug_printf("svga: cannot blit stencil, skipping\n");
+ info.mask &= ~PIPE_MASK_S;
+ }
+
+ if (!util_blitter_is_blit_supported(svga->blitter, &info)) {
+ debug_printf("svga: blit unsupported %s -> %s\n",
+ util_format_short_name(info.src.resource->format),
+ util_format_short_name(info.dst.resource->format));
+ return;
+ }
+
+ /* XXX turn off occlusion and streamout queries */
+
+ util_blitter_save_vertex_buffers(svga->blitter,
+ svga->curr.num_vertex_buffers,
+ svga->curr.vb);
+ util_blitter_save_vertex_elements(svga->blitter, (void*)svga->curr.velems);
+ util_blitter_save_vertex_shader(svga->blitter, svga->curr.vs);
+ /*util_blitter_save_geometry_shader(svga->blitter, svga->curr.gs);*/
+ /*util_blitter_save_so_targets(svga->blitter, svga->num_so_targets,
+ (struct pipe_stream_output_target**)svga->so_targets);*/
+ util_blitter_save_rasterizer(svga->blitter, (void*)svga->curr.rast);
+ util_blitter_save_viewport(svga->blitter, &svga->curr.viewport);
+ util_blitter_save_scissor(svga->blitter, &svga->curr.scissor);
+ util_blitter_save_fragment_shader(svga->blitter, svga->curr.fs);
+ util_blitter_save_blend(svga->blitter, (void*)svga->curr.blend);
+ util_blitter_save_depth_stencil_alpha(svga->blitter,
+ (void*)svga->curr.depth);
+ util_blitter_save_stencil_ref(svga->blitter, &svga->curr.stencil_ref);
+ /*util_blitter_save_sample_mask(svga->blitter, svga->sample_mask);*/
+ util_blitter_save_framebuffer(svga->blitter, &svga->curr.framebuffer);
+ util_blitter_save_fragment_sampler_states(svga->blitter,
+ svga->curr.num_samplers,
+ (void**)svga->curr.sampler);
+ util_blitter_save_fragment_sampler_views(svga->blitter,
+ svga->curr.num_sampler_views,
+ svga->curr.sampler_views);
+ /*util_blitter_save_render_condition(svga->blitter, svga->render_cond_query,
+ svga->render_cond_mode);*/
+ util_blitter_blit(svga->blitter, &info);
+}
+
+
void
svga_init_blit_functions(struct svga_context *svga)
{
svga->pipe.resource_copy_region = svga_surface_copy;
+ svga->pipe.blit = svga_blit;
}
diff --git a/src/gallium/drivers/svga/svga_swtnl_draw.c b/src/gallium/drivers/svga/svga_swtnl_draw.c
index 212f11a8230..4aeeb673ec9 100644
--- a/src/gallium/drivers/svga/svga_swtnl_draw.c
+++ b/src/gallium/drivers/svga/svga_swtnl_draw.c
@@ -154,6 +154,13 @@ boolean svga_init_swtnl( struct svga_context *svga )
draw_set_render(svga->swtnl.draw, svga->swtnl.backend);
+ svga->blitter = util_blitter_create(&svga->pipe);
+ if (!svga->blitter)
+ goto fail;
+
+ /* must be done before installing Draw stages */
+ util_blitter_cache_all_shaders(svga->blitter);
+
draw_install_aaline_stage(svga->swtnl.draw, &svga->pipe);
draw_install_aapoint_stage(svga->swtnl.draw, &svga->pipe);
draw_install_pstipple_stage(svga->swtnl.draw, &svga->pipe);
@@ -164,6 +171,9 @@ boolean svga_init_swtnl( struct svga_context *svga )
return TRUE;
fail:
+ if (svga->blitter)
+ util_blitter_destroy(svga->blitter);
+
if (svga->swtnl.backend)
svga->swtnl.backend->destroy( svga->swtnl.backend );