From patchwork Fri Dec 4 16:13:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 7769621 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3B22EBEEE1 for ; Fri, 4 Dec 2015 16:13:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4BF04205CB for ; Fri, 4 Dec 2015 16:13:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9DAC0205BB for ; Fri, 4 Dec 2015 16:13:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B70636E21E; Fri, 4 Dec 2015 08:13:48 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by gabe.freedesktop.org (Postfix) with ESMTPS id E937D6E19E for ; Fri, 4 Dec 2015 08:13:46 -0800 (PST) Received: by wmvv187 with SMTP id v187so81646835wmv.1 for ; Fri, 04 Dec 2015 08:13:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AqZkYWuIMgxs0Z2y74j/ZFLBUvnv1y5yxHg95OFVAg4=; b=eAwBWpAHdVi++Y2pTv7gjsM6p9pSViEI7PmyzEtWRsfjNZc+u1crB2tE9zyAR3tDo8 ZEYC6EsyJnesWDrFMX0K5zDesDOvEL5mXr4/NSye6Ck4/UNwWDh0/XEsFj2lW0CMckA9 a56Wa9IyfAofLwRYxlbpDJw/CrObHoFBczNUU= 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=AqZkYWuIMgxs0Z2y74j/ZFLBUvnv1y5yxHg95OFVAg4=; b=dJg0LOnhgxTAYsvxIrn7nVsDEgEupPqVE+fDBrK1bAJqDOqShqVihkGQzqIzNzVRac Q8GKWlUqtqQolaMyoXSfeK2oSNpuWhQCG9+tV3j4BCpGzSyWCe7mbxFR6fWOMpC5pcl9 +7BaPb5lUfszCEQ9H+HKrVPNFVlxnNVl66LSu7fqsBlJ7Mn9h4b/6CrCHv5FsbEy0Mew MQyl29+e1vS6nYLUr9+VOZYA/g+Z9+svE11w2Bx8cn1AFGdhiDacE/kYbS11zAbBOf5x aKS5zz9MRnl+PbjyhSrmA+Fy2elhJ+vCAC4BWiHA4gRUe40KFHSdf5gQNbxGAdicxpwa s14w== X-Gm-Message-State: ALoCoQnzVt6bfsO8ciR6RlJR5ewj+y/MliThZ2oOnxwhidtiVRtzT257AS+V6T66qwOV/G9yIluR X-Received: by 10.28.49.65 with SMTP id x62mr6239990wmx.49.1449245625525; Fri, 04 Dec 2015 08:13:45 -0800 (PST) Received: from phenom.ffwll.local (212-51-149-109.fiber7.init7.net. [212.51.149.109]) by smtp.gmail.com with ESMTPSA id f11sm4158495wmd.7.2015.12.04.08.13.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Dec 2015 08:13:44 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH] drm/nouveau: Use private save/restore hooks for CRTCs Date: Fri, 4 Dec 2015 17:13:38 +0100 Message-Id: <1449245618-1127-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.5.1 In-Reply-To: <1449218769-16577-14-git-send-email-daniel.vetter@ffwll.ch> References: <1449218769-16577-14-git-send-email-daniel.vetter@ffwll.ch> Cc: Daniel Vetter , Intel Graphics Development , Ben Skeggs , Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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 I want to remove the core ones since with atomic drivers system suspend/resume is solved much differently. And there's only 2 drivers (gma500 besides nouveau) really using them. v2: Fixup bugs Ilia spotted. Cc: Ben Skeggs Cc: Ilia Mirkin Signed-off-by: Daniel Vetter Reviewed-by: Thierry Reding --- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 5 +++-- drivers/gpu/drm/nouveau/dispnv04/disp.c | 11 ++++++----- drivers/gpu/drm/nouveau/nouveau_crtc.h | 3 +++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c index dab24066fa21..bb9e9cb14b9d 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c @@ -1081,8 +1081,6 @@ nouveau_crtc_set_config(struct drm_mode_set *set) } static const struct drm_crtc_funcs nv04_crtc_funcs = { - .save = nv_crtc_save, - .restore = nv_crtc_restore, .cursor_set = nv04_crtc_cursor_set, .cursor_move = nv04_crtc_cursor_move, .gamma_set = nv_crtc_gamma_set, @@ -1123,6 +1121,9 @@ nv04_crtc_create(struct drm_device *dev, int crtc_num) nv_crtc->index = crtc_num; nv_crtc->last_dpms = NV_DPMS_CLEARED; + nv_crtc->save = nv_crtc_save; + nv_crtc->restore = nv_crtc_restore; + drm_crtc_init(dev, &nv_crtc->base, &nv04_crtc_funcs); drm_crtc_helper_add(&nv_crtc->base, &nv04_crtc_helper_funcs); drm_mode_crtc_set_gamma_size(&nv_crtc->base, 256); diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c b/drivers/gpu/drm/nouveau/dispnv04/disp.c index 9e650081c357..59242ff767ea 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c @@ -39,7 +39,7 @@ nv04_display_create(struct drm_device *dev) struct dcb_table *dcb = &drm->vbios.dcb; struct drm_connector *connector, *ct; struct drm_encoder *encoder; - struct drm_crtc *crtc; + struct nouveau_crtc *crtc; struct nv04_display *disp; int i, ret; @@ -107,8 +107,8 @@ nv04_display_create(struct drm_device *dev) } /* Save previous state */ - list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) - crtc->funcs->save(crtc); + list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head) + crtc->save(&crtc->base); list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { const struct drm_encoder_helper_funcs *func = encoder->helper_private; @@ -128,6 +128,7 @@ nv04_display_destroy(struct drm_device *dev) struct nouveau_drm *drm = nouveau_drm(dev); struct drm_encoder *encoder; struct drm_crtc *crtc; + struct nouveau_crtc *nv_crtc; /* Turn every CRTC off. */ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { @@ -145,8 +146,8 @@ nv04_display_destroy(struct drm_device *dev) func->restore(encoder); } - list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) - crtc->funcs->restore(crtc); + list_for_each_entry(nv_crtc, &dev->mode_config.crtc_list, base.head) + nv_crtc->restore(&nv_crtc->base); nouveau_hw_save_vga_fonts(dev, 0); diff --git a/drivers/gpu/drm/nouveau/nouveau_crtc.h b/drivers/gpu/drm/nouveau/nouveau_crtc.h index f19cb1c5fc5a..863f10b8d818 100644 --- a/drivers/gpu/drm/nouveau/nouveau_crtc.h +++ b/drivers/gpu/drm/nouveau/nouveau_crtc.h @@ -73,6 +73,9 @@ struct nouveau_crtc { int (*set_dither)(struct nouveau_crtc *crtc, bool update); int (*set_scale)(struct nouveau_crtc *crtc, bool update); int (*set_color_vibrance)(struct nouveau_crtc *crtc, bool update); + + void (*save)(struct drm_crtc *crtc); + void (*restore)(struct drm_crtc *crtc); }; static inline struct nouveau_crtc *nouveau_crtc(struct drm_crtc *crtc)