From patchwork Tue Apr 24 12:44:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 134104 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2201392lji; Tue, 24 Apr 2018 05:56:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/36tftOR/FLse4qYUNtez+yI4HPRzMb0B9JXW6t9JjDrlCdrvSwlW/ETc8zLaqcAtUkAgI X-Received: by 10.98.103.154 with SMTP id t26mr24125092pfj.24.1524574579233; Tue, 24 Apr 2018 05:56:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524574579; cv=none; d=google.com; s=arc-20160816; b=IJyxqd8PH+BgjJJb3gUn4NFciGfNVhm6ytuUukKJfMTJhrkdyoyIZ3G0e4qLhRIAKS hb4HOom7GmSNuNPX9GcuECiHH/4LZSuDHrPoEKZNSv0AVEhy+6No1gbcx/rbb4m+ma90 SJzUrGwBBAi2ZVyqlyTTAgP7+Bdn6Bbp6q2LpZISYVogVvIQPhqfdV63j532DuOABD7G DOj8tPeKi+wmuMqv6TM9DmqmcgAgcWbPPf2pmcX9UBO9F9OW9JhL+IkWRFnrs1LJCmnP s/xBX5qC8BkrrwKJJrEXgeY4h/bZiWeOmJpj8ktDHMm+UrLwkkaXvqjuh+1YoXx+o0uN OdCw== 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=DescmNCseaJ8oNlOCcs8oBn51AIBW4IjvCIIM2a0pgg=; b=pZorjOCkTYxFME3yrMIpzPwgRmOnBxm2Rm/Jb8K64tQCKRiNa3KT3nPCfc1jQvC6Xb 0tiuu/cumyumj7wVeyRfwUTmDC4UWkUqX/9ktHr2navYlpjiaugpsJrrIFy0zrbs1x4r ITHg+nnIp2UXrHqli0cteI1lGgvcPhdzTqEe5fIrutJXDlv3S1hfI58C4p42KwrQSq+o sN3f8Dvw7TwQZX2qjHtvDaCqDl82KDp1/sxLbyoA34PRDB+g5FtPfa364rk/DbAOUTyG huOx3nRWWU0bnWCaT3/gh2XpZU2PD6aybmB8R8+yKqTtlMQVvJYelgfre22sRLOJvGlT THVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KruyEIc+; 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 5si8282391pgi.135.2018.04.24.05.56.19; Tue, 24 Apr 2018 05:56:19 -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=KruyEIc+; 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 S1757911AbeDXM4Q (ORCPT + 12 others); Tue, 24 Apr 2018 08:56:16 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:52177 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757793AbeDXMpK (ORCPT ); Tue, 24 Apr 2018 08:45:10 -0400 Received: by mail-wm0-f68.google.com with SMTP id j4so691758wme.1 for ; Tue, 24 Apr 2018 05:45:09 -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=zMuKVj6QFacwz7IWhezYa4XGmFJI0qX2tfO++Xoft9Y=; b=KruyEIc+IPG2dxIs1Bgsm/v9ngSZQRTjuGGyiq9IKbL4HqWm6oKJwcFqadh6DpOgjA ODwdmvRC/Jjc93WrHzNN5BDT7hJLmi5PuhQ1dU8Y2Lw08iaN8Evyhv8fsv41j1CCOVh0 Oji/+4W/T4aMXCOBsrFSaGGPucqJ9C1w41w1k= 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=zMuKVj6QFacwz7IWhezYa4XGmFJI0qX2tfO++Xoft9Y=; b=l4EZAo+jRtkUYXN3KZPhcBOga1xwMViXJ5Rz1dNElC3Z4hPMaBd1rUMvkWAIzHaFY7 7M52qn0BftphEy9RXfortkoBAkrYTFPZAnWmecUdJZJoGNavWQcM3QkvJ0MXhDR94GWw 7JFnUYj6YBhgNGgR+xlwKHOwpu4Fnuibfe5BHBm6qJs+6fBGAzvpj7kbCp1j7xf0uNLy Tu6he5Grwam3IqQQXY+XNnAMAcbW+4pOHbHbX5QBUuP5vCrZMZsouwJVhh/698hXfXQ4 VQsJ+e0xWYOWIkkjaj3JEKHHnkr2rXDDGLmIhxyhzduudD/LGFVWwi2aL5yRfi22Tk3u BUTA== X-Gm-Message-State: ALQs6tCXYrL2KvteqQM7GP1NWdPxo4dsREc55ht6OfRQzJNYd3ehRtkg CCHn+hGRm55aMm/OfiRH0S2D7A== X-Received: by 10.28.60.194 with SMTP id j185mr12500455wma.159.1524573908826; Tue, 24 Apr 2018 05:45:08 -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.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 05:45:08 -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 03/28] venus: hfi: update sequence event to handle more properties Date: Tue, 24 Apr 2018 15:44:11 +0300 Message-Id: <20180424124436.26955-4-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 HFI version 4xx can pass more properties in the sequence change event, extend the event structure with them. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi.h | 9 ++++++ drivers/media/platform/qcom/venus/hfi_msgs.c | 46 ++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) -- 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/hfi.h b/drivers/media/platform/qcom/venus/hfi.h index 5466b7d60dd0..21376d93170f 100644 --- a/drivers/media/platform/qcom/venus/hfi.h +++ b/drivers/media/platform/qcom/venus/hfi.h @@ -74,6 +74,15 @@ struct hfi_event_data { u32 tag; u32 profile; u32 level; + u32 bit_depth; + u32 pic_struct; + u32 colour_space; + u32 entropy_mode; + u32 buf_count; + struct { + u32 left, top; + u32 width, height; + } input_crop; }; /* define core states */ diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c b/drivers/media/platform/qcom/venus/hfi_msgs.c index 589e1a6b36a9..5970e9b1716b 100644 --- a/drivers/media/platform/qcom/venus/hfi_msgs.c +++ b/drivers/media/platform/qcom/venus/hfi_msgs.c @@ -25,10 +25,17 @@ static void event_seq_changed(struct venus_core *core, struct venus_inst *inst, struct hfi_msg_event_notify_pkt *pkt) { + enum hfi_version ver = core->res->hfi_version; struct hfi_event_data event = {0}; int num_properties_changed; struct hfi_framesize *frame_sz; struct hfi_profile_level *profile_level; + struct hfi_bit_depth *pixel_depth; + struct hfi_pic_struct *pic_struct; + struct hfi_colour_space *colour_info; + struct hfi_buffer_requirements *bufreq; + struct hfi_extradata_input_crop *crop; + u32 entropy_mode = 0; u8 *data_ptr; u32 ptype; @@ -69,6 +76,45 @@ static void event_seq_changed(struct venus_core *core, struct venus_inst *inst, event.level = profile_level->level; data_ptr += sizeof(*profile_level); break; + case HFI_PROPERTY_PARAM_VDEC_PIXEL_BITDEPTH: + data_ptr += sizeof(u32); + pixel_depth = (struct hfi_bit_depth *)data_ptr; + event.bit_depth = pixel_depth->bit_depth; + data_ptr += sizeof(*pixel_depth); + break; + case HFI_PROPERTY_PARAM_VDEC_PIC_STRUCT: + data_ptr += sizeof(u32); + pic_struct = (struct hfi_pic_struct *)data_ptr; + event.pic_struct = pic_struct->progressive_only; + data_ptr += sizeof(*pic_struct); + break; + case HFI_PROPERTY_PARAM_VDEC_COLOUR_SPACE: + data_ptr += sizeof(u32); + colour_info = (struct hfi_colour_space *)data_ptr; + event.colour_space = colour_info->colour_space; + data_ptr += sizeof(*colour_info); + break; + case HFI_PROPERTY_CONFIG_VDEC_ENTROPY: + data_ptr += sizeof(u32); + entropy_mode = *(u32 *)data_ptr; + event.entropy_mode = entropy_mode; + data_ptr += sizeof(u32); + break; + case HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS: + data_ptr += sizeof(u32); + bufreq = (struct hfi_buffer_requirements *)data_ptr; + event.buf_count = HFI_BUFREQ_COUNT_MIN(bufreq, ver); + data_ptr += sizeof(*bufreq); + break; + case HFI_INDEX_EXTRADATA_INPUT_CROP: + data_ptr += sizeof(u32); + crop = (struct hfi_extradata_input_crop *)data_ptr; + event.input_crop.left = crop->left; + event.input_crop.top = crop->top; + event.input_crop.width = crop->width; + event.input_crop.height = crop->height; + data_ptr += sizeof(*crop); + break; default: break; } 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: 134079 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2190239lji; Tue, 24 Apr 2018 05:45:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx48r6FDp+NKAhGICnNZ4c3b25Vdp3p4jmpu7LNek8fEknf3ufZEMZxHKRA8UI2Giqq9EkQlp X-Received: by 2002:a17:902:8488:: with SMTP id c8-v6mr24868470plo.357.1524573920660; Tue, 24 Apr 2018 05:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524573920; cv=none; d=google.com; s=arc-20160816; b=1JBn1LNkGNgAgAg4ffzCgbDpbBklZS8tjBjC2vLFiQSHM0B/1s2hs+2bGRYGzN80q0 gLbJwRtm2hG7tx1XOHdWYyxsdNNbQmnrA13YoOOPHNhM6rnbZB57JV4Tw/jU9WAp3WJ8 CXa2zDoKkS/Gl/HC0rfEOSIksyEwD79Q1vNpHX2yjhXf+bIp8GPMF+Aeo4M0oYFJvdZ1 4oCyu6x+3sRwfOa5A2aL+PrK9MUPUk7TPKPgzhooyrWENDDKCO5W7KxIAI1TGz7ZtkCq X1arAZNp2VTrKnNfQUien4YiuLPvFASXnMwYolct/xzCFx6KTmS+fg/sgxkHFoPcPKPE yF/A== 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=y9cBhTi9twYBRH8ovOvooJ8uIrDamLv1hzaB2RNI8tU=; b=r+khk1Q1Xd8zhMlfAsT5h/lLZFCzRNI3dYcHn9GE3EudLrrLdTKg37CNQkXuYATx6o xPo57MNrS++fxxuSrFUA03+zdADL/EV0AWfrYHwXyWqqfG5ejBD06571MpqpHLNMq2WZ VuA0HWwd8slz1/JLRuEQHNfV2JxbIpYYTxtoBaaVUEy5AOJQgURMKXwgFsKzNOZQYy+E 1lFaW4c9HrDxkduP8laAz0r8tMYk+Z8V1DUPgP4P9PLl/pgO/S0TaKOJcHSkwqhETDfI CteaIyzPfUbS3GaHl18Sa61DXIiCr122/aHmSOGRjwMkwiiiuXBMz0PsOBiXb+EfcebT RX0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=dceRlkYI; 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 b3-v6si1574380pli.0.2018.04.24.05.45.20; Tue, 24 Apr 2018 05:45:20 -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=dceRlkYI; 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 S1757828AbeDXMpS (ORCPT + 12 others); 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-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 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 -- 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/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) From patchwork Tue Apr 24 12:44:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 134100 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2198787lji; Tue, 24 Apr 2018 05:53:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx49l2kBydBdVorVFrHvG67s5AlWLMNzUOLSDW55pLjRv8ZGZQY8QRpy08CjyAz/bF+b4BweR X-Received: by 10.101.96.205 with SMTP id r13mr8729782pgv.22.1524574422935; Tue, 24 Apr 2018 05:53:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524574422; cv=none; d=google.com; s=arc-20160816; b=rPnLxfBTq89zWi5wEPIGak2nQbglK3LXfE63bdw/sZAsxtsSPOjNL65rv0D3zO88tw FSuW+iAXamFOYeuSxUSuYp7zd+NGvi2XxT/Flv7rXWbtdCGVYKyNRici8rquOjnKffpS eOO/G/76bicWrIblO4kvNqaUtkduecYCwvZ8wZPa5rr2yjkVmvymV5PsyC2+GZA+w1Ta ZPz3ute6HM2xEiez4rkiPl1cKdUQYCzWu+s2X9aLU8Q0Tm6jENRkjY/4DpLDA2Hng8Cw CzynW1y/JnThgOwv6q79dq6m7G6vsuO4CMY0FppCE8JpueS9AOdmOLrgRsmSpN6UmqpZ h/hQ== 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=ranS/GvgSu/hXiF+BOsHnRJTM1PZETANBozCuYa/8wA=; b=NuIdx1T5GxbJIvryNinmUL1uy65dcUj0M1dREV9dF+L+YcuQ0m1m4+9zaSRnhtezAn p8e3wu5fQFpeawrUAtnEXM1marWtdh3ZvdOZjUq0XGUA/5X2cbp4gRZIHCv7ONIDYGZf 8Bq2faCL77JAXxBN8C14zWU2Y1zkLN3w62xPQIfJoLkhgE6X1wvaX0M6F/vk/Ke0X67A pIlh8KYw3mw5p3NoSkNsk4PHSO5pXPTA5PYNoMD9q5YTNug76v3UAM1l3PirwSH1x5+u YJ1d3qGzxjgb+e1cxfQU1F9CNEs+1FlZemo2MOPUVBMQaIgHCZfDemratq8RclY3hhS0 0roA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=jvv9yNgT; 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 d16-v6si2278649pli.176.2018.04.24.05.53.42; Tue, 24 Apr 2018 05:53:42 -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=jvv9yNgT; 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 S933085AbeDXMxk (ORCPT + 12 others); Tue, 24 Apr 2018 08:53:40 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:54356 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757824AbeDXMpS (ORCPT ); Tue, 24 Apr 2018 08:45:18 -0400 Received: by mail-wm0-f67.google.com with SMTP id f6so688165wmc.4 for ; Tue, 24 Apr 2018 05:45:17 -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=dVkqRVLZfFoqB0FvZLVgL85/ireF+ESn1YcZI2Vtj7I=; b=jvv9yNgTqrGmlPBAGv8lNvbyQvFr4QaH2jz1HJuCR3ruVSGi7ed6Qz45hioUoi0C6C FsdItHcTIhonZL/FVWEH+2CJ9jvLhZ197rmhq6FNhRzqVqjJpwwayrTJIbfvTjzLrpT1 xEoptOsJcZMP+3nuyN72nbfQrpJs3wC7LgnPE= 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=dVkqRVLZfFoqB0FvZLVgL85/ireF+ESn1YcZI2Vtj7I=; b=pYzMB2Ckio/V6UlDN+mu2piC81iYGtyGO3/ALob925yeFOp090k+S1UlWWwpAH4gyP rGviUC6hx5yeQ05+MHf8rUkwCXsGAGTGt/4c/v+2nmTS7m4phfiNbE6j6xMQ09f+VNDx 6HcAAEqSA2nbdbbUsD9DBwYbwTcKTikNXbHgy1h39HuGjovTEBnnwPQZe+lUJRlt502Q 4/T1Dc8vx5dZ21h/EZhzFYB1+LjLYSBG4tf9Ro9nmhg9YFGqGIY6iox2eOFSly1mA0hs BZ9olAi+SGgvr59FG8bzWf9EbEMEvFHEw3caOhJMMnP9qS99N/WvDgyqmbSJOQF+VGRf kiuQ== X-Gm-Message-State: ALQs6tBpdvEZtYnse/Tp/zMG223tdup+Dq3UBpUX/uXMvtS+QDibmxYO 29FNHTnCzONjQPsLpjBS3dD3NZBz9us= X-Received: by 10.28.237.11 with SMTP id l11mr13351498wmh.160.1524573916737; Tue, 24 Apr 2018 05:45:16 -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.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 05:45:16 -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 09/28] venus: venc,vdec: adds clocks needed for venus 4xx Date: Tue, 24 Apr 2018 15:44:17 +0300 Message-Id: <20180424124436.26955-10-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 This extends the clocks number to support suspend and resume on Venus version 4xx. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 4 +-- drivers/media/platform/qcom/venus/vdec.c | 42 ++++++++++++++++++++++++++------ drivers/media/platform/qcom/venus/venc.c | 42 ++++++++++++++++++++++++++------ 3 files changed, 72 insertions(+), 16 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/core.h b/drivers/media/platform/qcom/venus/core.h index 8d3e150800c9..b5b9a84e9155 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -92,8 +92,8 @@ struct venus_core { void __iomem *base; int irq; struct clk *clks[VIDC_CLKS_NUM_MAX]; - struct clk *core0_clk; - struct clk *core1_clk; + struct clk *core0_clk, *core0_bus_clk; + struct clk *core1_clk, *core1_bus_clk; struct video_device *vdev_dec; struct video_device *vdev_enc; struct v4l2_device v4l2_dev; diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 261a51adeef2..c45452634e7e 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -1081,12 +1081,18 @@ static int vdec_probe(struct platform_device *pdev) if (!core) return -EPROBE_DEFER; - if (core->res->hfi_version == HFI_VERSION_3XX) { + if (IS_V3(core) || IS_V4(core)) { core->core0_clk = devm_clk_get(dev, "core"); if (IS_ERR(core->core0_clk)) return PTR_ERR(core->core0_clk); } + if (IS_V4(core)) { + core->core0_bus_clk = devm_clk_get(dev, "bus"); + if (IS_ERR(core->core0_bus_clk)) + return PTR_ERR(core->core0_bus_clk); + } + platform_set_drvdata(pdev, core); vdev = video_device_alloc(); @@ -1132,12 +1138,23 @@ static __maybe_unused int vdec_runtime_suspend(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); - if (core->res->hfi_version == HFI_VERSION_1XX) + if (IS_V1(core)) return 0; - writel(0, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); + if (IS_V3(core)) + writel(0, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); + else if (IS_V4(core)) + writel(0, core->base + WRAPPER_VCODEC0_MMCC_POWER_CONTROL); + + if (IS_V4(core)) + clk_disable_unprepare(core->core0_bus_clk); + clk_disable_unprepare(core->core0_clk); - writel(1, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); + + if (IS_V3(core)) + writel(1, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); + else if (IS_V4(core)) + writel(1, core->base + WRAPPER_VCODEC0_MMCC_POWER_CONTROL); return 0; } @@ -1147,12 +1164,23 @@ static __maybe_unused int vdec_runtime_resume(struct device *dev) struct venus_core *core = dev_get_drvdata(dev); int ret; - if (core->res->hfi_version == HFI_VERSION_1XX) + if (IS_V1(core)) return 0; - writel(0, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); + if (IS_V3(core)) + writel(0, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); + else if (IS_V4(core)) + writel(0, core->base + WRAPPER_VCODEC0_MMCC_POWER_CONTROL); + ret = clk_prepare_enable(core->core0_clk); - writel(1, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); + + if (IS_V4(core)) + ret |= clk_prepare_enable(core->core0_bus_clk); + + if (IS_V3(core)) + writel(1, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); + else if (IS_V4(core)) + writel(1, core->base + WRAPPER_VCODEC0_MMCC_POWER_CONTROL); return ret; } diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 947001170a77..bc8c2e7a8d2c 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -1225,12 +1225,18 @@ static int venc_probe(struct platform_device *pdev) if (!core) return -EPROBE_DEFER; - if (core->res->hfi_version == HFI_VERSION_3XX) { + if (IS_V3(core) || IS_V4(core)) { core->core1_clk = devm_clk_get(dev, "core"); if (IS_ERR(core->core1_clk)) return PTR_ERR(core->core1_clk); } + if (IS_V4(core)) { + core->core1_bus_clk = devm_clk_get(dev, "bus"); + if (IS_ERR(core->core1_bus_clk)) + return PTR_ERR(core->core1_bus_clk); + } + platform_set_drvdata(pdev, core); vdev = video_device_alloc(); @@ -1276,12 +1282,23 @@ static __maybe_unused int venc_runtime_suspend(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); - if (core->res->hfi_version == HFI_VERSION_1XX) + if (IS_V1(core)) return 0; - writel(0, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); + if (IS_V3(core)) + writel(0, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); + else if (IS_V4(core)) + writel(0, core->base + WRAPPER_VCODEC1_MMCC_POWER_CONTROL); + + if (IS_V4(core)) + clk_disable_unprepare(core->core1_bus_clk); + clk_disable_unprepare(core->core1_clk); - writel(1, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); + + if (IS_V3(core)) + writel(1, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); + else if (IS_V4(core)) + writel(1, core->base + WRAPPER_VCODEC1_MMCC_POWER_CONTROL); return 0; } @@ -1291,12 +1308,23 @@ static __maybe_unused int venc_runtime_resume(struct device *dev) struct venus_core *core = dev_get_drvdata(dev); int ret; - if (core->res->hfi_version == HFI_VERSION_1XX) + if (IS_V1(core)) return 0; - writel(0, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); + if (IS_V3(core)) + writel(0, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); + else if (IS_V4(core)) + writel(0, core->base + WRAPPER_VCODEC1_MMCC_POWER_CONTROL); + ret = clk_prepare_enable(core->core1_clk); - writel(1, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); + + if (IS_V4(core)) + ret |= clk_prepare_enable(core->core1_bus_clk); + + if (IS_V3(core)) + writel(1, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); + else if (IS_V4(core)) + writel(1, core->base + WRAPPER_VCODEC1_MMCC_POWER_CONTROL); return ret; } From patchwork Tue Apr 24 12:44:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 134097 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2195991lji; Tue, 24 Apr 2018 05:50:56 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+DFtm+xdH2EXhBmEDkEeJQvX9WSAs9xQUZzMmPAhumen5oTQcXd9gYGiFa9vTHwQe1YoP2 X-Received: by 2002:a17:902:8:: with SMTP id 8-v6mr24546905pla.287.1524574255892; Tue, 24 Apr 2018 05:50:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524574255; cv=none; d=google.com; s=arc-20160816; b=RsBWscu0Fbg/+FaNoYWketLGW/vbDDtzaRolQttCoDHHaHbP0M9o/13luCVF4z5bY0 cWc9RQaw8qicro//5USm55CIxVrWBkkW0cD51kletZGOnWtiBp1lSwk/PvP9w4Am8EGI HU6BiwtL5OqyOO+BRQsYuzasQfwKooOPbOuZVUsSMKlkb2opcmud/4kzn4EZRnlglhB2 ZA5esIyc/teYnLaNfGAAibht1RZIRCq507eOeobrOZ/je7fhGmwJqF8eUqzwXff0RGHG xDoA/AHJqp3MRFtsXyTNshutgqeaZh+h1ZlejqnUOmb7oBG0MqeVzzvvnonXiSPqesIE 1gWg== 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=IBa6phthbSwC1KdR8C68yhRyMlFFwINddYldGVWb/98=; b=gnxMKzug/gp7ECSlPTRSUDFiZzMkUTSbf/hKiUEH5LhPddav2pEUqu7JSeWeEf60aH 19kkthWQn8J+okwV97/s7s8ElfkkaX1o1ryay7wdwkTGmF6jiWhCsE1Y9epI/7rkRHDl 4TisBbu4uNATenDjAx3+qYjBtkC/Emw97otklXO8whsRHJBqrqf53uu8G9ui/sztVBKf bs8EruE8RcQrP5UhlJJfuT7JRl/959As4+nPQW9IN5nX2TssQxWMsIhtLBWfFlK+A4Ab +AvGXPQKhvMvsfAYZhAuvsx9Z5XUBV+4nktTOk1rok4C6unzUhJrcSsGjTMWsVa7eyos KYIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=CsLJFaRJ; 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 k5-v6si14918948pln.598.2018.04.24.05.50.55; Tue, 24 Apr 2018 05:50:55 -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=CsLJFaRJ; 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 S933258AbeDXMtL (ORCPT + 12 others); Tue, 24 Apr 2018 08:49:11 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:52211 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757852AbeDXMpV (ORCPT ); Tue, 24 Apr 2018 08:45:21 -0400 Received: by mail-wm0-f68.google.com with SMTP id j4so692924wme.1 for ; Tue, 24 Apr 2018 05:45:20 -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=FwCtEwLEpmMLaiuSji/6aV0n4yMAtfTv0+KtZGSYs+o=; b=CsLJFaRJ7PIllpeT5Fn+M5kfDu5l2VLYZbdw92cVN6qNTLFgaAaG1IhxbooT38zqLV S/srp/i/MlEKWq+cxJyiSDt3W1YLVzTyVUmOklvsNP0cEt+fpMW7EnyKPTr/APDdb0A6 uT1MWbH4Fyf41y17Fzo7UTM525DK591DarXgw= 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=FwCtEwLEpmMLaiuSji/6aV0n4yMAtfTv0+KtZGSYs+o=; b=s58yd0aEwSr/QfP+InpQxGVbcR1jUD4vHqYcCn4gGFwbE6i6/nQK9Sf8tr1obxMLi7 WeAZWktj5xukbumQEJaiwGu+cjdu8PugOZNEqUTHRznO4TjxCzGjz+1B/yhVtNwHqiE8 kS+BaN9056ADg/4dV5HIHX0bC2Li6H8BYaTonevkWCijWOsmYnPSTtoljKS5e0L/kpi4 M7HmXw3MkTJ3UYk34caKWpmk70h/hBlHXkfpfdEDdawdPVUpbuGh9wFJzXWf+eqgRqHB mwBcjpqaqAh/RZa1+v5RxVseUxXcxz1Ph+ftDtrik56HYCeJ/M9YPq3k6dH89Lqn4wX+ uvPg== X-Gm-Message-State: ALQs6tCEtTxs22Hhw52NcXr3Rppf3rpDyGzNwC1hfWdwj88gs12xdkwM XHrnJ0WyA/nx5L10efUNY/eI9A== X-Received: by 10.28.228.130 with SMTP id b124mr12987247wmh.100.1524573919870; Tue, 24 Apr 2018 05:45:19 -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.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 05:45:19 -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 12/28] venus: helpers: make a commmon function for power_enable Date: Tue, 24 Apr 2018 15:44:20 +0300 Message-Id: <20180424124436.26955-13-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 Make common function which will enable power when enabling/disabling clocks and also covers Venus 3xx/4xx versions. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 51 +++++++++++++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 ++ drivers/media/platform/qcom/venus/vdec.c | 25 ++++---------- drivers/media/platform/qcom/venus/venc.c | 25 ++++---------- 4 files changed, 67 insertions(+), 36 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 d9065cc8a7d3..2b21f6ed7502 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -13,6 +13,7 @@ * */ #include +#include #include #include #include @@ -24,6 +25,7 @@ #include "core.h" #include "helpers.h" #include "hfi_helper.h" +#include "hfi_venus_io.h" struct intbuf { struct list_head list; @@ -781,3 +783,52 @@ void venus_helper_init_instance(struct venus_inst *inst) } } EXPORT_SYMBOL_GPL(venus_helper_init_instance); + +int venus_helper_power_enable(struct venus_core *core, u32 session_type, + bool enable) +{ + void __iomem *ctrl, *stat; + u32 val; + int ret; + + if (!IS_V3(core) && !IS_V4(core)) + return -EINVAL; + + if (IS_V3(core)) { + if (session_type == VIDC_SESSION_TYPE_DEC) + ctrl = core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL; + else + ctrl = core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL; + if (enable) + writel(0, ctrl); + else + writel(1, ctrl); + + return 0; + } + + if (session_type == VIDC_SESSION_TYPE_DEC) { + ctrl = core->base + WRAPPER_VCODEC0_MMCC_POWER_CONTROL; + stat = core->base + WRAPPER_VCODEC0_MMCC_POWER_STATUS; + } else { + ctrl = core->base + WRAPPER_VCODEC1_MMCC_POWER_CONTROL; + stat = core->base + WRAPPER_VCODEC1_MMCC_POWER_STATUS; + } + + if (enable) { + writel(0, ctrl); + + ret = readl_poll_timeout(stat, val, val & BIT(1), 1, 100); + if (ret) + return ret; + } else { + writel(1, ctrl); + + ret = readl_poll_timeout(stat, val, !(val & BIT(1)), 1, 100); + if (ret) + return ret; + } + + return 0; +} +EXPORT_SYMBOL_GPL(venus_helper_power_enable); diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 971392be5df5..0e64aa95624a 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -43,4 +43,6 @@ int venus_helper_set_color_format(struct venus_inst *inst, u32 fmt); void venus_helper_acquire_buf_ref(struct vb2_v4l2_buffer *vbuf); void venus_helper_release_buf_ref(struct venus_inst *inst, unsigned int idx); void venus_helper_init_instance(struct venus_inst *inst); +int venus_helper_power_enable(struct venus_core *core, u32 session_type, + bool enable); #endif diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index cd278a695899..0ddc2c4df934 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -1131,26 +1131,21 @@ static int vdec_remove(struct platform_device *pdev) static __maybe_unused int vdec_runtime_suspend(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); + int ret; if (IS_V1(core)) return 0; - if (IS_V3(core)) - writel(0, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); - else if (IS_V4(core)) - writel(0, core->base + WRAPPER_VCODEC0_MMCC_POWER_CONTROL); + ret = venus_helper_power_enable(core, VIDC_SESSION_TYPE_DEC, true); if (IS_V4(core)) clk_disable_unprepare(core->core0_bus_clk); clk_disable_unprepare(core->core0_clk); - if (IS_V3(core)) - writel(1, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); - else if (IS_V4(core)) - writel(1, core->base + WRAPPER_VCODEC0_MMCC_POWER_CONTROL); + ret |= venus_helper_power_enable(core, VIDC_SESSION_TYPE_DEC, false); - return 0; + return ret; } static __maybe_unused int vdec_runtime_resume(struct device *dev) @@ -1161,20 +1156,14 @@ static __maybe_unused int vdec_runtime_resume(struct device *dev) if (IS_V1(core)) return 0; - if (IS_V3(core)) - writel(0, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); - else if (IS_V4(core)) - writel(0, core->base + WRAPPER_VCODEC0_MMCC_POWER_CONTROL); + ret = venus_helper_power_enable(core, VIDC_SESSION_TYPE_DEC, true); - ret = clk_prepare_enable(core->core0_clk); + ret |= clk_prepare_enable(core->core0_clk); if (IS_V4(core)) ret |= clk_prepare_enable(core->core0_bus_clk); - if (IS_V3(core)) - writel(1, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); - else if (IS_V4(core)) - writel(1, core->base + WRAPPER_VCODEC0_MMCC_POWER_CONTROL); + ret |= venus_helper_power_enable(core, VIDC_SESSION_TYPE_DEC, false); return ret; } diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index be8ea3326386..f87d891325ea 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -1267,26 +1267,21 @@ static int venc_remove(struct platform_device *pdev) static __maybe_unused int venc_runtime_suspend(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); + int ret; if (IS_V1(core)) return 0; - if (IS_V3(core)) - writel(0, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); - else if (IS_V4(core)) - writel(0, core->base + WRAPPER_VCODEC1_MMCC_POWER_CONTROL); + ret = venus_helper_power_enable(core, VIDC_SESSION_TYPE_ENC, true); if (IS_V4(core)) clk_disable_unprepare(core->core1_bus_clk); clk_disable_unprepare(core->core1_clk); - if (IS_V3(core)) - writel(1, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); - else if (IS_V4(core)) - writel(1, core->base + WRAPPER_VCODEC1_MMCC_POWER_CONTROL); + ret |= venus_helper_power_enable(core, VIDC_SESSION_TYPE_ENC, false); - return 0; + return ret; } static __maybe_unused int venc_runtime_resume(struct device *dev) @@ -1297,20 +1292,14 @@ static __maybe_unused int venc_runtime_resume(struct device *dev) if (IS_V1(core)) return 0; - if (IS_V3(core)) - writel(0, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); - else if (IS_V4(core)) - writel(0, core->base + WRAPPER_VCODEC1_MMCC_POWER_CONTROL); + ret = venus_helper_power_enable(core, VIDC_SESSION_TYPE_ENC, true); - ret = clk_prepare_enable(core->core1_clk); + ret |= clk_prepare_enable(core->core1_clk); if (IS_V4(core)) ret |= clk_prepare_enable(core->core1_bus_clk); - if (IS_V3(core)) - writel(1, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); - else if (IS_V4(core)) - writel(1, core->base + WRAPPER_VCODEC1_MMCC_POWER_CONTROL); + ret |= venus_helper_power_enable(core, VIDC_SESSION_TYPE_ENC, false); return ret; } From patchwork Tue Apr 24 12:44:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 134081 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2190707lji; Tue, 24 Apr 2018 05:45:46 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+vLt/7swE39BDIDO29/ws2WZZgLdzTeVGBnIaQsM1pAiP9ehX01lUyA25imWQxxVySd9t9 X-Received: by 2002:a17:902:6181:: with SMTP id u1-v6mr24591077plj.272.1524573946193; Tue, 24 Apr 2018 05:45:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524573946; cv=none; d=google.com; s=arc-20160816; b=Dhg+c/utbeLdN0JqoFMmXw4ntOJ3UDdqpsphrMRmekVNLOBGbb87Q0F/oOJoGdIk+F air5Sfvgb3ThGSmOJ8ZyfQtW3r+xbXVUU81JjHdo/fzuIUzopLxssqncV71/HWF5Lg0W qQzBAet0+Cps00YgMTc1X3rSxPK/MuLbUPI+ZhwFA+eGMHsEAc2I/NxrZC1gwqTGsAQN WeN6o2O2ZswPcUUCeQ9vyZOvs9WAnQPgjXSwzcIcs732TqcTJsBKU+TLfLsOUhty6be/ 2+FTNJDr/vazfglgYxi/Ly5Pkoh3hlHDkwa2UcLFk7HiCpUU/UkUn3Kl2O53hXG2NsE6 dLzg== 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=U2xi0dn6gyZZ1hHDNjEw863LI0vBovx/8ohHjYwNdKM=; b=Cx5cOrbj5Itlp8oMssFc8qBZ1h/XWNAmrIul/jUBHQJJItg9YGRS0FVhzfeozFKm9V zmQPQjpBrbwepk7xn4xqmyCkibi2wvimHHxF04m2xLv+APbExi54ChE8BvsO07q5A3+h WTtGOWL7Q0N09VkUG1grXitEAxW2JLpuyTpnEt70BK685QBLknzZ6SDzL4HYwtj+tX6M d+/OC1rD4js94B6ZB4RatxO07TkvQPWpB4Eqlyh14bWfLAhphpW/YRi41YYeQHEPLh9z fVNaHIZ/Ls6dhQwIIbdqnM0KlJO0XUGuHTXhK+y+uPxzq9U5bDqqTRBmOHZ7E0nmnxlO EoDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=cxxR2Mae; 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 h185si9600654pgc.34.2018.04.24.05.45.45; Tue, 24 Apr 2018 05:45:46 -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=cxxR2Mae; 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 S932864AbeDXMpn (ORCPT + 12 others); Tue, 24 Apr 2018 08:45:43 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:52222 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932895AbeDXMpZ (ORCPT ); Tue, 24 Apr 2018 08:45:25 -0400 Received: by mail-wm0-f66.google.com with SMTP id j4so693325wme.1 for ; Tue, 24 Apr 2018 05:45:25 -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=E1+ejdpR+y9FFa9IqPOnHFP+NneMBNW0D/LV7Xa2NWI=; b=cxxR2Maek1lraGTEXZDsWBggO5SnVXjvXN6RiN4msQAjoqHM+yr3qcWRqNpOyeYMcq F1cPZ/akFtj5sMrC33OcbaMsf3+ShUWTWim4ELQS2rdoeeHMDYqT9RZ8wCbgqOd40bN0 07PkKrxB1jJRewSL30m2NHikR7VJQ5ktfmfos= 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=E1+ejdpR+y9FFa9IqPOnHFP+NneMBNW0D/LV7Xa2NWI=; b=CsNAn6nrdwMzd8S/f+RAICk+PKF1fJCm0dJbeDOdoH/ahU/q+j6BH4Nd4HhIwuONP/ 4fG235PJ0buv7fEyZTN+l/Ioc5H+cwm5Qi8BElkIXUpvSEg2i1q96K7yqBs59FB9pKhw pwsEG0sHtXo6p8hFRCvoOEFx7ySYJbp/KSplkVxdPzqN9cKFUOcZxJ9PcFSM3qpmNehZ 2oPimC9l6SZCTVEjlN24R8gIxxsCRj1uYYo9xgLRG3V/uViTTefbdKhHllKrJfTD7Juk Tqc6k12YzH1f83KhkQ80X5SfNZ8tB+bEHbqcxVBuyWfSfyhQ2V0dRqqIY1MYx7+6OFux tZKA== X-Gm-Message-State: ALQs6tBzpIpJoHVTLagmXx/18lCsaWtyItW6ohQE4N8EzJZQEqUfFHJE VaCGny1e2wZ2VADKdwBvFt8zTRkEio4= X-Received: by 10.28.91.209 with SMTP id p200mr11519310wmb.11.1524573924309; Tue, 24 Apr 2018 05:45:24 -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.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 05:45:23 -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 16/28] venus: add helper function to set actual buffer size Date: Tue, 24 Apr 2018 15:44:24 +0300 Message-Id: <20180424124436.26955-17-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 Add and use a helper function to set actual buffer size for particular buffer type. This is also preparation to use the second decoder output. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 12 ++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 1 + drivers/media/platform/qcom/venus/vdec.c | 10 ++-------- 3 files changed, 15 insertions(+), 8 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 824ad4d2d064..94664a3ce3e2 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -544,6 +544,18 @@ int venus_helper_set_dyn_bufmode(struct venus_inst *inst) } EXPORT_SYMBOL_GPL(venus_helper_set_dyn_bufmode); +int venus_helper_set_bufsize(struct venus_inst *inst, u32 bufsize, u32 buftype) +{ + u32 ptype = HFI_PROPERTY_PARAM_BUFFER_SIZE_ACTUAL; + struct hfi_buffer_size_actual bufsz; + + bufsz.type = buftype; + bufsz.size = bufsize; + + return hfi_session_set_property(inst, ptype, &bufsz); +} +EXPORT_SYMBOL_GPL(venus_helper_set_bufsize); + static void delayed_process_buf_func(struct work_struct *work) { struct venus_buffer *buf, *n; diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 52b961ed491e..cd306bd8978f 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -41,6 +41,7 @@ int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, unsigned int output_bufs); 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); void venus_helper_acquire_buf_ref(struct vb2_v4l2_buffer *vbuf); void venus_helper_release_buf_ref(struct venus_inst *inst, unsigned int idx); void venus_helper_init_instance(struct venus_inst *inst); diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 1de9cc64cf2f..b43607dee4fe 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -710,7 +710,6 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count) { struct venus_inst *inst = vb2_get_drv_priv(q); struct venus_core *core = inst->core; - u32 ptype; int ret; mutex_lock(&inst->lock); @@ -740,13 +739,8 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count) goto deinit_sess; if (core->res->hfi_version == HFI_VERSION_3XX) { - struct hfi_buffer_size_actual buf_sz; - - ptype = HFI_PROPERTY_PARAM_BUFFER_SIZE_ACTUAL; - buf_sz.type = HFI_BUFFER_OUTPUT; - buf_sz.size = inst->output_buf_size; - - ret = hfi_session_set_property(inst, ptype, &buf_sz); + ret = venus_helper_set_bufsize(inst, inst->output_buf_size, + HFI_BUFFER_OUTPUT); if (ret) goto deinit_sess; } 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); From patchwork Tue Apr 24 12:44:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 134091 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2193968lji; Tue, 24 Apr 2018 05:49:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx48DKp9BWXUiuHWB/eQfhLe1aecgIghecAFOPshIKDHSkT+uJz5Ko1rD16FzGddNU5lPHszG X-Received: by 2002:a17:902:9a41:: with SMTP id x1-v6mr25493663plv.256.1524574141946; Tue, 24 Apr 2018 05:49:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524574141; cv=none; d=google.com; s=arc-20160816; b=OVdXJO1OVL0GNqAkGfVvLeQIv7e3mq6tRtrhEHsWyqETY51ByaHSDLcp4btpMXr7UA hSQNRO+23jt5z3PG8TyEek0tQa0g6iVJPY9FR7qi/XSJilarSb7z180OjU5j5cw+9+XE K0b664EGemRtpEUmg2fkI5d4nwxpKOfZT5kHBqa3A7qp4oPrVFFCaKi+8vC/s3PrTmaP 4SglvRn6xkmkBAFU7Y2xVurDcG/L1lhAxrC9IZSlgyaLJ5pgsfiFphf4l+PJZ6bJp2LM Qi40nlL2h+seP7ANdh67DHC16WVZmnTby5Xn7cvnbRJW8JE4Zv60/Ksw1zoxY3NkbLTy oZRg== 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=3ai6kxNR+dm+UEc+yxYckccSo9kZlfgfvr9fT9GLxD8=; b=oC2hB4gk/QYIDF25GCWM8/6Lk/SqWmPmWBcTszqmmaT5IU9ECfgLzd87H613GBWEr1 aVTDSDbB0BmefJk3y+9slgCN3JEXmj4TxEvjT23ziJi9DBul2hk9QXY+DHvqAzOj9SEc 4NkdhylBXJn41MMvBfc6Bo6JMwakxagrtm1tdlpt5TD5L+f5io4dngsJSxeX/1C/mPsk zLeihT9Gre/ntkowXBps/L6HkES+YK+9dR1fOPquj642iwZwzmRcvRYaf2bmBnwgJkOd RIBTqv2k2p7kyPX1Yk+j6SXlxoxF5G/9+KMV8XZG83Y3tBw/GzkcIibqqx6U6x38w1RB EPGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=K5zkByJk; 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.48.58; Tue, 24 Apr 2018 05:49:01 -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=K5zkByJk; 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 S932854AbeDXMsy (ORCPT + 12 others); Tue, 24 Apr 2018 08:48:54 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:42952 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757859AbeDXMpa (ORCPT ); Tue, 24 Apr 2018 08:45:30 -0400 Received: by mail-wr0-f195.google.com with SMTP id s18-v6so49792630wrg.9 for ; Tue, 24 Apr 2018 05:45:29 -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=E6MkggzS/K/ebZ56K2ogSp1CwxIKbW/hp68ey+BGUis=; b=K5zkByJkIWRBiYoW8GhRAduR5uls9LRt0Bqae9twtcbowjFpXy8XQQ4hu0qi4Lo1F5 rdq+yaYu7YIYifhpcq+8AG8tSpz8aFg1vQ0WthqnKrWZC9GKJQQAl9XWw21og1Nf1Akn k7o8m+GFDnlhBKdFMVkih/7qwr9LpqXOGPfIs= 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=E6MkggzS/K/ebZ56K2ogSp1CwxIKbW/hp68ey+BGUis=; b=iCMOn1R+1Y9OC5vKe6VgdB/6umOmtucmtqE0+mpVR/foxCUS0ujY8kFyUqM1/N0Cui hUcmfQX8nYzjrgb4L8xxSVRpVe52Bo/6cxZWdmgg6reH+TTt6vS/mfQtm5q9pyxaEVZj CZmpgeUfMxenIGIIHnMSlNdr88BpPcvG5P0A1a7zLpr3Al3ZSog48w2MPb54tvIe50kZ F+9dDSaAml04zqa/mAlicMcMLNymo0FixmdUP3zMYQbv67Kh8SHZlg9ZG06y/tIePLD0 HJLsIc8lMHfoetigXZBgb2bE/4BoFY+vYZRwF+W36/WhL9CGArcHglYnFalW0ohe4Q/k 49kA== X-Gm-Message-State: ALQs6tCT6Sb+5UW+FoK9PQGd4Do9lmUMyODF8wEQN+RIgy+J1y9RZSWG lPW67dJMO7WhaqvB4dTcEuB6RQ== X-Received: by 2002:adf:8bce:: with SMTP id w14-v6mr20301937wra.169.1524573928804; Tue, 24 Apr 2018 05:45:28 -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.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 05:45:28 -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 20/28] venus: helpers, vdec, venc: add helpers to set work mode and core usage Date: Tue, 24 Apr 2018 15:44:28 +0300 Message-Id: <20180424124436.26955-21-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 These are new properties applicable to Venus version 4xx. Add the helpers and call them from decoder and encoder drivers. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 28 ++++++++++++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 ++ drivers/media/platform/qcom/venus/vdec.c | 8 ++++++++ drivers/media/platform/qcom/venus/venc.c | 8 ++++++++ 4 files changed, 46 insertions(+) -- 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 0d55604f7484..adf8701a64bb 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -484,6 +484,34 @@ int venus_helper_set_output_resolution(struct venus_inst *inst, } EXPORT_SYMBOL_GPL(venus_helper_set_output_resolution); +int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode) +{ + u32 ptype = HFI_PROPERTY_PARAM_WORK_MODE; + struct hfi_video_work_mode wm; + + if (!IS_V4(inst->core)) + return 0; + + wm.video_work_mode = mode; + + return hfi_session_set_property(inst, ptype, &wm); +} +EXPORT_SYMBOL_GPL(venus_helper_set_work_mode); + +int venus_helper_set_core_usage(struct venus_inst *inst, u32 usage) +{ + u32 ptype = HFI_PROPERTY_CONFIG_VIDEOCORES_USAGE; + struct hfi_videocores_usage_type cu; + + if (!IS_V4(inst->core)) + return 0; + + cu.video_core_enable_mask = usage; + + return hfi_session_set_property(inst, ptype, &cu); +} +EXPORT_SYMBOL_GPL(venus_helper_set_core_usage); + int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, unsigned int output_bufs) { diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 79af7845efbd..d5e727e1ecab 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -38,6 +38,8 @@ int venus_helper_set_input_resolution(struct venus_inst *inst, int venus_helper_set_output_resolution(struct venus_inst *inst, unsigned int width, unsigned int height, u32 buftype); +int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode); +int venus_helper_set_core_usage(struct venus_inst *inst, u32 usage); 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, diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index b43607dee4fe..ceaf1a338eb3 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -550,6 +550,14 @@ static int vdec_set_properties(struct venus_inst *inst) u32 ptype; int ret; + ret = venus_helper_set_work_mode(inst, VIDC_WORK_MODE_2); + if (ret) + return ret; + + ret = venus_helper_set_core_usage(inst, VIDC_CORE_ID_1); + if (ret) + return ret; + if (core->res->hfi_version == HFI_VERSION_1XX) { ptype = HFI_PROPERTY_PARAM_VDEC_CONTINUE_DATA_TRANSFER; ret = hfi_session_set_property(inst, ptype, &en); diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 8970f14b3a82..3b3299bff1cd 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -643,6 +643,14 @@ static int venc_set_properties(struct venus_inst *inst) u32 ptype, rate_control, bitrate, profile = 0, level = 0; int ret; + ret = venus_helper_set_work_mode(inst, VIDC_WORK_MODE_2); + if (ret) + return ret; + + ret = venus_helper_set_core_usage(inst, VIDC_CORE_ID_2); + if (ret) + return ret; + ptype = HFI_PROPERTY_CONFIG_FRAME_RATE; frate.buffer_type = HFI_BUFFER_OUTPUT; frate.framerate = inst->fps * (1 << 16); From patchwork Tue Apr 24 12:44:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 134090 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2193917lji; Tue, 24 Apr 2018 05:48:58 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Mnd8uBMS5FCckr31PchGtK6jkp86UH/4oTq8ROBkOeOwkWyY5KePPhPG79PHZ1jIBZLkX X-Received: by 10.99.125.86 with SMTP id m22mr20865947pgn.257.1524574138347; Tue, 24 Apr 2018 05:48:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524574138; cv=none; d=google.com; s=arc-20160816; b=rgxvwAEGHAT+aimZsKJ4AltMftZPOFHdGm6Wa8YOZrmx3Wuw+FakUtJg4EhTJAv5Io BD3GYvMRt/SaKnftjSp1sucBbcTDsNXOX3qp/0LGoq2hw4bqHNr88wanvS9BHjDnTnqs whFONDse7TPA1kMZeRXTpmX0HgD7tRNV9qSrzM8Dm2/tceyxLlsCa+SEU7fhkiLwenhF CZwgixflZMl5FL9eig88zFMV7/aEQIHGSWzX1Bbve/MtCe6bE1fjdemliCP5zi1ogwUE 6nEgScBqnou0n1FUGbQ9mucpep73+BEi+HAMW6L8psB31Z8t/uDipsUX45BuuWJF67iF dvLg== 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=ORTZztKofskC7v1ejEqolTCt3cDKmedOQOV1icLLFzM=; b=k+V0O1xrPMchj3QrJhNV8qJhddMo4g+bfL6j3mqVMk4evev5+CisKVSshbnwa9L1Jo WMNNMgh6xpKDdqeea6ahhfgx82cXehC94ubSCfMYbZH1KKJx40w0b7Q/a04CbkiFinxp /nZAGNU0ZOAZA98NiSsp0ePVSUa83ksnw86nbU8DGPGpfStA/zx3LfFqVk0QESpXPvLH bFfKwlRiqZOVg3f7Og5R2PIJFIG5nAv4BCbDIB35j691X9RVOi4B+TIPplPl/LOJDx9k 2Y3wxzQ338zrezCdNIGq5S5MJD5ep7vZNilVNRxAqOANMzJOLUoYoCAq6YI/cayT1ysR GciQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=bQP+h/TG; 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.48.55; Tue, 24 Apr 2018 05:48:58 -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=bQP+h/TG; 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 S1757706AbeDXMsx (ORCPT + 12 others); Tue, 24 Apr 2018 08:48:53 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:43977 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757863AbeDXMpb (ORCPT ); Tue, 24 Apr 2018 08:45:31 -0400 Received: by mail-wr0-f193.google.com with SMTP id v15-v6so31694187wrm.10 for ; Tue, 24 Apr 2018 05:45:30 -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=f/4AdQywwbP394uiEj1sSEy1sx0RwvTHezORi/HpjQ4=; b=bQP+h/TGW9vG0mKDwp1V1oNGyK7eiXl4B7CKqjBq9VE+VECjT0X4nvTiycCAOo9SZ+ z4+Euotw/FMp9Ry6g6AjrfHNlmE2k+gacHdFOfilYW6tkN9/1D/o5MM3kRNjK+EywRzl cQqv5kvnbCdyHASeNdvqYb5txiySCMuLS2GcA= 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=f/4AdQywwbP394uiEj1sSEy1sx0RwvTHezORi/HpjQ4=; b=hnjVqXfwzHBto04fbWiuDCb1uKsKjC2wa56PE8X/tOyMA+Mu6OY0UysY2iGMB5xCmf eehNSgxtdADlrqXJDh3ZbtSn0oakcKx0XlD0CLnRPc44Tt90DMGva/f8Lsl+iEMV/zG/ tlKXLLQGmvB2bSxO9NxZRhkS/FJOf0t7hWHsX2TrNda0Z1cDxtrJ4Z/dyzExN1yxecRT g3vfp+l1Mmwh3saoJQCmAAGnD6Y0QpFe5/SF3aqUr2y+qv+ZnB3ADh4QSu8inX4NXeul Vr3EDo7iDwXu3epLqRjSB1uVqdjENkM0juZdMmbcBb4IkSwJTxmpwsXsiE8NhpJddoCp 93/g== X-Gm-Message-State: ALQs6tA8s2GanQouc+WCCeXr6W156vl3sOHT1hhCZZX58hp8gQFTCCkF dyIEGVvETdi1gqwp2NHy04SXBw== X-Received: by 2002:adf:b8cf:: with SMTP id c15-v6mr21172072wrg.122.1524573929796; Tue, 24 Apr 2018 05:45:29 -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.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 05:45:29 -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 21/28] venus: helpers: extend set_num_bufs helper with one more argument Date: Tue, 24 Apr 2018 15:44:29 +0300 Message-Id: <20180424124436.26955-22-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 Extend venus_helper_set_num_bufs() helper function with one more argument to set number of output buffers for the secondary decoder output. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 16 ++++++++++++++-- drivers/media/platform/qcom/venus/helpers.h | 3 ++- drivers/media/platform/qcom/venus/vdec.c | 2 +- drivers/media/platform/qcom/venus/venc.c | 2 +- 4 files changed, 18 insertions(+), 5 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 adf8701a64bb..f04d16953b3a 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -513,7 +513,8 @@ int venus_helper_set_core_usage(struct venus_inst *inst, u32 usage) EXPORT_SYMBOL_GPL(venus_helper_set_core_usage); int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, - unsigned int output_bufs) + unsigned int output_bufs, + unsigned int output2_bufs) { u32 ptype = HFI_PROPERTY_PARAM_BUFFER_COUNT_ACTUAL; struct hfi_buffer_count_actual buf_count; @@ -529,7 +530,18 @@ int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, buf_count.type = HFI_BUFFER_OUTPUT; buf_count.count_actual = output_bufs; - return hfi_session_set_property(inst, ptype, &buf_count); + ret = hfi_session_set_property(inst, ptype, &buf_count); + if (ret) + return ret; + + if (output2_bufs) { + buf_count.type = HFI_BUFFER_OUTPUT2; + buf_count.count_actual = output2_bufs; + + ret = hfi_session_set_property(inst, ptype, &buf_count); + } + + return ret; } EXPORT_SYMBOL_GPL(venus_helper_set_num_bufs); diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index d5e727e1ecab..8ff4bd3ef958 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -41,7 +41,8 @@ int venus_helper_set_output_resolution(struct venus_inst *inst, int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode); int venus_helper_set_core_usage(struct venus_inst *inst, u32 usage); int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, - unsigned int output_bufs); + unsigned int output_bufs, + unsigned int output2_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); diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index ceaf1a338eb3..8d188b11b85a 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -758,7 +758,7 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count) goto deinit_sess; ret = venus_helper_set_num_bufs(inst, inst->num_input_bufs, - VB2_MAX_FRAME); + VB2_MAX_FRAME, VB2_MAX_FRAME); if (ret) goto deinit_sess; diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 3b3299bff1cd..c9c40d1ce7c6 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -963,7 +963,7 @@ static int venc_start_streaming(struct vb2_queue *q, unsigned int count) goto deinit_sess; ret = venus_helper_set_num_bufs(inst, inst->num_input_bufs, - inst->num_output_bufs); + inst->num_output_bufs, 0); if (ret) goto deinit_sess; From patchwork Tue Apr 24 12:44:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 134088 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2191642lji; Tue, 24 Apr 2018 05:46:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+jPma5Vxw45r3m2+FcH8z1avsWxrVn2ObaqEyhm313ynCxKz+ZCd5hzLliWTjzWfZ7fdfF X-Received: by 10.99.61.202 with SMTP id k193mr20036611pga.435.1524574003745; Tue, 24 Apr 2018 05:46:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524574003; cv=none; d=google.com; s=arc-20160816; b=KFEqCvP3kRIG8o+8WhJh4/NAnsJxGfWfuwXBkQQIFU+MOw0OvFUJb2OZtDObmG719+ Z2Oem/Thmdv7O+ebb5zQDTggYY/Ds50s2am9vrsyL5wtj2l6N887mC0Vz0jOC5zpx/f2 YvDbzclxqdycW2CA4bRcQetXKFW66dG9eE9wSHBH03mAYcLO3rxilG58id7qAFrRzfFc riFbOfXeBtls3hw2bakZ55mKVR5JH+8N14xPMeRjb/kGAFTOXgSE35/9JO4ITtY4qqTu O8GjH4a8TqSaZEMsNc7poo3Ojs0c/a/mQUWlXhlkiGly/bJfQ1nzomb4MfuR0LJ9N5/z MUjw== 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=9Pr8WBhrEA3dnaaguJR719cM0+aVZOGHzMYtHN4i9fs=; b=q86xNW9pDcXrXsRQBqI5G6SabNl+akr2k0K7WmctOE6RDlYpMr2g3OZeCZ46EvoQOT Hu2ORaJ2ElBmbiTFa4S/KNAOMmspvoXZbZwFzXYE4kFHDVWlZQQltzN0Lex1ZsMT1R9V +C+gS5kPyt+3ewS2ZX4uYr4X0KOsB6smWWPmsbjLBGVURuNTVB/ITuOo3fVmecdbpWYz a4jO6yNAd28b0cdrKuB6XzeyFKHDP5z8EcNW+IFd0jaWP0B3F8djTdrtEtHa9QEGuTva ERYN88Hs7YBiYxjGtiXuTAxl9m0ri2KTlV5AxVQL8kxpqVQsw6bCKzpjBWwogo4XLW6r WXmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=EtN1Z8TK; 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 c11-v6si13560927pls.97.2018.04.24.05.46.43; Tue, 24 Apr 2018 05:46:43 -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=EtN1Z8TK; 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 S933097AbeDXMqk (ORCPT + 12 others); Tue, 24 Apr 2018 08:46:40 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:51012 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757866AbeDXMpc (ORCPT ); Tue, 24 Apr 2018 08:45:32 -0400 Received: by mail-wm0-f68.google.com with SMTP id t67so691440wmt.0 for ; Tue, 24 Apr 2018 05:45:31 -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=hWZfGvfu/2NalLUr9US+fWfp5Cl3dsxLRK8jVW0R1to=; b=EtN1Z8TKyt8sakREnupB4xNELFwZtCs0JpwbkA+inaY5sBT0p1TL2C1+64rK4+ijDm jZiQV0B3MEaeV9rEg+SiL4DSyVk3DaU8cAe2h48921tutCsYZBGhb2HHLFLKIyHoBDHt lVP2zcLg2aAxXMy2/pEM/mhxXUv421zolW7vA= 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=hWZfGvfu/2NalLUr9US+fWfp5Cl3dsxLRK8jVW0R1to=; b=Z86T7rgKfCneqRVd7V/stE22jMB1h9loiEkOtO+zJ3tbEedr8c3oedQ/hW782qwnXC CIWNPyx/VrJD3cLVFiKtel3niLfIqlenHFgvx8JRUuwXqTL2sqmwsNoOgnazIEBOc7++ lZs9JgRKTwpA4FGNLWgvrTYZvyzQFJoKVeY2BqBytBDUeX5In+eWLGWHrC9TvaNUicBa Zo2gEVc6IpPc1lJ2UBom0/hDE6EpXiiMYdQFeFCB5LVBMtwE9jCxdAmVqOCxlx7F6rSh VYK7v0jL8nIt7dtM9M4Y4e2+Zr5+c9JQzmJnfW8jvEMTgvwahWrAmecRnTDq9B2pcVVd Kh9Q== X-Gm-Message-State: ALQs6tBKyPF5qXTvdmJG5WcpUBLneW8Jmhz1DAcxmvA9UICf5yfV9+8O go/4CViLLIBuvV57IAEDVKCdrA== X-Received: by 10.28.111.7 with SMTP id k7mr12038928wmc.148.1524573930767; Tue, 24 Apr 2018 05:45:30 -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.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 05:45:30 -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 22/28] venus: helpers: add a helper to return opb buffer sizes Date: Tue, 24 Apr 2018 15:44:30 +0300 Message-Id: <20180424124436.26955-23-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 Add a helper function to return current output picture buffer size. OPB sizes can vary depending on the selected decoder output(s). Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 10 ++++++++++ drivers/media/platform/qcom/venus/helpers.c | 15 +++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 1 + 3 files changed, 26 insertions(+) -- 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/core.h b/drivers/media/platform/qcom/venus/core.h index 255292899204..4d6c05f156c4 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -234,6 +234,11 @@ struct venus_buffer { * @num_output_bufs: holds number of output buffers * @input_buf_size holds input buffer size * @output_buf_size: holds output buffer size + * @output2_buf_size: holds secondary decoder output buffer size + * @dpb_buftype: decoded picture buffer type + * @dpb_fmt: decodec picture buffre raw format + * @opb_buftype: output picture buffer type + * @opb_fmt: output picture buffer raw format * @reconfig: a flag raised by decoder when the stream resolution changed * @reconfig_width: holds the new width * @reconfig_height: holds the new height @@ -282,6 +287,11 @@ struct venus_inst { unsigned int num_output_bufs; unsigned int input_buf_size; unsigned int output_buf_size; + unsigned int output2_buf_size; + u32 dpb_buftype; + u32 dpb_fmt; + u32 opb_buftype; + u32 opb_fmt; bool reconfig; u32 reconfig_width; u32 reconfig_height; diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index f04d16953b3a..f0a0fca60c76 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -611,6 +611,21 @@ int venus_helper_set_bufsize(struct venus_inst *inst, u32 bufsize, u32 buftype) } EXPORT_SYMBOL_GPL(venus_helper_set_bufsize); +unsigned int venus_helper_get_opb_size(struct venus_inst *inst) +{ + /* the encoder has only one output */ + if (inst->session_type == VIDC_SESSION_TYPE_ENC) + return inst->output_buf_size; + + if (inst->opb_buftype == HFI_BUFFER_OUTPUT) + return inst->output_buf_size; + else if (inst->opb_buftype == HFI_BUFFER_OUTPUT2) + return inst->output2_buf_size; + + return 0; +} +EXPORT_SYMBOL_GPL(venus_helper_get_opb_size); + static void delayed_process_buf_func(struct work_struct *work) { struct venus_buffer *buf, *n; diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 8ff4bd3ef958..92be45894a69 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -48,6 +48,7 @@ int venus_helper_set_raw_format(struct venus_inst *inst, u32 hfi_format, 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); +unsigned int venus_helper_get_opb_size(struct venus_inst *inst); void venus_helper_acquire_buf_ref(struct vb2_v4l2_buffer *vbuf); void venus_helper_release_buf_ref(struct venus_inst *inst, unsigned int idx); void venus_helper_init_instance(struct venus_inst *inst);