* [PATCH 1/7] drm/i915: Pass the new crtc state to color management code
@ 2017-08-23 15:22 ville.syrjala
2017-08-23 15:22 ` [PATCH 2/7] drm/i915: Pass the crtc state explicitly to intel_pipe_update_start/end() ville.syrjala
` (6 more replies)
0 siblings, 7 replies; 11+ messages in thread
From: ville.syrjala @ 2017-08-23 15:22 UTC (permalink / raw)
To: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
In an effort to eliminate the obj->state usage let's pass on the
new crtc state pointer (which we already have!) to the color management
code.
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index ad74d1d11dbe..80a14b30e4d3 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12928,8 +12928,8 @@ static void intel_begin_crtc_commit(struct drm_crtc *crtc,
if (!modeset &&
(intel_cstate->base.color_mgmt_changed ||
intel_cstate->update_pipe)) {
- intel_color_set_csc(crtc->state);
- intel_color_load_luts(crtc->state);
+ intel_color_set_csc(&intel_cstate->base);
+ intel_color_load_luts(&intel_cstate->base);
}
/* Perform vblank evasion around commit operation */
--
2.13.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/7] drm/i915: Pass the crtc state explicitly to intel_pipe_update_start/end()
2017-08-23 15:22 [PATCH 1/7] drm/i915: Pass the new crtc state to color management code ville.syrjala
@ 2017-08-23 15:22 ` ville.syrjala
2017-08-23 15:22 ` [PATCH 3/7] drm/i915: Eliminate obj->state usage in g4x/vlv/chv wm computation ville.syrjala
` (5 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: ville.syrjala @ 2017-08-23 15:22 UTC (permalink / raw)
To: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Pass the appropriate new crtc state explicitly to
intel_pipe_update_start/end() instead of of mucking around with
crtc->state.
v2: The mmio flip stuff is gone
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> #v1
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 14 +++++++++-----
drivers/gpu/drm/i915/intel_drv.h | 12 ++++++++++--
drivers/gpu/drm/i915/intel_sprite.c | 27 +++++++++++++--------------
3 files changed, 32 insertions(+), 21 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 80a14b30e4d3..cee4db0a1626 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12917,13 +12917,13 @@ static void intel_begin_crtc_commit(struct drm_crtc *crtc,
struct drm_device *dev = crtc->dev;
struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
- struct intel_crtc_state *intel_cstate =
- to_intel_crtc_state(crtc->state);
struct intel_crtc_state *old_intel_cstate =
to_intel_crtc_state(old_crtc_state);
struct intel_atomic_state *old_intel_state =
to_intel_atomic_state(old_crtc_state->state);
- bool modeset = needs_modeset(crtc->state);
+ struct intel_crtc_state *intel_cstate =
+ intel_atomic_get_new_crtc_state(old_intel_state, intel_crtc);
+ bool modeset = needs_modeset(&intel_cstate->base);
if (!modeset &&
(intel_cstate->base.color_mgmt_changed ||
@@ -12933,7 +12933,7 @@ static void intel_begin_crtc_commit(struct drm_crtc *crtc,
}
/* Perform vblank evasion around commit operation */
- intel_pipe_update_start(intel_crtc);
+ intel_pipe_update_start(intel_cstate);
if (modeset)
goto out;
@@ -12953,8 +12953,12 @@ static void intel_finish_crtc_commit(struct drm_crtc *crtc,
struct drm_crtc_state *old_crtc_state)
{
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+ struct intel_atomic_state *old_intel_state =
+ to_intel_atomic_state(old_crtc_state->state);
+ struct intel_crtc_state *new_crtc_state =
+ intel_atomic_get_new_crtc_state(old_intel_state, intel_crtc);
- intel_pipe_update_end(intel_crtc);
+ intel_pipe_update_end(new_crtc_state);
}
/**
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index f60995fe455c..9a7c7dd0ea84 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1190,6 +1190,14 @@ hdmi_to_dig_port(struct intel_hdmi *intel_hdmi)
return container_of(intel_hdmi, struct intel_digital_port, hdmi);
}
+static inline struct intel_crtc_state *
+intel_atomic_get_new_crtc_state(struct intel_atomic_state *state,
+ struct intel_crtc *crtc)
+{
+ return to_intel_crtc_state(drm_atomic_get_new_crtc_state(&state->base,
+ &crtc->base));
+}
+
/* intel_fifo_underrun.c */
bool intel_set_cpu_fifo_underrun_reporting(struct drm_i915_private *dev_priv,
enum pipe pipe, bool enable);
@@ -1888,8 +1896,8 @@ struct intel_plane *intel_sprite_plane_create(struct drm_i915_private *dev_priv,
enum pipe pipe, int plane);
int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
struct drm_file *file_priv);
-void intel_pipe_update_start(struct intel_crtc *crtc);
-void intel_pipe_update_end(struct intel_crtc *crtc);
+void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state);
+void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state);
/* intel_tv.c */
void intel_tv_init(struct drm_i915_private *dev_priv);
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 524933b01483..b0d6e3e28d07 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -70,8 +70,7 @@ int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
/**
* intel_pipe_update_start() - start update of a set of display registers
- * @crtc: the crtc of which the registers are going to be updated
- * @start_vbl_count: vblank counter return pointer used for error checking
+ * @new_crtc_state: the new crtc state
*
* Mark the start of an update to pipe registers that should be updated
* atomically regarding vblank. If the next vblank will happens within
@@ -79,18 +78,18 @@ int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
*
* After a successful call to this function, interrupts will be disabled
* until a subsequent call to intel_pipe_update_end(). That is done to
- * avoid random delays. The value written to @start_vbl_count should be
- * supplied to intel_pipe_update_end() for error checking.
+ * avoid random delays.
*/
-void intel_pipe_update_start(struct intel_crtc *crtc)
+void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)
{
+ struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->base.crtc);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
- const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
+ const struct drm_display_mode *adjusted_mode = &new_crtc_state->base.adjusted_mode;
long timeout = msecs_to_jiffies_timeout(1);
int scanline, min, max, vblank_start;
wait_queue_head_t *wq = drm_crtc_vblank_waitqueue(&crtc->base);
bool need_vlv_dsi_wa = (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) &&
- intel_crtc_has_type(crtc->config, INTEL_OUTPUT_DSI);
+ intel_crtc_has_type(new_crtc_state, INTEL_OUTPUT_DSI);
DEFINE_WAIT(wait);
vblank_start = adjusted_mode->crtc_vblank_start;
@@ -170,15 +169,15 @@ void intel_pipe_update_start(struct intel_crtc *crtc)
/**
* intel_pipe_update_end() - end update of a set of display registers
- * @crtc: the crtc of which the registers were updated
- * @start_vbl_count: start vblank counter (used for error checking)
+ * @new_crtc_state: the new crtc state
*
* Mark the end of an update started with intel_pipe_update_start(). This
* re-enables interrupts and verifies the update was actually completed
- * before a vblank using the value of @start_vbl_count.
+ * before a vblank.
*/
-void intel_pipe_update_end(struct intel_crtc *crtc)
+void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state)
{
+ struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->base.crtc);
enum pipe pipe = crtc->pipe;
int scanline_end = intel_get_crtc_scanline(crtc);
u32 end_vbl_count = intel_crtc_get_vblank_counter(crtc);
@@ -191,14 +190,14 @@ void intel_pipe_update_end(struct intel_crtc *crtc)
* Would be slightly nice to just grab the vblank count and arm the
* event outside of the critical section - the spinlock might spin for a
* while ... */
- if (crtc->base.state->event) {
+ if (new_crtc_state->base.event) {
WARN_ON(drm_crtc_vblank_get(&crtc->base) != 0);
spin_lock(&crtc->base.dev->event_lock);
- drm_crtc_arm_vblank_event(&crtc->base, crtc->base.state->event);
+ drm_crtc_arm_vblank_event(&crtc->base, new_crtc_state->base.event);
spin_unlock(&crtc->base.dev->event_lock);
- crtc->base.state->event = NULL;
+ new_crtc_state->base.event = NULL;
}
local_irq_enable();
--
2.13.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/7] drm/i915: Eliminate obj->state usage in g4x/vlv/chv wm computation
2017-08-23 15:22 [PATCH 1/7] drm/i915: Pass the new crtc state to color management code ville.syrjala
2017-08-23 15:22 ` [PATCH 2/7] drm/i915: Pass the crtc state explicitly to intel_pipe_update_start/end() ville.syrjala
@ 2017-08-23 15:22 ` ville.syrjala
2017-08-23 15:22 ` [PATCH 4/7] drm/i915: Pass proper old/new states to intel_plane_atomic_check_with_state() ville.syrjala
` (4 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: ville.syrjala @ 2017-08-23 15:22 UTC (permalink / raw)
To: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Use explicit old/new states instead of relying on obj->state.
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/i915_drv.h | 9 +++++++++
drivers/gpu/drm/i915/intel_drv.h | 8 ++++++++
drivers/gpu/drm/i915/intel_pm.c | 30 +++++++++++++++---------------
3 files changed, 32 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 7587ef53026b..1072fbd70eae 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -569,6 +569,15 @@ struct i915_hotplug {
(__i)++) \
for_each_if (plane_state)
+#define for_each_oldnew_intel_plane_in_state(__state, plane, old_plane_state, new_plane_state, __i) \
+ for ((__i) = 0; \
+ (__i) < (__state)->base.dev->mode_config.num_total_plane && \
+ ((plane) = to_intel_plane((__state)->base.planes[__i].ptr), \
+ (old_plane_state) = to_intel_plane_state((__state)->base.planes[__i].old_state), \
+ (new_plane_state) = to_intel_plane_state((__state)->base.planes[__i].new_state), 1); \
+ (__i)++) \
+ for_each_if (plane)
+
struct drm_i915_private;
struct i915_mm_struct;
struct i915_mmu_object;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 9a7c7dd0ea84..e2e9b8215864 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1191,6 +1191,14 @@ hdmi_to_dig_port(struct intel_hdmi *intel_hdmi)
}
static inline struct intel_crtc_state *
+intel_atomic_get_old_crtc_state(struct intel_atomic_state *state,
+ struct intel_crtc *crtc)
+{
+ return to_intel_crtc_state(drm_atomic_get_old_crtc_state(&state->base,
+ &crtc->base));
+}
+
+static inline struct intel_crtc_state *
intel_atomic_get_new_crtc_state(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index d5ff0b9f999f..b9cbc5fec909 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -1322,21 +1322,21 @@ static int g4x_compute_pipe_wm(struct intel_crtc_state *crtc_state)
int num_active_planes = hweight32(crtc_state->active_planes &
~BIT(PLANE_CURSOR));
const struct g4x_pipe_wm *raw;
- struct intel_plane_state *plane_state;
+ const struct intel_plane_state *old_plane_state;
+ const struct intel_plane_state *new_plane_state;
struct intel_plane *plane;
enum plane_id plane_id;
int i, level;
unsigned int dirty = 0;
- for_each_intel_plane_in_state(state, plane, plane_state, i) {
- const struct intel_plane_state *old_plane_state =
- to_intel_plane_state(plane->base.state);
-
- if (plane_state->base.crtc != &crtc->base &&
+ for_each_oldnew_intel_plane_in_state(state, plane,
+ old_plane_state,
+ new_plane_state, i) {
+ if (new_plane_state->base.crtc != &crtc->base &&
old_plane_state->base.crtc != &crtc->base)
continue;
- if (g4x_raw_plane_wm_compute(crtc_state, plane_state))
+ if (g4x_raw_plane_wm_compute(crtc_state, new_plane_state))
dirty |= BIT(plane->id);
}
@@ -1831,21 +1831,21 @@ static int vlv_compute_pipe_wm(struct intel_crtc_state *crtc_state)
int num_active_planes = hweight32(crtc_state->active_planes &
~BIT(PLANE_CURSOR));
bool needs_modeset = drm_atomic_crtc_needs_modeset(&crtc_state->base);
- struct intel_plane_state *plane_state;
+ const struct intel_plane_state *old_plane_state;
+ const struct intel_plane_state *new_plane_state;
struct intel_plane *plane;
enum plane_id plane_id;
int level, ret, i;
unsigned int dirty = 0;
- for_each_intel_plane_in_state(state, plane, plane_state, i) {
- const struct intel_plane_state *old_plane_state =
- to_intel_plane_state(plane->base.state);
-
- if (plane_state->base.crtc != &crtc->base &&
+ for_each_oldnew_intel_plane_in_state(state, plane,
+ old_plane_state,
+ new_plane_state, i) {
+ if (new_plane_state->base.crtc != &crtc->base &&
old_plane_state->base.crtc != &crtc->base)
continue;
- if (vlv_raw_plane_wm_compute(crtc_state, plane_state))
+ if (vlv_raw_plane_wm_compute(crtc_state, new_plane_state))
dirty |= BIT(plane->id);
}
@@ -1864,7 +1864,7 @@ static int vlv_compute_pipe_wm(struct intel_crtc_state *crtc_state)
/* cursor changes don't warrant a FIFO recompute */
if (dirty & ~BIT(PLANE_CURSOR)) {
const struct intel_crtc_state *old_crtc_state =
- to_intel_crtc_state(crtc->base.state);
+ intel_atomic_get_old_crtc_state(state, crtc);
const struct vlv_fifo_state *old_fifo_state =
&old_crtc_state->wm.vlv.fifo_state;
--
2.13.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/7] drm/i915: Pass proper old/new states to intel_plane_atomic_check_with_state()
2017-08-23 15:22 [PATCH 1/7] drm/i915: Pass the new crtc state to color management code ville.syrjala
2017-08-23 15:22 ` [PATCH 2/7] drm/i915: Pass the crtc state explicitly to intel_pipe_update_start/end() ville.syrjala
2017-08-23 15:22 ` [PATCH 3/7] drm/i915: Eliminate obj->state usage in g4x/vlv/chv wm computation ville.syrjala
@ 2017-08-23 15:22 ` ville.syrjala
2017-08-31 18:50 ` Ville Syrjälä
2017-08-23 15:22 ` [PATCH 5/7] drm/i915: Eliminate obj->state usage from pre/post plane update ville.syrjala
` (3 subsequent siblings)
6 siblings, 1 reply; 11+ messages in thread
From: ville.syrjala @ 2017-08-23 15:22 UTC (permalink / raw)
To: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Eliminate plane->state and crtc->state usage from
intel_plane_atomic_check_with_state() and its callers. Instead pass the
proper states in or dig them up from the top level atomic state.
Note that intel_plane_atomic_check_with_state() itself isn't allowed to
use the top level atomic state as there is none when it gets called from
the legacy cursor short circuit path.
v2: Rename some variables for easier comprehension (Maarten)
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/intel_atomic_plane.c | 49 +++++++++++++++++++------------
drivers/gpu/drm/i915/intel_display.c | 12 ++++----
drivers/gpu/drm/i915/intel_drv.h | 16 ++++++++--
3 files changed, 51 insertions(+), 26 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
index ee76fab7bb6f..8e6dc159f64d 100644
--- a/drivers/gpu/drm/i915/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
@@ -107,7 +107,9 @@ intel_plane_destroy_state(struct drm_plane *plane,
drm_atomic_helper_plane_destroy_state(plane, state);
}
-int intel_plane_atomic_check_with_state(struct intel_crtc_state *crtc_state,
+int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_state,
+ struct intel_crtc_state *crtc_state,
+ const struct intel_plane_state *old_plane_state,
struct intel_plane_state *intel_state)
{
struct drm_plane *plane = intel_state->base.plane;
@@ -124,7 +126,7 @@ int intel_plane_atomic_check_with_state(struct intel_crtc_state *crtc_state,
* anything driver-specific we need to test in that case, so
* just return success.
*/
- if (!intel_state->base.crtc && !plane->state->crtc)
+ if (!intel_state->base.crtc && !old_plane_state->base.crtc)
return 0;
/* Clip all planes to CRTC size, or 0x0 if CRTC is disabled */
@@ -194,16 +196,21 @@ int intel_plane_atomic_check_with_state(struct intel_crtc_state *crtc_state,
else
crtc_state->active_planes &= ~BIT(intel_plane->id);
- return intel_plane_atomic_calc_changes(&crtc_state->base, state);
+ return intel_plane_atomic_calc_changes(old_crtc_state,
+ &crtc_state->base,
+ old_plane_state,
+ state);
}
static int intel_plane_atomic_check(struct drm_plane *plane,
- struct drm_plane_state *state)
+ struct drm_plane_state *new_plane_state)
{
- struct drm_crtc *crtc = state->crtc;
- struct drm_crtc_state *drm_crtc_state;
-
- crtc = crtc ? crtc : plane->state->crtc;
+ struct drm_atomic_state *state = new_plane_state->state;
+ const struct drm_plane_state *old_plane_state =
+ drm_atomic_get_old_plane_state(state, plane);
+ struct drm_crtc *crtc = new_plane_state->crtc ?: old_plane_state->crtc;
+ const struct drm_crtc_state *old_crtc_state;
+ struct drm_crtc_state *new_crtc_state;
/*
* Both crtc and plane->crtc could be NULL if we're updating a
@@ -214,29 +221,33 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
if (!crtc)
return 0;
- drm_crtc_state = drm_atomic_get_existing_crtc_state(state->state, crtc);
- if (WARN_ON(!drm_crtc_state))
- return -EINVAL;
+ old_crtc_state = drm_atomic_get_old_crtc_state(state, crtc);
+ new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
- return intel_plane_atomic_check_with_state(to_intel_crtc_state(drm_crtc_state),
- to_intel_plane_state(state));
+ return intel_plane_atomic_check_with_state(to_intel_crtc_state(old_crtc_state),
+ to_intel_crtc_state(new_crtc_state),
+ to_intel_plane_state(old_plane_state),
+ to_intel_plane_state(new_plane_state));
}
static void intel_plane_atomic_update(struct drm_plane *plane,
struct drm_plane_state *old_state)
{
+ struct intel_atomic_state *state = to_intel_atomic_state(old_state->state);
struct intel_plane *intel_plane = to_intel_plane(plane);
- struct intel_plane_state *intel_state =
- to_intel_plane_state(plane->state);
- struct drm_crtc *crtc = plane->state->crtc ?: old_state->crtc;
+ const struct intel_plane_state *new_plane_state =
+ intel_atomic_get_new_plane_state(state, intel_plane);
+ struct drm_crtc *crtc = new_plane_state->base.crtc ?: old_state->crtc;
+
+ if (new_plane_state->base.visible) {
+ const struct intel_crtc_state *new_crtc_state =
+ intel_atomic_get_new_crtc_state(state, to_intel_crtc(crtc));
- if (intel_state->base.visible) {
trace_intel_update_plane(plane,
to_intel_crtc(crtc));
intel_plane->update_plane(intel_plane,
- to_intel_crtc_state(crtc->state),
- intel_state);
+ new_crtc_state, new_plane_state);
} else {
trace_intel_disable_plane(plane,
to_intel_crtc(crtc));
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index cee4db0a1626..50617f390dce 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -10317,7 +10317,7 @@ static bool intel_wm_need_update(struct drm_plane *plane,
return false;
}
-static bool needs_scaling(struct intel_plane_state *state)
+static bool needs_scaling(const struct intel_plane_state *state)
{
int src_w = drm_rect_width(&state->base.src) >> 16;
int src_h = drm_rect_height(&state->base.src) >> 16;
@@ -10327,7 +10327,9 @@ static bool needs_scaling(struct intel_plane_state *state)
return (src_w != dst_w || src_h != dst_h);
}
-int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
+int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_state,
+ struct drm_crtc_state *crtc_state,
+ const struct intel_plane_state *old_plane_state,
struct drm_plane_state *plane_state)
{
struct intel_crtc_state *pipe_config = to_intel_crtc_state(crtc_state);
@@ -10336,10 +10338,8 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
struct intel_plane *plane = to_intel_plane(plane_state->plane);
struct drm_device *dev = crtc->dev;
struct drm_i915_private *dev_priv = to_i915(dev);
- struct intel_plane_state *old_plane_state =
- to_intel_plane_state(plane->base.state);
bool mode_changed = needs_modeset(crtc_state);
- bool was_crtc_enabled = crtc->state->active;
+ bool was_crtc_enabled = old_crtc_state->base.active;
bool is_crtc_enabled = crtc_state->active;
bool turn_off, turn_on, visible, was_visible;
struct drm_framebuffer *fb = plane_state->fb;
@@ -13137,6 +13137,8 @@ intel_legacy_cursor_update(struct drm_plane *plane,
new_plane_state->crtc_h = crtc_h;
ret = intel_plane_atomic_check_with_state(to_intel_crtc_state(crtc->state),
+ to_intel_crtc_state(crtc->state), /* FIXME need a new crtc state? */
+ to_intel_plane_state(plane->state),
to_intel_plane_state(new_plane_state));
if (ret)
goto out_free;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index e2e9b8215864..6a6b2567ed0a 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1190,6 +1190,14 @@ hdmi_to_dig_port(struct intel_hdmi *intel_hdmi)
return container_of(intel_hdmi, struct intel_digital_port, hdmi);
}
+static inline struct intel_plane_state *
+intel_atomic_get_new_plane_state(struct intel_atomic_state *state,
+ struct intel_plane *plane)
+{
+ return to_intel_plane_state(drm_atomic_get_new_plane_state(&state->base,
+ &plane->base));
+}
+
static inline struct intel_crtc_state *
intel_atomic_get_old_crtc_state(struct intel_atomic_state *state,
struct intel_crtc *crtc)
@@ -1418,7 +1426,9 @@ int intel_plane_atomic_set_property(struct drm_plane *plane,
struct drm_plane_state *state,
struct drm_property *property,
uint64_t val);
-int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
+int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_state,
+ struct drm_crtc_state *crtc_state,
+ const struct intel_plane_state *old_plane_state,
struct drm_plane_state *plane_state);
void assert_pch_transcoder_disabled(struct drm_i915_private *dev_priv,
@@ -1977,7 +1987,9 @@ struct drm_plane_state *intel_plane_duplicate_state(struct drm_plane *plane);
void intel_plane_destroy_state(struct drm_plane *plane,
struct drm_plane_state *state);
extern const struct drm_plane_helper_funcs intel_plane_helper_funcs;
-int intel_plane_atomic_check_with_state(struct intel_crtc_state *crtc_state,
+int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_state,
+ struct intel_crtc_state *crtc_state,
+ const struct intel_plane_state *old_plane_state,
struct intel_plane_state *intel_state);
/* intel_color.c */
--
2.13.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 5/7] drm/i915: Eliminate obj->state usage from pre/post plane update
2017-08-23 15:22 [PATCH 1/7] drm/i915: Pass the new crtc state to color management code ville.syrjala
` (2 preceding siblings ...)
2017-08-23 15:22 ` [PATCH 4/7] drm/i915: Pass proper old/new states to intel_plane_atomic_check_with_state() ville.syrjala
@ 2017-08-23 15:22 ` ville.syrjala
2017-08-23 15:22 ` [PATCH 6/7] drm/i915: Eliminate crtc->state usage from intel_update_pipe_config() ville.syrjala
` (2 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: ville.syrjala @ 2017-08-23 15:22 UTC (permalink / raw)
To: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Dig up the appropriate new crtc and plane states from the top level
atomic state in intel_pre_plane_update() and intel_post_plane_update().
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 50617f390dce..ed5f63de6769 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5098,7 +5098,8 @@ static void intel_post_plane_update(struct intel_crtc_state *old_crtc_state)
struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->base.crtc);
struct drm_atomic_state *old_state = old_crtc_state->base.state;
struct intel_crtc_state *pipe_config =
- to_intel_crtc_state(crtc->base.state);
+ intel_atomic_get_new_crtc_state(to_intel_atomic_state(old_state),
+ crtc);
struct drm_plane *primary = crtc->base.primary;
struct drm_plane_state *old_pri_state =
drm_atomic_get_existing_plane_state(old_state, primary);
@@ -5110,7 +5111,8 @@ static void intel_post_plane_update(struct intel_crtc_state *old_crtc_state)
if (old_pri_state) {
struct intel_plane_state *primary_state =
- to_intel_plane_state(primary->state);
+ intel_atomic_get_new_plane_state(to_intel_atomic_state(old_state),
+ to_intel_plane(primary));
struct intel_plane_state *old_primary_state =
to_intel_plane_state(old_pri_state);
@@ -5139,7 +5141,8 @@ static void intel_pre_plane_update(struct intel_crtc_state *old_crtc_state,
if (old_pri_state) {
struct intel_plane_state *primary_state =
- to_intel_plane_state(primary->state);
+ intel_atomic_get_new_plane_state(old_intel_state,
+ to_intel_plane(primary));
struct intel_plane_state *old_primary_state =
to_intel_plane_state(old_pri_state);
--
2.13.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 6/7] drm/i915: Eliminate crtc->state usage from intel_update_pipe_config()
2017-08-23 15:22 [PATCH 1/7] drm/i915: Pass the new crtc state to color management code ville.syrjala
` (3 preceding siblings ...)
2017-08-23 15:22 ` [PATCH 5/7] drm/i915: Eliminate obj->state usage from pre/post plane update ville.syrjala
@ 2017-08-23 15:22 ` ville.syrjala
2017-08-23 15:22 ` [PATCH 7/7] drm/i915: Eliminate crtc->state usage from intel_atomic_commit_tail and .crtc_update() ville.syrjala
2017-08-23 15:56 ` ✓ Fi.CI.BAT: success for series starting with [1/7] drm/i915: Pass the new crtc state to color management code Patchwork
6 siblings, 0 replies; 11+ messages in thread
From: ville.syrjala @ 2017-08-23 15:22 UTC (permalink / raw)
To: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Pass the correct new crtc state to intel_update_pipe_config() instead
of using crtc->state.
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index ed5f63de6769..49020ffd9ac6 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3784,15 +3784,14 @@ void intel_finish_reset(struct drm_i915_private *dev_priv)
clear_bit(I915_RESET_MODESET, &dev_priv->gpu_error.flags);
}
-static void intel_update_pipe_config(struct intel_crtc *crtc,
- struct intel_crtc_state *old_crtc_state)
+static void intel_update_pipe_config(const struct intel_crtc_state *old_crtc_state,
+ const struct intel_crtc_state *new_crtc_state)
{
+ struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->base.crtc);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
- struct intel_crtc_state *pipe_config =
- to_intel_crtc_state(crtc->base.state);
/* drm_atomic_helper_update_legacy_modeset_state might not be called. */
- crtc->base.mode = crtc->base.state->mode;
+ crtc->base.mode = new_crtc_state->base.mode;
/*
* Update pipe size and adjust fitter if needed: the reason for this is
@@ -3804,17 +3803,17 @@ static void intel_update_pipe_config(struct intel_crtc *crtc,
*/
I915_WRITE(PIPESRC(crtc->pipe),
- ((pipe_config->pipe_src_w - 1) << 16) |
- (pipe_config->pipe_src_h - 1));
+ ((new_crtc_state->pipe_src_w - 1) << 16) |
+ (new_crtc_state->pipe_src_h - 1));
/* on skylake this is done by detaching scalers */
if (INTEL_GEN(dev_priv) >= 9) {
skl_detach_scalers(crtc);
- if (pipe_config->pch_pfit.enabled)
+ if (new_crtc_state->pch_pfit.enabled)
skylake_pfit_enable(crtc);
} else if (HAS_PCH_SPLIT(dev_priv)) {
- if (pipe_config->pch_pfit.enabled)
+ if (new_crtc_state->pch_pfit.enabled)
ironlake_pfit_enable(crtc);
else if (old_crtc_state->pch_pfit.enabled)
ironlake_pfit_disable(crtc, true);
@@ -12942,7 +12941,7 @@ static void intel_begin_crtc_commit(struct drm_crtc *crtc,
goto out;
if (intel_cstate->update_pipe)
- intel_update_pipe_config(intel_crtc, old_intel_cstate);
+ intel_update_pipe_config(old_intel_cstate, intel_cstate);
else if (INTEL_GEN(dev_priv) >= 9)
skl_detach_scalers(intel_crtc);
--
2.13.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 7/7] drm/i915: Eliminate crtc->state usage from intel_atomic_commit_tail and .crtc_update()
2017-08-23 15:22 [PATCH 1/7] drm/i915: Pass the new crtc state to color management code ville.syrjala
` (4 preceding siblings ...)
2017-08-23 15:22 ` [PATCH 6/7] drm/i915: Eliminate crtc->state usage from intel_update_pipe_config() ville.syrjala
@ 2017-08-23 15:22 ` ville.syrjala
2017-08-23 15:56 ` ✓ Fi.CI.BAT: success for series starting with [1/7] drm/i915: Pass the new crtc state to color management code Patchwork
6 siblings, 0 replies; 11+ messages in thread
From: ville.syrjala @ 2017-08-23 15:22 UTC (permalink / raw)
To: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
We already have the correct new crtc state so just use that instead of
crtc->state.
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 49020ffd9ac6..593459368cab 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12256,7 +12256,7 @@ static void skl_update_crtcs(struct drm_atomic_state *state,
unsigned int cmask = drm_crtc_mask(crtc);
intel_crtc = to_intel_crtc(crtc);
- cstate = to_intel_crtc_state(crtc->state);
+ cstate = to_intel_crtc_state(new_crtc_state);
pipe = intel_crtc->pipe;
if (updated & cmask || !cstate->base.active)
@@ -12385,7 +12385,7 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
intel_check_cpu_fifo_underruns(dev_priv);
intel_check_pch_fifo_underruns(dev_priv);
- if (!crtc->state->active) {
+ if (!new_crtc_state->active) {
/*
* Make sure we don't call initial_watermarks
* for ILK-style watermark updates.
@@ -12394,7 +12394,7 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
*/
if (INTEL_GEN(dev_priv) >= 9)
dev_priv->display.initial_watermarks(intel_state,
- to_intel_crtc_state(crtc->state));
+ to_intel_crtc_state(new_crtc_state));
}
}
}
--
2.13.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* ✓ Fi.CI.BAT: success for series starting with [1/7] drm/i915: Pass the new crtc state to color management code
2017-08-23 15:22 [PATCH 1/7] drm/i915: Pass the new crtc state to color management code ville.syrjala
` (5 preceding siblings ...)
2017-08-23 15:22 ` [PATCH 7/7] drm/i915: Eliminate crtc->state usage from intel_atomic_commit_tail and .crtc_update() ville.syrjala
@ 2017-08-23 15:56 ` Patchwork
6 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2017-08-23 15:56 UTC (permalink / raw)
To: ville.syrjala; +Cc: intel-gfx
== Series Details ==
Series: series starting with [1/7] drm/i915: Pass the new crtc state to color management code
URL : https://patchwork.freedesktop.org/series/29219/
State : success
== Summary ==
Series 29219v1 series starting with [1/7] drm/i915: Pass the new crtc state to color management code
https://patchwork.freedesktop.org/api/1.0/series/29219/revisions/1/mbox/
Test kms_flip:
Subgroup basic-flip-vs-modeset:
pass -> SKIP (fi-skl-x1585l) fdo#101781
fdo#101781 https://bugs.freedesktop.org/show_bug.cgi?id=101781
fi-bdw-5557u total:279 pass:268 dwarn:0 dfail:0 fail:0 skip:11 time:453s
fi-bdw-gvtdvm total:279 pass:265 dwarn:0 dfail:0 fail:0 skip:14 time:436s
fi-blb-e6850 total:279 pass:224 dwarn:1 dfail:0 fail:0 skip:54 time:362s
fi-bsw-n3050 total:279 pass:243 dwarn:0 dfail:0 fail:0 skip:36 time:560s
fi-bwr-2160 total:279 pass:184 dwarn:0 dfail:0 fail:0 skip:95 time:253s
fi-bxt-j4205 total:279 pass:260 dwarn:0 dfail:0 fail:0 skip:19 time:523s
fi-byt-j1900 total:279 pass:254 dwarn:1 dfail:0 fail:0 skip:24 time:529s
fi-byt-n2820 total:279 pass:250 dwarn:1 dfail:0 fail:0 skip:28 time:520s
fi-elk-e7500 total:279 pass:230 dwarn:0 dfail:0 fail:0 skip:49 time:440s
fi-glk-2a total:279 pass:260 dwarn:0 dfail:0 fail:0 skip:19 time:616s
fi-hsw-4770 total:279 pass:263 dwarn:0 dfail:0 fail:0 skip:16 time:446s
fi-hsw-4770r total:279 pass:263 dwarn:0 dfail:0 fail:0 skip:16 time:424s
fi-ilk-650 total:279 pass:229 dwarn:0 dfail:0 fail:0 skip:50 time:425s
fi-ivb-3520m total:279 pass:261 dwarn:0 dfail:0 fail:0 skip:18 time:508s
fi-ivb-3770 total:279 pass:261 dwarn:0 dfail:0 fail:0 skip:18 time:475s
fi-kbl-7500u total:279 pass:261 dwarn:0 dfail:0 fail:0 skip:18 time:481s
fi-kbl-7560u total:279 pass:269 dwarn:0 dfail:0 fail:0 skip:10 time:596s
fi-kbl-r total:279 pass:261 dwarn:0 dfail:0 fail:0 skip:18 time:604s
fi-pnv-d510 total:279 pass:223 dwarn:1 dfail:0 fail:0 skip:55 time:534s
fi-skl-6260u total:279 pass:269 dwarn:0 dfail:0 fail:0 skip:10 time:476s
fi-skl-6700k total:279 pass:261 dwarn:0 dfail:0 fail:0 skip:18 time:484s
fi-skl-6770hq total:279 pass:269 dwarn:0 dfail:0 fail:0 skip:10 time:486s
fi-skl-gvtdvm total:279 pass:266 dwarn:0 dfail:0 fail:0 skip:13 time:442s
fi-skl-x1585l total:279 pass:268 dwarn:0 dfail:0 fail:0 skip:11 time:480s
fi-snb-2520m total:279 pass:251 dwarn:0 dfail:0 fail:0 skip:28 time:553s
fi-snb-2600 total:279 pass:250 dwarn:0 dfail:0 fail:0 skip:29 time:408s
2964b2f4029594399c4e3c28d64c504dcd914ab4 drm-tip: 2017y-08m-23d-13h-11m-32s UTC integration manifest
771ec71694a9 drm/i915: Eliminate crtc->state usage from intel_atomic_commit_tail and .crtc_update()
886ed5e6aee8 drm/i915: Eliminate crtc->state usage from intel_update_pipe_config()
f6951661fdef drm/i915: Eliminate obj->state usage from pre/post plane update
1385856883f1 drm/i915: Pass proper old/new states to intel_plane_atomic_check_with_state()
83ae0a82ef4a drm/i915: Eliminate obj->state usage in g4x/vlv/chv wm computation
2a84e3cce6c3 drm/i915: Pass the crtc state explicitly to intel_pipe_update_start/end()
3c63369bd59c drm/i915: Pass the new crtc state to color management code
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5476/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/7] drm/i915: Pass proper old/new states to intel_plane_atomic_check_with_state()
2017-08-23 15:22 ` [PATCH 4/7] drm/i915: Pass proper old/new states to intel_plane_atomic_check_with_state() ville.syrjala
@ 2017-08-31 18:50 ` Ville Syrjälä
2017-09-01 5:15 ` Maarten Lankhorst
0 siblings, 1 reply; 11+ messages in thread
From: Ville Syrjälä @ 2017-08-31 18:50 UTC (permalink / raw)
To: intel-gfx
On Wed, Aug 23, 2017 at 06:22:23PM +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Eliminate plane->state and crtc->state usage from
> intel_plane_atomic_check_with_state() and its callers. Instead pass the
> proper states in or dig them up from the top level atomic state.
>
> Note that intel_plane_atomic_check_with_state() itself isn't allowed to
> use the top level atomic state as there is none when it gets called from
> the legacy cursor short circuit path.
>
> v2: Rename some variables for easier comprehension (Maarten)
>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
This patch would still need some review love... In the meantime I
pushed the first three patches from the series. Thanks for the reviews
thus far.
> ---
> drivers/gpu/drm/i915/intel_atomic_plane.c | 49 +++++++++++++++++++------------
> drivers/gpu/drm/i915/intel_display.c | 12 ++++----
> drivers/gpu/drm/i915/intel_drv.h | 16 ++++++++--
> 3 files changed, 51 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
> index ee76fab7bb6f..8e6dc159f64d 100644
> --- a/drivers/gpu/drm/i915/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
> @@ -107,7 +107,9 @@ intel_plane_destroy_state(struct drm_plane *plane,
> drm_atomic_helper_plane_destroy_state(plane, state);
> }
>
> -int intel_plane_atomic_check_with_state(struct intel_crtc_state *crtc_state,
> +int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_state,
> + struct intel_crtc_state *crtc_state,
> + const struct intel_plane_state *old_plane_state,
> struct intel_plane_state *intel_state)
> {
> struct drm_plane *plane = intel_state->base.plane;
> @@ -124,7 +126,7 @@ int intel_plane_atomic_check_with_state(struct intel_crtc_state *crtc_state,
> * anything driver-specific we need to test in that case, so
> * just return success.
> */
> - if (!intel_state->base.crtc && !plane->state->crtc)
> + if (!intel_state->base.crtc && !old_plane_state->base.crtc)
> return 0;
>
> /* Clip all planes to CRTC size, or 0x0 if CRTC is disabled */
> @@ -194,16 +196,21 @@ int intel_plane_atomic_check_with_state(struct intel_crtc_state *crtc_state,
> else
> crtc_state->active_planes &= ~BIT(intel_plane->id);
>
> - return intel_plane_atomic_calc_changes(&crtc_state->base, state);
> + return intel_plane_atomic_calc_changes(old_crtc_state,
> + &crtc_state->base,
> + old_plane_state,
> + state);
> }
>
> static int intel_plane_atomic_check(struct drm_plane *plane,
> - struct drm_plane_state *state)
> + struct drm_plane_state *new_plane_state)
> {
> - struct drm_crtc *crtc = state->crtc;
> - struct drm_crtc_state *drm_crtc_state;
> -
> - crtc = crtc ? crtc : plane->state->crtc;
> + struct drm_atomic_state *state = new_plane_state->state;
> + const struct drm_plane_state *old_plane_state =
> + drm_atomic_get_old_plane_state(state, plane);
> + struct drm_crtc *crtc = new_plane_state->crtc ?: old_plane_state->crtc;
> + const struct drm_crtc_state *old_crtc_state;
> + struct drm_crtc_state *new_crtc_state;
>
> /*
> * Both crtc and plane->crtc could be NULL if we're updating a
> @@ -214,29 +221,33 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
> if (!crtc)
> return 0;
>
> - drm_crtc_state = drm_atomic_get_existing_crtc_state(state->state, crtc);
> - if (WARN_ON(!drm_crtc_state))
> - return -EINVAL;
> + old_crtc_state = drm_atomic_get_old_crtc_state(state, crtc);
> + new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
>
> - return intel_plane_atomic_check_with_state(to_intel_crtc_state(drm_crtc_state),
> - to_intel_plane_state(state));
> + return intel_plane_atomic_check_with_state(to_intel_crtc_state(old_crtc_state),
> + to_intel_crtc_state(new_crtc_state),
> + to_intel_plane_state(old_plane_state),
> + to_intel_plane_state(new_plane_state));
> }
>
> static void intel_plane_atomic_update(struct drm_plane *plane,
> struct drm_plane_state *old_state)
> {
> + struct intel_atomic_state *state = to_intel_atomic_state(old_state->state);
> struct intel_plane *intel_plane = to_intel_plane(plane);
> - struct intel_plane_state *intel_state =
> - to_intel_plane_state(plane->state);
> - struct drm_crtc *crtc = plane->state->crtc ?: old_state->crtc;
> + const struct intel_plane_state *new_plane_state =
> + intel_atomic_get_new_plane_state(state, intel_plane);
> + struct drm_crtc *crtc = new_plane_state->base.crtc ?: old_state->crtc;
> +
> + if (new_plane_state->base.visible) {
> + const struct intel_crtc_state *new_crtc_state =
> + intel_atomic_get_new_crtc_state(state, to_intel_crtc(crtc));
>
> - if (intel_state->base.visible) {
> trace_intel_update_plane(plane,
> to_intel_crtc(crtc));
>
> intel_plane->update_plane(intel_plane,
> - to_intel_crtc_state(crtc->state),
> - intel_state);
> + new_crtc_state, new_plane_state);
> } else {
> trace_intel_disable_plane(plane,
> to_intel_crtc(crtc));
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index cee4db0a1626..50617f390dce 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -10317,7 +10317,7 @@ static bool intel_wm_need_update(struct drm_plane *plane,
> return false;
> }
>
> -static bool needs_scaling(struct intel_plane_state *state)
> +static bool needs_scaling(const struct intel_plane_state *state)
> {
> int src_w = drm_rect_width(&state->base.src) >> 16;
> int src_h = drm_rect_height(&state->base.src) >> 16;
> @@ -10327,7 +10327,9 @@ static bool needs_scaling(struct intel_plane_state *state)
> return (src_w != dst_w || src_h != dst_h);
> }
>
> -int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
> +int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_state,
> + struct drm_crtc_state *crtc_state,
> + const struct intel_plane_state *old_plane_state,
> struct drm_plane_state *plane_state)
> {
> struct intel_crtc_state *pipe_config = to_intel_crtc_state(crtc_state);
> @@ -10336,10 +10338,8 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
> struct intel_plane *plane = to_intel_plane(plane_state->plane);
> struct drm_device *dev = crtc->dev;
> struct drm_i915_private *dev_priv = to_i915(dev);
> - struct intel_plane_state *old_plane_state =
> - to_intel_plane_state(plane->base.state);
> bool mode_changed = needs_modeset(crtc_state);
> - bool was_crtc_enabled = crtc->state->active;
> + bool was_crtc_enabled = old_crtc_state->base.active;
> bool is_crtc_enabled = crtc_state->active;
> bool turn_off, turn_on, visible, was_visible;
> struct drm_framebuffer *fb = plane_state->fb;
> @@ -13137,6 +13137,8 @@ intel_legacy_cursor_update(struct drm_plane *plane,
> new_plane_state->crtc_h = crtc_h;
>
> ret = intel_plane_atomic_check_with_state(to_intel_crtc_state(crtc->state),
> + to_intel_crtc_state(crtc->state), /* FIXME need a new crtc state? */
> + to_intel_plane_state(plane->state),
> to_intel_plane_state(new_plane_state));
> if (ret)
> goto out_free;
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index e2e9b8215864..6a6b2567ed0a 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1190,6 +1190,14 @@ hdmi_to_dig_port(struct intel_hdmi *intel_hdmi)
> return container_of(intel_hdmi, struct intel_digital_port, hdmi);
> }
>
> +static inline struct intel_plane_state *
> +intel_atomic_get_new_plane_state(struct intel_atomic_state *state,
> + struct intel_plane *plane)
> +{
> + return to_intel_plane_state(drm_atomic_get_new_plane_state(&state->base,
> + &plane->base));
> +}
> +
> static inline struct intel_crtc_state *
> intel_atomic_get_old_crtc_state(struct intel_atomic_state *state,
> struct intel_crtc *crtc)
> @@ -1418,7 +1426,9 @@ int intel_plane_atomic_set_property(struct drm_plane *plane,
> struct drm_plane_state *state,
> struct drm_property *property,
> uint64_t val);
> -int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
> +int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_state,
> + struct drm_crtc_state *crtc_state,
> + const struct intel_plane_state *old_plane_state,
> struct drm_plane_state *plane_state);
>
> void assert_pch_transcoder_disabled(struct drm_i915_private *dev_priv,
> @@ -1977,7 +1987,9 @@ struct drm_plane_state *intel_plane_duplicate_state(struct drm_plane *plane);
> void intel_plane_destroy_state(struct drm_plane *plane,
> struct drm_plane_state *state);
> extern const struct drm_plane_helper_funcs intel_plane_helper_funcs;
> -int intel_plane_atomic_check_with_state(struct intel_crtc_state *crtc_state,
> +int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_state,
> + struct intel_crtc_state *crtc_state,
> + const struct intel_plane_state *old_plane_state,
> struct intel_plane_state *intel_state);
>
> /* intel_color.c */
> --
> 2.13.0
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/7] drm/i915: Pass proper old/new states to intel_plane_atomic_check_with_state()
2017-08-31 18:50 ` Ville Syrjälä
@ 2017-09-01 5:15 ` Maarten Lankhorst
2017-09-01 13:57 ` Ville Syrjälä
0 siblings, 1 reply; 11+ messages in thread
From: Maarten Lankhorst @ 2017-09-01 5:15 UTC (permalink / raw)
To: Ville Syrjälä, intel-gfx
Op 31-08-17 om 20:50 schreef Ville Syrjälä:
> On Wed, Aug 23, 2017 at 06:22:23PM +0300, ville.syrjala@linux.intel.com wrote:
>> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>
>> Eliminate plane->state and crtc->state usage from
>> intel_plane_atomic_check_with_state() and its callers. Instead pass the
>> proper states in or dig them up from the top level atomic state.
>>
>> Note that intel_plane_atomic_check_with_state() itself isn't allowed to
>> use the top level atomic state as there is none when it gets called from
>> the legacy cursor short circuit path.
>>
>> v2: Rename some variables for easier comprehension (Maarten)
>>
>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> This patch would still need some review love... In the meantime I
> pushed the first three patches from the series. Thanks for the reviews
> thus far.
I love it.
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/7] drm/i915: Pass proper old/new states to intel_plane_atomic_check_with_state()
2017-09-01 5:15 ` Maarten Lankhorst
@ 2017-09-01 13:57 ` Ville Syrjälä
0 siblings, 0 replies; 11+ messages in thread
From: Ville Syrjälä @ 2017-09-01 13:57 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: intel-gfx
On Fri, Sep 01, 2017 at 07:15:55AM +0200, Maarten Lankhorst wrote:
> Op 31-08-17 om 20:50 schreef Ville Syrjälä:
> > On Wed, Aug 23, 2017 at 06:22:23PM +0300, ville.syrjala@linux.intel.com wrote:
> >> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >>
> >> Eliminate plane->state and crtc->state usage from
> >> intel_plane_atomic_check_with_state() and its callers. Instead pass the
> >> proper states in or dig them up from the top level atomic state.
> >>
> >> Note that intel_plane_atomic_check_with_state() itself isn't allowed to
> >> use the top level atomic state as there is none when it gets called from
> >> the legacy cursor short circuit path.
> >>
> >> v2: Rename some variables for easier comprehension (Maarten)
> >>
> >> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> >> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > This patch would still need some review love... In the meantime I
> > pushed the first three patches from the series. Thanks for the reviews
> > thus far.
> I love it.
>
> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Thank you. Pushed the rest of the series to dinq.
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-09-01 13:57 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-23 15:22 [PATCH 1/7] drm/i915: Pass the new crtc state to color management code ville.syrjala
2017-08-23 15:22 ` [PATCH 2/7] drm/i915: Pass the crtc state explicitly to intel_pipe_update_start/end() ville.syrjala
2017-08-23 15:22 ` [PATCH 3/7] drm/i915: Eliminate obj->state usage in g4x/vlv/chv wm computation ville.syrjala
2017-08-23 15:22 ` [PATCH 4/7] drm/i915: Pass proper old/new states to intel_plane_atomic_check_with_state() ville.syrjala
2017-08-31 18:50 ` Ville Syrjälä
2017-09-01 5:15 ` Maarten Lankhorst
2017-09-01 13:57 ` Ville Syrjälä
2017-08-23 15:22 ` [PATCH 5/7] drm/i915: Eliminate obj->state usage from pre/post plane update ville.syrjala
2017-08-23 15:22 ` [PATCH 6/7] drm/i915: Eliminate crtc->state usage from intel_update_pipe_config() ville.syrjala
2017-08-23 15:22 ` [PATCH 7/7] drm/i915: Eliminate crtc->state usage from intel_atomic_commit_tail and .crtc_update() ville.syrjala
2017-08-23 15:56 ` ✓ Fi.CI.BAT: success for series starting with [1/7] drm/i915: Pass the new crtc state to color management code Patchwork
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.