From: Andrzej Hajda <a.hajda@samsung.com>
To: Smitha T Murthy <smitha.t@samsung.com>,
linux-arm-kernel@lists.infradead.org,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: kyungmin.park@samsung.com, kamil@wypas.org, jtp.park@samsung.com,
mchehab@kernel.org, pankaj.dubey@samsung.com, krzk@kernel.org,
m.szyprowski@samsung.com, s.nawrocki@samsung.com
Subject: Re: [PATCH 05/11] [media] s5p-mfc: Add support for HEVC decoder
Date: Thu, 02 Feb 2017 09:20:53 +0100 [thread overview]
Message-ID: <840f5d3f-6075-ea4a-696d-68cc7807df0d@samsung.com> (raw)
In-Reply-To: <0b8c3503-ea16-99dc-d2be-85c122eac564@samsung.com>
On 02.02.2017 08:58, Andrzej Hajda wrote:
> On 18.01.2017 11:02, Smitha T Murthy wrote:
>> Add support for codec definition and corresponding buffer
>> requirements for HEVC decoder.
>>
>> Signed-off-by: Smitha T Murthy <smitha.t@samsung.com>
>> ---
>> drivers/media/platform/s5p-mfc/regs-mfc-v10.h | 3 +++
>> drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c | 3 +++
>> drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 1 +
>> drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 8 ++++++++
>> drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | 18 ++++++++++++++++--
>> drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h | 5 +++++
>> 6 files changed, 36 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v10.h b/drivers/media/platform/s5p-mfc/regs-mfc-v10.h
>> index 153ee68..a57009a 100644
>> --- a/drivers/media/platform/s5p-mfc/regs-mfc-v10.h
>> +++ b/drivers/media/platform/s5p-mfc/regs-mfc-v10.h
>> @@ -32,6 +32,9 @@
>> #define MFC_VERSION_V10 0xA0
>> #define MFC_NUM_PORTS_V10 1
>>
>> +/* MFCv10 codec defines*/
>> +#define S5P_FIMV_CODEC_HEVC_DEC 17
>> +
>> /* Encoder buffer size for MFC v10.0 */
>> #define ENC_V100_H264_ME_SIZE(x, y) \
>> (((x + 3) * (y + 3) * 8) \
>> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
>> index b1b1491..76eca67 100644
>> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
>> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
>> @@ -101,6 +101,9 @@ static int s5p_mfc_open_inst_cmd_v6(struct s5p_mfc_ctx *ctx)
>> case S5P_MFC_CODEC_VP8_DEC:
>> codec_type = S5P_FIMV_CODEC_VP8_DEC_V6;
>> break;
>> + case S5P_MFC_CODEC_HEVC_DEC:
>> + codec_type = S5P_FIMV_CODEC_HEVC_DEC;
>> + break;
>> case S5P_MFC_CODEC_H264_ENC:
>> codec_type = S5P_FIMV_CODEC_H264_ENC_V6;
>> break;
>> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
>> index 998e24b..5c46060 100644
>> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
>> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
>> @@ -79,6 +79,7 @@ static inline dma_addr_t s5p_mfc_mem_cookie(void *a, void *b)
>> #define S5P_MFC_CODEC_H263_DEC 5
>> #define S5P_MFC_CODEC_VC1RCV_DEC 6
>> #define S5P_MFC_CODEC_VP8_DEC 7
>> +#define S5P_MFC_CODEC_HEVC_DEC 17
>>
>> #define S5P_MFC_CODEC_H264_ENC 20
>> #define S5P_MFC_CODEC_H264_MVC_ENC 21
>> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
>> index 784b28e..9f459b3 100644
>> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
>> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
>> @@ -156,6 +156,14 @@
>> .versions = MFC_V6_BIT | MFC_V7_BIT | MFC_V8_BIT |
>> MFC_V10_BIT,
>> },
>> + {
>> + .name = "HEVC Encoded Stream",
>> + .fourcc = V4L2_PIX_FMT_HEVC,
>> + .codec_mode = S5P_FIMV_CODEC_HEVC_DEC,
>> + .type = MFC_FMT_DEC,
>> + .num_planes = 1,
>> + .versions = MFC_V10_BIT,
>> + },
>> };
>>
>> #define NUM_FORMATS ARRAY_SIZE(formats)
>> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
>> index 369210a..b6cb280 100644
>> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
>> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
>> @@ -220,6 +220,13 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx)
>> S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6);
>> ctx->bank1.size = ctx->scratch_buf_size;
>> break;
>> + case S5P_MFC_CODEC_HEVC_DEC:
>> + mfc_debug(2, "Use min scratch buffer size\n");
>> + ctx->scratch_buf_size = ALIGN(ctx->scratch_buf_size, 256);
> Again alignment of something which should be already aligned, and magic
> number instead of S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6.
>
>> + ctx->bank1.size =
>> + ctx->scratch_buf_size +
>> + (ctx->mv_count * ctx->mv_size);
>> + break;
>> case S5P_MFC_CODEC_H264_ENC:
>> if (IS_MFCV10(dev)) {
>> mfc_debug(2, "Use min scratch buffer size\n");
>> @@ -322,6 +329,7 @@ static int s5p_mfc_alloc_instance_buffer_v6(struct s5p_mfc_ctx *ctx)
>> switch (ctx->codec_mode) {
>> case S5P_MFC_CODEC_H264_DEC:
>> case S5P_MFC_CODEC_H264_MVC_DEC:
>> + case S5P_MFC_CODEC_HEVC_DEC:
>> ctx->ctx.size = buf_size->h264_dec_ctx;
>> break;
>> case S5P_MFC_CODEC_MPEG4_DEC:
>> @@ -438,6 +446,10 @@ static void s5p_mfc_dec_calc_dpb_size_v6(struct s5p_mfc_ctx *ctx)
>> ctx->img_height);
>> ctx->mv_size = ALIGN(ctx->mv_size, 16);
>> }
>> + } else if (ctx->codec_mode == S5P_MFC_CODEC_HEVC_DEC) {
>> + ctx->mv_size = s5p_mfc_dec_hevc_mv_size(ctx->img_width,
>> + ctx->img_height);
>> + ctx->mv_size = ALIGN(ctx->mv_size, 32);
> Again, unnecessary alignment, result of s5p_mfc_dec_hevc_mv_size is
> already aligned to 256.
>
>> } else {
>> ctx->mv_size = 0;
>> }
>> @@ -526,7 +538,8 @@ static int s5p_mfc_set_dec_frame_buffer_v6(struct s5p_mfc_ctx *ctx)
>> buf_size1 -= ctx->scratch_buf_size;
>>
>> if (ctx->codec_mode == S5P_FIMV_CODEC_H264_DEC ||
>> - ctx->codec_mode == S5P_FIMV_CODEC_H264_MVC_DEC){
>> + ctx->codec_mode == S5P_FIMV_CODEC_H264_MVC_DEC ||
>> + ctx->codec_mode == S5P_FIMV_CODEC_HEVC_DEC) {
>> writel(ctx->mv_size, mfc_regs->d_mv_buffer_size);
>> writel(ctx->mv_count, mfc_regs->d_num_mv);
>> }
>> @@ -549,7 +562,8 @@ static int s5p_mfc_set_dec_frame_buffer_v6(struct s5p_mfc_ctx *ctx)
>> mfc_regs->d_second_plane_dpb + i * 4);
>> }
>> if (ctx->codec_mode == S5P_MFC_CODEC_H264_DEC ||
>> - ctx->codec_mode == S5P_MFC_CODEC_H264_MVC_DEC) {
>> + ctx->codec_mode == S5P_MFC_CODEC_H264_MVC_DEC ||
>> + ctx->codec_mode == S5P_MFC_CODEC_HEVC_DEC) {
>> for (i = 0; i < ctx->mv_count; i++) {
>> /* To test alignment */
>> align_gap = buf_addr1;
>> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h
>> index 2b5a9f4..2e404d8 100644
>> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h
>> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h
>> @@ -29,6 +29,11 @@
>> #define enc_lcu_width(x_size) ((x_size + 31) / 32)
>> #define enc_lcu_height(y_size) ((y_size + 31) / 32)
>>
>> +#define dec_lcu_width(x_size) ((x_size + 63) / 64)
> It could be replaced with:
>
> +#define dec_lcu_width(x_size) ALIGN(x_size, 64)
Ups, DIV_ROUND_UP should be used instead of ALIGN, here and below.
>
>
>> +#define dec_lcu_height(y_size) ((y_size + 63) / 64)
> The same here.
>> +#define s5p_mfc_dec_hevc_mv_size(x, y) \
>> + (dec_lcu_width(x) * dec_lcu_height(y) * 256 + 512)
>> +
> If dec_lcu_(width|height) are not used anywhere else, you can just
> squash them here:
>
> #define s5p_mfc_dec_hevc_mv_size(x, y) (ALIGN(x, 64) * ALIGN(y, 64) * 256 + 512)
>
> And if there is only one use of this macro, maybe it would be good to
> just hardcode it there.
>
> Regards
> Andrzej
>
>> /* Definition */
>> #define ENC_MULTI_SLICE_MB_MAX ((1 << 30) - 1)
>> #define ENC_MULTI_SLICE_BIT_MIN 2800
>
next prev parent reply other threads:[~2017-02-02 8:21 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170118100714epcas1p274e2e68d14a788417fbde2c26c91bcb9@epcas1p2.samsung.com>
2017-01-18 10:01 ` [PATCH 00/11] Add MFC v10.10 support Smitha T Murthy
[not found] ` <CGME20170118100718epcas5p1f9aebb16fc61d41a13d09054fa96a14d@epcas5p1.samsung.com>
2017-01-18 10:01 ` [PATCH 01/11] [media] s5p-mfc: Rename IS_MFCV8 macro Smitha T Murthy
2017-01-18 14:51 ` Andrzej Hajda
2017-01-31 8:56 ` Smitha T Murthy
[not found] ` <CGME20170118100723epcas5p132e0ebfad38261bed95cffc47334f9dc@epcas5p1.samsung.com>
2017-01-18 10:02 ` [PATCH 02/11] [media] s5p-mfc: Adding initial support for MFC v10.10 Smitha T Murthy
2017-01-18 15:10 ` Andrzej Hajda
2017-01-31 9:12 ` Smitha T Murthy
2017-01-21 20:28 ` Rob Herring
2017-02-06 8:37 ` Smitha T Murthy
[not found] ` <CGME20170118100726epcas1p2d443360ea389ccb0826a1b5c5512da55@epcas1p2.samsung.com>
2017-01-18 10:02 ` [PATCH 03/11] [media] s5p-mfc: Use min scratch buffer size Smitha T Murthy
2017-02-02 7:16 ` Andrzej Hajda
2017-02-06 8:38 ` Smitha T Murthy
[not found] ` <CGME20170118100731epcas5p16f07548a8a6c95f2ef539704e032a54d@epcas5p1.samsung.com>
2017-01-18 10:02 ` [PATCH 04/11] [media] s5p-mfc: Support MFCv10.10 buffer requirements Smitha T Murthy
2017-02-02 8:30 ` Andrzej Hajda
2017-02-06 8:41 ` Smitha T Murthy
[not found] ` <CGME20170118100737epcas1p269ede3c99e71ce55b934945cd20181e1@epcas1p2.samsung.com>
2017-01-18 10:02 ` [PATCH 05/11] [media] s5p-mfc: Add support for HEVC decoder Smitha T Murthy
2017-02-02 7:58 ` Andrzej Hajda
2017-02-02 8:20 ` Andrzej Hajda [this message]
2017-02-06 8:39 ` Smitha T Murthy
2017-02-06 8:39 ` Smitha T Murthy
[not found] ` <CGME20170118100742epcas5p1bb390dffa4fe530d94573f41d8791ef7@epcas5p1.samsung.com>
2017-01-18 10:02 ` [PATCH 06/11] [media] videodev2.h: Add v4l2 definition for HEVC Smitha T Murthy
2017-02-02 8:34 ` Andrzej Hajda
2017-02-06 8:41 ` Smitha T Murthy
[not found] ` <CGME20170118100756epcas1p2c8a93b383a4c85648b5e9efac8cea9c7@epcas1p2.samsung.com>
2017-01-18 10:02 ` [PATCH 08/11] [media] s5p-mfc: Add VP9 decoder support Smitha T Murthy
2017-02-02 8:39 ` Andrzej Hajda
2017-02-06 8:42 ` Smitha T Murthy
[not found] ` <CGME20170118100807epcas5p1a0af682c334aa9581f32cbf7f1f264c2@epcas5p1.samsung.com>
2017-01-18 10:02 ` [PATCH 09/11] [media] s5p-mfc: Add support for HEVC encoder Smitha T Murthy
2017-02-02 8:55 ` Andrzej Hajda
2017-02-06 8:42 ` Smitha T Murthy
[not found] ` <CGME20170118100818epcas5p1c7153a6fe9d93f96269008f42f736b90@epcas5p1.samsung.com>
2017-01-18 10:02 ` [PATCH 10/11] [media] v4l2: Add v4l2 control IDs " Smitha T Murthy
2017-02-06 14:54 ` Andrzej Hajda
2017-02-13 5:33 ` Smitha T Murthy
[not found] ` <CGME20170118100827epcas5p16023525ba778b58b8e9a31b8a764b382@epcas5p1.samsung.com>
2017-01-18 10:02 ` [PATCH 11/11] Documention: v4l: Documentation for HEVC CIDs Smitha T Murthy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=840f5d3f-6075-ea4a-696d-68cc7807df0d@samsung.com \
--to=a.hajda@samsung.com \
--cc=jtp.park@samsung.com \
--cc=kamil@wypas.org \
--cc=krzk@kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mchehab@kernel.org \
--cc=pankaj.dubey@samsung.com \
--cc=s.nawrocki@samsung.com \
--cc=smitha.t@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®