Skip to contentSkip to conversation

amdgpu video codec support addition and code optimization

PATCH In review [email protected] 2 participants 4 messages Jul 13, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover amdgpu video codec support addition and code optimization

From: Veerabadhran Gopalakrishnan <[email protected]>

Patch 1 - Added the list of supported codecs for yellow carp in the codec query. Patch 2 - Code optimization for the codec info structure initialization.

Veerabadhran Gopalakrishnan (2):
amdgpu/nv.c - Added video codec support for Yellow Carp amdgpu/nv.c - Optimize code for video codec support structure

 drivers/gpu/drm/amd/amdgpu/amdgpu.h |   7 +
 drivers/gpu/drm/amd/amdgpu/nv.c     | 243 ++++++----------------------
 drivers/gpu/drm/amd/amdgpu/soc15.c  | 176 +++-----------------
 3 files changed, 75 insertions(+), 351 deletions(-)
Signature · 6 lines
2.25.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw

PATCH 1/2 amdgpu/nv.c - Added video codec support for Yellow Carp

From: Veerabadhran Gopalakrishnan <[email protected]>

Added the supported codecs in the video capabilities query.

---
 drivers/gpu/drm/amd/amdgpu/nv.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/nv.c +19 -1
index 94a2c0742..04f6cf38c 100644
@@ -333,6 +333,19 @@ static const struct amdgpu_video_codecs bg_video_codecs_encode = {
 	.codec_array = NULL,
 };
 
+/* Yellow Carp*/
+static const struct amdgpu_video_codec_info yc_video_codecs_decode_array[] = {
+	{codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4906, 52)},
+	{codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 186)},
+	{codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 8192, 4352, 0)},
+	{codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 4096, 4096, 0)},
+};
+
+static const struct amdgpu_video_codecs yc_video_codecs_decode = {
+	.codec_count = ARRAY_SIZE(bg_video_codecs_decode_array),
+	.codec_array = bg_video_codecs_decode_array,
+};
+
 static int nv_query_video_codecs(struct amdgpu_device *adev, bool encode,
 				 const struct amdgpu_video_codecs **codecs)
 {
@@ -353,12 +366,17 @@ static int nv_query_video_codecs(struct amdgpu_device *adev, bool encode,
 	case CHIP_NAVY_FLOUNDER:
 	case CHIP_DIMGREY_CAVEFISH:
 	case CHIP_VANGOGH:
-	case CHIP_YELLOW_CARP:
 		if (encode)
 			*codecs = &nv_video_codecs_encode;
 		else
 			*codecs = &sc_video_codecs_decode;
 		return 0;
+	case CHIP_YELLOW_CARP:
+		if (encode)
+			*codecs = &nv_video_codecs_encode;
+		else
+			*codecs = &yc_video_codecs_decode;
+		return 0;
 	case CHIP_BEIGE_GOBY:
 		if (encode)
 			*codecs = &bg_video_codecs_encode;
Signature · 6 lines
2.25.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] amdgpu/nv.c - Added video codec support for Yellow Carp

[AMD Official Use Only]

James Zhu

________________________________
From: Gopalakrishnan, Veerabadhran (Veera) <[email protected]>
Sent: Tuesday, July 13, 2021 2:48 PM
To: [email protected] <[email protected]>
Cc: Liu, Leo <[email protected]>; Zhu, James <[email protected]>; Zhang, Boyuan <[email protected]>; Rao, Srinath <[email protected]>; Gopalakrishnan, Veerabadhran (Veera) <[email protected]>
Subject: [PATCH 1/2] amdgpu/nv.c - Added video codec support for Yellow Carp

From: Veerabadhran Gopalakrishnan <[email protected]>

Added the supported codecs in the video capabilities query.

---
 drivers/gpu/drm/amd/amdgpu/nv.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/nv.c +19 -1
index 94a2c0742..04f6cf38c 100644
@@ -333,6 +333,19 @@ static const struct amdgpu_video_codecs bg_video_codecs_encode = {
         .codec_array = NULL,
 };
 
+/* Yellow Carp*/
+static const struct amdgpu_video_codec_info yc_video_codecs_decode_array[] = {
+       {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4906, 52)},
+       {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 186)},
+       {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 8192, 4352, 0)},
+       {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 4096, 4096, 0)},
+};
+
+static const struct amdgpu_video_codecs yc_video_codecs_decode = {
+       .codec_count = ARRAY_SIZE(bg_video_codecs_decode_array),
+       .codec_array = bg_video_codecs_decode_array,
+};
+
 static int nv_query_video_codecs(struct amdgpu_device *adev, bool encode,
                                  const struct amdgpu_video_codecs **codecs)
 {
@@ -353,12 +366,17 @@ static int nv_query_video_codecs(struct amdgpu_device *adev, bool encode,
         case CHIP_NAVY_FLOUNDER:
         case CHIP_DIMGREY_CAVEFISH:
         case CHIP_VANGOGH:
-       case CHIP_YELLOW_CARP:
                 if (encode)
                         *codecs = &nv_video_codecs_encode;
                 else
                         *codecs = &sc_video_codecs_decode;
                 return 0;
+       case CHIP_YELLOW_CARP:
+               if (encode)
+                       *codecs = &nv_video_codecs_encode;
+               else
+                       *codecs = &yc_video_codecs_decode;
+               return 0;
         case CHIP_BEIGE_GOBY:
                 if (encode)
                         *codecs = &bg_video_codecs_encode;

--
2.25.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw

PATCH 2/2 amdgpu/nv.c - Optimize code for video codec support structure

In reply to [email protected]

From: Veerabadhran Gopalakrishnan <[email protected]>

Optimized the code for codec info structure initialization

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h |   7 +
 drivers/gpu/drm/amd/amdgpu/nv.c     | 223 ++++------------------------
 drivers/gpu/drm/amd/amdgpu/soc15.c  | 176 +++-------------------
 3 files changed, 56 insertions(+), 350 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +7 -0
index d14b4968a..61a0897e9 100644
@@ -619,6 +619,13 @@ struct amdgpu_video_codec_info {
 	u32 max_level;
 };
 
+#define codec_info_build(type, width, height, level) \
+			 .codec_type = type,\
+			 .max_width = width,\
+			 .max_height = height,\
+			 .max_pixels_per_frame = height * width,\
+			 .max_level = level,
+
 struct amdgpu_video_codecs {
 	const u32 codec_count;
 	const struct amdgpu_video_codec_info *codec_array;
drivers/gpu/drm/amd/amdgpu/nv.c +27 -196

256 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/soc15.c +22 -154

200 lines not on this page · raw message

Signature · 6 lines
2.25.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx