[Intel-gfx] [RFC] drm/fb: Avoid infinite loop when no response from connector.
Chris Wilson
chris at chris-wilson.co.uk
Fri Feb 17 12:53:06 UTC 2017
On Fri, Feb 17, 2017 at 01:40:38PM +0100, Arkadiusz Hiler wrote:
> On Fri, Feb 17, 2017 at 11:17:46AM +0100, Tomasz Lis wrote:
> > This fixes an old patch so it doesn't cause infinite retries:
> > drm/fb: add support for tiled monitor configurations.
> >
> > The max count of iterations, 0xa10070f, was carefully selected based on the fact
> > that it looks cool.
> > ---
> > drivers/gpu/drm/drm_fb_helper.c | 4 +++-
> > drivers/gpu/drm/i915/intel_fbdev.c | 5 ++++-
> > 2 files changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
>
> Change to that file should go through dri-devel.
>
> > index 0dd5da8..8e6c535 100644
> > --- a/drivers/gpu/drm/drm_fb_helper.c
> > +++ b/drivers/gpu/drm/drm_fb_helper.c
> > @@ -2011,7 +2011,9 @@ static bool drm_target_preferred(struct drm_fb_helper *fb_helper,
> >
> > if ((conn_configured & mask) != mask) {
> > tile_pass++;
> > - goto retry;
> > + if (tile_pass < 0xa10070f)
>
> Can we have this named? Also it could be more sensible to go with
> something representing order of how many retries we want rather than
> going full wizard on it?
A more suitable approach might be:
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 041322fef607..32d0af6b07a7 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -348,7 +348,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
bool *enabled, int width, int height)
{
struct drm_i915_private *dev_priv = to_i915(fb_helper->dev);
- unsigned long conn_configured, mask;
+ unsigned long conn_configured, conn_seq, mask;
unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG);
int i, j;
bool *save_enabled;
@@ -365,6 +365,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
mask = GENMASK(count - 1, 0);
conn_configured = 0;
retry:
+ conn_seq = conn_configured;
for (i = 0; i < count; i++) {
struct drm_fb_helper_connector *fb_conn;
struct drm_connector *connector;
@@ -489,10 +490,8 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
conn_configured |= BIT(i);
}
- if ((conn_configured & mask) != mask) {
- pass++;
+ if ((conn_configured & mask) != mask && conn_configured != conn_seq)
goto retry;
- }
/*
* If the BIOS didn't enable everything it could, fall back to have the
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list