From patchwork Tue Apr 24 12:44:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 134091 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2193968lji; Tue, 24 Apr 2018 05:49:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx48DKp9BWXUiuHWB/eQfhLe1aecgIghecAFOPshIKDHSkT+uJz5Ko1rD16FzGddNU5lPHszG X-Received: by 2002:a17:902:9a41:: with SMTP id x1-v6mr25493663plv.256.1524574141946; Tue, 24 Apr 2018 05:49:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524574141; cv=none; d=google.com; s=arc-20160816; b=OVdXJO1OVL0GNqAkGfVvLeQIv7e3mq6tRtrhEHsWyqETY51ByaHSDLcp4btpMXr7UA hSQNRO+23jt5z3PG8TyEek0tQa0g6iVJPY9FR7qi/XSJilarSb7z180OjU5j5cw+9+XE K0b664EGemRtpEUmg2fkI5d4nwxpKOfZT5kHBqa3A7qp4oPrVFFCaKi+8vC/s3PrTmaP 4SglvRn6xkmkBAFU7Y2xVurDcG/L1lhAxrC9IZSlgyaLJ5pgsfiFphf4l+PJZ6bJp2LM Qi40nlL2h+seP7ANdh67DHC16WVZmnTby5Xn7cvnbRJW8JE4Zv60/Ksw1zoxY3NkbLTy oZRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=3ai6kxNR+dm+UEc+yxYckccSo9kZlfgfvr9fT9GLxD8=; b=oC2hB4gk/QYIDF25GCWM8/6Lk/SqWmPmWBcTszqmmaT5IU9ECfgLzd87H613GBWEr1 aVTDSDbB0BmefJk3y+9slgCN3JEXmj4TxEvjT23ziJi9DBul2hk9QXY+DHvqAzOj9SEc 4NkdhylBXJn41MMvBfc6Bo6JMwakxagrtm1tdlpt5TD5L+f5io4dngsJSxeX/1C/mPsk zLeihT9Gre/ntkowXBps/L6HkES+YK+9dR1fOPquj642iwZwzmRcvRYaf2bmBnwgJkOd RIBTqv2k2p7kyPX1Yk+j6SXlxoxF5G/9+KMV8XZG83Y3tBw/GzkcIibqqx6U6x38w1RB EPGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=K5zkByJk; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 202si7540324pgg.546.2018.04.24.05.48.58; Tue, 24 Apr 2018 05:49:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=K5zkByJk; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932854AbeDXMsy (ORCPT + 12 others); Tue, 24 Apr 2018 08:48:54 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:42952 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757859AbeDXMpa (ORCPT ); Tue, 24 Apr 2018 08:45:30 -0400 Received: by mail-wr0-f195.google.com with SMTP id s18-v6so49792630wrg.9 for ; Tue, 24 Apr 2018 05:45:29 -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:in-reply-to:references; bh=E6MkggzS/K/ebZ56K2ogSp1CwxIKbW/hp68ey+BGUis=; b=K5zkByJkIWRBiYoW8GhRAduR5uls9LRt0Bqae9twtcbowjFpXy8XQQ4hu0qi4Lo1F5 rdq+yaYu7YIYifhpcq+8AG8tSpz8aFg1vQ0WthqnKrWZC9GKJQQAl9XWw21og1Nf1Akn k7o8m+GFDnlhBKdFMVkih/7qwr9LpqXOGPfIs= 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=E6MkggzS/K/ebZ56K2ogSp1CwxIKbW/hp68ey+BGUis=; b=iCMOn1R+1Y9OC5vKe6VgdB/6umOmtucmtqE0+mpVR/foxCUS0ujY8kFyUqM1/N0Cui hUcmfQX8nYzjrgb4L8xxSVRpVe52Bo/6cxZWdmgg6reH+TTt6vS/mfQtm5q9pyxaEVZj CZmpgeUfMxenIGIIHnMSlNdr88BpPcvG5P0A1a7zLpr3Al3ZSog48w2MPb54tvIe50kZ F+9dDSaAml04zqa/mAlicMcMLNymo0FixmdUP3zMYQbv67Kh8SHZlg9ZG06y/tIePLD0 HJLsIc8lMHfoetigXZBgb2bE/4BoFY+vYZRwF+W36/WhL9CGArcHglYnFalW0ohe4Q/k 49kA== X-Gm-Message-State: ALQs6tCT6Sb+5UW+FoK9PQGd4Do9lmUMyODF8wEQN+RIgy+J1y9RZSWG lPW67dJMO7WhaqvB4dTcEuB6RQ== X-Received: by 2002:adf:8bce:: with SMTP id w14-v6mr20301937wra.169.1524573928804; Tue, 24 Apr 2018 05:45:28 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id n49-v6sm22666013wrn.50.2018.04.24.05.45.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 05:45:28 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH 20/28] venus: helpers, vdec, venc: add helpers to set work mode and core usage Date: Tue, 24 Apr 2018 15:44:28 +0300 Message-Id: <20180424124436.26955-21-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180424124436.26955-1-stanimir.varbanov@linaro.org> References: <20180424124436.26955-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org These are new properties applicable to Venus version 4xx. Add the helpers and call them from decoder and encoder drivers. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 28 ++++++++++++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 ++ drivers/media/platform/qcom/venus/vdec.c | 8 ++++++++ drivers/media/platform/qcom/venus/venc.c | 8 ++++++++ 4 files changed, 46 insertions(+) -- 2.14.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 0d55604f7484..adf8701a64bb 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -484,6 +484,34 @@ int venus_helper_set_output_resolution(struct venus_inst *inst, } EXPORT_SYMBOL_GPL(venus_helper_set_output_resolution); +int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode) +{ + u32 ptype = HFI_PROPERTY_PARAM_WORK_MODE; + struct hfi_video_work_mode wm; + + if (!IS_V4(inst->core)) + return 0; + + wm.video_work_mode = mode; + + return hfi_session_set_property(inst, ptype, &wm); +} +EXPORT_SYMBOL_GPL(venus_helper_set_work_mode); + +int venus_helper_set_core_usage(struct venus_inst *inst, u32 usage) +{ + u32 ptype = HFI_PROPERTY_CONFIG_VIDEOCORES_USAGE; + struct hfi_videocores_usage_type cu; + + if (!IS_V4(inst->core)) + return 0; + + cu.video_core_enable_mask = usage; + + return hfi_session_set_property(inst, ptype, &cu); +} +EXPORT_SYMBOL_GPL(venus_helper_set_core_usage); + int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, unsigned int output_bufs) { diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 79af7845efbd..d5e727e1ecab 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -38,6 +38,8 @@ int venus_helper_set_input_resolution(struct venus_inst *inst, int venus_helper_set_output_resolution(struct venus_inst *inst, unsigned int width, unsigned int height, u32 buftype); +int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode); +int venus_helper_set_core_usage(struct venus_inst *inst, u32 usage); int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, unsigned int output_bufs); int venus_helper_set_raw_format(struct venus_inst *inst, u32 hfi_format, diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index b43607dee4fe..ceaf1a338eb3 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -550,6 +550,14 @@ static int vdec_set_properties(struct venus_inst *inst) u32 ptype; int ret; + ret = venus_helper_set_work_mode(inst, VIDC_WORK_MODE_2); + if (ret) + return ret; + + ret = venus_helper_set_core_usage(inst, VIDC_CORE_ID_1); + if (ret) + return ret; + if (core->res->hfi_version == HFI_VERSION_1XX) { ptype = HFI_PROPERTY_PARAM_VDEC_CONTINUE_DATA_TRANSFER; ret = hfi_session_set_property(inst, ptype, &en); diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 8970f14b3a82..3b3299bff1cd 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -643,6 +643,14 @@ static int venc_set_properties(struct venus_inst *inst) u32 ptype, rate_control, bitrate, profile = 0, level = 0; int ret; + ret = venus_helper_set_work_mode(inst, VIDC_WORK_MODE_2); + if (ret) + return ret; + + ret = venus_helper_set_core_usage(inst, VIDC_CORE_ID_2); + if (ret) + return ret; + ptype = HFI_PROPERTY_CONFIG_FRAME_RATE; frate.buffer_type = HFI_BUFFER_OUTPUT; frate.framerate = inst->fps * (1 << 16);