Re: [Intel-gfx] [PATCH] io-mapping: Fixup for different names of writecombine

2016-08-23 Thread Joonas Lahtinen
On ti, 2016-08-23 at 22:22 +0200, Daniel Vetter wrote:
> Somehow architectures can't agree on this. And for good measure make
> sure we have a fallback which should work everywhere (fingers
> crossed).
> 
> This is to fix a compile fail on microblaze in gpiolib-of.c, which
> misguidedly includes io-mapping.h (instead of screaming at whichever
> achitecture doesn't correctly pull in asm/io.h from linux/io.h).
> 
> Not tested since there's no reasonable way to get at microblaze
> toolchains :(
> 
> Fixes: ac96b5566926 ("io-mapping.h: s/PAGE_KERNEL_IO/PAGE_KERNEL/")
> Cc: Chris Wilson 
> Cc: Daniel Vetter 
> Cc: Joonas Lahtinen 
> Cc: linux...@kvack.org
> Signed-off-by: Daniel Vetter 
> ---
>  include/linux/io-mapping.h | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
> index a87dd7fffc0a..f4e33756c09c 100644
> --- a/include/linux/io-mapping.h
> +++ b/include/linux/io-mapping.h
> @@ -123,7 +123,13 @@ io_mapping_init_wc(struct io_mapping *iomap,
>   iomap->base = base;
>   iomap->size = size;
>   iomap->iomem = ioremap_wc(base, size);
> +#ifdef pgprot_noncached_wc /* archs can't agree on a name ... */
> + iomap->prot = pgprot_noncached_wc(PAGE_KERNEL);
> +#elif pgprot_writecombine

Maybe you meant #elif defined pgprot_writecombine?

Regards, Joonas

>   iomap->prot = pgprot_writecombine(PAGE_KERNEL);
> +#else
> + iomap->prot = pgprot_noncached(PAGE_KERNEL);
> +#endif
>  
>   return iomap;
>  }
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/2] drm/i915/fbc: Allow on unfenced surfaces, for recent gen

2016-08-23 Thread Chris Wilson
On Mon, Aug 22, 2016 at 09:39:17PM -0300, Paulo Zanoni wrote:
> 2016-08-18 5:21 GMT-03:00 Chris Wilson :
> > Only fbc1 is tied to using a fence. Later iterations of fbc are more
> > flexible and allow operation on unfenced frontbuffers.
> >
> > Signed-off-by: Chris Wilson 
> > Cc: Daniel Vetter 
> > Cc: "Zanoni, Paulo R" 
> 
> Hi
> 
> I see this patch was applied. Now, on my Skylake machine, if I boot
> with i915.enable_fbc=1 I'll get FIFO underruns under fbcon. Just
> booting already gives me a FIFO underrun message, and then if I "sudo
> systemctl stop lightdm" I'll get a constantly-blinking screen.
> 
> Of course, applying the patch that disables FBC after a FIFO underrun
> will help stopping the ever-blinking fbcon, but I think we should try
> to avoid the underruns in the places we know we can, and leave the
> "disable FBC on FIFO underruns" just for the cases we're not expecting.
> 
> Also, please remember that I mentioned there are FBC workarounds for
> untiled that we still don't implement (although when I re-read my
> email it may sound like I suggested the workarounds are for non-GTT
> tracking). IMHO this argument alone should
> have prevented this patch from being merged...
> 
> Based on that, can we please revert this patch? I'm afraid some people
> would consider these underruns as blockers to enabling FBC, so it's
> probably better to enable FBC only on X tiled for now, and leave this
> for when we know how to prevent the underrun (possibly by implementing
> the missing WAs).

Sure you can disable FBC - just note that typically framebuffers will be
unfenced.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v3 1/4] drm/i915: Store port enum in intel_encoder

2016-08-23 Thread Pandiyan, Dhinakaran
On Wed, 2016-08-24 at 08:08 +0200, Daniel Vetter wrote:
> On Tue, Aug 23, 2016 at 01:49:17PM -0700, Dhinakaran Pandiyan wrote:
> > Storing the port enum in intel_encoder makes it convenient to know the
> > port attached to an encoder. Moving the port information up from
> > intel_digital_port to intel_encoder avoids unecessary intel_digital_port
> > access and handles MST encoders cleanly without requiring conditional
> > checks for them (thanks danvet).
> > 
> > Signed-off-by: Dhinakaran Pandiyan 
> > Cc: Daniel Vetter 
> > Cc: Ville Syrjälä 
> > ---
> >  drivers/gpu/drm/i915/i915_drv.h | 1 +
> >  drivers/gpu/drm/i915/intel_ddi.c| 1 +
> >  drivers/gpu/drm/i915/intel_dp.c | 1 +
> >  drivers/gpu/drm/i915/intel_dp_mst.c | 1 +
> >  drivers/gpu/drm/i915/intel_drv.h| 1 +
> >  drivers/gpu/drm/i915/intel_dsi.c| 1 +
> >  drivers/gpu/drm/i915/intel_dvo.c| 2 ++
> >  drivers/gpu/drm/i915/intel_hdmi.c   | 1 +
> >  drivers/gpu/drm/i915/intel_lvds.c   | 3 ++-
> >  drivers/gpu/drm/i915/intel_tv.c | 2 ++
> >  10 files changed, 13 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h 
> > b/drivers/gpu/drm/i915/i915_drv.h
> > index 9cd102c..60e282d5 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -185,6 +185,7 @@ enum plane {
> >  #define sprite_name(p, s) ((p) * INTEL_INFO(dev)->num_sprites[(p)] + (s) + 
> > 'A')
> >  
> >  enum port {
> > +   PORT_NONE = -1,
> > PORT_A = 0,
> > PORT_B,
> > PORT_C,
> > diff --git a/drivers/gpu/drm/i915/intel_ddi.c 
> > b/drivers/gpu/drm/i915/intel_ddi.c
> > index c2df4e4..086de39 100644
> > --- a/drivers/gpu/drm/i915/intel_ddi.c
> > +++ b/drivers/gpu/drm/i915/intel_ddi.c
> > @@ -2426,6 +2426,7 @@ void intel_ddi_init(struct drm_device *dev, enum port 
> > port)
> > intel_dig_port->max_lanes = max_lanes;
> >  
> > intel_encoder->type = INTEL_OUTPUT_UNKNOWN;
> > +   intel_encoder->attached_port = port;
> > intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
> > intel_encoder->cloneable = 0;
> >  
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c 
> > b/drivers/gpu/drm/i915/intel_dp.c
> > index 364db90..4771428 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -5726,6 +5726,7 @@ bool intel_dp_init(struct drm_device *dev,
> > intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
> > }
> > intel_encoder->cloneable = 0;
> > +   intel_encoder->attached_port = port;
> >  
> > intel_dig_port->hpd_pulse = intel_dp_hpd_pulse;
> > dev_priv->hotplug.irq_port[port] = intel_dig_port;
> > diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c 
> > b/drivers/gpu/drm/i915/intel_dp_mst.c
> > index 629337d..a51f6f7 100644
> > --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> > +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> > @@ -540,6 +540,7 @@ intel_dp_create_fake_mst_encoder(struct 
> > intel_digital_port *intel_dig_port, enum
> >  DRM_MODE_ENCODER_DPMST, "DP-MST %c", pipe_name(pipe));
> >  
> > intel_encoder->type = INTEL_OUTPUT_DP_MST;
> > +   intel_encoder->attached_port = intel_dig_port->port;
> > intel_encoder->crtc_mask = 0x7;
> > intel_encoder->cloneable = 0;
> >  
> > diff --git a/drivers/gpu/drm/i915/intel_drv.h 
> > b/drivers/gpu/drm/i915/intel_drv.h
> > index 1c700b0..101d671 100644
> > --- a/drivers/gpu/drm/i915/intel_drv.h
> > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > @@ -202,6 +202,7 @@ struct intel_encoder {
> > struct drm_encoder base;
> >  
> > enum intel_output_type type;
> > +   enum port attached_port;
> 
> Why the attached_ prefix? The intel_encoder _is_ the port (more or less at
> least). Also intel_sdvo.c is missing. Otherwise I think it makes sense.
> -Daniel
> 
> 

I didn't realize that, will change. 

> > unsigned int cloneable;
> > void (*hot_plug)(struct intel_encoder *);
> > bool (*compute_config)(struct intel_encoder *,
> > diff --git a/drivers/gpu/drm/i915/intel_dsi.c 
> > b/drivers/gpu/drm/i915/intel_dsi.c
> > index de8e9fb..293e530 100644
> > --- a/drivers/gpu/drm/i915/intel_dsi.c
> > +++ b/drivers/gpu/drm/i915/intel_dsi.c
> > @@ -1478,6 +1478,7 @@ void intel_dsi_init(struct drm_device *dev)
> >  
> > intel_connector->get_hw_state = intel_connector_get_hw_state;
> >  
> > +   intel_encoder->attached_port = port;
> > /*
> >  * On BYT/CHV, pipe A maps to MIPI DSI port A, pipe B maps to MIPI DSI
> >  * port C. BXT isn't limited like this.
> > diff --git a/drivers/gpu/drm/i915/intel_dvo.c 
> > b/drivers/gpu/drm/i915/intel_dvo.c
> > index 47bdf9d..86a888f 100644
> > --- a/drivers/gpu/drm/i915/intel_dvo.c
> > +++ b/drivers/gpu/drm/i915/intel_dvo.c
> > @@ -511,7 +511,9 @@ void intel_dvo_init(struct drm_device *dev)
> >  "DVO %c", intel_dvo_port_name(dvo->dvo_reg));
> >  
> > intel_encoder->type = INTEL_OUTPUT_DVO;
> > +   intel_encoder->attached_port = PORT_NONE;

[Intel-gfx] [PATCH v2] drm: Add reference counting to drm_atomic_state

2016-08-23 Thread Chris Wilson
drm_atomic_state has a complicated single owner model that tracks the
single reference from allocation through to destruction on another
thread - or perhaps on a local error path. We can simplify this tracking
by using reference counting (at a cost of a few more atomics). This is
even more beneficial when the lifetime of the state becomes more
convoluted than being passed to a single worker thread for the commit.

v2: Double check !intel atomic_commit functions for missing gets

Signed-off-by: Chris Wilson 
Cc: Daniel Vetter 
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c |  3 +-
 drivers/gpu/drm/drm_atomic.c | 23 +++
 drivers/gpu/drm/drm_atomic_helper.c  | 98 +++-
 drivers/gpu/drm/drm_fb_helper.c  |  9 +--
 drivers/gpu/drm/exynos/exynos_drm_drv.c  |  3 +-
 drivers/gpu/drm/i915/i915_debugfs.c  |  3 +-
 drivers/gpu/drm/i915/intel_display.c | 32 -
 drivers/gpu/drm/i915/intel_sprite.c  |  4 +-
 drivers/gpu/drm/mediatek/mtk_drm_drv.c   |  3 +-
 drivers/gpu/drm/msm/msm_atomic.c |  3 +-
 drivers/gpu/drm/omapdrm/omap_drv.c   |  3 +-
 drivers/gpu/drm/rcar-du/rcar_du_kms.c|  3 +-
 drivers/gpu/drm/sti/sti_drv.c|  3 +-
 drivers/gpu/drm/tegra/drm.c  |  3 +-
 drivers/gpu/drm/tilcdc/tilcdc_drv.c  |  2 -
 drivers/gpu/drm/vc4/vc4_kms.c|  3 +-
 include/drm/drm_atomic.h | 12 +++-
 include/drm/drm_crtc.h   |  3 +
 18 files changed, 85 insertions(+), 128 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c 
b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index d4a3d61b7b06..15a9f9d3ef9a 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -464,7 +464,7 @@ atmel_hlcdc_dc_atomic_complete(struct atmel_hlcdc_dc_commit 
*commit)
 
drm_atomic_helper_cleanup_planes(dev, old_state);
 
-   drm_atomic_state_free(old_state);
+   drm_atomic_state_put(old_state);
 
/* Complete the commit, wake up any waiter. */
spin_lock(&dc->commit.wait.lock);
@@ -521,6 +521,7 @@ static int atmel_hlcdc_dc_atomic_commit(struct drm_device 
*dev,
/* Swap the state, this is the point of no return. */
drm_atomic_helper_swap_state(state, true);
 
+   drm_atomic_state_get(state);
if (async)
queue_work(dc->wq, &commit->work);
else
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 5cb2e22d5d55..349c2f0de900 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -74,6 +74,8 @@ EXPORT_SYMBOL(drm_atomic_state_default_release);
 int
 drm_atomic_state_init(struct drm_device *dev, struct drm_atomic_state *state)
 {
+   kref_init(&state->ref);
+
/* TODO legacy paths should maybe do a better job about
 * setting this appropriately?
 */
@@ -215,22 +217,16 @@ void drm_atomic_state_clear(struct drm_atomic_state 
*state)
 EXPORT_SYMBOL(drm_atomic_state_clear);
 
 /**
- * drm_atomic_state_free - free all memory for an atomic state
+ * __drm_atomic_state_free - free all memory for an atomic state
  * @state: atomic state to deallocate
  *
  * This frees all memory associated with an atomic state, including all the
  * per-object state for planes, crtcs and connectors.
  */
-void drm_atomic_state_free(struct drm_atomic_state *state)
+void __drm_atomic_state_free(struct kref *ref)
 {
-   struct drm_device *dev;
-   struct drm_mode_config *config;
-
-   if (!state)
-   return;
-
-   dev = state->dev;
-   config = &dev->mode_config;
+   struct drm_atomic_state *state = container_of(ref, typeof(*state), ref);
+   struct drm_mode_config *config = &state->dev->mode_config;
 
drm_atomic_state_clear(state);
 
@@ -243,7 +239,7 @@ void drm_atomic_state_free(struct drm_atomic_state *state)
kfree(state);
}
 }
-EXPORT_SYMBOL(drm_atomic_state_free);
+EXPORT_SYMBOL(__drm_atomic_state_free);
 
 /**
  * drm_atomic_get_crtc_state - get crtc state
@@ -1742,7 +1738,7 @@ retry:
if (arg->flags & DRM_MODE_ATOMIC_TEST_ONLY) {
/*
 * Unlike commit, check_only does not clean up state.
-* Below we call drm_atomic_state_free for it.
+* Below we call drm_atomic_state_put for it.
 */
ret = drm_atomic_check_only(state);
} else if (arg->flags & DRM_MODE_ATOMIC_NONBLOCK) {
@@ -1775,8 +1771,7 @@ out:
goto retry;
}
 
-   if (ret || arg->flags & DRM_MODE_ATOMIC_TEST_ONLY)
-   drm_atomic_state_free(state);
+   drm_atomic_state_put(state);
 
drm_modeset_drop_locks(&ctx);
drm_modeset_acquire_fini(&ctx);
diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 9abe0a242f96..14d

Re: [Intel-gfx] [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution issues

2016-08-23 Thread Yang, Libin
Hi Daniel,

Thanks. Let's wait for Ville back from vacation. :)

Regards,
Libin


> -Original Message-
> From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of Daniel
> Vetter
> Sent: Wednesday, August 24, 2016 1:53 PM
> To: Yang, Libin 
> Cc: 'libin.y...@linux.intel.com' ; 'intel-
> g...@lists.freedesktop.org' ;
> 'jani.nik...@linux.intel.com' ;
> 'ville.syrj...@linux.intel.com' ; Vetter, 
> Daniel
> ; 'ti...@suse.de' 
> Subject: Re: [Intel-gfx] [PATCH v4 0/3] drm/i915: fix some audio support 4K
> resolution issues
> 
> On Wed, Aug 24, 2016 at 05:35:34AM +, Yang, Libin wrote:
> > Sorry for disturb. Is there any comments for the patches?
> 
> Ville is on vacation, not sure whom else would be a good reviewer from our
> side ... Might need to escalate to managers to finding a random reviewer
> who first needs to ramp up on hdmi/audio issues.
> -Daniel
> 
> >
> > Regards,
> > Libin
> >
> > > -Original Message-
> > > From: Yang, Libin
> > > Sent: Monday, August 22, 2016 9:16 AM
> > > To: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> > > jani.nik...@linux.intel.com; ville.syrj...@linux.intel.com; Vetter,
> > > Daniel ; ti...@suse.de
> > > Subject: RE: [PATCH v4 0/3] drm/i915: fix some audio support 4K
> > > resolution issues
> > >
> > > Any comments?
> > >
> > > Regards,
> > > Libin
> > >
> > >
> > > > -Original Message-
> > > > From: libin.y...@linux.intel.com
> > > > [mailto:libin.y...@linux.intel.com]
> > > > Sent: Thursday, August 18, 2016 2:42 PM
> > > > To: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> > > > ville.syrj...@linux.intel.com; Vetter, Daniel
> > > > ; ti...@suse.de
> > > > Cc: Yang, Libin ; Libin Yang
> > > > 
> > > > Subject: [PATCH v4 0/3] drm/i915: fix some audio support 4K
> > > > resolution issues
> > > >
> > > > From: Libin Yang 
> > > >
> > > > changelog:
> > > > v1: initial patches
> > > >
> > > > v2: change to use crtc->config->port_clock instead of mode->clock for
> dp
> > > > change to use mode->crtc_clock instead of mode->clock
> > > > rename mode to adjusted_mode
> > > >
> > > > v3: add support for 270MHz
> > > > add more platforms support
> > > > use u16 n; u16 m to save the space
> > > > add support for 192KHz, 96KHz, 88.2KHz
> > > > split patch for more platform support separately
> > > >
> > > > v4: change to use intel_crtc_has_dp_encoder() to support DP MST
> > > > add support for 176.4KHz
> > > > fix some tiny code style issues
> > > > reset cts to 0 for HDMI mode
> > > >
> > > > Libin Yang (3):
> > > >   drm/i915: set proper N/M in modeset
> > > >   drm/i915: set proper N/MCTS on more platforms
> > > >   drm/i915: HDMI audio gets the TMDS clock by crtc_clock
> > > >
> > > >  drivers/gpu/drm/i915/i915_reg.h|   7 ++
> > > >  drivers/gpu/drm/i915/intel_audio.c | 155
> > > > +++--
> > > >  2 files changed, 140 insertions(+), 22 deletions(-)
> > > >
> > > > --
> > > > 1.9.1
> >
> > ___
> > 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
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v3 1/4] drm/i915: Store port enum in intel_encoder

2016-08-23 Thread Daniel Vetter
On Tue, Aug 23, 2016 at 01:49:17PM -0700, Dhinakaran Pandiyan wrote:
> Storing the port enum in intel_encoder makes it convenient to know the
> port attached to an encoder. Moving the port information up from
> intel_digital_port to intel_encoder avoids unecessary intel_digital_port
> access and handles MST encoders cleanly without requiring conditional
> checks for them (thanks danvet).
> 
> Signed-off-by: Dhinakaran Pandiyan 
> Cc: Daniel Vetter 
> Cc: Ville Syrjälä 
> ---
>  drivers/gpu/drm/i915/i915_drv.h | 1 +
>  drivers/gpu/drm/i915/intel_ddi.c| 1 +
>  drivers/gpu/drm/i915/intel_dp.c | 1 +
>  drivers/gpu/drm/i915/intel_dp_mst.c | 1 +
>  drivers/gpu/drm/i915/intel_drv.h| 1 +
>  drivers/gpu/drm/i915/intel_dsi.c| 1 +
>  drivers/gpu/drm/i915/intel_dvo.c| 2 ++
>  drivers/gpu/drm/i915/intel_hdmi.c   | 1 +
>  drivers/gpu/drm/i915/intel_lvds.c   | 3 ++-
>  drivers/gpu/drm/i915/intel_tv.c | 2 ++
>  10 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 9cd102c..60e282d5 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -185,6 +185,7 @@ enum plane {
>  #define sprite_name(p, s) ((p) * INTEL_INFO(dev)->num_sprites[(p)] + (s) + 
> 'A')
>  
>  enum port {
> + PORT_NONE = -1,
>   PORT_A = 0,
>   PORT_B,
>   PORT_C,
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c 
> b/drivers/gpu/drm/i915/intel_ddi.c
> index c2df4e4..086de39 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -2426,6 +2426,7 @@ void intel_ddi_init(struct drm_device *dev, enum port 
> port)
>   intel_dig_port->max_lanes = max_lanes;
>  
>   intel_encoder->type = INTEL_OUTPUT_UNKNOWN;
> + intel_encoder->attached_port = port;
>   intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
>   intel_encoder->cloneable = 0;
>  
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 364db90..4771428 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -5726,6 +5726,7 @@ bool intel_dp_init(struct drm_device *dev,
>   intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
>   }
>   intel_encoder->cloneable = 0;
> + intel_encoder->attached_port = port;
>  
>   intel_dig_port->hpd_pulse = intel_dp_hpd_pulse;
>   dev_priv->hotplug.irq_port[port] = intel_dig_port;
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c 
> b/drivers/gpu/drm/i915/intel_dp_mst.c
> index 629337d..a51f6f7 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -540,6 +540,7 @@ intel_dp_create_fake_mst_encoder(struct 
> intel_digital_port *intel_dig_port, enum
>DRM_MODE_ENCODER_DPMST, "DP-MST %c", pipe_name(pipe));
>  
>   intel_encoder->type = INTEL_OUTPUT_DP_MST;
> + intel_encoder->attached_port = intel_dig_port->port;
>   intel_encoder->crtc_mask = 0x7;
>   intel_encoder->cloneable = 0;
>  
> diff --git a/drivers/gpu/drm/i915/intel_drv.h 
> b/drivers/gpu/drm/i915/intel_drv.h
> index 1c700b0..101d671 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -202,6 +202,7 @@ struct intel_encoder {
>   struct drm_encoder base;
>  
>   enum intel_output_type type;
> + enum port attached_port;

Why the attached_ prefix? The intel_encoder _is_ the port (more or less at
least). Also intel_sdvo.c is missing. Otherwise I think it makes sense.
-Daniel


>   unsigned int cloneable;
>   void (*hot_plug)(struct intel_encoder *);
>   bool (*compute_config)(struct intel_encoder *,
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c 
> b/drivers/gpu/drm/i915/intel_dsi.c
> index de8e9fb..293e530 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -1478,6 +1478,7 @@ void intel_dsi_init(struct drm_device *dev)
>  
>   intel_connector->get_hw_state = intel_connector_get_hw_state;
>  
> + intel_encoder->attached_port = port;
>   /*
>* On BYT/CHV, pipe A maps to MIPI DSI port A, pipe B maps to MIPI DSI
>* port C. BXT isn't limited like this.
> diff --git a/drivers/gpu/drm/i915/intel_dvo.c 
> b/drivers/gpu/drm/i915/intel_dvo.c
> index 47bdf9d..86a888f 100644
> --- a/drivers/gpu/drm/i915/intel_dvo.c
> +++ b/drivers/gpu/drm/i915/intel_dvo.c
> @@ -511,7 +511,9 @@ void intel_dvo_init(struct drm_device *dev)
>"DVO %c", intel_dvo_port_name(dvo->dvo_reg));
>  
>   intel_encoder->type = INTEL_OUTPUT_DVO;
> + intel_encoder->attached_port = PORT_NONE;
>   intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
> +
>   switch (dvo->type) {
>   case INTEL_DVO_CHIP_TMDS:
>   intel_encoder->cloneable = (1 << INTEL_OUTPUT_ANALOG) |
> diff --git a/drivers/gpu/drm/i915/intel_hdmi

Re: [Intel-gfx] [PATCH] io-mapping: Fixup for different names of writecombine

2016-08-23 Thread Chris Wilson
On Tue, Aug 23, 2016 at 10:22:33PM +0200, Daniel Vetter wrote:
> Somehow architectures can't agree on this. And for good measure make
> sure we have a fallback which should work everywhere (fingers
> crossed).
> 
> This is to fix a compile fail on microblaze in gpiolib-of.c, which
> misguidedly includes io-mapping.h (instead of screaming at whichever
> achitecture doesn't correctly pull in asm/io.h from linux/io.h).
> 
> Not tested since there's no reasonable way to get at microblaze
> toolchains :(
> 
> Fixes: ac96b5566926 ("io-mapping.h: s/PAGE_KERNEL_IO/PAGE_KERNEL/")
> Cc: Chris Wilson 
> Cc: Daniel Vetter 
> Cc: Joonas Lahtinen 
> Cc: linux...@kvack.org
> Signed-off-by: Daniel Vetter 

As mentioned I'm looking at reducing the number of unused includes of
io-mapping.h, discussion in progress over at gpio/mlx4.

On the positive side, this does at least mean the WC pgprot mess is
hidden away in the header!

Reviewed-by: Chris Wilson 
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v1 00/13] Implement sw_sync test

2016-08-23 Thread Daniel Vetter
On Tue, Aug 23, 2016 at 01:56:02PM -0400, robert.f...@collabora.com wrote:
> From: Robert Foss 
> 
> This series implements the sw_sync test and the lib/sw_sync helper functions
> for said test.
> 
> Gustavo Padovans sw_sync series was just de-staged in
> gregkh-staging/staging-next [1], and this test is targeted at verifying the
> functionality implemented in that series.
> 
> The sw_sync subtests range from very basic tests of the sw_sync functionality,
> to stress testing and randomized tests.
> 
> [1] http://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/

This seems to be patches against igt (but the series is lacking the i-g-t-
subject tag per CONTRIBUTING). I'm ok with that, but I thought the idea
was to merge these testcases into the kernel's selftests? Did the plan
change?
-Daniel

> 
> Robert Foss (13):
>   lib/sw_sync: Add helper functions for managing synchronization
> primitives
>   tests/sw_sync: Add sw_sync test
>   tests/sw_sync: Add subtest test_alloc_fence
>   tests/sw_sync: Add subtest test_alloc_fence_invalid_timeline
>   tests/sw_sync: Add subtest test_alloc_merge_fence
>   tests/sw_sync: Add subtest test_sync_wait
>   tests/sw_sync: Add subtest test_sync_merge
>   tests/sw_sync: Add subtest test_sync_merge_same
>   tests/sw_sync: Add subtest test_sync_multi_consumer
>   tests/sw_sync: Add subtest test_sync_multi_consumer_producer
>   tests/sw_sync: Add subtest test_sync_random_merge
>   tests/sw_sync: Add subtest test_sync_multi_timeline_wait
>   tests/sw_sync: Add subtest test_sync_multi_producer_single_consumer
> 
>  lib/Makefile.sources   |   2 +
>  lib/sw_sync.c  | 237 +
>  lib/sw_sync.h  |  49 
>  tests/Makefile.sources |   1 +
>  tests/sw_sync.c| 693 
> +
>  5 files changed, 982 insertions(+)
>  create mode 100644 lib/sw_sync.c
>  create mode 100644 lib/sw_sync.h
>  create mode 100644 tests/sw_sync.c
> 
> -- 
> 2.7.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [REBASED PATCH 1/5 v2] drm/i915: cosmetic fixes to i915_drv.h

2016-08-23 Thread Daniel Vetter
On Mon, Aug 22, 2016 at 12:24:20PM +0300, David Weinehall wrote:
> Fix minor whitespace issues plus a typo.
> 
> Signed-off-by: David Weinehall 

Reviewed-by: Daniel Vetter 

> ---
>  drivers/gpu/drm/i915/i915_drv.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index e6069057eb98..2cb40026b476 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2549,7 +2549,7 @@ struct drm_i915_cmd_table {
>   BUILD_BUG(); \
>   __p; \
>  })
> -#define INTEL_INFO(p)(&__I915__(p)->info)
> +#define INTEL_INFO(p)(&__I915__(p)->info)
>  #define INTEL_GEN(p) (INTEL_INFO(p)->gen)
>  #define INTEL_DEVID(p)   (INTEL_INFO(p)->device_id)
>  
> @@ -2843,7 +2843,7 @@ extern int i915_suspend_switcheroo(struct drm_device 
> *dev, pm_message_t state);
>  extern int i915_resume_switcheroo(struct drm_device *dev);
>  
>  int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
> - int enable_ppgtt);
> + int enable_ppgtt);
>  
>  bool intel_sanitize_semaphores(struct drm_i915_private *dev_priv, int value);
>  
> @@ -3780,7 +3780,7 @@ __raw_write(64, q)
>  #undef __raw_write
>  
>  /* These are untraced mmio-accessors that are only valid to be used inside
> - * criticial sections inside IRQ handlers where forcewake is explicitly
> + * critical sections inside IRQ handlers where forcewake is explicitly
>   * controlled.
>   * Think twice, and think again, before using these.
>   * Note: Should only be used between intel_uncore_forcewake_irqlock() and
> -- 
> 2.9.3
> 
> ___
> 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
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/2] drm/i915/fbc: Allow on unfenced surfaces, for recent gen

2016-08-23 Thread Daniel Vetter
On Mon, Aug 22, 2016 at 09:39:17PM -0300, Paulo Zanoni wrote:
> 2016-08-18 5:21 GMT-03:00 Chris Wilson :
> > Only fbc1 is tied to using a fence. Later iterations of fbc are more
> > flexible and allow operation on unfenced frontbuffers.
> >
> > Signed-off-by: Chris Wilson 
> > Cc: Daniel Vetter 
> > Cc: "Zanoni, Paulo R" 
> 
> Hi
> 
> I see this patch was applied. Now, on my Skylake machine, if I boot
> with i915.enable_fbc=1 I'll get FIFO underruns under fbcon. Just
> booting already gives me a FIFO underrun message, and then if I "sudo
> systemctl stop lightdm" I'll get a constantly-blinking screen.
> 
> Of course, applying the patch that disables FBC after a FIFO underrun
> will help stopping the ever-blinking fbcon, but I think we should try
> to avoid the underruns in the places we know we can, and leave the
> "disable FBC on FIFO underruns" just for the cases we're not expecting.
> 
> Also, please remember that I mentioned there are FBC workarounds for
> untiled that we still don't implement (although when I re-read my
> email it may sound like I suggested the workarounds are for non-GTT
> tracking). IMHO this argument alone should
> have prevented this patch from being merged...
> 
> Based on that, can we please revert this patch? I'm afraid some people
> would consider these underruns as blockers to enabling FBC, so it's
> probably better to enable FBC only on X tiled for now, and leave this
> for when we know how to prevent the underrun (possibly by implementing
> the missing WAs).
> 
> 
> (I'm sorry if you got this message twice, but the mail servers are a
> little crazy these days and I didn't receive my copy, so I'm sending
> it again).

Yeah, mailman was on vacation a bit the last few days due to a ddos
probably. +1 from me for just reverting if this is causing troubles.
Also, patch doesn't seem to have a Testcase: line, was the
kms_frontbuffer_tracking test not extended to cover this new use-case? In
that case definitely revert, since failed to pass testing requirements.
-Daniel

> 
> Thanks,
> Paulo
> 
> 
> > ---
> >  drivers/gpu/drm/i915/intel_fbc.c | 6 --
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_fbc.c 
> > b/drivers/gpu/drm/i915/intel_fbc.c
> > index 57e1ca624d73..9534f90c6551 100644
> > --- a/drivers/gpu/drm/i915/intel_fbc.c
> > +++ b/drivers/gpu/drm/i915/intel_fbc.c
> > @@ -789,8 +789,10 @@ static bool intel_fbc_can_activate(struct intel_crtc 
> > *crtc)
> >  */
> > if (cache->fb.tiling_mode != I915_TILING_X ||
> > cache->fb.fence_reg == I915_FENCE_REG_NONE) {
> > -   fbc->no_fbc_reason = "framebuffer not tiled or fenced";
> > -   return false;
> > +   if (INTEL_GEN(dev_priv) < 5) {
> > +   fbc->no_fbc_reason = "framebuffer not tiled or 
> > fenced";
> > +   return false;
> > +   }
> > }
> > if (INTEL_INFO(dev_priv)->gen <= 4 && !IS_G4X(dev_priv) &&
> > cache->plane.rotation != DRM_ROTATE_0) {
> > --
> > 2.9.3
> >
> > ___
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> 
> 
> -- 
> Paulo Zanoni
> ___
> 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
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution issues

2016-08-23 Thread Daniel Vetter
On Wed, Aug 24, 2016 at 05:35:34AM +, Yang, Libin wrote:
> Sorry for disturb. Is there any comments for the patches?

Ville is on vacation, not sure whom else would be a good reviewer from our
side ... Might need to escalate to managers to finding a random reviewer
who first needs to ramp up on hdmi/audio issues.
-Daniel

> 
> Regards,
> Libin
> 
> > -Original Message-
> > From: Yang, Libin
> > Sent: Monday, August 22, 2016 9:16 AM
> > To: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> > jani.nik...@linux.intel.com; ville.syrj...@linux.intel.com; Vetter, Daniel
> > ; ti...@suse.de
> > Subject: RE: [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution
> > issues
> > 
> > Any comments?
> > 
> > Regards,
> > Libin
> > 
> > 
> > > -Original Message-
> > > From: libin.y...@linux.intel.com [mailto:libin.y...@linux.intel.com]
> > > Sent: Thursday, August 18, 2016 2:42 PM
> > > To: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> > > ville.syrj...@linux.intel.com; Vetter, Daniel
> > > ; ti...@suse.de
> > > Cc: Yang, Libin ; Libin Yang
> > > 
> > > Subject: [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution
> > > issues
> > >
> > > From: Libin Yang 
> > >
> > > changelog:
> > > v1: initial patches
> > >
> > > v2: change to use crtc->config->port_clock instead of mode->clock for dp
> > > change to use mode->crtc_clock instead of mode->clock
> > >   rename mode to adjusted_mode
> > >
> > > v3: add support for 270MHz
> > > add more platforms support
> > >   use u16 n; u16 m to save the space
> > >   add support for 192KHz, 96KHz, 88.2KHz
> > >   split patch for more platform support separately
> > >
> > > v4: change to use intel_crtc_has_dp_encoder() to support DP MST
> > > add support for 176.4KHz
> > > fix some tiny code style issues
> > > reset cts to 0 for HDMI mode
> > >
> > > Libin Yang (3):
> > >   drm/i915: set proper N/M in modeset
> > >   drm/i915: set proper N/MCTS on more platforms
> > >   drm/i915: HDMI audio gets the TMDS clock by crtc_clock
> > >
> > >  drivers/gpu/drm/i915/i915_reg.h|   7 ++
> > >  drivers/gpu/drm/i915/intel_audio.c | 155
> > > +++--
> > >  2 files changed, 140 insertions(+), 22 deletions(-)
> > >
> > > --
> > > 1.9.1
> 
> ___
> 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
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution issues

2016-08-23 Thread Yang, Libin
Sorry for disturb. Is there any comments for the patches?

Regards,
Libin

> -Original Message-
> From: Yang, Libin
> Sent: Monday, August 22, 2016 9:16 AM
> To: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> jani.nik...@linux.intel.com; ville.syrj...@linux.intel.com; Vetter, Daniel
> ; ti...@suse.de
> Subject: RE: [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution
> issues
> 
> Any comments?
> 
> Regards,
> Libin
> 
> 
> > -Original Message-
> > From: libin.y...@linux.intel.com [mailto:libin.y...@linux.intel.com]
> > Sent: Thursday, August 18, 2016 2:42 PM
> > To: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> > ville.syrj...@linux.intel.com; Vetter, Daniel
> > ; ti...@suse.de
> > Cc: Yang, Libin ; Libin Yang
> > 
> > Subject: [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution
> > issues
> >
> > From: Libin Yang 
> >
> > changelog:
> > v1: initial patches
> >
> > v2: change to use crtc->config->port_clock instead of mode->clock for dp
> > change to use mode->crtc_clock instead of mode->clock
> > rename mode to adjusted_mode
> >
> > v3: add support for 270MHz
> > add more platforms support
> > use u16 n; u16 m to save the space
> > add support for 192KHz, 96KHz, 88.2KHz
> > split patch for more platform support separately
> >
> > v4: change to use intel_crtc_has_dp_encoder() to support DP MST
> > add support for 176.4KHz
> > fix some tiny code style issues
> > reset cts to 0 for HDMI mode
> >
> > Libin Yang (3):
> >   drm/i915: set proper N/M in modeset
> >   drm/i915: set proper N/MCTS on more platforms
> >   drm/i915: HDMI audio gets the TMDS clock by crtc_clock
> >
> >  drivers/gpu/drm/i915/i915_reg.h|   7 ++
> >  drivers/gpu/drm/i915/intel_audio.c | 155
> > +++--
> >  2 files changed, 140 insertions(+), 22 deletions(-)
> >
> > --
> > 1.9.1

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


[Intel-gfx] ✗ Fi.CI.BAT: failure for drm: Add reference counting to drm_atomic_state

2016-08-23 Thread Patchwork
== Series Details ==

Series: drm: Add reference counting to drm_atomic_state
URL   : https://patchwork.freedesktop.org/series/11494/
State : failure

== Summary ==

Series 11494v1 drm: Add reference counting to drm_atomic_state
http://patchwork.freedesktop.org/api/1.0/series/11494/revisions/1/mbox/

Test kms_cursor_legacy:
Subgroup basic-flip-vs-cursor-legacy:
pass   -> FAIL   (fi-skl-6700k)
Subgroup basic-flip-vs-cursor-varying-size:
pass   -> FAIL   (fi-skl-6700k)
fail   -> PASS   (fi-hsw-4770r)
Test kms_force_connector_basic:
Subgroup force-load-detect:
pass   -> INCOMPLETE (fi-hsw-4770k)
pass   -> INCOMPLETE (fi-ivb-3520m)
pass   -> INCOMPLETE (fi-snb-2600)
pass   -> INCOMPLETE (fi-snb-2520m)

fi-bdw-5557u total:249  pass:232  dwarn:0   dfail:0   fail:1   skip:16 
fi-bsw-n3050 total:249  pass:202  dwarn:0   dfail:0   fail:3   skip:44 
fi-byt-n2820 total:249  pass:204  dwarn:0   dfail:0   fail:4   skip:41 
fi-hsw-4770k total:25   pass:22   dwarn:0   dfail:0   fail:0   skip:2  
fi-hsw-4770r total:249  pass:222  dwarn:0   dfail:0   fail:1   skip:26 
fi-ivb-3520m total:25   pass:21   dwarn:0   dfail:0   fail:0   skip:3  
fi-skl-6260u total:249  pass:234  dwarn:0   dfail:0   fail:1   skip:14 
fi-skl-6700k total:249  pass:214  dwarn:4   dfail:0   fail:3   skip:28 
fi-snb-2520m total:25   pass:20   dwarn:0   dfail:0   fail:0   skip:4  
fi-snb-2600  total:25   pass:20   dwarn:0   dfail:0   fail:0   skip:4  

Results at /archive/results/CI_IGT_test/Patchwork_2415/

74607c2ff95614c1ace6a7207a2960ecc1cec95c drm-intel-nightly: 
2016y-08m-23d-19h-46m-16s UTC integration manifest
a87e70f drm: Add reference counting to drm_atomic_state

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


[Intel-gfx] ✗ Fi.CI.BAT: failure for Prep. for DP audio MST support (rev2)

2016-08-23 Thread Patchwork
== Series Details ==

Series: Prep. for DP audio MST support (rev2)
URL   : https://patchwork.freedesktop.org/series/11129/
State : failure

== Summary ==

Series 11129v2 Prep. for DP audio MST support
http://patchwork.freedesktop.org/api/1.0/series/11129/revisions/2/mbox/

Test gem_exec_suspend:
Subgroup basic-s3:
dmesg-warn -> INCOMPLETE (fi-hsw-4770k)
Test kms_cursor_legacy:
Subgroup basic-flip-vs-cursor-legacy:
pass   -> FAIL   (fi-skl-6700k)
Subgroup basic-flip-vs-cursor-varying-size:
pass   -> FAIL   (fi-skl-6700k)
fail   -> PASS   (fi-hsw-4770r)

fi-bdw-5557u total:249  pass:232  dwarn:0   dfail:0   fail:1   skip:16 
fi-bsw-n3050 total:249  pass:202  dwarn:0   dfail:0   fail:3   skip:44 
fi-byt-n2820 total:249  pass:204  dwarn:0   dfail:0   fail:4   skip:41 
fi-hsw-4770k total:107  pass:91   dwarn:0   dfail:0   fail:0   skip:15 
fi-hsw-4770r total:249  pass:222  dwarn:0   dfail:0   fail:1   skip:26 
fi-ivb-3520m total:249  pass:217  dwarn:0   dfail:0   fail:1   skip:31 
fi-skl-6260u total:249  pass:234  dwarn:0   dfail:0   fail:1   skip:14 
fi-skl-6700k total:249  pass:214  dwarn:4   dfail:0   fail:3   skip:28 
fi-snb-2520m total:249  pass:201  dwarn:4   dfail:0   fail:2   skip:42 
fi-snb-2600  total:249  pass:202  dwarn:4   dfail:0   fail:1   skip:42 

Results at /archive/results/CI_IGT_test/Patchwork_2414/

74607c2ff95614c1ace6a7207a2960ecc1cec95c drm-intel-nightly: 
2016y-08m-23d-19h-46m-16s UTC integration manifest
f7d8bf1 drm/i915: Switch to using port stored in intel_encoder
50a0bdf drm/i915: Store port enum in intel_encoder

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


[Intel-gfx] linux-next: manual merge of the drm-intel tree with the drm-intel-fixes tree

2016-08-23 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the drm-intel tree got a conflict in:

  drivers/gpu/drm/i915/intel_display.c

between commits from the drm-intel-fixes tree (some of which are
cherry-picked from the drm-intel tree) and teh same and other commits
from the drm-inte tree.  These are just going to cause new conflicts
every time you touch this file again in either tree (which happens a
lot :-().

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider only putting
the fix patches into the drm-intel-fixes tree and then getting them
into the drm-intel tree by merging the -fixes tree instead of
cherry-picking them the other way.

-- 
Cheers,
Stephen Rothwell
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] linux-next: manual merge of the drm-intel tree with the drm-intel-fixes tree

2016-08-23 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the drm-intel tree got a conflict in:

  drivers/gpu/drm/i915/intel_drv.h

between commit:

  f403372658fc ("drm/i915/skl: Add support for the SAGV, fix underrun hangs")
  (which is a chery-pick of commit 656d1b89e5ff from the drm-intel tree)

from the drm-intel-fixes tree and commit:

  62e0fb880123 ("drm/i915/skl: Update plane watermarks atomically during plane 
updates")

from the drm-intel tree.

I fixed it up (I just used the drm-intel tree version) and can carry the
fix as necessary. This is now fixed as far as linux-next is concerned,
but any non trivial conflicts should be mentioned to your upstream
maintainer when your tree is submitted for merging.  You may also want
to consider cooperating with the maintainer of the conflicting tree to
minimise any particularly complex conflicts.

-- 
Cheers,
Stephen Rothwell
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v4 1/4] drm: Helper for lspcon in drm_dp_dual_mode

2016-08-23 Thread kbuild test robot
Hi Shashank,

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on v4.8-rc3 next-20160823]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Shashank-Sharma/Enable-lspcon-support-for-GEN9-devices/20160818-183353
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   include/drm/drm_fourcc.h:1: warning: no structured comments found
   include/drm/drm_crtc.h:848: warning: No description found for parameter 
'index'
   include/drm/drm_crtc.h:1223: warning: No description found for parameter 
'index'
   include/drm/drm_crtc.h:1720: warning: No description found for parameter 
'index'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'connector_ida'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'edid_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'dpms_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'path_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'tile_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'plane_type_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'rotation_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'prop_src_x'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'prop_src_y'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'prop_src_w'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'prop_src_h'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'prop_crtc_x'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'prop_crtc_y'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'prop_crtc_w'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'prop_crtc_h'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'prop_fb_id'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'prop_crtc_id'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'prop_active'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'prop_mode_id'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'dvi_i_subconnector_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'dvi_i_select_subconnector_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'tv_subconnector_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'tv_select_subconnector_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'tv_mode_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'tv_left_margin_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'tv_right_margin_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'tv_top_margin_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'tv_bottom_margin_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'tv_brightness_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'tv_contrast_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'tv_flicker_reduction_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'tv_overscan_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'tv_saturation_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'tv_hue_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'scaling_mode_property'
   include/drm/drm_crtc.h:2505: warning: No description found for parameter 
'aspect_ratio_property'
   include/drm/drm_crtc.h:2505: warning: No description found fo

Re: [Intel-gfx] [PATCH] drm: Add reference counting to drm_atomic_state

2016-08-23 Thread kbuild test robot
Hi Chris,

[auto build test WARNING on drm-intel/for-linux-next]
[cannot apply to drm/drm-next v4.8-rc3 next-20160823]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Chris-Wilson/drm-Add-reference-counting-to-drm_atomic_state/20160824-054553
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/drm_modes.c:693: warning: No description found for parameter 
'bus_flags'
>> drivers/gpu/drm/drm_atomic.c:228: warning: No description found for 
>> parameter 'ref'
>> drivers/gpu/drm/drm_atomic.c:228: warning: Excess function parameter 'state' 
>> description in '__drm_atomic_state_free'
>> drivers/gpu/drm/drm_atomic.c:228: warning: No description found for 
>> parameter 'ref'
>> drivers/gpu/drm/drm_atomic.c:228: warning: Excess function parameter 'state' 
>> description in '__drm_atomic_state_free'
>> include/drm/drm_crtc.h:2063: warning: No description found for parameter 
>> 'ref'
   drivers/gpu/drm/drm_plane_helper.c:248: warning: No description found for 
parameter 'dst'
   drivers/gpu/drm/drm_plane_helper.c:248: warning: Excess function parameter 
'dest' description in 'drm_plane_helper_check_update'
   drivers/gpu/drm/drm_plane_helper.c:247: warning: No description found for 
parameter 'dst'
   drivers/gpu/drm/drm_plane_helper.c:247: warning: Excess function parameter 
'dest' description in 'drm_plane_helper_check_update'
   drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
parameter 'dev_priv'
   drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
parameter 'crtc_state'
   drivers/gpu/drm/i915/intel_dp.c:5063: warning: Excess function parameter 
'dev' description in 'intel_dp_set_drrs_state'
   drivers/gpu/drm/i915/intel_dp.c:5158: warning: No description found for 
parameter 'crtc_state'
   drivers/gpu/drm/i915/intel_dp.c:5188: warning: No description found for 
parameter 'old_crtc_state'
   drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
parameter 'dev_priv'
   drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
parameter 'crtc_state'
   drivers/gpu/drm/i915/intel_dp.c:5063: warning: Excess function parameter 
'dev' description in 'intel_dp_set_drrs_state'
   drivers/gpu/drm/i915/intel_dp.c:5158: warning: No description found for 
parameter 'crtc_state'
   drivers/gpu/drm/i915/intel_dp.c:5188: warning: No description found for 
parameter 'old_crtc_state'
   drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
parameter 'dev_priv'
   drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
parameter 'crtc_state'
   drivers/gpu/drm/i915/intel_dp.c:5063: warning: Excess function parameter 
'dev' description in 'intel_dp_set_drrs_state'
   drivers/gpu/drm/i915/intel_dp.c:5158: warning: No description found for 
parameter 'crtc_state'
   drivers/gpu/drm/i915/intel_dp.c:5188: warning: No description found for 
parameter 'old_crtc_state'
   drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
parameter 'dev_priv'
   drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
parameter 'crtc_state'
   drivers/gpu/drm/i915/intel_dp.c:5063: warning: Excess function parameter 
'dev' description in 'intel_dp_set_drrs_state'
   drivers/gpu/drm/i915/intel_dp.c:5158: warning: No description found for 
parameter 'crtc_state'
   drivers/gpu/drm/i915/intel_dp.c:5188: warning: No description found for 
parameter 'old_crtc_state'
   drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
parameter 'dev_priv'
   drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
parameter 'crtc_state'
   drivers/gpu/drm/i915/intel_dp.c:5063: warning: Excess function parameter 
'dev' description in 'intel_dp_set_drrs_state'
   drivers/gpu/drm/i915/intel_dp.c:5158: warning: No description found for 
parameter 'crtc_state'
   drivers/gpu/drm/i915/intel_dp.c:5188: warning: No description found for 
parameter 'old_crtc_state'
   drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
parameter 'dev_pr

[Intel-gfx] [drm-intel:drm-intel-next-queued 44/46] include/linux/io-mapping.h:115:31: fatal error: asm/pgtable_types.h: No such file or directory

2016-08-23 Thread kbuild test robot
tree:   git://anongit.freedesktop.org/drm-intel drm-intel-next-queued
head:   c58305af1835095ddc25ee6f548ac05915e66ac5
commit: cafaf14a5d8f152ed3c984ecd48dee6e824446bc [44/46] io-mapping: Always 
create a struct to hold metadata about the io-mapping
config: microblaze-mmu_defconfig (attached as .config)
compiler: microblaze-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout cafaf14a5d8f152ed3c984ecd48dee6e824446bc
# save the attached .config to linux build tree
make.cross ARCH=microblaze 

Note: the drm-intel/drm-intel-next-queued HEAD 
ac96b5566926af83463ddcf4655856033c092f26 builds fine.
  It only hurts bisectibility.

All errors (new ones prefixed by >>):

   In file included from drivers/gpio/gpiolib-of.c:19:0:
>> include/linux/io-mapping.h:115:31: fatal error: asm/pgtable_types.h: No such 
>> file or directory
#include 
  ^
   compilation terminated.

vim +115 include/linux/io-mapping.h

   109  iounmap(vaddr);
   110  }
   111  
   112  #else
   113  
   114  #include 
 > 115  #include 
   116  
   117  /* Create the io_mapping object*/
   118  static inline struct io_mapping *

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [Mesa-dev] [PATCH v1 00/13] Implement sw_sync test

2016-08-23 Thread Eric Engestrom
On Tue, Aug 23, 2016 at 01:56:02PM -0400, robert.f...@collabora.com wrote:
> From: Robert Foss 
> 
> This series implements the sw_sync test and the lib/sw_sync helper functions
> for said test.
> 
> Gustavo Padovans sw_sync series was just de-staged in
> gregkh-staging/staging-next [1], and this test is targeted at verifying the
> functionality implemented in that series.
> 
> The sw_sync subtests range from very basic tests of the sw_sync functionality,
> to stress testing and randomized tests.
> 
> [1] http://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/
> 
> Robert Foss (13):
>   lib/sw_sync: Add helper functions for managing synchronization
> primitives
>   tests/sw_sync: Add sw_sync test
>   tests/sw_sync: Add subtest test_alloc_fence
>   tests/sw_sync: Add subtest test_alloc_fence_invalid_timeline
>   tests/sw_sync: Add subtest test_alloc_merge_fence
>   tests/sw_sync: Add subtest test_sync_wait
>   tests/sw_sync: Add subtest test_sync_merge
>   tests/sw_sync: Add subtest test_sync_merge_same
>   tests/sw_sync: Add subtest test_sync_multi_consumer
>   tests/sw_sync: Add subtest test_sync_multi_consumer_producer
>   tests/sw_sync: Add subtest test_sync_random_merge
>   tests/sw_sync: Add subtest test_sync_multi_timeline_wait
>   tests/sw_sync: Add subtest test_sync_multi_producer_single_consumer
> 
>  lib/Makefile.sources   |   2 +
>  lib/sw_sync.c  | 237 +
>  lib/sw_sync.h  |  49 
>  tests/Makefile.sources |   1 +
>  tests/sw_sync.c| 693 
> +
>  5 files changed, 982 insertions(+)
>  create mode 100644 lib/sw_sync.c
>  create mode 100644 lib/sw_sync.h
>  create mode 100644 tests/sw_sync.c
> 
> -- 
> 2.7.4

Thanks for your work!

I sent some specific comments directly to a few patches, but everything
else looks good to me.

With the issues raised in patches 1 & 2 fixed (and with or without my
suggestions), the whole series is:
Reviewed-by: Eric Engestrom 

Cheers,
  Eric
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [Mesa-dev] [PATCH v1 11/13] tests/sw_sync: Add subtest test_sync_random_merge

2016-08-23 Thread Eric Engestrom
On Tue, Aug 23, 2016 at 01:56:13PM -0400, robert.f...@collabora.com wrote:
> From: Robert Foss 
> 
> This subtest verifies that creating many timelines and merging random fences
> from each timeline with eachother results in merged fences that are fully
> functional.
> 
> Signed-off-by: Robert Foss 
> ---
>  tests/sw_sync.c | 73 
> +
>  1 file changed, 73 insertions(+)
> 
> diff --git a/tests/sw_sync.c b/tests/sw_sync.c
> index 0e67ad5..8e5a7c9 100644
> --- a/tests/sw_sync.c
> +++ b/tests/sw_sync.c
> @@ -383,6 +383,76 @@ static void test_sync_multi_consumer_producer(void)
>   igt_assert_f(thread_ret == 0, "A sync thread reported failure.\n");
>  }
>  
> +static void test_sync_random_merge(void)
> +{
> + int i, size, ret;
> + const int nbr_timeline = 32;
> + const int nbr_merge = 1024;
> + int fence_map[nbr_timeline];
> + int timeline_arr[nbr_timeline];
> + int fence, tmpfence, merged;
> + int timeline, timeline_offset, sync_pt;
> +
> + srand(time(NULL));
> +
> + for (i = 0; i < nbr_timeline; i++)
> + timeline_arr[i] = sw_sync_timeline_create();
> +
> + memset(fence_map, -1, sizeof(fence_map));

This sets each byte to -1, which happens to be the same as an int -1,
but I don't really like it: this is only true for two special values, -1
and 0, and would become a bug if it was ever changed.

I'd much prefer if you simply set:
fence_map[i] = -1;
in the loop you already have just above.

BTW, seeing how many times you set and test for -1 as the "invalid fd
sentinel", how about a:
#define INVALID_FD (-1)
and use that token throughout the code? I think it would improve
readability as well

> +
> + sync_pt = rand();
> + fence = sw_sync_fence_create(timeline_arr[0], sync_pt);
> +
> + fence_map[0] = sync_pt;
> +
> + /* Randomly create syncpoints out of a fixed set of timelines,
> +  * and merge them together.
> +  */
> + for (i = 0; i < nbr_merge; i++) {
> + /* Generate syncpoint. */
> + timeline_offset = rand() % nbr_timeline;
> + timeline = timeline_arr[timeline_offset];
> + sync_pt = rand();
> +
> + /* Keep track of the latest sync_pt in each timeline. */
> + if (fence_map[timeline_offset] == -1)
> + fence_map[timeline_offset] = sync_pt;
> + else if (fence_map[timeline_offset] < sync_pt)
> + fence_map[timeline_offset] = sync_pt;
> +
> + /* Merge. */
> + tmpfence = sw_sync_fence_create(timeline, sync_pt);
> + merged = sw_sync_merge(tmpfence, fence);
> + sw_sync_fence_destroy(tmpfence);
> + sw_sync_fence_destroy(fence);
> + fence = merged;
> + }
> +
> + size = 0;
> + for (i = 0; i < nbr_timeline; i++)
> + if (fence_map[i] != -1)
> + size++;
> +
> + /* Trigger the merged fence. */
> + for (i = 0; i < nbr_timeline; i++) {
> + if (fence_map[i] != -1) {
> + ret = sw_sync_wait(fence, 0);
> + igt_assert_f(ret == 0,
> + "Failure waiting on fence until timeout\n");
> + /* Increment the timeline to the last sync_pt */
> + sw_sync_timeline_inc(timeline_arr[i], fence_map[i]);
> + }
> + }
> +
> + /* Check that the fence is triggered. */
> + ret = sw_sync_wait(fence, 0);
> + igt_assert_f(ret > 0, "Failure triggering fence\n");
> +
> + sw_sync_fence_destroy(fence);
> + for (i = 0; i < nbr_timeline; i++)
> + sw_sync_timeline_destroy(timeline_arr[i]);
> +}
> +
>  igt_main
>  {
>   igt_subtest("alloc_timeline")
> @@ -411,5 +481,8 @@ igt_main
>  
>   igt_subtest("sync_multi_consumer_producer")
>   test_sync_multi_consumer_producer();
> +
> + igt_subtest("sync_random_merge")
> + test_sync_random_merge();
>  }
>  
> -- 
> 2.7.4
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [Mesa-dev] [PATCH v1 02/13] tests/sw_sync: Add sw_sync test

2016-08-23 Thread Eric Engestrom
On Tue, Aug 23, 2016 at 01:56:04PM -0400, robert.f...@collabora.com wrote:
> From: Robert Foss 
> 
> Add initial tests for sw_sync.
> 
> Signed-off-by: Gustavo Padovan 
> Signed-off-by: Robert Foss 
> ---
>  lib/sw_sync.c  | 13 ++---
>  lib/sw_sync.h  |  2 +-
>  tests/Makefile.sources |  1 +
>  tests/sw_sync.c| 51 
> ++
>  4 files changed, 59 insertions(+), 8 deletions(-)
>  create mode 100644 tests/sw_sync.c
> 
> diff --git a/lib/sw_sync.c b/lib/sw_sync.c
> index c4e7d07..e3d5f85 100644
> --- a/lib/sw_sync.c
> +++ b/lib/sw_sync.c
> @@ -150,8 +150,6 @@ int sw_sync_wait(int fence, int timeout)
>  
>   ret = poll(&fds, 1, timeout);
>  
> - sw_sync_fd_close(fence);
> -
>   return ret;
>  }
>  
> @@ -179,9 +177,10 @@ static struct sync_file_info *sync_file_info(int fd)
>   info->num_fences = num_fences;
>  
>   fence_info = calloc(num_fences, sizeof(struct sync_fence_info));
> - if (!fence_info)
> + if (!fence_info) {
>   free(info);
>   return NULL;
> + }

Oh, I see you fixed it here.
I would fold all these lib/ hunks from this patch into the previous
patch though, they don't belong in "Add sw_sync test" IMO, and having
them as a separate patch between the two would mean knowingly
introducing bugs in one commit and fixing them in the next.

>  
>   info->sync_fence_info = (uint64_t)(unsigned long) (fence_info);
>  
> @@ -217,18 +216,18 @@ int sw_sync_fence_size(int fd)
>   return count;
>  }
>  
> -int sw_sync_fence_count_with_status(int fd, int status)
> +int sw_sync_fence_count_status(int fd, int status)
>  {
>   int i, count = 0;
> - struct sync_fence_info *fenceInfo = NULL;
> + struct sync_fence_info *fence_info = NULL;
>   struct sync_file_info *info = sync_file_info(fd);
>  
>   if (!info)
>   return -1;
>  
> - fenceInfo = (struct sync_fence_info *)(uintptr_t)info->sync_fence_info;
> + fence_info = (struct sync_fence_info *)(uintptr_t)info->sync_fence_info;
>   for (i = 0 ; i < info->num_fences ; i++) {
> - if (fenceInfo[i].status == status)
> + if (fence_info[i].status == status)
>   count++;
>   }
>  
> diff --git a/lib/sw_sync.h b/lib/sw_sync.h
> index b179adf..1092608 100644
> --- a/lib/sw_sync.h
> +++ b/lib/sw_sync.h
> @@ -43,7 +43,7 @@ void sw_sync_timeline_inc(int fd, uint32_t count);
>  int sw_sync_merge(int fd1, int fd2);
>  int sw_sync_wait(int fence, int timeout);
>  int sw_sync_fence_size(int fd);
> -int sw_sync_fence_count_with_status(int fd, int status);
> +int sw_sync_fence_count_status(int fd, int status);
>  
>  #endif
>  
> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> index 72a58ad..0ba769f 100644
> --- a/tests/Makefile.sources
> +++ b/tests/Makefile.sources
> @@ -125,6 +125,7 @@ TESTS_progs_M = \
>   prime_mmap_kms \
>   prime_self_import \
>   prime_vgem \
> + sw_sync \
>   template \
>   vgem_basic \
>   vgem_slow \
> diff --git a/tests/sw_sync.c b/tests/sw_sync.c
> new file mode 100644
> index 000..d2d4c42
> --- /dev/null
> +++ b/tests/sw_sync.c
> @@ -0,0 +1,51 @@
> +/*
> + * Copyright 2012 Google, Inc
> + * Copyright © 2016 Collabora, Ltd.
> + *
> + * Based on the implementation from the Android Open Source Project
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
> DEALINGS
> + * IN THE SOFTWARE.
> + *
> + * Authors:
> + *Robert Foss 
> + */
> +
> +#include 
> +
> +#include "sw_sync.h"
> +#include "igt.h"
> +#include "igt_aux.h"
> +
> +IGT_TEST_DESCRIPTION("Test SW Sync Framework");
> +
> +static void test_alloc_timeline(void)
> +{
> + int timeline;
> +
> + timeline = sw_sync_timeline_create();
> + sw_sync_timeline_destroy(timeline);
> +}
> +
> +igt_main

Re: [Intel-gfx] [Mesa-dev] [PATCH v1 01/13] lib/sw_sync: Add helper functions for managing synchronization primitives

2016-08-23 Thread Eric Engestrom
On Tue, Aug 23, 2016 at 01:56:03PM -0400, robert.f...@collabora.com wrote:
> From: Robert Foss 
> 
> Base functions to help testing the Sync File Framework (explicit fencing
> mechanism ported from Android).
> These functions allow you to create, use and destroy timelines and fences.
> 
> Signed-off-by: Gustavo Padovan 
> Signed-off-by: Robert Foss 
> ---
>  lib/Makefile.sources |   2 +
>  lib/sw_sync.c| 238 
> +++
>  lib/sw_sync.h|  49 +++
>  3 files changed, 289 insertions(+)
>  create mode 100644 lib/sw_sync.c
>  create mode 100644 lib/sw_sync.h
> 

[snip]

> +int sw_sync_fd_is_valid(int fd)
> +{
> + int status;
> +
> + if (fd == -1)

`-1` seems too specific. While open() will return -1 on error, any
negative fd is invalid, so I'd test for `<0` here instead.

> + return 0;
> +
> + status = fcntl(fd, F_GETFD, 0);
> + return status >= 0;
> +}
> +
> +static
> +void sw_sync_fd_close(int fd)
> +{
> + if (fd == -1)
> + return;
> +
> + if (fcntl(fd, F_GETFD, 0) < 0)
> + return;

Why not replace these two tests with a simple
if (sw_sync_fd_is_valid(fd))

> +
> + close(fd);
> +}
> +
> +int sw_sync_timeline_create(void)
> +{
> + int fd = open("/dev/sw_sync", O_RDWR);
> +
> + if (!sw_sync_fd_is_valid(fd))
> + fd = open("/sys/kernel/debug/sync/sw_sync", O_RDWR);

I tend to prefer for hard-coded paths to be in a #define at the top, but
I don't know what the policy for that is in IGT.

> +
> + igt_assert(sw_sync_fd_is_valid(fd));
> +
> + return fd;
> +}
> +

[snip]

> +static struct sync_file_info *sync_file_info(int fd)
> +{
> + struct sync_file_info *info;
> + struct sync_fence_info *fence_info;
> + int err, num_fences;
> +
> + info = malloc(sizeof(*info));
> + if (info == NULL)
> + return NULL;
> +
> + memset(info, 0, sizeof(*info));

You could replace malloc() + memset(0) with calloc(), as you're doing
a few lines below.

> + err = ioctl(fd, SYNC_IOC_FILE_INFO, info);
> + if (err < 0) {
> + free(info);
> + return NULL;
> + }
> +
> + num_fences = info->num_fences;
> +
> + if (num_fences) {
> + info->flags = 0;
> + info->num_fences = num_fences;
> +
> + fence_info = calloc(num_fences, sizeof(struct sync_fence_info));

sizeof(*fence_info)

> + if (!fence_info)
> + free(info);
> + return NULL;

Missing braces

> +
> + info->sync_fence_info = (uint64_t)(unsigned long) (fence_info);
> +
> + err = ioctl(fd, SYNC_IOC_FILE_INFO, info);
> + if (err < 0) {
> + free(fence_info);
> + free(info);
> + return NULL;
> + }
> + }
> +
> + return info;
> +}

[snip]

Cheers,
  Eric
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm: Add reference counting to drm_atomic_state

2016-08-23 Thread Chris Wilson
drm_atomic_state has a complicated single owner model that tracks the
single reference from allocation through to destruction on another
thread - or perhaps on a local error path. We can simplify this tracking
by using reference counting (at a cost of a few more atomics). This is
even more beneficial when the lifetime of the state becomes more
convoluted than being passed to a single worker thread for the commit.

Signed-off-by: Chris Wilson 
Cc: Daniel Vetter 
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c |  2 +-
 drivers/gpu/drm/drm_atomic.c | 23 +++
 drivers/gpu/drm/drm_atomic_helper.c  | 98 +++-
 drivers/gpu/drm/drm_fb_helper.c  |  8 +--
 drivers/gpu/drm/exynos/exynos_drm_drv.c  |  2 +-
 drivers/gpu/drm/i915/i915_debugfs.c  |  3 +-
 drivers/gpu/drm/i915/intel_display.c | 25 +++
 drivers/gpu/drm/i915/intel_sprite.c  |  4 +-
 drivers/gpu/drm/mediatek/mtk_drm_drv.c   |  2 +-
 drivers/gpu/drm/msm/msm_atomic.c |  2 +-
 drivers/gpu/drm/omapdrm/omap_drv.c   |  2 +-
 drivers/gpu/drm/rcar-du/rcar_du_kms.c|  2 +-
 drivers/gpu/drm/sti/sti_drv.c|  2 +-
 drivers/gpu/drm/tegra/drm.c  |  2 +-
 drivers/gpu/drm/tilcdc/tilcdc_drv.c  |  2 +-
 drivers/gpu/drm/vc4/vc4_kms.c|  2 +-
 include/drm/drm_atomic.h | 12 +++-
 include/drm/drm_crtc.h   |  2 +
 18 files changed, 73 insertions(+), 122 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c 
b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index d4a3d61b7b06..00f30fbd2336 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -464,7 +464,7 @@ atmel_hlcdc_dc_atomic_complete(struct atmel_hlcdc_dc_commit 
*commit)
 
drm_atomic_helper_cleanup_planes(dev, old_state);
 
-   drm_atomic_state_free(old_state);
+   drm_atomic_state_put(old_state);
 
/* Complete the commit, wake up any waiter. */
spin_lock(&dc->commit.wait.lock);
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 5cb2e22d5d55..349c2f0de900 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -74,6 +74,8 @@ EXPORT_SYMBOL(drm_atomic_state_default_release);
 int
 drm_atomic_state_init(struct drm_device *dev, struct drm_atomic_state *state)
 {
+   kref_init(&state->ref);
+
/* TODO legacy paths should maybe do a better job about
 * setting this appropriately?
 */
@@ -215,22 +217,16 @@ void drm_atomic_state_clear(struct drm_atomic_state 
*state)
 EXPORT_SYMBOL(drm_atomic_state_clear);
 
 /**
- * drm_atomic_state_free - free all memory for an atomic state
+ * __drm_atomic_state_free - free all memory for an atomic state
  * @state: atomic state to deallocate
  *
  * This frees all memory associated with an atomic state, including all the
  * per-object state for planes, crtcs and connectors.
  */
-void drm_atomic_state_free(struct drm_atomic_state *state)
+void __drm_atomic_state_free(struct kref *ref)
 {
-   struct drm_device *dev;
-   struct drm_mode_config *config;
-
-   if (!state)
-   return;
-
-   dev = state->dev;
-   config = &dev->mode_config;
+   struct drm_atomic_state *state = container_of(ref, typeof(*state), ref);
+   struct drm_mode_config *config = &state->dev->mode_config;
 
drm_atomic_state_clear(state);
 
@@ -243,7 +239,7 @@ void drm_atomic_state_free(struct drm_atomic_state *state)
kfree(state);
}
 }
-EXPORT_SYMBOL(drm_atomic_state_free);
+EXPORT_SYMBOL(__drm_atomic_state_free);
 
 /**
  * drm_atomic_get_crtc_state - get crtc state
@@ -1742,7 +1738,7 @@ retry:
if (arg->flags & DRM_MODE_ATOMIC_TEST_ONLY) {
/*
 * Unlike commit, check_only does not clean up state.
-* Below we call drm_atomic_state_free for it.
+* Below we call drm_atomic_state_put for it.
 */
ret = drm_atomic_check_only(state);
} else if (arg->flags & DRM_MODE_ATOMIC_NONBLOCK) {
@@ -1775,8 +1771,7 @@ out:
goto retry;
}
 
-   if (ret || arg->flags & DRM_MODE_ATOMIC_TEST_ONLY)
-   drm_atomic_state_free(state);
+   drm_atomic_state_put(state);
 
drm_modeset_drop_locks(&ctx);
drm_modeset_acquire_fini(&ctx);
diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 9abe0a242f96..14dbae947a12 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1187,7 +1187,7 @@ static void commit_tail(struct drm_atomic_state *state)
 
drm_atomic_helper_commit_cleanup_done(state);
 
-   drm_atomic_state_free(state);
+   drm_atomic_state_put(state);
 }
 
 static void commit_work(struct work_struct *work)
@@ -1263,6 +1263,7 

Re: [Intel-gfx] PRMs for older hardware

2016-08-23 Thread Dave Airlie
On 24 August 2016 at 05:54, Ruslan Kabatsayev  wrote:
> Hello all,
>
> On the project page [1] I've found PRMs for more or less modern GPUs.
> But what about such devices as Atom N550 or 915G Express chipset?
> Where can I find documentation about them? The DRM driver does support
> them, but I can't seem to find the docs it's based on.
>
> [1]: https://01.org/linuxgraphics/documentation/hardware-specification-prms

No documents for these were ever publically released unfortunately.

I doubt they will be now.

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


[Intel-gfx] [PATCH v3 4/4] drm/i915: start adding dp mst audio

2016-08-23 Thread Dhinakaran Pandiyan
From: Libin Yang 

(This patch is developed by Dave Airlie  originally)

This patch adds support for DP MST audio in i915.

Enable audio codec when DP MST is enabled if has_audio flag is set.
Disable audio codec when DP MST is disabled if has_audio flag is set.

Another separated patches to support DP MST audio will be implemented
in audio driver.

Signed-off-by: Libin Yang 
Reviewed-by: Lyude 
---
 drivers/gpu/drm/i915/i915_debugfs.c | 19 ++-
 drivers/gpu/drm/i915/intel_ddi.c| 20 +++-
 drivers/gpu/drm/i915/intel_dp_mst.c | 21 +
 drivers/gpu/drm/i915/intel_drv.h|  2 ++
 4 files changed, 56 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index d0b4c74..8ec69d0 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2925,6 +2925,20 @@ static void intel_dp_info(struct seq_file *m,
intel_panel_info(m, &intel_connector->panel);
 }
 
+static void intel_dp_mst_info(struct seq_file *m,
+ struct intel_connector *intel_connector)
+{
+   struct intel_encoder *intel_encoder = intel_connector->encoder;
+   struct intel_dp_mst_encoder *intel_mst =
+   enc_to_mst(&intel_encoder->base);
+   struct intel_digital_port *intel_dig_port = intel_mst->primary;
+   struct intel_dp *intel_dp = &intel_dig_port->dp;
+   bool has_audio = drm_dp_mst_port_has_audio(&intel_dp->mst_mgr,
+   intel_connector->port);
+
+   seq_printf(m, "\taudio support: %s\n", yesno(has_audio));
+}
+
 static void intel_hdmi_info(struct seq_file *m,
struct intel_connector *intel_connector)
 {
@@ -2967,7 +2981,10 @@ static void intel_connector_info(struct seq_file *m,
switch (connector->connector_type) {
case DRM_MODE_CONNECTOR_DisplayPort:
case DRM_MODE_CONNECTOR_eDP:
-   intel_dp_info(m, intel_connector);
+   if (intel_encoder->type == INTEL_OUTPUT_DP_MST)
+   intel_dp_mst_info(m, intel_connector);
+   else
+   intel_dp_info(m, intel_connector);
break;
case DRM_MODE_CONNECTOR_LVDS:
if (intel_encoder->type == INTEL_OUTPUT_LVDS)
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 086de39..1429232 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -2173,6 +2173,19 @@ void intel_ddi_fdi_disable(struct drm_crtc *crtc)
I915_WRITE(FDI_RX_CTL(PIPE_A), val);
 }
 
+bool intel_ddi_is_audio_enabled(struct drm_i915_private *dev_priv,
+struct intel_crtc *intel_crtc)
+{
+   u32 temp;
+
+   if (intel_display_power_is_enabled(dev_priv, POWER_DOMAIN_AUDIO)) {
+   temp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
+   if (temp & AUDIO_OUTPUT_ENABLE(intel_crtc->pipe))
+   return true;
+   }
+   return false;
+}
+
 void intel_ddi_get_config(struct intel_encoder *encoder,
  struct intel_crtc_state *pipe_config)
 {
@@ -2238,11 +2251,8 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
break;
}
 
-   if (intel_display_power_is_enabled(dev_priv, POWER_DOMAIN_AUDIO)) {
-   temp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
-   if (temp & AUDIO_OUTPUT_ENABLE(intel_crtc->pipe))
-   pipe_config->has_audio = true;
-   }
+   pipe_config->has_audio =
+   intel_ddi_is_audio_enabled(dev_priv, intel_crtc);
 
if (encoder->type == INTEL_OUTPUT_EDP && dev_priv->vbt.edp.bpp &&
pipe_config->pipe_bpp > dev_priv->vbt.edp.bpp) {
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c 
b/drivers/gpu/drm/i915/intel_dp_mst.c
index a51f6f7..5d03ebf 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -76,6 +76,8 @@ static bool intel_dp_mst_compute_config(struct intel_encoder 
*encoder,
return false;
}
 
+   if (drm_dp_mst_port_has_audio(&intel_dp->mst_mgr, found->port))
+   pipe_config->has_audio = true;
mst_pbn = drm_dp_calc_pbn_mode(adjusted_mode->crtc_clock, bpp);
 
pipe_config->pbn = mst_pbn;
@@ -97,6 +99,10 @@ static void intel_mst_disable_dp(struct intel_encoder 
*encoder)
struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
struct intel_digital_port *intel_dig_port = intel_mst->primary;
struct intel_dp *intel_dp = &intel_dig_port->dp;
+   struct drm_device *dev = encoder->base.dev;
+   struct drm_i915_private *dev_priv = dev->dev_private;
+   struct drm_crtc *crtc = encoder->base.crtc;
+   struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
int ret;
 
DRM_DEBUG_KMS("%d\n", intel_dp->active_mst_links);

[Intel-gfx] [PATCH v3 3/4] drm/i915: Move audio_connector to intel_encoder

2016-08-23 Thread Dhinakaran Pandiyan
With DP MST, a digital_port can carry more than one audio stream. Hence,
more than one audio_connector needs to be attached to intel_digital_port in
such cases. However, each stream is associated with an unique encoder. So,
instead of creating an array of audio_connectors per port, move
audio_connector from struct intel_digital_port to struct intel_encoder.
This also simplifies access to the right audio_connector from codec
functions in intel_audio.c that receive intel_encoder.

v2: Removed local that are needed anymore.

Signed-off-by: Dhinakaran Pandiyan 
---
 drivers/gpu/drm/i915/intel_audio.c | 12 
 drivers/gpu/drm/i915/intel_drv.h   |  4 ++--
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_audio.c 
b/drivers/gpu/drm/i915/intel_audio.c
index 5a41439..b86bfad 100644
--- a/drivers/gpu/drm/i915/intel_audio.c
+++ b/drivers/gpu/drm/i915/intel_audio.c
@@ -490,7 +490,6 @@ void intel_audio_codec_enable(struct intel_encoder 
*intel_encoder)
struct drm_connector *connector;
struct drm_i915_private *dev_priv = to_i915(encoder->dev);
struct i915_audio_component *acomp = dev_priv->audio_component;
-   struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
enum port port = intel_encoder->attached_port;
 
connector = drm_select_eld(encoder);
@@ -515,7 +514,7 @@ void intel_audio_codec_enable(struct intel_encoder 
*intel_encoder)
 adjusted_mode);
 
mutex_lock(&dev_priv->av_mutex);
-   intel_dig_port->audio_connector = connector;
+   intel_encoder->audio_connector = connector;
/* referred in audio callbacks */
dev_priv->dig_port_map[port] = intel_encoder;
mutex_unlock(&dev_priv->av_mutex);
@@ -536,14 +535,13 @@ void intel_audio_codec_disable(struct intel_encoder 
*intel_encoder)
struct drm_encoder *encoder = &intel_encoder->base;
struct drm_i915_private *dev_priv = to_i915(encoder->dev);
struct i915_audio_component *acomp = dev_priv->audio_component;
-   struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
enum port port = intel_encoder->attached_port;
 
if (dev_priv->display.audio_codec_disable)
dev_priv->display.audio_codec_disable(intel_encoder);
 
mutex_lock(&dev_priv->av_mutex);
-   intel_dig_port->audio_connector = NULL;
+   intel_encoder->audio_connector = NULL;
dev_priv->dig_port_map[port] = NULL;
mutex_unlock(&dev_priv->av_mutex);
 
@@ -704,7 +702,6 @@ static int i915_audio_component_get_eld(struct device *dev, 
int port,
 {
struct drm_i915_private *dev_priv = dev_to_i915(dev);
struct intel_encoder *intel_encoder;
-   struct intel_digital_port *intel_dig_port;
const u8 *eld;
int ret = -EINVAL;
 
@@ -713,10 +710,9 @@ static int i915_audio_component_get_eld(struct device 
*dev, int port,
/* intel_encoder might be NULL for DP MST */
if (intel_encoder) {
ret = 0;
-   intel_dig_port = enc_to_dig_port(&intel_encoder->base);
-   *enabled = intel_dig_port->audio_connector != NULL;
+   *enabled = intel_encoder->audio_connector != NULL;
if (*enabled) {
-   eld = intel_dig_port->audio_connector->eld;
+   eld = intel_encoder->audio_connector->eld;
ret = drm_eld_size(eld);
memcpy(buf, eld, min(max_bytes, ret));
}
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 101d671..0f8eebe 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -232,6 +232,8 @@ struct intel_encoder {
void (*suspend)(struct intel_encoder *);
int crtc_mask;
enum hpd_pin hpd_pin;
+   /* for communication with audio component; protected by av_mutex */
+   const struct drm_connector *audio_connector;
 };
 
 struct intel_panel {
@@ -948,8 +950,6 @@ struct intel_digital_port {
enum irqreturn (*hpd_pulse)(struct intel_digital_port *, bool);
bool release_cl2_override;
uint8_t max_lanes;
-   /* for communication with audio component; protected by av_mutex */
-   const struct drm_connector *audio_connector;
 };
 
 struct intel_dp_mst_encoder {
-- 
2.5.0

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


[Intel-gfx] [PATCH v3 2/4] drm/i915: Switch to using port stored in intel_encoder

2016-08-23 Thread Dhinakaran Pandiyan
Now that we have the port enum stored in intel_encoder use that instead of
dereferencing intel_dig_port. Saves us a few locals.

struct intel_encoder variables have been renamed to be consistent and
convey type information.

Signed-off-by: Dhinakaran Pandiyan 
---
 drivers/gpu/drm/i915/intel_audio.c | 39 +++---
 1 file changed, 15 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_audio.c 
b/drivers/gpu/drm/i915/intel_audio.c
index d32f586..5a41439 100644
--- a/drivers/gpu/drm/i915/intel_audio.c
+++ b/drivers/gpu/drm/i915/intel_audio.c
@@ -276,17 +276,15 @@ static void hsw_audio_codec_disable(struct intel_encoder 
*encoder)
 }
 
 static void hsw_audio_codec_enable(struct drm_connector *connector,
-  struct intel_encoder *encoder,
+  struct intel_encoder *intel_encoder,
   const struct drm_display_mode *adjusted_mode)
 {
struct drm_i915_private *dev_priv = to_i915(connector->dev);
-   struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
+   struct intel_crtc *intel_crtc = to_intel_crtc(intel_encoder->base.crtc);
enum pipe pipe = intel_crtc->pipe;
+   enum port port = intel_encoder->attached_port;
struct i915_audio_component *acomp = dev_priv->audio_component;
const uint8_t *eld = connector->eld;
-   struct intel_digital_port *intel_dig_port =
-   enc_to_dig_port(&encoder->base);
-   enum port port = intel_dig_port->port;
uint32_t tmp;
int len, i;
int n, rate;
@@ -355,14 +353,12 @@ static void hsw_audio_codec_enable(struct drm_connector 
*connector,
mutex_unlock(&dev_priv->av_mutex);
 }
 
-static void ilk_audio_codec_disable(struct intel_encoder *encoder)
+static void ilk_audio_codec_disable(struct intel_encoder *intel_encoder)
 {
-   struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-   struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
-   struct intel_digital_port *intel_dig_port =
-   enc_to_dig_port(&encoder->base);
-   enum port port = intel_dig_port->port;
+   struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
+   struct intel_crtc *intel_crtc = to_intel_crtc(intel_encoder->base.crtc);
enum pipe pipe = intel_crtc->pipe;
+   enum port port = intel_encoder->attached_port;
uint32_t tmp, eldv;
i915_reg_t aud_config, aud_cntrl_st2;
 
@@ -402,18 +398,15 @@ static void ilk_audio_codec_disable(struct intel_encoder 
*encoder)
 }
 
 static void ilk_audio_codec_enable(struct drm_connector *connector,
-  struct intel_encoder *encoder,
+  struct intel_encoder *intel_encoder,
   const struct drm_display_mode *adjusted_mode)
 {
struct drm_i915_private *dev_priv = to_i915(connector->dev);
-   struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
-   struct intel_digital_port *intel_dig_port =
-   enc_to_dig_port(&encoder->base);
-   enum port port = intel_dig_port->port;
+   struct intel_crtc *intel_crtc = to_intel_crtc(intel_encoder->base.crtc);
enum pipe pipe = intel_crtc->pipe;
+   enum port port = intel_encoder->attached_port;
uint8_t *eld = connector->eld;
-   uint32_t eldv;
-   uint32_t tmp;
+   uint32_t tmp, eldv;
int len, i;
i915_reg_t hdmiw_hdmiedid, aud_config, aud_cntl_st, aud_cntrl_st2;
 
@@ -495,11 +488,10 @@ void intel_audio_codec_enable(struct intel_encoder 
*intel_encoder)
struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
const struct drm_display_mode *adjusted_mode = 
&crtc->config->base.adjusted_mode;
struct drm_connector *connector;
-   struct drm_device *dev = encoder->dev;
-   struct drm_i915_private *dev_priv = to_i915(dev);
+   struct drm_i915_private *dev_priv = to_i915(encoder->dev);
struct i915_audio_component *acomp = dev_priv->audio_component;
struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
-   enum port port = intel_dig_port->port;
+   enum port port = intel_encoder->attached_port;
 
connector = drm_select_eld(encoder);
if (!connector)
@@ -542,11 +534,10 @@ void intel_audio_codec_enable(struct intel_encoder 
*intel_encoder)
 void intel_audio_codec_disable(struct intel_encoder *intel_encoder)
 {
struct drm_encoder *encoder = &intel_encoder->base;
-   struct drm_device *dev = encoder->dev;
-   struct drm_i915_private *dev_priv = to_i915(dev);
+   struct drm_i915_private *dev_priv = to_i915(encoder->dev);
struct i915_audio_component *acomp = dev_priv->audio_component;
struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
-   enum port port = intel_dig_port->port;
+   enum port

[Intel-gfx] [PATCH v3 1/4] drm/i915: Store port enum in intel_encoder

2016-08-23 Thread Dhinakaran Pandiyan
Storing the port enum in intel_encoder makes it convenient to know the
port attached to an encoder. Moving the port information up from
intel_digital_port to intel_encoder avoids unecessary intel_digital_port
access and handles MST encoders cleanly without requiring conditional
checks for them (thanks danvet).

Signed-off-by: Dhinakaran Pandiyan 
Cc: Daniel Vetter 
Cc: Ville Syrjälä 
---
 drivers/gpu/drm/i915/i915_drv.h | 1 +
 drivers/gpu/drm/i915/intel_ddi.c| 1 +
 drivers/gpu/drm/i915/intel_dp.c | 1 +
 drivers/gpu/drm/i915/intel_dp_mst.c | 1 +
 drivers/gpu/drm/i915/intel_drv.h| 1 +
 drivers/gpu/drm/i915/intel_dsi.c| 1 +
 drivers/gpu/drm/i915/intel_dvo.c| 2 ++
 drivers/gpu/drm/i915/intel_hdmi.c   | 1 +
 drivers/gpu/drm/i915/intel_lvds.c   | 3 ++-
 drivers/gpu/drm/i915/intel_tv.c | 2 ++
 10 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 9cd102c..60e282d5 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -185,6 +185,7 @@ enum plane {
 #define sprite_name(p, s) ((p) * INTEL_INFO(dev)->num_sprites[(p)] + (s) + 'A')
 
 enum port {
+   PORT_NONE = -1,
PORT_A = 0,
PORT_B,
PORT_C,
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index c2df4e4..086de39 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -2426,6 +2426,7 @@ void intel_ddi_init(struct drm_device *dev, enum port 
port)
intel_dig_port->max_lanes = max_lanes;
 
intel_encoder->type = INTEL_OUTPUT_UNKNOWN;
+   intel_encoder->attached_port = port;
intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
intel_encoder->cloneable = 0;
 
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 364db90..4771428 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -5726,6 +5726,7 @@ bool intel_dp_init(struct drm_device *dev,
intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
}
intel_encoder->cloneable = 0;
+   intel_encoder->attached_port = port;
 
intel_dig_port->hpd_pulse = intel_dp_hpd_pulse;
dev_priv->hotplug.irq_port[port] = intel_dig_port;
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c 
b/drivers/gpu/drm/i915/intel_dp_mst.c
index 629337d..a51f6f7 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -540,6 +540,7 @@ intel_dp_create_fake_mst_encoder(struct intel_digital_port 
*intel_dig_port, enum
 DRM_MODE_ENCODER_DPMST, "DP-MST %c", pipe_name(pipe));
 
intel_encoder->type = INTEL_OUTPUT_DP_MST;
+   intel_encoder->attached_port = intel_dig_port->port;
intel_encoder->crtc_mask = 0x7;
intel_encoder->cloneable = 0;
 
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 1c700b0..101d671 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -202,6 +202,7 @@ struct intel_encoder {
struct drm_encoder base;
 
enum intel_output_type type;
+   enum port attached_port;
unsigned int cloneable;
void (*hot_plug)(struct intel_encoder *);
bool (*compute_config)(struct intel_encoder *,
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index de8e9fb..293e530 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -1478,6 +1478,7 @@ void intel_dsi_init(struct drm_device *dev)
 
intel_connector->get_hw_state = intel_connector_get_hw_state;
 
+   intel_encoder->attached_port = port;
/*
 * On BYT/CHV, pipe A maps to MIPI DSI port A, pipe B maps to MIPI DSI
 * port C. BXT isn't limited like this.
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
index 47bdf9d..86a888f 100644
--- a/drivers/gpu/drm/i915/intel_dvo.c
+++ b/drivers/gpu/drm/i915/intel_dvo.c
@@ -511,7 +511,9 @@ void intel_dvo_init(struct drm_device *dev)
 "DVO %c", intel_dvo_port_name(dvo->dvo_reg));
 
intel_encoder->type = INTEL_OUTPUT_DVO;
+   intel_encoder->attached_port = PORT_NONE;
intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
+
switch (dvo->type) {
case INTEL_DVO_CHIP_TMDS:
intel_encoder->cloneable = (1 << INTEL_OUTPUT_ANALOG) |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c 
b/drivers/gpu/drm/i915/intel_hdmi.c
index 4df9f38..070a5e2 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1962,6 +1962,7 @@ void intel_hdmi_init(struct drm_device *dev,
}
 
intel_encoder->type = INTEL_OUTPUT_HDMI;
+   intel_encoder->attached_port = port;
if (IS_CHERRYVIEW(dev)) {
if (port == PORT_

[Intel-gfx] [PATCH v3 0/4] Prep. for DP audio MST support

2016-08-23 Thread Dhinakaran Pandiyan
This series lays the groundwork for more DP MST audio work that will
follow.

v2:
Different solution replacing the enc_to_dig_port() fix (Ville, Lyude).
No changes to MST audio enabling and move audio_connector patches.
Reordered the patches (Lyude)

v3:
Different solution to get port from encoder (danvet).
Removed locals that are not needed any more.
Minor variable renaming clean up.
Rebased on dinq.
Retained r-b for "start adding dp mst audio" as it does not change.

Dhinakaran Pandiyan (3):
  drm/i915: Store port enum in intel_encoder
  drm/i915: Switch to using port stored in intel_encoder
  drm/i915: Move audio_connector to intel_encoder

Libin Yang (1):
  drm/i915: start adding dp mst audio

 drivers/gpu/drm/i915/i915_debugfs.c | 19 +-
 drivers/gpu/drm/i915/i915_drv.h |  1 +
 drivers/gpu/drm/i915/intel_audio.c  | 51 ++---
 drivers/gpu/drm/i915/intel_ddi.c| 21 +++
 drivers/gpu/drm/i915/intel_dp.c |  1 +
 drivers/gpu/drm/i915/intel_dp_mst.c | 22 
 drivers/gpu/drm/i915/intel_drv.h|  7 +++--
 drivers/gpu/drm/i915/intel_dsi.c|  1 +
 drivers/gpu/drm/i915/intel_dvo.c|  2 ++
 drivers/gpu/drm/i915/intel_hdmi.c   |  1 +
 drivers/gpu/drm/i915/intel_lvds.c   |  3 ++-
 drivers/gpu/drm/i915/intel_tv.c |  2 ++
 12 files changed, 90 insertions(+), 41 deletions(-)

-- 
2.5.0

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


[Intel-gfx] [PATCH] io-mapping: Fixup for different names of writecombine

2016-08-23 Thread Daniel Vetter
Somehow architectures can't agree on this. And for good measure make
sure we have a fallback which should work everywhere (fingers
crossed).

This is to fix a compile fail on microblaze in gpiolib-of.c, which
misguidedly includes io-mapping.h (instead of screaming at whichever
achitecture doesn't correctly pull in asm/io.h from linux/io.h).

Not tested since there's no reasonable way to get at microblaze
toolchains :(

Fixes: ac96b5566926 ("io-mapping.h: s/PAGE_KERNEL_IO/PAGE_KERNEL/")
Cc: Chris Wilson 
Cc: Daniel Vetter 
Cc: Joonas Lahtinen 
Cc: linux...@kvack.org
Signed-off-by: Daniel Vetter 
---
 include/linux/io-mapping.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index a87dd7fffc0a..f4e33756c09c 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -123,7 +123,13 @@ io_mapping_init_wc(struct io_mapping *iomap,
iomap->base = base;
iomap->size = size;
iomap->iomem = ioremap_wc(base, size);
+#ifdef pgprot_noncached_wc /* archs can't agree on a name ... */
+   iomap->prot = pgprot_noncached_wc(PAGE_KERNEL);
+#elif pgprot_writecombine
iomap->prot = pgprot_writecombine(PAGE_KERNEL);
+#else
+   iomap->prot = pgprot_noncached(PAGE_KERNEL);
+#endif
 
return iomap;
 }
-- 
2.9.3

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


[Intel-gfx] PRMs for older hardware

2016-08-23 Thread Ruslan Kabatsayev
Hello all,

On the project page [1] I've found PRMs for more or less modern GPUs.
But what about such devices as Atom N550 or 915G Express chipset?
Where can I find documentation about them? The DRM driver does support
them, but I can't seem to find the docs it's based on.

[1]: https://01.org/linuxgraphics/documentation/hardware-specification-prms

Thanks,
Ruslan
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PULL] topic/drm-misc

2016-08-23 Thread Daniel Vetter
Hi Dave,

A few bigger things:
- start of splitting drm_crtc.c into more manageable and better documneted
  chunks
- DRM_DEV_* logging (Sean)

But besides those it's really all one-off misc patches all over this time
around, trying to summarize them further would just end up in copying the
shortlog ;-)

Once you pulled this in can you pls apply

https://patchwork.freedesktop.org/patch/106979/

on top? I think this patch would benefit from your direct sob, and it has
some trivial conflicts with the doc polish in this pull.

I also have a pile in drm-intel-next, but the io-mapping.h change in there
blew up on some really interesting places because some folks thought this
is the generic iomapping header, without realizing that it's _only_ for
per-page io_mapping (only used by i915, nouveau and some random network
driver, which looks a bit fishy). We need to undo that silliness first
before I can send you that pull (gpiolib and some infiniband files include
linux/io-mapping.h), so probably will take a few days.

Cheers, Daniel


The following changes since commit fc93ff608b15ae32cde3006b7af860b59cac20ec:

  Merge tag 'drm-intel-next-2016-08-08' of 
git://anongit.freedesktop.org/drm-intel into drm-next (2016-08-15 16:53:57 
+1000)

are available in the git repository at:

  git://anongit.freedesktop.org/drm-intel tags/topic/drm-misc-2016-08-23

for you to fetch changes up to 28579f37467cd1a9130a6287cf8322986e0b56f9:

  drm/fb-helper: Make docs for fb_set_suspend wrappers consistent (2016-08-23 
21:12:56 +0200)


Chris Wilson (4):
  dma-buf: Wait on the reservation object when sync'ing before CPU access
  drm: Allow drivers to modify plane_state in prepare_fb/cleanup_fb
  drm: Avoid calling dev_printk(.dev = NULL)
  drm/fb-helper: Fix the dummy remove_conflicting_framebuffers

Clint Taylor (1):
  drm/edid: CEA mode 64 1080p100 vsync pulse width incorrect

Daniel Vetter (23):
  drm/doc: Fix more kerneldoc/sphinx warnings
  drm/doc: Light drm-kms-helper.rst cleanup
  drm/kms-helpers: Extract drm_modeset_helper.[hc]
  drm/doc: Reorg drm-mm.rst
  drm/doc: Reorg for drm-kms.rst
  drm/etnaviv: Don't set drm_device->platformdev
  drm/hisilicon: Don't set drm_device->platformdev
  drm/doc: Remove outdated FIXME for the page_flip callback
  drm/kms: Nuke dirty_info property
  drm/doc: Include drm_atomic.h
  drm: Extract drm_framebuffer.[hc]
  drm/doc: Update drm_framebuffer docs
  drm: Export drm_property_replace_global_blob
  drm: Extract drm_connector.[hc]
  drm/doc: Include new drm_blend.c
  drm: Don't export dp-aux devnode functions
  drm: Update connector documentation
  drm: Remove display_info->min/max_(h|v)max
  drm: document drm_display_info
  vgaarbiter: rst-ifiy and polish kerneldoc
  drm: Fix kerneldoc in drm_plane_helper.c
  Revert "drm/hisilicon: Don't set drm_device->platformdev"
  drm/fb-helper: Make docs for fb_set_suspend wrappers consistent

Eric Engestrom (2):
  drm: make drm_get_format_name thread-safe
  drm: remove `const` attribute to hint at caller that they now own the 
memory

Heinrich Schuchardt (1):
  drm: avoid exposing kernel stack in compat_drm_getstats

Jamie Lentin (1):
  drm/udl: Ensure channel is selected before using the device.

Laurent Pinchart (1):
  drm: Don't implement empty prepare_fb()/cleanup_fb()

Lothar Waßmann (1):
  drm: update kerneldoc for changes introduced by commits "16fadc2568e9" 
and "9671e228fb78"

Markus Elfring (4):
  GPU-DRM-Savage: Use memdup_user() rather than duplicating
  virtio-gpu: Use memdup_user() rather than duplicating its implementation
  drm/bridge: dw-hdmi: Delete unnecessary assignment for the field "owner"
  drm/rockchip: Delete unnecessary assignment for the field "owner"

Noralf Trønnes (1):
  drm/fb-helper: Add drm_fb_helper_set_suspend_unlocked()

Randy Dunlap (1):
  dma-buf: fix kernel-doc warning and typos

Rob Clark (1):
  reservation: fix small comment typo

Sean Paul (3):
  drm: Introduce DRM_DEV_* log messages
  drm/rockchip: Use DRM_DEV_ERROR in vop
  drm/rockchip: Don't continue trying to enable crtc on failure

Shawn Guo (1):
  drm: drop DRIVER_HAVE_IRQ flag for some drivers

Wei Yongjun (1):
  drm/mgag200: fix error return code in mgag200fb_create()

 Documentation/gpu/drm-kms-helpers.rst  |  211 +-
 Documentation/gpu/drm-kms.rst  |  270 +--
 Documentation/gpu/drm-mm.rst   |   58 +-
 Documentation/gpu/drm-uapi.rst |3 +
 Documentation/gpu/index.rst|1 +
 Documentation/gpu/vga-switcheroo.rst   |2 -
 .../{vgaarbiter.txt => gpu/vgaarbiter.rst} |  161 +-
 drivers/dma-buf/dma-buf.c  |   23 +
 drivers/dma-buf/fence-array.c  |6

Re: [Intel-gfx] Display problems after upgrade to X v1.18.3

2016-08-23 Thread Jim Abernathy



On 08/23/2016 03:06 PM, Jim Abernathy wrote:

On 08/23/2016 01:10 PM, David Weinehall wrote:

On Tue, Aug 23, 2016 at 11:40:53AM -0400, Jim Abernathy wrote:

Not having much luck with the Distro forums on this issue so I thought
I'd ask for advice here.

I've been running Ubuntu 14.04.4 for some time on Intel Core i5 GFX
without any issues.  My display is HDMI from the PC to an Onkyo A/V
receiver then to a Sony KDL-XBR6.

Core i5 is a bit vague; to know what graphics generation you run,
could you provide the output of:

sudo cat /sys/kernel/debug/dri/0/i915_capabilities

gen: 6
pch: 2
is_mobile: yes
is_i85x: no
is_i915g: no
is_i945gm: no
is_g33: no
need_gfx_hws: yes
is_g4x: no
is_pineview: no
is_broadwater: no
is_crestline: no
is_ivybridge: no
is_valleyview: no
is_haswell: no
is_skylake: no
is_preliminary: no
has_fbc: yes
has_pipe_cxsr: no
has_hotplug: yes
cursor_needs_physical: no
has_overlay: no
overlay_needs_physical: no
supports_tv: no
has_llc: yes
has_ddi: no
has_fpga_dbg: no
jim@test:~$


Also, since it might be a kernel issue, the kernel version would be
nice to know too (uname -a).

Linux test 4.4.0-34-generic #53-Ubuntu SMP Wed Jul 27 16:06:39 UTC 
2016 x86_64 x86_64 x86_64 GNU/Linux


Intel Desktop DCP847SKE NUC with Intel Celeron CPU 847 @ 1.10GHZ

To explain the differences between my OP about Core i5 and tests on 
Celeron.  My production PC with the problem is a Core i5, buy I took it 
back to Ubuntu 14.04 LTS until this is resolved.  I setup a Celeron NUC 
to use to help solve this issue.  Since All my PCs have Intel GFX and 
all have this problem using the Sony TV and Onkyo receiver on 16.04, the 
NUC was the easiest to setup and leave alone until the problem is resolved.


Jim A


When I try a fresh install of 16.04.1, I get a display that blanks out
for 3-5 seconds at random times depending on what is being displayed
at the time.  I also have small amouts of video noise that is random
horizontal lines about 1 pixel tall scattered through the page.

I noticed that 14.04.05 uses X server 1.17.2 and 16.04.1 uses 1.18.3.

When I do the command xrandr --verbose I see some small differences
between 14.04 and 16.04, but it's things like 2 digits displayed
instead of 1.  i.e. 60.0 vs. 60.00. I'm only concerned with 1080P HD.

I've tried this on different computers all with Intel GFX. same 
results.


This does not occur on other monitors or TVs.

I'd blame it on Sony and Onkyo if they didn't work so well with
Windows, all versions, and Ubuntu all versions except 16.04.

It's almost like the auto detection software in the newest version of
X is off just enough to make my display flaky.  Kind of like the old
analog CRT TVs that were sensitive to small tweaks to the horizontal
and vertical adjustments.

Any help would be appreciated.

Kind regards, David Weinehall


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


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


Re: [Intel-gfx] [drm-intel:for-linux-next 1/1] include/linux/io-mapping.h:126:2: error: implicit declaration of function 'pgprot_writecombine'

2016-08-23 Thread Daniel Vetter
On Tue, Aug 23, 2016 at 9:16 PM, Chris Wilson  wrote:
> On Wed, Aug 24, 2016 at 02:22:29AM +0800, kbuild test robot wrote:
>> tree:   git://anongit.freedesktop.org/drm-intel for-linux-next
>> head:   ac96b5566926af83463ddcf4655856033c092f26
>> commit: ac96b5566926af83463ddcf4655856033c092f26 [1/1] io-mapping.h: 
>> s/PAGE_KERNEL_IO/PAGE_KERNEL/
>> config: microblaze-nommu_defconfig (attached as .config)
>> compiler: microblaze-linux-gcc (GCC) 4.9.0
>> reproduce:
>> wget 
>> https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
>>  -O ~/bin/make.cross
>> chmod +x ~/bin/make.cross
>> git checkout ac96b5566926af83463ddcf4655856033c092f26
>> # save the attached .config to linux build tree
>> make.cross ARCH=microblaze
>>
>> All errors (new ones prefixed by >>):
>>
>>In file included from drivers/gpio/gpiolib-of.c:19:0:
>>include/linux/io-mapping.h: In function 'io_mapping_init_wc':
>> >> include/linux/io-mapping.h:126:2: error: implicit declaration of function 
>> >> 'pgprot_writecombine' [-Werror=implicit-function-declaration]
>>  iomap->prot = pgprot_writecombine(PAGE_KERNEL);
>>  ^
>> >> include/linux/io-mapping.h:126:14: error: incompatible types when 
>> >> assigning to type 'pgprot_t' from type 'int'
>>  iomap->prot = pgprot_writecombine(PAGE_KERNEL);
>>  ^
>>cc1: some warnings being treated as errors
>>
>> vim +/pgprot_writecombine +126 include/linux/io-mapping.h
>
> Grrr.
>
> diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
> index a87dd7fffc0a..babd4c53a5aa 100644
> --- a/include/linux/io-mapping.h
> +++ b/include/linux/io-mapping.h
> @@ -114,6 +114,10 @@ io_mapping_unmap(void __iomem *vaddr)
>  #include 
>  #include 
>
> +#ifdef pgprot_noncached_wc
> +#define pgprot_writecombine pgprot_noncached_wc
> +#endif
> +
>  /* Create the io_mapping object*/
>  static inline struct io_mapping *
>  io_mapping_init_wc(struct io_mapping *iomap,
>
> is what I have in mind. Looks like a divide between x86 and ppc (and
> their followers).

tbh I'm leaning towards reverting, since this is getting a bit
embarrassing ;-) Also the io-mapping.h change wasn't reviewed or acked
by arch maintainers (which is probably should have been in hindsight).
And i915_mm.c probably should be somewhere in arch/core code, too.
I'll discuss this a bit more tomorrow with you &Joonas, but since it's
holding up the drm-intel-next pull revert it likely is.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: free intel_fb

2016-08-23 Thread Patchwork
== Series Details ==

Series: drm/i915: free intel_fb
URL   : https://patchwork.freedesktop.org/series/11477/
State : failure

== Summary ==

Series 11477v1 drm/i915: free intel_fb
http://patchwork.freedesktop.org/api/1.0/series/11477/revisions/1/mbox/

Test gem_exec_suspend:
Subgroup basic-s3:
incomplete -> DMESG-WARN (fi-hsw-4770k)
Test kms_cursor_legacy:
Subgroup basic-cursor-vs-flip-legacy:
pass   -> FAIL   (fi-bsw-n3050)
Subgroup basic-cursor-vs-flip-varying-size:
pass   -> FAIL   (fi-bsw-n3050)
Subgroup basic-flip-vs-cursor-legacy:
fail   -> PASS   (fi-bdw-5557u)
Subgroup basic-flip-vs-cursor-varying-size:
fail   -> PASS   (fi-bsw-n3050)
Test prime_busy:
Subgroup basic-after-default:
pass   -> FAIL   (fi-bsw-n3050)
Subgroup basic-before-default:
pass   -> FAIL   (fi-bsw-n3050)
Subgroup basic-wait-after-default:
pass   -> FAIL   (fi-bsw-n3050)
Subgroup basic-wait-before-default:
pass   -> FAIL   (fi-bsw-n3050)
Test prime_vgem:
Subgroup basic-busy-default:
pass   -> FAIL   (fi-bsw-n3050)
Subgroup basic-gtt:
pass   -> FAIL   (fi-bsw-n3050)
Subgroup basic-sync-default:
pass   -> FAIL   (fi-bsw-n3050)
Subgroup basic-wait-default:
pass   -> FAIL   (fi-bsw-n3050)

fi-bdw-5557u total:249  pass:232  dwarn:0   dfail:0   fail:1   skip:16 
fi-bsw-n3050 total:249  pass:194  dwarn:0   dfail:0   fail:11  skip:44 
fi-byt-n2820 total:249  pass:204  dwarn:0   dfail:0   fail:4   skip:41 
fi-hsw-4770k total:249  pass:220  dwarn:6   dfail:0   fail:1   skip:22 
fi-hsw-4770r total:249  pass:222  dwarn:0   dfail:0   fail:1   skip:26 
fi-ivb-3520m total:249  pass:217  dwarn:0   dfail:0   fail:1   skip:31 
fi-skl-6260u total:249  pass:234  dwarn:0   dfail:0   fail:1   skip:14 
fi-skl-6700k total:249  pass:214  dwarn:4   dfail:0   fail:3   skip:28 
fi-snb-2520m total:249  pass:201  dwarn:4   dfail:0   fail:2   skip:42 
fi-snb-2600  total:249  pass:202  dwarn:4   dfail:0   fail:1   skip:42 

Results at /archive/results/CI_IGT_test/Patchwork_2411/

d05ed1828321404c7fdf369ca17fa958938913bc drm-intel-nightly: 
2016y-08m-23d-16h-32m-14s UTC integration manifest
b9253f5 drm/i915: free intel_fb

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


Re: [Intel-gfx] [drm-intel:for-linux-next 1/1] include/linux/io-mapping.h:126:2: error: implicit declaration of function 'pgprot_writecombine'

2016-08-23 Thread Chris Wilson
On Wed, Aug 24, 2016 at 02:22:29AM +0800, kbuild test robot wrote:
> tree:   git://anongit.freedesktop.org/drm-intel for-linux-next
> head:   ac96b5566926af83463ddcf4655856033c092f26
> commit: ac96b5566926af83463ddcf4655856033c092f26 [1/1] io-mapping.h: 
> s/PAGE_KERNEL_IO/PAGE_KERNEL/
> config: microblaze-nommu_defconfig (attached as .config)
> compiler: microblaze-linux-gcc (GCC) 4.9.0
> reproduce:
> wget 
> https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
>  -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> git checkout ac96b5566926af83463ddcf4655856033c092f26
> # save the attached .config to linux build tree
> make.cross ARCH=microblaze 
> 
> All errors (new ones prefixed by >>):
> 
>In file included from drivers/gpio/gpiolib-of.c:19:0:
>include/linux/io-mapping.h: In function 'io_mapping_init_wc':
> >> include/linux/io-mapping.h:126:2: error: implicit declaration of function 
> >> 'pgprot_writecombine' [-Werror=implicit-function-declaration]
>  iomap->prot = pgprot_writecombine(PAGE_KERNEL);
>  ^
> >> include/linux/io-mapping.h:126:14: error: incompatible types when 
> >> assigning to type 'pgprot_t' from type 'int'
>  iomap->prot = pgprot_writecombine(PAGE_KERNEL);
>  ^
>cc1: some warnings being treated as errors
> 
> vim +/pgprot_writecombine +126 include/linux/io-mapping.h

Grrr.

diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index a87dd7fffc0a..babd4c53a5aa 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -114,6 +114,10 @@ io_mapping_unmap(void __iomem *vaddr)
 #include 
 #include 
 
+#ifdef pgprot_noncached_wc
+#define pgprot_writecombine pgprot_noncached_wc
+#endif
+
 /* Create the io_mapping object*/
 static inline struct io_mapping *
 io_mapping_init_wc(struct io_mapping *iomap,

is what I have in mind. Looks like a divide between x86 and ppc (and
their followers).
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] Display problems after upgrade to X v1.18.3

2016-08-23 Thread Jim Abernathy

On 08/23/2016 01:10 PM, David Weinehall wrote:

On Tue, Aug 23, 2016 at 11:40:53AM -0400, Jim Abernathy wrote:

Not having much luck with the Distro forums on this issue so I thought
I'd ask for advice here.

I've been running Ubuntu 14.04.4 for some time on Intel Core i5 GFX
without any issues.  My display is HDMI from the PC to an Onkyo A/V
receiver then to a Sony KDL-XBR6.

Core i5 is a bit vague; to know what graphics generation you run,
could you provide the output of:

sudo cat /sys/kernel/debug/dri/0/i915_capabilities

gen: 6
pch: 2
is_mobile: yes
is_i85x: no
is_i915g: no
is_i945gm: no
is_g33: no
need_gfx_hws: yes
is_g4x: no
is_pineview: no
is_broadwater: no
is_crestline: no
is_ivybridge: no
is_valleyview: no
is_haswell: no
is_skylake: no
is_preliminary: no
has_fbc: yes
has_pipe_cxsr: no
has_hotplug: yes
cursor_needs_physical: no
has_overlay: no
overlay_needs_physical: no
supports_tv: no
has_llc: yes
has_ddi: no
has_fpga_dbg: no
jim@test:~$


Also, since it might be a kernel issue, the kernel version would be
nice to know too (uname -a).

Linux test 4.4.0-34-generic #53-Ubuntu SMP Wed Jul 27 16:06:39 UTC 2016 
x86_64 x86_64 x86_64 GNU/Linux


Intel Desktop DCP847SKE NUC with Intel Celeron CPU 847 @ 1.10GHZ


When I try a fresh install of 16.04.1, I get a display that blanks out
for 3-5 seconds at random times depending on what is being displayed
at the time.  I also have small amouts of video noise that is random
horizontal lines about 1 pixel tall scattered through the page.

I noticed that 14.04.05 uses X server 1.17.2 and 16.04.1 uses 1.18.3.

When I do the command xrandr --verbose I see some small differences
between 14.04 and 16.04, but it's things like 2 digits displayed
instead of 1.  i.e. 60.0 vs. 60.00. I'm only concerned with 1080P HD.

I've tried this on different computers all with Intel GFX. same results.

This does not occur on other monitors or TVs.

I'd blame it on Sony and Onkyo if they didn't work so well with
Windows, all versions, and Ubuntu all versions except 16.04.

It's almost like the auto detection software in the newest version of
X is off just enough to make my display flaky.  Kind of like the old
analog CRT TVs that were sensitive to small tweaks to the horizontal
and vertical adjustments.

Any help would be appreciated.

Kind regards, David Weinehall


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


[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: use offset value in DRM_DEBUG_KMS

2016-08-23 Thread Patchwork
== Series Details ==

Series: drm/i915: use offset value in DRM_DEBUG_KMS
URL   : https://patchwork.freedesktop.org/series/11476/
State : failure

== Summary ==

Series 11476v1 drm/i915: use offset value in DRM_DEBUG_KMS
http://patchwork.freedesktop.org/api/1.0/series/11476/revisions/1/mbox/

Test gem_exec_suspend:
Subgroup basic-s3:
incomplete -> DMESG-WARN (fi-hsw-4770k)
Test kms_cursor_legacy:
Subgroup basic-flip-vs-cursor-legacy:
pass   -> FAIL   (fi-bsw-n3050)
fail   -> PASS   (fi-skl-6700k)
Subgroup basic-flip-vs-cursor-varying-size:
fail   -> PASS   (fi-skl-6700k)

fi-bdw-5557u total:249  pass:231  dwarn:0   dfail:0   fail:2   skip:16 
fi-bsw-n3050 total:249  pass:202  dwarn:0   dfail:0   fail:3   skip:44 
fi-byt-n2820 total:249  pass:204  dwarn:0   dfail:0   fail:4   skip:41 
fi-hsw-4770k total:249  pass:220  dwarn:6   dfail:0   fail:1   skip:22 
fi-hsw-4770r total:249  pass:222  dwarn:0   dfail:0   fail:1   skip:26 
fi-ivb-3520m total:249  pass:217  dwarn:0   dfail:0   fail:1   skip:31 
fi-skl-6260u total:249  pass:234  dwarn:0   dfail:0   fail:1   skip:14 
fi-skl-6700k total:249  pass:216  dwarn:4   dfail:0   fail:1   skip:28 
fi-snb-2520m total:249  pass:201  dwarn:4   dfail:0   fail:2   skip:42 
fi-snb-2600  total:249  pass:202  dwarn:4   dfail:0   fail:1   skip:42 

Results at /archive/results/CI_IGT_test/Patchwork_2410/

d05ed1828321404c7fdf369ca17fa958938913bc drm-intel-nightly: 
2016y-08m-23d-16h-32m-14s UTC integration manifest
9f91239 drm/i915: use offset value in DRM_DEBUG_KMS

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


[Intel-gfx] [drm-intel:for-linux-next 1/1] include/linux/io-mapping.h:126:2: error: implicit declaration of function 'pgprot_writecombine'

2016-08-23 Thread kbuild test robot
tree:   git://anongit.freedesktop.org/drm-intel for-linux-next
head:   ac96b5566926af83463ddcf4655856033c092f26
commit: ac96b5566926af83463ddcf4655856033c092f26 [1/1] io-mapping.h: 
s/PAGE_KERNEL_IO/PAGE_KERNEL/
config: microblaze-nommu_defconfig (attached as .config)
compiler: microblaze-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout ac96b5566926af83463ddcf4655856033c092f26
# save the attached .config to linux build tree
make.cross ARCH=microblaze 

All errors (new ones prefixed by >>):

   In file included from drivers/gpio/gpiolib-of.c:19:0:
   include/linux/io-mapping.h: In function 'io_mapping_init_wc':
>> include/linux/io-mapping.h:126:2: error: implicit declaration of function 
>> 'pgprot_writecombine' [-Werror=implicit-function-declaration]
 iomap->prot = pgprot_writecombine(PAGE_KERNEL);
 ^
>> include/linux/io-mapping.h:126:14: error: incompatible types when assigning 
>> to type 'pgprot_t' from type 'int'
 iomap->prot = pgprot_writecombine(PAGE_KERNEL);
 ^
   cc1: some warnings being treated as errors

vim +/pgprot_writecombine +126 include/linux/io-mapping.h

   120 resource_size_t base,
   121 unsigned long size)
   122  {
   123  iomap->base = base;
   124  iomap->size = size;
   125  iomap->iomem = ioremap_wc(base, size);
 > 126  iomap->prot = pgprot_writecombine(PAGE_KERNEL);
   127  
   128  return iomap;
   129  }

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [1/2] drm/i915: Create a intel_encoder_find_connector helper function.

2016-08-23 Thread Patchwork
== Series Details ==

Series: series starting with [1/2] drm/i915: Create a 
intel_encoder_find_connector helper function.
URL   : https://patchwork.freedesktop.org/series/11475/
State : failure

== Summary ==

Series 11475v1 Series without cover letter
http://patchwork.freedesktop.org/api/1.0/series/11475/revisions/1/mbox/

Test gem_exec_suspend:
Subgroup basic-s3:
incomplete -> DMESG-WARN (fi-hsw-4770k)
Test kms_cursor_legacy:
Subgroup basic-flip-vs-cursor-legacy:
pass   -> FAIL   (fi-bsw-n3050)
fail   -> PASS   (fi-bdw-5557u)
Test kms_flip:
Subgroup basic-plain-flip:
pass   -> DMESG-WARN (fi-bdw-5557u)

fi-bdw-5557u total:249  pass:231  dwarn:1   dfail:0   fail:1   skip:16 
fi-bsw-n3050 total:249  pass:202  dwarn:0   dfail:0   fail:3   skip:44 
fi-byt-n2820 total:249  pass:204  dwarn:0   dfail:0   fail:4   skip:41 
fi-hsw-4770k total:249  pass:220  dwarn:6   dfail:0   fail:1   skip:22 
fi-hsw-4770r total:249  pass:222  dwarn:0   dfail:0   fail:1   skip:26 
fi-ivb-3520m total:249  pass:217  dwarn:0   dfail:0   fail:1   skip:31 
fi-skl-6260u total:249  pass:234  dwarn:0   dfail:0   fail:1   skip:14 
fi-skl-6700k total:249  pass:214  dwarn:4   dfail:0   fail:3   skip:28 
fi-snb-2520m total:249  pass:201  dwarn:4   dfail:0   fail:2   skip:42 
fi-snb-2600  total:249  pass:202  dwarn:4   dfail:0   fail:1   skip:42 

Results at /archive/results/CI_IGT_test/Patchwork_2409/

d05ed1828321404c7fdf369ca17fa958938913bc drm-intel-nightly: 
2016y-08m-23d-16h-32m-14s UTC integration manifest
d850b44 drm/i915: Cleanup crt disable sequence on hsw+
6d1b137 drm/i915: Create a intel_encoder_find_connector helper function.

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


[Intel-gfx] [PATCH v1 13/13] tests/sw_sync: Add subtest test_sync_multi_producer_single_consumer

2016-08-23 Thread robert . foss
From: Robert Foss 

This subtest runs a single consumer thread and multiple producer thread that
are synchronized using multiple timelines.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 139 
 1 file changed, 139 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 9ff5088..2accdee 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -446,6 +446,142 @@ static void test_sync_multi_consumer_producer(void)
igt_assert_f(thread_ret == 0, "A sync thread reported failure.\n");
 }
 
+static int test_mspc_wait_on_fence(int fence)
+{
+   int error, active;
+
+   do {
+   error = sw_sync_fence_count_status(fence,
+  SW_SYNC_FENCE_STATUS_ERROR);
+   igt_assert_f(error == 0, "Error occurred on fence\n");
+   active = sw_sync_fence_count_status(fence,
+   
SW_SYNC_FENCE_STATUS_ACTIVE);
+   } while (active);
+
+   return 0;
+}
+
+static struct {
+   int iterations;
+   int threads;
+   int counter;
+   int cons_timeline;
+   int *prod_timeline;
+   pthread_mutex_t lock;
+} test_mpsc_data;
+
+static int mpsc_producer_thread(void *d)
+{
+   int id = (long)d;
+   int fence, i;
+   int *prod_timeline = test_mpsc_data.prod_timeline;
+   int cons_timeline = test_mpsc_data.cons_timeline;
+   int iterations = test_mpsc_data.iterations;
+
+   for (i = 0; i < iterations; i++) {
+   fence = sw_sync_fence_create(cons_timeline, i);
+
+   /* Wait for the consumer to finish. Use alternate
+* means of waiting on the fence
+*/
+   if ((iterations + id) % 8 != 0) {
+   igt_assert_f(sw_sync_wait(fence, -1) > 0,
+"Failure waiting on fence\n");
+   } else {
+   igt_assert_f(test_mspc_wait_on_fence(fence) == 0,
+"Failure waiting on fence\n");
+   }
+
+   /* Every producer increments the counter, the consumer
+* checks and erases it
+*/
+   pthread_mutex_lock(&test_mpsc_data.lock);
+   test_mpsc_data.counter++;
+   pthread_mutex_unlock(&test_mpsc_data.lock);
+
+   sw_sync_timeline_inc(prod_timeline[id], 1);
+   sw_sync_fence_destroy(fence);
+   }
+
+   return 0;
+}
+
+static int mpsc_consumer_thread(void)
+{
+   int fence, merged, tmp, it, i;
+   int *prod_timeline = test_mpsc_data.prod_timeline;
+   int cons_timeline = test_mpsc_data.cons_timeline;
+   int iterations = test_mpsc_data.iterations;
+   int n = test_mpsc_data.threads;
+
+   for (it = 1; it <= iterations; it++) {
+   fence = sw_sync_fence_create(prod_timeline[0], it);
+   for (i = 1; i < n; i++) {
+   tmp = sw_sync_fence_create(prod_timeline[i], it);
+   merged = sw_sync_merge(tmp, fence);
+   sw_sync_fence_destroy(tmp);
+   sw_sync_fence_destroy(fence);
+   fence = merged;
+   }
+
+   /* Make sure we see an increment from every producer thread.
+* Vary the means by which we wait.
+*/
+   if (iterations % 8 != 0) {
+   igt_assert_f(sw_sync_wait(fence, -1) == 0,
+   "Producers did not increment as 
expected\n");
+   } else {
+   igt_assert_f(test_mspc_wait_on_fence(fence) == 0,
+"Failure waiting on fence\n");
+   }
+
+   igt_assert_f(test_mpsc_data.counter == n * it,
+"Counter value mismatch\n");
+
+   /* Release the producer threads */
+   sw_sync_timeline_inc(cons_timeline, 1);
+   sw_sync_fence_destroy(fence);
+   }
+
+   return 0;
+}
+
+/* IMPORTANT NOTE: if you see this test failing on your system, it may be
+ * due to a shortage of file descriptors. Please ensure your system has
+ * a sensible limit for this test to finish correctly.
+ */
+static void test_sync_multi_producer_single_consumer(void)
+{
+   int iterations = 1 << 12;
+   int n = 5;
+   int prod_timeline[n];
+   int cons_timeline;
+   pthread_t threads[n];
+   long i;
+
+   cons_timeline = sw_sync_timeline_create();
+   for (i = 0; i < n; i++)
+   prod_timeline[i] = sw_sync_timeline_create();
+
+   test_mpsc_data.prod_timeline = prod_timeline;
+   test_mpsc_data.cons_timeline = cons_timeline;
+   test_mpsc_data.iterations = iterations;
+   test_mpsc_data.threads = n;
+   test_mpsc_data.counter = 0;
+   pthread_mutex_init(&test_mpsc_data.l

[Intel-gfx] [PATCH v1 10/13] tests/sw_sync: Add subtest test_sync_multi_consumer_producer

2016-08-23 Thread robert . foss
From: Robert Foss 

This test verifies that stressing the kernel by creating multiple
consumer/producer threads that wait on a single timeline to be incremented
by another conumer/producer thread does not fail.
And that the order amongst the threads is maintained.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 83 +
 1 file changed, 83 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 0c9c923..0e67ad5 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -303,6 +303,86 @@ static void test_sync_multi_consumer(void)
igt_assert_f(thread_ret == 0, "A sync thread reported failure.\n");
 }
 
+static void * test_sync_multi_consumer_producer_thread(void *arg)
+{
+   data_t *data = arg;
+   int thread_id = data->thread_id;
+   int nbr_threads = data->nbr_threads;
+   int timeline = data->timeline;
+   int iterations = data->nbr_iterations;
+   int ret, i;
+
+   for (i = 0; i < iterations; i++) {
+   int next_point = i * nbr_threads + thread_id;
+   int fence = sw_sync_fence_create(timeline, next_point);
+
+   ret = sw_sync_wait(fence, 1000);
+   if (ret <= 0)
+   {
+   return (void *) 1;
+   }
+
+   if (*(data->counter) != next_point)
+   {
+   return (void *) 1;
+   }
+
+   (*data->counter)++;
+
+   /* Kick off the next thread. */
+   sw_sync_timeline_inc(timeline, 1);
+
+   sw_sync_fence_destroy(fence);
+   }
+   return NULL;
+}
+
+static void test_sync_multi_consumer_producer(void)
+{
+   const uint32_t nbr_threads = 8;
+   const uint32_t nbr_iterations = 1 << 14;
+   data_t data_arr[nbr_threads];
+   pthread_t thread_arr[nbr_threads];
+   int timeline;
+   volatile uint32_t counter = 0;
+   uintptr_t thread_ret = 0;
+   data_t data;
+   int i, ret;
+
+   timeline = sw_sync_timeline_create();
+
+   data.nbr_iterations = nbr_iterations;
+   data.nbr_threads = nbr_threads;
+   data.counter = &counter;
+   data.timeline = timeline;
+
+   /* Start consumer threads. */
+   for (i = 0; i < nbr_threads; i++)
+   {
+   data_arr[i] = data;
+   data_arr[i].thread_id = i;
+   ret = pthread_create(&thread_arr[i], NULL,
+test_sync_multi_consumer_producer_thread,
+(void *) &(data_arr[i]));
+   igt_assert_eq(ret, 0);
+   }
+
+   /* Wait for threads to complete. */
+   for (i = 0; i < nbr_threads; i++)
+   {
+   uintptr_t local_thread_ret;
+   pthread_join(thread_arr[i], (void **)&local_thread_ret);
+   thread_ret |= local_thread_ret;
+   }
+
+   sw_sync_timeline_destroy(timeline);
+
+   igt_assert_f(counter == nbr_threads * nbr_iterations,
+"Counter has unexpected value.\n");
+
+   igt_assert_f(thread_ret == 0, "A sync thread reported failure.\n");
+}
+
 igt_main
 {
igt_subtest("alloc_timeline")
@@ -328,5 +408,8 @@ igt_main
 
igt_subtest("sync_multi_consumer")
test_sync_multi_consumer();
+
+   igt_subtest("sync_multi_consumer_producer")
+   test_sync_multi_consumer_producer();
 }
 
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 09/13] tests/sw_sync: Add subtest test_sync_multi_consumer

2016-08-23 Thread robert . foss
From: Robert Foss 

This subtest verifies the access ordering of multiple consumer threads.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 103 
 1 file changed, 103 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index db03f48..0c9c923 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -27,6 +27,8 @@
  *Robert Foss 
  */
 
+#include 
+#include 
 #include 
 
 #include "sw_sync.h"
@@ -35,6 +37,15 @@
 
 IGT_TEST_DESCRIPTION("Test SW Sync Framework");
 
+typedef struct {
+   int timeline;
+   uint32_t thread_id;
+   uint32_t nbr_threads;
+   uint32_t nbr_iterations;
+   volatile uint32_t * volatile counter;
+   sem_t *sem;
+} data_t;
+
 static void test_alloc_timeline(void)
 {
int timeline;
@@ -203,6 +214,95 @@ static void test_sync_merge_same(void)
sw_sync_timeline_destroy(timeline);
 }
 
+static void * test_sync_multi_consumer_thread(void *arg)
+{
+   data_t *data = arg;
+   int thread_id = data->thread_id;
+   int nbr_threads = data->nbr_threads;
+   int timeline = data->timeline;
+   int iterations = data->nbr_iterations;
+   int ret, i;
+
+   for (i = 0; i < iterations; i++) {
+   int next_point = i * nbr_threads + thread_id;
+   int fence = sw_sync_fence_create(timeline, next_point);
+
+   ret = sw_sync_wait(fence, 1000);
+   if (ret <= 0)
+   {
+   return (void *) 1;
+   }
+
+   if (*(data->counter) != next_point)
+   {
+   return (void *) 1;
+   }
+
+   sem_post(data->sem);
+   sw_sync_fence_destroy(fence);
+   }
+   return NULL;
+}
+
+static void test_sync_multi_consumer(void)
+{
+   const uint32_t nbr_threads = 8;
+   const uint32_t nbr_iterations = 1 << 14;
+   data_t data_arr[nbr_threads];
+   pthread_t thread_arr[nbr_threads];
+   sem_t sem;
+   int timeline;
+   volatile uint32_t counter = 0;
+   uintptr_t thread_ret = 0;
+   data_t data;
+   int i, ret;
+
+   sem_init(&sem, 0, 0);
+   timeline = sw_sync_timeline_create();
+
+   data.nbr_iterations = nbr_iterations;
+   data.nbr_threads = nbr_threads;
+   data.counter = &counter;
+   data.timeline = timeline;
+   data.sem = &sem;
+
+   /* Start sync threads. */
+   for (i = 0; i < nbr_threads; i++)
+   {
+   data_arr[i] = data;
+   data_arr[i].thread_id = i;
+   ret = pthread_create(&thread_arr[i], NULL,
+test_sync_multi_consumer_thread,
+(void *) &(data_arr[i]));
+   igt_assert_eq(ret, 0);
+   }
+
+   /* Produce 'content'. */
+   for (i = 0; i < nbr_threads * nbr_iterations; i++)
+   {
+   sem_wait(&sem);
+
+   counter++;
+   sw_sync_timeline_inc(timeline, 1);
+   }
+
+   /* Wait for threads to complete. */
+   for (i = 0; i < nbr_threads; i++)
+   {
+   uintptr_t local_thread_ret;
+   pthread_join(thread_arr[i], (void **)&local_thread_ret);
+   thread_ret |= local_thread_ret;
+   }
+
+   sw_sync_timeline_destroy(timeline);
+   sem_destroy(&sem);
+
+   igt_assert_f(counter == nbr_threads * nbr_iterations,
+"Counter has unexpected value.\n");
+
+   igt_assert_f(thread_ret == 0, "A sync thread reported failure.\n");
+}
+
 igt_main
 {
igt_subtest("alloc_timeline")
@@ -225,5 +325,8 @@ igt_main
 
igt_subtest("sync_merge_same")
test_sync_merge_same();
+
+   igt_subtest("sync_multi_consumer")
+   test_sync_multi_consumer();
 }
 
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 06/13] tests/sw_sync: Add subtest test_sync_wait

2016-08-23 Thread robert . foss
From: Robert Foss 

This subtest verifies that waiting on fences works properly.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 851430e..07e9638 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -80,6 +80,41 @@ static void test_alloc_merge_fence(void)
sw_sync_timeline_destroy(timeline[1]);
 }
 
+static void test_sync_wait(void)
+{
+   int fence, ret;
+   int timeline;
+
+   timeline = sw_sync_timeline_create();
+   fence = sw_sync_fence_create(timeline, 5);
+
+   /* Wait on fence until timeout */
+   ret = sw_sync_wait(fence, 0);
+   igt_assert_f(ret == 0, "Failure waiting on fence until timeout\n");
+
+   /* Advance timeline from 0 -> 1 */
+   sw_sync_timeline_inc(timeline, 1);
+
+   /* Wait on fence until timeout */
+   ret = sw_sync_wait(fence, 0);
+   igt_assert_f(ret == 0, "Failure waiting on fence until timeout\n");
+
+   /* Signal the fence */
+   sw_sync_timeline_inc(timeline, 4);
+
+   /* Wait successfully */
+   ret = sw_sync_wait(fence, 0);
+   igt_assert_f(ret > 0, "Failure waiting on fence\n");
+
+   /* Go even further, and confirm wait still succeeds */
+   sw_sync_timeline_inc(timeline, 10);
+   ret = sw_sync_wait(fence, 0);
+   igt_assert_f(ret > 0, "Failure waiting ahead\n");
+
+   sw_sync_fence_destroy(fence);
+   sw_sync_timeline_destroy(timeline);
+}
+
 igt_main
 {
igt_subtest("alloc_timeline")
@@ -93,5 +128,8 @@ igt_main
 
igt_subtest("alloc_merge_fence")
test_alloc_merge_fence();
+
+   igt_subtest("sync_wait")
+   test_sync_wait();
 }
 
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 02/13] tests/sw_sync: Add sw_sync test

2016-08-23 Thread robert . foss
From: Robert Foss 

Add initial tests for sw_sync.

Signed-off-by: Gustavo Padovan 
Signed-off-by: Robert Foss 
---
 lib/sw_sync.c  | 13 ++---
 lib/sw_sync.h  |  2 +-
 tests/Makefile.sources |  1 +
 tests/sw_sync.c| 51 ++
 4 files changed, 59 insertions(+), 8 deletions(-)
 create mode 100644 tests/sw_sync.c

diff --git a/lib/sw_sync.c b/lib/sw_sync.c
index c4e7d07..e3d5f85 100644
--- a/lib/sw_sync.c
+++ b/lib/sw_sync.c
@@ -150,8 +150,6 @@ int sw_sync_wait(int fence, int timeout)
 
ret = poll(&fds, 1, timeout);
 
-   sw_sync_fd_close(fence);
-
return ret;
 }
 
@@ -179,9 +177,10 @@ static struct sync_file_info *sync_file_info(int fd)
info->num_fences = num_fences;
 
fence_info = calloc(num_fences, sizeof(struct sync_fence_info));
-   if (!fence_info)
+   if (!fence_info) {
free(info);
return NULL;
+   }
 
info->sync_fence_info = (uint64_t)(unsigned long) (fence_info);
 
@@ -217,18 +216,18 @@ int sw_sync_fence_size(int fd)
return count;
 }
 
-int sw_sync_fence_count_with_status(int fd, int status)
+int sw_sync_fence_count_status(int fd, int status)
 {
int i, count = 0;
-   struct sync_fence_info *fenceInfo = NULL;
+   struct sync_fence_info *fence_info = NULL;
struct sync_file_info *info = sync_file_info(fd);
 
if (!info)
return -1;
 
-   fenceInfo = (struct sync_fence_info *)(uintptr_t)info->sync_fence_info;
+   fence_info = (struct sync_fence_info *)(uintptr_t)info->sync_fence_info;
for (i = 0 ; i < info->num_fences ; i++) {
-   if (fenceInfo[i].status == status)
+   if (fence_info[i].status == status)
count++;
}
 
diff --git a/lib/sw_sync.h b/lib/sw_sync.h
index b179adf..1092608 100644
--- a/lib/sw_sync.h
+++ b/lib/sw_sync.h
@@ -43,7 +43,7 @@ void sw_sync_timeline_inc(int fd, uint32_t count);
 int sw_sync_merge(int fd1, int fd2);
 int sw_sync_wait(int fence, int timeout);
 int sw_sync_fence_size(int fd);
-int sw_sync_fence_count_with_status(int fd, int status);
+int sw_sync_fence_count_status(int fd, int status);
 
 #endif
 
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 72a58ad..0ba769f 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -125,6 +125,7 @@ TESTS_progs_M = \
prime_mmap_kms \
prime_self_import \
prime_vgem \
+   sw_sync \
template \
vgem_basic \
vgem_slow \
diff --git a/tests/sw_sync.c b/tests/sw_sync.c
new file mode 100644
index 000..d2d4c42
--- /dev/null
+++ b/tests/sw_sync.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2012 Google, Inc
+ * Copyright © 2016 Collabora, Ltd.
+ *
+ * Based on the implementation from the Android Open Source Project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ *Robert Foss 
+ */
+
+#include 
+
+#include "sw_sync.h"
+#include "igt.h"
+#include "igt_aux.h"
+
+IGT_TEST_DESCRIPTION("Test SW Sync Framework");
+
+static void test_alloc_timeline(void)
+{
+   int timeline;
+
+   timeline = sw_sync_timeline_create();
+   sw_sync_timeline_destroy(timeline);
+}
+
+igt_main
+{
+   igt_subtest("alloc_timeline")
+   test_alloc_timeline();
+}
+
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 11/13] tests/sw_sync: Add subtest test_sync_random_merge

2016-08-23 Thread robert . foss
From: Robert Foss 

This subtest verifies that creating many timelines and merging random fences
from each timeline with eachother results in merged fences that are fully
functional.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 73 +
 1 file changed, 73 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 0e67ad5..8e5a7c9 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -383,6 +383,76 @@ static void test_sync_multi_consumer_producer(void)
igt_assert_f(thread_ret == 0, "A sync thread reported failure.\n");
 }
 
+static void test_sync_random_merge(void)
+{
+   int i, size, ret;
+   const int nbr_timeline = 32;
+   const int nbr_merge = 1024;
+   int fence_map[nbr_timeline];
+   int timeline_arr[nbr_timeline];
+   int fence, tmpfence, merged;
+   int timeline, timeline_offset, sync_pt;
+
+   srand(time(NULL));
+
+   for (i = 0; i < nbr_timeline; i++)
+   timeline_arr[i] = sw_sync_timeline_create();
+
+   memset(fence_map, -1, sizeof(fence_map));
+
+   sync_pt = rand();
+   fence = sw_sync_fence_create(timeline_arr[0], sync_pt);
+
+   fence_map[0] = sync_pt;
+
+   /* Randomly create syncpoints out of a fixed set of timelines,
+* and merge them together.
+*/
+   for (i = 0; i < nbr_merge; i++) {
+   /* Generate syncpoint. */
+   timeline_offset = rand() % nbr_timeline;
+   timeline = timeline_arr[timeline_offset];
+   sync_pt = rand();
+
+   /* Keep track of the latest sync_pt in each timeline. */
+   if (fence_map[timeline_offset] == -1)
+   fence_map[timeline_offset] = sync_pt;
+   else if (fence_map[timeline_offset] < sync_pt)
+   fence_map[timeline_offset] = sync_pt;
+
+   /* Merge. */
+   tmpfence = sw_sync_fence_create(timeline, sync_pt);
+   merged = sw_sync_merge(tmpfence, fence);
+   sw_sync_fence_destroy(tmpfence);
+   sw_sync_fence_destroy(fence);
+   fence = merged;
+   }
+
+   size = 0;
+   for (i = 0; i < nbr_timeline; i++)
+   if (fence_map[i] != -1)
+   size++;
+
+   /* Trigger the merged fence. */
+   for (i = 0; i < nbr_timeline; i++) {
+   if (fence_map[i] != -1) {
+   ret = sw_sync_wait(fence, 0);
+   igt_assert_f(ret == 0,
+   "Failure waiting on fence until timeout\n");
+   /* Increment the timeline to the last sync_pt */
+   sw_sync_timeline_inc(timeline_arr[i], fence_map[i]);
+   }
+   }
+
+   /* Check that the fence is triggered. */
+   ret = sw_sync_wait(fence, 0);
+   igt_assert_f(ret > 0, "Failure triggering fence\n");
+
+   sw_sync_fence_destroy(fence);
+   for (i = 0; i < nbr_timeline; i++)
+   sw_sync_timeline_destroy(timeline_arr[i]);
+}
+
 igt_main
 {
igt_subtest("alloc_timeline")
@@ -411,5 +481,8 @@ igt_main
 
igt_subtest("sync_multi_consumer_producer")
test_sync_multi_consumer_producer();
+
+   igt_subtest("sync_random_merge")
+   test_sync_random_merge();
 }
 
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 05/13] tests/sw_sync: Add subtest test_alloc_merge_fence

2016-08-23 Thread robert . foss
From: Robert Foss 

This subtest verifies that merging two fences works in the simples possible
case.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 102647d..851430e 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -60,6 +60,26 @@ static void test_alloc_fence_invalid_timeline(void)
sw_sync_fence_create(-1, 0);
 }
 
+static void test_alloc_merge_fence(void)
+{
+   int in_fence[2];
+   int fence_merge;
+   int timeline[2];
+
+   timeline[0] = sw_sync_timeline_create();
+   timeline[1] = sw_sync_timeline_create();
+
+   in_fence[0] = sw_sync_fence_create(timeline[0], 1);
+   in_fence[1] = sw_sync_fence_create(timeline[1], 1);
+   fence_merge = sw_sync_merge(in_fence[1], in_fence[0]);
+
+   sw_sync_fence_destroy(in_fence[0]);
+   sw_sync_fence_destroy(in_fence[1]);
+   sw_sync_fence_destroy(fence_merge);
+   sw_sync_timeline_destroy(timeline[0]);
+   sw_sync_timeline_destroy(timeline[1]);
+}
+
 igt_main
 {
igt_subtest("alloc_timeline")
@@ -70,5 +90,8 @@ igt_main
 
igt_subtest("alloc_fence_invalid_timeline")
test_alloc_fence_invalid_timeline();
+
+   igt_subtest("alloc_merge_fence")
+   test_alloc_merge_fence();
 }
 
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 07/13] tests/sw_sync: Add subtest test_sync_merge

2016-08-23 Thread robert . foss
From: Robert Foss 

Add subtest test_sync_merge that tests merging fences and the validity of the
resulting merged fence.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 67 +
 1 file changed, 67 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 07e9638..00ac44b 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -115,6 +115,70 @@ static void test_sync_wait(void)
sw_sync_timeline_destroy(timeline);
 }
 
+static void test_sync_merge(void)
+{
+   int in_fence[3];
+   int fence_merge;
+   int timeline;
+   int active, signaled;
+
+   timeline = sw_sync_timeline_create();
+   in_fence[0] = sw_sync_fence_create(timeline, 1);
+   in_fence[1] = sw_sync_fence_create(timeline, 2);
+   in_fence[2] = sw_sync_fence_create(timeline, 3);
+
+   fence_merge = sw_sync_merge(in_fence[0], in_fence[1]);
+   fence_merge = sw_sync_merge(in_fence[2], fence_merge);
+
+   /* confirm all fences have one active point (even d) */
+   active = sw_sync_fence_count_status(in_fence[0],
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   igt_assert_f(active == 1, "in_fence[0] has too many active fences\n");
+   active = sw_sync_fence_count_status(in_fence[1],
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   igt_assert_f(active == 1, "in_fence[1] has too many active fences\n");
+   active = sw_sync_fence_count_status(in_fence[2],
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   igt_assert_f(active == 1, "in_fence[2] has too many active fences\n");
+   active = sw_sync_fence_count_status(fence_merge,
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   igt_assert_f(active == 1, "fence_merge has too many active fences\n");
+
+   /* confirm that fence_merge is not signaled until the max of fence 
0,1,2 */
+   sw_sync_timeline_inc(timeline, 1);
+   signaled = sw_sync_fence_count_status(in_fence[0],
+ SW_SYNC_FENCE_STATUS_SIGNALED);
+   active = sw_sync_fence_count_status(fence_merge,
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   igt_assert_f(signaled == 1, "in_fence[0] did not signal\n");
+   igt_assert_f(active == 1, "fence_merge signaled too early\n");
+
+   sw_sync_timeline_inc(timeline, 1);
+   signaled = sw_sync_fence_count_status(in_fence[1],
+ SW_SYNC_FENCE_STATUS_SIGNALED);
+   active = sw_sync_fence_count_status(fence_merge,
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   igt_assert_f(signaled == 1, "in_fence[1] did not signal\n");
+   igt_assert_f(active == 1, "fence_merge signaled too early\n");
+
+   sw_sync_timeline_inc(timeline, 1);
+   signaled = sw_sync_fence_count_status(in_fence[2],
+ SW_SYNC_FENCE_STATUS_SIGNALED);
+   igt_assert_f(signaled == 1, "in_fence[2] did not signal\n");
+   signaled = sw_sync_fence_count_status(fence_merge,
+  SW_SYNC_FENCE_STATUS_SIGNALED);
+   active = sw_sync_fence_count_status(fence_merge,
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   igt_assert_f(active == 0 && signaled == 1,
+"fence_merge did not signal\n");
+
+   sw_sync_fence_destroy(in_fence[0]);
+   sw_sync_fence_destroy(in_fence[1]);
+   sw_sync_fence_destroy(in_fence[2]);
+   sw_sync_fence_destroy(fence_merge);
+   sw_sync_timeline_destroy(timeline);
+}
+
 igt_main
 {
igt_subtest("alloc_timeline")
@@ -131,5 +195,8 @@ igt_main
 
igt_subtest("sync_wait")
test_sync_wait();
+
+   igt_subtest("sync_merge")
+   test_sync_merge();
 }
 
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 08/13] tests/sw_sync: Add subtest test_sync_merge_same

2016-08-23 Thread robert . foss
From: Robert Foss 

This subtest verifies merging a fence with itself does not fail.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 00ac44b..db03f48 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -179,6 +179,30 @@ static void test_sync_merge(void)
sw_sync_timeline_destroy(timeline);
 }
 
+static void test_sync_merge_same(void)
+{
+   int in_fence[2];
+   int timeline;
+   int signaled;
+
+   timeline = sw_sync_timeline_create();
+   in_fence[0] = sw_sync_fence_create(timeline, 1);
+   in_fence[1] = sw_sync_merge(in_fence[0], in_fence[0]);
+
+   signaled = sw_sync_fence_count_status(in_fence[0],
+ SW_SYNC_FENCE_STATUS_SIGNALED);
+   igt_assert_f(signaled == 0, "fence signaled too early\n");
+
+   sw_sync_timeline_inc(timeline, 1);
+   signaled = sw_sync_fence_count_status(in_fence[0],
+ SW_SYNC_FENCE_STATUS_SIGNALED);
+   igt_assert_f(signaled == 1, "fence did not signal\n");
+
+   sw_sync_fence_destroy(in_fence[0]);
+   sw_sync_fence_destroy(in_fence[1]);
+   sw_sync_timeline_destroy(timeline);
+}
+
 igt_main
 {
igt_subtest("alloc_timeline")
@@ -198,5 +222,8 @@ igt_main
 
igt_subtest("sync_merge")
test_sync_merge();
+
+   igt_subtest("sync_merge_same")
+   test_sync_merge_same();
 }
 
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 04/13] tests/sw_sync: Add subtest test_alloc_fence_invalid_timeline

2016-08-23 Thread robert . foss
From: Robert Foss 

This subtests tests that creating fences on negative timelines fail.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index a8c8ca4..102647d 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -55,6 +55,10 @@ static void test_alloc_fence(void)
sw_sync_timeline_destroy(timeline);
 }
 
+static void test_alloc_fence_invalid_timeline(void)
+{
+   sw_sync_fence_create(-1, 0);
+}
 
 igt_main
 {
@@ -63,5 +67,8 @@ igt_main
 
igt_subtest("alloc_fence")
test_alloc_fence();
+
+   igt_subtest("alloc_fence_invalid_timeline")
+   test_alloc_fence_invalid_timeline();
 }
 
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 12/13] tests/sw_sync: Add subtest test_sync_multi_timeline_wait

2016-08-23 Thread robert . foss
From: Robert Foss 

This subtest verifies that waiting, timing out on a wait and that counting
fences in various states works.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 66 +
 1 file changed, 66 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 8e5a7c9..9ff5088 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -214,6 +214,69 @@ static void test_sync_merge_same(void)
sw_sync_timeline_destroy(timeline);
 }
 
+static void test_sync_multi_timeline_wait(void)
+{
+   int timeline[3];
+   int in_fence[3];
+   int fence_merge;
+   int active, signaled, ret;
+
+   timeline[0] = sw_sync_timeline_create();
+   timeline[1] = sw_sync_timeline_create();
+   timeline[2] = sw_sync_timeline_create();
+
+   in_fence[0] = sw_sync_fence_create(timeline[0], 5);
+   in_fence[1] = sw_sync_fence_create(timeline[1], 5);
+   in_fence[2] = sw_sync_fence_create(timeline[2], 5);
+
+   fence_merge = sw_sync_merge(in_fence[0], in_fence[1]);
+   fence_merge = sw_sync_merge(in_fence[2], fence_merge);
+
+   /* Confirm fence isn't signaled */
+   active = sw_sync_fence_count_status(fence_merge,
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   igt_assert_f(active == 3, "Fence signaled too early\n");
+
+   ret = sw_sync_wait(fence_merge, 0);
+   igt_assert_f(ret == 0, "Failure waiting on fence until timeout\n");
+
+   sw_sync_timeline_inc(timeline[0], 5);
+   active = sw_sync_fence_count_status(fence_merge,
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   signaled = sw_sync_fence_count_status(fence_merge,
+ SW_SYNC_FENCE_STATUS_SIGNALED);
+   igt_assert_f(active == 2 && signaled == 1,
+   "Fence did not signal properly\n");
+
+   sw_sync_timeline_inc(timeline[1], 5);
+   active = sw_sync_fence_count_status(fence_merge,
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   signaled = sw_sync_fence_count_status(fence_merge,
+ SW_SYNC_FENCE_STATUS_SIGNALED);
+   igt_assert_f(active == 1 && signaled == 2,
+   "Fence did not signal properly\n");
+
+   sw_sync_timeline_inc(timeline[2], 5);
+   active = sw_sync_fence_count_status(fence_merge,
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   signaled = sw_sync_fence_count_status(fence_merge,
+ SW_SYNC_FENCE_STATUS_SIGNALED);
+   igt_assert_f(active == 0 && signaled == 3,
+"Fence did not signal properly\n");
+
+   /* confirm you can successfully wait */
+   ret = sw_sync_wait(fence_merge, 100);
+   igt_assert_f(ret > 0, "Failure waiting on signaled fence\n");
+
+   sw_sync_fence_destroy(in_fence[0]);
+   sw_sync_fence_destroy(in_fence[1]);
+   sw_sync_fence_destroy(in_fence[2]);
+   sw_sync_fence_destroy(fence_merge);
+   sw_sync_timeline_destroy(timeline[0]);
+   sw_sync_timeline_destroy(timeline[1]);
+   sw_sync_timeline_destroy(timeline[2]);
+}
+
 static void * test_sync_multi_consumer_thread(void *arg)
 {
data_t *data = arg;
@@ -476,6 +539,9 @@ igt_main
igt_subtest("sync_merge_same")
test_sync_merge_same();
 
+   igt_subtest("sync_multi_timeline_wait")
+   test_sync_multi_timeline_wait();
+
igt_subtest("sync_multi_consumer")
test_sync_multi_consumer();
 
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 03/13] tests/sw_sync: Add subtest test_alloc_fence

2016-08-23 Thread robert . foss
From: Robert Foss 

Add subtest alloc_fence that verifies that it's possible to allocate a fence
on a timeline.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index d2d4c42..a8c8ca4 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -43,9 +43,25 @@ static void test_alloc_timeline(void)
sw_sync_timeline_destroy(timeline);
 }
 
+static void test_alloc_fence(void)
+{
+   int in_fence;
+   int timeline;
+
+   timeline = sw_sync_timeline_create();
+   in_fence = sw_sync_fence_create(timeline, 0);
+
+   sw_sync_fence_destroy(in_fence);
+   sw_sync_timeline_destroy(timeline);
+}
+
+
 igt_main
 {
igt_subtest("alloc_timeline")
test_alloc_timeline();
+
+   igt_subtest("alloc_fence")
+   test_alloc_fence();
 }
 
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 00/13] Implement sw_sync test

2016-08-23 Thread robert . foss
From: Robert Foss 

This series implements the sw_sync test and the lib/sw_sync helper functions
for said test.

Gustavo Padovans sw_sync series was just de-staged in
gregkh-staging/staging-next [1], and this test is targeted at verifying the
functionality implemented in that series.

The sw_sync subtests range from very basic tests of the sw_sync functionality,
to stress testing and randomized tests.

[1] http://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/

Robert Foss (13):
  lib/sw_sync: Add helper functions for managing synchronization
primitives
  tests/sw_sync: Add sw_sync test
  tests/sw_sync: Add subtest test_alloc_fence
  tests/sw_sync: Add subtest test_alloc_fence_invalid_timeline
  tests/sw_sync: Add subtest test_alloc_merge_fence
  tests/sw_sync: Add subtest test_sync_wait
  tests/sw_sync: Add subtest test_sync_merge
  tests/sw_sync: Add subtest test_sync_merge_same
  tests/sw_sync: Add subtest test_sync_multi_consumer
  tests/sw_sync: Add subtest test_sync_multi_consumer_producer
  tests/sw_sync: Add subtest test_sync_random_merge
  tests/sw_sync: Add subtest test_sync_multi_timeline_wait
  tests/sw_sync: Add subtest test_sync_multi_producer_single_consumer

 lib/Makefile.sources   |   2 +
 lib/sw_sync.c  | 237 +
 lib/sw_sync.h  |  49 
 tests/Makefile.sources |   1 +
 tests/sw_sync.c| 693 +
 5 files changed, 982 insertions(+)
 create mode 100644 lib/sw_sync.c
 create mode 100644 lib/sw_sync.h
 create mode 100644 tests/sw_sync.c

-- 
2.7.4

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


[Intel-gfx] [PATCH v1 01/13] lib/sw_sync: Add helper functions for managing synchronization primitives

2016-08-23 Thread robert . foss
From: Robert Foss 

Base functions to help testing the Sync File Framework (explicit fencing
mechanism ported from Android).
These functions allow you to create, use and destroy timelines and fences.

Signed-off-by: Gustavo Padovan 
Signed-off-by: Robert Foss 
---
 lib/Makefile.sources |   2 +
 lib/sw_sync.c| 238 +++
 lib/sw_sync.h|  49 +++
 3 files changed, 289 insertions(+)
 create mode 100644 lib/sw_sync.c
 create mode 100644 lib/sw_sync.h

diff --git a/lib/Makefile.sources b/lib/Makefile.sources
index bac9a7f..3dc7c3c 100644
--- a/lib/Makefile.sources
+++ b/lib/Makefile.sources
@@ -61,6 +61,8 @@ lib_source_list = \
rendercopy_gen8.c   \
rendercopy_gen9.c   \
rendercopy.h\
+   sw_sync.c   \
+   sw_sync.h   \
intel_reg_map.c \
intel_iosf.c\
igt_kms.c   \
diff --git a/lib/sw_sync.c b/lib/sw_sync.c
new file mode 100644
index 000..c4e7d07
--- /dev/null
+++ b/lib/sw_sync.c
@@ -0,0 +1,238 @@
+/*
+ * Copyright 2012 Google, Inc
+ * Copyright © 2016 Collabora, Ltd.
+ *
+ * Based on the implementation from the Android Open Source Project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ *Robert Foss 
+ */
+
+#ifndef ANDROID
+#define _GNU_SOURCE
+#else
+#include 
+#endif
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sw_sync.h"
+#include "drmtest.h"
+#include "ioctl_wrappers.h"
+
+#ifndef SW_SYNC_IOC_INC
+struct sw_sync_create_fence_data {
+   __u32   value;
+   charname[32];
+   __s32   fence;
+};
+
+#define SW_SYNC_IOC_MAGIC  'W'
+#define SW_SYNC_IOC_CREATE_FENCE   _IOWR(SW_SYNC_IOC_MAGIC, 0,\
+   struct 
sw_sync_create_fence_data)
+#define SW_SYNC_IOC_INC_IOW(SW_SYNC_IOC_MAGIC, 1, 
__u32)
+#endif
+
+int sw_sync_fd_is_valid(int fd)
+{
+   int status;
+
+   if (fd == -1)
+   return 0;
+
+   status = fcntl(fd, F_GETFD, 0);
+   return status >= 0;
+}
+
+static
+void sw_sync_fd_close(int fd)
+{
+   if (fd == -1)
+   return;
+
+   if (fcntl(fd, F_GETFD, 0) < 0)
+   return;
+
+   close(fd);
+}
+
+int sw_sync_timeline_create(void)
+{
+   int fd = open("/dev/sw_sync", O_RDWR);
+
+   if (!sw_sync_fd_is_valid(fd))
+   fd = open("/sys/kernel/debug/sync/sw_sync", O_RDWR);
+
+   igt_assert(sw_sync_fd_is_valid(fd));
+
+   return fd;
+}
+
+void sw_sync_timeline_destroy(int fd)
+{
+   return sw_sync_fd_close(fd);
+}
+
+void sw_sync_fence_destroy(int fd)
+{
+   return sw_sync_fd_close(fd);
+}
+
+int sw_sync_fence_create(int fd, int32_t seqno)
+{
+   struct sw_sync_create_fence_data data = {};
+
+   data.value = seqno;
+   if (fd >= 0) {
+   do_ioctl(fd, SW_SYNC_IOC_CREATE_FENCE, &data);
+   return data.fence;
+   } else {
+   do_ioctl_err(fd, SW_SYNC_IOC_CREATE_FENCE, &data, EBADF);
+   return -1;
+   }
+}
+
+void sw_sync_timeline_inc(int fd, uint32_t count)
+{
+   uint32_t arg = count;
+
+   if (fd == 0 || fd == -1)
+   return;
+
+   do_ioctl(fd, SW_SYNC_IOC_INC, &arg);
+}
+
+int sw_sync_merge(int fd1, int fd2)
+{
+   struct sync_merge_data data = {};
+   int err;
+
+   data.fd2 = fd2;
+
+   err = ioctl(fd1, SYNC_IOC_MERGE, &data);
+   if (err < 0)
+   return err;
+
+   sw_sync_fd_is_valid(data.fence);
+
+   return data.fence;
+}
+
+int sw_sync_wait(int fence, int timeout)
+{
+   struct pollfd fds;
+   int ret;
+
+   fds.fd = fence;
+   fds.events = POLLIN | POLLERR;
+
+   ret = poll(&fds, 1, timeout);
+
+   sw_sync_fd_close(fence);
+
+   return ret;
+}
+
+s

[Intel-gfx] [PATCH v1 10/13] tests/sw_sync: Add subtest test_sync_multi_consumer_producer

2016-08-23 Thread robert . foss
From: Robert Foss 

This test verifies that stressing the kernel by creating multiple
consumer/producer threads that wait on a single timeline to be incremented
by another conumer/producer thread does not fail.
And that the order amongst the threads is maintained.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 83 +
 1 file changed, 83 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 0c9c923..0e67ad5 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -303,6 +303,86 @@ static void test_sync_multi_consumer(void)
igt_assert_f(thread_ret == 0, "A sync thread reported failure.\n");
 }
 
+static void * test_sync_multi_consumer_producer_thread(void *arg)
+{
+   data_t *data = arg;
+   int thread_id = data->thread_id;
+   int nbr_threads = data->nbr_threads;
+   int timeline = data->timeline;
+   int iterations = data->nbr_iterations;
+   int ret, i;
+
+   for (i = 0; i < iterations; i++) {
+   int next_point = i * nbr_threads + thread_id;
+   int fence = sw_sync_fence_create(timeline, next_point);
+
+   ret = sw_sync_wait(fence, 1000);
+   if (ret <= 0)
+   {
+   return (void *) 1;
+   }
+
+   if (*(data->counter) != next_point)
+   {
+   return (void *) 1;
+   }
+
+   (*data->counter)++;
+
+   /* Kick off the next thread. */
+   sw_sync_timeline_inc(timeline, 1);
+
+   sw_sync_fence_destroy(fence);
+   }
+   return NULL;
+}
+
+static void test_sync_multi_consumer_producer(void)
+{
+   const uint32_t nbr_threads = 8;
+   const uint32_t nbr_iterations = 1 << 14;
+   data_t data_arr[nbr_threads];
+   pthread_t thread_arr[nbr_threads];
+   int timeline;
+   volatile uint32_t counter = 0;
+   uintptr_t thread_ret = 0;
+   data_t data;
+   int i, ret;
+
+   timeline = sw_sync_timeline_create();
+
+   data.nbr_iterations = nbr_iterations;
+   data.nbr_threads = nbr_threads;
+   data.counter = &counter;
+   data.timeline = timeline;
+
+   /* Start consumer threads. */
+   for (i = 0; i < nbr_threads; i++)
+   {
+   data_arr[i] = data;
+   data_arr[i].thread_id = i;
+   ret = pthread_create(&thread_arr[i], NULL,
+test_sync_multi_consumer_producer_thread,
+(void *) &(data_arr[i]));
+   igt_assert_eq(ret, 0);
+   }
+
+   /* Wait for threads to complete. */
+   for (i = 0; i < nbr_threads; i++)
+   {
+   uintptr_t local_thread_ret;
+   pthread_join(thread_arr[i], (void **)&local_thread_ret);
+   thread_ret |= local_thread_ret;
+   }
+
+   sw_sync_timeline_destroy(timeline);
+
+   igt_assert_f(counter == nbr_threads * nbr_iterations,
+"Counter has unexpected value.\n");
+
+   igt_assert_f(thread_ret == 0, "A sync thread reported failure.\n");
+}
+
 igt_main
 {
igt_subtest("alloc_timeline")
@@ -328,5 +408,8 @@ igt_main
 
igt_subtest("sync_multi_consumer")
test_sync_multi_consumer();
+
+   igt_subtest("sync_multi_consumer_producer")
+   test_sync_multi_consumer_producer();
 }
 
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 09/13] tests/sw_sync: Add subtest test_sync_multi_consumer

2016-08-23 Thread robert . foss
From: Robert Foss 

This subtest verifies the access ordering of multiple consumer threads.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 103 
 1 file changed, 103 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index db03f48..0c9c923 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -27,6 +27,8 @@
  *Robert Foss 
  */
 
+#include 
+#include 
 #include 
 
 #include "sw_sync.h"
@@ -35,6 +37,15 @@
 
 IGT_TEST_DESCRIPTION("Test SW Sync Framework");
 
+typedef struct {
+   int timeline;
+   uint32_t thread_id;
+   uint32_t nbr_threads;
+   uint32_t nbr_iterations;
+   volatile uint32_t * volatile counter;
+   sem_t *sem;
+} data_t;
+
 static void test_alloc_timeline(void)
 {
int timeline;
@@ -203,6 +214,95 @@ static void test_sync_merge_same(void)
sw_sync_timeline_destroy(timeline);
 }
 
+static void * test_sync_multi_consumer_thread(void *arg)
+{
+   data_t *data = arg;
+   int thread_id = data->thread_id;
+   int nbr_threads = data->nbr_threads;
+   int timeline = data->timeline;
+   int iterations = data->nbr_iterations;
+   int ret, i;
+
+   for (i = 0; i < iterations; i++) {
+   int next_point = i * nbr_threads + thread_id;
+   int fence = sw_sync_fence_create(timeline, next_point);
+
+   ret = sw_sync_wait(fence, 1000);
+   if (ret <= 0)
+   {
+   return (void *) 1;
+   }
+
+   if (*(data->counter) != next_point)
+   {
+   return (void *) 1;
+   }
+
+   sem_post(data->sem);
+   sw_sync_fence_destroy(fence);
+   }
+   return NULL;
+}
+
+static void test_sync_multi_consumer(void)
+{
+   const uint32_t nbr_threads = 8;
+   const uint32_t nbr_iterations = 1 << 14;
+   data_t data_arr[nbr_threads];
+   pthread_t thread_arr[nbr_threads];
+   sem_t sem;
+   int timeline;
+   volatile uint32_t counter = 0;
+   uintptr_t thread_ret = 0;
+   data_t data;
+   int i, ret;
+
+   sem_init(&sem, 0, 0);
+   timeline = sw_sync_timeline_create();
+
+   data.nbr_iterations = nbr_iterations;
+   data.nbr_threads = nbr_threads;
+   data.counter = &counter;
+   data.timeline = timeline;
+   data.sem = &sem;
+
+   /* Start sync threads. */
+   for (i = 0; i < nbr_threads; i++)
+   {
+   data_arr[i] = data;
+   data_arr[i].thread_id = i;
+   ret = pthread_create(&thread_arr[i], NULL,
+test_sync_multi_consumer_thread,
+(void *) &(data_arr[i]));
+   igt_assert_eq(ret, 0);
+   }
+
+   /* Produce 'content'. */
+   for (i = 0; i < nbr_threads * nbr_iterations; i++)
+   {
+   sem_wait(&sem);
+
+   counter++;
+   sw_sync_timeline_inc(timeline, 1);
+   }
+
+   /* Wait for threads to complete. */
+   for (i = 0; i < nbr_threads; i++)
+   {
+   uintptr_t local_thread_ret;
+   pthread_join(thread_arr[i], (void **)&local_thread_ret);
+   thread_ret |= local_thread_ret;
+   }
+
+   sw_sync_timeline_destroy(timeline);
+   sem_destroy(&sem);
+
+   igt_assert_f(counter == nbr_threads * nbr_iterations,
+"Counter has unexpected value.\n");
+
+   igt_assert_f(thread_ret == 0, "A sync thread reported failure.\n");
+}
+
 igt_main
 {
igt_subtest("alloc_timeline")
@@ -225,5 +325,8 @@ igt_main
 
igt_subtest("sync_merge_same")
test_sync_merge_same();
+
+   igt_subtest("sync_multi_consumer")
+   test_sync_multi_consumer();
 }
 
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 12/13] tests/sw_sync: Add subtest test_sync_multi_timeline_wait

2016-08-23 Thread robert . foss
From: Robert Foss 

This subtest verifies that waiting, timing out on a wait and that counting
fences in various states works.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 66 +
 1 file changed, 66 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 8e5a7c9..9ff5088 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -214,6 +214,69 @@ static void test_sync_merge_same(void)
sw_sync_timeline_destroy(timeline);
 }
 
+static void test_sync_multi_timeline_wait(void)
+{
+   int timeline[3];
+   int in_fence[3];
+   int fence_merge;
+   int active, signaled, ret;
+
+   timeline[0] = sw_sync_timeline_create();
+   timeline[1] = sw_sync_timeline_create();
+   timeline[2] = sw_sync_timeline_create();
+
+   in_fence[0] = sw_sync_fence_create(timeline[0], 5);
+   in_fence[1] = sw_sync_fence_create(timeline[1], 5);
+   in_fence[2] = sw_sync_fence_create(timeline[2], 5);
+
+   fence_merge = sw_sync_merge(in_fence[0], in_fence[1]);
+   fence_merge = sw_sync_merge(in_fence[2], fence_merge);
+
+   /* Confirm fence isn't signaled */
+   active = sw_sync_fence_count_status(fence_merge,
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   igt_assert_f(active == 3, "Fence signaled too early\n");
+
+   ret = sw_sync_wait(fence_merge, 0);
+   igt_assert_f(ret == 0, "Failure waiting on fence until timeout\n");
+
+   sw_sync_timeline_inc(timeline[0], 5);
+   active = sw_sync_fence_count_status(fence_merge,
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   signaled = sw_sync_fence_count_status(fence_merge,
+ SW_SYNC_FENCE_STATUS_SIGNALED);
+   igt_assert_f(active == 2 && signaled == 1,
+   "Fence did not signal properly\n");
+
+   sw_sync_timeline_inc(timeline[1], 5);
+   active = sw_sync_fence_count_status(fence_merge,
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   signaled = sw_sync_fence_count_status(fence_merge,
+ SW_SYNC_FENCE_STATUS_SIGNALED);
+   igt_assert_f(active == 1 && signaled == 2,
+   "Fence did not signal properly\n");
+
+   sw_sync_timeline_inc(timeline[2], 5);
+   active = sw_sync_fence_count_status(fence_merge,
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   signaled = sw_sync_fence_count_status(fence_merge,
+ SW_SYNC_FENCE_STATUS_SIGNALED);
+   igt_assert_f(active == 0 && signaled == 3,
+"Fence did not signal properly\n");
+
+   /* confirm you can successfully wait */
+   ret = sw_sync_wait(fence_merge, 100);
+   igt_assert_f(ret > 0, "Failure waiting on signaled fence\n");
+
+   sw_sync_fence_destroy(in_fence[0]);
+   sw_sync_fence_destroy(in_fence[1]);
+   sw_sync_fence_destroy(in_fence[2]);
+   sw_sync_fence_destroy(fence_merge);
+   sw_sync_timeline_destroy(timeline[0]);
+   sw_sync_timeline_destroy(timeline[1]);
+   sw_sync_timeline_destroy(timeline[2]);
+}
+
 static void * test_sync_multi_consumer_thread(void *arg)
 {
data_t *data = arg;
@@ -476,6 +539,9 @@ igt_main
igt_subtest("sync_merge_same")
test_sync_merge_same();
 
+   igt_subtest("sync_multi_timeline_wait")
+   test_sync_multi_timeline_wait();
+
igt_subtest("sync_multi_consumer")
test_sync_multi_consumer();
 
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 11/13] tests/sw_sync: Add subtest test_sync_random_merge

2016-08-23 Thread robert . foss
From: Robert Foss 

This subtest verifies that creating many timelines and merging random fences
from each timeline with eachother results in merged fences that are fully
functional.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 73 +
 1 file changed, 73 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 0e67ad5..8e5a7c9 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -383,6 +383,76 @@ static void test_sync_multi_consumer_producer(void)
igt_assert_f(thread_ret == 0, "A sync thread reported failure.\n");
 }
 
+static void test_sync_random_merge(void)
+{
+   int i, size, ret;
+   const int nbr_timeline = 32;
+   const int nbr_merge = 1024;
+   int fence_map[nbr_timeline];
+   int timeline_arr[nbr_timeline];
+   int fence, tmpfence, merged;
+   int timeline, timeline_offset, sync_pt;
+
+   srand(time(NULL));
+
+   for (i = 0; i < nbr_timeline; i++)
+   timeline_arr[i] = sw_sync_timeline_create();
+
+   memset(fence_map, -1, sizeof(fence_map));
+
+   sync_pt = rand();
+   fence = sw_sync_fence_create(timeline_arr[0], sync_pt);
+
+   fence_map[0] = sync_pt;
+
+   /* Randomly create syncpoints out of a fixed set of timelines,
+* and merge them together.
+*/
+   for (i = 0; i < nbr_merge; i++) {
+   /* Generate syncpoint. */
+   timeline_offset = rand() % nbr_timeline;
+   timeline = timeline_arr[timeline_offset];
+   sync_pt = rand();
+
+   /* Keep track of the latest sync_pt in each timeline. */
+   if (fence_map[timeline_offset] == -1)
+   fence_map[timeline_offset] = sync_pt;
+   else if (fence_map[timeline_offset] < sync_pt)
+   fence_map[timeline_offset] = sync_pt;
+
+   /* Merge. */
+   tmpfence = sw_sync_fence_create(timeline, sync_pt);
+   merged = sw_sync_merge(tmpfence, fence);
+   sw_sync_fence_destroy(tmpfence);
+   sw_sync_fence_destroy(fence);
+   fence = merged;
+   }
+
+   size = 0;
+   for (i = 0; i < nbr_timeline; i++)
+   if (fence_map[i] != -1)
+   size++;
+
+   /* Trigger the merged fence. */
+   for (i = 0; i < nbr_timeline; i++) {
+   if (fence_map[i] != -1) {
+   ret = sw_sync_wait(fence, 0);
+   igt_assert_f(ret == 0,
+   "Failure waiting on fence until timeout\n");
+   /* Increment the timeline to the last sync_pt */
+   sw_sync_timeline_inc(timeline_arr[i], fence_map[i]);
+   }
+   }
+
+   /* Check that the fence is triggered. */
+   ret = sw_sync_wait(fence, 0);
+   igt_assert_f(ret > 0, "Failure triggering fence\n");
+
+   sw_sync_fence_destroy(fence);
+   for (i = 0; i < nbr_timeline; i++)
+   sw_sync_timeline_destroy(timeline_arr[i]);
+}
+
 igt_main
 {
igt_subtest("alloc_timeline")
@@ -411,5 +481,8 @@ igt_main
 
igt_subtest("sync_multi_consumer_producer")
test_sync_multi_consumer_producer();
+
+   igt_subtest("sync_random_merge")
+   test_sync_random_merge();
 }
 
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 13/13] tests/sw_sync: Add subtest test_sync_multi_producer_single_consumer

2016-08-23 Thread robert . foss
From: Robert Foss 

This subtest runs a single consumer thread and multiple producer thread that
are synchronized using multiple timelines.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 139 
 1 file changed, 139 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 9ff5088..2accdee 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -446,6 +446,142 @@ static void test_sync_multi_consumer_producer(void)
igt_assert_f(thread_ret == 0, "A sync thread reported failure.\n");
 }
 
+static int test_mspc_wait_on_fence(int fence)
+{
+   int error, active;
+
+   do {
+   error = sw_sync_fence_count_status(fence,
+  SW_SYNC_FENCE_STATUS_ERROR);
+   igt_assert_f(error == 0, "Error occurred on fence\n");
+   active = sw_sync_fence_count_status(fence,
+   
SW_SYNC_FENCE_STATUS_ACTIVE);
+   } while (active);
+
+   return 0;
+}
+
+static struct {
+   int iterations;
+   int threads;
+   int counter;
+   int cons_timeline;
+   int *prod_timeline;
+   pthread_mutex_t lock;
+} test_mpsc_data;
+
+static int mpsc_producer_thread(void *d)
+{
+   int id = (long)d;
+   int fence, i;
+   int *prod_timeline = test_mpsc_data.prod_timeline;
+   int cons_timeline = test_mpsc_data.cons_timeline;
+   int iterations = test_mpsc_data.iterations;
+
+   for (i = 0; i < iterations; i++) {
+   fence = sw_sync_fence_create(cons_timeline, i);
+
+   /* Wait for the consumer to finish. Use alternate
+* means of waiting on the fence
+*/
+   if ((iterations + id) % 8 != 0) {
+   igt_assert_f(sw_sync_wait(fence, -1) > 0,
+"Failure waiting on fence\n");
+   } else {
+   igt_assert_f(test_mspc_wait_on_fence(fence) == 0,
+"Failure waiting on fence\n");
+   }
+
+   /* Every producer increments the counter, the consumer
+* checks and erases it
+*/
+   pthread_mutex_lock(&test_mpsc_data.lock);
+   test_mpsc_data.counter++;
+   pthread_mutex_unlock(&test_mpsc_data.lock);
+
+   sw_sync_timeline_inc(prod_timeline[id], 1);
+   sw_sync_fence_destroy(fence);
+   }
+
+   return 0;
+}
+
+static int mpsc_consumer_thread(void)
+{
+   int fence, merged, tmp, it, i;
+   int *prod_timeline = test_mpsc_data.prod_timeline;
+   int cons_timeline = test_mpsc_data.cons_timeline;
+   int iterations = test_mpsc_data.iterations;
+   int n = test_mpsc_data.threads;
+
+   for (it = 1; it <= iterations; it++) {
+   fence = sw_sync_fence_create(prod_timeline[0], it);
+   for (i = 1; i < n; i++) {
+   tmp = sw_sync_fence_create(prod_timeline[i], it);
+   merged = sw_sync_merge(tmp, fence);
+   sw_sync_fence_destroy(tmp);
+   sw_sync_fence_destroy(fence);
+   fence = merged;
+   }
+
+   /* Make sure we see an increment from every producer thread.
+* Vary the means by which we wait.
+*/
+   if (iterations % 8 != 0) {
+   igt_assert_f(sw_sync_wait(fence, -1) == 0,
+   "Producers did not increment as 
expected\n");
+   } else {
+   igt_assert_f(test_mspc_wait_on_fence(fence) == 0,
+"Failure waiting on fence\n");
+   }
+
+   igt_assert_f(test_mpsc_data.counter == n * it,
+"Counter value mismatch\n");
+
+   /* Release the producer threads */
+   sw_sync_timeline_inc(cons_timeline, 1);
+   sw_sync_fence_destroy(fence);
+   }
+
+   return 0;
+}
+
+/* IMPORTANT NOTE: if you see this test failing on your system, it may be
+ * due to a shortage of file descriptors. Please ensure your system has
+ * a sensible limit for this test to finish correctly.
+ */
+static void test_sync_multi_producer_single_consumer(void)
+{
+   int iterations = 1 << 12;
+   int n = 5;
+   int prod_timeline[n];
+   int cons_timeline;
+   pthread_t threads[n];
+   long i;
+
+   cons_timeline = sw_sync_timeline_create();
+   for (i = 0; i < n; i++)
+   prod_timeline[i] = sw_sync_timeline_create();
+
+   test_mpsc_data.prod_timeline = prod_timeline;
+   test_mpsc_data.cons_timeline = cons_timeline;
+   test_mpsc_data.iterations = iterations;
+   test_mpsc_data.threads = n;
+   test_mpsc_data.counter = 0;
+   pthread_mutex_init(&test_mpsc_data.l

[Intel-gfx] [PATCH v1 02/13] tests/sw_sync: Add sw_sync test

2016-08-23 Thread robert . foss
From: Robert Foss 

Add initial tests for sw_sync.

Signed-off-by: Gustavo Padovan 
Signed-off-by: Robert Foss 
---
 lib/sw_sync.c  | 13 ++---
 lib/sw_sync.h  |  2 +-
 tests/Makefile.sources |  1 +
 tests/sw_sync.c| 51 ++
 4 files changed, 59 insertions(+), 8 deletions(-)
 create mode 100644 tests/sw_sync.c

diff --git a/lib/sw_sync.c b/lib/sw_sync.c
index c4e7d07..e3d5f85 100644
--- a/lib/sw_sync.c
+++ b/lib/sw_sync.c
@@ -150,8 +150,6 @@ int sw_sync_wait(int fence, int timeout)
 
ret = poll(&fds, 1, timeout);
 
-   sw_sync_fd_close(fence);
-
return ret;
 }
 
@@ -179,9 +177,10 @@ static struct sync_file_info *sync_file_info(int fd)
info->num_fences = num_fences;
 
fence_info = calloc(num_fences, sizeof(struct sync_fence_info));
-   if (!fence_info)
+   if (!fence_info) {
free(info);
return NULL;
+   }
 
info->sync_fence_info = (uint64_t)(unsigned long) (fence_info);
 
@@ -217,18 +216,18 @@ int sw_sync_fence_size(int fd)
return count;
 }
 
-int sw_sync_fence_count_with_status(int fd, int status)
+int sw_sync_fence_count_status(int fd, int status)
 {
int i, count = 0;
-   struct sync_fence_info *fenceInfo = NULL;
+   struct sync_fence_info *fence_info = NULL;
struct sync_file_info *info = sync_file_info(fd);
 
if (!info)
return -1;
 
-   fenceInfo = (struct sync_fence_info *)(uintptr_t)info->sync_fence_info;
+   fence_info = (struct sync_fence_info *)(uintptr_t)info->sync_fence_info;
for (i = 0 ; i < info->num_fences ; i++) {
-   if (fenceInfo[i].status == status)
+   if (fence_info[i].status == status)
count++;
}
 
diff --git a/lib/sw_sync.h b/lib/sw_sync.h
index b179adf..1092608 100644
--- a/lib/sw_sync.h
+++ b/lib/sw_sync.h
@@ -43,7 +43,7 @@ void sw_sync_timeline_inc(int fd, uint32_t count);
 int sw_sync_merge(int fd1, int fd2);
 int sw_sync_wait(int fence, int timeout);
 int sw_sync_fence_size(int fd);
-int sw_sync_fence_count_with_status(int fd, int status);
+int sw_sync_fence_count_status(int fd, int status);
 
 #endif
 
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 72a58ad..0ba769f 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -125,6 +125,7 @@ TESTS_progs_M = \
prime_mmap_kms \
prime_self_import \
prime_vgem \
+   sw_sync \
template \
vgem_basic \
vgem_slow \
diff --git a/tests/sw_sync.c b/tests/sw_sync.c
new file mode 100644
index 000..d2d4c42
--- /dev/null
+++ b/tests/sw_sync.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2012 Google, Inc
+ * Copyright © 2016 Collabora, Ltd.
+ *
+ * Based on the implementation from the Android Open Source Project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ *Robert Foss 
+ */
+
+#include 
+
+#include "sw_sync.h"
+#include "igt.h"
+#include "igt_aux.h"
+
+IGT_TEST_DESCRIPTION("Test SW Sync Framework");
+
+static void test_alloc_timeline(void)
+{
+   int timeline;
+
+   timeline = sw_sync_timeline_create();
+   sw_sync_timeline_destroy(timeline);
+}
+
+igt_main
+{
+   igt_subtest("alloc_timeline")
+   test_alloc_timeline();
+}
+
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 00/13] Implement sw_sync test

2016-08-23 Thread robert . foss
From: Robert Foss 

This series implements the sw_sync test and the lib/sw_sync helper functions
for said test.

Gustavo Padovans sw_sync series was just de-staged in
gregkh-staging/staging-next [1], and this test is targeted at verifying the
functionality implemented in that series. 

The sw_sync subtests range from very basic tests of the sw_sync functionality,
to stress testing and randomized tests.

[1] http://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/

Robert Foss (13):
  lib/sw_sync: Add helper functions for managing synchronization
primitives
  tests/sw_sync: Add sw_sync test
  tests/sw_sync: Add subtest test_alloc_fence
  tests/sw_sync: Add subtest test_alloc_fence_invalid_timeline
  tests/sw_sync: Add subtest test_alloc_merge_fence
  tests/sw_sync: Add subtest test_sync_wait
  tests/sw_sync: Add subtest test_sync_merge
  tests/sw_sync: Add subtest test_sync_merge_same
  tests/sw_sync: Add subtest test_sync_multi_consumer
  tests/sw_sync: Add subtest test_sync_multi_consumer_producer
  tests/sw_sync: Add subtest test_sync_random_merge
  tests/sw_sync: Add subtest test_sync_multi_timeline_wait
  tests/sw_sync: Add subtest test_sync_multi_producer_single_consumer

 lib/Makefile.sources   |   2 +
 lib/sw_sync.c  | 237 +
 lib/sw_sync.h  |  49 
 tests/Makefile.sources |   1 +
 tests/sw_sync.c| 693 +
 5 files changed, 982 insertions(+)
 create mode 100644 lib/sw_sync.c
 create mode 100644 lib/sw_sync.h
 create mode 100644 tests/sw_sync.c

-- 
2.7.4

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


[Intel-gfx] [PATCH v1 04/13] tests/sw_sync: Add subtest test_alloc_fence_invalid_timeline

2016-08-23 Thread robert . foss
From: Robert Foss 

This subtests tests that creating fences on negative timelines fail.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index a8c8ca4..102647d 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -55,6 +55,10 @@ static void test_alloc_fence(void)
sw_sync_timeline_destroy(timeline);
 }
 
+static void test_alloc_fence_invalid_timeline(void)
+{
+   sw_sync_fence_create(-1, 0);
+}
 
 igt_main
 {
@@ -63,5 +67,8 @@ igt_main
 
igt_subtest("alloc_fence")
test_alloc_fence();
+
+   igt_subtest("alloc_fence_invalid_timeline")
+   test_alloc_fence_invalid_timeline();
 }
 
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 01/13] lib/sw_sync: Add helper functions for managing synchronization primitives

2016-08-23 Thread robert . foss
From: Robert Foss 

Base functions to help testing the Sync File Framework (explicit fencing
mechanism ported from Android).
These functions allow you to create, use and destroy timelines and fences.

Signed-off-by: Gustavo Padovan 
Signed-off-by: Robert Foss 
---
 lib/Makefile.sources |   2 +
 lib/sw_sync.c| 238 +++
 lib/sw_sync.h|  49 +++
 3 files changed, 289 insertions(+)
 create mode 100644 lib/sw_sync.c
 create mode 100644 lib/sw_sync.h

diff --git a/lib/Makefile.sources b/lib/Makefile.sources
index bac9a7f..3dc7c3c 100644
--- a/lib/Makefile.sources
+++ b/lib/Makefile.sources
@@ -61,6 +61,8 @@ lib_source_list = \
rendercopy_gen8.c   \
rendercopy_gen9.c   \
rendercopy.h\
+   sw_sync.c   \
+   sw_sync.h   \
intel_reg_map.c \
intel_iosf.c\
igt_kms.c   \
diff --git a/lib/sw_sync.c b/lib/sw_sync.c
new file mode 100644
index 000..c4e7d07
--- /dev/null
+++ b/lib/sw_sync.c
@@ -0,0 +1,238 @@
+/*
+ * Copyright 2012 Google, Inc
+ * Copyright © 2016 Collabora, Ltd.
+ *
+ * Based on the implementation from the Android Open Source Project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ *Robert Foss 
+ */
+
+#ifndef ANDROID
+#define _GNU_SOURCE
+#else
+#include 
+#endif
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sw_sync.h"
+#include "drmtest.h"
+#include "ioctl_wrappers.h"
+
+#ifndef SW_SYNC_IOC_INC
+struct sw_sync_create_fence_data {
+   __u32   value;
+   charname[32];
+   __s32   fence;
+};
+
+#define SW_SYNC_IOC_MAGIC  'W'
+#define SW_SYNC_IOC_CREATE_FENCE   _IOWR(SW_SYNC_IOC_MAGIC, 0,\
+   struct 
sw_sync_create_fence_data)
+#define SW_SYNC_IOC_INC_IOW(SW_SYNC_IOC_MAGIC, 1, 
__u32)
+#endif
+
+int sw_sync_fd_is_valid(int fd)
+{
+   int status;
+
+   if (fd == -1)
+   return 0;
+
+   status = fcntl(fd, F_GETFD, 0);
+   return status >= 0;
+}
+
+static
+void sw_sync_fd_close(int fd)
+{
+   if (fd == -1)
+   return;
+
+   if (fcntl(fd, F_GETFD, 0) < 0)
+   return;
+
+   close(fd);
+}
+
+int sw_sync_timeline_create(void)
+{
+   int fd = open("/dev/sw_sync", O_RDWR);
+
+   if (!sw_sync_fd_is_valid(fd))
+   fd = open("/sys/kernel/debug/sync/sw_sync", O_RDWR);
+
+   igt_assert(sw_sync_fd_is_valid(fd));
+
+   return fd;
+}
+
+void sw_sync_timeline_destroy(int fd)
+{
+   return sw_sync_fd_close(fd);
+}
+
+void sw_sync_fence_destroy(int fd)
+{
+   return sw_sync_fd_close(fd);
+}
+
+int sw_sync_fence_create(int fd, int32_t seqno)
+{
+   struct sw_sync_create_fence_data data = {};
+
+   data.value = seqno;
+   if (fd >= 0) {
+   do_ioctl(fd, SW_SYNC_IOC_CREATE_FENCE, &data);
+   return data.fence;
+   } else {
+   do_ioctl_err(fd, SW_SYNC_IOC_CREATE_FENCE, &data, EBADF);
+   return -1;
+   }
+}
+
+void sw_sync_timeline_inc(int fd, uint32_t count)
+{
+   uint32_t arg = count;
+
+   if (fd == 0 || fd == -1)
+   return;
+
+   do_ioctl(fd, SW_SYNC_IOC_INC, &arg);
+}
+
+int sw_sync_merge(int fd1, int fd2)
+{
+   struct sync_merge_data data = {};
+   int err;
+
+   data.fd2 = fd2;
+
+   err = ioctl(fd1, SYNC_IOC_MERGE, &data);
+   if (err < 0)
+   return err;
+
+   sw_sync_fd_is_valid(data.fence);
+
+   return data.fence;
+}
+
+int sw_sync_wait(int fence, int timeout)
+{
+   struct pollfd fds;
+   int ret;
+
+   fds.fd = fence;
+   fds.events = POLLIN | POLLERR;
+
+   ret = poll(&fds, 1, timeout);
+
+   sw_sync_fd_close(fence);
+
+   return ret;
+}
+
+s

[Intel-gfx] [PATCH v1 06/13] tests/sw_sync: Add subtest test_sync_wait

2016-08-23 Thread robert . foss
From: Robert Foss 

This subtest verifies that waiting on fences works properly.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 851430e..07e9638 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -80,6 +80,41 @@ static void test_alloc_merge_fence(void)
sw_sync_timeline_destroy(timeline[1]);
 }
 
+static void test_sync_wait(void)
+{
+   int fence, ret;
+   int timeline;
+
+   timeline = sw_sync_timeline_create();
+   fence = sw_sync_fence_create(timeline, 5);
+
+   /* Wait on fence until timeout */
+   ret = sw_sync_wait(fence, 0);
+   igt_assert_f(ret == 0, "Failure waiting on fence until timeout\n");
+
+   /* Advance timeline from 0 -> 1 */
+   sw_sync_timeline_inc(timeline, 1);
+
+   /* Wait on fence until timeout */
+   ret = sw_sync_wait(fence, 0);
+   igt_assert_f(ret == 0, "Failure waiting on fence until timeout\n");
+
+   /* Signal the fence */
+   sw_sync_timeline_inc(timeline, 4);
+
+   /* Wait successfully */
+   ret = sw_sync_wait(fence, 0);
+   igt_assert_f(ret > 0, "Failure waiting on fence\n");
+
+   /* Go even further, and confirm wait still succeeds */
+   sw_sync_timeline_inc(timeline, 10);
+   ret = sw_sync_wait(fence, 0);
+   igt_assert_f(ret > 0, "Failure waiting ahead\n");
+
+   sw_sync_fence_destroy(fence);
+   sw_sync_timeline_destroy(timeline);
+}
+
 igt_main
 {
igt_subtest("alloc_timeline")
@@ -93,5 +128,8 @@ igt_main
 
igt_subtest("alloc_merge_fence")
test_alloc_merge_fence();
+
+   igt_subtest("sync_wait")
+   test_sync_wait();
 }
 
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 08/13] tests/sw_sync: Add subtest test_sync_merge_same

2016-08-23 Thread robert . foss
From: Robert Foss 

This subtest verifies merging a fence with itself does not fail.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 00ac44b..db03f48 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -179,6 +179,30 @@ static void test_sync_merge(void)
sw_sync_timeline_destroy(timeline);
 }
 
+static void test_sync_merge_same(void)
+{
+   int in_fence[2];
+   int timeline;
+   int signaled;
+
+   timeline = sw_sync_timeline_create();
+   in_fence[0] = sw_sync_fence_create(timeline, 1);
+   in_fence[1] = sw_sync_merge(in_fence[0], in_fence[0]);
+
+   signaled = sw_sync_fence_count_status(in_fence[0],
+ SW_SYNC_FENCE_STATUS_SIGNALED);
+   igt_assert_f(signaled == 0, "fence signaled too early\n");
+
+   sw_sync_timeline_inc(timeline, 1);
+   signaled = sw_sync_fence_count_status(in_fence[0],
+ SW_SYNC_FENCE_STATUS_SIGNALED);
+   igt_assert_f(signaled == 1, "fence did not signal\n");
+
+   sw_sync_fence_destroy(in_fence[0]);
+   sw_sync_fence_destroy(in_fence[1]);
+   sw_sync_timeline_destroy(timeline);
+}
+
 igt_main
 {
igt_subtest("alloc_timeline")
@@ -198,5 +222,8 @@ igt_main
 
igt_subtest("sync_merge")
test_sync_merge();
+
+   igt_subtest("sync_merge_same")
+   test_sync_merge_same();
 }
 
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 03/13] tests/sw_sync: Add subtest test_alloc_fence

2016-08-23 Thread robert . foss
From: Robert Foss 

Add subtest alloc_fence that verifies that it's possible to allocate a fence
on a timeline.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index d2d4c42..a8c8ca4 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -43,9 +43,25 @@ static void test_alloc_timeline(void)
sw_sync_timeline_destroy(timeline);
 }
 
+static void test_alloc_fence(void)
+{
+   int in_fence;
+   int timeline;
+
+   timeline = sw_sync_timeline_create();
+   in_fence = sw_sync_fence_create(timeline, 0);
+
+   sw_sync_fence_destroy(in_fence);
+   sw_sync_timeline_destroy(timeline);
+}
+
+
 igt_main
 {
igt_subtest("alloc_timeline")
test_alloc_timeline();
+
+   igt_subtest("alloc_fence")
+   test_alloc_fence();
 }
 
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 07/13] tests/sw_sync: Add subtest test_sync_merge

2016-08-23 Thread robert . foss
From: Robert Foss 

Add subtest test_sync_merge that tests merging fences and the validity of the
resulting merged fence.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 67 +
 1 file changed, 67 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 07e9638..00ac44b 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -115,6 +115,70 @@ static void test_sync_wait(void)
sw_sync_timeline_destroy(timeline);
 }
 
+static void test_sync_merge(void)
+{
+   int in_fence[3];
+   int fence_merge;
+   int timeline;
+   int active, signaled;
+
+   timeline = sw_sync_timeline_create();
+   in_fence[0] = sw_sync_fence_create(timeline, 1);
+   in_fence[1] = sw_sync_fence_create(timeline, 2);
+   in_fence[2] = sw_sync_fence_create(timeline, 3);
+
+   fence_merge = sw_sync_merge(in_fence[0], in_fence[1]);
+   fence_merge = sw_sync_merge(in_fence[2], fence_merge);
+
+   /* confirm all fences have one active point (even d) */
+   active = sw_sync_fence_count_status(in_fence[0],
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   igt_assert_f(active == 1, "in_fence[0] has too many active fences\n");
+   active = sw_sync_fence_count_status(in_fence[1],
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   igt_assert_f(active == 1, "in_fence[1] has too many active fences\n");
+   active = sw_sync_fence_count_status(in_fence[2],
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   igt_assert_f(active == 1, "in_fence[2] has too many active fences\n");
+   active = sw_sync_fence_count_status(fence_merge,
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   igt_assert_f(active == 1, "fence_merge has too many active fences\n");
+
+   /* confirm that fence_merge is not signaled until the max of fence 
0,1,2 */
+   sw_sync_timeline_inc(timeline, 1);
+   signaled = sw_sync_fence_count_status(in_fence[0],
+ SW_SYNC_FENCE_STATUS_SIGNALED);
+   active = sw_sync_fence_count_status(fence_merge,
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   igt_assert_f(signaled == 1, "in_fence[0] did not signal\n");
+   igt_assert_f(active == 1, "fence_merge signaled too early\n");
+
+   sw_sync_timeline_inc(timeline, 1);
+   signaled = sw_sync_fence_count_status(in_fence[1],
+ SW_SYNC_FENCE_STATUS_SIGNALED);
+   active = sw_sync_fence_count_status(fence_merge,
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   igt_assert_f(signaled == 1, "in_fence[1] did not signal\n");
+   igt_assert_f(active == 1, "fence_merge signaled too early\n");
+
+   sw_sync_timeline_inc(timeline, 1);
+   signaled = sw_sync_fence_count_status(in_fence[2],
+ SW_SYNC_FENCE_STATUS_SIGNALED);
+   igt_assert_f(signaled == 1, "in_fence[2] did not signal\n");
+   signaled = sw_sync_fence_count_status(fence_merge,
+  SW_SYNC_FENCE_STATUS_SIGNALED);
+   active = sw_sync_fence_count_status(fence_merge,
+   SW_SYNC_FENCE_STATUS_ACTIVE);
+   igt_assert_f(active == 0 && signaled == 1,
+"fence_merge did not signal\n");
+
+   sw_sync_fence_destroy(in_fence[0]);
+   sw_sync_fence_destroy(in_fence[1]);
+   sw_sync_fence_destroy(in_fence[2]);
+   sw_sync_fence_destroy(fence_merge);
+   sw_sync_timeline_destroy(timeline);
+}
+
 igt_main
 {
igt_subtest("alloc_timeline")
@@ -131,5 +195,8 @@ igt_main
 
igt_subtest("sync_wait")
test_sync_wait();
+
+   igt_subtest("sync_merge")
+   test_sync_merge();
 }
 
-- 
2.7.4

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


[Intel-gfx] [PATCH v1 05/13] tests/sw_sync: Add subtest test_alloc_merge_fence

2016-08-23 Thread robert . foss
From: Robert Foss 

This subtest verifies that merging two fences works in the simples possible
case.

Signed-off-by: Robert Foss 
---
 tests/sw_sync.c | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 102647d..851430e 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -60,6 +60,26 @@ static void test_alloc_fence_invalid_timeline(void)
sw_sync_fence_create(-1, 0);
 }
 
+static void test_alloc_merge_fence(void)
+{
+   int in_fence[2];
+   int fence_merge;
+   int timeline[2];
+
+   timeline[0] = sw_sync_timeline_create();
+   timeline[1] = sw_sync_timeline_create();
+
+   in_fence[0] = sw_sync_fence_create(timeline[0], 1);
+   in_fence[1] = sw_sync_fence_create(timeline[1], 1);
+   fence_merge = sw_sync_merge(in_fence[1], in_fence[0]);
+
+   sw_sync_fence_destroy(in_fence[0]);
+   sw_sync_fence_destroy(in_fence[1]);
+   sw_sync_fence_destroy(fence_merge);
+   sw_sync_timeline_destroy(timeline[0]);
+   sw_sync_timeline_destroy(timeline[1]);
+}
+
 igt_main
 {
igt_subtest("alloc_timeline")
@@ -70,5 +90,8 @@ igt_main
 
igt_subtest("alloc_fence_invalid_timeline")
test_alloc_fence_invalid_timeline();
+
+   igt_subtest("alloc_merge_fence")
+   test_alloc_merge_fence();
 }
 
-- 
2.7.4

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


Re: [Intel-gfx] Display problems after upgrade to X v1.18.3

2016-08-23 Thread David Weinehall
On Tue, Aug 23, 2016 at 11:40:53AM -0400, Jim Abernathy wrote:
> Not having much luck with the Distro forums on this issue so I thought
> I'd ask for advice here.
> 
> I've been running Ubuntu 14.04.4 for some time on Intel Core i5 GFX
> without any issues.  My display is HDMI from the PC to an Onkyo A/V
> receiver then to a Sony KDL-XBR6.

Core i5 is a bit vague; to know what graphics generation you run,
could you provide the output of:

sudo cat /sys/kernel/debug/dri/0/i915_capabilities

Also, since it might be a kernel issue, the kernel version would be
nice to know too (uname -a).

> When I try a fresh install of 16.04.1, I get a display that blanks out
> for 3-5 seconds at random times depending on what is being displayed
> at the time.  I also have small amouts of video noise that is random
> horizontal lines about 1 pixel tall scattered through the page.
> 
> I noticed that 14.04.05 uses X server 1.17.2 and 16.04.1 uses 1.18.3.
> 
> When I do the command xrandr --verbose I see some small differences
> between 14.04 and 16.04, but it's things like 2 digits displayed
> instead of 1.  i.e. 60.0 vs. 60.00. I'm only concerned with 1080P HD.
> 
> I've tried this on different computers all with Intel GFX. same results.
> 
> This does not occur on other monitors or TVs.
> 
> I'd blame it on Sony and Onkyo if they didn't work so well with
> Windows, all versions, and Ubuntu all versions except 16.04.
> 
> It's almost like the auto detection software in the newest version of
> X is off just enough to make my display flaky.  Kind of like the old
> analog CRT TVs that were sensitive to small tweaks to the horizontal
> and vertical adjustments.
> 
> Any help would be appreciated.


Kind regards, David Weinehall
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/debugfs: Add panel delays for eDP

2016-08-23 Thread Patchwork
== Series Details ==

Series: drm/i915/debugfs: Add panel delays for eDP
URL   : https://patchwork.freedesktop.org/series/11472/
State : failure

== Summary ==

Series 11472v1 drm/i915/debugfs: Add panel delays for eDP
http://patchwork.freedesktop.org/api/1.0/series/11472/revisions/1/mbox/

Test drv_module_reload_basic:
skip   -> PASS   (fi-skl-6260u)
Test kms_cursor_legacy:
Subgroup basic-cursor-vs-flip-varying-size:
pass   -> FAIL   (fi-bsw-n3050)
Subgroup basic-flip-vs-cursor-legacy:
fail   -> PASS   (fi-bsw-n3050)
fail   -> PASS   (fi-skl-6700k)
Subgroup basic-flip-vs-cursor-varying-size:
fail   -> PASS   (fi-byt-n2820)
Test prime_busy:
Subgroup basic-after-default:
pass   -> FAIL   (fi-bsw-n3050)
Subgroup basic-before-default:
pass   -> FAIL   (fi-bsw-n3050)
Subgroup basic-wait-after-default:
pass   -> FAIL   (fi-bsw-n3050)
Subgroup basic-wait-before-default:
pass   -> FAIL   (fi-bsw-n3050)
Test prime_vgem:
Subgroup basic-busy-default:
pass   -> FAIL   (fi-bsw-n3050)
Subgroup basic-fence-flip:
pass   -> DMESG-WARN (fi-hsw-4770k)
Subgroup basic-gtt:
pass   -> FAIL   (fi-bsw-n3050)
Subgroup basic-sync-default:
pass   -> FAIL   (fi-bsw-n3050)
Subgroup basic-wait-default:
pass   -> FAIL   (fi-bsw-n3050)

fi-bdw-5557u total:249  pass:232  dwarn:0   dfail:0   fail:1   skip:16 
fi-bsw-n3050 total:249  pass:195  dwarn:0   dfail:0   fail:10  skip:44 
fi-byt-n2820 total:249  pass:205  dwarn:0   dfail:0   fail:3   skip:41 
fi-hsw-4770k total:249  pass:219  dwarn:7   dfail:0   fail:1   skip:22 
fi-hsw-4770r total:249  pass:222  dwarn:0   dfail:0   fail:1   skip:26 
fi-ivb-3520m total:249  pass:217  dwarn:0   dfail:0   fail:1   skip:31 
fi-skl-6260u total:249  pass:234  dwarn:0   dfail:0   fail:1   skip:14 
fi-skl-6700k total:249  pass:215  dwarn:4   dfail:0   fail:2   skip:28 
fi-snb-2520m total:249  pass:201  dwarn:4   dfail:0   fail:2   skip:42 
fi-snb-2600  total:249  pass:202  dwarn:4   dfail:0   fail:1   skip:42 

Results at /archive/results/CI_IGT_test/Patchwork_2407/

a0744f39d2948f39be393f4d065c2f383e277ee2 drm-intel-nightly: 
2016y-08m-23d-15h-35m-47s UTC integration manifest
92229cc drm/i915/debugfs: Add panel delays for eDP

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


Re: [Intel-gfx] [PATCH 1/2] drm/i915: Create a intel_encoder_find_connector helper function.

2016-08-23 Thread kbuild test robot
Hi Maarten,

[auto build test ERROR on drm-intel/for-linux-next]
[cannot apply to v4.8-rc3 next-20160823]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Maarten-Lankhorst/drm-i915-Create-a-intel_encoder_find_connector-helper-function/20160823-222308
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-x009-201634 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/gpu/drm/i915/intel_display.c: In function 'intel_sanitize_encoder':
>> drivers/gpu/drm/i915/intel_display.c:16539:21: error: unused variable 'dev' 
>> [-Werror=unused-variable]
 struct drm_device *dev = encoder->base.dev;
^~~
   cc1: all warnings being treated as errors

vim +/dev +16539 drivers/gpu/drm/i915/intel_display.c

4cc31489 Daniel Vetter 2014-03-24  16533}
24929352 Daniel Vetter 2012-07-02  16534  }
24929352 Daniel Vetter 2012-07-02  16535  
24929352 Daniel Vetter 2012-07-02  16536  static void 
intel_sanitize_encoder(struct intel_encoder *encoder)
24929352 Daniel Vetter 2012-07-02  16537  {
24929352 Daniel Vetter 2012-07-02  16538struct intel_connector 
*connector;
24929352 Daniel Vetter 2012-07-02 @16539struct drm_device *dev = 
encoder->base.dev;
24929352 Daniel Vetter 2012-07-02  16540  
24929352 Daniel Vetter 2012-07-02  16541/* We need to check both for a 
crtc link (meaning that the
24929352 Daniel Vetter 2012-07-02  16542 * encoder is active and trying 
to read from a pipe) and the

:: The code at line 16539 was first introduced by commit
:: 24929352481f085c5f85d4d4cbc919ddf106d381 drm/i915: read out the modeset 
hw state at load and resume time

:: TO: Daniel Vetter 
:: CC: Daniel Vetter 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] linux-next: build failure after merge of the drm-intel tree

2016-08-23 Thread Daniel Vetter
On Tue, Aug 23, 2016 at 11:56:14AM +1000, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the drm-intel tree, today's linux-next build (arm
> multi_v7_defconfig) failed like this:
> 
> In file included from drivers/gpio/gpiolib-of.c:19:0:
> include/linux/io-mapping.h:115:31: fatal error: asm/pgtable_types.h: No such 
> file or directory
> In file included from drivers/gpu/drm/nouveau/include/nvif/os.h:16:0,
>  from drivers/gpu/drm/nouveau/include/nvkm/core/os.h:3,
>  from drivers/gpu/drm/nouveau/include/nvkm/core/object.h:3,   
>  from drivers/gpu/drm/nouveau/include/nvkm/core/client.h:3,   
>  from drivers/gpu/drm/nouveau/nvkm/core/client.c:24:
> include/linux/io-mapping.h:115:31: fatal error: asm/pgtable_types.h: No such 
> file or directory
> 
> and many more.
> 
> Caused by commit
> 
>   cafaf14a5d8f ("io-mapping: Always create a struct to hold metadata about 
> the io-mapping")
> 
> I have used the drm-intel tree from next-20160822 for today.

Should be fixed now, thanks for reporting.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2] io-mapping.h: s/PAGE_KERNEL_IO/PAGE_KERNEL/

2016-08-23 Thread Daniel Vetter
On Tue, Aug 23, 2016 at 04:50:24PM +0100, Chris Wilson wrote:
> PAGE_KERNEL_IO is an x86-ism. Though it is used to define the pgprot_t
> used for the iomapped region, it itself is just PAGE_KERNEL. On all
> other arches, PAGE_KERNEL_IO is undefined so in a general header we must
> refrain from using it.
> 
> v2: include pgtable for pgprot_combine()
> 
> Reported-by: Stephen Rothwell 
> Fixes: cafaf14a5d8f ("io-mapping: Always create a struct to hold metadata 
> about the io-mapping")
> Signed-off-by: Chris Wilson 
> Cc: Daniel Vetter 
> Cc: Joonas Lahtinen 
> Cc: linux...@kvack.org

This one seems to have worked out, applied to dinq.

Thanks, Daniel

> ---
>  include/linux/io-mapping.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
> index b4c4b5c4216d..a87dd7fffc0a 100644
> --- a/include/linux/io-mapping.h
> +++ b/include/linux/io-mapping.h
> @@ -112,7 +112,7 @@ io_mapping_unmap(void __iomem *vaddr)
>  #else
>  
>  #include 
> -#include 
> +#include 
>  
>  /* Create the io_mapping object*/
>  static inline struct io_mapping *
> @@ -123,7 +123,7 @@ io_mapping_init_wc(struct io_mapping *iomap,
>   iomap->base = base;
>   iomap->size = size;
>   iomap->iomem = ioremap_wc(base, size);
> - iomap->prot = pgprot_writecombine(PAGE_KERNEL_IO);
> + iomap->prot = pgprot_writecombine(PAGE_KERNEL);
>  
>   return iomap;
>  }
> -- 
> 2.9.3
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v3 27/27] drm/i915/slpc: Update freq min/max softlimits

2016-08-23 Thread kbuild test robot
Hi Sagar,

[auto build test ERROR on drm-intel/for-linux-next]
[cannot apply to v4.8-rc3 next-20160823]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Sagar-Arun-Kamble/Add-support-for-GuC-based-SLPC/20160823-204034
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-x009-201634 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/gpu/drm/i915/intel_slpc.c: In function 'intel_slpc_enable':
>> drivers/gpu/drm/i915/intel_slpc.c:299:15: error: unused variable 'page' 
>> [-Werror=unused-variable]
 struct page *page;
  ^~~~
   cc1: all warnings being treated as errors

vim +/page +299 drivers/gpu/drm/i915/intel_slpc.c

   293  dev_priv->guc.slpc.enabled = false;
   294  }
   295  
   296  void intel_slpc_enable(struct drm_i915_private *dev_priv)
   297  {
   298  struct drm_i915_gem_object *obj;
 > 299  struct page *page;
   300  void *pv = NULL;
   301  struct slpc_shared_data data;
   302  u64 val;

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v2] io-mapping.h: s/PAGE_KERNEL_IO/PAGE_KERNEL/

2016-08-23 Thread Chris Wilson
PAGE_KERNEL_IO is an x86-ism. Though it is used to define the pgprot_t
used for the iomapped region, it itself is just PAGE_KERNEL. On all
other arches, PAGE_KERNEL_IO is undefined so in a general header we must
refrain from using it.

v2: include pgtable for pgprot_combine()

Reported-by: Stephen Rothwell 
Fixes: cafaf14a5d8f ("io-mapping: Always create a struct to hold metadata about 
the io-mapping")
Signed-off-by: Chris Wilson 
Cc: Daniel Vetter 
Cc: Joonas Lahtinen 
Cc: linux...@kvack.org
---
 include/linux/io-mapping.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index b4c4b5c4216d..a87dd7fffc0a 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -112,7 +112,7 @@ io_mapping_unmap(void __iomem *vaddr)
 #else
 
 #include 
-#include 
+#include 
 
 /* Create the io_mapping object*/
 static inline struct io_mapping *
@@ -123,7 +123,7 @@ io_mapping_init_wc(struct io_mapping *iomap,
iomap->base = base;
iomap->size = size;
iomap->iomem = ioremap_wc(base, size);
-   iomap->prot = pgprot_writecombine(PAGE_KERNEL_IO);
+   iomap->prot = pgprot_writecombine(PAGE_KERNEL);
 
return iomap;
 }
-- 
2.9.3

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


[Intel-gfx] ✗ Fi.CI.BAT: warning for series starting with [v3,01/27] drm/i915: Remove RPM suspend dependency on rps.enabled and related changes

2016-08-23 Thread Patchwork
== Series Details ==

Series: series starting with [v3,01/27] drm/i915: Remove RPM suspend dependency 
on rps.enabled and related changes
URL   : https://patchwork.freedesktop.org/series/11461/
State : warning

== Summary ==

Series 11461v1 Series without cover letter
http://patchwork.freedesktop.org/api/1.0/series/11461/revisions/1/mbox/

Test drv_hangman:
Subgroup error-state-basic:
pass   -> DMESG-WARN (fi-snb-2600)
Test gem_basic:
Subgroup bad-close:
pass   -> DMESG-WARN (fi-snb-2520m)
Test gem_ringfill:
Subgroup basic-default-forked:
pass   -> DMESG-WARN (fi-snb-2600)
Subgroup basic-default-hang:
pass   -> DMESG-WARN (fi-snb-2520m)
Test kms_cursor_legacy:
Subgroup basic-flip-vs-cursor-varying-size:
fail   -> PASS   (fi-hsw-4770k)
Test kms_pipe_crc_basic:
Subgroup hang-read-crc-pipe-a:
pass   -> DMESG-WARN (fi-snb-2600)
pass   -> DMESG-WARN (fi-snb-2520m)
Subgroup hang-read-crc-pipe-b:
skip   -> PASS   (fi-skl-6260u)
pass   -> DMESG-WARN (fi-snb-2600)
pass   -> DMESG-WARN (fi-snb-2520m)

fi-bdw-5557u total:249  pass:232  dwarn:0   dfail:0   fail:1   skip:16 
fi-bsw-n3050 total:249  pass:202  dwarn:0   dfail:0   fail:3   skip:44 
fi-byt-n2820 total:249  pass:204  dwarn:0   dfail:0   fail:4   skip:41 
fi-hsw-4770k total:249  pass:220  dwarn:6   dfail:0   fail:1   skip:22 
fi-hsw-4770r total:249  pass:221  dwarn:0   dfail:0   fail:2   skip:26 
fi-ivb-3520m total:249  pass:217  dwarn:0   dfail:0   fail:1   skip:31 
fi-skl-6260u total:249  pass:234  dwarn:0   dfail:0   fail:1   skip:14 
fi-skl-6700k total:249  pass:214  dwarn:4   dfail:0   fail:3   skip:28 
fi-snb-2520m total:249  pass:197  dwarn:8   dfail:0   fail:2   skip:42 
fi-snb-2600  total:249  pass:198  dwarn:8   dfail:0   fail:1   skip:42 

Results at /archive/results/CI_IGT_test/Patchwork_2406/

5a8708ec5c5bbc8eacf1f5b9cb815e6064e9737b drm-intel-nightly: 
2016y-08m-23d-12h-12m-19s UTC integration manifest
cdf6f4e drm/i915/slpc: Update freq min/max softlimits
3c60f17 drm/i915: Add support for SKL/BXT 9.18 GuC Firmware for SLPC
0e3e59f drm/i915: Sanitize GT PM before reset
03c1058 drm/i915/slpc: Keep RP SW Mode enabled while disabling rps
58d8793 drm/i915/slpc: Only Enable GTPERF, Disable DCC, Balancer, IBC, FPS Stall
bd518e4 drm/i915: Mark GuC load status as PENDING in i915_drm_resume_early
36be1aa drm/i915: Check GuC load status for Host to GuC action and SLPC status
28e9513 drm/i915/slpc: Add broxton support
ebc79b5 drm/i915/slpc: Add i915_slpc_info to debugfs
5daaf83 drm/i915/slpc: Add enable/disable debugfs for slpc
1cccd78 drm/i915/slpc: Add slpc support for max/min freq
b086b52 drm/i915/slpc: Add parameter unset/set/get functions
700487e drm/i915/slpc: Add slpc_status enum values
d9fa858 drm/i915/slpc: Send shutdown event
a9dac14 drm/i915/slpc: Send reset event
b1e6d41 drm/i915: Add sysfs interface to know the HW requested frequency
db28c6a drm/i915/slpc: Update sysfs/debugfs interfaces for frequency parameters
f22abbe drm/i915/slpc: Allocate/Release/Initialize SLPC shared data
488d086 drm/i915/slpc: If using SLPC, do not set frequency
f75ddcd drm/i915/slpc: Enable SLPC in guc if supported
a2794ff drm/i915/slpc: Use intel_slpc_* functions if supported
71a703d drm/i915/slpc: Sanitize SLPC version
19483f6 drm/i915/slpc: Add enable_slpc module parameter
44686ae drm/i915/slpc: Add SKL SLPC Support
a567d72 drm/i915/slpc: Add has_slpc capability flag
a207589 drm/i915/slpc: Expose guc functions for use with SLPC
ade0a96 drm/i915: Remove RPM suspend dependency on rps.enabled and related 
changes

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


[Intel-gfx] Display problems after upgrade to X v1.18.3

2016-08-23 Thread Jim Abernathy
Not having much luck with the Distro forums on this issue so I thought I'd ask 
for advice here.

I've been running Ubuntu 14.04.4 for some time on Intel Core i5 GFX without any 
issues.  My display is HDMI from the PC to an Onkyo A/V receiver then to a Sony 
KDL-XBR6.

When I try a fresh install of 16.04.1, I get a display that blanks out for 3-5 
seconds at random times depending on what is being displayed at the time.  I 
also have small amouts of video noise that is random horizontal lines about 1 
pixel tall scattered through the page.

I noticed that 14.04.05 uses X server 1.17.2 and 16.04.1 uses 1.18.3.

When I do the command xrandr --verbose I see some small differences between 
14.04 and 16.04, but it's things like 2 digits displayed instead of 1.  i.e. 
60.0 vs. 60.00. I'm only concerned with 1080P HD.

I've tried this on different computers all with Intel GFX. same results.

This does not occur on other monitors or TVs.

I'd blame it on Sony and Onkyo if they didn't work so well with Windows, all 
versions, and Ubuntu all versions except 16.04.

It's almost like the auto detection software in the newest version of X is off 
just enough to make my display flaky.  Kind of like the old analog CRT TVs that 
were sensitive to small tweaks to the horizontal and vertical adjustments.

Any help would be appreciated.

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


Re: [Intel-gfx] [PATCH] drm/i915: free intel_fb

2016-08-23 Thread Chris Wilson
On Tue, Aug 23, 2016 at 04:00:44PM +0100, Matthew Auld wrote:
> We need to free the allocated intel_fb in the error path, not
> intel_fb->base. Otherwise we risk calling kfree with a non-kmalloc'd
> address, which is bound to give us grief at some point.
> 
> Signed-off-by: Matthew Auld 
Reviewed-by: Chris Wilson 
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/2] drm/i915: Create a intel_encoder_find_connector helper function.

2016-08-23 Thread kbuild test robot
Hi Maarten,

[auto build test WARNING on drm-intel/for-linux-next]
[cannot apply to v4.8-rc3 next-20160823]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Maarten-Lankhorst/drm-i915-Create-a-intel_encoder_find_connector-helper-function/20160823-222308
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-x016-201634 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/i915/intel_display.c: In function 'intel_sanitize_encoder':
>> drivers/gpu/drm/i915/intel_display.c:16539:21: warning: unused variable 
>> 'dev' [-Wunused-variable]
 struct drm_device *dev = encoder->base.dev;
^~~

vim +/dev +16539 drivers/gpu/drm/i915/intel_display.c

a168f5b3f1 Ville Syrjälä 2016-08-05  16523   * We track the 
PCH trancoder underrun reporting state
a168f5b3f1 Ville Syrjälä 2016-08-05  16524   * within the 
crtc. With crtc for pipe A housing the underrun
a168f5b3f1 Ville Syrjälä 2016-08-05  16525   * reporting 
state for PCH transcoder A, crtc for pipe B housing
a168f5b3f1 Ville Syrjälä 2016-08-05  16526   * it for PCH 
transcoder B, etc. LPT-H has only PCH transcoder A,
a168f5b3f1 Ville Syrjälä 2016-08-05  16527   * and marking 
underrun reporting as disabled for the non-existing
a168f5b3f1 Ville Syrjälä 2016-08-05  16528   * PCH 
transcoders B and C would prevent enabling the south
a168f5b3f1 Ville Syrjälä 2016-08-05  16529   * error 
interrupt (see cpt_can_enable_serr_int()).
a168f5b3f1 Ville Syrjälä 2016-08-05  16530   */
a168f5b3f1 Ville Syrjälä 2016-08-05  16531  if 
(has_pch_trancoder(dev_priv, (enum transcoder)crtc->pipe))
4cc3148930 Daniel Vetter 2014-03-24  16532  
crtc->pch_fifo_underrun_disabled = true;
4cc3148930 Daniel Vetter 2014-03-24  16533  }
2492935248 Daniel Vetter 2012-07-02  16534  }
2492935248 Daniel Vetter 2012-07-02  16535  
2492935248 Daniel Vetter 2012-07-02  16536  static void 
intel_sanitize_encoder(struct intel_encoder *encoder)
2492935248 Daniel Vetter 2012-07-02  16537  {
2492935248 Daniel Vetter 2012-07-02  16538  struct intel_connector 
*connector;
2492935248 Daniel Vetter 2012-07-02 @16539  struct drm_device *dev 
= encoder->base.dev;
2492935248 Daniel Vetter 2012-07-02  16540  
2492935248 Daniel Vetter 2012-07-02  16541  /* We need to check 
both for a crtc link (meaning that the
2492935248 Daniel Vetter 2012-07-02  16542   * encoder is active 
and trying to read from a pipe) and the
2492935248 Daniel Vetter 2012-07-02  16543   * pipe itself being 
active. */
2492935248 Daniel Vetter 2012-07-02  16544  bool has_active_crtc = 
encoder->base.crtc &&
2492935248 Daniel Vetter 2012-07-02  16545  
to_intel_crtc(encoder->base.crtc)->active;
2492935248 Daniel Vetter 2012-07-02  16546  
d1b4131c19 Maarten Lankhorst 2016-08-23  16547  connector = 
intel_encoder_find_connector(encoder);

:: The code at line 16539 was first introduced by commit
:: 24929352481f085c5f85d4d4cbc919ddf106d381 drm/i915: read out the modeset 
hw state at load and resume time

:: TO: Daniel Vetter 
:: CC: Daniel Vetter 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm/i915: free intel_fb

2016-08-23 Thread Matthew Auld
We need to free the allocated intel_fb in the error path, not
intel_fb->base. Otherwise we risk calling kfree with a non-kmalloc'd
address, which is bound to give us grief at some point.

Signed-off-by: Matthew Auld 
---
 drivers/gpu/drm/i915/intel_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index a5c80cb5..79bc99d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -9798,7 +9798,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
return;
 
 error:
-   kfree(fb);
+   kfree(intel_fb);
 }
 
 static void ironlake_get_pfit_config(struct intel_crtc *crtc,
-- 
2.7.4

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


[Intel-gfx] [PATCH] drm/i915: use offset value in DRM_DEBUG_KMS

2016-08-23 Thread Matthew Auld
We go through all the trouble of reading the offset from hw, but never
end up using it. Later in the DRM_DEBUG_KMS statement we mistakenly use
the base as the offset. Let's fix this by now making use of both the
offset and the base, and while we are here make the format more
consistent.

Signed-off-by: Matthew Auld 
---
 drivers/gpu/drm/i915/intel_display.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index b10bea6..a5c80cb5 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -8765,9 +8765,9 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
 
plane_config->size = fb->pitches[0] * aligned_height;
 
-   DRM_DEBUG_KMS("pipe/plane %c/%d with fb: size=%dx%d@%d, offset=%x, 
pitch %d, size 0x%x\n",
+   DRM_DEBUG_KMS("pipe/plane %c/%d with fb: size=%dx%d@%d, base=%x, 
offset=%x, pitch=%d, size=0x%x\n",
  pipe_name(pipe), plane, fb->width, fb->height,
- fb->bits_per_pixel, base, fb->pitches[0],
+ fb->bits_per_pixel, base, offset, fb->pitches[0],
  plane_config->size);
 
plane_config->fb = intel_fb;
@@ -9789,9 +9789,9 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
 
plane_config->size = fb->pitches[0] * aligned_height;
 
-   DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, 
size 0x%x\n",
+   DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, base=%x, offset=%x, 
pitch=%d, size=0x%x\n",
  pipe_name(pipe), fb->width, fb->height,
- fb->bits_per_pixel, base, fb->pitches[0],
+ fb->bits_per_pixel, base, offset, fb->pitches[0],
  plane_config->size);
 
plane_config->fb = intel_fb;
@@ -9886,9 +9886,9 @@ ironlake_get_initial_plane_config(struct intel_crtc *crtc,
 
plane_config->size = fb->pitches[0] * aligned_height;
 
-   DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, 
size 0x%x\n",
+   DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, base=%x, offset=%x, 
pitch=%d, size=0x%x\n",
  pipe_name(pipe), fb->width, fb->height,
- fb->bits_per_pixel, base, fb->pitches[0],
+ fb->bits_per_pixel, base, offset, fb->pitches[0],
  plane_config->size);
 
plane_config->fb = intel_fb;
-- 
2.7.4

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


Re: [Intel-gfx] [PATCH 2/4] drm/i915: Simplify ELSP queue request tracking

2016-08-23 Thread Chris Wilson
On Tue, Aug 23, 2016 at 05:28:07PM +0300, Mika Kuoppala wrote:
> > +   /* Try to read in pairs and fill both submission ports */
> > +   spin_lock(&engine->execlist_lock);
> > +   list_for_each_entry(cursor, &engine->execlist_queue, execlist_link) {
> > +   if (last && !merge_ctx(cursor->ctx, last->ctx)) {
> > +   if (port != engine->execlist_port)
> > +   break;
> 
> In here you will merge ctx also for the second port?
>
> The previous version of the code was careful to only merge for
> the first port/request.

Careful? Hah.
-Chris
 
-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/2] drm/i915: Cleanup crt disable sequence on hsw+

2016-08-23 Thread Daniel Vetter
On Tue, Aug 23, 2016 at 04:18:08PM +0200, Maarten Lankhorst wrote:
> Instead of iterating overthe connectors manually, run the last part of
> DDI disabling inside the crt post disable function.
> 
> This was meant to be addressed before submitting the other commit,
> but I missed the review comments.
> 
> Fixes: fd6bbda9c7a4 ("drm/i915: Pass crtc_state and connector_state to 
> encoder functions")
> Signed-off-by: Maarten Lankhorst 

Yup, I think that's much more tidy.

Reviewed-by: Daniel Vetter 

> ---
>  drivers/gpu/drm/i915/intel_crt.c | 15 
>  drivers/gpu/drm/i915/intel_ddi.c | 67 
> ++--
>  drivers/gpu/drm/i915/intel_display.c | 25 ++
>  drivers/gpu/drm/i915/intel_drv.h |  8 +++--
>  4 files changed, 57 insertions(+), 58 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_crt.c 
> b/drivers/gpu/drm/i915/intel_crt.c
> index 1daf2d9c937e..dfbcf16b41df 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -215,6 +215,20 @@ static void pch_post_disable_crt(struct intel_encoder 
> *encoder,
>   intel_disable_crt(encoder, old_crtc_state, old_conn_state);
>  }
>  
> +static void hsw_post_disable_crt(struct intel_encoder *encoder,
> +  struct intel_crtc_state *old_crtc_state,
> +  struct drm_connector_state *old_conn_state)
> +{
> + struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> +
> + pch_post_disable_crt(encoder, old_crtc_state, old_conn_state);
> +
> + lpt_disable_pch_transcoder(dev_priv);
> + lpt_disable_iclkip(dev_priv);
> +
> + intel_ddi_fdi_post_disable(encoder, old_crtc_state, old_conn_state);
> +}
> +
>  static void intel_enable_crt(struct intel_encoder *encoder,
>struct intel_crtc_state *pipe_config,
>struct drm_connector_state *conn_state)
> @@ -905,6 +919,7 @@ void intel_crt_init(struct drm_device *dev)
>   if (HAS_DDI(dev)) {
>   crt->base.get_config = hsw_crt_get_config;
>   crt->base.get_hw_state = intel_ddi_get_hw_state;
> + crt->base.post_disable = hsw_post_disable_crt;
>   } else {
>   crt->base.get_config = intel_crt_get_config;
>   crt->base.get_hw_state = intel_crt_get_hw_state;
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c 
> b/drivers/gpu/drm/i915/intel_ddi.c
> index 309ba7bc19ad..bbd81c6bdd69 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -1714,6 +1714,40 @@ static void intel_ddi_post_disable(struct 
> intel_encoder *intel_encoder,
>   }
>  }
>  
> +void intel_ddi_fdi_post_disable(struct intel_encoder *intel_encoder,
> + struct intel_crtc_state *old_crtc_state,
> + struct drm_connector_state *old_conn_state)
> +{
> + struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
> + uint32_t val;
> +
> + /*
> +  * Bspec lists this as both step 13 (before DDI_BUF_CTL disable)
> +  * and step 18 (after clearing PORT_CLK_SEL). Based on a BUN,
> +  * step 13 is the correct place for it. Step 18 is where it was
> +  * originally before the BUN.
> +  */
> + val = I915_READ(FDI_RX_CTL(PIPE_A));
> + val &= ~FDI_RX_ENABLE;
> + I915_WRITE(FDI_RX_CTL(PIPE_A), val);
> +
> + intel_ddi_post_disable(intel_encoder, old_crtc_state, old_conn_state);
> +
> + val = I915_READ(FDI_RX_MISC(PIPE_A));
> + val &= ~(FDI_RX_PWRDN_LANE1_MASK | FDI_RX_PWRDN_LANE0_MASK);
> + val |= FDI_RX_PWRDN_LANE1_VAL(2) | FDI_RX_PWRDN_LANE0_VAL(2);
> + I915_WRITE(FDI_RX_MISC(PIPE_A), val);
> +
> + val = I915_READ(FDI_RX_CTL(PIPE_A));
> + val &= ~FDI_PCDCLK;
> + I915_WRITE(FDI_RX_CTL(PIPE_A), val);
> +
> + val = I915_READ(FDI_RX_CTL(PIPE_A));
> + val &= ~FDI_RX_PLL_ENABLE;
> + I915_WRITE(FDI_RX_CTL(PIPE_A), val);
> +}
> +
> +
>  static void intel_enable_ddi(struct intel_encoder *intel_encoder,
>struct intel_crtc_state *pipe_config,
>struct drm_connector_state *conn_state)
> @@ -2153,39 +2187,6 @@ void intel_ddi_prepare_link_retrain(struct intel_dp 
> *intel_dp)
>   udelay(600);
>  }
>  
> -void intel_ddi_fdi_disable(struct intel_encoder *intel_encoder,
> -struct intel_crtc_state *old_crtc_state,
> -struct drm_connector_state *old_conn_state)
> -{
> - struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
> - uint32_t val;
> -
> - /*
> -  * Bspec lists this as both step 13 (before DDI_BUF_CTL disable)
> -  * and step 18 (after clearing PORT_CLK_SEL). Based on a BUN,
> -  * step 13 is the correct place for it. Step 18 is where it was
> -  * originally before the BUN.
> -  */
> - val = I915_READ(FDI_RX_CTL(PIPE_A));
> - val &= ~FDI_RX_ENABLE;
> -

Re: [Intel-gfx] [PATCH 1/2] drm/i915: Create a intel_encoder_find_connector helper function.

2016-08-23 Thread Daniel Vetter
On Tue, Aug 23, 2016 at 04:18:07PM +0200, Maarten Lankhorst wrote:
> This makes the code in intel_sanitize_encoder slightly more readable.
> This was meant to be addressed in fd6bbda9c7a4, but I missed that
> review comment.
> 
> Fixes: fd6bbda9c7a4 ("drm/i915: Pass crtc_state and connector_state to 
> encoder functions")
> Signed-off-by: Maarten Lankhorst 

Yeah, prettiness restored!

Reviewed-by: Daniel Vetter 

> ---
>  drivers/gpu/drm/i915/intel_display.c | 20 +---
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c 
> b/drivers/gpu/drm/i915/intel_display.c
> index 2dd2c0e9ae32..2ae080f947e8 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -16423,6 +16423,17 @@ static bool intel_crtc_has_encoders(struct 
> intel_crtc *crtc)
>   return false;
>  }
>  
> +static struct intel_connector *intel_encoder_find_connector(struct 
> intel_encoder *encoder)
> +{
> + struct drm_device *dev = encoder->base.dev;
> + struct intel_connector *connector;
> +
> + for_each_connector_on_encoder(dev, &encoder->base, connector)
> + return connector;
> +
> + return NULL;
> +}
> +
>  static bool has_pch_trancoder(struct drm_i915_private *dev_priv,
> enum transcoder pch_transcoder)
>  {
> @@ -16526,7 +16537,6 @@ static void intel_sanitize_encoder(struct 
> intel_encoder *encoder)
>  {
>   struct intel_connector *connector;
>   struct drm_device *dev = encoder->base.dev;
> - bool found_connector = false;
>  
>   /* We need to check both for a crtc link (meaning that the
>* encoder is active and trying to read from a pipe) and the
> @@ -16534,12 +16544,8 @@ static void intel_sanitize_encoder(struct 
> intel_encoder *encoder)
>   bool has_active_crtc = encoder->base.crtc &&
>   to_intel_crtc(encoder->base.crtc)->active;
>  
> - for_each_connector_on_encoder(dev, &encoder->base, connector) {
> - found_connector = true;
> - break;
> - }
> -
> - if (found_connector && !has_active_crtc) {
> + connector = intel_encoder_find_connector(encoder);
> + if (connector && !has_active_crtc) {
>   DRM_DEBUG_KMS("[ENCODER:%d:%s] has active connectors but no 
> active pipe!\n",
> encoder->base.base.id,
> encoder->base.name);
> -- 
> 2.7.4
> 
> ___
> 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
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/4] drm/i915: Simplify ELSP queue request tracking

2016-08-23 Thread Mika Kuoppala
Chris Wilson  writes:

> Emulate HW to track and manage ELSP queue. A set of SW ports are defined
> and requests are assigned to these ports before submitting them to HW. This
> helps in cleaning up incomplete requests during reset recovery easier
> especially after engine reset by decoupling elsp queue management. This
> will become more clear in the next patch.
>
> In the engine reset case we want to resume where we left-off after skipping
> the incomplete batch which requires checking the elsp queue, removing
> element and fixing elsp_submitted counts in some cases. Instead of directly
> manipulating the elsp queue from reset path we can examine these ports, fix
> up ringbuffer pointers using the incomplete request and restart submissions
> again after reset.
>
> Cc: Tvrtko Ursulin 
> Cc: Mika Kuoppala 
> Cc: Arun Siluvery 
> Signed-off-by: Chris Wilson 
> Link: 
> http://patchwork.freedesktop.org/patch/msgid/1470414607-32453-3-git-send-email-arun.siluv...@linux.intel.com
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c |   2 +-
>  drivers/gpu/drm/i915/i915_gem.c |   6 +-
>  drivers/gpu/drm/i915/i915_gem_request.c |  11 +-
>  drivers/gpu/drm/i915/i915_gem_request.h |  24 +-
>  drivers/gpu/drm/i915/intel_lrc.c| 417 
> +++-
>  drivers/gpu/drm/i915/intel_lrc.h|   2 -
>  drivers/gpu/drm/i915/intel_ringbuffer.h |   7 +-
>  7 files changed, 160 insertions(+), 309 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
> b/drivers/gpu/drm/i915/i915_debugfs.c
> index 9bd41581b592..f1f937a64c27 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2200,7 +2200,7 @@ static int i915_execlists(struct seq_file *m, void 
> *data)
>   status_pointer = I915_READ(RING_CONTEXT_STATUS_PTR(engine));
>   seq_printf(m, "\tStatus pointer: 0x%08X\n", status_pointer);
>  
> - read_pointer = engine->next_context_status_buffer;
> + read_pointer = GEN8_CSB_READ_PTR(status_pointer);
>   write_pointer = GEN8_CSB_WRITE_PTR(status_pointer);
>   if (read_pointer > write_pointer)
>   write_pointer += GEN8_CSB_ENTRIES;
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index f4f8eaa90f2a..19715f5e698f 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -2443,7 +2443,11 @@ static void i915_gem_reset_engine_cleanup(struct 
> intel_engine_cs *engine)
>   /* Ensure irq handler finishes or is cancelled. */
>   tasklet_kill(&engine->irq_tasklet);
>  
> - intel_execlists_cancel_requests(engine);
> + INIT_LIST_HEAD(&engine->execlist_queue);
> + i915_gem_request_assign(&engine->execlist_port[0].request,
> + NULL);
> + i915_gem_request_assign(&engine->execlist_port[1].request,
> + NULL);

How about engine->reset() which would contain these?

>   }
>  
>   /*
> diff --git a/drivers/gpu/drm/i915/i915_gem_request.c 
> b/drivers/gpu/drm/i915/i915_gem_request.c
> index 6c2553715263..49cca4233a8e 100644
> --- a/drivers/gpu/drm/i915/i915_gem_request.c
> +++ b/drivers/gpu/drm/i915/i915_gem_request.c
> @@ -736,16 +736,18 @@ complete:
>   return ret;
>  }
>  
> -static void engine_retire_requests(struct intel_engine_cs *engine)
> +static bool engine_retire_requests(struct intel_engine_cs *engine)
>  {
>   struct drm_i915_gem_request *request, *next;
>  
>   list_for_each_entry_safe(request, next, &engine->request_list, link) {
>   if (!i915_gem_request_completed(request))
> - break;
> + return false;
>  
>   i915_gem_request_retire(request);
>   }
> +
> + return true;
>  }
>  
>  void i915_gem_retire_requests(struct drm_i915_private *dev_priv)
> @@ -759,9 +761,8 @@ void i915_gem_retire_requests(struct drm_i915_private 
> *dev_priv)
>  
>   GEM_BUG_ON(!dev_priv->gt.awake);
>  
> - for_each_engine(engine, dev_priv) {
> - engine_retire_requests(engine);
> - if (!intel_engine_is_active(engine))
> + for_each_engine_masked(engine, dev_priv, dev_priv->gt.active_engines) {
> + if (engine_retire_requests(engine))
>   dev_priv->gt.active_engines &= 
> ~intel_engine_flag(engine);
>   }
>

These were already stripped to another patch. Good.

> diff --git a/drivers/gpu/drm/i915/i915_gem_request.h 
> b/drivers/gpu/drm/i915/i915_gem_request.h
> index 3496e28785e7..32123e38ef4b 100644
> --- a/drivers/gpu/drm/i915/i915_gem_request.h
> +++ b/drivers/gpu/drm/i915/i915_gem_request.h
> @@ -94,6 +94,9 @@ struct drm_i915_gem_request {
>   /** Position in the ringbuffer of the end of the whole request */
>   u32 tail;
>  
> + /** Position in the ringbuffer after the end of the whole request */
> + 

[Intel-gfx] ✗ Fi.CI.BAT: failure for ] Revert "Revert "drm/i915: Use atomic commits for legacy page_flips""

2016-08-23 Thread Patchwork
== Series Details ==

Series: ] Revert "Revert "drm/i915: Use atomic commits for legacy page_flips""
URL   : https://patchwork.freedesktop.org/series/11469/
State : failure

== Summary ==

Series 11469v1 ] Revert "Revert "drm/i915: Use atomic commits for legacy 
page_flips""
http://patchwork.freedesktop.org/api/1.0/series/11469/revisions/1/mbox/

Test gem_exec_suspend:
Subgroup basic-s3:
dmesg-warn -> INCOMPLETE (fi-hsw-4770k)
Test kms_cursor_legacy:
Subgroup basic-cursor-vs-flip-legacy:
pass   -> FAIL   (fi-ivb-3520m)
pass   -> FAIL   (fi-bsw-n3050)
pass   -> FAIL   (fi-snb-2520m)
pass   -> FAIL   (fi-snb-2600)
pass   -> FAIL   (fi-hsw-4770r)
pass   -> FAIL   (fi-skl-6260u)
pass   -> FAIL   (fi-byt-n2820)
pass   -> FAIL   (fi-bdw-5557u)
pass   -> FAIL   (fi-skl-6700k)
Subgroup basic-cursor-vs-flip-varying-size:
pass   -> FAIL   (fi-ivb-3520m)
pass   -> FAIL   (fi-bsw-n3050)
pass   -> FAIL   (fi-snb-2520m)
pass   -> FAIL   (fi-snb-2600)
pass   -> FAIL   (fi-hsw-4770r)
pass   -> FAIL   (fi-skl-6260u)
pass   -> FAIL   (fi-byt-n2820)
pass   -> FAIL   (fi-bdw-5557u)
pass   -> FAIL   (fi-skl-6700k)
Subgroup basic-flip-vs-cursor-legacy:
pass   -> FAIL   (fi-ivb-3520m)
pass   -> FAIL   (fi-snb-2520m)
pass   -> FAIL   (fi-snb-2600)
pass   -> FAIL   (fi-hsw-4770r)
pass   -> FAIL   (fi-skl-6260u)
pass   -> FAIL   (fi-bdw-5557u)
Subgroup basic-flip-vs-cursor-varying-size:
pass   -> FAIL   (fi-ivb-3520m)
pass   -> FAIL   (fi-skl-6260u)
pass   -> FAIL   (fi-snb-2520m)
pass   -> FAIL   (fi-bdw-5557u)
pass   -> FAIL   (fi-snb-2600)
Test kms_pipe_crc_basic:
Subgroup hang-read-crc-pipe-b:
skip   -> PASS   (fi-skl-6260u)
Test prime_vgem:
Subgroup basic-fence-flip:
pass   -> FAIL   (fi-skl-6700k)
pass   -> FAIL   (fi-snb-2600)
pass   -> FAIL   (fi-hsw-4770r)
pass   -> FAIL   (fi-bdw-5557u)
pass   -> FAIL   (fi-byt-n2820)
pass   -> FAIL   (fi-skl-6260u)

fi-bdw-5557u total:249  pass:227  dwarn:0   dfail:0   fail:6   skip:16 
fi-bsw-n3050 total:249  pass:200  dwarn:0   dfail:0   fail:5   skip:44 
fi-byt-n2820 total:249  pass:201  dwarn:0   dfail:0   fail:7   skip:41 
fi-hsw-4770k total:107  pass:91   dwarn:0   dfail:0   fail:0   skip:15 
fi-hsw-4770r total:249  pass:217  dwarn:0   dfail:0   fail:6   skip:26 
fi-ivb-3520m total:249  pass:213  dwarn:0   dfail:0   fail:5   skip:31 
fi-skl-6260u total:249  pass:229  dwarn:0   dfail:0   fail:6   skip:14 
fi-skl-6700k total:249  pass:211  dwarn:4   dfail:0   fail:6   skip:28 
fi-snb-2520m total:249  pass:197  dwarn:4   dfail:0   fail:6   skip:42 
fi-snb-2600  total:249  pass:197  dwarn:4   dfail:0   fail:6   skip:42 

Results at /archive/results/CI_IGT_test/Patchwork_2403/

5a8708ec5c5bbc8eacf1f5b9cb815e6064e9737b drm-intel-nightly: 
2016y-08m-23d-12h-12m-19s UTC integration manifest
f95c574 ] Revert "Revert "drm/i915: Use atomic commits for legacy page_flips""

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


[Intel-gfx] [PATCH 2/2] drm/i915: Cleanup crt disable sequence on hsw+

2016-08-23 Thread Maarten Lankhorst
Instead of iterating overthe connectors manually, run the last part of
DDI disabling inside the crt post disable function.

This was meant to be addressed before submitting the other commit,
but I missed the review comments.

Fixes: fd6bbda9c7a4 ("drm/i915: Pass crtc_state and connector_state to encoder 
functions")
Signed-off-by: Maarten Lankhorst 
---
 drivers/gpu/drm/i915/intel_crt.c | 15 
 drivers/gpu/drm/i915/intel_ddi.c | 67 ++--
 drivers/gpu/drm/i915/intel_display.c | 25 ++
 drivers/gpu/drm/i915/intel_drv.h |  8 +++--
 4 files changed, 57 insertions(+), 58 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 1daf2d9c937e..dfbcf16b41df 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -215,6 +215,20 @@ static void pch_post_disable_crt(struct intel_encoder 
*encoder,
intel_disable_crt(encoder, old_crtc_state, old_conn_state);
 }
 
+static void hsw_post_disable_crt(struct intel_encoder *encoder,
+struct intel_crtc_state *old_crtc_state,
+struct drm_connector_state *old_conn_state)
+{
+   struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+
+   pch_post_disable_crt(encoder, old_crtc_state, old_conn_state);
+
+   lpt_disable_pch_transcoder(dev_priv);
+   lpt_disable_iclkip(dev_priv);
+
+   intel_ddi_fdi_post_disable(encoder, old_crtc_state, old_conn_state);
+}
+
 static void intel_enable_crt(struct intel_encoder *encoder,
 struct intel_crtc_state *pipe_config,
 struct drm_connector_state *conn_state)
@@ -905,6 +919,7 @@ void intel_crt_init(struct drm_device *dev)
if (HAS_DDI(dev)) {
crt->base.get_config = hsw_crt_get_config;
crt->base.get_hw_state = intel_ddi_get_hw_state;
+   crt->base.post_disable = hsw_post_disable_crt;
} else {
crt->base.get_config = intel_crt_get_config;
crt->base.get_hw_state = intel_crt_get_hw_state;
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 309ba7bc19ad..bbd81c6bdd69 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1714,6 +1714,40 @@ static void intel_ddi_post_disable(struct intel_encoder 
*intel_encoder,
}
 }
 
+void intel_ddi_fdi_post_disable(struct intel_encoder *intel_encoder,
+   struct intel_crtc_state *old_crtc_state,
+   struct drm_connector_state *old_conn_state)
+{
+   struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
+   uint32_t val;
+
+   /*
+* Bspec lists this as both step 13 (before DDI_BUF_CTL disable)
+* and step 18 (after clearing PORT_CLK_SEL). Based on a BUN,
+* step 13 is the correct place for it. Step 18 is where it was
+* originally before the BUN.
+*/
+   val = I915_READ(FDI_RX_CTL(PIPE_A));
+   val &= ~FDI_RX_ENABLE;
+   I915_WRITE(FDI_RX_CTL(PIPE_A), val);
+
+   intel_ddi_post_disable(intel_encoder, old_crtc_state, old_conn_state);
+
+   val = I915_READ(FDI_RX_MISC(PIPE_A));
+   val &= ~(FDI_RX_PWRDN_LANE1_MASK | FDI_RX_PWRDN_LANE0_MASK);
+   val |= FDI_RX_PWRDN_LANE1_VAL(2) | FDI_RX_PWRDN_LANE0_VAL(2);
+   I915_WRITE(FDI_RX_MISC(PIPE_A), val);
+
+   val = I915_READ(FDI_RX_CTL(PIPE_A));
+   val &= ~FDI_PCDCLK;
+   I915_WRITE(FDI_RX_CTL(PIPE_A), val);
+
+   val = I915_READ(FDI_RX_CTL(PIPE_A));
+   val &= ~FDI_RX_PLL_ENABLE;
+   I915_WRITE(FDI_RX_CTL(PIPE_A), val);
+}
+
+
 static void intel_enable_ddi(struct intel_encoder *intel_encoder,
 struct intel_crtc_state *pipe_config,
 struct drm_connector_state *conn_state)
@@ -2153,39 +2187,6 @@ void intel_ddi_prepare_link_retrain(struct intel_dp 
*intel_dp)
udelay(600);
 }
 
-void intel_ddi_fdi_disable(struct intel_encoder *intel_encoder,
-  struct intel_crtc_state *old_crtc_state,
-  struct drm_connector_state *old_conn_state)
-{
-   struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
-   uint32_t val;
-
-   /*
-* Bspec lists this as both step 13 (before DDI_BUF_CTL disable)
-* and step 18 (after clearing PORT_CLK_SEL). Based on a BUN,
-* step 13 is the correct place for it. Step 18 is where it was
-* originally before the BUN.
-*/
-   val = I915_READ(FDI_RX_CTL(PIPE_A));
-   val &= ~FDI_RX_ENABLE;
-   I915_WRITE(FDI_RX_CTL(PIPE_A), val);
-
-   intel_ddi_post_disable(intel_encoder, old_crtc_state, old_conn_state);
-
-   val = I915_READ(FDI_RX_MISC(PIPE_A));
-   val &= ~(FDI_RX_PWRDN_LANE1_MASK | FDI_RX_PWRDN_LANE0_MASK);
-   val |= FDI_RX

[Intel-gfx] [PATCH 1/2] drm/i915: Create a intel_encoder_find_connector helper function.

2016-08-23 Thread Maarten Lankhorst
This makes the code in intel_sanitize_encoder slightly more readable.
This was meant to be addressed in fd6bbda9c7a4, but I missed that
review comment.

Fixes: fd6bbda9c7a4 ("drm/i915: Pass crtc_state and connector_state to encoder 
functions")
Signed-off-by: Maarten Lankhorst 
---
 drivers/gpu/drm/i915/intel_display.c | 20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 2dd2c0e9ae32..2ae080f947e8 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -16423,6 +16423,17 @@ static bool intel_crtc_has_encoders(struct intel_crtc 
*crtc)
return false;
 }
 
+static struct intel_connector *intel_encoder_find_connector(struct 
intel_encoder *encoder)
+{
+   struct drm_device *dev = encoder->base.dev;
+   struct intel_connector *connector;
+
+   for_each_connector_on_encoder(dev, &encoder->base, connector)
+   return connector;
+
+   return NULL;
+}
+
 static bool has_pch_trancoder(struct drm_i915_private *dev_priv,
  enum transcoder pch_transcoder)
 {
@@ -16526,7 +16537,6 @@ static void intel_sanitize_encoder(struct intel_encoder 
*encoder)
 {
struct intel_connector *connector;
struct drm_device *dev = encoder->base.dev;
-   bool found_connector = false;
 
/* We need to check both for a crtc link (meaning that the
 * encoder is active and trying to read from a pipe) and the
@@ -16534,12 +16544,8 @@ static void intel_sanitize_encoder(struct 
intel_encoder *encoder)
bool has_active_crtc = encoder->base.crtc &&
to_intel_crtc(encoder->base.crtc)->active;
 
-   for_each_connector_on_encoder(dev, &encoder->base, connector) {
-   found_connector = true;
-   break;
-   }
-
-   if (found_connector && !has_active_crtc) {
+   connector = intel_encoder_find_connector(encoder);
+   if (connector && !has_active_crtc) {
DRM_DEBUG_KMS("[ENCODER:%d:%s] has active connectors but no 
active pipe!\n",
  encoder->base.base.id,
  encoder->base.name);
-- 
2.7.4

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


[Intel-gfx] [drm-intel:topic/drm-misc 3/3] htmldocs: drivers/gpu/drm/drm_fb_helper.c:1069: warning: No description found for parameter 'suspend'

2016-08-23 Thread kbuild test robot
tree:   git://anongit.freedesktop.org/drm-intel topic/drm-misc
head:   cfe63423d9be3e7020296c3dfb512768a83cd099
commit: cfe63423d9be3e7020296c3dfb512768a83cd099 [3/3] drm/fb-helper: Add 
drm_fb_helper_set_suspend_unlocked()
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/drm_fb_helper.c:1069: warning: No description found for 
>> parameter 'suspend'
>> drivers/gpu/drm/drm_fb_helper.c:1069: warning: Excess function parameter 
>> 'state' description in 'drm_fb_helper_set_suspend_unlocked'
   drivers/gpu/drm/drm_fb_helper.c:1070: warning: No description found for 
parameter 'suspend'
   drivers/gpu/drm/drm_fb_helper.c:1070: warning: Excess function parameter 
'state' description in 'drm_fb_helper_set_suspend_unlocked'
   Documentation/gpu/drm-kms.rst:13: WARNING: Could not lex literal_block as 
"C". Highlighting skipped.
   Documentation/gpu/drm-kms-helpers.rst:16: WARNING: Could not lex 
literal_block as "C". Highlighting skipped.
   Documentation/gpu/i915.rst:57: WARNING: Could not lex literal_block as "C". 
Highlighting skipped.
   Documentation/gpu/drm-internals.rst:286: WARNING: undefined label: 
vga_switcheroo (if the link has no caption the label must precede a section 
header)

vim +/suspend +1069 drivers/gpu/drm/drm_fb_helper.c

  1053   *  takes the console lock
  1054   * @fb_helper: driver-allocated fbdev helper
  1055   * @state: desired state, zero to resume, non-zero to suspend
  1056   *
  1057   * A wrapper around fb_set_suspend() that takes the console lock. If 
the lock
  1058   * isn't available on resume, a worker is tasked with waiting for the 
lock
  1059   * to become available. The console lock can be pretty contented on 
resume
  1060   * due to all the printk activity.
  1061   *
  1062   * This function can be called multiple times with the same state since
  1063   * &fb_info->state is checked to see if fbdev is running or not before 
locking.
  1064   *
  1065   * Use drm_fb_helper_set_suspend() if you need to take the lock 
yourself.
  1066   */
  1067  void drm_fb_helper_set_suspend_unlocked(struct drm_fb_helper *fb_helper,
  1068  int suspend)
> 1069  {
  1070  if (!fb_helper || !fb_helper->fbdev)
  1071  return;
  1072  
  1073  /* make sure there's no pending/ongoing resume */
  1074  flush_work(&fb_helper->resume_work);
  1075  
  1076  if (suspend) {
  1077  if (fb_helper->fbdev->state != FBINFO_STATE_RUNNING)

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [RESEND PATCH v13 6/7] drm/i915: Move CRTC updating in atomic_commit into it's own hook

2016-08-23 Thread Lyude
Since we have to write ddb allocations at the same time as we do other
plane updates, we're going to need to be able to control the order in
which we execute modesets on each pipe. The easiest way to do this is to
just factor this section of intel_atomic_commit_tail()
(intel_atomic_commit() for stable branches) into it's own function, and
add an appropriate display function hook for it.

Based off of Matt Rope's suggestions

Changes since v1:
 - Drop pipe_config->base.active check in intel_update_crtcs() since we
   check that before calling the function

Signed-off-by: Lyude 
Reviewed-by: Matt Roper 
[omitting CC for stable, since this patch will need to be changed for
such backports first]
Cc: Ville Syrjälä 
Cc: Daniel Vetter 
Cc: Radhakrishna Sripada 
Cc: Hans de Goede 

Signed-off-by: Lyude 
---
 drivers/gpu/drm/i915/i915_drv.h  |  2 +
 drivers/gpu/drm/i915/intel_display.c | 74 +---
 2 files changed, 54 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index ff96b7a..04b4fd6 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -514,6 +514,8 @@ struct drm_i915_display_funcs {
struct drm_atomic_state *old_state);
void (*crtc_disable)(struct intel_crtc_state *old_crtc_state,
 struct drm_atomic_state *old_state);
+   void (*update_crtcs)(struct drm_atomic_state *state,
+unsigned int *crtc_vblank_mask);
void (*audio_codec_enable)(struct drm_connector *connector,
   struct intel_encoder *encoder,
   const struct drm_display_mode 
*adjusted_mode);
diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index b10bea6..330df69 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -14198,6 +14198,52 @@ static bool needs_vblank_wait(struct intel_crtc_state 
*crtc_state)
return false;
 }
 
+static void intel_update_crtc(struct drm_crtc *crtc,
+ struct drm_atomic_state *state,
+ struct drm_crtc_state *old_crtc_state,
+ unsigned int *crtc_vblank_mask)
+{
+   struct drm_device *dev = crtc->dev;
+   struct drm_i915_private *dev_priv = to_i915(dev);
+   struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+   struct intel_crtc_state *pipe_config = to_intel_crtc_state(crtc->state);
+   bool modeset = needs_modeset(crtc->state);
+
+   if (modeset) {
+   update_scanline_offset(intel_crtc);
+   dev_priv->display.crtc_enable(pipe_config, state);
+   } else {
+   intel_pre_plane_update(to_intel_crtc_state(old_crtc_state));
+   }
+
+   if (drm_atomic_get_existing_plane_state(state, crtc->primary)) {
+   intel_fbc_enable(
+   intel_crtc, pipe_config,
+   to_intel_plane_state(crtc->primary->state));
+   }
+
+   drm_atomic_helper_commit_planes_on_crtc(old_crtc_state);
+
+   if (needs_vblank_wait(pipe_config))
+   *crtc_vblank_mask |= drm_crtc_mask(crtc);
+}
+
+static void intel_update_crtcs(struct drm_atomic_state *state,
+  unsigned int *crtc_vblank_mask)
+{
+   struct drm_crtc *crtc;
+   struct drm_crtc_state *old_crtc_state;
+   int i;
+
+   for_each_crtc_in_state(state, crtc, old_crtc_state, i) {
+   if (!crtc->state->active)
+   continue;
+
+   intel_update_crtc(crtc, state, old_crtc_state,
+ crtc_vblank_mask);
+   }
+}
+
 static void intel_atomic_commit_tail(struct drm_atomic_state *state)
 {
struct drm_device *dev = state->dev;
@@ -14296,17 +14342,9 @@ static void intel_atomic_commit_tail(struct 
drm_atomic_state *state)
intel_modeset_verify_disabled(dev);
}
 
-   /* Now enable the clocks, plane, pipe, and connectors that we set up. */
+   /* Complete the events for pipes that have now been disabled */
for_each_crtc_in_state(state, crtc, old_crtc_state, i) {
-   struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
bool modeset = needs_modeset(crtc->state);
-   struct intel_crtc_state *pipe_config =
-   to_intel_crtc_state(crtc->state);
-
-   if (modeset && crtc->state->active) {
-   update_scanline_offset(to_intel_crtc(crtc));
-   dev_priv->display.crtc_enable(pipe_config, state);
-   }
 
/* Complete events for now disable pipes here. */
if (modeset && !crtc->state->active && crtc->state->event) {
@@ -14316,21 +14354,11 @@ static void intel_atomic_commit_tail(struct 
drm_atomic_state *state)
 

[Intel-gfx] [RESEND PATCH v13 7/7] drm/i915/skl: Update DDB values atomically with wms/plane attrs

2016-08-23 Thread Lyude
Now that we can hook into update_crtcs and control the order in which we
update CRTCs at each modeset, we can finish the final step of fixing
Skylake's watermark handling by performing DDB updates at the same time
as plane updates and watermark updates.

The first major change in this patch is skl_update_crtcs(), which
handles ensuring that we order each CRTC update in our atomic commits
properly so that they honor the DDB flush order.

The second major change in this patch is the order in which we flush the
pipes. While the previous order may have worked, it can't be used in
this approach since it no longer will do the right thing. For example,
using the old ddb flush order:

We have pipes A, B, and C enabled, and we're disabling C. Initial ddb
allocation looks like this:

|   A   |   B   |xxx|

Since we're performing the ddb updates after performing any CRTC
disablements in intel_atomic_commit_tail(), the space to the right of
pipe B is unallocated.

1. Flush pipes with new allocation contained into old space. None
   apply, so we skip this
2. Flush pipes having their allocation reduced, but overlapping with a
   previous allocation. None apply, so we also skip this
3. Flush pipes that got more space allocated. This applies to A and B,
   giving us the following update order: A, B

This is wrong, since updating pipe A first will cause it to overlap with
B and potentially burst into flames. Our new order (see the code
comments for details) would update the pipes in the proper order: B, A.

As well, we calculate the order for each DDB update during the check
phase, and reference it later in the commit phase when we hit
skl_update_crtcs().

This long overdue patch fixes the rest of the underruns on Skylake.

Changes since v1:
 - Add skl_ddb_entry_write() for cursor into skl_write_cursor_wm()
Changes since v2:
 - Use the method for updating CRTCs that Ville suggested
 - In skl_update_wm(), only copy the watermarks for the crtc that was
   passed to us
Changes since v3:
 - Small comment fix in skl_ddb_allocation_overlaps()
Changes since v4:
 - Remove the second loop in intel_update_crtcs() and use Ville's
   suggestion for updating the ddb allocations in the right order
 - Get rid of the second loop and just use the ddb state as it updates
   to determine what order to update everything in (thanks for the
   suggestion Ville)
 - Simplify skl_ddb_allocation_overlaps()
 - Split actual overlap checking into it's own helper

Fixes: 0e8fb7ba7ca5 ("drm/i915/skl: Flush the WM configuration")
Fixes: 8211bd5bdf5e ("drm/i915/skl: Program the DDB allocation")
[omitting CC for stable, since this patch will need to be changed for
such backports first]

Testcase: kms_cursor_legacy
Testcase: plane-all-modeset-transition
Signed-off-by: Lyude 
Cc: Ville Syrjälä 
Cc: Daniel Vetter 
Cc: Radhakrishna Sripada 
Cc: Hans de Goede 
Cc: Matt Roper 
---
 drivers/gpu/drm/i915/intel_display.c |  93 +---
 drivers/gpu/drm/i915/intel_drv.h |   7 ++
 drivers/gpu/drm/i915/intel_pm.c  | 200 ---
 3 files changed, 132 insertions(+), 168 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 330df69..f9273f4 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13483,16 +13483,23 @@ static void verify_wm_state(struct drm_crtc *crtc,
  hw_entry->start, hw_entry->end);
}
 
-   /* cursor */
-   hw_entry = &hw_ddb.plane[pipe][PLANE_CURSOR];
-   sw_entry = &sw_ddb->plane[pipe][PLANE_CURSOR];
-
-   if (!skl_ddb_entry_equal(hw_entry, sw_entry)) {
-   DRM_ERROR("mismatch in DDB state pipe %c cursor "
- "(expected (%u,%u), found (%u,%u))\n",
- pipe_name(pipe),
- sw_entry->start, sw_entry->end,
- hw_entry->start, hw_entry->end);
+   /*
+* cursor
+* If the cursor plane isn't active, we may not have updated it's ddb
+* allocation. In that case since the ddb allocation will be updated
+* once the plane becomes visible, we can skip this check
+*/
+   if (intel_crtc->cursor_addr) {
+   hw_entry = &hw_ddb.plane[pipe][PLANE_CURSOR];
+   sw_entry = &sw_ddb->plane[pipe][PLANE_CURSOR];
+
+   if (!skl_ddb_entry_equal(hw_entry, sw_entry)) {
+   DRM_ERROR("mismatch in DDB state pipe %c cursor "
+ "(expected (%u,%u), found (%u,%u))\n",
+ pipe_name(pipe),
+ sw_entry->start, sw_entry->end,
+ hw_entry->start, hw_entry->end);
+   }
}
 }
 
@@ -14244,6 +14251,65 @@ static void intel_update_crtcs(struct drm_atomic_state 
*state,
}
 }
 
+static void skl_update_crtcs(struct drm_atomic_state *state,
+   

Re: [Intel-gfx] [PATCH] io-mapping.h: s/PAGE_KERNEL_IO/PAGE_KERNEL/

2016-08-23 Thread Chris Wilson
On Tue, Aug 23, 2016 at 03:43:15PM +0200, Daniel Vetter wrote:
> On Tue, Aug 23, 2016 at 2:21 PM, Chris Wilson  
> wrote:
> > On Tue, Aug 23, 2016 at 02:05:18PM +0200, Daniel Vetter wrote:
> >> On Tue, Aug 23, 2016 at 11:04:03AM +0300, Joonas Lahtinen wrote:
> >> > On ti, 2016-08-23 at 08:22 +0100, Chris Wilson wrote:
> >> > > PAGE_KERNEL_IO is an x86-ism. Though it is used to define the pgprot_t
> >> > > used for the iomapped region, it itself is just PAGE_KERNEL. On all
> >> > > other arches, PAGE_KERNEL_IO is undefined so in a general header we 
> >> > > must
> >> > > refrain from using it.
> >> > >
> >> >
> >> > There is;
> >> >
> >> > #define __PAGE_KERNEL_IO   (__PAGE_KERNEL)
> >> >
> >> > So no functional change, but will compile on all archs.
> >> >
> >> > Reviewed-by: Joonas Lahtinen 
> >>
> >> Still not happy:
> >>
> >>   CC  drivers/gpio/gpiolib-of.o
> >> In file included from drivers/gpio/gpiolib-of.c:19:0:
> >> ./include/linux/io-mapping.h: In function ‘io_mapping_init_wc’:
> >> ./include/linux/io-mapping.h:125:16: error: implicit declaration of 
> >> function ‘pgprot_writecombine’ [-Werror=implicit-function-declaration]
> >>   iomap->prot = pgprot_writecombine(PAGE_KERNEL);
> >> ^~~
> >> ./include/linux/io-mapping.h:125:36: error: ‘PAGE_KERNEL’ undeclared 
> >> (first use in this function)
> >>   iomap->prot = pgprot_writecombine(PAGE_KERNEL);
> >> ^~~
> >
> > That was pulled in by the x86 headers,
> >
> > #include 
> 
> Can you pls respin?

Was that right?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [01/17] drm/i915: Skip holding an object reference for execbuf preparation

2016-08-23 Thread Patchwork
== Series Details ==

Series: series starting with [01/17] drm/i915: Skip holding an object reference 
for execbuf preparation
URL   : https://patchwork.freedesktop.org/series/11399/
State : failure

== Summary ==

Series 11399v1 Series without cover letter
http://patchwork.freedesktop.org/api/1.0/series/11399/revisions/1/mbox/

Test kms_cursor_legacy:
Subgroup basic-flip-vs-cursor-varying-size:
fail   -> PASS   (fi-hsw-4770r)
fail   -> PASS   (fi-hsw-4770k)
Test kms_pipe_crc_basic:
Subgroup hang-read-crc-pipe-b:
skip   -> PASS   (fi-skl-6260u)
Subgroup suspend-read-crc-pipe-b:
dmesg-warn -> INCOMPLETE (fi-hsw-4770k)

fi-bdw-5557u total:249  pass:232  dwarn:0   dfail:0   fail:1   skip:16 
fi-bsw-n3050 total:249  pass:202  dwarn:0   dfail:0   fail:3   skip:44 
fi-byt-n2820 total:249  pass:204  dwarn:0   dfail:0   fail:4   skip:41 
fi-hsw-4770k total:207  pass:184  dwarn:2   dfail:0   fail:0   skip:20 
fi-hsw-4770r total:249  pass:222  dwarn:0   dfail:0   fail:1   skip:26 
fi-ivb-3520m total:249  pass:217  dwarn:0   dfail:0   fail:1   skip:31 
fi-skl-6260u total:249  pass:234  dwarn:0   dfail:0   fail:1   skip:14 
fi-skl-6700k total:249  pass:214  dwarn:4   dfail:0   fail:3   skip:28 
fi-snb-2520m total:249  pass:201  dwarn:4   dfail:0   fail:2   skip:42 
fi-snb-2600  total:249  pass:202  dwarn:4   dfail:0   fail:1   skip:42 

Results at /archive/results/CI_IGT_test/Patchwork_2402/

5a8708ec5c5bbc8eacf1f5b9cb815e6064e9737b drm-intel-nightly: 
2016y-08m-23d-12h-12m-19s UTC integration manifest
fc94e4d drm/i915: Pin the pages whilst operating on them
b754ad4 drm/i915: Fix i915_gem_evict_for_vma (soft-pinning)
01051fe drm/i915: Allow the user to pass a context to any ring
986279d drm/i915: Defer active reference until required
2405119 drm/i915: Skip holding an object reference for execbuf preparation

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


Re: [Intel-gfx] [PATCH v3 27/27] drm/i915/slpc: Update freq min/max softlimits

2016-08-23 Thread kbuild test robot
Hi Sagar,

[auto build test WARNING on drm-intel/for-linux-next]
[cannot apply to v4.8-rc3 next-20160823]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Sagar-Arun-Kamble/Add-support-for-GuC-based-SLPC/20160823-204034
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-defconfig (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/i915/intel_slpc.c: In function 'intel_slpc_enable':
>> drivers/gpu/drm/i915/intel_slpc.c:299:15: warning: unused variable 'page' 
>> [-Wunused-variable]
 struct page *page;
  ^~~~

vim +/page +299 drivers/gpu/drm/i915/intel_slpc.c

   283  
   284  void intel_slpc_suspend(struct drm_i915_private *dev_priv)
   285  {
   286  host2guc_slpc_shutdown(dev_priv);
   287  dev_priv->guc.slpc.enabled = false;
   288  }
   289  
   290  void intel_slpc_disable(struct drm_i915_private *dev_priv)
   291  {
   292  host2guc_slpc_shutdown(dev_priv);
   293  dev_priv->guc.slpc.enabled = false;
   294  }
   295  
   296  void intel_slpc_enable(struct drm_i915_private *dev_priv)
   297  {
   298  struct drm_i915_gem_object *obj;
 > 299  struct page *page;
   300  void *pv = NULL;
   301  struct slpc_shared_data data;
   302  u64 val;
   303  
   304  host2guc_slpc_reset(dev_priv);
   305  dev_priv->guc.slpc.enabled = true;
   306  
   307  /* Enable only GTPERF task, Disable others */

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] io-mapping.h: s/PAGE_KERNEL_IO/PAGE_KERNEL/

2016-08-23 Thread Daniel Vetter
On Tue, Aug 23, 2016 at 2:21 PM, Chris Wilson  wrote:
> On Tue, Aug 23, 2016 at 02:05:18PM +0200, Daniel Vetter wrote:
>> On Tue, Aug 23, 2016 at 11:04:03AM +0300, Joonas Lahtinen wrote:
>> > On ti, 2016-08-23 at 08:22 +0100, Chris Wilson wrote:
>> > > PAGE_KERNEL_IO is an x86-ism. Though it is used to define the pgprot_t
>> > > used for the iomapped region, it itself is just PAGE_KERNEL. On all
>> > > other arches, PAGE_KERNEL_IO is undefined so in a general header we must
>> > > refrain from using it.
>> > >
>> >
>> > There is;
>> >
>> > #define __PAGE_KERNEL_IO   (__PAGE_KERNEL)
>> >
>> > So no functional change, but will compile on all archs.
>> >
>> > Reviewed-by: Joonas Lahtinen 
>>
>> Still not happy:
>>
>>   CC  drivers/gpio/gpiolib-of.o
>> In file included from drivers/gpio/gpiolib-of.c:19:0:
>> ./include/linux/io-mapping.h: In function ‘io_mapping_init_wc’:
>> ./include/linux/io-mapping.h:125:16: error: implicit declaration of function 
>> ‘pgprot_writecombine’ [-Werror=implicit-function-declaration]
>>   iomap->prot = pgprot_writecombine(PAGE_KERNEL);
>> ^~~
>> ./include/linux/io-mapping.h:125:36: error: ‘PAGE_KERNEL’ undeclared (first 
>> use in this function)
>>   iomap->prot = pgprot_writecombine(PAGE_KERNEL);
>> ^~~
>
> That was pulled in by the x86 headers,
>
> #include 

Can you pls respin?

Thanks, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 03/17] drm/i915: Allow the user to pass a context to any ring

2016-08-23 Thread John Harrison

On 23/08/2016 14:28, John Harrison wrote:

On 22/08/2016 13:23, Chris Wilson wrote:

On Mon, Aug 22, 2016 at 02:23:28PM +0300, Joonas Lahtinen wrote:

On ma, 2016-08-22 at 09:03 +0100, Chris Wilson wrote:

With full-ppgtt, we want the user to have full control over their memory
layout, with a separate instance per context. Forcing them to use a
shared memory layout for !RCS not only duplicates the amount of work we
have to do, but also defeats the memory segregation on offer.

Signed-off-by: Chris Wilson
---
  drivers/gpu/drm/i915/i915_gem_execbuffer.c | 5 +
  1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c 
b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 8f9d5ad0cfd8..fb1a64738fb8 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1250,12 +1250,9 @@ static struct i915_gem_context *
  i915_gem_validate_context(struct drm_device *dev, struct drm_file *file,
  struct intel_engine_cs *engine, const u32 ctx_id)
  {
-   struct i915_gem_context *ctx = NULL;
+   struct i915_gem_context *ctx;
struct i915_ctx_hang_stats *hs;
  
-	if (engine->id != RCS && ctx_id != DEFAULT_CONTEXT_HANDLE)

-   return ERR_PTR(-EINVAL);
-

One would think this existed due to lack of testing or bugs in early
hardware. Do we need to use IS_GEN or some other means of validation?

No.

This has nothing to do with the hardware logical state (that is found
within intel_context and only enabled where appropriate). The
i915_gem_context is the driver's segregation between clients. Not only
is t required for tracking clients independently (currently hangstats,
but the context would be the first place we start enforcing cgroups like
controls), but it is vital for clients who want to control their memory
layout without conflicts (with themselves and others).
-Chris

It is also important for clients that want to submit lots of work in 
parallel from a single application by using multiple contexts. Other 
internal teams have been running with this patch for quite some time. 
I believe the only reason it has not been merged upstream before (it 
has been on the mailing list at least twice before that I know of) was 
the argument of no open source user.


Reviewed-by: John Harrison 



Actually, just found a previous instance. It had an r-b from Daniel 
Thomas but Tvrtko vetoed it on the grounds of needing IGT coverage first 
- message id '<565ef558.5050...@linux.intel.com>' on Dec 2nd 2015.


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


[Intel-gfx] [drm-intel:for-linux-next 14/16] htmldocs: drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for parameter 'dev_priv'

2016-08-23 Thread kbuild test robot
tree:   git://anongit.freedesktop.org/drm-intel for-linux-next
head:   62e0fb880123c98793e5c3ba8355501b0305e92e
commit: 85cb48a1651ee7cbc49468776d3078418f7827c5 [14/16] drm/i915: Convert 
intel_dp to use atomic state
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/drm_modes.c:693: warning: No description found for parameter 
'bus_flags'
   drivers/gpu/drm/drm_plane_helper.c:248: warning: No description found for 
parameter 'dst'
   drivers/gpu/drm/drm_plane_helper.c:248: warning: Excess function parameter 
'dest' description in 'drm_plane_helper_check_update'
   drivers/gpu/drm/drm_plane_helper.c:247: warning: No description found for 
parameter 'dst'
   drivers/gpu/drm/drm_plane_helper.c:247: warning: Excess function parameter 
'dest' description in 'drm_plane_helper_check_update'
>> drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
>> parameter 'dev_priv'
>> drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
>> parameter 'crtc_state'
>> drivers/gpu/drm/i915/intel_dp.c:5063: warning: Excess function parameter 
>> 'dev' description in 'intel_dp_set_drrs_state'
   drivers/gpu/drm/i915/intel_dp.c:5158: warning: No description found for 
parameter 'crtc_state'
>> drivers/gpu/drm/i915/intel_dp.c:5188: warning: No description found for 
>> parameter 'old_crtc_state'
>> drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
>> parameter 'dev_priv'
>> drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
>> parameter 'crtc_state'
>> drivers/gpu/drm/i915/intel_dp.c:5063: warning: Excess function parameter 
>> 'dev' description in 'intel_dp_set_drrs_state'
   drivers/gpu/drm/i915/intel_dp.c:5158: warning: No description found for 
parameter 'crtc_state'
>> drivers/gpu/drm/i915/intel_dp.c:5188: warning: No description found for 
>> parameter 'old_crtc_state'
>> drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
>> parameter 'dev_priv'
>> drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
>> parameter 'crtc_state'
>> drivers/gpu/drm/i915/intel_dp.c:5063: warning: Excess function parameter 
>> 'dev' description in 'intel_dp_set_drrs_state'
   drivers/gpu/drm/i915/intel_dp.c:5158: warning: No description found for 
parameter 'crtc_state'
>> drivers/gpu/drm/i915/intel_dp.c:5188: warning: No description found for 
>> parameter 'old_crtc_state'
>> drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
>> parameter 'dev_priv'
>> drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
>> parameter 'crtc_state'
>> drivers/gpu/drm/i915/intel_dp.c:5063: warning: Excess function parameter 
>> 'dev' description in 'intel_dp_set_drrs_state'
   drivers/gpu/drm/i915/intel_dp.c:5158: warning: No description found for 
parameter 'crtc_state'
>> drivers/gpu/drm/i915/intel_dp.c:5188: warning: No description found for 
>> parameter 'old_crtc_state'
>> drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
>> parameter 'dev_priv'
>> drivers/gpu/drm/i915/intel_dp.c:5063: warning: No description found for 
>> parameter 'crtc_state'
>> drivers/gpu/drm/i915/intel_dp.c:5063: warning: Excess function parameter 
>> 'dev' description in 'intel_dp_set_drrs_state'
   drivers/gpu/drm/i915/intel_dp.c:5158: warning: No description found for 
parameter 'crtc_state'
>> drivers/gpu/drm/i915/intel_dp.c:5188: warning: No description found for 
>> parameter 'old_crtc_state'

vim +/dev_priv +5063 drivers/gpu/drm/i915/intel_dp.c

b33a2815 Vandana Kannan  2015-02-13  5057   *
b33a2815 Vandana Kannan  2015-02-13  5058   * The caller of this 
function needs to take a lock on dev_priv->drrs.
b33a2815 Vandana Kannan  2015-02-13  5059   */
85cb48a1 Maarten Lankhorst   2016-08-09  5060  static void 
intel_dp_set_drrs_state(struct drm_i915_private *dev_priv,
85cb48a1 Maarten Lankhorst   2016-08-09  5061   
struct intel_crtc_state *crtc_state,
85cb48a1 Maarten Lankhorst   2016-08-09  5062   
int refresh_rate)
439d7ac0 Pradeep Bhat2014-04-05 @5063  {
439d7ac0 Pradeep Bhat2014-04-05  5064   struct intel_encoder 
*encoder;
96178eeb Vandana Kannan  2015-01-10  5065   struct 
intel_digital_port *dig_port = NULL;
96178eeb Vandana Kannan  2015-01-10  5066   struct intel_dp 
*intel_dp = dev_priv->drrs.dp;
85cb48a1 Maarten Lankhorst   2016-08-09  5067   struct intel_crtc 
*intel_crtc = to_intel_crtc(crtc_state->base.crtc);
96178eeb Vandana Kannan  2015-01-10  5068   enum 
drrs_refresh_rate_type index = DRRS_HIGH_RR;
439d7ac0 Pradeep Bhat2014-04-05  5069  
439d7ac0 Pradeep Bhat2014-04-05  5070   if (refresh_rate <= 0) {
439d7ac0 Pradeep Bhat2014-04-05  5071   
DRM_DEBUG_KMS("Refresh rate should be positive non-zero.\n");

Re: [Intel-gfx] [PATCH 03/17] drm/i915: Allow the user to pass a context to any ring

2016-08-23 Thread John Harrison

On 22/08/2016 13:23, Chris Wilson wrote:

On Mon, Aug 22, 2016 at 02:23:28PM +0300, Joonas Lahtinen wrote:

On ma, 2016-08-22 at 09:03 +0100, Chris Wilson wrote:

With full-ppgtt, we want the user to have full control over their memory
layout, with a separate instance per context. Forcing them to use a
shared memory layout for !RCS not only duplicates the amount of work we
have to do, but also defeats the memory segregation on offer.

Signed-off-by: Chris Wilson 
---
  drivers/gpu/drm/i915/i915_gem_execbuffer.c | 5 +
  1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c 
b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 8f9d5ad0cfd8..fb1a64738fb8 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1250,12 +1250,9 @@ static struct i915_gem_context *
  i915_gem_validate_context(struct drm_device *dev, struct drm_file *file,
  struct intel_engine_cs *engine, const u32 ctx_id)
  {
-   struct i915_gem_context *ctx = NULL;
+   struct i915_gem_context *ctx;
struct i915_ctx_hang_stats *hs;
  
-	if (engine->id != RCS && ctx_id != DEFAULT_CONTEXT_HANDLE)

-   return ERR_PTR(-EINVAL);
-

One would think this existed due to lack of testing or bugs in early
hardware. Do we need to use IS_GEN or some other means of validation?

No.

This has nothing to do with the hardware logical state (that is found
within intel_context and only enabled where appropriate). The
i915_gem_context is the driver's segregation between clients. Not only
is t required for tracking clients independently (currently hangstats,
but the context would be the first place we start enforcing cgroups like
controls), but it is vital for clients who want to control their memory
layout without conflicts (with themselves and others).
-Chris

It is also important for clients that want to submit lots of work in 
parallel from a single application by using multiple contexts. Other 
internal teams have been running with this patch for quite some time. I 
believe the only reason it has not been merged upstream before (it has 
been on the mailing list at least twice before that I know of) was the 
argument of no open source user.


Reviewed-by: John Harrison 

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


Re: [Intel-gfx] [PATCH v3 01/27] drm/i915: Remove RPM suspend dependency on rps.enabled and related changes

2016-08-23 Thread kbuild test robot
Hi Sagar,

[auto build test ERROR on drm-intel/for-linux-next]
[cannot apply to v4.8-rc3 next-20160823]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Sagar-Arun-Kamble/Add-support-for-GuC-based-SLPC/20160823-204034
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-x001-201634 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/gpu/drm/i915/intel_runtime_pm.c: In function 
'intel_runtime_pm_enable':
>> drivers/gpu/drm/i915/intel_runtime_pm.c:2761:21: error: unused variable 
>> 'dev' [-Werror=unused-variable]
 struct drm_device *dev = &dev_priv->drm;
^~~
   cc1: all warnings being treated as errors

vim +/dev +2761 drivers/gpu/drm/i915/intel_runtime_pm.c

e4e7684f Daniel Vetter   2014-09-30  2755   * subordinate display power 
domains. That is only done on the first modeset
e4e7684f Daniel Vetter   2014-09-30  2756   * using 
intel_display_set_init_power().
e4e7684f Daniel Vetter   2014-09-30  2757   */
f458ebbc Daniel Vetter   2014-09-30  2758  void intel_runtime_pm_enable(struct 
drm_i915_private *dev_priv)
9c065a7d Daniel Vetter   2014-09-30  2759  {
52a05c30 David Weinehall 2016-08-22  2760   struct pci_dev *pdev = 
dev_priv->drm.pdev;
91c8a326 Chris Wilson2016-07-05 @2761   struct drm_device *dev = 
&dev_priv->drm;
52a05c30 David Weinehall 2016-08-22  2762   struct device *kdev = 
&pdev->dev;
9c065a7d Daniel Vetter   2014-09-30  2763  
c49d13ee David Weinehall 2016-08-22  2764   
pm_runtime_set_autosuspend_delay(kdev, 1); /* 10s */

:: The code at line 2761 was first introduced by commit
:: 91c8a326a192117219d5b9b980244c3662e35404 drm/i915: Convert dev_priv->dev 
backpointers to dev_priv->drm

:: TO: Chris Wilson 
:: CC: Chris Wilson 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


  1   2   3   >