* [PATCH 1/3] drm/atomic-helper: Extract drm_atomic_helper_calc_timestamping_constants()
@ 2020-09-07 12:00 Ville Syrjala
2020-09-07 12:00 ` [PATCH 2/3] drm/atomic-helper: Remove the timestamping constant update from drm_atomic_helper_update_legacy_modeset_state() Ville Syrjala
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Ville Syrjala @ 2020-09-07 12:00 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Put the vblank timestamping constants update loop into its own
function. It has no business living inside
drm_atomic_helper_update_legacy_modeset_state() so we'll be wanting
to move it out entirely. As a first step we'll still call it
from drm_atomic_helper_update_legacy_modeset_state().
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/drm_atomic_helper.c | 22 +++++++++++++++++++++-
include/drm/drm_atomic_helper.h | 3 +++
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 9e1ad493e689..673e3fc282d9 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1186,13 +1186,33 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev,
crtc->x = new_plane_state->src_x >> 16;
crtc->y = new_plane_state->src_y >> 16;
}
+ }
+ drm_atomic_helper_calc_timestamping_constants(old_state);
+}
+EXPORT_SYMBOL(drm_atomic_helper_update_legacy_modeset_state);
+
+/**
+ * drm_atomic_helper_calc_timestamping_constants - update vblank timestamping constants
+ * @state: atomic state object
+ *
+ * Updates the timestamping constants used for precise vblank timestamps
+ * by calling drm_calc_timestamping_constants() for all enabled crtcs in @state.
+ */
+void drm_atomic_helper_calc_timestamping_constants(struct drm_atomic_state *state)
+{
+ struct drm_crtc_state *new_crtc_state;
+ struct drm_crtc *crtc;
+ int i;
+
+ /* set legacy state in the crtc structure */
+ for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
if (new_crtc_state->enable)
drm_calc_timestamping_constants(crtc,
&new_crtc_state->adjusted_mode);
}
}
-EXPORT_SYMBOL(drm_atomic_helper_update_legacy_modeset_state);
+EXPORT_SYMBOL(drm_atomic_helper_calc_timestamping_constants);
static void
crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index b268180c97eb..85df04c8e62f 100644
--- a/include/drm/drm_atomic_helper.h
+++ b/include/drm/drm_atomic_helper.h
@@ -74,6 +74,9 @@ void
drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev,
struct drm_atomic_state *old_state);
+void
+drm_atomic_helper_calc_timestamping_constants(struct drm_atomic_state *state);
+
void drm_atomic_helper_commit_modeset_disables(struct drm_device *dev,
struct drm_atomic_state *state);
void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
--
2.26.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] drm/atomic-helper: Remove the timestamping constant update from drm_atomic_helper_update_legacy_modeset_state()
2020-09-07 12:00 [PATCH 1/3] drm/atomic-helper: Extract drm_atomic_helper_calc_timestamping_constants() Ville Syrjala
@ 2020-09-07 12:00 ` Ville Syrjala
2020-09-07 18:12 ` [Intel-gfx] " Daniel Vetter
2020-09-07 12:00 ` [PATCH 3/3] drm/i915: Drop the drm_atomic_helper_calc_timestamping_constants() call Ville Syrjala
2020-09-07 18:08 ` [Intel-gfx] [PATCH 1/3] drm/atomic-helper: Extract drm_atomic_helper_calc_timestamping_constants() Daniel Vetter
2 siblings, 1 reply; 8+ messages in thread
From: Ville Syrjala @ 2020-09-07 12:00 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
The timestamping constants have nothing to do with any legacy state
so should not be updated from
drm_atomic_helper_update_legacy_modeset_state().
Let's make everyone call drm_atomic_helper_calc_timestamping_constants()
directly instead of relying on
drm_atomic_helper_update_legacy_modeset_state() to call it.
@@
expression S;
@@
- drm_atomic_helper_calc_timestamping_constants(S);
@@
expression D, S;
@@
drm_atomic_helper_update_legacy_modeset_state(D, S);
+ drm_atomic_helper_calc_timestamping_constants(S);
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 +
drivers/gpu/drm/drm_atomic_helper.c | 7 ++-----
drivers/gpu/drm/i915/display/intel_display.c | 1 +
drivers/gpu/drm/nouveau/dispnv50/disp.c | 1 +
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 490684787cff..0511097343da 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -7397,6 +7397,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
int crtc_disable_count = 0;
drm_atomic_helper_update_legacy_modeset_state(dev, state);
+ drm_atomic_helper_calc_timestamping_constants(state);
dm_state = dm_atomic_get_new_state(state);
if (dm_state && dm_state->context) {
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 673e3fc282d9..45ee613c8efd 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1115,9 +1115,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
* @old_state: atomic state object with old state structures
*
* This function updates all the various legacy modeset state pointers in
- * connectors, encoders and CRTCs. It also updates the timestamping constants
- * used for precise vblank timestamps by calling
- * drm_calc_timestamping_constants().
+ * connectors, encoders and CRTCs.
*
* Drivers can use this for building their own atomic commit if they don't have
* a pure helper-based modeset implementation.
@@ -1187,8 +1185,6 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev,
crtc->y = new_plane_state->src_y >> 16;
}
}
-
- drm_atomic_helper_calc_timestamping_constants(old_state);
}
EXPORT_SYMBOL(drm_atomic_helper_update_legacy_modeset_state);
@@ -1296,6 +1292,7 @@ void drm_atomic_helper_commit_modeset_disables(struct drm_device *dev,
disable_outputs(dev, old_state);
drm_atomic_helper_update_legacy_modeset_state(dev, old_state);
+ drm_atomic_helper_calc_timestamping_constants(old_state);
crtc_set_mode(dev, old_state);
}
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index ec148a8da2c2..035840ce3825 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -15578,6 +15578,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
if (state->modeset) {
drm_atomic_helper_update_legacy_modeset_state(dev, &state->base);
+ drm_atomic_helper_calc_timestamping_constants(&state->base);
intel_set_cdclk_pre_plane_update(state);
diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index 7799530e07c1..b6d1b926bc5e 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -2069,6 +2069,7 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
drm_atomic_helper_wait_for_fences(dev, state, false);
drm_atomic_helper_wait_for_dependencies(state);
drm_atomic_helper_update_legacy_modeset_state(dev, state);
+ drm_atomic_helper_calc_timestamping_constants(state);
if (atom->lock_core)
mutex_lock(&disp->mutex);
--
2.26.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] drm/i915: Drop the drm_atomic_helper_calc_timestamping_constants() call
2020-09-07 12:00 [PATCH 1/3] drm/atomic-helper: Extract drm_atomic_helper_calc_timestamping_constants() Ville Syrjala
2020-09-07 12:00 ` [PATCH 2/3] drm/atomic-helper: Remove the timestamping constant update from drm_atomic_helper_update_legacy_modeset_state() Ville Syrjala
@ 2020-09-07 12:00 ` Ville Syrjala
2020-09-07 18:14 ` [Intel-gfx] " Daniel Vetter
2020-09-07 18:08 ` [Intel-gfx] [PATCH 1/3] drm/atomic-helper: Extract drm_atomic_helper_calc_timestamping_constants() Daniel Vetter
2 siblings, 1 reply; 8+ messages in thread
From: Ville Syrjala @ 2020-09-07 12:00 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
We update the timestamping constants per-crtc explicitly in
intel_crtc_update_active_timings(). Furtermore the helper will
use uapi.adjusted_mode whereas we want hw.adjusted_mode. Thus
let's drop the helper call an rely on what we already have in
intel_crtc_update_active_timings(). We can now also drop the
hw.adjusted_mode -> uapi.adjusted_mode copy hack that was added
to keep the helper from deriving the timestamping constants from
the wrong thing.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/display/intel_display.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 035840ce3825..a846f414c759 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -13472,12 +13472,6 @@ intel_modeset_pipe_config(struct intel_crtc_state *pipe_config)
"hw max bpp: %i, pipe bpp: %i, dithering: %i\n",
base_bpp, pipe_config->pipe_bpp, pipe_config->dither);
- /*
- * Make drm_calc_timestamping_constants in
- * drm_atomic_helper_update_legacy_modeset_state() happy
- */
- pipe_config->uapi.adjusted_mode = pipe_config->hw.adjusted_mode;
-
return 0;
}
@@ -15578,7 +15572,6 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
if (state->modeset) {
drm_atomic_helper_update_legacy_modeset_state(dev, &state->base);
- drm_atomic_helper_calc_timestamping_constants(&state->base);
intel_set_cdclk_pre_plane_update(state);
--
2.26.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Intel-gfx] [PATCH 1/3] drm/atomic-helper: Extract drm_atomic_helper_calc_timestamping_constants()
2020-09-07 12:00 [PATCH 1/3] drm/atomic-helper: Extract drm_atomic_helper_calc_timestamping_constants() Ville Syrjala
2020-09-07 12:00 ` [PATCH 2/3] drm/atomic-helper: Remove the timestamping constant update from drm_atomic_helper_update_legacy_modeset_state() Ville Syrjala
2020-09-07 12:00 ` [PATCH 3/3] drm/i915: Drop the drm_atomic_helper_calc_timestamping_constants() call Ville Syrjala
@ 2020-09-07 18:08 ` Daniel Vetter
2 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2020-09-07 18:08 UTC (permalink / raw)
To: Ville Syrjala; +Cc: intel-gfx, dri-devel
On Mon, Sep 07, 2020 at 03:00:24PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Put the vblank timestamping constants update loop into its own
> function. It has no business living inside
> drm_atomic_helper_update_legacy_modeset_state() so we'll be wanting
> to move it out entirely. As a first step we'll still call it
> from drm_atomic_helper_update_legacy_modeset_state().
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> drivers/gpu/drm/drm_atomic_helper.c | 22 +++++++++++++++++++++-
> include/drm/drm_atomic_helper.h | 3 +++
> 2 files changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 9e1ad493e689..673e3fc282d9 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1186,13 +1186,33 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev,
> crtc->x = new_plane_state->src_x >> 16;
> crtc->y = new_plane_state->src_y >> 16;
> }
> + }
>
> + drm_atomic_helper_calc_timestamping_constants(old_state);
> +}
> +EXPORT_SYMBOL(drm_atomic_helper_update_legacy_modeset_state);
> +
> +/**
> + * drm_atomic_helper_calc_timestamping_constants - update vblank timestamping constants
> + * @state: atomic state object
> + *
> + * Updates the timestamping constants used for precise vblank timestamps
> + * by calling drm_calc_timestamping_constants() for all enabled crtcs in @state.
> + */
> +void drm_atomic_helper_calc_timestamping_constants(struct drm_atomic_state *state)
> +{
> + struct drm_crtc_state *new_crtc_state;
> + struct drm_crtc *crtc;
> + int i;
> +
> + /* set legacy state in the crtc structure */
> + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
> if (new_crtc_state->enable)
> drm_calc_timestamping_constants(crtc,
> &new_crtc_state->adjusted_mode);
> }
> }
> -EXPORT_SYMBOL(drm_atomic_helper_update_legacy_modeset_state);
> +EXPORT_SYMBOL(drm_atomic_helper_calc_timestamping_constants);
>
> static void
> crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)
> diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
> index b268180c97eb..85df04c8e62f 100644
> --- a/include/drm/drm_atomic_helper.h
> +++ b/include/drm/drm_atomic_helper.h
> @@ -74,6 +74,9 @@ void
> drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev,
> struct drm_atomic_state *old_state);
>
> +void
> +drm_atomic_helper_calc_timestamping_constants(struct drm_atomic_state *state);
> +
> void drm_atomic_helper_commit_modeset_disables(struct drm_device *dev,
> struct drm_atomic_state *state);
> void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
> --
> 2.26.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Intel-gfx] [PATCH 2/3] drm/atomic-helper: Remove the timestamping constant update from drm_atomic_helper_update_legacy_modeset_state()
2020-09-07 12:00 ` [PATCH 2/3] drm/atomic-helper: Remove the timestamping constant update from drm_atomic_helper_update_legacy_modeset_state() Ville Syrjala
@ 2020-09-07 18:12 ` Daniel Vetter
2020-09-14 20:16 ` Ville Syrjälä
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Vetter @ 2020-09-07 18:12 UTC (permalink / raw)
To: Ville Syrjala; +Cc: intel-gfx, dri-devel
On Mon, Sep 07, 2020 at 03:00:25PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> The timestamping constants have nothing to do with any legacy state
> so should not be updated from
> drm_atomic_helper_update_legacy_modeset_state().
>
> Let's make everyone call drm_atomic_helper_calc_timestamping_constants()
> directly instead of relying on
> drm_atomic_helper_update_legacy_modeset_state() to call it.
>
> @@
> expression S;
> @@
> - drm_atomic_helper_calc_timestamping_constants(S);
>
> @@
> expression D, S;
> @@
> drm_atomic_helper_update_legacy_modeset_state(D, S);
> + drm_atomic_helper_calc_timestamping_constants(S);
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
I think the kerneldoc for
drm_crtc_vblank_helper_get_vblank/_timestamp_internal (both of them) also
needs to be updated to mention the new function. With that fixed:
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 +
> drivers/gpu/drm/drm_atomic_helper.c | 7 ++-----
> drivers/gpu/drm/i915/display/intel_display.c | 1 +
> drivers/gpu/drm/nouveau/dispnv50/disp.c | 1 +
> 4 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 490684787cff..0511097343da 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -7397,6 +7397,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
> int crtc_disable_count = 0;
>
> drm_atomic_helper_update_legacy_modeset_state(dev, state);
> + drm_atomic_helper_calc_timestamping_constants(state);
>
> dm_state = dm_atomic_get_new_state(state);
> if (dm_state && dm_state->context) {
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 673e3fc282d9..45ee613c8efd 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1115,9 +1115,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
> * @old_state: atomic state object with old state structures
> *
> * This function updates all the various legacy modeset state pointers in
> - * connectors, encoders and CRTCs. It also updates the timestamping constants
> - * used for precise vblank timestamps by calling
> - * drm_calc_timestamping_constants().
> + * connectors, encoders and CRTCs.
> *
> * Drivers can use this for building their own atomic commit if they don't have
> * a pure helper-based modeset implementation.
> @@ -1187,8 +1185,6 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev,
> crtc->y = new_plane_state->src_y >> 16;
> }
> }
> -
> - drm_atomic_helper_calc_timestamping_constants(old_state);
> }
> EXPORT_SYMBOL(drm_atomic_helper_update_legacy_modeset_state);
>
> @@ -1296,6 +1292,7 @@ void drm_atomic_helper_commit_modeset_disables(struct drm_device *dev,
> disable_outputs(dev, old_state);
>
> drm_atomic_helper_update_legacy_modeset_state(dev, old_state);
> + drm_atomic_helper_calc_timestamping_constants(old_state);
>
> crtc_set_mode(dev, old_state);
> }
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index ec148a8da2c2..035840ce3825 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -15578,6 +15578,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
>
> if (state->modeset) {
> drm_atomic_helper_update_legacy_modeset_state(dev, &state->base);
> + drm_atomic_helper_calc_timestamping_constants(&state->base);
>
> intel_set_cdclk_pre_plane_update(state);
>
> diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> index 7799530e07c1..b6d1b926bc5e 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
> +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> @@ -2069,6 +2069,7 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
> drm_atomic_helper_wait_for_fences(dev, state, false);
> drm_atomic_helper_wait_for_dependencies(state);
> drm_atomic_helper_update_legacy_modeset_state(dev, state);
> + drm_atomic_helper_calc_timestamping_constants(state);
>
> if (atom->lock_core)
> mutex_lock(&disp->mutex);
> --
> 2.26.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Intel-gfx] [PATCH 3/3] drm/i915: Drop the drm_atomic_helper_calc_timestamping_constants() call
2020-09-07 12:00 ` [PATCH 3/3] drm/i915: Drop the drm_atomic_helper_calc_timestamping_constants() call Ville Syrjala
@ 2020-09-07 18:14 ` Daniel Vetter
2020-09-08 11:50 ` Ville Syrjälä
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Vetter @ 2020-09-07 18:14 UTC (permalink / raw)
To: Ville Syrjala; +Cc: intel-gfx, dri-devel
On Mon, Sep 07, 2020 at 03:00:26PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> We update the timestamping constants per-crtc explicitly in
> intel_crtc_update_active_timings(). Furtermore the helper will
> use uapi.adjusted_mode whereas we want hw.adjusted_mode. Thus
> let's drop the helper call an rely on what we already have in
> intel_crtc_update_active_timings(). We can now also drop the
> hw.adjusted_mode -> uapi.adjusted_mode copy hack that was added
> to keep the helper from deriving the timestamping constants from
> the wrong thing.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Does this fix some CI fail? I'd kinda expect/hope for that ...
Anyway looks like a good idea to not mess with the uapi state like this.
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> drivers/gpu/drm/i915/display/intel_display.c | 7 -------
> 1 file changed, 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 035840ce3825..a846f414c759 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -13472,12 +13472,6 @@ intel_modeset_pipe_config(struct intel_crtc_state *pipe_config)
> "hw max bpp: %i, pipe bpp: %i, dithering: %i\n",
> base_bpp, pipe_config->pipe_bpp, pipe_config->dither);
>
> - /*
> - * Make drm_calc_timestamping_constants in
> - * drm_atomic_helper_update_legacy_modeset_state() happy
> - */
> - pipe_config->uapi.adjusted_mode = pipe_config->hw.adjusted_mode;
> -
> return 0;
> }
>
> @@ -15578,7 +15572,6 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
>
> if (state->modeset) {
> drm_atomic_helper_update_legacy_modeset_state(dev, &state->base);
> - drm_atomic_helper_calc_timestamping_constants(&state->base);
>
> intel_set_cdclk_pre_plane_update(state);
>
> --
> 2.26.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Intel-gfx] [PATCH 3/3] drm/i915: Drop the drm_atomic_helper_calc_timestamping_constants() call
2020-09-07 18:14 ` [Intel-gfx] " Daniel Vetter
@ 2020-09-08 11:50 ` Ville Syrjälä
0 siblings, 0 replies; 8+ messages in thread
From: Ville Syrjälä @ 2020-09-08 11:50 UTC (permalink / raw)
To: Daniel Vetter; +Cc: intel-gfx, dri-devel
On Mon, Sep 07, 2020 at 08:14:38PM +0200, Daniel Vetter wrote:
> On Mon, Sep 07, 2020 at 03:00:26PM +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > We update the timestamping constants per-crtc explicitly in
> > intel_crtc_update_active_timings(). Furtermore the helper will
> > use uapi.adjusted_mode whereas we want hw.adjusted_mode. Thus
> > let's drop the helper call an rely on what we already have in
> > intel_crtc_update_active_timings(). We can now also drop the
> > hw.adjusted_mode -> uapi.adjusted_mode copy hack that was added
> > to keep the helper from deriving the timestamping constants from
> > the wrong thing.
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Does this fix some CI fail? I'd kinda expect/hope for that ...
Nah. Just trying to get rid of some of the confusing stuff before
we add even more confusing stuff for bigjoiner.
>
> Anyway looks like a good idea to not mess with the uapi state like this.
>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>
> > ---
> > drivers/gpu/drm/i915/display/intel_display.c | 7 -------
> > 1 file changed, 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > index 035840ce3825..a846f414c759 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -13472,12 +13472,6 @@ intel_modeset_pipe_config(struct intel_crtc_state *pipe_config)
> > "hw max bpp: %i, pipe bpp: %i, dithering: %i\n",
> > base_bpp, pipe_config->pipe_bpp, pipe_config->dither);
> >
> > - /*
> > - * Make drm_calc_timestamping_constants in
> > - * drm_atomic_helper_update_legacy_modeset_state() happy
> > - */
> > - pipe_config->uapi.adjusted_mode = pipe_config->hw.adjusted_mode;
> > -
> > return 0;
> > }
> >
> > @@ -15578,7 +15572,6 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
> >
> > if (state->modeset) {
> > drm_atomic_helper_update_legacy_modeset_state(dev, &state->base);
> > - drm_atomic_helper_calc_timestamping_constants(&state->base);
> >
> > intel_set_cdclk_pre_plane_update(state);
> >
> > --
> > 2.26.2
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Intel-gfx] [PATCH 2/3] drm/atomic-helper: Remove the timestamping constant update from drm_atomic_helper_update_legacy_modeset_state()
2020-09-07 18:12 ` [Intel-gfx] " Daniel Vetter
@ 2020-09-14 20:16 ` Ville Syrjälä
0 siblings, 0 replies; 8+ messages in thread
From: Ville Syrjälä @ 2020-09-14 20:16 UTC (permalink / raw)
To: Daniel Vetter; +Cc: intel-gfx, dri-devel
On Mon, Sep 07, 2020 at 08:12:56PM +0200, Daniel Vetter wrote:
> On Mon, Sep 07, 2020 at 03:00:25PM +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > The timestamping constants have nothing to do with any legacy state
> > so should not be updated from
> > drm_atomic_helper_update_legacy_modeset_state().
> >
> > Let's make everyone call drm_atomic_helper_calc_timestamping_constants()
> > directly instead of relying on
> > drm_atomic_helper_update_legacy_modeset_state() to call it.
> >
> > @@
> > expression S;
> > @@
> > - drm_atomic_helper_calc_timestamping_constants(S);
> >
> > @@
> > expression D, S;
> > @@
> > drm_atomic_helper_update_legacy_modeset_state(D, S);
> > + drm_atomic_helper_calc_timestamping_constants(S);
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> I think the kerneldoc for
> drm_crtc_vblank_helper_get_vblank/_timestamp_internal (both of them) also
> needs to be updated to mention the new function. With that fixed:
>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Fixed the docs while applying. Thanks for the review.
>
>
> > ---
> > drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 +
> > drivers/gpu/drm/drm_atomic_helper.c | 7 ++-----
> > drivers/gpu/drm/i915/display/intel_display.c | 1 +
> > drivers/gpu/drm/nouveau/dispnv50/disp.c | 1 +
> > 4 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > index 490684787cff..0511097343da 100644
> > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > @@ -7397,6 +7397,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
> > int crtc_disable_count = 0;
> >
> > drm_atomic_helper_update_legacy_modeset_state(dev, state);
> > + drm_atomic_helper_calc_timestamping_constants(state);
> >
> > dm_state = dm_atomic_get_new_state(state);
> > if (dm_state && dm_state->context) {
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > index 673e3fc282d9..45ee613c8efd 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -1115,9 +1115,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
> > * @old_state: atomic state object with old state structures
> > *
> > * This function updates all the various legacy modeset state pointers in
> > - * connectors, encoders and CRTCs. It also updates the timestamping constants
> > - * used for precise vblank timestamps by calling
> > - * drm_calc_timestamping_constants().
> > + * connectors, encoders and CRTCs.
> > *
> > * Drivers can use this for building their own atomic commit if they don't have
> > * a pure helper-based modeset implementation.
> > @@ -1187,8 +1185,6 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev,
> > crtc->y = new_plane_state->src_y >> 16;
> > }
> > }
> > -
> > - drm_atomic_helper_calc_timestamping_constants(old_state);
> > }
> > EXPORT_SYMBOL(drm_atomic_helper_update_legacy_modeset_state);
> >
> > @@ -1296,6 +1292,7 @@ void drm_atomic_helper_commit_modeset_disables(struct drm_device *dev,
> > disable_outputs(dev, old_state);
> >
> > drm_atomic_helper_update_legacy_modeset_state(dev, old_state);
> > + drm_atomic_helper_calc_timestamping_constants(old_state);
> >
> > crtc_set_mode(dev, old_state);
> > }
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > index ec148a8da2c2..035840ce3825 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -15578,6 +15578,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
> >
> > if (state->modeset) {
> > drm_atomic_helper_update_legacy_modeset_state(dev, &state->base);
> > + drm_atomic_helper_calc_timestamping_constants(&state->base);
> >
> > intel_set_cdclk_pre_plane_update(state);
> >
> > diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> > index 7799530e07c1..b6d1b926bc5e 100644
> > --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
> > +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> > @@ -2069,6 +2069,7 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
> > drm_atomic_helper_wait_for_fences(dev, state, false);
> > drm_atomic_helper_wait_for_dependencies(state);
> > drm_atomic_helper_update_legacy_modeset_state(dev, state);
> > + drm_atomic_helper_calc_timestamping_constants(state);
> >
> > if (atom->lock_core)
> > mutex_lock(&disp->mutex);
> > --
> > 2.26.2
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-09-14 20:16 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-07 12:00 [PATCH 1/3] drm/atomic-helper: Extract drm_atomic_helper_calc_timestamping_constants() Ville Syrjala
2020-09-07 12:00 ` [PATCH 2/3] drm/atomic-helper: Remove the timestamping constant update from drm_atomic_helper_update_legacy_modeset_state() Ville Syrjala
2020-09-07 18:12 ` [Intel-gfx] " Daniel Vetter
2020-09-14 20:16 ` Ville Syrjälä
2020-09-07 12:00 ` [PATCH 3/3] drm/i915: Drop the drm_atomic_helper_calc_timestamping_constants() call Ville Syrjala
2020-09-07 18:14 ` [Intel-gfx] " Daniel Vetter
2020-09-08 11:50 ` Ville Syrjälä
2020-09-07 18:08 ` [Intel-gfx] [PATCH 1/3] drm/atomic-helper: Extract drm_atomic_helper_calc_timestamping_constants() Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox