diff options
author | Christian König <[email protected]> | 2013-04-30 14:40:40 +0200 |
---|---|---|
committer | Christian König <[email protected]> | 2013-05-01 13:33:46 +0200 |
commit | 7d2f2a0c890b1993532a45c8c392c28950ddc06e (patch) | |
tree | 73245f57a60fc400dd78061dbcd43c26a5046ad7 /src/gallium | |
parent | e27f87b549cf2d4cfef97958ff175862fdf494b0 (diff) |
vl/buffer: use 2D_ARRAY instead of 3D textures
Signed-off-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/vl/vl_compositor.c | 12 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_video_buffer.c | 23 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_video_buffer.h | 7 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_uvd.c | 14 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/radeonsi_uvd.c | 14 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/surface.c | 8 |
6 files changed, 40 insertions, 38 deletions
diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index 1c393a99de6..62f593a3203 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -152,7 +152,7 @@ create_frag_shader_video_buffer(struct vl_compositor *c) * fragment = csc * texel */ for (i = 0; i < 3; ++i) - ureg_TEX(shader, ureg_writemask(texel, TGSI_WRITEMASK_X << i), TGSI_TEXTURE_3D, tc, sampler[i]); + ureg_TEX(shader, ureg_writemask(texel, TGSI_WRITEMASK_X << i), TGSI_TEXTURE_2D_ARRAY, tc, sampler[i]); ureg_MOV(shader, ureg_writemask(texel, TGSI_WRITEMASK_W), ureg_imm1f(shader, 1.0f)); @@ -207,7 +207,7 @@ create_frag_shader_weave(struct vl_compositor *c) i_tc[i], ureg_imm1f(shader, 0.5f)); ureg_ROUND(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_YZ), ureg_src(t_tc[i])); ureg_MOV(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_W), - ureg_imm1f(shader, i ? -0.25f : 0.25f)); + ureg_imm1f(shader, i ? 1.0f : 0.0f)); ureg_ADD(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_YZ), ureg_src(t_tc[i]), ureg_imm1f(shader, 0.5f)); ureg_MUL(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_Y), @@ -227,7 +227,7 @@ create_frag_shader_weave(struct vl_compositor *c) TGSI_SWIZZLE_X, j ? TGSI_SWIZZLE_Z : TGSI_SWIZZLE_Y, TGSI_SWIZZLE_W, TGSI_SWIZZLE_W); ureg_TEX(shader, ureg_writemask(t_texel[i], TGSI_WRITEMASK_X << j), - TGSI_TEXTURE_3D, src, sampler[j]); + TGSI_TEXTURE_2D_ARRAY, src, sampler[j]); } /* calculate linear interpolation factor @@ -558,7 +558,7 @@ static INLINE struct u_rect default_rect(struct vl_compositor_layer *layer) { struct pipe_resource *res = layer->sampler_views[0]->texture; - struct u_rect rect = { 0, res->width0, 0, res->height0 * res->depth0 }; + struct u_rect rect = { 0, res->width0, 0, res->height0 * res->array_size }; return rect; } @@ -902,14 +902,14 @@ vl_compositor_set_buffer_layer(struct vl_compositor_state *s, break; case VL_COMPOSITOR_BOB_TOP: - s->layers[layer].zw.x = 0.25f; + s->layers[layer].zw.x = 0.0f; s->layers[layer].src.tl.y += half_a_line; s->layers[layer].src.br.y += half_a_line; s->layers[layer].fs = c->fs_video_buffer; break; case VL_COMPOSITOR_BOB_BOTTOM: - s->layers[layer].zw.x = 0.75f; + s->layers[layer].zw.x = 1.0f; s->layers[layer].src.tl.y -= half_a_line; s->layers[layer].src.br.y -= half_a_line; s->layers[layer].fs = c->fs_video_buffer; diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c index d61dab22c2d..220c3ea632f 100644 --- a/src/gallium/auxiliary/vl/vl_video_buffer.c +++ b/src/gallium/auxiliary/vl/vl_video_buffer.c @@ -216,15 +216,16 @@ void vl_vide_buffer_template(struct pipe_resource *templ, const struct pipe_video_buffer *tmpl, enum pipe_format resource_format, - unsigned depth, unsigned usage, unsigned plane) + unsigned array_size, unsigned usage, + unsigned plane) { memset(templ, 0, sizeof(*templ)); - templ->target = depth > 1 ? PIPE_TEXTURE_3D : PIPE_TEXTURE_2D; + templ->target = array_size > 1 ? PIPE_TEXTURE_2D_ARRAY : PIPE_TEXTURE_2D; templ->format = resource_format; templ->width0 = tmpl->width; templ->height0 = tmpl->height; - templ->depth0 = depth; - templ->array_size = 1; + templ->depth0 = 1; + templ->array_size = array_size; templ->bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET; templ->usage = usage; @@ -349,15 +350,15 @@ vl_video_buffer_surfaces(struct pipe_video_buffer *buffer) struct vl_video_buffer *buf = (struct vl_video_buffer *)buffer; struct pipe_surface surf_templ; struct pipe_context *pipe; - unsigned i, j, depth, surf; + unsigned i, j, array_size, surf; assert(buf); pipe = buf->base.context; - depth = buffer->interlaced ? 2 : 1; + array_size = buffer->interlaced ? 2 : 1; for (i = 0, surf = 0; i < VL_NUM_COMPONENTS; ++i) { - for (j = 0; j < depth; ++j, ++surf) { + for (j = 0; j < array_size; ++j, ++surf) { assert(surf < (VL_NUM_COMPONENTS * 2)); if (!buf->resources[i]) { @@ -433,7 +434,7 @@ 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_NUM_COMPONENTS], - unsigned depth, unsigned usage) + unsigned array_size, unsigned usage) { struct pipe_resource res_tmpl; struct pipe_resource *resources[VL_NUM_COMPONENTS]; @@ -443,7 +444,7 @@ vl_video_buffer_create_ex(struct pipe_context *pipe, memset(resources, 0, sizeof resources); - vl_vide_buffer_template(&res_tmpl, tmpl, resource_formats[0], depth, usage, 0); + vl_vide_buffer_template(&res_tmpl, tmpl, resource_formats[0], array_size, usage, 0); resources[0] = pipe->screen->resource_create(pipe->screen, &res_tmpl); if (!resources[0]) goto error; @@ -453,7 +454,7 @@ vl_video_buffer_create_ex(struct pipe_context *pipe, return vl_video_buffer_create_ex2(pipe, tmpl, resources); } - vl_vide_buffer_template(&res_tmpl, tmpl, resource_formats[1], depth, usage, 1); + vl_vide_buffer_template(&res_tmpl, tmpl, resource_formats[1], array_size, usage, 1); resources[1] = pipe->screen->resource_create(pipe->screen, &res_tmpl); if (!resources[1]) goto error; @@ -461,7 +462,7 @@ vl_video_buffer_create_ex(struct pipe_context *pipe, if (resource_formats[2] == PIPE_FORMAT_NONE) return vl_video_buffer_create_ex2(pipe, tmpl, resources); - vl_vide_buffer_template(&res_tmpl, tmpl, resource_formats[2], depth, usage, 2); + vl_vide_buffer_template(&res_tmpl, tmpl, resource_formats[2], array_size, usage, 2); resources[2] = pipe->screen->resource_create(pipe->screen, &res_tmpl); if (!resources[2]) goto error; diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.h b/src/gallium/auxiliary/vl/vl_video_buffer.h index 6e2f8b8291a..e666011aea1 100644 --- a/src/gallium/auxiliary/vl/vl_video_buffer.h +++ b/src/gallium/auxiliary/vl/vl_video_buffer.h @@ -98,7 +98,8 @@ void vl_vide_buffer_template(struct pipe_resource *templ, const struct pipe_video_buffer *templat, enum pipe_format resource_format, - unsigned depth, unsigned usage, unsigned plane); + unsigned array_size, unsigned usage, + unsigned plane); /** * creates a video buffer, can be used as a standard implementation for pipe->create_video_buffer @@ -108,13 +109,13 @@ vl_video_buffer_create(struct pipe_context *pipe, const struct pipe_video_buffer *templat); /** - * extended create function, gets depth, usage and formats for each plane seperately + * extended create function, gets array_size, usage and formats for each plane seperately */ 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_NUM_COMPONENTS], - unsigned depth, unsigned usage); + unsigned array_size, unsigned usage); /** * even more extended create function, provide the pipe_resource for each plane diff --git a/src/gallium/drivers/r600/r600_uvd.c b/src/gallium/drivers/r600/r600_uvd.c index c4c04a84b3d..90282380889 100644 --- a/src/gallium/drivers/r600/r600_uvd.c +++ b/src/gallium/drivers/r600/r600_uvd.c @@ -61,7 +61,7 @@ struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe, const enum pipe_format *resource_formats; struct pipe_video_buffer template; struct pipe_resource templ; - unsigned i, depth; + unsigned i, array_size; assert(pipe); @@ -70,12 +70,12 @@ struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe, if (!resource_formats) return NULL; - depth = tmpl->interlaced ? 2 : 1; + array_size = tmpl->interlaced ? 2 : 1; template = *tmpl; template.width = align(tmpl->width, VL_MACROBLOCK_WIDTH); - template.height = align(tmpl->height / depth, VL_MACROBLOCK_HEIGHT); + template.height = align(tmpl->height / array_size, VL_MACROBLOCK_HEIGHT); - vl_vide_buffer_template(&templ, &template, resource_formats[0], depth, PIPE_USAGE_STATIC, 0); + vl_vide_buffer_template(&templ, &template, resource_formats[0], array_size, PIPE_USAGE_STATIC, 0); if (ctx->chip_class < EVERGREEN) templ.flags = R600_RESOURCE_FLAG_TRANSFER; resources[0] = (struct r600_texture *) @@ -84,7 +84,7 @@ struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe, goto error; if (resource_formats[1] != PIPE_FORMAT_NONE) { - vl_vide_buffer_template(&templ, &template, resource_formats[1], depth, PIPE_USAGE_STATIC, 1); + vl_vide_buffer_template(&templ, &template, resource_formats[1], array_size, PIPE_USAGE_STATIC, 1); if (ctx->chip_class < EVERGREEN) templ.flags = R600_RESOURCE_FLAG_TRANSFER; resources[1] = (struct r600_texture *) @@ -94,7 +94,7 @@ struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe, } if (resource_formats[2] != PIPE_FORMAT_NONE) { - vl_vide_buffer_template(&templ, &template, resource_formats[2], depth, PIPE_USAGE_STATIC, 2); + vl_vide_buffer_template(&templ, &template, resource_formats[2], array_size, PIPE_USAGE_STATIC, 2); if (ctx->chip_class < EVERGREEN) templ.flags = R600_RESOURCE_FLAG_TRANSFER; resources[2] = (struct r600_texture *) @@ -122,7 +122,7 @@ struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe, resources[i]->resource.buf); } - template.height *= depth; + template.height *= array_size; return vl_video_buffer_create_ex2(pipe, &template, (struct pipe_resource **)resources); error: diff --git a/src/gallium/drivers/radeonsi/radeonsi_uvd.c b/src/gallium/drivers/radeonsi/radeonsi_uvd.c index 1aaaac41839..04f672dfa5e 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_uvd.c +++ b/src/gallium/drivers/radeonsi/radeonsi_uvd.c @@ -61,7 +61,7 @@ struct pipe_video_buffer *radeonsi_video_buffer_create(struct pipe_context *pipe const enum pipe_format *resource_formats; struct pipe_video_buffer template; struct pipe_resource templ; - unsigned i, depth; + unsigned i, array_size; assert(pipe); @@ -70,12 +70,12 @@ struct pipe_video_buffer *radeonsi_video_buffer_create(struct pipe_context *pipe if (!resource_formats) return NULL; - depth = tmpl->interlaced ? 2 : 1; + array_size = tmpl->interlaced ? 2 : 1; template = *tmpl; template.width = align(tmpl->width, VL_MACROBLOCK_WIDTH); - template.height = align(tmpl->height / depth, VL_MACROBLOCK_HEIGHT); + template.height = align(tmpl->height / array_size, VL_MACROBLOCK_HEIGHT); - vl_vide_buffer_template(&templ, &template, resource_formats[0], depth, PIPE_USAGE_STATIC, 0); + vl_vide_buffer_template(&templ, &template, resource_formats[0], array_size, PIPE_USAGE_STATIC, 0); /* TODO: Setting the transfer flag is only a workaround till we get tiling working */ templ.flags = R600_RESOURCE_FLAG_TRANSFER; resources[0] = (struct r600_resource_texture *) @@ -84,7 +84,7 @@ struct pipe_video_buffer *radeonsi_video_buffer_create(struct pipe_context *pipe goto error; if (resource_formats[1] != PIPE_FORMAT_NONE) { - vl_vide_buffer_template(&templ, &template, resource_formats[1], depth, PIPE_USAGE_STATIC, 1); + vl_vide_buffer_template(&templ, &template, resource_formats[1], array_size, PIPE_USAGE_STATIC, 1); templ.flags = R600_RESOURCE_FLAG_TRANSFER; resources[1] = (struct r600_resource_texture *) pipe->screen->resource_create(pipe->screen, &templ); @@ -93,7 +93,7 @@ struct pipe_video_buffer *radeonsi_video_buffer_create(struct pipe_context *pipe } if (resource_formats[2] != PIPE_FORMAT_NONE) { - vl_vide_buffer_template(&templ, &template, resource_formats[2], depth, PIPE_USAGE_STATIC, 2); + vl_vide_buffer_template(&templ, &template, resource_formats[2], array_size, PIPE_USAGE_STATIC, 2); templ.flags = R600_RESOURCE_FLAG_TRANSFER; resources[2] = (struct r600_resource_texture *) pipe->screen->resource_create(pipe->screen, &templ); @@ -120,7 +120,7 @@ struct pipe_video_buffer *radeonsi_video_buffer_create(struct pipe_context *pipe resources[i]->resource.buf); } - template.height *= depth; + template.height *= array_size; return vl_video_buffer_create_ex2(pipe, &template, (struct pipe_resource **)resources); error: diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c index 5c06f8511aa..ad56125e0ce 100644 --- a/src/gallium/state_trackers/vdpau/surface.c +++ b/src/gallium/state_trackers/vdpau/surface.c @@ -228,7 +228,7 @@ vlVdpVideoSurfaceGetBitsYCbCr(VdpVideoSurface surface, vlVdpVideoSurfaceSize(vlsurface, i, &width, &height); - for (j = 0; j < sv->texture->depth0; ++j) { + for (j = 0; j < sv->texture->array_size; ++j) { struct pipe_box box = { 0, 0, j, width, height, 1 @@ -244,7 +244,7 @@ vlVdpVideoSurfaceGetBitsYCbCr(VdpVideoSurface surface, } util_copy_rect(destination_data[i] + destination_pitches[i] * j, sv->texture->format, - destination_pitches[i] * sv->texture->depth0, 0, 0, + destination_pitches[i] * sv->texture->array_size, 0, 0, box.width, box.height, map, transfer->stride, 0, 0); pipe_transfer_unmap(pipe, transfer); @@ -315,7 +315,7 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, vlVdpVideoSurfaceSize(p_surf, i, &width, &height); - for (j = 0; j < sv->texture->depth0; ++j) { + for (j = 0; j < sv->texture->array_size; ++j) { struct pipe_box dst_box = { 0, 0, j, width, height, 1 @@ -324,7 +324,7 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, pipe->transfer_inline_write(pipe, sv->texture, 0, PIPE_TRANSFER_WRITE, &dst_box, source_data[i] + source_pitches[i] * j, - source_pitches[i] * sv->texture->depth0, + source_pitches[i] * sv->texture->array_size, 0); } } |