From patchwork Tue Apr 24 12:44:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 10359469 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F0BD1601D3 for ; Tue, 24 Apr 2018 12:45:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0DF228DB0 for ; Tue, 24 Apr 2018 12:45:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D540D28DB4; Tue, 24 Apr 2018 12:45:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CC2028DB0 for ; Tue, 24 Apr 2018 12:45:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757828AbeDXMpS (ORCPT ); Tue, 24 Apr 2018 08:45:18 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35559 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932125AbeDXMpL (ORCPT ); Tue, 24 Apr 2018 08:45:11 -0400 Received: by mail-wm0-f66.google.com with SMTP id o78so610586wmg.0 for ; Tue, 24 Apr 2018 05:45:10 -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=dceRlkYIPwqm9VEjyo3hBvNzMJoPaC776a9fzu0NZJG7rCY38rLmMqEydYcStN6Dge WrJI/6nz/RCOkLZs2UnLTuWYt7Aa+kq/frmjKTKoUrbgM3VGKztzHhszCtp/+re7RGB+ AWizvWW+1ncJzFs7aqOf+XVKriKIeQjcj80AI= 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=cD+82Y0NylkkIgfgSyFeefHswnGa9aJCl9oXnE/ktE43Hn/ROMS/AuBeCcsi4et9w4 TwRH9qJwtx1QNHvME7wUP5Tc7we40kH/m0GJBegbfQWcN/f2FLB6AhRQz/58qds3ZcXe 9FLmAuDP+otbpGUmZ5xutDgvCBwETC6CRvPsOHz1H2cCt9Hsw9d4dZrc1hAV5+jzB/lv 1uGGpglDbhEjx1w1j4TFz4aOeBQRXlrTfeWkZ/BTkDtBLqhP4LVMaD/xbo8ift5mhBU9 oJKBOdDlce4fO8oU44/sqRrr5kpgduHw8kMKo2iHoas2v3w+LnTw/VlYMSqqB3z1o8zK QYyw== X-Gm-Message-State: ALQs6tAMnYpUhjcUPwCZVkW00GfNbu/EMCXy/YZ7SLbFwe0CogDkMXJm d1Q5eBEBBog2xq2e2Be7CFoIcQ== X-Google-Smtp-Source: AIpwx48iCq1GNDV053+P5KhCo6eevgap9VLCYE3Zo0zJ8j79uFNCf32B4YlmXBTaUVi08Pfl9G7UmA== X-Received: by 10.28.32.132 with SMTP id g126mr13307651wmg.52.1524573910361; Tue, 24 Apr 2018 05:45:10 -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.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 05:45:09 -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 04/28] venus: hfi_cmds: add set_properties for 4xx version Date: Tue, 24 Apr 2018 15:44:12 +0300 Message-Id: <20180424124436.26955-5-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 X-Virus-Scanned: ClamAV using ClamSMTP 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)