[Mesa-dev] [PATCH] r600g: Fallback to shader decoding if UVD isn't available
Andreas Boll
andreas.boll.dev at gmail.com
Wed Apr 3 14:13:05 PDT 2013
FYI this and the radeonsi patch assume that the kernel driver with UVD
support reports version 2.31.0 (needs to be bumped)
2013/4/3 Andreas Boll <andreas.boll.dev at gmail.com>
> Cc: Christian König <deathsimple at vodafone.de>
> ---
> src/gallium/drivers/r600/r600_pipe.c | 63
> +++++++++++++++++++++++++++++++---
> src/gallium/drivers/r600/r600_pipe.h | 1 +
> 2 files changed, 60 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/r600_pipe.c
> b/src/gallium/drivers/r600/r600_pipe.c
> index 5b82aed..7a80661 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -380,8 +380,13 @@ static struct pipe_context
> *r600_create_context(struct pipe_screen *screen, void
> r600_init_context_resource_functions(rctx);
> r600_init_surface_functions(rctx);
>
> - rctx->context.create_video_decoder = r600_uvd_create_decoder;
> - rctx->context.create_video_buffer = r600_video_buffer_create;
> + if (rscreen->has_uvd) {
> + rctx->context.create_video_decoder =
> r600_uvd_create_decoder;
> + rctx->context.create_video_buffer =
> r600_video_buffer_create;
> + } else {
> + rctx->context.create_video_decoder = vl_create_decoder;
> + rctx->context.create_video_buffer = vl_video_buffer_create;
> + }
>
> r600_init_common_state_functions(rctx);
>
> @@ -787,6 +792,31 @@ static int r600_get_video_param(struct pipe_screen
> *screen,
> }
> }
>
> +static int r600_get_video_param_fallback(struct pipe_screen *screen,
> + enum pipe_video_profile profile,
> + enum pipe_video_cap param)
> +{
> + switch (param) {
> + case PIPE_VIDEO_CAP_SUPPORTED:
> + return vl_profile_supported(screen, profile);
> + case PIPE_VIDEO_CAP_NPOT_TEXTURES:
> + return 1;
> + case PIPE_VIDEO_CAP_MAX_WIDTH:
> + case PIPE_VIDEO_CAP_MAX_HEIGHT:
> + return vl_video_buffer_max_size(screen);
> + case PIPE_VIDEO_CAP_PREFERED_FORMAT:
> + return PIPE_FORMAT_NV12;
> + case PIPE_VIDEO_CAP_PREFERS_INTERLACED:
> + return false;
> + case PIPE_VIDEO_CAP_SUPPORTS_INTERLACED:
> + return false;
> + case PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE:
> + return true;
> + default:
> + return 0;
> + }
> +}
> +
> static int r600_get_compute_param(struct pipe_screen *screen,
> enum pipe_compute_cap param,
> void *ret)
> @@ -1214,6 +1244,19 @@ struct pipe_screen *r600_screen_create(struct
> radeon_winsys *ws)
> rscreen->has_cp_dma = rscreen->info.drm_minor >= 27 &&
> !(rscreen->debug_flags & DBG_NO_CP_DMA);
>
> + /* UVD support. */
> + switch (rscreen->chip_class) {
> + /* The R6xx and RS780/RS880 chipset generations are currently not
> supported, but might be added in the future. */
> + case R700:
> + case EVERGREEN:
> + case CAYMAN:
> + rscreen->has_uvd = rscreen->info.drm_minor >= 31;
> + break;
> + default:
> + rscreen->has_uvd = FALSE;
> + break;
> + }
> +
> if (r600_init_tiling(rscreen)) {
> FREE(rscreen);
> return NULL;
> @@ -1225,7 +1268,13 @@ struct pipe_screen *r600_screen_create(struct
> radeon_winsys *ws)
> rscreen->screen.get_param = r600_get_param;
> rscreen->screen.get_shader_param = r600_get_shader_param;
> rscreen->screen.get_paramf = r600_get_paramf;
> - rscreen->screen.get_video_param = r600_get_video_param;
> +
> + if (rscreen->has_uvd) {
> + rscreen->screen.get_video_param = r600_get_video_param;
> + } else {
> + rscreen->screen.get_video_param =
> r600_get_video_param_fallback;
> + }
> +
> rscreen->screen.get_compute_param = r600_get_compute_param;
> rscreen->screen.get_timestamp = r600_get_timestamp;
>
> @@ -1236,7 +1285,13 @@ struct pipe_screen *r600_screen_create(struct
> radeon_winsys *ws)
> rscreen->screen.is_format_supported =
> r600_is_format_supported;
> rscreen->dma_blit = &r600_dma_blit;
> }
> - rscreen->screen.is_video_format_supported =
> r600_is_video_format_supported;
> +
> + if (rscreen->has_uvd) {
> + rscreen->screen.is_video_format_supported =
> r600_is_video_format_supported;
> + } else {
> + rscreen->screen.is_video_format_supported =
> vl_video_buffer_is_format_supported;
> + }
> +
> rscreen->screen.context_create = r600_create_context;
> rscreen->screen.fence_reference = r600_fence_reference;
> rscreen->screen.fence_signalled = r600_fence_signalled;
> diff --git a/src/gallium/drivers/r600/r600_pipe.h
> b/src/gallium/drivers/r600/r600_pipe.h
> index f3433e7..944f9fe 100644
> --- a/src/gallium/drivers/r600/r600_pipe.h
> +++ b/src/gallium/drivers/r600/r600_pipe.h
> @@ -273,6 +273,7 @@ struct r600_screen {
> bool has_streamout;
> bool has_msaa;
> bool has_cp_dma;
> + bool has_uvd;
> enum r600_msaa_texture_mode msaa_texture_support;
> struct r600_tiling_info tiling_info;
> struct r600_pipe_fences fences;
> --
> 1.7.10.4
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130403/9c58e18c/attachment-0001.html>
More information about the mesa-dev
mailing list