From patchwork Tue Oct 29 16:13:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 3109181 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D23309F2B7 for ; Tue, 29 Oct 2013 16:18:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AF41A2035D for ; Tue, 29 Oct 2013 16:18:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7DB67200F4 for ; Tue, 29 Oct 2013 16:18:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AC7ABEEC72; Tue, 29 Oct 2013 09:15:53 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qe0-f54.google.com (mail-qe0-f54.google.com [209.85.128.54]) by gabe.freedesktop.org (Postfix) with ESMTP id 28FD0EEBDC for ; Tue, 29 Oct 2013 09:14:00 -0700 (PDT) Received: by mail-qe0-f54.google.com with SMTP id 1so49684qec.13 for ; Tue, 29 Oct 2013 09:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0/McybfG6EjcGRyRl4v51BGe8kQ/HHxRUQDzz0w5Z8A=; b=Q7+jVZo3COa6WR/aSSOESDE7ydPr1ayJwiljmzAHgv99QQHsz/QxUIqTkEJtz3Ukjd CKUPcFewGzHcWlRsrOWW119RinrzRDfN44p+uf1m35C8N/ZtYjDtMJUlD6lpzYCLswAn sQMXGwp9axjMtS+7Ehe43RTBu2W4QhojbNf4o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0/McybfG6EjcGRyRl4v51BGe8kQ/HHxRUQDzz0w5Z8A=; b=JZMJaF5p11YcmaPRQ1uHCc6VmC4hpUWAHiKpUSnMc4jgZxaCoCH08FIC2K9i+TPJb1 l5D9UvmWLV/LD7EDWJ/vwAlarXutMrteIBcOVZqkVX8ebW4Jm3wzGD5vtwWzTX6gxJFC 4Eo5WyS7m1Z66Z7QXfd4eOvKNVRRcJBH9G818Mn9gSyZRPpgYJ7q8tZdt0jv/mWC/RIj TNty0/80TLYK+YpLguL4AB0psjLyafc6i+N/fNqOoVM3yZmsliMo76wqXYFz9+UvVkFo E1Be+HhjgTByuD8D3NIfjrNEOThjUn1yc/Pya0/pAHF8dOPzBUKKsQt44xw68w+geDWe /9Nw== X-Gm-Message-State: ALoCoQlUFgRMESeDFLBDUedC26lidzoh/bB7G4ZiMDt9r4PkarjOApR43oEV07g7kuL36Ys6ZrBw X-Received: by 10.224.38.135 with SMTP id b7mr1982186qae.10.1383063239704; Tue, 29 Oct 2013 09:13:59 -0700 (PDT) Received: from seanpaul-glaptop.roam.corp.google.com (cpe-173-095-180-236.nc.res.rr.com. [173.95.180.236]) by mx.google.com with ESMTPSA id h9sm66581946qaq.9.2013.10.29.09.13.58 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Oct 2013 09:13:59 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, inki.dae@samsung.com Subject: [PATCH v3 16/32] drm/exynos: Disable unused crtc planes from crtc Date: Tue, 29 Oct 2013 12:13:02 -0400 Message-Id: <1383063198-10526-17-git-send-email-seanpaul@chromium.org> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1383063198-10526-1-git-send-email-seanpaul@chromium.org> References: <1383063198-10526-1-git-send-email-seanpaul@chromium.org> Cc: marcheu@chromium.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch moves the code which disables unused crtc planes from the encoder to the crtc. Since there is a 1:1 encoder/crtc mapping in exynos, the only valid crtc change the pre-existing code could catch is disconnecting an active crtc from the encoder. Thus it is functionally equivalent to just disable all planes attached to a crtc when the crtc is disabled. Signed-off-by: Sean Paul Reviewed-by: Tomasz Figa --- Changes in v2: None Changes in v3: None drivers/gpu/drm/exynos/exynos_drm_crtc.c | 13 +++++- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 65 ++--------------------------- 2 files changed, 15 insertions(+), 63 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index 347d62d..d019385 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c @@ -176,10 +176,19 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, static void exynos_drm_crtc_disable(struct drm_crtc *crtc) { - struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); + struct drm_plane *plane; + int ret; - exynos_plane_dpms(exynos_crtc->plane, DRM_MODE_DPMS_OFF); exynos_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); + + list_for_each_entry(plane, &crtc->dev->mode_config.plane_list, head) { + if (plane->crtc != crtc) + continue; + + ret = plane->funcs->disable_plane(plane); + if (ret) + DRM_ERROR("Failed to disable plane %d\n", ret); + } } static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = { diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index d4ae664..bfa2f17 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c @@ -29,7 +29,6 @@ * @display: the display structure that maps to this encoder */ struct exynos_drm_encoder { - struct drm_crtc *old_crtc; struct drm_encoder drm_encoder; struct exynos_drm_display *display; }; @@ -67,71 +66,15 @@ exynos_drm_encoder_mode_fixup(struct drm_encoder *encoder, return true; } -static void disable_plane_to_crtc(struct drm_device *dev, - struct drm_crtc *old_crtc, - struct drm_crtc *new_crtc) -{ - struct drm_plane *plane; - - /* - * if old_crtc isn't same as encoder->crtc then it means that - * user changed crtc id to another one so the plane to old_crtc - * should be disabled and plane->crtc should be set to new_crtc - * (encoder->crtc) - */ - list_for_each_entry(plane, &dev->mode_config.plane_list, head) { - if (plane->crtc == old_crtc) { - /* - * do not change below call order. - * - * plane->funcs->disable_plane call checks - * if encoder->crtc is same as plane->crtc and if same - * then manager_ops->win_disable callback will be called - * to diasble current hw overlay so plane->crtc should - * have new_crtc because new_crtc was set to - * encoder->crtc in advance. - */ - plane->crtc = new_crtc; - plane->funcs->disable_plane(plane); - } - } -} - static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { - struct drm_device *dev = encoder->dev; - struct drm_connector *connector; - struct exynos_drm_display *display; - - list_for_each_entry(connector, &dev->mode_config.connector_list, head) { - if (connector->encoder == encoder) { - struct exynos_drm_encoder *exynos_encoder; - - exynos_encoder = to_exynos_encoder(encoder); - - if (exynos_encoder->old_crtc != encoder->crtc && - exynos_encoder->old_crtc) { - - /* - * disable a plane to old crtc and change - * crtc of the plane to new one. - */ - disable_plane_to_crtc(dev, - exynos_encoder->old_crtc, - encoder->crtc); - } - - display = exynos_encoder->display; - - if (display->ops->mode_set) - display->ops->mode_set(display, - adjusted_mode); + struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder); + struct exynos_drm_display *display = exynos_encoder->display; - exynos_encoder->old_crtc = encoder->crtc; - } - } + if (display->ops->mode_set) + display->ops->mode_set(display, adjusted_mode); } static void exynos_drm_encoder_prepare(struct drm_encoder *encoder)