Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3820336ybt; Tue, 23 Jun 2020 11:30:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxypwvgXVxcZkxC9fdir2CqcbA1ZqfqwnqTNsoa2JnTfFZpYd5SJCqasQ7qwUGEgXiY5O1s X-Received: by 2002:a50:ee84:: with SMTP id f4mr10769176edr.183.1592937005923; Tue, 23 Jun 2020 11:30:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592937005; cv=none; d=google.com; s=arc-20160816; b=cxhshS6ACfgrEmfcx00o02SHS34uA58wVLk9g0qhYTUmPw7Py8oaG8jmNAjn4zRc3a /VAUUeDd/dLedAXvNEWBfrv5mddT0/jePZ1D7hXYFVfimhczO235sRlnxYnKHR0/mJXC z70kGcgJGMP337VPA/p4eOVlThnooiA7xDdRBK4fXbHrG2j/iBrScrT4aivtjZVzTBxj dHJLsUNUDx4bIrigK+IIIm/pnvlwFNdebNU7uj4/8Y9XX/CivDyPCKpaj3OSV+nPgKlP NK2xRFPt4qSD3jEmhDPE0YVdIb0R3GqTmLr5STOF2l03KCvM7IlPmnAjhMK0UgsuWd6Z 3IyA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=qbCPNFIxXUJ6DAyL9WC0KlWS4RXTFe6PrSnHCLKjfso=; b=gPJV2++fHCxLDxanPMN2qP51vjA5g/oEONyLeiR3C5u2syMIaL2qATwe2k9zwfvlaw ygsO5tfTANOVdLP6F9v/hMnVlxOT9V61QgqyahQgxmYGW7Lro7agxxlgO9gW7+4IsC/f Ge1oUBdSHeGUlMMavKvWxQ03zKk1DsG+tiowukHjHupgMT5A4d2QlCNjDB9CQp5fCRPs nClyR+XW50sqiAvPp1IMH0kvUCzd/X19e9xSHCQNNBvB1UHpKM4KBecp+MXVY/qva4RR wJbvoDdOCRk7mfMUSMeukoeuutQ5lT74jsSME6zuUMnJr/GUPPNuNJh+92PusoDqAdXz rSxA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i18si1273204edx.250.2020.06.23.11.29.42; Tue, 23 Jun 2020 11:30:05 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387458AbgFWS3I (ORCPT + 99 others); Tue, 23 Jun 2020 14:29:08 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:42738 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732549AbgFWS3H (ORCPT ); Tue, 23 Jun 2020 14:29:07 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id 0C53C2A37E7 From: Ezequiel Garcia To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Tomasz Figa , kernel@collabora.com, Jonas Karlman , Hans Verkuil , Alexandre Courbot , Jeffrey Kardatzke , Nicolas Dufresne , Philipp Zabel , Maxime Ripard , Paul Kocialkowski , Ezequiel Garcia Subject: [RFC 2/7] fixup! media: uapi: h264: update reference lists Date: Tue, 23 Jun 2020 15:28:04 -0300 Message-Id: <20200623182809.1375-3-ezequiel@collabora.com> X-Mailer: git-send-email 2.26.0.rc2 In-Reply-To: <20200623182809.1375-1-ezequiel@collabora.com> References: <20200623182809.1375-1-ezequiel@collabora.com> 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 Align v4l2_h264_reference to 32-bits, giving some room for future extensions. Signed-off-by: Ezequiel Garcia --- .../userspace-api/media/v4l/ext-ctrls-codec.rst | 3 +++ drivers/media/v4l2-core/v4l2-ctrls.c | 16 ++++++++++++++++ include/media/h264-ctrls.h | 7 +++++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index 6c36d298db20..7af12447a5b0 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -1943,6 +1943,9 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - * - __u8 - ``index`` - + * - __u32 + - ``reserved`` + - Applications and drivers must set this to zero. .. _h264_reference_flags: diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 3f3fbcd60cc6..6abd023f10c7 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1721,6 +1721,8 @@ static void std_log(const struct v4l2_ctrl *ctrl) #define zero_padding(s) \ memset(&(s).padding, 0, sizeof((s).padding)) +#define zero_reserved(s) \ + memset(&(s).reserved, 0, sizeof((s).reserved)) /* * Compound controls validation requires setting unused fields/flags to zero @@ -1731,6 +1733,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, { struct v4l2_ctrl_mpeg2_slice_params *p_mpeg2_slice_params; struct v4l2_ctrl_vp8_frame_header *p_vp8_frame_header; + struct v4l2_ctrl_h264_slice_params *p_h264_slice_params; struct v4l2_ctrl_hevc_sps *p_hevc_sps; struct v4l2_ctrl_hevc_pps *p_hevc_pps; struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params; @@ -1790,7 +1793,20 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, case V4L2_CTRL_TYPE_H264_SPS: case V4L2_CTRL_TYPE_H264_PPS: case V4L2_CTRL_TYPE_H264_SCALING_MATRIX: + break; case V4L2_CTRL_TYPE_H264_SLICE_PARAMS: + p_h264_slice_params = p; + + for (i = 0; i < V4L2_H264_REF_PIC_LIST_LEN; i++) { + struct v4l2_h264_reference *ref0 = + &p_h264_slice_params->ref_pic_list0[i]; + struct v4l2_h264_reference *ref1 = + &p_h264_slice_params->ref_pic_list1[i]; + + zero_reserved(*ref0); + zero_reserved(*ref1); + } + break; case V4L2_CTRL_TYPE_H264_DECODE_PARAMS: break; diff --git a/include/media/h264-ctrls.h b/include/media/h264-ctrls.h index 9b1cbc9bc38e..c6cbf178c1c9 100644 --- a/include/media/h264-ctrls.h +++ b/include/media/h264-ctrls.h @@ -19,6 +19,8 @@ */ #define V4L2_H264_NUM_DPB_ENTRIES 16 +#define V4L2_H264_REF_PIC_LIST_LEN 32 + /* Our pixel format isn't stable at the moment */ #define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4') /* H264 parsed slices */ @@ -146,6 +148,7 @@ struct v4l2_h264_pred_weight_table { struct v4l2_h264_reference { __u8 flags; __u8 index; + __u16 reserved; }; struct v4l2_ctrl_h264_slice_params { @@ -190,8 +193,8 @@ struct v4l2_ctrl_h264_slice_params { * Entries on each list are indices into * v4l2_ctrl_h264_decode_params.dpb[]. */ - struct v4l2_h264_reference ref_pic_list0[32]; - struct v4l2_h264_reference ref_pic_list1[32]; + struct v4l2_h264_reference ref_pic_list0[V4L2_H264_REF_PIC_LIST_LEN]; + struct v4l2_h264_reference ref_pic_list1[V4L2_H264_REF_PIC_LIST_LEN]; __u32 flags; }; -- 2.26.0.rc2