* [PATCH] drm/i915: properly compute dp dithering for user-created modes
@ 2012-04-10 7:33 Daniel Vetter
2012-04-10 8:14 ` Chris Wilson
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Vetter @ 2012-04-10 7:33 UTC (permalink / raw)
To: Intel Graphics Development; +Cc: Daniel Vetter, DRI Development, stable
We've only computed whether we need to fall back to 6bpc due to dp
link bandwidth constrains in mode_valid, but not mode_fixup. Under
various circumstances X likes to create new modes which then lack
proper 6bpc flags (if required), resulting in mode_fixup failures and
ultimately black screens.
This is hopefully fixes the last regression fallout of the dp
bandwidth fixes.
The likely culprit for this regression is
commit 3d794f87238f74d80e78a7611c7fbde8a54c85c2
Author: Keith Packard <keithp@keithp.com>
Date: Wed Jan 25 08:16:25 2012 -0800
drm/i915: Force explicit bpp selection for intel_dp_link_required
Reported-and-tested-by: Brice Goglin <Brice.Goglin@ens-lyon.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48170
Cc: stable@kernel.org
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/gpu/drm/i915/intel_dp.c | 49 +++++++++++++++++++++++++++-----------
1 files changed, 35 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 110552f..065c26d 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -219,14 +219,38 @@ intel_dp_max_data_rate(int max_link_clock, int max_lanes)
return (max_link_clock * max_lanes * 8) / 10;
}
+static bool
+intel_dp_adjust_dithering(struct intel_dp *intel_dp,
+ struct drm_display_mode *mode,
+ struct drm_display_mode *adjusted_mode)
+{
+ int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp));
+ int max_lanes = intel_dp_max_lane_count(intel_dp);
+ int max_rate, mode_rate;
+
+ mode_rate = intel_dp_link_required(mode->clock, 24);
+ max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);
+
+ if (mode_rate > max_rate) {
+ mode_rate = intel_dp_link_required(mode->clock, 18);
+ if (mode_rate > max_rate)
+ return false;
+
+ if (adjusted_mode)
+ adjusted_mode->private_flags
+ |= INTEL_MODE_DP_FORCE_6BPC;
+
+ return true;
+ }
+
+ return true;
+}
+
static int
intel_dp_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
{
struct intel_dp *intel_dp = intel_attached_dp(connector);
- int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp));
- int max_lanes = intel_dp_max_lane_count(intel_dp);
- int max_rate, mode_rate;
if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) {
if (mode->hdisplay > intel_dp->panel_fixed_mode->hdisplay)
@@ -236,16 +260,8 @@ intel_dp_mode_valid(struct drm_connector *connector,
return MODE_PANEL;
}
- mode_rate = intel_dp_link_required(mode->clock, 24);
- max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);
-
- if (mode_rate > max_rate) {
- mode_rate = intel_dp_link_required(mode->clock, 18);
- if (mode_rate > max_rate)
- return MODE_CLOCK_HIGH;
- else
- mode->private_flags |= INTEL_MODE_DP_FORCE_6BPC;
- }
+ if (!intel_dp_adjust_dithering(intel_dp, mode, NULL))
+ return MODE_CLOCK_HIGH;
if (mode->clock < 10000)
return MODE_CLOCK_LOW;
@@ -672,7 +688,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode,
int lane_count, clock;
int max_lane_count = intel_dp_max_lane_count(intel_dp);
int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0;
- int bpp = mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24;
+ int bpp;
static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 };
if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) {
@@ -686,6 +702,11 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode,
mode->clock = intel_dp->panel_fixed_mode->clock;
}
+ if (!intel_dp_adjust_dithering(intel_dp, mode, adjusted_mode))
+ return false;
+
+ bpp = adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24;
+
for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) {
for (clock = 0; clock <= max_clock; clock++) {
int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count);
--
1.7.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/i915: properly compute dp dithering for user-created modes
2012-04-10 7:33 [PATCH] drm/i915: properly compute dp dithering for user-created modes Daniel Vetter
@ 2012-04-10 8:14 ` Chris Wilson
2012-04-10 8:36 ` Daniel Vetter
0 siblings, 1 reply; 7+ messages in thread
From: Chris Wilson @ 2012-04-10 8:14 UTC (permalink / raw)
To: Intel Graphics Development; +Cc: Daniel Vetter, stable, DRI Development
On Tue, 10 Apr 2012 09:33:19 +0200, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> We've only computed whether we need to fall back to 6bpc due to dp
> link bandwidth constrains in mode_valid, but not mode_fixup. Under
> various circumstances X likes to create new modes which then lack
> proper 6bpc flags (if required), resulting in mode_fixup failures and
> ultimately black screens.
>
> This is hopefully fixes the last regression fallout of the dp
> bandwidth fixes.
Based on my reading, this still leaves the issue of depth > 24 modes as
the upper bandwidth required is calculated on the presumption of
depth == 24, but the divider set to the fb depth in the normal case.
> The likely culprit for this regression is
>
> commit 3d794f87238f74d80e78a7611c7fbde8a54c85c2
> Author: Keith Packard <keithp@keithp.com>
> Date: Wed Jan 25 08:16:25 2012 -0800
>
> drm/i915: Force explicit bpp selection for intel_dp_link_required
>
> Reported-and-tested-by: Brice Goglin <Brice.Goglin@ens-lyon.org>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48170
> Cc: stable@kernel.org
> Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> drivers/gpu/drm/i915/intel_dp.c | 49 +++++++++++++++++++++++++++-----------
> 1 files changed, 35 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 110552f..065c26d 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -219,14 +219,38 @@ intel_dp_max_data_rate(int max_link_clock, int max_lanes)
> return (max_link_clock * max_lanes * 8) / 10;
> }
>
> +static bool
> +intel_dp_adjust_dithering(struct intel_dp *intel_dp,
> + struct drm_display_mode *mode,
> + struct drm_display_mode *adjusted_mode)
> +{
> + int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp));
> + int max_lanes = intel_dp_max_lane_count(intel_dp);
> + int max_rate, mode_rate;
> +
> + mode_rate = intel_dp_link_required(mode->clock, 24);
> + max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);
> +
> + if (mode_rate > max_rate) {
> + mode_rate = intel_dp_link_required(mode->clock, 18);
Cut'n'paste bad whitespace.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] drm/i915: properly compute dp dithering for user-created modes
2012-04-10 8:14 ` Chris Wilson
@ 2012-04-10 8:36 ` Daniel Vetter
2012-04-10 8:42 ` Daniel Vetter
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Vetter @ 2012-04-10 8:36 UTC (permalink / raw)
To: Intel Graphics Development; +Cc: Daniel Vetter, DRI Development, stable
We've only computed whether we need to fall back to 6bpc due to dp
link bandwidth constrains in mode_valid, but not mode_fixup. Under
various circumstances X likes to create new modes which then lack
proper 6bpc flags (if required), resulting in mode_fixup failures and
ultimately black screens.
Chris Wilson pointed out that we still get things wrong for bpp > 24,
but that should be fixed in another patch (and it'll be easier because
this patch consolidates the logic).
The likely culprit for this regression is
commit 3d794f87238f74d80e78a7611c7fbde8a54c85c2
Author: Keith Packard <keithp@keithp.com>
Date: Wed Jan 25 08:16:25 2012 -0800
drm/i915: Force explicit bpp selection for intel_dp_link_required
v2: Fix indentation and tune down the too bold claim that this should
fix the world. Both noticed by Chris Wilson.
Reported-and-tested-by: Brice Goglin <Brice.Goglin@ens-lyon.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48170
Cc: stable@kernel.org
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/gpu/drm/i915/intel_dp.c | 49 +++++++++++++++++++++++++++-----------
1 files changed, 35 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 110552f..065c26d 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -219,14 +219,38 @@ intel_dp_max_data_rate(int max_link_clock, int max_lanes)
return (max_link_clock * max_lanes * 8) / 10;
}
+static bool
+intel_dp_adjust_dithering(struct intel_dp *intel_dp,
+ struct drm_display_mode *mode,
+ struct drm_display_mode *adjusted_mode)
+{
+ int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp));
+ int max_lanes = intel_dp_max_lane_count(intel_dp);
+ int max_rate, mode_rate;
+
+ mode_rate = intel_dp_link_required(mode->clock, 24);
+ max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);
+
+ if (mode_rate > max_rate) {
+ mode_rate = intel_dp_link_required(mode->clock, 18);
+ if (mode_rate > max_rate)
+ return false;
+
+ if (adjusted_mode)
+ adjusted_mode->private_flags
+ |= INTEL_MODE_DP_FORCE_6BPC;
+
+ return true;
+ }
+
+ return true;
+}
+
static int
intel_dp_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
{
struct intel_dp *intel_dp = intel_attached_dp(connector);
- int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp));
- int max_lanes = intel_dp_max_lane_count(intel_dp);
- int max_rate, mode_rate;
if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) {
if (mode->hdisplay > intel_dp->panel_fixed_mode->hdisplay)
@@ -236,16 +260,8 @@ intel_dp_mode_valid(struct drm_connector *connector,
return MODE_PANEL;
}
- mode_rate = intel_dp_link_required(mode->clock, 24);
- max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);
-
- if (mode_rate > max_rate) {
- mode_rate = intel_dp_link_required(mode->clock, 18);
- if (mode_rate > max_rate)
- return MODE_CLOCK_HIGH;
- else
- mode->private_flags |= INTEL_MODE_DP_FORCE_6BPC;
- }
+ if (!intel_dp_adjust_dithering(intel_dp, mode, NULL))
+ return MODE_CLOCK_HIGH;
if (mode->clock < 10000)
return MODE_CLOCK_LOW;
@@ -672,7 +688,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode,
int lane_count, clock;
int max_lane_count = intel_dp_max_lane_count(intel_dp);
int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0;
- int bpp = mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24;
+ int bpp;
static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 };
if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) {
@@ -686,6 +702,11 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode,
mode->clock = intel_dp->panel_fixed_mode->clock;
}
+ if (!intel_dp_adjust_dithering(intel_dp, mode, adjusted_mode))
+ return false;
+
+ bpp = adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24;
+
for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) {
for (clock = 0; clock <= max_clock; clock++) {
int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count);
--
1.7.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] drm/i915: properly compute dp dithering for user-created modes
2012-04-10 8:36 ` Daniel Vetter
@ 2012-04-10 8:42 ` Daniel Vetter
2012-04-10 13:46 ` Adam Jackson
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Vetter @ 2012-04-10 8:42 UTC (permalink / raw)
To: Intel Graphics Development; +Cc: Daniel Vetter, DRI Development, stable
We've only computed whether we need to fall back to 6bpc due to dp
link bandwidth constrains in mode_valid, but not mode_fixup. Under
various circumstances X likes to create new modes which then lack
proper 6bpc flags (if required), resulting in mode_fixup failures and
ultimately black screens.
Chris Wilson pointed out that we still get things wrong for bpp > 24,
but that should be fixed in another patch (and it'll be easier because
this patch consolidates the logic).
The likely culprit for this regression is
commit 3d794f87238f74d80e78a7611c7fbde8a54c85c2
Author: Keith Packard <keithp@keithp.com>
Date: Wed Jan 25 08:16:25 2012 -0800
drm/i915: Force explicit bpp selection for intel_dp_link_required
v2: Fix indentation and tune down the too bold claim that this should
fix the world. Both noticed by Chris Wilson.
v3: Try to really git add things.
Reported-and-tested-by: Brice Goglin <Brice.Goglin@ens-lyon.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48170
Cc: stable@kernel.org
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/gpu/drm/i915/intel_dp.c | 49 +++++++++++++++++++++++++++-----------
1 files changed, 35 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 110552f..4b63791 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -219,14 +219,38 @@ intel_dp_max_data_rate(int max_link_clock, int max_lanes)
return (max_link_clock * max_lanes * 8) / 10;
}
+static bool
+intel_dp_adjust_dithering(struct intel_dp *intel_dp,
+ struct drm_display_mode *mode,
+ struct drm_display_mode *adjusted_mode)
+{
+ int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp));
+ int max_lanes = intel_dp_max_lane_count(intel_dp);
+ int max_rate, mode_rate;
+
+ mode_rate = intel_dp_link_required(mode->clock, 24);
+ max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);
+
+ if (mode_rate > max_rate) {
+ mode_rate = intel_dp_link_required(mode->clock, 18);
+ if (mode_rate > max_rate)
+ return false;
+
+ if (adjusted_mode)
+ adjusted_mode->private_flags
+ |= INTEL_MODE_DP_FORCE_6BPC;
+
+ return true;
+ }
+
+ return true;
+}
+
static int
intel_dp_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
{
struct intel_dp *intel_dp = intel_attached_dp(connector);
- int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp));
- int max_lanes = intel_dp_max_lane_count(intel_dp);
- int max_rate, mode_rate;
if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) {
if (mode->hdisplay > intel_dp->panel_fixed_mode->hdisplay)
@@ -236,16 +260,8 @@ intel_dp_mode_valid(struct drm_connector *connector,
return MODE_PANEL;
}
- mode_rate = intel_dp_link_required(mode->clock, 24);
- max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);
-
- if (mode_rate > max_rate) {
- mode_rate = intel_dp_link_required(mode->clock, 18);
- if (mode_rate > max_rate)
- return MODE_CLOCK_HIGH;
- else
- mode->private_flags |= INTEL_MODE_DP_FORCE_6BPC;
- }
+ if (!intel_dp_adjust_dithering(intel_dp, mode, NULL))
+ return MODE_CLOCK_HIGH;
if (mode->clock < 10000)
return MODE_CLOCK_LOW;
@@ -672,7 +688,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode,
int lane_count, clock;
int max_lane_count = intel_dp_max_lane_count(intel_dp);
int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0;
- int bpp = mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24;
+ int bpp;
static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 };
if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) {
@@ -686,6 +702,11 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode,
mode->clock = intel_dp->panel_fixed_mode->clock;
}
+ if (!intel_dp_adjust_dithering(intel_dp, mode, adjusted_mode))
+ return false;
+
+ bpp = adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24;
+
for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) {
for (clock = 0; clock <= max_clock; clock++) {
int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count);
--
1.7.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/i915: properly compute dp dithering for user-created modes
2012-04-10 8:42 ` Daniel Vetter
@ 2012-04-10 13:46 ` Adam Jackson
2012-04-10 17:23 ` Daniel Vetter
2012-04-10 17:26 ` [Intel-gfx] " Keith Packard
0 siblings, 2 replies; 7+ messages in thread
From: Adam Jackson @ 2012-04-10 13:46 UTC (permalink / raw)
To: Daniel Vetter; +Cc: Intel Graphics Development, DRI Development, stable
On 4/10/12 4:42 AM, Daniel Vetter wrote:
> We've only computed whether we need to fall back to 6bpc due to dp
> link bandwidth constrains in mode_valid, but not mode_fixup. Under
> various circumstances X likes to create new modes which then lack
> proper 6bpc flags (if required), resulting in mode_fixup failures and
> ultimately black screens.
>
> Chris Wilson pointed out that we still get things wrong for bpp > 24,
> but that should be fixed in another patch (and it'll be easier because
> this patch consolidates the logic).
Certainly an improvement.
Reviewed-by: Adam Jackson <ajax@redhat.com>
- ajax
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/i915: properly compute dp dithering for user-created modes
2012-04-10 13:46 ` Adam Jackson
@ 2012-04-10 17:23 ` Daniel Vetter
2012-04-10 17:26 ` [Intel-gfx] " Keith Packard
1 sibling, 0 replies; 7+ messages in thread
From: Daniel Vetter @ 2012-04-10 17:23 UTC (permalink / raw)
To: Adam Jackson
Cc: Daniel Vetter, Intel Graphics Development, DRI Development,
stable
On Tue, Apr 10, 2012 at 09:46:53AM -0400, Adam Jackson wrote:
> On 4/10/12 4:42 AM, Daniel Vetter wrote:
> >We've only computed whether we need to fall back to 6bpc due to dp
> >link bandwidth constrains in mode_valid, but not mode_fixup. Under
> >various circumstances X likes to create new modes which then lack
> >proper 6bpc flags (if required), resulting in mode_fixup failures and
> >ultimately black screens.
> >
> >Chris Wilson pointed out that we still get things wrong for bpp > 24,
> >but that should be fixed in another patch (and it'll be easier because
> >this patch consolidates the logic).
>
> Certainly an improvement.
>
> Reviewed-by: Adam Jackson <ajax@redhat.com>
I've picked this up for -fixes, thanks for the review.
-Daniel
--
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915: properly compute dp dithering for user-created modes
2012-04-10 13:46 ` Adam Jackson
2012-04-10 17:23 ` Daniel Vetter
@ 2012-04-10 17:26 ` Keith Packard
1 sibling, 0 replies; 7+ messages in thread
From: Keith Packard @ 2012-04-10 17:26 UTC (permalink / raw)
To: Adam Jackson, Daniel Vetter
Cc: Intel Graphics Development, stable, DRI Development
<#part sign=pgpmime>
On Tue, 10 Apr 2012 09:46:53 -0400, Adam Jackson <ajax@redhat.com> wrote:
> Certainly an improvement.
>
> Reviewed-by: Adam Jackson <ajax@redhat.com>
I'd like to know if this actually helps someone before I stick it in
drm-intel-fixes...
--
keith.packard@intel.com
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-04-10 17:26 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-10 7:33 [PATCH] drm/i915: properly compute dp dithering for user-created modes Daniel Vetter
2012-04-10 8:14 ` Chris Wilson
2012-04-10 8:36 ` Daniel Vetter
2012-04-10 8:42 ` Daniel Vetter
2012-04-10 13:46 ` Adam Jackson
2012-04-10 17:23 ` Daniel Vetter
2012-04-10 17:26 ` [Intel-gfx] " Keith Packard
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.