Commit 6f786950 authored by Alex Deucher's avatar Alex Deucher
Browse files

drm/amdgpu/codec: drop the internal codec index



And just use the ioctl index.  They are the same.

Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b50368da
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -584,15 +584,6 @@ enum amd_reset_method {
	AMD_RESET_METHOD_PCI,
};

#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;
+8 −8
Original line number Diff line number Diff line
@@ -1012,14 +1012,14 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
			int idx = codecs->codec_array[i].codec_type;

			switch (idx) {
			case AMDGPU_VIDEO_CODEC_TYPE_MPEG2:
			case AMDGPU_VIDEO_CODEC_TYPE_MPEG4:
			case AMDGPU_VIDEO_CODEC_TYPE_MPEG4_AVC:
			case AMDGPU_VIDEO_CODEC_TYPE_VC1:
			case AMDGPU_VIDEO_CODEC_TYPE_HEVC:
			case AMDGPU_VIDEO_CODEC_TYPE_JPEG:
			case AMDGPU_VIDEO_CODEC_TYPE_VP9:
			case AMDGPU_VIDEO_CODEC_TYPE_AV1:
			case AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2:
			case AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4:
			case AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1:
			case AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC:
			case AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC:
			case AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG:
			case AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9:
			case AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1:
				caps->codec_info[idx].valid = 1;
				caps->codec_info[idx].max_width =
					codecs->codec_array[i].max_width;
+7 −5
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@
#include <linux/module.h>
#include <linux/pci.h>

#include <drm/amdgpu_drm.h>

#include "amdgpu.h"
#include "amdgpu_atombios.h"
#include "amdgpu_ih.h"
@@ -73,7 +75,7 @@
static const struct amdgpu_video_codec_info cik_video_codecs_encode_array[] =
{
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_MPEG4_AVC,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC,
		.max_width = 2048,
		.max_height = 1152,
		.max_pixels_per_frame = 2048 * 1152,
@@ -90,28 +92,28 @@ static const struct amdgpu_video_codecs cik_video_codecs_encode =
static const struct amdgpu_video_codec_info cik_video_codecs_decode_array[] =
{
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_MPEG2,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2,
		.max_width = 2048,
		.max_height = 1152,
		.max_pixels_per_frame = 2048 * 1152,
		.max_level = 3,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_MPEG4,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4,
		.max_width = 2048,
		.max_height = 1152,
		.max_pixels_per_frame = 2048 * 1152,
		.max_level = 5,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_MPEG4_AVC,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC,
		.max_width = 2048,
		.max_height = 1152,
		.max_pixels_per_frame = 2048 * 1152,
		.max_level = 41,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_VC1,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1,
		.max_width = 2048,
		.max_height = 1152,
		.max_pixels_per_frame = 2048 * 1152,
+19 −17
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@
#include <linux/module.h>
#include <linux/pci.h>

#include <drm/amdgpu_drm.h>

#include "amdgpu.h"
#include "amdgpu_atombios.h"
#include "amdgpu_ih.h"
@@ -69,14 +71,14 @@ static const struct amd_ip_funcs nv_common_ip_funcs;
static const struct amdgpu_video_codec_info nv_video_codecs_encode_array[] =
{
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_MPEG4_AVC,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC,
		.max_width = 4096,
		.max_height = 2304,
		.max_pixels_per_frame = 4096 * 2304,
		.max_level = 0,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_HEVC,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC,
		.max_width = 4096,
		.max_height = 2304,
		.max_pixels_per_frame = 4096 * 2304,
@@ -94,49 +96,49 @@ static const struct amdgpu_video_codecs nv_video_codecs_encode =
static const struct amdgpu_video_codec_info nv_video_codecs_decode_array[] =
{
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_MPEG2,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2,
		.max_width = 4096,
		.max_height = 4096,
		.max_pixels_per_frame = 4096 * 4096,
		.max_level = 3,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_MPEG4,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4,
		.max_width = 4096,
		.max_height = 4096,
		.max_pixels_per_frame = 4096 * 4096,
		.max_level = 5,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_MPEG4_AVC,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC,
		.max_width = 4096,
		.max_height = 4096,
		.max_pixels_per_frame = 4096 * 4096,
		.max_level = 52,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_VC1,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1,
		.max_width = 4096,
		.max_height = 4096,
		.max_pixels_per_frame = 4096 * 4096,
		.max_level = 4,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_HEVC,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC,
		.max_width = 8192,
		.max_height = 4352,
		.max_pixels_per_frame = 8192 * 4352,
		.max_level = 186,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_JPEG,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG,
		.max_width = 4096,
		.max_height = 4096,
		.max_pixels_per_frame = 4096 * 4096,
		.max_level = 0,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_VP9,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9,
		.max_width = 8192,
		.max_height = 4352,
		.max_pixels_per_frame = 8192 * 4352,
@@ -154,56 +156,56 @@ static const struct amdgpu_video_codecs nv_video_codecs_decode =
static const struct amdgpu_video_codec_info sc_video_codecs_decode_array[] =
{
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_MPEG2,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2,
		.max_width = 4096,
		.max_height = 4096,
		.max_pixels_per_frame = 4096 * 4096,
		.max_level = 3,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_MPEG4,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4,
		.max_width = 4096,
		.max_height = 4096,
		.max_pixels_per_frame = 4096 * 4096,
		.max_level = 5,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_MPEG4_AVC,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC,
		.max_width = 4096,
		.max_height = 4096,
		.max_pixels_per_frame = 4096 * 4096,
		.max_level = 52,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_VC1,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1,
		.max_width = 4096,
		.max_height = 4096,
		.max_pixels_per_frame = 4096 * 4096,
		.max_level = 4,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_HEVC,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC,
		.max_width = 8192,
		.max_height = 4352,
		.max_pixels_per_frame = 8192 * 4352,
		.max_level = 186,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_JPEG,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG,
		.max_width = 4096,
		.max_height = 4096,
		.max_pixels_per_frame = 4096 * 4096,
		.max_level = 0,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_VP9,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9,
		.max_width = 8192,
		.max_height = 4352,
		.max_pixels_per_frame = 8192 * 4352,
		.max_level = 0,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_AV1,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1,
		.max_width = 8192,
		.max_height = 4352,
		.max_pixels_per_frame = 8192 * 4352,
+7 −5
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@
#include <linux/module.h>
#include <linux/pci.h>

#include <drm/amdgpu_drm.h>

#include "amdgpu.h"
#include "amdgpu_atombios.h"
#include "amdgpu_ih.h"
@@ -911,7 +913,7 @@ static const u32 hainan_mgcg_cgcg_init[] =
static const struct amdgpu_video_codec_info tahiti_video_codecs_encode_array[] =
{
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_MPEG4_AVC,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC,
		.max_width = 2048,
		.max_height = 1152,
		.max_pixels_per_frame = 2048 * 1152,
@@ -942,28 +944,28 @@ static const struct amdgpu_video_codecs hainan_video_codecs_encode =
static const struct amdgpu_video_codec_info tahiti_video_codecs_decode_array[] =
{
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_MPEG2,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2,
		.max_width = 2048,
		.max_height = 1152,
		.max_pixels_per_frame = 2048 * 1152,
		.max_level = 3,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_MPEG4,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4,
		.max_width = 2048,
		.max_height = 1152,
		.max_pixels_per_frame = 2048 * 1152,
		.max_level = 5,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_MPEG4_AVC,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC,
		.max_width = 2048,
		.max_height = 1152,
		.max_pixels_per_frame = 2048 * 1152,
		.max_level = 41,
	},
	{
		.codec_type = AMDGPU_VIDEO_CODEC_TYPE_VC1,
		.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1,
		.max_width = 2048,
		.max_height = 1152,
		.max_pixels_per_frame = 2048 * 1152,
Loading