* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
boolean
vl_video_buffer_is_format_supported(struct pipe_screen *screen,
enum pipe_format format,
- enum pipe_video_profile profile)
+ enum pipe_video_profile profile,
+ enum pipe_video_entrypoint entrypoint)
{
const enum pipe_format *resource_formats;
unsigned i;
void
vl_video_buffer_set_associated_data(struct pipe_video_buffer *vbuf,
- struct pipe_video_decoder *vdec,
+ struct pipe_video_codec *vcodec,
void *associated_data,
void (*destroy_associated_data)(void *))
{
- vbuf->decoder = vdec;
+ vbuf->codec = vcodec;
if (vbuf->associated_data == associated_data)
return;
void *
vl_video_buffer_get_associated_data(struct pipe_video_buffer *vbuf,
- struct pipe_video_decoder *vdec)
+ struct pipe_video_codec *vcodec)
{
- if (vbuf->decoder == vdec)
+ if (vbuf->codec == vcodec)
return vbuf->associated_data;
else
return NULL;
}
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)
+vl_video_buffer_template(struct pipe_resource *templ,
+ const struct pipe_video_buffer *tmpl,
+ enum pipe_format resource_format,
+ unsigned depth, unsigned array_size,
+ unsigned usage, unsigned plane)
{
memset(templ, 0, sizeof(*templ));
- templ->target = depth > 1 ? PIPE_TEXTURE_3D : PIPE_TEXTURE_2D;
+ if (depth > 1)
+ templ->target = PIPE_TEXTURE_3D;
+ else if (array_size > 1)
+ templ->target = PIPE_TEXTURE_2D_ARRAY;
+ else
+ templ->target = PIPE_TEXTURE_2D;
templ->format = resource_format;
templ->width0 = tmpl->width;
templ->height0 = tmpl->height;
templ->depth0 = depth;
- templ->array_size = 1;
+ templ->array_size = array_size;
templ->bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
templ->usage = usage;
templ->width0 /= 2;
templ->height0 /= 2;
} else if (tmpl->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_422) {
- templ->height0 /= 2;
+ templ->width0 /= 2;
}
}
}
pipe_resource_reference(&buf->resources[i], NULL);
}
- for (i = 0; i < VL_NUM_COMPONENTS * 2; ++i)
+ for (i = 0; i < VL_MAX_SURFACES; ++i)
pipe_surface_reference(&buf->surfaces[i], NULL);
vl_video_buffer_set_associated_data(buffer, NULL, NULL, NULL);
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;
- for (i = 0, surf = 0; i < depth; ++i ) {
- for (j = 0; j < VL_NUM_COMPONENTS; ++j, ++surf) {
- assert(surf < (VL_NUM_COMPONENTS * 2));
+ array_size = buffer->interlaced ? 2 : 1;
+ for (i = 0, surf = 0; i < VL_NUM_COMPONENTS; ++i) {
+ for (j = 0; j < array_size; ++j, ++surf) {
+ assert(surf < VL_MAX_SURFACES);
- if (!buf->resources[j]) {
+ if (!buf->resources[i]) {
pipe_surface_reference(&buf->surfaces[surf], NULL);
continue;
}
if (!buf->surfaces[surf]) {
memset(&surf_templ, 0, sizeof(surf_templ));
- surf_templ.format = vl_video_buffer_surface_format(buf->resources[j]->format);
- surf_templ.usage = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
- surf_templ.u.tex.first_layer = surf_templ.u.tex.last_layer = i;
- buf->surfaces[surf] = pipe->create_surface(pipe, buf->resources[j], &surf_templ);
+ surf_templ.format = vl_video_buffer_surface_format(buf->resources[i]->format);
+ surf_templ.u.tex.first_layer = surf_templ.u.tex.last_layer = j;
+ buf->surfaces[surf] = pipe->create_surface(pipe, buf->resources[i], &surf_templ);
if (!buf->surfaces[surf])
goto error;
}
return buf->surfaces;
error:
- for (i = 0; i < (VL_NUM_COMPONENTS * 2); ++i )
+ for (i = 0; i < VL_MAX_SURFACES; ++i )
pipe_surface_reference(&buf->surfaces[i], NULL);
return NULL;
(
pipe->screen,
PIPE_VIDEO_PROFILE_UNKNOWN,
+ PIPE_VIDEO_ENTRYPOINT_UNKNOWN,
PIPE_VIDEO_CAP_NPOT_TEXTURES
);
result = vl_video_buffer_create_ex
(
pipe, &templat, resource_formats,
- tmpl->interlaced ? 2 : 1, PIPE_USAGE_STATIC
+ 1, tmpl->interlaced ? 2 : 1, PIPE_USAGE_STATIC
);
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 depth, unsigned array_size, unsigned usage)
{
struct pipe_resource res_tmpl;
struct pipe_resource *resources[VL_NUM_COMPONENTS];
memset(resources, 0, sizeof resources);
- vl_vide_buffer_template(&res_tmpl, tmpl, resource_formats[0], depth, usage, 0);
+ vl_video_buffer_template(&res_tmpl, tmpl, resource_formats[0], depth, array_size, usage, 0);
resources[0] = pipe->screen->resource_create(pipe->screen, &res_tmpl);
if (!resources[0])
goto error;
return vl_video_buffer_create_ex2(pipe, tmpl, resources);
}
- vl_vide_buffer_template(&res_tmpl, tmpl, resource_formats[1], depth, usage, 1);
+ vl_video_buffer_template(&res_tmpl, tmpl, resource_formats[1], depth, array_size, usage, 1);
resources[1] = pipe->screen->resource_create(pipe->screen, &res_tmpl);
if (!resources[1])
goto error;
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_video_buffer_template(&res_tmpl, tmpl, resource_formats[2], depth, array_size, usage, 2);
resources[2] = pipe->screen->resource_create(pipe->screen, &res_tmpl);
if (!resources[2])
goto error;
unsigned i;
buffer = CALLOC_STRUCT(vl_video_buffer);
+ if (!buffer)
+ return NULL;
buffer->base = *tmpl;
buffer->base.context = pipe;