From patchwork Tue May 15 07:58:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135846 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp674040lji; Tue, 15 May 2018 01:05:53 -0700 (PDT) X-Google-Smtp-Source: AB8JxZofqZv7SUFYt4yxB9+qu1Y3YxV0CPtZgrBIwKa4tTJRYZqG0LXfKoiVVYKWL8S8WDm8z+Sf X-Received: by 2002:a62:4b16:: with SMTP id y22-v6mr14042740pfa.29.1526371553336; Tue, 15 May 2018 01:05:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371553; cv=none; d=google.com; s=arc-20160816; b=F5XLSnmhp8e53UU0qQVl1QneYJ0AHxJI7UakOPC7i6WiW3hcdKufHkyHfz8Go1QnVD V1hmjnIlKnVqrPDp2+GHvf4/9InReuZcg1EhK9k/GWVs0Dy7C3SlSykZ0UXR5uU1XkR+ kP0ND3AfsrhUKI540KKIGsnmWXBuBSwDOSbcSvOk8BilSYt2lkp8zHYFjmUglc1KmBQh gDlHpTDXg1A1Ny9v/poeqKOFG8w9NCNsFyZ6/vyM60vbLoa7QQwLOhuGHtZo9S9bPXRB NYueduK6Bdm+bG+dAgCZ/RV4TkbmCoia/1ei47USF2sNiNsbLkAsH4HudLDDg3VqecUX YcvA== 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=I3nOpspPKFRVlOuNg6j7NzeUvpnsaVxjNaC3cF+zWUP3Rf4fCurMTpiM4p6S+gJBdj arAA0nRMAlRmMYA4fb+uZzelcQjgbNLq3PrmhuUm6yy99Cl6CrumEy3YQrO55+w/tRnm mJuHwDKU8ggdOhHbPDH1mIAeLBswheBeTYpmmUOQe5NhuhwzP1witrFE+uD4fD1q9RNn eRXyXAqJW5OP3IcmdjqaYq+iKhuhhwUvHLQu/xA3qVLEjNSREHjrGbnXZ+F+vEMEf/it dNy6agF9frJEBLyVV7XJh8FDmFye5AbjCyrvL1MMowfNF/TwgZIlZr+rdkrdMZFJKbI4 nJ4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hntoyzcd; 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 w135-v6si11050722pff.340.2018.05.15.01.05.53; Tue, 15 May 2018 01:05:53 -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=Hntoyzcd; 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 S1752626AbeEOIFt (ORCPT + 29 others); Tue, 15 May 2018 04:05:49 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:33884 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752571AbeEOH7u (ORCPT ); Tue, 15 May 2018 03:59:50 -0400 Received: by mail-wr0-f194.google.com with SMTP id p18-v6so14910563wrm.1 for ; Tue, 15 May 2018 00:59:49 -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=HntoyzcdLDQcfT7eysUu5YtnLS5Q7+KnpsPSf9xkdeiwQa/WIHqYwvJUTIURHJoQz9 is/BZ6NR2QFjcxJpPX5t3mRdhauw6zZtrrGzscqEfwqFLWFXTfhm2hy4FNFdXIiaJecs lU/ZZUwT2lfmjfArz+fhekFoSCOr2OLrQa/NU= 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=oLJu+aaqqIdaeiJzfZi6hIe9p5U4X44ni1nRqmVIaPsfL0oIZGVonyU0QR27GdbSzg ygmjioi2TubEFsnMqRuOPH5FbI0B55tGqm43iGg4vQwjMgo24zZdiRLyvyp2g0ApCBQB uJXTk3nceZt8INWg9vBIIuplDtRmTwMIhoGrZnr0j+YFqh1gQEkph0WMrHXBFRA0sik0 ieRj8Oe8Kv3NMzE2jBSsHIdFuB8TQvW/7shY77VphS3VZlhZxc+6FBCOemlUsjkzWBBF 8vT+UHTd+MblT4+SweZM0HeQgYe+tqa3PRwC6If47sSAY5FHaKK3EBfYjJKger4EBR79 fq6w== X-Gm-Message-State: ALKqPwd15NsebRL3gKUxwB6n0UWMPjZnhZNCtjeXzEj9N8+8vM36eGwO hakU1oXxhczr6pSSBkEng630qw== X-Received: by 2002:adf:8756:: with SMTP id 22-v6mr8742713wrz.117.1526371188913; Tue, 15 May 2018 00:59:48 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:48 -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 v2 20/29] venus: helpers: add a new helper to set raw format Date: Tue, 15 May 2018 10:58:50 +0300 Message-Id: <20180515075859.17217-21-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-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(-) -- 2.14.1 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);