From patchwork Tue May 15 07:58:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135829 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp668101lji; Tue, 15 May 2018 00:59:36 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqDPKw8a4PMMdupaeuVtrb9kpAmC0Qkc46l5AuVM5bewDCkLE8p+KOYbrmtBKEMRbTrBCnG X-Received: by 2002:a17:902:5481:: with SMTP id e1-v6mr13144027pli.137.1526371176782; Tue, 15 May 2018 00:59:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371176; cv=none; d=google.com; s=arc-20160816; b=ZqAn7HmM+eAWkG6IF6RtTZmJMBuBCVX3pq7wBB/EHoVbmSvgHhzzxx+BZIbpaTeISe mEBA00bcz2qqePHV6cYHqdcXNjMer3f3Mnt9bOEXLYDa2/YwD1Zv0W+0El15wtJVYHI6 OHsY59nXYhfw0TSOMZ0aiGlPESmSrPM/wKNPVQkYszpTp7v93wZy16R/DG15519M3ZZ5 a2H8gMalj6dYrQGMbiMOAnRnuCY3ZfWo9KXOSALuBBuaiQeAUIAh8BJgjn3SEv39uCEO aaVFykJqnAte6a+y79Y3XKzO1KTESxL5Y3JnksYFlhlnuG9btbZ7QVa/24wOpwh9eVwV uhAQ== 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=qq5mFuZJ4Yav2DH45SOsMSanfFXAE44rr7On7fvNHsQ=; b=O/3F1omMqE5W0mYx6XGhEHVyFOZicPPot7pOG5yhev5beRin5uasEQpU0QF1sfICGo 2MIo2Ky1P3F1LFYsd0SZCgFJW8l26G453rfVOnEE+805+gbZMO7HYOfnyOYKbgBSimjp jVb819i5dSYVlbistQEX2uap4jok0mmScdw9kqPJ3ceMFY1Khv2ilBkS8MWIFoU51OBO XepSaSjq93be1YAGCjmslawvvyaKDuYC3+BAKGJPuwu94f0yANaP/LbcBCb2GSmH45bj d7Z55uWK18qdv/stuYjYqQd7LeiO4AqyQfBuxPKN5kyLat4Pn9WrtwMhtJLY7rIOH+v/ 6hrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GVho9xOS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a65-v6si1564927pgc.503.2018.05.15.00.59.36; Tue, 15 May 2018 00:59:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GVho9xOS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752490AbeEOH7d (ORCPT + 29 others); Tue, 15 May 2018 03:59:33 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:36798 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752188AbeEOH73 (ORCPT ); Tue, 15 May 2018 03:59:29 -0400 Received: by mail-wr0-f193.google.com with SMTP id p4-v6so14929168wrh.3 for ; Tue, 15 May 2018 00:59: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=qq5mFuZJ4Yav2DH45SOsMSanfFXAE44rr7On7fvNHsQ=; b=GVho9xOSe3lLm0Hwc5X2NNK+GEQbR6aTbFCtj/2Mx/7rDzZGTV8s0hUtGvbOB9W1wQ ohshyTzj+zW6R+wdHK3t0Gt19sX13xBq+BNL3Bdkc2NK988iexaJLeqErNkWq7qknsBD LGeYn5O5JB+5AKLMqyL3JVQQMe3Gy9i/HwPvE= 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=qq5mFuZJ4Yav2DH45SOsMSanfFXAE44rr7On7fvNHsQ=; b=NMqySrqmksJUGrScuex9V+drfJE7DtF1W40T13NTMdKFDypGGmBvFMIfbTf34Ab8DB sFUKABjmH1XWMrNIlBHeOSdQZ8QJjZYJKGp0ZWCl8NvLKY9uuv8vWikjiDfUtHQMQ2r9 1nGOHUVTEKRm+xAHie0BdiLFRXXLKE7p1f/1vKUDhrqF4asfowBKJBPzdYzdfQNWaBky nmyo8Fk/XeOYU9uJLO5LIQwMVf1do9iYhex7BpMfIgVLYzj8Fi8uFGFKvcu7IPlxKTia T2qnnGTrGwqt/pkAxuPZvU1B1ujO0iG5yNDuUZ8kNPE0DOyJYu17rDvbsIvyCxUvNGQc HzjA== X-Gm-Message-State: ALKqPweu6wgXjgnOunk41ML9qpX3MWGs4SL3RD+QIsJWp2pPEy/6PNLn CemZqM8WxFDeJ4WXexXbgnrozw== X-Received: by 2002:adf:b352:: with SMTP id k18-v6mr9245607wrd.207.1526371168456; Tue, 15 May 2018 00:59:28 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59: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 v2 01/29] venus: hfi_msgs: correct pointer increment Date: Tue, 15 May 2018 10:58:31 +0300 Message-Id: <20180515075859.17217-2-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Data pointer should be incremented by size of the structure not the size of a pointer, correct the mistake. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi_msgs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.14.1 Reviewed-by: Tomasz Figa diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c b/drivers/media/platform/qcom/venus/hfi_msgs.c index 90c93d9603dc..589e1a6b36a9 100644 --- a/drivers/media/platform/qcom/venus/hfi_msgs.c +++ b/drivers/media/platform/qcom/venus/hfi_msgs.c @@ -60,14 +60,14 @@ static void event_seq_changed(struct venus_core *core, struct venus_inst *inst, frame_sz = (struct hfi_framesize *)data_ptr; event.width = frame_sz->width; event.height = frame_sz->height; - data_ptr += sizeof(frame_sz); + data_ptr += sizeof(*frame_sz); break; case HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT: data_ptr += sizeof(u32); profile_level = (struct hfi_profile_level *)data_ptr; event.profile = profile_level->profile; event.level = profile_level->level; - data_ptr += sizeof(profile_level); + data_ptr += sizeof(*profile_level); break; default: break; From patchwork Tue May 15 07:58:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135857 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp682658lji; Tue, 15 May 2018 01:14:09 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqos6/4zgQ/Fszi88jnKiPCTMY8+6ZSezfqKT/uD43MNXTVriX4O2qYT+PN9UkGh8SPiByt X-Received: by 2002:a17:902:ea:: with SMTP id a97-v6mr13151447pla.28.1526372049644; Tue, 15 May 2018 01:14:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526372049; cv=none; d=google.com; s=arc-20160816; b=ixHOuABrsTjlSmSkdHb9Gj8Y4lJCJNsTkruGCaNTFw2//UKHXiAtMBeBzyf/9lgXma nMabeRG3NPYXq4ZJ4INb3RlNSY/ANis/2nMr+nUyMWd+O3C+rYe/pC0gxlvIdYHsYT9n fjXNLwxD6yP40nBC0vbv7NnTNH/6+KfsKzgBV4VGxqFGWuwFF3keWsGFlLmuQRlkt1+2 xPIyB/D9UPPNq20IDD7t7UOyaDYEereCTjb2UwTzD9CrY214QCpQkQZogo/eEUI223YD L8O0Vq206mfSMLoWFGF37BoVF6KWVFu/79qTXfU63C8lkIVB3Y2wICNYA6WoE8W1LemL Q7wg== 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=zMuKVj6QFacwz7IWhezYa4XGmFJI0qX2tfO++Xoft9Y=; b=nSvnCEbx9dtY4w9nqUqKZJ9YqR42gKjA5e9bIks6UKN16sCBpXIwQGzXsNdWCUHZAu uc7qwxCu4/018x0xqn0gV8vEC/sbcGVyCcgFFM80J+FQL+Pw+T56GccZY+WpjXda9ZWh PUXU6uqUr6x2b2fj1xwS1kNUy9uUQZYAsF9bdbXlh2F7xa2b/YRRfLHyy0X4QeKNApyn F9u4JDf7xm3CaMMG1ZItkq1+TayjGDc80VOVq+WlPEwWx5fhyUkEsYzxnGc/3Iv4ySsr 1mLowWH4upKNiVdJyoOd3uxA/uFmI2L9Sph/mYMC6N3UqhkWiisfmxC+FRsH3pNjl10j 5BJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c+6Hxpd0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i67-v6si11220360pfi.95.2018.05.15.01.14.09; Tue, 15 May 2018 01:14:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c+6Hxpd0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752642AbeEOIN0 (ORCPT + 29 others); Tue, 15 May 2018 04:13:26 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:52007 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752381AbeEOH7b (ORCPT ); Tue, 15 May 2018 03:59:31 -0400 Received: by mail-wm0-f46.google.com with SMTP id j4-v6so17706759wme.1 for ; Tue, 15 May 2018 00:59: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=zMuKVj6QFacwz7IWhezYa4XGmFJI0qX2tfO++Xoft9Y=; b=c+6Hxpd0CTMqsaqKcC8AiHK+v5O0TaF9SFCF6yAu1GTzYEjAHnm/3M3B+L2WRCH7Y3 BlWQTGvliHq8ccpAH3lWvZAwtjMep87ZZaADF50TYdDNuoMdBJx7QsvnVRoSWRkXLiNA RISAekdtAnh9R2USGmepHeGAggmalq8tF0c0o= 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=XNlzzAgnA243Z0r5qCg5DUqlYbWjyvtLzxYzfAFLz16RsB4/s45IF12BHkh8FZbDmP cAoMLSTkm0csMHBWBTVJXcwGGnwfXZHK6EZVJ429noC96fq0yXxISiQVk+OZ7MI2JMZw C/0xxSoqGA/1lxNzSIAeuL93Ftx23oZF/lGqg7mYFORW/tUC6Us6ZVxgDj0g+Rv3Uqgu I2zHkKcjkv6WFkJ5yC9UPi42H2fOg4mZgO7KFqs4jggJv2zxX0A0kcF7LnGFKP7ucfTg 7hx16kQt4pKhaumiOO5np1h9Y97oqox2ny57wYzw5yMn/kY4bp9FeMCjJso0oegZGUMV 0G/w== X-Gm-Message-State: ALKqPwf3lI0Vv5ubb2ePvccQ6FpYiO42wfyFBv+T6C6Ut9jZA3iYjKIz EPuNPRksu5sum/isRkYDhE8AQA== X-Received: by 2002:a1c:7c05:: with SMTP id x5-v6mr6605523wmc.7.1526371170572; Tue, 15 May 2018 00:59:30 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59: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 v2 03/29] venus: hfi: update sequence event to handle more properties Date: Tue, 15 May 2018 10:58:33 +0300 Message-Id: <20180515075859.17217-4-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 May 15 07:58:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135855 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp681484lji; Tue, 15 May 2018 01:13:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqwRirkVb4ytfULYPPKQIA8DJN2f1Htz3sb5a19KTTSA7Q1gtnaXZ2ndI1SwSyr//1KZgvC X-Received: by 2002:a62:4c53:: with SMTP id z80-v6mr14122025pfa.181.1526371985065; Tue, 15 May 2018 01:13:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371985; cv=none; d=google.com; s=arc-20160816; b=oRPzeSPz2+UjX96+hL6ANMDvV0NRR5WhY9w36lIf8FRqqzDdLMDQFNuP4Q23HpKHIH fF1/4uZv/u4Z8FNnfbPDlUGI66uErP+Ci7Aym9gPyoGauaEYkBeNopDwqVtxjkdA8jUF +7DlB2GdGoaUPc+9GNHAQdWkOSt9/sZztashPKlwiTpsnVuL8ljyaOLshaEgH9R8eW6d HhUUYgiykpnbH7aymgwEPhl4UfY3Z+yLQhuuwabrUvfTGdqs9dMtjZ6kqVmI6G14CkQv XRAEiSK/blMGbW0Z+D8s+MLiBcVBSgPydnWZEZQOn/7RBx+sjFxXgqXfvqsBX0qdKQhX UWBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=dihCKrpTwMryu1Tp9ISl68rVO7mV7cRP6PZqJIU3Z/M=; b=CNr0Ubfssp5e2oOfgwc5HHTMFmVjq2kd7TGEOXqrmaFSQybnTSlsMHMEiaiNPRetwe AAfV9s/feutZPZVYuYqRUCPftS5XuuVWtIkzUAdwKdeyyz5IfOCOmoxBQCqZ76lO2+vW rGEQQ35zCkkO4IN2/wmUB4J7RzAEozrVig6isA8kZ31dPGWryLYlox1SZHpwUKoFGv5H QWtgZQDLChEH9H0Tt2BA7sdKNdJNr9SdS+J6EkYBL7+2BC9FbzPPCJIZxiFP2spxWNNU AbK94x6G9od4TcjEbD2KbwlahpmLsa6R4+CJepVaG5Fdt8Hk1JBW5Kjax96H4WKxA0F+ L5sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PUYQKzxV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x4-v6si8859506pgc.411.2018.05.15.01.13.04; Tue, 15 May 2018 01:13:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PUYQKzxV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752417AbeEOINB (ORCPT + 29 others); Tue, 15 May 2018 04:13:01 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:39200 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752467AbeEOH7c (ORCPT ); Tue, 15 May 2018 03:59:32 -0400 Received: by mail-wr0-f195.google.com with SMTP id q3-v6so14909765wrj.6 for ; Tue, 15 May 2018 00:59:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dihCKrpTwMryu1Tp9ISl68rVO7mV7cRP6PZqJIU3Z/M=; b=PUYQKzxV1goqhQOlDZSuAzptH+B9cJQfOswdOa0yA1YkgVwCVMYjdgvs0yv1B2lttj UrbaWNWa6MaHD4EM0dggBkF6G4oOgZ9c92FuJ8I7mMHW6Bv9hcIlqG7V0OGLHZc5II6H PZ2q0OTpVfeChD5Q2a9rIncET3Dab44gzoPjQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dihCKrpTwMryu1Tp9ISl68rVO7mV7cRP6PZqJIU3Z/M=; b=OuZ/nQgUSqWyvhNU7UWP5kPyr8em73vAf1eUbo7OT10sFHnp2ZwAElAb4wOYjqpfWU HhQrCHqqa96xljey5uU/qjOzXEktQStjN7GLTwn6Wu5ODkirEmWZHgG5fj4m6H/NW3wl 13Pa/IQS08FuVOFRGZ/Ye5hccEgNzXu5U8jXeY2DDggFeGHZEJGjSbVYAMsSLU8Hclhj a0rr5TYsID4HLYzsW8CAi1gICzZvE00B0R6bkGmIFQCwYSbDOACFmvdd35jzqDuShfrH sY4IiydFbWNPtyy+TF91Q6H4/jppQJ9p+UhFnb2QnW1QYo0H+ItaLiU0lk8hPuHakvWc TvkQ== X-Gm-Message-State: ALKqPwfOTKcCmDFVmzBWSUFIjizvQob1YVl143zlImG/F0T7oZqz/ayo PZeB7LJRVpNfBRPALHH/+IA7lYG4OkI= X-Received: by 2002:adf:b00f:: with SMTP id f15-v6mr10546852wra.254.1526371171609; Tue, 15 May 2018 00:59:31 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:31 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 04/29] venus: hfi_cmds: add set_properties for 4xx version Date: Tue, 15 May 2018 10:58:34 +0300 Message-Id: <20180515075859.17217-5-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adds set_properties method to handle newer 4xx properties and fall-back to 3xx for the rest. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi_cmds.c | 64 +++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c index 1cfeb7743041..6bd287154796 100644 --- a/drivers/media/platform/qcom/venus/hfi_cmds.c +++ b/drivers/media/platform/qcom/venus/hfi_cmds.c @@ -1166,6 +1166,65 @@ pkt_session_set_property_3xx(struct hfi_session_set_property_pkt *pkt, return ret; } +static int +pkt_session_set_property_4xx(struct hfi_session_set_property_pkt *pkt, + void *cookie, u32 ptype, void *pdata) +{ + void *prop_data; + int ret = 0; + + if (!pkt || !cookie || !pdata) + return -EINVAL; + + prop_data = &pkt->data[1]; + + pkt->shdr.hdr.size = sizeof(*pkt); + pkt->shdr.hdr.pkt_type = HFI_CMD_SESSION_SET_PROPERTY; + pkt->shdr.session_id = hash32_ptr(cookie); + pkt->num_properties = 1; + pkt->data[0] = ptype; + + /* + * Any session set property which is different in 3XX packetization + * should be added as a new case below. All unchanged session set + * properties will be handled in the default case. + */ + switch (ptype) { + case HFI_PROPERTY_PARAM_BUFFER_COUNT_ACTUAL: { + struct hfi_buffer_count_actual *in = pdata; + struct hfi_buffer_count_actual_4xx *count = prop_data; + + count->count_actual = in->count_actual; + count->type = in->type; + count->count_min_host = in->count_actual; + pkt->shdr.hdr.size += sizeof(u32) + sizeof(*count); + break; + } + case HFI_PROPERTY_PARAM_WORK_MODE: { + struct hfi_video_work_mode *in = pdata, *wm = prop_data; + + wm->video_work_mode = in->video_work_mode; + pkt->shdr.hdr.size += sizeof(u32) + sizeof(*wm); + break; + } + case HFI_PROPERTY_CONFIG_VIDEOCORES_USAGE: { + struct hfi_videocores_usage_type *in = pdata, *cu = prop_data; + + cu->video_core_enable_mask = in->video_core_enable_mask; + pkt->shdr.hdr.size += sizeof(u32) + sizeof(*cu); + break; + } + case HFI_PROPERTY_CONFIG_VENC_MAX_BITRATE: + /* not implemented on Venus 4xx */ + break; + default: + ret = pkt_session_set_property_3xx(pkt, cookie, ptype, pdata); + break; + } + + return ret; +} + int pkt_session_get_property(struct hfi_session_get_property_pkt *pkt, void *cookie, u32 ptype) { @@ -1181,7 +1240,10 @@ int pkt_session_set_property(struct hfi_session_set_property_pkt *pkt, if (hfi_ver == HFI_VERSION_1XX) return pkt_session_set_property_1x(pkt, cookie, ptype, pdata); - return pkt_session_set_property_3xx(pkt, cookie, ptype, pdata); + if (hfi_ver == HFI_VERSION_3XX) + return pkt_session_set_property_3xx(pkt, cookie, ptype, pdata); + + return pkt_session_set_property_4xx(pkt, cookie, ptype, pdata); } void pkt_set_version(enum hfi_version version) From patchwork Tue May 15 07:58:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135831 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp668176lji; Tue, 15 May 2018 00:59:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp4DfTK2LJJkwaEwvcq1kHzze0O3Hjn8B2CTNLtVOFXup39s+82U03XAY8aJfJXM0nInDrF X-Received: by 2002:a17:902:6bca:: with SMTP id m10-v6mr13360533plt.6.1526371183420; Tue, 15 May 2018 00:59:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371183; cv=none; d=google.com; s=arc-20160816; b=VS6duIbzHUmPRobPZWYjqvqkFG2BBVlA/Zxs0jNDEwaI5cLCJy4+74F6dBAuyTnM9O 2sApBH1kztlLabY3ix6uF82cRxB4/cXGNL1UDKej5NPqjLWTsdO8tDEiLLVX4+9xAoQg VDz0oxcEw1VmUIhtm/KIzGdgRdGizf0YzrEYLwa6e6ZmYZZ84ZXMBl8iJ8grXuFYr5uH UGeNA0eJRis+ewL5Vx0MAk+hHVJXp9dyb1yu4WTSh3DnZA6CN2kO+JHO90ZFFDqFSMJg GcVf6lp1jlNIKcrs3K1aXw0vGqzcxA8Y5GX6W7mLTpWfGGg0Fnh8s+CxkREWZoHuZiEw m9KQ== 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=1Wl88e8hLVwkRwSqVzoF/pW4BWPgDsxkJpBzUcyKn74=; b=n7kFMrn7fzklAT2d7VRAuN+7BkAIwdF9ylqLZXDKEApvX9dcaDu8vHzH4gZHvo6g2C F7pkz3qpqttbX3khR1UkqfILf02r0sb6drtxsUin4gO14aFjJ/rxgBMiNPKEbEsKXOZG /fJglf9RUVqD+3BryGIR2lDgkR5uDoOt4aIuuRBU3jcubQe/QRRpRPeNNp1qc6k1AqjC hj6xX8B3LgL/idNTrOJvNwqTI5V7LZs/Vb1/Maj7Op4hBZBOQ9BUoMmU52e4yFyfHFdF lTVjYN6uWhm+pN371WQWlAbKD8id6z2rglaRjwzwaPYXQMq6fwstgXx7KuE2kuKDWa/R d2qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kWf7enzN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v12-v6si6045050pgs.538.2018.05.15.00.59.43; Tue, 15 May 2018 00:59:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kWf7enzN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752536AbeEOH7i (ORCPT + 29 others); Tue, 15 May 2018 03:59:38 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:52872 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752483AbeEOH7d (ORCPT ); Tue, 15 May 2018 03:59:33 -0400 Received: by mail-wm0-f65.google.com with SMTP id w194-v6so17604247wmf.2 for ; Tue, 15 May 2018 00:59:33 -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=1Wl88e8hLVwkRwSqVzoF/pW4BWPgDsxkJpBzUcyKn74=; b=kWf7enzN07XvXMw6gIDGewrYehNrHu8fDOPXrUrJrm2ILtgoUf5pV/CHZE71FOwMYZ jkR3k8bJy5hvUFlN9GS2dyICUYu2YEFF5lbmflywe4EXLwYj5VeDOYXYM0i8w62KX88y 6UTc4d6ExQmW489meo/ShDICvZ6HliqIemkRs= 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=1Wl88e8hLVwkRwSqVzoF/pW4BWPgDsxkJpBzUcyKn74=; b=OJEsnGxK5HP7Fj5QcFoZVMqV+NKwIOonn+7ezsXer5prTHjW40p66cDhKoV5TAfF4b M3u1NsrMno7lphWT/wp1pA38oRxHuyGItBiQdKitSEIFa0sxIpRg4p2xFhqrPKG1fqXq ntl2+DPuUdxcxzsXI1wuDt/G/4FsDU+MsNqhO03USRpGWkVfutz/6nv+rsUOryKg78to X3PjRUNW1+BvXwMv33wPg1J6NEkCFfIfnLI+kjba01eO8xoEjZ3hG/5ymASP03/jVezr WEUbuKDgrwFYWXwZ5UBB7On+GqNJnsKG6HBzZKB9LsFcucV56/XR5aZdxg94aMlq+qxc byMg== X-Gm-Message-State: ALKqPwcoElVSnmOTGVDuFB/YbFRdCWtyoJCEdCGf9ARf3bxTYCxtJOsQ M3+UaMVkEH48tC/sDVTxbm+QT5W0e7c= X-Received: by 2002:a1c:6d90:: with SMTP id b16-v6mr6827926wmi.138.1526371172568; Tue, 15 May 2018 00:59:32 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:32 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 05/29] venus: hfi: support session continue for 4xx version Date: Tue, 15 May 2018 10:58:35 +0300 Message-Id: <20180515075859.17217-6-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This makes possible to handle session_continue for 4xx as well. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/hfi.c b/drivers/media/platform/qcom/venus/hfi.c index bca894a00c07..cbc6fad05e47 100644 --- a/drivers/media/platform/qcom/venus/hfi.c +++ b/drivers/media/platform/qcom/venus/hfi.c @@ -312,7 +312,7 @@ int hfi_session_continue(struct venus_inst *inst) { struct venus_core *core = inst->core; - if (core->res->hfi_version != HFI_VERSION_3XX) + if (core->res->hfi_version == HFI_VERSION_1XX) return 0; return core->ops->session_continue(inst); From patchwork Tue May 15 07:58: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: 135854 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp681099lji; Tue, 15 May 2018 01:12:38 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr5TxYg3Z9vwYVZyFGJe4mzFCWQaqHaO8KZtJtRBB3Wu7xdhYrplll/CysFg7iJXvoiNWjs X-Received: by 2002:a17:902:a717:: with SMTP id w23-v6mr13300051plq.130.1526371958437; Tue, 15 May 2018 01:12:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371958; cv=none; d=google.com; s=arc-20160816; b=Et5f77KqjOUMkLA8HcHs6sxj5wLyV1CtpKPLPfKlD4Rpb7SE6UP9uE/av+jR9fqf9N j9WYFsQambprmT0imHE4vMYuXy69HzaooHV1tvqYsQWsuM4xgeq6pVk+CU1JYGrZwZyp 60x3HhW2BZ6+JIhlId3fmHrNowFvfn697vBj86Z0uLP1YQnAH/Pm/dr5BmphyMQzafjQ fzG5hSlDEk+sSYWGOLpfAKfCzaxYA5RDGAk5thWitb9eKJpNS/9ElAHpRlbfbfo2R/vy ZEgZuafDJXc7iYKYtgtZG6JO0pNqn2Qm7mmgus4NneP1hCW+rBcTT46KZIuldITfh1FN 1TXQ== 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=zuQ1SjEcsKyg6eckkbc65vVKHJNFHgpP18aBxBMCet0=; b=nw7wZXxzk8QVyV93+sbEv/VFpag+iPUiPHOfMiBZ38Hi3hlLcMeA/wWUpkijnTqoif +FIOuhmx7JIBofTS6P+OdCUCjmqDE+xWh4EmWDr+V6uUkEoZCqlpedG39LzZ41pn0c5P xB4kpaXYk/UsoG7zsk2j97U22izZnPLi/O7FRaa6qDq19hIb9eAL8dpyaO+0gIpybgds 04Br+eizNSxfZuuuCmIPxcEk5yK0HIzlazvb3M6Akat2Ps9NwL4ezpBTkROWRNelpJks YoEfBw5a2I00ISMQcwl5ZGlxX1RjeISCBlLUvBFgiKOTPXH4CcXoKRVNG8h/ltl97ucm Vf8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BUraEchV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d1-v6si12009525plr.410.2018.05.15.01.12.38; Tue, 15 May 2018 01:12:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BUraEchV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752633AbeEOIMQ (ORCPT + 29 others); Tue, 15 May 2018 04:12:16 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35031 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752506AbeEOH7g (ORCPT ); Tue, 15 May 2018 03:59:36 -0400 Received: by mail-wm0-f66.google.com with SMTP id o78-v6so19723294wmg.0 for ; Tue, 15 May 2018 00:59:35 -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=zuQ1SjEcsKyg6eckkbc65vVKHJNFHgpP18aBxBMCet0=; b=BUraEchVvckvYps8Tg8xqmU4mz0xhWovqODgLrZdUjz/sddwuF3mEGfIKwRlYK8iXw XueQ33HoSsI3VXM1c4ue9Cb3pQjGiHKJJyR6Pw5ZTlKKeJ1uucZvwxSosmDa+ao0eNOc th4w7B++JW+OzYGxzEQWZFV3Cp7BLvFyQUzK8= 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=zuQ1SjEcsKyg6eckkbc65vVKHJNFHgpP18aBxBMCet0=; b=p0RiMew+ojzqySZ3yApo7cdspfy0ufTVeTUjolGKyo/Z/7mmbhxpYsZZwijOUvCLnb EcxAY0KeOHsn9ffjrnjV2+hKl+iF7e/tljYsg4ThAPwSAP4UZOHy1RGex+Hmta5WrnUW uKDVWQllUFm2PjNGbmnboa0wi0THmtJ+4tO+O9vGzNFEVYFCHxaA4kvGDZPKuOgy55kf 2WiHq8hAqw4FqH74RF5r0PkhlJXSle/cM2w6xu8YgBcSNpgdAaE7BRflNs3bRCW/YGOc N9AVm7SY0HGDHZSXCkB2SuQq7Q2E8aDbEHIs/t1p6HA+yKZOqn1Bb69gfrePM5xUoby3 8y8w== X-Gm-Message-State: ALKqPwdiPFIBwlynexRsIQJzVbm3ckNGHyjo0O6snmRlhCxLvBYNpQNd +2Fp7SitTzJVRFhhhWsRmjOm8w== X-Received: by 2002:a1c:a750:: with SMTP id q77-v6mr6885237wme.111.1526371174839; Tue, 15 May 2018 00:59:34 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:34 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 07/29] venus: hfi_venus: add halt AXI support for Venus 4xx Date: Tue, 15 May 2018 10:58:37 +0300 Message-Id: <20180515075859.17217-8-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c index 734ce11b0ed0..53546174aab8 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -532,6 +532,23 @@ static int venus_halt_axi(struct venus_hfi_device *hdev) u32 val; int ret; + if (hdev->core->res->hfi_version == HFI_VERSION_4XX) { + val = venus_readl(hdev, WRAPPER_CPU_AXI_HALT); + val |= BIT(16); + venus_writel(hdev, WRAPPER_CPU_AXI_HALT, val); + + ret = readl_poll_timeout(base + WRAPPER_CPU_AXI_HALT_STATUS, + val, val & BIT(24), + 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; From patchwork Tue May 15 07:58: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: 135851 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp678406lji; Tue, 15 May 2018 01:09:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoy6dv3ETF8gEMtwI9uDTJVbm4IIgEeHftKPpy0RnTRgIXpbTF94xrcVgcTu8MQw6eAl4Lr X-Received: by 2002:a17:902:3e5:: with SMTP id d92-v6mr2685694pld.104.1526371799838; Tue, 15 May 2018 01:09:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371799; cv=none; d=google.com; s=arc-20160816; b=Ye0PdlZC2xAoEdd39yPFx0BUPiSCIg2Kk6FD3QjxPElyNtKIKjxSLSPw0dAnmlY5uM tul04TT1O5kk9/XMccmISuRCmmVreiB5NLumBsv4l8mAQ4ddXvOZJYaxOOK1hihZlI9V ADzLItDnOIRaCcuT8+CMxWDrvE3u2zvHN5n38iRUDn/AuOy9KB5qlpGJujz8RUkRM0B9 obOgleJEEF5iv4lqVqmjVSghPRobXOV/TDpSfpnVW1Rpc0wComo5NVDZlKy+tJIGW3GH 3THQWqbIhM4cMJMtfAVib6Ewc93E7dqjYXDDOqT1rQFPX0N1pEogfFu3Sgx411S1jWsG VfUA== 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=dVkqRVLZfFoqB0FvZLVgL85/ireF+ESn1YcZI2Vtj7I=; b=erQr9CpESLL5LF3zEKomEtlHc4kSTIoLuKrDi/YVVvnZu+pIX3VrFQej2qnCKUxCO0 g7kiwMM6hmZWD67fx0sygLMpjFV4cbV3jjvUe8OPvIAqCdu2LBSzt76JTt3NA97gxL4J g78Imb8Yp2kZ1YJlntQSPRe8275suTTmS/A7whHWW2oYZrnYU5KpuCDQKwbGB6IEZNcx dJD2jpV2rdJaulogsGlVcv/O+qkamNC4OFZyzwR9dFmf6ebmseNP7ihvUCEaOSPjgrXP ltRi967L19Uxg3G1xERA5azYM8VB7YGogz/JmNp8q8xeaEeROfOP4KL17H9rrXZLImil xdEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Uta+TgaK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g6-v6si9505390pgr.72.2018.05.15.01.09.59; Tue, 15 May 2018 01:09:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Uta+TgaK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752647AbeEOIJk (ORCPT + 29 others); Tue, 15 May 2018 04:09:40 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:54951 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752539AbeEOH7k (ORCPT ); Tue, 15 May 2018 03:59:40 -0400 Received: by mail-wm0-f65.google.com with SMTP id f6-v6so17674299wmc.4 for ; Tue, 15 May 2018 00:59:39 -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=Uta+TgaKH3jiVQR9Q6RKEI3b1rU65BWj+5/sgYU/ZLXaeOEIKK8dwYkrWvgAFhXyti SUxXQ8lW93pn6J8UskgSvC3EfE6zIjBsMJN3XYoe4HXeTPjpE4yOJh5KZnbrwVih+ivN sU9fYQ1cE4Hv6Dyrf7+s5A33RAP4NYLa5cLlQ= 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=B71G+tSIf7tUNdMcD1D78/rN/M5uQMqkE6ynVXAFM0E6w/Dmo67j8SUjQ91wLGc2Ly Pb2lyAKSXAT30VJ4vhYHKCf41ym7wrtielAwbxiXtbLg688bnt5g0TSem9UyMJCGAMq9 DKp8zt+ix+1AYRWs3eO9KOmF+bSmiM0DAc3xPy5j60qMzy2oRqXItku/AF7xJ3vbPJaA FchpD0zrACOV3h9mi6v6lUjrlsCVPSpsazviv5KxchE6hHw/4+wk4GVlJTMVAQVME/9n 9P4xYZPHRWazXw0SI7hlpBdekaovD87I6f03PhAvKT2jqR4fJqDjaym+eDN5qu2TrYZy 2qUQ== X-Gm-Message-State: ALKqPwcvqWacY289CqXEMRkoMym3IOuKWMOyOhMI3CjoEipvZSdYRVX7 gllCKug64xYU56ioYJUVsQ58DULVJGk= X-Received: by 2002:a1c:7a0b:: with SMTP id v11-v6mr7401839wmc.58.1526371179017; Tue, 15 May 2018 00:59:39 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:38 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 11/29] venus: venc, vdec: adds clocks needed for venus 4xx Date: Tue, 15 May 2018 10:58:41 +0300 Message-Id: <20180515075859.17217-12-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 May 15 07:58:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135848 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp674965lji; Tue, 15 May 2018 01:06:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqwk7NnfjwHnTgImHigP70H2bmWKVDah14bNveyBL41D1DdUMCvjupNu9jIezCVpSVMxdPv X-Received: by 2002:a63:66c2:: with SMTP id a185-v6mr11558385pgc.347.1526371603565; Tue, 15 May 2018 01:06:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371603; cv=none; d=google.com; s=arc-20160816; b=pGYEMxhD0kJrJs/+C4BZu+MtB6syiSRII4xaYi03jsT/UsfzGANkkKR9/j0fbCnWFG Szi9nWayNNNR2fqvm5qJSNiUNnQ69FMzjQ3FAeAmgmL2iN1Rr52LSS+dVzmllNKcFatO IVT3Z4LShzqSUsO6NzkBAZ+R/JnSYydE8phR62kk3a46KWa3WVY0KjbD/rngwhl5nPqL LlQ4Y9FCVpywPbADJrHYe1LF/PYSuZHdZXR/PePxB4R3Rxp0tJMjL4tPtGYyu6x3rMzj 4nsCQr4+zUZyz/nwZo+cIVaS/nl0q04+RCL63HXyLQ4Tj8cZgcgcTnslkGDnNwivowES 9A3Q== 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=14fkdpoElKA9QBR+Z+GrZ80Ug95BF77LAyGiE0JfK94=; b=HMpVuinw4kbwAjdnKtZKyOXOuRPOLnW3T6/ydaSmeY38FKE9j6sZcCdi+TS8fa3Epa X5nE+stJtxX6/0wVKUphP2Diu/2KfN/Nh91XSjzXwPHj/l6XIZsuDw15qIL22v2O54Iw joESAC7Mzosr3oJYpI50cfD7Whl/loT/PcV+YDXPH9tyj7n/BbYAtJ3VxV8tRQ4e1Njr zeP5B/dMRvv4iyOL1kOiPUYUouSF2PEGjvruRa8wTTi0N+OO6lqU88DTwDF6+uF8Akkt mr5FwcOtaae6aNcgkXn4nnP6lO0F8t2EgktCpPLte2qF2pF3hoH+wyUbYCkhEjADTMZa rW2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N/XlIpUA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h21-v6si9049308pgv.580.2018.05.15.01.06.43; Tue, 15 May 2018 01:06:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N/XlIpUA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752767AbeEOIGi (ORCPT + 29 others); Tue, 15 May 2018 04:06:38 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:43841 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752543AbeEOH7m (ORCPT ); Tue, 15 May 2018 03:59:42 -0400 Received: by mail-wr0-f194.google.com with SMTP id v15-v6so14907793wrm.10 for ; Tue, 15 May 2018 00:59:41 -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=14fkdpoElKA9QBR+Z+GrZ80Ug95BF77LAyGiE0JfK94=; b=N/XlIpUAQKE1MYNH/1cqR2XvWvOc6702R4+Ax79SF8ABFWneDtX1ZMwBI/TIYqd9AS VWnEGbPZnhhYbrQtwFn0OosuOOtKURP+3VfbKpWofKMLkI6H6hNoQAQD0+mUGwUT+deA 6CKubvxmo4bikNzlJRrRMSg+XnTZE0VCQ9Dio= 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=14fkdpoElKA9QBR+Z+GrZ80Ug95BF77LAyGiE0JfK94=; b=EZSrdTckavYvxp3C0pN3TGbpJh4dciik7gUon/SqLwVa9H14s/5b4NZjGWCmzJHYE/ ggziCS9NhASGyD4rdU1o3+HTX6SmIEYTfHuuDrG7Y6qHreChtcvu2hi0j0VzrXrQYbh/ 4Ck8Rl8PHzkh6uZe/dBF7fruiAr1fVZW1DA4cgva1RLN5DEJc5A5qBfXRlQnGxNLYlHM BdWkc8W2+Z8OsGP9dy0rSX1xLzmspJGdovgFk57Dz5G6QzP4C7x68l/0j7DP1wS7tNqr m84IcYyXxa3sQtcMoVGB0kYZNglu6VaBw/WPbhz/9eKwVCK+gvFpDRILMnOkAw4Hy8Vy jiVQ== X-Gm-Message-State: ALKqPwdp877y/pnoLK2Ox0fTsTpnrKUWfxgJPKS+WL2yaCtzjAfBRy6v EqexHzhUSmEjeW43XJjSuKtqhg== X-Received: by 2002:adf:ea4f:: with SMTP id j15-v6mr10298822wrn.4.1526371180233; Tue, 15 May 2018 00:59:40 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:39 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 12/29] venus: add common capability parser Date: Tue, 15 May 2018 10:58:42 +0300 Message-Id: <20180515075859.17217-13-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds common capability parser for all supported Venus versions. Having it will help to enumerate better the supported raw formars and codecs and also the capabilities for every codec like max/min width/height, framerate, bitrate and so on. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/Makefile | 3 +- drivers/media/platform/qcom/venus/core.c | 85 ++++++ drivers/media/platform/qcom/venus/core.h | 68 +++-- drivers/media/platform/qcom/venus/hfi.c | 5 +- drivers/media/platform/qcom/venus/hfi_helper.h | 28 +- drivers/media/platform/qcom/venus/hfi_msgs.c | 348 ++----------------------- drivers/media/platform/qcom/venus/hfi_parser.c | 295 +++++++++++++++++++++ drivers/media/platform/qcom/venus/hfi_parser.h | 45 ++++ drivers/media/platform/qcom/venus/vdec.c | 38 +-- drivers/media/platform/qcom/venus/venc.c | 52 ++-- 10 files changed, 530 insertions(+), 437 deletions(-) create mode 100644 drivers/media/platform/qcom/venus/hfi_parser.c create mode 100644 drivers/media/platform/qcom/venus/hfi_parser.h -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/Makefile b/drivers/media/platform/qcom/venus/Makefile index bfd4edf7c83f..b44b11b03e12 100644 --- a/drivers/media/platform/qcom/venus/Makefile +++ b/drivers/media/platform/qcom/venus/Makefile @@ -2,7 +2,8 @@ # Makefile for Qualcomm Venus driver venus-core-objs += core.o helpers.o firmware.o \ - hfi_venus.o hfi_msgs.o hfi_cmds.o hfi.o + hfi_venus.o hfi_msgs.o hfi_cmds.o hfi.o \ + hfi_parser.o venus-dec-objs += vdec.o vdec_ctrls.o venus-enc-objs += venc.o venc_ctrls.o diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 41eef376eb2d..381bfdd688db 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -152,6 +152,83 @@ static void venus_clks_disable(struct venus_core *core) clk_disable_unprepare(core->clks[i]); } +static u32 to_v4l2_codec_type(u32 codec) +{ + switch (codec) { + case HFI_VIDEO_CODEC_H264: + return V4L2_PIX_FMT_H264; + case HFI_VIDEO_CODEC_H263: + return V4L2_PIX_FMT_H263; + case HFI_VIDEO_CODEC_MPEG1: + return V4L2_PIX_FMT_MPEG1; + case HFI_VIDEO_CODEC_MPEG2: + return V4L2_PIX_FMT_MPEG2; + case HFI_VIDEO_CODEC_MPEG4: + return V4L2_PIX_FMT_MPEG4; + case HFI_VIDEO_CODEC_VC1: + return V4L2_PIX_FMT_VC1_ANNEX_G; + case HFI_VIDEO_CODEC_VP8: + return V4L2_PIX_FMT_VP8; + case HFI_VIDEO_CODEC_VP9: + return V4L2_PIX_FMT_VP9; + case HFI_VIDEO_CODEC_DIVX: + case HFI_VIDEO_CODEC_DIVX_311: + return V4L2_PIX_FMT_XVID; + default: + return 0; + } +} + +static int venus_enumerate_codecs(struct venus_core *core, u32 type) +{ + const struct hfi_inst_ops dummy_ops = {}; + struct venus_inst *inst; + u32 codec, codecs; + unsigned int i; + int ret; + + if (core->res->hfi_version != HFI_VERSION_1XX) + return 0; + + inst = kzalloc(sizeof(*inst), GFP_KERNEL); + if (!inst) + return -ENOMEM; + + mutex_init(&inst->lock); + inst->core = core; + inst->session_type = type; + if (type == VIDC_SESSION_TYPE_DEC) + codecs = core->dec_codecs; + else + codecs = core->enc_codecs; + + ret = hfi_session_create(inst, &dummy_ops); + if (ret) + goto err; + + for (i = 0; i < MAX_CODEC_NUM; i++) { + codec = (1 << i) & codecs; + if (!codec) + continue; + + ret = hfi_session_init(inst, to_v4l2_codec_type(codec)); + if (ret) + goto done; + + ret = hfi_session_deinit(inst); + if (ret) + goto done; + } + +done: + hfi_session_destroy(inst); +err: + mutex_destroy(&inst->lock); + kfree(inst); + + return ret; +} + static int venus_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -219,6 +296,14 @@ static int venus_probe(struct platform_device *pdev) if (ret) goto err_venus_shutdown; + ret = venus_enumerate_codecs(core, VIDC_SESSION_TYPE_DEC); + if (ret) + goto err_venus_shutdown; + + ret = venus_enumerate_codecs(core, VIDC_SESSION_TYPE_ENC); + if (ret) + goto err_venus_shutdown; + ret = v4l2_device_register(dev, &core->v4l2_dev); if (ret) goto err_core_deinit; diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index b5b9a84e9155..fe2d2b9e8af8 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -57,6 +57,29 @@ struct venus_format { u32 type; }; +#define MAX_PLANES 4 +#define MAX_FMT_ENTRIES 32 +#define MAX_CAP_ENTRIES 32 +#define MAX_CODEC_NUM 32 + +struct raw_formats { + u32 buftype; + u32 fmt; +}; + +struct venus_caps { + u32 codec; + u32 domain; + bool cap_bufs_mode_dynamic; + unsigned int num_caps; + struct hfi_capability caps[MAX_CAP_ENTRIES]; + unsigned int num_pl; + struct hfi_profile_level pl[HFI_MAX_PROFILE_COUNT]; + unsigned int num_fmts; + struct raw_formats fmts[MAX_FMT_ENTRIES]; + bool valid; +}; + /** * struct venus_core - holds core parameters valid for all instances * @@ -120,6 +143,8 @@ struct venus_core { void *priv; const struct hfi_ops *ops; struct delayed_work work; + struct venus_caps caps[MAX_CODEC_NUM]; + unsigned int codecs_count; }; struct vdec_controls { @@ -224,22 +249,8 @@ 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_width: width capability - * @cap_height: height capability - * @cap_mbs_per_frame: macroblocks per frame capability - * @cap_mbs_per_sec: macroblocks per second capability - * @cap_framerate: framerate capability - * @cap_scale_x: horizontal scaling capability - * @cap_scale_y: vertical scaling capability - * @cap_bitrate: bitrate capability - * @cap_hier_p: hier capability - * @cap_ltr_count: LTR count capability - * @cap_secure_output2_threshold: secure OUTPUT2 threshold capability * @cap_bufs_mode_static: buffers allocation mode capability * @cap_bufs_mode_dynamic: buffers allocation mode capability - * @pl_count: count of supported profiles/levels - * @pl: supported profiles/levels - * @bufreq: holds buffer requirements */ struct venus_inst { struct list_head list; @@ -276,6 +287,7 @@ struct venus_inst { bool reconfig; u32 reconfig_width; u32 reconfig_height; + u32 hfi_codec; u32 sequence_cap; u32 sequence_out; struct v4l2_m2m_dev *m2m_dev; @@ -287,22 +299,8 @@ struct venus_inst { const struct hfi_inst_ops *ops; u32 session_type; union hfi_get_property hprop; - struct hfi_capability cap_width; - struct hfi_capability cap_height; - struct hfi_capability cap_mbs_per_frame; - struct hfi_capability cap_mbs_per_sec; - struct hfi_capability cap_framerate; - struct hfi_capability cap_scale_x; - struct hfi_capability cap_scale_y; - struct hfi_capability cap_bitrate; - struct hfi_capability cap_hier_p; - struct hfi_capability cap_ltr_count; - struct hfi_capability cap_secure_output2_threshold; bool cap_bufs_mode_static; bool cap_bufs_mode_dynamic; - unsigned int pl_count; - struct hfi_profile_level pl[HFI_MAX_PROFILE_COUNT]; - struct hfi_buffer_requirements bufreq[HFI_BUFFER_TYPE_MAX]; }; #define IS_V1(core) ((core)->res->hfi_version == HFI_VERSION_1XX) @@ -322,4 +320,18 @@ static inline void *to_hfi_priv(struct venus_core *core) return core->priv; } +static inline struct venus_caps * +venus_caps_by_codec(struct venus_core *core, u32 codec, u32 domain) +{ + unsigned int c; + + for (c = 0; c < MAX_CODEC_NUM; c++) { + if (core->caps[c].codec == codec && + core->caps[c].domain == domain) + return &core->caps[c]; + } + + return NULL; +} + #endif diff --git a/drivers/media/platform/qcom/venus/hfi.c b/drivers/media/platform/qcom/venus/hfi.c index a570fdad0de0..94ca27b0bb99 100644 --- a/drivers/media/platform/qcom/venus/hfi.c +++ b/drivers/media/platform/qcom/venus/hfi.c @@ -203,13 +203,12 @@ int hfi_session_init(struct venus_inst *inst, u32 pixfmt) { struct venus_core *core = inst->core; const struct hfi_ops *ops = core->ops; - u32 codec; int ret; - codec = to_codec_type(pixfmt); + inst->hfi_codec = to_codec_type(pixfmt); reinit_completion(&inst->done); - ret = ops->session_init(inst, inst->session_type, codec); + ret = ops->session_init(inst, inst->session_type, inst->hfi_codec); if (ret) return ret; diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h index 1bc5aab1ce6b..64cc2bc946ee 100644 --- a/drivers/media/platform/qcom/venus/hfi_helper.h +++ b/drivers/media/platform/qcom/venus/hfi_helper.h @@ -858,10 +858,23 @@ struct hfi_uncompressed_format_select { u32 format; }; +struct hfi_uncompressed_plane_constraints { + u32 stride_multiples; + u32 max_stride; + u32 min_plane_buffer_height_multiple; + u32 buffer_alignment; +}; + +struct hfi_uncompressed_plane_info { + u32 format; + u32 num_planes; + struct hfi_uncompressed_plane_constraints plane_format[1]; +}; + struct hfi_uncompressed_format_supported { u32 buffer_type; u32 format_entries; - u32 format_info[1]; + struct hfi_uncompressed_plane_info format_info[1]; }; struct hfi_uncompressed_plane_actual { @@ -875,19 +888,6 @@ struct hfi_uncompressed_plane_actual_info { struct hfi_uncompressed_plane_actual plane_format[1]; }; -struct hfi_uncompressed_plane_constraints { - u32 stride_multiples; - u32 max_stride; - u32 min_plane_buffer_height_multiple; - u32 buffer_alignment; -}; - -struct hfi_uncompressed_plane_info { - u32 format; - u32 num_planes; - struct hfi_uncompressed_plane_constraints plane_format[1]; -}; - struct hfi_uncompressed_plane_actual_constraints_info { u32 buffer_type; u32 num_planes; diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c b/drivers/media/platform/qcom/venus/hfi_msgs.c index 023802e62833..8a943f53a12b 100644 --- a/drivers/media/platform/qcom/venus/hfi_msgs.c +++ b/drivers/media/platform/qcom/venus/hfi_msgs.c @@ -21,6 +21,7 @@ #include "hfi.h" #include "hfi_helper.h" #include "hfi_msgs.h" +#include "hfi_parser.h" static void event_seq_changed(struct venus_core *core, struct venus_inst *inst, struct hfi_msg_event_notify_pkt *pkt) @@ -219,81 +220,30 @@ static void hfi_sys_init_done(struct venus_core *core, struct venus_inst *inst, void *packet) { struct hfi_msg_sys_init_done_pkt *pkt = packet; - u32 rem_bytes, read_bytes = 0, num_properties; - u32 error, ptype; - u8 *data; + u32 rem_bytes, num_properties, error; error = pkt->error_type; if (error != HFI_ERR_NONE) - goto err_no_prop; + goto done; num_properties = pkt->num_properties; if (!num_properties) { error = HFI_ERR_SYS_INVALID_PARAMETER; - goto err_no_prop; + goto done; } rem_bytes = pkt->hdr.size - sizeof(*pkt) + sizeof(u32); - if (!rem_bytes) { /* missing property data */ error = HFI_ERR_SYS_INSUFFICIENT_RESOURCES; - goto err_no_prop; + goto done; } - data = (u8 *)&pkt->data[0]; - - if (core->res->hfi_version == HFI_VERSION_3XX) - goto err_no_prop; - - while (num_properties && rem_bytes >= sizeof(u32)) { - ptype = *((u32 *)data); - data += sizeof(u32); - - switch (ptype) { - case HFI_PROPERTY_PARAM_CODEC_SUPPORTED: { - struct hfi_codec_supported *prop; - - prop = (struct hfi_codec_supported *)data; - - if (rem_bytes < sizeof(*prop)) { - error = HFI_ERR_SYS_INSUFFICIENT_RESOURCES; - break; - } - - read_bytes += sizeof(*prop) + sizeof(u32); - core->dec_codecs = prop->dec_codecs; - core->enc_codecs = prop->enc_codecs; - break; - } - case HFI_PROPERTY_PARAM_MAX_SESSIONS_SUPPORTED: { - struct hfi_max_sessions_supported *prop; - - if (rem_bytes < sizeof(*prop)) { - error = HFI_ERR_SYS_INSUFFICIENT_RESOURCES; - break; - } - - prop = (struct hfi_max_sessions_supported *)data; - read_bytes += sizeof(*prop) + sizeof(u32); - core->max_sessions_supported = prop->max_sessions; - break; - } - default: - error = HFI_ERR_SYS_INVALID_PARAMETER; - break; - } - - if (error) - break; - - rem_bytes -= read_bytes; - data += read_bytes; - num_properties--; - } + error = hfi_parser(core, inst, num_properties, &pkt->data[0], + rem_bytes); -err_no_prop: +done: core->error = error; complete(&core->done); } @@ -371,51 +321,6 @@ static void hfi_sys_pc_prepare_done(struct venus_core *core, dev_dbg(core->dev, "pc prepare done (error %x)\n", pkt->error_type); } -static void -hfi_copy_cap_prop(struct hfi_capability *in, struct venus_inst *inst) -{ - if (!in || !inst) - return; - - switch (in->capability_type) { - case HFI_CAPABILITY_FRAME_WIDTH: - inst->cap_width = *in; - break; - case HFI_CAPABILITY_FRAME_HEIGHT: - inst->cap_height = *in; - break; - case HFI_CAPABILITY_MBS_PER_FRAME: - inst->cap_mbs_per_frame = *in; - break; - case HFI_CAPABILITY_MBS_PER_SECOND: - inst->cap_mbs_per_sec = *in; - break; - case HFI_CAPABILITY_FRAMERATE: - inst->cap_framerate = *in; - break; - case HFI_CAPABILITY_SCALE_X: - inst->cap_scale_x = *in; - break; - case HFI_CAPABILITY_SCALE_Y: - inst->cap_scale_y = *in; - break; - case HFI_CAPABILITY_BITRATE: - inst->cap_bitrate = *in; - break; - case HFI_CAPABILITY_HIER_P_NUM_ENH_LAYERS: - inst->cap_hier_p = *in; - break; - case HFI_CAPABILITY_ENC_LTR_COUNT: - inst->cap_ltr_count = *in; - break; - case HFI_CAPABILITY_CP_OUTPUT2_THRESH: - inst->cap_secure_output2_threshold = *in; - break; - default: - break; - } -} - static unsigned int session_get_prop_profile_level(struct hfi_msg_session_property_info_pkt *pkt, struct hfi_profile_level *profile_level) @@ -505,238 +410,11 @@ static void hfi_session_prop_info(struct venus_core *core, complete(&inst->done); } -static u32 init_done_read_prop(struct venus_core *core, struct venus_inst *inst, - struct hfi_msg_session_init_done_pkt *pkt) -{ - struct device *dev = core->dev; - u32 rem_bytes, num_props; - u32 ptype, next_offset = 0; - u32 err; - u8 *data; - - rem_bytes = pkt->shdr.hdr.size - sizeof(*pkt) + sizeof(u32); - if (!rem_bytes) { - dev_err(dev, "%s: missing property info\n", __func__); - return HFI_ERR_SESSION_INSUFFICIENT_RESOURCES; - } - - err = pkt->error_type; - if (err) - return err; - - data = (u8 *)&pkt->data[0]; - num_props = pkt->num_properties; - - while (err == HFI_ERR_NONE && num_props && rem_bytes >= sizeof(u32)) { - ptype = *((u32 *)data); - next_offset = sizeof(u32); - - switch (ptype) { - case HFI_PROPERTY_PARAM_CODEC_MASK_SUPPORTED: { - struct hfi_codec_mask_supported *masks = - (struct hfi_codec_mask_supported *) - (data + next_offset); - - next_offset += sizeof(*masks); - num_props--; - break; - } - case HFI_PROPERTY_PARAM_CAPABILITY_SUPPORTED: { - struct hfi_capabilities *caps; - struct hfi_capability *cap; - u32 num_caps; - - if ((rem_bytes - next_offset) < sizeof(*cap)) { - err = HFI_ERR_SESSION_INVALID_PARAMETER; - break; - } - - caps = (struct hfi_capabilities *)(data + next_offset); - - num_caps = caps->num_capabilities; - cap = &caps->data[0]; - next_offset += sizeof(u32); - - while (num_caps && - (rem_bytes - next_offset) >= sizeof(u32)) { - hfi_copy_cap_prop(cap, inst); - cap++; - next_offset += sizeof(*cap); - num_caps--; - } - num_props--; - break; - } - case HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SUPPORTED: { - struct hfi_uncompressed_format_supported *prop = - (struct hfi_uncompressed_format_supported *) - (data + next_offset); - u32 num_fmt_entries; - u8 *fmt; - struct hfi_uncompressed_plane_info *inf; - - if ((rem_bytes - next_offset) < sizeof(*prop)) { - err = HFI_ERR_SESSION_INVALID_PARAMETER; - break; - } - - num_fmt_entries = prop->format_entries; - next_offset = sizeof(*prop) - sizeof(u32); - fmt = (u8 *)&prop->format_info[0]; - - dev_dbg(dev, "uncomm format support num entries:%u\n", - num_fmt_entries); - - while (num_fmt_entries) { - struct hfi_uncompressed_plane_constraints *cnts; - u32 bytes_to_skip; - - inf = (struct hfi_uncompressed_plane_info *)fmt; - - if ((rem_bytes - next_offset) < sizeof(*inf)) { - err = HFI_ERR_SESSION_INVALID_PARAMETER; - break; - } - - dev_dbg(dev, "plane info: fmt:%x, planes:%x\n", - inf->format, inf->num_planes); - - cnts = &inf->plane_format[0]; - dev_dbg(dev, "%u %u %u %u\n", - cnts->stride_multiples, - cnts->max_stride, - cnts->min_plane_buffer_height_multiple, - cnts->buffer_alignment); - - bytes_to_skip = sizeof(*inf) - sizeof(*cnts) + - inf->num_planes * sizeof(*cnts); - - fmt += bytes_to_skip; - next_offset += bytes_to_skip; - num_fmt_entries--; - } - num_props--; - break; - } - case HFI_PROPERTY_PARAM_PROPERTIES_SUPPORTED: { - struct hfi_properties_supported *prop = - (struct hfi_properties_supported *) - (data + next_offset); - - next_offset += sizeof(*prop) - sizeof(u32) - + prop->num_properties * sizeof(u32); - num_props--; - break; - } - case HFI_PROPERTY_PARAM_PROFILE_LEVEL_SUPPORTED: { - struct hfi_profile_level_supported *prop = - (struct hfi_profile_level_supported *) - (data + next_offset); - struct hfi_profile_level *pl; - unsigned int prop_count = 0; - unsigned int count = 0; - u8 *ptr; - - ptr = (u8 *)&prop->profile_level[0]; - prop_count = prop->profile_count; - - if (prop_count > HFI_MAX_PROFILE_COUNT) - prop_count = HFI_MAX_PROFILE_COUNT; - - while (prop_count) { - ptr++; - pl = (struct hfi_profile_level *)ptr; - - inst->pl[count].profile = pl->profile; - inst->pl[count].level = pl->level; - prop_count--; - count++; - ptr += sizeof(*pl) / sizeof(u32); - } - - inst->pl_count = count; - next_offset += sizeof(*prop) - sizeof(*pl) + - prop->profile_count * sizeof(*pl); - - num_props--; - break; - } - case HFI_PROPERTY_PARAM_INTERLACE_FORMAT_SUPPORTED: { - next_offset += - sizeof(struct hfi_interlace_format_supported); - num_props--; - break; - } - case HFI_PROPERTY_PARAM_NAL_STREAM_FORMAT_SUPPORTED: { - struct hfi_nal_stream_format *nal = - (struct hfi_nal_stream_format *) - (data + next_offset); - dev_dbg(dev, "NAL format: %x\n", nal->format); - next_offset += sizeof(*nal); - num_props--; - break; - } - case HFI_PROPERTY_PARAM_NAL_STREAM_FORMAT_SELECT: { - next_offset += sizeof(u32); - num_props--; - break; - } - case HFI_PROPERTY_PARAM_MAX_SEQUENCE_HEADER_SIZE: { - u32 *max_seq_sz = (u32 *)(data + next_offset); - - dev_dbg(dev, "max seq header sz: %x\n", *max_seq_sz); - next_offset += sizeof(u32); - num_props--; - break; - } - case HFI_PROPERTY_PARAM_VENC_INTRA_REFRESH: { - next_offset += sizeof(struct hfi_intra_refresh); - num_props--; - break; - } - case HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE_SUPPORTED: { - struct hfi_buffer_alloc_mode_supported *prop = - (struct hfi_buffer_alloc_mode_supported *) - (data + next_offset); - unsigned int i; - - for (i = 0; i < prop->num_entries; i++) { - if (prop->buffer_type == HFI_BUFFER_OUTPUT || - prop->buffer_type == HFI_BUFFER_OUTPUT2) { - switch (prop->data[i]) { - case HFI_BUFFER_MODE_STATIC: - inst->cap_bufs_mode_static = true; - break; - case HFI_BUFFER_MODE_DYNAMIC: - inst->cap_bufs_mode_dynamic = true; - break; - default: - break; - } - } - } - next_offset += sizeof(*prop) - - sizeof(u32) + prop->num_entries * sizeof(u32); - num_props--; - break; - } - default: - dev_dbg(dev, "%s: default case %#x\n", __func__, ptype); - break; - } - - rem_bytes -= next_offset; - data += next_offset; - } - - return err; -} - static void hfi_session_init_done(struct venus_core *core, struct venus_inst *inst, void *packet) { struct hfi_msg_session_init_done_pkt *pkt = packet; - unsigned int error; + u32 rem_bytes, error; error = pkt->error_type; if (error != HFI_ERR_NONE) @@ -745,8 +423,14 @@ static void hfi_session_init_done(struct venus_core *core, if (core->res->hfi_version != HFI_VERSION_1XX) goto done; - error = init_done_read_prop(core, inst, pkt); + rem_bytes = pkt->shdr.hdr.size - sizeof(*pkt) + sizeof(u32); + if (!rem_bytes) { + error = HFI_ERR_SESSION_INSUFFICIENT_RESOURCES; + goto done; + } + error = hfi_parser(core, inst, pkt->num_properties, &pkt->data[0], + rem_bytes); done: inst->error = error; complete(&inst->done); diff --git a/drivers/media/platform/qcom/venus/hfi_parser.c b/drivers/media/platform/qcom/venus/hfi_parser.c new file mode 100644 index 000000000000..f9181d999b23 --- /dev/null +++ b/drivers/media/platform/qcom/venus/hfi_parser.c @@ -0,0 +1,295 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2018 Linaro Ltd. + * + * Author: Stanimir Varbanov + */ +#include + +#include "core.h" +#include "hfi_helper.h" +#include "hfi_parser.h" + +typedef void (*func)(struct venus_caps *cap, void *data, unsigned int size); + +static void init_codecs_vcaps(struct venus_core *core) +{ + struct venus_caps *caps = core->caps; + struct venus_caps *cap; + unsigned int i; + + for (i = 0; i < 8 * sizeof(core->dec_codecs); i++) { + if ((1 << i) & core->dec_codecs) { + cap = &caps[core->codecs_count++]; + cap->codec = (1 << i) & core->dec_codecs; + cap->domain = VIDC_SESSION_TYPE_DEC; + cap->valid = false; + } + } + + for (i = 0; i < 8 * sizeof(core->enc_codecs); i++) { + if ((1 << i) & core->enc_codecs) { + cap = &caps[core->codecs_count++]; + cap->codec = (1 << i) & core->enc_codecs; + cap->domain = VIDC_SESSION_TYPE_ENC; + cap->valid = false; + } + } +} + +static void for_each_codec(struct venus_caps *caps, unsigned int caps_num, + u32 codecs, u32 domain, func cb, void *data, + unsigned int size) +{ + struct venus_caps *cap; + unsigned int i; + + for (i = 0; i < caps_num; i++) { + cap = &caps[i]; + if (cap->valid && cap->domain == domain) + continue; + if (cap->codec & codecs && cap->domain == domain) + cb(cap, data, size); + } +} + +static void fill_buf_mode(struct venus_caps *cap, void *data, unsigned int num) +{ + u32 *type = data; + + if (*type == HFI_BUFFER_MODE_DYNAMIC) + cap->cap_bufs_mode_dynamic = true; +} + +static void parse_alloc_mode(struct venus_core *core, struct venus_inst *inst, + u32 codecs, u32 domain, void *data) +{ + struct hfi_buffer_alloc_mode_supported *mode = data; + u32 num_entries = mode->num_entries; + u32 *type; + + if (num_entries > 16) + return; + + type = mode->data; + + 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; + + for_each_codec(core->caps, ARRAY_SIZE(core->caps), + codecs, domain, fill_buf_mode, type, 1); + } + + type++; + } +} + +static void parse_profile_level(u32 codecs, u32 domain, void *data) +{ + struct hfi_profile_level_supported *pl = data; + struct hfi_profile_level *proflevel = pl->profile_level; + u32 count = pl->profile_count; + + if (count > HFI_MAX_PROFILE_COUNT) + return; + + while (count) { + proflevel = (void *)proflevel + sizeof(*proflevel); + count--; + } +} + +static void fill_caps(struct venus_caps *cap, void *data, unsigned int num) +{ + struct hfi_capability *caps = data; + unsigned int i; + + for (i = 0; i < num; i++) + cap->caps[cap->num_caps++] = caps[i]; +} + +static void parse_caps(struct venus_core *core, struct venus_inst *inst, + u32 codecs, u32 domain, void *data) +{ + struct hfi_capabilities *caps = data; + struct hfi_capability *cap = caps->data; + u32 num_caps = caps->num_capabilities; + struct hfi_capability caps_arr[MAX_CAP_ENTRIES] = {}; + unsigned int i = 0; + + if (num_caps > MAX_CAP_ENTRIES) + return; + + while (num_caps) { + caps_arr[i++] = *cap; + cap = (void *)cap + sizeof(*cap); + num_caps--; + } + + for_each_codec(core->caps, ARRAY_SIZE(core->caps), codecs, domain, + fill_caps, caps_arr, i); +} + +static void fill_raw_fmts(struct venus_caps *cap, void *fmts, + unsigned int num_fmts) +{ + struct raw_formats *formats = fmts; + unsigned int i; + + for (i = 0; i < num_fmts; i++) + cap->fmts[cap->num_fmts++] = formats[i]; +} + +static void parse_raw_formats(struct venus_core *core, struct venus_inst *inst, + u32 codecs, u32 domain, void *data) +{ + struct hfi_uncompressed_format_supported *fmt = data; + struct hfi_uncompressed_plane_info *pinfo = fmt->format_info; + struct hfi_uncompressed_plane_constraints *constr; + u32 entries = fmt->format_entries; + u32 num_planes; + struct raw_formats rfmts[MAX_FMT_ENTRIES] = {}; + unsigned int i = 0; + + while (entries) { + num_planes = pinfo->num_planes; + + rfmts[i].fmt = pinfo->format; + rfmts[i].buftype = fmt->buffer_type; + i++; + + if (pinfo->num_planes > MAX_PLANES) + break; + + constr = pinfo->plane_format; + + while (pinfo->num_planes) { + constr = (void *)constr + sizeof(*constr); + pinfo->num_planes--; + } + + pinfo = (void *)pinfo + sizeof(*constr) * num_planes + + 2 * sizeof(u32); + entries--; + } + + for_each_codec(core->caps, ARRAY_SIZE(core->caps), codecs, domain, + fill_raw_fmts, rfmts, i); +} + +static void parse_codecs(struct venus_core *core, void *data) +{ + struct hfi_codec_supported *codecs = data; + + core->dec_codecs = codecs->dec_codecs; + core->enc_codecs = codecs->enc_codecs; + + if (core->res->hfi_version == HFI_VERSION_1XX) { + core->dec_codecs &= ~HFI_VIDEO_CODEC_HEVC; + core->dec_codecs &= ~HFI_VIDEO_CODEC_SPARK; + } +} + +static void parse_max_sessions(struct venus_core *core, void *data) +{ + struct hfi_max_sessions_supported *sessions = data; + + core->max_sessions_supported = sessions->max_sessions; +} + +static void parse_codecs_mask(u32 *codecs, u32 *domain, void *data) +{ + struct hfi_codec_mask_supported *mask = data; + + *codecs = mask->codecs; + *domain = mask->video_domains; +} + +static void parser_init(struct venus_core *core, struct venus_inst *inst, + u32 *codecs, u32 *domain) +{ + if (core->res->hfi_version != HFI_VERSION_1XX) + return; + + if (!inst) + return; + + *codecs = inst->hfi_codec; + *domain = inst->session_type; +} + +static void parser_fini(struct venus_core *core, struct venus_inst *inst, + u32 codecs, u32 domain) +{ + struct venus_caps *caps = core->caps; + struct venus_caps *cap; + u32 dom; + unsigned int i; + + if (core->res->hfi_version != HFI_VERSION_1XX) + return; + + if (!inst) + return; + + dom = inst->session_type; + + for (i = 0; i < MAX_CODEC_NUM; i++) { + cap = &caps[i]; + if (cap->codec & codecs && cap->domain == dom) + cap->valid = true; + } +} + +u32 hfi_parser(struct venus_core *core, struct venus_inst *inst, + u32 num_properties, void *buf, u32 size) +{ + unsigned int words_count = size >> 2; + u32 *word = buf, *data, codecs = 0, domain = 0; + + if (size % 4) + return HFI_ERR_SYS_INSUFFICIENT_RESOURCES; + + parser_init(core, inst, &codecs, &domain); + + while (words_count) { + data = word + 1; + + switch (*word) { + case HFI_PROPERTY_PARAM_CODEC_SUPPORTED: + parse_codecs(core, data); + init_codecs_vcaps(core); + break; + case HFI_PROPERTY_PARAM_MAX_SESSIONS_SUPPORTED: + parse_max_sessions(core, data); + break; + case HFI_PROPERTY_PARAM_CODEC_MASK_SUPPORTED: + parse_codecs_mask(&codecs, &domain, data); + break; + case HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SUPPORTED: + parse_raw_formats(core, inst, codecs, domain, data); + break; + case HFI_PROPERTY_PARAM_CAPABILITY_SUPPORTED: + parse_caps(core, inst, codecs, domain, data); + break; + case HFI_PROPERTY_PARAM_PROFILE_LEVEL_SUPPORTED: + parse_profile_level(codecs, domain, data); + break; + case HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE_SUPPORTED: + parse_alloc_mode(core, inst, codecs, domain, data); + break; + default: + break; + } + + word++; + words_count--; + } + + parser_fini(core, inst, codecs, domain); + + return HFI_ERR_NONE; +} diff --git a/drivers/media/platform/qcom/venus/hfi_parser.h b/drivers/media/platform/qcom/venus/hfi_parser.h new file mode 100644 index 000000000000..c484ac91a8e2 --- /dev/null +++ b/drivers/media/platform/qcom/venus/hfi_parser.h @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2018 Linaro Ltd. */ +#ifndef __VENUS_HFI_PARSER_H__ +#define __VENUS_HFI_PARSER_H__ + +#include "core.h" + +u32 hfi_parser(struct venus_core *core, struct venus_inst *inst, + u32 num_properties, void *buf, u32 size); + +static inline struct hfi_capability *get_cap(struct venus_inst *inst, u32 type) +{ + struct venus_core *core = inst->core; + struct venus_caps *caps; + unsigned int i; + + caps = venus_caps_by_codec(core, inst->hfi_codec, inst->session_type); + if (!caps) + return ERR_PTR(-EINVAL); + + for (i = 0; i < MAX_CAP_ENTRIES; i++) { + if (caps->caps[i].capability_type == type) + return &caps->caps[i]; + } + + return ERR_PTR(-EINVAL); +} + +#define CAP_MIN(inst, type) ((get_cap(inst, type))->min) +#define CAP_MAX(inst, type) ((get_cap(inst, type))->max) +#define CAP_STEP(inst, type) ((get_cap(inst, type))->step_size) + +#define FRAME_WIDTH_MIN(inst) CAP_MIN(inst, HFI_CAPABILITY_FRAME_WIDTH) +#define FRAME_WIDTH_MAX(inst) CAP_MAX(inst, HFI_CAPABILITY_FRAME_WIDTH) +#define FRAME_WIDTH_STEP(inst) CAP_STEP(inst, HFI_CAPABILITY_FRAME_WIDTH) + +#define FRAME_HEIGHT_MIN(inst) CAP_MIN(inst, HFI_CAPABILITY_FRAME_HEIGHT) +#define FRAME_HEIGHT_MAX(inst) CAP_MAX(inst, HFI_CAPABILITY_FRAME_HEIGHT) +#define FRAME_HEIGHT_STEP(inst) CAP_STEP(inst, HFI_CAPABILITY_FRAME_HEIGHT) + +#define FRATE_MIN(inst) CAP_MIN(inst, HFI_CAPABILITY_FRAMERATE) +#define FRATE_MAX(inst) CAP_MAX(inst, HFI_CAPABILITY_FRAMERATE) +#define FRATE_STEP(inst) CAP_STEP(inst, HFI_CAPABILITY_FRAMERATE) + +#endif diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index c45452634e7e..3b38bd1241b0 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -24,6 +24,7 @@ #include #include "hfi_venus_io.h" +#include "hfi_parser.h" #include "core.h" #include "helpers.h" #include "vdec.h" @@ -177,10 +178,10 @@ vdec_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f) pixmp->height = 720; } - pixmp->width = clamp(pixmp->width, inst->cap_width.min, - inst->cap_width.max); - pixmp->height = clamp(pixmp->height, inst->cap_height.min, - inst->cap_height.max); + pixmp->width = clamp(pixmp->width, FRAME_WIDTH_MIN(inst), + FRAME_WIDTH_MAX(inst)); + pixmp->height = clamp(pixmp->height, FRAME_HEIGHT_MIN(inst), + FRAME_HEIGHT_MAX(inst)); if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) pixmp->height = ALIGN(pixmp->height, 32); @@ -442,12 +443,12 @@ static int vdec_enum_framesizes(struct file *file, void *fh, fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE; - fsize->stepwise.min_width = inst->cap_width.min; - fsize->stepwise.max_width = inst->cap_width.max; - fsize->stepwise.step_width = inst->cap_width.step_size; - fsize->stepwise.min_height = inst->cap_height.min; - fsize->stepwise.max_height = inst->cap_height.max; - fsize->stepwise.step_height = inst->cap_height.step_size; + fsize->stepwise.min_width = FRAME_WIDTH_MIN(inst); + fsize->stepwise.max_width = FRAME_WIDTH_MAX(inst); + fsize->stepwise.step_width = FRAME_WIDTH_STEP(inst); + fsize->stepwise.min_height = FRAME_HEIGHT_MIN(inst); + fsize->stepwise.max_height = FRAME_HEIGHT_MAX(inst); + fsize->stepwise.step_height = FRAME_HEIGHT_STEP(inst); return 0; } @@ -902,22 +903,7 @@ static void vdec_inst_init(struct venus_inst *inst) inst->fps = 30; inst->timeperframe.numerator = 1; inst->timeperframe.denominator = 30; - - inst->cap_width.min = 64; - inst->cap_width.max = 1920; - if (inst->core->res->hfi_version == HFI_VERSION_3XX) - inst->cap_width.max = 3840; - inst->cap_width.step_size = 1; - inst->cap_height.min = 64; - inst->cap_height.max = ALIGN(1080, 32); - if (inst->core->res->hfi_version == HFI_VERSION_3XX) - inst->cap_height.max = ALIGN(2160, 32); - inst->cap_height.step_size = 1; - inst->cap_framerate.min = 1; - inst->cap_framerate.max = 30; - inst->cap_framerate.step_size = 1; - inst->cap_mbs_per_frame.min = 16; - inst->cap_mbs_per_frame.max = 8160; + inst->hfi_codec = HFI_VIDEO_CODEC_H264; } static const struct v4l2_m2m_ops vdec_m2m_ops = { diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index bc8c2e7a8d2c..be8ea3326386 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -24,6 +24,7 @@ #include #include "hfi_venus_io.h" +#include "hfi_parser.h" #include "core.h" #include "helpers.h" #include "venc.h" @@ -301,10 +302,10 @@ venc_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f) pixmp->height = 720; } - pixmp->width = clamp(pixmp->width, inst->cap_width.min, - inst->cap_width.max); - pixmp->height = clamp(pixmp->height, inst->cap_height.min, - inst->cap_height.max); + pixmp->width = clamp(pixmp->width, FRAME_WIDTH_MIN(inst), + FRAME_WIDTH_MAX(inst)); + pixmp->height = clamp(pixmp->height, FRAME_HEIGHT_MIN(inst), + FRAME_HEIGHT_MAX(inst)); if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) pixmp->height = ALIGN(pixmp->height, 32); @@ -553,12 +554,12 @@ static int venc_enum_framesizes(struct file *file, void *fh, if (fsize->index) return -EINVAL; - fsize->stepwise.min_width = inst->cap_width.min; - fsize->stepwise.max_width = inst->cap_width.max; - fsize->stepwise.step_width = inst->cap_width.step_size; - fsize->stepwise.min_height = inst->cap_height.min; - fsize->stepwise.max_height = inst->cap_height.max; - fsize->stepwise.step_height = inst->cap_height.step_size; + fsize->stepwise.min_width = FRAME_WIDTH_MIN(inst); + fsize->stepwise.max_width = FRAME_WIDTH_MAX(inst); + fsize->stepwise.step_width = FRAME_WIDTH_STEP(inst); + fsize->stepwise.min_height = FRAME_HEIGHT_MIN(inst); + fsize->stepwise.max_height = FRAME_HEIGHT_MAX(inst); + fsize->stepwise.step_height = FRAME_HEIGHT_STEP(inst); return 0; } @@ -586,18 +587,18 @@ static int venc_enum_frameintervals(struct file *file, void *fh, if (!fival->width || !fival->height) return -EINVAL; - if (fival->width > inst->cap_width.max || - fival->width < inst->cap_width.min || - fival->height > inst->cap_height.max || - fival->height < inst->cap_height.min) + if (fival->width > FRAME_WIDTH_MAX(inst) || + fival->width < FRAME_WIDTH_MIN(inst) || + fival->height > FRAME_HEIGHT_MAX(inst) || + fival->height < FRAME_HEIGHT_MIN(inst)) return -EINVAL; fival->stepwise.min.numerator = 1; - fival->stepwise.min.denominator = inst->cap_framerate.max; + fival->stepwise.min.denominator = FRATE_MAX(inst); fival->stepwise.max.numerator = 1; - fival->stepwise.max.denominator = inst->cap_framerate.min; + fival->stepwise.max.denominator = FRATE_MIN(inst); fival->stepwise.step.numerator = 1; - fival->stepwise.step.denominator = inst->cap_framerate.max; + fival->stepwise.step.denominator = FRATE_MAX(inst); return 0; } @@ -1091,22 +1092,7 @@ static void venc_inst_init(struct venus_inst *inst) inst->fps = 15; inst->timeperframe.numerator = 1; inst->timeperframe.denominator = 15; - - inst->cap_width.min = 96; - inst->cap_width.max = 1920; - if (inst->core->res->hfi_version == HFI_VERSION_3XX) - inst->cap_width.max = 3840; - inst->cap_width.step_size = 2; - inst->cap_height.min = 64; - inst->cap_height.max = ALIGN(1080, 32); - if (inst->core->res->hfi_version == HFI_VERSION_3XX) - inst->cap_height.max = ALIGN(2160, 32); - inst->cap_height.step_size = 2; - inst->cap_framerate.min = 1; - inst->cap_framerate.max = 30; - inst->cap_framerate.step_size = 1; - inst->cap_mbs_per_frame.min = 24; - inst->cap_mbs_per_frame.max = 8160; + inst->hfi_codec = HFI_VIDEO_CODEC_H264; } static int venc_open(struct file *file) From patchwork Tue May 15 07:58:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135843 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp672903lji; Tue, 15 May 2018 01:04:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo/KCasOZCSVsKNeIHDPnqBPUSqzTIPFc5X2NbF/1MCwmsGikwfiZeyFJPnW4CFpnaabyLI X-Received: by 2002:a17:902:b908:: with SMTP id bf8-v6mr13169066plb.358.1526371480426; Tue, 15 May 2018 01:04:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371480; cv=none; d=google.com; s=arc-20160816; b=e62pYqr988ItBdRai6rp2neQBkSV6yCX57XfkG2go2weAhrghFliQqpQXIXTbgy38+ 1SN8oGa1TZU957xpu3vAyfWPe+zd0GA9dJwpcztMfLzOom0zhZWmDL9tpGgnPY2IkBxp cK4c9b5GM8yxEkSSXGsQ0o14hzpL1sWizUPydAn1BJUZ1/QJcCOfXXf/lnMX3m6RMk+7 ReHIdrH4V6QkdbhJ4otFxJwiCVYZPF21RKj77px/LQelvFCcUwmBw6oe0OwTcIPA02Nj 4+B68fT6wA/3ttNfeaVId3pj79vxDk4CWpq53/ROcPbOm0L3hXEo0GesEYWrzvO12Ht3 mYbg== 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=N3frKovU6D+244ryArLGCq4QJaJotXxoCOQlJ6G7Cas=; b=aLGFXfVqTqXEVcbsAk2iv8fZuaep5QvHuwx0f12/jaY3b3jRNKjFVuoXg+8dN9od9q QyymyKvo6I1/UZCNcomWd+vqibdKOVePl3QHl53Dlf9kCZxVhLh75F90g3ZCvPcY+4Lq GN6U1B3NAdSWr0GAU31UTx0lOnCXSud+zp4FJl5OMRdQlxhwvfKr7aUgKF4HbEb5wksl VAM4bhnUXBZhgqqEeNMtSvGO+fNOP9FQyhMSm1W12VDOygmFYmXiNx5rXu6tpI/bWe6Y ZWgiM8zFshiCHF7R7xgO6GYiiklDzLRDbgkEFJFXpV+UJpiHSXC45NrV5r+2UIXEd2Hk 65Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PGpb6Ztv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d11-v6si11242351pfh.131.2018.05.15.01.04.40; Tue, 15 May 2018 01:04:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PGpb6Ztv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752602AbeEOH7v (ORCPT + 29 others); Tue, 15 May 2018 03:59:51 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:37181 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752485AbeEOH7p (ORCPT ); Tue, 15 May 2018 03:59:45 -0400 Received: by mail-wm0-f66.google.com with SMTP id l1-v6so19722457wmb.2 for ; Tue, 15 May 2018 00:59:44 -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=N3frKovU6D+244ryArLGCq4QJaJotXxoCOQlJ6G7Cas=; b=PGpb6ZtvU6PITz0RJ/IGWQiVfrKjn2meockZos9e7JzME0DMKgHJaKiS7zJAcSbr+7 FX2a1BaYzkIS8QkpU443wHXG5VDS097GeGIoK56prAmWM4BVU6rbQOBk5yUp4o46JzKF xOFOs9tczfSBdR3JnRFtazp7LXJA4XdPu0zW8= 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=N3frKovU6D+244ryArLGCq4QJaJotXxoCOQlJ6G7Cas=; b=eXMg7MDosZw5v5jrZh9GrLD/wganmCOxoEmBJZbP3rE++jv7StXASZ3rocqGbAyn9M RIjquy48k8AwTPDHHfAvYI0Pi93CuG373MlFL31fJvNHNO7qA/AzAliIWeGajZFDbQgE h3sb/ok2yYbgnqFvxDHSC3zPCnazqb9qlUr0BKKFGX6n82WmWe2zl0PnVI2qjgb3fZpY FBcAgotMcGaMD8KgbEBOiaOOlch1WGYwkudmb49cedLkVZyU0X58UT5UlAU6oNPegK/t oANBfguqahEX2jRPx5xYVbpzCNrPCX6dy2c21qlW7fa+AOaTywHGirx6/G9TFDp7BXT3 1lsw== X-Gm-Message-State: ALKqPwctiQfugvpiqGjxQlX+VLfgkVU8CG1B/d/bbKiaXDSIPJXH4gD1 HVaDgiI2rzI0r/l1TRp9ER88BQ== X-Received: by 2002:a1c:824b:: with SMTP id e72-v6mr6952942wmd.64.1526371183962; Tue, 15 May 2018 00:59:43 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:43 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 15/29] venus: helpers: rename a helper function and use buffer mode from caps Date: Tue, 15 May 2018 10:58:45 +0300 Message-Id: <20180515075859.17217-16-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 2b21f6ed7502..1eda19adbf28 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -354,18 +354,19 @@ 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 inline int 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; + if (caps->cap_bufs_mode_dynamic) + return 1; + + return 0; } static int session_unregister_bufs(struct venus_inst *inst) @@ -374,7 +375,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) { @@ -394,7 +395,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 Tue May 15 07:58:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135833 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp668332lji; Tue, 15 May 2018 00:59:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp+fhvjAkmgg3K30HG3slRy2WCKMCIhKlC/jf4htFhKLd7VNxtjGWdNnjZ4eIqC24liW8qf X-Received: by 2002:a62:3f4e:: with SMTP id m75-v6mr13841066pfa.176.1526371198676; Tue, 15 May 2018 00:59:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371198; cv=none; d=google.com; s=arc-20160816; b=YjX89qYH42syH32XnooylEXNy5PkMMLiMuVBf17MpLdU0o/jRJewgcIpgiaMVNYSbY 9sAwNIyaZZAKCyCEIuV59yqJZMuCMyZxh6pajGg9lKF2aTX+bkTDt0hZPbDY9PaqEsNI MQGWWwuRoSr6Am+V0ZbV71EvvFpvjXl2oPgtS7pvvqcysRJ5bZv4sSQud3UcGRbzSXLj 9ckDvuocjEFNz3Uv+u+b3CjOFJQUW4DahgrLCatYYIw/5QOPuBIWpr8kJION92XAUwQ9 KykJVVsf2002UWbSaUtD1R0dUba6cUfUyfPB6jvamz3shb2ZPcwV0F3MuIiMLhAbTz2d blyA== 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=3Xf+55afhjoDcaeKubJqAzHOIUCCK3ZQ+JCHq5q9y4E=; b=Ybkdo/PqKmf2NR0MuNkys2mm6aVhhYwz01BVoL5MgIA/uTV9jKT6OUPCvBDAF+PqIi tS9SQmjCJ10YcfGyXdnML1rRQBAJCwWcKaPZKBhs0Ahtsf5D0OV/ESNvemNg88X0G/+s 4rkGo1gMQWxp+vPk84FP8BxslcpywHoXUGGwCUi7j9VI4A7XnR3ddV0KTVx0dMdfHK6I wNhEIybNtNensSSEk/JbixOcI3+HZZx3m9+dUl2Fu/0KG/Kbr15eyzAfJKQSzVCZu9dW 8NSznP0kJY2gnx6TUF1X+zNfBs8tQO09iyLEiM33OdSQgFH6us4xK3JdWZ2D2O6QmGeZ OYeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ewneyThd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r10-v6si8803116pgs.647.2018.05.15.00.59.58; Tue, 15 May 2018 00:59:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ewneyThd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752631AbeEOH7z (ORCPT + 29 others); Tue, 15 May 2018 03:59:55 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:53280 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752557AbeEOH7q (ORCPT ); Tue, 15 May 2018 03:59:46 -0400 Received: by mail-wm0-f67.google.com with SMTP id a67-v6so17596225wmf.3 for ; Tue, 15 May 2018 00:59:45 -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=3Xf+55afhjoDcaeKubJqAzHOIUCCK3ZQ+JCHq5q9y4E=; b=ewneyThdcAqzj4RqNgCUyAhUSfTCPVBdqcepApBNK95kril48klFM501kfC7OXEgY/ JQq2yUDUjO0RYs8lIxnWrkPww19HnIz787hUwOBqwJluTgU5gr3cC+dVrX7J5iCTJTSs i7tM0o98fmP5cAdmYErSinPzuHHMPTzdRd8XI= 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=3Xf+55afhjoDcaeKubJqAzHOIUCCK3ZQ+JCHq5q9y4E=; b=UydqNOe8bjARVgA5ftfVhY9xyazQ/afHdOZ8iDggzJabFqVwk7vMUKHZoxCIDoE7s3 cplXH0G1lIGy1RUzBlorJbcYcTC4cbon4KkUYqu/VC3DbG3VLx1I9COqqVs+DQma8IU9 nJl9mitdTheOezxLyHbhk6uU2dd1yY8rKcU6KVFwltEvtTYL8la/Yf8FFA9Y9iQHgJrZ 2xLKkNQrlIHqTt2H7PLykZoLpJqwwOKjNbY6Hhx7aL991mSAxm4sxIvCu3JljQ2ctYOB GXrAgQoWSAl5mlINEPmlOhAXpHPcp1KgFmNEZf9kbGkEFac1gCt7ORnYtuwhyRCo9Ha7 9OTg== X-Gm-Message-State: ALKqPwfLJYUVR/5g3ZNXDGJok3ZL/2knqWIHXfZOpVrOcvTcbW7SSu3r JSeCHjei0thr6SElVUZNaqh6Ug== X-Received: by 2002:a1c:be0f:: with SMTP id o15-v6mr7463328wmf.104.1526371184956; Tue, 15 May 2018 00:59:44 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:44 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 16/29] venus: add a helper function to set dynamic buffer mode Date: Tue, 15 May 2018 10:58:46 +0300 Message-Id: <20180515075859.17217-17-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adds a new helper function to set dynamic buffer mode if it is supported by current HFI version. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 22 ++++++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 1 + drivers/media/platform/qcom/venus/vdec.c | 15 +++------------ 3 files changed, 26 insertions(+), 12 deletions(-) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 1eda19adbf28..824ad4d2d064 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -522,6 +522,28 @@ int venus_helper_set_color_format(struct venus_inst *inst, u32 pixfmt) } EXPORT_SYMBOL_GPL(venus_helper_set_color_format); +int venus_helper_set_dyn_bufmode(struct venus_inst *inst) +{ + u32 ptype = HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE; + struct hfi_buffer_alloc_mode mode; + int ret; + + if (!is_dynamic_bufmode(inst)) + return 0; + + mode.type = HFI_BUFFER_OUTPUT; + mode.mode = HFI_BUFFER_MODE_DYNAMIC; + + ret = hfi_session_set_property(inst, ptype, &mode); + if (ret) + return ret; + + mode.type = HFI_BUFFER_OUTPUT2; + + return hfi_session_set_property(inst, ptype, &mode); +} +EXPORT_SYMBOL_GPL(venus_helper_set_dyn_bufmode); + 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 0e64aa95624a..52b961ed491e 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -40,6 +40,7 @@ int venus_helper_set_output_resolution(struct venus_inst *inst, 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); 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 2bd81de6328a..271192273953 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -557,18 +557,9 @@ static int vdec_set_properties(struct venus_inst *inst) return ret; } - if (core->res->hfi_version == HFI_VERSION_3XX || - inst->cap_bufs_mode_dynamic) { - struct hfi_buffer_alloc_mode mode; - - ptype = HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE; - mode.type = HFI_BUFFER_OUTPUT; - mode.mode = HFI_BUFFER_MODE_DYNAMIC; - - ret = hfi_session_set_property(inst, ptype, &mode); - if (ret) - return ret; - } + ret = venus_helper_set_dyn_bufmode(inst); + if (ret) + return ret; if (ctr->post_loop_deb_mode) { ptype = HFI_PROPERTY_CONFIG_VDEC_POST_LOOP_DEBLOCKER; From patchwork Tue May 15 07:58:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135849 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp676694lji; Tue, 15 May 2018 01:08:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq4BemsAydPn0h6Xu6DC9i4Hq3AEWIG6GP/BANvwo+D6pwELZy4/4ghM2gpet4DecEPlpmf X-Received: by 2002:a63:ab45:: with SMTP id k5-v6mr6156877pgp.192.1526371702796; Tue, 15 May 2018 01:08:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371702; cv=none; d=google.com; s=arc-20160816; b=WfZsRZRkYK4MgvJ5dsCVqr2DFFS8woHnsEBGRirJvgxMDhHjpo1yxxs97JR5au11qb QqbxPzOhKGz80wqTmw8rwNmjxNhN5YtmWSCiOreJPdbri730PvRFbtO8fDtTOml/JzgN d4KvTea5JtAJNy0N+qwuN7hyrZUvv0m2VJilXebCA5EkkPFUguuKTMx98sG8uKLV1Fzm sgt9RjhYrls6uXzQShoQhfy9B9h+6E1hBB4kEVPG3+eOCZlvw09nuAmp5sjpUfj+oeFM yX0gFEI72G3NzdHUlVFimbSsSt15p85rv38GKDrpTMTj+Eh4A0Dbobsf0DpsC7xldzMD dLJA== 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=LGrG65w+692fXlrWbeO9piVjDIBa1EwxpwDxPY675l8=; b=CX/OYeW35/NoYoJNuXwSnwwub7lme0QugOlXuMgfSmKdEuXg8eA7KJs8m7OCR9b1hp m1oVpqWv87GuaDSzMs1s8nxiEDZx3Uj5nd+BEGOvO8HxB0ZvwZWBlAmeSQ1Y2sqvU7s6 XJ2ZH9OpDi9b9jaXSDG4Q5d9nNniuS0cyMVS2R4v8aAAbn84V0O0/Fm3QbEcOPl+H5kB oO2L13iu+OJ4YU626tP/rNeuTnswYVg5NZFTZqDeOa1nLrl/ktXld32NiuOMRQ0RuNwE fkfN6YOHwvBZhltlkDGC+BLNvtIcCngfcNt+7kcDLzkVoeLyhZaEOMWSdj+5Hq2vlLIG Fg/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AJH4E6M5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g9-v6si10965512plt.232.2018.05.15.01.08.22; Tue, 15 May 2018 01:08:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AJH4E6M5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752679AbeEOIGa (ORCPT + 29 others); Tue, 15 May 2018 04:06:30 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:36836 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752565AbeEOH7s (ORCPT ); Tue, 15 May 2018 03:59:48 -0400 Received: by mail-wr0-f194.google.com with SMTP id p4-v6so14930255wrh.3 for ; Tue, 15 May 2018 00:59:47 -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=LGrG65w+692fXlrWbeO9piVjDIBa1EwxpwDxPY675l8=; b=AJH4E6M5Wg6QWf6WyFF/lgjHp6vP+mo1e9qxLkr1uEJ1RUdB5w1L17q5UmxT99Y6yM TG4kU/MjxQIwcX6sKvCRU5LCGKFJZEaBRQmWmh0ANItr/F13cPuSGg03TaM/0nP9xTkM ft9OS6cByVR0nPtxMa9aY+SBBLU06+bV3RHn4= 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=LGrG65w+692fXlrWbeO9piVjDIBa1EwxpwDxPY675l8=; b=KS9OBKiSUflmY5DuZAL0DJ15SXobaqN93WYbiR3iPxm3h8Go19zaYaIOESXvUukuuf 0S/bTl6XXZ2zP10B4+gOlarfTmsEZtfwCL3yrT71TqNsPOJMZrNZw3QRS2gzR1iknZTS YxJd4Ub+Dq13dOvyfAjwLJUwQCm9kQJ8iVdCty0LXOgSeLQmlC0swfA6HVWbUwls1Ar9 KJERHZroorLPxW5trnfcoTzv7paAv5z5g77oq2yPQJbo+u1ilsQ9sTEBZpGVwdSni43Q 0oc0U9MRWDgWE05HIsxtR4EjQjWKzqq95IpY+DzjgsVG7m2QvyJJ5qqUf2lszl/0WNhx B8pQ== X-Gm-Message-State: ALKqPwfyPtfdJkcYtEPDlrQEEhHxdBgv7kmvnmAicZ5OU3wAl3OM7PPO oLYb+0z1FwM+FJusRraWrcjncg== X-Received: by 2002:adf:e38e:: with SMTP id e14-v6mr9169734wrm.198.1526371186947; Tue, 15 May 2018 00:59:46 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:46 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 18/29] venus: delete no longer used bufmode flag from instance Date: Tue, 15 May 2018 10:58:48 +0300 Message-Id: <20180515075859.17217-19-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Delete no longer used flag cap_bufs_mode_dynamic from instance structure. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 2 -- drivers/media/platform/qcom/venus/hfi_parser.c | 6 +----- 2 files changed, 1 insertion(+), 7 deletions(-) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index c46334454cd9..255292899204 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -249,7 +249,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_dynamic: buffers allocation mode capability */ struct venus_inst { struct list_head list; @@ -298,7 +297,6 @@ struct venus_inst { const struct hfi_inst_ops *ops; u32 session_type; union hfi_get_property hprop; - 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 f9181d999b23..ad039a3444b8 100644 --- a/drivers/media/platform/qcom/venus/hfi_parser.c +++ b/drivers/media/platform/qcom/venus/hfi_parser.c @@ -75,13 +75,9 @@ static void parse_alloc_mode(struct venus_core *core, struct venus_inst *inst, 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++; } From patchwork Tue May 15 07:58:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135850 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp677007lji; Tue, 15 May 2018 01:08:42 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpyYjOxrvulUqpZKpCmvkfUnucNoDxHSNyP4RJ1atULijwEIb2k9h9hOmsQB5MiUI/gNFJK X-Received: by 2002:a17:902:22cc:: with SMTP id o12-v6mr13799111plg.38.1526371722048; Tue, 15 May 2018 01:08:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371722; cv=none; d=google.com; s=arc-20160816; b=QoGK2L7FZgR94p96tw/CmO/NwRa2eYmrenD7b1xfCtGMA3O9acTPg6FiQ0vCsHgiq0 Ae1fA9oxYzIOgCnGfnZFyHjC1DCIEFeS0GrNuuxHgAQPys4WIBPSELjCkfA/XGATH9QO 3aMuq4MYmHgtjiJ2/9eNOx8kyBE8uBIDNrGAoRc6XbaABJ9l1gDawAQO0CGDzJvCW2sB KqaYXy+Zf5I1x7vk0kF0MfCsAoBHx+3xzvvSH3Vxi+UvwV+PwCqswRx68zAXsLhKCOYA Ndx2YcHXzes/RkNHyihvmcYjGXoSJ5Xnd2qpFnksXrpw7Zb4e5g8v1BQWRbxzDDvxGUL F4jw== 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=1lZp2O9BfjywiJT0LOLaR31PS0wYHF12CIuuGpujLE4=; b=w3fchFRe9caB5oMhUm91FictlKsalyPebAJ+t3yoQ+3snFmqSlvrFPmEXgKaZ+seTh 7BulB+e+nVob6SbnzTI8B4YCHxxL5N3+iJazeykP1fziz13Xa8bbF5Huea0Otvz0nApt c56SUO0O5K7MfMGFQqZF/CN8/MxMS40ye+FV8oRoakUdPz5NDXBRroEOBj4N59PiQvbm oyle+vmv1QZkIfXj+5SYq5ueH8J+SA9xhinWg5pO9DOgc/pcm6C4YLcxzIXlsNrVM194 t2EeJy0wCJk/Qh4yPKqZzM0X/CHZn6E/KSLQUl11WmgA0xIobu6g+zQOfmlo4fQzE26a cpww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b51aZ5GR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n10-v6si11080592pfe.70.2018.05.15.01.08.41; Tue, 15 May 2018 01:08:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b51aZ5GR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752564AbeEOIG1 (ORCPT + 29 others); Tue, 15 May 2018 04:06:27 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:41953 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752566AbeEOH7t (ORCPT ); Tue, 15 May 2018 03:59:49 -0400 Received: by mail-wr0-f194.google.com with SMTP id g21-v6so14879817wrb.8 for ; Tue, 15 May 2018 00:59:48 -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=1lZp2O9BfjywiJT0LOLaR31PS0wYHF12CIuuGpujLE4=; b=b51aZ5GRJjxo2TSLk4W6tTCDp5KwAnvmVyGdW/OkBpTPjl6gy3Jy3LrqB61mNRhEjM XIDQOWkvJWgoei5XZvtK6a0nvBxaFY2pQRhr2BJ3DjqhdsTrmOxa09Mn1U0qjTQX7Cls xTAp2Kf05Ja1PXRFLZ2FkkWQV1ER5yEc1ImpY= 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=1lZp2O9BfjywiJT0LOLaR31PS0wYHF12CIuuGpujLE4=; b=T40v8sc3YWxyuJLL1sZT8uYcTZhsz3IPqUEHL3HXLZIMnlfsYt+SAHzNZ3nLNC+Cu9 1j57wtDTVIPbrEcfhxo5n6Fzd0hY2jYXl7baGmyx9kUolKFj/756HirSId1G9nKsSs0Y cWf/OYV2Dsar6szbx6oYwqFNDAoqJJ1weDNYf7+9PhMhLXKL8RzMnaTID0ccGQ2r47Xb pkgUOgZ+MeLT04nT+eQhxAfvLgn7EsmIu3u3KImeDbSRZY5V07aeXl6OyI9bc84fvYbY IHikmT+qvhdhTAAsgk0+EpdQsPiTBY2IVAbam7w6nAq1sKIlgivx28OhRks3W9l44kgw Qsjg== X-Gm-Message-State: ALKqPwcW0GhqpdBlMpAYv4Y4mhovICB31D40KwTi4r9F2BEQVVjx76bZ Ww4Q0UuEwVBAB+QoDpIpYExxMw== X-Received: by 2002:adf:b00f:: with SMTP id f15-v6mr10547679wra.254.1526371187931; Tue, 15 May 2018 00:59:47 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:47 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 19/29] venus: helpers: add buffer type argument to a helper Date: Tue, 15 May 2018 10:58:49 +0300 Message-Id: <20180515075859.17217-20-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds one more function argument to pass buffer type to set_output_resolution() helper function. That is a preparation to support secondary decoder output. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 5 +++-- drivers/media/platform/qcom/venus/helpers.h | 3 ++- drivers/media/platform/qcom/venus/venc.c | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 94664a3ce3e2..5512fbfdebb9 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -456,12 +456,13 @@ int venus_helper_set_input_resolution(struct venus_inst *inst, EXPORT_SYMBOL_GPL(venus_helper_set_input_resolution); int venus_helper_set_output_resolution(struct venus_inst *inst, - unsigned int width, unsigned int height) + unsigned int width, unsigned int height, + u32 buftype) { u32 ptype = HFI_PROPERTY_PARAM_FRAME_SIZE; struct hfi_framesize fs; - fs.buffer_type = HFI_BUFFER_OUTPUT; + fs.buffer_type = buftype; fs.width = width; fs.height = height; diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index cd306bd8978f..0de9989adcdb 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -36,7 +36,8 @@ int venus_helper_get_bufreq(struct venus_inst *inst, u32 type, 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, - unsigned int width, unsigned int height); + unsigned int width, unsigned int height, + u32 buftype); 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); diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index f87d891325ea..8970f14b3a82 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -795,7 +795,8 @@ static int venc_init_session(struct venus_inst *inst) goto deinit; ret = venus_helper_set_output_resolution(inst, inst->width, - inst->height); + inst->height, + HFI_BUFFER_OUTPUT); if (ret) goto deinit; From patchwork Tue May 15 07:58: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: 135846 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp674040lji; Tue, 15 May 2018 01:05:53 -0700 (PDT) X-Google-Smtp-Source: AB8JxZofqZv7SUFYt4yxB9+qu1Y3YxV0CPtZgrBIwKa4tTJRYZqG0LXfKoiVVYKWL8S8WDm8z+Sf X-Received: by 2002:a62:4b16:: with SMTP id y22-v6mr14042740pfa.29.1526371553336; Tue, 15 May 2018 01:05:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371553; cv=none; d=google.com; s=arc-20160816; b=F5XLSnmhp8e53UU0qQVl1QneYJ0AHxJI7UakOPC7i6WiW3hcdKufHkyHfz8Go1QnVD V1hmjnIlKnVqrPDp2+GHvf4/9InReuZcg1EhK9k/GWVs0Dy7C3SlSykZ0UXR5uU1XkR+ kP0ND3AfsrhUKI540KKIGsnmWXBuBSwDOSbcSvOk8BilSYt2lkp8zHYFjmUglc1KmBQh gDlHpTDXg1A1Ny9v/poeqKOFG8w9NCNsFyZ6/vyM60vbLoa7QQwLOhuGHtZo9S9bPXRB NYueduK6Bdm+bG+dAgCZ/RV4TkbmCoia/1ei47USF2sNiNsbLkAsH4HudLDDg3VqecUX YcvA== 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=tE7ddrHDV+3yc9f38Cj9wFWsLbTExF8lwsgINEJhw3E=; b=I3nOpspPKFRVlOuNg6j7NzeUvpnsaVxjNaC3cF+zWUP3Rf4fCurMTpiM4p6S+gJBdj arAA0nRMAlRmMYA4fb+uZzelcQjgbNLq3PrmhuUm6yy99Cl6CrumEy3YQrO55+w/tRnm mJuHwDKU8ggdOhHbPDH1mIAeLBswheBeTYpmmUOQe5NhuhwzP1witrFE+uD4fD1q9RNn eRXyXAqJW5OP3IcmdjqaYq+iKhuhhwUvHLQu/xA3qVLEjNSREHjrGbnXZ+F+vEMEf/it dNy6agF9frJEBLyVV7XJh8FDmFye5AbjCyrvL1MMowfNF/TwgZIlZr+rdkrdMZFJKbI4 nJ4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hntoyzcd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w135-v6si11050722pff.340.2018.05.15.01.05.53; Tue, 15 May 2018 01:05:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hntoyzcd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752626AbeEOIFt (ORCPT + 29 others); Tue, 15 May 2018 04:05:49 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:33884 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752571AbeEOH7u (ORCPT ); Tue, 15 May 2018 03:59:50 -0400 Received: by mail-wr0-f194.google.com with SMTP id p18-v6so14910563wrm.1 for ; Tue, 15 May 2018 00:59:49 -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=HntoyzcdLDQcfT7eysUu5YtnLS5Q7+KnpsPSf9xkdeiwQa/WIHqYwvJUTIURHJoQz9 is/BZ6NR2QFjcxJpPX5t3mRdhauw6zZtrrGzscqEfwqFLWFXTfhm2hy4FNFdXIiaJecs lU/ZZUwT2lfmjfArz+fhekFoSCOr2OLrQa/NU= 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=oLJu+aaqqIdaeiJzfZi6hIe9p5U4X44ni1nRqmVIaPsfL0oIZGVonyU0QR27GdbSzg ygmjioi2TubEFsnMqRuOPH5FbI0B55tGqm43iGg4vQwjMgo24zZdiRLyvyp2g0ApCBQB uJXTk3nceZt8INWg9vBIIuplDtRmTwMIhoGrZnr0j+YFqh1gQEkph0WMrHXBFRA0sik0 ieRj8Oe8Kv3NMzE2jBSsHIdFuB8TQvW/7shY77VphS3VZlhZxc+6FBCOemlUsjkzWBBF 8vT+UHTd+MblT4+SweZM0HeQgYe+tqa3PRwC6If47sSAY5FHaKK3EBfYjJKger4EBR79 fq6w== X-Gm-Message-State: ALKqPwd15NsebRL3gKUxwB6n0UWMPjZnhZNCtjeXzEj9N8+8vM36eGwO hakU1oXxhczr6pSSBkEng630qw== X-Received: by 2002:adf:8756:: with SMTP id 22-v6mr8742713wrz.117.1526371188913; Tue, 15 May 2018 00:59:48 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:48 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 20/29] venus: helpers: add a new helper to set raw format Date: Tue, 15 May 2018 10:58:50 +0300 Message-Id: <20180515075859.17217-21-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 May 15 07:58:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135844 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp673031lji; Tue, 15 May 2018 01:04:50 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqUlwGJhe2ZNB0a5AMRHfTTChTHgYoVd0jYCAP2XzRXLJ/RtbAYkJH4jf3OleObc74sQ5/w X-Received: by 2002:a63:63c5:: with SMTP id x188-v6mr10889095pgb.302.1526371490250; Tue, 15 May 2018 01:04:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371490; cv=none; d=google.com; s=arc-20160816; b=wT7KQUL6drY0Pa086u537yvb1Q2xuTyT/bddhWuGi4Qv/hxbCLfI3UEIik2yAdYPeb Qukt5fy8izGW40lg0GkT8GVwy2dQw0c2EtSjlfzF38ogMFzI47ffJng2AlNfze9zvao/ p6gQlIeBSm0GaWkss4VQ8KraOS0jF4C2rNBZIBXZa7AYWn+bJfn5YZ4oOmobqPpZyxAi YyWUgm6w4lxMqnIrPNLDN2GlxjVlFvvzyCYZO10lg/lKF9mQe7wms7vsBBV8x+6kptHc UrTCnciSdN2H1YmlWYauq2Xutd3OrjUMAa4Kxrsh/i+L6/t/w9w43cjnKjabxwh9TjNh hW9Q== 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=LRKdSFC0W7+6iXp+TLBSpemgpy27cGrdsW/F6vKvVU0=; b=X4LIT4SzgeZT+77lAjwEzFmQU4hDuXEv8Jffo6kHKgFPttkOrtlLG8yPjBhSHIegd2 gLxKboJxXaZGJrFro48drvhw7vpmwS2qO/UxrNEHvFV7GBZKPs5eawptVd0di8nGBcYF xV2EUyY6U9f8IfrSjgtreYjDXEnlTaV7UiPsgJ89IKUXojvdpBRvpRw6p8PPSCDwpLbX 8yx5oaHPLjwJHgAd1iJilZ8o6MYQgegEIfGi5pV3J2GBhR3IgTqGJLg04jQWF25dlTRX QcY8zfoAdAl+S8JAxQMXJG4aCAxh3ST8jHMLLIAuTOG7mduGIk6ldie6IAeRV98NDzz3 OI+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P9Ib0j7p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15-v6si8905180pgs.308.2018.05.15.01.04.49; Tue, 15 May 2018 01:04:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P9Ib0j7p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752666AbeEOIEn (ORCPT + 29 others); Tue, 15 May 2018 04:04:43 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:44869 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752584AbeEOH7v (ORCPT ); Tue, 15 May 2018 03:59:51 -0400 Received: by mail-wr0-f193.google.com with SMTP id y15-v6so14880718wrg.11 for ; Tue, 15 May 2018 00:59:50 -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=LRKdSFC0W7+6iXp+TLBSpemgpy27cGrdsW/F6vKvVU0=; b=P9Ib0j7pr0I3GUJQbRmdPsgCU0dE9O5OjUIU8MnDWdbEjmpTcmTVk/DC6e5hq1SYmO 7nPZ4ZD7OY38V0tX4bVywdxeMNj4beqaAnzXnhxOI50W67uEA9S18LNzTNRg4WZ8w+Xa wfwteJT7YjbDwwVB1unCvdP4HnNZtYzBrouBk= 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=LRKdSFC0W7+6iXp+TLBSpemgpy27cGrdsW/F6vKvVU0=; b=ITB0Y7sA8pDvngNcMnwgAQ2Rw9v4tUyX1e89ppeUmWBGHWKwBe/fsKdmFva+aEeYQ9 BDRqUpv8FESnYMcxf4pt0j2BDIq1pcjLGcrH9cEjv/oP2F06AcJhao8DqE/WGFcibtSs 0yTIDjY/z6+5FKcLIWap5HKb7M4T2sIyuQzjEensuO3JGD8vlvI79EjJILhQskYie5JQ oiDdyn3w/u8IhK/ZTV7hHPVOugl3p+xAL2g4+RwJHTxy3XoHCVEhqGvPDGK3JSRawGu4 REAOuTC1OcNRPzk8JWgLAxf2/qI1HhOcT/7qlZcTAktFCl641kBZ1MIjcXmEWWuiqC48 shLQ== X-Gm-Message-State: ALKqPwfSkYTVhcXX+kT3hImQQUp/70JZivP4G/i383+JwwCnZ6sCkq63 TM7avzX070zlwwiznmCjFrW2Fg== X-Received: by 2002:adf:e549:: with SMTP id z9-v6mr9085642wrm.186.1526371189918; Tue, 15 May 2018 00:59:49 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:49 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 21/29] venus: helpers, vdec, venc: add helpers to set work mode and core usage Date: Tue, 15 May 2018 10:58:51 +0300 Message-Id: <20180515075859.17217-22-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 e8e00d0650e9..3c7ffebe4bad 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 May 15 07:58: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: 135845 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp673301lji; Tue, 15 May 2018 01:05:09 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpWrjHvorppu/e3TQEKv9D5ZUko+IQKLYztaJAyAIUv1OaLIM0OjtuwU7NBBA4VpnEp1LMS X-Received: by 2002:a63:5f95:: with SMTP id t143-v6mr11093334pgb.165.1526371509321; Tue, 15 May 2018 01:05:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371509; cv=none; d=google.com; s=arc-20160816; b=Axu6AQcfw0IsG7H0JksO1XFWrxBDtcGGPyVYsgxcSOcs7XM5gxQIPWs3bGVBj4zE42 j+yR7XgzNngUQAbIKgb4L/3uLnXuGUFzVvcxW429gNZvzzCGWnwIXWsajCj/BMuWIodJ 5Qd4+VaeZNgQ46pmXgn1tB4SsPPJ5MgJ9jijMXjgILsKvEoyms5Ao/5X84byzPM/BVtU Efs71BmhZLR1uOlJiGjSuNd0BQl4m/zimzMSEzgSWLX3dvnX6OWBS8uQbHgrcAEnofME bw9pte4+XHb6hza8/drr/Kcq7dYoBCDK585tmTzpsoXst1cd5R+VcWUKS9MMwQ0WnfHx +kQg== 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=o3kwc509SWtxtHy8ZRhQbfMYwCPzJ2epVMtoq9RNABU=; b=sdNPZeX2lSYXqyT+iQktdmmth5FdL/6Nrlvma4kJTsJ+EF5hUWcmG/F9Vg3qaFI8l/ P96CT6538TgBel3ajufnN42e0ZNsiEe74g3TYkby8efsQ9jDM8NjjDu4h5u56dRcTrL+ MJ980og/T3Ozl19AJR2qBgp4OEhDOqosld3UEyMnxAioPDd3JS75y385+N71FiAwjc/C qCaMh7AAJcTC6AyoGq00kVXm4Iy7PdNUTNz3sMHkGoNFZjJH8mlvwTkkI6gfru2ACvK4 XYOu+S5Y1JwwiS/7IGQgpJZRsLVQExZYrMVaZ76btd7BweKmVX0j/seIe8aeMVL/PV2S EECw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TBU2fWez; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15-v6si8905180pgs.308.2018.05.15.01.05.09; Tue, 15 May 2018 01:05:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TBU2fWez; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752604AbeEOIEj (ORCPT + 29 others); Tue, 15 May 2018 04:04:39 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:42171 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752599AbeEOH7w (ORCPT ); Tue, 15 May 2018 03:59:52 -0400 Received: by mail-wr0-f196.google.com with SMTP id v5-v6so14902957wrf.9 for ; Tue, 15 May 2018 00:59:51 -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=o3kwc509SWtxtHy8ZRhQbfMYwCPzJ2epVMtoq9RNABU=; b=TBU2fWezRYovGDlfctUWmqgC7mb694zA5THOAk480bG/yaRyQn9BSAu4AHkuw6q96q 4w6C17wuVlgoFfLPv5XUSFVBc67iwdSGs23a3J36Z3ov2hNp97/T7EKkSmMBrAxC0GWq XjsBec1742WqKSXknmn1Wewat8ORmvqecT4kw= 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=o3kwc509SWtxtHy8ZRhQbfMYwCPzJ2epVMtoq9RNABU=; b=TWeK977SnTdMw+ccgCe4QI1h3SBSf0Zu8ipNxTcGKQ0cL+dJBuVlaik807BMD265Am f/B04tU1S6+7VFLaQjdrgyxJl6AjpKyQvspjL1EUZp8eRvfSWIn7IEMXO01+ol3ShzSh DAg2OL7YN0UKkAZ+N/xbGXHZ6WsCuaeSG99cGHyG6S3Et4fNXGPlJVNk9z/WSKkppg3/ JtMQbhCOvBjHkf0bDy+GPUJMyocMhrgUmEqOyhVV594E5Uvw9MVab4CIcmSmvbErcFVb lpyDyIldseluqJleH8Nt8mxxDMKiazUqqnduocF9uQqPbjJzXyGELf/Y2VLf0VyVizRn qIxw== X-Gm-Message-State: ALKqPwe9C5Q21JZqrRafKq+kU8HL0qO1QJXcb0NKJzOAnKMaGRFlPk/2 8I9aiOlc9RbDj7uxkMdcNRhsaw== X-Received: by 2002:adf:9ed0:: with SMTP id b16-v6mr8619696wrf.170.1526371190889; Tue, 15 May 2018 00:59:50 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:50 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 22/29] venus: helpers: extend set_num_bufs helper with one more argument Date: Tue, 15 May 2018 10:58:52 +0300 Message-Id: <20180515075859.17217-23-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 3c7ffebe4bad..898c5edb91f5 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 May 15 07:58:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135842 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp671173lji; Tue, 15 May 2018 01:02:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo+kclnZ2lHYcNTYgC7sdoDmyKb0l3VcZRjKP11N+qFf4kRhq6fdo2xBpWH3ClNLwlIYzyG X-Received: by 2002:a65:5003:: with SMTP id f3-v6mr7261071pgo.433.1526371361558; Tue, 15 May 2018 01:02:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371361; cv=none; d=google.com; s=arc-20160816; b=RPLRJI4+6HK8N1XRg/w5atteuFCI3uOH5mgevgkzjEZGVdFVPddbbAMCXUHvlt844Y 5WpUg66Hee5lsXts2eBlUGNEEWURLr65uC/6bvxtxWF8DFrQwelPb4pm+ahbi2N1ofHw 46SBuum1ufFi+f2ZQOmgkn8IwWOGzZDSD/0LQzrxm6L3nvbl4+STz2Jbf/iajZ72hOmg UR4d5nK3/D02JE42x/usjV/FP1Nv6t0WB8VykD2r63MKM3Kxminv71tnJxPimnuN55hK AuUuo9kpqcvOUmI3F6E0USr0Ax4bLz/13rPSOdZH280mfVNMbqW0K0BsRcCuC9K7e0/r R8AA== 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=hWZfGvfu/2NalLUr9US+fWfp5Cl3dsxLRK8jVW0R1to=; b=Bdn3MfeTIFTVPe0UvVm9mI8Ap2DmBiAeUDWbQwfCM25qtHkxwXvopJwSQ2RsMxZQyq vqidjmzRd8RXDbnk+QfLofkT1PXAafHCj13JPGnGxdDTrCq4WLZGqgyuMAUK2WGbfEvV e4PihrRdGFxh8Wr2xLI48rAGWAc7p8rQA/iQTm5ozfiKLspP4tT1mj+r2/PdO4H93nzI Dv27WqsV1gFNU7xwRZlldH4rKzmLbFsPfDhdtk09VFVUI9ZG7XZIaLjWoQSqPo7Tpwml eA9d89DFQzBu2mQwRYFQQOV+OLD5KR2FLt/meIMYgHLjsKy3cryQRVN0fwkW3QmiUYsn WaQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MgK4hmBD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m79-v6si11224021pfi.236.2018.05.15.01.02.41; Tue, 15 May 2018 01:02:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MgK4hmBD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752687AbeEOICj (ORCPT + 29 others); Tue, 15 May 2018 04:02:39 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:37214 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752485AbeEOH7x (ORCPT ); Tue, 15 May 2018 03:59:53 -0400 Received: by mail-wr0-f194.google.com with SMTP id h5-v6so14902933wrm.4 for ; Tue, 15 May 2018 00:59:52 -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=MgK4hmBDadyXeaBvily/j+KQ2LBkGgVfN86lRx/mWoj114KiMMKVxsF+gyq2gYdeKj y53wvg3iWMhfE5Z6uN1Q3KNm2HOpeHeu8l1DguNL8vGiS02SR7xy8rerXONn+5TbTJBw I4Y7tX/9Htv4lhzc7Ddt0p6XBFh0XH87iPxMU= 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=SyTYXdnAUb+dbyIuoWaqZMKR1h66NBwqN421SFpTocKcth9duFAfqfVdvqK+oQjVr9 nOVhX5K9dFzO/pdBOmSRElZgr2NyRLHm6Nra/n0oQK5QyCJltBdstDwiyw4h7VwoEBQO dzM8ebExJrmvHz2TMtugjKn81qebReA2Pcxtzd0rrdJITF22cNdbuTwtbbbPZnxmi6Qe KF4DisaJNA2lmk11lkFxNk5yjTwKY1yuByh0KhfCJpQoKdVQypKceiXFyzyR34qRrSHL 35xIK3eGMdAmVr+TiMWnyIw9TRPRoUWaKPTnLg1Dws225a5nirmIBC3p4bHyAuMH+9w3 FdBA== X-Gm-Message-State: ALKqPwcyl8mY425ooiGnauAax2SRMjORCn7141gSdS+YYno77MOZt98P xcIVsL9lOOLFDHC67kwuiK9JPQ== X-Received: by 2002:adf:9615:: with SMTP id b21-v6mr9417489wra.253.1526371191906; Tue, 15 May 2018 00:59:51 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:51 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 23/29] venus: helpers: add a helper to return opb buffer sizes Date: Tue, 15 May 2018 10:58:53 +0300 Message-Id: <20180515075859.17217-24-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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); From patchwork Tue May 15 07:58:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135839 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp670503lji; Tue, 15 May 2018 01:02:00 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqW1qCqZUl1Nca2XSP1SSfj5hc6WoeVohX/yLnWsrNuDl2zo8Z6cfkFarwaDx+/usxuYoRy X-Received: by 2002:a62:f80c:: with SMTP id d12-v6mr14068752pfh.159.1526371320684; Tue, 15 May 2018 01:02:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371320; cv=none; d=google.com; s=arc-20160816; b=DaD8vekYnqLz2IUMH7HwDBoGcc4v9hGRhfhOs8uz9bklJoyf6FiwGi/F1qIYSu83L5 oMNAL70/tfaEl6FuvNhLbHt6sec3EoMKX1HU5ApvhrZiTQZGTsYzPH8tl34gF//aP1G4 3Egs5gGAqyOE31t1MTEUM70gN7FK/5tNmdHyKqPfEOykaQqeiWG9sUcWREiWZuPiH5CQ zmqxlUDL0HDBrAz0S0R2VFBTdYmmdobjLA3U1vF4JqfdGA8JDfMt+6onKIA7Vol0PnGY jqQNuLzEBQAk1CYgFcHRPc6ZJNgy9nqtZanFmC3wpcvEo8nTRFILaKxtW3Lh5MN+1KMP ++aQ== 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=a98vy368Ek8kav7BscKJ5dhB9a5blZNgWY5G48n3VjI=; b=aIefbQ31y67Ft0SPfLDaUEeJ3DF/6PIhlWAh5eoM6wmUD3Sugh5oQQPu44TLGKRYvb /FCsOXGLRJtFSA6vEp+1tfocqWcnXEDAFvl/7k1SWFeMvxUGlKrRFuvCiFDFiPqrCAoH 8XPRoAnE3Vas1oHKfXUMo/1Fm/g3skhpy3F1V+jzN+ICllAFi/tpElty2AnreYWZdnSg sUzS2QlZ12UeYa7FXIXTCzgAS/3rotsj0ywufVL3L5E+MhHVTTH8mFrus3gZF4n5K3jy 4t/+wPAI7XMsW0SZzEvgxBFTzJeZMBixRO8OvrUWegmzVFniPNoPp7vQjYA6lGlW1Z0P H49w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R2I7QHdx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4-v6si9528859pgn.54.2018.05.15.01.02.00; Tue, 15 May 2018 01:02:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R2I7QHdx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752733AbeEOIB6 (ORCPT + 29 others); Tue, 15 May 2018 04:01:58 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:46013 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752608AbeEOH7y (ORCPT ); Tue, 15 May 2018 03:59:54 -0400 Received: by mail-wr0-f196.google.com with SMTP id p5-v6so14886605wre.12 for ; Tue, 15 May 2018 00:59:53 -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=a98vy368Ek8kav7BscKJ5dhB9a5blZNgWY5G48n3VjI=; b=R2I7QHdxOmAk0EZqcE9a4UoK0Z72LVs85KMFxGAV5cXGmb6+Nwp3y9oOzcZAY7GGnO W61hP/ZHaV7FniqjHn2KdgHkQXsiDUi56W8KQI3Bwmzq9RtyD153hLiRtuqEOc6/Hfol pRfod6uxl3ibG0rH7lp+mKdfnpJ+OaRVPn3g4= 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=a98vy368Ek8kav7BscKJ5dhB9a5blZNgWY5G48n3VjI=; b=Qk4wNUNXt+vTNjP6T7T009aQKmr7heVqaL14MTybIMTFAOtLoeDJwm80KzoLV49b5F jPUSp1VjgHPWfZXWAasY7odaRpFZGXY9ahFpQA2mAagSBg6JvvcyfJKGqk9ZlTQymGmC jeANIf+oiCG6OUa8LSeSwd7UnrVwVttYS4wheLwCX57nTJRZFvOxik6W8cLmnWklarU8 EkIjJ2GTLOVtd7X3abKOhMKfudU5QxwXxY9aatMSNL94JbeslGP8K5h8UY4UM4n1qWLU KnLYghZi+T24p8jDn7EyMcOwNk7ft0yyoZdFL3cGXCEIEqQj6s7Ifm7AonFciieGOvsQ Ei0Q== X-Gm-Message-State: ALKqPwcGgVi1Bk+zoZqLqfganS9j+mEJm7NBXhuyJqDxqThAkBJUQNXa 2XPodCMo0fGw6dMU16Jm1edCpw== X-Received: by 2002:adf:93e5:: with SMTP id 92-v6mr9515965wrp.230.1526371192936; Tue, 15 May 2018 00:59:52 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:52 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 24/29] venus: vdec: get required input buffers as well Date: Tue, 15 May 2018 10:58:54 +0300 Message-Id: <20180515075859.17217-25-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rework and rename vdec_cap_num_buffers() to get the number of input buffers too. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/vdec.c | 41 +++++++++++++++++++------------- 1 file changed, 24 insertions(+), 17 deletions(-) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 898c5edb91f5..5a5e3e2fece4 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -603,19 +603,32 @@ static int vdec_init_session(struct venus_inst *inst) return ret; } -static int vdec_cap_num_buffers(struct venus_inst *inst, unsigned int *num) +static int vdec_num_buffers(struct venus_inst *inst, unsigned int *in_num, + unsigned int *out_num) { + enum hfi_version ver = inst->core->res->hfi_version; struct hfi_buffer_requirements bufreq; int ret; + *in_num = *out_num = 0; + ret = vdec_init_session(inst); if (ret) return ret; + ret = venus_helper_get_bufreq(inst, HFI_BUFFER_INPUT, &bufreq); + if (ret) + goto deinit; + + *in_num = HFI_BUFREQ_COUNT_MIN(&bufreq, ver); + ret = venus_helper_get_bufreq(inst, HFI_BUFFER_OUTPUT, &bufreq); + if (ret) + goto deinit; - *num = bufreq.count_actual; + *out_num = HFI_BUFREQ_COUNT_MIN(&bufreq, ver); +deinit: hfi_session_deinit(inst); return ret; @@ -626,7 +639,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, num; + unsigned int p, in_num, out_num; int ret = 0; if (*num_planes) { @@ -649,35 +662,29 @@ static int vdec_queue_setup(struct vb2_queue *q, return 0; } + ret = vdec_num_buffers(inst, &in_num, &out_num); + if (ret) + return ret; + 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, inst->out_height); inst->input_buf_size = sizes[0]; + *num_buffers = max(*num_buffers, in_num); inst->num_input_bufs = *num_buffers; - - ret = vdec_cap_num_buffers(inst, &num); - if (ret) - break; - - inst->num_output_bufs = num; + inst->num_output_bufs = out_num; break; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: *num_planes = inst->fmt_cap->num_planes; - ret = vdec_cap_num_buffers(inst, &num); - if (ret) - break; - - *num_buffers = max(*num_buffers, num); - for (p = 0; p < *num_planes; p++) sizes[p] = get_framesize_uncompressed(p, inst->width, inst->height); - - inst->num_output_bufs = *num_buffers; inst->output_buf_size = sizes[0]; + *num_buffers = max(*num_buffers, out_num); + inst->num_output_bufs = *num_buffers; break; default: ret = -EINVAL; From patchwork Tue May 15 07:58:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135834 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp668377lji; Tue, 15 May 2018 01:00:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqBB57088g2W8seUQadDPD1vkqYL7aWiLWVcbPq7akkl9qDg46he3pRdnJs2FcqfMA0fIn3 X-Received: by 2002:a63:b144:: with SMTP id g4-v6mr11204324pgp.253.1526371202099; Tue, 15 May 2018 01:00:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371202; cv=none; d=google.com; s=arc-20160816; b=NPpC3UzsM3wH4OwQRLqSb0++Tc/dK0QWChRjjnFVLZXnoOu42c6hRs+YgAy8BA+QxD XQ12UsU5+2PvT+IpCUgeyAYR1tn3Ty5cjJgHe0F+YmFq6cYwwrCVq8EnOQmgiSMAg2C9 2kNZ/VdiCb3ZjDoOGeOlp4xDLmmrxFkBkni0hzauI2+hwQoMz6v3EgYmxe0VXw3GZhV/ yw2RDvJSgISIjpO7GdDvExcszAikWY0v/HQXhVZOlKmgpMuEBFJs0pbbzVgI3z/rc1T4 CcfCqq6n5jw/jDgFaI+Li8U9UJq4jrZqB49aw0eweZCyoQRc9gkGcjbbindY5Km9BeL8 zbdA== 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=B3zcQ+Nddm28/i04nstpD/wOS+xVnQqkWTyM5YaDQ0A=; b=F7KsvxUDH5VH5um72w1eCIvB528qFCQR2g3ZBhz2koEznOM/19QD6/zyO+WuPFRs+X YINHbXQk5pW5fchH78aRYjJGGDkTttacGq22oLpGVKPavBSTEHXN42FxwVCka44D2Z6M R7agwgJFntYoFCCGA5DE65uLa5XcGLu6Y6Q/VeMnkBABKNvVw2LbPp9crP5uGlQ0O0r/ KBhTytDlus30AOWUroQmYuyyUezBjYKr9/NV/Rf638rT96+c7GcM1v4ljm9iBqnNeB/C Z7yEIA5A388Db53snEnvzU+2vzLoVIAOLLvSs1EBd8AhmNYhFMIbNnR1wPuG2IrDfG8Z w54Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LBQVoYV7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r10-v6si8803116pgs.647.2018.05.15.01.00.01; Tue, 15 May 2018 01:00:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LBQVoYV7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752656AbeEOH76 (ORCPT + 29 others); Tue, 15 May 2018 03:59:58 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:36849 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752560AbeEOH7z (ORCPT ); Tue, 15 May 2018 03:59:55 -0400 Received: by mail-wr0-f195.google.com with SMTP id p4-v6so14930652wrh.3 for ; Tue, 15 May 2018 00:59:54 -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=B3zcQ+Nddm28/i04nstpD/wOS+xVnQqkWTyM5YaDQ0A=; b=LBQVoYV7yPMe9FvQMtvMzJR+QOM3pqS4YNMmbhj0P0pnm6ZLu6nkVfl6UY3UyoHJhq zhB7szd3l3e64z7WarR5c2jQ+b2JWQFCsJ9rYCCMovGQJoEibcbq+JDvRyNw1pVxPIFK ZQm8ugSn06mPEldezkhL0EOrMDLFUrPKc27U0= 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=B3zcQ+Nddm28/i04nstpD/wOS+xVnQqkWTyM5YaDQ0A=; b=XAArMpZvpnJTKXabSkv5TotYbsiP0prFdcicLUt8s/M1Ml/atp6oGjQVkYPPxNWmB6 XHjtNGPeSMla6+izQhpIr8Egp/9Rt9ysc13JCZ5NhrbgeM4e+8CPeSdvFagQN02uq2tc RKUOeKgfhGP1pM/vBSiaqc8u31YQjVC2VPJIQDZ9GdHfmBovjogtV8VG1Fjj2YkGo5li vpeUQ7otRSqOGFa1a/FKDn2wKHJT+BNZS+kpg+kNTaMjXSYhnTEaQWFGzybsD3DP3GAx SPIJ04n7tQVBTISFX93s7aOXQ+5ihactix/C6hAmKIBY/KVMHGZTsad5VS7AeIoB3aW9 2Vrw== X-Gm-Message-State: ALKqPwenqOUb2ps3dOWITUOGf+1AVWU9GbvbElAl3wtCKgQ006yPSQhh YlMAgNTMfPrhSU3Lc4ciExpZag== X-Received: by 2002:adf:b352:: with SMTP id k18-v6mr9246692wrd.207.1526371193969; Tue, 15 May 2018 00:59:53 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:53 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 25/29] venus: vdec: new function for output configuration Date: Tue, 15 May 2018 10:58:55 +0300 Message-Id: <20180515075859.17217-26-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make a new function vdec_output_conf() for decoder output configuration. vdec_output_conf() will set properties via HFI interface related to the output configuration, and keep vdec_set_properties() which will set properties related to decoding parameters. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/vdec.c | 35 ++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 15 deletions(-) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 5a5e3e2fece4..3a699af0ab58 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -545,6 +545,23 @@ static const struct v4l2_ioctl_ops vdec_ioctl_ops = { static int vdec_set_properties(struct venus_inst *inst) { struct vdec_controls *ctr = &inst->controls.dec; + struct hfi_enable en = { .enable = 1 }; + u32 ptype; + int ret; + + if (ctr->post_loop_deb_mode) { + ptype = HFI_PROPERTY_CONFIG_VDEC_POST_LOOP_DEBLOCKER; + en.enable = 1; + ret = hfi_session_set_property(inst, ptype, &en); + if (ret) + return ret; + } + + return 0; +} + +static int vdec_output_conf(struct venus_inst *inst) +{ struct venus_core *core = inst->core; struct hfi_enable en = { .enable = 1 }; u32 ptype; @@ -569,14 +586,6 @@ static int vdec_set_properties(struct venus_inst *inst) if (ret) return ret; - if (ctr->post_loop_deb_mode) { - ptype = HFI_PROPERTY_CONFIG_VDEC_POST_LOOP_DEBLOCKER; - en.enable = 1; - ret = hfi_session_set_property(inst, ptype, &en); - if (ret) - return ret; - } - return 0; } @@ -724,7 +733,6 @@ static int vdec_verify_conf(struct venus_inst *inst) 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; int ret; mutex_lock(&inst->lock); @@ -753,12 +761,9 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count) if (ret) goto deinit_sess; - if (core->res->hfi_version == HFI_VERSION_3XX) { - ret = venus_helper_set_bufsize(inst, inst->output_buf_size, - HFI_BUFFER_OUTPUT); - if (ret) - goto deinit_sess; - } + ret = vdec_output_conf(inst); + if (ret) + goto deinit_sess; ret = vdec_verify_conf(inst); if (ret) From patchwork Tue May 15 07:58:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135838 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp669883lji; Tue, 15 May 2018 01:01:24 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrv1p6ZexxSE9M9V9Beg8n02ZmdqJklM8JFuvmvaQ/IT+j+xXjNiOGgowW5ulPfWqaYWGvh X-Received: by 2002:a17:902:be0e:: with SMTP id r14-v6mr13391553pls.158.1526371284368; Tue, 15 May 2018 01:01:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371284; cv=none; d=google.com; s=arc-20160816; b=QPSt3c+YPkNkrfOIrxDzHZ3rcFSq8MOB7xNOP38ajncVo/I1CalCRamJFIwtByNLua mDZLaw9rEgWw4F4s4xfm1ulejOd724zQeh0H84r9AAwB6vMUbzLOAatVzaCM7Nj9Rs7k ekA7XoqkWPfwDXv/7Vf+rh5fIpC94D1nfq3xvqZrg6YM1dP2sSx9MCWFKmvdHPwnDJ7v xtmggZ3Pi7647Kl0LTeh1Fg7SZieCew60kPVSKTK3EuyruZ3+ALg6gwB275EFnXEdQh+ pkfkhvKMaLmR3dj8BYGKYbqGk6DBvOeh1bqHnkECIjx3J+GE3gwcF2/wSDWvUU5eSHTZ 38uA== 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=DspR5wX164TCrkrYzpWCseWwSIF9N63nPos67PRYL4Q=; b=RvY9ucx9CiXZBV2TyIGAisAnTMM4MdYToUkhFNEMVBqZn+nJDSWBlY5gi/zJAEqMtL TBiAkKpERfRM/wiUigyjACCIjMtGBApqDsPPaFSFkerDnktmFw2GTtO+1JxoihR64VeJ FZstaanwyMq/6e3XLg2dBNm9TQSNmqfVJZtArynCShm/67POvGR2f0RbhFk1tscxfQ08 OcNiyXKk2+a4NZpN5Vj8/MhWrS2X9zZyH+SaEpxfLZfr7E/heGkNPpNlt6K3xNQfrMWr PH6Z+RBusxgKItKdG38a8MUeowLKCCU2H1LlNM80Q4EM5UwmqHsZ/i2/AaaaFitye/Ea yZmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FPcQszTT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 21-v6si11664536pfy.293.2018.05.15.01.01.21; Tue, 15 May 2018 01:01:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FPcQszTT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752708AbeEOIBS (ORCPT + 29 others); Tue, 15 May 2018 04:01:18 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:35192 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752633AbeEOH74 (ORCPT ); Tue, 15 May 2018 03:59:56 -0400 Received: by mail-wr0-f195.google.com with SMTP id i14-v6so14910775wre.2 for ; Tue, 15 May 2018 00:59:55 -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=DspR5wX164TCrkrYzpWCseWwSIF9N63nPos67PRYL4Q=; b=FPcQszTTG3sH3U35OR1n3pz0Novbf3P5fElaEnIjESy2+X0/A0LK3JnpNYQ8fna3Ie SliidiZKzSxpk/EFBd6p4rsD2iT3iyE0KmDx6rS1+F1D/8WBtqxjp0s7coanGM3aZkQA e8cBYCueMMJCGK5vyAFc8fHHYUCQYg8b34K6M= 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=DspR5wX164TCrkrYzpWCseWwSIF9N63nPos67PRYL4Q=; b=bY+RnCQvhyVztrBkF4r26Y9EHcKw3KzoY8RYu+qeQE9w5wLyxNRzdGlAaccLG85tei nBu5eHwzhMkgdx5eqbbXbdZB6fjc/SknYD50zeafgU6toTBaf/lSHdEew3xkiKQIZFvO Iu4WC5hUzs/U65ky59tChfnmb8vn/hj7iN5Y6WrQIv8+YvxxN3zbBDsjNWLPL5E72mvd L9CyzSJ0FiTsdt0tg3vNAVxk9LC4FeLL7x+vJ3+3QEnKIo6FZM3b161eZO0gtMbYLoGT QwAjv1PPA55BvUeiB70UH1dmHY43tx+bkEd2++j5BLUnX/Hdytt8HcS3tJRcMUeqSuRl b02w== X-Gm-Message-State: ALKqPwfAD8Pjsevg4KOdRRMmiAqQn2so1pPBZaOuVNghyea213hMRrDy 9MqHr9slsCRA7rZz8zFXW6Wrqw== X-Received: by 2002:adf:adf0:: with SMTP id w103-v6mr10122920wrc.101.1526371195084; Tue, 15 May 2018 00:59:55 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:54 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 26/29] venus: move frame size calculations in common place Date: Tue, 15 May 2018 10:58:56 +0300 Message-Id: <20180515075859.17217-27-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org move calculations of raw and compressed in a 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 diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index f0a0fca60c76..ed569705ecac 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -455,6 +455,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 3a699af0ab58..28db28fb5f21 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; } @@ -648,7 +620,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) { @@ -678,7 +650,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); @@ -687,10 +660,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 c9c40d1ce7c6..54f253b98b24 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: From patchwork Tue May 15 07:58:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135835 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp668458lji; Tue, 15 May 2018 01:00:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq9BWWgbuXpm1Al0HPae/oXoJW2RmUSVlBBltqOX4m8EJPGMAnsMGvzpAmhzgSB0D4T3N61 X-Received: by 2002:a62:5050:: with SMTP id e77-v6mr14210360pfb.16.1526371207906; Tue, 15 May 2018 01:00:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371207; cv=none; d=google.com; s=arc-20160816; b=ACnWZSjUayTcU6wPHeMjcFKvnkzlAXzvnKckMrBuvqp4BPtA6m9eQzDCLF+WI5xb4N ouLru0epE1C1ZvyEurhCQKudrWoljd4VEzBalJ3/1gCSACfdzu+8NKsvAxWN5ZMy1LR9 Kt/oN/uk/bxunGnE64XqueqsafNyGLj0ciWbD/662ihTV2tqqal+gjYLIjjMT6HatAw5 H6tmhB/QWL3yb3sjqvmC+rLwHgWT9NODsiKNOG/M0e+ATCsZvD0PALzc1FqhIcpLboId cAv3JNeXWhbzmYaa7kg5sxAAxZ5St4lfH3qWdoEgj4BEsTb8akJ+mbkU+RffjqjkASaf Fysg== 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=ChawOJI3JvjKom0ef+YfKzLvyKa4ajCIkBvp4xgDuXY=; b=nrZ9WOiuOtInjsYKPvPegX2zrtt2qb1brhg5V8bfkC187XlpIzDbrh+PWvozQ/mX7L +VdVLilXGkQ0+ax7+n0S8sG9p4xfaTe5lefhZ3RGQY4rPi8u4jlFNY0DIJLgXv7TJW12 z710LVHO8bdxXKOuNmatbn14LtSJgA0fc5HcUXIZuTOkXQV10oHGqNukHWbtqeRQ0bOM OfCUaSKEincJfu2xcysofCfH/+Y1N6fKWXxSu50eQTvlBL0RsFaJ07d1kGxaBxUnceWz KDPuX3omjH+qKPzIbVNJiHfkAMTw7YTRqfqYJQi/dPJbRsh97k6cRqdp2aLaNl5ZhYnZ PjmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XmAcwvny; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d31-v6si334096pld.23.2018.05.15.01.00.07; Tue, 15 May 2018 01:00:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XmAcwvny; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752669AbeEOIAF (ORCPT + 29 others); Tue, 15 May 2018 04:00:05 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34573 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752642AbeEOH75 (ORCPT ); Tue, 15 May 2018 03:59:57 -0400 Received: by mail-wm0-f65.google.com with SMTP id a137-v6so14775169wme.1 for ; Tue, 15 May 2018 00:59:57 -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=ChawOJI3JvjKom0ef+YfKzLvyKa4ajCIkBvp4xgDuXY=; b=XmAcwvnyoWbYNzHDKhuYrMOn9J14GDuoLyeuReFvZ50981Al7SuIqmfmucEP0e1Qts we9uT3i65UEl+AnNPsAis8i1M+KZGISDCbbcxNEMaKsOhxgyUSexle5Om2fMTYgI6/vK tP1bv4fA6qnxzf+ZGBEmyyjiX8KIrhtrEh7Wk= 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=ChawOJI3JvjKom0ef+YfKzLvyKa4ajCIkBvp4xgDuXY=; b=uVcxLJ8o7aIYFUeDbtTsvfeU8n7xym+Vj4+bfyy7KxpP56pntxDR+F/9vQk3lEgyLh SSIs0L/Za5XK6pB1nEfNHz3wL6aYFZ3jrHuy4nEjYJ7M5j38hKv6FODF3r4BYUPtJGi5 wd7L1BCneJR9d2ZdTn6VrES/dQpLEZL03zjRXKf/kxQV+kAxy8VkyU1vJs1YTxqwb3yP Fr/Clx5A00XPY2AOBIXJcUAPj4ZIVsTh9mX5LjiKJhqEPFiw64r6jU2RURVfUTeP7mMk cQSjpKPDr54+ig4R2htN7Z7WVPx0CfEtVxgYUColbbtrPxBvXAa/zmhVeCWXNQ08ez1m HFIw== X-Gm-Message-State: ALKqPwdzsSrRh4enh1696T9mBqfyhZKEmWtAzs7heE9R6kdtXgSPR/aO nDDafxGZ2x4ImHlNXSy9DHYujQ== X-Received: by 2002:a1c:424f:: with SMTP id p76-v6mr6584976wma.15.1526371196149; Tue, 15 May 2018 00:59:56 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:55 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 27/29] venus: implementing multi-stream support Date: Tue, 15 May 2018 10:58:57 +0300 Message-Id: <20180515075859.17217-28-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is implementing a multi-stream decoder support. The multi stream gives an option to use the secondary decoder output with different raw format (or the same in case of crop). Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 1 + drivers/media/platform/qcom/venus/helpers.c | 204 +++++++++++++++++++++++++++- drivers/media/platform/qcom/venus/helpers.h | 6 + drivers/media/platform/qcom/venus/vdec.c | 91 ++++++++++++- drivers/media/platform/qcom/venus/venc.c | 1 + 5 files changed, 299 insertions(+), 4 deletions(-) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 4d6c05f156c4..85e66e2dd672 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -259,6 +259,7 @@ struct venus_inst { struct list_head list; struct mutex lock; struct venus_core *core; + struct list_head dpbbufs; struct list_head internalbufs; struct list_head registeredbufs; struct list_head delayed_process; diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index ed569705ecac..87dcf9973e6f 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -85,6 +85,112 @@ bool venus_helper_check_codec(struct venus_inst *inst, u32 v4l2_pixfmt) } EXPORT_SYMBOL_GPL(venus_helper_check_codec); +static int venus_helper_queue_dpb_bufs(struct venus_inst *inst) +{ + struct intbuf *buf; + int ret = 0; + + if (list_empty(&inst->dpbbufs)) + return 0; + + list_for_each_entry(buf, &inst->dpbbufs, list) { + struct hfi_frame_data fdata; + + memset(&fdata, 0, sizeof(fdata)); + fdata.alloc_len = buf->size; + fdata.device_addr = buf->da; + fdata.buffer_type = buf->type; + + ret = hfi_session_process_buf(inst, &fdata); + if (ret) + goto fail; + } + +fail: + return ret; +} + +int venus_helper_free_dpb_bufs(struct venus_inst *inst) +{ + struct intbuf *buf, *n; + + if (list_empty(&inst->dpbbufs)) + return 0; + + list_for_each_entry_safe(buf, n, &inst->dpbbufs, list) { + list_del_init(&buf->list); + dma_free_attrs(inst->core->dev, buf->size, buf->va, buf->da, + buf->attrs); + kfree(buf); + } + + INIT_LIST_HEAD(&inst->dpbbufs); + + return 0; +} +EXPORT_SYMBOL_GPL(venus_helper_free_dpb_bufs); + +int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) +{ + struct venus_core *core = inst->core; + struct device *dev = core->dev; + enum hfi_version ver = core->res->hfi_version; + struct hfi_buffer_requirements bufreq; + u32 buftype = inst->dpb_buftype; + unsigned int dpb_size = 0; + struct intbuf *buf; + unsigned int i; + u32 count; + int ret; + + /* no need to allocate dpb buffers */ + if (!inst->dpb_fmt) + return 0; + + if (inst->dpb_buftype == HFI_BUFFER_OUTPUT) + dpb_size = inst->output_buf_size; + else if (inst->dpb_buftype == HFI_BUFFER_OUTPUT2) + dpb_size = inst->output2_buf_size; + + if (!dpb_size) + return 0; + + ret = venus_helper_get_bufreq(inst, buftype, &bufreq); + if (ret) + return ret; + + count = HFI_BUFREQ_COUNT_MIN(&bufreq, ver); + + for (i = 0; i < count; i++) { + buf = kzalloc(sizeof(*buf), GFP_KERNEL); + if (!buf) { + ret = -ENOMEM; + goto fail; + } + + buf->type = buftype; + buf->size = dpb_size; + buf->attrs = DMA_ATTR_WRITE_COMBINE | + DMA_ATTR_NO_KERNEL_MAPPING; + buf->va = dma_alloc_attrs(dev, buf->size, &buf->da, GFP_KERNEL, + buf->attrs); + if (!buf->va) { + kfree(buf); + ret = -ENOMEM; + goto fail; + } + + list_add_tail(&buf->list, &inst->dpbbufs); + } + + return 0; + +fail: + venus_helper_free_dpb_bufs(inst); + return ret; +} +EXPORT_SYMBOL_GPL(venus_helper_alloc_dpb_bufs); + static int intbufs_set_buffer(struct venus_inst *inst, u32 type) { struct venus_core *core = inst->core; @@ -342,7 +448,10 @@ session_process_buf(struct venus_inst *inst, struct vb2_v4l2_buffer *vbuf) if (vbuf->flags & V4L2_BUF_FLAG_LAST || !fdata.filled_len) fdata.flags |= HFI_BUFFERFLAG_EOS; } else if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { - fdata.buffer_type = HFI_BUFFER_OUTPUT; + if (inst->session_type == VIDC_SESSION_TYPE_ENC) + fdata.buffer_type = HFI_BUFFER_OUTPUT; + else + fdata.buffer_type = inst->opb_buftype; fdata.filled_len = 0; fdata.offset = 0; } @@ -675,6 +784,27 @@ int venus_helper_set_color_format(struct venus_inst *inst, u32 pixfmt) } EXPORT_SYMBOL_GPL(venus_helper_set_color_format); +int venus_helper_set_multistream(struct venus_inst *inst, bool out_en, + bool out2_en) +{ + struct hfi_multi_stream multi = {0}; + u32 ptype = HFI_PROPERTY_PARAM_VDEC_MULTI_STREAM; + int ret; + + multi.buffer_type = HFI_BUFFER_OUTPUT; + multi.enable = out_en; + + ret = hfi_session_set_property(inst, ptype, &multi); + if (ret) + return ret; + + multi.buffer_type = HFI_BUFFER_OUTPUT2; + multi.enable = out2_en; + + return hfi_session_set_property(inst, ptype, &multi); +} +EXPORT_SYMBOL_GPL(venus_helper_set_multistream); + int venus_helper_set_dyn_bufmode(struct venus_inst *inst) { u32 ptype = HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE; @@ -822,9 +952,10 @@ EXPORT_SYMBOL_GPL(venus_helper_vb2_buf_init); int venus_helper_vb2_buf_prepare(struct vb2_buffer *vb) { struct venus_inst *inst = vb2_get_drv_priv(vb->vb2_queue); + unsigned int out_buf_size = venus_helper_get_opb_size(inst); if (vb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE && - vb2_plane_size(vb, 0) < inst->output_buf_size) + vb2_plane_size(vb, 0) < out_buf_size) return -EINVAL; if (vb->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE && vb2_plane_size(vb, 0) < inst->input_buf_size) @@ -894,6 +1025,8 @@ void venus_helper_vb2_stop_streaming(struct vb2_queue *q) if (ret) hfi_session_abort(inst); + venus_helper_free_dpb_bufs(inst); + load_scale_clocks(core); INIT_LIST_HEAD(&inst->registeredbufs); } @@ -932,8 +1065,14 @@ int venus_helper_vb2_start_streaming(struct venus_inst *inst) if (ret) goto err_unload_res; + ret = venus_helper_queue_dpb_bufs(inst); + if (ret) + goto err_session_stop; + return 0; +err_session_stop: + hfi_session_stop(inst); err_unload_res: hfi_session_unload_res(inst); err_unreg_bufs: @@ -987,6 +1126,67 @@ void venus_helper_init_instance(struct venus_inst *inst) } EXPORT_SYMBOL_GPL(venus_helper_init_instance); +static bool find_fmt_from_caps(struct venus_caps *caps, u32 buftype, u32 fmt) +{ + unsigned int i; + + for (i = 0; i < caps->num_fmts; i++) { + if (caps->fmts[i].buftype == buftype && + caps->fmts[i].fmt == fmt) + return true; + } + + return false; +} + +int venus_helper_get_out_fmts(struct venus_inst *inst, u32 v4l2_fmt, + u32 *out_fmt, u32 *out2_fmt, bool ubwc) +{ + struct venus_core *core = inst->core; + struct venus_caps *caps; + u32 ubwc_fmt, fmt = to_hfi_raw_fmt(v4l2_fmt); + bool found, found_ubwc; + + *out_fmt = *out2_fmt = 0; + + if (!fmt) + return -EINVAL; + + caps = venus_caps_by_codec(core, inst->hfi_codec, inst->session_type); + if (!caps) + return -EINVAL; + + if (ubwc) { + ubwc_fmt = fmt | HFI_COLOR_FORMAT_UBWC_BASE; + found_ubwc = find_fmt_from_caps(caps, HFI_BUFFER_OUTPUT, + ubwc_fmt); + found = find_fmt_from_caps(caps, HFI_BUFFER_OUTPUT2, fmt); + + if (found_ubwc && found) { + *out_fmt = ubwc_fmt; + *out2_fmt = fmt; + return 0; + } + } + + found = find_fmt_from_caps(caps, HFI_BUFFER_OUTPUT, fmt); + if (found) { + *out_fmt = fmt; + *out2_fmt = 0; + return 0; + } + + found = find_fmt_from_caps(caps, HFI_BUFFER_OUTPUT2, fmt); + if (found) { + *out_fmt = 0; + *out2_fmt = fmt; + return 0; + } + + return -EINVAL; +} +EXPORT_SYMBOL_GPL(venus_helper_get_out_fmts); + int venus_helper_power_enable(struct venus_core *core, u32 session_type, bool enable) { diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 92b167a47166..2475f284f396 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -50,10 +50,16 @@ 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); +int venus_helper_set_multistream(struct venus_inst *inst, bool out_en, + bool out2_en); 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); +int venus_helper_get_out_fmts(struct venus_inst *inst, u32 fmt, u32 *out_fmt, + u32 *out2_fmt, bool ubwc); +int venus_helper_alloc_dpb_bufs(struct venus_inst *inst); +int venus_helper_free_dpb_bufs(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 28db28fb5f21..d2d082009686 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -532,10 +532,16 @@ static int vdec_set_properties(struct venus_inst *inst) return 0; } +#define is_ubwc_fmt(fmt) (!!((fmt) & HFI_COLOR_FORMAT_UBWC_BASE)) + static int vdec_output_conf(struct venus_inst *inst) { struct venus_core *core = inst->core; struct hfi_enable en = { .enable = 1 }; + u32 width = inst->out_width; + u32 height = inst->out_height; + u32 out_fmt, out2_fmt; + bool ubwc = false; u32 ptype; int ret; @@ -554,6 +560,78 @@ static int vdec_output_conf(struct venus_inst *inst) return ret; } + if (width > 1920 && height > ALIGN(1080, 32)) + ubwc = true; + + if (IS_V4(core)) + ubwc = true; + + ret = venus_helper_get_out_fmts(inst, inst->fmt_cap->pixfmt, &out_fmt, + &out2_fmt, ubwc); + if (ret) + return ret; + + inst->output_buf_size = + venus_helper_get_framesz_raw(out_fmt, width, height); + inst->output2_buf_size = + venus_helper_get_framesz_raw(out2_fmt, width, height); + + if (is_ubwc_fmt(out_fmt)) { + inst->opb_buftype = HFI_BUFFER_OUTPUT2; + inst->opb_fmt = out2_fmt; + inst->dpb_buftype = HFI_BUFFER_OUTPUT; + inst->dpb_fmt = out_fmt; + } else if (is_ubwc_fmt(out2_fmt)) { + inst->opb_buftype = HFI_BUFFER_OUTPUT; + inst->opb_fmt = out_fmt; + inst->dpb_buftype = HFI_BUFFER_OUTPUT2; + inst->dpb_fmt = out2_fmt; + } else { + inst->opb_buftype = HFI_BUFFER_OUTPUT; + inst->opb_fmt = out_fmt; + inst->dpb_buftype = 0; + inst->dpb_fmt = 0; + } + + ret = venus_helper_set_raw_format(inst, inst->opb_fmt, + inst->opb_buftype); + if (ret) + return ret; + + if (inst->dpb_fmt) { + ret = venus_helper_set_multistream(inst, false, true); + if (ret) + return ret; + + ret = venus_helper_set_raw_format(inst, inst->dpb_fmt, + inst->dpb_buftype); + if (ret) + return ret; + + ret = venus_helper_set_output_resolution(inst, width, height, + HFI_BUFFER_OUTPUT2); + if (ret) + return ret; + } + + if (IS_V3(core) || IS_V4(core)) { + if (inst->output2_buf_size) { + ret = venus_helper_set_bufsize(inst, + inst->output2_buf_size, + HFI_BUFFER_OUTPUT2); + if (ret) + return ret; + } + + if (inst->output_buf_size) { + ret = venus_helper_set_bufsize(inst, + inst->output_buf_size, + HFI_BUFFER_OUTPUT); + if (ret) + return ret; + } + } + ret = venus_helper_set_dyn_bufmode(inst); if (ret) return ret; @@ -624,6 +702,8 @@ static int vdec_queue_setup(struct vb2_queue *q, int ret = 0; if (*num_planes) { + unsigned int output_buf_size = venus_helper_get_opb_size(inst); + if (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE && *num_planes != inst->fmt_out->num_planes) return -EINVAL; @@ -637,7 +717,7 @@ static int vdec_queue_setup(struct vb2_queue *q, return -EINVAL; if (q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE && - sizes[0] < inst->output_buf_size) + sizes[0] < output_buf_size) return -EINVAL; return 0; @@ -746,6 +826,10 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count) if (ret) goto deinit_sess; + ret = venus_helper_alloc_dpb_bufs(inst); + if (ret) + goto deinit_sess; + ret = venus_helper_vb2_start_streaming(inst); if (ret) goto deinit_sess; @@ -797,9 +881,11 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type, vbuf->field = V4L2_FIELD_NONE; if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { + unsigned int opb_sz = venus_helper_get_opb_size(inst); + vb = &vbuf->vb2_buf; vb->planes[0].bytesused = - max_t(unsigned int, inst->output_buf_size, bytesused); + max_t(unsigned int, opb_sz, bytesused); vb->planes[0].data_offset = data_offset; vb->timestamp = timestamp_us * NSEC_PER_USEC; vbuf->sequence = inst->sequence_cap++; @@ -937,6 +1023,7 @@ static int vdec_open(struct file *file) if (!inst) return -ENOMEM; + INIT_LIST_HEAD(&inst->dpbbufs); INIT_LIST_HEAD(&inst->registeredbufs); INIT_LIST_HEAD(&inst->internalbufs); INIT_LIST_HEAD(&inst->list); diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 54f253b98b24..a703bce78abc 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -1084,6 +1084,7 @@ static int venc_open(struct file *file) if (!inst) return -ENOMEM; + INIT_LIST_HEAD(&inst->dpbbufs); INIT_LIST_HEAD(&inst->registeredbufs); INIT_LIST_HEAD(&inst->internalbufs); INIT_LIST_HEAD(&inst->list); From patchwork Tue May 15 07:58: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: 135836 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp668895lji; Tue, 15 May 2018 01:00:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp7hgKsGY70cstjKDtAXxH8/lK2ZRtrFvDtvBaPO1suG933JH57XhW5FiwpXcze3BeBwldm X-Received: by 2002:a65:5c47:: with SMTP id v7-v6mr11290128pgr.425.1526371231781; Tue, 15 May 2018 01:00:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371231; cv=none; d=google.com; s=arc-20160816; b=Iid1VsX/gq24xP2F9sYnpSOp7WwdM3XE7kISYi/L9BSEyNwAtyFu6oJnc4RPwgcm+l 6ekNwgQAUNxxH5g4tqs6gjvRGgoZxakwxGViRB9WPtH8ZGYUpfpiwdEVmYuFbIpc9x2d zhQMRSviJPE+FxWDmQOfLQLunmsj0/jliFLjhH02JbwVA/skS+ED2DKBBZWEfc50mo/M qwLqMzPp/imzr2wa50A0Ea1DeAZym/XAITNqfrmiAJB0zQJQLNylKkBfr3vQeHSeLNQ/ E4Ym3huUOMIrKHw7gPwnsGKTJ3Y6y7PhHItpPVj0Ef63mcFoaziIQwFebHDhS+qQXYLZ upYw== 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=X29eSoJZ0yZJujNimFriAnLn1bdouqTmBHJYnqFJFLw=; b=ZO5ydwC0Mn8a9YoZxCL09jfSMB8DMeFZ15MiAig+4WN3SSmPKqey/cjC7bQdg2Th16 xhLxgQ2VU/sz1PGduejOADIo+Ik8HxrM9FIcZIcAcVEhYyvr2RdH3lGbSfRRmkLtBrL5 MRJAXwrANOSdrkkMwruVFVQd+5+bav4AX25/p+6Wfy6uOsO1BWGqOKJBsygNSL6szp9a PBmMFOm9K71qMfSPMRxIU9JwKHgtOLumti/a5uE9Gku6tVZB2qW4rtPSXXoB2lAimjB9 6z+bKtIxllecqdKOaDyaWR8HWxPDpM1lbKyp5Ov2haM2jkS0xCKjCsdNHNAl0J/+fu0i HMxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O9Xf+Fz7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g34-v6si11074044pld.411.2018.05.15.01.00.31; Tue, 15 May 2018 01:00:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O9Xf+Fz7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752702AbeEOIA2 (ORCPT + 29 others); Tue, 15 May 2018 04:00:28 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:50694 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752654AbeEOH76 (ORCPT ); Tue, 15 May 2018 03:59:58 -0400 Received: by mail-wm0-f68.google.com with SMTP id t11-v6so17688468wmt.0 for ; Tue, 15 May 2018 00:59:57 -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=X29eSoJZ0yZJujNimFriAnLn1bdouqTmBHJYnqFJFLw=; b=O9Xf+Fz7VJl1t/PDM+sJw3MdGi0az8AtSybhLzfWT3eOE2sSg397iilJeBhz95igH1 s/FDHSMJXDkui0RioU1E5ulktW3wzl4PJMmn+fn562ZnaweImicDGpvg19v6LrFMH617 TX39XSAo57YE8rN8bVgs1twVSmKUGls99pAbI= 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=X29eSoJZ0yZJujNimFriAnLn1bdouqTmBHJYnqFJFLw=; b=Wzv+/Fxw/yVegzgg8ooF5iDHlmo5B5OcpuA+hbjzzuSLg3wKMcLEiE1Qvk5qoao+sh vXIpbxk1IDOWgEYwsRj7gOgDcy9x0zYt965cfaYPGsHngBOflROGb6AHT2dC+4SLt9HL dH272MHXIjL/E/7MWXzWLgiYuntE6q1ZWHqzDtKmCWSAFTh2ISwp1gDLJYSiJzd1WR0+ QGCXQcTsdDpHZhZGO7d2bhdGNGneqHh/Jp9JXij+QCqBi1GqqXCPLzMhWy0p5mC7tIE6 mXAHqeds9TAxAfegt0S7z5ZnpIDnneqqX9WLkuWvyviPp1EkVYE06V3DlZjM27TLypJ1 8m6g== X-Gm-Message-State: ALKqPwcYhjH/yDcpZM/KGcOY+IFRZUz5v43y4iYHYZYvX5VY5GjMwnt9 OzvJ5AtMEMovKHtegbbY44hgxA== X-Received: by 2002:a1c:c702:: with SMTP id x2-v6mr7715806wmf.57.1526371197189; Tue, 15 May 2018 00:59:57 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:56 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 28/29] venus: add sdm845 compatible and resource data Date: Tue, 15 May 2018 10:58:58 +0300 Message-Id: <20180515075859.17217-29-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds sdm845 DT compatible string with it's resource data table. Reviewed-by: Rob Herring Signed-off-by: Stanimir Varbanov --- .../devicetree/bindings/media/qcom,venus.txt | 1 + drivers/media/platform/qcom/venus/core.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) -- 2.14.1 diff --git a/Documentation/devicetree/bindings/media/qcom,venus.txt b/Documentation/devicetree/bindings/media/qcom,venus.txt index 2693449daf73..00d0d1bf7647 100644 --- a/Documentation/devicetree/bindings/media/qcom,venus.txt +++ b/Documentation/devicetree/bindings/media/qcom,venus.txt @@ -6,6 +6,7 @@ Definition: Value should contain one of: - "qcom,msm8916-venus" - "qcom,msm8996-venus" + - "qcom,sdm845-venus" - reg: Usage: required Value type: diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 381bfdd688db..bb6add9d340e 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -450,9 +450,31 @@ static const struct venus_resources msm8996_res = { .fwname = "qcom/venus-4.2/venus.mdt", }; +static const struct freq_tbl sdm845_freq_table[] = { + { 1944000, 380000000 }, /* 4k UHD @ 60 */ + { 972000, 320000000 }, /* 4k UHD @ 30 */ + { 489600, 200000000 }, /* 1080p @ 60 */ + { 244800, 100000000 }, /* 1080p @ 30 */ +}; + +static const struct venus_resources sdm845_res = { + .freq_tbl = sdm845_freq_table, + .freq_tbl_size = ARRAY_SIZE(sdm845_freq_table), + .clks = {"core", "iface", "bus" }, + .clks_num = 3, + .max_load = 2563200, + .hfi_version = HFI_VERSION_4XX, + .vmem_id = VIDC_RESOURCE_NONE, + .vmem_size = 0, + .vmem_addr = 0, + .dma_mask = 0xe0000000 - 1, + .fwname = "qcom/venus-5.2/venus.mdt", +}; + static const struct of_device_id venus_dt_match[] = { { .compatible = "qcom,msm8916-venus", .data = &msm8916_res, }, { .compatible = "qcom,msm8996-venus", .data = &msm8996_res, }, + { .compatible = "qcom,sdm845-venus", .data = &sdm845_res, }, { } }; MODULE_DEVICE_TABLE(of, venus_dt_match); From patchwork Tue May 15 07:58:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135837 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp669043lji; Tue, 15 May 2018 01:00:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpAJl0dJrOWcBvg9G/t+Ug7BZ3+gSTskdkhT/BOVbTCpGVwFfNdLIsinGvXA1f34nDt5hcJ X-Received: by 2002:a65:5c47:: with SMTP id v7-v6mr11290686pgr.425.1526371241485; Tue, 15 May 2018 01:00:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371241; cv=none; d=google.com; s=arc-20160816; b=gs9yu1xyE/UkOR2uu0ItwyzLE8G5tQ8d+xjS4BACB5S/CPZKYb0cLMN7ky0tDGQHJZ sWIFWt92xfmSYkdvupb8mrch3K1/Kr6Mjjamzalbn2OlTojLVPqPh/2lCk1tSMceOkpu F4s+q0WTIwx1TpVeBBcS+Y6VrgBlfCWhdDlhMsjhMTg3HvNhS6/zyCtFbZHMO1rGNIXg MD07oIlCOTdrsNKVvWM6L4BQgJ7cPEL4kP4+sbNnPubJTj2lc2kSwU8pEF7tArstLf68 fbAq9o/LieyymBeFAvOHfPBzkhgCH86TVDyj7HstMjSvrG3xLsPrQVDI+4iYvJXdmXwJ qdjw== 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=WQOQSGQ8+pOf2QfOZlURcvnuPEKjy5C3mdVmwEUxuhs=; b=vJbl5HE1l0ffxbXEUPuNmiSGts/P7yzkg6ymkMYMxOBFi2PNuK4k7/nRaPTRRXHy/A A+YbMOQ7LPMK2Ea/l2RI+kwwxr4rMxeiC5ut/QkzAW54X6ssghRprWiuEPKl298XfPFK KJiI8fkUibkrMwOPEIiAeQkmRgmkxtWX+lhBg5aiA3QWOX2V9Rw2+DtzME3aNkhEjwj7 64sAFOIAjWvHP5UPpN2fBpwSn5rXdEFP9duiqC6a62w7xP0rP10q6dD4BTu4NtYCLEOJ 4KQZiMx9zOfq4A26j5dc6Dt7Z2JcYti1SvseapJQA7epnXqkb8mGtgu8/Mc+ooV48u3Z yVzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gEvLzq6D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g34-v6si11074044pld.411.2018.05.15.01.00.41; Tue, 15 May 2018 01:00:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gEvLzq6D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752697AbeEOIA0 (ORCPT + 29 others); Tue, 15 May 2018 04:00:26 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:37225 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752247AbeEOH77 (ORCPT ); Tue, 15 May 2018 03:59:59 -0400 Received: by mail-wr0-f195.google.com with SMTP id h5-v6so14903300wrm.4 for ; Tue, 15 May 2018 00:59:58 -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=WQOQSGQ8+pOf2QfOZlURcvnuPEKjy5C3mdVmwEUxuhs=; b=gEvLzq6D+QNfdLzuZ27cv9dKWRThjo3szx2Fy43tY7A7fSE9neojIv+HsnhCz2enE+ mNL2AwBkRScl2G9fR4xfqZBW7qiWRHynB+27XDDc0UhftSPVx22YzgSJHeo0PIez5Wkt HxlgsBF8qMgMYFO+qQJummcGKoT+bhmIiouWA= 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=WQOQSGQ8+pOf2QfOZlURcvnuPEKjy5C3mdVmwEUxuhs=; b=PpcRW4WeLgXjnWGqVEs37cbn3uGvZjqvu5tT+Q5crxsH2jvtWbp29cLacBTcn/vfuP o/mA3gIziqzqowmxWPQTOnCxBONOCSj0OxVb46y3+8U3SozXwHPk6/wvwQGP+KKeo0Ek 66UBqwLFnKXDMLEJNqIfnNLJDw/NWnOrrkONoPM306lit2AQjdf4ZNBGfHM8mr6Ier5f huT7OkKoiGSQJC1JpoQFbXrn+vem7khkFLG+z9DSgWtR909QPwLbnWYNcK3FlMYsA7Tg KVr3mBIbmxMeGLS0QCV0lB3k0aq+p9GRN8mMcX2F8S/ShHymGIpbJuQJmvIKjpM5QO6j wviA== X-Gm-Message-State: ALKqPwcZfWs69bo7zzyLWeJkVcDlqBirbWXG2KAL3GSiWNVb0G6BYde+ ToLTkC91p7lgYOZPLrCklf5NVQ== X-Received: by 2002:adf:a00d:: with SMTP id k13-v6mr9461385wrk.39.1526371198352; Tue, 15 May 2018 00:59:58 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:57 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 29/29] venus: add HEVC codec support Date: Tue, 15 May 2018 10:58:59 +0300 Message-Id: <20180515075859.17217-30-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This add HEVC codec support for venus versions 3xx and 4xx. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 2 ++ drivers/media/platform/qcom/venus/helpers.c | 3 ++ drivers/media/platform/qcom/venus/hfi.c | 2 ++ drivers/media/platform/qcom/venus/vdec.c | 4 +++ drivers/media/platform/qcom/venus/venc.c | 49 +++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 85e66e2dd672..2a956d1b9bd1 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -185,10 +185,12 @@ struct venc_controls { u32 mpeg4; u32 h264; u32 vpx; + u32 hevc; } profile; struct { u32 mpeg4; u32 h264; + u32 hevc; } level; }; diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 87dcf9973e6f..fecadba039cf 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -71,6 +71,9 @@ bool venus_helper_check_codec(struct venus_inst *inst, u32 v4l2_pixfmt) case V4L2_PIX_FMT_XVID: codec = HFI_VIDEO_CODEC_DIVX; break; + case V4L2_PIX_FMT_HEVC: + codec = HFI_VIDEO_CODEC_HEVC; + break; default: return false; } diff --git a/drivers/media/platform/qcom/venus/hfi.c b/drivers/media/platform/qcom/venus/hfi.c index 94ca27b0bb99..24207829982f 100644 --- a/drivers/media/platform/qcom/venus/hfi.c +++ b/drivers/media/platform/qcom/venus/hfi.c @@ -49,6 +49,8 @@ static u32 to_codec_type(u32 pixfmt) return HFI_VIDEO_CODEC_VP9; case V4L2_PIX_FMT_XVID: return HFI_VIDEO_CODEC_DIVX; + case V4L2_PIX_FMT_HEVC: + return HFI_VIDEO_CODEC_HEVC; default: return 0; } diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index d2d082009686..d2ffd9bd44de 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -77,6 +77,10 @@ static const struct venus_format vdec_formats[] = { .pixfmt = V4L2_PIX_FMT_XVID, .num_planes = 1, .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, + }, { + .pixfmt = V4L2_PIX_FMT_HEVC, + .num_planes = 1, + .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, }, }; diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index a703bce78abc..50a04cb1cc22 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -59,6 +59,10 @@ static const struct venus_format venc_formats[] = { .pixfmt = V4L2_PIX_FMT_VP8, .num_planes = 1, .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + }, { + .pixfmt = V4L2_PIX_FMT_HEVC, + .num_planes = 1, + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, }, }; @@ -220,6 +224,46 @@ static int venc_v4l2_to_hfi(int id, int value) case V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY: return HFI_H264_DB_MODE_SKIP_SLICE_BOUNDARY; } + case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE: + switch (value) { + case V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN: + default: + return HFI_HEVC_PROFILE_MAIN; + case V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE: + return HFI_HEVC_PROFILE_MAIN_STILL_PIC; + case V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10: + return HFI_HEVC_PROFILE_MAIN10; + } + case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL: + switch (value) { + case V4L2_MPEG_VIDEO_HEVC_LEVEL_1: + default: + return HFI_HEVC_LEVEL_1; + case V4L2_MPEG_VIDEO_HEVC_LEVEL_2: + return HFI_HEVC_LEVEL_2; + case V4L2_MPEG_VIDEO_HEVC_LEVEL_2_1: + return HFI_HEVC_LEVEL_21; + case V4L2_MPEG_VIDEO_HEVC_LEVEL_3: + return HFI_HEVC_LEVEL_3; + case V4L2_MPEG_VIDEO_HEVC_LEVEL_3_1: + return HFI_HEVC_LEVEL_31; + case V4L2_MPEG_VIDEO_HEVC_LEVEL_4: + return HFI_HEVC_LEVEL_4; + case V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1: + return HFI_HEVC_LEVEL_41; + case V4L2_MPEG_VIDEO_HEVC_LEVEL_5: + return HFI_HEVC_LEVEL_5; + case V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1: + return HFI_HEVC_LEVEL_51; + case V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2: + return HFI_HEVC_LEVEL_52; + case V4L2_MPEG_VIDEO_HEVC_LEVEL_6: + return HFI_HEVC_LEVEL_6; + case V4L2_MPEG_VIDEO_HEVC_LEVEL_6_1: + return HFI_HEVC_LEVEL_61; + case V4L2_MPEG_VIDEO_HEVC_LEVEL_6_2: + return HFI_HEVC_LEVEL_62; + } } return 0; @@ -744,6 +788,11 @@ static int venc_set_properties(struct venus_inst *inst) } else if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_H263) { profile = 0; level = 0; + } else if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_HEVC) { + profile = venc_v4l2_to_hfi(V4L2_CID_MPEG_VIDEO_HEVC_PROFILE, + ctr->profile.hevc); + level = venc_v4l2_to_hfi(V4L2_CID_MPEG_VIDEO_HEVC_LEVEL, + ctr->level.hevc); } ptype = HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT;