From patchwork Tue Apr 24 12:44:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 134092 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2193992lji; Tue, 24 Apr 2018 05:49:03 -0700 (PDT) X-Google-Smtp-Source: AIpwx48lyhEaX41WccwuAK9CdOt9wxCasv4v3B10N5J7fq6m/HnHcN7VS6nXlePMortPC/ChsjrF X-Received: by 10.99.103.131 with SMTP id b125mr19792821pgc.177.1524574143836; Tue, 24 Apr 2018 05:49:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524574143; cv=none; d=google.com; s=arc-20160816; b=I0t1nocHNFDITCFvWn9vv4MLETwbYj9rVEr5js62zVt9yJ61i1xfQCcHnxViTGUnpu 6fVgU/fRlLgg8DDOBGUhfnl23DGkjHXgZNh2Jz/2mppaWnVZQzHb7++FBLdlxV8IfJ8Z FvJRGVn9ZCi/zLWaV6Gdr8Oq3742aVSCjQok2TpLxH2EL84I+jZRBY4E0rhm0YMp0GA2 ZagXVm9E1fd/Cy6H3S4eocaqISTT1Z94eHxFx4OT0pMkFLcmNP+sDVI3M7WPVkstIeoN 6OBGBQK0rHi6DRnGXUgy09j+hKWmqHTHdoY8arSKXtvkdT7zjsUSbADRkgrd21/NgmDs 89ow== 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=O4YXiKYa1UtYIKxkdVHnMJ28Y8lUH2VmQc6lT9I547I=; b=Z9CV/kro2Glz9n33ZP2mpaO1dfwa1Gpr5jrJM3gReYVgtpO8Qm9DhKAGduFWlfLnUO KpfS9+0FVr58gHvY2DfJlyg7z6gD9j+Q6P6I4ZLHOIPHwFXZw7ut6GhnjWvUd6pP+nwg EPgSW16Y+dAvoEK/2/BZbGKRE9Ia8yL+0AM9B78dEFvBTrQ5af7zErYStYEvf+NLhEHR OFK7JhynS0itmUwzeBrhxFZAJSwKJbqrYbh6wqxyBvqD87QNZ7AJlyfqAphFhwl+Z61z 1Z5T0sgMglh6chJWrVroJFdo2XjJkDoIXe3Q8dtq9GkUEdhi1edh+g2wJcWlSDouUrbE XbMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Am1S3tb0; 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.49.02; Tue, 24 Apr 2018 05:49:03 -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=Am1S3tb0; 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 S933204AbeDXMs4 (ORCPT + 12 others); Tue, 24 Apr 2018 08:48:56 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:38371 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757855AbeDXMp3 (ORCPT ); Tue, 24 Apr 2018 08:45:29 -0400 Received: by mail-wm0-f66.google.com with SMTP id i3so615018wmf.3 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=LTkwOZkU6whCVxXnFst9SxbN+ZVlqo5YftapVNyBEO/fhoDGsgFPHIseRBK8QkUTP2 gKGwReELof932EgcBqDDTyCPW2c9ORXDaTxVIZAptxhoHZyJddZlD+wQaAwcZC+/HiJ2 KaXeVsDQWDqK4gSc9V17Yj6e47vKNaQ4fbr+PPH8HP3sOBxhtfJ+6Pt9Q7CGPnDwYTGy 5Ou7pK3Bhyhup3hF2EvDPk6m7iM0PYk5XVpOQKHK4ZbH6U+YB14OO/KXQym9VcgGVpVT vKttr2HqTJYWYlmE4rS63fTJHr+vd+7fNrMYN44bO8jKi0etNpdAILJRHDsdK3sPmyfh gQRA== X-Gm-Message-State: ALQs6tARNBf95wcF9ZxX41ULw/qrYuHjLM2SztVakw1NEehiAFh+QHYN 2cmR38BIXvhvQx3SSTwjQj2UUg== 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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(-) -- 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 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);