[Mesa-dev] [PATCH 13/18] radeon/vce: adapt new firmware interface changes

Marek Olšák maraeo at gmail.com
Mon Apr 20 15:23:45 PDT 2015


From: Leo Liu <leo.liu at amd.com>

v2: make this also compatible with original released firmware
v3: rebase by Marek

Signed-off-by: Leo Liu <leo.liu at amd.com>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
---
 src/gallium/drivers/radeon/radeon_vce.c        |  1 +
 src/gallium/drivers/radeon/radeon_vce.h        |  1 +
 src/gallium/drivers/radeon/radeon_vce_40_2_2.c | 13 +++++++++++--
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_vce.c b/src/gallium/drivers/radeon/radeon_vce.c
index b8b35b3..d5ae26d 100644
--- a/src/gallium/drivers/radeon/radeon_vce.c
+++ b/src/gallium/drivers/radeon/radeon_vce.c
@@ -353,6 +353,7 @@ struct pipe_video_codec *rvce_create_encoder(struct pipe_context *context,
 	if (!enc)
 		return NULL;
 
+	enc->fw_ver = rscreen->info.vce_fw_version;
 	if (rscreen->info.drm_major == 3)
 		enc->use_vm = true;
 	if ((rscreen->info.drm_major > 2) || (rscreen->info.drm_minor >= 42))
diff --git a/src/gallium/drivers/radeon/radeon_vce.h b/src/gallium/drivers/radeon/radeon_vce.h
index 67ba333..7d37320 100644
--- a/src/gallium/drivers/radeon/radeon_vce.h
+++ b/src/gallium/drivers/radeon/radeon_vce.h
@@ -100,6 +100,7 @@ struct rvce_encoder {
 	struct rvid_buffer		cpb;
 	struct pipe_h264_enc_picture_desc pic;
 	bool				use_vm;
+	unsigned			fw_ver;
 	bool				use_vui;
 };
 
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 1e7f278..f1f4cce 100644
--- a/src/gallium/drivers/radeon/radeon_vce_40_2_2.c
+++ b/src/gallium/drivers/radeon/radeon_vce_40_2_2.c
@@ -44,6 +44,8 @@
 #include "radeon_video.h"
 #include "radeon_vce.h"
 
+#define FW_40_2_2 ((40 << 24) | (2 << 16) | (2 << 8))
+
 static const unsigned profiles[7] = { 66, 77, 88, 100, 110, 122, 244 };
 
 static struct rvce_cpb_slot *current_slot(struct rvce_encoder *enc)
@@ -145,6 +147,10 @@ static void rate_control(struct rvce_encoder *enc)
 	RVCE_CS(0x00000000); // encBPicsDeltaQP
 	RVCE_CS(0x00000000); // encReferenceBPicsDeltaQP
 	RVCE_CS(0x00000000); // encRateControlReInitDisable
+	if (enc->fw_ver > FW_40_2_2) {
+		RVCE_CS(0x00000000); // encLCVBRInitQPFlag
+		RVCE_CS(0x00000000); // encLCVBRSATDBasedNonlinearBitBudgetFlag
+	}
 	RVCE_END();
 }
 
@@ -314,7 +320,10 @@ static void encode(struct rvce_encoder *enc)
 	RVCE_END();
 
 	RVCE_BEGIN(0x03000001); // encode
-	RVCE_CS(0x00000000); // insertHeaders
+	if ((enc->fw_ver > FW_40_2_2) && (!enc->pic.frame_num))
+		RVCE_CS(0x00000011); // insertHeaders
+	else
+		RVCE_CS(0x00000000); // insertHeaders
 	RVCE_CS(0x00000000); // pictureStructure
 	RVCE_CS(enc->bs_size); // allowedMaxBitstreamSize
 	RVCE_CS(0x00000000); // forceRefreshMap
@@ -328,7 +337,7 @@ static void encode(struct rvce_encoder *enc)
 	RVCE_CS(align(enc->luma->npix_y, 16)); // encInputFrameYPitch
 	RVCE_CS(enc->luma->level[0].pitch_bytes); // encInputPicLumaPitch
 	RVCE_CS(enc->chroma->level[0].pitch_bytes); // encInputPicChromaPitch
-	RVCE_CS(0x00000000); // encInputPic(Addr|Array)Mode
+	RVCE_CS(0x00000000); // encInputPic(Addr|Array)Mode,encDisable(TwoPipeMode|MBOffloading)
 	RVCE_CS(0x00000000); // encInputPicTileConfig
 	RVCE_CS(enc->pic.picture_type); // encPicType
 	RVCE_CS(enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_IDR); // encIdrFlag
-- 
2.1.0



More information about the mesa-dev mailing list