Commit 8f3b41dc authored by Stanimir Varbanov's avatar Stanimir Varbanov Committed by Mauro Carvalho Chehab
Browse files

media: venus: Rename venus_caps to hfi_plat_caps



Now when we have hfi platform make venus capabilities an
hfi platform capabilities.

Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent aa603389
Loading
Loading
Loading
Loading
+3 −27
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@

#include "dbgfs.h"
#include "hfi.h"
#include "hfi_platform.h"

#define VDBGL	"VenusLow : "
#define VDBGM	"VenusMed : "
@@ -82,31 +83,6 @@ struct venus_format {
	u32 flags;
};

#define MAX_PLANES		4
#define MAX_FMT_ENTRIES		32
#define MAX_CAP_ENTRIES		32
#define MAX_ALLOC_MODE_ENTRIES	16
#define MAX_CODEC_NUM		32
#define MAX_SESSIONS		16

struct raw_formats {
	u32 buftype;
	u32 fmt;
};

struct venus_caps {
	u32 codec;
	u32 domain;
	bool cap_bufs_mode_dynamic;
	unsigned int num_caps;
	struct hfi_capability caps[MAX_CAP_ENTRIES];
	unsigned int num_pl;
	struct hfi_profile_level pl[HFI_MAX_PROFILE_COUNT];
	unsigned int num_fmts;
	struct raw_formats fmts[MAX_FMT_ENTRIES];
	bool valid;	/* used only for Venus v1xx */
};

/**
 * struct venus_core - holds core parameters valid for all instances
 *
@@ -185,7 +161,7 @@ struct venus_core {
	void *priv;
	const struct hfi_ops *ops;
	struct delayed_work work;
	struct venus_caps caps[MAX_CODEC_NUM];
	struct hfi_plat_caps caps[MAX_CODEC_NUM];
	unsigned int codecs_count;
	unsigned int core0_usage_count;
	unsigned int core1_usage_count;
@@ -420,7 +396,7 @@ static inline void *to_hfi_priv(struct venus_core *core)
	return core->priv;
}

static inline struct venus_caps *
static inline struct hfi_plat_caps *
venus_caps_by_codec(struct venus_core *core, u32 codec, u32 domain)
{
	unsigned int c;
+3 −3
Original line number Diff line number Diff line
@@ -481,7 +481,7 @@ session_process_buf(struct venus_inst *inst, struct vb2_v4l2_buffer *vbuf)
static bool is_dynamic_bufmode(struct venus_inst *inst)
{
	struct venus_core *core = inst->core;
	struct venus_caps *caps;
	struct hfi_plat_caps *caps;

	/*
	 * v4 doesn't send BUFFER_ALLOC_MODE_SUPPORTED property and supports
@@ -1531,7 +1531,7 @@ void venus_helper_init_instance(struct venus_inst *inst)
}
EXPORT_SYMBOL_GPL(venus_helper_init_instance);

static bool find_fmt_from_caps(struct venus_caps *caps, u32 buftype, u32 fmt)
static bool find_fmt_from_caps(struct hfi_plat_caps *caps, u32 buftype, u32 fmt)
{
	unsigned int i;

@@ -1548,7 +1548,7 @@ int venus_helper_get_out_fmts(struct venus_inst *inst, u32 v4l2_fmt,
			      u32 *out_fmt, u32 *out2_fmt, bool ubwc)
{
	struct venus_core *core = inst->core;
	struct venus_caps *caps;
	struct hfi_plat_caps *caps;
	u32 ubwc_fmt, fmt = to_hfi_raw_fmt(v4l2_fmt);
	bool found, found_ubwc;

+9 −9
Original line number Diff line number Diff line
@@ -11,12 +11,12 @@
#include "hfi_helper.h"
#include "hfi_parser.h"

typedef void (*func)(struct venus_caps *cap, const void *data,
typedef void (*func)(struct hfi_plat_caps *cap, const void *data,
		     unsigned int size);

static void init_codecs(struct venus_core *core)
{
	struct venus_caps *caps = core->caps, *cap;
	struct hfi_plat_caps *caps = core->caps, *cap;
	unsigned long bit;

	for_each_set_bit(bit, &core->dec_codecs, MAX_CODEC_NUM) {
@@ -34,11 +34,11 @@ static void init_codecs(struct venus_core *core)
	}
}

static void for_each_codec(struct venus_caps *caps, unsigned int caps_num,
static void for_each_codec(struct hfi_plat_caps *caps, unsigned int caps_num,
			   u32 codecs, u32 domain, func cb, void *data,
			   unsigned int size)
{
	struct venus_caps *cap;
	struct hfi_plat_caps *cap;
	unsigned int i;

	for (i = 0; i < caps_num; i++) {
@@ -51,7 +51,7 @@ static void for_each_codec(struct venus_caps *caps, unsigned int caps_num,
}

static void
fill_buf_mode(struct venus_caps *cap, const void *data, unsigned int num)
fill_buf_mode(struct hfi_plat_caps *cap, const void *data, unsigned int num)
{
	const u32 *type = data;

@@ -81,7 +81,7 @@ parse_alloc_mode(struct venus_core *core, u32 codecs, u32 domain, void *data)
	}
}

static void fill_profile_level(struct venus_caps *cap, const void *data,
static void fill_profile_level(struct hfi_plat_caps *cap, const void *data,
			       unsigned int num)
{
	const struct hfi_profile_level *pl = data;
@@ -107,7 +107,7 @@ parse_profile_level(struct venus_core *core, u32 codecs, u32 domain, void *data)
}

static void
fill_caps(struct venus_caps *cap, const void *data, unsigned int num)
fill_caps(struct hfi_plat_caps *cap, const void *data, unsigned int num)
{
	const struct hfi_capability *caps = data;

@@ -132,7 +132,7 @@ parse_caps(struct venus_core *core, u32 codecs, u32 domain, void *data)
		       fill_caps, caps_arr, num_caps);
}

static void fill_raw_fmts(struct venus_caps *cap, const void *fmts,
static void fill_raw_fmts(struct hfi_plat_caps *cap, const void *fmts,
			  unsigned int num_fmts)
{
	const struct raw_formats *formats = fmts;
@@ -211,7 +211,7 @@ static void parser_init(struct venus_inst *inst, u32 *codecs, u32 *domain)

static void parser_fini(struct venus_inst *inst, u32 codecs, u32 domain)
{
	struct venus_caps *caps, *cap;
	struct hfi_plat_caps *caps, *cap;
	unsigned int i;
	u32 dom;

+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ static inline u32 get_cap(struct venus_inst *inst, u32 type, u32 which)
{
	struct venus_core *core = inst->core;
	struct hfi_capability *cap = NULL;
	struct venus_caps *caps;
	struct hfi_plat_caps *caps;
	unsigned int i;

	caps = venus_caps_by_codec(core, inst->hfi_codec, inst->session_type);
+25 −0
Original line number Diff line number Diff line
@@ -12,6 +12,31 @@
#include "hfi.h"
#include "hfi_helper.h"

#define MAX_PLANES		4
#define MAX_FMT_ENTRIES		32
#define MAX_CAP_ENTRIES		32
#define MAX_ALLOC_MODE_ENTRIES	16
#define MAX_CODEC_NUM		32
#define MAX_SESSIONS		16

struct raw_formats {
	u32 buftype;
	u32 fmt;
};

struct hfi_plat_caps {
	u32 codec;
	u32 domain;
	bool cap_bufs_mode_dynamic;
	unsigned int num_caps;
	struct hfi_capability caps[MAX_CAP_ENTRIES];
	unsigned int num_pl;
	struct hfi_profile_level pl[HFI_MAX_PROFILE_COUNT];
	unsigned int num_fmts;
	struct raw_formats fmts[MAX_FMT_ENTRIES];
	bool valid;	/* used only for Venus v1xx */
};

struct hfi_platform_codec_freq_data {
	u32 pixfmt;
	u32 session_type;