diff options
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/vl/vl_context.c | 30 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_video_buffer.c | 25 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_video_buffer.h | 11 |
3 files changed, 35 insertions, 31 deletions
diff --git a/src/gallium/auxiliary/vl/vl_context.c b/src/gallium/auxiliary/vl/vl_context.c index 3a90a247bd8..46e1981cc9f 100644 --- a/src/gallium/auxiliary/vl/vl_context.c +++ b/src/gallium/auxiliary/vl/vl_context.c @@ -47,33 +47,6 @@ vl_context_destroy(struct pipe_video_context *context) FREE(ctx); } -static boolean -vl_context_is_format_supported(struct pipe_video_context *context, - enum pipe_format format, - enum pipe_video_profile profile) -{ - struct vl_context *ctx = (struct vl_context*)context; - const enum pipe_format *resource_formats; - unsigned i; - - assert(context); - - resource_formats = vl_video_buffer_formats(ctx->pipe, format); - if (!resource_formats) - return false; - - for(i = 0; i < VL_MAX_PLANES; ++i) { - if (!resource_formats[i]) - continue; - - if (!ctx->pipe->screen->is_format_supported(ctx->pipe->screen, resource_formats[i], - PIPE_TEXTURE_2D, 0, PIPE_USAGE_STATIC)) - return false; - } - - return true; -} - static struct pipe_surface * vl_context_create_surface(struct pipe_video_context *context, struct pipe_resource *resource, @@ -220,7 +193,7 @@ vl_context_create_buffer(struct pipe_video_context *context, PIPE_VIDEO_CAP_NPOT_TEXTURES ); - resource_formats = vl_video_buffer_formats(ctx->pipe, buffer_format); + resource_formats = vl_video_buffer_formats(ctx->pipe->screen, buffer_format); if (!resource_formats) return NULL; @@ -261,7 +234,6 @@ vl_create_context(struct pipe_context *pipe) ctx->base.screen = pipe->screen; ctx->base.destroy = vl_context_destroy; - ctx->base.is_format_supported = vl_context_is_format_supported; ctx->base.create_surface = vl_context_create_surface; ctx->base.create_sampler_view = vl_context_create_sampler_view; ctx->base.clear_sampler = vl_context_clear_sampler; diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c index 93bc096b733..9b7bab47484 100644 --- a/src/gallium/auxiliary/vl/vl_video_buffer.c +++ b/src/gallium/auxiliary/vl/vl_video_buffer.c @@ -51,7 +51,7 @@ const enum pipe_format const_resource_formats_NV12[3] = { }; const enum pipe_format * -vl_video_buffer_formats(struct pipe_context *pipe, enum pipe_format format) +vl_video_buffer_formats(struct pipe_screen *screen, enum pipe_format format) { switch(format) { case PIPE_FORMAT_YV12: @@ -65,6 +65,29 @@ vl_video_buffer_formats(struct pipe_context *pipe, enum pipe_format format) } } +boolean +vl_video_buffer_is_format_supported(struct pipe_screen *screen, + enum pipe_format format, + enum pipe_video_profile profile) +{ + const enum pipe_format *resource_formats; + unsigned i; + + resource_formats = vl_video_buffer_formats(screen, format); + if (!resource_formats) + return false; + + for(i = 0; i < VL_MAX_PLANES; ++i) { + if (!resource_formats[i]) + continue; + + if (!screen->is_format_supported(screen, resource_formats[i], PIPE_TEXTURE_2D, 0, PIPE_USAGE_STATIC)) + return false; + } + + return true; +} + static void vl_video_buffer_destroy(struct pipe_video_buffer *buffer) { diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.h b/src/gallium/auxiliary/vl/vl_video_buffer.h index 728c6f5f091..8755c54dc73 100644 --- a/src/gallium/auxiliary/vl/vl_video_buffer.h +++ b/src/gallium/auxiliary/vl/vl_video_buffer.h @@ -53,7 +53,16 @@ struct vl_video_buffer * get subformats for each plane */ const enum pipe_format * -vl_video_buffer_formats(struct pipe_context *pipe, enum pipe_format format); +vl_video_buffer_formats(struct pipe_screen *screen, enum pipe_format format); + +/** + * check if video buffer format is supported for a codec/profile + * can be used as default implementation of screen->is_video_format_supported + */ +boolean +vl_video_buffer_is_format_supported(struct pipe_screen *screen, + enum pipe_format format, + enum pipe_video_profile profile); /** * initialize a buffer, creating its resources |