From patchwork Fri Mar 16 21:50:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schake X-Patchwork-Id: 10290351 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7D58E602C2 for ; Fri, 16 Mar 2018 21:51:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6ED8B2903C for ; Fri, 16 Mar 2018 21:51:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63B5D290C9; Fri, 16 Mar 2018 21:51:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0EDF42903C for ; Fri, 16 Mar 2018 21:51:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 79BB66EC0A; Fri, 16 Mar 2018 21:51:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id BCDD16EC0A for ; Fri, 16 Mar 2018 21:51:27 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id z9so5535505wmb.3 for ; Fri, 16 Mar 2018 14:51:27 -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=n7WzE/Jj9Lcs+ZyGSJcRHIQIJIiihSyTSKlRed/znTc=; b=XGXTdmF4GuIWxgZTw2uTp1/QlG2mTPgUXdzvYh88FfT4XcO5p6vJGTIBrPpyId5JMe JeacI+nrytU1nlalbbmp8bErxAh/rhnzsI+1qMUVN9ZxA/np0k7Ikihx4efB4EBkcChQ TkC4AjyyjVOSx4SQsZE2UoI5j2hN9FuCSYBomCDLAYaVF8dBJbCm/pApSRy5Y5cJ4Abg ZVJrGE6VBakVjhNT/KFWMg7WPDXWkp4G++AjXa1hcS3gS/VUwr/lebaZcP9lA4WIPpwL zSOBVJsQNmSyAkpLpXku5HEiJFQctz5J8EoMQvhw+6aNBHHNEjokIBHzsPegLTgPcmI3 laKg== 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=n7WzE/Jj9Lcs+ZyGSJcRHIQIJIiihSyTSKlRed/znTc=; b=eFZvcQYOj+6BwlTAQdHsW/9ZruKHqw/WCSMUD1IHcR4g7vlP72oJ1Y62cK8TaJbMyb h8NgNln98TmiWGhhqyDVI10QkEDsZTfokJ0vLdXC80Y9bQ3Og7UiFgeflsn9h0awEXF8 R0AKWIr+oo1cLA5NpUTxoYCKIoY0uLC56F5op+NH6Z+w5oZWbeHD8fP/bRTziVdo2cen sDfKPvKbBPSx3eEwAi0hCZ0F6L+3l+AguPrV8d5juQyvqgZetlnI8UpmYKA9taMQKSHv aR1gcorlx47Jyd3q4BOZRlcAjYDYTyAvMfdnTkwLoSuvuw5g0vKaZT3B9ktin8bYzjWI 75FQ== X-Gm-Message-State: AElRT7ELwVFq0vICCS0Ozv7fEUyKaEiEdTiIAZvk7PP0umNaYZAowGog sSHvyF7URoPyFCF/95HXOG8= X-Google-Smtp-Source: AG47ELu5KesKfqNVjyOclbJjHWLw/5qA63PKtcHOrHSK6PEqjXYrJBCdQ8qgbM9EDU36NYqovnjcSw== X-Received: by 10.80.152.161 with SMTP id j30mr3997429edb.202.1521237086332; Fri, 16 Mar 2018 14:51:26 -0700 (PDT) Received: from localhost.localdomain (x5ce4c84b.dyn.telefonica.de. [92.228.200.75]) by smtp.gmail.com with ESMTPSA id m23sm5000606edc.69.2018.03.16.14.51.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Mar 2018 14:51:25 -0700 (PDT) From: Stefan Schake To: eric@anholt.net Subject: [PATCH 3/3] drm/vc4: Restrict active CTM to one CRTC Date: Fri, 16 Mar 2018 22:50:59 +0100 Message-Id: <1521237059-37117-4-git-send-email-stschake@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521237059-37117-1-git-send-email-stschake@gmail.com> References: <1521237059-37117-1-git-send-email-stschake@gmail.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: airlied@linux.ie, linux-rpi-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, Stefan Schake MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP We only have one hardware block to do the CTM and need to reject attempts to enable it for multiple CRTCs simultaneously. Signed-off-by: Stefan Schake --- drivers/gpu/drm/vc4/vc4_crtc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 5c83fd2..64ff293 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -678,10 +678,17 @@ static enum drm_mode_status vc4_crtc_mode_valid(struct drm_crtc *crtc, return MODE_OK; } +static int vc4_crtc_get_ctm_fifo(struct vc4_dev *vc4) +{ + return VC4_GET_FIELD(HVS_READ(SCALER_OLEDOFFS), + SCALER_OLEDOFFS_DISPFIFO); +} + static int vc4_crtc_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state) { struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(state); + struct drm_crtc_state *old_state = crtc->state; struct drm_device *dev = crtc->dev; struct vc4_dev *vc4 = to_vc4_dev(dev); struct drm_plane *plane; @@ -703,6 +710,10 @@ static int vc4_crtc_atomic_check(struct drm_crtc *crtc, */ if (vc4_crtc_atomic_check_ctm(state)) return -EINVAL; + + /* We can only enable CTM for one fifo or CRTC at a time */ + if (!old_state->ctm && vc4_crtc_get_ctm_fifo(vc4)) + return -EINVAL; } drm_atomic_crtc_state_for_each_plane_state(plane, plane_state, state)