diff options
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/vl/vl_idct.c | 29 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_idct.h | 6 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_mc.c | 22 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_mc.h | 6 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_mpeg12_decoder.c | 15 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_zscan.c | 17 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_zscan.h | 7 |
7 files changed, 38 insertions, 64 deletions
diff --git a/src/gallium/auxiliary/vl/vl_idct.c b/src/gallium/auxiliary/vl/vl_idct.c index a2b35371c94..325551aad0d 100644 --- a/src/gallium/auxiliary/vl/vl_idct.c +++ b/src/gallium/auxiliary/vl/vl_idct.c @@ -614,9 +614,9 @@ init_source(struct vl_idct *idct, struct vl_idct_buffer *buffer) } static void -cleanup_source(struct vl_idct *idct, struct vl_idct_buffer *buffer) +cleanup_source(struct vl_idct_buffer *buffer) { - assert(idct && buffer); + assert(buffer); pipe_surface_reference(&buffer->fb_state_mismatch.cbufs[0], NULL); @@ -665,13 +665,13 @@ error_surfaces: } static void -cleanup_intermediate(struct vl_idct *idct, struct vl_idct_buffer *buffer) +cleanup_intermediate(struct vl_idct_buffer *buffer) { unsigned i; - assert(idct && buffer); + assert(buffer); - for(i = 0; i < idct->nr_of_render_targets; ++i) + for(i = 0; i < PIPE_MAX_COLOR_BUFS; ++i) pipe_surface_reference(&buffer->fb_state.cbufs[i], NULL); pipe_sampler_view_reference(&buffer->sampler_views.individual.intermediate, NULL); @@ -802,8 +802,6 @@ vl_idct_init_buffer(struct vl_idct *idct, struct vl_idct_buffer *buffer, memset(buffer, 0, sizeof(struct vl_idct_buffer)); - buffer->idct = idct; - pipe_sampler_view_reference(&buffer->sampler_views.individual.matrix, idct->matrix); pipe_sampler_view_reference(&buffer->sampler_views.individual.source, source); pipe_sampler_view_reference(&buffer->sampler_views.individual.transpose, idct->transpose); @@ -823,20 +821,17 @@ vl_idct_cleanup_buffer(struct vl_idct_buffer *buffer) { assert(buffer); - cleanup_source(buffer->idct, buffer); - cleanup_intermediate(buffer->idct, buffer); + cleanup_source(buffer); + cleanup_intermediate(buffer); pipe_sampler_view_reference(&buffer->sampler_views.individual.matrix, NULL); pipe_sampler_view_reference(&buffer->sampler_views.individual.transpose, NULL); } void -vl_idct_flush(struct vl_idct_buffer *buffer, unsigned num_instances) +vl_idct_flush(struct vl_idct *idct, struct vl_idct_buffer *buffer, unsigned num_instances) { - struct vl_idct *idct; assert(buffer); - - idct = buffer->idct; idct->pipe->bind_rasterizer_state(idct->pipe, idct->rs_state); idct->pipe->bind_blend_state(idct->pipe, idct->blend); @@ -859,13 +854,13 @@ vl_idct_flush(struct vl_idct_buffer *buffer, unsigned num_instances) } void -vl_idct_prepare_stage2(struct vl_idct_buffer *buffer) +vl_idct_prepare_stage2(struct vl_idct *idct, struct vl_idct_buffer *buffer) { assert(buffer); /* second stage */ - buffer->idct->pipe->bind_rasterizer_state(buffer->idct->pipe, buffer->idct->rs_state); - buffer->idct->pipe->bind_fragment_sampler_states(buffer->idct->pipe, 2, buffer->idct->samplers); - buffer->idct->pipe->set_fragment_sampler_views(buffer->idct->pipe, 2, buffer->sampler_views.stage[1]); + idct->pipe->bind_rasterizer_state(idct->pipe, idct->rs_state); + idct->pipe->bind_fragment_sampler_states(idct->pipe, 2, idct->samplers); + idct->pipe->set_fragment_sampler_views(idct->pipe, 2, buffer->sampler_views.stage[1]); } diff --git a/src/gallium/auxiliary/vl/vl_idct.h b/src/gallium/auxiliary/vl/vl_idct.h index 1d19d8146fc..575a6206742 100644 --- a/src/gallium/auxiliary/vl/vl_idct.h +++ b/src/gallium/auxiliary/vl/vl_idct.h @@ -58,8 +58,6 @@ struct vl_idct /* a set of buffers to work with */ struct vl_idct_buffer { - struct vl_idct *idct; - struct pipe_viewport_state viewport_mismatch; struct pipe_viewport_state viewport; @@ -113,9 +111,9 @@ vl_idct_cleanup_buffer(struct vl_idct_buffer *buffer); /* flush the buffer and start rendering, vertex buffers needs to be setup before calling this */ void -vl_idct_flush(struct vl_idct_buffer *buffer, unsigned num_verts); +vl_idct_flush(struct vl_idct *idct, struct vl_idct_buffer *buffer, unsigned num_verts); void -vl_idct_prepare_stage2(struct vl_idct_buffer *buffer); +vl_idct_prepare_stage2(struct vl_idct *idct, struct vl_idct_buffer *buffer); #endif diff --git a/src/gallium/auxiliary/vl/vl_mc.c b/src/gallium/auxiliary/vl/vl_mc.c index 9534a8f0050..0f41c687f46 100644 --- a/src/gallium/auxiliary/vl/vl_mc.c +++ b/src/gallium/auxiliary/vl/vl_mc.c @@ -551,8 +551,6 @@ vl_mc_init_buffer(struct vl_mc *renderer, struct vl_mc_buffer *buffer) { assert(renderer && buffer); - buffer->renderer = renderer; - buffer->viewport.scale[2] = 1; buffer->viewport.scale[3] = 1; buffer->viewport.translate[0] = 0; @@ -588,13 +586,10 @@ vl_mc_set_surface(struct vl_mc_buffer *buffer, struct pipe_surface *surface) } static void -prepare_pipe_4_rendering(struct vl_mc_buffer *buffer, unsigned mask) +prepare_pipe_4_rendering(struct vl_mc *renderer, struct vl_mc_buffer *buffer, unsigned mask) { - struct vl_mc *renderer; - assert(buffer); - renderer = buffer->renderer; renderer->pipe->bind_rasterizer_state(renderer->pipe, renderer->rs_state); if (buffer->surface_cleared) @@ -607,15 +602,11 @@ prepare_pipe_4_rendering(struct vl_mc_buffer *buffer, unsigned mask) } void -vl_mc_render_ref(struct vl_mc_buffer *buffer, struct pipe_sampler_view *ref) +vl_mc_render_ref(struct vl_mc *renderer, struct vl_mc_buffer *buffer, struct pipe_sampler_view *ref) { - struct vl_mc *renderer; - assert(buffer && ref); - prepare_pipe_4_rendering(buffer, PIPE_MASK_R | PIPE_MASK_G | PIPE_MASK_B); - - renderer = buffer->renderer; + prepare_pipe_4_rendering(renderer, buffer, PIPE_MASK_R | PIPE_MASK_G | PIPE_MASK_B); renderer->pipe->bind_vs_state(renderer->pipe, renderer->vs_ref); renderer->pipe->bind_fs_state(renderer->pipe, renderer->fs_ref); @@ -631,9 +622,8 @@ vl_mc_render_ref(struct vl_mc_buffer *buffer, struct pipe_sampler_view *ref) } void -vl_mc_render_ycbcr(struct vl_mc_buffer *buffer, unsigned component, unsigned num_instances) +vl_mc_render_ycbcr(struct vl_mc *renderer, struct vl_mc_buffer *buffer, unsigned component, unsigned num_instances) { - struct vl_mc *renderer; unsigned mask = 1 << component; assert(buffer); @@ -641,9 +631,7 @@ vl_mc_render_ycbcr(struct vl_mc_buffer *buffer, unsigned component, unsigned num if (num_instances == 0) return; - prepare_pipe_4_rendering(buffer, mask); - - renderer = buffer->renderer; + prepare_pipe_4_rendering(renderer, buffer, mask); renderer->pipe->bind_vs_state(renderer->pipe, renderer->vs_ycbcr); renderer->pipe->bind_fs_state(renderer->pipe, renderer->fs_ycbcr); diff --git a/src/gallium/auxiliary/vl/vl_mc.h b/src/gallium/auxiliary/vl/vl_mc.h index 081562aa744..2c3b237eae2 100644 --- a/src/gallium/auxiliary/vl/vl_mc.h +++ b/src/gallium/auxiliary/vl/vl_mc.h @@ -59,8 +59,6 @@ struct vl_mc struct vl_mc_buffer { - struct vl_mc *renderer; - bool surface_cleared; struct pipe_viewport_state viewport; @@ -92,8 +90,8 @@ void vl_mc_cleanup_buffer(struct vl_mc_buffer *buffer); void vl_mc_set_surface(struct vl_mc_buffer *buffer, struct pipe_surface *surface); -void vl_mc_render_ref(struct vl_mc_buffer *buffer, struct pipe_sampler_view *ref); +void vl_mc_render_ref(struct vl_mc *renderer, struct vl_mc_buffer *buffer, struct pipe_sampler_view *ref); -void vl_mc_render_ycbcr(struct vl_mc_buffer *buffer, unsigned component, unsigned num_instances); +void vl_mc_render_ycbcr(struct vl_mc *renderer, struct vl_mc_buffer *buffer, unsigned component, unsigned num_instances); #endif /* vl_mc_h */ diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c index e502fc626f5..04253efaefa 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c @@ -583,8 +583,9 @@ vl_mpeg12_begin_frame(struct pipe_video_decoder *decoder) dec->intra_matrix[0] = 1 << (7 - dec->picture_desc.intra_dc_precision); for (i = 0; i < VL_MAX_PLANES; ++i) { - vl_zscan_upload_quant(&buf->zscan[i], dec->intra_matrix, true); - vl_zscan_upload_quant(&buf->zscan[i], dec->non_intra_matrix, false); + struct vl_zscan *zscan = i == 0 ? &dec->zscan_y : &dec->zscan_c; + vl_zscan_upload_quant(zscan, &buf->zscan[i], dec->intra_matrix, true); + vl_zscan_upload_quant(zscan, &buf->zscan[i], dec->non_intra_matrix, false); } vl_vb_map(&buf->vertex_stream, dec->base.context); @@ -746,7 +747,7 @@ vl_mpeg12_end_frame(struct pipe_video_decoder *decoder) vb[2] = vl_vb_get_mv(&buf->vertex_stream, j);; dec->base.context->set_vertex_buffers(dec->base.context, 3, vb); - vl_mc_render_ref(&buf->mc[i], dec->ref_frames[j][i]); + vl_mc_render_ref(i ? &dec->mc_c : &dec->mc_y, &buf->mc[i], dec->ref_frames[j][i]); } } @@ -757,10 +758,10 @@ vl_mpeg12_end_frame(struct pipe_video_decoder *decoder) vb[1] = vl_vb_get_ycbcr(&buf->vertex_stream, i); dec->base.context->set_vertex_buffers(dec->base.context, 2, vb); - vl_zscan_render(&buf->zscan[i] , buf->num_ycbcr_blocks[i]); + vl_zscan_render(i ? &dec->zscan_c : & dec->zscan_y, &buf->zscan[i] , buf->num_ycbcr_blocks[i]); if (dec->base.entrypoint <= PIPE_VIDEO_ENTRYPOINT_IDCT) - vl_idct_flush(&buf->idct[i], buf->num_ycbcr_blocks[i]); + vl_idct_flush(i ? &dec->idct_c : &dec->idct_y, &buf->idct[i], buf->num_ycbcr_blocks[i]); } mc_source_sv = dec->mc_source->get_sampler_view_planes(dec->mc_source); @@ -775,12 +776,12 @@ vl_mpeg12_end_frame(struct pipe_video_decoder *decoder) dec->base.context->set_vertex_buffers(dec->base.context, 2, vb); if (dec->base.entrypoint <= PIPE_VIDEO_ENTRYPOINT_IDCT) - vl_idct_prepare_stage2(&buf->idct[component]); + vl_idct_prepare_stage2(i ? &dec->idct_c : &dec->idct_y, &buf->idct[component]); else { dec->base.context->set_fragment_sampler_views(dec->base.context, 1, &mc_source_sv[component]); dec->base.context->bind_fragment_sampler_states(dec->base.context, 1, &dec->sampler_ycbcr); } - vl_mc_render_ycbcr(&buf->mc[i], j, buf->num_ycbcr_blocks[component]); + vl_mc_render_ycbcr(i ? &dec->mc_c : &dec->mc_y, &buf->mc[i], j, buf->num_ycbcr_blocks[component]); } } } diff --git a/src/gallium/auxiliary/vl/vl_zscan.c b/src/gallium/auxiliary/vl/vl_zscan.c index b720d538f9c..600e4152412 100644 --- a/src/gallium/auxiliary/vl/vl_zscan.c +++ b/src/gallium/auxiliary/vl/vl_zscan.c @@ -473,8 +473,6 @@ vl_zscan_init_buffer(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer, memset(buffer, 0, sizeof(struct vl_zscan_buffer)); - buffer->zscan = zscan; - pipe_sampler_view_reference(&buffer->src, src); buffer->viewport.scale[0] = dst->width; @@ -537,7 +535,8 @@ vl_zscan_set_layout(struct vl_zscan_buffer *buffer, struct pipe_sampler_view *la } void -vl_zscan_upload_quant(struct vl_zscan_buffer *buffer, const uint8_t matrix[64], bool intra) +vl_zscan_upload_quant(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer, + const uint8_t matrix[64], bool intra) { struct pipe_context *pipe; struct pipe_transfer *buf_transfer; @@ -555,9 +554,9 @@ vl_zscan_upload_quant(struct vl_zscan_buffer *buffer, const uint8_t matrix[64], assert(buffer); assert(matrix); - pipe = buffer->zscan->pipe; + pipe = zscan->pipe; - rect.width *= buffer->zscan->blocks_per_line; + rect.width *= zscan->blocks_per_line; buf_transfer = pipe->get_transfer ( @@ -574,7 +573,7 @@ vl_zscan_upload_quant(struct vl_zscan_buffer *buffer, const uint8_t matrix[64], if (!data) goto error_map; - for (i = 0; i < buffer->zscan->blocks_per_line; ++i) + for (i = 0; i < zscan->blocks_per_line; ++i) for (y = 0; y < BLOCK_HEIGHT; ++y) for (x = 0; x < BLOCK_WIDTH; ++x) data[i * BLOCK_WIDTH + y * pitch + x] = matrix[x + y * BLOCK_WIDTH]; @@ -589,14 +588,10 @@ error_transfer: } void -vl_zscan_render(struct vl_zscan_buffer *buffer, unsigned num_instances) +vl_zscan_render(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer, unsigned num_instances) { - struct vl_zscan *zscan; - assert(buffer); - zscan = buffer->zscan; - zscan->pipe->bind_rasterizer_state(zscan->pipe, zscan->rs_state); zscan->pipe->bind_blend_state(zscan->pipe, zscan->blend); zscan->pipe->bind_fragment_sampler_states(zscan->pipe, 3, zscan->samplers); diff --git a/src/gallium/auxiliary/vl/vl_zscan.h b/src/gallium/auxiliary/vl/vl_zscan.h index ec90c1738b2..27411f21d52 100644 --- a/src/gallium/auxiliary/vl/vl_zscan.h +++ b/src/gallium/auxiliary/vl/vl_zscan.h @@ -57,8 +57,6 @@ struct vl_zscan struct vl_zscan_buffer { - struct vl_zscan *zscan; - struct pipe_viewport_state viewport; struct pipe_framebuffer_state fb_state; @@ -93,9 +91,10 @@ void vl_zscan_set_layout(struct vl_zscan_buffer *buffer, struct pipe_sampler_view *layout); void -vl_zscan_upload_quant(struct vl_zscan_buffer *buffer, const uint8_t matrix[64], bool intra); +vl_zscan_upload_quant(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer, + const uint8_t matrix[64], bool intra); void -vl_zscan_render(struct vl_zscan_buffer *buffer, unsigned num_instances); +vl_zscan_render(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer, unsigned num_instances); #endif |