Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3037357imj; Mon, 11 Feb 2019 12:43:22 -0800 (PST) X-Google-Smtp-Source: AHgI3IbM/O1AlX4Nli3rrL1ElmEXkcS03jCiGaCpVBDmNVF7vycn4c+qW7h4e4WaoN8h511+zSq/ X-Received: by 2002:a63:29c3:: with SMTP id p186mr149534pgp.24.1549917802222; Mon, 11 Feb 2019 12:43:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549917802; cv=none; d=google.com; s=arc-20160816; b=huuk17qd8J69z7pWBucB33taeDphrIAwKePjgWBBguZxdpGko/ytqEHP3coM3uJx+H 9urS+IOkGNz/mBCY5NGiMeKdL5ZjW8OOG1UOj9serMU1Q6xjY5F03MAkZj3CnOzL/THx 81JP/kB/pJYHPEjCCA6Cd4aC0+ZBz6cJjQwAiz6xy+Meo/g57MoRjw8UTjJo8uuDhKZa S9IcykOMCcUlcQzPQGCOvhcocL9McQmrCb8R+SsZ83bNShuRTg/kJbBzAHtIKuh2Uyof ykIfwlpDZmoh043sZJZ9MnTVXOqvVMGP3FJe28wBbN3xQD7wDWYkbudV6j9Uhwnb5l7t X5Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id; bh=TE9TfT6VUZusQOuP2kCjzjVF+bH1cjQyFnru65euM4M=; b=GvDdd83fqFKOs1ogXyubIdg/P2IS9heIy/jzbohoIgHhiBlOmQOIfEfzLfxGrWTAt8 13ziATtoZVUPstIw5tHi2wyD3ywTtfXqfaxtxmPyyrg1nm4Zb4mDTv57Ytdp8n0lUW/4 1LzCYgsESPfrEIUfve6fEi0OI4JX9KJmKn38EjIR9tIvlQWr63IQov6PKCqWUZ04swnu dblKFNn0YhbaVTQWrpV0egTcosdrV6DLmZQvNkW4/NEATEaBNxAS97xLn1SAiBvf8aEn IHbDZHCcFWjWEqnI0jleGjDyymPgml8vo/jnOXdOCUyH2zj3KDoKBGTC33RnnlUlSZ5e qDoA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t4si9973743pga.83.2019.02.11.12.43.05; Mon, 11 Feb 2019 12:43:22 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730134AbfBKTs2 (ORCPT + 99 others); Mon, 11 Feb 2019 14:48:28 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:39070 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727639AbfBKTs2 (ORCPT ); Mon, 11 Feb 2019 14:48:28 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id B983A27EC6B Message-ID: <5a31f5596c04390d76bf34fdb8b71b6a96306943.camel@collabora.com> Subject: Re: [PATCH v3 2/2] media: cedrus: Add H264 decoding support From: Ezequiel Garcia To: Maxime Ripard , hans.verkuil@cisco.com, acourbot@chromium.org, sakari.ailus@linux.intel.com, Laurent Pinchart Cc: 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 Date: Mon, 11 Feb 2019 16:48:17 -0300 In-Reply-To: <4c00e1ab1e70adb1d94db59c37393250ca3791c5.1549895062.git-series.maxime.ripard@bootlin.com> References: <4c00e1ab1e70adb1d94db59c37393250ca3791c5.1549895062.git-series.maxime.ripard@bootlin.com> Organization: Collabora Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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))) Regards, Ez