Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3798162imj; Tue, 12 Feb 2019 04:59:44 -0800 (PST) X-Google-Smtp-Source: AHgI3IZEYTgCHGnSquFpYvEmLy6LyNN75+MEscyRbY10Et7J9AyIxy62L5vtzO50jCbgLFDA3mTt X-Received: by 2002:a62:3ac8:: with SMTP id v69mr3885167pfj.150.1549976384748; Tue, 12 Feb 2019 04:59:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549976384; cv=none; d=google.com; s=arc-20160816; b=vBYWH45VXMKWwCYAAUOk+PdKWEvT5nRjZHu9543PaD7sqVBxenV0yfmXBbBTwEmxaK S/LpC6RBYN3cipwULgrStuBl7hU90D7RPflBMnSwjfBjKtmIfi0T1SkpkmhxdZm9hKhw OG0+FSeMa6oV2svZpacX7YCKzFsvDS2lpDIJ2SOe3k3ij6p7v9OACb6ELBp1wFW0HsUv 9oaGSeJd5JjpB9I66tYXYtVI2bEqO6h0hA+JpoPEld2xUOC9G0B1+OPxf73Il9/o0AXJ 54DT3t5jhHdlShNUZ8WGMDjHGKoVEhzE66iUmGD7Je+VhEQ+HvT97zEm8xXU2jEVTKqg Htww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=kfUu+Gsb+zgNla0QTIOmQ58JGvkoU0CljgYuXOONpWM=; b=A8yRxz8LLxRn07MIFj4m2677+30FVMcsDOV9nnsTP5hWxCqwsKlo9j0LUP7SwnJdN4 dOYwcw+lAdeyINcMLmUeLM6uvNszJOVH6eNW85l3Tua1GJFtGqw9D14UM58yP6xfhvAT Q1R5eMozlSUzj83vVycnPW6FhjLyeQFyismXO3w7v2Oc2c+AXMmDMLg0ejGkjjdOumha Engzr3MdbdSYvvWkwMJxwf/61iAzDMr9uBXj/bq+nmLCm/kBL6+6K1xdCNocMNYoLyMn /lyxpOysdBEECziNxykFsDg2u3mhH7gYL7YzbmirUBp3J4tuJKagJ05aadc9Jy5LKpOy VkOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 23si12118391pgc.221.2019.02.12.04.59.27; Tue, 12 Feb 2019 04:59:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728827AbfBLMrT convert rfc822-to-8bit (ORCPT + 99 others); Tue, 12 Feb 2019 07:47:19 -0500 Received: from relay10.mail.gandi.net ([217.70.178.230]:58913 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbfBLMrS (ORCPT ); Tue, 12 Feb 2019 07:47:18 -0500 Received: from localhost (aaubervilliers-681-1-89-68.w90-88.abo.wanadoo.fr [90.88.30.68]) (Authenticated sender: maxime.ripard@bootlin.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id B38EE24000D; Tue, 12 Feb 2019 12:47:13 +0000 (UTC) Date: Tue, 12 Feb 2019 13:47:13 +0100 From: Maxime Ripard To: Ezequiel Garcia Cc: hans.verkuil@cisco.com, acourbot@chromium.org, sakari.ailus@linux.intel.com, Laurent Pinchart , tfiga@chromium.org, posciak@chromium.org, Paul Kocialkowski , Chen-Yu Tsai , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, nicolas.dufresne@collabora.com, jenskuske@gmail.com, jernej.skrabec@gmail.com, jonas@kwiboo.se, linux-sunxi@googlegroups.com, Thomas Petazzoni Subject: Re: [PATCH v3 2/2] media: cedrus: Add H264 decoding support Message-ID: <20190212124713.cqms5jofw433nx6m@flea> References: <4c00e1ab1e70adb1d94db59c37393250ca3791c5.1549895062.git-series.maxime.ripard@bootlin.com> <5a31f5596c04390d76bf34fdb8b71b6a96306943.camel@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <5a31f5596c04390d76bf34fdb8b71b6a96306943.camel@collabora.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 11, 2019 at 04:48:17PM -0300, Ezequiel Garcia wrote: > On Mon, 2019-02-11 at 15:39 +0100, Maxime Ripard wrote: > > Introduce some basic H264 decoding support in cedrus. So far, only the > > baseline profile videos have been tested, and some more advanced features > > used in higher profiles are not even implemented. > > > > Signed-off-by: Maxime Ripard > [..] > > > > +static void _cedrus_write_ref_list(struct cedrus_ctx *ctx, > > + struct cedrus_run *run, > > + const u8 *ref_list, u8 num_ref, > > + enum cedrus_h264_sram_off sram) > > +{ > > + const struct v4l2_ctrl_h264_decode_param *decode = run->h264.decode_param; > > + struct vb2_queue *cap_q = &ctx->fh.m2m_ctx->cap_q_ctx.q; > > + const struct vb2_buffer *dst_buf = &run->dst->vb2_buf; > > + struct cedrus_dev *dev = ctx->dev; > > + u8 sram_array[CEDRUS_MAX_REF_IDX]; > > + unsigned int size, i; > > + > > + memset(sram_array, 0, sizeof(sram_array)); > > + > > + for (i = 0; i < num_ref; i++) { > > + const struct v4l2_h264_dpb_entry *dpb; > > + const struct cedrus_buffer *cedrus_buf; > > + const struct vb2_v4l2_buffer *ref_buf; > > + unsigned int position; > > + int buf_idx; > > + u8 dpb_idx; > > + > > + dpb_idx = ref_list[i]; > > + dpb = &decode->dpb[dpb_idx]; > > + > > + if (!(dpb->flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE)) > > + continue; > > + > > + if (dst_buf->timestamp == dpb->timestamp) > > + buf_idx = dst_buf->index; > > + else > > + buf_idx = vb2_find_timestamp(cap_q, dpb->timestamp, 0); > > + > > + if (buf_idx < 0) > > + continue; > > + > > + ref_buf = to_vb2_v4l2_buffer(ctx->dst_bufs[buf_idx]); > > + cedrus_buf = vb2_v4l2_to_cedrus_buffer(ref_buf); > > + position = cedrus_buf->codec.h264.position; > > + > > + sram_array[i] |= position << 1; > > + if (ref_buf->field == V4L2_FIELD_BOTTOM) > > + sram_array[i] |= BIT(0); > > + } > > + > > + size = min((unsigned int)ALIGN(num_ref, 4), sizeof(sram_array)); > > Perhaps s/unsigned int/size_t, so the arguments to min() have the same type? > > Otherwise, I got this warning: > > /home/zeta/repos/linux/media_tree/drivers/staging/media/sunxi/cedrus/cedrus_h264.c: In function ‘_cedrus_write_ref_list’: > /home/zeta/repos/linux/media_tree/include/linux/kernel.h:846:29: warning: comparison of distinct pointer types lacks a cast > (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) Strange, I didn't notice any warning. I'll make sure to fix it. Thanks! Maxime -- Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com