use vl_vb_upload_quads also for mc
authorChristian König <deathsimple@vodafone.de>
Sun, 28 Nov 2010 19:20:47 +0000 (20:20 +0100)
committerChristian König <deathsimple@vodafone.de>
Fri, 3 Dec 2010 18:04:00 +0000 (19:04 +0100)
src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c

index dbc900d261447168cc6dba2db7d9595477c57451..ab6f8b092fe4f3d6e958e2f9759b6d69cc120c8d 100644 (file)
@@ -87,11 +87,6 @@ enum VS_OUTPUT
    VS_O_MV3
 };
 
-/* vertices for a quad covering a macroblock */
-static const struct vertex2f const_quad[4] = {
-   {0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f}
-};
-
 static const unsigned const_mbtype_config[VL_NUM_MACROBLOCK_TYPES][2] = {
    [VL_MACROBLOCK_TYPE_INTRA]           = { 0, 0 },
    [VL_MACROBLOCK_TYPE_FWD_FRAME_PRED]  = { 1, 1 },
@@ -553,15 +548,7 @@ init_buffers(struct vl_mpeg12_mc_renderer *r)
       r->sampler_views.all[i] = r->pipe->create_sampler_view(r->pipe, r->textures.all[i], &sampler_view);
    }
 
-   r->vertex_bufs.individual.rect.stride = sizeof(struct vertex2f);
-   r->vertex_bufs.individual.rect.max_index = 4 * r->macroblocks_per_batch - 1;
-   r->vertex_bufs.individual.rect.buffer_offset = 0;
-   r->vertex_bufs.individual.rect.buffer = pipe_buffer_create
-   (
-      r->pipe->screen,
-      PIPE_BIND_VERTEX_BUFFER,
-      sizeof(struct vertex2f) * 4 * r->macroblocks_per_batch
-   );
+   r->vertex_bufs.individual.quad = vl_vb_upload_quads(r->pipe, r->macroblocks_per_batch);
 
    r->vertex_bufs.individual.ycbcr.stride = sizeof(struct vert_stream_0);
    r->vertex_bufs.individual.ycbcr.max_index = 4 * r->macroblocks_per_batch - 1;
@@ -644,27 +631,6 @@ init_buffers(struct vl_mpeg12_mc_renderer *r)
    return true;
 }
 
-static void
-init_const_buffers(struct vl_mpeg12_mc_renderer *r)
-{
-   struct pipe_transfer *buf_transfer;
-   struct vertex2f *rect;
-   unsigned i;
-
-   rect = pipe_buffer_map
-   (
-      r->pipe,
-      r->vertex_bufs.individual.rect.buffer,
-      PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD,
-      &buf_transfer
-   );
-
-   for ( i = 0; i < r->macroblocks_per_batch; ++i)
-     memcpy(rect + i * 4, &const_quad, sizeof(const_quad));
-
-   pipe_buffer_unmap(r->pipe, r->vertex_bufs.individual.rect.buffer, buf_transfer);
-}
-
 static void
 cleanup_buffers(struct vl_mpeg12_mc_renderer *r)
 {
@@ -1121,8 +1087,6 @@ vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer,
    if (!init_buffers(renderer))
       goto error_buffers;
 
-   init_const_buffers(renderer);
-
    renderer->surface = NULL;
    renderer->past = NULL;
    renderer->future = NULL;