diff options
author | Christian König <deathsimple@vodafone.de> | 2011-07-08 11:20:39 +0200 |
---|---|---|
committer | Christian König <deathsimple@vodafone.de> | 2011-07-08 11:20:39 +0200 |
commit | 7eca76952b6726be9459375dde7478a01789577e (patch) | |
tree | 07d63b63c53485914f5566b91d85681de171535d | |
parent | f265a194263bb2a3fa204947a9c98f472835f121 (diff) |
[g3dvl] rename is_format_supported to is_video_format_supported and move it into screen object
-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 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_screen.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_screen.c | 2 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_screen.h | 8 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_video_context.h | 7 |
8 files changed, 49 insertions, 38 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 diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index a440ecb8c39..53437d3ad08 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -25,6 +25,7 @@ #include "util/u_format_s3tc.h" #include "util/u_memory.h" #include "os/os_time.h" +#include "vl/vl_video_buffer.h" #include "r300_context.h" #include "r300_texture.h" @@ -522,6 +523,7 @@ struct pipe_screen* r300_screen_create(struct radeon_winsys *rws) r300screen->screen.get_paramf = r300_get_paramf; r300screen->screen.get_video_param = r300_get_video_param; r300screen->screen.is_format_supported = r300_is_format_supported; + r300screen->screen.is_video_format_supported = vl_video_buffer_is_format_supported; r300screen->screen.context_create = r300_create_context; r300screen->screen.video_context_create = r300_video_create; r300screen->screen.fence_reference = r300_fence_reference; diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index a25b6d0ff96..4b923f86704 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -38,6 +38,7 @@ #include <util/u_memory.h> #include <util/u_inlines.h> #include "util/u_upload_mgr.h" +#include <vl/vl_video_buffer.h> #include "os/os_time.h" #include <pipebuffer/pb_buffer.h> #include "r600.h" @@ -667,6 +668,7 @@ struct pipe_screen *r600_screen_create(struct radeon *radeon) rscreen->screen.get_paramf = r600_get_paramf; rscreen->screen.get_video_param = r600_get_video_param; rscreen->screen.is_format_supported = r600_is_format_supported; + rscreen->screen.is_video_format_supported = vl_video_buffer_is_format_supported; rscreen->screen.context_create = r600_create_context; rscreen->screen.video_context_create = r600_video_create; rscreen->screen.fence_reference = r600_fence_reference; diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index f0467e9148d..b978fb4f61e 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -34,6 +34,7 @@ #include "pipe/p_screen.h" #include "draw/draw_context.h" #include "vl/vl_context.h" +#include "vl/vl_video_buffer.h" #include "state_tracker/sw_winsys.h" #include "tgsi/tgsi_exec.h" @@ -338,6 +339,7 @@ softpipe_create_screen(struct sw_winsys *winsys) screen->base.get_paramf = softpipe_get_paramf; screen->base.get_video_param = softpipe_get_video_param; screen->base.is_format_supported = softpipe_is_format_supported; + screen->base.is_video_format_supported = vl_video_buffer_is_format_supported; screen->base.context_create = softpipe_create_context; screen->base.flush_frontbuffer = softpipe_flush_frontbuffer; screen->base.video_context_create = sp_video_create; diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index 2fa469bbea7..011724a79cc 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -112,6 +112,14 @@ struct pipe_screen { enum pipe_texture_target target, unsigned sample_count, unsigned bindings ); + + /** + * Check if the given pipe_format is supported as output for this codec/profile. + * \param profile profile to check, may also be PIPE_VIDEO_PROFILE_UNKNOWN + */ + boolean (*is_video_format_supported)( struct pipe_screen *, + enum pipe_format format, + enum pipe_video_profile profile ); /** * Create a new texture object, using the given template info. diff --git a/src/gallium/include/pipe/p_video_context.h b/src/gallium/include/pipe/p_video_context.h index 1fb635f1756..78cf43e2edc 100644 --- a/src/gallium/include/pipe/p_video_context.h +++ b/src/gallium/include/pipe/p_video_context.h @@ -56,13 +56,6 @@ struct pipe_video_context void (*destroy)(struct pipe_video_context *context); /** - * Check if the given pipe_format is supported as a video buffer - */ - boolean (*is_format_supported)(struct pipe_video_context *context, - enum pipe_format format, - enum pipe_video_profile profile); - - /** * create a surface of a texture */ struct pipe_surface *(*create_surface)(struct pipe_video_context *context, |