Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp272524imm; Tue, 15 May 2018 01:14:16 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpFd/XZGrJnf/pgUERaMkWmF+15lZCfy4cLchaVgYSiw+Xo3+cZAMcwYm0egYd9LKi3mhh2 X-Received: by 2002:a65:44c3:: with SMTP id g3-v6mr10613031pgs.428.1526372055966; Tue, 15 May 2018 01:14:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526372055; cv=none; d=google.com; s=arc-20160816; b=rJD8yQY2gv+tOsdAnGektAU2JoyujQnPbr/aG9DPMvuMF7j9RdPblXkZiSIeikeXfY UxJgxgr4FQVEuzzcG9OpnkZB7RL4WkPsb4SBT8VdKFFBoUfmSEN7+hmF1PjQ7a92lttU CXd4NVRh/0gp5z9hOSYkFSoE3qQ5dkkwmtUij4obMfT0msGbNdkCdXZ+eaRvwMFZBnPc VAaPV2V1WbzjqV75CrzINBHwoIMUGmcwhX3ni22j5V1tAfn9m3B59cg9A24/k0Rk7I0f 70HjHj4sH90nF2jUhXwdj24zupDB9Q14FC7fI83+ULKP0hBnUGjxK+JRsAsGUKLg0Y1P gw5A== 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 70-v6si11691559pfu.274.2018.05.15.01.14.02; Tue, 15 May 2018 01:14:15 -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 S1752392AbeEOINB (ORCPT + 99 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(-) 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) -- 2.14.1