From patchwork Wed Jun 13 15:07: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: 138479 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp847272lji; Wed, 13 Jun 2018 08:09:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI2V6mAAoji9qUmfyhr9MK1t+S3FuYM7cIoRdGgsYddyvCpAmQwfnahjRgf7+xe6c/w+NMJ X-Received: by 2002:a17:902:585c:: with SMTP id f28-v6mr5615381plj.206.1528902549271; Wed, 13 Jun 2018 08:09:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902549; cv=none; d=google.com; s=arc-20160816; b=hJw2gifIm68B6hoW5trccUQy/EF40cGQhR/mvUxUmP+fsORj/F1rTQ4tuGIoPn2xfk sYKzNkNtAnOucswGyAgxt4TiTAM80IjLeHr0VxMF3N5esbDPiI8fWWnZ+pnVikgqjdmL 6lj0hwgRlyuJ+xy0rsQou/j9/nCdc7GBslmm3usBHFygR4u2s+54tHUT+YtzBoi+6gM3 NPFcv7bEzpZSsPtxDb4U2R/jVUe04h9k4P5FarL2Zk0VPdgVfONw0d05d5MkDsBQLVZm zrV5nDNcOtPVOhdeYVYFTl2AY3V+YS7eD/Aced5G5pVnKwiUteJy1UHoVjnqRHvTr5Cy meFQ== 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=g7vPJ6C9yMPpfGQpi9Z8sz0LII9z4TumPUUp9BsvfwU=; b=zWIXuFkac4XIPglYFrQ/SrpYXgPSrAnZ06JJt04Q6NHuqtBPmGXP8ty4xAgZU5XN/8 HzrLHPxQPpVlWLpVZ2W1fqsasL9lZnPjQiTFwCCjHIymkWqJ7PCvKGdiLSA6sy8fotHP HhnSLTaMWj3ynH856nIsdXvFTDZcHOV6g+ab9XdK5k63gFTEZPPycmssBZKRiL08MhtJ Q8YmhsGTPPlkq/6Y/N0q5GOjEpr+7EvY/oHEiKW1twvjqo7EoVokQ0l7uu6lsvx5Vlbg itC1VXZnpk07WecB3leLnVin7lHE0dbLI3Xt7tBBEhY2En5bPID+3wLt4il1GTEwfJln vYfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="b/o8iHMu"; 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 j84-v6si3027175pfj.79.2018.06.13.08.09.08; Wed, 13 Jun 2018 08:09: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="b/o8iHMu"; 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 S935935AbeFMPJH (ORCPT + 30 others); Wed, 13 Jun 2018 11:09:07 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:34311 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935694AbeFMPJE (ORCPT ); Wed, 13 Jun 2018 11:09:04 -0400 Received: by mail-wr0-f194.google.com with SMTP id a12-v6so3163156wro.1 for ; Wed, 13 Jun 2018 08:09:04 -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=g7vPJ6C9yMPpfGQpi9Z8sz0LII9z4TumPUUp9BsvfwU=; b=b/o8iHMunGPtkbYsi84qKwhpRvA7FlRf0zIU5ZBlR9ixNFKvIdQl1fozVAdMeE/MOf eDgMGQEgCYSUay6r8SNSxmdiChMvgNP9QFi0W4pJ2C3y1T66gl9ZIWBtcrb0HAgK4zLX Tg3YzTu+5GYuxFRmN6V2Br/i76ni2tgZvIy2U= 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=g7vPJ6C9yMPpfGQpi9Z8sz0LII9z4TumPUUp9BsvfwU=; b=erOmqK1eOkPaacBWt3VT1bxJhrLEUsLov682IcVkoNuCYdwEZPraf4Mfx6LwpD1BSN tizTRXpr2nduaO5x7CLOD4LO3x4i7l6ouPmygBQa/uPKQ8LT968js0BorJeD5/jGX6tH s3gUOP0zhkdOvKeFbTUqGop6DCUNjbiWcI+ey5FjlLjJNPF5WQhk2LXg0R/xCLDXZQ1L kVyrtVFvGAWf4w91RLP2ppYW7qbJXe5uAejJ5gwjNiOTuAfF4Hql2Od1W2/zMZubUMem 0M3PlHAwdBWxth+EPEqrrAj/Z4Sb68WBIAz7rfCJMtze29OWWwt1DBQpV9BUkHlDmOuK z1xQ== X-Gm-Message-State: APt69E3QXlokTcHse0MFc52PPi6W2o4rYV28FJjHkaJtHqiBpH44dZFm zb4Ezzm7SWtv8LghKRHm1fiddA== X-Received: by 2002:adf:ee0e:: with SMTP id y14-v6mr4439491wrn.63.1528902543885; Wed, 13 Jun 2018 08:09:03 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:03 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 01/27] venus: hfi_msgs: correct pointer increment Date: Wed, 13 Jun 2018 18:07:35 +0300 Message-Id: <20180613150801.11702-2-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-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 Reviewed-by: Tomasz Figa --- drivers/media/platform/qcom/venus/hfi_msgs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.14.1 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 Wed Jun 13 15:07: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: 138505 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp857185lji; Wed, 13 Jun 2018 08:16:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKINZbloluRG5TUYq8k7OBOSdpnK4UrU8H90FpFFT7VRKLfHnVKs4dXZD8Nlveuo28bVsRZK X-Received: by 2002:a62:9513:: with SMTP id p19-v6mr5311400pfd.239.1528902991676; Wed, 13 Jun 2018 08:16:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902991; cv=none; d=google.com; s=arc-20160816; b=wCLHqzy0/I7rOPJvVRic8J8exBkIiZ1DuaWBnGFqCVy1flAmcDJjTUAHwynOTOue0W oeHMsVu1VDlqG65h0WU8pdxvWIQetRv4EZ3P0VCiDM43P6BYjIaj4FnvPFQCeOtUJbv7 ZIq82MOnEi7DL7wd7pvLptfQUiIRJHlnpqekj4LfUMueO5V6C2CUHBke6F6Dgc7nh0u6 6OzHCsQVbiITlmjoX9E1WOW1TPNHGu7jkhZzBUrJrhronu5Yg74/SO28kvjz9QsT/J9B vHfDg485fjGxbGZtHW9c9EDylIGgdhFm+s2od+Skumc4VJ/bpe925LIVt7MpodvV+0hS d2Ng== 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=Q4VOjPiepSlhJERfbnnBhuea6lSxKsWxYzdpU/r/kD8=; b=1Gv96xnnefXP+iSRISzgPELv+cXifiv7BHjjNN5OgQX5S4uLvGG3r9kNduFfvckluO qLKmaHfvWKYTRH1PcuY36M0IPNcAaQ9F7yOLI6B+nKQdYal10iPafEJrH4vocQ7FUmOe nxVtzxIo9hGjKB76J94YwsqYjJVRsVAfldgGeR2lfkDyqnGNrTss7XFwLugyxd+38sll caoCx2N+nltbXivFIX7ix2pwPukiiBpmgbYmM3MQjmeEJKFk8Mt4upqoV7joPYLjHVtI rTFPc53vvhq3hsmYLCkaMAlmRJSfasno0Hk/EZgJjSwRo2vmjVWDoav5k9pbZwqWdF/A 21rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QZfCkU98; 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 e17-v6si2441498pgv.160.2018.06.13.08.16.31; Wed, 13 Jun 2018 08:16: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=QZfCkU98; 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 S936132AbeFMPQ2 (ORCPT + 30 others); Wed, 13 Jun 2018 11:16:28 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:35150 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935694AbeFMPJJ (ORCPT ); Wed, 13 Jun 2018 11:09:09 -0400 Received: by mail-wm0-f51.google.com with SMTP id j15-v6so6157879wme.0 for ; Wed, 13 Jun 2018 08:09:08 -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=Q4VOjPiepSlhJERfbnnBhuea6lSxKsWxYzdpU/r/kD8=; b=QZfCkU98S1pD2aXixdruDJOauHbv+jvetmIfkZlUmB6xJWjFcdjWU5BvNs6NwgUuhi jDapxaI5O50AHYpoyLVdD/WEomCKG72FVEtW+OMvGup5tgoM3AmmmxofThSFMyMc6j8n PReTbcF/wGmiQ2yKZBL+0OA6Y/Jjhk+PFKvjs= 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=Q4VOjPiepSlhJERfbnnBhuea6lSxKsWxYzdpU/r/kD8=; b=RgKtfeomCD+MRfImNxcL1gmKs8eV5C2GbpsME5cQ7cnRzyH5wHKIYXnlBXHcqSLHNv lDmIiUNgGWXw7s1L0wEuTJlq7BJwOhKzfRKX06+m+RAfACAg6yq3T2H5oc3Mdq18GULW 9WHzBbo+dtc+IMMluHNqq0oOllyNqM4MfimNeMZ2313HngRgkZyDOBr54L74G0AUYWJf 71RpC2tOJKMgjYxV7Ju/NpOV8wy3LDsi/pouJ7QAxdU7R96trpIbACLcsD1dsQzg1LtZ Al8XV/yfpjmNMYlxsAPvTWl3FQQR8tjQsGVGh1qxZnoILWgOT8eYg0okUgLEStIemOVL VkJA== X-Gm-Message-State: APt69E30X5BjiMoZYDVCKNQ2UILG8n6BM3v433T/4kiKQp1iJf5iXa3+ OecG/hEGhNgjLqpzmoGpXw1ApA== X-Received: by 2002:a1c:b6c3:: with SMTP id g186-v6mr3715290wmf.40.1528902547703; Wed, 13 Jun 2018 08:09:07 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:07 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 03/27] venus: hfi: update sequence event to handle more properties Date: Wed, 13 Jun 2018 18:07:37 +0300 Message-Id: <20180613150801.11702-4-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-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 | 10 +++++++ drivers/media/platform/qcom/venus/hfi_msgs.c | 44 ++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/hfi.h b/drivers/media/platform/qcom/venus/hfi.h index 5466b7d60dd0..6038d8e0ab22 100644 --- a/drivers/media/platform/qcom/venus/hfi.h +++ b/drivers/media/platform/qcom/venus/hfi.h @@ -74,6 +74,16 @@ struct hfi_event_data { u32 tag; u32 profile; u32 level; + /* the following properties start appear from v4 onwards */ + u32 bit_depth; + u32 pic_struct; + u32 colour_space; + u32 entropy_mode; + u32 buf_count; + struct { + u32 left, top; + u32 width, height; + } input_crop; }; /* define core states */ diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c b/drivers/media/platform/qcom/venus/hfi_msgs.c index 589e1a6b36a9..54cd41e5837c 100644 --- a/drivers/media/platform/qcom/venus/hfi_msgs.c +++ b/drivers/media/platform/qcom/venus/hfi_msgs.c @@ -25,10 +25,16 @@ static void event_seq_changed(struct venus_core *core, struct venus_inst *inst, struct hfi_msg_event_notify_pkt *pkt) { + enum hfi_version ver = core->res->hfi_version; struct hfi_event_data event = {0}; int num_properties_changed; struct hfi_framesize *frame_sz; struct hfi_profile_level *profile_level; + struct hfi_bit_depth *pixel_depth; + struct hfi_pic_struct *pic_struct; + struct hfi_colour_space *colour_info; + struct hfi_buffer_requirements *bufreq; + struct hfi_extradata_input_crop *crop; u8 *data_ptr; u32 ptype; @@ -69,6 +75,44 @@ static void event_seq_changed(struct venus_core *core, struct venus_inst *inst, event.level = profile_level->level; data_ptr += sizeof(*profile_level); break; + case HFI_PROPERTY_PARAM_VDEC_PIXEL_BITDEPTH: + data_ptr += sizeof(u32); + pixel_depth = (struct hfi_bit_depth *)data_ptr; + event.bit_depth = pixel_depth->bit_depth; + data_ptr += sizeof(*pixel_depth); + break; + case HFI_PROPERTY_PARAM_VDEC_PIC_STRUCT: + data_ptr += sizeof(u32); + pic_struct = (struct hfi_pic_struct *)data_ptr; + event.pic_struct = pic_struct->progressive_only; + data_ptr += sizeof(*pic_struct); + break; + case HFI_PROPERTY_PARAM_VDEC_COLOUR_SPACE: + data_ptr += sizeof(u32); + colour_info = (struct hfi_colour_space *)data_ptr; + event.colour_space = colour_info->colour_space; + data_ptr += sizeof(*colour_info); + break; + case HFI_PROPERTY_CONFIG_VDEC_ENTROPY: + data_ptr += sizeof(u32); + event.entropy_mode = *(u32 *)data_ptr; + data_ptr += sizeof(u32); + break; + case HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS: + data_ptr += sizeof(u32); + bufreq = (struct hfi_buffer_requirements *)data_ptr; + event.buf_count = HFI_BUFREQ_COUNT_MIN(bufreq, ver); + data_ptr += sizeof(*bufreq); + break; + case HFI_INDEX_EXTRADATA_INPUT_CROP: + data_ptr += sizeof(u32); + crop = (struct hfi_extradata_input_crop *)data_ptr; + event.input_crop.left = crop->left; + event.input_crop.top = crop->top; + event.input_crop.width = crop->width; + event.input_crop.height = crop->height; + data_ptr += sizeof(*crop); + break; default: break; } From patchwork Wed Jun 13 15:07:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 138482 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp847518lji; Wed, 13 Jun 2018 08:09:20 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJANkjKRnSjlJh6YJQ372IZCkm9l/kVGWuQWIt6HfrqQFa5XbnsDzvGKXOd45dC0RYSO62n X-Received: by 2002:a17:902:42c3:: with SMTP id h61-v6mr5571213pld.319.1528902559930; Wed, 13 Jun 2018 08:09:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902559; cv=none; d=google.com; s=arc-20160816; b=vZMO1e4BX+dDvmosrRUoifza93Piq3zPAiwPN2p2OsfbhcRBfzy7KH4IZOMisrsc1M 2xDB19kGu0ladhynsasdF1FSvqbWdJs+4G8D0hjvA+XFze+Y0JFpS2lYTPxmNa3DXWck RUf7LR8Lhar+FhoBnKs9MizCEB80IMFGJybMSSnq8yGcaA3ZGR81Oae8g2ff8ElGDk9B ZpID11xqJNQMsGJew97mvJLwcFWtCVONpEbYN8hpyZXTw899HOuJPaAs89HUMt6NA40t qRLXXUst4l9g/N7mvCE/KIs1MCggvcDWyeGa+IO9rb6wmZQ5XiASIbejx03eVJD5shGj 0zzw== 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=2Rjs/riZGr/2boEAWhRGcdDD/iS7glDtXPe+puCnQcc=; b=pGN89VQ/IExL2+MJn2f/T+e/ynZRBvnusgyyrS47EScOfIC5UbdkD/kc8PWLXgKWAh 2/n1gNqPQjAj7O1iz2mMaANACNXHfe/OzKHEXGe2QXrlXSl/hQMfyhwb7mIAohrJpMif aVumPc5SG/0HjaRmq2aRcXYNULlfvqM03dgSxvoGZPCnOconV26Tq4dXDiLb/s3uihRg 3Dk60IxZp8yT4GpPM2gPNdO4vgA3aDOago4pZX5T3VxblOyIHIwAwomrDE8apekC/1nU BpASXz5te/2LTDRfL5yuasVR0F0d/tzk9vEL4VzYkkpUk12vdEFA+rjDrtdhUYcHvlhR pthw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P52I9hmz; 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 h33-v6si3271727plh.124.2018.06.13.08.09.19; Wed, 13 Jun 2018 08:09:19 -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=P52I9hmz; 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 S935979AbeFMPJO (ORCPT + 30 others); Wed, 13 Jun 2018 11:09:14 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:54901 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935951AbeFMPJK (ORCPT ); Wed, 13 Jun 2018 11:09:10 -0400 Received: by mail-wm0-f65.google.com with SMTP id o13-v6so5319440wmf.4 for ; Wed, 13 Jun 2018 08:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2Rjs/riZGr/2boEAWhRGcdDD/iS7glDtXPe+puCnQcc=; b=P52I9hmzV8Gy32BanhgHpkACF9LJcaVpD4PCT/uz0pooSvjrazcfMd/QMZYiTKKX0o iVGc4JbO8t9inFar0DA0ZkCTP2yJCiz7ZONgeithmFQySWYdX3SXbi1vwcoCXx4WnVHw xdsMLwu7ksz/HwNdDv2Ea9dwyBJTlGHQjTIWM= 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=2Rjs/riZGr/2boEAWhRGcdDD/iS7glDtXPe+puCnQcc=; b=heRTRDfND1wIepLeckxARQ6wVMz+zS8ST1FiOsQRxDv8gwgiLNMNgHi4P+fJgdDCDl MWAubzB4rnLJhJhM3sKAFmnCMSrGodmakHe3d8Zb7JjievIqEk09U17SLWvSyJfBKGz4 rcYdDLZOjvdIo4gc2gBKz4V2MMVCQPTZc0LWs1HAwIXwAWp+NBNBeyG2NxH6MCmrATrL S08jz664tICcRFxyxyV+r67w+sSaDZqmNc62GEwEswV5spMzdMCVp/bnMJ/H5c5l3S+h LblBlAw7KQm2yUU4z9OE8CpJzb9AWwaLhP5hVzafZkbXrvjmto8AN3dtXtxyiOkx8LqT qi5A== X-Gm-Message-State: APt69E3qN7NEAhW7SfIckt/nEOWSgG71Ti2p1lHRFuiR7PkIXu8cii5F OMA01C6iy9OTpJMA0b5cUY/T0w== X-Received: by 2002:a1c:e618:: with SMTP id d24-v6mr3589303wmh.154.1528902549312; Wed, 13 Jun 2018 08:09:09 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:08 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 04/27] venus: hfi_cmds: add set_properties for 4xx version Date: Wed, 13 Jun 2018 18:07:38 +0300 Message-Id: <20180613150801.11702-5-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-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 | 62 +++++++++++++++++++++++++++- 1 file changed, 61 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..e8389d8d8c48 100644 --- a/drivers/media/platform/qcom/venus/hfi_cmds.c +++ b/drivers/media/platform/qcom/venus/hfi_cmds.c @@ -1166,6 +1166,63 @@ 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; + + 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: + return pkt_session_set_property_3xx(pkt, cookie, ptype, pdata); + } + + return 0; +} + int pkt_session_get_property(struct hfi_session_get_property_pkt *pkt, void *cookie, u32 ptype) { @@ -1181,7 +1238,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 Wed Jun 13 15:07:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 138484 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp847653lji; Wed, 13 Jun 2018 08:09:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKeCrjenUep0zs+HAG9cVQrU3SaLcz75UK66FQ2okh+K5BBA9RE446WeFSi7LQICKYvye06 X-Received: by 2002:a62:ba13:: with SMTP id k19-v6mr5271010pff.245.1528902565976; Wed, 13 Jun 2018 08:09:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902565; cv=none; d=google.com; s=arc-20160816; b=AC8Rtte5D6sZwaSMsdycQWg+opFK/5GwguyRRYl2+hOtLcO5EwA86b/dR5ie3n4Pmb yPDHhmWgvEavrpcpsy3t1BSz+UHUccqrQ4iRM0taFU0gy2MGWY0GFyCov0vGNQVYH3gY f+4z03X6/Y8DYpc8F27aZ9ssxAeVP5Ut2NoLtCk50sWna6urvdEvauz6XCVbXoP6RDgJ 6R254UzOki6fcAQZOrfypiuamYBZj6w57InUElZyop1RVvx0/CPjfqq/ZPlcVUiCUBt8 q1OCmw0GkR97bC/fiKksVlKt9WVJuTCQew5QFMMNFEit0l/Mx/thj7cTN+18+u5kTH9u XFZQ== 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=DopT6tfRa5ZXddiWA2KYWqHxQ5fQ330DwA7mzNfZ1z4=; b=khvUVobgil0vR2wkToP5UqokzcxYoxZt/PYTJkCmAd4c5symtW278tWUg7BbiMBVXX VKtkNeCOw/mjborUS2crl05dii7mg5oZ+CvFJoLEeIyYgytl21fumZ0WDfYY8P5eGi2k 6tShOm7JvsmaU7UvwswHL8APOFcTqoNBKaeLaXdUq8cKytzuqeQknab6E6/1tEbFOZhX Oeh8sQgSXvPxpqlD+mB7TkLU/UPiEyKqKzO/prMovzBWv+lOSIBgWRuPTyFLhNLGLkCt w0VinIo1PCCJIRSnpr3uEO9GKlUmSPXoH9/rw4zyWH2puXsjLdxfLYGsCKGY6FLg5qgB +cbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TGcQseII; 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 h33-v6si3271727plh.124.2018.06.13.08.09.25; Wed, 13 Jun 2018 08:09:25 -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=TGcQseII; 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 S936031AbeFMPJX (ORCPT + 30 others); Wed, 13 Jun 2018 11:09:23 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35782 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935971AbeFMPJO (ORCPT ); Wed, 13 Jun 2018 11:09:14 -0400 Received: by mail-wm0-f67.google.com with SMTP id j15-v6so6158491wme.0 for ; Wed, 13 Jun 2018 08:09:13 -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=DopT6tfRa5ZXddiWA2KYWqHxQ5fQ330DwA7mzNfZ1z4=; b=TGcQseIIokf4O4DZ8xLZt3+w/947HlwG1URxXKRe2h3HY9sqcCru0SNoT6f9MJLOTX YI606ldSsZF3FbfJNjBssY3FfNYysjC8t83rfOfi02dK04hqf6ODtLZlS0BUfYtWIRmn ia8MofSGAUds8bx1Ag0s09OhrD5dVqzWu9Sqc= 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=DopT6tfRa5ZXddiWA2KYWqHxQ5fQ330DwA7mzNfZ1z4=; b=Oa9AHWVQaF3BhOYbEpi12vdN36IRO/2mO/JnXDBKUmyzSM5kCkfMWxII/XeWKXesHB 83A4cP+rHs15Hlv3hr8zwk1bsZsDcOuDqwPtuqsic8fIsAEF25t9KwD7P6xTL4UMNVRh riPkknFKzonQIocBG3Tdl5pJvXA08+1Ux/Mm53vBdA3hgTfnRVzPMhDmv/yEKRKFwKez RBQk7DgNiqhI1+t/Eoa/b5NHhmevNekt6RVhTSa/xxiOfxNx/rtVA9lYqgqgSn+P+bxF GpG390OrBYxcddQuszv/kztGPNEOPM3wYM+RKfzGCf4s2st2LfGWC/753BsP5Fb3s+zD 4BxQ== X-Gm-Message-State: APt69E0dEkEqiax5/MpF6fL14QsmkuqMePRSSHG+dsNLIvqUGOBu9nGn Vr63dyw8x39Y7jZKM9gsYefvYw== X-Received: by 2002:a1c:91c4:: with SMTP id t187-v6mr4035433wmd.51.1528902553219; Wed, 13 Jun 2018 08:09:13 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:12 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 06/27] venus: hfi: handle buffer output2 type as well Date: Wed, 13 Jun 2018 18:07:40 +0300 Message-Id: <20180613150801.11702-7-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-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 handling of buffers of type OUTPUT2 which is needed to support Venus 4xx version. Signed-off-by: Stanimir Varbanov Reviewed-by: Tomasz Figa --- drivers/media/platform/qcom/venus/hfi.c | 3 ++- drivers/media/platform/qcom/venus/hfi_msgs.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/hfi.c b/drivers/media/platform/qcom/venus/hfi.c index cbc6fad05e47..a570fdad0de0 100644 --- a/drivers/media/platform/qcom/venus/hfi.c +++ b/drivers/media/platform/qcom/venus/hfi.c @@ -473,7 +473,8 @@ int hfi_session_process_buf(struct venus_inst *inst, struct hfi_frame_data *fd) if (fd->buffer_type == HFI_BUFFER_INPUT) return ops->session_etb(inst, fd); - else if (fd->buffer_type == HFI_BUFFER_OUTPUT) + else if (fd->buffer_type == HFI_BUFFER_OUTPUT || + fd->buffer_type == HFI_BUFFER_OUTPUT2) return ops->session_ftb(inst, fd); return -EINVAL; diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c b/drivers/media/platform/qcom/venus/hfi_msgs.c index 54cd41e5837c..c0f3bef8299f 100644 --- a/drivers/media/platform/qcom/venus/hfi_msgs.c +++ b/drivers/media/platform/qcom/venus/hfi_msgs.c @@ -823,7 +823,8 @@ static void hfi_session_ftb_done(struct venus_core *core, error = HFI_ERR_SESSION_INVALID_PARAMETER; } - if (buffer_type != HFI_BUFFER_OUTPUT) + if (buffer_type != HFI_BUFFER_OUTPUT && + buffer_type != HFI_BUFFER_OUTPUT2) goto done; if (hfi_flags & HFI_BUFFERFLAG_EOS) From patchwork Wed Jun 13 15:07: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: 138483 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp847602lji; Wed, 13 Jun 2018 08:09:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKFDTcMIHd55OXRtxLna2bRnjPh01KH0MBO5WCfaYY1vYQLGuORUp+a5RIm/PyytbfHBnO4 X-Received: by 2002:a63:951c:: with SMTP id p28-v6mr4436698pgd.318.1528902563751; Wed, 13 Jun 2018 08:09:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902563; cv=none; d=google.com; s=arc-20160816; b=M2zIJ9BqD0O57bJK6bcBfJzwiHTUtCXE8zJ6g3aFxV/wMFl0jo/jdb5MfEiFr1TUFU JaJR2YeGoK8lSTMtKMc3UqqlGxWRa8iJ4XyaeOYWO5ITcTvjD1GovQQn8peY2vUE6nRC UjVuI2AsQzbUNh4P6cr/QKGSoHOs7i5OsmtYrvJj7Ujv7QEP+5RjqetmyK2ofmkGbMWm Kx49tBWq+NOBhNWB/ABX6HRAGJ06mxjMZfXUrSkIV8HP+l2ZncAvMdEBMROvZycbrHW1 dfbAL/pitxYVf71XoLONVnGZ+QWHJk32D5fheKSpnNJNdbp1HSI2v4oi79mY1S+rZFW5 sRpA== 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=JTs56AHvy6n4KWdfQCk5+mkf+fJThH/BkJrEXFnLkOk=; b=p5oXE5i6hF/q2b9MXBTucS4VUKKlRt7Y2kl3cey40IhB3gwkWrmnVDynRLOGx+UX0T Pd/TbjfErNfgYztD6WRC9AB6j5Zo/L02mmmoVPfLA2TodfPAyRpdYraWvghoUbF73qwx MGCtnFI4RBNb9Tp7G8IKAFcLXPdz3SfNZqqOImRxHF7rpSWpVYm+E9vIm1DLdNS9s2rk smUZQizGo3renB41idDnVKOpRv/y/1QqZapoLmwVf4O6p6oCOF+Qp7YyqL6NA/UaK/Uz 5UqVO8cCGt9mt3Uxe0LoXqEbCif+6B95YHYx9vBirrAUywzmJ/ecBF7keKsjMAp6Al7s mUfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YoDC2T97; 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 h33-v6si3271727plh.124.2018.06.13.08.09.23; Wed, 13 Jun 2018 08:09:23 -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=YoDC2T97; 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 S935972AbeFMPJV (ORCPT + 30 others); Wed, 13 Jun 2018 11:09:21 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:35518 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935956AbeFMPJQ (ORCPT ); Wed, 13 Jun 2018 11:09:16 -0400 Received: by mail-wr0-f194.google.com with SMTP id l10-v6so3163721wrn.2 for ; Wed, 13 Jun 2018 08:09:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JTs56AHvy6n4KWdfQCk5+mkf+fJThH/BkJrEXFnLkOk=; b=YoDC2T97GMSTnDtT1J5RA8dxlqoBLa65csQZd7HMtglZjLp8Et/bXB8KhPwkhNejD3 Mj81L36jR68fKP6AIbwsY5u9emz5NVxP3ZDod6SdVur87rhZeRY8X5VqCgBbzNAXL7GJ JyVUtHFINcPWD3rfzwP2FeuaKrwqC6il7eyLQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JTs56AHvy6n4KWdfQCk5+mkf+fJThH/BkJrEXFnLkOk=; b=SZOR7JnkTXcaYTVOAvP0xQKHVf7p9nowuGywnoWVKE5mhml7CABcoye0UglQHutV8U v6IyY6bHnKT+j44Zx4h7JU7lAYIU6WP707mE64jrdag+fEp9RQcLWAT51IszLPFOJ4Xj dPg674P3DI3vsYru5NBtxNWTJtF1nmrghaWZalCewjYMKDK7xBzAeZzsuYBkXejqd5kd IR1WeA3l0DKp6g890KypMD+Kdzi0IX9uHAs0CU43xreX6swPFRrqm3a6mLbwSFFZ2WKr bU7TOYN3mp9AIIfNzezF2VaVDZzrIsuylEYUIPWBtSl10tR0E/iuiyWHaMzgOs4Ok0yR x9Eg== X-Gm-Message-State: APt69E0PQ8UYIopu7t2WOGAiVPD4I8bnEieZpUIvLl6850qUCtvhGhaw 7US5WChf9uIYodkbolrc2dQIMQ== X-Received: by 2002:adf:86ae:: with SMTP id 43-v6mr4158751wrx.281.1528902555195; Wed, 13 Jun 2018 08:09:15 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:14 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 07/27] venus: hfi_venus: add halt AXI support for Venus 4xx Date: Wed, 13 Jun 2018 18:07:41 +0300 Message-Id: <20180613150801.11702-8-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-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 | 18 ++++++++++++++++++ drivers/media/platform/qcom/venus/hfi_venus_io.h | 2 ++ 2 files changed, 20 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..784b3ad1a9f6 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -532,6 +532,24 @@ static int venus_halt_axi(struct venus_hfi_device *hdev) u32 val; int ret; + if (IS_V4(hdev->core)) { + val = venus_readl(hdev, WRAPPER_CPU_AXI_HALT); + val |= WRAPPER_CPU_AXI_HALT_HALT; + venus_writel(hdev, WRAPPER_CPU_AXI_HALT, val); + + ret = readl_poll_timeout(base + WRAPPER_CPU_AXI_HALT_STATUS, + val, + val & WRAPPER_CPU_AXI_HALT_STATUS_IDLE, + POLL_INTERVAL_US, + VBIF_AXI_HALT_ACK_TIMEOUT_US); + if (ret) { + dev_err(dev, "AXI bus port halt timeout\n"); + return ret; + } + + return 0; + } + /* Halt AXI and AXI IMEM VBIF Access */ val = venus_readl(hdev, VBIF_AXI_HALT_CTRL0); val |= VBIF_AXI_HALT_CTRL0_HALT_REQ; diff --git a/drivers/media/platform/qcom/venus/hfi_venus_io.h b/drivers/media/platform/qcom/venus/hfi_venus_io.h index d327b5cea334..c0b18de1e396 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus_io.h +++ b/drivers/media/platform/qcom/venus/hfi_venus_io.h @@ -104,7 +104,9 @@ #define WRAPPER_CPU_CLOCK_CONFIG (WRAPPER_BASE + 0x2000) #define WRAPPER_CPU_AXI_HALT (WRAPPER_BASE + 0x2008) +#define WRAPPER_CPU_AXI_HALT_HALT BIT(16) #define WRAPPER_CPU_AXI_HALT_STATUS (WRAPPER_BASE + 0x200c) +#define WRAPPER_CPU_AXI_HALT_STATUS_IDLE BIT(24) #define WRAPPER_CPU_CGC_DIS (WRAPPER_BASE + 0x2010) #define WRAPPER_CPU_STATUS (WRAPPER_BASE + 0x2014) From patchwork Wed Jun 13 15:07: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: 138485 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp847777lji; Wed, 13 Jun 2018 08:09:32 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ3+Y5AhDBZsrGPkUwoemg7TxGkRUnbZ4E8QcabFapJkav+c5YFSeXkgivLqiRXSnKprv9B X-Received: by 2002:a62:c4dd:: with SMTP id h90-v6mr5426335pfk.86.1528902571876; Wed, 13 Jun 2018 08:09:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902571; cv=none; d=google.com; s=arc-20160816; b=J0DCBbFl2AmOW7aarPMECZqfVbgT55PihMALnOYk9MxlX/0RFD+wQ/SFgjV1TldURZ M7LNuRd2nfXfSEPCq4RPV0yehfNlPcQ/E+nrrv8RTumJJFNU5dUeOhqqU5XGhbQ0oovf jpe28BFVA8Hf2v8/d2a3sBqOyGL/UIjMvljml1dLH+nEx5E2/SSIwuuLXDltISW1vqdJ ypEZ+FVo7Gsel9RnZ0N/V5P9tSOhc3at1vfDTo15Z/6xp50qA/Z+e+WL07z9mNfyRjct ev4RpNCY8lBXyTM12gKiqBkHrBh6Cp/px59D9UoDEW+3comrz2sIu4XYcs4ro7l3GR13 he5w== 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=2uDxGwnkJEDIEjqGMUQjkdR51PtdwGqouV1zq5IG5iU=; b=zCr3xq0FHQx+NziGcHO/pP/2mdrml2H7vcp9sSYlFYOnHP2MweBDJFme46wuBqDf1W en1VBQcemDlIFkYPsRL+4FENWbDUAILIWT9idtEyelbwo0OlPGnYVPtnNADUsD7C/Ssv TTb0Sx+eP5BPNaH/gt6j6fDgyuyWcm9C2Gp97LnB7O5WeIfiHkxFG1qsf/Cfv7txvEqw 7AVQTaR1grXlmwiwgibbLT5xmifErZHeCo+8J5SC8+TnXII+8q0l75BVxD8NXnI3gpRC ZSuX0z5Kxb+AxddfvvqmmL053vqa1aiJIkqFuMiNEBBzwIt1okNY24PiEJOZV29JyPdp 0oYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jl4nee7p; 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 h33-v6si3271727plh.124.2018.06.13.08.09.31; Wed, 13 Jun 2018 08:09: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=jl4nee7p; 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 S935723AbeFMPJ3 (ORCPT + 30 others); Wed, 13 Jun 2018 11:09:29 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:37073 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936020AbeFMPJX (ORCPT ); Wed, 13 Jun 2018 11:09:23 -0400 Received: by mail-wr0-f193.google.com with SMTP id d8-v6so3153455wro.4 for ; Wed, 13 Jun 2018 08:09:22 -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=2uDxGwnkJEDIEjqGMUQjkdR51PtdwGqouV1zq5IG5iU=; b=jl4nee7ptqemroRPd0+/SoFQEz/x/Htx5Cxe5LzMiJLqUO2e4Q+lRsDpU2QqJ7JQRW QTeNFnbum3m3xOuqo7RGvKHTm8LtuGl6/uBbrgxcB5uRwnriRW5nbiENzfX1whStWEsj G695U6MawWxjUODxKIi+LHM88wXqZRVp2K1go= 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=2uDxGwnkJEDIEjqGMUQjkdR51PtdwGqouV1zq5IG5iU=; b=eXyOD1ZF9/7c0F2bBHqEBTmkkbM0Y5igeW43ianAgjCj+6mULVQWrw5qoOb6oFBVek QJbH1kSAGU0QKraUn0P+cpU9XO3ZDDG21rUgbcsSRuCqoyj6HrDTRb+TPOMfdqqVFKV6 3069MX48Std7gvE6KD3qRAcf8F2nW1tj3hfbk8ylNoPOIw1KSl//WRML5Xx8mjkvLfBC +DXyxlksui2FewgH2Pv6rwY9SongVfZr7z1HJm83eqyJO6bSzqInwE4tHiYAHwuJJdLJ qLMc9eZjEv3HrQG952TSkRqFMMb3yE5X/VFn1CRwk2rtZ2LM4FWJmJ2GnV4B7ERGK3tD Lftg== X-Gm-Message-State: APt69E23D1Si1HTFib+oRu7kNKfHx/YzbGKUulYFpA1Yf36u9NhQV6zV +3mQjqqiIqHWEHaYvkEcs0wdbw== X-Received: by 2002:adf:99a7:: with SMTP id y36-v6mr4493135wrb.64.1528902562007; Wed, 13 Jun 2018 08:09:22 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:21 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 11/27] venus: core, helpers: add two more clocks found in Venus 4xx Date: Wed, 13 Jun 2018 18:07:45 +0300 Message-Id: <20180613150801.11702-12-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-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 two more clocks for Venus 4xx in core structure and create a new power enable function to handle it for 3xx/4xx versions. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 4 +++ drivers/media/platform/qcom/venus/helpers.c | 51 +++++++++++++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 ++ drivers/media/platform/qcom/venus/vdec.c | 44 ++++++++++++++++++++----- drivers/media/platform/qcom/venus/venc.c | 44 ++++++++++++++++++++----- 5 files changed, 129 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..2bf8839784fa 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -65,6 +65,8 @@ struct venus_format { * @clks: an array of struct clk pointers * @core0_clk: a struct clk pointer for core0 * @core1_clk: a struct clk pointer for core1 + * @core0_bus_clk: a struct clk pointer for core0 bus clock + * @core1_bus_clk: a struct clk pointer for core1 bus clock * @vdev_dec: a reference to video device structure for decoder instances * @vdev_enc: a reference to video device structure for encoder instances * @v4l2_dev: a holder for v4l2 device structure @@ -94,6 +96,8 @@ struct venus_core { struct clk *clks[VIDC_CLKS_NUM_MAX]; struct clk *core0_clk; struct clk *core1_clk; + struct clk *core0_bus_clk; + struct 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/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index d9065cc8a7d3..228084e72fb7 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -13,6 +13,7 @@ * */ #include +#include #include #include #include @@ -24,6 +25,7 @@ #include "core.h" #include "helpers.h" #include "hfi_helper.h" +#include "hfi_venus_io.h" struct intbuf { struct list_head list; @@ -781,3 +783,52 @@ void venus_helper_init_instance(struct venus_inst *inst) } } EXPORT_SYMBOL_GPL(venus_helper_init_instance); + +int venus_helper_power_enable(struct venus_core *core, u32 session_type, + bool enable) +{ + void __iomem *ctrl, *stat; + u32 val; + int ret; + + if (!IS_V3(core) && !IS_V4(core)) + return 0; + + if (IS_V3(core)) { + if (session_type == VIDC_SESSION_TYPE_DEC) + ctrl = core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL; + else + ctrl = core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL; + if (enable) + writel(0, ctrl); + else + writel(1, ctrl); + + return 0; + } + + if (session_type == VIDC_SESSION_TYPE_DEC) { + ctrl = core->base + WRAPPER_VCODEC0_MMCC_POWER_CONTROL; + stat = core->base + WRAPPER_VCODEC0_MMCC_POWER_STATUS; + } else { + ctrl = core->base + WRAPPER_VCODEC1_MMCC_POWER_CONTROL; + stat = core->base + WRAPPER_VCODEC1_MMCC_POWER_STATUS; + } + + if (enable) { + writel(0, ctrl); + + ret = readl_poll_timeout(stat, val, val & BIT(1), 1, 100); + if (ret) + return ret; + } else { + writel(1, ctrl); + + ret = readl_poll_timeout(stat, val, !(val & BIT(1)), 1, 100); + if (ret) + return ret; + } + + return 0; +} +EXPORT_SYMBOL_GPL(venus_helper_power_enable); diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 971392be5df5..0e64aa95624a 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -43,4 +43,6 @@ int venus_helper_set_color_format(struct venus_inst *inst, u32 fmt); void venus_helper_acquire_buf_ref(struct vb2_v4l2_buffer *vbuf); void venus_helper_release_buf_ref(struct venus_inst *inst, unsigned int idx); void venus_helper_init_instance(struct venus_inst *inst); +int venus_helper_power_enable(struct venus_core *core, u32 session_type, + bool enable); #endif diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 261a51adeef2..3cf243ddcdb8 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(); @@ -1131,15 +1137,21 @@ static int vdec_remove(struct platform_device *pdev) static __maybe_unused int vdec_runtime_suspend(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); + int ret; - if (core->res->hfi_version == HFI_VERSION_1XX) + if (IS_V1(core)) return 0; - writel(0, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); + ret = venus_helper_power_enable(core, VIDC_SESSION_TYPE_DEC, true); + + if (IS_V4(core)) + clk_disable_unprepare(core->core0_bus_clk); + clk_disable_unprepare(core->core0_clk); - writel(1, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); - return 0; + ret |= venus_helper_power_enable(core, VIDC_SESSION_TYPE_DEC, false); + + return ret; } static __maybe_unused int vdec_runtime_resume(struct device *dev) @@ -1147,13 +1159,29 @@ 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); + ret = venus_helper_power_enable(core, VIDC_SESSION_TYPE_DEC, true); + if (ret) + return ret; + ret = clk_prepare_enable(core->core0_clk); - writel(1, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); + if (ret) + goto err_power_disable; + + if (IS_V4(core)) + ret = clk_prepare_enable(core->core0_bus_clk); + if (ret) + goto err_unprepare_core0; + + return venus_helper_power_enable(core, VIDC_SESSION_TYPE_DEC, false); + +err_unprepare_core0: + clk_disable_unprepare(core->core0_clk); +err_power_disable: + venus_helper_power_enable(core, VIDC_SESSION_TYPE_DEC, false); return ret; } diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 947001170a77..2cd7b342b208 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(); @@ -1275,15 +1281,21 @@ static int venc_remove(struct platform_device *pdev) static __maybe_unused int venc_runtime_suspend(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); + int ret; - if (core->res->hfi_version == HFI_VERSION_1XX) + if (IS_V1(core)) return 0; - writel(0, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); + ret = venus_helper_power_enable(core, VIDC_SESSION_TYPE_ENC, true); + + if (IS_V4(core)) + clk_disable_unprepare(core->core1_bus_clk); + clk_disable_unprepare(core->core1_clk); - writel(1, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); - return 0; + ret |= venus_helper_power_enable(core, VIDC_SESSION_TYPE_ENC, false); + + return ret; } static __maybe_unused int venc_runtime_resume(struct device *dev) @@ -1291,13 +1303,29 @@ 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); + ret = venus_helper_power_enable(core, VIDC_SESSION_TYPE_ENC, true); + if (ret) + return ret; + ret = clk_prepare_enable(core->core1_clk); - writel(1, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); + if (ret) + goto err_power_disable; + + if (IS_V4(core)) + ret = clk_prepare_enable(core->core1_bus_clk); + if (ret) + goto err_unprepare_core1; + + return venus_helper_power_enable(core, VIDC_SESSION_TYPE_ENC, false); + +err_unprepare_core1: + clk_disable_unprepare(core->core1_clk); +err_power_disable: + venus_helper_power_enable(core, VIDC_SESSION_TYPE_ENC, false); return ret; } From patchwork Wed Jun 13 15:07: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: 138500 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp854545lji; Wed, 13 Jun 2018 08:14:33 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLNmxVgaCc99WYkLGit6Arpo9OGg/LWwqy19IJfG9Rn2UTXmeziuuNIdmgrWAfmy06tJb3A X-Received: by 2002:a65:510c:: with SMTP id f12-v6mr4341115pgq.288.1528902872925; Wed, 13 Jun 2018 08:14:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902872; cv=none; d=google.com; s=arc-20160816; b=X1DUEmwKi2Ytt0X/qHyyAUMfLAYEQFTYof0JeA+RHe+bEqvB3rnGfI8o6l4kk2ahgk GP3u8FfGCGV1gcosyoW/MVyE1aHAfqMtYRO9tqaehq82d9C+xWw27AC+FJjiMShSubqb Dic34ondOR332XD1pxInG/CYjufMBKi5F3Y1JfYFt/SiQ/zlqKNT/DPzfkMP2fevMkCm VxjZsAUshXDbmF+M5EYKUt8KFiOhyrDC81UR/t9eSw5NBHrULKjwh6GjEVrjUvOQub5G d/5KG/KKIdD9jzk1lFXt/U9UyBs2OpgvJyQ9xN5bpFv1dhcGj8BmNYBS7jjxkmX8Brrh r9cw== 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=yztKk2BM2Urd2i4rlMoJSMQuiyuNHcjDJ4S89zi609U=; b=KL8Ll/8aw6tv8RFCcgrWVuo+/t+4SjYiHx6DU7emIvwg0hzQcQqyjFL9Gmpb5b7nXd vWQyW9c9zTWnoeK1SNIW++BaqxV9J+mBfGoo5eQEiDKCavX3f3ZrEyAPkLlbpq5LBaBa Y9Kz7j0DE9Z6OCYxPX7P6XKEtMVEZMEJdrdGHmelhfwqtMOtkwcipVnEUkd/QAOf498j RIM1gEAcWmg+P9d9hwXcmVYUX1ZFXVj05qjlrQ+8f6gbc+Z8YmyClA2GeRfhBb81wI+a lCvlLM3dJWy17SbHXqVuhMh8HQ9UGTZiuYysY37siU8+a0zyZ4R5XeN/u76DX3J/pUR/ /PDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aWOXZVIe; 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 9-v6si3124003ple.104.2018.06.13.08.14.32; Wed, 13 Jun 2018 08:14:32 -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=aWOXZVIe; 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 S935836AbeFMPOa (ORCPT + 30 others); Wed, 13 Jun 2018 11:14:30 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:40544 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935842AbeFMPJZ (ORCPT ); Wed, 13 Jun 2018 11:09:25 -0400 Received: by mail-wr0-f196.google.com with SMTP id l41-v6so3135694wre.7 for ; Wed, 13 Jun 2018 08:09:24 -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=yztKk2BM2Urd2i4rlMoJSMQuiyuNHcjDJ4S89zi609U=; b=aWOXZVIeEl5YIApuxaUdbshw5Ec4wFD7Hi2XuRCDvt1L2tmU8iBd5dJTjhEDf8NRZW KlFLFQpXi4xVkjH/Z+foYBLl4sw/+7G506WbKQcdjse0gV3mEuF7lCJkTf/2RIwGJT37 X9o8LfgKQNcx+7Fwz96Eb/6Qu4xeLEcA3cDj0= 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=yztKk2BM2Urd2i4rlMoJSMQuiyuNHcjDJ4S89zi609U=; b=V82kc6WXMtntvfze/9Rsq4Ttk95/HTyLDRKg5cvJcGLqSWoedvYNOOcVvw1NGpRKRH sywmO2bCTd0apdBS53Dd1CVBfDvev/Ext7ggllmUfSt+fhHYqVV2IynnF+jgucansLsA WTcFeJ0a2wZRxRMkwgqB0a7t7AqLa8mA1/gmg/Hx3KH8HbVUY+JRrr2TIP6yNQWHJLM0 plGIIeV0KkXuemFxHMhCoW75RQKjNchZWP1BKxcqkk/Otbs0GDiKpcoCT9vzDjjSqFgv XfG8D36v7F+2K1l0n0Gyo2s8VJX2t83h5l9C2wb4GDMcrqUCflvqR6ywUjn/7Z0trfjy H3Hw== X-Gm-Message-State: APt69E2+A7XsAANwHH7EYhEo7CM0DlhNBKq/JQWsGi7PwglwAB6bXmM8 Tq8J15jMEXqUpTtDD+vDB9o7Xg== X-Received: by 2002:adf:ee0e:: with SMTP id y14-v6mr4440542wrn.63.1528902563680; Wed, 13 Jun 2018 08:09:23 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:23 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 12/27] venus: hfi_parser: add common capability parser Date: Wed, 13 Jun 2018 18:07:46 +0300 Message-Id: <20180613150801.11702-13-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-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 | 74 +++--- 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 | 282 ++++++++++++++++++++ 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, 521 insertions(+), 439 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 2bf8839784fa..b995d1601c87 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -57,6 +57,30 @@ struct venus_format { u32 type; }; +#define MAX_PLANES 4 +#define MAX_FMT_ENTRIES 32 +#define MAX_CAP_ENTRIES 32 +#define MAX_ALLOC_MODE_ENTRIES 16 +#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; /* used only for Venus v1xx */ +}; + /** * struct venus_core - holds core parameters valid for all instances * @@ -113,8 +137,8 @@ struct venus_core { unsigned int error; bool sys_error; const struct hfi_core_ops *core_ops; - u32 enc_codecs; - u32 dec_codecs; + unsigned long enc_codecs; + unsigned long dec_codecs; unsigned int max_sessions_supported; #define ENC_ROTATION_CAPABILITY 0x1 #define ENC_SCALING_CAPABILITY 0x2 @@ -124,6 +148,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 { @@ -216,6 +242,7 @@ struct venus_buffer { * @reconfig: a flag raised by decoder when the stream resolution changed * @reconfig_width: holds the new width * @reconfig_height: holds the new height + * @hfi_codec: current codec for this instance in HFI space * @sequence_cap: a sequence counter for capture queue * @sequence_out: a sequence counter for output queue * @m2m_dev: a reference to m2m device structure @@ -228,22 +255,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; @@ -280,6 +293,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; @@ -291,22 +305,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) @@ -326,4 +326,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 < core->codecs_count; 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..15804ad7e65d 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_constraints[1]; +}; + struct hfi_uncompressed_format_supported { u32 buffer_type; u32 format_entries; - u32 format_info[1]; + struct hfi_uncompressed_plane_info plane_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 c0f3bef8299f..d3cbb062e1cf 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) @@ -217,81 +218,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); } @@ -369,51 +319,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) @@ -503,238 +408,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) @@ -743,8 +421,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..e8e41811db80 --- /dev/null +++ b/drivers/media/platform/qcom/venus/hfi_parser.c @@ -0,0 +1,282 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2018 Linaro Ltd. + * + * Author: Stanimir Varbanov + */ +#include +#include + +#include "core.h" +#include "hfi_helper.h" +#include "hfi_parser.h" + +typedef void (*func)(struct venus_caps *cap, const void *data, + unsigned int size); + +static void init_codecs(struct venus_core *core) +{ + struct venus_caps *caps = core->caps, *cap; + unsigned long bit; + + for_each_set_bit(bit, &core->dec_codecs, MAX_CODEC_NUM) { + cap = &caps[core->codecs_count++]; + cap->codec = BIT(bit); + cap->domain = VIDC_SESSION_TYPE_DEC; + cap->valid = false; + } + + for_each_set_bit(bit, &core->enc_codecs, MAX_CODEC_NUM) { + cap = &caps[core->codecs_count++]; + cap->codec = BIT(bit); + 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, const void *data, unsigned int num) +{ + const u32 *type = data; + + if (*type == HFI_BUFFER_MODE_DYNAMIC) + cap->cap_bufs_mode_dynamic = true; +} + +static void +parse_alloc_mode(struct venus_core *core, u32 codecs, u32 domain, void *data) +{ + struct hfi_buffer_alloc_mode_supported *mode = data; + u32 num_entries = mode->num_entries; + u32 *type; + + if (num_entries > MAX_ALLOC_MODE_ENTRIES) + 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 fill_profile_level(struct venus_caps *cap, const void *data, + unsigned int num) +{ + const struct hfi_profile_level *pl = data; + + memcpy(cap->pl, pl, num * sizeof(*pl)); + cap->num_pl += num; +} + +static void +parse_profile_level(struct venus_core *core, u32 codecs, u32 domain, void *data) +{ + struct hfi_profile_level_supported *pl = data; + struct hfi_profile_level *proflevel = pl->profile_level; + struct hfi_profile_level pl_arr[HFI_MAX_PROFILE_COUNT] = {}; + + if (pl->profile_count > HFI_MAX_PROFILE_COUNT) + return; + + memcpy(pl_arr, proflevel, pl->profile_count * sizeof(*proflevel)); + + for_each_codec(core->caps, ARRAY_SIZE(core->caps), codecs, domain, + fill_profile_level, pl_arr, pl->profile_count); +} + +static void +fill_caps(struct venus_caps *cap, const void *data, unsigned int num) +{ + const struct hfi_capability *caps = data; + + memcpy(cap->caps, caps, num * sizeof(*caps)); + cap->num_caps += num; +} + +static void +parse_caps(struct venus_core *core, 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] = {}; + + if (num_caps > MAX_CAP_ENTRIES) + return; + + memcpy(caps_arr, cap, num_caps * sizeof(*cap)); + + for_each_codec(core->caps, ARRAY_SIZE(core->caps), codecs, domain, + fill_caps, caps_arr, num_caps); +} + +static void fill_raw_fmts(struct venus_caps *cap, const void *fmts, + unsigned int num_fmts) +{ + const struct raw_formats *formats = fmts; + + memcpy(cap->fmts, formats, num_fmts * sizeof(*formats)); + cap->num_fmts += num_fmts; +} + +static void +parse_raw_formats(struct venus_core *core, u32 codecs, u32 domain, void *data) +{ + struct hfi_uncompressed_format_supported *fmt = data; + struct hfi_uncompressed_plane_info *pinfo = fmt->plane_info; + struct hfi_uncompressed_plane_constraints *constr; + u32 entries = fmt->format_entries; + u32 num_planes; + struct raw_formats rawfmts[MAX_FMT_ENTRIES] = {}; + unsigned int i = 0; + + while (entries) { + num_planes = pinfo->num_planes; + + rawfmts[i].fmt = pinfo->format; + rawfmts[i].buftype = fmt->buffer_type; + i++; + + if (pinfo->num_planes > MAX_PLANES) + break; + + 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, rawfmts, 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 (IS_V1(core)) { + core->dec_codecs &= ~HFI_VIDEO_CODEC_HEVC; + core->dec_codecs &= ~HFI_VIDEO_CODEC_SPARK; + } +} + +static void parse_max_sessions(struct venus_core *core, const void *data) +{ + const 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_inst *inst, u32 *codecs, u32 *domain) +{ + if (!inst || !IS_V1(inst->core)) + return; + + *codecs = inst->hfi_codec; + *domain = inst->session_type; +} + +static void parser_fini(struct venus_inst *inst, u32 codecs, u32 domain) +{ + struct venus_caps *caps, *cap; + unsigned int i; + u32 dom; + + if (!inst || !IS_V1(inst->core)) + return; + + caps = inst->core->caps; + 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(inst, &codecs, &domain); + + while (words_count) { + data = word + 1; + + switch (*word) { + case HFI_PROPERTY_PARAM_CODEC_SUPPORTED: + parse_codecs(core, data); + init_codecs(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, codecs, domain, data); + break; + case HFI_PROPERTY_PARAM_CAPABILITY_SUPPORTED: + parse_caps(core, codecs, domain, data); + break; + case HFI_PROPERTY_PARAM_PROFILE_LEVEL_SUPPORTED: + parse_profile_level(core, codecs, domain, data); + break; + case HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE_SUPPORTED: + parse_alloc_mode(core, codecs, domain, data); + break; + default: + break; + } + + word++; + words_count--; + } + + parser_fini(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..59bcd7c3a4d8 --- /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 < caps->num_caps; 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 3cf243ddcdb8..31a240ab142b 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 2cd7b342b208..aa6b0026d79d 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 Wed Jun 13 15:07:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 138501 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp854896lji; Wed, 13 Jun 2018 08:14:49 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLlpWBbfJuZy7slTFgh88t2LuUfiYFwHEq5B5KO+vjPLIy0UHgG4ZVR1T8W3j8jJKnm4mbt X-Received: by 2002:a65:6591:: with SMTP id u17-v6mr4294608pgv.401.1528902889314; Wed, 13 Jun 2018 08:14:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902889; cv=none; d=google.com; s=arc-20160816; b=C/I6VGboubHGeRKcrxAP7Oyhnp27+pguRi4sspw+9SRKb7Pq0XOiQpLlMaTkmFKpHm qSJ/i8zgNGVG8NyeZWHwFEntLbs0eamw6dj0vsLnnrzwkiQhEzJR6CLFOXGZZkEzUKbP e45rFAzssrZlUffVD0mTFiDws1Xa7/7kjqCu2/Loyu2yDbiAcK47aU5c6l+c5cTtqwDi /V1aAMLsUHVxryTFltT923VCvF3BhcyV8r0dN7nI6pPmYjWGzIRuREUVw8JIyUPNrjhc 26MNft65DyZbjaDL8tFbTtsfB1ufpvbpnE64NFn+hZlRKzf8qqNhTaxBXbtp+ukQuiIp ZSjQ== 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=tpg/OEO6kmuXcfyGgT7M54n6/6j/1UYfIVpGWyjDnSc=; b=vFMutV6f92sysBOdOtreGRcRsAKPygjEowo4QT39ZIJ419P/q3VvhpbbTgSKEJlgre 7l3QOVdD48IQrHaFv0SLwkfN1/sP1MIUcnY53+4jnlL76JTODysutRLdEAHvxBujOMyY DsBd2io/YkjRZ0Czg0Jgl8Ht/2NeeZDRJEQDCoOVsgJlpFmmfxsbAX6/zU/Q2R0L/luI yVAVKdKMI57UoNsSuzi/1LaKrvZJRxL+vF1m1dTdCTt+fwmobroLL3cv3ZRo6ZblZ8ul wJjh4T46wA9XeZvOBLm4hpEnYRC9gUx5oXqvuFKDSItlvYjLOYnY+ADexT2YSkYSjnjp bmLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JEVvuOBU; 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 i15-v6si2575681pgf.412.2018.06.13.08.14.49; Wed, 13 Jun 2018 08:14:49 -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=JEVvuOBU; 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 S936078AbeFMPO3 (ORCPT + 30 others); Wed, 13 Jun 2018 11:14:29 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:35537 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936033AbeFMPJ0 (ORCPT ); Wed, 13 Jun 2018 11:09:26 -0400 Received: by mail-wr0-f193.google.com with SMTP id l10-v6so3164339wrn.2 for ; Wed, 13 Jun 2018 08:09:26 -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=tpg/OEO6kmuXcfyGgT7M54n6/6j/1UYfIVpGWyjDnSc=; b=JEVvuOBUkZR9I2+mI1l9O8R3pWwYyfNE7mSdJu+Qt91VTiaSrBCuUBUzicavGUSCaA NPf5Wlz4Sf11zw2wJhrgqwhpcmUYyMxwpKY4eIPIVyffB7+WEGCowY7KOK75KIfMX3hx g40eJ4kY++PTpv5Q1P2M3nAsyKI1k6SdOUDSY= 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=tpg/OEO6kmuXcfyGgT7M54n6/6j/1UYfIVpGWyjDnSc=; b=Z/av8INt8La/03i0oEoZ66PJAML+7WmDZVTR4YUba6L8vYpbAZRS6L9WuRwn5uVhfp ZwV8n824O0Ut/BeeWr6lF69Gm1Bsese8fTocKskUy6mK7v28o+tu/rJYS6yevr8xuJgH uXx9ohX6pt66L24ThcUsUai7cFZP5DUr/fzFSJ/ilLQbCa0ptcadDspfNi15VH91p1GQ t2lJZOV2PCZeKqoq7QRhZtJf6VkcYLaanbBdGxj7J+2+wLscC5IqfwsFBpYttmKSW5CL ut7PfrcNcrgjLT5WLMTyVCyqofolsSymplbeSaHCgRnxq9B3bWuSAZkg+quNWGuGA9a2 qq5Q== X-Gm-Message-State: APt69E3FklapicE9kshlVQqGzYU0Mu8DR2233Rg/XPJ2dIp9w/ER4QEn vYT8eUk9yh8pe5WMjq2B4rEnnw== X-Received: by 2002:adf:91e5:: with SMTP id 92-v6mr4548396wri.124.1528902565457; Wed, 13 Jun 2018 08:09:25 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:24 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 13/27] venus: helpers: rename a helper function and use buffer mode from caps Date: Wed, 13 Jun 2018 18:07:47 +0300 Message-Id: <20180613150801.11702-14-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-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 | 18 ++++++++---------- 1 file changed, 8 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 228084e72fb7..03121dbb4175 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -354,18 +354,16 @@ session_process_buf(struct venus_inst *inst, struct vb2_v4l2_buffer *vbuf) return 0; } -static inline int is_reg_unreg_needed(struct venus_inst *inst) +static bool is_dynamic_bufmode(struct venus_inst *inst) { - if (inst->session_type == VIDC_SESSION_TYPE_DEC && - inst->core->res->hfi_version == HFI_VERSION_3XX) - return 0; + struct venus_core *core = inst->core; + struct venus_caps *caps; - if (inst->session_type == VIDC_SESSION_TYPE_DEC && - inst->cap_bufs_mode_dynamic && - inst->core->res->hfi_version == HFI_VERSION_1XX) + caps = venus_caps_by_codec(core, inst->hfi_codec, inst->session_type); + if (!caps) return 0; - return 1; + return caps->cap_bufs_mode_dynamic; } static int session_unregister_bufs(struct venus_inst *inst) @@ -374,7 +372,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 +392,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 Wed Jun 13 15:07: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: 138495 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp852012lji; Wed, 13 Jun 2018 08:12:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKzpEFcD5yHTmENHM6WZZJrK2c7cAR6Br85LizqkJzQzi1DBOjSjOdDctDzO01LRj5eMc9I X-Received: by 2002:a63:6dc5:: with SMTP id i188-v6mr4361199pgc.391.1528902749004; Wed, 13 Jun 2018 08:12:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902748; cv=none; d=google.com; s=arc-20160816; b=gaEWumLsQweBT/avDbc56vOKoSkqWDogqAZg7pkYBtLCcVi5h6SLIFwLsxM9b1LCrZ aF0CirVSK8hZ9USDXDx7e8Bh4wL7s55tp8eluFb0MPS7NNGT1ug9vWxnX/OSv/Buz5bQ CFQ7Jb9CsbGJ8UCVZhWDFfa2zb5W35NzdJCAM8illUT01cZzL4qs99065TU5eJvq2GY0 MJmK6vxuFazzCsgwSE0a29OJchonSqXl8dY2FJCsXQPIM3h1YX+YqV156i6T0mWZkDj3 03cTe83SlA0fC2eCChxZ8UX+DyMRU+1r7ums070gGxih8l3M8kyK9AScZ79gvBUcB7Qd hFpA== 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=tdgb7i3pHOc18juXBnV581NGwky8g4nU20Ecgz01uNo=; b=gKu3zkT3x/6dlNulvwoelUxMs1GqggQiCwGuP9CeVxZs9t0pgnr7Kon0O/vX21V9ZE kpmE/P4lhfItQ8d2hNuqKwQb9fAxRaHKg3DbrkBQ7Qc14qIXdCYDA3DDrE4ZKnowxqiL lhX8YSkG6e5Bty18I3DqPMr7M6u7ONDlqoSjMQzAFTFWHiiYBgeteFYbvNj3qGhc2n1L +UtTVWcDU9rlSYg5hG0LIrCR/IWWU/bJFBf/aKggxdo+8Pole3nvL9HbzyR5TU+fQgZI HBm3sq9fhauv1XTJeTnCsGwJfDueUwWmUcUmIJHt7pgybhuuX48NNJYFrS+fTbdhSgc7 nX3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Peysxwj/"; 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 m3-v6si3173770pfm.0.2018.06.13.08.12.28; Wed, 13 Jun 2018 08:12:28 -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="Peysxwj/"; 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 S964842AbeFMPJf (ORCPT + 30 others); Wed, 13 Jun 2018 11:09:35 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35901 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964794AbeFMPJ2 (ORCPT ); Wed, 13 Jun 2018 11:09:28 -0400 Received: by mail-wm0-f68.google.com with SMTP id v131-v6so6113013wma.1 for ; Wed, 13 Jun 2018 08:09:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tdgb7i3pHOc18juXBnV581NGwky8g4nU20Ecgz01uNo=; b=Peysxwj/SxfKV2HWMBS22WXjOKTcC4lZjBQI9R80bN+ZxC3VZcVtRvL+YNKbzybTRz I6Bzi9UPL4pM2ajXjyAga3Ihmiv3p74n3CZWAeWuXB98WxmaiKZKzBwViRVRKtm5eG+K iQ0g0Ev2epWxrIHAWaUPnY6b87df6s4dfC+k4= 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=tdgb7i3pHOc18juXBnV581NGwky8g4nU20Ecgz01uNo=; b=N1XVaetj6+a77OS5gFo4at7igXwPKuM+AOrzaETka1BXgL9/Ajx9Zofz+DNcoLr0LH epHRZbRkBKn881kZ0wHqP5itrvimjnRoLYBremO9klMchRWmq+Q8e4dcmrGAkm8QQ3Lz IuNyyo8kECxi4DPerw1Bd+CHKGxIEyaVn2hvQErUvfcDUH99mEpXl/aiKc1BU18trh8P LuWXTIPlNoVdvWQalGM985ds2S2cdvQk5tKf/wwBR49Z0bm6LQ9hTxkePdLBo9dsBcpY gGlm1POP1r+vz6q39svvWk47UCi5wk0cs6vW861jJ2aA+hJdtkLzBj+J5QlV6OtNYq1z O7Cg== X-Gm-Message-State: APt69E2rPIvFo8u6UT3ZcV6gDJN4TRyVC7DeTEzI257kHgR4NihZswA3 NbANFanNCeN/9Ax3tk/BOveaKw== X-Received: by 2002:a1c:40d4:: with SMTP id n203-v6mr3687240wma.101.1528902567203; Wed, 13 Jun 2018 08:09:27 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:26 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 14/27] venus: helpers: add a helper function to set dynamic buffer mode Date: Wed, 13 Jun 2018 18:07:48 +0300 Message-Id: <20180613150801.11702-15-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-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. The dynamic buffer mode is set unconditionally for both decoder outputs. 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 03121dbb4175..e3dc2772946f 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -519,6 +519,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 31a240ab142b..92669a358a90 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 Wed Jun 13 15:07: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: 138486 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp847988lji; Wed, 13 Jun 2018 08:09:40 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIcX5jxyXQHydARLy3bQBQCk4hs0LpA9cieG1eA5vwMb6S1bA9AP4pocm8vCm75SyPdYT4K X-Received: by 2002:a63:77c9:: with SMTP id s192-v6mr4435152pgc.140.1528902580588; Wed, 13 Jun 2018 08:09:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902580; cv=none; d=google.com; s=arc-20160816; b=vvgpLIsQpx6iPhH+uTquAfMdpZPUVkUObhOyQTXIciHl5Dbc8Mh0MbcuUqgbrbr52K uEAhzBYVw1JvD0mP0RTm4ql+FJFlG50ggC8jio1F5YdvxZhJObILPf0yyvu+/024VLzE mWOgeSEVGl9FPruR5at2AipuSd4mqpzBWxKc6S/wkRMGv7MXxqJDcI7ZLjHjJpd8rmoH 2qNEfbLW42Zf9uD4GUnH7z1U/Cond93CZj0tLv9TlRx8ns8oIJD+rVc2PoMEDrvJzqRP gW+QHjGAMbWUgIRPpWVXQuiAjdMGO2pWMSoAPWcvH5aetqaZxASe1ElweIMN/JuzN3Ug jQyA== 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=+ssufRupM9PR8pPvQwm/oq0OgQo86xh959S5/coLDU0=; b=nhmqTFUSsbKK5LQFFO40vA7m+Boi7iWqbSdsSZvN8IlzZli/B8gLJI21jnauOCWHE/ KfbFOtz9d/q6FFki7D9KISyab0aymoN9vvZrJ4lkNwzyQaI+uHWAvtUw0RHUXyz+I+Sy eyI4BYsPbI9TGN6oEQTw3J7yL44FFQnfcVNuG91j7E67JdOFXNjppYRUXOLPhTiFHZGr KP8qfJltBsyYfsecAAso3GqlTYSvcVCynlNyUI4Fp2RE/ck1tpKqgcHrpNFjO+lfkTKc fVEL0/bFWKZ08bWTpj/TXegJMfN5IRN4+qteaiJzvsaV/iuvV219LtdKqILTvkMJaMxa Fxww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HAvcH6mT; 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 g83-v6si3138772pfg.225.2018.06.13.08.09.40; Wed, 13 Jun 2018 08:09: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=HAvcH6mT; 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 S964864AbeFMPJi (ORCPT + 30 others); Wed, 13 Jun 2018 11:09:38 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:38314 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936020AbeFMPJb (ORCPT ); Wed, 13 Jun 2018 11:09:31 -0400 Received: by mail-wr0-f194.google.com with SMTP id e18-v6so3154166wrs.5 for ; Wed, 13 Jun 2018 08:09:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+ssufRupM9PR8pPvQwm/oq0OgQo86xh959S5/coLDU0=; b=HAvcH6mT/lQ1wclNDe8VS5pd8ZPeAO+ONYeGGJw3nArgNCX1nyd/vsR4nbLvDyj3ww Ffm2reqWvkQK8RVDPYEe1EjarTCCw0I9s3VyRbKQP/d/f1jlou+7bUBzOLMfNcyIAqwT zvL13Op5aT18qk0+FSQjjOSbAA1xItbxrEOHk= 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=+ssufRupM9PR8pPvQwm/oq0OgQo86xh959S5/coLDU0=; b=hEzioAOsNLYizKKYNAQpAdHhSfmOZH0HOYE0JHnurqUfj7ZUCvBrc9prYeKbzaYeF0 aHhOXDZsYhmfERH3e5NIMm6O4Eyd5mGmXW9xp/qVUg5wWdJHjLZThFDt93m1PKH1O4bV Q8mnz69nNdsclAl9m/onLc2Q5lokyIr+SYwUzsV7LqArtZY0+mXHtOg3cQHtsvCgQzhG ocsagyAAQa+m2lLkzfRAK3jZK8MN4I53rFZvz1DNqK5+glZ0ETOwl7VddC2dfFUyuuap BYAD6aVyWNB8cgkiaqqewKQMZ78CbGEL81aNHy/JIYDxJNtMteOVArR8OXyWnjH3Szh7 OuLg== X-Gm-Message-State: APt69E0B14ESnuWz8gtxF6WPmxRn8cOQvpFx4Cr+ER5/Ap/8DGHLFNMH D9ReebSoLWSeHa3BIg5BtWCr2g== X-Received: by 2002:adf:ac37:: with SMTP id v52-v6mr4684099wrc.56.1528902569996; Wed, 13 Jun 2018 08:09:29 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:29 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 15/27] venus: helpers: add helper function to set actual buffer size Date: Wed, 13 Jun 2018 18:07:49 +0300 Message-Id: <20180613150801.11702-16-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-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 and use a helper function to set actual buffer size for particular buffer type. This is also preparation to use the second decoder output. Signed-off-by: Stanimir Varbanov Reviewed-by: Tomasz Figa --- drivers/media/platform/qcom/venus/helpers.c | 12 ++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 1 + drivers/media/platform/qcom/venus/vdec.c | 10 ++-------- 3 files changed, 15 insertions(+), 8 deletions(-) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index e3dc2772946f..0cce664f093d 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -541,6 +541,18 @@ int venus_helper_set_dyn_bufmode(struct venus_inst *inst) } EXPORT_SYMBOL_GPL(venus_helper_set_dyn_bufmode); +int venus_helper_set_bufsize(struct venus_inst *inst, u32 bufsize, u32 buftype) +{ + u32 ptype = HFI_PROPERTY_PARAM_BUFFER_SIZE_ACTUAL; + struct hfi_buffer_size_actual bufsz; + + bufsz.type = buftype; + bufsz.size = bufsize; + + return hfi_session_set_property(inst, ptype, &bufsz); +} +EXPORT_SYMBOL_GPL(venus_helper_set_bufsize); + static void delayed_process_buf_func(struct work_struct *work) { struct venus_buffer *buf, *n; diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 52b961ed491e..cd306bd8978f 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -41,6 +41,7 @@ int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, unsigned int output_bufs); int venus_helper_set_color_format(struct venus_inst *inst, u32 fmt); int venus_helper_set_dyn_bufmode(struct venus_inst *inst); +int venus_helper_set_bufsize(struct venus_inst *inst, u32 bufsize, u32 buftype); void venus_helper_acquire_buf_ref(struct vb2_v4l2_buffer *vbuf); void venus_helper_release_buf_ref(struct venus_inst *inst, unsigned int idx); void venus_helper_init_instance(struct venus_inst *inst); diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 92669a358a90..eae9c651ac91 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -710,7 +710,6 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count) { struct venus_inst *inst = vb2_get_drv_priv(q); struct venus_core *core = inst->core; - u32 ptype; int ret; mutex_lock(&inst->lock); @@ -740,13 +739,8 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count) goto deinit_sess; if (core->res->hfi_version == HFI_VERSION_3XX) { - struct hfi_buffer_size_actual buf_sz; - - ptype = HFI_PROPERTY_PARAM_BUFFER_SIZE_ACTUAL; - buf_sz.type = HFI_BUFFER_OUTPUT; - buf_sz.size = inst->output_buf_size; - - ret = hfi_session_set_property(inst, ptype, &buf_sz); + ret = venus_helper_set_bufsize(inst, inst->output_buf_size, + HFI_BUFFER_OUTPUT); if (ret) goto deinit_sess; } From patchwork Wed Jun 13 15:07: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: 138499 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp853606lji; Wed, 13 Jun 2018 08:13:49 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIO6kbwjIBpcyuZafBuiZEShfcvLG+hdNRBfrPdHlAP+wzHZfRmDojdxz6GGO55pyNAQTC6 X-Received: by 2002:a63:920c:: with SMTP id o12-v6mr4390166pgd.233.1528902829213; Wed, 13 Jun 2018 08:13:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902829; cv=none; d=google.com; s=arc-20160816; b=fjE/AXOK0i0E1Ls2jUbNjKaWpPZ3ZrTyKCkA0lesp3lsB8LX2UMnmilM6fZxVk/1vE CSyClHcXDLAxjX1KBTIBhbCAMp01W3o6sYABwmVuuKsz9Js1jmM4pyL9yJjt6k8/1OZs ILK4WBDXfgtqfXvRtbP0Sh5ptMZVt2sCj/XZDTUnymfEy6Cp8G2jy8mvJ2zS5ZmsR8je 9UHoVANaH0LAlF5t8/U7W4ExhQDF59g7VIEJGIi3T/RyiaizahFPoadg3LmnXhP2vEy0 goe5qe7w+/ZiSnqSGsKqpKxxdYGhvShLVENPcV1ipLWxxFJS9c4ZUWfy/3VVL/qsu+l5 UF6g== 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=8FeGnPaIV5EPC/U6dJ9bqO8cVCrprWFMS2h0FyRklic=; b=p1Y5zEjM3qyEO35NxgWuGsYxG77KzHgYVxjUseK4NMKk/JSWN4DlWtOTU0+kohYhWK +X5QdZm/K/ZeMuqjdZiJZTszH9SwthmD4VZlslH7C5U4dLbwMFjnfQMK4pev2DdWPy6m N2ni2RuwRuZvYMsU1qrsuym3aNenIOBe+1ib8BTcu1crPoiT4sxHEGEyUW3cWY6wCqq6 cggSk5fWSO+P4hDv34BT6s+aeI6ItJIqTJUXg4rYdLIs6r1a6rptkCOeWRY9gCLwYZhM chLdtX7l1P7Zdf0YEKl7VIeCDQTLuSr9njrFMC/NvDbrhUDHorFwjQrOgb8B3z36N5bd Wb/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DbgkykdI; 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 124-v6si2628490pgg.29.2018.06.13.08.13.48; Wed, 13 Jun 2018 08:13:49 -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=DbgkykdI; 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 S964926AbeFMPNq (ORCPT + 30 others); Wed, 13 Jun 2018 11:13:46 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:38317 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936045AbeFMPJc (ORCPT ); Wed, 13 Jun 2018 11:09:32 -0400 Received: by mail-wr0-f196.google.com with SMTP id e18-v6so3154239wrs.5 for ; Wed, 13 Jun 2018 08:09: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=8FeGnPaIV5EPC/U6dJ9bqO8cVCrprWFMS2h0FyRklic=; b=DbgkykdIAU/q2oI+KqvMKILbWsND/5N+3ERdIHtdnXuD6XzymIAn7sUKImayk8I4Da jYrLROPWZw48ReRmNPemXqgtyParf4wx3aUPXokZpeGGRYuYwgVeoZxBGrXB3aHMR1R4 FcWabV65slqNUB8i1qjFKl09JBvhDLZiLm1bA= 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=8FeGnPaIV5EPC/U6dJ9bqO8cVCrprWFMS2h0FyRklic=; b=aK5nSj6oZAC119It6YyLDFtVBO4/3RjerOB6da+304tY52++Io8T4ZLjx6OVpYcvgY pWaCsHxSpdBIB+GcVKbwYaw0K9WV7aMbaHzQdA/AWnFNxJaeyOlc/kuRroLYEEVfIyBc Cpa0lBkw9LVHk0r8TBXC8lMnmyk0cWhik6ezUyREevQJhOclfad6oD/oiCc8VU4igrhj RkfFjzMxVBCQsLZ6RtUou0/VeT7o4EgdXUaFkt5QLjGK8GwTmSvFlnW0ftHuupTlb9+H H1twpT/MSKnQxsnQtFJrn1Wv9U7apB5CfMuMwoKgKuWF1aWPOWje7+CPNDuoR3GPWibP /oXQ== X-Gm-Message-State: APt69E23cOOLi2OENXFgtHe43VFBX3+fSt0kNr5ykP668xoIwmaZzkwF IADqzsSfeV4k5Tx2eZ5EQItHvA== X-Received: by 2002:adf:965a:: with SMTP id c26-v6mr4525172wra.197.1528902571177; Wed, 13 Jun 2018 08:09:31 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09: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 , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 16/27] venus: core: delete not used buffer mode flags Date: Wed, 13 Jun 2018 18:07:50 +0300 Message-Id: <20180613150801.11702-17-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-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 not used flag for capture buffer allocation mode and no longer used cap_bufs_mode_dynamic from instance structure. Signed-off-by: Stanimir Varbanov Reviewed-by: Tomasz Figa --- drivers/media/platform/qcom/venus/core.h | 4 ---- drivers/media/platform/qcom/venus/hfi_parser.c | 6 +----- 2 files changed, 1 insertion(+), 9 deletions(-) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index b995d1601c87..1d1a59a5d343 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -255,8 +255,6 @@ struct venus_buffer { * @priv: a private for HFI operations callbacks * @session_type: the type of the session (decoder or encoder) * @hprop: a union used as a holder by get property - * @cap_bufs_mode_static: buffers allocation mode capability - * @cap_bufs_mode_dynamic: buffers allocation mode capability */ struct venus_inst { struct list_head list; @@ -305,8 +303,6 @@ struct venus_inst { const struct hfi_inst_ops *ops; u32 session_type; union hfi_get_property hprop; - bool cap_bufs_mode_static; - bool cap_bufs_mode_dynamic; }; #define IS_V1(core) ((core)->res->hfi_version == HFI_VERSION_1XX) diff --git a/drivers/media/platform/qcom/venus/hfi_parser.c b/drivers/media/platform/qcom/venus/hfi_parser.c index e8e41811db80..c4ad50f992b0 100644 --- a/drivers/media/platform/qcom/venus/hfi_parser.c +++ b/drivers/media/platform/qcom/venus/hfi_parser.c @@ -73,13 +73,9 @@ parse_alloc_mode(struct venus_core *core, u32 codecs, u32 domain, void *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; - + 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 Wed Jun 13 15:07: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: 138497 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp852531lji; Wed, 13 Jun 2018 08:12:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLqEsrmCNx61WtxbSP/KHakMzUVLAItS2Koi2OIlZ9B/dK0fheikBGmagA+AT/qjwP35vZF X-Received: by 2002:a62:a21b:: with SMTP id m27-v6mr5298577pff.248.1528902775338; Wed, 13 Jun 2018 08:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902775; cv=none; d=google.com; s=arc-20160816; b=DgtR2LbGh8IMsO4Wi9gW5YJCg5SF0gpHCmjiUdIvvGwIdTiJukXDoHxUNMTr0nfEyt VFy+L3EjcMqYy0HptEnRBVLvVaRsPOQOn/Z6SlpKlb7XKK84Th2CCT14IHtqkYm57sAY M4yi2OjPEMPWJqVup5DbKLePZrNePHt3+pa6jVh2aLULrVQJ4U/h8isknnPFbZjg4gSp of6ShWdr3HOMPBXEGzJaAzzo94hW0WN/2cDZgJwO4+2OaldoRpK7cRBjpBBVfEDrKBJ3 aPgJL7o/nSJS7GNkSYK8+UdiQWIux4M7kYNWM42+1iiJQZsamHnjlCw5mgnNHy+egnBD Xb+g== 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=dBNFMYHtBk25cq657W5saatgm8VT3r2BxDc+quPr6ks=; b=u2Ga4JlLhgbRfVxOsBBH9hcEdtw3vCpWxIko//ReSCtX7KCe0NpPT0Kj3bnJ0wKAmN Y7UBIHOYngq7NS8oz8WEvFPe2SzYOiMrIhejWHpvMAt776p2XFvqPgNZezVnaa7tW6W4 sZ06euoBHczNieYCOgnKW4eQBuueZP4uGFpr3aKD07Cjb728aialUSEFyzSY8xOj+GU8 myl3U/Wq13YngzO+1p62sQgREd/aXLckZu3hKatG84PcEbQvMbiUnTHtUPo3bfhRKdex D79mPNHUh07AjENkbVt8EEij+R5GHKverXi3jTTvSEXoawInFAEEBBEg36ov79R7Gk8Y qP/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bV3CIa0x; 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 z13-v6si3226530plo.287.2018.06.13.08.12.54; Wed, 13 Jun 2018 08:12:55 -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=bV3CIa0x; 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 S964903AbeFMPMx (ORCPT + 30 others); Wed, 13 Jun 2018 11:12:53 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35920 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964821AbeFMPJe (ORCPT ); Wed, 13 Jun 2018 11:09:34 -0400 Received: by mail-wm0-f65.google.com with SMTP id v131-v6so6113765wma.1 for ; Wed, 13 Jun 2018 08:09: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=dBNFMYHtBk25cq657W5saatgm8VT3r2BxDc+quPr6ks=; b=bV3CIa0xUuxCdgKwWNrfpkv0DO2KPsdQN+EhIcQtL7pcHVipOb+YlbHx8u4tRMipf0 mbiIZeXoav75uF6EHJnFvN5mZerPGVYpSosbsUCtm5lxT+rLjNzwEjwCjhx2lLMWa+LA sR8A2gkOnoCyzWs3FfIsuzYB6CYcowgDIGmhc= 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=dBNFMYHtBk25cq657W5saatgm8VT3r2BxDc+quPr6ks=; b=oUW57jt1BEicIvuXVAe1qqz5i2/4TlclviWHfrswZ8zPN0ldZ4MHzAXxFeR5/XJMfD Kf4ECFjoHpXkOuB+zVdC0R/e61slgrz6KYKGIplyXiGLKE+0pTC6kH75iWIrQ9suRvgp 7tu2kUVx5sW232LWOIJGPbcJhTx4nkYmrOBej1nERVJykShnj0sp+RiNl3Xk5vrFeEdh WBZffwGn0MQPtGhXoYRR9gk/cL11fR0/YsCEFnCRDwqHzZCSCdoek64j8CasEQLxHPFi /prdM56KY04JJlqNjG0xDRDObmPoglJrBZ4RoDWKRD4LavcmzdJzutcRIfng8Dinqy2F t5rg== X-Gm-Message-State: APt69E2Blfa60mpJferbNjUxcfmEyv/cl5keU/jb/oghy1PuvhIrs+UV C6adIXd/lrE1cHO4p+IukrlQWg== X-Received: by 2002:a1c:c90:: with SMTP id 138-v6mr3611866wmm.110.1528902573343; Wed, 13 Jun 2018 08:09:33 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09: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 , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 18/27] venus: helpers: add a new helper to set raw format Date: Wed, 13 Jun 2018 18:07:52 +0300 Message-Id: <20180613150801.11702-19-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-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 Reviewed-by: Tomasz Figa --- drivers/media/platform/qcom/venus/helpers.c | 52 ++++++++++++++++++----------- drivers/media/platform/qcom/venus/helpers.h | 2 ++ 2 files changed, 35 insertions(+), 19 deletions(-) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 2eeb243e4dbe..a1590d5cc921 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -407,6 +407,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) { @@ -488,35 +502,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 Wed Jun 13 15:07: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: 138496 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp852060lji; Wed, 13 Jun 2018 08:12:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL1wL2NPaAgNPBB9zOVMgkTi/fr+jQkYtfkqio6pQLQXCK37CPAH/jx+a/5AHb9zUw3aNJ2 X-Received: by 2002:a63:ba56:: with SMTP id l22-v6mr4428818pgu.161.1528902751553; Wed, 13 Jun 2018 08:12:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902751; cv=none; d=google.com; s=arc-20160816; b=h7UJEPGLfKGt5ujBWysI7j3+uuBa2cahBXBenLPGYKzbmNE0IcpIu5/9gSxp9y13Y4 KVGmC47tDlt8/nNBzt90YR8CTZT522ct3BPLDwms1dsY0SqmxCKBVYL1Whkq+E98imAv yqhqe1EmwCe1/gRmk+xq8X29BP4Ye1fIDLXXtLkQslCJ43bNHNvO+GU4hPvnbkVelTCR 0yPe2dlU17z26SoQzDv/I+MYObBNmNhFeTpk91gsVI/cS+isJfbr9HJLMrHZeIJqH8u2 vJIQyN3WYhcaxA9NnQgIqFGlVtwnnhkd568zT+Kqxd1zNPNsGzTe2LcA3R6p8cVzz8xu oMPw== 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=88FFyjErotOxDmhgzqLVFCd4JC06AOb71V78xZlxmq0=; b=OohjxDKZ4Uk+cvMH6s2cOM4tYSBXue/6YOx/T+eqSvyTA5YrUv9io5c9dx07r6pWT6 TMy/oXm9c0Fd8PsOZ9LYncS2IVSQxNqdZW1qfpZsTBeBOWwqs2IJc139VWm5ripJjyUY WE79E5E9+HARvoqSDEUYqn87PVM5EO4bSGkY6cnJHoLhjSACn5KGcr1p+NrUH3fMMaCh Zxt06mi2hT5PA7M5shcgpQi2ig9vJqbf/rNNkTuA7DNx6nAAwA3Y7ran+ylzofqz0d5d xCwY8XWPdhnK7U7rANH4iMWPbFuVJwWkd/Wiz3EqWfOntnFg3ekC7Ucy8xCNL1YmbDuD lvEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="DWtf5/vA"; 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 m3-v6si3173770pfm.0.2018.06.13.08.12.31; Wed, 13 Jun 2018 08:12: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="DWtf5/vA"; 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 S936089AbeFMPM3 (ORCPT + 30 others); Wed, 13 Jun 2018 11:12:29 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:46582 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964832AbeFMPJf (ORCPT ); Wed, 13 Jun 2018 11:09:35 -0400 Received: by mail-wr0-f196.google.com with SMTP id v13-v6so3123758wrp.13 for ; Wed, 13 Jun 2018 08:09: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=88FFyjErotOxDmhgzqLVFCd4JC06AOb71V78xZlxmq0=; b=DWtf5/vAnk4J0ykQlmOj12hv6UzFLjEPzAdjszIInMO3CSQiHOauLKP6/0UJ3MDK2P l9vuvljcNT0DJtwFYVOd5DiayQpoHJ4uqi90HRMO7QycM57o9omIAefUOMiDsCicvN15 dImRiwksxCmivl1tiIqZdgvKno+vTscTXo1YA= 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=88FFyjErotOxDmhgzqLVFCd4JC06AOb71V78xZlxmq0=; b=J0pqTsEYZ+5qUrUHPwIewy5ipuaoirftLShhUwerkL+6VKOHMgNY5Zt2z2P4bOWjIv aOT3VvczxhudtUbNnJQjHnE5ha6RgEreHeHXJYNDt8ZoYsgCwJQGeA25lS4nZ9IkvNJW vruo/+8oao+3a7LD/LLYR2A3Gk8h90ce0UhIPZ2X923W80pev3WmhdYka1t4h0INhUl4 tjzhCC5n18rLHPIquVmicxuU7J84OUp1NTD9jHghTK1WZZtCVvK4mvBb4xPkCR64dusH 7YZTPV/us0U76r3+i5wngp3WPeW3AH0vsi9xG+INjIRRfy+9KHQZ8QmuH1Ar3g8OMQNP HMlg== X-Gm-Message-State: APt69E1cb3w/2PuFSwwtQurjaWJO5CQ5v82Obou/HjWVa0PndAY2Qe1l CMh89p8FjIgftnkSTdXudkxmpg== X-Received: by 2002:a5d:45cb:: with SMTP id b11-v6mr4588034wrs.106.1528902574620; Wed, 13 Jun 2018 08:09:34 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09: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 , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 19/27] venus: helpers, vdec, venc: add helpers to set work mode and core usage Date: Wed, 13 Jun 2018 18:07:53 +0300 Message-Id: <20180613150801.11702-20-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-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 Reviewed-by: Tomasz Figa --- 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 a1590d5cc921..2295cca3c22a 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -481,6 +481,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 eae9c651ac91..f1cf4678d013 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 1d7f87e0f5b3..4f0a5daa97e2 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 Wed Jun 13 15:07: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: 138494 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp851581lji; Wed, 13 Jun 2018 08:12:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ4AIxCqKV4jGu7OlyiIuiLdBbvv0EF5sPwn8xn61ZgeUXd0KUmDbRI1e3Ed5+MeGAtDN9w X-Received: by 2002:a62:2091:: with SMTP id m17-v6mr5272089pfj.110.1528902728261; Wed, 13 Jun 2018 08:12:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902728; cv=none; d=google.com; s=arc-20160816; b=yfb3W0u52RWcU5Y3N0F1GHssWcbTanwsA3SqNEy1YJLsaFVw/4YxxWR2xo7IHEDQTq vh/JIFVRzXwTEXkAlOF64PgM4DgvC5oNhbxLNwjsisdpPT8XtwJpxLt4YGmhfBgoJl6g GPkS+fc8OEfCFdsvhwhpEmwT3aTOZqUp41k33Br/HoL9B0VcQM9o1Q8B3FJEQmSxDClV vuGY8BgSUiL5jOJPFmtHWV7M/2YUaUYGkUDI1yEKVHAZWkLI6Ww9dnW4HwILqftFDbfX nBa1oKjiOt9QWVQuuDa2RUmAbf1+pe4Ve0gD/p8fa9kqB9DIPZDRHfgfljeWixRlym4D IoCg== 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=ohBxby42Vxzlh/dYlM+pRHCgvQbfNHDMttBaQvAQZWk=; b=dAml29HNeKtuHQ/rzJxLNyT5bxMCnCzaeO1yTSlEPqj83F0VH7T0dK6sLg8GEUqcin mTiTiBZinxtG0xcBvDoDTp+zu9SkyVTkPauuNwb6mynMcop39ATSEOj1itgEGdP9fErU j1JYDTRxtiUr/CVerlpDYwxq74g7ufd2tCDTHhGMUNnVSYxOTkXAliJNzsROK0r469Ta WGf7b6TfERJB9XkbfpKgkAkRRSg3SIgqlhIrJrvgMxNnxQLquroqN6wCJUDpyfitvrbp IUoDBvCuQPBkGXgSeF+rzS1iuEOryi7y8JBmLgWwOmptMrifvCIVIzZjHuYDuNez8QsP Wn/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="H7f/O1Ds"; 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 5-v6si3203838pfd.73.2018.06.13.08.12.07; Wed, 13 Jun 2018 08:12:08 -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="H7f/O1Ds"; 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 S964898AbeFMPMG (ORCPT + 30 others); Wed, 13 Jun 2018 11:12:06 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:43111 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964844AbeFMPJh (ORCPT ); Wed, 13 Jun 2018 11:09:37 -0400 Received: by mail-wr0-f194.google.com with SMTP id d2-v6so3128877wrm.10 for ; Wed, 13 Jun 2018 08:09:36 -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=ohBxby42Vxzlh/dYlM+pRHCgvQbfNHDMttBaQvAQZWk=; b=H7f/O1Dst8IxOrlnNncGoCWuFd2oJBWShALTTD/eyJOH8rlaGkoKD9oXT1vxdtVA8P Ja7WZ9EaCn27fTrPCuB3jvCk6xwTkXWY8/bhXRcxyDuiWjqlcFdimUoNCkIqk2ReR2Xw /Ku73REc5Sf2G4D8XoIrEYA/4RdP1SkWQucIU= 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=ohBxby42Vxzlh/dYlM+pRHCgvQbfNHDMttBaQvAQZWk=; b=c3whar/dU5OzHENpRKjKELRRzpQJubDleOwvM1N8ESsTvgKmufZgxC+wd03P0M2bu2 YHciA3truF8XWvXAScN8mVbfP28qlRP8HsQoflcamk6p5nDmrtyC6BBz5xWAmLe43FKc DqcZztuX8gmzHnxI0ApzPk2koWX8Eiag5frGUeZ07U0sAfIRrqaOy4V1E/Hn8Mk9n6n9 U5MdKN+uXuCp4pJC1iWCf00HPekqR5cAwC61iYk7ZP8yzR2NhqEu7gDHlsKk12AJOgZe zBfosBbCyNlYvVl2IBrW0OtjbRmfZQcl/ifJ2r0lSNIfn2pXXa9VTgAI8oDBFGKff+Go 862g== X-Gm-Message-State: APt69E1kpARxpqeAOHl9i3Vcx2mx5z9URJb+VhQgKNwDj05pptfj2WAI vJ3dHQdashLDFV/3u9jrBDA6DA== X-Received: by 2002:adf:f712:: with SMTP id r18-v6mr4847201wrp.85.1528902575794; Wed, 13 Jun 2018 08:09:35 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:35 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 20/27] venus: helpers: extend set_num_bufs helper with one more argument Date: Wed, 13 Jun 2018 18:07:54 +0300 Message-Id: <20180613150801.11702-21-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-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 Reviewed-by: Tomasz Figa --- 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 2295cca3c22a..e332c9682b9c 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -510,7 +510,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; @@ -526,7 +527,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 f1cf4678d013..5d8bf288bd2a 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 4f0a5daa97e2..abde7d6d123f 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 Wed Jun 13 15:07: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: 138487 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp848177lji; Wed, 13 Jun 2018 08:09:48 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJeyqg/dCTFNVC3eJRIeao9GjDTRMLLQFwqMC1qC8cKpyojffqCrBs5AyhwmulgQ4Xw8Wyk X-Received: by 2002:a62:e117:: with SMTP id q23-v6mr5350756pfh.75.1528902588582; Wed, 13 Jun 2018 08:09:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902588; cv=none; d=google.com; s=arc-20160816; b=kCBMGHJNBpdX27nR+VvppvEOzrwOqqupw424EcrcmKMuTwj5E4ofOHLZ1XiKu3wMT8 q2xDSKHEpSrYVlubiyI7DnPVHvo2Crsnq/pML/Tub9aVX9pn8MtrEs6rpLykd6tTkWV8 q0bR1+0p24bEK4QPOjaQp8E7xSkANzYp2QPfs6f0BU54Cau8d/QkmHXAijJmBwJIVbRw x9juW1/RQWJtz1RhoAvEdg3xOD3J8JKL3z/08852mSb3sVzRgTPVuadG3LyZgUjAMklv wuQv9XcOzGrQn5F8zW6BXobyhOBD3bkxNNCtnj+L+humTgylmuWZId948pcscKnExxkT +B5Q== 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=VRMNPzwCVtxgb0LfMFtJgW6g4iKfhAD4kYYPw52509I=; b=bxg/GzmX+VrOrZBimEvI02H0TqBgpSb4sAZhcjg04sXlbOeny2eBEqhpiwIz5pWGuc hCVWRSb+ZJsA80BKzVElfxO80xUSHYt8A/RpNSdNgX9kok0ovWDo3CvIvMbSz/TFXm/8 1GmthtnntkNo+YHkdyJ17gd2mX1UHVezL/GpGFWDdLBFy+y9fxkU9ZtieF4oooNI+n5P h29qqcfI9myriKfmJYTcp/A/i166ROO92mTX3MF6PzYMQsY6xL6+GzNmzqGOnaf+lR/q EQqk80G66jwQmvglHCJE6G/Y3AN4C/vpUbDp1DUOB2x3Rrecpi92akGIE3Jj2yCZ5Pub ERUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OoBGAH3x; 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 g83-v6si3138772pfg.225.2018.06.13.08.09.48; Wed, 13 Jun 2018 08:09:48 -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=OoBGAH3x; 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 S936075AbeFMPJn (ORCPT + 30 others); Wed, 13 Jun 2018 11:09:43 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:34378 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964852AbeFMPJi (ORCPT ); Wed, 13 Jun 2018 11:09:38 -0400 Received: by mail-wr0-f196.google.com with SMTP id a12-v6so3165136wro.1 for ; Wed, 13 Jun 2018 08:09:37 -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=VRMNPzwCVtxgb0LfMFtJgW6g4iKfhAD4kYYPw52509I=; b=OoBGAH3xOCYloy6CF7yFWDTUCJCYyO/yPSHl0WZ9/P9oswx2CHsRAtKRpHNCLEBmxD 9aFvCzzfAkDa2qC9kBgpUk29i6+KAShPU4sCgUGLJyvGZ0Cwl2bSGK+Srhy2GgMkndjQ 5ruxZAEUuDWlpA+hqvuQUSvMaBLJvT6qRv5oY= 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=VRMNPzwCVtxgb0LfMFtJgW6g4iKfhAD4kYYPw52509I=; b=m/PsVdtE0S0LvorokiAJg2j0r9k58EZDWPYwgERf5xTx3HRlO/hmwV0h0hDFNlXut8 OK2b8thzeAkdE6aKu+b76Tj2KDyJw+dT3vEuA5cT3XcRCHqyiqfkQVRu74DvYMupmqKR ZEcsUFrxMKSTE3lBKcL91yNGQcVNYUOyqQzTNwiH/4IDu0e5wNTzDcFjsuX0bq7VvFvy +VkdjQp2rsSBc1u/+NXWVp7krGZ4m8URdHP/K4ZDEYZtzXEBEFecPye4PujnPp/G2MzR 8d1qzL5nTsiOHyC16fgn6xBSvJPkKfUP2ukmHHM2lo+a/A2JXhim0cx4hpDB/cXaFxC8 4qLQ== X-Gm-Message-State: APt69E0Qi0X8lYRdO27iaW1L7m7dcL2Ysfy9pNEwKs6QZInY4vdrmtZu jHNOhYir1+3I2eUQMn02tBnkqw== X-Received: by 2002:adf:efcf:: with SMTP id i15-v6mr4795449wrp.195.1528902576980; Wed, 13 Jun 2018 08:09:36 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:36 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 21/27] venus: helpers: add a helper to return opb buffer sizes Date: Wed, 13 Jun 2018 18:07:55 +0300 Message-Id: <20180613150801.11702-22-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-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 | 6 ++++++ drivers/media/platform/qcom/venus/helpers.c | 15 +++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 1 + 3 files changed, 22 insertions(+) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 1d1a59a5d343..f8e4d92ff0e1 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -239,6 +239,9 @@ 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 + * @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 @@ -288,6 +291,9 @@ struct venus_inst { unsigned int num_output_bufs; unsigned int input_buf_size; unsigned int output_buf_size; + unsigned int output2_buf_size; + 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 e332c9682b9c..6b31c91528ed 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -608,6 +608,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 Wed Jun 13 15:07: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: 138491 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp849687lji; Wed, 13 Jun 2018 08:10:49 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ07QnD0lBMQS9RkPnWGco8x8w+oUO+qnDp1rbg8zmg126WLX/Y2GvZOJDhWsbY6AqedVSR X-Received: by 2002:a63:42c7:: with SMTP id p190-v6mr4514335pga.142.1528902649124; Wed, 13 Jun 2018 08:10:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902649; cv=none; d=google.com; s=arc-20160816; b=BcfMJPuNEObfgMczAhxhetEze7mtB1+IosBp3yEC6mFk0CnnY4K9wVqpnwygbUlArb BhQTBhY5iETNuWt1zG7zvkLSJMqc38Xy0ma8bo3OOa5ecgBwB7CKeUlETpBZdt196qZm 4h2cCreE9LDAPVoo01TlHONmkIzeX77hi8noqL9oZ7okYpYGyxstEuotfSqDh+VrCOK+ lLRncAc4GBDcf0HC6jEs2umt+7eCPJajvt3EbhimYqWuKmMcRYeIYU5XaeVd1hcjfgr8 Acq93CEb3KNB1mGHQWhxCEHz4ccTlXr+0AICNELSfxhyF+P0nkHPPU1xOYVrEnPIYt1y dkRg== 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=BwaBMOBtFU4AkNYUJGU1SJQFvBan9CUJEd06K8viUtI=; b=Bt6dmpM8U/eYzfctfGJ/02yFoT0zfKN7iRaRPzWhMxIGyiXAO3IRMCTFIYMCTs9cWp bgV3JPTnVzwSTKd/5vtiI/rxXhQ4ELJ3tBshf4ZKCrXThp2oIE0Oub8CEpYjTQ6l/Ovx Q2VxeyQAVQBBlohcxKkg/VJZu1xVKUSWTN4gYQuuY1rd0+v5z5YMUAQcYebtyPwp2Ebk YdZBeMN3xotgXiqX1j93nZJ/N0AeWvDJ2xM+Q0G3oKa8VM8oHcE1uT+IQ5ys2WPbrQ03 ngfvQ0e4jfp3eNsr8jvN1aJwjasPle7TU4L+YhrJlMWH3hm0tf0a/9FTbixN7bxGUz9o muhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YCYzTfJw; 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 134-v6si2600680pgc.116.2018.06.13.08.10.48; Wed, 13 Jun 2018 08:10:49 -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=YCYzTfJw; 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 S936118AbeFMPKi (ORCPT + 30 others); Wed, 13 Jun 2018 11:10:38 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34664 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936058AbeFMPJm (ORCPT ); Wed, 13 Jun 2018 11:09:42 -0400 Received: by mail-wm0-f65.google.com with SMTP id l15-v6so19071726wmc.1 for ; Wed, 13 Jun 2018 08:09: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=BwaBMOBtFU4AkNYUJGU1SJQFvBan9CUJEd06K8viUtI=; b=YCYzTfJwmPuvz82t8EEihY0RAnaAiJJeA1uouGRf+vitvlDif2586bgATGgtXhC/fL CaBiMB0KyxdL4VaRgM5rQJtuRYreM2vJkh6GseYKqRJglVQNSDhQG8Mql0zJL+cSANA+ nSXC9CVburOabDQRosHAy0MUT467qYt6sOeUM= 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=BwaBMOBtFU4AkNYUJGU1SJQFvBan9CUJEd06K8viUtI=; b=j8ZuXo1cSBj/5Y+fyLm5wfQPAPqBGcpRoPUPlCPxxz1gbPE0NxHilsFhvKrXMVTRyK xtsOl4UFEnHYnduzfx60EIabvRsF6nMcWKXYJcD4pFog8RmfskZM0orEwMyjR19xArmP wUWKKuhqxY3nJUeP6ZTAUIo1xCNX1HWSmnI0N8y/GJQuAoOmRGDCHsI7/u7Xz5w/OF1Y 9nEstOgRKnhYJ/ry0NMIVEuLK+Iaoy0k0snkBJBF60WkIRLVvERS/3jCNEwrB2mNeW2C R997So/taekTuaZC5bRcOJDylnykJ213Z9nYaNVwpSqb77FCvUzlK96Xez4somMZUoMC fmMQ== X-Gm-Message-State: APt69E1zq7YWu1FtOiZVmfRYQacDUV2vKSYwDFoogeVY7EMAv2BycHKC atOklQ+g/7KcWs7C3S0WeI4DpA== X-Received: by 2002:a1c:ae8b:: with SMTP id x133-v6mr4052302wme.125.1528902580589; Wed, 13 Jun 2018 08:09:40 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09: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 , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 24/27] venus: helpers: move frame size calculations on common place Date: Wed, 13 Jun 2018 18:07:58 +0300 Message-Id: <20180613150801.11702-25-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-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 move the calculations of raw and compressed buffer sizes on common helper and make it identical for encoder and decoder. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 98 +++++++++++++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 + drivers/media/platform/qcom/venus/vdec.c | 54 ++++------------ drivers/media/platform/qcom/venus/venc.c | 56 ++++------------- 4 files changed, 126 insertions(+), 84 deletions(-) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 6b31c91528ed..a342472ae2f0 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -452,6 +452,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 4d3f1cd7ed1d..4e8a4086e6fa 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -29,29 +29,6 @@ #include "helpers.h" #include "vdec.h" -static u32 get_framesize_uncompressed(unsigned int plane, u32 width, u32 height) -{ - u32 y_stride, uv_stride, y_plane; - u32 y_sclines, uv_sclines, uv_plane; - u32 size; - - y_stride = ALIGN(width, 128); - uv_stride = ALIGN(width, 128); - y_sclines = ALIGN(height, 32); - uv_sclines = ALIGN(((height + 1) >> 1), 16); - - y_plane = y_stride * y_sclines; - uv_plane = uv_stride * uv_sclines + SZ_4K; - size = y_plane + uv_plane + SZ_8K; - - return ALIGN(size, SZ_4K); -} - -static u32 get_framesize_compressed(unsigned int width, unsigned int height) -{ - return ((width * height * 3 / 2) / 2) + 128; -} - /* * Three resons to keep MPLANE formats (despite that the number of planes * currently is one): @@ -160,7 +137,6 @@ vdec_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f) struct v4l2_pix_format_mplane *pixmp = &f->fmt.pix_mp; struct v4l2_plane_pix_format *pfmt = pixmp->plane_fmt; const struct venus_format *fmt; - unsigned int p; memset(pfmt[0].reserved, 0, sizeof(pfmt[0].reserved)); memset(pixmp->reserved, 0, sizeof(pixmp->reserved)); @@ -191,18 +167,14 @@ vdec_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f) pixmp->num_planes = fmt->num_planes; pixmp->flags = 0; - if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { - for (p = 0; p < pixmp->num_planes; p++) { - pfmt[p].sizeimage = - get_framesize_uncompressed(p, pixmp->width, - pixmp->height); - pfmt[p].bytesperline = ALIGN(pixmp->width, 128); - } - } else { - pfmt[0].sizeimage = get_framesize_compressed(pixmp->width, - pixmp->height); + pfmt[0].sizeimage = venus_helper_get_framesz(pixmp->pixelformat, + pixmp->width, + pixmp->height); + + if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) + pfmt[0].bytesperline = ALIGN(pixmp->width, 128); + else pfmt[0].bytesperline = 0; - } return fmt; } @@ -647,7 +619,7 @@ static int vdec_queue_setup(struct vb2_queue *q, unsigned int sizes[], struct device *alloc_devs[]) { struct venus_inst *inst = vb2_get_drv_priv(q); - unsigned int p, in_num, out_num; + unsigned int in_num, out_num; int ret = 0; if (*num_planes) { @@ -677,7 +649,8 @@ static int vdec_queue_setup(struct vb2_queue *q, switch (q->type) { case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: *num_planes = inst->fmt_out->num_planes; - sizes[0] = get_framesize_compressed(inst->out_width, + sizes[0] = venus_helper_get_framesz(inst->fmt_out->pixfmt, + inst->out_width, inst->out_height); inst->input_buf_size = sizes[0]; *num_buffers = max(*num_buffers, in_num); @@ -686,10 +659,9 @@ static int vdec_queue_setup(struct vb2_queue *q, break; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: *num_planes = inst->fmt_cap->num_planes; - - for (p = 0; p < *num_planes; p++) - sizes[p] = get_framesize_uncompressed(p, inst->width, - inst->height); + sizes[0] = venus_helper_get_framesz(inst->fmt_cap->pixfmt, + inst->width, + inst->height); inst->output_buf_size = sizes[0]; *num_buffers = max(*num_buffers, out_num); inst->num_output_bufs = *num_buffers; diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index abde7d6d123f..31aafe487fa1 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 Wed Jun 13 15:08:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 138490 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp848992lji; Wed, 13 Jun 2018 08:10:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKuqnKLd5XpR9el4ru6+Xu0OuIzMQcdSBJQiKulF6V+7DdgsUPh7TA3CLJNHPEnfUD5O7L4 X-Received: by 2002:a17:902:3a5:: with SMTP id d34-v6mr5644666pld.103.1528902620945; Wed, 13 Jun 2018 08:10:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902620; cv=none; d=google.com; s=arc-20160816; b=v+KiMZr3zOuelRIQ3Vwv3tJao8Bj2L7+DaxrYqPLUPCcTOAaQlaZcKIO25qM3YNjyB BRn7jdhNrXUFnBnKc5w1D+DOdqRhl3h2tczPUx0DfWi0j5l0TeqMnQz7dty3ABmixffq Kfp2haABDxD5B7sfuvMcEUAdKYIoYlOMRp565JLaPruTxCz/i7lYjx2tMtYOb4RCzMzw 56nPA4aB2hPSvxx9EP1amGwK9aRgFmMTs+6Wc548HQntneMrJDSX8cOZ9Q5Iy6jRlh+E isF3bgHWxwG3lvemdshyT+zTqXIRsMvF2uVkMgHqqGRcc2sDZ2PzPQ/USTDyx0Km/0EU /HDw== 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=jaIrs4Hlkn8/hSfPKZPaW9B0la4YriBdsqxKyEKBPSU=; b=H9q+5J3wrgZIupBM68layixvwFzfpnhPnSUcUP6hMK1uelZkcusfiB55XMai2/viXx SByal56TvWgCSWz6KwiJMMqzj/QPcgBlZWkMG2EFEDzNZJoab1Gd2TN2quPaSpxN6X3O vQF7DeXupRXbaZSILAaAQfaH3ZTm/kM/dddol8i5eJYjhWnw0Ky1iASx9qrlWjn/pDUf wxP6b/S8MA0omEhVA1FxryTG3EMc8fWugG1ykB1Dci2lR035sjorOJcIpnLhBHtlGfYv QZQfG/JM86AmQzRpEx1rVGLJFOmP8tlZj1JKFPnqUUq2JzKIdYj+9r0L7B6dpxfM3qaL V6lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FKaStwU6; 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 d13-v6si3152900pfe.214.2018.06.13.08.10.20; Wed, 13 Jun 2018 08:10:20 -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=FKaStwU6; 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 S936104AbeFMPKT (ORCPT + 30 others); Wed, 13 Jun 2018 11:10:19 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:40341 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936081AbeFMPJp (ORCPT ); Wed, 13 Jun 2018 11:09:45 -0400 Received: by mail-wm0-f68.google.com with SMTP id n5-v6so6069688wmc.5 for ; Wed, 13 Jun 2018 08:09: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=jaIrs4Hlkn8/hSfPKZPaW9B0la4YriBdsqxKyEKBPSU=; b=FKaStwU6gRwmZ3HUd7N0XNz1roaYRpObvAtYy3LLmbwiwv7F0Nu56yncW5kpbSqnLF 8iAXTerKjhOFrYqphSzXcHHFgtagdGrC0nhJ/U3gkPRzia4keCmRD7to0CsuaaRrzWad zes1Jjp9G0W76uOiKblEEPvZPF6K4pnHbegL4= 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=jaIrs4Hlkn8/hSfPKZPaW9B0la4YriBdsqxKyEKBPSU=; b=CSicAI0WOX1ANVi4mrtw9sbc34OBcK62mzT5G2Uj27UQSg3KyywpzMYt0mqJ+g9o57 6yCbnZ3wgf2JFXLReowv8CCGwBD3vWU2TkR/KDhayWP1deicbYo8SP8/i+iva3FGleCe vXjJakszWi3+H7944ar4AEL9WbqUIkgRY/2Gh4F5ooj8tOL6b5eLqw7yWwQiC8NR3x7Z DdEVt9Ga3Rv9cXAxW45UMc3VQo/ZEmHF8DMH8vlhwxpXQbPx5AvJJwiCgBPKff3a38qp oQcCIpuHy00AsheUpd6egquiKI6+N0hlIJ4LAE6LR6XwFsw7+F7uMKR7GvN7kAkqcQ7P iBKg== X-Gm-Message-State: APt69E2X1nZ6DSX8dzXZo93mwJqdOeaFj0MXauVQXUMD0Mlgajnmj0UM FNG5dNdXLjJ0fHieSEfL5wLiEA== X-Received: by 2002:a1c:9bd0:: with SMTP id d199-v6mr3845405wme.16.1528902584439; Wed, 13 Jun 2018 08:09:44 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09: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 , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 27/27] venus: add HEVC codec support Date: Wed, 13 Jun 2018 18:08:01 +0300 Message-Id: <20180613150801.11702-28-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-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 Reviewed-by: Tomasz Figa --- 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 8cc49f30a363..2f02365f4818 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -190,10 +190,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 a0c7ef5f9125..2da88aec5a21 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 9d509b3c1c7a..d079aebff550 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 be5dc3a2eb28..a2c6a4b7ac43 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;