From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 06/18] drm/i915: Fill in more crtc state.
Date: Thu, 2 Jul 2015 16:36:50 +0200 [thread overview]
Message-ID: <1435847822-5318-7-git-send-email-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <1435847822-5318-1-git-send-email-maarten.lankhorst@linux.intel.com>
Perform a full readout of the state by making sure the mode is set
up correctly atomically.
Also there was a small memory leak by doing the memset, fix this
by calling __drm_atomic_helper_crtc_destroy_state first.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 39 ++++++++++++++++--------------------
drivers/gpu/drm/i915/intel_fbdev.c | 9 ++-------
2 files changed, 19 insertions(+), 29 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index a3f9080828bd..34d756250c76 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -15229,6 +15229,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
{
struct drm_device *dev = crtc->base.dev;
struct drm_i915_private *dev_priv = dev->dev_private;
+ struct intel_crtc_state *pipe_config = to_intel_crtc_state(crtc->base.state);
struct intel_encoder *encoder;
u32 reg;
bool enable;
@@ -15237,9 +15238,20 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
reg = PIPECONF(crtc->config->cpu_transcoder);
I915_WRITE(reg, I915_READ(reg) & ~PIPECONF_FRAME_START_DELAY_MASK);
+ memset(&crtc->base.mode, 0, sizeof(crtc->base.mode));
+ if (pipe_config->base.active) {
+ intel_mode_from_pipe_config(&crtc->base.mode, pipe_config);
+ intel_mode_from_pipe_config(&pipe_config->base.adjusted_mode, pipe_config);
+ crtc->base.hwmode = pipe_config->base.adjusted_mode;
+
+ WARN_ON(drm_atomic_set_mode_for_crtc(&pipe_config->base, &crtc->base.mode) < 0);
+ } else
+ WARN_ON(drm_atomic_set_mode_for_crtc(&pipe_config->base, NULL) < 0);
+
/* restore vblank interrupts to correct state */
drm_crtc_vblank_reset(&crtc->base);
if (crtc->active) {
+ drm_calc_timestamping_constants(&crtc->base, &crtc->base.hwmode);
update_scanline_offset(crtc);
drm_crtc_vblank_on(&crtc->base);
}
@@ -15292,9 +15304,8 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
crtc->base.state->enable ? "enabled" : "disabled",
crtc->active ? "enabled" : "disabled");
- crtc->base.state->enable = crtc->active;
- crtc->base.state->active = crtc->active;
- crtc->base.enabled = crtc->active;
+ crtc->base.enabled = crtc->base.state->active = crtc->active;
+ WARN_ON(drm_atomic_set_mode_for_crtc(&pipe_config->base, NULL) < 0);
/* Because we only establish the connector -> encoder ->
* crtc links if something is active, this means the
@@ -15467,6 +15478,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
int i;
for_each_intel_crtc(dev, crtc) {
+ __drm_atomic_helper_crtc_destroy_state(&crtc->base, crtc->base.state);
memset(crtc->config, 0, sizeof(*crtc->config));
crtc->config->base.crtc = &crtc->base;
@@ -15475,10 +15487,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
crtc->active = dev_priv->display.get_pipe_config(crtc,
crtc->config);
- crtc->base.state->enable = crtc->active;
- crtc->base.state->active = crtc->active;
- crtc->base.enabled = crtc->active;
- crtc->base.hwmode = crtc->config->base.adjusted_mode;
+ crtc->base.enabled = crtc->base.state->active = crtc->active;
+ WARN_ON(drm_atomic_set_mode_for_crtc(crtc->base.state, NULL) < 0);
readout_plane_state(crtc, to_intel_crtc_state(crtc->base.state));
@@ -15556,21 +15566,6 @@ void intel_modeset_setup_hw_state(struct drm_device *dev,
intel_modeset_readout_hw_state(dev);
- /*
- * Now that we have the config, copy it to each CRTC struct
- * Note that this could go away if we move to using crtc_config
- * checking everywhere.
- */
- for_each_intel_crtc(dev, crtc) {
- if (crtc->active && i915.fastboot) {
- intel_mode_from_pipe_config(&crtc->base.mode,
- crtc->config);
- DRM_DEBUG_KMS("[CRTC:%d] found active mode: ",
- crtc->base.base.id);
- drm_mode_debug_printmodeline(&crtc->base.mode);
- }
- }
-
/* HW state is read out, now we need to sanitize this mess. */
for_each_intel_encoder(dev, encoder) {
intel_sanitize_encoder(encoder);
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 3d5bb56477ab..52d20cea182c 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -486,16 +486,11 @@ retry:
* config, not the input mode, which is what crtc->mode
* usually contains. But since our current fastboot
* code puts a mode derived from the post-pfit timings
- * into crtc->mode this works out correctly. We don't
- * use hwmode anywhere right now, so use it for this
- * since the fb helper layer wants a pointer to
- * something we own.
+ * into crtc->mode this works out correctly.
*/
DRM_DEBUG_KMS("looking for current mode on connector %s\n",
connector->name);
- intel_mode_from_pipe_config(&encoder->crtc->hwmode,
- to_intel_crtc(encoder->crtc)->config);
- modes[i] = &encoder->crtc->hwmode;
+ modes[i] = &encoder->crtc->mode;
}
crtcs[i] = new_crtc;
--
2.1.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-07-02 14:37 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-02 14:36 [PATCH 00/18] Convert to atomic, part 4 Maarten Lankhorst
2015-07-02 14:36 ` [PATCH 01/18] drm/atomic: add connectors_changed to separate it from mode_changed Maarten Lankhorst
2015-07-02 14:36 ` [PATCH 02/18] drm/i915: Fix noatomic crtc disabling Maarten Lankhorst
2015-07-02 14:36 ` [PATCH 03/18] drm/i915: Do not update pfit state when toggling crtc enabled Maarten Lankhorst
2015-07-02 14:36 ` [PATCH 04/18] drm/i915: Do not use plane_config in intel_fbdev.c Maarten Lankhorst
2015-07-02 14:36 ` [PATCH 05/18] drm/i915: Allow fuzzy matching in pipe_config_compare Maarten Lankhorst
2015-07-02 14:36 ` Maarten Lankhorst [this message]
2015-07-02 14:36 ` [PATCH 07/18] drm/i915: fill in more mode members Maarten Lankhorst
2015-07-02 14:36 ` [PATCH 08/18] drm/i915: Rework primary plane stuff slightly Maarten Lankhorst
2015-07-02 14:36 ` [PATCH 09/18] drm/i915: Convert suspend/resume to atomic Maarten Lankhorst
2015-07-02 14:36 ` [PATCH 10/18] drm/i915: Update power domains on readout Maarten Lankhorst
2015-07-02 14:36 ` [PATCH 11/18] drm/i915: skip modeset if compatible, and enable fastboot for everyone Maarten Lankhorst
2015-07-02 14:36 ` [PATCH 12/18] drm/i915: Always reset in intel_crtc_restore_mode Maarten Lankhorst
2015-07-02 14:36 ` [PATCH 13/18] drm/i915: Make intel_display_suspend atomic, try 2 Maarten Lankhorst
2015-07-02 14:36 ` [PATCH 14/18] drm/i915: Use full atomic modeset Maarten Lankhorst
2015-07-02 14:36 ` [PATCH 15/18] drm/i915: Call plane update functions directly from intel_atomic_commit Maarten Lankhorst
2015-07-02 14:37 ` [PATCH 16/18] drm/i915: always disable irqs in intel_pipe_update_start Maarten Lankhorst
2015-07-02 14:37 ` [PATCH 17/18] drm/i915: Only commit planes on crtc's that have changed planes Maarten Lankhorst
2015-07-02 14:37 ` [PATCH 18/18] drm/i915: Remove use of runtime pm in atomic commit functions Maarten Lankhorst
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1435847822-5318-7-git-send-email-maarten.lankhorst@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox