Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp212277ybj; Fri, 8 May 2020 09:58:25 -0700 (PDT) X-Google-Smtp-Source: APiQypKUdkVMosAE3p6iO60eFBYC+ckRi+XiMKLayySvligTBRW4vzqXyFSFP5Ui7Ml2UDcFi3FY X-Received: by 2002:a17:906:1443:: with SMTP id q3mr2743397ejc.325.1588957105080; Fri, 08 May 2020 09:58:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588957105; cv=none; d=google.com; s=arc-20160816; b=n//f2doknFjfyTJzsvKWbdN7UcqW8yCQNnRamr6GQdkV9zZM6pOkxhMqtqyWEfUwyK DM0j3+oVNbIcA+V6w6gNKCo3nQW4JZlU0G0hOqs07WinZ39RvMrp5QTaCi5N5XklM1NZ jPsW5n0euJsKi3QiOaP/bSnOndL6MNuS6gvFF66dFXH9SorcoLjAy7opmw4GLpHzJ4HO A3q2wCgrcE+pzVe77rz1FSm9PnyeS5kl1Jli2z2z/KOahOt5PFACG/0JFY47ibjMGF7K OOzlq54U1caVG+KD55bKXqOJMuykS80riY9yEVEBjFE6AVHY+tuIND2bv8UD83PCv4LT QeOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=qSHE/cDUYWET1agiZaWzN/cLhWh+dKZVdX5a77HIV0o=; b=tKuMoNIzUst+u4hSdkXyiGGCL5+HYsZYNLrS1SLQzOl5rhpNPdemPyPLoCFsi6YV5S /sSyhbwifr24YzWvXeCKZqHv73vY4fHTWqB+fxdQy1RGGsfO1gb/AY8zLs99KZVkFNBH i4B4aY7RMxMgHFTzMvyZGVr12tXZ0HDSx1fR17NGlDNYx2tasIQPRU5R2eQ/S2ujeGTm 1LS91vu0DG7vhl5k+8BMV2tIprxGI09TMWLc7B2cRUe6E4CdwqrMnrQRdDZZXrZtSZb0 2Bd0Km1nm+GRWgO3OtCf0Ba/F8xfYmzcjZ445+ZhfJ9LPxeN5YC+WKDsawFg2IAn+n4D Adtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=K1x45ekd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b21si1240611edr.569.2020.05.08.09.58.01; Fri, 08 May 2020 09:58:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=K1x45ekd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727097AbgEHQ4f (ORCPT + 99 others); Fri, 8 May 2020 12:56:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726750AbgEHQ4e (ORCPT ); Fri, 8 May 2020 12:56:34 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D24CC061A0C for ; Fri, 8 May 2020 09:56:34 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id f12so1742493edn.12 for ; Fri, 08 May 2020 09:56:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qSHE/cDUYWET1agiZaWzN/cLhWh+dKZVdX5a77HIV0o=; b=K1x45ekdP5M5U1MQqp4w0sbhv6u1/qfAEDLNfXKxfqr5iK3JD9mMli3EIjS1druXx4 I+/2i166tr6/suS6hqQgXXhRD4Mw7UhlO6V7jlEu3JhlhAdCjNiMoNa0EibtMdpvRMvm s2Amar7H23yx37oA/d7ZX04clDeVlZRlKHpCM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qSHE/cDUYWET1agiZaWzN/cLhWh+dKZVdX5a77HIV0o=; b=hxB6hKev4grE/bHxYFte4XGCmIr/IE3Pxs1bEY8gByrDBQ/vEmbadxjGaQH4qBjeSI zAIrzStrQKhRoQV2vTgZ/MEXAUvP33OcBOJ36JnMEf6yk7SbkcWx96Zz9X8mOS1z6gNw LhK/BZVE0/vJozqunWDb/EjnYBH5MYNYEEZCImCPKnr7tNG2zUlMpvs+Kt+4d1tMe0lR bfS9ej71qRBTy8oVySvlMvk07nHmwjGfmmiegeuYaw7wmMTtgAfwGhWYXSjgzZoqnvnv nn5nyiJJm1NiKtexwKoq9jBXbWlYiwlkn/8epEEdJbV9uVbuSuT947EOpA+mbYWIcRlQ FyuA== X-Gm-Message-State: AGi0Pub5z4jQqeZSnS4wo0KlhygwjiPPVjYN6sWSHfbJ9yJXTm/JlAee 79kKqqYXSZxzSP81pjU1NKSvo8DbmVXWgA== X-Received: by 2002:aa7:df8a:: with SMTP id b10mr3024424edy.263.1588956992534; Fri, 08 May 2020 09:56:32 -0700 (PDT) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com. [209.85.221.43]) by smtp.gmail.com with ESMTPSA id r4sm240105ejz.28.2020.05.08.09.56.31 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 May 2020 09:56:31 -0700 (PDT) Received: by mail-wr1-f43.google.com with SMTP id 50so2156103wrc.11 for ; Fri, 08 May 2020 09:56:31 -0700 (PDT) X-Received: by 2002:a5d:66c5:: with SMTP id k5mr3817089wrw.17.1588956990811; Fri, 08 May 2020 09:56:30 -0700 (PDT) MIME-Version: 1.0 References: <20200505134110.3435-1-ezequiel@collabora.com> <20200505134110.3435-4-ezequiel@collabora.com> <8e8eda07-e5f5-86dc-899b-0823ea0479f2@xs4all.nl> In-Reply-To: From: Tomasz Figa Date: Fri, 8 May 2020 18:56:18 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 3/3] media: rkvdec: Add the VP9 backend To: Ezequiel Garcia Cc: Hans Verkuil , Linux Media Mailing List , "open list:ARM/Rockchip SoC..." , Linux Kernel Mailing List , kernel@collabora.com, Jonas Karlman , Heiko Stuebner , Alexandre Courbot , Jeffrey Kardatzke , Gustavo Padovan , Boris Brezillon Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 8, 2020 at 6:26 PM Ezequiel Garcia wrote: > > On Fri, 2020-05-08 at 12:34 +0200, Hans Verkuil wrote: > > On 05/05/2020 15:41, Ezequiel Garcia wrote: > > > From: Boris Brezillon > > > > > > The Rockchip VDEC supports VP9 profile 0 up to 4096x2304@30fps. Add > > > a backend for this new format. > > > > > > Signed-off-by: Boris Brezillon > > > Signed-off-by: Ezequiel Garcia > > > --- > > > drivers/staging/media/rkvdec/Makefile | 2 +- > > > drivers/staging/media/rkvdec/rkvdec-vp9.c | 1577 +++++++++++++++++++++ > > > drivers/staging/media/rkvdec/rkvdec.c | 56 +- > > > drivers/staging/media/rkvdec/rkvdec.h | 6 + > > > 4 files changed, 1637 insertions(+), 4 deletions(-) > > > create mode 100644 drivers/staging/media/rkvdec/rkvdec-vp9.c > > > > > > diff --git a/drivers/staging/media/rkvdec/Makefile b/drivers/staging/media/rkvdec/Makefile > > > index c08fed0a39f9..cb86b429cfaa 100644 > > > --- a/drivers/staging/media/rkvdec/Makefile > > > +++ b/drivers/staging/media/rkvdec/Makefile > > > @@ -1,3 +1,3 @@ > > > obj-$(CONFIG_VIDEO_ROCKCHIP_VDEC) += rockchip-vdec.o > > > > > > -rockchip-vdec-y += rkvdec.o rkvdec-h264.o > > > +rockchip-vdec-y += rkvdec.o rkvdec-h264.o rkvdec-vp9.o > > > diff --git a/drivers/staging/media/rkvdec/rkvdec-vp9.c b/drivers/staging/media/rkvdec/rkvdec-vp9.c > > > new file mode 100644 > > > index 000000000000..37d0ea4e3570 > > > --- /dev/null > > > +++ b/drivers/staging/media/rkvdec/rkvdec-vp9.c > > > @@ -0,0 +1,1577 @@ > > > > > > > > > +static void init_inter_probs(struct rkvdec_ctx *ctx, > > > + const struct rkvdec_vp9_run *run) > > > +{ > > > + const struct v4l2_ctrl_vp9_frame_decode_params *dec_params; > > > + struct rkvdec_vp9_ctx *vp9_ctx = ctx->priv; > > > + struct rkvdec_vp9_priv_tbl *tbl = vp9_ctx->priv_tbl.cpu; > > > + struct rkvdec_vp9_inter_frame_probs *rkprobs; > > > + const struct v4l2_vp9_probabilities *probs; > > > + unsigned int i, j, k; > > > + > > > + rkprobs = &tbl->probs.inter; > > > + dec_params = run->decode_params; > > > + probs = &dec_params->probs; > > > + > > > + /* > > > + * inter probs > > > + * 151 x 128 bits, aligned to 152 x 128 bits > > > + * inter only > > > + * intra_y_mode & inter_block info 6 x 128 bits > > > + */ > > > + > > > + memcpy(rkprobs->y_mode, probs->y_mode, sizeof(rkprobs->y_mode)); > > > + memcpy(rkprobs->comp_mode, probs->comp_mode, > > > + sizeof(rkprobs->comp_mode)); > > > + memcpy(rkprobs->comp_ref, probs->comp_ref, > > > + sizeof(rkprobs->comp_ref)); > > > + memcpy(rkprobs->single_ref, probs->single_ref, > > > + sizeof(rkprobs->single_ref)); > > > + memcpy(rkprobs->inter_mode, probs->inter_mode, > > > + sizeof(rkprobs->inter_mode)); > > > + memcpy(rkprobs->interp_filter, probs->interp_filter, > > > + sizeof(rkprobs->interp_filter)); > > > + > > > + /* 128 x 128 bits coeff related */ > > > + for (i = 0; i < ARRAY_SIZE(probs->coef); i++) { > > > + for (j = 0; j < ARRAY_SIZE(probs->coef[0]); j++) { > > > + for (k = 0; k < ARRAY_SIZE(probs->coef[0][0]); k++) > > > + write_coeff_plane(probs->coef[i][j][k], > > > + rkprobs->coef[k][i][j]); > > > + } > > > + } > > > + > > > + /* intra uv mode 6 x 128 */ > > > + memcpy(rkprobs->uv_mode_0_2, &probs->uv_mode[0], > > > + sizeof(rkprobs->uv_mode_0_2)); > > > + memcpy(rkprobs->uv_mode_3_5, &probs->uv_mode[3], > > > + sizeof(rkprobs->uv_mode_3_5)); > > > + memcpy(rkprobs->uv_mode_6_8, &probs->uv_mode[6], > > > + sizeof(rkprobs->uv_mode_6_8)); > > > + memcpy(rkprobs->uv_mode_9, &probs->uv_mode[9], > > > + sizeof(rkprobs->uv_mode_9)); > > > + > > > + /* mv related 6 x 128 */ > > > + memcpy(rkprobs->mv.joint, probs->mv.joint, > > > + sizeof(rkprobs->mv.joint)); > > > + memcpy(rkprobs->mv.sign, probs->mv.sign, > > > + sizeof(rkprobs->mv.sign)); > > > + memcpy(rkprobs->mv.class, probs->mv.class, > > > + sizeof(rkprobs->mv.class)); > > > + memcpy(rkprobs->mv.class0_bit, probs->mv.class0_bit, > > > + sizeof(rkprobs->mv.class0_bit)); > > > + memcpy(rkprobs->mv.bits, probs->mv.bits, > > > + sizeof(rkprobs->mv.bits)); > > > + memcpy(rkprobs->mv.class0_fr, probs->mv.class0_fr, > > > + sizeof(rkprobs->mv.class0_fr)); > > > + memcpy(rkprobs->mv.fr, probs->mv.fr, > > > + sizeof(rkprobs->mv.fr)); > > > + memcpy(rkprobs->mv.class0_hp, probs->mv.class0_hp, > > > + sizeof(rkprobs->mv.class0_hp)); > > > + memcpy(rkprobs->mv.hp, probs->mv.hp, > > > + sizeof(rkprobs->mv.hp)); > > > > Can't you just do: 'rkprobs->mv = probs->mv'? > > > > I think I'd like to keep this as-is. > > Having the memcpy makes it explicit that we are copying > these structs around. While the assignment would > bring type checking, it can be misleading for readers. On the other hand, it's not obvious from the code that all fields of the structure are copied. Perhaps memcpy(&rkprobs->mv, &probs->mv, sizeof(rkprobs->mv)) would be a good compromise?