From patchwork Tue Mar 2 11:44:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 390661 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, 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 A29F4C433E0 for ; Tue, 2 Mar 2021 17:39:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5225364F04 for ; Tue, 2 Mar 2021 17:39:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347068AbhCBRgB (ORCPT ); Tue, 2 Mar 2021 12:36:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349998AbhCBLpa (ORCPT ); Tue, 2 Mar 2021 06:45:30 -0500 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFD2FC061797 for ; Tue, 2 Mar 2021 03:44:36 -0800 (PST) Received: by mail-ej1-x633.google.com with SMTP id jt13so34703938ejb.0 for ; Tue, 02 Mar 2021 03:44:36 -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 :mime-version:content-transfer-encoding; bh=OYb8vJLtF0OcL+zflNVb+VLYn9hupFKm6pNP1npRGAs=; b=Fdzmb2mRXTcQ71E7e/Rz9NstwwCYPElhCv8G7FK/LY3feNupOcxaNfx/7MchmQ/vNL iDfzMaZK4OQisuZk3ng8Z2redjqlToRn5uGKL3rndzr50AuqN/kdKo4KXVzsVfOIQAqd y7isDG/ym9EAbW1Y9Ym7a4tCXyRQNgscnZpSkcK6VXl0eyl/AStNR/0OPzfiYPcXICqt ny9O5+0PfSEjSZdkBg9uMZx+u7TB2+rkfR16kYMCfSprQwCSX0SZydRe6XpxMYiDYL16 Uua8gvl0lseBR7r6ooml18e9YvnVYLWHRZHVME0MY7pw+ZFUrw1HM+uuctAHz6Up+RFs 2tnw== 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:mime-version:content-transfer-encoding; bh=OYb8vJLtF0OcL+zflNVb+VLYn9hupFKm6pNP1npRGAs=; b=SAbLy3Z1lFV11Z4ZBuwNMS7XYQaAO0x3CrkNNQJeR0mNq1hPL0GMePepP5YNp/vWoV w5JlHkplTnsS0ppyakMt2iFk39QEQUoCyCA8DS3FJUXe4A+L+IJmLNll1j4PnkmKIZwJ YBBJYCeZxtx5VbnMhaAc7V7MIxFvtk1y+RG4MPykxksE3m3DVA9OBqnxyo+rescD8CDd BzpozP0zKY6rbiaXU211I1deYuZZmDfk7uW3QrlMQVmcq9j/q20J8gwcY0cQE9xhXPft DI4vXEI52w6NGDacZNhrwucmiF380BwxV25NGWA2GleAW0efiMniH2MgiQqSVhHnn1Ac NyqQ== X-Gm-Message-State: AOAM533++0Gwip76aXi14dTYg95azEcRCaezFr8ASI1+VfOGjEFmQlLV g92bp5q+EjDmCVBP8TsKEUbThLbdJOo4fuPa X-Google-Smtp-Source: ABdhPJxPnMQDXF+ikLOWRIcd1g0H8KL/Bv0qB65dbjTr/Y9F89o5L8MY2b4sVhbO1Npyd8zBOZRRnA== X-Received: by 2002:a17:906:388d:: with SMTP id q13mr2469836ejd.34.1614685475483; Tue, 02 Mar 2021 03:44:35 -0800 (PST) Received: from localhost.localdomain (hst-208-217.medicom.bg. [84.238.208.217]) by smtp.gmail.com with ESMTPSA id x17sm18494897edq.42.2021.03.02.03.44.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Mar 2021 03:44:35 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Hans Verkuil , Stanimir Varbanov Subject: [PATCH v2 1/2] v4l2-ctrl: Add decoder conceal color control Date: Tue, 2 Mar 2021 13:44:29 +0200 Message-Id: <20210302114430.3594475-2-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210302114430.3594475-1-stanimir.varbanov@linaro.org> References: <20210302114430.3594475-1-stanimir.varbanov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add decoder v4l2 control to set conceal color. Signed-off-by: Stanimir Varbanov Reviewed-by: Hans Verkuil --- .../media/v4l/ext-ctrls-codec.rst | 33 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-ctrls.c | 9 +++++ include/uapi/linux/v4l2-controls.h | 1 + 3 files changed, 43 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index 00944e97d638..817da8a14572 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -674,6 +674,39 @@ enum v4l2_mpeg_video_frame_skip_mode - is currently displayed (decoded). This value is reset to 0 whenever the decoder is started. +``V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR (integer64)`` + This control sets conceal color in YUV color space. It describes the + client preference of error conceal color in case of error where + reference frame is missing. The decoder should fill the reference + buffer with preferred color and use it for future decoding. The control + is using 16bits per channel. + Applicable to decoders. + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + + * - + - 8bit format + - 10bit format + - 12bit format + * - Y luminance + - Bit 0:7 + - Bit 0:9 + - Bit 0:11 + * - Cb chrominance + - Bit 16:23 + - Bit 16:25 + - Bit 16:27 + * - Cr chrominance + - Bit 32:39 + - Bit 32:41 + - Bit 32:43 + * - Must be zero + - Bit 48:63 + - Bit 48:63 + - Bit 48:63 + ``V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE (boolean)`` If enabled the decoder expects to receive a single slice per buffer, otherwise the decoder expects a single frame in per buffer. diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 016cf6204cbb..a3b9d28a00b7 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -945,6 +945,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_MPEG_VIDEO_VBV_SIZE: return "VBV Buffer Size"; case V4L2_CID_MPEG_VIDEO_DEC_PTS: return "Video Decoder PTS"; case V4L2_CID_MPEG_VIDEO_DEC_FRAME: return "Video Decoder Frame Count"; + case V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR: return "Video Decoder Conceal Color"; case V4L2_CID_MPEG_VIDEO_VBV_DELAY: return "Initial Delay for VBV Control"; case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE: return "Horizontal MV Search Range"; case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE: return "Vertical MV Search Range"; @@ -1430,6 +1431,14 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, *max = 0x7fffffffffffffffLL; *step = 1; break; + case V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR: + *type = V4L2_CTRL_TYPE_INTEGER64; + *min = 0; + /* default for 8bit black, luma is 16, chroma is 128 */ + *def = 0x8000800010LL; + *max = 0xffffffffffffLL; + *step = 1; + break; case V4L2_CID_PIXEL_RATE: *type = V4L2_CTRL_TYPE_INTEGER64; *flags |= V4L2_CTRL_FLAG_READ_ONLY; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 039c0d7add1b..5e5a3068be2d 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -428,6 +428,7 @@ enum v4l2_mpeg_video_multi_slice_mode { #define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE (V4L2_CID_CODEC_BASE+228) #define V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME (V4L2_CID_CODEC_BASE+229) #define V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_ID (V4L2_CID_CODEC_BASE+230) +#define V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR (V4L2_CID_CODEC_BASE+231) /* CIDs for the MPEG-2 Part 2 (H.262) codec */ #define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_CODEC_BASE+270) From patchwork Tue Mar 2 11:44:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 390660 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, 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 27FACC433E0 for ; Tue, 2 Mar 2021 17:39:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D29D164F04 for ; Tue, 2 Mar 2021 17:39:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349828AbhCBRgn (ORCPT ); Tue, 2 Mar 2021 12:36:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343994AbhCBLse (ORCPT ); Tue, 2 Mar 2021 06:48:34 -0500 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC914C0617AA for ; Tue, 2 Mar 2021 03:44:38 -0800 (PST) Received: by mail-ed1-x536.google.com with SMTP id l12so24751678edt.3 for ; Tue, 02 Mar 2021 03:44:38 -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 :mime-version:content-transfer-encoding; bh=fSiros/bpA33DrxLIopBprg2PSwxl41ia1ZrqmhCZho=; b=CNiOAB/aDlzJx9jbByOgDWXCKNWzh8AJzgEz0m4qj5XspiYYDgtMl9nEejj/Y+v5oS qLbKQ9CvJaJ3+NrID6Tu+BUBGvcrrc61b8jK6nSFt830rNnGPFwzLYfYSdxzpq4LWwar DYgblksxROekZQeRoThk7ywNOChEPN5LiWDmF4Tdl+ahUIdLsHg6SaGnyGTi7qvaA+kI HYb4d+9Wwq4GT+nu7qnZSuTaqdje8i9mougNcFj0RpGnJLuummJovJ7CtGOBS+A6arNt NQ7UkYoZrRjFmnfN2VSGxYUOlugz2BY0hu+krFNXB5UbUbbxpRYAGhK11g9d5eCYxgkM /xDA== 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:mime-version:content-transfer-encoding; bh=fSiros/bpA33DrxLIopBprg2PSwxl41ia1ZrqmhCZho=; b=fgxNr92L6PO63HK8m4Ak7uz0Hd28ZUCIPP1e9S876jHT1K2YAEKCZfTWDTefIObSr/ Rv4cZZH6aKDU4gW66xZ5ZhyXlElRzx49ksaXFq4U9xj0X+EWJC+Kh/p/rLHV9M/roKhh MsTdAiXdryLsT7A+NrqUAXzafMuEWX4FGzPfsbNprK0u3WqiHtfJSaGSP+q3eMY2Q/1J SepMibACZjyRRLOz6z1pJkyXbnl4h26fUoILtsLw7MV7b/Y8CCucgevtZOqqYtdKE1FK rlg++tc3qbn5oRI8nVESb4wXFLkGdTG39XU6NjnSaYBo4MaP/d0RRuvIVRNK2qmqX/j/ TA1w== X-Gm-Message-State: AOAM53123WKBtgdi9oeil9dO+Qj3rao3wIkm66wQYGXFGhFsBpG22wY0 usrtl8DvpAPE3zu2Uui9nocuXIrlGYAIhP9Q X-Google-Smtp-Source: ABdhPJwbHuuQPFtmc38SU8zyIEd/Ak7lLBGY51qRk27BvP/2szHwIi3IGa1Jqg5gpAWhRYaJTOXQnQ== X-Received: by 2002:aa7:dc4e:: with SMTP id g14mr1337280edu.114.1614685476271; Tue, 02 Mar 2021 03:44:36 -0800 (PST) Received: from localhost.localdomain (hst-208-217.medicom.bg. [84.238.208.217]) by smtp.gmail.com with ESMTPSA id x17sm18494897edq.42.2021.03.02.03.44.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Mar 2021 03:44:36 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Hans Verkuil , Stanimir Varbanov Subject: [PATCH v2 2/2] venus: vdec: Add support for conceal control Date: Tue, 2 Mar 2021 13:44:30 +0200 Message-Id: <20210302114430.3594475-3-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210302114430.3594475-1-stanimir.varbanov@linaro.org> References: <20210302114430.3594475-1-stanimir.varbanov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Adds support for decoder conceal color control. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 1 + drivers/media/platform/qcom/venus/hfi_cmds.c | 18 ++++++++++++++++-- drivers/media/platform/qcom/venus/hfi_helper.h | 10 ++++++++++ drivers/media/platform/qcom/venus/vdec.c | 11 ++++++++++- drivers/media/platform/qcom/venus/vdec_ctrls.c | 7 +++++++ 5 files changed, 44 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index a252ed32cc14..b70ff14e5a5b 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -172,6 +172,7 @@ struct vdec_controls { u32 post_loop_deb_mode; u32 profile; u32 level; + u64 conceal_color; }; struct venc_controls { diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c index 4f7565834469..884339aae6a7 100644 --- a/drivers/media/platform/qcom/venus/hfi_cmds.c +++ b/drivers/media/platform/qcom/venus/hfi_cmds.c @@ -760,7 +760,9 @@ static int pkt_session_set_property_1x(struct hfi_session_set_property_pkt *pkt, struct hfi_conceal_color *color = prop_data; u32 *in = pdata; - color->conceal_color = *in; + color->conceal_color = *in & 0xff; + color->conceal_color |= ((*in >> 10) & 0xff) << 8; + color->conceal_color |= ((*in >> 20) & 0xff) << 16; pkt->shdr.hdr.size += sizeof(u32) + sizeof(*color); break; } @@ -1255,7 +1257,19 @@ pkt_session_set_property_6xx(struct hfi_session_set_property_pkt *pkt, cq->frame_quality = in->frame_quality; pkt->shdr.hdr.size += sizeof(u32) + sizeof(*cq); break; - } default: + } + case HFI_PROPERTY_PARAM_VDEC_CONCEAL_COLOR: { + struct hfi_conceal_color_v4 *color = prop_data; + u32 *in = pdata; + + color->conceal_color_8bit = *in & 0xff; + color->conceal_color_8bit |= ((*in >> 10) & 0xff) << 8; + color->conceal_color_8bit |= ((*in >> 20) & 0xff) << 16; + color->conceal_color_10bit = *in; + pkt->shdr.hdr.size += sizeof(u32) + sizeof(*color); + break; + } + default: return pkt_session_set_property_4xx(pkt, cookie, ptype, pdata); } diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h index 6b524c7cde5f..fa49b49170b7 100644 --- a/drivers/media/platform/qcom/venus/hfi_helper.h +++ b/drivers/media/platform/qcom/venus/hfi_helper.h @@ -685,10 +685,20 @@ struct hfi_vc1e_perf_cfg_type { u32 search_range_y_subsampled[3]; }; +/* + * 0 - 7bit -> Luma (def: 16) + * 8 - 15bit -> Chroma (def: 128) + * format is valid up to v4 + */ struct hfi_conceal_color { u32 conceal_color; }; +struct hfi_conceal_color_v4 { + u32 conceal_color_8bit; + u32 conceal_color_10bit; +}; + struct hfi_intra_period { u32 pframes; u32 bframes; diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index e4dc97f00fc3..8d98fca55db1 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -620,7 +620,7 @@ static int vdec_set_properties(struct venus_inst *inst) { struct vdec_controls *ctr = &inst->controls.dec; struct hfi_enable en = { .enable = 1 }; - u32 ptype; + u32 ptype, conceal; int ret; if (ctr->post_loop_deb_mode) { @@ -630,6 +630,15 @@ static int vdec_set_properties(struct venus_inst *inst) return ret; } + ptype = HFI_PROPERTY_PARAM_VDEC_CONCEAL_COLOR; + conceal = ctr->conceal_color & 0xffff; + conceal |= ((ctr->conceal_color >> 16) & 0xffff) << 10; + conceal |= ((ctr->conceal_color >> 32) & 0xffff) << 20; + + ret = hfi_session_set_property(inst, ptype, &conceal); + if (ret) + return ret; + return 0; } diff --git a/drivers/media/platform/qcom/venus/vdec_ctrls.c b/drivers/media/platform/qcom/venus/vdec_ctrls.c index 974110b75b93..9ff3db1c4a0f 100644 --- a/drivers/media/platform/qcom/venus/vdec_ctrls.c +++ b/drivers/media/platform/qcom/venus/vdec_ctrls.c @@ -30,6 +30,9 @@ static int vdec_op_s_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_MPEG_VIDEO_VP9_LEVEL: ctr->level = ctrl->val; break; + case V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR: + ctr->conceal_color = *ctrl->p_new.p_s64; + break; default: return -EINVAL; } @@ -158,6 +161,10 @@ int vdec_ctrl_init(struct venus_inst *inst) if (ctrl) ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE; + v4l2_ctrl_new_std(&inst->ctrl_handler, &vdec_ctrl_ops, + V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR, 0, + 0xffffffffffffLL, 1, 0x8000800010LL); + ret = inst->ctrl_handler.error; if (ret) { v4l2_ctrl_handler_free(&inst->ctrl_handler);