Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1061029pxx; Tue, 27 Oct 2020 07:23:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmCGqjKs1w1WA4etZ63TljN2rp6GjuWnloglmieQQf48aXekPaWrYibfu55tbCTsueMwq2 X-Received: by 2002:a17:907:204c:: with SMTP id pg12mr2533323ejb.464.1603808629475; Tue, 27 Oct 2020 07:23:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603808629; cv=none; d=google.com; s=arc-20160816; b=bJERtedRQjXR5Z3ZjmTmJrDj+hPJp9Xya3kMm6ZbCXPk1exJaB6RMF22n4YGvYz8LY JN1rbXY+sF0ki7jFfn1H766BghM5TXkFRpH17/a74+oNI+ue1On9eXnYOqPSZ3/LcBio etLhtn8mYdgZhnnafJurXSrzMvTchC/qvZxqU1QtBK5q1dzV1IL74knVe5UTk4wtJJfj Z99jhT/SLC+OEm7C55TjriICxgyLUk/5IQGzwtCai1GxqC3KRzDQs0EqHEC70V19Bx6V LvPY0wOspMlIogsOhJhTUPR3I0XQgUgSeQQV0B5uSGNkep5+vdsgaYa0tFtbEKUDB0Og tPjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=/wDjT/SlZ3lKVqpNwVDGAcf/aKgztmBHkRCUdNnZ+aw=; b=hQF/pLdx9cYPA8zy8tqYWtrpYd5blc/3Tk7XPqumT2Qt0X4NeD2NwYjp01hgBneh1A AY0bttKlXQhDxuJp9u59SPuIr2SndwDj+oep8GVQJTwx++FhhRPC/W/S3StjLEok17vI WGBVgZc/7ulqO7XDCRHqpKc9xBlpt2heACzuE/gt/jcjLafrpuRPIlsNHDaZWAbRlQJn gYfcjzW3Ek+BM9fu0P3NjHph5+VK0ghkVzXONpVAFfRyuqFe+Oq3wJOQA4wmTjjQIf/s T7IC/nvW2UZrRL+W28ojhxXcogEHmrHEUeyRFANB/CYGrlsTX14HIqT+tJ8BsLxHXIfM N3pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="vdYfDY/T"; 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=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 g16si1014548edm.68.2020.10.27.07.23.25; Tue, 27 Oct 2020 07:23:49 -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; dkim=pass header.i=@linaro.org header.s=google header.b="vdYfDY/T"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2508803AbgJ0JT4 (ORCPT + 99 others); Tue, 27 Oct 2020 05:19:56 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:36455 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2508741AbgJ0JT4 (ORCPT ); Tue, 27 Oct 2020 05:19:56 -0400 Received: by mail-wr1-f67.google.com with SMTP id x7so1031331wrl.3 for ; Tue, 27 Oct 2020 02:19:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=/wDjT/SlZ3lKVqpNwVDGAcf/aKgztmBHkRCUdNnZ+aw=; b=vdYfDY/TYNYCUgUHMhh+fIs/CSYiFFsyY+p6u4EvFhFraYVRB+9sfXxFgmnQVpjFFZ t7TQqqEObuDsMpVky/Lm1YJg3RVAG7ox13tpuFg0HgAPOKGsarXP2yD96nkoRJLMhdLT 2D8UFmfF5BasOtQ+lnsgCxv2oqSiriPcMkUOzFmi6GPFZLdT+kkUrwT5gWOYUCdNUuTu z4i4xMc8jIu1Bb+eaE6fywlbRpVL5oe6C9YF7l/qXlAHl8i70CxhvxxdaGWAaJzHqsh7 BvJkLbs/KDLQxns65ayk2DILD8HJfNGy6Bp/nFg2MUuCy85dzAV03YWyhPzx59Wc3tO5 W5ZQ== 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; bh=/wDjT/SlZ3lKVqpNwVDGAcf/aKgztmBHkRCUdNnZ+aw=; b=r9vxrMjyLXxPaYqZ18R2l2+EyNXFwbgV4ZYeCPPpiCEhN/oFeAALJId9MelhW+W2N6 8p29H/10tMv2OP5ufK8cDGfEGO8GqotNgHVdOJAYN0nNIAs4+uo8xsGTiuPjq12TRWPe w4TUk9rim30XLOC/r/elmROHcB199tUNtW6KYLvDzebe2fv7WhDfqVEpAGgi8TC83stF aMCVDIdoE700xdm4YH2qUr8t3N1c2hGRj2Z6gDa1Sg0r/0U6VweXZigChAp+w/0ihVwC iHkJTXhqDYX4fDqzRMd6w769wtyL1sipXBQOR5CdTaq4fm5KrXP0vvrO9jlucXXmkk1w zqLA== X-Gm-Message-State: AOAM531ZCd+D9mBb54s2mbQN+lvXceijVHmQhbD6y62hQAkB6AGr5tI0 /QcI9hna+0weLHI9FzNCKvtq+A== X-Received: by 2002:a5d:4001:: with SMTP id n1mr1680682wrp.426.1603790393873; Tue, 27 Oct 2020 02:19:53 -0700 (PDT) Received: from localhost.localdomain ([84.238.208.210]) by smtp.gmail.com with ESMTPSA id i10sm1292902wrq.27.2020.10.27.02.19.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 02:19:53 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Stanimir Varbanov Subject: [PATCH v2] venus: venc: Fix setting of profile and level Date: Tue, 27 Oct 2020 11:19:36 +0200 Message-Id: <20201027091936.14478-1-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The profile and level in op_set_ctrl was recently changed but during v4l2_ctrl_handler_setup profile and level control values are mangled. Fixes: 435c53c3698f ("media: venus: venc: Use helper to set profile and level") Signed-off-by: Stanimir Varbanov --- v2: Fixed kernel test robot WARNING drivers/media/platform/qcom/venus/core.h | 15 +++++++-- drivers/media/platform/qcom/venus/venc.c | 31 ++++++++++++++++++- .../media/platform/qcom/venus/venc_ctrls.c | 14 +++++++-- 3 files changed, 55 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 7b79a33dc9d6..05c9fbd51f0c 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -243,8 +243,19 @@ struct venc_controls { u32 header_mode; - u32 profile; - u32 level; + struct { + u32 h264; + u32 mpeg4; + u32 hevc; + u32 vp8; + u32 vp9; + } profile; + struct { + u32 h264; + u32 mpeg4; + u32 hevc; + u32 vp9; + } level; }; struct venus_buffer { diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index f8b1484e7dcd..47246528ac7e 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -537,6 +537,7 @@ static int venc_set_properties(struct venus_inst *inst) struct hfi_quantization quant; struct hfi_quantization_range quant_range; u32 ptype, rate_control, bitrate; + u32 profile, level; int ret; ret = venus_helper_set_work_mode(inst, VIDC_WORK_MODE_2); @@ -684,7 +685,35 @@ static int venc_set_properties(struct venus_inst *inst) if (ret) return ret; - ret = venus_helper_set_profile_level(inst, ctr->profile, ctr->level); + switch (inst->hfi_codec) { + case HFI_VIDEO_CODEC_H264: + profile = ctr->profile.h264; + level = ctr->level.h264; + break; + case HFI_VIDEO_CODEC_MPEG4: + profile = ctr->profile.mpeg4; + level = ctr->level.mpeg4; + break; + case HFI_VIDEO_CODEC_VP8: + profile = ctr->profile.vp8; + level = 0; + break; + case HFI_VIDEO_CODEC_VP9: + profile = ctr->profile.vp9; + level = ctr->level.vp9; + break; + case HFI_VIDEO_CODEC_HEVC: + profile = ctr->profile.hevc; + level = ctr->level.hevc; + break; + case HFI_VIDEO_CODEC_MPEG2: + default: + profile = 0; + level = 0; + break; + } + + ret = venus_helper_set_profile_level(inst, profile, level); if (ret) return ret; diff --git a/drivers/media/platform/qcom/venus/venc_ctrls.c b/drivers/media/platform/qcom/venus/venc_ctrls.c index 0708b3b89d0c..cf860e6446c0 100644 --- a/drivers/media/platform/qcom/venus/venc_ctrls.c +++ b/drivers/media/platform/qcom/venus/venc_ctrls.c @@ -103,15 +103,25 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) ctr->h264_entropy_mode = ctrl->val; break; case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE: + ctr->profile.mpeg4 = ctrl->val; + break; case V4L2_CID_MPEG_VIDEO_H264_PROFILE: + ctr->profile.h264 = ctrl->val; + break; case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE: + ctr->profile.hevc = ctrl->val; + break; case V4L2_CID_MPEG_VIDEO_VP8_PROFILE: - ctr->profile = ctrl->val; + ctr->profile.vp8 = ctrl->val; break; case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL: + ctr->level.mpeg4 = ctrl->val; + break; case V4L2_CID_MPEG_VIDEO_H264_LEVEL: + ctr->level.h264 = ctrl->val; + break; case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL: - ctr->level = ctrl->val; + ctr->level.hevc = ctrl->val; break; case V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP: ctr->h264_i_qp = ctrl->val; -- 2.17.1