mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
vl: Add support for max level query v2
This patch adds the level query support to the video decoders and uses some more reasonable defaults. v2: (ck) add commit message Reviewed-by: Christian König <christian.koenig@amd.com>
This commit is contained in:
parent
830f4df993
commit
d1ba1055d9
12 changed files with 99 additions and 4 deletions
|
|
@ -44,6 +44,21 @@ vl_profile_supported(struct pipe_screen *screen, enum pipe_video_profile profile
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
vl_level_supported(struct pipe_screen *screen, enum pipe_video_profile profile)
|
||||
{
|
||||
assert(screen);
|
||||
switch (profile) {
|
||||
case PIPE_VIDEO_PROFILE_MPEG1:
|
||||
return 0;
|
||||
case PIPE_VIDEO_PROFILE_MPEG2_SIMPLE:
|
||||
case PIPE_VIDEO_PROFILE_MPEG2_MAIN:
|
||||
return 3;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
struct pipe_video_decoder *
|
||||
vl_create_decoder(struct pipe_context *pipe,
|
||||
enum pipe_video_profile profile,
|
||||
|
|
|
|||
|
|
@ -37,6 +37,12 @@
|
|||
bool
|
||||
vl_profile_supported(struct pipe_screen *screen, enum pipe_video_profile profile);
|
||||
|
||||
/**
|
||||
* get the maximum supported level for the given profile with shader based decoding
|
||||
*/
|
||||
int
|
||||
vl_level_supported(struct pipe_screen *screen, enum pipe_video_profile profile);
|
||||
|
||||
/**
|
||||
* standard implementation of pipe->create_video_decoder
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -170,7 +170,8 @@ ilo_get_video_param(struct pipe_screen *screen,
|
|||
return 1;
|
||||
case PIPE_VIDEO_CAP_SUPPORTS_INTERLACED:
|
||||
return 0;
|
||||
|
||||
case PIPE_VIDEO_CAP_MAX_LEVEL:
|
||||
return vl_level_supported(screen, profile);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -862,6 +862,8 @@ nouveau_screen_get_video_param(struct pipe_screen *pscreen,
|
|||
return false;
|
||||
case PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE:
|
||||
return true;
|
||||
case PIPE_VIDEO_CAP_MAX_LEVEL:
|
||||
return vl_level_supported(screen, profile);
|
||||
default:
|
||||
debug_printf("unknown video param: %d\n", param);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -778,6 +778,21 @@ nv84_screen_get_video_param(struct pipe_screen *pscreen,
|
|||
return true;
|
||||
case PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE:
|
||||
return false;
|
||||
case PIPE_VIDEO_CAP_MAX_LEVEL:
|
||||
switch (profile) {
|
||||
case PIPE_VIDEO_PROFILE_MPEG1:
|
||||
return 0;
|
||||
case PIPE_VIDEO_PROFILE_MPEG2_SIMPLE:
|
||||
case PIPE_VIDEO_PROFILE_MPEG2_MAIN:
|
||||
return 3;
|
||||
case PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE:
|
||||
case PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN:
|
||||
case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH:
|
||||
return 41;
|
||||
default:
|
||||
debug_printf("unknown video profile: %d\n", profile);
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
debug_printf("unknown video param: %d\n", param);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -48,6 +48,31 @@ nvc0_screen_get_video_param(struct pipe_screen *pscreen,
|
|||
return true;
|
||||
case PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE:
|
||||
return false;
|
||||
case PIPE_VIDEO_CAP_MAX_LEVEL:
|
||||
switch (profile) {
|
||||
case PIPE_VIDEO_PROFILE_MPEG1:
|
||||
return 0;
|
||||
case PIPE_VIDEO_PROFILE_MPEG2_SIMPLE:
|
||||
case PIPE_VIDEO_PROFILE_MPEG2_MAIN:
|
||||
return 3;
|
||||
case PIPE_VIDEO_PROFILE_MPEG4_SIMPLE:
|
||||
return 3;
|
||||
case PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE:
|
||||
return 5;
|
||||
case PIPE_VIDEO_PROFILE_VC1_SIMPLE:
|
||||
return 1;
|
||||
case PIPE_VIDEO_PROFILE_VC1_MAIN:
|
||||
return 2;
|
||||
case PIPE_VIDEO_PROFILE_VC1_ADVANCED:
|
||||
return 4;
|
||||
case PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE:
|
||||
case PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN:
|
||||
case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH:
|
||||
return 41;
|
||||
default:
|
||||
debug_printf("unknown video profile: %d\n", profile);
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
debug_printf("unknown video param: %d\n", param);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -359,6 +359,8 @@ static int r300_get_video_param(struct pipe_screen *screen,
|
|||
return false;
|
||||
case PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE:
|
||||
return true;
|
||||
case PIPE_VIDEO_CAP_MAX_LEVEL:
|
||||
return vl_level_supported(screen, profile);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -795,6 +795,8 @@ static int r600_get_video_param(struct pipe_screen *screen,
|
|||
return false;
|
||||
case PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE:
|
||||
return true;
|
||||
case PIPE_VIDEO_CAP_MAX_LEVEL:
|
||||
return vl_level_supported(screen, profile);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1113,6 +1113,30 @@ int ruvd_get_video_param(struct pipe_screen *screen,
|
|||
return true;
|
||||
case PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE:
|
||||
return true;
|
||||
case PIPE_VIDEO_CAP_MAX_LEVEL:
|
||||
switch (profile) {
|
||||
case PIPE_VIDEO_PROFILE_MPEG1:
|
||||
return 0;
|
||||
case PIPE_VIDEO_PROFILE_MPEG2_SIMPLE:
|
||||
case PIPE_VIDEO_PROFILE_MPEG2_MAIN:
|
||||
return 3;
|
||||
case PIPE_VIDEO_PROFILE_MPEG4_SIMPLE:
|
||||
return 3;
|
||||
case PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE:
|
||||
return 5;
|
||||
case PIPE_VIDEO_PROFILE_VC1_SIMPLE:
|
||||
return 1;
|
||||
case PIPE_VIDEO_PROFILE_VC1_MAIN:
|
||||
return 2;
|
||||
case PIPE_VIDEO_PROFILE_VC1_ADVANCED:
|
||||
return 4;
|
||||
case PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE:
|
||||
case PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN:
|
||||
case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH:
|
||||
return 41;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -546,6 +546,8 @@ static int r600_get_video_param(struct pipe_screen *screen,
|
|||
return vl_video_buffer_max_size(screen);
|
||||
case PIPE_VIDEO_CAP_PREFERED_FORMAT:
|
||||
return PIPE_FORMAT_NV12;
|
||||
case PIPE_VIDEO_CAP_MAX_LEVEL:
|
||||
return vl_level_supported(screen, profile);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ enum pipe_video_cap
|
|||
PIPE_VIDEO_CAP_PREFERED_FORMAT = 4,
|
||||
PIPE_VIDEO_CAP_PREFERS_INTERLACED = 5,
|
||||
PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE = 6,
|
||||
PIPE_VIDEO_CAP_SUPPORTS_INTERLACED = 7
|
||||
PIPE_VIDEO_CAP_SUPPORTS_INTERLACED = 7,
|
||||
PIPE_VIDEO_CAP_MAX_LEVEL = 8
|
||||
};
|
||||
|
||||
enum pipe_video_codec
|
||||
|
|
|
|||
|
|
@ -176,13 +176,13 @@ vlVdpDecoderQueryCapabilities(VdpDevice device, VdpDecoderProfile profile,
|
|||
*is_supported = false;
|
||||
return VDP_STATUS_OK;
|
||||
}
|
||||
|
||||
|
||||
pipe_mutex_lock(dev->mutex);
|
||||
*is_supported = pscreen->get_video_param(pscreen, p_profile, PIPE_VIDEO_CAP_SUPPORTED);
|
||||
if (*is_supported) {
|
||||
*max_width = pscreen->get_video_param(pscreen, p_profile, PIPE_VIDEO_CAP_MAX_WIDTH);
|
||||
*max_height = pscreen->get_video_param(pscreen, p_profile, PIPE_VIDEO_CAP_MAX_HEIGHT);
|
||||
*max_level = 16;
|
||||
*max_level = pscreen->get_video_param(pscreen, p_profile, PIPE_VIDEO_CAP_MAX_LEVEL);
|
||||
*max_macroblocks = (*max_width/16)*(*max_height/16);
|
||||
} else {
|
||||
*max_width = 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue