Re: [PATCH] venus: replace arrary index with enum for supported formats

From: Stanimir Varbanov
Date: Thu May 25 2023 - 18:12:51 EST


Hi Konrad,

On 23.05.23 г. 11:02 ч., Konrad Dybcio wrote:


On 22.05.2023 08:17, Dikshita Agarwal wrote:
Use enums to list supported formats for encoder and decoder
instead of array index which was a error prone design.

Signed-off-by: Dikshita Agarwal <quic_dikshita@xxxxxxxxxxx>
---
Thanks a lot.

Reviewed-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxx>

drivers/media/platform/qcom/venus/core.h | 16 ++++++++
drivers/media/platform/qcom/venus/vdec.c | 63 +++++++++++++++++++-------------
drivers/media/platform/qcom/venus/venc.c | 31 +++++++++-------
3 files changed, 72 insertions(+), 38 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h
index 12a42fb..e988ed4 100644
--- a/drivers/media/platform/qcom/venus/core.h
+++ b/drivers/media/platform/qcom/venus/core.h
@@ -83,6 +83,22 @@ struct venus_resources {
const char *fwname;
};
+enum venus_fmt {
+ VENUS_FMT_NV12 = 0,
+ VENUS_FMT_QC08C = 1,
+ VENUS_FMT_QC10C = 2,
+ VENUS_FMT_H264 = 3,
+ VENUS_FMT_VP8 = 4,
+ VENUS_FMT_VP9 = 5,
+ VENUS_FMT_HEVC = 6,
+ VENUS_FMT_VC1_ANNEX_G = 7,
+ VENUS_FMT_VC1_ANNEX_L = 8,
+ VENUS_FMT_MPEG4 = 9,
+ VENUS_FMT_MPEG2 = 10,
+ VENUS_FMT_H263 = 11,
+ VENUS_FMT_XVID = 12,
Nit: I don't think the '= n' is necessary here, as it doesn't
map to anything in hw/fw (or does it?)

IMO, the numbers could help when debugging to avoid counting.


Konrad
--
regards,
Stan