Received: by 10.192.165.148 with SMTP id m20csp4733240imm; Tue, 24 Apr 2018 07:35:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx48qlFZYvMlpo8aGhwUX+K9Hjy9o8Ob7UmTNutY8J4urYIPL7G5QvhXPjNTipJpkzVtHp3rc X-Received: by 10.98.161.10 with SMTP id b10mr24172825pff.214.1524580524463; Tue, 24 Apr 2018 07:35:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524580524; cv=none; d=google.com; s=arc-20160816; b=v2JMMTAuIEtr3K7xQZg5wapME/VcQyLzr2ueTY2OoNFpaCi5W8ZkTx0TaMVEwAujaj UMxMkGSxAsRjlMGgSffQ+6Urr596RFJZw9CoTCfweTyP2fvevkyIOe6rESeXajt0xM56 wbgY+vf4eE7GZmpJ1AtGL1LuSVHf3aQTdQRysus9+c1wEYZuv7pWWx1CCimxFkU1zG3m WDS4gPay3ZNthjubP4raaMhhAhWQxVcJI8Xb4wAPG7nsifjSsga133kk434OWm0T/QYk PkpdXYdO9QXOe5jm65k1auP3AjBOGLv6A0VkPkMi8KcxB+7U9igTbwKfuDZBisYecPkl JSTg== 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=tE7ddrHDV+3yc9f38Cj9wFWsLbTExF8lwsgINEJhw3E=; b=MHAJ5Q0cXYwfCP+H9CRhiob5RqWu0B0/riNZem04mRT/mQA3RVVY1e66hkFAxI+7xl TvXfiAEl5gJzl6LFOJONTsUKnc5HiWHrAwNnhgBMjpJZTvqqqfEO7wJ4In5ZLE6x8tTZ IlIT4OxGSrkCbUY1eYSIOSJbchWWP28LHPxEQIRRThrzvPuVhaY4np9p/wtA8WEhXTkd LhxZm+6IN+5v64Y/LT+Uj/FQjXyxPiQ45dnZkvHEGDVe9SpFMDYg7qnfZcbohqceqRcI Uve702UNAKa1wPmukhY1bI67wieTIpzBhBNEhi3tzTs7w17/7caeAqEiIHzm1CwCczGj ML6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Am1S3tb0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id v29si7341817pgn.510.2018.04.24.07.35.09; Tue, 24 Apr 2018 07:35:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Am1S3tb0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S933253AbeDXMtJ (ORCPT + 99 others); Tue, 24 Apr 2018 08:49:09 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:39237 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757856AbeDXMp3 (ORCPT ); Tue, 24 Apr 2018 08:45:29 -0400 Received: by mail-wm0-f65.google.com with SMTP id b21so615432wme.4 for ; Tue, 24 Apr 2018 05:45:28 -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=tE7ddrHDV+3yc9f38Cj9wFWsLbTExF8lwsgINEJhw3E=; b=Am1S3tb0UQNx+W4FJvdZtBRP164kxZNOFJSNKE64MBfpDx3toyza22MqXUaHLaELUT 8z+TbouXNm790g4BvnZlKvKho9KabRAJdlKSkFQBBnWz53jcFim/dAUN3R9S6gJPyNDv ZNe5XqoyR/9BC+8QXO4yaqwrxPDAnWmQN+8Ic= 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=tE7ddrHDV+3yc9f38Cj9wFWsLbTExF8lwsgINEJhw3E=; b=dhhuIZn18G9hEhHeo9JWn9/kC7MEfp8Kv+X4+12pgDtsVtUgX6I/2LSLvOxOKh2hOD aaiSVoXxnhObDDpjH7qI6e9R/LMZX/PTqcURf3VrNiPCMKIOUjoiEX7iDSBaZwJfu26j K42bgkai1wwq5VXU287pDMpLoQ8OE0/dM+Ypg/HhKKzBMhju2hY08ARPF84AqS0jrWgP vzD87RfizXgzGR1U4DlmdL/0kXLluEh1VPXyM7Aa4cTArk3AvnuveKr2fSuCn36/UWhU JSBT1ctSX8tvu0Z9Bm94vD/5YYEdJQECazqbRckB4DnHAc7MiWpz3WQM7Au4fcyjFMYR L2jQ== X-Gm-Message-State: ALQs6tDno1XwAD7LPT9fhSvkeuj24Shls42Bo7l4QAkgjntjB8/fq5bm yk9Ui6kXMAsnIDqWY1/Kc6MF7Q== X-Received: by 10.28.132.68 with SMTP id g65mr13254649wmd.114.1524573927644; Tue, 24 Apr 2018 05:45:27 -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.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 05:45:27 -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 19/28] venus: helpers: add a new helper to set raw format Date: Tue, 24 Apr 2018 15:44:27 +0300 Message-Id: <20180424124436.26955-20-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The new helper will has one more argument for buffer type, that way the decoder can configure the format on it's secondary output. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 52 ++++++++++++++++++----------- drivers/media/platform/qcom/venus/helpers.h | 2 ++ 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 5512fbfdebb9..0d55604f7484 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -410,6 +410,20 @@ static int session_register_bufs(struct venus_inst *inst) return ret; } +static u32 to_hfi_raw_fmt(u32 v4l2_fmt) +{ + switch (v4l2_fmt) { + case V4L2_PIX_FMT_NV12: + return HFI_COLOR_FORMAT_NV12; + case V4L2_PIX_FMT_NV21: + return HFI_COLOR_FORMAT_NV21; + default: + break; + } + + return 0; +} + int venus_helper_get_bufreq(struct venus_inst *inst, u32 type, struct hfi_buffer_requirements *req) { @@ -491,35 +505,35 @@ int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, } EXPORT_SYMBOL_GPL(venus_helper_set_num_bufs); -int venus_helper_set_color_format(struct venus_inst *inst, u32 pixfmt) +int venus_helper_set_raw_format(struct venus_inst *inst, u32 hfi_format, + u32 buftype) { - struct hfi_uncompressed_format_select fmt; u32 ptype = HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SELECT; - int ret; + struct hfi_uncompressed_format_select fmt; + + fmt.buffer_type = buftype; + fmt.format = hfi_format; + + return hfi_session_set_property(inst, ptype, &fmt); +} +EXPORT_SYMBOL_GPL(venus_helper_set_raw_format); + +int venus_helper_set_color_format(struct venus_inst *inst, u32 pixfmt) +{ + u32 hfi_format, buftype; if (inst->session_type == VIDC_SESSION_TYPE_DEC) - fmt.buffer_type = HFI_BUFFER_OUTPUT; + buftype = HFI_BUFFER_OUTPUT; else if (inst->session_type == VIDC_SESSION_TYPE_ENC) - fmt.buffer_type = HFI_BUFFER_INPUT; + buftype = HFI_BUFFER_INPUT; else return -EINVAL; - switch (pixfmt) { - case V4L2_PIX_FMT_NV12: - fmt.format = HFI_COLOR_FORMAT_NV12; - break; - case V4L2_PIX_FMT_NV21: - fmt.format = HFI_COLOR_FORMAT_NV21; - break; - default: + hfi_format = to_hfi_raw_fmt(pixfmt); + if (!hfi_format) return -EINVAL; - } - ret = hfi_session_set_property(inst, ptype, &fmt); - if (ret) - return ret; - - return 0; + return venus_helper_set_raw_format(inst, hfi_format, buftype); } EXPORT_SYMBOL_GPL(venus_helper_set_color_format); diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 0de9989adcdb..79af7845efbd 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -40,6 +40,8 @@ int venus_helper_set_output_resolution(struct venus_inst *inst, u32 buftype); 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, + u32 buftype); int venus_helper_set_color_format(struct venus_inst *inst, u32 fmt); int venus_helper_set_dyn_bufmode(struct venus_inst *inst); int venus_helper_set_bufsize(struct venus_inst *inst, u32 bufsize, u32 buftype); -- 2.14.1