[Intel-gfx] [PATCH] drm/i915: use BLT ring for flips on IVB

2011-06-09 Thread Jesse Barnes
Found a couple more problems:
  1) MI_DISPLAY_FLIP should take a '1' in the last byte to indicate
 length on IVB
  2) apprently only the BLT ring version of the command actually causes
 interrupts to be generated

With this patch, modetest -v works on my test platform.  Clearly it's in
need of more splitting though.  The case statement should be split into
per-chipset flip command generation.

Signed-off-by: Jesse Barnes 
---
 drivers/gpu/drm/i915/intel_display.c |   21 -
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 81a9059..37d0087 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6343,9 +6343,11 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
/* Offset into the new buffer for cases of shared fbs between CRTCs */
offset = crtc->y * fb->pitch + crtc->x * fb->bits_per_pixel/8;
 
-   ret = BEGIN_LP_RING(4);
-   if (ret)
-   goto cleanup_objs;
+   if (!IS_IVYBRIDGE(dev)) {
+   ret = BEGIN_LP_RING(4);
+   if (ret)
+   goto cleanup_objs;
+   }
 
/* Block clients from rendering to the new back buffer until
 * the flip occurs and the object is no longer visible.
@@ -6390,7 +6392,6 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
break;
 
case 6:
-   case 7:
OUT_RING(MI_DISPLAY_FLIP |
 MI_DISPLAY_FLIP_PLANE(intel_crtc->plane));
OUT_RING(fb->pitch | obj->tiling_mode);
@@ -6400,8 +6401,18 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
pipesrc = I915_READ(PIPESRC(pipe)) & 0x0fff0fff;
OUT_RING(pf | pipesrc);
break;
+   case 7:
+   intel_ring_begin(&dev_priv->ring[BCS], 4);
+   intel_ring_emit(&dev_priv->ring[BCS], (MI_DISPLAY_FLIP_I915 | 
(intel_crtc->plane << 19)));
+   intel_ring_emit(&dev_priv->ring[BCS], (fb->pitch | 
obj->tiling_mode));
+   intel_ring_emit(&dev_priv->ring[BCS], (obj->gtt_offset));
+   intel_ring_emit(&dev_priv->ring[BCS], (MI_NOOP));
+   intel_ring_advance(&dev_priv->ring[BCS]);
+   break;
}
-   ADVANCE_LP_RING();
+
+   if (!IS_IVYBRIDGE(dev))
+   ADVANCE_LP_RING();
 
mutex_unlock(&dev->struct_mutex);
 
-- 
1.7.4.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] Properly decrement flip_count if we want to undo.

2011-06-09 Thread Stéphane Marchesin
---
 src/intel_display.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/intel_display.c b/src/intel_display.c
index b55b110..c9fdc59 100644
--- a/src/intel_display.c
+++ b/src/intel_display.c
@@ -1499,6 +1499,9 @@ intel_do_pageflip(intel_screen_private *intel,
 error_undo:
drmModeRmFB(mode->fd, mode->fb_id);
mode->fb_id = old_fb_id;
+   for (i = 0; i < config->num_crtc; i++)
+   if (config->crtc[i]->enabled)
+   mode->flip_count--;
 
 error_out:
xf86DrvMsg(scrn->scrnIndex, X_WARNING, "Page flip failed: %s\n",
-- 
1.7.5.3.367.ga9930

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] Test the first mode if there is no preferred mode.

2011-06-09 Thread Lan, Hai
This patch can make the testdisplay work if there is no preferred mode found. 
For example, 
if we use a 30 inch monitor(preferred mode is 2560x1600) with a single channel 
DVI cable, the driver will drop
the mode of 2560x1600. In this case testdisplay won't work because it can't 
find the preferred
Could anybody help to push this patch? Thanks.

Hai Lan

> -Original Message-
> From: intel-gfx-bounces+hai.lan=intel@lists.freedesktop.org
> [mailto:intel-gfx-bounces+hai.lan=intel@lists.freedesktop.org] On
> Behalf Of Lan, Hai
> Sent: Tuesday, May 31, 2011 5:47 PM
> To: Paul Menzel; intel-gfx@lists.freedesktop.org
> Subject: Re: [Intel-gfx] [PATCH] Test the first mode if there is no preferred
> mode.
> 
> Dear Paul
> Thanks for your advice. I am afraid there might be a i915 driver bug. We use
> the testdisplay to check the SDVO-TV and
> find the TV has no preferred mode. This will cause the testdisplay to quit. 
> So I
> write this patch to make the testdisplay to go on.
> 
> Hai Lan
> 
> > -Original Message-
> > From: intel-gfx-bounces+hai.lan=intel@lists.freedesktop.org
> > [mailto:intel-gfx-bounces+hai.lan=intel@lists.freedesktop.org] On
> > Behalf Of Paul Menzel
> > Sent: Tuesday, May 31, 2011 5:05 PM
> > To: intel-gfx@lists.freedesktop.org
> > Subject: Re: [Intel-gfx] [PATCH] Test the first mode if there is no 
> > preferred
> > mode.
> >
> > Dear Hai,
> >
> >
> > Am Dienstag, den 31.05.2011, 17:24 -0400 schrieb Hai Lan:
> > > For a TV device, there  might be no preferred mode.
> >
> > is that an error of the device or is this a driver “feature”?
> >
> > > In this case, we can test the first mode.
> >
> > Is a Signed-off-by line needed to get your patch accepted? You can add it
> > automatically passing `-s` to `git commit` or `git format-patch`.
> >
> > > ---
> > >  tests/testdisplay.c |   13 ++---
> > >  1 files changed, 10 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/tests/testdisplay.c b/tests/testdisplay.c index
> > > 41a5753..ef194fe 100644
> > > --- a/tests/testdisplay.c
> > > +++ b/tests/testdisplay.c
> > > @@ -280,9 +280,16 @@ static void
> > connector_find_preferred_mode(struct connector *c)
> > >   }
> > >
> > >   if (!c->mode_valid) {
> > > - fprintf(stderr, "failed to find any modes on connector %d\n",
> > > - c->id);
> > > - return;
> > > + if (connector->count_modes > 0) {
> > > + /* use the first mode as test mode */
> > > + c->mode = connector->modes[0];
> > > + c->mode_valid = 1;
> > > + }
> > > + else {
> > > + fprintf(stderr, "failed to find any modes on
> connector %d\n",
> > > + c->id);
> > > + return;
> > > + }
> > >   }
> > >
> > >   /* Now get the encoder */
> >
> > Reviewed-by: Paul Menzel 
> >
> >
> > Thanks,
> >
> > Paul
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx