[RFC PATCH 33/37] drm: i915/tegra: atomic: Reference, not duplicate, modes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Take a reference to existing modes, rather than duplicating them to
create new ones.

Signed-off-by: Daniel Stone <daniels@xxxxxxxxxxxxx>
---
 drivers/gpu/drm/i915/intel_atomic.c |  8 ++------
 drivers/gpu/drm/tegra/dc.c          | 11 ++---------
 2 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
index 80cb562..8b80a54 100644
--- a/drivers/gpu/drm/i915/intel_atomic.c
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -227,12 +227,8 @@ intel_crtc_duplicate_state(struct drm_crtc *crtc)
 
 	crtc_state->base.crtc = crtc;
 
-	if (intel_crtc->config && intel_crtc->config->mode) {
-		crtc_state->mode =
-			drm_mode_duplicate(crtc->dev, intel_crtc->config->mode);
-		if (!crtc_state->mode)
-			goto err;
-	}
+	if (crtc_state->base.mode)
+		drm_mode_reference(crtc_state->base.mode);
 
 	return &crtc_state->base;
 err:
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 4dd51fe..888fcbd 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -1018,12 +1018,8 @@ tegra_crtc_atomic_duplicate_state(struct drm_crtc *crtc)
 	if (!copy)
 		return NULL;
 
-	if (state->base.mode) {
-		copy->base.mode =
-			drm_mode_duplicate(crtc->dev, state->base.mode);
-		if (!copy->base.mode)
-			goto err;
-	}
+	if (copy->base.mode)
+		drm_mode_reference(copy->base.mode);
 
 	copy->base.mode_changed = false;
 	copy->base.active_changed = false;
@@ -1031,9 +1027,6 @@ tegra_crtc_atomic_duplicate_state(struct drm_crtc *crtc)
 	copy->base.event = NULL;
 
 	return &copy->base;
-err:
-	kfree(copy);
-	return NULL;
 }
 
 static void tegra_crtc_atomic_destroy_state(struct drm_crtc *crtc,
-- 
2.3.2

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux