summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2012-04-29 21:34:43 +0200
committerMarek Olšák <maraeo@gmail.com>2012-04-30 01:18:49 +0200
commit3ed72dd31d45b66e54724dcd20bbbbb6875313c3 (patch)
treeedcb96ff93b54f5ba1e855bc6ac9fb1e3c4224b3 /src
parent889c9a566c1b0e1d3ef269c53900e5cfbd6d7b45 (diff)
st/xorg: don't use user_buffer_create
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/xorg/xorg_renderer.c67
1 files changed, 16 insertions, 51 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c
index e28e06a9261..ca25b0912f1 100644
--- a/src/gallium/state_trackers/xorg/xorg_renderer.c
+++ b/src/gallium/state_trackers/xorg/xorg_renderer.c
@@ -42,44 +42,19 @@ static INLINE void map_point(float *mat, float x, float y,
}
}
-static INLINE struct pipe_resource *
-renderer_buffer_create(struct xorg_renderer *r)
-{
- struct pipe_resource *buf =
- pipe_user_buffer_create(r->pipe->screen,
- r->buffer,
- sizeof(float)*
- r->buffer_size,
-/* XXX was: PIPE_BUFFER_USAGE_PIXEL/PIPE_BUFFER_USAGE_GPU_WRITE even though this is a vertex buffer??? */
- PIPE_BIND_VERTEX_BUFFER);
- r->buffer_size = 0;
-
- return buf;
-}
-
static INLINE void
renderer_draw(struct xorg_renderer *r)
{
- struct pipe_context *pipe = r->pipe;
- struct pipe_resource *buf = 0;
int num_verts = r->buffer_size/(r->attrs_per_vertex * NUM_COMPONENTS);
if (!r->buffer_size)
return;
- buf = renderer_buffer_create(r);
-
-
- if (buf) {
- cso_set_vertex_elements(r->cso, r->attrs_per_vertex, r->velems);
+ cso_set_vertex_elements(r->cso, r->attrs_per_vertex, r->velems);
+ util_draw_user_vertex_buffer(r->cso, r->buffer, PIPE_PRIM_QUADS,
+ num_verts, r->attrs_per_vertex);
- util_draw_vertex_buffer(pipe, r->cso, buf, 0,
- PIPE_PRIM_QUADS,
- num_verts, /* verts */
- r->attrs_per_vertex); /* attribs/vert */
-
- pipe_resource_reference(&buf, NULL);
- }
+ r->buffer_size = 0;
}
static INLINE void
@@ -287,7 +262,7 @@ add_vertex_data2(struct xorg_renderer *r,
src_s0, src_t1, mask_s0, mask_t1);
}
-static struct pipe_resource *
+static void
setup_vertex_data_yuv(struct xorg_renderer *r,
float srcX, float srcY, float srcW, float srcH,
float dstX, float dstY, float dstW, float dstH,
@@ -317,8 +292,6 @@ setup_vertex_data_yuv(struct xorg_renderer *r,
/* 4th vertex */
add_vertex_1tex(r, dstX, dstY + dstH,
s0, t1);
-
- return renderer_buffer_create(r);
}
@@ -592,34 +565,26 @@ void renderer_copy_pixmap(struct xorg_renderer *r,
add_vertex_1tex(r, x0, y1, s0, t1);
}
-
-
-
void renderer_draw_yuv(struct xorg_renderer *r,
float src_x, float src_y, float src_w, float src_h,
int dst_x, int dst_y, int dst_w, int dst_h,
struct pipe_resource **textures)
{
- struct pipe_context *pipe = r->pipe;
- struct pipe_resource *buf = 0;
-
- buf = setup_vertex_data_yuv(r,
- src_x, src_y, src_w, src_h,
- dst_x, dst_y, dst_w, dst_h,
- textures);
+ const int num_attribs = 2; /*pos + tex coord*/
- if (buf) {
- const int num_attribs = 2; /*pos + tex coord*/
+ setup_vertex_data_yuv(r,
+ src_x, src_y, src_w, src_h,
+ dst_x, dst_y, dst_w, dst_h,
+ textures);
- cso_set_vertex_elements(r->cso, num_attribs, r->velems);
+ cso_set_vertex_elements(r->cso, num_attribs, r->velems);
- util_draw_vertex_buffer(pipe, r->cso, buf, 0,
- PIPE_PRIM_QUADS,
- 4, /* verts */
- num_attribs); /* attribs/vert */
+ util_draw_user_vertex_buffer(r->cso, r->buffer,
+ PIPE_PRIM_QUADS,
+ 4, /* verts */
+ num_attribs); /* attribs/vert */
- pipe_resource_reference(&buf, NULL);
- }
+ r->buffer_size = 0;
}
void renderer_begin_solid(struct xorg_renderer *r)