From patchwork Wed Jun 17 22:40:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11610895 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2846F13A0 for ; Wed, 17 Jun 2020 22:40:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 06A642080D for ; Wed, 17 Jun 2020 22:40:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="C3/TSekq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 06A642080D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A4EE66E8E4; Wed, 17 Jun 2020 22:40:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4B2C16E8E4 for ; Wed, 17 Jun 2020 22:40:46 +0000 (UTC) Received: by mail-pg1-x541.google.com with SMTP id e9so1972147pgo.9 for ; Wed, 17 Jun 2020 15:40:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=yxhkUrEZGMGW6V4hv3gqzEshBUWawbyxpwsGYbTMAP4=; b=C3/TSekqJZZMRXXMevCccVhyXTBxs5StkCa3/Myij+08Kzcct5wdEG2BPhAKdXPOfv 2WClkyxfVXT81fmioLGdEepEQcsW2bLVwfmqQUMvd7b5IWkow9dHGJs6bLcVtZVih5fc rNQdrLvysaoDWBhGyFA04ir9S1TuRmEIjHOnLlO7DA90LVaIf85LgLAAHAvENvOmjddy KZkzvb9C6Lxwmoj2fdVAW5JDELlZWxb1AnaS6nGlzHb7xrkX1pV8blDUKgNq+hVrWd9W ftuh3XjgDhvwf9nCH1imdw0Brn79AG/VerLFG89gmzHmvPDIaokCodch8Uq7SgHlxEQi GvSw== 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; bh=yxhkUrEZGMGW6V4hv3gqzEshBUWawbyxpwsGYbTMAP4=; b=Hyrlni5PZ73QZOIrwwI9fyJAVjixhM4mSN4yVhdGVVayuM8mLCYl/topmon11lYTRH Sb8gzDaHLNML/TpMxt75HEWkvyoWMHqo2uSzBCS1vcc/vX5adQEWEFXUbJKV1LtKQfYV A8XG3vy6PNLMNxy/1m4eox3M1QUo0fZ2SbeuSADjiaKa4mqEVpmwO1WwS6oq6RHM718s Z6NqWX8R8COthhRfXn6wfZ6YLotvNTrEZ8Li6LlgJAa3wEOaAjqSg0Upl3cdevOrtg/t rU0Z8R8rEgjjbFTJ+kTX4WyQBjw/NuF6sCYlf+ra2JTjkw1+G6c4qy+a2kewnSY8zA+1 Okog== X-Gm-Message-State: AOAM533BDREJ4gQU4BaTeRnC9liDdPEluQtbVUX6L4ahRkEdMk6rlJuQ xW2omYMvCi0CmsTRyCTOn58= X-Google-Smtp-Source: ABdhPJxrIQeRLx2Cjy19QaB82zGd8G1E+KIumafFZaHrrE9sYy8tgFDygV/AkvTMIJRptlcBVFaf5Q== X-Received: by 2002:a62:9255:: with SMTP id o82mr902817pfd.218.1592433645740; Wed, 17 Jun 2020 15:40:45 -0700 (PDT) Received: from majic.sklembedded.com (c-73-202-231-77.hsd1.ca.comcast.net. [73.202.231.77]) by smtp.googlemail.com with ESMTPSA id x20sm486431pjr.44.2020.06.17.15.40.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 15:40:45 -0700 (PDT) From: Steve Longerbeam To: Philipp Zabel Subject: [PATCH 1/3] gpu: ipu-v3: Restore RGB32, BGR32 Date: Wed, 17 Jun 2020 15:40:36 -0700 Message-Id: <20200617224038.17889-1-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, Steve Longerbeam MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" RGB32 and BGR32 formats were inadvertently removed from the switch statement in ipu_pixelformat_to_colorspace(). Restore them. Fixes: a59957172b0c ("gpu: ipu-v3: enable remaining 32-bit RGB V4L2 pixel formats") Signed-off-by: Steve Longerbeam Reviewed-by: Philipp Zabel --- drivers/gpu/ipu-v3/ipu-common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c index ee2a025e54cf..b3dae9ec1a38 100644 --- a/drivers/gpu/ipu-v3/ipu-common.c +++ b/drivers/gpu/ipu-v3/ipu-common.c @@ -124,6 +124,8 @@ enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat) case V4L2_PIX_FMT_RGBX32: case V4L2_PIX_FMT_ARGB32: case V4L2_PIX_FMT_XRGB32: + case V4L2_PIX_FMT_RGB32: + case V4L2_PIX_FMT_BGR32: return IPUV3_COLORSPACE_RGB; default: return IPUV3_COLORSPACE_UNKNOWN; From patchwork Wed Jun 17 22:40:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11610899 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3ED2913A0 for ; Wed, 17 Jun 2020 22:40:56 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1D1872168B for ; Wed, 17 Jun 2020 22:40:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Pjvb1KC/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D1872168B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6015C6EA09; Wed, 17 Jun 2020 22:40:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id 50B5A6E8E4 for ; Wed, 17 Jun 2020 22:40:47 +0000 (UTC) Received: by mail-pg1-x544.google.com with SMTP id l63so1963535pge.12 for ; Wed, 17 Jun 2020 15:40:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SoPMTXvqN+c9eLGuj7ute01VMh5hNI9a49zXdLhCV9s=; b=Pjvb1KC/wgVYFAixCZ6ZJtZSkgpiF+/xehBsICyTk7NBUv0o/B3h2IsNeW6TXqIGGq qQnR60qnzrEdLRF34zszX1iNTBN8XGs9yEtLoyvaiZLTJKWEM/YvfsThlfsPpw8le8o1 zW2i5PI3mbBzJNzFvOEHH2/e+k1L5ZzFsJG+Tr0Wc/jrhNkkeg4yYHZ39LiwCUhRZJWX Y9fPWCWebJ4ki3mSWPWVCPrSHc0nEuvog7Ax6Gd7xuDfMD2F76A8c7oYL9llcJXBwM+b HQ2eAE/VRDgMRdbJS+sb4ZZDMMz/UpzDNXVzkgNwymf03OS5NqHCoqzoZoq9dWpFICBV 2Xgw== 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=SoPMTXvqN+c9eLGuj7ute01VMh5hNI9a49zXdLhCV9s=; b=htIsrc30G7nhny1xyUIZiah4K4+t5eARHh2aADA/xW4kn0mn2iznDo4lIjRf09d0na znwV0o67DLOB9lZroT3b0RG5BN8uqq7JAmXvoqYaq8psBG1jc0g8jwc/gzqQjvbCSANl Lwfp5snZ86z1aEPquaI+wY902w2wmUzh91HP3Q4JzHVLLqFxxBKs4jFPG00UHgHrV1VF BYAnb7wmT8/HgNnfAta7vrvNxTIcn/31lPLnVrd8N1AkC/cMw1t/PPBVcalc/vHrqKEj z3A/8qbCBb8nY5QjTgR8hzTzYekMH0Teu9BZVNCHv3XWAh9HGgZmXEm3Zl9CQoZatLFD 0Nnw== X-Gm-Message-State: AOAM532s+1N9Qy99pNh45tAyO30/J61WrkDS92ylt7tUHZ/8GmlybJy+ dj68hNKA7jpeq1yNzxfNmco= X-Google-Smtp-Source: ABdhPJyNogq5pyroi5y5jhPEauxrgHQen8TBiBXdjZ9tsUAkPhogEPL+HvS9ww2piDW5O1QUsUnIdg== X-Received: by 2002:a62:7f44:: with SMTP id a65mr916441pfd.258.1592433646853; Wed, 17 Jun 2020 15:40:46 -0700 (PDT) Received: from majic.sklembedded.com (c-73-202-231-77.hsd1.ca.comcast.net. [73.202.231.77]) by smtp.googlemail.com with ESMTPSA id x20sm486431pjr.44.2020.06.17.15.40.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 15:40:46 -0700 (PDT) From: Steve Longerbeam To: Philipp Zabel Subject: [PATCH 2/3] gpu: ipu-v3: image-convert: Combine rotate/no-rotate irq handlers Date: Wed, 17 Jun 2020 15:40:37 -0700 Message-Id: <20200617224038.17889-2-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617224038.17889-1-slongerbeam@gmail.com> References: <20200617224038.17889-1-slongerbeam@gmail.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, Steve Longerbeam MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Combine the rotate_irq() and norotate_irq() handlers into a single eof_irq() handler. Signed-off-by: Steve Longerbeam Reviewed-by: Philipp Zabel --- drivers/gpu/ipu-v3/ipu-image-convert.c | 58 +++++++++----------------- 1 file changed, 20 insertions(+), 38 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c index eeca50d9a1ee..f8b031ded3cf 100644 --- a/drivers/gpu/ipu-v3/ipu-image-convert.c +++ b/drivers/gpu/ipu-v3/ipu-image-convert.c @@ -1709,9 +1709,10 @@ static irqreturn_t do_irq(struct ipu_image_convert_run *run) return IRQ_WAKE_THREAD; } -static irqreturn_t norotate_irq(int irq, void *data) +static irqreturn_t eof_irq(int irq, void *data) { struct ipu_image_convert_chan *chan = data; + struct ipu_image_convert_priv *priv = chan->priv; struct ipu_image_convert_ctx *ctx; struct ipu_image_convert_run *run; unsigned long flags; @@ -1728,45 +1729,26 @@ static irqreturn_t norotate_irq(int irq, void *data) ctx = run->ctx; - if (ipu_rot_mode_is_irt(ctx->rot_mode)) { - /* this is a rotation operation, just ignore */ - spin_unlock_irqrestore(&chan->irqlock, flags); - return IRQ_HANDLED; - } - - ret = do_irq(run); -out: - spin_unlock_irqrestore(&chan->irqlock, flags); - return ret; -} - -static irqreturn_t rotate_irq(int irq, void *data) -{ - struct ipu_image_convert_chan *chan = data; - struct ipu_image_convert_priv *priv = chan->priv; - struct ipu_image_convert_ctx *ctx; - struct ipu_image_convert_run *run; - unsigned long flags; - irqreturn_t ret; - - spin_lock_irqsave(&chan->irqlock, flags); - - /* get current run and its context */ - run = chan->current_run; - if (!run) { + if (irq == chan->out_eof_irq) { + if (ipu_rot_mode_is_irt(ctx->rot_mode)) { + /* this is a rotation op, just ignore */ + ret = IRQ_HANDLED; + goto out; + } + } else if (irq == chan->rot_out_eof_irq) { + if (!ipu_rot_mode_is_irt(ctx->rot_mode)) { + /* this was NOT a rotation op, shouldn't happen */ + dev_err(priv->ipu->dev, + "Unexpected rotation interrupt\n"); + ret = IRQ_HANDLED; + goto out; + } + } else { + dev_err(priv->ipu->dev, "Received unknown irq %d\n", irq); ret = IRQ_NONE; goto out; } - ctx = run->ctx; - - if (!ipu_rot_mode_is_irt(ctx->rot_mode)) { - /* this was NOT a rotation operation, shouldn't happen */ - dev_err(priv->ipu->dev, "Unexpected rotation interrupt\n"); - spin_unlock_irqrestore(&chan->irqlock, flags); - return IRQ_HANDLED; - } - ret = do_irq(run); out: spin_unlock_irqrestore(&chan->irqlock, flags); @@ -1859,7 +1841,7 @@ static int get_ipu_resources(struct ipu_image_convert_chan *chan) chan->out_chan, IPU_IRQ_EOF); - ret = request_threaded_irq(chan->out_eof_irq, norotate_irq, do_bh, + ret = request_threaded_irq(chan->out_eof_irq, eof_irq, do_bh, 0, "ipu-ic", chan); if (ret < 0) { dev_err(priv->ipu->dev, "could not acquire irq %d\n", @@ -1872,7 +1854,7 @@ static int get_ipu_resources(struct ipu_image_convert_chan *chan) chan->rotation_out_chan, IPU_IRQ_EOF); - ret = request_threaded_irq(chan->rot_out_eof_irq, rotate_irq, do_bh, + ret = request_threaded_irq(chan->rot_out_eof_irq, eof_irq, do_bh, 0, "ipu-ic", chan); if (ret < 0) { dev_err(priv->ipu->dev, "could not acquire irq %d\n", From patchwork Wed Jun 17 22:40:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11610897 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1827290 for ; Wed, 17 Jun 2020 22:40:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EAF432080D for ; Wed, 17 Jun 2020 22:40:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ISbkmKUF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAF432080D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 250E76E946; Wed, 17 Jun 2020 22:40:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by gabe.freedesktop.org (Postfix) with ESMTPS id 67DE06EA02 for ; Wed, 17 Jun 2020 22:40:48 +0000 (UTC) Received: by mail-pl1-x643.google.com with SMTP id y18so1599390plr.4 for ; Wed, 17 Jun 2020 15:40:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8ijWGY6rH37IZ18Sj3MjwXEQSnZGumTcPQBv7Q2Smgw=; b=ISbkmKUFmOSaswcugssgcgZbb/mPDnFJ+YVqb0U24j8KbCScwh5i0lGjx9lPAjf3It gsT1+9KDJu3noqF0S20V4HTQ56/Wlg/tbi2A+r5LG2xj9jVTGdkJv0Sf4y4aLqg+4B2f DPG14Fys8e+M3Az0y4VywBqEa1dj2vIcwOVEtTLkOWJawQBQ1K0cEeoMC4JW5GhiyU0z +AnYcxCmHCf2g2lH/tCLygE4IX1dEAgouhLK0USawZcOu4xnG6uERU0l+SRLCdDzolU5 AVn5DjJeinSsTt7U8UHS2+xRZ1hltfQEJV+1xDZ0Drx4G1N66x+Cg/adqWc0b9GdRApq QsWQ== 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=8ijWGY6rH37IZ18Sj3MjwXEQSnZGumTcPQBv7Q2Smgw=; b=RNZHHWOWH8vSfEP9qdzUGu6oX+kYKduj5V7Wk1Ihnka/JkeSG/+x6gfK/i8RtQw6Yl +D6e8AYfvQ91PNE8w8ZemiGqg3PSFhhyJXN1lJ73mbR13cg9QXPPOMVsWGW1SSOjYcmD nYEFNeJgtIkorwGw4EzohDutkfV8HGzQlxkIZiBsapzeyrcskIEimzcT7njEBdeIh64N 2ZQwGglWpXe5yQCLkUpgooZsLIftNZkBW/KzPOeok/7MG7RBzuriNZuIXlV+pzQT4o9L IvpEaqsoYq3HgN5FBxBTg+7T/TKqEZRSN8WS4Ac2krduPUWEqW9wk21MCPZDa+B/cZI6 fBgQ== X-Gm-Message-State: AOAM532X6lT/Xu1J2lKciiT9A1WH+PnDGF3Kgvfjd/PqOZPx6gFcnYFY YBTv0bwj2YrfirSMKQaWKX6CNuHOnlI= X-Google-Smtp-Source: ABdhPJyr7hKT8ZY72b6YZ9m0XZlImXB6u+grpmDuxYbMx25PfsV590x9dIR0qrm0FjHNVi28FYePRQ== X-Received: by 2002:a17:90a:7a8f:: with SMTP id q15mr1085008pjf.116.1592433647961; Wed, 17 Jun 2020 15:40:47 -0700 (PDT) Received: from majic.sklembedded.com (c-73-202-231-77.hsd1.ca.comcast.net. [73.202.231.77]) by smtp.googlemail.com with ESMTPSA id x20sm486431pjr.44.2020.06.17.15.40.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 15:40:47 -0700 (PDT) From: Steve Longerbeam To: Philipp Zabel Subject: [PATCH 3/3] gpu: ipu-v3: image-convert: Wait for all EOFs before completing a tile Date: Wed, 17 Jun 2020 15:40:38 -0700 Message-Id: <20200617224038.17889-3-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617224038.17889-1-slongerbeam@gmail.com> References: <20200617224038.17889-1-slongerbeam@gmail.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, Steve Longerbeam MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use a bit-mask of EOF irqs to determine when all required idmac channel EOFs have been received for a tile conversion, and only do tile completion processing after all EOFs have been received. Otherwise it was found that a conversion would stall after the completion of a tile and the start of the next tile, because the input/read idmac channel had not completed and entered idle state, thus locking up the channel when attempting to re-start it for the next tile. Fixes: 0537db801bb01 ("gpu: ipu-v3: image-convert: reconfigure IC per tile") Signed-off-by: Steve Longerbeam --- drivers/gpu/ipu-v3/ipu-image-convert.c | 108 ++++++++++++++++++------- 1 file changed, 81 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c index f8b031ded3cf..43e82eb79a08 100644 --- a/drivers/gpu/ipu-v3/ipu-image-convert.c +++ b/drivers/gpu/ipu-v3/ipu-image-convert.c @@ -137,6 +137,17 @@ struct ipu_image_convert_ctx; struct ipu_image_convert_chan; struct ipu_image_convert_priv; +enum eof_irq_mask { + EOF_IRQ_IN = BIT(0), + EOF_IRQ_ROT_IN = BIT(1), + EOF_IRQ_OUT = BIT(2), + EOF_IRQ_ROT_OUT = BIT(3), +}; + +#define EOF_IRQ_COMPLETE (EOF_IRQ_IN | EOF_IRQ_OUT) +#define EOF_IRQ_ROT_COMPLETE (EOF_IRQ_IN | EOF_IRQ_OUT | \ + EOF_IRQ_ROT_IN | EOF_IRQ_ROT_OUT) + struct ipu_image_convert_ctx { struct ipu_image_convert_chan *chan; @@ -173,6 +184,9 @@ struct ipu_image_convert_ctx { /* where to place converted tile in dest image */ unsigned int out_tile_map[MAX_TILES]; + /* mask of completed EOF irqs at every tile conversion */ + enum eof_irq_mask eof_mask; + struct list_head list; }; @@ -189,6 +203,8 @@ struct ipu_image_convert_chan { struct ipuv3_channel *rotation_out_chan; /* the IPU end-of-frame irqs */ + int in_eof_irq; + int rot_in_eof_irq; int out_eof_irq; int rot_out_eof_irq; @@ -1380,6 +1396,9 @@ static int convert_start(struct ipu_image_convert_run *run, unsigned int tile) dev_dbg(priv->ipu->dev, "%s: task %u: starting ctx %p run %p tile %u -> %u\n", __func__, chan->ic_task, ctx, run, tile, dst_tile); + /* clear EOF irq mask */ + ctx->eof_mask = 0; + if (ipu_rot_mode_is_irt(ctx->rot_mode)) { /* swap width/height for resizer */ dest_width = d_image->tile[dst_tile].height; @@ -1615,7 +1634,7 @@ static bool ic_settings_changed(struct ipu_image_convert_ctx *ctx) } /* hold irqlock when calling */ -static irqreturn_t do_irq(struct ipu_image_convert_run *run) +static irqreturn_t do_tile_complete(struct ipu_image_convert_run *run) { struct ipu_image_convert_ctx *ctx = run->ctx; struct ipu_image_convert_chan *chan = ctx->chan; @@ -1715,8 +1734,9 @@ static irqreturn_t eof_irq(int irq, void *data) struct ipu_image_convert_priv *priv = chan->priv; struct ipu_image_convert_ctx *ctx; struct ipu_image_convert_run *run; + irqreturn_t ret = IRQ_HANDLED; + bool tile_complete = false; unsigned long flags; - irqreturn_t ret; spin_lock_irqsave(&chan->irqlock, flags); @@ -1729,27 +1749,33 @@ static irqreturn_t eof_irq(int irq, void *data) ctx = run->ctx; - if (irq == chan->out_eof_irq) { - if (ipu_rot_mode_is_irt(ctx->rot_mode)) { - /* this is a rotation op, just ignore */ - ret = IRQ_HANDLED; - goto out; - } - } else if (irq == chan->rot_out_eof_irq) { + if (irq == chan->in_eof_irq) { + ctx->eof_mask |= EOF_IRQ_IN; + } else if (irq == chan->out_eof_irq) { + ctx->eof_mask |= EOF_IRQ_OUT; + } else if (irq == chan->rot_in_eof_irq || + irq == chan->rot_out_eof_irq) { if (!ipu_rot_mode_is_irt(ctx->rot_mode)) { /* this was NOT a rotation op, shouldn't happen */ dev_err(priv->ipu->dev, "Unexpected rotation interrupt\n"); - ret = IRQ_HANDLED; goto out; } + ctx->eof_mask |= (irq == chan->rot_in_eof_irq) ? + EOF_IRQ_ROT_IN : EOF_IRQ_ROT_OUT; } else { dev_err(priv->ipu->dev, "Received unknown irq %d\n", irq); ret = IRQ_NONE; goto out; } - ret = do_irq(run); + if (ipu_rot_mode_is_irt(ctx->rot_mode)) + tile_complete = (ctx->eof_mask == EOF_IRQ_ROT_COMPLETE); + else + tile_complete = (ctx->eof_mask == EOF_IRQ_COMPLETE); + + if (tile_complete) + ret = do_tile_complete(run); out: spin_unlock_irqrestore(&chan->irqlock, flags); return ret; @@ -1783,6 +1809,10 @@ static void force_abort(struct ipu_image_convert_ctx *ctx) static void release_ipu_resources(struct ipu_image_convert_chan *chan) { + if (chan->in_eof_irq >= 0) + free_irq(chan->in_eof_irq, chan); + if (chan->rot_in_eof_irq >= 0) + free_irq(chan->rot_in_eof_irq, chan); if (chan->out_eof_irq >= 0) free_irq(chan->out_eof_irq, chan); if (chan->rot_out_eof_irq >= 0) @@ -1801,7 +1831,27 @@ static void release_ipu_resources(struct ipu_image_convert_chan *chan) chan->in_chan = chan->out_chan = chan->rotation_in_chan = chan->rotation_out_chan = NULL; - chan->out_eof_irq = chan->rot_out_eof_irq = -1; + chan->in_eof_irq = -1; + chan->rot_in_eof_irq = -1; + chan->out_eof_irq = -1; + chan->rot_out_eof_irq = -1; +} + +static int get_eof_irq(struct ipu_image_convert_chan *chan, + struct ipuv3_channel *channel) +{ + struct ipu_image_convert_priv *priv = chan->priv; + int ret, irq; + + irq = ipu_idmac_channel_irq(priv->ipu, channel, IPU_IRQ_EOF); + + ret = request_threaded_irq(irq, eof_irq, do_bh, 0, "ipu-ic", chan); + if (ret < 0) { + dev_err(priv->ipu->dev, "could not acquire irq %d\n", irq); + return ret; + } + + return irq; } static int get_ipu_resources(struct ipu_image_convert_chan *chan) @@ -1837,31 +1887,33 @@ static int get_ipu_resources(struct ipu_image_convert_chan *chan) } /* acquire the EOF interrupts */ - chan->out_eof_irq = ipu_idmac_channel_irq(priv->ipu, - chan->out_chan, - IPU_IRQ_EOF); + ret = get_eof_irq(chan, chan->in_chan); + if (ret < 0) { + chan->in_eof_irq = -1; + goto err; + } + chan->in_eof_irq = ret; - ret = request_threaded_irq(chan->out_eof_irq, eof_irq, do_bh, - 0, "ipu-ic", chan); + ret = get_eof_irq(chan, chan->rotation_in_chan); if (ret < 0) { - dev_err(priv->ipu->dev, "could not acquire irq %d\n", - chan->out_eof_irq); - chan->out_eof_irq = -1; + chan->rot_in_eof_irq = -1; goto err; } + chan->rot_in_eof_irq = ret; - chan->rot_out_eof_irq = ipu_idmac_channel_irq(priv->ipu, - chan->rotation_out_chan, - IPU_IRQ_EOF); + ret = get_eof_irq(chan, chan->out_chan); + if (ret < 0) { + chan->out_eof_irq = -1; + goto err; + } + chan->out_eof_irq = ret; - ret = request_threaded_irq(chan->rot_out_eof_irq, eof_irq, do_bh, - 0, "ipu-ic", chan); + ret = get_eof_irq(chan, chan->rotation_out_chan); if (ret < 0) { - dev_err(priv->ipu->dev, "could not acquire irq %d\n", - chan->rot_out_eof_irq); chan->rot_out_eof_irq = -1; goto err; } + chan->rot_out_eof_irq = ret; return 0; err: @@ -2440,6 +2492,8 @@ int ipu_image_convert_init(struct ipu_soc *ipu, struct device *dev) chan->ic_task = i; chan->priv = priv; chan->dma_ch = &image_convert_dma_chan[i]; + chan->in_eof_irq = -1; + chan->rot_in_eof_irq = -1; chan->out_eof_irq = -1; chan->rot_out_eof_irq = -1;