res_tmpl.usage = frequently_accessed ? PIPE_USAGE_DYNAMIC : PIPE_USAGE_STATIC;
pipe_mutex_lock(dev->mutex);
+
+ if (!CheckSurfaceParams(pipe->screen, &res_tmpl)) {
+ ret = VDP_STATUS_RESOURCES;
+ goto err_unlock;
+ }
+
res = pipe->screen->resource_create(pipe->screen, &res_tmpl);
if (!res) {
ret = VDP_STATUS_RESOURCES;
res_tmpl.usage = PIPE_USAGE_STATIC;
pipe_mutex_lock(dev->mutex);
+
+ if (!CheckSurfaceParams(pipe->screen, &res_tmpl))
+ goto err_unlock;
+
res = pipe->screen->resource_create(pipe->screen, &res_tmpl);
if (!res)
goto err_unlock;
pipe_mutex_lock(vlsurface->device->mutex);
vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
+ if (!CheckSurfaceParams(context->screen, &res_tmpl))
+ goto error_resource;
+
res = context->screen->resource_create(context->screen, &res_tmpl);
if (!res)
goto error_resource;
return box;
}
+static inline bool
+CheckSurfaceParams(struct pipe_screen *screen,
+ const struct pipe_resource *templ)
+{
+ return screen->is_format_supported(
+ screen, templ->format, templ->target, templ->nr_samples, templ->bind);
+}
+
typedef struct
{
struct vl_screen *vscreen;