[Mesa-dev] [PATCH 2/4] radeon/uvd: move polaris fw check into radeon_video.c

Christian König deathsimple at vodafone.de
Thu Jul 7 09:57:16 UTC 2016


From: Christian König <christian.koenig at amd.com>

It's actually not very clever to claim to support H.264
and then fail to create a decoder.

Signed-off-by: Christian König <christian.koenig at amd.com>
---
 src/gallium/drivers/radeon/radeon_uvd.c   |  8 --------
 src/gallium/drivers/radeon/radeon_video.c | 16 +++++++++++++---
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_uvd.c b/src/gallium/drivers/radeon/radeon_uvd.c
index 7223417..52658fa 100644
--- a/src/gallium/drivers/radeon/radeon_uvd.c
+++ b/src/gallium/drivers/radeon/radeon_uvd.c
@@ -60,8 +60,6 @@
 #define FB_BUFFER_SIZE_TONGA (2048 * 64)
 #define IT_SCALING_TABLE_SIZE 992
 
-#define FW_1_66_16 ((1 << 24) | (66 << 16) | (16 << 8))
-
 /* UVD decoder representation */
 struct ruvd_decoder {
 	struct pipe_video_codec		base;
@@ -1185,12 +1183,6 @@ struct pipe_video_codec *ruvd_create_decoder(struct pipe_context *context,
 		height = align(height, VL_MACROBLOCK_HEIGHT);
 		break;
 	case PIPE_VIDEO_FORMAT_MPEG4_AVC:
-		if ((info.family == CHIP_POLARIS10 || info.family == CHIP_POLARIS11) &&
-		    info.uvd_fw_version < FW_1_66_16 ) {
-			RVID_ERR("POLARIS10/11 firmware version need to be updated.\n");
-			return NULL;
-		}
-
 		width = align(width, VL_MACROBLOCK_WIDTH);
 		height = align(height, VL_MACROBLOCK_HEIGHT);
 		break;
diff --git a/src/gallium/drivers/radeon/radeon_video.c b/src/gallium/drivers/radeon/radeon_video.c
index 69e4416..a26668b 100644
--- a/src/gallium/drivers/radeon/radeon_video.c
+++ b/src/gallium/drivers/radeon/radeon_video.c
@@ -43,6 +43,8 @@
 #include "radeon_video.h"
 #include "radeon_vce.h"
 
+#define FW_1_66_16 ((1 << 24) | (66 << 16) | (16 << 8))
+
 /* generate an stream handle */
 unsigned rvid_alloc_stream_handle()
 {
@@ -206,6 +208,9 @@ int rvid_get_video_param(struct pipe_screen *screen,
 {
 	struct r600_common_screen *rscreen = (struct r600_common_screen *)screen;
 	enum pipe_video_format codec = u_reduce_video_profile(profile);
+	struct radeon_info info;
+
+	rscreen->ws->query_info(rscreen->ws, &info);
 
 	if (entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
 		switch (param) {
@@ -239,10 +244,15 @@ int rvid_get_video_param(struct pipe_screen *screen,
 		case PIPE_VIDEO_FORMAT_MPEG12:
 			return profile != PIPE_VIDEO_PROFILE_MPEG1;
 		case PIPE_VIDEO_FORMAT_MPEG4:
+			/* no support for MPEG4 on older hw */
+			return rscreen->family >= CHIP_PALM;
 		case PIPE_VIDEO_FORMAT_MPEG4_AVC:
-			if (rscreen->family < CHIP_PALM)
-				/* no support for MPEG4 */
-				return codec != PIPE_VIDEO_FORMAT_MPEG4;
+			if ((rscreen->family == CHIP_POLARIS10 ||
+			     rscreen->family == CHIP_POLARIS11) &&
+			    info.uvd_fw_version < FW_1_66_16 ) {
+				RVID_ERR("POLARIS10/11 firmware version need to be updated.\n");
+				return false;
+			}
 			return true;
 		case PIPE_VIDEO_FORMAT_VC1:
 			return true;
-- 
2.5.0



More information about the mesa-dev mailing list