From: Veerabadhran Date: Wed, 5 Feb 2020 14:03:01 +0000 (+0530) Subject: radeon/vce: Move global function pointer si_get_pic_param to local encoder structure X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=461c40e0fd5d67dc8155ae4f6c53ddd9acd995b1;p=mesa.git radeon/vce: Move global function pointer si_get_pic_param to local encoder structure Multi gpu use case broken when the function was global Reviewed-by: Leo Liu Tested-by: Marge Bot Part-of: --- diff --git a/src/gallium/drivers/radeon/radeon_vce.c b/src/gallium/drivers/radeon/radeon_vce.c index 3e909d8b318..521dfb40a67 100644 --- a/src/gallium/drivers/radeon/radeon_vce.c +++ b/src/gallium/drivers/radeon/radeon_vce.c @@ -48,10 +48,6 @@ #define FW_52_8_3 ((52 << 24) | (8 << 16) | (3 << 8)) #define FW_53 (53 << 24) -/* version specific function for getting parameters */ -static void (*si_get_pic_param)(struct rvce_encoder *enc, - struct pipe_h264_enc_picture_desc *pic) = NULL; - /** * flush commands to the hardware */ @@ -276,7 +272,7 @@ static void rvce_begin_frame(struct pipe_video_codec *encoder, enc->pic.rate_ctrl.target_bitrate != pic->rate_ctrl.target_bitrate; enc->pic = *pic; - si_get_pic_param(enc, pic); + enc->si_get_pic_param(enc, pic); enc->get_buffer(vid_buf->resources[0], &enc->handle, &enc->luma); enc->get_buffer(vid_buf->resources[1], NULL, &enc->chroma); @@ -494,7 +490,6 @@ struct pipe_video_codec *si_vce_create_encoder(struct pipe_context *context, switch (sscreen->info.vce_fw_version) { case FW_40_2_2: si_vce_40_2_2_init(enc); - si_get_pic_param = si_vce_40_2_2_get_param; break; case FW_50_0_1: @@ -502,20 +497,17 @@ struct pipe_video_codec *si_vce_create_encoder(struct pipe_context *context, case FW_50_10_2: case FW_50_17_3: si_vce_50_init(enc); - si_get_pic_param = si_vce_50_get_param; break; case FW_52_0_3: case FW_52_4_3: case FW_52_8_3: si_vce_52_init(enc); - si_get_pic_param = si_vce_52_get_param; break; default: if ((sscreen->info.vce_fw_version & (0xff << 24)) >= FW_53) { si_vce_52_init(enc); - si_get_pic_param = si_vce_52_get_param; } else goto error; } diff --git a/src/gallium/drivers/radeon/radeon_vce.h b/src/gallium/drivers/radeon/radeon_vce.h index b5cfe178061..bb2567ed3be 100644 --- a/src/gallium/drivers/radeon/radeon_vce.h +++ b/src/gallium/drivers/radeon/radeon_vce.h @@ -376,6 +376,8 @@ struct rvce_encoder { void (*task_info)(struct rvce_encoder *enc, uint32_t op, uint32_t dep, uint32_t fb_idx, uint32_t ring_idx); + void (*si_get_pic_param)(struct rvce_encoder *enc, + struct pipe_h264_enc_picture_desc *pic); unsigned stream_handle; diff --git a/src/gallium/drivers/radeon/radeon_vce_40_2_2.c b/src/gallium/drivers/radeon/radeon_vce_40_2_2.c index e17468c9097..f2d11d49c6f 100644 --- a/src/gallium/drivers/radeon/radeon_vce_40_2_2.c +++ b/src/gallium/drivers/radeon/radeon_vce_40_2_2.c @@ -443,4 +443,5 @@ void si_vce_40_2_2_init(struct rvce_encoder *enc) enc->config = config; enc->encode = encode; enc->destroy = destroy; + enc->si_get_pic_param = si_vce_40_2_2_get_param; } diff --git a/src/gallium/drivers/radeon/radeon_vce_50.c b/src/gallium/drivers/radeon/radeon_vce_50.c index f4cbc9bb82b..e480ecb749f 100644 --- a/src/gallium/drivers/radeon/radeon_vce_50.c +++ b/src/gallium/drivers/radeon/radeon_vce_50.c @@ -238,4 +238,5 @@ void si_vce_50_init(struct rvce_encoder *enc) /* only the two below are different */ enc->rate_control = rate_control; enc->encode = encode; + enc->si_get_pic_param = si_vce_50_get_param; } diff --git a/src/gallium/drivers/radeon/radeon_vce_52.c b/src/gallium/drivers/radeon/radeon_vce_52.c index 364da4dbe24..bb97cdfe5c3 100644 --- a/src/gallium/drivers/radeon/radeon_vce_52.c +++ b/src/gallium/drivers/radeon/radeon_vce_52.c @@ -667,4 +667,5 @@ void si_vce_52_init(struct rvce_encoder *enc) enc->config = config; enc->encode = encode; enc->destroy = destroy; + enc->si_get_pic_param = si_vce_52_get_param; }