From patchwork Sun Mar 25 01:52:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schake X-Patchwork-Id: 10306467 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 B5566600F6 for ; Sun, 25 Mar 2018 01:53:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5AE4291DE for ; Sun, 25 Mar 2018 01:53:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9147291F1; Sun, 25 Mar 2018 01:53:39 +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 6C5B8291DE for ; Sun, 25 Mar 2018 01:53:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 203866E064; Sun, 25 Mar 2018 01:53:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7A49D6E064 for ; Sun, 25 Mar 2018 01:53:36 +0000 (UTC) Received: by mail-wr0-x241.google.com with SMTP id p53so8036296wrc.10 for ; Sat, 24 Mar 2018 18:53:36 -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=dEPPc+dWIomk1lBZi/hqi2mCLNW3fHRUdS309o3FiFY=; b=FTmCw+/gnrEfZA3cQ4LFI/bU5CrljilIzkpufngkGqgwNTOIwOVAs9Fi8Rsnk4iJ7E TSYUCrO41lKsZPeNrSr3+qBQYWFFsMM3XtuVpB7UxSot2EDgZwpAi3shj1W90m5glBjt 5C45TAlbk9pdfhzSzbF9qnSmmyp+iiKWSYIu2jlDb1zCohOh2UVjbaPdlvGivCt4rq+J OAq3JbXiIrV5y1V5VIeduofjhTl4QCBzHk2mq938eJasEIPgCcPvDJsI/8CUe9P1nxOS o6xT+h0+rFUKJLVuNiEhIVAjmD/BJQZQYShLDBIpZUq9gCMzMUX/ePzQxGMn8g8dWh0o tV2A== 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=dEPPc+dWIomk1lBZi/hqi2mCLNW3fHRUdS309o3FiFY=; b=RSgEDWCDpbBjsHgjG0AiO/MZcAE9SrC0+mxXDPg6jh164DdnSEGDDb/TQMnKMlCBEV slaPbPWMnDTyOm9G8Talx1v16WocuRkZKPNfhSoOgS7PT5WQO4cEBz5VZgLOQMX0t3BB wjfnYBAjNE1JnNPBU4NdAAMOMlmfh/bHM/lzM29SRh60d3beiZRs21WGLI9Jg+Qlp5zw xKBo+UfRpGA7igIjVofFKbfCQ96VLdsWvItFZwUK9X81x4FyPnUV0skY5R+AqXgm9a23 zRR+GikJy9p3SS1C4CK8WQgfEmcYkICCEUPWk5FC6XqZOg5CY6gx+CwzcdT1gM97gYRL 519w== X-Gm-Message-State: AElRT7GLC+3ipS568aku+xooMzYt60896yx2vyHuPqfiqtZ5nTZUHG3I wNs9/5IouQK+yfOg/3DoKTE= X-Google-Smtp-Source: AG47ELuekqcMcR4H3YjiMGOcCwSbJTGdpReQtYkRatofI/GvAno+WNz+cb9TQAW0qkvtpuFDr58Kwg== X-Received: by 10.223.162.203 with SMTP id t11mr28522404wra.88.1521942814884; Sat, 24 Mar 2018 18:53:34 -0700 (PDT) Received: from localhost.localdomain (ip-88-153-118-32.hsi04.unitymediagroup.de. [88.153.118.32]) by smtp.gmail.com with ESMTPSA id j3sm15413678wra.19.2018.03.24.18.53.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Mar 2018 18:53:34 -0700 (PDT) From: Stefan Schake To: eric@anholt.net Subject: [PATCH v2 4/4] drm/vc4: Restrict active CTM to one CRTC Date: Sat, 24 Mar 2018 18:52:40 -0700 Message-Id: <20180325015240.75464-5-stschake@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180325015240.75464-1-stschake@gmail.com> References: <20180325015240.75464-1-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 --- v2: No change 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 bafb0102fe1d..180b93ec447e 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -676,10 +676,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; @@ -701,6 +708,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)