From patchwork Tue Nov 25 11:09:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 5376231 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 C82189F2F5 for ; Tue, 25 Nov 2014 11:09:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DAF7D201ED for ; Tue, 25 Nov 2014 11:09:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id AA824201C0 for ; Tue, 25 Nov 2014 11:09:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CD4D86E714; Tue, 25 Nov 2014 03:09:52 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com [74.125.82.45]) by gabe.freedesktop.org (Postfix) with ESMTP id 865616E714 for ; Tue, 25 Nov 2014 03:09:51 -0800 (PST) Received: by mail-wg0-f45.google.com with SMTP id b13so511102wgh.32 for ; Tue, 25 Nov 2014 03:09:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=mubMOWiV/da0nTxmhBbPF+JLsBPG9V/6h9BujKPvZRY=; b=xoXmVi/GXzgQZoOytA80qsTj/LaWnf1E5INTlXWZW6LAARPrhRxUOZdHkr9ysWYgQL iLrs4EdxEytxacVbl+4+ERAqcCVbzc46nNeKCehpLG9HapGVNZSypVoSPFyloA793LbT tXPW18kA/lCU1BSzD5j35ft5xPFrLbtAezdz8kUYmsMex/6hoEHUt69waaMbGaQw68rx yQu9AVuZms3EaK9Zwn8RA/bAN7IXbQzI6h3dytIU3NZw0c25FaNWiTdazd0nKxIY7AAG 4rrDNXpqjeNAzAHdV6DmMOzC+mdL/oX2irm9GOqS+ZwMgTLW75U73L775IvSkXaIrX+e BSag== X-Received: by 10.180.93.132 with SMTP id cu4mr29771247wib.46.1416913790662; Tue, 25 Nov 2014 03:09:50 -0800 (PST) Received: from localhost (port-22965.pppoe.wtnet.de. [46.59.151.101]) by mx.google.com with ESMTPSA id fo12sm15987294wic.19.2014.11.25.03.09.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Nov 2014 03:09:50 -0800 (PST) From: Thierry Reding To: Daniel Vetter Subject: [PATCH v2 1/6] drm/plane: Pass old state to ->atomic_update() Date: Tue, 25 Nov 2014 12:09:44 +0100 Message-Id: <1416913789-23209-1-git-send-email-thierry.reding@gmail.com> X-Mailer: git-send-email 2.1.3 Cc: dri-devel@lists.freedesktop.org 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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 From: Thierry Reding In most situations it will be useful to have the old state passed to the ->atomic_update() callback. For example if a plane is being disabled the new state's .crtc field will be NULL, but some drivers may rely on this field to program the CRTCs registers. v2: rename variable to old_plane_state and remove redundant comment as suggested by Daniel Vetter, remove an Exynos hunk that doesn't apply to drm-next and add a hunk for pending MSM mdp5 changes Reviewed-by: Daniel Vetter Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_atomic_helper.c | 5 ++++- drivers/gpu/drm/drm_plane_helper.c | 2 +- drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 3 ++- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 3 ++- include/drm/drm_plane_helper.h | 3 ++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 25d8263f9869..7f020403ffe0 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1014,6 +1014,7 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, for (i = 0; i < nplanes; i++) { struct drm_plane_helper_funcs *funcs; struct drm_plane *plane = old_state->planes[i]; + struct drm_plane_state *old_plane_state; if (!plane) continue; @@ -1023,7 +1024,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, if (!funcs || !funcs->atomic_update) continue; - funcs->atomic_update(plane); + old_plane_state = old_state->plane_states[i]; + + funcs->atomic_update(plane, old_plane_state); } for (i = 0; i < ncrtcs; i++) { diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c index 2dd30518f9a2..aa399db5d36d 100644 --- a/drivers/gpu/drm/drm_plane_helper.c +++ b/drivers/gpu/drm/drm_plane_helper.c @@ -443,7 +443,7 @@ int drm_plane_helper_commit(struct drm_plane *plane, crtc_funcs[i]->atomic_begin(crtc[i]); } - plane_funcs->atomic_update(plane); + plane_funcs->atomic_update(plane, plane_state); for (i = 0; i < 2; i++) { if (crtc_funcs[i] && crtc_funcs[i]->atomic_flush) diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c index 76d0a40c7138..1e5ebe83647d 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c @@ -107,7 +107,8 @@ static int mdp4_plane_atomic_check(struct drm_plane *plane, return 0; } -static void mdp4_plane_atomic_update(struct drm_plane *plane) +static void mdp4_plane_atomic_update(struct drm_plane *plane, + struct drm_plane_state *old_state) { struct drm_plane_state *state = plane->state; int ret; diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c index 533df7caa310..26e5fdea6594 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c @@ -213,7 +213,8 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane, return 0; } -static void mdp5_plane_atomic_update(struct drm_plane *plane) +static void mdp5_plane_atomic_update(struct drm_plane *plane, + struct drm_plane_state *old_state) { struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane); struct drm_plane_state *state = plane->state; diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h index 00ad3b3c5324..d3122cd0609b 100644 --- a/include/drm/drm_plane_helper.h +++ b/include/drm/drm_plane_helper.h @@ -59,7 +59,8 @@ struct drm_plane_helper_funcs { int (*atomic_check)(struct drm_plane *plane, struct drm_plane_state *state); - void (*atomic_update)(struct drm_plane *plane); + void (*atomic_update)(struct drm_plane *plane, + struct drm_plane_state *old_state); }; static inline void drm_plane_helper_add(struct drm_plane *plane,