lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eaf4f649-89fc-77ff-dab1-2c837cd8c877@collabora.com>
Date:   Wed, 19 Jan 2022 12:50:43 +0100
From:   AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>
To:     Yunfei Dong <yunfei.dong@...iatek.com>,
        Alexandre Courbot <acourbot@...omium.org>,
        Hans Verkuil <hverkuil-cisco@...all.nl>,
        Tzung-Bi Shih <tzungbi@...omium.org>,
        Tiffany Lin <tiffany.lin@...iatek.com>,
        Andrew-CT Chen <andrew-ct.chen@...iatek.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Tomasz Figa <tfiga@...gle.com>
Cc:     George Sun <george.sun@...iatek.com>,
        Xiaoyong Lu <xiaoyong.lu@...iatek.com>,
        Hsin-Yi Wang <hsinyi@...omium.org>,
        Fritz Koenig <frkoenig@...omium.org>,
        Dafna Hirschfeld <dafna.hirschfeld@...labora.com>,
        Benjamin Gaignard <benjamin.gaignard@...labora.com>,
        Daniel Vetter <daniel@...ll.ch>,
        dri-devel <dri-devel@...ts.freedesktop.org>,
        Irui Wang <irui.wang@...iatek.com>,
        Steve Cho <stevecho@...omium.org>, linux-media@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, srv_heupstream@...iatek.com,
        linux-mediatek@...ts.infradead.org,
        Project_Global_Chrome_Upstream_Group@...iatek.com
Subject: Re: [PATCH v5, 15/15] media: mtk-vcodec: support stateless VP9
 decoding

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@...iatek.com>
>> Signed-off-by: George Sun <george.sun@...iatek.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@...labora.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@...labora.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ