mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno  <angelogioacchino.delregno@collabora.com>
To: Yunfei Dong <yunfei.dong@mediatek.com>,
	Alexandre Courbot <acourbot@chromium.org>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Tzung-Bi Shih <tzungbi@chromium.org>,
	Tiffany Lin <tiffany.lin@mediatek.com>,
	Andrew-CT Chen <andrew-ct.chen@mediatek.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Tomasz Figa <tfiga@google.com>
Cc: George Sun <george.sun@mediatek.com>,
	Xiaoyong Lu <xiaoyong.lu@mediatek.com>,
	Hsin-Yi Wang <hsinyi@chromium.org>,
	Fritz Koenig <frkoenig@chromium.org>,
	Dafna Hirschfeld <dafna.hirschfeld@collabora.com>,
	Benjamin Gaignard <benjamin.gaignard@collabora.com>,
	Daniel Vetter <daniel@ffwll.ch>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Irui Wang <irui.wang@mediatek.com>,
	Steve Cho <stevecho@chromium.org>,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	srv_heupstream@mediatek.com, linux-mediatek@lists.infradead.org,
	Project_Global_Chrome_Upstream_Group@mediatek.com
Subject: Re: [PATCH v5, 15/15] media: mtk-vcodec: support stateless VP9 decoding
Date: Wed, 19 Jan 2022 12:50:43 +0100	[thread overview]
Message-ID: <eaf4f649-89fc-77ff-dab1-2c837cd8c877@collabora.com> (raw)
In-Reply-To: <275affff-12d9-4659-e900-aa9c306e6701@collabora.com>

Il 19/01/22 12:28, AngeloGioacchino Del Regno ha scritto:
> Il 17/01/22 10:40, Yunfei Dong ha scritto:
>> Add support for VP9 decoding using the stateless API,
>> as supported by MT8192. And the drivers is lat and core architecture.
>>
>> Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
>> Signed-off-by: George Sun <george.sun@mediatek.com>
>> ---
>>   drivers/media/platform/mtk-vcodec/Makefile    |    1 +
>>   .../mtk-vcodec/mtk_vcodec_dec_stateless.c     |   26 +-
>>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |    1 +
>>   .../mtk-vcodec/vdec/vdec_vp9_req_lat_if.c     | 1973 +++++++++++++++++
>>   .../media/platform/mtk-vcodec/vdec_drv_if.c   |    4 +
>>   .../media/platform/mtk-vcodec/vdec_drv_if.h   |    1 +
>>   6 files changed, 2003 insertions(+), 3 deletions(-)
>>   create mode 100644 drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_req_lat_if.c
>>
> 
> Hello Yunfei,
> this driver is based on an older version of the VP9 stateless decoder uAPI,
> hence this is not applicable upstream.
> 
> The latest linux-next tag (as of today) already contains the new and
> accepted code; can you please rebase over that one?
> 
> Thanks,
> Angelo

While finishing a rebase, I had time to do a fast port of this patch; in hopes
to spare you some time, I'm giving you my (fast) take at this.

Feel free to use it as you wish!


 From 5f329ad271c94bf82d2dd12075372159466c28f9 Mon Sep 17 00:00:00 2001

From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Date: Wed, 19 Jan 2022 12:45:18 +0100

Subject: [PATCH] media: mtk-vcodec: Port VP9 stateless driver to upstream uAPI



This driver was written based on an old VP9 uAPI, but that code

changed over time: port this over the newest, and upstream accepted,

VP9 uAPI.



Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

---

  .../mtk-vcodec/mtk_vcodec_dec_stateless.c     |  2 +-

  .../mtk-vcodec/vdec/vdec_vp9_req_lat_if.c     | 29 +++++++------------

  2 files changed, 12 insertions(+), 19 deletions(-)



diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_stateless.c 
b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_stateless.c

index 26fd97d867e9..7f4baa39bf6c 100644

--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_stateless.c

+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_stateless.c

@@ -94,7 +94,7 @@ static const struct mtk_stateless_control 
mtk_stateless_controls[] = {

  	},

  	{

  		.cfg = {

-			.id = V4L2_CID_MPEG_VIDEO_VP9_FRAME_DECODE_PARAMS,

+			.id = V4L2_CID_STATELESS_VP9_FRAME,

  			},

  		.codec_type = V4L2_PIX_FMT_VP9_FRAME,

  	},

diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_req_lat_if.c 
b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_req_lat_if.c

index 92cd39f00840..8caf4f28db29 100644

--- a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_req_lat_if.c

+++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_req_lat_if.c

@@ -711,7 +711,7 @@ static int vdec_vp9_slice_setup_lat_from_src_buf(struct 
vdec_vp9_slice_instance



  static void vdec_vp9_slice_setup_hdr(struct vdec_vp9_slice_instance *instance,

  				     struct vdec_vp9_slice_uncompressed_header *uh,

-				     struct v4l2_ctrl_vp9_frame_decode_params *hdr)

+				     struct v4l2_ctrl_vp9_frame *hdr)

  {

  	int i;



@@ -749,13 +749,13 @@ static void vdec_vp9_slice_setup_hdr(struct 
vdec_vp9_slice_instance *instance,

  	 * - LAST_FRAME = 1,

  	 * - GOLDEN_FRAME = 2,

  	 * - ALTREF_FRAME = 3,

-	 * ref_frame_sign_biases[INTRA_FRAME] is always 0

+	 * ref_frame_sign_bias[INTRA_FRAME] is always 0

  	 * and VDA only passes another 3 directions

  	 */

  	uh->ref_frame_sign_bias[0] = 0;

  	for (i = 0; i < 3; i++)

  		uh->ref_frame_sign_bias[i + 1] =

-			!!(hdr->ref_frame_sign_biases & (1 << i));

+			!!(hdr->ref_frame_sign_bias & (1 << i));

  	uh->allow_high_precision_mv = HDR_FLAG(ALLOW_HIGH_PREC_MV);

  	uh->interpolation_filter = hdr->interpolation_filter;

  	uh->refresh_frame_context = HDR_FLAG(REFRESH_FRAME_CTX);

@@ -772,7 +772,7 @@ static void vdec_vp9_slice_setup_hdr(struct 
vdec_vp9_slice_instance *instance,



  static void vdec_vp9_slice_setup_frame_ctx(struct vdec_vp9_slice_instance *instance,

  					   struct vdec_vp9_slice_uncompressed_header *uh,

-					   struct v4l2_ctrl_vp9_frame_decode_params *hdr)

+					   struct v4l2_ctrl_vp9_frame *hdr)

  {

  	int error_resilient_mode;

  	int reset_frame_context;

@@ -857,7 +857,7 @@ static void vdec_vp9_slice_setup_segmentation(struct 
vdec_vp9_slice_uncompressed

  }



  static int vdec_vp9_slice_setup_tile(struct vdec_vp9_slice_vsi *vsi,

-				     struct v4l2_ctrl_vp9_frame_decode_params *hdr)

+				     struct v4l2_ctrl_vp9_frame *hdr)

  {

  	unsigned int rows_log2;

  	unsigned int cols_log2;

@@ -909,19 +909,10 @@ static void vdec_vp9_slice_setup_state(struct 
vdec_vp9_slice_vsi *vsi)

  	memset(&vsi->state, 0, sizeof(vsi->state));

  }



-static void vdec_vp9_slice_setup_ref_idx(struct vdec_vp9_slice_pfc *pfc,

-					 struct v4l2_ctrl_vp9_frame_decode_params *hdr)

-{

-	int i;

-

-	for (i = 0; i < 3; i++)

-		pfc->ref_idx[i] = hdr->refs[i];

-}

-

  static int vdec_vp9_slice_setup_pfc(struct vdec_vp9_slice_instance *instance,

  				    struct vdec_vp9_slice_pfc *pfc)

  {

-	struct v4l2_ctrl_vp9_frame_decode_params *hdr;

+	struct v4l2_ctrl_vp9_frame *hdr;

  	struct vdec_vp9_slice_uncompressed_header *uh;

  	struct v4l2_ctrl *hdr_ctrl;

  	struct vdec_vp9_slice_vsi *vsi;

@@ -929,7 +920,7 @@ static int vdec_vp9_slice_setup_pfc(struct 
vdec_vp9_slice_instance *instance,



  	/* frame header */

  	hdr_ctrl = v4l2_ctrl_find(&instance->ctx->ctrl_hdl,

-				  V4L2_CID_MPEG_VIDEO_VP9_FRAME_DECODE_PARAMS);

+				  V4L2_CID_STATELESS_VP9_FRAME);

  	if (!hdr_ctrl || !hdr_ctrl->p_cur.p)

  		return -EINVAL;



@@ -949,7 +940,9 @@ static int vdec_vp9_slice_setup_pfc(struct 
vdec_vp9_slice_instance *instance,

  	vdec_vp9_slice_setup_state(vsi);



  	/* core stage needs buffer index to get ref y/c ... */

-	vdec_vp9_slice_setup_ref_idx(pfc, hdr);

+	pfc->ref_idx[0] = hdr->last_frame_ts;

+	pfc->ref_idx[1] = hdr->golden_frame_ts;

+	pfc->ref_idx[2] = hdr->alt_frame_ts;



  	pfc->seq = instance->seq;

  	instance->seq++;

@@ -1789,7 +1782,7 @@ static void vdec_vp9_slice_get_crop_info(struct 
vdec_vp9_slice_instance *instanc

  			 cr->left, cr->top, cr->width, cr->height);

  }



-static int vdec_vp9_slice_get_param(void *h_vdec, vdec_get_param_type type, void *out)

+static int vdec_vp9_slice_get_param(void *h_vdec, enum vdec_get_param_type type, 
void *out)

  {

  	struct vdec_vp9_slice_instance *instance = h_vdec;



-- 

2.33.1


      reply	other threads:[~2022-01-19 11:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-17  9:39 [PATCH v5, 00/15] media: mtk-vcodec: support for MT8192 decoder Yunfei Dong
2022-01-17  9:39 ` [PATCH v5, 01/15] media: mtk-vcodec: Add vdec enable/disable hardware helpers Yunfei Dong
2022-01-17  9:39 ` [PATCH v5, 02/15] media: mtk-vcodec: Using firmware type to separate different firmware architecture Yunfei Dong
2022-01-17  9:39 ` [PATCH v5, 03/15] media: mtk-vcodec: get capture queue buffer size from scp Yunfei Dong
2022-01-17  9:39 ` [PATCH v5, 04/15] media: mtk-vcodec: Read max resolution from dec_capability Yunfei Dong
2022-01-17  9:39 ` [PATCH v5, 05/15] media: mtk-vcodec: Call v4l2_m2m_set_dst_buffered() set capture buffer buffered Yunfei Dong
2022-01-17  9:39 ` [PATCH v5, 06/15] media: mtk-vcodec: Refactor get and put capture buffer flow Yunfei Dong
2022-01-17  9:39 ` [PATCH v5, 07/15] media: mtk-vcodec: Refactor supported vdec formats and framesizes Yunfei Dong
2022-01-17  9:39 ` [PATCH v5, 08/15] media: mtk-vcodec: Add format to support MT21C Yunfei Dong
2022-01-17  9:39 ` [PATCH v5, 09/15] media: mtk-vcodec: disable vp8 4K capability Yunfei Dong
2022-01-17  9:39 ` [PATCH v5, 10/15] media: mtk-vcodec: Fix v4l2-compliance fail Yunfei Dong
2022-01-17  9:39 ` [PATCH v5, 11/15] media: mtk-vcodec: record capture queue format type Yunfei Dong
2022-01-17  9:39 ` [PATCH v5, 12/15] media: mtk-vcodec: Extract H264 common code Yunfei Dong
2022-01-20 15:10   ` AngeloGioacchino Del Regno
2022-01-17  9:39 ` [PATCH v5, 13/15] media: mtk-vcodec: support stateless H.264 decoding for mt8192 Yunfei Dong
2022-01-17  9:40 ` [PATCH v5, 14/15] media: mtk-vcodec: support stateless VP8 decoding Yunfei Dong
2022-01-20 15:02   ` AngeloGioacchino Del Regno
2022-01-17  9:40 ` [PATCH v5, 15/15] media: mtk-vcodec: support stateless VP9 decoding Yunfei Dong
2022-01-19 11:28   ` AngeloGioacchino Del Regno
2022-01-19 11:50     ` AngeloGioacchino Del Regno [this message]

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=eaf4f649-89fc-77ff-dab1-2c837cd8c877@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=acourbot@chromium.org \
    --cc=andrew-ct.chen@mediatek.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=dafna.hirschfeld@collabora.com \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=frkoenig@chromium.org \
    --cc=george.sun@mediatek.com \
    --cc=hsinyi@chromium.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=irui.wang@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=srv_heupstream@mediatek.com \
    --cc=stevecho@chromium.org \
    --cc=tfiga@google.com \
    --cc=tiffany.lin@mediatek.com \
    --cc=tzungbi@chromium.org \
    --cc=xiaoyong.lu@mediatek.com \
    --cc=yunfei.dong@mediatek.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

Powered by JetHome