From patchwork Thu Sep 10 01:57:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Roper X-Patchwork-Id: 7150041 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 A8EBFBEEC1 for ; Thu, 10 Sep 2015 01:58:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 921AE2094E for ; Thu, 10 Sep 2015 01:58:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 09F0420979 for ; Thu, 10 Sep 2015 01:58:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5EB2772259; Wed, 9 Sep 2015 18:58:42 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id 8803072251; Wed, 9 Sep 2015 18:58:40 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 09 Sep 2015 18:58:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,501,1437462000"; d="scan'208";a="641909391" Received: from mdroper-hswdev.fm.intel.com (HELO mdroper-hswdev) ([10.1.134.215]) by orsmga003.jf.intel.com with ESMTP; 09 Sep 2015 18:58:39 -0700 Received: from mattrope by mdroper-hswdev with local (Exim 4.84) (envelope-from ) id 1ZZr8J-0005JI-MH; Wed, 09 Sep 2015 18:58:39 -0700 From: Matt Roper To: intel-gfx@lists.freedesktop.org Subject: [PATCH 2/4] drm/atomic/helper: Allow duplication of in-flight states Date: Wed, 9 Sep 2015 18:57:53 -0700 Message-Id: <1441850275-20353-3-git-send-email-matthew.d.roper@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1441850275-20353-1-git-send-email-matthew.d.roper@intel.com> References: <1441850275-20353-1-git-send-email-matthew.d.roper@intel.com> 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 Drivers may wish to duplicate in-flight states internally, but the __drm_atomic_helper_{crtc,plane}_duplicate_state helper functions can only be used to make a copy of state that has already been committed to obj->state. Let's update the helpers to take any existing state object as their first parameter rather than the DRM object pointer. We can update handful of existing callsites to just pass obj->state for it. Cc: dri-devel@lists.freedesktop.org Signed-off-by: Matt Roper --- drivers/gpu/drm/drm_atomic_helper.c | 12 ++++++------ drivers/gpu/drm/i915/intel_atomic.c | 2 +- drivers/gpu/drm/i915/intel_atomic_plane.c | 2 +- drivers/gpu/drm/omapdrm/omap_plane.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 2 +- drivers/gpu/drm/tegra/dc.c | 4 ++-- include/drm/drm_atomic_helper.h | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 9941167..915b462 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -2149,10 +2149,10 @@ EXPORT_SYMBOL(drm_atomic_helper_crtc_reset); * Copies atomic state from a CRTC's current state and resets inferred values. * This is useful for drivers that subclass the CRTC state. */ -void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc, +void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc_state *from, struct drm_crtc_state *state) { - memcpy(state, crtc->state, sizeof(*state)); + memcpy(state, from, sizeof(*state)); if (state->mode_blob) drm_property_reference_blob(state->mode_blob); @@ -2181,7 +2181,7 @@ drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc) state = kmalloc(sizeof(*state), GFP_KERNEL); if (state) - __drm_atomic_helper_crtc_duplicate_state(crtc, state); + __drm_atomic_helper_crtc_duplicate_state(crtc->state, state); return state; } @@ -2248,10 +2248,10 @@ EXPORT_SYMBOL(drm_atomic_helper_plane_reset); * Copies atomic state from a plane's current state. This is useful for * drivers that subclass the plane state. */ -void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, +void __drm_atomic_helper_plane_duplicate_state(struct drm_plane_state *from, struct drm_plane_state *state) { - memcpy(state, plane->state, sizeof(*state)); + memcpy(state, from, sizeof(*state)); if (state->fb) drm_framebuffer_reference(state->fb); @@ -2275,7 +2275,7 @@ drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane) state = kmalloc(sizeof(*state), GFP_KERNEL); if (state) - __drm_atomic_helper_plane_duplicate_state(plane, state); + __drm_atomic_helper_plane_duplicate_state(plane->state, state); return state; } diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c index 3ffc385..45b21ac 100644 --- a/drivers/gpu/drm/i915/intel_atomic.c +++ b/drivers/gpu/drm/i915/intel_atomic.c @@ -97,7 +97,7 @@ intel_crtc_duplicate_state(struct drm_crtc *crtc) if (!crtc_state) return NULL; - __drm_atomic_helper_crtc_duplicate_state(crtc, &crtc_state->base); + __drm_atomic_helper_crtc_duplicate_state(crtc->state, &crtc_state->base); crtc_state->base.crtc = crtc; diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c index f1ab8e4..afbbfe0 100644 --- a/drivers/gpu/drm/i915/intel_atomic_plane.c +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c @@ -87,7 +87,7 @@ intel_plane_duplicate_state(struct drm_plane *plane) state = &intel_state->base; - __drm_atomic_helper_plane_duplicate_state(plane, state); + __drm_atomic_helper_plane_duplicate_state(plane->state, state); return state; } diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index 09e363b..8962e6b 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c @@ -258,7 +258,7 @@ omap_plane_atomic_duplicate_state(struct drm_plane *plane) if (copy == NULL) return NULL; - __drm_atomic_helper_plane_duplicate_state(plane, ©->base); + __drm_atomic_helper_plane_duplicate_state(plane->state, ©->base); return ©->base; } diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index c669864..e050f54 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c @@ -310,7 +310,7 @@ rcar_du_plane_atomic_duplicate_state(struct drm_plane *plane) if (copy == NULL) return NULL; - __drm_atomic_helper_plane_duplicate_state(plane, ©->state); + __drm_atomic_helper_plane_duplicate_state(plane->state, ©->state); return ©->state; } diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index b4af4ab..efd1fc1 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -455,7 +455,7 @@ static struct drm_plane_state *tegra_plane_atomic_duplicate_state(struct drm_pla if (!copy) return NULL; - __drm_atomic_helper_plane_duplicate_state(plane, ©->base); + __drm_atomic_helper_plane_duplicate_state(plane->state, ©->base); copy->tiling = state->tiling; copy->format = state->format; copy->swap = state->swap; @@ -1036,7 +1036,7 @@ tegra_crtc_atomic_duplicate_state(struct drm_crtc *crtc) if (!copy) return NULL; - __drm_atomic_helper_crtc_duplicate_state(crtc, ©->base); + __drm_atomic_helper_crtc_duplicate_state(crtc->state, ©->base); copy->clk = state->clk; copy->pclk = state->pclk; copy->div = state->div; diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index 1547eb4..570ebff 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h @@ -93,7 +93,7 @@ int drm_atomic_helper_connector_dpms(struct drm_connector *connector, /* default implementations for state handling */ void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc); -void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc, +void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc_state *from, struct drm_crtc_state *state); struct drm_crtc_state * drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc); @@ -103,7 +103,7 @@ void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc, struct drm_crtc_state *state); void drm_atomic_helper_plane_reset(struct drm_plane *plane); -void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, +void __drm_atomic_helper_plane_duplicate_state(struct drm_plane_state *from, struct drm_plane_state *state); struct drm_plane_state * drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane);