From patchwork Tue Nov 13 20:52:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10681527 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C315C13BF for ; Tue, 13 Nov 2018 20:53:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3FEA2B738 for ; Tue, 13 Nov 2018 20:53:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A839C2B739; Tue, 13 Nov 2018 20:53:03 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 34C012B72D for ; Tue, 13 Nov 2018 20:53:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 230FD6E265; Tue, 13 Nov 2018 20:53:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yb1-xb42.google.com (mail-yb1-xb42.google.com [IPv6:2607:f8b0:4864:20::b42]) by gabe.freedesktop.org (Postfix) with ESMTPS id 38D746E2CD for ; Tue, 13 Nov 2018 20:53:00 +0000 (UTC) Received: by mail-yb1-xb42.google.com with SMTP id 131-v6so5961012ybe.12 for ; Tue, 13 Nov 2018 12:53:00 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=+UzFsJ1BJ8TOb9dU3PaMBqryyEUf5HCAifaLVRzgGLY=; b=htZaH2aK7RFRi+w0IOAHV7X8KELMEbgVsvTYWxusu8RZ4wXN1ZvDCwHqy5k/lwfidE 0pRoTE9raSc8ftUDboQL3i6ZkVOhm45PXOYcsw3oqzqjTuVU6NItjpBYqrpWc9YkSp0m 9yPUqZD4H5aFpk0w6dIxoIlfapTE6kUFIXqmgq1YUla7A3iH41+I3aODsl6BqVk+358c 0T57Yb3e4Hl0IL59HzlSgIyfulCiglpC6DbvADF0rkf9/WEIBkeyAoiQaniq6NGSGKf1 dKnNYZ4IXISqtLepI7INhvXInOnpCQwZc6smc62P9qqmHTmrUByRnpR45zBzvaAl0Do3 U8OA== X-Gm-Message-State: AGRZ1gKj6m8R+bzn6Jb9M1VkKkAiIeOXLtNThQe1VU7mtKBgpbDkIS++ aB7txuFXo7tIlpwtZ9Nw/ORL2Aibg3nD0Q== X-Google-Smtp-Source: AJdET5fFQ6gLf/G1S3Aqk5MiE2krnlIeL43YPUSw9NDtyXvsJHohtJPYBM37sQNGNNCo7LF6ZelA9w== X-Received: by 2002:a25:cdc3:: with SMTP id d186-v6mr3221589ybf.360.1542142379152; Tue, 13 Nov 2018 12:52:59 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id u130-v6sm5441257ywa.71.2018.11.13.12.52.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 12:52:58 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 1/8] drm/msm: dpu: Move pm_runtime_(get|put) from vblank_enable Date: Tue, 13 Nov 2018 15:52:44 -0500 Message-Id: <20181113205257.170707-1-sean@poorly.run> X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog MIME-Version: 1.0 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: Sean Paul Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul There are 4 times that _dpu_crtc_vblank_enable_no_lock() is called: 1- crtc enable 2- crtc disable 3- crtc vblank enable 4- crtc vblank disable When we enable or disable the crtc, we call drm_crtc_vblank_on and drm_crtc_vblank_off respectively. That will gate vblank enables and disables to only being called when the crtc is active. That means that we can just enable/disable pm runtime in crtc enable/disable. This will be beneficial in trying to eliminate blocking calls from the vblank call chain. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 80de5289ada3..aa2f20c05dd7 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -777,8 +777,6 @@ static void _dpu_crtc_vblank_enable_no_lock( struct drm_encoder *enc; if (enable) { - pm_runtime_get_sync(dev->dev); - list_for_each_entry(enc, &dev->mode_config.encoder_list, head) { if (enc->crtc != crtc) continue; @@ -801,8 +799,6 @@ static void _dpu_crtc_vblank_enable_no_lock( dpu_encoder_register_vblank_callback(enc, NULL, NULL); } - - pm_runtime_put_sync(dev->dev); } } @@ -902,6 +898,8 @@ static void dpu_crtc_disable(struct drm_crtc *crtc) crtc->state->event = NULL; spin_unlock_irqrestore(&crtc->dev->event_lock, flags); } + + pm_runtime_put_sync(crtc->dev->dev); } static void dpu_crtc_enable(struct drm_crtc *crtc, @@ -917,6 +915,8 @@ static void dpu_crtc_enable(struct drm_crtc *crtc, } priv = crtc->dev->dev_private; + pm_runtime_get_sync(crtc->dev->dev); + DRM_DEBUG_KMS("crtc%d\n", crtc->base.id); dpu_crtc = to_dpu_crtc(crtc); From patchwork Tue Nov 13 20:52:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10681531 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B1A9213BF for ; Tue, 13 Nov 2018 20:53:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1F5D2B6D8 for ; Tue, 13 Nov 2018 20:53:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 961C62B537; Tue, 13 Nov 2018 20:53:06 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 50B872B537 for ; Tue, 13 Nov 2018 20:53:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EE8736E30C; Tue, 13 Nov 2018 20:53:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw1-xc41.google.com (mail-yw1-xc41.google.com [IPv6:2607:f8b0:4864:20::c41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2F3676E34C for ; Tue, 13 Nov 2018 20:53:04 +0000 (UTC) Received: by mail-yw1-xc41.google.com with SMTP id v77-v6so6392195ywc.4 for ; Tue, 13 Nov 2018 12:53:04 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=0uJlzUYoMkmz9wfHG2GzW+owDjWRrYyxWNW8o1b4XmE=; b=WK4vnnOQQIrYa9RuTqOrlZV3hEOoxCX+3Ofq4oqR6MbzsBtz3zGhUdc+vhmzG+vlQY Tl5q5/b66DyPAE4r65voIGoAciCDEG43rON+06WaCOBi/MhPv1IDH7jEiR4+ImOdV/cS 9/XTs0OmiC/yfeefSGf4MpCY0EsCHrCconHLx3RDBJDLNPQC79Ny9qoSh+1522etw6GU h6eFt89De6yb4TKqPFTC5MWQa1aFwgNf9HXlDkSPSnezIQnor4ptlwyenEFV9XQvs77P rcSPupLZLGmFV8yhYVcVkucc93AFkZYKV4FLESoQ7bGo4iQa9RcVTzxhkEf4x8l5zKIg c5Gg== X-Gm-Message-State: AGRZ1gIt+OP4r04weTkqQweueeLZ9/HhmbTnIxL3q0g97PsQWdZWtwZ7 /J9FZNaFm1y1imDJIgzVKQecGS01v76/Mg== X-Google-Smtp-Source: AJdET5e3g/BOJwzA7VaReXm7vkjU8Z1FpQ40k0EdnOEV7Xxo5HmDnEUQX96cAJD3zxj82V2a67LKrw== X-Received: by 2002:a0d:e744:: with SMTP id q65-v6mr6774291ywe.109.1542142383167; Tue, 13 Nov 2018 12:53:03 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id u130-v6sm5441257ywa.71.2018.11.13.12.53.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 12:53:02 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 2/8] drm/msm: dpu: Remove crtc_lock from setup_mixers Date: Tue, 13 Nov 2018 15:52:45 -0500 Message-Id: <20181113205257.170707-2-sean@poorly.run> X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog In-Reply-To: <20181113205257.170707-1-sean@poorly.run> References: <20181113205257.170707-1-sean@poorly.run> MIME-Version: 1.0 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: Sean Paul Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul I think the intention here was to protect the enc->crtc access, but that's insufficient to avoid enc->crtc changing. Fortunately we're already holding the modeset lock when this is called (from atomic_check), so remove the crtc_lock and add a modeset lock check. While we're at it, use the encoder mask from crtc state instead of legacy pointer. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index aa2f20c05dd7..adda0aa0cbaa 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -470,19 +470,13 @@ static void _dpu_crtc_setup_mixer_for_encoder( static void _dpu_crtc_setup_mixers(struct drm_crtc *crtc) { - struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc); struct drm_encoder *enc; - mutex_lock(&dpu_crtc->crtc_lock); - /* Check for mixers on all encoders attached to this crtc */ - list_for_each_entry(enc, &crtc->dev->mode_config.encoder_list, head) { - if (enc->crtc != crtc) - continue; + WARN_ON(!drm_modeset_is_locked(&crtc->mutex)); + /* Check for mixers on all encoders attached to this crtc */ + drm_for_each_encoder_mask(enc, crtc->dev, crtc->state->encoder_mask) _dpu_crtc_setup_mixer_for_encoder(crtc, enc); - } - - mutex_unlock(&dpu_crtc->crtc_lock); } static void _dpu_crtc_setup_lm_bounds(struct drm_crtc *crtc, From patchwork Tue Nov 13 20:52:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10681535 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E1F4414DB for ; Tue, 13 Nov 2018 20:53:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D33962B537 for ; Tue, 13 Nov 2018 20:53:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C748E2B6D8; Tue, 13 Nov 2018 20:53:13 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 4F6162B537 for ; Tue, 13 Nov 2018 20:53:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D1FA36E385; Tue, 13 Nov 2018 20:53:11 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yb1-xb43.google.com (mail-yb1-xb43.google.com [IPv6:2607:f8b0:4864:20::b43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 705796E385 for ; Tue, 13 Nov 2018 20:53:10 +0000 (UTC) Received: by mail-yb1-xb43.google.com with SMTP id g192-v6so6000927ybf.3 for ; Tue, 13 Nov 2018 12:53:10 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=Gw8hEOv58ViRfS9flWGeHJFwnbGtlE0LSz6pZTAyGds=; b=R9O4/lsIHBNUsm9MraRk1eYnosHKuq/Pgx6V2wLQVEdu7DPig8MMh6LmsvlAPb4FL4 ERmYyKGairDDGWYKJkIvVeKMlvwnZXLx/udnFsgk4oy+oZMjPr39liZ+1TKk54vSSnm3 J5GBxD3ctNelwXONNEvYtssuiJzw86FocU8j4NpYHKLoenFnoCyK0gZ2o0vjmLjekhoV 7vvLrsHLX3xRVJIOad4Z/A1eubuFedfC39ZI0zYHQCOQrP3FgYT+9nwdy6s62YY19XiH QHxu2vX40JlHLHx2KiFfXG5d0ChOf6OMtqlyrd+WRUs7GjY4j/bmRgkYMXZPhpbWwoyS jOXA== X-Gm-Message-State: AGRZ1gLDokTLHWS6km3yAxcI0PskrglXh+17sBp2vxBSEBDO735IQlEe 8TBjKZEa4dbeQhLtq8DUsYFmRpMP7NOAIA== X-Google-Smtp-Source: AJdET5fmiPlko+uXxNVbMWR70rZQD7DvS0aKU9a8Qrj/4GD2avPhXJZgQhit/WvXcqkMM0q4LkAEAw== X-Received: by 2002:a5b:cce:: with SMTP id e14-v6mr6330773ybr.350.1542142389382; Tue, 13 Nov 2018 12:53:09 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id u130-v6sm5441257ywa.71.2018.11.13.12.53.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 12:53:09 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 3/8] drm/msm: dpu: Remove vblank_callback from encoder Date: Tue, 13 Nov 2018 15:52:46 -0500 Message-Id: <20181113205257.170707-3-sean@poorly.run> X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog In-Reply-To: <20181113205257.170707-1-sean@poorly.run> References: <20181113205257.170707-1-sean@poorly.run> MIME-Version: 1.0 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: Sean Paul Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul The indirection of registering a callback and opaque pointer isn't real useful when there's only one callsite. So instead of having the vblank_cb registration, just give encoder a crtc and let it directly call the vblank handler. In a later patch, we'll make use of this further. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 8 +++---- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h | 6 +++++ drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 25 +++++++++++---------- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 10 ++++----- 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index adda0aa0cbaa..38119b4d4a80 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -291,9 +291,8 @@ enum dpu_intf_mode dpu_crtc_get_intf_mode(struct drm_crtc *crtc) return INTF_MODE_NONE; } -static void dpu_crtc_vblank_cb(void *data) +void dpu_crtc_vblank_callback(struct drm_crtc *crtc) { - struct drm_crtc *crtc = (struct drm_crtc *)data; struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc); /* keep statistics on vblank callback - with auto reset via debugfs */ @@ -779,8 +778,7 @@ static void _dpu_crtc_vblank_enable_no_lock( DRMID(enc), enable, dpu_crtc); - dpu_encoder_register_vblank_callback(enc, - dpu_crtc_vblank_cb, (void *)crtc); + dpu_encoder_assign_crtc(enc, crtc); } } else { list_for_each_entry(enc, &dev->mode_config.encoder_list, head) { @@ -791,7 +789,7 @@ static void _dpu_crtc_vblank_enable_no_lock( DRMID(enc), enable, dpu_crtc); - dpu_encoder_register_vblank_callback(enc, NULL, NULL); + dpu_encoder_assign_crtc(enc, NULL); } } } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h index 93d21a61a040..54595cc29be5 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h @@ -270,6 +270,12 @@ static inline int dpu_crtc_frame_pending(struct drm_crtc *crtc) */ int dpu_crtc_vblank(struct drm_crtc *crtc, bool en); +/** + * dpu_crtc_vblank_callback - called on vblank irq, issues completion events + * @crtc: Pointer to drm crtc object + */ +void dpu_crtc_vblank_callback(struct drm_crtc *crtc); + /** * dpu_crtc_commit_kickoff - trigger kickoff of the commit for this crtc * @crtc: Pointer to drm crtc object diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index d89ac520f7e6..fd6514f681ae 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -142,9 +142,11 @@ enum dpu_enc_rc_states { * @intfs_swapped Whether or not the phys_enc interfaces have been swapped * for partial update right-only cases, such as pingpong * split where virtual pingpong does not generate IRQs - * @crtc_vblank_cb: Callback into the upper layer / CRTC for - * notification of the VBLANK - * @crtc_vblank_cb_data: Data from upper layer for VBLANK notification + * @crtc: Pointer to the currently assigned crtc. Normally you + * would use crtc->state->encoder_mask to determine the + * link between encoder/crtc. However in this case we need + * to track crtc in the disable() hook which is called + * _after_ encoder_mask is cleared. * @crtc_kickoff_cb: Callback into CRTC that will flush & start * all CTL paths * @crtc_kickoff_cb_data: Opaque user data given to crtc_kickoff_cb @@ -186,8 +188,7 @@ struct dpu_encoder_virt { bool intfs_swapped; - void (*crtc_vblank_cb)(void *); - void *crtc_vblank_cb_data; + struct drm_crtc *crtc; struct dentry *debugfs_root; struct mutex enc_lock; @@ -1241,8 +1242,8 @@ static void dpu_encoder_vblank_callback(struct drm_encoder *drm_enc, dpu_enc = to_dpu_encoder_virt(drm_enc); spin_lock_irqsave(&dpu_enc->enc_spinlock, lock_flags); - if (dpu_enc->crtc_vblank_cb) - dpu_enc->crtc_vblank_cb(dpu_enc->crtc_vblank_cb_data); + if (dpu_enc->crtc) + dpu_crtc_vblank_callback(dpu_enc->crtc); spin_unlock_irqrestore(&dpu_enc->enc_spinlock, lock_flags); atomic_inc(&phy_enc->vsync_cnt); @@ -1262,15 +1263,14 @@ static void dpu_encoder_underrun_callback(struct drm_encoder *drm_enc, DPU_ATRACE_END("encoder_underrun_callback"); } -void dpu_encoder_register_vblank_callback(struct drm_encoder *drm_enc, - void (*vbl_cb)(void *), void *vbl_data) +void dpu_encoder_assign_crtc(struct drm_encoder *drm_enc, struct drm_crtc *crtc) { struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc); unsigned long lock_flags; bool enable; int i; - enable = vbl_cb ? true : false; + enable = crtc ? true : false; if (!drm_enc) { DPU_ERROR("invalid encoder\n"); @@ -1279,8 +1279,9 @@ void dpu_encoder_register_vblank_callback(struct drm_encoder *drm_enc, trace_dpu_enc_vblank_cb(DRMID(drm_enc), enable); spin_lock_irqsave(&dpu_enc->enc_spinlock, lock_flags); - dpu_enc->crtc_vblank_cb = vbl_cb; - dpu_enc->crtc_vblank_cb_data = vbl_data; + /* crtc should always be cleared before re-assigning */ + WARN_ON(crtc && dpu_enc->crtc); + dpu_enc->crtc = crtc; spin_unlock_irqrestore(&dpu_enc->enc_spinlock, lock_flags); for (i = 0; i < dpu_enc->num_phys_encs; i++) { diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h index aa4f135218fa..be1d80867834 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h @@ -55,14 +55,12 @@ void dpu_encoder_get_hw_resources(struct drm_encoder *encoder, struct dpu_encoder_hw_resources *hw_res); /** - * dpu_encoder_register_vblank_callback - provide callback to encoder that - * will be called on the next vblank. + * dpu_encoder_assign_crtc - Link the encoder to the crtc it's assigned to * @encoder: encoder pointer - * @cb: callback pointer, provide NULL to deregister and disable IRQs - * @data: user data provided to callback + * @crtc: crtc pointer */ -void dpu_encoder_register_vblank_callback(struct drm_encoder *encoder, - void (*cb)(void *), void *data); +void dpu_encoder_assign_crtc(struct drm_encoder *encoder, + struct drm_crtc *crtc); /** * dpu_encoder_register_frame_event_callback - provide callback to encoder that From patchwork Tue Nov 13 20:52:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10681537 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1D56D13BF for ; Tue, 13 Nov 2018 20:53:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F3572B5DB for ; Tue, 13 Nov 2018 20:53:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01DA12B6DE; Tue, 13 Nov 2018 20:53:17 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 B71B92B5DB for ; Tue, 13 Nov 2018 20:53:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C64276E34C; Tue, 13 Nov 2018 20:53:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw1-xc41.google.com (mail-yw1-xc41.google.com [IPv6:2607:f8b0:4864:20::c41]) by gabe.freedesktop.org (Postfix) with ESMTPS id A3F526E3CC for ; Tue, 13 Nov 2018 20:53:15 +0000 (UTC) Received: by mail-yw1-xc41.google.com with SMTP id h32so288594ywk.2 for ; Tue, 13 Nov 2018 12:53:15 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=qPltI1qrCgJwGI6zSBtcezk2XinRjtKm0e3Db/qEV38=; b=ex9DpY6o3puXMLiBYEvLM0KW8W5d95ooQgVmbqMEnXFE3z55wT+URstZm6Q3Cb+ih3 5xNZ6VJfmN6vh9HpSn1+gRTBMgGFEWS0ODK7yBhRtp+8U0wRiu25Q8CxsfDIR3PegGHX Gw5N1mmPaK8hJ60htEBTeZ3jRL1UmUTCALCXzdt8/2D+4HXySsDC9ncpdKfYftwh6wUb AEGJjhcD6hkYGqcsW7dRUm8nLc8crNUDFohhcT7C71L+CEkwhXcvVr7cy1Ec+2Gzk4ug dSmLC7X+K5Y/9Vhl0nCi6dtZc9cba+6CLaDOZbkNjiMA9Db8ifpR22Q3VWp49xT3shd6 S+PA== X-Gm-Message-State: AGRZ1gJc7CNcL7qGTA2XGogzzyPa3oOgHtaFLXBMgFqwWmeE1vR+6frQ mZKQNJQDfWb0nhvIq05B4OXIUj1NdVr9KQ== X-Google-Smtp-Source: AJdET5dZ2pYtsT4yX/fGZGtElRcJ50UL1jJofnjOqs7cuoXKPzvJ9irCrkPmVRSuP3Hyx9bbb9cZPA== X-Received: by 2002:a0d:ed82:: with SMTP id w124-v6mr6526478ywe.447.1542142394690; Tue, 13 Nov 2018 12:53:14 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id u130-v6sm5441257ywa.71.2018.11.13.12.53.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 12:53:14 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 4/8] drm/msm: dpu: Use atomic_disable for dpu_crtc_disable Date: Tue, 13 Nov 2018 15:52:47 -0500 Message-Id: <20181113205257.170707-4-sean@poorly.run> X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog In-Reply-To: <20181113205257.170707-1-sean@poorly.run> References: <20181113205257.170707-1-sean@poorly.run> MIME-Version: 1.0 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: Sean Paul Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul Matches dpu_crtc_enable and we'll need the old state in a future patch Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 38119b4d4a80..a4d1a3c98318 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -823,7 +823,8 @@ static struct drm_crtc_state *dpu_crtc_duplicate_state(struct drm_crtc *crtc) return &cstate->base; } -static void dpu_crtc_disable(struct drm_crtc *crtc) +static void dpu_crtc_disable(struct drm_crtc *crtc, + struct drm_crtc_state *old_crtc_state) { struct dpu_crtc *dpu_crtc; struct dpu_crtc_state *cstate; @@ -1421,7 +1422,7 @@ static const struct drm_crtc_funcs dpu_crtc_funcs = { }; static const struct drm_crtc_helper_funcs dpu_crtc_helper_funcs = { - .disable = dpu_crtc_disable, + .atomic_disable = dpu_crtc_disable, .atomic_enable = dpu_crtc_enable, .atomic_check = dpu_crtc_atomic_check, .atomic_begin = dpu_crtc_atomic_begin, From patchwork Tue Nov 13 20:52:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10681543 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 12A601747 for ; Tue, 13 Nov 2018 20:53:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 036BA2B537 for ; Tue, 13 Nov 2018 20:53:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC31F2B6D8; Tue, 13 Nov 2018 20:53:22 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 A7F532B537 for ; Tue, 13 Nov 2018 20:53:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9BDF66E3D6; Tue, 13 Nov 2018 20:53:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yb1-xb43.google.com (mail-yb1-xb43.google.com [IPv6:2607:f8b0:4864:20::b43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1A9326E3D6 for ; Tue, 13 Nov 2018 20:53:20 +0000 (UTC) Received: by mail-yb1-xb43.google.com with SMTP id z2-v6so6005518ybj.2 for ; Tue, 13 Nov 2018 12:53:20 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=CisQwFaedQoJAvfuZOz2h5EluFVHXrdWffEeo6TMs60=; b=XNRPxmISlpzXimf42koLPVXOgaK6+2HbOgF6hP0G8bzAl4nMMth85Am8MTBTsoVrH9 o+fiZMv3hsA9XHsxN5/NFk6ZQuGgP9EqD80SZat5vofKb3M3g5TcjptvzQ/49S8PxO/m Uk+ORFQgWsP9pGwAVyDsRXYq1aCbUD0YRPSYG/0kf5Tp0qh4EnUbNZF+5YHlR/7yBFXA kPq4xO/UIZQNV3SjIrVLiOwbfySTrhr8dh7gPWidIRl6Kab8N8jqV4FcopJwe6Vjum8I xFM9U2RsrZ37EUYoRUgcQVPKtUu2hSwSDtPEhxrVT8ElIAKaG9vLn1bIGHFCAkTFK0jd CgIg== X-Gm-Message-State: AGRZ1gKk0kmpqkpPR7YeJ+ZUN6UFcEIbRDRJ5pdMISTi7WuZ33LTIq5G pxXFTyBAoLbnJEgAHa6HtCKN7MTPdVTIDA== X-Google-Smtp-Source: AJdET5eGnXFHhrqaSduuK+DKISQvkZXCkUarOOZ/61VQonLCWHcYIN8G1TiFeCRZ9KAF2kqJIrMmJg== X-Received: by 2002:a25:3794:: with SMTP id e142-v6mr6652237yba.94.1542142399088; Tue, 13 Nov 2018 12:53:19 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id u130-v6sm5441257ywa.71.2018.11.13.12.53.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 12:53:18 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 5/8] drm/msm: dpu: Don't bother checking ->enabled in dpu_crtc_vblank Date: Tue, 13 Nov 2018 15:52:48 -0500 Message-Id: <20181113205257.170707-5-sean@poorly.run> X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog In-Reply-To: <20181113205257.170707-1-sean@poorly.run> References: <20181113205257.170707-1-sean@poorly.run> MIME-Version: 1.0 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: Sean Paul Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul The drm_crtc_vblank_on/off calls in enable/disable guarantee that we won't call this function when crtc is not enabled. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index a4d1a3c98318..4b7f98a6ab60 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -1176,9 +1176,7 @@ int dpu_crtc_vblank(struct drm_crtc *crtc, bool en) mutex_lock(&dpu_crtc->crtc_lock); trace_dpu_crtc_vblank(DRMID(&dpu_crtc->base), en, dpu_crtc); - if (dpu_crtc->enabled) { - _dpu_crtc_vblank_enable_no_lock(dpu_crtc, en); - } + _dpu_crtc_vblank_enable_no_lock(dpu_crtc, en); dpu_crtc->vblank_requested = en; mutex_unlock(&dpu_crtc->crtc_lock); From patchwork Tue Nov 13 20:52:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10681547 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EDE3A14DB for ; Tue, 13 Nov 2018 20:53:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEE782B6D8 for ; Tue, 13 Nov 2018 20:53:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2C762B6F0; Tue, 13 Nov 2018 20:53:28 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 4B5152B6D8 for ; Tue, 13 Nov 2018 20:53:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 448656E3E8; Tue, 13 Nov 2018 20:53:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yb1-xb42.google.com (mail-yb1-xb42.google.com [IPv6:2607:f8b0:4864:20::b42]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4AD2B6E3E7 for ; Tue, 13 Nov 2018 20:53:26 +0000 (UTC) Received: by mail-yb1-xb42.google.com with SMTP id i78-v6so6011428ybg.0 for ; Tue, 13 Nov 2018 12:53:26 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=lYQVVC1Y3ZfyuZqHA2nUb+14qf9W+2O5hRpfM/PMDgM=; b=qT71cqrPK4eVAiDs7AleBYxHeIybWkIu+lyLrOw1uFuAX1PbGys+pZXhfAiT8C32Nu t6W9b4pkFmlpzvr89pD8p9oE2wG1R9lGKhvurTtGrJjGJMEll/mLU2DMAQBLpctlME7g OF64Wp1Ne78+iCan79vBB7nZMCpjs3G/xESw2wsRO6EPhSU/nRIPSu617Ej9lqCKOvVT uWGJyYIBMYmuFBIjfCMcXaAmY/eK5/WryjokSz0IY7FfbLeO1m5j3ksiRTxqwCqOT2Mf iR5ZX/6/Oy7P3ObHNwBvGe0R8zs9VxQtov8VGgdfd8eiv63xC4dO59IulioV6xXaRi/b SiAw== X-Gm-Message-State: AGRZ1gI37IrVnQsftDt89A8Q2QwhQY7LDr7TU7aypb0g/mLCe7RBKK75 1NEsNSlpILvelYIXG+SxDmrFxKMbTA81PQ== X-Google-Smtp-Source: AJdET5d8L9Zuj2ZEpREbrtAHkIKaNVXQg2vPlyOBg7vaO1fP5ukpEvJMo9vqHgTx+xjhXDYLVUMB1A== X-Received: by 2002:a25:7009:: with SMTP id l9-v6mr6873714ybc.35.1542142405087; Tue, 13 Nov 2018 12:53:25 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id u130-v6sm5441257ywa.71.2018.11.13.12.53.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 12:53:24 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 6/8] drm/msm: dpu: Separate crtc assignment from vblank enable Date: Tue, 13 Nov 2018 15:52:49 -0500 Message-Id: <20181113205257.170707-6-sean@poorly.run> X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog In-Reply-To: <20181113205257.170707-1-sean@poorly.run> References: <20181113205257.170707-1-sean@poorly.run> MIME-Version: 1.0 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: Sean Paul Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul Instead of assigning/clearing the crtc on vblank enable/disable, we can just assign and clear the crtc on modeset. That allows us to just toggle the encoder's vblank interrupts on vblank_enable. So why is this important? Previously the driver was using the legacy pointers to assign/clear the crtc. Legacy pointers are cleared _after_ disabling the hardware, so the legacy pointer was valid during vblank_disable, but that's not something we should rely on. Instead of relying on the core ordering the legacy pointer assignments just so, we'll assign the crtc in dpu_crtc enable/disable. This is the only place that mapping can change, so we're covered there. We're also taking advantage of drm_crtc_vblank_on/off. By using this, we ensure that vblank_enable/disable can never be called while the crtc is off (which means the assigned crtc will always be valid). As such, we don't need to use modeset locks or the crtc_lock in the vblank_enable/disable routine to be sure state is consistent. ...I think. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 77 +++++++++------------ drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 27 +++++--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 10 +++ 3 files changed, 59 insertions(+), 55 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 4b7f98a6ab60..59e823281fdf 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -757,43 +757,6 @@ void dpu_crtc_commit_kickoff(struct drm_crtc *crtc) DPU_ATRACE_END("crtc_commit"); } -/** - * _dpu_crtc_vblank_enable_no_lock - update power resource and vblank request - * @dpu_crtc: Pointer to dpu crtc structure - * @enable: Whether to enable/disable vblanks - */ -static void _dpu_crtc_vblank_enable_no_lock( - struct dpu_crtc *dpu_crtc, bool enable) -{ - struct drm_crtc *crtc = &dpu_crtc->base; - struct drm_device *dev = crtc->dev; - struct drm_encoder *enc; - - if (enable) { - list_for_each_entry(enc, &dev->mode_config.encoder_list, head) { - if (enc->crtc != crtc) - continue; - - trace_dpu_crtc_vblank_enable(DRMID(&dpu_crtc->base), - DRMID(enc), enable, - dpu_crtc); - - dpu_encoder_assign_crtc(enc, crtc); - } - } else { - list_for_each_entry(enc, &dev->mode_config.encoder_list, head) { - if (enc->crtc != crtc) - continue; - - trace_dpu_crtc_vblank_enable(DRMID(&dpu_crtc->base), - DRMID(enc), enable, - dpu_crtc); - - dpu_encoder_assign_crtc(enc, NULL); - } - } -} - /** * dpu_crtc_duplicate_state - state duplicate hook * @crtc: Pointer to drm crtc structure @@ -847,6 +810,10 @@ static void dpu_crtc_disable(struct drm_crtc *crtc, /* Disable/save vblank irq handling */ drm_crtc_vblank_off(crtc); + drm_for_each_encoder_mask(encoder, crtc->dev, + old_crtc_state->encoder_mask) + dpu_encoder_assign_crtc(encoder, NULL); + mutex_lock(&dpu_crtc->crtc_lock); /* wait for frame_event_done completion */ @@ -856,9 +823,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc, atomic_read(&dpu_crtc->frame_pending)); trace_dpu_crtc_disable(DRMID(crtc), false, dpu_crtc); - if (dpu_crtc->enabled && dpu_crtc->vblank_requested) { - _dpu_crtc_vblank_enable_no_lock(dpu_crtc, false); - } dpu_crtc->enabled = false; if (atomic_read(&dpu_crtc->frame_pending)) { @@ -922,13 +886,13 @@ static void dpu_crtc_enable(struct drm_crtc *crtc, mutex_lock(&dpu_crtc->crtc_lock); trace_dpu_crtc_enable(DRMID(crtc), true, dpu_crtc); - if (!dpu_crtc->enabled && dpu_crtc->vblank_requested) { - _dpu_crtc_vblank_enable_no_lock(dpu_crtc, true); - } dpu_crtc->enabled = true; mutex_unlock(&dpu_crtc->crtc_lock); + drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state->encoder_mask) + dpu_encoder_assign_crtc(encoder, crtc); + /* Enable/restore vblank irq handling */ drm_crtc_vblank_on(crtc); } @@ -1173,10 +1137,33 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, int dpu_crtc_vblank(struct drm_crtc *crtc, bool en) { struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc); + struct drm_encoder *enc; - mutex_lock(&dpu_crtc->crtc_lock); trace_dpu_crtc_vblank(DRMID(&dpu_crtc->base), en, dpu_crtc); - _dpu_crtc_vblank_enable_no_lock(dpu_crtc, en); + + /* + * Normally we would iterate through encoder_mask in crtc state to find + * attached encoders. In this case, we might be disabling vblank _after_ + * encoder_mask has been cleared. + * + * Instead, we "assign" a crtc to the encoder in enable and clear it in + * disable (which is also after encoder_mask is cleared). So instead of + * using encoder mask, we'll ask the encoder to toggle itself iff it's + * currently assigned to our crtc. + * + * Note also that this function cannot be called while crtc is disabled + * since we use drm_crtc_vblank_on/off. So we don't need to worry + * about the assigned crtcs being inconsistent with the current state + * (which means no need to worry about modeset locks). + */ + list_for_each_entry(enc, &crtc->dev->mode_config.encoder_list, head) { + trace_dpu_crtc_vblank_enable(DRMID(crtc), DRMID(enc), en, + dpu_crtc); + + dpu_encoder_toggle_vblank_for_crtc(enc, crtc, en); + } + + mutex_lock(&dpu_crtc->crtc_lock); dpu_crtc->vblank_requested = en; mutex_unlock(&dpu_crtc->crtc_lock); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index fd6514f681ae..5914ae70572c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -1267,22 +1267,29 @@ void dpu_encoder_assign_crtc(struct drm_encoder *drm_enc, struct drm_crtc *crtc) { struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc); unsigned long lock_flags; - bool enable; - int i; - - enable = crtc ? true : false; - - if (!drm_enc) { - DPU_ERROR("invalid encoder\n"); - return; - } - trace_dpu_enc_vblank_cb(DRMID(drm_enc), enable); spin_lock_irqsave(&dpu_enc->enc_spinlock, lock_flags); /* crtc should always be cleared before re-assigning */ WARN_ON(crtc && dpu_enc->crtc); dpu_enc->crtc = crtc; spin_unlock_irqrestore(&dpu_enc->enc_spinlock, lock_flags); +} + +void dpu_encoder_toggle_vblank_for_crtc(struct drm_encoder *drm_enc, + struct drm_crtc *crtc, bool enable) +{ + struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc); + unsigned long lock_flags; + int i; + + trace_dpu_enc_vblank_cb(DRMID(drm_enc), enable); + + spin_lock_irqsave(&dpu_enc->enc_spinlock, lock_flags); + if (dpu_enc->crtc == crtc) { + spin_unlock_irqrestore(&dpu_enc->enc_spinlock, lock_flags); + return; + } + spin_unlock_irqrestore(&dpu_enc->enc_spinlock, lock_flags); for (i = 0; i < dpu_enc->num_phys_encs; i++) { struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i]; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h index be1d80867834..6896ea2ab854 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h @@ -62,6 +62,16 @@ void dpu_encoder_get_hw_resources(struct drm_encoder *encoder, void dpu_encoder_assign_crtc(struct drm_encoder *encoder, struct drm_crtc *crtc); +/** + * dpu_encoder_toggle_vblank_for_crtc - Toggles vblank interrupts on or off if + * the encoder is assigned to the given crtc + * @encoder: encoder pointer + * @crtc: crtc pointer + * @enable: true if vblank should be enabled + */ +void dpu_encoder_toggle_vblank_for_crtc(struct drm_encoder *encoder, + struct drm_crtc *crtc, bool enable); + /** * dpu_encoder_register_frame_event_callback - provide callback to encoder that * will be called after the request is complete, or other events. From patchwork Tue Nov 13 20:52:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10681551 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 68C0613BF for ; Tue, 13 Nov 2018 20:53:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59D4A28760 for ; Tue, 13 Nov 2018 20:53:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C81B287B1; Tue, 13 Nov 2018 20:53:33 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 E111028760 for ; Tue, 13 Nov 2018 20:53:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 933B36E3E9; Tue, 13 Nov 2018 20:53:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw1-xc43.google.com (mail-yw1-xc43.google.com [IPv6:2607:f8b0:4864:20::c43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 777A66E3EA for ; Tue, 13 Nov 2018 20:53:30 +0000 (UTC) Received: by mail-yw1-xc43.google.com with SMTP id z72-v6so6426590ywa.0 for ; Tue, 13 Nov 2018 12:53:30 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=aSD3EHQKFkXK6ExvcPg9r4Ff3jbRscKTleXRTxFS8MU=; b=QT04+HmlnGUw1bnC6F7GvAhBCQ+CEpDa9GiEt6NI/ZAa0eihBocySZ7JTx33H0N5w9 Wlr0+sAQuqyA/JbQ+TM81qOwh4dW9dslyIUMkSyO7CHMAmRod9+QwHjTunUg3Hb4+ODT u6PSyqxX+ljOFnYO3qxQ0NVlsJkSC0Im+1dF8kg59yYPlGnlOmd18RnRNSJCJAzIIey3 8kld8Vwkm6fgR0aZ2YAQo3/Z76vGMD4CT27HgV91enzR+YVni8Z1yA34IG72L9jAIF/p fD8LMDTN95StWRQOTcRQl//yVntL/PzmFm95Q468sMe5chk9Sb1Qp+CdPypAexMaRk3X hODA== X-Gm-Message-State: AGRZ1gKvCfm4fMdm0fQuWxuoAS/4uEUvdfZ3UBDe4DUqsfGH8XHPn0lL nImCEUWJg5qnbX7M0L831odZm5+RuZ+m/g== X-Google-Smtp-Source: AJdET5fJmk8h7K7wlVduyG1hVEYBN1/XJ+Vqjvwv39oHUxkzpIG2v6at0DWIkQ0VEftPR8l+8HLoaQ== X-Received: by 2002:a81:2ed7:: with SMTP id u206mr6080620ywu.127.1542142409438; Tue, 13 Nov 2018 12:53:29 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id u130-v6sm5441257ywa.71.2018.11.13.12.53.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 12:53:29 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 7/8] drm/msm: dpu: Remove vblank_requested flag from dpu_crtc Date: Tue, 13 Nov 2018 15:52:50 -0500 Message-Id: <20181113205257.170707-7-sean@poorly.run> X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog In-Reply-To: <20181113205257.170707-1-sean@poorly.run> References: <20181113205257.170707-1-sean@poorly.run> MIME-Version: 1.0 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: Sean Paul Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul It's just for debug output, we don't need it Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 6 ------ drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h | 2 -- drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h | 14 ++++---------- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 59e823281fdf..ab96a2e69efa 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -1163,10 +1163,6 @@ int dpu_crtc_vblank(struct drm_crtc *crtc, bool en) dpu_encoder_toggle_vblank_for_crtc(enc, crtc, en); } - mutex_lock(&dpu_crtc->crtc_lock); - dpu_crtc->vblank_requested = en; - mutex_unlock(&dpu_crtc->crtc_lock); - return 0; } @@ -1282,8 +1278,6 @@ static int _dpu_debugfs_status_show(struct seq_file *s, void *data) dpu_crtc->vblank_cb_time = ktime_set(0, 0); } - seq_printf(s, "vblank_enable:%d\n", dpu_crtc->vblank_requested); - mutex_unlock(&dpu_crtc->crtc_lock); drm_modeset_unlock_all(crtc->dev); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h index 54595cc29be5..2b358546af49 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h @@ -132,7 +132,6 @@ struct dpu_crtc_frame_event { * @vblank_cb_count : count of vblank callback since last reset * @play_count : frame count between crtc enable and disable * @vblank_cb_time : ktime at vblank count reset - * @vblank_requested : whether the user has requested vblank events * @enabled : whether the DPU CRTC is currently enabled. updated in the * commit-thread, not state-swap time which is earlier, so * safe to make decisions on during VBLANK on/off work @@ -166,7 +165,6 @@ struct dpu_crtc { u32 vblank_cb_count; u64 play_count; ktime_t vblank_cb_time; - bool vblank_requested; bool enabled; struct list_head feature_list; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h index 328df37d7580..c78b521ceda1 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h @@ -728,20 +728,17 @@ TRACE_EVENT(dpu_crtc_vblank_enable, __field( uint32_t, enc_id ) __field( bool, enable ) __field( bool, enabled ) - __field( bool, vblank_requested ) ), TP_fast_assign( __entry->drm_id = drm_id; __entry->enc_id = enc_id; __entry->enable = enable; __entry->enabled = crtc->enabled; - __entry->vblank_requested = crtc->vblank_requested; ), - TP_printk("id:%u encoder:%u enable:%s state{enabled:%s vblank_req:%s}", + TP_printk("id:%u encoder:%u enable:%s state{enabled:%s}", __entry->drm_id, __entry->enc_id, __entry->enable ? "true" : "false", - __entry->enabled ? "true" : "false", - __entry->vblank_requested ? "true" : "false") + __entry->enabled ? "true" : "false") ); DECLARE_EVENT_CLASS(dpu_crtc_enable_template, @@ -751,18 +748,15 @@ DECLARE_EVENT_CLASS(dpu_crtc_enable_template, __field( uint32_t, drm_id ) __field( bool, enable ) __field( bool, enabled ) - __field( bool, vblank_requested ) ), TP_fast_assign( __entry->drm_id = drm_id; __entry->enable = enable; __entry->enabled = crtc->enabled; - __entry->vblank_requested = crtc->vblank_requested; ), - TP_printk("id:%u enable:%s state{enabled:%s vblank_req:%s}", + TP_printk("id:%u enable:%s state{enabled:%s}", __entry->drm_id, __entry->enable ? "true" : "false", - __entry->enabled ? "true" : "false", - __entry->vblank_requested ? "true" : "false") + __entry->enabled ? "true" : "false") ); DEFINE_EVENT(dpu_crtc_enable_template, dpu_crtc_enable, TP_PROTO(uint32_t drm_id, bool enable, struct dpu_crtc *crtc), From patchwork Tue Nov 13 20:52:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10681555 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B923C14DB for ; Tue, 13 Nov 2018 20:53:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAB9D28760 for ; Tue, 13 Nov 2018 20:53:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F062287C9; Tue, 13 Nov 2018 20:53:37 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 49A36287AF for ; Tue, 13 Nov 2018 20:53:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 421BA6E3F1; Tue, 13 Nov 2018 20:53:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw1-xc42.google.com (mail-yw1-xc42.google.com [IPv6:2607:f8b0:4864:20::c42]) by gabe.freedesktop.org (Postfix) with ESMTPS id 245A36E3F1 for ; Tue, 13 Nov 2018 20:53:35 +0000 (UTC) Received: by mail-yw1-xc42.google.com with SMTP id c126-v6so6362832ywd.8 for ; Tue, 13 Nov 2018 12:53:35 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=M5Qj26388Mypl+kjf/7uxrybkcyeIeqEx97zHmjsMZs=; b=mN+Wu2rplx7ZW1c4vp2F8llRgQlwYvWIHMmcDTIHu6WXlyCCF16g++F5k5M/5X6cXS O/o040047vD7ieghUJH4LZzg0JR3BQ/SHJwhe6FhWVKbr70yta3ih33vf/MKP+IBK/V2 Vrdmj4lZyp2BWdnXc2eerZkKyv9/J4jtWAAeVgTDEkOV6RJ829OMy+8OJaLPEPCKeVX0 26aK+v7XrKr+K6h7iOG9P5Oi8XtVaQl1Aaq4rUMdY2SVgp3uX5l8LfMr8+MlVktMEUqa uXSBCDAjI9rWd29ozuPy8H8QnL+3IoIEiRL3x3qhPtCKgnjlQ2NZOVcjFp95Qbz+gbQQ YCWA== X-Gm-Message-State: AGRZ1gJ2cqXjceFBKyFnVIuDPOLqN5YZ13OrQMdjxOa8mO1KXazLEdRN mKePyTjfMHN/S+my+B6+vD6UD2qwhd7HuA== X-Google-Smtp-Source: AJdET5c7xHAAiCM3F5ScZ/lZGr2GxNt8vG9Rhj7UkTuhOaQKTa4SA408jo/lw/2i4Bd/L0MSfMKbtA== X-Received: by 2002:a81:3348:: with SMTP id z69-v6mr6636298ywz.305.1542142414094; Tue, 13 Nov 2018 12:53:34 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id u130-v6sm5441257ywa.71.2018.11.13.12.53.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 12:53:33 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 8/8] drm/msm: dpu: Remove crtc_lock Date: Tue, 13 Nov 2018 15:52:51 -0500 Message-Id: <20181113205257.170707-8-sean@poorly.run> X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog In-Reply-To: <20181113205257.170707-1-sean@poorly.run> References: <20181113205257.170707-1-sean@poorly.run> MIME-Version: 1.0 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: Sean Paul Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul Each time it's called we're holding the crtc modeset lock, so it's redundant. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 11 ----------- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h | 3 --- 2 files changed, 14 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index ab96a2e69efa..df4ac1242706 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -69,7 +69,6 @@ static void dpu_crtc_destroy(struct drm_crtc *crtc) return; drm_crtc_cleanup(crtc); - mutex_destroy(&dpu_crtc->crtc_lock); kfree(dpu_crtc); } @@ -814,8 +813,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc, old_crtc_state->encoder_mask) dpu_encoder_assign_crtc(encoder, NULL); - mutex_lock(&dpu_crtc->crtc_lock); - /* wait for frame_event_done completion */ if (_dpu_crtc_wait_for_frame_done(crtc)) DPU_ERROR("crtc%d wait for frame done failed;frame_pending%d\n", @@ -847,8 +844,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc, cstate->bw_control = false; cstate->bw_split_vote = false; - mutex_unlock(&dpu_crtc->crtc_lock); - if (crtc->state->event && !crtc->state->active) { spin_lock_irqsave(&crtc->dev->event_lock, flags); drm_crtc_send_vblank_event(crtc, crtc->state->event); @@ -884,12 +879,9 @@ static void dpu_crtc_enable(struct drm_crtc *crtc, dpu_crtc_frame_event_cb, (void *)crtc); } - mutex_lock(&dpu_crtc->crtc_lock); trace_dpu_crtc_enable(DRMID(crtc), true, dpu_crtc); dpu_crtc->enabled = true; - mutex_unlock(&dpu_crtc->crtc_lock); - drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state->encoder_mask) dpu_encoder_assign_crtc(encoder, crtc); @@ -1191,7 +1183,6 @@ static int _dpu_debugfs_status_show(struct seq_file *s, void *data) drm_modeset_lock_all(crtc->dev); cstate = to_dpu_crtc_state(crtc->state); - mutex_lock(&dpu_crtc->crtc_lock); mode = &crtc->state->adjusted_mode; out_width = _dpu_crtc_get_mixer_width(cstate, mode); @@ -1278,7 +1269,6 @@ static int _dpu_debugfs_status_show(struct seq_file *s, void *data) dpu_crtc->vblank_cb_time = ktime_set(0, 0); } - mutex_unlock(&dpu_crtc->crtc_lock); drm_modeset_unlock_all(crtc->dev); return 0; @@ -1428,7 +1418,6 @@ struct drm_crtc *dpu_crtc_init(struct drm_device *dev, struct drm_plane *plane, crtc = &dpu_crtc->base; crtc->dev = dev; - mutex_init(&dpu_crtc->crtc_lock); spin_lock_init(&dpu_crtc->spin_lock); atomic_set(&dpu_crtc->frame_pending, 0); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h index 2b358546af49..34f0c4d4d774 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h @@ -140,7 +140,6 @@ struct dpu_crtc_frame_event { * @dirty_list : list of color processing features are dirty * @ad_dirty: list containing ad properties that are dirty * @ad_active: list containing ad properties that are active - * @crtc_lock : crtc lock around create, destroy and access. * @frame_pending : Whether or not an update is pending * @frame_events : static allocation of in-flight frame events * @frame_event_list : available frame event list @@ -173,8 +172,6 @@ struct dpu_crtc { struct list_head ad_dirty; struct list_head ad_active; - struct mutex crtc_lock; - atomic_t frame_pending; struct dpu_crtc_frame_event frame_events[DPU_CRTC_FRAME_EVENT_SIZE]; struct list_head frame_event_list;