From patchwork Mon Nov 9 17:31:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 320944 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp1918749ilc; Mon, 9 Nov 2020 09:32:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJyhii9WfysKU6C0NXhL19a1LCQbF3iW+GBLuprNLrLm0ULiU2Dkqzr7jDOB1ha9Dg/FKf/2 X-Received: by 2002:a17:906:c1c3:: with SMTP id bw3mr15443579ejb.126.1604943154961; Mon, 09 Nov 2020 09:32:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604943154; cv=none; d=google.com; s=arc-20160816; b=nobXtVMJ6UMnuG0Mvjp3KHBseIWcHeesIJ1lXCs0hp05tnLlcCFkzjx4ZQwjiEcub+ hQCeY3G5anOD312l7L2HFwRrmCI9BZ+pWkrh2sDGpQOm3XMdMegOK4Vh0uprbKtXdfy9 tmo6ksm6K/WwEGDSV5NpH4N+nnwBeyCA0XMLjVxiSsQ99weWzAoN9SRKwUmA/yLg3Rgp /7PcHVxLyjXdJGA4Jk27Qmj7IQjFIgH65XmIMor0rVwr80ySzJSAdiil/0T6g5dg/6/A aul8otKNRt05cfW16sIEqQ1H8uJM7Y9+OIR3jhNqfDJAp2ZU3IlkAg1EPitTXCwipetr qaZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=iNRzHj9PelsG2iSGOVGYTY9mpu2bcEQftZ5GO4rFbCI=; b=sS/ZQ4wl4hkA9VxkmyGSv6ZFGfyW+szEd0SmlcyS4Wmk0fAsMgNLMP+1a5dpVnCzh2 2vY77Jg4rXE6+9W2m0kkcdt1EHGbprJDgY3CKx2Qe523h8vVZRbHyLeH5za87bFpBXJC 1Gzgjn4+SNd70XwItU0CBKWhpVD/6vvolNKXPcNjWkBQglCM1i5tPlWfE/dcC94huOb9 pWsamyvyN3xTkrXyZvs+UbEGmC4DI/rV9lrDDvApSXhde9hyx90u2alljyYmMQjIuZv5 Ilf/252WG/Pz3WprcUXdTTn/xWS6nfdgitHzCcqxxT4zk16/liOvcN2x99IUH0DOIAH4 sGUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oPENIUiB; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f9si2485625ejq.352.2020.11.09.09.32.34; Mon, 09 Nov 2020 09:32:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-msm-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=@linaro.org header.s=google header.b=oPENIUiB; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731873AbgKIRcS (ORCPT + 15 others); Mon, 9 Nov 2020 12:32:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731800AbgKIRcS (ORCPT ); Mon, 9 Nov 2020 12:32:18 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0B03C0613CF for ; Mon, 9 Nov 2020 09:32:17 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id t11so9604586edj.13 for ; Mon, 09 Nov 2020 09:32:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iNRzHj9PelsG2iSGOVGYTY9mpu2bcEQftZ5GO4rFbCI=; b=oPENIUiBBvq53V9e8Lq0nYu3dojSOJm5X6ry31ClZSQP6nK+TAVGGfHYbC2cmjXoQ4 xSkXup47wSSyU1EfxcdLpbFNs9EjXltundh+EYtIRVx970I00BCCkaHuaO7PqjiMjUEi OzW0HAcs5EvdmWgoya0ezxIJt3YLDUe9sVd4TGqKSIufdAM2lkLETluoFNXDZcl24zzj Gvu9jikP9vIU1DdTZOEslGnZbdYIhiC8BFf/1yfhz/dWkmnQXxyXfvQjcDS2EfQZDLYn 4pbT7B3x9du3aFUkg5Ie+eSlcNLRZpyuksvlDaOLC/uuPeHjjCgH++BTM2KTGYNGSeqg 2dxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iNRzHj9PelsG2iSGOVGYTY9mpu2bcEQftZ5GO4rFbCI=; b=GJagMVGqDE1ZKpLbZz8XrSNSJmiPVWQLrNl4jPO4eEJeNCeAZO70lVHVStqK1vmhTJ IfF3Hd1TWH46a0p9chiQ8bG7bvxx8GqARPwJm2fslF2b5+gFgMDvJx9KolAdmpfrhOcW TAy+zMVyBFU6nAdkp+hK7Np5Yfwyh4dOUN2pmAScARbxs2Tr5M1CvZ+wElCQkmk2FhwG 6HpKWc230JG9IuoemRpK1B/2cF8CusL7/fbr04CzEDvWdxyFTWpOr2VkEsGLZ3GEPRzX GpCgF1XY2+hQktJc5/8YfDDCiZ8Ygfb+ec5DloF7tHu67cg+lAmG7fJpZEWxUouAWCi/ fMXQ== X-Gm-Message-State: AOAM533BXVsRL7gwHkoFweX/fuwlVmNpCbmC9VR0Ym4v3CFlkLx62ybL yyT32Panc4+7TEHLXHM22vVp6A== X-Received: by 2002:aa7:df04:: with SMTP id c4mr16581201edy.25.1604943136543; Mon, 09 Nov 2020 09:32:16 -0800 (PST) Received: from localhost.localdomain (hst-221-32.medicom.bg. [84.238.221.32]) by smtp.gmail.com with ESMTPSA id w18sm5037005edq.43.2020.11.09.09.32.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2020 09:32:15 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Nicolas Dufresne , Ezequiel Garcia , Hans Verkuil , Stanimir Varbanov Subject: [PATCH 1/3] v4l: Add HDR10 HEVC static metadata controls Date: Mon, 9 Nov 2020 19:31:51 +0200 Message-Id: <20201109173153.23720-2-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201109173153.23720-1-stanimir.varbanov@linaro.org> References: <20201109173153.23720-1-stanimir.varbanov@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add Content light level and Mastering display colour volume v4l2 compounf controls, relevant payload structures and validation. Signed-off-by: Stanimir Varbanov --- drivers/media/v4l2-core/v4l2-ctrls.c | 61 ++++++++++++++++++++++++++++ include/media/hevc-ctrls.h | 41 +++++++++++++++++++ include/media/v4l2-ctrls.h | 2 + 3 files changed, 104 insertions(+) -- 2.17.1 diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index bd7f330c941c..f70eaa6a46df 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1023,6 +1023,8 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS: return "HEVC Slice Parameters"; case V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE: return "HEVC Decode Mode"; case V4L2_CID_MPEG_VIDEO_HEVC_START_CODE: return "HEVC Start Code"; + case V4L2_CID_MPEG_VIDEO_HEVC_CLL_INFO: return "HEVC Content Light Info"; + case V4L2_CID_MPEG_VIDEO_HEVC_MASTERING_DISPLAY: return "HEVC Mastering Display"; /* CAMERA controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ @@ -1461,6 +1463,12 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS: *type = V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS; break; + case V4L2_CID_MPEG_VIDEO_HEVC_CLL_INFO: + *type = V4L2_CTRL_TYPE_HEVC_CLL_INFO; + break; + case V4L2_CID_MPEG_VIDEO_HEVC_MASTERING_DISPLAY: + *type = V4L2_CTRL_TYPE_HEVC_MASTERING_DISPLAY; + break; case V4L2_CID_UNIT_CELL_SIZE: *type = V4L2_CTRL_TYPE_AREA; *flags |= V4L2_CTRL_FLAG_READ_ONLY; @@ -1775,6 +1783,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, 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; + struct v4l2_ctrl_hevc_mastering_display *p_hevc_mastering; struct v4l2_area *area; void *p = ptr.p + idx * ctrl->elem_size; unsigned int i; @@ -1934,6 +1943,52 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, zero_padding(*p_hevc_slice_params); break; + case V4L2_CTRL_TYPE_HEVC_CLL_INFO: + break; + + case V4L2_CTRL_TYPE_HEVC_MASTERING_DISPLAY: + p_hevc_mastering = p; + + for (i = 0; i < 3; ++i) { + if (p_hevc_mastering->display_primaries_x[i] < + V4L2_HEVC_MASTERING_PRIMARIES_X_LOW || + p_hevc_mastering->display_primaries_x[i] > + V4L2_HEVC_MASTERING_PRIMARIES_X_HIGH || + p_hevc_mastering->display_primaries_y[i] < + V4L2_HEVC_MASTERING_PRIMARIES_Y_LOW || + p_hevc_mastering->display_primaries_y[i] > + V4L2_HEVC_MASTERING_PRIMARIES_Y_HIGH) + return -EINVAL; + } + + if (p_hevc_mastering->white_point_x < + V4L2_HEVC_MASTERING_WHITE_POINT_X_LOW || + p_hevc_mastering->white_point_x > + V4L2_HEVC_MASTERING_WHITE_POINT_X_HIGH || + p_hevc_mastering->white_point_y < + V4L2_HEVC_MASTERING_WHITE_POINT_Y_LOW || + p_hevc_mastering->white_point_y > + V4L2_HEVC_MASTERING_WHITE_POINT_Y_HIGH) + return -EINVAL; + + if (p_hevc_mastering->max_luminance < + V4L2_HEVC_MASTERING_MAX_LUMA_LOW || + p_hevc_mastering->max_luminance > + V4L2_HEVC_MASTERING_MAX_LUMA_HIGH || + p_hevc_mastering->min_luminance < + V4L2_HEVC_MASTERING_MIN_LUMA_LOW || + p_hevc_mastering->min_luminance > + V4L2_HEVC_MASTERING_MIN_LUMA_HIGH) + return -EINVAL; + + if (p_hevc_mastering->max_luminance == + V4L2_HEVC_MASTERING_MAX_LUMA_LOW && + p_hevc_mastering->min_luminance == + V4L2_HEVC_MASTERING_MIN_LUMA_HIGH) + return -EINVAL; + + break; + case V4L2_CTRL_TYPE_AREA: area = p; if (!area->width || !area->height) @@ -2626,6 +2681,12 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS: elem_size = sizeof(struct v4l2_ctrl_hevc_slice_params); break; + case V4L2_CTRL_TYPE_HEVC_CLL_INFO: + elem_size = sizeof(struct v4l2_ctrl_hevc_cll_info); + break; + case V4L2_CTRL_TYPE_HEVC_MASTERING_DISPLAY: + elem_size = sizeof(struct v4l2_ctrl_hevc_mastering_display); + break; case V4L2_CTRL_TYPE_AREA: elem_size = sizeof(struct v4l2_area); break; diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h index 1009cf0891cc..d254457d2846 100644 --- a/include/media/hevc-ctrls.h +++ b/include/media/hevc-ctrls.h @@ -209,4 +209,45 @@ struct v4l2_ctrl_hevc_slice_params { __u64 flags; }; +/* + * Content light level information. + * Source Rec. ITU-T H.265 v7 (11/2019) HEVC; D.2.35 + */ +#define V4L2_CID_MPEG_VIDEO_HEVC_CLL_INFO (V4L2_CID_MPEG_BASE + 1017) +#define V4L2_CTRL_TYPE_HEVC_CLL_INFO 0x0123 + +struct v4l2_ctrl_hevc_cll_info { + __u16 max_content_light_level; + __u16 max_pic_average_light_level; +}; + +/* + * Mastering display colour volume. + * Source Rec. ITU-T H.265 v7 (11/2019) HEVC; D.2.28 + */ +#define V4L2_CID_MPEG_VIDEO_HEVC_MASTERING_DISPLAY (V4L2_CID_MPEG_BASE + 1018) +#define V4L2_CTRL_TYPE_HEVC_MASTERING_DISPLAY 0x0124 + +#define V4L2_HEVC_MASTERING_PRIMARIES_X_LOW 5 +#define V4L2_HEVC_MASTERING_PRIMARIES_X_HIGH 37000 +#define V4L2_HEVC_MASTERING_PRIMARIES_Y_LOW 5 +#define V4L2_HEVC_MASTERING_PRIMARIES_Y_HIGH 42000 +#define V4L2_HEVC_MASTERING_WHITE_POINT_X_LOW 5 +#define V4L2_HEVC_MASTERING_WHITE_POINT_X_HIGH 37000 +#define V4L2_HEVC_MASTERING_WHITE_POINT_Y_LOW 5 +#define V4L2_HEVC_MASTERING_WHITE_POINT_Y_HIGH 42000 +#define V4L2_HEVC_MASTERING_MAX_LUMA_LOW 50000 +#define V4L2_HEVC_MASTERING_MAX_LUMA_HIGH 100000000 +#define V4L2_HEVC_MASTERING_MIN_LUMA_LOW 1 +#define V4L2_HEVC_MASTERING_MIN_LUMA_HIGH 50000 + +struct v4l2_ctrl_hevc_mastering_display { + __u16 display_primaries_x[3]; + __u16 display_primaries_y[3]; + __u16 white_point_x; + __u16 white_point_y; + __u32 max_luminance; + __u32 min_luminance; +}; + #endif diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index cb25f345e9ad..6120e29945e1 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -80,6 +80,8 @@ union v4l2_ctrl_ptr { 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; + struct v4l2_ctrl_hevc_cll_info *p_hevc_cll; + struct v4l2_ctrl_hevc_mastering_display *p_hevc_mastering; struct v4l2_area *p_area; void *p; const void *p_const; From patchwork Mon Nov 9 17:31:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 321114 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DC3CC388F7 for ; Mon, 9 Nov 2020 17:32:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B11C9216C4 for ; Mon, 9 Nov 2020 17:32:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="K/q9QV3O" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732079AbgKIRcU (ORCPT ); Mon, 9 Nov 2020 12:32:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731976AbgKIRcT (ORCPT ); Mon, 9 Nov 2020 12:32:19 -0500 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96737C0613D3 for ; Mon, 9 Nov 2020 09:32:19 -0800 (PST) Received: by mail-ed1-x544.google.com with SMTP id a71so9614061edf.9 for ; Mon, 09 Nov 2020 09:32:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FGNFPuj/SX/rcqMTW0uy7ZBhU7+E+vudgCF6hi4C9Do=; b=K/q9QV3OM/pZlqVFg480sOR2HLKVB+UGI5Q88kxNCVOsAU1QmHphPzs7d/VJErln9/ pXBsgE9IW02Pk5v7PwoKTFCoD3cigdUPJtp1OLeWpF4DUT2aVaM4kEwWZn7jq2yyUVlX YN7a3qZe3BNwFHcBvz5lb2eGI6l2u7FdvfqcPKgNGls3F1k01MK8aLh5AbKT0rc5Z1jn Ecej351fPYLZy3WKX+ypYWJGgUu3I2qil96zviN/cKjgoVFAtNhsaRMIn8p90f3xz3Rx 3taElNqFCxCqhxHtJQRth5dh14iFtusqGWu+Sq4Hi3qc9Nw7FKLDeaD0yjKzvATHkQum 2tOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FGNFPuj/SX/rcqMTW0uy7ZBhU7+E+vudgCF6hi4C9Do=; b=PGn+SsAbhMAtPS/HMHupZm3qU+P5e8F7+UpK/57tgFLBPvD3kGO/wneCMJSeITcK1Z WhuFGUVf7akV4l1i45fNjD3hWfgrvaSak32XZGrL7E9R19SB/LAMttpjBRAGrilzbhJ8 aJyaxgoQzVlPBe6pInUedR60ZhLHtfsGoKM/MCxXKE7TGouo1p8oNYxnAFvLK3E6rFBi WVfMX4x7pyPlFXDTsgFx8A/I2Qjy65apr/HrGaq7wAcOgcaSdJXeXjjtUI7MIlZvLFGV B7IEZl+IFhEcxqldqsC03BgA0Ww+FDXyMoNeJQl+siFIKaPQaPIbTyqGHgCAwa2HrjWi WCeQ== X-Gm-Message-State: AOAM532xum5A15tq4+mmS1fi6t/z9nWwBU6+VRbbZV/gmNQ+41tZEsxc +NCcZ2TVIxOTslA/TR0HnHT2ng== X-Google-Smtp-Source: ABdhPJyMJQrQJTwuF2GzVsX8AOFWtNJg7ZZydyNbS+xqZZiVJZf1tHX/Sj9G4pF+MVgAR4WBTaqV+g== X-Received: by 2002:a50:f68b:: with SMTP id d11mr16978977edn.64.1604943138340; Mon, 09 Nov 2020 09:32:18 -0800 (PST) Received: from localhost.localdomain (hst-221-32.medicom.bg. [84.238.221.32]) by smtp.gmail.com with ESMTPSA id w18sm5037005edq.43.2020.11.09.09.32.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2020 09:32:17 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Nicolas Dufresne , Ezequiel Garcia , Hans Verkuil , Stanimir Varbanov Subject: [PATCH 2/3] docs: media: Document CLL and Mastering display Date: Mon, 9 Nov 2020 19:31:52 +0200 Message-Id: <20201109173153.23720-3-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201109173153.23720-1-stanimir.varbanov@linaro.org> References: <20201109173153.23720-1-stanimir.varbanov@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Document Content light level and Mastering display colour volume. Signed-off-by: Stanimir Varbanov --- .../media/v4l/ext-ctrls-codec.rst | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index ce728c757eaf..39d0aab5ca3d 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -4382,3 +4382,64 @@ enum v4l2_mpeg_video_hevc_size_of_length_field - - Selecting this value specifies that HEVC slices are expected to be prefixed by Annex B start codes. According to :ref:`hevc` valid start codes can be 3-bytes 0x000001 or 4-bytes 0x00000001. + +``V4L2_CID_MPEG_VIDEO_HEVC_CLL_INFO (struct)`` + The Content Light Level defines upper bounds for the nominal target + brightness light level of the pictures. + +.. c:type:: v4l2_ctrl_hevc_cll_info + +.. cssclass:: longtable + +.. flat-table:: struct v4l2_ctrl_hevc_cll_info + :header-rows: 0 + :stub-columns: 0 + :widths: 1 1 2 + + * - __u16 + - ``max_content_light_level`` + - An upper bound on the maximum light level among all individual + samples for the pictures of coded video sequence, cd/m2. + * - __u16 + - ``max_pic_average_light_level`` + - An upper bound on the maximum average light level among the + samples for any idividual picture of coded video sequence, cd/m2. + +``V4L2_CID_MPEG_VIDEO_HEVC_MASTERING_DISPLAY (struct)`` + The mastering display defines the colour volume (the colour primaries, + white point and luminance range) of a display considered to be the + mastering display for current video content. + +.. c:type:: v4l2_ctrl_hevc_mastering_display + +.. cssclass:: longtable + +.. flat-table:: struct v4l2_ctrl_hevc_mastering_display + :header-rows: 0 + :stub-columns: 0 + :widths: 1 1 2 + + * - __u16 + - ``display_primaries_x[3]`` + - Specifies the normalized x chromaticity coordinate of the colour + primary component of the mastering display. + * - __u16 + - ``display_primaries_y[3]`` + - Specifies the normalized y chromaticity coordinate of the colour + primary component of the mastering display. + * - __u16 + - ``white_point_x`` + - Specifies the normalized x chromaticity coordinate of the white + point of the mastering display. + * - __u16 + - ``white_point_y`` + - Specifies the normalized y chromaticity coordinate of the white + point of the mastering display. + * - __u32 + - ``max_luminance`` + - Specifies the nominal maximum display luminance of the mastering + display. + * - __u32 + - ``min_luminance`` + - specifies the nominal minimum display luminance of the mastering + display. From patchwork Mon Nov 9 17:31:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 320942 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp1918706ilc; Mon, 9 Nov 2020 09:32:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzhewZbiGcX51k0fWnsS80fbQigtGeRj/tHfN2K7agjVgqE7ZIIDLREiKtCEE6l+k/xWMtE X-Received: by 2002:a50:ab07:: with SMTP id s7mr16280535edc.287.1604943151676; Mon, 09 Nov 2020 09:32:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604943151; cv=none; d=google.com; s=arc-20160816; b=yncokwwTn44FSamytnTHvH0jWuwkm1Q432HGebqenfmrCB+4DtyE9zTGUk4Hks/MYR dx0mrPkBSwjdsKZCZa14muaOO3T3bmvSRl5HUiNCzL9umxoxIIJ+GXJfagLhGO/2UW+/ NTmlHUd0WGWYVolC+vdoBJuuxVC9vROtERWr+zwX0nHKS3oNXTDgA9tpYBI+li80WV2C C4z9lwUdeVMSChn6wxJtnEPM7fxtbtseLJd+PcH8Kzx4gUN1Sqh9Y+BzDl6F+NqZTIhl Kc0C9K/co//O9sebmW77pxop1ZNtzwgrnza2/b24MLSdUc+2YM06gqxEa6SAD9Yc8U6y kXEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=ezO+DX9s/19HhOfnYGYVPy5hE139zPRMF2WAfs7c5YQ=; b=0Ic7GTCYJn2OxOBcm4cWkX5KiKOPqqYOL00TFlFnoKLIrl4BVZbwdbX+yH4nI0t3v9 AsfvgER3wPqBH1a5TnwJe2Pysqd5RexHMQRJVugp/1yD0/9M0DJ8+HcsTKZkM/nDeE0k lfWw7uAzt4ctxpDC7uEMtaAe7JBcDHNR6Js4HuIixgbdjywLbOzaaw66N0ofBprXBENC SXb91cQIyqPupvBlf7G/V98GsIj5gFbAWQ0sQcmQivGAk4n9q97Tb7X0sR8xBqxMXq0Q 8m6scGMJNtSOGe5AxD0zty6xY4EmogsBOHoLfj9NhS7ceVEN1qvYdF/FZzC5YOpBSru4 FmWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="aD/roHpw"; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f9si2485625ejq.352.2020.11.09.09.32.31; Mon, 09 Nov 2020 09:32:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-msm-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=@linaro.org header.s=google header.b="aD/roHpw"; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732116AbgKIRcW (ORCPT + 15 others); Mon, 9 Nov 2020 12:32:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732094AbgKIRcV (ORCPT ); Mon, 9 Nov 2020 12:32:21 -0500 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D54DC0617A6 for ; Mon, 9 Nov 2020 09:32:21 -0800 (PST) Received: by mail-ed1-x542.google.com with SMTP id l5so3164900edq.11 for ; Mon, 09 Nov 2020 09:32:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ezO+DX9s/19HhOfnYGYVPy5hE139zPRMF2WAfs7c5YQ=; b=aD/roHpwAG/NHJo6730N73bntrF+DDKc+Y3fCEYr+bv+t0SUqksRQG2yws173ZywNx qMBR3Xhj9ScuhqQ2U7UP4CHX5hX+ED0yhX/LtsqQ2PRYCPWJ3oUiisFNVVgWfkxphfC9 YiyRQ6PBvAfD7R1ct4wFrJ1KDp9GosPPheSKi6FCgA5nOKEtNH9E9Mwa3a6mxzmJrHlJ h0MfPuTCgGz/b91UEC/fKo48dpRGXKePqvXG3Zv6hToqqIh+uA0E+BTId5iDrp63Eu0q 4OfPOfLAooUTq0KTNUmivZNDiUqkbfoDWFW602ULnPbbK5Gtc5BlkiOkPpTC0sYjxuv0 x1Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ezO+DX9s/19HhOfnYGYVPy5hE139zPRMF2WAfs7c5YQ=; b=tPGH8T7k6Uq1msVG0gstV63Z3WBKNNoa6ONQiKXmrYB00VPaaxAohyT/eWqBnYrRpC Tj/+RqiV5qMXAD1WbQN/5tKpFZ60mHaoJwz/wHafZHi1CSLQRzYIG5GmI+ASeTHOeOhv YjFb84eYqa/w5JvYOVKlT4GBQnkoMrE90T48KXLv8qztf79nQBbGg7Swxc4vZ51aeiff hHvGsnOddu376buKWRSbYXD59donVK8GPpJdyt0sbCCXfD9TizuHXo2FgtHQSVPYDKiD nlvNXqKgzR/Q+OD3MkYfG7uAY14YNmXaU1xkzi+bqbY8ctDYALPrwB9o7Ue+FB6VI98F 9R2w== X-Gm-Message-State: AOAM5308c97Lsbw1Jemv0Sz3OQ0KJpPNKiMublQ/m+XI5AJwD+2Tb9i9 Mw9nZrItVic9E0sb1npEvFpx53jOGiIR8LOc X-Received: by 2002:aa7:da44:: with SMTP id w4mr16724948eds.131.1604943140039; Mon, 09 Nov 2020 09:32:20 -0800 (PST) Received: from localhost.localdomain (hst-221-32.medicom.bg. [84.238.221.32]) by smtp.gmail.com with ESMTPSA id w18sm5037005edq.43.2020.11.09.09.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2020 09:32:19 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Nicolas Dufresne , Ezequiel Garcia , Hans Verkuil , Stanimir Varbanov Subject: [PATCH 3/3] venus: venc: Add support for CLL and Mastering display controls Date: Mon, 9 Nov 2020 19:31:53 +0200 Message-Id: <20201109173153.23720-4-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201109173153.23720-1-stanimir.varbanov@linaro.org> References: <20201109173153.23720-1-stanimir.varbanov@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Create CLL and Mastering display colour volume v4l2 controls for encoder, add handling of HDR10 PQ SEI packet payloads for v4. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 3 ++ drivers/media/platform/qcom/venus/hfi_cmds.c | 8 +++++ .../media/platform/qcom/venus/hfi_helper.h | 20 +++++++++++++ drivers/media/platform/qcom/venus/venc.c | 29 +++++++++++++++++++ .../media/platform/qcom/venus/venc_ctrls.c | 16 +++++++++- 5 files changed, 75 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 7b79a33dc9d6..9d2637983927 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -245,6 +245,9 @@ struct venc_controls { u32 profile; u32 level; + + struct v4l2_ctrl_hevc_cll_info cll; + struct v4l2_ctrl_hevc_mastering_display mastering; }; struct venus_buffer { diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c index 7022368c1e63..081e5a816bca 100644 --- a/drivers/media/platform/qcom/venus/hfi_cmds.c +++ b/drivers/media/platform/qcom/venus/hfi_cmds.c @@ -1205,6 +1205,14 @@ pkt_session_set_property_4xx(struct hfi_session_set_property_pkt *pkt, pkt->shdr.hdr.size += sizeof(u32) + sizeof(*cu); break; } + case HFI_PROPERTY_PARAM_VENC_HDR10_PQ_SEI: { + struct hfi_hdr10_pq_sei *in = pdata, *hdr10 = prop_data; + + memcpy(hdr10, in, sizeof(*hdr10)); + pkt->shdr.hdr.size += sizeof(u32) + sizeof(*hdr10); + break; + } + case HFI_PROPERTY_CONFIG_VENC_MAX_BITRATE: case HFI_PROPERTY_CONFIG_VDEC_POST_LOOP_DEBLOCKER: case HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE: diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h index 60ee2479f7a6..8e8dc6b5c855 100644 --- a/drivers/media/platform/qcom/venus/hfi_helper.h +++ b/drivers/media/platform/qcom/venus/hfi_helper.h @@ -506,6 +506,7 @@ #define HFI_PROPERTY_PARAM_VENC_VPX_ERROR_RESILIENCE_MODE 0x2005029 #define HFI_PROPERTY_PARAM_VENC_HIER_B_MAX_NUM_ENH_LAYER 0x200502c #define HFI_PROPERTY_PARAM_VENC_HIER_P_HYBRID_MODE 0x200502f +#define HFI_PROPERTY_PARAM_VENC_HDR10_PQ_SEI 0x2005036 /* * HFI_PROPERTY_CONFIG_VENC_COMMON_START @@ -791,6 +792,25 @@ struct hfi_ltr_mark { u32 mark_frame; }; +struct hfi_mastering_display_colour_sei_payload { + u32 display_primaries_x[3]; + u32 display_primaries_y[3]; + u32 white_point_x; + u32 white_point_y; + u32 max_display_mastering_luminance; + u32 min_display_mastering_luminance; +}; + +struct hfi_content_light_level_sei_payload { + u32 max_content_light; + u32 max_pic_average_light; +}; + +struct hfi_hdr10_pq_sei { + struct hfi_mastering_display_colour_sei_payload mastering; + struct hfi_content_light_level_sei_payload cll; +}; + struct hfi_framesize { u32 buffer_type; u32 width; diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index f8b1484e7dcd..ae593a6a5a22 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -587,6 +587,35 @@ static int venc_set_properties(struct venus_inst *inst) return ret; } + if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_HEVC) { + struct hfi_hdr10_pq_sei hdr10; + unsigned int c; + + ptype = HFI_PROPERTY_PARAM_VENC_HDR10_PQ_SEI; + + for (c = 0; c < 3; c++) { + hdr10.mastering.display_primaries_x[c] = + ctr->mastering.display_primaries_x[c]; + hdr10.mastering.display_primaries_y[c] = + ctr->mastering.display_primaries_y[c]; + } + + hdr10.mastering.white_point_x = ctr->mastering.white_point_x; + hdr10.mastering.white_point_y = ctr->mastering.white_point_y; + hdr10.mastering.max_display_mastering_luminance = + ctr->mastering.max_luminance; + hdr10.mastering.min_display_mastering_luminance = + ctr->mastering.min_luminance; + + hdr10.cll.max_content_light = ctr->cll.max_content_light_level; + hdr10.cll.max_pic_average_light = + ctr->cll.max_pic_average_light_level; + + ret = hfi_session_set_property(inst, ptype, &hdr10); + if (ret) + return ret; + } + /* IDR periodicity, n: * n = 0 - only the first I-frame is IDR frame * n = 1 - all I-frames will be IDR frames diff --git a/drivers/media/platform/qcom/venus/venc_ctrls.c b/drivers/media/platform/qcom/venus/venc_ctrls.c index 0708b3b89d0c..dab1286cbb1a 100644 --- a/drivers/media/platform/qcom/venus/venc_ctrls.c +++ b/drivers/media/platform/qcom/venus/venc_ctrls.c @@ -198,6 +198,12 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE: ctr->frame_skip_mode = ctrl->val; break; + case V4L2_CID_MPEG_VIDEO_HEVC_CLL_INFO: + ctr->cll = *ctrl->p_new.p_hevc_cll; + break; + case V4L2_CID_MPEG_VIDEO_HEVC_MASTERING_DISPLAY: + ctr->mastering = *ctrl->p_new.p_hevc_mastering; + break; default: return -EINVAL; } @@ -213,7 +219,7 @@ int venc_ctrl_init(struct venus_inst *inst) { int ret; - ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 33); + ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 35); if (ret) return ret; @@ -364,6 +370,14 @@ int venc_ctrl_init(struct venus_inst *inst) (1 << V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT)), V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED); + v4l2_ctrl_new_std_compound(&inst->ctrl_handler, &venc_ctrl_ops, + V4L2_CID_MPEG_VIDEO_HEVC_CLL_INFO, + v4l2_ctrl_ptr_create(NULL)); + + v4l2_ctrl_new_std_compound(&inst->ctrl_handler, &venc_ctrl_ops, + V4L2_CID_MPEG_VIDEO_HEVC_MASTERING_DISPLAY, + v4l2_ctrl_ptr_create(NULL)); + ret = inst->ctrl_handler.error; if (ret) goto err;