From patchwork Thu Jul 5 13:03:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 141145 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1929668ljj; Thu, 5 Jul 2018 06:15:17 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd8J8dMm1rjRLl5Kjzyh5j/nqcOMq2s7fjCDPPTbEZ+RypOy6i5QI64005sRaGR5OmhufgB X-Received: by 2002:a17:902:b785:: with SMTP id e5-v6mr6160325pls.339.1530796517705; Thu, 05 Jul 2018 06:15:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530796517; cv=none; d=google.com; s=arc-20160816; b=JgZKKHv/9Nr25pNkILMNT/iH8bkZv2JRg+uG5Ror3eYbqkx5uE9JJq7XOJlDOWFfP4 g4+NplzsIdgmXeAI9HpTimDEE7Y55rJB+7RaVsl/lpeI56H9A7jTHun/yYIT4sBVy01O Fc0PCRoYajpH3JMFcXeKHQEwFWE2xPorGgqGW1FpgHa9TAugqtAhZQK/Viblev71J7wA hdusvbYVqIGBaMRDkz2CG97frua+7GRv7NWiDJ//lyoH1LmtLZtLO9/iSN6NfP1SB3bi G+aV2awcaNnUjfSPxV5lN03k7KH3HCIdPRwwDuUvtEh9WseDo+9YuMms5feEKEhva5pN DYdg== 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=ogZkHBlueg2U6UdUxAxd4rT71LnMs9IaaVp6ldnz+nc=; b=cEMj1SvnGF1gTNEJHrcdmPUL/8TORI7rsBLrB5BXL8X+qYJtkUbuzQdB9I615PFqTh DMmVfuGmxwwfNeulMYxIht2ZvCbPhvZPX2XuJkP3kAR1MoUOFlpwxqInCVFz0oHw70LA 6pPIxNHrZY0TOrekdLKeCPVgHJc1LfLc8phjcuOf06n4QulfNvv2LQ1k4+SdzA+KX1zP pOqX/4wbtS1ew8ekzxb9/N/eaG80revihgXTBSQsQPEWO5Q3hVuUGept2g5IawoJ2WZC ghZ6CUT+eCyGsAPejfkQ1RctRNCpu9Dk18Gb9fO6ET0uILC3T1REmu1giebDsagQdGD4 hUIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Zq3sdWVl; 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 v12-v6si5892737plo.264.2018.07.05.06.15.17; Thu, 05 Jul 2018 06:15:17 -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=Zq3sdWVl; 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 S1754447AbeGENPP (ORCPT + 13 others); Thu, 5 Jul 2018 09:15:15 -0400 Received: from mail-wm0-f54.google.com ([74.125.82.54]:38062 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754186AbeGENFL (ORCPT ); Thu, 5 Jul 2018 09:05:11 -0400 Received: by mail-wm0-f54.google.com with SMTP id 69-v6so10663870wmf.3 for ; Thu, 05 Jul 2018 06:05: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=IkTyFSrIU3t7cIZYL2XgO/R/eieXH0YtvjSnmpTxJrg=; b=Zq3sdWVl4EHBKIc++/cHAydxrVD6iRdMRWR6tdvJyNJ71fCSIoYqdriZMyXIuhN3BV u+YZAvePv1+hDkj6XKshWJx3Ijm3eAcgwqaY8g2x/Un7lB36798tMq1mZJAeUWCa9UHi LEHbMKs0HhbQvVRjVlrjSQKZs2btlBOON5Png= 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=IkTyFSrIU3t7cIZYL2XgO/R/eieXH0YtvjSnmpTxJrg=; b=WCTw//kONowXHmVx9c27uTJ/E/CRh5Q7OcJVP+aECpouzwHShf2mvPjLWVr/DPur6Q MF03CsfjTurH/pnb3rboJjLluXMt/8WknZfpDRolr9pzR+FcuuDEg6b4kD4OH3egh8aX tlOtp4PjFH+kA4HmndQ1SvWaKMt8Y0j1F3EFb2TICY6dL7kv5Fq6IrHPEfxuPI/4riHQ jA33Ts16IWMXZ5n/2K8lcd2B8paLsFq3YOuHFYUSq2OBNWwcaLPzmeyhYsFZzeMcITIk 8RRdUWhCfna6W2PWCOyz1MWKTKdp8HgeHiha2OBE1aBwBMZW4zTCITvubFhp88wFLwJK a+8Q== X-Gm-Message-State: APt69E032dUeNICNLijdBbjAzsOUk1XZ9Z+QXBfNAlXx8N+5bDTndPsA 6P8NlO6x2Fkw2RcV4XeJ+/xXqw== X-Received: by 2002:a1c:b286:: with SMTP id b128-v6mr3772787wmf.121.1530795909814; Thu, 05 Jul 2018 06:05:09 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 11-v6sm2109102wrw.67.2018.07.05.06.05.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jul 2018 06:05: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 , Tomasz Figa , Alexandre Courbot , Stanimir Varbanov Subject: [PATCH v5 03/27] venus: hfi: update sequence event to handle more properties Date: Thu, 5 Jul 2018 16:03:37 +0300 Message-Id: <20180705130401.24315-4-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180705130401.24315-1-stanimir.varbanov@linaro.org> References: <20180705130401.24315-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 | 10 ++++++ drivers/media/platform/qcom/venus/hfi_helper.h | 28 ++++++++++++++++ drivers/media/platform/qcom/venus/hfi_msgs.c | 44 ++++++++++++++++++++++++++ 3 files changed, 82 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..6038d8e0ab22 100644 --- a/drivers/media/platform/qcom/venus/hfi.h +++ b/drivers/media/platform/qcom/venus/hfi.h @@ -74,6 +74,16 @@ struct hfi_event_data { u32 tag; u32 profile; u32 level; + /* the following properties start appear from v4 onwards */ + 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_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h index f5f1557b1176..1bc5aab1ce6b 100644 --- a/drivers/media/platform/qcom/venus/hfi_helper.h +++ b/drivers/media/platform/qcom/venus/hfi_helper.h @@ -801,6 +801,34 @@ struct hfi_h264_vui_timing_info { u32 time_scale; }; +struct hfi_bit_depth { + u32 buffer_type; + u32 bit_depth; +}; + +struct hfi_picture_type { + u32 is_sync_frame; + u32 picture_type; +}; + +struct hfi_pic_struct { + u32 progressive_only; +}; + +struct hfi_colour_space { + u32 colour_space; +}; + +struct hfi_extradata_input_crop { + u32 size; + u32 version; + u32 port_index; + u32 left; + u32 top; + u32 width; + u32 height; +}; + #define HFI_COLOR_FORMAT_MONOCHROME 0x01 #define HFI_COLOR_FORMAT_NV12 0x02 #define HFI_COLOR_FORMAT_NV21 0x03 diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c b/drivers/media/platform/qcom/venus/hfi_msgs.c index 589e1a6b36a9..54cd41e5837c 100644 --- a/drivers/media/platform/qcom/venus/hfi_msgs.c +++ b/drivers/media/platform/qcom/venus/hfi_msgs.c @@ -25,10 +25,16 @@ 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; u8 *data_ptr; u32 ptype; @@ -69,6 +75,44 @@ 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); + event.entropy_mode = *(u32 *)data_ptr; + 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 Thu Jul 5 13:03:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 141143 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1928559ljj; Thu, 5 Jul 2018 06:14:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcKxvuFQexKPG+Tw/e0sjvoNBqEBrvH7h3sDOKORNrj4sQib87y6ipQ8ILPC7U2svZqpzK4 X-Received: by 2002:aa7:82d9:: with SMTP id f25-v6mr6363488pfn.218.1530796460433; Thu, 05 Jul 2018 06:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530796460; cv=none; d=google.com; s=arc-20160816; b=Em4ZQsvLDUCKtf4RDXdrOosTJISr3gsGrJh6DACSErFuNrktOmYVmTWjLnZi+ShIXe PXLgs4QYbsv9fap/VoYVFbnwLR92nu+TVpOS1HmykLu0QK+hmTajScGPETH7DHu071/V k3XFb7dz5sYzdM/bogk3uaAYZx6lujgYIjeUYMeTQcogdu+DB3MPuC8B8hKtfhtnZdm+ 9OwKf7eqHp1ntLoE25rhyPxvQyT6q555TY5QK7J+3CH6Rvs+sauII+nxGp1vpEhRUoQ1 Govlq6FwcqX5wr5wehbG40QNW3gDTzeUHR8Tef0UkzmkGLiDNsyStVQv99STwUGuVZil drKw== 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=KEU8A7rBnpwRrZeJDhuhNNHTxOxbYDpN/yhpkLtIIgo=; b=jiZUWZrZkwcGpA3CBoBJXpRytTQ3r9ZcU7boJhB63/y8Tzk+PJVlrQKjpbsu70WrCQ WwtFbnbDRW7+32VlPM1C62lkLwn/i8FQYKt3L3HofS7ykBXmmSVlJU9xqaPRU04vC8UQ 0+9Xol8RZqd7Slnz6++89IODkuj3KirK4uKmuNj13DSnfpzL0mYNJdtesbTDykOmhAT0 Gzr88Ys+NUuPv7+fb14Pch5vRTKdtcBpL6nTTPY2RqLhvwDTzE3Zf6OwQfBC+MeKOV// aDfIC0cDphVOLYBy9aHHnUXevfbwcKkgKcbfPrlFl3P66SVaG/DEyH2sdTqK7U2NVPu6 pOEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=i7BLU1+i; 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 d2-v6si5250377pgv.562.2018.07.05.06.14.20; Thu, 05 Jul 2018 06:14: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=i7BLU1+i; 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 S1754456AbeGENOS (ORCPT + 13 others); Thu, 5 Jul 2018 09:14:18 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:55007 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754304AbeGENFP (ORCPT ); Thu, 5 Jul 2018 09:05:15 -0400 Received: by mail-wm0-f67.google.com with SMTP id i139-v6so10960884wmf.4 for ; Thu, 05 Jul 2018 06:05:15 -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=JTs56AHvy6n4KWdfQCk5+mkf+fJThH/BkJrEXFnLkOk=; b=i7BLU1+i6u6aYm292awS7/VVhRt8OUoCtcevBsE+dyXgQk1Vr9nxm++Db6twC+VBsU 5Od0HbxpM7l/gnd76vfvWocAmNB4lhbcal1ok6mNj8U/QSEkiw8w1UNNn73qAz0rBtkh vCZoqwPi5K4KVj6HJ/fa0K4rkseK6RWgYcWsk= 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=JTs56AHvy6n4KWdfQCk5+mkf+fJThH/BkJrEXFnLkOk=; b=PuXPIIOc5Y0wAryccSoRIy0uWNI1WotzSam25BxuJ9ACsw31b5uy02orHIY9isqzL2 KGt1YttYkjG9KKCU+ggEAfqnO5nRBdubGO4UhfcveFb2EVVpqGrTrHChp8JNiaCRd73O Qksup5vetM9ZocQOxx0SBNMZKVut/DRCpz0+9GPxKa8GLDzjkn9KGSVN3O9dWtSOpTjm v8Y30ayxNrmFgIZNOH9+styQBBfiHPgoCaxZB9eTOECc4WXNoz/CkTP166S9cSiCJ65w cLAvCHM00uQ5AKm7zWZHg9t98VB0YEWEZqo3J6C7nx3bkqfX6FVzlj7kqIStnsaENzqY 7QpA== X-Gm-Message-State: APt69E0Wy+P88JHhNdpNPKK7rck8Y7dZFVPqy4JJoe7OxWw3Y5heAEfj 1XxsdrHp9b5cMyt9Mh0CE8jETQ== X-Received: by 2002:a1c:ac03:: with SMTP id v3-v6mr3962769wme.100.1530795914473; Thu, 05 Jul 2018 06:05:14 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 11-v6sm2109102wrw.67.2018.07.05.06.05.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jul 2018 06:05:13 -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 , Tomasz Figa , Alexandre Courbot , Stanimir Varbanov Subject: [PATCH v5 07/27] venus: hfi_venus: add halt AXI support for Venus 4xx Date: Thu, 5 Jul 2018 16:03:41 +0300 Message-Id: <20180705130401.24315-8-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180705130401.24315-1-stanimir.varbanov@linaro.org> References: <20180705130401.24315-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 AXI halt support for version 4xx by using venus wrapper registers. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi_venus.c | 18 ++++++++++++++++++ drivers/media/platform/qcom/venus/hfi_venus_io.h | 2 ++ 2 files changed, 20 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_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c index 734ce11b0ed0..784b3ad1a9f6 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -532,6 +532,24 @@ static int venus_halt_axi(struct venus_hfi_device *hdev) u32 val; int ret; + if (IS_V4(hdev->core)) { + val = venus_readl(hdev, WRAPPER_CPU_AXI_HALT); + val |= WRAPPER_CPU_AXI_HALT_HALT; + venus_writel(hdev, WRAPPER_CPU_AXI_HALT, val); + + ret = readl_poll_timeout(base + WRAPPER_CPU_AXI_HALT_STATUS, + val, + val & WRAPPER_CPU_AXI_HALT_STATUS_IDLE, + POLL_INTERVAL_US, + VBIF_AXI_HALT_ACK_TIMEOUT_US); + if (ret) { + dev_err(dev, "AXI bus port halt timeout\n"); + return ret; + } + + return 0; + } + /* Halt AXI and AXI IMEM VBIF Access */ val = venus_readl(hdev, VBIF_AXI_HALT_CTRL0); val |= VBIF_AXI_HALT_CTRL0_HALT_REQ; diff --git a/drivers/media/platform/qcom/venus/hfi_venus_io.h b/drivers/media/platform/qcom/venus/hfi_venus_io.h index d327b5cea334..c0b18de1e396 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus_io.h +++ b/drivers/media/platform/qcom/venus/hfi_venus_io.h @@ -104,7 +104,9 @@ #define WRAPPER_CPU_CLOCK_CONFIG (WRAPPER_BASE + 0x2000) #define WRAPPER_CPU_AXI_HALT (WRAPPER_BASE + 0x2008) +#define WRAPPER_CPU_AXI_HALT_HALT BIT(16) #define WRAPPER_CPU_AXI_HALT_STATUS (WRAPPER_BASE + 0x200c) +#define WRAPPER_CPU_AXI_HALT_STATUS_IDLE BIT(24) #define WRAPPER_CPU_CGC_DIS (WRAPPER_BASE + 0x2010) #define WRAPPER_CPU_STATUS (WRAPPER_BASE + 0x2014) From patchwork Thu Jul 5 13:03:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 141137 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1926167ljj; Thu, 5 Jul 2018 06:12:06 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd4sZwHxjvCGNggzVtlRR2L/hgT984H2OaXi6WXUKW62PJcScTzjApgKQr/kPmMBkBy477k X-Received: by 2002:a65:42c3:: with SMTP id l3-v6mr5364310pgp.398.1530796325990; Thu, 05 Jul 2018 06:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530796325; cv=none; d=google.com; s=arc-20160816; b=ZwBORLGkihH63+E5DXQhI1OmpLDwS8N6fqSl+cJ/Oj2hg/ZI31uaGVIoUHOfefGG8f Casp6/Z02muxQTBNnxO+Vg61HdAb5z97GG+c2NSwUOR6lMnSnejiiHnQiwMAi9xtACaC oIdNN8ufKrCVfBk/bUxb2YxdiF081pFsl1VDMzueRtofZoURJxNEc7scxb/+/iglaD6J fnW6FfbK35ZczXOkepoUVCMdWcb5JL0GONQyuTKeWSBYtzhFFCwlkXyqYCGny2qr5PwO 4vQeLsvZqyvnHpp8AuZTTeenupK/V2ADQ7nHjf30nE63f/AQrDo9LkQUxLZyNvcIhMD5 gUfw== 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=GZuNBMm7RtOdJYDfqJvFYuf4WYJ7NOe1IIgTYAMoy8g=; b=rjleBAQ12C36KODEQ9Yf+ysiE8hlm8ClesUasd2XQIJP26jxU0FcZAIZsSX4pbvHzx cwYxSfQttx/R+QFzptq6uBaAPyy9V/HLpSwr67w7Y13krNkMixb98i1AQ5QK6C15ZB9a WQX/JoMwevQYmpI7Q8GUb87A7nlIigmT1W2904afdYDFzAD3ZAzbC995/DDHfxtkZwDs MzDnVvYulu2rLP0W7+H4WiDFKbenPzxsxflqRKy6QuQy7B2Ctobkhj4sUwa3IeWeP0QF wogPrua9ymAeQj6A9FnBK2YBXWrocFNnGbYPIpiYs74FOHb7SpnWDfYFQVSgZV1O4zJD iU1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=G9VD4fRS; 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 q136-v6si5463785pgq.483.2018.07.05.06.12.05; Thu, 05 Jul 2018 06:12:05 -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=G9VD4fRS; 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 S1754506AbeGENMD (ORCPT + 13 others); Thu, 5 Jul 2018 09:12:03 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:40613 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754395AbeGENFW (ORCPT ); Thu, 5 Jul 2018 09:05:22 -0400 Received: by mail-wm0-f65.google.com with SMTP id z13-v6so10717867wma.5 for ; Thu, 05 Jul 2018 06:05:21 -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=3i8BckNk5AMxsFObk6sMQ2N4Vr3Tdy+vGDFQyGUXeZU=; b=G9VD4fRSgCR80eTzzW6fpSDt93wNTPBC3e0s5RsP7jgFooQXq9+g6TfnyaQfGGsh3M ++seMqYU6Piy38xXED9y9k9seeSGyRhcNUshc9B7JR2A5LaHq/oXrfgOtj6ycuVGpz9F IWejZK5y3eyLwFMMFFmClzAQThiLoyo18JZYA= 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=3i8BckNk5AMxsFObk6sMQ2N4Vr3Tdy+vGDFQyGUXeZU=; b=FdCot8RJyC3FctwZsbFneRyfYYwXvz61I9uBHgZFmG5OzElIF47FNsHI8Y0JF8Kid4 8ekc7b+HfHXKKpvdxuCOhWUsgulqD2mBuMmUoYmmnEUy33V85aWVZ0a1+N82M9BY6ugQ fs132Mj9YEbMdfCHsBOPjyo/mbxCcrY5xlyLETCYwiKzC9bq5jig/L+IQvQPvYadEeME bC+1YOkerMCUPQtV2WAyNWbrnNH3Cx5OYHMzSAhpJPau6CCu5jxLc7YJ8lgp/GJXPFhj NX3tUP/hKdKf9o9s+cY7vPgjCJbCiYR43QvTeu4GwYTqOQucRkNz/Fm6mByhFiC40ow2 18lg== X-Gm-Message-State: APt69E0uKgs1zQthF1bCUoAQ8K42z7LPSiWyXmU3SF/uMMxXhY7h6Nlh KWNti5I/eLGJBNVSH/8PWx3E0Q== X-Received: by 2002:adf:a49a:: with SMTP id g26-v6mr4681005wrb.91.1530795921265; Thu, 05 Jul 2018 06:05:21 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 11-v6sm2109102wrw.67.2018.07.05.06.05.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jul 2018 06:05:20 -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 , Tomasz Figa , Alexandre Courbot , Stanimir Varbanov Subject: [PATCH v5 13/27] venus: helpers: rename a helper function and use buffer mode from caps Date: Thu, 5 Jul 2018 16:03:47 +0300 Message-Id: <20180705130401.24315-14-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180705130401.24315-1-stanimir.varbanov@linaro.org> References: <20180705130401.24315-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 Rename is_reg_unreg_needed() to better name is_dynamic_bufmode() and use buffer mode from enumerated per codec capabilities. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 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 c8c4a4be78e3..27c4a4060c4e 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -359,18 +359,16 @@ session_process_buf(struct venus_inst *inst, struct vb2_v4l2_buffer *vbuf) return 0; } -static inline int is_reg_unreg_needed(struct venus_inst *inst) +static bool is_dynamic_bufmode(struct venus_inst *inst) { - if (inst->session_type == VIDC_SESSION_TYPE_DEC && - inst->core->res->hfi_version == HFI_VERSION_3XX) - return 0; + struct venus_core *core = inst->core; + struct venus_caps *caps; - if (inst->session_type == VIDC_SESSION_TYPE_DEC && - inst->cap_bufs_mode_dynamic && - inst->core->res->hfi_version == HFI_VERSION_1XX) + caps = venus_caps_by_codec(core, inst->hfi_codec, inst->session_type); + if (!caps) return 0; - return 1; + return caps->cap_bufs_mode_dynamic; } static int session_unregister_bufs(struct venus_inst *inst) @@ -379,7 +377,7 @@ static int session_unregister_bufs(struct venus_inst *inst) struct hfi_buffer_desc bd; int ret = 0; - if (!is_reg_unreg_needed(inst)) + if (is_dynamic_bufmode(inst)) return 0; list_for_each_entry_safe(buf, n, &inst->registeredbufs, reg_list) { @@ -399,7 +397,7 @@ static int session_register_bufs(struct venus_inst *inst) struct venus_buffer *buf; int ret = 0; - if (!is_reg_unreg_needed(inst)) + if (is_dynamic_bufmode(inst)) return 0; list_for_each_entry(buf, &inst->registeredbufs, reg_list) { From patchwork Thu Jul 5 13:03:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 141133 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1922093ljj; Thu, 5 Jul 2018 06:08:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfae9Vi/1x/pkoDfQTqPKApBItp5Q7K++R5KKFVCnJL/u3LsjWR63q27db8zorBp9ofV005 X-Received: by 2002:a65:4a42:: with SMTP id a2-v6mr5616676pgu.367.1530796106543; Thu, 05 Jul 2018 06:08:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530796106; cv=none; d=google.com; s=arc-20160816; b=OVtF3m2SDQfaVmq7On9/623IrM5BrI1JY7wTOEDs7GXjPv0DfK8wRtMISSVEXADTIS fDlFIgy6l58pukWsEaKsGf527blQJn+62b2mM6uSVZtw5VEG/LYUWNotKlkLd1sObh/9 3owSfnUX2xX9eIHerVQzVGDnPEV7KI0L4i04Gk0DwM834+2lsuTShCu77IVQR6hgi+4Z nrrAmw1AX6OTkx/ebK9r9lINTTfVxoyzXIQax1UEOnsM9AyAcA0Zl+5RG1hZvEe2fHHi vL+0iD5NEcQqJzTp5Z05e/YhMM9cDuh4HX4myhdFaloc9u/9GvFJzmnZFco1wMRp6XVH igSQ== 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=432LGMOKDri2aHGmlsk5+tKaCBAWzx8vp+BkYZY5QaE=; b=RZjRGkwJ8MnDSL4cWqBkSXjQOsDc353RFGOdJ6UM/nieZ0plDPUuS2xZvo5phlcZ9S nTjdWmP/YwY/vYrRZXgW857BfMOXjMlF+eWwRnC6QCikVl/9kXXxfIbqfxFAxiORoD7T lNeKD9gYyHQaNfnjLIBEjUF3/iWkowUKYn3/3Xq8hbDvDgQgUF3F41U42HhwlC6Q19Fb ih9TiINn21w3geW5JPKvF1bNolIcAo9mcjKOY75gz0nfyvlK5rF8exy6QS4jlfJ/rEPn GBUuCxsZsg1vHuyQ6A0xqBX2NCl3eusmtWmxFjkIiF2oOFkaC/Y/jEB78uTgmhiSmgHe 8YgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=aBVRGtF7; 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 b59-v6si5946793plc.335.2018.07.05.06.08.26; Thu, 05 Jul 2018 06:08:26 -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=aBVRGtF7; 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 S1754486AbeGENFa (ORCPT + 13 others); Thu, 5 Jul 2018 09:05:30 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36662 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754430AbeGENFZ (ORCPT ); Thu, 5 Jul 2018 09:05:25 -0400 Received: by mail-wm0-f66.google.com with SMTP id s14-v6so10733813wmc.1 for ; Thu, 05 Jul 2018 06:05: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=mQvgz0he50LgDF6W19hQpoXcaRIIqvIGjdBolqGqtak=; b=aBVRGtF7chvAjFUuH4DJM+9T9BSUp4mwafrIU3ALbgzmIAB6H3ZT9YsZ8yIWXVsJZc U4NdSrXUnq5lW0n4IWk4N474qVIYcU6eqwr4YrlfRFt4HE+jCfs6ozAeeFQQ8rvry7lK Mb9D2izWO8I2T3p6qXC/rAF00jFgAfh6x9Jgw= 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=mQvgz0he50LgDF6W19hQpoXcaRIIqvIGjdBolqGqtak=; b=jxzLwzjf1bKUOqWlTj9wU6k45XXrtCHL9BVjcA2Bw77YiqG3IPOJj4kNWkOfYdFwaN xYrxtFcMxw6bP7LxetEp90Fvrs6/y/2gAS9a7h1FMkmdAKmRL/BTyABTeGElGXoaui9v Xpu9toaHjdjDVnpXuk03cBhmbHufzvXkMBFOk+3nnugHrVoHIACnYIXKbcvnTEOabaFW JGRsuuH5FYV4KrEiUdIqOXn6dlZkck6jTuk+Iv9QEe53vh2mko9z2dxFFBOxyXDosBZI w+LwVDDQJwOuzOy+xiRZJWK1r+lOhm0UK9J87JjgpouRFbawbwLsWXqheOmcTFcn/290 p6dA== X-Gm-Message-State: APt69E1ZGTB+I2olByH4IS9jwDqpSEsqTTp5bavfIJnzdqjl3Xy28sZU UCARtDcDZD4IdA9zgkKkEbQgTg== X-Received: by 2002:a1c:ee15:: with SMTP id m21-v6mr4118435wmh.112.1530795924608; Thu, 05 Jul 2018 06:05:24 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 11-v6sm2109102wrw.67.2018.07.05.06.05.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jul 2018 06:05:24 -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 , Tomasz Figa , Alexandre Courbot , Stanimir Varbanov Subject: [PATCH v5 16/27] venus: core: delete not used buffer mode flags Date: Thu, 5 Jul 2018 16:03:50 +0300 Message-Id: <20180705130401.24315-17-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180705130401.24315-1-stanimir.varbanov@linaro.org> References: <20180705130401.24315-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 Delete not used flag for capture buffer allocation mode and no longer used cap_bufs_mode_dynamic from instance structure. Signed-off-by: Stanimir Varbanov Reviewed-by: Tomasz Figa --- drivers/media/platform/qcom/venus/core.h | 4 ---- drivers/media/platform/qcom/venus/hfi_parser.c | 11 +++-------- 2 files changed, 3 insertions(+), 12 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 b995d1601c87..1d1a59a5d343 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -255,8 +255,6 @@ struct venus_buffer { * @priv: a private for HFI operations callbacks * @session_type: the type of the session (decoder or encoder) * @hprop: a union used as a holder by get property - * @cap_bufs_mode_static: buffers allocation mode capability - * @cap_bufs_mode_dynamic: buffers allocation mode capability */ struct venus_inst { struct list_head list; @@ -305,8 +303,6 @@ struct venus_inst { const struct hfi_inst_ops *ops; u32 session_type; union hfi_get_property hprop; - bool cap_bufs_mode_static; - bool cap_bufs_mode_dynamic; }; #define IS_V1(core) ((core)->res->hfi_version == HFI_VERSION_1XX) diff --git a/drivers/media/platform/qcom/venus/hfi_parser.c b/drivers/media/platform/qcom/venus/hfi_parser.c index afc0db3b5dc3..2293d936e49c 100644 --- a/drivers/media/platform/qcom/venus/hfi_parser.c +++ b/drivers/media/platform/qcom/venus/hfi_parser.c @@ -60,8 +60,7 @@ fill_buf_mode(struct venus_caps *cap, const void *data, unsigned int num) } static void -parse_alloc_mode(struct venus_core *core, struct venus_inst *inst, u32 codecs, - u32 domain, void *data) +parse_alloc_mode(struct venus_core *core, u32 codecs, u32 domain, void *data) { struct hfi_buffer_alloc_mode_supported *mode = data; u32 num_entries = mode->num_entries; @@ -74,13 +73,9 @@ parse_alloc_mode(struct venus_core *core, struct venus_inst *inst, u32 codecs, while (num_entries--) { if (mode->buffer_type == HFI_BUFFER_OUTPUT || - mode->buffer_type == HFI_BUFFER_OUTPUT2) { - if (*type == HFI_BUFFER_MODE_DYNAMIC && inst) - inst->cap_bufs_mode_dynamic = true; - + mode->buffer_type == HFI_BUFFER_OUTPUT2) for_each_codec(core->caps, ARRAY_SIZE(core->caps), codecs, domain, fill_buf_mode, type, 1); - } type++; } @@ -267,7 +262,7 @@ u32 hfi_parser(struct venus_core *core, struct venus_inst *inst, void *buf, parse_profile_level(core, codecs, domain, data); break; case HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE_SUPPORTED: - parse_alloc_mode(core, inst, codecs, domain, data); + parse_alloc_mode(core, codecs, domain, data); break; default: break; From patchwork Thu Jul 5 13:03:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 141135 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1922774ljj; Thu, 5 Jul 2018 06:09:03 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcIJig8SUDrAd1NNIAmZLihBC2qfzXyFfKZpeD1lpMbsFmb8KijoMx7p0bpXktdW0ecFgGx X-Received: by 2002:a62:4ece:: with SMTP id c197-v6mr6437936pfb.240.1530796143329; Thu, 05 Jul 2018 06:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530796143; cv=none; d=google.com; s=arc-20160816; b=ZOEBntAvVv3S4zSZbLBqc0yVWdI3+pPKQIhXStpRG1Yqt2xyoq31XHBDA53e7Q4o1Q S3bRgjgnAuubAuSbk8vl6iGNLqE+7EjftkTYQTYrJLYUkgrylS1Uqza9ZXw1b/YhlSCP YeRkmTHFFNmDQ6EeMyih8Z4EckDGd0F60yZiKAwQBqXamCTrIQsTcfREBRAdNkuZGAT1 6vSW8DPZXkCs/k04ujtKG0bwRkBj25+E2sks5lHb/Mzcwhj6w2mO+ReP6triGUaEvkSr bn/eOUvxIL8GfoY22FBrQfKpNptPfwoiEMH9kpW1VGwDqMnnFMCI60oAe/YggU9rsJ9N S38A== 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=wy9DYft3c2tGcMabTQhgj6VntbANhHTXg8GE/1KNNrk=; b=Nq55/0fSgnDltNnh32iBhlnPyZKyvFCIKhxTRRVnqgSdmw3z72PGX6nhSWjKI4mo8k KRBiFWQwp96pASyDOGQ1pfdpePsY0GbmF17HTCB56nWe5HVlqPK2NfkyHKhrY9/lWDGL QACQpEkIoo63LGuLy2HyktLRbmZT56VmyFoes7kGZvjgm80wjlwmqDzCFwG2VUWmAzgz 5VNSAOuXbUFp0akLcHT27OHcYPg2ixkhL2e3GwjkWnixC2uLX6cv+uTgQm+tAMcRzAvi 1k4fp7dZHIV7feecSBRPLTeeP+8d//6ZrT3OG2M9JDIS7WyQq5g0LQzY5M14MDxuCm3D RBKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ARsYTs3v; 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 62-v6si5900266ply.176.2018.07.05.06.09.03; Thu, 05 Jul 2018 06:09: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=ARsYTs3v; 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 S1754650AbeGENIv (ORCPT + 13 others); Thu, 5 Jul 2018 09:08:51 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:55405 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754457AbeGENF2 (ORCPT ); Thu, 5 Jul 2018 09:05:28 -0400 Received: by mail-wm0-f65.google.com with SMTP id v16-v6so11019884wmv.5 for ; Thu, 05 Jul 2018 06:05:27 -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=xjY2pgEoTA9v1GrVLiJUVDtWBCCmEDIrn4PrFqxnYRw=; b=ARsYTs3v6lFEkzXCmw8I0Cfe4mVJ2ViQCjSlhZy95NOXUaMka8YJQrB9ePCF9NHZ6D 8L6KUJgieytQzjeHwPkDb0Ae5AxExIuU0SMspMilyPsixSOWXOp8ErsKOV/Y53LKhEco lLPRG7duYQFoliOJfR32zRNQJyPWFrmJaud+I= 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=xjY2pgEoTA9v1GrVLiJUVDtWBCCmEDIrn4PrFqxnYRw=; b=h8M8b2qEneyHxGUwprFWmHWedFxQfMlLei7TQC63gMhzbaCDPe+Fb+/hqkI1CeJyZQ KKEEVELiMN2Xcm3dwOBSDWU4LW150tmX9K71BCj5EH2oy1RV9od3MHGnKTp74CsUT5qc Ytq79yWi42xyuVS9HkiosYY128mezx4UljEoFVk6+um7nXlgevkaCL83lPshqpvg1CKZ 56DeKNwbx9PSnO37CfruzPLITiEwysxwOjA8OI+fOVbW4OCxODsGSwL6egUktnb6nl2i fgFaoMRxe9035Eled7Q4ZWSU28tbfkk1qpG1NWp6dV3O1GWMsJ4I2+lw3nEfwi0ay2La tAnw== X-Gm-Message-State: APt69E3W0Do47D8ROxUYa/KBPhWdPDJ5L/zfIIn2bEMrD7COxDDPG0il 7J/gd4qQqyI+XiAJbMBLG/VbfQ== X-Received: by 2002:a1c:ac03:: with SMTP id v3-v6mr3963295wme.100.1530795926779; Thu, 05 Jul 2018 06:05:26 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 11-v6sm2109102wrw.67.2018.07.05.06.05.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jul 2018 06:05:26 -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 , Tomasz Figa , Alexandre Courbot , Stanimir Varbanov Subject: [PATCH v5 18/27] venus: helpers: add a new helper to set raw format Date: Thu, 5 Jul 2018 16:03:52 +0300 Message-Id: <20180705130401.24315-19-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180705130401.24315-1-stanimir.varbanov@linaro.org> References: <20180705130401.24315-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 Reviewed-by: Tomasz Figa --- 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 7e764eeeb07c..4e4109e80988 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -412,6 +412,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) { @@ -493,35 +507,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) { + const u32 ptype = HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SELECT; struct hfi_uncompressed_format_select fmt; - u32 ptype = HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SELECT; - int ret; + + 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 Thu Jul 5 13:03:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 141129 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1920222ljj; Thu, 5 Jul 2018 06:06:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd9aYS/SDvdhG2+jKhFIusZwN96dSMlVXinCHOUQZeqKUa/1vE1myc+lFrS4OfWG51BtVZt X-Received: by 2002:a62:748:: with SMTP id b69-v6mr6356171pfd.177.1530796003861; Thu, 05 Jul 2018 06:06:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530796003; cv=none; d=google.com; s=arc-20160816; b=f1WTYsYs59TOHASRf1wRlGq8upiZQZ+2QJGgePvZR3YLnVy7tZhx1cXFxojL+3r2/D IKjbJyIZT6W29LSolFOjppVVjDJ4Ffj/UZaf81PTvnhpretB3/SqobYNQ10c/dsxKi3h 9eHF0kfmCysbDzxsrtq8v7445JfpKYHXrvtU/JsxOvYvhbAVCNpg6o8n4CBOZSaQE92J iP9F257dpQhVmrihlBKgSGxespsvwM5b/PISNxRIf+2MvVGVUNPZFXVC8NIFHrdxgM9E ny6ZnJ4iv1OrJnnTi9WXPnJLMwAdP4/aWjFaftQb9XcF3Grh0+jyGWeAfnoPNmt9tiYt qfQg== 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=kHGEDWiHBSLR5uLeoDXl96poJr98jk7JuSC6TOJ79ys=; b=b8MYZXAToKymZ0oV6mmifkwcY78jgu7H6KSjaiWbWs49AkTmIHKQN+OIlTwaZYxSe2 WMRb+8MC2+shzqIT/E0CCsi2A4Mtp6QwYWF2i+2h7VlQK0XbqgWMLfPnc7LPqxhX+VaZ dK+9lGbEm7WI+4gMLjxdoY8w3hSE+n5d5N6QlulXm17GVN7N3kCR13mAi1ODRnU03rcY uFnkUsF0eDwV3WWl6UmngC7aqFOLUYI0DjoLZwnulrqq/WFsL2Ry5jhZRDiSIDEPcely pJ1tvUpttsXexwMxhXYl/M+8+Bpmjaw8TIcBaVBe0Md3AYM/vHlyplULWHobNZL7/2QR /4xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gZSL+bm1; 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 89-v6si5894135ple.488.2018.07.05.06.06.43; Thu, 05 Jul 2018 06:06: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=gZSL+bm1; 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 S1754519AbeGENGl (ORCPT + 13 others); Thu, 5 Jul 2018 09:06:41 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34097 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754518AbeGENFf (ORCPT ); Thu, 5 Jul 2018 09:05:35 -0400 Received: by mail-wr1-f65.google.com with SMTP id c13-v6so1100544wrt.1 for ; Thu, 05 Jul 2018 06:05:34 -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=XyG/RSkx4/EUEjTmTj+OmT+ZMtTeZJix7S4bP2KK9yE=; b=gZSL+bm1s1y9GvpryzxCRfldXKl8Dw2AOfQiA4ezcfgeZiR+qnnzInuEdaboalfO0M DBt+vl8aw9ywqG76kijQWJNdqEcTycltnm7PndAXOGJmMPi9DRm3wtZCYW1Wh0OwzYGu BolGcUpww3xQ1HyZuxFFkhMhzvDZKZCRuBBtc= 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=XyG/RSkx4/EUEjTmTj+OmT+ZMtTeZJix7S4bP2KK9yE=; b=RIvW3qg5feoRlwSScW1a6ds159b1mdzF6q3UxTCxwP7AaekTEIzNhtvtnoVx56wPEc +QQqTLkdLUZ9vNgcOUClGm3iLgl1TugSBI95J764GfJ6iVD8VafelR4Rp6NB8vTOjuZl C414aRqTX8mTt3G1xfzFkfVOAPFHOP0dGTj3t/YIH5aN14ZjJMr/1SVEQ6XD+Ai/knQy 1jFqJjNNwVB/kvIXbsJLqFK6nfiltKKMsFEOSFq0G6/xfnlL5IxBE0L27ZIY7Vl0eoCh PIK5EbojUamrZFs+lPwzp3AmtoIsJNJhYU9pUEY4V14TLjaQhuHjcldyo+942/P+576z xK/Q== X-Gm-Message-State: APt69E1HA06zdnV/uJp7rGhmG5Pq3l2bTnosyP+nkoRXUt2NV6UxdawA tZ22v+/2YEK6qvOo/9zaxQxU8A== X-Received: by 2002:adf:992d:: with SMTP id x42-v6mr4482043wrb.81.1530795933756; Thu, 05 Jul 2018 06:05:33 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 11-v6sm2109102wrw.67.2018.07.05.06.05.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jul 2018 06:05:33 -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 , Tomasz Figa , Alexandre Courbot , Stanimir Varbanov Subject: [PATCH v5 24/27] venus: helpers: move frame size calculations on common place Date: Thu, 5 Jul 2018 16:03:58 +0300 Message-Id: <20180705130401.24315-25-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180705130401.24315-1-stanimir.varbanov@linaro.org> References: <20180705130401.24315-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 move the calculations of raw and compressed buffer sizes on common helper and make it identical for encoder and decoder. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 98 +++++++++++++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 + drivers/media/platform/qcom/venus/vdec.c | 54 ++++------------ drivers/media/platform/qcom/venus/venc.c | 56 ++++------------- 4 files changed, 126 insertions(+), 84 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 8d2f4db52e48..1e4d18448f7b 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -457,6 +457,104 @@ int venus_helper_get_bufreq(struct venus_inst *inst, u32 type, } EXPORT_SYMBOL_GPL(venus_helper_get_bufreq); +static u32 get_framesize_raw_nv12(u32 width, u32 height) +{ + u32 y_stride, uv_stride, y_plane; + u32 y_sclines, uv_sclines, uv_plane; + u32 size; + + y_stride = ALIGN(width, 128); + uv_stride = ALIGN(width, 128); + y_sclines = ALIGN(height, 32); + uv_sclines = ALIGN(((height + 1) >> 1), 16); + + y_plane = y_stride * y_sclines; + uv_plane = uv_stride * uv_sclines + SZ_4K; + size = y_plane + uv_plane + SZ_8K; + + return ALIGN(size, SZ_4K); +} + +static u32 get_framesize_raw_nv12_ubwc(u32 width, u32 height) +{ + u32 y_meta_stride, y_meta_plane; + u32 y_stride, y_plane; + u32 uv_meta_stride, uv_meta_plane; + u32 uv_stride, uv_plane; + u32 extradata = SZ_16K; + + y_meta_stride = ALIGN(DIV_ROUND_UP(width, 32), 64); + y_meta_plane = y_meta_stride * ALIGN(DIV_ROUND_UP(height, 8), 16); + y_meta_plane = ALIGN(y_meta_plane, SZ_4K); + + y_stride = ALIGN(width, 128); + y_plane = ALIGN(y_stride * ALIGN(height, 32), SZ_4K); + + uv_meta_stride = ALIGN(DIV_ROUND_UP(width / 2, 16), 64); + uv_meta_plane = uv_meta_stride * ALIGN(DIV_ROUND_UP(height / 2, 8), 16); + uv_meta_plane = ALIGN(uv_meta_plane, SZ_4K); + + uv_stride = ALIGN(width, 128); + uv_plane = ALIGN(uv_stride * ALIGN(height / 2, 32), SZ_4K); + + return ALIGN(y_meta_plane + y_plane + uv_meta_plane + uv_plane + + max(extradata, y_stride * 48), SZ_4K); +} + +u32 venus_helper_get_framesz_raw(u32 hfi_fmt, u32 width, u32 height) +{ + switch (hfi_fmt) { + case HFI_COLOR_FORMAT_NV12: + case HFI_COLOR_FORMAT_NV21: + return get_framesize_raw_nv12(width, height); + case HFI_COLOR_FORMAT_NV12_UBWC: + return get_framesize_raw_nv12_ubwc(width, height); + default: + return 0; + } +} +EXPORT_SYMBOL_GPL(venus_helper_get_framesz_raw); + +u32 venus_helper_get_framesz(u32 v4l2_fmt, u32 width, u32 height) +{ + u32 hfi_fmt, sz; + bool compressed; + + switch (v4l2_fmt) { + case V4L2_PIX_FMT_MPEG: + case V4L2_PIX_FMT_H264: + case V4L2_PIX_FMT_H264_NO_SC: + case V4L2_PIX_FMT_H264_MVC: + case V4L2_PIX_FMT_H263: + case V4L2_PIX_FMT_MPEG1: + case V4L2_PIX_FMT_MPEG2: + case V4L2_PIX_FMT_MPEG4: + case V4L2_PIX_FMT_XVID: + case V4L2_PIX_FMT_VC1_ANNEX_G: + case V4L2_PIX_FMT_VC1_ANNEX_L: + case V4L2_PIX_FMT_VP8: + case V4L2_PIX_FMT_VP9: + case V4L2_PIX_FMT_HEVC: + compressed = true; + break; + default: + compressed = false; + break; + } + + if (compressed) { + sz = ALIGN(height, 32) * ALIGN(width, 32) * 3 / 2 / 2; + return ALIGN(sz, SZ_4K); + } + + hfi_fmt = to_hfi_raw_fmt(v4l2_fmt); + if (!hfi_fmt) + return 0; + + return venus_helper_get_framesz_raw(hfi_fmt, width, height); +} +EXPORT_SYMBOL_GPL(venus_helper_get_framesz); + int venus_helper_set_input_resolution(struct venus_inst *inst, unsigned int width, unsigned int height) { diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 92be45894a69..92b167a47166 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -33,6 +33,8 @@ void venus_helper_m2m_device_run(void *priv); void venus_helper_m2m_job_abort(void *priv); int venus_helper_get_bufreq(struct venus_inst *inst, u32 type, struct hfi_buffer_requirements *req); +u32 venus_helper_get_framesz_raw(u32 hfi_fmt, u32 width, u32 height); +u32 venus_helper_get_framesz(u32 v4l2_fmt, u32 width, u32 height); int venus_helper_set_input_resolution(struct venus_inst *inst, unsigned int width, unsigned int height); int venus_helper_set_output_resolution(struct venus_inst *inst, diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 11db3074d1a5..9c98637e26f6 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -29,29 +29,6 @@ #include "helpers.h" #include "vdec.h" -static u32 get_framesize_uncompressed(unsigned int plane, u32 width, u32 height) -{ - u32 y_stride, uv_stride, y_plane; - u32 y_sclines, uv_sclines, uv_plane; - u32 size; - - y_stride = ALIGN(width, 128); - uv_stride = ALIGN(width, 128); - y_sclines = ALIGN(height, 32); - uv_sclines = ALIGN(((height + 1) >> 1), 16); - - y_plane = y_stride * y_sclines; - uv_plane = uv_stride * uv_sclines + SZ_4K; - size = y_plane + uv_plane + SZ_8K; - - return ALIGN(size, SZ_4K); -} - -static u32 get_framesize_compressed(unsigned int width, unsigned int height) -{ - return ((width * height * 3 / 2) / 2) + 128; -} - /* * Three resons to keep MPLANE formats (despite that the number of planes * currently is one): @@ -160,7 +137,6 @@ vdec_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f) struct v4l2_pix_format_mplane *pixmp = &f->fmt.pix_mp; struct v4l2_plane_pix_format *pfmt = pixmp->plane_fmt; const struct venus_format *fmt; - unsigned int p; memset(pfmt[0].reserved, 0, sizeof(pfmt[0].reserved)); memset(pixmp->reserved, 0, sizeof(pixmp->reserved)); @@ -191,18 +167,14 @@ vdec_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f) pixmp->num_planes = fmt->num_planes; pixmp->flags = 0; - if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { - for (p = 0; p < pixmp->num_planes; p++) { - pfmt[p].sizeimage = - get_framesize_uncompressed(p, pixmp->width, - pixmp->height); - pfmt[p].bytesperline = ALIGN(pixmp->width, 128); - } - } else { - pfmt[0].sizeimage = get_framesize_compressed(pixmp->width, - pixmp->height); + pfmt[0].sizeimage = venus_helper_get_framesz(pixmp->pixelformat, + pixmp->width, + pixmp->height); + + if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) + pfmt[0].bytesperline = ALIGN(pixmp->width, 128); + else pfmt[0].bytesperline = 0; - } return fmt; } @@ -647,7 +619,7 @@ static int vdec_queue_setup(struct vb2_queue *q, unsigned int sizes[], struct device *alloc_devs[]) { struct venus_inst *inst = vb2_get_drv_priv(q); - unsigned int p, in_num, out_num; + unsigned int in_num, out_num; int ret = 0; if (*num_planes) { @@ -677,7 +649,8 @@ static int vdec_queue_setup(struct vb2_queue *q, switch (q->type) { case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: *num_planes = inst->fmt_out->num_planes; - sizes[0] = get_framesize_compressed(inst->out_width, + sizes[0] = venus_helper_get_framesz(inst->fmt_out->pixfmt, + inst->out_width, inst->out_height); inst->input_buf_size = sizes[0]; *num_buffers = max(*num_buffers, in_num); @@ -686,10 +659,9 @@ static int vdec_queue_setup(struct vb2_queue *q, break; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: *num_planes = inst->fmt_cap->num_planes; - - for (p = 0; p < *num_planes; p++) - sizes[p] = get_framesize_uncompressed(p, inst->width, - inst->height); + sizes[0] = venus_helper_get_framesz(inst->fmt_cap->pixfmt, + inst->width, + inst->height); inst->output_buf_size = sizes[0]; *num_buffers = max(*num_buffers, out_num); inst->num_output_bufs = *num_buffers; diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index cc8049fd8811..6d4cc9e4bac2 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -31,32 +31,6 @@ #define NUM_B_FRAMES_MAX 4 -static u32 get_framesize_uncompressed(unsigned int plane, u32 width, u32 height) -{ - u32 y_stride, uv_stride, y_plane; - u32 y_sclines, uv_sclines, uv_plane; - u32 size; - - y_stride = ALIGN(width, 128); - uv_stride = ALIGN(width, 128); - y_sclines = ALIGN(height, 32); - uv_sclines = ALIGN(((height + 1) >> 1), 16); - - y_plane = y_stride * y_sclines; - uv_plane = uv_stride * uv_sclines + SZ_4K; - size = y_plane + uv_plane + SZ_8K; - size = ALIGN(size, SZ_4K); - - return size; -} - -static u32 get_framesize_compressed(u32 width, u32 height) -{ - u32 sz = ALIGN(height, 32) * ALIGN(width, 32) * 3 / 2 / 2; - - return ALIGN(sz, SZ_4K); -} - /* * Three resons to keep MPLANE formats (despite that the number of planes * currently is one): @@ -284,7 +258,6 @@ venc_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f) struct v4l2_pix_format_mplane *pixmp = &f->fmt.pix_mp; struct v4l2_plane_pix_format *pfmt = pixmp->plane_fmt; const struct venus_format *fmt; - unsigned int p; memset(pfmt[0].reserved, 0, sizeof(pfmt[0].reserved)); memset(pixmp->reserved, 0, sizeof(pixmp->reserved)); @@ -318,19 +291,14 @@ venc_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f) pixmp->num_planes = fmt->num_planes; pixmp->flags = 0; - if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { - for (p = 0; p < pixmp->num_planes; p++) { - pfmt[p].sizeimage = - get_framesize_uncompressed(p, pixmp->width, - pixmp->height); + pfmt[0].sizeimage = venus_helper_get_framesz(pixmp->pixelformat, + pixmp->width, + pixmp->height); - pfmt[p].bytesperline = ALIGN(pixmp->width, 128); - } - } else { - pfmt[0].sizeimage = get_framesize_compressed(pixmp->width, - pixmp->height); + if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) + pfmt[0].bytesperline = ALIGN(pixmp->width, 128); + else pfmt[0].bytesperline = 0; - } return fmt; } @@ -845,7 +813,7 @@ static int venc_queue_setup(struct vb2_queue *q, unsigned int sizes[], struct device *alloc_devs[]) { struct venus_inst *inst = vb2_get_drv_priv(q); - unsigned int p, num, min = 4; + unsigned int num, min = 4; int ret = 0; if (*num_planes) { @@ -880,16 +848,18 @@ static int venc_queue_setup(struct vb2_queue *q, *num_buffers = max(*num_buffers, num); inst->num_input_bufs = *num_buffers; - for (p = 0; p < *num_planes; ++p) - sizes[p] = get_framesize_uncompressed(p, inst->width, - inst->height); + sizes[0] = venus_helper_get_framesz(inst->fmt_out->pixfmt, + inst->width, + inst->height); inst->input_buf_size = sizes[0]; break; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: *num_planes = inst->fmt_cap->num_planes; *num_buffers = max(*num_buffers, min); inst->num_output_bufs = *num_buffers; - sizes[0] = get_framesize_compressed(inst->width, inst->height); + sizes[0] = venus_helper_get_framesz(inst->fmt_cap->pixfmt, + inst->width, + inst->height); inst->output_buf_size = sizes[0]; break; default: