st/vdpau: some mixer fixes
[mesa.git] / src / gallium / state_trackers / xorg / xorg_renderer.c
index 92f1cc50653bf0ffec05b934a2b8eb2349b1ca7d..6b799af90c8a1cc613f8a3b9a34b09da7662bdb5 100644 (file)
@@ -10,6 +10,7 @@
 #include "util/u_sampler.h"
 
 #include "util/u_inlines.h"
+#include "util/u_box.h"
 
 #include <math.h>
 
@@ -72,7 +73,7 @@ renderer_draw(struct xorg_renderer *r)
    if (buf) {
       cso_set_vertex_elements(r->cso, r->attrs_per_vertex, r->velems);
 
-      util_draw_vertex_buffer(pipe, buf, 0,
+      util_draw_vertex_buffer(pipe, r->cso, buf, 0,
                               PIPE_PRIM_QUADS,
                               num_verts,  /* verts */
                               r->attrs_per_vertex); /* attribs/vert */
@@ -428,6 +429,7 @@ void renderer_set_constants(struct xorg_renderer *r,
    pipe_resource_reference(cbuf, NULL);
    *cbuf = pipe_buffer_create(r->pipe->screen,
                               PIPE_BIND_CONSTANT_BUFFER,
+                              PIPE_USAGE_STATIC,
                               param_bytes);
 
    if (*cbuf) {
@@ -448,8 +450,7 @@ void renderer_copy_prepare(struct xorg_renderer *r,
 
    assert(screen->is_format_supported(screen, dst_surface->format,
                                       PIPE_TEXTURE_2D, 0,
-                                      PIPE_BIND_RENDER_TARGET,
-                                      0));
+                                      PIPE_BIND_RENDER_TARGET));
    (void) screen;
 
 
@@ -517,14 +518,10 @@ renderer_clone_texture(struct xorg_renderer *r,
    struct pipe_resource *pt;
    struct pipe_resource templ;
 
-   if (pipe->is_resource_referenced(pipe, src, 0, 0) &
-       PIPE_REFERENCED_FOR_WRITE)
-      pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
-
    /* the coming in texture should already have that invariance */
    debug_assert(screen->is_format_supported(screen, src->format,
                                             PIPE_TEXTURE_2D, 0,
-                                            PIPE_BIND_SAMPLER_VIEW, 0));
+                                            PIPE_BIND_SAMPLER_VIEW));
 
    format = src->format;
 
@@ -535,6 +532,7 @@ renderer_clone_texture(struct xorg_renderer *r,
    templ.width0 = src->width0;
    templ.height0 = src->height0;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.bind = PIPE_BIND_SAMPLER_VIEW;
 
    pt = screen->resource_create(screen, &templ);
@@ -546,19 +544,15 @@ renderer_clone_texture(struct xorg_renderer *r,
 
    {
       /* copy source framebuffer surface into texture */
-      struct pipe_subresource subsrc, subdst;
-      subsrc.face = 0;
-      subsrc.level = 0;
-      subdst.face = 0;
-      subdst.level = 0;
+      struct pipe_box src_box;
+      u_box_origin_2d(src->width0, src->height0, &src_box);
+
       pipe->resource_copy_region(pipe,
                                  pt, /* dest */
-                                 subdst,
+                                 0, /* dest_level */
                                  0, 0, 0, /* destx/y/z */
                                  src,
-                                 subsrc,
-                                 0, 0, 0,
-                                 src->width0, src->height0);
+                                 0, &src_box);
    }
 
    return pt;
@@ -618,7 +612,7 @@ void renderer_draw_yuv(struct xorg_renderer *r,
 
       cso_set_vertex_elements(r->cso, num_attribs, r->velems);
 
-      util_draw_vertex_buffer(pipe, buf, 0,
+      util_draw_vertex_buffer(pipe, r->cso, buf, 0,
                               PIPE_PRIM_QUADS,
                               4,  /* verts */
                               num_attribs); /* attribs/vert */