Signed-off-by: Christian König <deathsimple@vodafone.de>tags/i965-primitive-restart-v2
@@ -35,7 +35,7 @@ | |||
#define VL_BLOCK_WIDTH 8 | |||
#define VL_BLOCK_HEIGHT 8 | |||
#define VL_MAX_PLANES 3 | |||
#define VL_NUM_COMPONENTS 3 | |||
#define VL_MAX_REF_FRAMES 2 | |||
#endif |
@@ -36,7 +36,7 @@ | |||
#include "vl_defines.h" | |||
#include "vl_types.h" | |||
#define VL_MC_NUM_BLENDERS (1 << VL_MAX_PLANES) | |||
#define VL_MC_NUM_BLENDERS (1 << VL_NUM_COMPONENTS) | |||
struct pipe_context; | |||
@@ -124,7 +124,7 @@ init_zscan_buffer(struct vl_mpeg12_decoder *dec, struct vl_mpeg12_buffer *buffer | |||
if (!destination) | |||
goto error_surface; | |||
for (i = 0; i < VL_MAX_PLANES; ++i) | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) | |||
if (!vl_zscan_init_buffer(i == 0 ? &dec->zscan_y : &dec->zscan_c, | |||
&buffer->zscan[i], buffer->zscan_source, destination[i])) | |||
goto error_plane; | |||
@@ -150,7 +150,7 @@ cleanup_zscan_buffer(struct vl_mpeg12_buffer *buffer) | |||
assert(buffer); | |||
for (i = 0; i < VL_MAX_PLANES; ++i) | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) | |||
vl_zscan_cleanup_buffer(&buffer->zscan[i]); | |||
pipe_sampler_view_reference(&buffer->zscan_source, NULL); | |||
@@ -234,7 +234,7 @@ cleanup_mc_buffer(struct vl_mpeg12_buffer *buf) | |||
assert(buf); | |||
for (i = 0; i < VL_MAX_PLANES; ++i) | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) | |||
vl_mc_cleanup_buffer(&buf->mc[i]); | |||
} | |||
@@ -533,7 +533,7 @@ vl_mpeg12_begin_frame(struct pipe_video_decoder *decoder, | |||
memset(non_intra_matrix, 0x10, sizeof(non_intra_matrix)); | |||
} | |||
for (i = 0; i < VL_MAX_PLANES; ++i) { | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) { | |||
struct vl_zscan *zscan = i == 0 ? &dec->zscan_y : &dec->zscan_c; | |||
vl_zscan_upload_quant(zscan, &buf->zscan[i], intra_matrix, true); | |||
vl_zscan_upload_quant(zscan, &buf->zscan[i], non_intra_matrix, false); | |||
@@ -555,7 +555,7 @@ vl_mpeg12_begin_frame(struct pipe_video_decoder *decoder, | |||
buf->block_num = 0; | |||
buf->texels = dec->base.context->transfer_map(dec->base.context, buf->tex_transfer); | |||
for (i = 0; i < VL_MAX_PLANES; ++i) { | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) { | |||
buf->ycbcr_stream[i] = vl_vb_get_ycbcr_stream(&buf->vertex_stream, i); | |||
buf->num_ycbcr_blocks[i] = 0; | |||
} | |||
@@ -564,7 +564,7 @@ vl_mpeg12_begin_frame(struct pipe_video_decoder *decoder, | |||
buf->mv_stream[i] = vl_vb_get_mv_stream(&buf->vertex_stream, i); | |||
if (dec->base.entrypoint >= PIPE_VIDEO_ENTRYPOINT_IDCT) { | |||
for (i = 0; i < VL_MAX_PLANES; ++i) | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) | |||
vl_zscan_set_layout(&buf->zscan[i], dec->zscan_linear); | |||
} | |||
} | |||
@@ -658,7 +658,7 @@ vl_mpeg12_decode_bitstream(struct pipe_video_decoder *decoder, | |||
buf = vl_mpeg12_get_decode_buffer(dec, target); | |||
assert(buf); | |||
for (i = 0; i < VL_MAX_PLANES; ++i) | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) | |||
vl_zscan_set_layout(&buf->zscan[i], desc->alternate_scan ? | |||
dec->zscan_alternate : dec->zscan_normal); | |||
@@ -704,7 +704,7 @@ vl_mpeg12_end_frame(struct pipe_video_decoder *decoder, | |||
} | |||
dec->base.context->bind_vertex_elements_state(dec->base.context, dec->ves_mv); | |||
for (i = 0; i < VL_MAX_PLANES; ++i) { | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) { | |||
if (!target_surfaces[i]) continue; | |||
vl_mc_set_surface(&buf->mc[i], target_surfaces[i]); | |||
@@ -720,7 +720,7 @@ vl_mpeg12_end_frame(struct pipe_video_decoder *decoder, | |||
} | |||
dec->base.context->bind_vertex_elements_state(dec->base.context, dec->ves_ycbcr); | |||
for (i = 0; i < VL_MAX_PLANES; ++i) { | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) { | |||
if (!buf->num_ycbcr_blocks[i]) continue; | |||
vb[1] = vl_vb_get_ycbcr(&buf->vertex_stream, i); | |||
@@ -734,7 +734,7 @@ vl_mpeg12_end_frame(struct pipe_video_decoder *decoder, | |||
plane_order = vl_video_buffer_plane_order(target->buffer_format); | |||
mc_source_sv = dec->mc_source->get_sampler_view_planes(dec->mc_source); | |||
for (i = 0, component = 0; i < VL_MAX_PLANES; ++i) { | |||
for (i = 0, component = 0; i < VL_NUM_COMPONENTS; ++i) { | |||
if (!target_surfaces[i]) continue; | |||
nr_components = util_format_get_nr_components(target_surfaces[i]->texture->format); |
@@ -89,14 +89,14 @@ struct vl_mpeg12_buffer | |||
struct pipe_sampler_view *zscan_source; | |||
struct vl_mpg12_bs bs; | |||
struct vl_zscan_buffer zscan[VL_MAX_PLANES]; | |||
struct vl_idct_buffer idct[VL_MAX_PLANES]; | |||
struct vl_mc_buffer mc[VL_MAX_PLANES]; | |||
struct vl_zscan_buffer zscan[VL_NUM_COMPONENTS]; | |||
struct vl_idct_buffer idct[VL_NUM_COMPONENTS]; | |||
struct vl_mc_buffer mc[VL_NUM_COMPONENTS]; | |||
struct pipe_transfer *tex_transfer; | |||
short *texels; | |||
struct vl_ycbcr_block *ycbcr_stream[VL_MAX_PLANES]; | |||
struct vl_ycbcr_block *ycbcr_stream[VL_NUM_COMPONENTS]; | |||
struct vl_motionvector *mv_stream[VL_MAX_REF_FRAMES]; | |||
}; | |||
@@ -215,7 +215,7 @@ vl_vb_init(struct vl_vertex_buffer *buffer, struct pipe_context *pipe, | |||
size = width * height; | |||
for (i = 0; i < VL_MAX_PLANES; ++i) { | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) { | |||
buffer->ycbcr[i].resource = pipe_buffer_create | |||
( | |||
pipe->screen, | |||
@@ -243,11 +243,11 @@ vl_vb_init(struct vl_vertex_buffer *buffer, struct pipe_context *pipe, | |||
return true; | |||
error_mv: | |||
for (i = 0; i < VL_MAX_PLANES; ++i) | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) | |||
pipe_resource_reference(&buffer->mv[i].resource, NULL); | |||
error_ycbcr: | |||
for (i = 0; i < VL_MAX_PLANES; ++i) | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) | |||
pipe_resource_reference(&buffer->ycbcr[i].resource, NULL); | |||
return false; | |||
} | |||
@@ -293,7 +293,7 @@ vl_vb_map(struct vl_vertex_buffer *buffer, struct pipe_context *pipe) | |||
assert(buffer && pipe); | |||
for (i = 0; i < VL_MAX_PLANES; ++i) { | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) { | |||
buffer->ycbcr[i].vertex_stream = pipe_buffer_map | |||
( | |||
pipe, | |||
@@ -319,7 +319,7 @@ struct vl_ycbcr_block * | |||
vl_vb_get_ycbcr_stream(struct vl_vertex_buffer *buffer, int component) | |||
{ | |||
assert(buffer); | |||
assert(component < VL_MAX_PLANES); | |||
assert(component < VL_NUM_COMPONENTS); | |||
return buffer->ycbcr[component].vertex_stream; | |||
} | |||
@@ -348,7 +348,7 @@ vl_vb_unmap(struct vl_vertex_buffer *buffer, struct pipe_context *pipe) | |||
assert(buffer && pipe); | |||
for (i = 0; i < VL_MAX_PLANES; ++i) { | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) { | |||
pipe_buffer_unmap(pipe, buffer->ycbcr[i].transfer); | |||
} | |||
@@ -364,7 +364,7 @@ vl_vb_cleanup(struct vl_vertex_buffer *buffer) | |||
assert(buffer); | |||
for (i = 0; i < VL_MAX_PLANES; ++i) { | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) { | |||
pipe_resource_reference(&buffer->ycbcr[i].resource, NULL); | |||
} | |||
@@ -96,7 +96,7 @@ struct vl_vertex_buffer | |||
struct pipe_resource *resource; | |||
struct pipe_transfer *transfer; | |||
struct vl_ycbcr_block *vertex_stream; | |||
} ycbcr[VL_MAX_PLANES]; | |||
} ycbcr[VL_NUM_COMPONENTS]; | |||
struct { | |||
struct pipe_resource *resource; |
@@ -104,7 +104,7 @@ vl_video_buffer_is_format_supported(struct pipe_screen *screen, | |||
if (!resource_formats) | |||
return false; | |||
for (i = 0; i < VL_MAX_PLANES; ++i) { | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) { | |||
if (!resource_formats[i]) | |||
continue; | |||
@@ -187,13 +187,13 @@ vl_video_buffer_destroy(struct pipe_video_buffer *buffer) | |||
assert(buf); | |||
for (i = 0; i < VL_MAX_PLANES; ++i) { | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) { | |||
pipe_sampler_view_reference(&buf->sampler_view_planes[i], NULL); | |||
pipe_sampler_view_reference(&buf->sampler_view_components[i], NULL); | |||
pipe_resource_reference(&buf->resources[i], NULL); | |||
} | |||
for (i = 0; i < VL_MAX_PLANES * 2; ++i) | |||
for (i = 0; i < VL_NUM_COMPONENTS * 2; ++i) | |||
pipe_surface_reference(&buf->surfaces[i], NULL); | |||
vl_video_buffer_set_associated_data(buffer, NULL, NULL, NULL); | |||
@@ -256,7 +256,7 @@ vl_video_buffer_sampler_view_components(struct pipe_video_buffer *buffer) | |||
unsigned nr_components = util_format_get_nr_components(res->format); | |||
for (j = 0; j < nr_components; ++j, ++component) { | |||
assert(component < VL_MAX_PLANES); | |||
assert(component < VL_NUM_COMPONENTS); | |||
if (!buf->sampler_view_components[component]) { | |||
memset(&sv_templ, 0, sizeof(sv_templ)); | |||
@@ -273,7 +273,7 @@ vl_video_buffer_sampler_view_components(struct pipe_video_buffer *buffer) | |||
return buf->sampler_view_components; | |||
error: | |||
for (i = 0; i < VL_MAX_PLANES; ++i ) | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i ) | |||
pipe_sampler_view_reference(&buf->sampler_view_components[i], NULL); | |||
return NULL; | |||
@@ -293,8 +293,8 @@ vl_video_buffer_surfaces(struct pipe_video_buffer *buffer) | |||
depth = buffer->interlaced ? 2 : 1; | |||
for (i = 0, surf = 0; i < depth; ++i ) { | |||
for (j = 0; j < VL_MAX_PLANES; ++j, ++surf) { | |||
assert(surf < (VL_MAX_PLANES * 2)); | |||
for (j = 0; j < VL_NUM_COMPONENTS; ++j, ++surf) { | |||
assert(surf < (VL_NUM_COMPONENTS * 2)); | |||
if (!buf->resources[j]) { | |||
pipe_surface_reference(&buf->surfaces[surf], NULL); | |||
@@ -316,7 +316,7 @@ vl_video_buffer_surfaces(struct pipe_video_buffer *buffer) | |||
return buf->surfaces; | |||
error: | |||
for (i = 0; i < (VL_MAX_PLANES * 2); ++i ) | |||
for (i = 0; i < (VL_NUM_COMPONENTS * 2); ++i ) | |||
pipe_surface_reference(&buf->surfaces[i], NULL); | |||
return NULL; | |||
@@ -369,11 +369,11 @@ vl_video_buffer_create(struct pipe_context *pipe, | |||
struct pipe_video_buffer * | |||
vl_video_buffer_create_ex(struct pipe_context *pipe, | |||
const struct pipe_video_buffer *tmpl, | |||
const enum pipe_format resource_formats[VL_MAX_PLANES], | |||
const enum pipe_format resource_formats[VL_NUM_COMPONENTS], | |||
unsigned depth, unsigned usage) | |||
{ | |||
struct pipe_resource res_tmpl; | |||
struct pipe_resource *resources[VL_MAX_PLANES]; | |||
struct pipe_resource *resources[VL_NUM_COMPONENTS]; | |||
unsigned i; | |||
assert(pipe); | |||
@@ -407,7 +407,7 @@ vl_video_buffer_create_ex(struct pipe_context *pipe, | |||
return vl_video_buffer_create_ex2(pipe, tmpl, resources); | |||
error: | |||
for (i = 0; i < VL_MAX_PLANES; ++i) | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) | |||
pipe_resource_reference(&resources[i], NULL); | |||
return NULL; | |||
@@ -416,7 +416,7 @@ error: | |||
struct pipe_video_buffer * | |||
vl_video_buffer_create_ex2(struct pipe_context *pipe, | |||
const struct pipe_video_buffer *tmpl, | |||
struct pipe_resource *resources[VL_MAX_PLANES]) | |||
struct pipe_resource *resources[VL_NUM_COMPONENTS]) | |||
{ | |||
struct vl_video_buffer *buffer; | |||
unsigned i; | |||
@@ -431,7 +431,7 @@ vl_video_buffer_create_ex2(struct pipe_context *pipe, | |||
buffer->base.get_surfaces = vl_video_buffer_surfaces; | |||
buffer->num_planes = 0; | |||
for (i = 0; i < VL_MAX_PLANES; ++i) { | |||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) { | |||
buffer->resources[i] = resources[i]; | |||
if (resources[i]) | |||
buffer->num_planes++; |
@@ -42,10 +42,10 @@ struct vl_video_buffer | |||
{ | |||
struct pipe_video_buffer base; | |||
unsigned num_planes; | |||
struct pipe_resource *resources[VL_MAX_PLANES]; | |||
struct pipe_sampler_view *sampler_view_planes[VL_MAX_PLANES]; | |||
struct pipe_sampler_view *sampler_view_components[VL_MAX_PLANES]; | |||
struct pipe_surface *surfaces[VL_MAX_PLANES * 2]; | |||
struct pipe_resource *resources[VL_NUM_COMPONENTS]; | |||
struct pipe_sampler_view *sampler_view_planes[VL_NUM_COMPONENTS]; | |||
struct pipe_sampler_view *sampler_view_components[VL_NUM_COMPONENTS]; | |||
struct pipe_surface *surfaces[VL_NUM_COMPONENTS * 2]; | |||
}; | |||
/** | |||
@@ -113,7 +113,7 @@ vl_video_buffer_create(struct pipe_context *pipe, | |||
struct pipe_video_buffer * | |||
vl_video_buffer_create_ex(struct pipe_context *pipe, | |||
const struct pipe_video_buffer *templat, | |||
const enum pipe_format resource_formats[VL_MAX_PLANES], | |||
const enum pipe_format resource_formats[VL_NUM_COMPONENTS], | |||
unsigned depth, unsigned usage); | |||
/** | |||
@@ -122,6 +122,6 @@ vl_video_buffer_create_ex(struct pipe_context *pipe, | |||
struct pipe_video_buffer * | |||
vl_video_buffer_create_ex2(struct pipe_context *pipe, | |||
const struct pipe_video_buffer *templat, | |||
struct pipe_resource *resources[VL_MAX_PLANES]); | |||
struct pipe_resource *resources[VL_NUM_COMPONENTS]); | |||
#endif /* vl_video_buffer_h */ |
@@ -685,7 +685,7 @@ nouveau_video_buffer_sampler_view_components(struct pipe_video_buffer *buffer) | |||
unsigned nr_components = util_format_get_nr_components(buf->resources[i]->format); | |||
for (j = 0; j < nr_components; ++j, ++component) { | |||
assert(component < VL_MAX_PLANES); | |||
assert(component < VL_NUM_COMPONENTS); | |||
if (!buf->sampler_view_components[component]) { | |||
memset(&sv_templ, 0, sizeof(sv_templ)); |