radeon: Use P010 for decoding of 10-bit videos
authorThong Thai <thong.thai@amd.com>
Wed, 18 Dec 2019 16:33:22 +0000 (11:33 -0500)
committerMarge Bot <eric+marge@anholt.net>
Fri, 3 Jan 2020 16:30:22 +0000 (16:30 +0000)
Previously, P016 was used for the decoding of 10-bit HEVC/H.265 encoded
videos, which worked fine for mpv and ffmpeg. GStreamer specifically looks
for P010, so this patch sets the default buffer type to P010 for HEVC
decoding.

Signed-off-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3153>

src/gallium/drivers/r600/radeon_uvd.c
src/gallium/drivers/radeon/radeon_uvd.c
src/gallium/drivers/radeon/radeon_vcn_dec.c
src/gallium/drivers/radeonsi/si_get.c

index 2a5054f1aef521ef744986fc480cb120b0780564..5c46731a48074963c93820762d25c20534358108 100644 (file)
@@ -666,7 +666,8 @@ static struct ruvd_h265 get_h265_msg(struct ruvd_decoder *dec, struct pipe_video
        }
 
        if (pic->base.profile == PIPE_VIDEO_PROFILE_HEVC_MAIN_10) {
-               if (target->buffer_format == PIPE_FORMAT_P016) {
+               if (target->buffer_format == PIPE_FORMAT_P010 ||
+                       target->buffer_format == PIPE_FORMAT_P016) {
                        result.p010_mode = 1;
                        result.msb_mode = 1;
                } else {
index 59ff5a88d539f05c979a2df7d3479bb27b4c1491..f570b75dfaa4954581305d591c69213aa91bc914 100644 (file)
@@ -741,7 +741,8 @@ static struct ruvd_h265 get_h265_msg(struct ruvd_decoder *dec, struct pipe_video
        }
 
        if (pic->base.profile == PIPE_VIDEO_PROFILE_HEVC_MAIN_10) {
-               if (target->buffer_format == PIPE_FORMAT_P016) {
+               if (target->buffer_format == PIPE_FORMAT_P010 ||
+                   target->buffer_format == PIPE_FORMAT_P016) {
                        result.p010_mode = 1;
                        result.msb_mode = 1;
                } else {
index 6d0ae7b4ce1441e0ec3512e719e17abe93ebf151..0f903b1629f5445fb0f142bf1d21e560bc089c97 100644 (file)
@@ -329,7 +329,8 @@ static rvcn_dec_message_hevc_t get_h265_msg(struct radeon_decoder *dec,
        }
 
        if (pic->base.profile == PIPE_VIDEO_PROFILE_HEVC_MAIN_10) {
-               if (target->buffer_format == PIPE_FORMAT_P016) {
+               if (target->buffer_format == PIPE_FORMAT_P010 ||
+                       target->buffer_format == PIPE_FORMAT_P016) {
                        result.p010_mode = 1;
                        result.msb_mode = 1;
                } else {
@@ -530,7 +531,8 @@ static rvcn_dec_message_vp9_t get_vp9_msg(struct radeon_decoder *dec,
        result.ref_frame_sign_bias[2] = pic->picture_parameter.pic_fields.alt_ref_frame_sign_bias;
 
        if (pic->base.profile == PIPE_VIDEO_PROFILE_VP9_PROFILE2) {
-               if (target->buffer_format == PIPE_FORMAT_P016) {
+               if (target->buffer_format == PIPE_FORMAT_P010 ||
+                       target->buffer_format == PIPE_FORMAT_P016) {
                        result.p010_mode = 1;
                        result.msb_mode = 1;
                } else {
index 4b63d6b75225300f10e2899c58bf1142d9da78df..c34c8649bcfc394c7e22a03999df8e09f8f1b5f5 100644 (file)
@@ -686,8 +686,9 @@ static int si_get_video_param(struct pipe_screen *screen,
                        return (sscreen->info.family < CHIP_TONGA) ? 1152 : 4096;
                }
        case PIPE_VIDEO_CAP_PREFERED_FORMAT:
-               if (profile == PIPE_VIDEO_PROFILE_HEVC_MAIN_10 ||
-                   profile == PIPE_VIDEO_PROFILE_VP9_PROFILE2)
+               if (profile == PIPE_VIDEO_PROFILE_HEVC_MAIN_10)
+                       return PIPE_FORMAT_P010;
+               else if (profile == PIPE_VIDEO_PROFILE_VP9_PROFILE2)
                        return PIPE_FORMAT_P016;
                else
                        return PIPE_FORMAT_NV12;