[PATCH 1/4] drm/amdgpu: add asic callback for querying video codec info (v2)
Alex Deucher
alexdeucher at gmail.com
Wed Jan 27 05:32:28 UTC 2021
This will be used by a new INFO ioctl query to fetch the decode
and encode capabilities from the kernel driver rather than
hardcoding them in mesa. This gives us more fine grained control
of capabilities using information that is only availabl in the
kernel (e.g., platform limitations or bandwidth restrictions).
v2: reorder the codecs to better align with mesa
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index f4ff8ddb52d4..3ff8d08e3cf0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -582,6 +582,27 @@ enum amd_reset_method {
AMD_RESET_METHOD_BACO
};
+#define AMDGPU_VIDEO_CODEC_TYPE_MPEG2 0
+#define AMDGPU_VIDEO_CODEC_TYPE_MPEG4 1
+#define AMDGPU_VIDEO_CODEC_TYPE_VC1 2
+#define AMDGPU_VIDEO_CODEC_TYPE_MPEG4_AVC 3
+#define AMDGPU_VIDEO_CODEC_TYPE_HEVC 4
+#define AMDGPU_VIDEO_CODEC_TYPE_JPEG 5
+#define AMDGPU_VIDEO_CODEC_TYPE_VP9 6
+#define AMDGPU_VIDEO_CODEC_TYPE_AV1 7
+
+struct amdgpu_video_codec_info {
+ u32 codec_type;
+ u32 max_width;
+ u32 max_height;
+ u32 max_level;
+};
+
+struct amdgpu_video_codecs {
+ const u32 codec_count;
+ const struct amdgpu_video_codec_info *codec_array;
+};
+
/*
* ASIC specific functions.
*/
@@ -626,6 +647,9 @@ struct amdgpu_asic_funcs {
void (*pre_asic_init)(struct amdgpu_device *adev);
/* enter/exit umd stable pstate */
int (*update_umd_stable_pstate)(struct amdgpu_device *adev, bool enter);
+ /* query video codecs */
+ int (*query_video_codecs)(struct amdgpu_device *adev, bool encode,
+ const struct amdgpu_video_codecs **codecs);
};
/*
@@ -1218,6 +1242,7 @@ int emu_soc_asic_init(struct amdgpu_device *adev);
#define amdgpu_asic_pre_asic_init(adev) (adev)->asic_funcs->pre_asic_init((adev))
#define amdgpu_asic_update_umd_stable_pstate(adev, enter) \
((adev)->asic_funcs->update_umd_stable_pstate ? (adev)->asic_funcs->update_umd_stable_pstate((adev), (enter)) : 0)
+#define amdgpu_asic_query_video_codecs(adev, e, c) (adev)->asic_funcs->query_video_codecs((adev), (e), (c))
#define amdgpu_inc_vram_lost(adev) atomic_inc(&((adev)->vram_lost_counter));
--
2.29.2
More information about the amd-gfx
mailing list