From patchwork Fri Dec 4 08:45:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 7766591 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 4AF96BEEE5 for ; Fri, 4 Dec 2015 08:46:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 623D62051C for ; Fri, 4 Dec 2015 08:46:46 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 86BCE204E3 for ; Fri, 4 Dec 2015 08:46:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 72BA88A7E3; Fri, 4 Dec 2015 00:46:37 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id BB4E08A7F4 for ; Fri, 4 Dec 2015 00:46:35 -0800 (PST) Received: by wmec201 with SMTP id c201so63479962wme.0 for ; Fri, 04 Dec 2015 00:46:31 -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=wnSe1vVGjoCOuvlOgcon2JR2QCE7VOFvgCIE/03mcMM=; b=J4XVFc/NW4Zy1GovbYcQ3/c2BqmHi6zWpCBbAi5AMHbFB5e+6qp8KMwG/xcNEFqL46 nP/fyRTxlpfbWT8MLzL9eynvj7Bl4eLLKG83jH6Rp/xpblXYu9D4kXiY+tcFuxBGe3pl a9m5/lEhgdoeRc6Hr943Qwr3ivEr0YeYqSf5o= 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=wnSe1vVGjoCOuvlOgcon2JR2QCE7VOFvgCIE/03mcMM=; b=VHzrd7ScIH8HaCFTw8llPLsHuAD2G6KteBWqoUgjTUuUL47CW7DCfCMbobfmA22+XP 6aWL12Iam6dKoKYHQBSyQzg/DjSb1Kh2Py5dncZoRaiyh5xjtoSmsMGJhmYamRzhCBXS r9YmFq6lypI8QbYoVWq/MCGS0mMVRcvfm/0+B/tOdN6t1U6Q0p3XL3ffDWQu/W2o1tJL m9MidgIOKzL+D94h8bo/LmX8dZiUhm5oZaljeapAfwUzUDOC2OM3UJ72l8hVT6paYmYa 8bD977cRbJCVnAmHAcJZW0Og48D9Vcvoi2nQ6KrYZUnMiw1BxEb0qR3gMEe04cRLiQ/l lSoQ== X-Gm-Message-State: ALoCoQnM5899TtGT1bk472wTiBmtWgDBX6wyUo7tr4JBkQRB51QaRUkGylBqDS7VxahnfcmAM8Y+10fRolvH7Dvm+LCeTG91lg== X-Received: by 10.28.99.214 with SMTP id x205mr3447091wmb.20.1449218791340; Fri, 04 Dec 2015 00:46:31 -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 pc2sm6926311wjb.11.2015.12.04.00.46.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Dec 2015 00:46:30 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH 13/28] drm/nouveau: Use private save/restore hooks Date: Fri, 4 Dec 2015 09:45:54 +0100 Message-Id: <1449218769-16577-14-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.5.1 In-Reply-To: <1449218769-16577-1-git-send-email-daniel.vetter@ffwll.ch> References: <1449218769-16577-1-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. Cc: Ben Skeggs Signed-off-by: Daniel Vetter --- 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..ebd9430e0628 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); 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(crtc); 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)