From patchwork Tue May 15 07:58:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135855 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp681484lji; Tue, 15 May 2018 01:13:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqwRirkVb4ytfULYPPKQIA8DJN2f1Htz3sb5a19KTTSA7Q1gtnaXZ2ndI1SwSyr//1KZgvC X-Received: by 2002:a62:4c53:: with SMTP id z80-v6mr14122025pfa.181.1526371985065; Tue, 15 May 2018 01:13:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371985; cv=none; d=google.com; s=arc-20160816; b=oRPzeSPz2+UjX96+hL6ANMDvV0NRR5WhY9w36lIf8FRqqzDdLMDQFNuP4Q23HpKHIH fF1/4uZv/u4Z8FNnfbPDlUGI66uErP+Ci7Aym9gPyoGauaEYkBeNopDwqVtxjkdA8jUF +7DlB2GdGoaUPc+9GNHAQdWkOSt9/sZztashPKlwiTpsnVuL8ljyaOLshaEgH9R8eW6d HhUUYgiykpnbH7aymgwEPhl4UfY3Z+yLQhuuwabrUvfTGdqs9dMtjZ6kqVmI6G14CkQv XRAEiSK/blMGbW0Z+D8s+MLiBcVBSgPydnWZEZQOn/7RBx+sjFxXgqXfvqsBX0qdKQhX UWBA== 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=dihCKrpTwMryu1Tp9ISl68rVO7mV7cRP6PZqJIU3Z/M=; b=CNr0Ubfssp5e2oOfgwc5HHTMFmVjq2kd7TGEOXqrmaFSQybnTSlsMHMEiaiNPRetwe AAfV9s/feutZPZVYuYqRUCPftS5XuuVWtIkzUAdwKdeyyz5IfOCOmoxBQCqZ76lO2+vW rGEQQ35zCkkO4IN2/wmUB4J7RzAEozrVig6isA8kZ31dPGWryLYlox1SZHpwUKoFGv5H QWtgZQDLChEH9H0Tt2BA7sdKNdJNr9SdS+J6EkYBL7+2BC9FbzPPCJIZxiFP2spxWNNU AbK94x6G9od4TcjEbD2KbwlahpmLsa6R4+CJepVaG5Fdt8Hk1JBW5Kjax96H4WKxA0F+ L5sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PUYQKzxV; 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 x4-v6si8859506pgc.411.2018.05.15.01.13.04; Tue, 15 May 2018 01:13:05 -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=PUYQKzxV; 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 S1752417AbeEOINB (ORCPT + 29 others); Tue, 15 May 2018 04:13:01 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:39200 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752467AbeEOH7c (ORCPT ); Tue, 15 May 2018 03:59:32 -0400 Received: by mail-wr0-f195.google.com with SMTP id q3-v6so14909765wrj.6 for ; Tue, 15 May 2018 00:59:32 -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=dihCKrpTwMryu1Tp9ISl68rVO7mV7cRP6PZqJIU3Z/M=; b=PUYQKzxV1goqhQOlDZSuAzptH+B9cJQfOswdOa0yA1YkgVwCVMYjdgvs0yv1B2lttj UrbaWNWa6MaHD4EM0dggBkF6G4oOgZ9c92FuJ8I7mMHW6Bv9hcIlqG7V0OGLHZc5II6H PZ2q0OTpVfeChD5Q2a9rIncET3Dab44gzoPjQ= 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=dihCKrpTwMryu1Tp9ISl68rVO7mV7cRP6PZqJIU3Z/M=; b=OuZ/nQgUSqWyvhNU7UWP5kPyr8em73vAf1eUbo7OT10sFHnp2ZwAElAb4wOYjqpfWU HhQrCHqqa96xljey5uU/qjOzXEktQStjN7GLTwn6Wu5ODkirEmWZHgG5fj4m6H/NW3wl 13Pa/IQS08FuVOFRGZ/Ye5hccEgNzXu5U8jXeY2DDggFeGHZEJGjSbVYAMsSLU8Hclhj a0rr5TYsID4HLYzsW8CAi1gICzZvE00B0R6bkGmIFQCwYSbDOACFmvdd35jzqDuShfrH sY4IiydFbWNPtyy+TF91Q6H4/jppQJ9p+UhFnb2QnW1QYo0H+ItaLiU0lk8hPuHakvWc TvkQ== X-Gm-Message-State: ALKqPwfOTKcCmDFVmzBWSUFIjizvQob1YVl143zlImG/F0T7oZqz/ayo PZeB7LJRVpNfBRPALHH/+IA7lYG4OkI= X-Received: by 2002:adf:b00f:: with SMTP id f15-v6mr10546852wra.254.1526371171609; Tue, 15 May 2018 00:59:31 -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.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:31 -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 04/29] venus: hfi_cmds: add set_properties for 4xx version Date: Tue, 15 May 2018 10:58:34 +0300 Message-Id: <20180515075859.17217-5-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 Adds set_properties method to handle newer 4xx properties and fall-back to 3xx for the rest. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi_cmds.c | 64 +++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c index 1cfeb7743041..6bd287154796 100644 --- a/drivers/media/platform/qcom/venus/hfi_cmds.c +++ b/drivers/media/platform/qcom/venus/hfi_cmds.c @@ -1166,6 +1166,65 @@ pkt_session_set_property_3xx(struct hfi_session_set_property_pkt *pkt, return ret; } +static int +pkt_session_set_property_4xx(struct hfi_session_set_property_pkt *pkt, + void *cookie, u32 ptype, void *pdata) +{ + void *prop_data; + int ret = 0; + + if (!pkt || !cookie || !pdata) + return -EINVAL; + + prop_data = &pkt->data[1]; + + pkt->shdr.hdr.size = sizeof(*pkt); + pkt->shdr.hdr.pkt_type = HFI_CMD_SESSION_SET_PROPERTY; + pkt->shdr.session_id = hash32_ptr(cookie); + pkt->num_properties = 1; + pkt->data[0] = ptype; + + /* + * Any session set property which is different in 3XX packetization + * should be added as a new case below. All unchanged session set + * properties will be handled in the default case. + */ + switch (ptype) { + case HFI_PROPERTY_PARAM_BUFFER_COUNT_ACTUAL: { + struct hfi_buffer_count_actual *in = pdata; + struct hfi_buffer_count_actual_4xx *count = prop_data; + + count->count_actual = in->count_actual; + count->type = in->type; + count->count_min_host = in->count_actual; + pkt->shdr.hdr.size += sizeof(u32) + sizeof(*count); + break; + } + case HFI_PROPERTY_PARAM_WORK_MODE: { + struct hfi_video_work_mode *in = pdata, *wm = prop_data; + + wm->video_work_mode = in->video_work_mode; + pkt->shdr.hdr.size += sizeof(u32) + sizeof(*wm); + break; + } + case HFI_PROPERTY_CONFIG_VIDEOCORES_USAGE: { + struct hfi_videocores_usage_type *in = pdata, *cu = prop_data; + + cu->video_core_enable_mask = in->video_core_enable_mask; + pkt->shdr.hdr.size += sizeof(u32) + sizeof(*cu); + break; + } + case HFI_PROPERTY_CONFIG_VENC_MAX_BITRATE: + /* not implemented on Venus 4xx */ + break; + default: + ret = pkt_session_set_property_3xx(pkt, cookie, ptype, pdata); + break; + } + + return ret; +} + int pkt_session_get_property(struct hfi_session_get_property_pkt *pkt, void *cookie, u32 ptype) { @@ -1181,7 +1240,10 @@ int pkt_session_set_property(struct hfi_session_set_property_pkt *pkt, if (hfi_ver == HFI_VERSION_1XX) return pkt_session_set_property_1x(pkt, cookie, ptype, pdata); - return pkt_session_set_property_3xx(pkt, cookie, ptype, pdata); + if (hfi_ver == HFI_VERSION_3XX) + return pkt_session_set_property_3xx(pkt, cookie, ptype, pdata); + + return pkt_session_set_property_4xx(pkt, cookie, ptype, pdata); } void pkt_set_version(enum hfi_version version)