Re: [Intel-gfx] [PATCH 0/3] drm/i915: Handle hanging during nonblocking modeset correctly.

2017-01-30 Thread Daniel Vetter
On Mon, Jan 30, 2017 at 03:42:17PM +0100, Maarten Lankhorst wrote:
> Op 30-01-17 om 09:17 schreef Daniel Vetter:
> > On Fri, Jan 27, 2017 at 03:08:45PM +, Chris Wilson wrote:
> >> On Fri, Jan 27, 2017 at 03:58:08PM +0100, Daniel Vetter wrote:
> >>> On Fri, Jan 27, 2017 at 02:31:55PM +, Chris Wilson wrote:
>  On Fri, Jan 27, 2017 at 03:21:29PM +0100, Daniel Vetter wrote:
> > On Fri, Jan 27, 2017 at 09:30:50AM +, Chris Wilson wrote:
> >> On Thu, Jan 26, 2017 at 04:59:21PM +0100, Maarten Lankhorst wrote:
> >>> When writing some testcases for nonblocking modesets. I found out 
> >>> that the
> >>> infinite wait on the old fb was causing issues.
> >> The crux of the issue here is the locked wait for old dependencies and
> >> the inability to inject the intel_prepare_reset disabling of all 
> >> planes.
> >> There are a couple of locked waits on struct_mutex within the modeset
> >> locks for intel_overlay and if we happen to be using the display plane
> >> for the first time.
> >>
> >> The first I suggested solving using fences to track dependencies and
> >> keep the order between atomic states. Cancelling the outstanding
> >> modesets, replacing with a disable and then on restore jumping to the
> >> final state look doable. It also requires avoiding the struct_mutex for
> >> disabling, which is quite easy. To avoid the wait under struct_mutex,
> >> we've talked about switching to mmio, but for starters we could move 
> >> the
> >> wait from inside intel_overlay into the fence for the atomic operation.
> >> (But's that a little more surgery than we would like for intel_overlay 
> >> I
> >> guess - dig out Ville's patches for overlay planes?) And to prevent the
> >> wait under struct_mutex for pin_to_display_plane, my plane is to move
> >> that to an async fenced operation that is then naturally waited upon by
> >> the atomic modeset.
> > A bit more a hack, but a different idea, and I think hack for gen234.0 
> > is
> > ok:
> >
> > We complete all the requests before we start the hw reset with 
> > fence.error
> > = -EIO. But we do this only when we need to get at the display locks. A
> > slightly more elegant solution would be to trylock modeset locks, and if
> > one of them fails (and only then) complete all requests with -EIO to get
> > the concurrent modeset to proceed before we reset the hardware. That's
> > essentially the logic we had before all the reworks, and it worked. But 
> > I
> > didn't look at how scary that all would be to make it work again ...
>  The modeset lock may not just be waiting on our requests (even on pnv we
>  can expect that there are already users celebrating that pnv+nouveau
>  finally works ;) and that the display is not the only user/observer of
>  those requests. Using the requests to break the modeset lock just feels
>  like the wrong approach.
> >>> It's a cycle, and we need to break it somewhere. Another option might be
> >>> to break the cycle the same way we do it for gem locks: Wake up everyone
> >>> and restart the modeset ioctl. Since the trouble only happens for
> >>> synchronous modesets where we hold the locks while waiting for fences, we
> >>> can also break out of that and restart. And I also don't think that would
> >>> leak to other drivers, after all our gem locking restart dances also don't
> >>> leak to other drivers - it's just our own driver's lock which are affected
> >>> by these special wakupe semantics.
> >> It's a queue of nonblocking modesets that we need to worry about, afaik.
> >> Moving the wait for blocking modeset outside of modeset lock is easily
> >> achievable (and avoiding the other waits under both the modeset + 
> >> struct_mutex I have at least an idea for). So the challenge is how to
> >> inject all-planes-off for gen3 and then allow the queue to continue again
> >> afterwards.
> > Hm right, I missed the nonblocking updates which don't take locks. But
> > assuming we do the display reset for gpu resets as a full modeset (i.e.
> > going through ->atomic_commit) it should still work out correctly:
> >
> > Starting state: gpu is hung, nonblocking modeset waiting for some requests
> > to complete.
> Missing one evil detail here, else things would have moved forward..
> 
> A unrelated thread performs a blocking commit, and holds all locks until the 
> nonblocking modeset completes.

And where is the problem in that? If we first set all fences to -EIO, and
then try to grab locks, that other thread will be able to complete. After
all this scheme worked before we reworked the reset logic completely.
-Daniel

> > 1. hangcheck kicks in, fires off reset work.
> >
> > 2. We complete all requests with fence.error = -EIO and wake up any
> > waiters. That means no re-queueing for older platforms, but oh well.
> >
> > 3. We grab all the display locks. Nothing 

Re: [Intel-gfx] Broken DPMS with DisplayPort on CHV (also BYT?)

2017-01-30 Thread Sridhara.Venkatanara
Hi,

Installed RPM,

Issue still present with Single Dell E- Series monitor (Display doesn't appear )
Issue not observed with Dual Dell E-Series monitor. 
Sleep issue not observed.

Thanks
Sridhar

-Original Message-
From: Jeffrey Cheung [mailto:jche...@suse.com] 
Sent: Tuesday, January 31, 2017 11:39 AM
To: ti...@suse.de
Cc: Venkatanara, Sridhara ; 
angus.c...@intel.com; ray@intel.com; ville.syrj...@linux.intel.com; 
intel-gfx@lists.freedesktop.org; mma...@suse.cz
Subject: Re: [Intel-gfx] Broken DPMS with DisplayPort on CHV (also BYT?)

Hi Takashi

Thanks a lot. 

---

Hi Sridhara

Can you please try the test kernel ?

Regards

Jeffrey

>>> Takashi Iwai  2017/1/31 下午 13:49 >>>On Tue, 31 Jan 
>>> 2017 03:34:23 +0100,
Jeffrey Cheung wrote:
> 
> Hi Takashi
> 
> How is the test kernel ?  Just wonder when Sridhara team can test again. 

I already informed it in bugzilla and waiting for the test result...
  http://bugzilla.suse.com/show_bug.cgi?id=1019061#c35

It's found in
  http://download.opensuse.org/repositories/home:/tiwai:/bnc1019061-3/standard/


Takashi

> 
> Regards
> 
> Jeffrey
> 
> >>> Takashi Iwai  2017/1/27 下午 18:29 >>>On Thu, 26 Jan 
> >>> 2017 15:19:44 +0100,
> Takashi Iwai wrote:
> > 
> > On Thu, 26 Jan 2017 14:58:55 +0100,
> > Ville Syrjälä wrote:
> > > 
> > > Hmm. Have you tried 9f2bdb006a7e ("drm/i915: Prevent PPS stealing 
> > > from a normal DP port on VLV/CHV") ?
> > 
> > No, it's not tested.  I'll prepare a test kernel with it.
> 
> Sridhara reported that my backport didn't help, unfortunately.
> 
> But it was a backport, so I might have missed something.
> To be sure, I'll try to build a kernel from drm-intel-nightly, and let 
> them test again.
> 
> 
> thanks,
> 
> Takashi
> 

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


Re: [Intel-gfx] [PATCH] drm: Don't race connector registration

2017-01-30 Thread Daniel Vetter
On Mon, Jan 30, 2017 at 08:43:17AM -0800, Dave Hansen wrote:
> On 01/30/2017 01:12 AM, Daniel Vetter wrote:
> > On Thu, Jan 26, 2017 at 12:34:29PM -0800, Dave Hansen wrote:
> ...
> >> And, yeah, I think it just gets the connected status wrong.  The
> >> connector is still there.
> > 
> > Hm, I thought I replied here but I didn't:
> > - Is this just after boot (and then the connector is stuck forever), or
> >   starts to happen after suspend/resume, or some other system change like
> >   that? Or do they just crop up eventually?
> 
> The most consistent thing I do to screw it up is switch systems on my
> DVI KVM switch.  When I switch back to the system in question, it
> doesn't seem to notice the condition.  The connectors eventually show up
> with random combinations of switching to the console (ctrl-alt-f1) and
> back, running xrandr, or running gnome-control-panel and opening the
> Displays applet.

Hm, so is this a dp mst kvm switch (i.e. do the connectors get
hot-added/removed when you plug/unplug that thing)? Or just some other
non-mst switch? I was working under the assumption that this is mst still,
but I've never seen an mst kvm switch.

> I haven't been able to discern any pattern to it.  Sometimes just
> running xrandr fixes it.  Sometimes just opening the control panel.
> Others, I have to do it several times.
> 
> I don't think it shows up if I just leave it for a while.
> 
> > - Does this only happen once the connector is destroyed? Please trace
> >   intel_dp_destroy_mst_connector with something like:
> 
> I'll see if I can gather that.

If it's not mst, then don't bother with this for obvious reasons :-)
-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


[Intel-gfx] ✓ Fi.CI.BAT: success for drm/docs: Fix documentation for drm_atomic_set_mode_for_crtc

2017-01-30 Thread Patchwork
== Series Details ==

Series: drm/docs: Fix documentation for drm_atomic_set_mode_for_crtc
URL   : https://patchwork.freedesktop.org/series/18813/
State : success

== Summary ==

Series 18813v1 drm/docs: Fix documentation for drm_atomic_set_mode_for_crtc
https://patchwork.freedesktop.org/api/1.0/series/18813/revisions/1/mbox/

Test kms_flip:
Subgroup basic-flip-vs-wf_vblank:
dmesg-warn -> PASS   (fi-snb-2520m)
Test kms_force_connector_basic:
Subgroup force-connector-state:
dmesg-warn -> PASS   (fi-snb-2520m)
Test kms_pipe_crc_basic:
Subgroup nonblocking-crc-pipe-a:
dmesg-warn -> PASS   (fi-snb-2520m)

fi-bdw-5557u total:246  pass:232  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050 total:246  pass:207  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205 total:246  pass:224  dwarn:0   dfail:0   fail:0   skip:22 
fi-bxt-t5700 total:78   pass:65   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900 total:246  pass:219  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820 total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770  total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-ivb-3520m total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-ivb-3770  total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u total:246  pass:223  dwarn:0   dfail:0   fail:2   skip:21 
fi-skl-6260u total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hqtotal:246  pass:226  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k total:246  pass:221  dwarn:4   dfail:0   fail:0   skip:21 
fi-skl-6770hqtotal:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2520m total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-snb-2600  total:246  pass:214  dwarn:0   dfail:0   fail:0   skip:32 

123d798c350471aba7e0625c154c6d9e395756c8 drm-tip: 2017y-01m-30d-21h-14m-37s UTC 
integration manifest
0ca768a drm/docs: Fix documentation for drm_atomic_set_mode_for_crtc

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3648/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm/docs: Fix documentation for drm_atomic_set_mode_for_crtc

2017-01-30 Thread Dhinakaran Pandiyan
drm_atomic_set_mode_for_crtc() modifies the .enable member of CRTC state
but documentation claims otherwise, fix that.

Signed-off-by: Dhinakaran Pandiyan 
---
 drivers/gpu/drm/drm_atomic.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 78b54df..25944ab 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -322,9 +322,8 @@ static s32 __user *get_out_fence_for_crtc(struct 
drm_atomic_state *state,
  * @state: the CRTC whose incoming state to update
  * @mode: kernel-internal mode to use for the CRTC, or NULL to disable
  *
- * Set a mode (originating from the kernel) on the desired CRTC state. Does
- * not change any other state properties, including enable, active, or
- * mode_changed.
+ * Set a mode (originating from the kernel) on the desired CRTC state and 
update
+ * the enable property.
  *
  * RETURNS:
  * Zero on success, error code on failure. Cannot return -EDEADLK.
-- 
2.7.4

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


Re: [Intel-gfx] Broken DPMS with DisplayPort on CHV (also BYT?)

2017-01-30 Thread Takashi Iwai
On Tue, 31 Jan 2017 03:34:23 +0100,
Jeffrey Cheung wrote:
> 
> Hi Takashi
> 
> How is the test kernel ?  Just wonder when Sridhara team can test again. 

I already informed it in bugzilla and waiting for the test result...
  http://bugzilla.suse.com/show_bug.cgi?id=1019061#c35

It's found in
  http://download.opensuse.org/repositories/home:/tiwai:/bnc1019061-3/standard/


Takashi

> 
> Regards
> 
> Jeffrey
> 
> >>> Takashi Iwai  2017/1/27 下午 18:29 >>>On Thu, 26 Jan 2017 
> >>> 15:19:44 +0100,
> Takashi Iwai wrote:
> > 
> > On Thu, 26 Jan 2017 14:58:55 +0100,
> > Ville Syrjälä wrote:
> > > 
> > > Hmm. Have you tried 9f2bdb006a7e ("drm/i915: Prevent PPS stealing
> > > from a normal DP port on VLV/CHV") ?
> > 
> > No, it's not tested.  I'll prepare a test kernel with it.
> 
> Sridhara reported that my backport didn't help, unfortunately.
> 
> But it was a backport, so I might have missed something.
> To be sure, I'll try to build a kernel from drm-intel-nightly, and let
> them test again.
> 
> 
> thanks,
> 
> Takashi
> 
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 4.4 17/23] drm/i915: Dont leak edid in intel_crt_detect_ddc()

2017-01-30 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Ander Conselvan de Oliveira 

commit c34f078675f505c4437919bb1897b1351f16a050 upstream.

In the path where intel_crt_detect_ddc() detects a CRT, if would return
true without freeing the edid.

Fixes: a2bd1f541f19 ("drm/i915: check whether we actually received an edid in 
detect_ddc")
Cc: Chris Wilson 
Cc: Daniel Vetter 
Cc: Daniel Vetter 
Cc: Jani Nikula 
Cc: intel-gfx@lists.freedesktop.org
Signed-off-by: Ander Conselvan de Oliveira 

Reviewed-by: Ville Syrjälä 
Reviewed-by: Jani Nikula 
Link: 
http://patchwork.freedesktop.org/patch/msgid/1484922525-6131-1-git-send-email-ander.conselvan.de.olive...@intel.com
(cherry picked from commit c96b63a6a7ac4bd670ec2e663793a9a31418b790)
Signed-off-by: Jani Nikula 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/gpu/drm/i915/intel_crt.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -445,6 +445,7 @@ static bool intel_crt_detect_ddc(struct
struct drm_i915_private *dev_priv = crt->base.base.dev->dev_private;
struct edid *edid;
struct i2c_adapter *i2c;
+   bool ret = false;
 
BUG_ON(crt->base.type != INTEL_OUTPUT_ANALOG);
 
@@ -461,17 +462,17 @@ static bool intel_crt_detect_ddc(struct
 */
if (!is_digital) {
DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n");
-   return true;
+   ret = true;
+   } else {
+   DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [EDID 
reports a digital panel]\n");
}
-
-   DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [EDID reports a 
digital panel]\n");
} else {
DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [no valid EDID 
found]\n");
}
 
kfree(edid);
 
-   return false;
+   return ret;
 }
 
 static enum drm_connector_status


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


[Intel-gfx] [PATCH 4.9 50/66] drm/i915: Dont init hpd polling for vlv and chv from runtime_suspend()

2017-01-30 Thread Greg Kroah-Hartman
4.9-stable review patch.  If anyone has any objections, please let me know.

--

From: Ander Conselvan de Oliveira 

commit 21d6e0bde50713922a6520ef84e5fd245b05d468 upstream.

An error in the condition for avoiding the call to intel_hpd_poll_init()
for valleyview and cherryview from intel_runtime_suspend() caused it to
be called unconditionally. Fix it.

Fixes: 19625e85c6ec ("drm/i915: Enable polling when we don't have hpd")
Cc: Ville Syrjälä 
Cc: Daniel Vetter 
Cc: Lyude 
Cc: Daniel Vetter 
Cc: Jani Nikula 
Cc: intel-gfx@lists.freedesktop.org
Signed-off-by: Ander Conselvan de Oliveira 

Reviewed-by: Ville Syrjälä 
Link: 
http://patchwork.freedesktop.org/patch/msgid/1484922525-6131-2-git-send-email-ander.conselvan.de.olive...@intel.com
(cherry picked from commit 04313b00b79405f86d815100f85c47a2ee5b8ca0)
Signed-off-by: Jani Nikula 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/gpu/drm/i915/i915_drv.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -2372,7 +2372,7 @@ static int intel_runtime_suspend(struct
 
assert_forcewakes_inactive(dev_priv);
 
-   if (!IS_VALLEYVIEW(dev_priv) || !IS_CHERRYVIEW(dev_priv))
+   if (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv))
intel_hpd_poll_init(dev_priv);
 
DRM_DEBUG_KMS("Device suspended\n");


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


[Intel-gfx] [PATCH 4.9 51/66] drm/i915: Fix calculation of rotated x and y offsets for planar formats

2017-01-30 Thread Greg Kroah-Hartman
4.9-stable review patch.  If anyone has any objections, please let me know.

--

From: Ander Conselvan de Oliveira 

commit 3781bd6e7d64d5f5bea9fdee11ab9460a700c0e4 upstream.

Parameters tile_size, tile_width and tile_height were passed in the
wrong order to _intel_adjust_tile_offset() when calculating the rotated
offsets.

This doesn't fix any user visible bug, since for packed formats new
and old offset are the same and the rotated offsets are within a tile
before they are fed to _intel_adjust_tile_offset(). In that case, the
offsets are unchanged. That is not true for planar formats, but those
are currently not supported.

Fixes: 66a2d927cb0e ("drm/i915: Make intel_adjust_tile_offset() work for linear 
buffers")
Cc: Ville Syrjälä 
Cc: Sivakumar Thulasimani 
Cc: Daniel Vetter 
Cc: Jani Nikula 
Cc: intel-gfx@lists.freedesktop.org
Signed-off-by: Ander Conselvan de Oliveira 

Reviewed-by: Ville Syrjälä 
Link: 
http://patchwork.freedesktop.org/patch/msgid/1484922525-6131-3-git-send-email-ander.conselvan.de.olive...@intel.com
(cherry picked from commit 46a1bd289507dfcc428fb9daf65421ed6be6af8b)
Signed-off-by: Jani Nikula 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/gpu/drm/i915/intel_display.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2587,8 +2587,9 @@ intel_fill_fb_info(struct drm_i915_priva
 * We only keep the x/y offsets, so push all of the
 * gtt offset into the x/y offsets.
 */
-   _intel_adjust_tile_offset(, , tile_size,
- tile_width, tile_height, 
pitch_tiles,
+   _intel_adjust_tile_offset(, ,
+ tile_width, tile_height,
+ tile_size, pitch_tiles,
  gtt_offset_rotated * 
tile_size, 0);
 
gtt_offset_rotated += rot_info->plane[i].width * 
rot_info->plane[i].height;


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


[Intel-gfx] [PATCH 4.9 52/66] drm/i915: Check for NULL atomic state in intel_crtc_disable_noatomic()

2017-01-30 Thread Greg Kroah-Hartman
4.9-stable review patch.  If anyone has any objections, please let me know.

--

From: Ander Conselvan de Oliveira 

commit 6d1d427a4e24c403b4adf928d61994bdaa0ca03a upstream.

In intel_crtc_disable_noatomic(), bail on a failure to allocate an
atomic state to avoid a NULL pointer dereference.

Fixes: 4a80655827af ("drm/i915: Pass atomic state to crtc enable/disable 
functions")
Cc: Maarten Lankhorst 
Cc: Daniel Vetter 
Cc: Daniel Vetter 
Cc: Jani Nikula 
Cc: intel-gfx@lists.freedesktop.org
Signed-off-by: Ander Conselvan de Oliveira 

Reviewed-by: Ville Syrjälä 
Link: 
http://patchwork.freedesktop.org/patch/msgid/1484922525-6131-4-git-send-email-ander.conselvan.de.olive...@intel.com
(cherry picked from commit 31bb2ef97ea9db343348f9b5ccaa9bb6f48fc655)
Signed-off-by: Jani Nikula 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/gpu/drm/i915/intel_display.c |6 ++
 1 file changed, 6 insertions(+)

--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6869,6 +6869,12 @@ static void intel_crtc_disable_noatomic(
}
 
state = drm_atomic_state_alloc(crtc->dev);
+   if (!state) {
+   DRM_DEBUG_KMS("failed to disable [CRTC:%d:%s], out of memory",
+ crtc->base.id, crtc->name);
+   return;
+   }
+
state->acquire_ctx = crtc->dev->mode_config.acquire_ctx;
 
/* Everything's already locked, -EDEADLK can't happen. */


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


[Intel-gfx] [PATCH 4.9 49/66] drm/i915: Dont leak edid in intel_crt_detect_ddc()

2017-01-30 Thread Greg Kroah-Hartman
4.9-stable review patch.  If anyone has any objections, please let me know.

--

From: Ander Conselvan de Oliveira 

commit c34f078675f505c4437919bb1897b1351f16a050 upstream.

In the path where intel_crt_detect_ddc() detects a CRT, if would return
true without freeing the edid.

Fixes: a2bd1f541f19 ("drm/i915: check whether we actually received an edid in 
detect_ddc")
Cc: Chris Wilson 
Cc: Daniel Vetter 
Cc: Daniel Vetter 
Cc: Jani Nikula 
Cc: intel-gfx@lists.freedesktop.org
Signed-off-by: Ander Conselvan de Oliveira 

Reviewed-by: Ville Syrjälä 
Reviewed-by: Jani Nikula 
Link: 
http://patchwork.freedesktop.org/patch/msgid/1484922525-6131-1-git-send-email-ander.conselvan.de.olive...@intel.com
(cherry picked from commit c96b63a6a7ac4bd670ec2e663793a9a31418b790)
Signed-off-by: Jani Nikula 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/gpu/drm/i915/intel_crt.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -499,6 +499,7 @@ static bool intel_crt_detect_ddc(struct
struct drm_i915_private *dev_priv = to_i915(crt->base.base.dev);
struct edid *edid;
struct i2c_adapter *i2c;
+   bool ret = false;
 
BUG_ON(crt->base.type != INTEL_OUTPUT_ANALOG);
 
@@ -515,17 +516,17 @@ static bool intel_crt_detect_ddc(struct
 */
if (!is_digital) {
DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n");
-   return true;
+   ret = true;
+   } else {
+   DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [EDID 
reports a digital panel]\n");
}
-
-   DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [EDID reports a 
digital panel]\n");
} else {
DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [no valid EDID 
found]\n");
}
 
kfree(edid);
 
-   return false;
+   return ret;
 }
 
 static enum drm_connector_status


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


[Intel-gfx] [PATCH i-g-t v3 09/11] tests/kms_atomic_transition: add fencing parameter to run_transition_tests

2017-01-30 Thread Robert Foss
From: Gustavo Padovan 

Signed-off-by: Gustavo Padovan 
Signed-off-by: Robert Foss 
---
 tests/kms_atomic_transition.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 095af515..72429759 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -264,7 +264,7 @@ retry:
  */
 static void
 run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t 
*output,
-   enum transition_type type, bool nonblocking)
+   enum transition_type type, bool nonblocking, bool fencing)
 {
struct igt_fb fb, argb_fb, sprite_fb;
drmModeModeInfo *mode, override_mode;
@@ -674,19 +674,19 @@ igt_main
 
igt_subtest("plane-all-transition")
for_each_pipe_with_valid_output(, pipe, output)
-   run_transition_test(, pipe, output, 
TRANSITION_PLANES, false);
+   run_transition_test(, pipe, output, 
TRANSITION_PLANES, false, false);
 
igt_subtest("plane-all-transition-nonblocking")
for_each_pipe_with_valid_output(, pipe, output)
-   run_transition_test(, pipe, output, 
TRANSITION_PLANES, true);
+   run_transition_test(, pipe, output, 
TRANSITION_PLANES, true, false);
 
igt_subtest("plane-all-modeset-transition")
for_each_pipe_with_valid_output(, pipe, output)
-   run_transition_test(, pipe, output, 
TRANSITION_MODESET, false);
+   run_transition_test(, pipe, output, 
TRANSITION_MODESET, false, false);
 
igt_subtest("plane-toggle-modeset-transition")
for_each_pipe_with_valid_output(, pipe, output)
-   run_transition_test(, pipe, output, 
TRANSITION_MODESET_DISABLE, false);
+   run_transition_test(, pipe, output, 
TRANSITION_MODESET_DISABLE, false, false);
 
for (i = 1; i <= I915_MAX_PIPES; i++) {
igt_subtest_f("%ix-modeset-transitions", i)
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 10/11] tests/kms_atomic_transition: add out_fences tests

2017-01-30 Thread Robert Foss
Signed-off-by: Gustavo Padovan 
Signed-off-by: Robert Foss 
---
 lib/igt_kms.c |  35 ++
 tests/kms_atomic_transition.c | 148 ++
 2 files changed, 169 insertions(+), 14 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index f14496dd..523f3f57 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -53,6 +53,7 @@
 #include "intel_chipset.h"
 #include "igt_debugfs.h"
 #include "igt_sysfs.h"
+#include "sw_sync.h"
 
 /**
  * SECTION:igt_kms
@@ -2479,6 +2480,21 @@ static int igt_atomic_commit(igt_display_t *display, 
uint32_t flags, void *user_
}
 
ret = drmModeAtomicCommit(display->drm_fd, req, flags, user_data);
+   if (!ret) {
+
+   for_each_pipe(display, pipe) {
+   igt_pipe_t *pipe_obj = >pipes[pipe];
+
+   if (pipe_obj->out_fence != -1)
+   continue;
+
+   igt_assert(pipe_obj->out_fence >= 0);
+   ret = sync_fence_wait(pipe_obj->out_fence, 1000);
+   igt_assert(ret == 0);
+   close(pipe_obj->out_fence);
+   }
+   }
+
drmModeAtomicFree(req);
return ret;
 
@@ -2972,6 +2988,11 @@ void igt_plane_set_rotation(igt_plane_t *plane, 
igt_rotation_t rotation)
plane->rotation_changed = true;
 }
 
+void igt_pipe_request_out_fence(igt_pipe_t *pipe)
+{
+   pipe->out_fence_requested = true;
+}
+
 void
 igt_pipe_set_degamma_lut(igt_pipe_t *pipe, void *ptr, size_t length)
 {
@@ -2994,20 +3015,6 @@ igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void *ptr, 
size_t length)
 }
 
 /**
- * igt_pipe_set_out_fence_ptr:
- * @pipe: pipe pointer to which background color to be set
- * @fence_ptr: out fence pointer
- *
- * Sets the out fence pointer that will be passed to the kernel in
- * the atomic ioctl. When the kernel returns the out fence pointer
- * will contain the fd number of the out fence created by KMS.
- */
-void igt_pipe_set_out_fence_ptr(igt_pipe_t *pipe, int64_t *fence_ptr)
-{
-   pipe->out_fence_ptr = fence_ptr;
-}
-
-/**
  * igt_crtc_set_background:
  * @pipe: pipe pointer to which background color to be set
  * @background: background color value in BGR 16bpc
diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 72429759..eebb5d66 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -253,6 +253,93 @@ retry:
 sprite_width, sprite_height, alpha);
 }
 
+int *timeline;
+pthread_t *thread;
+int *seqno;
+
+static void prepare_fencing(igt_display_t *display, enum pipe pipe)
+{
+   igt_plane_t *plane;
+   int n_planes;
+
+   igt_require_sw_sync();
+
+   n_planes = display->pipes[pipe].n_planes;
+timeline = calloc(sizeof(*timeline), n_planes);
+igt_assert_f(timeline != NULL, "Failed to allocate memory for 
timelines\n");
+thread = calloc(sizeof(*thread), n_planes);
+igt_assert_f(thread != NULL, "Failed to allocate memory for thread\n");
+seqno = calloc(sizeof(*seqno), n_planes);
+igt_assert_f(seqno != NULL, "Failed to allocate memory for seqno\n");
+
+   for_each_plane_on_pipe(display, pipe, plane)
+   timeline[plane->index] = sw_sync_timeline_create();
+}
+
+static void unprepare_fencing(igt_display_t *display, enum pipe pipe)
+{
+   igt_plane_t *plane;
+
+   for_each_plane_on_pipe(display, pipe, plane)
+   close(timeline[plane->index]);
+
+   free(timeline);
+   free(thread);
+   free(seqno);
+}
+
+static void *fence_inc_thread(void *arg)
+{
+   int t = *((int *) arg);
+
+   pthread_detach(pthread_self());
+
+   usleep(5000);
+   sw_sync_timeline_inc(t, 1);
+   return NULL;
+}
+
+static void configure_fencing(igt_display_t *display, enum pipe pipe)
+{
+   igt_plane_t *plane;
+   int i, fd, ret;
+
+   for_each_plane_on_pipe(display, pipe, plane) {
+
+   if (!plane->fb)
+   continue;
+
+   i = plane->index;
+
+   seqno[i]++;
+   fd = sw_sync_timeline_create_fence(timeline[i], seqno[i]);
+   igt_plane_set_fence_fd(plane, fd);
+   ret = pthread_create([i], NULL, fence_inc_thread, 
[i]);
+   igt_assert_eq(ret, 0);
+   }
+}
+
+static void clear_fencing(igt_display_t *display, enum pipe pipe)
+{
+   igt_plane_t *plane;
+
+   for_each_plane_on_pipe(display, pipe, plane)
+   igt_plane_set_fence_fd(plane, -1);
+}
+
+static void atomic_commit(igt_display_t *display, enum pipe pipe, unsigned int 
flags, void *data, bool fencing)
+{
+   if (fencing) {
+   configure_fencing(display, pipe);
+   igt_pipe_request_out_fence(>pipes[pipe]);
+   }
+
+   igt_display_commit_atomic(display, flags, data);
+
+   if (fencing)
+

[Intel-gfx] [PATCH i-g-t v3 08/11] tests/kms_atomic: stress possible fence settings

2017-01-30 Thread Robert Foss
From: Gustavo Padovan 

Signed-off-by: Gustavo Padovan 
Signed-off-by: Robert Foss 
---
 tests/kms_atomic.c | 187 ++---
 1 file changed, 177 insertions(+), 10 deletions(-)

diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index 8df51ccd..09605e38 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -44,6 +44,7 @@
 #include "drmtest.h"
 #include "igt.h"
 #include "igt_aux.h"
+#include "sw_sync.h"
 
 #ifndef DRM_CLIENT_CAP_ATOMIC
 #define DRM_CLIENT_CAP_ATOMIC 3
@@ -126,6 +127,7 @@ struct kms_atomic_plane_state {
uint32_t fb_id; /* 0 to disable */
uint32_t src_x, src_y, src_w, src_h; /* 16.16 fixed-point */
uint32_t crtc_x, crtc_y, crtc_w, crtc_h; /* normal integers */
+   int32_t fence_fd;
 };
 
 struct kms_atomic_crtc_state {
@@ -133,6 +135,7 @@ struct kms_atomic_crtc_state {
uint32_t obj;
int idx;
bool active;
+   uint64_t out_fence_ptr;
struct kms_atomic_blob mode;
 };
 
@@ -190,11 +193,13 @@ static uint32_t blob_duplicate(int fd, uint32_t id_orig)
crtc_populate_req(crtc, req); \
plane_populate_req(plane, req); \
do_atomic_commit((crtc)->state->desc->fd, req, flags); \
-   crtc_check_current_state(crtc, plane, relax); \
-   plane_check_current_state(plane, relax); \
+   if (!(flags & DRM_MODE_ATOMIC_TEST_ONLY)) { \
+   crtc_check_current_state(crtc, plane, relax); \
+   plane_check_current_state(plane, relax); \
+   } \
 }
 
-#define crtc_commit_atomic_err(crtc, plane, crtc_old, plane_old, req, relax, 
e) { \
+#define crtc_commit_atomic_err(crtc, plane, crtc_old, plane_old, req, flags, 
relax, e) { \
drmModeAtomicSetCursor(req, 0); \
crtc_populate_req(crtc, req); \
plane_populate_req(plane, req); \
@@ -299,6 +304,9 @@ find_connector(struct kms_atomic_state *state,
 static void plane_populate_req(struct kms_atomic_plane_state *plane,
   drmModeAtomicReq *req)
 {
+   if (plane->fence_fd)
+   plane_set_prop(req, plane, IGT_PLANE_IN_FENCE_FD, 
plane->fence_fd);
+
plane_set_prop(req, plane, IGT_PLANE_CRTC_ID, plane->crtc_id);
plane_set_prop(req, plane, IGT_PLANE_FB_ID, plane->fb_id);
plane_set_prop(req, plane, IGT_PLANE_SRC_X, plane->src_x);
@@ -433,6 +441,10 @@ find_plane(struct kms_atomic_state *state, enum plane_type 
type,
 static void crtc_populate_req(struct kms_atomic_crtc_state *crtc,
  drmModeAtomicReq *req)
 {
+   if (crtc->out_fence_ptr)
+   crtc_set_prop(req, crtc, IGT_CRTC_OUT_FENCE_PTR,
+ crtc->out_fence_ptr);
+
crtc_set_prop(req, crtc, IGT_CRTC_MODE_ID, crtc->mode.id);
crtc_set_prop(req, crtc, IGT_CRTC_ACTIVE, crtc->active);
 }
@@ -1061,6 +1073,37 @@ static void plane_invalid_params(struct 
kms_atomic_crtc_state *crtc,
drmModeAtomicFree(req);
 }
 
+static void plane_invalid_params_fence(struct kms_atomic_crtc_state *crtc,
+   struct kms_atomic_plane_state *plane_old,
+   struct kms_atomic_connector_state *conn)
+{
+   struct kms_atomic_plane_state plane = *plane_old;
+   drmModeAtomicReq *req = drmModeAtomicAlloc();
+   int timeline, fence_fd;
+
+   igt_require_sw_sync();
+
+   /* invalid fence fd */
+   plane.fence_fd = plane.state->desc->fd;
+   plane.crtc_id = plane_old->crtc_id;
+   plane_commit_atomic_err(, plane_old, req,
+   ATOMIC_RELAX_NONE, EINVAL);
+
+   /* Valid fence_fd but invalid CRTC */
+   timeline = sw_sync_timeline_create();
+   fence_fd =  sw_sync_timeline_create_fence(timeline, 1);
+   plane.fence_fd = fence_fd;
+   plane.crtc_id = ~0U;
+   plane_commit_atomic_err(, plane_old, req,
+   ATOMIC_RELAX_NONE, EINVAL);
+
+   plane.fence_fd = -1;
+   close(fence_fd);
+   close(timeline);
+
+   drmModeAtomicFree(req);
+}
+
 static void crtc_invalid_params(struct kms_atomic_crtc_state *crtc_old,
struct kms_atomic_plane_state *plane,
struct kms_atomic_connector_state *conn)
@@ -1072,30 +1115,32 @@ static void crtc_invalid_params(struct 
kms_atomic_crtc_state *crtc_old,
 
/* Pass a series of invalid object IDs for the mode ID. */
crtc.mode.id = plane->obj;
-   crtc_commit_atomic_err(, plane, crtc_old, plane, req,
+   crtc_commit_atomic_err(, plane, crtc_old, plane, req, 0,
   ATOMIC_RELAX_NONE, EINVAL);
 
crtc.mode.id = crtc.obj;
-   crtc_commit_atomic_err(, plane, crtc_old, plane, req,
+   crtc_commit_atomic_err(, plane, crtc_old, plane, req, 0,
   ATOMIC_RELAX_NONE, EINVAL);
 

[Intel-gfx] [PATCH i-g-t v3 11/11] tests/kms_atomic_transition: add in_fences tests

2017-01-30 Thread Robert Foss
From: Gustavo Padovan 

Signed-off-by: Gustavo Padovan 
Signed-off-by: Robert Foss 
---
 lib/igt_kms.c |  3 +++
 tests/kms_atomic_transition.c | 48 ++-
 2 files changed, 32 insertions(+), 19 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 523f3f57..bc815363 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -2009,6 +2009,9 @@ igt_atomic_prepare_plane_commit(igt_plane_t *plane, 
igt_pipe_t *pipe,
if (plane->fence_fd >= 0) {
uint64_t fence_fd = (int64_t) plane->fence_fd;
igt_atomic_populate_plane_req(req, plane, 
IGT_PLANE_IN_FENCE_FD, fence_fd);
+
+   /* reset fence_fd to prevent it from being set for the next 
commit */
+   plane->fence_fd = -1;
}
 
if (plane->fb_changed) {
diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index eebb5d66..0876bbb3 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -23,7 +23,9 @@
 
 #include "igt.h"
 #include "drmtest.h"
+#include "sw_sync.h"
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -362,6 +364,9 @@ run_transition_test(igt_display_t *display, enum pipe pipe, 
igt_output_t *output
unsigned flags = DRM_MODE_PAGE_FLIP_EVENT;
int ret;
 
+   if (fencing)
+   prepare_fencing(display, pipe);
+
if (nonblocking)
flags |= DRM_MODE_ATOMIC_NONBLOCK;
 
@@ -404,18 +409,19 @@ run_transition_test(igt_display_t *display, enum pipe 
pipe, igt_output_t *output
wm_setup_plane(display, pipe, iter_max - 1, parms);
 
if (fencing)
-   igt_pipe_set_out_fence_ptr(>pipes[pipe],
-   (int64_t *) _fence);
+   igt_pipe_request_out_fence(>pipes[pipe]);
+
ret = igt_display_try_commit_atomic(display, 
DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
 
-   if (ret != -EINVAL || n_planes < 3)
+   if (ret != -EINVAL || display->pipes[pipe].n_planes < 3)
break;
 
ret = 0;
for_each_plane_on_pipe(display, pipe, plane) {
i = plane->index;
 
-   if (plane->is_primary || plane->is_cursor)
+   if (plane->type == DRM_PLANE_TYPE_PRIMARY ||
+   plane->type == DRM_PLANE_TYPE_CURSOR)
continue;
 
if (parms[i].width <= 512)
@@ -436,10 +442,8 @@ run_transition_test(igt_display_t *display, enum pipe 
pipe, igt_output_t *output
 
wm_setup_plane(display, pipe, i, parms);
 
-   if (fencing)
-   igt_pipe_set_out_fence_ptr(>pipes[pipe], 
_fence);
+   atomic_commit(display, pipe, flags, (void *)(unsigned long)i, 
fencing);
 
-   igt_display_commit_atomic(display, flags, (void *)(unsigned 
long)i);
drmHandleEvent(display->drm_fd, _events);
 
if (type == TRANSITION_MODESET_DISABLE) {
@@ -463,19 +467,14 @@ run_transition_test(igt_display_t *display, enum pipe 
pipe, igt_output_t *output
if (type == TRANSITION_MODESET)
igt_output_override_mode(output, 
_mode);
 
-   if (fencing)
-   
igt_pipe_set_out_fence_ptr(>pipes[pipe], _fence);
-
-   igt_display_commit_atomic(display, flags, (void 
*)(unsigned long)j);
+   atomic_commit(display, pipe, flags, (void 
*)(unsigned long)i, fencing);
drmHandleEvent(display->drm_fd, _events);
 
wm_setup_plane(display, pipe, i, parms);
if (type == TRANSITION_MODESET)
igt_output_override_mode(output, NULL);
 
-   if (fencing)
-   
igt_pipe_set_out_fence_ptr(>pipes[pipe], _fence);
-
+   atomic_commit(display, pipe, flags, (void 
*)(unsigned long)i, fencing);
igt_display_commit_atomic(display, flags, (void 
*)(unsigned long)i);
drmHandleEvent(display->drm_fd, _events);
}
@@ -483,6 +482,8 @@ run_transition_test(igt_display_t *display, enum pipe pipe, 
igt_output_t *output
}
 
 cleanup:
+   unprepare_fencing(display, pipe);
+
igt_output_set_pipe(output, PIPE_NONE);
 
for_each_plane_on_pipe(display, pipe, plane)
@@ -617,7 +618,7 @@ static void collect_crcs_mask(igt_pipe_crc_t **pipe_crcs, 
unsigned mask, igt_crc
}
 }
 
-static void run_modeset_tests(igt_display_t 

[Intel-gfx] [PATCH i-g-t v3 05/11] lib/igt_kms: Added igt_pipe_get_last_out_fence()

2017-01-30 Thread Robert Foss
Added the igt_pipe_get_last_out_fence() helper function
that wraps accesses to pipe->fence_out.

Signed-off-by: Robert Foss 
---
 lib/igt_kms.c | 8 
 lib/igt_kms.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 142658a6..f0e38b75 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1934,6 +1934,14 @@ static igt_output_t *igt_pipe_get_output(igt_pipe_t 
*pipe)
return NULL;
 }
 
+int igt_pipe_get_last_out_fence(igt_pipe_t *pipe)
+{
+   int fd = (int) pipe->out_fence;
+   pipe->out_fence = -1;
+
+   return fd;
+}
+
 bool igt_pipe_get_property(igt_pipe_t *pipe, const char *name,
   uint32_t *prop_id, uint64_t *value,
   drmModePropertyPtr *prop)
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 00e0dc68..94ff27bb 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -382,6 +382,7 @@ igt_plane_t *igt_output_get_plane_type(igt_output_t 
*output, int plane_type);
 igt_output_t *igt_output_from_connector(igt_display_t *display,
 drmModeConnector *connector);
 igt_plane_t *igt_pipe_get_plane_type(igt_pipe_t *pipe, int plane_type);
+int igt_pipe_get_last_out_fence(igt_pipe_t *pipe);
 bool igt_pipe_get_property(igt_pipe_t *pipe, const char *name,
   uint32_t *prop_id, uint64_t *value,
   drmModePropertyPtr *prop);
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 07/11] lib/igt_kms: Add support for the OUT_FENCE_PTR property

2017-01-30 Thread Robert Foss
From: Gustavo Padovan 

Add support for the OUT_FENCE_PTR property to enable setting out fences for
atomic commits.

Signed-off-by: Gustavo Padovan 
Signed-off-by: Robert Foss 
---
 lib/igt_kms.c | 26 +-
 lib/igt_kms.h |  6 +-
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index b79d2867..f14496dd 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -179,7 +179,8 @@ const char *igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
"DEGAMMA_LUT",
"GAMMA_LUT",
"MODE_ID",
-   "ACTIVE"
+   "ACTIVE",
+   "OUT_FENCE_PTR"
 };
 
 const char *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
@@ -2393,6 +2394,15 @@ static void igt_atomic_prepare_crtc_commit(igt_pipe_t 
*pipe_obj, drmModeAtomicRe
igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_ACTIVE, 
!!output);
}
 
+   pipe_obj->out_fence = -1;
+   if (pipe_obj->out_fence_requested)
+   {
+   pipe_obj->out_fence_requested = false;
+   igt_atomic_populate_crtc_req(req, pipe_obj, 
IGT_CRTC_OUT_FENCE_PTR,
+   (uint64_t)(uintptr_t) _obj->out_fence);
+   igt_assert_f(pipe_obj->out_fence != -1, "Unable to get fence, 
received -1 fd\n");
+   }
+
/*
 *  TODO: Add all crtc level properties here
 */
@@ -2984,6 +2994,20 @@ igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void *ptr, 
size_t length)
 }
 
 /**
+ * igt_pipe_set_out_fence_ptr:
+ * @pipe: pipe pointer to which background color to be set
+ * @fence_ptr: out fence pointer
+ *
+ * Sets the out fence pointer that will be passed to the kernel in
+ * the atomic ioctl. When the kernel returns the out fence pointer
+ * will contain the fd number of the out fence created by KMS.
+ */
+void igt_pipe_set_out_fence_ptr(igt_pipe_t *pipe, int64_t *fence_ptr)
+{
+   pipe->out_fence_ptr = fence_ptr;
+}
+
+/**
  * igt_crtc_set_background:
  * @pipe: pipe pointer to which background color to be set
  * @background: background color value in BGR 16bpc
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 85688853..9672dadc 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -94,6 +94,7 @@ enum igt_atomic_crtc_properties {
IGT_CRTC_GAMMA_LUT,
IGT_CRTC_MODE_ID,
IGT_CRTC_ACTIVE,
+   IGT_CRTC_OUT_FENCE_PTR,
IGT_NUM_CRTC_PROPS
 };
 
@@ -341,6 +342,9 @@ struct igt_pipe {
 
uint64_t mode_blob;
bool mode_changed;
+
+   int64_t out_fence;
+   bool out_fence_requested;
 };
 
 typedef struct {
@@ -395,7 +399,7 @@ static inline bool igt_plane_supports_rotation(igt_plane_t 
*plane)
 {
return plane->rotation_property != 0;
 }
-
+void igt_pipe_request_out_fence(igt_pipe_t *pipe);
 void igt_pipe_set_degamma_lut(igt_pipe_t *pipe, void *ptr, size_t length);
 void igt_pipe_set_ctm_matrix(igt_pipe_t *pipe, void *ptr, size_t length);
 void igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void *ptr, size_t length);
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 06/11] lib/igt_kms: Add support for the IN_FENCE_FD property

2017-01-30 Thread Robert Foss
Add support dor the IN_FENCE_FD property to enable setting in fences for atomic
commits.

Signed-off-by: Robert Foss 
---
 lib/igt_kms.c | 20 
 lib/igt_kms.h |  5 +
 2 files changed, 25 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index f0e38b75..b79d2867 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -168,6 +168,7 @@ const char *igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
"CRTC_H",
"FB_ID",
"CRTC_ID",
+   "IN_FENCE_FD",
"type",
"rotation"
 };
@@ -1667,6 +1668,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
plane->type = type;
plane->pipe = pipe;
plane->drm_plane = drm_plane;
+   plane->fence_fd = -1;
 
if (is_atomic == 0) {
display->is_atomic = 1;
@@ -2002,6 +2004,11 @@ igt_atomic_prepare_plane_commit(igt_plane_t *plane, 
igt_pipe_t *pipe,
plane->index,
fb_id);
 
+   if (plane->fence_fd >= 0) {
+   uint64_t fence_fd = (int64_t) plane->fence_fd;
+   igt_atomic_populate_plane_req(req, plane, 
IGT_PLANE_IN_FENCE_FD, fence_fd);
+   }
+
if (plane->fb_changed) {
igt_atomic_populate_plane_req(req, plane, IGT_PLANE_CRTC_ID, 
fb_id ? crtc_id : 0);
igt_atomic_populate_plane_req(req, plane, IGT_PLANE_FB_ID, 
fb_id);
@@ -2823,6 +2830,19 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb 
*fb)
plane->size_changed = true;
 }
 
+/**
+ * igt_plane_set_fence_fd:
+ * @plane: plane
+ * @fence_fd: fence fd, disable fence_fd by setting it to -1
+ *
+ * This function sets a fence fd to enable a commit to wait for some event to
+ * occur before completing.
+ */
+void igt_plane_set_fence_fd(igt_plane_t *plane, uint32_t fence_fd)
+{
+   plane->fence_fd = fence_fd;
+}
+
 void igt_plane_set_position(igt_plane_t *plane, int x, int y)
 {
igt_pipe_t *pipe = plane->pipe;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 94ff27bb..85688853 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -248,6 +248,7 @@ enum igt_atomic_plane_properties {
 
IGT_PLANE_FB_ID,
IGT_PLANE_CRTC_ID,
+   IGT_PLANE_IN_FENCE_FD,
IGT_PLANE_TYPE,
IGT_PLANE_ROTATION,
IGT_NUM_PLANE_PROPS
@@ -306,6 +307,9 @@ typedef struct {
uint32_t src_h;
 
igt_rotation_t rotation;
+
+   /* in fence fd */
+   int32_t fence_fd;
uint32_t atomic_props_plane[IGT_NUM_PLANE_PROPS];
 } igt_plane_t;
 
@@ -397,6 +401,7 @@ void igt_pipe_set_ctm_matrix(igt_pipe_t *pipe, void *ptr, 
size_t length);
 void igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void *ptr, size_t length);
 
 void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb);
+void igt_plane_set_fence_fd(igt_plane_t *plane, uint32_t fence_fd);
 void igt_plane_set_position(igt_plane_t *plane, int x, int y);
 void igt_plane_set_size(igt_plane_t *plane, int w, int h);
 void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation);
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 04/11] tests/kms_atomic: use global atomic properties definitions

2017-01-30 Thread Robert Foss
From: Gustavo Padovan 

Signed-off-by: Gustavo Padovan 
Signed-off-by: Robert Foss 
---
 tests/kms_atomic.c | 123 -
 1 file changed, 37 insertions(+), 86 deletions(-)

diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index e6d71c31..8df51ccd 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -105,55 +105,6 @@ static const char 
*plane_type_prop_names[NUM_PLANE_TYPE_PROPS] = {
"Cursor"
 };
 
-enum plane_properties {
-   PLANE_SRC_X = 0,
-   PLANE_SRC_Y,
-   PLANE_SRC_W,
-   PLANE_SRC_H,
-   PLANE_CRTC_X,
-   PLANE_CRTC_Y,
-   PLANE_CRTC_W,
-   PLANE_CRTC_H,
-   PLANE_FB_ID,
-   PLANE_CRTC_ID,
-   PLANE_TYPE,
-   NUM_PLANE_PROPS
-};
-
-static const char *plane_prop_names[NUM_PLANE_PROPS] = {
-   "SRC_X",
-   "SRC_Y",
-   "SRC_W",
-   "SRC_H",
-   "CRTC_X",
-   "CRTC_Y",
-   "CRTC_W",
-   "CRTC_H",
-   "FB_ID",
-   "CRTC_ID",
-   "type"
-};
-
-enum crtc_properties {
-   CRTC_MODE_ID = 0,
-   CRTC_ACTIVE,
-   NUM_CRTC_PROPS
-};
-
-static const char *crtc_prop_names[NUM_CRTC_PROPS] = {
-   "MODE_ID",
-   "ACTIVE"
-};
-
-enum connector_properties {
-   CONNECTOR_CRTC_ID = 0,
-   NUM_CONNECTOR_PROPS
-};
-
-static const char *connector_prop_names[NUM_CONNECTOR_PROPS] = {
-   "CRTC_ID"
-};
-
 struct kms_atomic_blob {
uint32_t id; /* 0 if not already allocated */
size_t len;
@@ -197,9 +148,9 @@ struct kms_atomic_state {
 
 struct kms_atomic_desc {
int fd;
-   uint32_t props_connector[NUM_CONNECTOR_PROPS];
-   uint32_t props_crtc[NUM_CRTC_PROPS];
-   uint32_t props_plane[NUM_PLANE_PROPS];
+   uint32_t props_connector[IGT_NUM_CONNECTOR_PROPS];
+   uint32_t props_crtc[IGT_NUM_CRTC_PROPS];
+   uint32_t props_plane[IGT_NUM_PLANE_PROPS];
uint64_t props_plane_type[NUM_PLANE_TYPE_PROPS];
 };
 
@@ -280,7 +231,7 @@ connector_get_current_state(struct 
kms_atomic_connector_state *connector)
for (i = 0; i < props->count_props; i++) {
uint32_t *prop_ids = connector->state->desc->props_connector;
 
-   if (props->props[i] == prop_ids[CONNECTOR_CRTC_ID])
+   if (props->props[i] == prop_ids[IGT_CONNECTOR_CRTC_ID])
connector->crtc_id = props->prop_values[i];
}
drmModeFreeObjectProperties(props);
@@ -348,16 +299,16 @@ find_connector(struct kms_atomic_state *state,
 static void plane_populate_req(struct kms_atomic_plane_state *plane,
   drmModeAtomicReq *req)
 {
-   plane_set_prop(req, plane, PLANE_CRTC_ID, plane->crtc_id);
-   plane_set_prop(req, plane, PLANE_FB_ID, plane->fb_id);
-   plane_set_prop(req, plane, PLANE_SRC_X, plane->src_x);
-   plane_set_prop(req, plane, PLANE_SRC_Y, plane->src_y);
-   plane_set_prop(req, plane, PLANE_SRC_W, plane->src_w);
-   plane_set_prop(req, plane, PLANE_SRC_H, plane->src_h);
-   plane_set_prop(req, plane, PLANE_CRTC_X, plane->crtc_x);
-   plane_set_prop(req, plane, PLANE_CRTC_Y, plane->crtc_y);
-   plane_set_prop(req, plane, PLANE_CRTC_W, plane->crtc_w);
-   plane_set_prop(req, plane, PLANE_CRTC_H, plane->crtc_h);
+   plane_set_prop(req, plane, IGT_PLANE_CRTC_ID, plane->crtc_id);
+   plane_set_prop(req, plane, IGT_PLANE_FB_ID, plane->fb_id);
+   plane_set_prop(req, plane, IGT_PLANE_SRC_X, plane->src_x);
+   plane_set_prop(req, plane, IGT_PLANE_SRC_Y, plane->src_y);
+   plane_set_prop(req, plane, IGT_PLANE_SRC_W, plane->src_w);
+   plane_set_prop(req, plane, IGT_PLANE_SRC_H, plane->src_h);
+   plane_set_prop(req, plane, IGT_PLANE_CRTC_X, plane->crtc_x);
+   plane_set_prop(req, plane, IGT_PLANE_CRTC_Y, plane->crtc_y);
+   plane_set_prop(req, plane, IGT_PLANE_CRTC_W, plane->crtc_w);
+   plane_set_prop(req, plane, IGT_PLANE_CRTC_H, plane->crtc_h);
 }
 
 static void plane_get_current_state(struct kms_atomic_plane_state *plane)
@@ -373,27 +324,27 @@ static void plane_get_current_state(struct 
kms_atomic_plane_state *plane)
for (i = 0; i < props->count_props; i++) {
uint32_t *prop_ids = desc->props_plane;
 
-   if (props->props[i] == prop_ids[PLANE_CRTC_ID])
+   if (props->props[i] == prop_ids[IGT_PLANE_CRTC_ID])
plane->crtc_id = props->prop_values[i];
-   else if (props->props[i] == prop_ids[PLANE_FB_ID])
+   else if (props->props[i] == prop_ids[IGT_PLANE_FB_ID])
plane->fb_id = props->prop_values[i];
-   else if (props->props[i] == prop_ids[PLANE_CRTC_X])
+   else if (props->props[i] == prop_ids[IGT_PLANE_CRTC_X])
plane->crtc_x = props->prop_values[i];
-   else if (props->props[i] == 

[Intel-gfx] [PATCH i-g-t v3 03/11] lib/igt_kms: export properties names

2017-01-30 Thread Robert Foss
From: Gustavo Padovan 

Signed-off-by: Gustavo Padovan 
Signed-off-by: Robert Foss 
---
 lib/igt_kms.c |  6 +++---
 lib/igt_kms.h | 23 +++
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 41acce45..142658a6 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -157,7 +157,7 @@ const unsigned char* igt_kms_get_base_edid(void)
 #define EDID_NAME alt_edid
 #include "igt_edid_template.h"
 
-static const char *igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
+const char *igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
"SRC_X",
"SRC_Y",
"SRC_W",
@@ -172,7 +172,7 @@ static const char 
*igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
"rotation"
 };
 
-static const char *igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
+const char *igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
"background_color",
"CTM",
"DEGAMMA_LUT",
@@ -181,7 +181,7 @@ static const char *igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] 
= {
"ACTIVE"
 };
 
-static const char *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
+const char *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
"scaling mode",
"CRTC_ID"
 };
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 25626187..00e0dc68 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -97,12 +97,28 @@ enum igt_atomic_crtc_properties {
IGT_NUM_CRTC_PROPS
 };
 
+/**
+ * igt_crtc_prop_names
+ *
+ * igt_crtc_prop_names contains a list of crtc property names,
+ * as indexed by the igt_atomic_crtc_properties enum.
+ */
+extern const char *igt_crtc_prop_names[];
+
 enum igt_atomic_connector_properties {
IGT_CONNECTOR_SCALING_MODE = 0,
IGT_CONNECTOR_CRTC_ID,
IGT_NUM_CONNECTOR_PROPS
 };
 
+/**
+ * igt_connector_prop_names
+ *
+ * igt_connector_prop_names contains a list of crtc property names,
+ * as indexed by the igt_atomic_connector_properties enum.
+ */
+extern const char *igt_connector_prop_names[];
+
 struct kmstest_connector_config {
drmModeCrtc *crtc;
drmModeConnector *connector;
@@ -237,6 +253,13 @@ enum igt_atomic_plane_properties {
IGT_NUM_PLANE_PROPS
 };
 
+/**
+ * igt_plane_prop_names
+ *
+ * igt_plane_prop_names contains a list of crtc property names,
+ * as indexed by the igt_atomic_plane_properties enum.
+ */
+extern const char *igt_plane_prop_names[];
 
 typedef struct igt_display igt_display_t;
 typedef struct igt_pipe igt_pipe_t;
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 00/11] tests/kms_atomic_transition add fence testing

2017-01-30 Thread Robert Foss
This series adds in/out fence testing to kms_atomic_transition test and makes 
some minor cleanups.

This series is rebased ontop of the dyn_n_planes_v3 series.

This series can be found here:
https://git.collabora.com/cgit/user/robertfoss/intel-gpu-tools.git/log/?h=fences_$VER


Changes since v1:

  lib/igt_kms:
   - Added gtk-doc for exported symbols
   - Changed integer casting to avoid potential issues
   - Changed out_fence_ptr type to int64_t*
   - Fixed igt_plane_set_fence_fd comment

  tests/:
   - Rework timeout change in commit_display()
   - Extract plane_invalid_params_fence() out plane_invalid_params()
   - Extract crtc_invalid_params_fence() out crtc_invalid_params()
   - Prevent add igt_require_sw_sync to subtests using sw_sync


Changes since v2:
  Rebased on upstream/master

  lib/igt_kms:
- Reset plane->fence_fd to -1 during igt_atomic_prepare_plane_commit()
- Rework out_fencs_ptr to be an int64_t named out_fence
- Add igt_pipe_request_out_fence()
  tests/:
- Switch to using igt_pipe_request_out_fence()
- Close out_fence fd
- Change out_fence to int64_t in run_transition_test()
- Added comments noting that two testcases are not invalid
- Added igt_pipe_get_last_out_fence() that wraps pipe->fence_out

Gustavo Padovan (8):
  tests/kms_atomic_transition: use igt timeout instead of blocking
  lib/igt_kms: move igt_kms_get_alt_edid() to the right place
  lib/igt_kms: export properties names
  tests/kms_atomic: use global atomic properties definitions
  lib/igt_kms: Add support for the OUT_FENCE_PTR property
  tests/kms_atomic: stress possible fence settings
  tests/kms_atomic_transition: add fencing parameter to
run_transition_tests
  tests/kms_atomic_transition: add in_fences tests

Robert Foss (3):
  lib/igt_kms: Added igt_pipe_get_last_out_fence()
  lib/igt_kms: Add support for the IN_FENCE_FD property
  tests/kms_atomic_transition: add out_fences tests

 lib/igt_kms.c | 104 +++---
 lib/igt_kms.h |  35 -
 tests/kms_atomic.c| 310 +-
 tests/kms_atomic_transition.c | 184 +++--
 4 files changed, 503 insertions(+), 130 deletions(-)

-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 01/11] tests/kms_atomic_transition: use igt timeout instead of blocking

2017-01-30 Thread Robert Foss
From: Gustavo Padovan 

If the event never arrives we can timeout and end the test.

Signed-off-by: Gustavo Padovan 
Signed-off-by: Robert Foss 
---
 tests/kms_atomic_transition.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 5fdb6175..095af515 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -383,7 +383,9 @@ static void commit_display(igt_display_t *display, unsigned 
event_mask, bool non
struct drm_event_vblank *vblank = (void *)buf;
uint32_t crtc_id, pipe = I915_MAX_PIPES;
 
+   igt_set_timeout(3, "Timed out while reading drm_fd\n");
ret = read(display->drm_fd, buf, sizeof(buf));
+   igt_reset_timeout();
if (ret < 0 && (errno == EINTR || errno == EAGAIN))
continue;
 
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 02/11] lib/igt_kms: move igt_kms_get_alt_edid() to the right place

2017-01-30 Thread Robert Foss
From: Gustavo Padovan 

Signed-off-by: Gustavo Padovan 
Signed-off-by: Robert Foss 
---
 lib/igt_kms.c | 34 +-
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 4ba6316d..41acce45 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -157,23 +157,6 @@ const unsigned char* igt_kms_get_base_edid(void)
 #define EDID_NAME alt_edid
 #include "igt_edid_template.h"
 
-/**
- * igt_kms_get_alt_edid:
- *
- * Get an alternate edid block, which includes the following modes:
- *
- *  - 1400x1050 60Hz
- *  - 1920x1080 60Hz
- *  - 1280x720 60Hz
- *  - 1024x768 60Hz
- *  - 800x600 60Hz
- *  - 640x480 60Hz
- *
- * This can be extended with further features using functions such as
- * #kmstest_edid_add_3d.
- *
- * Returns: an alternate edid block
- */
 static const char *igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
"SRC_X",
"SRC_Y",
@@ -301,6 +284,23 @@ igt_atomic_fill_pipe_props(igt_display_t *display, 
igt_pipe_t *pipe,
drmModeFreeObjectProperties(props);
 }
 
+/**
+ * igt_kms_get_alt_edid:
+ *
+ * Get an alternate edid block, which includes the following modes:
+ *
+ *  - 1400x1050 60Hz
+ *  - 1920x1080 60Hz
+ *  - 1280x720 60Hz
+ *  - 1024x768 60Hz
+ *  - 800x600 60Hz
+ *  - 640x480 60Hz
+ *
+ * This can be extended with further features using functions such as
+ * #kmstest_edid_add_3d.
+ *
+ * Returns: an alternate edid block
+ */
 const unsigned char* igt_kms_get_alt_edid(void)
 {
update_edid_csum(alt_edid);
-- 
2.11.0.453.g787f75f05

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


Re: [Intel-gfx] [PATCH v2 7/9] drm: Connector helper function to release atomic state

2017-01-30 Thread Pandiyan, Dhinakaran
On Wed, 2017-01-25 at 07:18 +0100, Daniel Vetter wrote:
> On Tue, Jan 24, 2017 at 03:49:35PM -0800, Dhinakaran Pandiyan wrote:
> > Having a ->atomic_release callback is useful to release shared resources
> > that get allocated in compute_config().
> > 
> > Suggested-by: Daniel Vetter 
> > Signed-off-by: Dhinakaran Pandiyan 
> > ---
> >  include/drm/drm_modeset_helper_vtables.h | 15 +++
> >  1 file changed, 15 insertions(+)
> > 
> > diff --git a/include/drm/drm_modeset_helper_vtables.h 
> > b/include/drm/drm_modeset_helper_vtables.h
> > index 46f5b34..e41b18a 100644
> > --- a/include/drm/drm_modeset_helper_vtables.h
> > +++ b/include/drm/drm_modeset_helper_vtables.h
> > @@ -831,6 +831,21 @@ struct drm_connector_helper_funcs {
> >  */
> > struct drm_encoder *(*atomic_best_encoder)(struct drm_connector 
> > *connector,
> >struct drm_connector_state 
> > *connector_state);
> > +
> > +   /**
> > +* @atomic_release:
> > +*
> > +* This function is used to release shared resources that were
> > +* previously acquired. For example, resources acquired in
> > +* encoder->compute_config() can be released by calling this function
> 
> @compute_config is the right way to do references within the same struct.

compute_config is not in the same structure, which made me realize I
should not be referring to compute_config() at all, as it is a helper
for struct intel_encoder. 


-DK
> 
> > +* from mode_fixup()
> 
> Same here.
> 
> Patch split up is a bit strange, hence why my review of the design is in
> later patches.
> 
> Thanks, Daniel
> 
> > +*
> > +* NOTE:
> > +*
> > +* This function is called in the check phase of an atomic update.
> > +*/
> > +   void (*atomic_release)(struct drm_connector *connector,
> > +  struct drm_connector_state *connector_state);
> >  };
> >  
> >  /**
> > -- 
> > 2.7.4
> > 
> 

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


[Intel-gfx] ✓ Fi.CI.BAT: success for Tracepoints cleanup and improvements for requests (rev5)

2017-01-30 Thread Patchwork
== Series Details ==

Series: Tracepoints cleanup and improvements for requests (rev5)
URL   : https://patchwork.freedesktop.org/series/18676/
State : success

== Summary ==

Series 18676v5 Tracepoints cleanup and improvements for requests
https://patchwork.freedesktop.org/api/1.0/series/18676/revisions/5/mbox/

Test kms_flip:
Subgroup basic-flip-vs-wf_vblank:
dmesg-warn -> PASS   (fi-snb-2520m)
Test kms_force_connector_basic:
Subgroup force-connector-state:
dmesg-warn -> PASS   (fi-snb-2520m)
Test kms_pipe_crc_basic:
Subgroup nonblocking-crc-pipe-a:
dmesg-warn -> PASS   (fi-snb-2520m)

fi-bdw-5557u total:246  pass:232  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050 total:246  pass:207  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205 total:246  pass:224  dwarn:0   dfail:0   fail:0   skip:22 
fi-bxt-t5700 total:78   pass:65   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900 total:246  pass:219  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820 total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770  total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-ivb-3520m total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-ivb-3770  total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u total:246  pass:223  dwarn:0   dfail:0   fail:2   skip:21 
fi-skl-6260u total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hqtotal:246  pass:226  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k total:246  pass:221  dwarn:4   dfail:0   fail:0   skip:21 
fi-skl-6770hqtotal:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2520m total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-snb-2600  total:246  pass:214  dwarn:0   dfail:0   fail:0   skip:32 

123d798c350471aba7e0625c154c6d9e395756c8 drm-tip: 2017y-01m-30d-21h-14m-37s UTC 
integration manifest
76609c5 drm/i915/tracepoints: Add hw_id to context tracepoints
e6bea66 drm/i915/tracepoints: Add backend level request in and out tracepoints
593c326 drm/i915/tracepoints: Rename i915_gem_request_notify
90db18b drm/i915/tracepoints: Add request submit and execute tracepoints
c8695c6 drm/i915/tracepoints: Remove unused i915_gem_request_complete
cec9de6 drm/i915/tracepoints: Tidy i915_gem_request_wait_begin
cbf06b5 drm/i915/tracepoints: Adjust i915_gem_ring_dispatch
b542e3c drm/i915/tracepoints: Tidy request event class

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3647/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✓ Fi.CI.BAT: success for drm/atomic: Fix double kfree on crtc_state->event

2017-01-30 Thread Patchwork
== Series Details ==

Series: drm/atomic: Fix double kfree on crtc_state->event
URL   : https://patchwork.freedesktop.org/series/18785/
State : success

== Summary ==

Series 18785v1 drm/atomic: Fix double kfree on crtc_state->event
https://patchwork.freedesktop.org/api/1.0/series/18785/revisions/1/mbox/

Test kms_flip:
Subgroup basic-flip-vs-wf_vblank:
dmesg-warn -> PASS   (fi-snb-2520m)
Test kms_force_connector_basic:
Subgroup force-connector-state:
dmesg-warn -> PASS   (fi-snb-2520m)
Test kms_pipe_crc_basic:
Subgroup nonblocking-crc-pipe-a:
dmesg-warn -> PASS   (fi-snb-2520m)

fi-bdw-5557u total:246  pass:232  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050 total:246  pass:207  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205 total:246  pass:224  dwarn:0   dfail:0   fail:0   skip:22 
fi-bxt-t5700 total:78   pass:65   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900 total:246  pass:219  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820 total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770  total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-ivb-3520m total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-ivb-3770  total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u total:246  pass:223  dwarn:0   dfail:0   fail:2   skip:21 
fi-skl-6260u total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hqtotal:246  pass:226  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k total:246  pass:221  dwarn:4   dfail:0   fail:0   skip:21 
fi-skl-6770hqtotal:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2520m total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-snb-2600  total:246  pass:214  dwarn:0   dfail:0   fail:0   skip:32 

123d798c350471aba7e0625c154c6d9e395756c8 drm-tip: 2017y-01m-30d-21h-14m-37s UTC 
integration manifest
d97f94e drm/atomic: Fix double kfree on crtc_state->event

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3646/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [Linux v4.10.0-rc1+] Still call-traces after suspend-resume (pm? i915? cpu/hotplug?)

2017-01-30 Thread Rafael J. Wysocki

On 1/24/2017 2:33 AM, Sedat Dilek wrote:

On Fri, Dec 30, 2016 at 3:02 PM, Rafael J. Wysocki  wrote:

On Fri, Dec 30, 2016 at 12:40 PM, Sedat Dilek  wrote:

Hi,

I have already reported this issue in [1].
One of the issue was solved.
Unfortunately, it looks like there is still a different problem here
(Ubuntu/precise AMD64).

I tried v4.10-rc1 and latest Linus tree up to...

commit 98473f9f3f9bd404873cd1178c8be7d6d619f0d1
"mm/filemap: fix parameters to test_bit()"

Here we go...

[   29.636047] BUG: sleeping function called from invalid context at
drivers/base/power/runtime.c:1032
[   29.636055] in_atomic(): 1, irqs_disabled(): 0, pid: 1500, name: Xorg
[   29.636058] 1 lock held by Xorg/1500:
[   29.636060]  #0:  (>struct_mutex){+.+.+.}, at:
[] i915_mutex_lock_interruptible+0x43/0x140 [i915]
[   29.636107] CPU: 0 PID: 1500 Comm: Xorg Not tainted
4.10.0-rc1-6-iniza-amd64 #1
[   29.636109] Hardware name: SAMSUNG ELECTRONICS CO., LTD.
530U3BI/530U4BI/530U4BH/530U3BI/530U4BI/530U4BH, BIOS 13XK 03/28/2013
[   29.636111] Call Trace:
[   29.636120]  dump_stack+0x85/0xc2
[   29.636124]  ___might_sleep+0x196/0x260
[   29.636127]  __might_sleep+0x53/0xb0
[   29.636131]  __pm_runtime_resume+0x7a/0x90
[   29.636159]  intel_runtime_pm_get+0x25/0x90 [i915]
[   29.636189]  aliasing_gtt_bind_vma+0xaa/0xf0 [i915]
[   29.636220]  i915_vma_bind+0xaf/0x1e0 [i915]
[   29.636248]  i915_gem_execbuffer_relocate_entry+0x513/0x6f0 [i915]
[   29.636272]  i915_gem_execbuffer_relocate_vma.isra.34+0x188/0x250 [i915]
[   29.636275]  ? trace_hardirqs_on+0xd/0x10
[   29.636294]  ? i915_gem_execbuffer_reserve_vma.isra.31+0x152/0x1f0 [i915]
[   29.636316]  ? i915_gem_execbuffer_reserve.isra.32+0x372/0x3a0 [i915]
[   29.636342]  i915_gem_do_execbuffer.isra.38+0xa70/0x1a40 [i915]
[   29.636347]  ? __might_fault+0x4e/0xb0
[   29.636373]  i915_gem_execbuffer2+0xc5/0x260 [i915]
[   29.636376]  ? __might_fault+0x4e/0xb0
[   29.636395]  drm_ioctl+0x206/0x450 [drm]
[   29.636420]  ? i915_gem_execbuffer+0x340/0x340 [i915]
[   29.636425]  ? __fget+0x5/0x200
[   29.636429]  do_vfs_ioctl+0x91/0x6f0
[   29.636431]  ? __fget+0x111/0x200
[   29.636433]  ? __fget+0x5/0x200
[   29.636436]  SyS_ioctl+0x79/0x90
[   29.636441]  entry_SYSCALL_64_fastpath+0x23/0xc6

On suspend/resume I see the same call trace.
[2] points to the "BUG" line.

Well, this appears to be an i915 issue, but not a serious one.

Clearly, a function that may sleep (pm_runtime_get_sync() in
intel_runtime_pm_get()) is called with disabled interrupts.  If I
understand the code correctly, though, it actually is not going to
sleep in this particular case, because pm_runtime_get_sync() has
already been called once for this device in the same code path which
means that this particular instance will return immediately, so this
is a false-positive (most likely).

Let me see if I the might_sleep_if() assertion in
__pm_runtime_resume(() can be moved to a better place.


Hi Rafael,

did you had a chance to look at this?
The problem still remains in Linux v4.10-rc5.


No, I didn't.

As I said, this is not a serious issue.

Thanks,
Rafael

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


[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Drop unused engine parameter from i915_gem_validate_context

2017-01-30 Thread Patchwork
== Series Details ==

Series: drm/i915: Drop unused engine parameter from i915_gem_validate_context
URL   : https://patchwork.freedesktop.org/series/18781/
State : success

== Summary ==

Series 18781v1 drm/i915: Drop unused engine parameter from 
i915_gem_validate_context
https://patchwork.freedesktop.org/api/1.0/series/18781/revisions/1/mbox/

Test kms_flip:
Subgroup basic-flip-vs-wf_vblank:
dmesg-warn -> PASS   (fi-snb-2520m)
Test kms_force_connector_basic:
Subgroup force-connector-state:
dmesg-warn -> PASS   (fi-snb-2520m)
Test kms_pipe_crc_basic:
Subgroup nonblocking-crc-pipe-a:
dmesg-warn -> PASS   (fi-snb-2520m)

fi-bdw-5557u total:246  pass:232  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050 total:246  pass:207  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205 total:246  pass:224  dwarn:0   dfail:0   fail:0   skip:22 
fi-bxt-t5700 total:78   pass:65   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900 total:246  pass:219  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820 total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770  total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-ivb-3520m total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-ivb-3770  total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u total:246  pass:223  dwarn:0   dfail:0   fail:2   skip:21 
fi-skl-6260u total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hqtotal:246  pass:226  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k total:246  pass:221  dwarn:4   dfail:0   fail:0   skip:21 
fi-skl-6770hqtotal:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2520m total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-snb-2600  total:246  pass:214  dwarn:0   dfail:0   fail:0   skip:32 

123d798c350471aba7e0625c154c6d9e395756c8 drm-tip: 2017y-01m-30d-21h-14m-37s UTC 
integration manifest
cea5fc4 drm/i915: Drop unused engine parameter from i915_gem_validate_context

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3645/
___
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 [1/2] drm/i915: Treat stolen memory as DMA addresses (rev4)

2017-01-30 Thread Patchwork
== Series Details ==

Series: series starting with [1/2] drm/i915: Treat stolen memory as DMA 
addresses (rev4)
URL   : https://patchwork.freedesktop.org/series/18697/
State : warning

== Summary ==

Series 18697v4 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/18697/revisions/4/mbox/

Test kms_busy:
Subgroup basic-flip-default-c:
pass   -> DMESG-WARN (fi-bsw-n3050)

fi-bdw-5557u total:246  pass:232  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050 total:246  pass:206  dwarn:1   dfail:0   fail:0   skip:39 
fi-bxt-j4205 total:246  pass:224  dwarn:0   dfail:0   fail:0   skip:22 
fi-bxt-t5700 total:78   pass:65   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900 total:246  pass:219  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820 total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770  total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-ivb-3520m total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-ivb-3770  total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u total:246  pass:223  dwarn:0   dfail:0   fail:2   skip:21 
fi-skl-6260u total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hqtotal:246  pass:226  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k total:246  pass:221  dwarn:4   dfail:0   fail:0   skip:21 
fi-skl-6770hqtotal:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2520m total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-snb-2600  total:246  pass:214  dwarn:0   dfail:0   fail:0   skip:32 

0e127a5125bdf8236d035abdb41567fcb843a934 drm-tip: 2017y-01m-30d-19h-59m-28s UTC 
integration manifest
a2d868b drm/i915: Sanity check the computed size and base of stolen memory
18634f3 drm/i915: Treat stolen memory as DMA addresses

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3644/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: Drop unused engine parameter from i915_gem_validate_context

2017-01-30 Thread Chris Wilson
On Mon, Jan 30, 2017 at 08:42:59PM +, Chris Wilson wrote:
> On Mon, Jan 30, 2017 at 05:08:58PM +, Tvrtko Ursulin wrote:
> > From: Tvrtko Ursulin 
> > 
> > Signed-off-by: Tvrtko Ursulin 

Anyway, regardless of my jibe,
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] drm/i915: Drop unused engine parameter from i915_gem_validate_context

2017-01-30 Thread Chris Wilson
On Mon, Jan 30, 2017 at 05:08:58PM +, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin 
> 
> Signed-off-by: Tvrtko Ursulin 
> ---
>  drivers/gpu/drm/i915/i915_gem_execbuffer.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c 
> b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index b7b0cf7c50d2..ba021e66469f 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -1233,7 +1233,7 @@ validate_exec_list(struct drm_device *dev,
>  
>  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)
> +   const u32 ctx_id)
>  {
>   struct i915_gem_context *ctx;
>  
> @@ -1708,7 +1708,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void 
> *data,
>   if (ret)
>   goto pre_mutex_err;
>  
> - ctx = i915_gem_validate_context(dev, file, engine, ctx_id);
> + ctx = i915_gem_validate_context(dev, file, ctx_id);
>   if (IS_ERR(ctx)) {
>   mutex_unlock(>struct_mutex);

static int eb_select_context(struct i915_execbuffer *eb)
{
struct i915_gem_context *ctx;

ctx = i915_gem_context_lookup(eb->file->driver_priv, eb->args->rsvd1);
if (unlikely(IS_ERR(ctx)))
return PTR_ERR(ctx);

if (unlikely(i915_gem_context_is_banned(ctx))) {
DRM_DEBUG("Context %u tried to submit while banned\n",
  ctx->user_handle);
return -EIO;
}

eb->ctx = i915_gem_context_get(ctx);
eb->vm = ctx->ppgtt ? >ppgtt->base : >i915->ggtt.base;

eb->context_flags = 0;
if (ctx->flags & CONTEXT_NO_ZEROMAP)
eb->context_flags |= __EXEC_OBJECT_NEEDS_BIAS;

return 0;
}

Too soon?
-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 v2 6/8] drm/i915/tracepoints: Rename i915_gem_request_notify

2017-01-30 Thread Chris Wilson
On Mon, Jan 30, 2017 at 06:07:29PM +, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin 
> 
> i915_gem_ring_notify is more appropriate since we do not have
> the request information at this point, but it is simply a
> signal from the engine that some request has been completed.
> 
> v2:
>   * Always trace and log if there were any waiters.
Agreed, I'd sketched that change, well to always emit the tracepoint when
the interrupt fired. Whether it was in vain is icing on the cake - I've
some sketches of keeping the user-interrupt alive until the following rq
to short-circuit some ping-ponging or irq enable state.
-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] drm/i915: use variadic macros and arrays to choose port/pipe based registers

2017-01-30 Thread Jani Nikula
On Fri, 27 Jan 2017, Chris Wilson  wrote:
> On Fri, Jan 27, 2017 at 05:57:06PM +0200, Jani Nikula wrote:
>> This allows the use of more than 3 ports/pipes/whatever without tricks,
>> even if the register offsets are not evenly spaced.
>> 
>> There's the risk of out of bounds access if we're not careful; currently
>> that would "just" lead to the wrong register offset being used. It might
>> be possible to add build bug ons for build time constant indexing.
>> 
>> We already have ports defined up to E, not sure if we might have bugs
>> related to them and the current _PORT3() macro.
>> 
>>text data bss dec hex filename
>> 1239868461994096 1290163  13afb3 drivers/gpu/drm/i915/i915.ko
>> 1238828461994096 1289123  13aba3 drivers/gpu/drm/i915/i915.ko
>> 
>> Cc: Chris Wilson 
>> Cc: Ville Syrjälä 
>> Cc: Tvrtko Ursulin 
>> Signed-off-by: Jani Nikula 
>> ---
>>  drivers/gpu/drm/i915/i915_reg.h | 11 +--
>>  1 file changed, 5 insertions(+), 6 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/i915_reg.h 
>> b/drivers/gpu/drm/i915/i915_reg.h
>> index 672cb102f477..c6435a447300 100644
>> --- a/drivers/gpu/drm/i915/i915_reg.h
>> +++ b/drivers/gpu/drm/i915/i915_reg.h
>> @@ -48,6 +48,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
>>  return !i915_mmio_reg_equal(reg, INVALID_MMIO_REG);
>>  }
>>  
>> +#define _PICK(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])
>
> Very neat. The danger is that for a variable index, the compiler will
> plonk the array on the stack, for each invocation. Though for a constant
> the compiler will see through it and generate the right constant.
>
> https://godbolt.org/g/YCK1od
>
> Given that it looks like the compiler will get smarter, this looks like
> a much less error prone way of writing these.
>
> Reviewed-by: Chris Wilson 

Thanks for the reviews, pushed to drm-intel-next-queued with Daniel's
IRC ack added on top.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v2 7/8] drm/i915/tracepoints: Add backend level request in and out tracepoints

2017-01-30 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

Two new tracepoints placed at the call sites where requests are
actually passed to the GPU enable userspace to track engine
utilisation.

These tracepoints are only enabled when the
DRM_I915_LOW_LEVEL_TRACEPOINTS Kconfig option is enabled.

v2: Fix compilation with !CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS.

Signed-off-by: Tvrtko Ursulin 
---
 drivers/gpu/drm/i915/i915_guc_submission.c |  2 ++
 drivers/gpu/drm/i915/i915_trace.h  | 49 ++
 drivers/gpu/drm/i915/intel_lrc.c   |  4 +++
 3 files changed, 55 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c 
b/drivers/gpu/drm/i915/i915_guc_submission.c
index 8ced9e26f075..beec88a30347 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -518,6 +518,8 @@ static void __i915_guc_submit(struct drm_i915_gem_request 
*rq)
if (i915_vma_is_map_and_fenceable(rq->ring->vma))
POSTING_READ_FW(GUC_STATUS);
 
+   trace_i915_gem_request_in(rq, 0);
+
b_ret = guc_ring_doorbell(client);
 
client->submissions[engine_id] += 1;
diff --git a/drivers/gpu/drm/i915/i915_trace.h 
b/drivers/gpu/drm/i915/i915_trace.h
index 7615cce74e0a..2a272c199137 100644
--- a/drivers/gpu/drm/i915/i915_trace.h
+++ b/drivers/gpu/drm/i915/i915_trace.h
@@ -591,6 +591,45 @@ DEFINE_EVENT(i915_gem_request, i915_gem_request_execute,
 TP_PROTO(struct drm_i915_gem_request *req),
 TP_ARGS(req)
 );
+
+DECLARE_EVENT_CLASS(i915_gem_request_hw,
+   TP_PROTO(struct drm_i915_gem_request *req,
+unsigned int port),
+   TP_ARGS(req, port),
+
+   TP_STRUCT__entry(
+__field(u32, dev)
+__field(u32, ring)
+__field(u32, seqno)
+__field(u32, global_seqno)
+__field(u32, ctx)
+__field(u32, port)
+   ),
+
+   TP_fast_assign(
+  __entry->dev = req->i915->drm.primary->index;
+  __entry->ring = req->engine->id;
+  __entry->ctx = req->ctx->hw_id;
+  __entry->seqno = req->fence.seqno;
+  __entry->global_seqno = req->global_seqno;
+  __entry->port = port;
+ ),
+
+   TP_printk("dev=%u, ring=%u, ctx=%u, seqno=%u, 
global_seqno=%u, port=%u",
+ __entry->dev, __entry->ring, __entry->ctx,
+ __entry->seqno, __entry->global_seqno,
+ __entry->port)
+);
+
+DEFINE_EVENT(i915_gem_request_hw, i915_gem_request_in,
+TP_PROTO(struct drm_i915_gem_request *req, unsigned int port),
+TP_ARGS(req, port)
+);
+
+DEFINE_EVENT(i915_gem_request_hw, i915_gem_request_out,
+TP_PROTO(struct drm_i915_gem_request *req, unsigned int port),
+TP_ARGS(req, port)
+);
 #else
 #if !defined(TRACE_HEADER_MULTI_READ)
 static inline void
@@ -602,6 +641,16 @@ static inline void
 trace_i915_gem_request_execute(struct drm_i915_gem_request *req)
 {
 }
+
+static inline void
+trace_i915_gem_request_in(struct drm_i915_gem_request *req, unsigned int port)
+{
+}
+
+static inline void
+trace_i915_gem_request_out(struct drm_i915_gem_request *req, unsigned int port)
+{
+}
 #endif
 #endif
 
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 0e99d53d5523..8aae8a375edc 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -475,6 +475,7 @@ static void execlists_dequeue(struct intel_engine_cs 
*engine)
cursor->priotree.priority = INT_MAX;
 
__i915_gem_request_submit(cursor);
+   trace_i915_gem_request_in(cursor, port - engine->execlist_port);
last = cursor;
submit = true;
}
@@ -531,6 +532,7 @@ static void intel_lrc_irq_handler(unsigned long data)
struct intel_engine_cs *engine = (struct intel_engine_cs *)data;
struct execlist_port *port = engine->execlist_port;
struct drm_i915_private *dev_priv = engine->i915;
+   unsigned int portidx = 0;
 
intel_uncore_forcewake_get(dev_priv, engine->fw_domains);
 
@@ -567,6 +569,8 @@ static void intel_lrc_irq_handler(unsigned long data)
execlists_context_status_change(port[0].request,

INTEL_CONTEXT_SCHEDULE_OUT);
 
+   trace_i915_gem_request_out(port[0].request,
+

[Intel-gfx] [PATCH v2 6/8] drm/i915/tracepoints: Rename i915_gem_request_notify

2017-01-30 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

i915_gem_ring_notify is more appropriate since we do not have
the request information at this point, but it is simply a
signal from the engine that some request has been completed.

v2:
  * Always trace and log if there were any waiters.
  * Rename to intel_engine_notify. (Chris Wilson)

Signed-off-by: Tvrtko Ursulin 
---
 drivers/gpu/drm/i915/i915_irq.c   |  6 --
 drivers/gpu/drm/i915/i915_trace.h | 13 -
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 0ff75f2282fa..30e6c2475ced 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1033,9 +1033,11 @@ static void ironlake_rps_change_irq_handler(struct 
drm_i915_private *dev_priv)
 
 static void notify_ring(struct intel_engine_cs *engine)
 {
+   bool waiters;
+
set_bit(ENGINE_IRQ_BREADCRUMB, >irq_posted);
-   if (intel_engine_wakeup(engine))
-   trace_i915_gem_request_notify(engine);
+   waiters = intel_engine_wakeup(engine);
+   trace_intel_engine_notify(engine, waiters);
 }
 
 static void vlv_c0_read(struct drm_i915_private *dev_priv,
diff --git a/drivers/gpu/drm/i915/i915_trace.h 
b/drivers/gpu/drm/i915/i915_trace.h
index ab81f1ef8350..7615cce74e0a 100644
--- a/drivers/gpu/drm/i915/i915_trace.h
+++ b/drivers/gpu/drm/i915/i915_trace.h
@@ -605,24 +605,27 @@ trace_i915_gem_request_execute(struct 
drm_i915_gem_request *req)
 #endif
 #endif
 
-TRACE_EVENT(i915_gem_request_notify,
-   TP_PROTO(struct intel_engine_cs *engine),
-   TP_ARGS(engine),
+TRACE_EVENT(intel_engine_notify,
+   TP_PROTO(struct intel_engine_cs *engine, bool waiters),
+   TP_ARGS(engine, waiters),
 
TP_STRUCT__entry(
 __field(u32, dev)
 __field(u32, ring)
 __field(u32, seqno)
+__field(bool, waiters)
 ),
 
TP_fast_assign(
   __entry->dev = engine->i915->drm.primary->index;
   __entry->ring = engine->id;
   __entry->seqno = intel_engine_get_seqno(engine);
+  __entry->waiters = waiters;
   ),
 
-   TP_printk("dev=%u, ring=%u, seqno=%u",
- __entry->dev, __entry->ring, __entry->seqno)
+   TP_printk("dev=%u, ring=%u, seqno=%u, waiters=%u",
+ __entry->dev, __entry->ring, __entry->seqno,
+ __entry->waiters)
 );
 
 DEFINE_EVENT(i915_gem_request, i915_gem_request_retire,
-- 
2.7.4

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


[Intel-gfx] [PATCH v2 3/8] drm/i915/tracepoints: Tidy i915_gem_request_wait_begin

2017-01-30 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

Provide the same information as the other request event classes.

v2: Pass in flags so we can properly report the blocking status.
(Chris Wilson)

Signed-off-by: Tvrtko Ursulin 
---
 drivers/gpu/drm/i915/i915_gem_request.c |  2 +-
 drivers/gpu/drm/i915/i915_trace.h   | 21 +
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_request.c 
b/drivers/gpu/drm/i915/i915_gem_request.c
index 72b7f7d9461d..823bc2a5bb7f 100644
--- a/drivers/gpu/drm/i915/i915_gem_request.c
+++ b/drivers/gpu/drm/i915/i915_gem_request.c
@@ -1077,7 +1077,7 @@ long i915_wait_request(struct drm_i915_gem_request *req,
if (!timeout)
return -ETIME;
 
-   trace_i915_gem_request_wait_begin(req);
+   trace_i915_gem_request_wait_begin(req, flags);
 
if (!i915_sw_fence_done(>execute)) {
timeout = __i915_request_wait_for_execute(req, flags, timeout);
diff --git a/drivers/gpu/drm/i915/i915_trace.h 
b/drivers/gpu/drm/i915/i915_trace.h
index 95574229eea0..0523732c1307 100644
--- a/drivers/gpu/drm/i915/i915_trace.h
+++ b/drivers/gpu/drm/i915/i915_trace.h
@@ -612,13 +612,16 @@ DEFINE_EVENT(i915_gem_request, i915_gem_request_complete,
 );
 
 TRACE_EVENT(i915_gem_request_wait_begin,
-   TP_PROTO(struct drm_i915_gem_request *req),
-   TP_ARGS(req),
+   TP_PROTO(struct drm_i915_gem_request *req, unsigned int flags),
+   TP_ARGS(req, flags),
 
TP_STRUCT__entry(
 __field(u32, dev)
 __field(u32, ring)
+__field(u32, ctx)
 __field(u32, seqno)
+__field(u32, global)
+__field(unsigned int, flags)
 __field(bool, blocking)
 ),
 
@@ -631,14 +634,16 @@ TRACE_EVENT(i915_gem_request_wait_begin,
TP_fast_assign(
   __entry->dev = req->i915->drm.primary->index;
   __entry->ring = req->engine->id;
-  __entry->seqno = req->global_seqno;
-  __entry->blocking =
-
mutex_is_locked(>i915->drm.struct_mutex);
+  __entry->ctx = req->ctx->hw_id;
+  __entry->seqno = req->fence.seqno;
+  __entry->global = req->global_seqno;
+  __entry->flags = flags;
+  __entry->blocking = flags & I915_WAIT_LOCKED;
   ),
 
-   TP_printk("dev=%u, ring=%u, seqno=%u, blocking=%s",
- __entry->dev, __entry->ring,
- __entry->seqno, __entry->blocking ?  "yes (NB)" : "no")
+   TP_printk("dev=%u, ring=%u, ctx=%u, seqno=%u, global=%u, 
blocking=%u, flags=%x",
+ __entry->dev, __entry->ring, __entry->ctx, __entry->seqno,
+ __entry->global, __entry->blocking, __entry->flags)
 );
 
 DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end,
-- 
2.7.4

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


[Intel-gfx] [PATCH v2 2/8] drm/i915/tracepoints: Adjust i915_gem_ring_dispatch

2017-01-30 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

Rename it to i915_gem_request_queue and fix the logged info
equivalent to the i915_gem_request even class. Also moved it
a bit further apart from the i915_gem_request_add tracepoint
since they otherwise provide similar information too close in
time.

v2: Remove sw fence singalling. We will rely on the soon to
come GuC scheduling backend to enable that. (Chris Wilson)

Signed-off-by: Tvrtko Ursulin 
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |  4 ++--
 drivers/gpu/drm/i915/i915_trace.h  | 12 +++-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c 
b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 91c2393199a3..53c9dbab0cdd 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1496,8 +1496,6 @@ execbuf_submit(struct i915_execbuffer_params *params,
if (ret)
return ret;
 
-   trace_i915_gem_ring_dispatch(params->request, params->dispatch_flags);
-
i915_gem_execbuffer_move_to_active(vmas, params->request);
 
return 0;
@@ -1842,6 +1840,8 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
params->dispatch_flags  = dispatch_flags;
params->ctx = ctx;
 
+   trace_i915_gem_request_queue(params->request, dispatch_flags);
+
ret = execbuf_submit(params, args, >vmas);
 err_request:
__i915_add_request(params->request, ret == 0);
diff --git a/drivers/gpu/drm/i915/i915_trace.h 
b/drivers/gpu/drm/i915/i915_trace.h
index d890e4b03902..95574229eea0 100644
--- a/drivers/gpu/drm/i915/i915_trace.h
+++ b/drivers/gpu/drm/i915/i915_trace.h
@@ -503,13 +503,14 @@ TRACE_EVENT(i915_gem_ring_sync_to,
  __entry->seqno)
 );
 
-TRACE_EVENT(i915_gem_ring_dispatch,
+TRACE_EVENT(i915_gem_request_queue,
TP_PROTO(struct drm_i915_gem_request *req, u32 flags),
TP_ARGS(req, flags),
 
TP_STRUCT__entry(
 __field(u32, dev)
 __field(u32, ring)
+__field(u32, ctx)
 __field(u32, seqno)
 __field(u32, flags)
 ),
@@ -517,13 +518,14 @@ TRACE_EVENT(i915_gem_ring_dispatch,
TP_fast_assign(
   __entry->dev = req->i915->drm.primary->index;
   __entry->ring = req->engine->id;
-  __entry->seqno = req->global_seqno;
+  __entry->ctx = req->ctx->hw_id;
+  __entry->seqno = req->fence.seqno;
   __entry->flags = flags;
-  dma_fence_enable_sw_signaling(>fence);
   ),
 
-   TP_printk("dev=%u, ring=%u, seqno=%u, flags=%x",
- __entry->dev, __entry->ring, __entry->seqno, 
__entry->flags)
+   TP_printk("dev=%u, ring=%u, ctx=%u, seqno=%u, flags=%x",
+ __entry->dev, __entry->ring, __entry->ctx, __entry->seqno,
+ __entry->flags)
 );
 
 TRACE_EVENT(i915_gem_ring_flush,
-- 
2.7.4

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


[Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [v2,1/3] drm/i915: Make intel_detect_preproduction_hw easier to extend

2017-01-30 Thread Patchwork
== Series Details ==

Series: series starting with [v2,1/3] drm/i915: Make 
intel_detect_preproduction_hw easier to extend
URL   : https://patchwork.freedesktop.org/series/18758/
State : success

== Summary ==

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


fi-bdw-5557u total:246  pass:232  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050 total:246  pass:207  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205 total:246  pass:224  dwarn:0   dfail:0   fail:0   skip:22 
fi-bxt-t5700 total:78   pass:65   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900 total:246  pass:219  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820 total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770  total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-ivb-3520m total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-ivb-3770  total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6260u total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hqtotal:246  pass:226  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k total:246  pass:221  dwarn:4   dfail:0   fail:0   skip:21 
fi-skl-6770hqtotal:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2520m total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-snb-2600  total:246  pass:214  dwarn:0   dfail:0   fail:0   skip:32 

e1cc28133f0474a85da1fc4017686c701b564312 drm-tip: 2017y-01m-30d-15h-50m-59s UTC 
integration manifest
9d64070 drm/i915: Add early BXT sdv to the list of preproduction machines
a8e683a drm/i915: Mark the kernel as tainted if we fail the preproduction check
e84a3d0 drm/i915: Make intel_detect_preproduction_hw easier to extend

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3641/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm/atomic: Fix double kfree on crtc_state->event

2017-01-30 Thread Daniel Vetter
This is a bug Maarten reported, with the following slab debug backtrace:

[IGT] kms_rotation_crc: starting subtest primary-rotation-180
=
BUG kmalloc-128 (Tainted: G U ): Object already free
-

Disabling lock debugging due to kernel taint
INFO: Allocated in drm_atomic_helper_setup_commit+0x285/0x2f0 [drm_kms_helper] 
age=0 cpu=3 pid=1529
 ___slab_alloc+0x308/0x3b0
 __slab_alloc+0xd/0x20
 kmem_cache_alloc_trace+0x92/0x1c0
 drm_atomic_helper_setup_commit+0x285/0x2f0 [drm_kms_helper]
 intel_atomic_commit+0x35/0x4f0 [i915]
 drm_atomic_commit+0x46/0x50 [drm]
 drm_mode_atomic_ioctl+0x7d4/0xab0 [drm]
 drm_ioctl+0x2b3/0x490 [drm]
 do_vfs_ioctl+0x69c/0x700
 SyS_ioctl+0x4e/0x80
 entry_SYSCALL_64_fastpath+0x13/0x94
INFO: Freed in drm_event_cancel_free+0xa3/0xb0 [drm] age=0 cpu=3 pid=1529
 __slab_free+0x48/0x2e0
 kfree+0x159/0x1a0
 drm_event_cancel_free+0xa3/0xb0 [drm]
 drm_mode_atomic_ioctl+0x86d/0xab0 [drm]
 drm_ioctl+0x2b3/0x490 [drm]
 do_vfs_ioctl+0x69c/0x700
 SyS_ioctl+0x4e/0x80
 entry_SYSCALL_64_fastpath+0x13/0x94
INFO: Slab 0xde1f0997b080 objects=17 used=2 fp=0x92fb65ec2578 
flags=0x2008101
INFO: Object 0x92fb65ec2578 @offset=1400 fp=0x92fb65ec2ae8

Redzone 92fb65ec2570: bb bb bb bb bb bb bb bb  

Object 92fb65ec2578: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  

Object 92fb65ec2588: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  

Object 92fb65ec2598: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  

Object 92fb65ec25a8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  

Object 92fb65ec25b8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  

Object 92fb65ec25c8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  

Object 92fb65ec25d8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  

Object 92fb65ec25e8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5  
kkk.
Redzone 92fb65ec25f8: bb bb bb bb bb bb bb bb  

Padding 92fb65ec2738: 5a 5a 5a 5a 5a 5a 5a 5a  

CPU: 3 PID: 180 Comm: kworker/3:2 Tainted: GBU  4.10.0-rc6-patser+ 
#5039
Hardware name:  /NUC5PPYB, BIOS 
PYBSWCEL.86A.0031.2015.0601.1712 06/01/2015
Workqueue: events intel_atomic_helper_free_state [i915]
Call Trace:
 dump_stack+0x4d/0x6d
 print_trailer+0x20c/0x220
 free_debug_processing+0x1c6/0x330
 ? drm_atomic_state_default_clear+0xf7/0x1c0 [drm]
 __slab_free+0x48/0x2e0
 ? drm_atomic_state_default_clear+0xf7/0x1c0 [drm]
 kfree+0x159/0x1a0
 drm_atomic_state_default_clear+0xf7/0x1c0 [drm]
 ? drm_atomic_state_clear+0x30/0x30 [drm]
 intel_atomic_state_clear+0xd/0x20 [i915]
 drm_atomic_state_clear+0x1a/0x30 [drm]
 __drm_atomic_state_free+0x13/0x60 [drm]
 intel_atomic_helper_free_state+0x5d/0x70 [i915]
 process_one_work+0x260/0x4a0
 worker_thread+0x2d1/0x4f0
 kthread+0x127/0x130
 ? process_one_work+0x4a0/0x4a0
 ? kthread_stop+0x120/0x120
 ret_from_fork+0x29/0x40
FIX kmalloc-128: Object at 0x92fb65ec2578 not freed

Reported-by: Maarten Lankhorst 
Cc: Maarten Lankhorst 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_atomic.c | 24 
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 026be94a7d15..366b4bf88206 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -159,15 +159,29 @@ void drm_atomic_state_default_clear(struct 
drm_atomic_state *state)
if (!crtc)
continue;
 
-   crtc->funcs->atomic_destroy_state(crtc,
- state->crtcs[i].state);
-
if (state->crtcs[i].commit) {
-   kfree(state->crtcs[i].commit->event);
+   /*
+* We need to make sure we don't double-free, which we
+* do by checking for state->event, implicitly since
+* kfree can handle a NULL state->event. We also need to
+* make sure we only kfree the event if it's one created
+* for internal commit tracking (and hence won't be
+* cleared by the caller, like the atomic IOCTL or a
+* legacy pageflip. This is done by checking
+* commit->event.
+*
+* This only works if everyone else sets state->event to
+* NULL when they take it away.
+*/
+   

[Intel-gfx] ✗ Fi.CI.BAT: warning for drm/i915: Record more information about the hanging contexts (rev2)

2017-01-30 Thread Patchwork
== Series Details ==

Series: drm/i915: Record more information about the hanging contexts (rev2)
URL   : https://patchwork.freedesktop.org/series/18662/
State : warning

== Summary ==

Series 18662v2 drm/i915: Record more information about the hanging contexts
https://patchwork.freedesktop.org/api/1.0/series/18662/revisions/2/mbox/

Test kms_force_connector_basic:
Subgroup force-connector-state:
pass   -> DMESG-WARN (fi-snb-2520m)

fi-bdw-5557u total:246  pass:232  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050 total:246  pass:207  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205 total:246  pass:224  dwarn:0   dfail:0   fail:0   skip:22 
fi-bxt-t5700 total:78   pass:65   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900 total:246  pass:219  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820 total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770  total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-ivb-3520m total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-ivb-3770  total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u total:246  pass:223  dwarn:0   dfail:0   fail:2   skip:21 
fi-skl-6260u total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hqtotal:246  pass:226  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k total:246  pass:221  dwarn:4   dfail:0   fail:0   skip:21 
fi-skl-6770hqtotal:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2520m total:246  pass:214  dwarn:1   dfail:0   fail:0   skip:31 
fi-snb-2600  total:246  pass:214  dwarn:0   dfail:0   fail:0   skip:32 

e1cc28133f0474a85da1fc4017686c701b564312 drm-tip: 2017y-01m-30d-15h-50m-59s UTC 
integration manifest
1e19d96 drm/i915: Record more information about the hanging contexts

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3640/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm/i915: Drop unused engine parameter from i915_gem_validate_context

2017-01-30 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

Signed-off-by: Tvrtko Ursulin 
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c 
b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index b7b0cf7c50d2..ba021e66469f 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1233,7 +1233,7 @@ validate_exec_list(struct drm_device *dev,
 
 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)
+ const u32 ctx_id)
 {
struct i915_gem_context *ctx;
 
@@ -1708,7 +1708,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
if (ret)
goto pre_mutex_err;
 
-   ctx = i915_gem_validate_context(dev, file, engine, ctx_id);
+   ctx = i915_gem_validate_context(dev, file, ctx_id);
if (IS_ERR(ctx)) {
mutex_unlock(>struct_mutex);
ret = PTR_ERR(ctx);
-- 
2.7.4

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


Re: [Intel-gfx] [PATCH] drm: Don't race connector registration

2017-01-30 Thread Dave Hansen
On 01/30/2017 01:12 AM, Daniel Vetter wrote:
> On Thu, Jan 26, 2017 at 12:34:29PM -0800, Dave Hansen wrote:
...
>> And, yeah, I think it just gets the connected status wrong.  The
>> connector is still there.
> 
> Hm, I thought I replied here but I didn't:
> - Is this just after boot (and then the connector is stuck forever), or
>   starts to happen after suspend/resume, or some other system change like
>   that? Or do they just crop up eventually?

The most consistent thing I do to screw it up is switch systems on my
DVI KVM switch.  When I switch back to the system in question, it
doesn't seem to notice the condition.  The connectors eventually show up
with random combinations of switching to the console (ctrl-alt-f1) and
back, running xrandr, or running gnome-control-panel and opening the
Displays applet.

I haven't been able to discern any pattern to it.  Sometimes just
running xrandr fixes it.  Sometimes just opening the control panel.
Others, I have to do it several times.

I don't think it shows up if I just leave it for a while.

> - Does this only happen once the connector is destroyed? Please trace
>   intel_dp_destroy_mst_connector with something like:

I'll see if I can gather that.
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2 13/13] drm/i915: Acquire P-Unit access when modifying P-Unit settings

2017-01-30 Thread Hans de Goede

Hi,

On 30-01-17 16:38, Ville Syrjälä wrote:

On Mon, Jan 30, 2017 at 04:27:58PM +0100, Hans de Goede wrote:

Hi,

On 30-01-17 16:11, Ville Syrjälä wrote:

On Mon, Jan 30, 2017 at 04:02:19PM +0100, Hans de Goede wrote:

Hi,

On 30-01-17 14:10, Ville Syrjälä wrote:

On Sat, Jan 28, 2017 at 06:18:45PM +0100, Hans de Goede wrote:

Hi,

On 01/28/2017 05:25 PM, Hans de Goede wrote:

Hi,

On 01/27/2017 02:51 PM, Ville Syrjälä wrote:

On Mon, Jan 23, 2017 at 10:09:58PM +0100, Hans de Goede wrote:

Make sure the P-Unit or the PMIC i2c bus is not in use when we send a
request to the P-Unit by calling iosf_mbi_punit_acquire() / _release()
around P-Unit write accesses.


Can't we just stuff the calls into the actual punit write function
rather than sprinkling them all over the place?


punit access is acquired across sections like this:

iosf_mbi_punit_acquire();

val = vlv_punit_read(dev_priv, PUNIT_REG_DSPFREQ);
val &= ~DSPFREQGUAR_MASK;
val |= (cmd << DSPFREQGUAR_SHIFT);
vlv_punit_write(dev_priv, PUNIT_REG_DSPFREQ, val);
if (wait_for((vlv_punit_read(dev_priv, PUNIT_REG_DSPFREQ) &
  DSPFREQSTAT_MASK) == (cmd << DSPFREQSTAT_SHIFT),
 50)) {
DRM_ERROR("timed out waiting for CDclk change\n");
}
iosf_mbi_punit_release();

Where we want to wait for the requested change to have taken
effect before releasing the punit.


Hmm. That's somewhat unfortunate. It also highlights a problem with the
patch wrt. RPS. We don't wait for the GPU to actually change frequencies
in set_rps() because that would slow things down too much. So I have to
wonder how much luck is needed to make this workaround really effective.


So the history of this patch-set is that I wrote this patch before
writing the patch to get FORCEWAKE_ALL before the pmic bus becomes
active (patch 12/13). Since a lot of testing was done with this
patch included in the patch-set and since it seemed a good idea
regardless (given my experience with accessing the punit vs
pmic bus accesses) I decided to leave it in.

Possibly just the patch to get FORCEWAKE_ALL is enough, that one
actually fixed things for me. That is also why I made this the
last patch in the set. I asked tagorereddy to test his system
without this patch, but he did not get around to that.

After all we do tell the punit to not touch the bus by acquiring
the pmic bus semaphore from i2c-desigware-baytrail.c, so maybe
for RPS freq changes it honors that and properly waits. Maybe it
honors that for all punit requests i915 does and the only real
problem is the forcewake stuff ?

I can try to drop this patch from my queue and run without it
for a while and see if things don't regress. And also ask
tagorereddy again to test his system that way.

Does that (dropping this patch for now) sound like a good idea?


More test results couldn't hurt at least. It also makes me wonder if
just bumping the timeouts to some ridiculously high value would fix
the problem as well.


I've already tried bumping the forcewake timeout from 50 to 250ms,
before writing the patch to just get forcewake_all before the pmic
bus access begins, that does not fix things,


And you bumped the i2c mutex timeout as well? Or does that fail somehow
gracefully if it can't get the mutex?


It will fail the i2c transfer with -ETIMEOUT, which will make the driver
report an error instead of e.g. the battery level, but it should not
affect the forcewake calls and those still failed with the large
timeout. So yes basically the i2c mutex fails gracefully.




and since we busy wait
for this timeout from non-sleeping context 250ms already is way too
high.


Sure, but I'm just trying to understand if the problem is simply caused
by proceeding with some hardware access without getting the i2c mutex.


Understood.


+ a comment would be nice why it's there.


I will add comments to the acquire calls.


Do we need a kconfig select/depends on the iosf_mbi thing? Or some
ifdefs?


No, the iosf_mbi header defines empty inline versions of
iosf_mbi_punit_acquire / _release if IOSF_MBI is disabled,
this does mean that iosf_mbi must be builtin if the i915
driver is. I'll add:

depends on DRM_I915=IOSF_MBI || IOSF_MBI=y

To the i915 Kconfig to enforce this.


Hmm, ok so that does not work (long cyclic dependency through the
selection of ACPI_VIDEO).

So I've now added this instead:

# iosf_mbi needs to be builtin if we are builtin
select IOSF_MBI if DRM_I915=y


That's probably not going to help anyone since i915 is usually a module.


Right, that is fine, then either the IOSF_MBI symbols are available,
or IOSF_MBI is disabled and we get the inline nops from the header.

The problem scenario is DRM_I915=y and IOSF_MBI=m, which is not very
realistic IMHO, but will get triggered by the random-config testing
several contributors do and lead to an unresolved symbol error there.


Well, from the user POV anything with IOSF_MBI==n 

Re: [Intel-gfx] [PATCH v2 5/5] drm/i915/glk: Enable pipe CSC

2017-01-30 Thread Ville Syrjälä
On Thu, Jan 26, 2017 at 01:24:25PM +0200, Ander Conselvan de Oliveira wrote:
> Now that the pre-csc degamma table is set up correctly in Geminilake,
> pipe CSC can be enabled without causing a black screen.
> 
> v2: Rebase.
> Signed-off-by: Ander Conselvan de Oliveira 
> 

Reviewed-by: Ville Syrjälä 

> ---
>  drivers/gpu/drm/i915/intel_display.c | 1 +
>  drivers/gpu/drm/i915/intel_sprite.c  | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c 
> b/drivers/gpu/drm/i915/intel_display.c
> index 13d05bc..3eee44a 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -3391,6 +3391,7 @@ static void skylake_update_primary_plane(struct 
> drm_plane *plane,
>   if (IS_GEMINILAKE(dev_priv)) {
>   I915_WRITE(PLANE_COLOR_CTL(pipe, plane_id),
>  PLANE_COLOR_PIPE_GAMMA_ENABLE |
> +PLANE_COLOR_PIPE_CSC_ENABLE |
>  PLANE_COLOR_PLANE_GAMMA_DISABLE);
>   } else {
>   plane_ctl |=
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c 
> b/drivers/gpu/drm/i915/intel_sprite.c
> index b16a295..27e0752 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -224,6 +224,7 @@ skl_update_plane(struct drm_plane *drm_plane,
>   if (IS_GEMINILAKE(dev_priv)) {
>   I915_WRITE(PLANE_COLOR_CTL(pipe, plane_id),
>  PLANE_COLOR_PIPE_GAMMA_ENABLE |
> +PLANE_COLOR_PIPE_CSC_ENABLE |
>  PLANE_COLOR_PLANE_GAMMA_DISABLE);
>   } else {
>   plane_ctl |=
> -- 
> 2.5.5
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2 13/13] drm/i915: Acquire P-Unit access when modifying P-Unit settings

2017-01-30 Thread Ville Syrjälä
On Mon, Jan 30, 2017 at 04:27:58PM +0100, Hans de Goede wrote:
> Hi,
> 
> On 30-01-17 16:11, Ville Syrjälä wrote:
> > On Mon, Jan 30, 2017 at 04:02:19PM +0100, Hans de Goede wrote:
> >> Hi,
> >>
> >> On 30-01-17 14:10, Ville Syrjälä wrote:
> >>> On Sat, Jan 28, 2017 at 06:18:45PM +0100, Hans de Goede wrote:
>  Hi,
> 
>  On 01/28/2017 05:25 PM, Hans de Goede wrote:
> > Hi,
> >
> > On 01/27/2017 02:51 PM, Ville Syrjälä wrote:
> >> On Mon, Jan 23, 2017 at 10:09:58PM +0100, Hans de Goede wrote:
> >>> Make sure the P-Unit or the PMIC i2c bus is not in use when we send a
> >>> request to the P-Unit by calling iosf_mbi_punit_acquire() / _release()
> >>> around P-Unit write accesses.
> >>
> >> Can't we just stuff the calls into the actual punit write function
> >> rather than sprinkling them all over the place?
> >
> > punit access is acquired across sections like this:
> >
> > iosf_mbi_punit_acquire();
> >
> > val = vlv_punit_read(dev_priv, PUNIT_REG_DSPFREQ);
> > val &= ~DSPFREQGUAR_MASK;
> > val |= (cmd << DSPFREQGUAR_SHIFT);
> > vlv_punit_write(dev_priv, PUNIT_REG_DSPFREQ, val);
> > if (wait_for((vlv_punit_read(dev_priv, PUNIT_REG_DSPFREQ) &
> >   DSPFREQSTAT_MASK) == (cmd << DSPFREQSTAT_SHIFT),
> >  50)) {
> > DRM_ERROR("timed out waiting for CDclk change\n");
> > }
> > iosf_mbi_punit_release();
> >
> > Where we want to wait for the requested change to have taken
> > effect before releasing the punit.
> >>>
> >>> Hmm. That's somewhat unfortunate. It also highlights a problem with the
> >>> patch wrt. RPS. We don't wait for the GPU to actually change frequencies
> >>> in set_rps() because that would slow things down too much. So I have to
> >>> wonder how much luck is needed to make this workaround really effective.
> >>
> >> So the history of this patch-set is that I wrote this patch before
> >> writing the patch to get FORCEWAKE_ALL before the pmic bus becomes
> >> active (patch 12/13). Since a lot of testing was done with this
> >> patch included in the patch-set and since it seemed a good idea
> >> regardless (given my experience with accessing the punit vs
> >> pmic bus accesses) I decided to leave it in.
> >>
> >> Possibly just the patch to get FORCEWAKE_ALL is enough, that one
> >> actually fixed things for me. That is also why I made this the
> >> last patch in the set. I asked tagorereddy to test his system
> >> without this patch, but he did not get around to that.
> >>
> >> After all we do tell the punit to not touch the bus by acquiring
> >> the pmic bus semaphore from i2c-desigware-baytrail.c, so maybe
> >> for RPS freq changes it honors that and properly waits. Maybe it
> >> honors that for all punit requests i915 does and the only real
> >> problem is the forcewake stuff ?
> >>
> >> I can try to drop this patch from my queue and run without it
> >> for a while and see if things don't regress. And also ask
> >> tagorereddy again to test his system that way.
> >>
> >> Does that (dropping this patch for now) sound like a good idea?
> >
> > More test results couldn't hurt at least. It also makes me wonder if
> > just bumping the timeouts to some ridiculously high value would fix
> > the problem as well.
> 
> I've already tried bumping the forcewake timeout from 50 to 250ms,
> before writing the patch to just get forcewake_all before the pmic
> bus access begins, that does not fix things,

And you bumped the i2c mutex timeout as well? Or does that fail somehow
gracefully if it can't get the mutex?

> and since we busy wait
> for this timeout from non-sleeping context 250ms already is way too
> high.

Sure, but I'm just trying to understand if the problem is simply caused
by proceeding with some hardware access without getting the i2c mutex.

> 
> >> + a comment would be nice why it's there.
> >
> > I will add comments to the acquire calls.
> >
> >> Do we need a kconfig select/depends on the iosf_mbi thing? Or some
> >> ifdefs?
> >
> > No, the iosf_mbi header defines empty inline versions of
> > iosf_mbi_punit_acquire / _release if IOSF_MBI is disabled,
> > this does mean that iosf_mbi must be builtin if the i915
> > driver is. I'll add:
> >
> > depends on DRM_I915=IOSF_MBI || IOSF_MBI=y
> >
> > To the i915 Kconfig to enforce this.
> 
>  Hmm, ok so that does not work (long cyclic dependency through the
>  selection of ACPI_VIDEO).
> 
>  So I've now added this instead:
> 
>   # iosf_mbi needs to be builtin if we are builtin
>   select IOSF_MBI if DRM_I915=y
> >>>
> >>> That's probably not going to help anyone since i915 is usually a module.
> >>
> >> Right, that is fine, then either the IOSF_MBI symbols are available,
> >> or IOSF_MBI is disabled and we get the inline 

Re: [Intel-gfx] [PATCH i-g-t v1] lib/drmtest: Add comment explaining DRIVER_ANY excluding DRIVER_VGEM

2017-01-30 Thread Eric Engestrom
On Monday, 2017-01-30 10:12:28 -0500, Robert Foss wrote:
> Signed-off-by: Robert Foss 
> ---
>  lib/drmtest.h | 7 +++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/lib/drmtest.h b/lib/drmtest.h
> index 19d4bd19..c9c019c0 100644
> --- a/lib/drmtest.h
> +++ b/lib/drmtest.h
> @@ -42,8 +42,15 @@
>  #define DRIVER_VC4   (1 << 1)
>  #define DRIVER_VGEM  (1 << 2)
>  #define DRIVER_VIRTIO(1 << 3)
> +/*
> + * Exclude DRVER_VGEM from DRIVER_ANY since if you run on a system
> + * with vgem as well as a supported driver, you can end up with a
> + * near-100% skip rate if you don't explicitly specify the device,
> + * depending on device-load ordering.
> + */
>  #define DRIVER_ANY   ~(DRIVER_VGEM)

Brilliant, cheers :)
Reviewed-by: Eric Engestrom 

>  
> +
>  #ifdef ANDROID
>  #if (!(defined HAVE_MMAP64)) && (!(defined __x86_64__))
>  extern void*  __mmap2(void *, size_t, int, int, int, off_t);
> -- 
> 2.11.0.453.g787f75f05
> 
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/perf: Improve handling of OA tail race (rev2)

2017-01-30 Thread Patchwork
== Series Details ==

Series: drm/i915/perf: Improve handling of OA tail race (rev2)
URL   : https://patchwork.freedesktop.org/series/18448/
State : success

== Summary ==

Series 18448v2 drm/i915/perf: Improve handling of OA tail race
https://patchwork.freedesktop.org/api/1.0/series/18448/revisions/2/mbox/

Test kms_pipe_crc_basic:
Subgroup nonblocking-crc-pipe-b-frame-sequence:
dmesg-warn -> PASS   (fi-snb-2520m)

fi-bdw-5557u total:246  pass:232  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050 total:246  pass:207  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205 total:246  pass:224  dwarn:0   dfail:0   fail:0   skip:22 
fi-bxt-t5700 total:78   pass:65   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900 total:246  pass:219  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820 total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770  total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-ivb-3520m total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-ivb-3770  total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u total:246  pass:223  dwarn:0   dfail:0   fail:2   skip:21 
fi-skl-6260u total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hqtotal:246  pass:226  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k total:246  pass:221  dwarn:4   dfail:0   fail:0   skip:21 
fi-skl-6770hqtotal:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2520m total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-snb-2600  total:246  pass:214  dwarn:0   dfail:0   fail:0   skip:32 

dc47d8d6ed4ea669aeccad104fde843fe039b9a5 drm-tip: 2017y-01m-30d-09h-12m-47s UTC 
integration manifest
0f4794b drm/i915/perf: improve tail race workaround
3409fa3 drm/i915/perf: no head/tail ref in gen7_oa_read
62150f8 drm/i915/perf: avoid read back of head register
39854f4 drm/i915/perf: avoid poll, read, EAGAIN busy loops
1509db8 drm/i915/perf: fix gen7_append_oa_reports comment

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3638/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2 13/13] drm/i915: Acquire P-Unit access when modifying P-Unit settings

2017-01-30 Thread Hans de Goede

Hi,

On 30-01-17 16:11, Ville Syrjälä wrote:

On Mon, Jan 30, 2017 at 04:02:19PM +0100, Hans de Goede wrote:

Hi,

On 30-01-17 14:10, Ville Syrjälä wrote:

On Sat, Jan 28, 2017 at 06:18:45PM +0100, Hans de Goede wrote:

Hi,

On 01/28/2017 05:25 PM, Hans de Goede wrote:

Hi,

On 01/27/2017 02:51 PM, Ville Syrjälä wrote:

On Mon, Jan 23, 2017 at 10:09:58PM +0100, Hans de Goede wrote:

Make sure the P-Unit or the PMIC i2c bus is not in use when we send a
request to the P-Unit by calling iosf_mbi_punit_acquire() / _release()
around P-Unit write accesses.


Can't we just stuff the calls into the actual punit write function
rather than sprinkling them all over the place?


punit access is acquired across sections like this:

iosf_mbi_punit_acquire();

val = vlv_punit_read(dev_priv, PUNIT_REG_DSPFREQ);
val &= ~DSPFREQGUAR_MASK;
val |= (cmd << DSPFREQGUAR_SHIFT);
vlv_punit_write(dev_priv, PUNIT_REG_DSPFREQ, val);
if (wait_for((vlv_punit_read(dev_priv, PUNIT_REG_DSPFREQ) &
  DSPFREQSTAT_MASK) == (cmd << DSPFREQSTAT_SHIFT),
 50)) {
DRM_ERROR("timed out waiting for CDclk change\n");
}
iosf_mbi_punit_release();

Where we want to wait for the requested change to have taken
effect before releasing the punit.


Hmm. That's somewhat unfortunate. It also highlights a problem with the
patch wrt. RPS. We don't wait for the GPU to actually change frequencies
in set_rps() because that would slow things down too much. So I have to
wonder how much luck is needed to make this workaround really effective.


So the history of this patch-set is that I wrote this patch before
writing the patch to get FORCEWAKE_ALL before the pmic bus becomes
active (patch 12/13). Since a lot of testing was done with this
patch included in the patch-set and since it seemed a good idea
regardless (given my experience with accessing the punit vs
pmic bus accesses) I decided to leave it in.

Possibly just the patch to get FORCEWAKE_ALL is enough, that one
actually fixed things for me. That is also why I made this the
last patch in the set. I asked tagorereddy to test his system
without this patch, but he did not get around to that.

After all we do tell the punit to not touch the bus by acquiring
the pmic bus semaphore from i2c-desigware-baytrail.c, so maybe
for RPS freq changes it honors that and properly waits. Maybe it
honors that for all punit requests i915 does and the only real
problem is the forcewake stuff ?

I can try to drop this patch from my queue and run without it
for a while and see if things don't regress. And also ask
tagorereddy again to test his system that way.

Does that (dropping this patch for now) sound like a good idea?


More test results couldn't hurt at least. It also makes me wonder if
just bumping the timeouts to some ridiculously high value would fix
the problem as well.


I've already tried bumping the forcewake timeout from 50 to 250ms,
before writing the patch to just get forcewake_all before the pmic
bus access begins, that does not fix things, and since we busy wait
for this timeout from non-sleeping context 250ms already is way too
high.


+ a comment would be nice why it's there.


I will add comments to the acquire calls.


Do we need a kconfig select/depends on the iosf_mbi thing? Or some
ifdefs?


No, the iosf_mbi header defines empty inline versions of
iosf_mbi_punit_acquire / _release if IOSF_MBI is disabled,
this does mean that iosf_mbi must be builtin if the i915
driver is. I'll add:

depends on DRM_I915=IOSF_MBI || IOSF_MBI=y

To the i915 Kconfig to enforce this.


Hmm, ok so that does not work (long cyclic dependency through the
selection of ACPI_VIDEO).

So I've now added this instead:

# iosf_mbi needs to be builtin if we are builtin
select IOSF_MBI if DRM_I915=y


That's probably not going to help anyone since i915 is usually a module.


Right, that is fine, then either the IOSF_MBI symbols are available,
or IOSF_MBI is disabled and we get the inline nops from the header.

The problem scenario is DRM_I915=y and IOSF_MBI=m, which is not very
realistic IMHO, but will get triggered by the random-config testing
several contributors do and lead to an unresolved symbol error there.


Well, from the user POV anything with IOSF_MBI==n can be a problem.
So I'm not sure if we should allow that.


So you're suggesting we just add an unconditional "select IOSF_MBI"
to the i915 Kconfig entry?

Regards,

Hans




BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=155241
Signed-off-by: Hans de Goede 
Tested-by: tagorereddy 
---
Changes in v2:
-Spelling: P-Unit, PMIC
-Adjust for iosf_mbi_punit_lock/_unlock to _acquire/_release rename
---
 drivers/gpu/drm/i915/intel_display.c| 6 ++
 drivers/gpu/drm/i915/intel_pm.c | 9 +
 drivers/gpu/drm/i915/intel_runtime_pm.c | 9 +
 3 files changed, 24 insertions(+)


Re: [Intel-gfx] [PATCH v2] drm/i915: Record more information about the hanging contexts

2017-01-30 Thread Mika Kuoppala
Chris Wilson  writes:

> Include extra information such as the user_handle and hw_id so that
> userspace can identify which of their contexts hung, useful if they are
> performing self-diagnositics.
>
> Signed-off-by: Chris Wilson 
> Cc: Mika Kuoppala 
> ---
>  drivers/gpu/drm/i915/i915_drv.h   | 14 +--
>  drivers/gpu/drm/i915/i915_gpu_error.c | 77 
> ++-
>  2 files changed, 59 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index c1fde816db63..7e7bc4504c94 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -970,6 +970,16 @@ struct drm_i915_error_state {
>   u32 semaphore_mboxes[I915_NUM_ENGINES - 1];
>   struct intel_instdone instdone;
>  
> + struct drm_i915_error_context {
> + char comm[TASK_COMM_LEN];
> + int pid;

s/int/pid_t

Reviewed-by: Mika Kuoppala 

> + u32 handle;
> + u32 hw_id;
> + int ban_score;
> + int active;
> + int guilty;
> + } context;
> +
>   struct drm_i915_error_object {
>   u64 gtt_offset;
>   u64 gtt_size;
> @@ -1003,10 +1013,6 @@ struct drm_i915_error_state {
>   u32 pp_dir_base;
>   };
>   } vm_info;
> -
> - pid_t pid;
> - char comm[TASK_COMM_LEN];
> - int context_bans;
>   } engine[I915_NUM_ENGINES];
>  
>   struct drm_i915_error_buffer {
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c 
> b/drivers/gpu/drm/i915/i915_gpu_error.c
> index e5375323eb06..5283fe815a4d 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -384,6 +384,15 @@ static void error_print_request(struct 
> drm_i915_error_state_buf *m,
>  erq->head, erq->tail);
>  }
>  
> +static void error_print_context(struct drm_i915_error_state_buf *m,
> + const char *header,
> + struct drm_i915_error_context *ctx)
> +{
> + err_printf(m, "%s%s[%d] user_handle %d hw_id %d, ban score %d guilty %d 
> active %d\n",
> +header, ctx->comm, ctx->pid, ctx->handle, ctx->hw_id,
> +ctx->ban_score, ctx->guilty, ctx->active);
> +}
> +
>  static void error_print_engine(struct drm_i915_error_state_buf *m,
>  struct drm_i915_error_engine *ee)
>  {
> @@ -457,6 +466,7 @@ static void error_print_engine(struct 
> drm_i915_error_state_buf *m,
>  
>   error_print_request(m, "  ELSP[0]: ", >execlist[0]);
>   error_print_request(m, "  ELSP[1]: ", >execlist[1]);
> + error_print_context(m, "  Active context: ", >context);
>  }
>  
>  void i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, 
> ...)
> @@ -562,12 +572,12 @@ int i915_error_state_to_str(struct 
> drm_i915_error_state_buf *m,
>  
>   for (i = 0; i < ARRAY_SIZE(error->engine); i++) {
>   if (error->engine[i].hangcheck_stalled &&
> - error->engine[i].pid != -1) {
> - err_printf(m, "Active process (on ring %s): %s [%d], 
> context bans %d\n",
> + error->engine[i].context.pid) {
> + err_printf(m, "Active process (on ring %s): %s [%d], 
> score %d\n",
>  engine_str(i),
> -error->engine[i].comm,
> -error->engine[i].pid,
> -error->engine[i].context_bans);
> +error->engine[i].context.comm,
> +error->engine[i].context.pid,
> +error->engine[i].context.ban_score);
>   }
>   }
>   err_printf(m, "Reset count: %u\n", error->reset_count);
> @@ -658,11 +668,13 @@ int i915_error_state_to_str(struct 
> drm_i915_error_state_buf *m,
>   obj = ee->batchbuffer;
>   if (obj) {
>   err_puts(m, dev_priv->engine[i]->name);
> - if (ee->pid != -1)
> - err_printf(m, " (submitted by %s [%d], bans 
> %d)",
> -ee->comm,
> -ee->pid,
> -ee->context_bans);
> + if (ee->context.pid)
> + err_printf(m, " (submitted by %s [%d], ctx %d 
> [%d], score %d)",
> +ee->context.comm,
> +ee->context.pid,
> +ee->context.handle,
> +   

[Intel-gfx] [PATCH] drm/i915: Skip modeset locking when atomic pageflips are used.

2017-01-30 Thread Maarten Lankhorst
With the atomic helper for pageflips there are no CS flips when
that require resetting, so on most platforms we can completely
skip the locking.

Because we may end up reverting the page_flip patch add an explicit
function pointer check so that if someone reverts the page flip patch
there will not be any issues if this is forgotten.

Signed-off-by: Maarten Lankhorst 
Testcase: kms_busy.extended-modeset-hang-oldfb-*
---
This is a standalone patch to fix modeset hangs on g4x+.

The path for gen4 and lower is simulated in 
kms_busy.extended-modeset-hang-oldfb-with-reset
and still fails.

 drivers/gpu/drm/i915/intel_display.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index d8db1caec1b8..1dd480a6752a 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3529,6 +3529,8 @@ static bool gpu_reset_clobbers_display(struct 
drm_i915_private *dev_priv)
INTEL_GEN(dev_priv) < 5 && !IS_G4X(dev_priv);
 }
 
+static const struct drm_crtc_funcs intel_crtc_funcs;
+
 void intel_prepare_reset(struct drm_i915_private *dev_priv)
 {
struct drm_device *dev = _priv->drm;
@@ -3536,6 +3538,11 @@ void intel_prepare_reset(struct drm_i915_private 
*dev_priv)
struct drm_atomic_state *state;
int ret;
 
+   if (intel_crtc_funcs.page_flip == drm_atomic_helper_page_flip &&
+   !i915.force_reset_modeset_test &&
+   !gpu_reset_clobbers_display(dev_priv))
+   return;
+
/*
 * Need mode_config.mutex so that we don't
 * trample ongoing ->detect() and whatnot.
@@ -3584,6 +3591,11 @@ void intel_finish_reset(struct drm_i915_private 
*dev_priv)
struct drm_atomic_state *state = dev_priv->modeset_restore_state;
int ret;
 
+   if (intel_crtc_funcs.page_flip == drm_atomic_helper_page_flip &&
+   !i915.force_reset_modeset_test &&
+   !gpu_reset_clobbers_display(dev_priv))
+   return;
+
/*
 * Flips in the rings will be nuked by the reset,
 * so complete all pending flips so that user space
-- 
2.7.4


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


[Intel-gfx] [PATCH i-g-t v1] lib/drmtest: Add comment explaining DRIVER_ANY excluding DRIVER_VGEM

2017-01-30 Thread Robert Foss
Signed-off-by: Robert Foss 
---
 lib/drmtest.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/lib/drmtest.h b/lib/drmtest.h
index 19d4bd19..c9c019c0 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -42,8 +42,15 @@
 #define DRIVER_VC4 (1 << 1)
 #define DRIVER_VGEM(1 << 2)
 #define DRIVER_VIRTIO  (1 << 3)
+/*
+ * Exclude DRVER_VGEM from DRIVER_ANY since if you run on a system
+ * with vgem as well as a supported driver, you can end up with a
+ * near-100% skip rate if you don't explicitly specify the device,
+ * depending on device-load ordering.
+ */
 #define DRIVER_ANY ~(DRIVER_VGEM)
 
+
 #ifdef ANDROID
 #if (!(defined HAVE_MMAP64)) && (!(defined __x86_64__))
 extern void*  __mmap2(void *, size_t, int, int, int, off_t);
-- 
2.11.0.453.g787f75f05

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


Re: [Intel-gfx] [PATCH v2 13/13] drm/i915: Acquire P-Unit access when modifying P-Unit settings

2017-01-30 Thread Ville Syrjälä
On Mon, Jan 30, 2017 at 04:02:19PM +0100, Hans de Goede wrote:
> Hi,
> 
> On 30-01-17 14:10, Ville Syrjälä wrote:
> > On Sat, Jan 28, 2017 at 06:18:45PM +0100, Hans de Goede wrote:
> >> Hi,
> >>
> >> On 01/28/2017 05:25 PM, Hans de Goede wrote:
> >>> Hi,
> >>>
> >>> On 01/27/2017 02:51 PM, Ville Syrjälä wrote:
>  On Mon, Jan 23, 2017 at 10:09:58PM +0100, Hans de Goede wrote:
> > Make sure the P-Unit or the PMIC i2c bus is not in use when we send a
> > request to the P-Unit by calling iosf_mbi_punit_acquire() / _release()
> > around P-Unit write accesses.
> 
>  Can't we just stuff the calls into the actual punit write function
>  rather than sprinkling them all over the place?
> >>>
> >>> punit access is acquired across sections like this:
> >>>
> >>> iosf_mbi_punit_acquire();
> >>>
> >>> val = vlv_punit_read(dev_priv, PUNIT_REG_DSPFREQ);
> >>> val &= ~DSPFREQGUAR_MASK;
> >>> val |= (cmd << DSPFREQGUAR_SHIFT);
> >>> vlv_punit_write(dev_priv, PUNIT_REG_DSPFREQ, val);
> >>> if (wait_for((vlv_punit_read(dev_priv, PUNIT_REG_DSPFREQ) &
> >>>   DSPFREQSTAT_MASK) == (cmd << DSPFREQSTAT_SHIFT),
> >>>  50)) {
> >>> DRM_ERROR("timed out waiting for CDclk change\n");
> >>> }
> >>> iosf_mbi_punit_release();
> >>>
> >>> Where we want to wait for the requested change to have taken
> >>> effect before releasing the punit.
> >
> > Hmm. That's somewhat unfortunate. It also highlights a problem with the
> > patch wrt. RPS. We don't wait for the GPU to actually change frequencies
> > in set_rps() because that would slow things down too much. So I have to
> > wonder how much luck is needed to make this workaround really effective.
> 
> So the history of this patch-set is that I wrote this patch before
> writing the patch to get FORCEWAKE_ALL before the pmic bus becomes
> active (patch 12/13). Since a lot of testing was done with this
> patch included in the patch-set and since it seemed a good idea
> regardless (given my experience with accessing the punit vs
> pmic bus accesses) I decided to leave it in.
> 
> Possibly just the patch to get FORCEWAKE_ALL is enough, that one
> actually fixed things for me. That is also why I made this the
> last patch in the set. I asked tagorereddy to test his system
> without this patch, but he did not get around to that.
> 
> After all we do tell the punit to not touch the bus by acquiring
> the pmic bus semaphore from i2c-desigware-baytrail.c, so maybe
> for RPS freq changes it honors that and properly waits. Maybe it
> honors that for all punit requests i915 does and the only real
> problem is the forcewake stuff ?
> 
> I can try to drop this patch from my queue and run without it
> for a while and see if things don't regress. And also ask
> tagorereddy again to test his system that way.
> 
> Does that (dropping this patch for now) sound like a good idea?

More test results couldn't hurt at least. It also makes me wonder if
just bumping the timeouts to some ridiculously high value would fix
the problem as well.

> 
>  + a comment would be nice why it's there.
> >>>
> >>> I will add comments to the acquire calls.
> >>>
>  Do we need a kconfig select/depends on the iosf_mbi thing? Or some
>  ifdefs?
> >>>
> >>> No, the iosf_mbi header defines empty inline versions of
> >>> iosf_mbi_punit_acquire / _release if IOSF_MBI is disabled,
> >>> this does mean that iosf_mbi must be builtin if the i915
> >>> driver is. I'll add:
> >>>
> >>> depends on DRM_I915=IOSF_MBI || IOSF_MBI=y
> >>>
> >>> To the i915 Kconfig to enforce this.
> >>
> >> Hmm, ok so that does not work (long cyclic dependency through the
> >> selection of ACPI_VIDEO).
> >>
> >> So I've now added this instead:
> >>
> >># iosf_mbi needs to be builtin if we are builtin
> >>select IOSF_MBI if DRM_I915=y
> >
> > That's probably not going to help anyone since i915 is usually a module.
> 
> Right, that is fine, then either the IOSF_MBI symbols are available,
> or IOSF_MBI is disabled and we get the inline nops from the header.
> 
> The problem scenario is DRM_I915=y and IOSF_MBI=m, which is not very
> realistic IMHO, but will get triggered by the random-config testing
> several contributors do and lead to an unresolved symbol error there.

Well, from the user POV anything with IOSF_MBI==n can be a problem.
So I'm not sure if we should allow that.

> 
> Hmm, thinking about this, this hunk actually belongs in 12/13 as that
> is the first patch to use iosf_mbi functions.
> 
> Regards,
> 
> Hans
> 
> 
> 
> > BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=155241
> > Signed-off-by: Hans de Goede 
> > Tested-by: tagorereddy 
> > ---
> > Changes in v2:
> > -Spelling: P-Unit, PMIC
> > -Adjust for iosf_mbi_punit_lock/_unlock to _acquire/_release rename
> > ---
> >  

Re: [Intel-gfx] [PATCH v2 13/13] drm/i915: Acquire P-Unit access when modifying P-Unit settings

2017-01-30 Thread Hans de Goede

Hi,

On 30-01-17 14:10, Ville Syrjälä wrote:

On Sat, Jan 28, 2017 at 06:18:45PM +0100, Hans de Goede wrote:

Hi,

On 01/28/2017 05:25 PM, Hans de Goede wrote:

Hi,

On 01/27/2017 02:51 PM, Ville Syrjälä wrote:

On Mon, Jan 23, 2017 at 10:09:58PM +0100, Hans de Goede wrote:

Make sure the P-Unit or the PMIC i2c bus is not in use when we send a
request to the P-Unit by calling iosf_mbi_punit_acquire() / _release()
around P-Unit write accesses.


Can't we just stuff the calls into the actual punit write function
rather than sprinkling them all over the place?


punit access is acquired across sections like this:

iosf_mbi_punit_acquire();

val = vlv_punit_read(dev_priv, PUNIT_REG_DSPFREQ);
val &= ~DSPFREQGUAR_MASK;
val |= (cmd << DSPFREQGUAR_SHIFT);
vlv_punit_write(dev_priv, PUNIT_REG_DSPFREQ, val);
if (wait_for((vlv_punit_read(dev_priv, PUNIT_REG_DSPFREQ) &
  DSPFREQSTAT_MASK) == (cmd << DSPFREQSTAT_SHIFT),
 50)) {
DRM_ERROR("timed out waiting for CDclk change\n");
}
iosf_mbi_punit_release();

Where we want to wait for the requested change to have taken
effect before releasing the punit.


Hmm. That's somewhat unfortunate. It also highlights a problem with the
patch wrt. RPS. We don't wait for the GPU to actually change frequencies
in set_rps() because that would slow things down too much. So I have to
wonder how much luck is needed to make this workaround really effective.


So the history of this patch-set is that I wrote this patch before
writing the patch to get FORCEWAKE_ALL before the pmic bus becomes
active (patch 12/13). Since a lot of testing was done with this
patch included in the patch-set and since it seemed a good idea
regardless (given my experience with accessing the punit vs
pmic bus accesses) I decided to leave it in.

Possibly just the patch to get FORCEWAKE_ALL is enough, that one
actually fixed things for me. That is also why I made this the
last patch in the set. I asked tagorereddy to test his system
without this patch, but he did not get around to that.

After all we do tell the punit to not touch the bus by acquiring
the pmic bus semaphore from i2c-desigware-baytrail.c, so maybe
for RPS freq changes it honors that and properly waits. Maybe it
honors that for all punit requests i915 does and the only real
problem is the forcewake stuff ?

I can try to drop this patch from my queue and run without it
for a while and see if things don't regress. And also ask
tagorereddy again to test his system that way.

Does that (dropping this patch for now) sound like a good idea?


+ a comment would be nice why it's there.


I will add comments to the acquire calls.


Do we need a kconfig select/depends on the iosf_mbi thing? Or some
ifdefs?


No, the iosf_mbi header defines empty inline versions of
iosf_mbi_punit_acquire / _release if IOSF_MBI is disabled,
this does mean that iosf_mbi must be builtin if the i915
driver is. I'll add:

depends on DRM_I915=IOSF_MBI || IOSF_MBI=y

To the i915 Kconfig to enforce this.


Hmm, ok so that does not work (long cyclic dependency through the
selection of ACPI_VIDEO).

So I've now added this instead:

# iosf_mbi needs to be builtin if we are builtin
select IOSF_MBI if DRM_I915=y


That's probably not going to help anyone since i915 is usually a module.


Right, that is fine, then either the IOSF_MBI symbols are available,
or IOSF_MBI is disabled and we get the inline nops from the header.

The problem scenario is DRM_I915=y and IOSF_MBI=m, which is not very
realistic IMHO, but will get triggered by the random-config testing
several contributors do and lead to an unresolved symbol error there.

Hmm, thinking about this, this hunk actually belongs in 12/13 as that
is the first patch to use iosf_mbi functions.

Regards,

Hans




BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=155241
Signed-off-by: Hans de Goede 
Tested-by: tagorereddy 
---
Changes in v2:
-Spelling: P-Unit, PMIC
-Adjust for iosf_mbi_punit_lock/_unlock to _acquire/_release rename
---
 drivers/gpu/drm/i915/intel_display.c| 6 ++
 drivers/gpu/drm/i915/intel_pm.c | 9 +
 drivers/gpu/drm/i915/intel_runtime_pm.c | 9 +
 3 files changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 5604701..13e5152 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -47,6 +47,7 @@
 #include 
 #include 
 #include 
+#include 

 static bool is_mmio_work(struct intel_flip_work *work)
 {
@@ -6421,6 +6422,8 @@ static void valleyview_set_cdclk(struct drm_device *dev, 
int cdclk)
 cmd = 0;

 mutex_lock(_priv->rps.hw_lock);
+iosf_mbi_punit_acquire();
+
 val = vlv_punit_read(dev_priv, PUNIT_REG_DSPFREQ);
 val &= ~DSPFREQGUAR_MASK;
 val |= (cmd << DSPFREQGUAR_SHIFT);
@@ 

Re: [Intel-gfx] [PATCH] drm/i915: Create context desc template when context is created

2017-01-30 Thread Mika Kuoppala
Chris Wilson  writes:

> On Fri, Jan 27, 2017 at 03:03:09PM +0200, Mika Kuoppala wrote:
>> Move the invariant parts of context desc setup from execlist init
>> to context creation. This is advantageous when we need to
>> create different templates based on the context parametrization,
>> ie. for svm capable contexts.
>> 
>> v2: s/create/default, remove engine->ctx_desc_template
>> 
>> Cc: Chris Wilson 
>> Signed-off-by: Mika Kuoppala 
>
>> +#define GEN8_CTX_VALID (1<<0)
>> +#define GEN8_CTX_FORCE_PD_RESTORE (1<<1)
>> +#define GEN8_CTX_FORCE_RESTORE (1<<2)
>> +#define GEN8_CTX_L3LLC_COHERENT (1<<5)
>> +#define GEN8_CTX_PRIVILEGE (1<<8)
>>  #define GEN8_CTX_ADDRESSING_MODE_SHIFT 3
>>  #define GEN8_CTX_ADDRESSING_MODE(dev_priv) (USES_FULL_48BIT_PPGTT(dev_priv) 
>> ?\
>>  INTEL_LEGACY_64B_CONTEXT : \
>>  INTEL_LEGACY_32B_CONTEXT)
>>  
>> +#define GEN8_CTX_ID_SHIFT 32
>> +#define GEN8_CTX_ID_WIDTH 21
>
> One thing to note for a future patch would be
> BUILD_BUG_ON(GEN8_CTX_ID_WIDTH < ilog2(MAX_CONTEXT_HW_ID));
> now that it is exposed to i915_gem_context.c
>
> Reviewed-by: Chris Wilson 

Pushed, thanks for review.
-Mika
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 0/3] drm/i915: Handle hanging during nonblocking modeset correctly.

2017-01-30 Thread Maarten Lankhorst
Op 30-01-17 om 09:17 schreef Daniel Vetter:
> On Fri, Jan 27, 2017 at 03:08:45PM +, Chris Wilson wrote:
>> On Fri, Jan 27, 2017 at 03:58:08PM +0100, Daniel Vetter wrote:
>>> On Fri, Jan 27, 2017 at 02:31:55PM +, Chris Wilson wrote:
 On Fri, Jan 27, 2017 at 03:21:29PM +0100, Daniel Vetter wrote:
> On Fri, Jan 27, 2017 at 09:30:50AM +, Chris Wilson wrote:
>> On Thu, Jan 26, 2017 at 04:59:21PM +0100, Maarten Lankhorst wrote:
>>> When writing some testcases for nonblocking modesets. I found out that 
>>> the
>>> infinite wait on the old fb was causing issues.
>> The crux of the issue here is the locked wait for old dependencies and
>> the inability to inject the intel_prepare_reset disabling of all planes.
>> There are a couple of locked waits on struct_mutex within the modeset
>> locks for intel_overlay and if we happen to be using the display plane
>> for the first time.
>>
>> The first I suggested solving using fences to track dependencies and
>> keep the order between atomic states. Cancelling the outstanding
>> modesets, replacing with a disable and then on restore jumping to the
>> final state look doable. It also requires avoiding the struct_mutex for
>> disabling, which is quite easy. To avoid the wait under struct_mutex,
>> we've talked about switching to mmio, but for starters we could move the
>> wait from inside intel_overlay into the fence for the atomic operation.
>> (But's that a little more surgery than we would like for intel_overlay I
>> guess - dig out Ville's patches for overlay planes?) And to prevent the
>> wait under struct_mutex for pin_to_display_plane, my plane is to move
>> that to an async fenced operation that is then naturally waited upon by
>> the atomic modeset.
> A bit more a hack, but a different idea, and I think hack for gen234.0 is
> ok:
>
> We complete all the requests before we start the hw reset with fence.error
> = -EIO. But we do this only when we need to get at the display locks. A
> slightly more elegant solution would be to trylock modeset locks, and if
> one of them fails (and only then) complete all requests with -EIO to get
> the concurrent modeset to proceed before we reset the hardware. That's
> essentially the logic we had before all the reworks, and it worked. But I
> didn't look at how scary that all would be to make it work again ...
 The modeset lock may not just be waiting on our requests (even on pnv we
 can expect that there are already users celebrating that pnv+nouveau
 finally works ;) and that the display is not the only user/observer of
 those requests. Using the requests to break the modeset lock just feels
 like the wrong approach.
>>> It's a cycle, and we need to break it somewhere. Another option might be
>>> to break the cycle the same way we do it for gem locks: Wake up everyone
>>> and restart the modeset ioctl. Since the trouble only happens for
>>> synchronous modesets where we hold the locks while waiting for fences, we
>>> can also break out of that and restart. And I also don't think that would
>>> leak to other drivers, after all our gem locking restart dances also don't
>>> leak to other drivers - it's just our own driver's lock which are affected
>>> by these special wakupe semantics.
>> It's a queue of nonblocking modesets that we need to worry about, afaik.
>> Moving the wait for blocking modeset outside of modeset lock is easily
>> achievable (and avoiding the other waits under both the modeset + 
>> struct_mutex I have at least an idea for). So the challenge is how to
>> inject all-planes-off for gen3 and then allow the queue to continue again
>> afterwards.
> Hm right, I missed the nonblocking updates which don't take locks. But
> assuming we do the display reset for gpu resets as a full modeset (i.e.
> going through ->atomic_commit) it should still work out correctly:
>
> Starting state: gpu is hung, nonblocking modeset waiting for some requests
> to complete.
Missing one evil detail here, else things would have moved forward..

A unrelated thread performs a blocking commit, and holds all locks until the 
nonblocking modeset completes.
> 1. hangcheck kicks in, fires off reset work.
>
> 2. We complete all requests with fence.error = -EIO and wake up any
> waiters. That means no re-queueing for older platforms, but oh well.
>
> 3. We grab all the display locks. Nothing happens yet.
>
> 4. We reset the chip, display dies.
>
> 5. We run ->atomic_commit to restore things. This will also force the
> nonblocking commit worker to complete before this display restore touches
> anything.
>
> The only trouble I see is that the nonblocking worker can still touch the
> display block while we kill it, which isn't awesome. But we can fix that
> by waiting for all pending nonblocking commits in step 3 manually (without
> calling into atomic_commit), as long as we do step 2.
>
> 

Re: [Intel-gfx] [PATCH v2 i-g-t] aubdump: support new ioctl

2017-01-30 Thread Chris Wilson
On Mon, Jan 30, 2017 at 02:20:47PM +, Lionel Landwerlin wrote:
> Otherwise we won't log anything with OpenGL applications using a
> recent Mesa driver.
> 
> v2: This requires updated uapi headers, hence the libdrm dependency
> bump (Petri)
> 
> Signed-off-by: Lionel Landwerlin 
> ---
>  configure.ac| 4 ++--
>  tools/aubdump.c | 3 ++-
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 5bdd744a..06c19f14 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -182,10 +182,10 @@ AC_ARG_ENABLE(intel, AS_HELP_STRING([--disable-intel],
> [Enable building of intel specific parts (default: auto)]),
> [INTEL=$enableval], [INTEL=auto])
>  if test "x$INTEL" = xauto; then
> - PKG_CHECK_EXISTS([libdrm_intel >= 2.4.74], [INTEL=yes], [INTEL=no])
> + PKG_CHECK_EXISTS([libdrm_intel >= 2.4.75], [INTEL=yes], [INTEL=no])
>  fi
>  if test "x$INTEL" = xyes; then
> - PKG_CHECK_MODULES(DRM_INTEL, [libdrm_intel >= 2.4.74])
> + PKG_CHECK_MODULES(DRM_INTEL, [libdrm_intel >= 2.4.75])

Are we really using libdrm_intel as the canonical source for the uapi
headers? /irony
-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] [PATCH v2 i-g-t] aubdump: support new ioctl

2017-01-30 Thread Lionel Landwerlin
Otherwise we won't log anything with OpenGL applications using a
recent Mesa driver.

v2: This requires updated uapi headers, hence the libdrm dependency
bump (Petri)

Signed-off-by: Lionel Landwerlin 
---
 configure.ac| 4 ++--
 tools/aubdump.c | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5bdd744a..06c19f14 100644
--- a/configure.ac
+++ b/configure.ac
@@ -182,10 +182,10 @@ AC_ARG_ENABLE(intel, AS_HELP_STRING([--disable-intel],
  [Enable building of intel specific parts (default: auto)]),
  [INTEL=$enableval], [INTEL=auto])
 if test "x$INTEL" = xauto; then
-   PKG_CHECK_EXISTS([libdrm_intel >= 2.4.74], [INTEL=yes], [INTEL=no])
+   PKG_CHECK_EXISTS([libdrm_intel >= 2.4.75], [INTEL=yes], [INTEL=no])
 fi
 if test "x$INTEL" = xyes; then
-   PKG_CHECK_MODULES(DRM_INTEL, [libdrm_intel >= 2.4.74])
+   PKG_CHECK_MODULES(DRM_INTEL, [libdrm_intel >= 2.4.75])
AC_DEFINE(HAVE_LIBDRM_INTEL, 1, [Have intel support])
 else
DRM_INTEL_CFLAGS=-I$\(top_srcdir\)/lib/stubs/drm/
diff --git a/tools/aubdump.c b/tools/aubdump.c
index d53addc2..59ef3e7e 100644
--- a/tools/aubdump.c
+++ b/tools/aubdump.c
@@ -632,7 +632,8 @@ ioctl(int fd, unsigned long request, ...)
return libc_ioctl(fd, request, argp);
}

-   case DRM_IOCTL_I915_GEM_EXECBUFFER2: {
+   case DRM_IOCTL_I915_GEM_EXECBUFFER2:
+   case DRM_IOCTL_I915_GEM_EXECBUFFER2_WR: {
dump_execbuffer2(fd, argp);
if (device_override)
return 0;
--
2.11.0
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2 2/3] pwm/core: Try to get the module from pwm_get

2017-01-30 Thread Hans de Goede

Hi,

On 30-01-17 09:17, Thierry Reding wrote:

On Sun, Jan 22, 2017 at 05:14:08PM +0100, Hans de Goede wrote:

Add a module_name string to the pwm_lookup struct and if specified
and pwmchip_find_by_name() does not find the pwmchip try calling
request_module with the specified name.

Signed-off-by: Hans de Goede 
---
 drivers/pwm/core.c  |  4 
 include/linux/pwm.h | 11 +--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index 0d3ef29..c418a7a 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -823,6 +823,10 @@ struct pwm_device *pwm_get(struct device *dev, const char 
*con_id)
return ERR_PTR(-ENODEV);

chip = pwmchip_find_by_name(chosen->provider);
+   if (!chip && chosen->module_name) {
+   request_module(chosen->module_name);


How about checking for an error code here? It's kind of pointless to try
again if the module didn't load in the first place. No need to respin, I
can make that change as I apply.


Sure, that is fine.

Regards,

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


Re: [Intel-gfx] [PATCH i-g-t v2] tests: Validate TEST_ONLY correctness against full atomic commit

2017-01-30 Thread Maarten Lankhorst
Op 30-01-17 om 14:22 schreef Mika Kahola:
> On Mon, 2017-01-30 at 13:43 +0100, Maarten Lankhorst wrote:
>> Op 30-01-17 om 12:37 schreef Mika Kahola:
>>> Validate atomic commit correctness before actual commit.
>>>
>>> For: VIZ-6956
>>>
>>> v2: Add flag to toggle TEST_ONLY for atomic commit.
>>> Remove DRM_MODE_PAGE_FLIP_EVENT flag, if enabled, before trying
>>> atomic
>>> commit with TEST_ONLY flag (Maarten)
>>>
>>> Cc: Maarten Lankhorst 
>>>
>>> Signed-off-by: Mika Kahola 
>>> 
>> Hey,
>>
>> Way too complicated, I thought of something like this instead too run
>> a whole test with TEST_ONLY.
> Ok, let's go with this approach. 
>
> To follow JIRA description for this test I was thinking to add yet
> another subtest for each kms_* that tests first with TEST_ONLY flag and
> if that fails with -EINVAL then test with the real deal.
Yeah, this is mostly meant for debugging in some existing tests. To validate
TEST_ONLY we could add a kms_atomic_test_only test, which can also be used to
see if a test with TEST_ONLY is not accidentally being committed by reading
plane/connector/crtc properties and compare before against after, which is also 
a JIRA.

~Maarten


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


[Intel-gfx] [PATCH i-g-t v3 17/33] tests/kms_panel_fitting: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_panel_fitting.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c
index 1b350762..e145a2df 100644
--- a/tests/kms_panel_fitting.c
+++ b/tests/kms_panel_fitting.c
@@ -76,10 +76,10 @@ static void prepare_crtc(data_t *data, igt_output_t 
*output, enum pipe pipe,
 * there's no way (that works) to light up a pipe with only a sprite
 * plane enabled at the moment.
 */
-   if (!plane->is_primary) {
+   if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
igt_plane_t *primary;
 
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(output, 
DRM_PLANE_TYPE_PRIMARY);
igt_plane_set_fb(primary, >fb1);
}
 
@@ -116,10 +116,10 @@ static void cleanup_crtc(data_t *data, igt_output_t 
*output, igt_plane_t *plane)
data->fb_id3 = 0;
}
 
-   if (!plane->is_primary) {
+   if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
igt_plane_t *primary;
 
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(output, 
DRM_PLANE_TYPE_PRIMARY);
igt_plane_set_fb(primary, NULL);
}
 
@@ -174,7 +174,7 @@ static void test_panel_fitting(data_t *d)
/* Set up display to enable panel fitting */
mode->hdisplay = 640;
mode->vdisplay = 480;
-   d->plane1 = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   d->plane1 = igt_output_get_plane_type(output, 
DRM_PLANE_TYPE_PRIMARY);
prepare_crtc(d, output, pipe, d->plane1, mode, COMMIT_LEGACY);
 
/* disable panel fitting */
@@ -189,7 +189,7 @@ static void test_panel_fitting(data_t *d)
prepare_crtc(d, output, pipe, d->plane1, _mode, 
COMMIT_LEGACY);
 
/* Set up fb2->plane2 mapping. */
-   d->plane2 = igt_output_get_plane(output, IGT_PLANE_2);
+   d->plane2 = igt_output_get_plane_type(output, 
DRM_PLANE_TYPE_OVERLAY);
igt_plane_set_fb(d->plane2, >fb2);
 
/* enable sprite plane */
@@ -226,8 +226,8 @@ test_panel_fitting_fastset(igt_display_t *display, const 
enum pipe pipe, igt_out
igt_output_override_mode(output, );
igt_output_set_pipe(output, pipe);
 
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
-   sprite = igt_output_get_plane(output, IGT_PLANE_2);
+   primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+   sprite = igt_output_get_plane_type(output, DRM_PLANE_TYPE_OVERLAY);
 
igt_create_color_fb(display->drm_fd, mode.hdisplay, mode.vdisplay,
DRM_FORMAT_XRGB, LOCAL_DRM_FORMAT_MOD_NONE,
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 31/33] tests/kms_ccs: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_ccs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index 047a3e87..11acda89 100644
--- a/tests/kms_ccs.c
+++ b/tests/kms_ccs.c
@@ -182,7 +182,7 @@ static void display_fb(data_t *data, int compressed)
render_ccs(data, f.handles[0], f.offsets[1], size[1],
   f.width/16, f.height/8, f.pitches[1]);
 
-   primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(data->output, 
DRM_PLANE_TYPE_PRIMARY);
igt_plane_set_fb(primary, fb);
 
if (data->flags & TEST_ROTATE_180)
@@ -231,7 +231,7 @@ static void test_output(data_t *data)
display_fb(data, TEST_COMPRESSED);
}
 
-   primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(data->output, 
DRM_PLANE_TYPE_PRIMARY);
igt_plane_set_fb(primary, NULL);
igt_plane_set_rotation(primary, IGT_ROTATION_0);
if (!display->is_atomic)
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 28/33] tests/kms_universal_plane: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_universal_plane.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tests/kms_universal_plane.c b/tests/kms_universal_plane.c
index 48560212..a2fe1cc1 100644
--- a/tests/kms_universal_plane.c
+++ b/tests/kms_universal_plane.c
@@ -148,16 +148,16 @@ functional_test_pipe(data_t *data, enum pipe pipe, 
igt_output_t *output)
 * boolean and show up in userspace as the wrong type.
 */
for (i = 0; i < display->pipes[pipe].n_planes; i++)
-   if (display->pipes[pipe].planes[i].is_primary)
+   if (display->pipes[pipe].planes[i].type == 
DRM_PLANE_TYPE_PRIMARY)
num_primary++;
-   else if (display->pipes[pipe].planes[i].is_cursor)
+   else if (display->pipes[pipe].planes[i].type == 
DRM_PLANE_TYPE_CURSOR)
num_cursor++;
 
igt_assert_eq(num_primary, 1);
igt_assert_lte(num_cursor, 1);
 
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
-   sprite = igt_output_get_plane(output, IGT_PLANE_2);
+   primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+   sprite = igt_output_get_plane_type(output, DRM_PLANE_TYPE_OVERLAY);
if (!sprite) {
functional_test_fini(, output);
igt_skip("No sprite plane available\n");
@@ -369,7 +369,7 @@ sanity_test_pipe(data_t *data, enum pipe pipe, igt_output_t 
*output)
 
sanity_test_init(, output, pipe);
 
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
/* Use legacy API to set a mode with a blue FB */
igt_plane_set_fb(primary, _fb);
@@ -480,7 +480,7 @@ pageflip_test_pipe(data_t *data, enum pipe pipe, 
igt_output_t *output)
 
pageflip_test_init(, output, pipe);
 
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
/* Use legacy API to set a mode with a blue FB */
igt_plane_set_fb(primary, _fb);
@@ -602,8 +602,8 @@ cursor_leak_test_pipe(data_t *data, enum pipe pipe, 
igt_output_t *output)
_fb[i]);
}
 
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
-   cursor = igt_output_get_plane(output, IGT_PLANE_CURSOR);
+   primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+   cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
if (!primary || !cursor) {
cursor_leak_test_fini(data, output, _fb, cursor_fb);
igt_skip("Primary and/or cursor are unavailable\n");
@@ -706,7 +706,7 @@ gen9_test_pipe(data_t *data, enum pipe pipe, igt_output_t 
*output)
 
gen9_test_init(, output, pipe);
 
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
/* Start with a full-screen primary plane */
igt_plane_set_fb(primary, _fb);
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 30/33] tests/prime_mmap_kms: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/prime_mmap_kms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/prime_mmap_kms.c b/tests/prime_mmap_kms.c
index a2f85fa7..e7cca54c 100644
--- a/tests/prime_mmap_kms.c
+++ b/tests/prime_mmap_kms.c
@@ -168,7 +168,7 @@ static void prepare_crtc(gpu_process_t *gpu)
DRM_FORMAT_XRGB, LOCAL_DRM_FORMAT_MOD_NONE,
1.0, 1.0, 1.0, >fb);
 
-   gpu->primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   gpu->primary = igt_output_get_plane_type(output, 
DRM_PLANE_TYPE_PRIMARY);
 
igt_plane_set_fb(gpu->primary, >fb);
igt_display_commit(display);
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 33/33] lib/igt_kms: Remove code obsoleted by dyn n_planes implementation

2017-01-30 Thread Robert Foss
Due to the dyn n_planes implementation some attributes and functions
were made obsolete and cand be removed.

However to keep all of the tests building the obsolete code is
removed after all of the tests have been made compatible with the
dyn n_planes changes.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 lib/igt_kms.c | 28 
 lib/igt_kms.h | 20 
 2 files changed, 48 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 961a3e4d..4ba6316d 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -346,32 +346,6 @@ int kmstest_pipe_to_index(char pipe)
 }
 
 /**
- * kmstest_plane_name:
- * @plane: display plane
- *
- * Returns: String representing @plane, e.g. "plane1".
- */
-const char *kmstest_plane_name(enum igt_plane plane)
-{
-   static const char *names[] = {
-   [IGT_PLANE_1] = "plane1",
-   [IGT_PLANE_2] = "plane2",
-   [IGT_PLANE_3] = "plane3",
-   [IGT_PLANE_4] = "plane4",
-   [IGT_PLANE_5] = "plane5",
-   [IGT_PLANE_6] = "plane6",
-   [IGT_PLANE_7] = "plane7",
-   [IGT_PLANE_8] = "plane8",
-   [IGT_PLANE_9] = "plane9",
-   [IGT_PLANE_CURSOR] = "cursor",
-   };
-
-   igt_assert(plane < ARRAY_SIZE(names) && names[plane]);
-
-   return names[plane];
-}
-
-/**
  * kmstest_plane_type_name:
  * @plane: display plane
  *
@@ -1671,7 +1645,6 @@ void igt_display_init(igt_display_t *display, int drm_fd)
plane = >planes[p];
plane->index = p++;
}
-   plane->is_primary = 1;
break;
case DRM_PLANE_TYPE_CURSOR:
if (pipe->plane_cursor == -1) {
@@ -1683,7 +1656,6 @@ void igt_display_init(igt_display_t *display, int drm_fd)
plane->index = p++;
}
display->has_cursor_plane = true;
-   plane->is_cursor = 1;
break;
default:
plane = >planes[p];
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 510657a3..25626187 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -58,24 +58,6 @@ enum pipe {
 };
 const char *kmstest_pipe_name(enum pipe pipe);
 int kmstest_pipe_to_index(char pipe);
-
-/* We namespace this enum to not conflict with the Android i915_drm.h */
-enum igt_plane {
-IGT_PLANE_1 = 0,
-IGT_PLANE_PRIMARY = IGT_PLANE_1,
-IGT_PLANE_2,
-IGT_PLANE_3,
-IGT_PLANE_4,
-IGT_PLANE_5,
-IGT_PLANE_6,
-IGT_PLANE_7,
-IGT_PLANE_8,
-IGT_PLANE_9,
-IGT_PLANE_CURSOR, /* IGT_PLANE_CURSOR is always the last plane. */
-IGT_MAX_PLANES,
-};
-
-const char *kmstest_plane_name(enum igt_plane plane);
 const char *kmstest_plane_type_name(int plane_type);
 
 enum port {
@@ -274,8 +256,6 @@ typedef struct {
int index;
/* capabilities */
int type;
-   unsigned int is_primary   : 1;
-   unsigned int is_cursor: 1;
/* state tracking */
unsigned int fb_changed   : 1;
unsigned int position_changed : 1;
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 29/33] tests/kms_vblank: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_vblank.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/kms_vblank.c b/tests/kms_vblank.c
index 122fbc8f..0d250653 100644
--- a/tests/kms_vblank.c
+++ b/tests/kms_vblank.c
@@ -76,7 +76,7 @@ static void prepare_crtc(data_t *data, int fd, igt_output_t 
*output)
0.0, 0.0, 0.0,
>primary_fb);
 
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
igt_plane_set_fb(primary, >primary_fb);
 
igt_display_commit(display);
@@ -91,7 +91,7 @@ static void cleanup_crtc(data_t *data, int fd, igt_output_t 
*output)
 
igt_remove_fb(fd, >primary_fb);
 
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
igt_plane_set_fb(primary, NULL);
 
igt_output_set_pipe(output, PIPE_ANY);
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 20/33] tests/kms_plane_multiple: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_plane_multiple.c | 232 -
 1 file changed, 145 insertions(+), 87 deletions(-)

diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
index 2b43f0c5..bb848784 100644
--- a/tests/kms_plane_multiple.c
+++ b/tests/kms_plane_multiple.c
@@ -47,8 +47,8 @@ typedef struct {
int drm_fd;
igt_display_t display;
igt_pipe_crc_t *pipe_crc;
-   igt_plane_t *plane[IGT_MAX_PLANES];
-   struct igt_fb fb[IGT_MAX_PLANES];
+   igt_plane_t **plane;
+   struct igt_fb *fb;
 } data_t;
 
 typedef struct {
@@ -70,20 +70,38 @@ struct {
 /*
  * Common code across all tests, acting on data_t
  */
-static void test_init(data_t *data, enum pipe pipe)
+static void test_init(data_t *data, enum pipe pipe, int n_planes)
 {
data->pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+
+   data->plane = calloc(n_planes, sizeof(data->plane));
+   igt_assert_f(data->plane != NULL, "Failed to allocate memory for 
planes\n");
+
+   data->fb = calloc(n_planes, sizeof(struct igt_fb));
+   igt_assert_f(data->fb != NULL, "Failed to allocate memory for FBs\n");
 }
 
-static void test_fini(data_t *data, igt_output_t *output, int max_planes)
+static void test_fini(data_t *data, igt_output_t *output, int n_planes)
 {
-   for (int i = IGT_PLANE_PRIMARY; i <= max_planes; i++)
-   igt_plane_set_fb(data->plane[i], NULL);
+   for (int i = 0; i < n_planes; i++) {
+   igt_plane_t *plane = data->plane[i];
+   if (!plane)
+   continue;
+   if (plane->type == DRM_PLANE_TYPE_PRIMARY)
+   continue;
+   igt_plane_set_fb(plane, NULL);
+   data->plane[i] = NULL;
+   }
 
/* reset the constraint on the pipe */
igt_output_set_pipe(output, PIPE_ANY);
 
igt_pipe_crc_free(data->pipe_crc);
+
+   free(data->plane);
+   data->plane = NULL;
+   free(data->fb);
+   data->fb = NULL;
 }
 
 static void
@@ -91,11 +109,13 @@ test_grab_crc(data_t *data, igt_output_t *output, enum 
pipe pipe, bool atomic,
  color_t *color, uint64_t tiling, igt_crc_t *crc /* out */)
 {
drmModeModeInfo *mode;
+   igt_plane_t *primary;
int ret, n;
 
igt_output_set_pipe(output, pipe);
 
-   data->plane[IGT_PLANE_PRIMARY] = igt_output_get_plane(output, 
IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+   data->plane[primary->index] = primary;
 
mode = igt_output_get_mode(output);
 
@@ -103,9 +123,9 @@ test_grab_crc(data_t *data, igt_output_t *output, enum pipe 
pipe, bool atomic,
DRM_FORMAT_XRGB,
LOCAL_DRM_FORMAT_MOD_NONE,
color->red, color->green, color->blue,
-   >fb[IGT_PLANE_PRIMARY]);
+   >fb[primary->index]);
 
-   igt_plane_set_fb(data->plane[IGT_PLANE_PRIMARY], 
>fb[IGT_PLANE_PRIMARY]);
+   igt_plane_set_fb(data->plane[primary->index], 
>fb[primary->index]);
 
ret = igt_display_try_commit2(>display,
  atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
@@ -128,29 +148,35 @@ test_grab_crc(data_t *data, igt_output_t *output, enum 
pipe pipe, bool atomic,
  */
 
 static void
-create_fb_for_mode_position(data_t *data, drmModeModeInfo *mode,
+create_fb_for_mode_position(data_t *data, igt_output_t *output, 
drmModeModeInfo *mode,
color_t *color, int *rect_x, int *rect_y,
int *rect_w, int *rect_h, uint64_t tiling,
int max_planes)
 {
unsigned int fb_id;
cairo_t *cr;
+   igt_plane_t *primary;
+
+   primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
fb_id = igt_create_fb(data->drm_fd,
  mode->hdisplay, mode->vdisplay,
  DRM_FORMAT_XRGB,
  tiling,
- >fb[IGT_PLANE_PRIMARY]);
+ >fb[primary->index]);
igt_assert(fb_id);
 
-   cr = igt_get_cairo_ctx(data->drm_fd, >fb[IGT_PLANE_PRIMARY]);
+   cr = igt_get_cairo_ctx(data->drm_fd, >fb[primary->index]);
igt_paint_color(cr, rect_x[0], rect_y[0],
mode->hdisplay, mode->vdisplay,
color->red, color->green, color->blue);
 
-   for (int i = IGT_PLANE_2; i <= max_planes; i++)
+   for (int i = 0; i <= max_planes; i++) {
+   if (data->plane[i]->type == DRM_PLANE_TYPE_PRIMARY)
+   continue;
igt_paint_color(cr, rect_x[i], 

[Intel-gfx] [PATCH i-g-t v3 19/33] tests/kms_plane: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_plane.c | 96 ++-
 1 file changed, 53 insertions(+), 43 deletions(-)

diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index e843a170..d0de0f52 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -150,7 +150,7 @@ enum {
 static void
 test_plane_position_with_output(data_t *data,
enum pipe pipe,
-   enum igt_plane plane,
+   int plane,
igt_output_t *output,
unsigned int flags)
 {
@@ -170,7 +170,7 @@ test_plane_position_with_output(data_t *data,
igt_output_set_pipe(output, pipe);
 
mode = igt_output_get_mode(output);
-   primary = igt_output_get_plane(output, 0);
+   primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
sprite = igt_output_get_plane(output, plane);
 
create_fb_for_mode__position(data, mode, 100, 100, 64, 64,
@@ -222,7 +222,7 @@ test_plane_position_with_output(data_t *data,
 }
 
 static void
-test_plane_position(data_t *data, enum pipe pipe, enum igt_plane plane,
+test_plane_position(data_t *data, enum pipe pipe, int plane,
unsigned int flags)
 {
igt_output_t *output;
@@ -294,7 +294,7 @@ enum {
 static void
 test_plane_panning_with_output(data_t *data,
   enum pipe pipe,
-  enum igt_plane plane,
+  int plane,
   igt_output_t *output,
   unsigned int flags)
 {
@@ -348,8 +348,8 @@ test_plane_panning_with_output(data_t *data,
 }
 
 static void
-test_plane_panning(data_t *data, enum pipe pipe, enum igt_plane plane,
-unsigned int flags)
+test_plane_panning(data_t *data, enum pipe pipe, int plane,
+  unsigned int flags)
 {
igt_output_t *output;
int connected_outs = 0;
@@ -367,47 +367,57 @@ test_plane_panning(data_t *data, enum pipe pipe, enum 
igt_plane plane,
 }
 
 static void
-run_tests_for_pipe_plane(data_t *data, enum pipe pipe, enum igt_plane plane)
+run_tests_for_pipe_plane(data_t *data, enum pipe pipe)
 {
-   igt_subtest_f("plane-position-covered-pipe-%s-plane-%d",
- kmstest_pipe_name(pipe), plane)
-   test_plane_position(data, pipe, plane,
-   TEST_POSITION_FULLY_COVERED);
-
-   igt_subtest_f("plane-position-hole-pipe-%s-plane-%d",
- kmstest_pipe_name(pipe), plane)
-   test_plane_position(data, pipe, plane, 0);
-
-   igt_subtest_f("plane-position-hole-dpms-pipe-%s-plane-%d",
- kmstest_pipe_name(pipe), plane)
-   test_plane_position(data, pipe, plane,
-   TEST_DPMS);
-
-   igt_subtest_f("plane-panning-top-left-pipe-%s-plane-%d",
- kmstest_pipe_name(pipe), plane)
-   test_plane_panning(data, pipe, plane, TEST_PANNING_TOP_LEFT);
-
-   igt_subtest_f("plane-panning-bottom-right-pipe-%s-plane-%d",
- kmstest_pipe_name(pipe), plane)
-   test_plane_panning(data, pipe, plane,
-  TEST_PANNING_BOTTOM_RIGHT);
-
-   igt_subtest_f("plane-panning-bottom-right-suspend-pipe-%s-plane-%d",
- kmstest_pipe_name(pipe), plane)
-   test_plane_panning(data, pipe, plane,
-  TEST_PANNING_BOTTOM_RIGHT |
-  TEST_SUSPEND_RESUME);
-}
+   igt_subtest_f("plane-position-covered-pipe-%s-planes",
+ kmstest_pipe_name(pipe)) {
+   int n_planes = data->display.pipes[pipe].n_planes;
+   for (int plane = 1; plane < n_planes; plane++)
+   test_plane_position(data, pipe, plane,
+   TEST_POSITION_FULLY_COVERED);
+   }
 
-static void
-run_tests_for_pipe(data_t *data, enum pipe pipe)
-{
-   int plane;
+   igt_subtest_f("plane-position-hole-pipe-%s-planes",
+ kmstest_pipe_name(pipe)) {
+   int n_planes = data->display.pipes[pipe].n_planes;
+   for (int plane = 1; plane < n_planes; plane++)
+   test_plane_position(data, pipe, plane, 0);
+   }
+
+   igt_subtest_f("plane-position-hole-dpms-pipe-%s-planes",
+ kmstest_pipe_name(pipe)) {
+   int n_planes = data->display.pipes[pipe].n_planes;
+   for (int plane = 1; plane < n_planes; plane++)
+   test_plane_position(data, pipe, plane,
+   TEST_DPMS);
+   }
+
+   

[Intel-gfx] [PATCH i-g-t v3 21/33] tests/kms_plane_scaling: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_plane_scaling.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 368da09f..18ba86c9 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -85,10 +85,10 @@ static void prepare_crtc(data_t *data, igt_output_t 
*output, enum pipe pipe,
 * there's no way (that works) to light up a pipe with only a sprite
 * plane enabled at the moment.
 */
-   if (!plane->is_primary) {
+   if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
igt_plane_t *primary;
 
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(output, 
DRM_PLANE_TYPE_PRIMARY);
igt_plane_set_fb(primary, >fb1);
}
 
@@ -128,10 +128,10 @@ static void cleanup_crtc(data_t *data, igt_output_t 
*output, igt_plane_t *plane)
data->fb_id3 = 0;
}
 
-   if (!plane->is_primary) {
+   if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
igt_plane_t *primary;
 
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(output, 
DRM_PLANE_TYPE_PRIMARY);
igt_plane_set_fb(primary, NULL);
}
 
@@ -207,7 +207,7 @@ static void test_plane_scaling(data_t *d)
igt_assert(d->fb_id3);
 
/* Set up display with plane 1 */
-   d->plane1 = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   d->plane1 = igt_output_get_plane(output, 1);
prepare_crtc(d, output, pipe, d->plane1, mode, 
COMMIT_UNIVERSAL);
 
if (primary_plane_scaling) {
@@ -227,7 +227,7 @@ static void test_plane_scaling(data_t *d)
}
 
/* Set up fb2->plane2 mapping. */
-   d->plane2 = igt_output_get_plane(output, IGT_PLANE_2);
+   d->plane2 = igt_output_get_plane(output, 2);
igt_plane_set_fb(d->plane2, >fb2);
 
/* 2nd plane windowed */
@@ -263,7 +263,7 @@ static void test_plane_scaling(data_t *d)
}
 
/* Set up fb3->plane3 mapping. */
-   d->plane3 = igt_output_get_plane(output, IGT_PLANE_3);
+   d->plane3 = igt_output_get_plane(output, 3);
igt_plane_set_fb(d->plane3, >fb3);
 
/* 3rd plane windowed - no scaling */
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 22/33] tests/kms_properties: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_properties.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/kms_properties.c b/tests/kms_properties.c
index 2650672d..a86371c0 100644
--- a/tests/kms_properties.c
+++ b/tests/kms_properties.c
@@ -38,7 +38,7 @@ static void prepare_pipe(igt_display_t *display, enum pipe 
pipe, igt_output_t *o
 
igt_output_set_pipe(output, pipe);
 
-   igt_plane_set_fb(igt_output_get_plane(output, IGT_PLANE_PRIMARY), fb);
+   igt_plane_set_fb(igt_output_get_plane_type(output, 
DRM_PLANE_TYPE_PRIMARY), fb);
 
igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : 
COMMIT_LEGACY);
 }
@@ -163,8 +163,8 @@ static void run_plane_property_tests(igt_display_t 
*display, enum pipe pipe, igt
prepare_pipe(display, pipe, output, );
 
for_each_plane_on_pipe(display, pipe, plane) {
-   igt_info("Testing plane properties on %s.%s (output: %s)\n",
-kmstest_pipe_name(pipe), 
kmstest_plane_name(plane->index), output->name);
+   igt_info("Testing plane properties on %s.#%d-%s (output: %s)\n",
+kmstest_pipe_name(pipe), plane->index, 
kmstest_plane_type_name(plane->type), output->name);
 
test_properties(display->drm_fd, DRM_MODE_OBJECT_PLANE, 
plane->drm_plane->plane_id, atomic);
}
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 23/33] tests/kms_psr_sink_crc: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_psr_sink_crc.c | 52 +---
 1 file changed, 23 insertions(+), 29 deletions(-)

diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index 926b8578..8f6bdc0d 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -34,12 +34,6 @@ bool running_with_psr_disabled;
 
 #define CRC_BLACK ""
 
-enum planes {
-   PRIMARY,
-   SPRITE,
-   CURSOR,
-};
-
 enum operations {
PAGE_FLIP,
MMAP_GTT,
@@ -69,7 +63,7 @@ static const char *op_str(enum operations op)
 
 typedef struct {
int drm_fd;
-   enum planes test_plane;
+   int test_plane;
enum operations op;
uint32_t devid;
uint32_t crtc_id;
@@ -313,9 +307,9 @@ static void run_test(data_t *data)
 
/* Setting a secondary fb/plane */
switch (data->test_plane) {
-   case PRIMARY: default: test_plane = data->primary; break;
-   case SPRITE: test_plane = data->sprite; break;
-   case CURSOR: test_plane = data->cursor; break;
+   case DRM_PLANE_TYPE_PRIMARY: default: test_plane = data->primary; break;
+   case DRM_PLANE_TYPE_OVERLAY: test_plane = data->sprite; break;
+   case DRM_PLANE_TYPE_CURSOR: test_plane = data->cursor; break;
}
igt_plane_set_fb(test_plane, >fb_white);
igt_display_commit(>display);
@@ -323,7 +317,7 @@ static void run_test(data_t *data)
/* Confirm it is not Green anymore */
igt_assert(wait_psr_entry(data));
get_sink_crc(data, ref_crc);
-   if (data->test_plane == PRIMARY)
+   if (data->test_plane == DRM_PLANE_TYPE_PRIMARY)
assert_or_manual(!is_green(ref_crc), "screen WHITE");
else
assert_or_manual(!is_green(ref_crc), "GREEN background with 
WHITE box");
@@ -355,7 +349,7 @@ static void run_test(data_t *data)
/* Printing white on white so the screen shouldn't change */
memset(ptr, 0xff, data->mod_size);
get_sink_crc(data, crc);
-   if (data->test_plane == PRIMARY)
+   if (data->test_plane == DRM_PLANE_TYPE_PRIMARY)
assert_or_manual(strcmp(ref_crc, crc) == 0, "screen 
WHITE");
else
assert_or_manual(strcmp(ref_crc, crc) == 0,
@@ -406,9 +400,9 @@ static void run_test(data_t *data)
 
 static void test_cleanup(data_t *data) {
igt_plane_set_fb(data->primary, NULL);
-   if (data->test_plane == SPRITE)
+   if (data->test_plane == DRM_PLANE_TYPE_OVERLAY)
igt_plane_set_fb(data->sprite, NULL);
-   if (data->test_plane == CURSOR)
+   if (data->test_plane == DRM_PLANE_TYPE_CURSOR)
igt_plane_set_fb(data->cursor, NULL);
 
igt_display_commit(>display);
@@ -428,7 +422,7 @@ static void setup_test_plane(data_t *data)
0.0, 1.0, 0.0,
>fb_green);
 
-   data->primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
+   data->primary = igt_output_get_plane_type(data->output, 
DRM_PLANE_TYPE_PRIMARY);
igt_plane_set_fb(data->primary, NULL);
 
white_h = data->mode->hdisplay;
@@ -439,16 +433,16 @@ static void setup_test_plane(data_t *data)
data->mod_stride = white_h * 4;
 
switch (data->test_plane) {
-   case SPRITE:
-   data->sprite = igt_output_get_plane(data->output,
-   IGT_PLANE_2);
+   case DRM_PLANE_TYPE_OVERLAY:
+   data->sprite = igt_output_get_plane_type(data->output,
+   DRM_PLANE_TYPE_OVERLAY);
igt_plane_set_fb(data->sprite, NULL);
/* To make it different for human eyes let's make
 * sprite visible in only one quarter of the primary
 */
white_h = white_h/2;
white_v = white_v/2;
-   case PRIMARY:
+   case DRM_PLANE_TYPE_PRIMARY:
igt_create_color_fb(data->drm_fd,
white_h, white_v,
DRM_FORMAT_XRGB,
@@ -456,9 +450,9 @@ static void setup_test_plane(data_t *data)
1.0, 1.0, 1.0,
>fb_white);
break;
-   case CURSOR:
-   data->cursor = igt_output_get_plane(data->output,
-   IGT_PLANE_CURSOR);
+   case DRM_PLANE_TYPE_CURSOR:
+   data->cursor = igt_output_get_plane_type(data->output,
+   DRM_PLANE_TYPE_CURSOR);
igt_plane_set_fb(data->cursor, NULL);

[Intel-gfx] [PATCH i-g-t v3 26/33] tests/kms_rotation_crc: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_rotation_crc.c | 63 
 1 file changed, 32 insertions(+), 31 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cb0ac1eb..6769a89b 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -97,17 +97,18 @@ static void commit_crtc(data_t *data, igt_output_t *output, 
igt_plane_t *plane)
 * we create an fb covering the crtc and call commit
 */
 
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
igt_plane_set_fb(primary, >fb_modeset);
primary->rotation_changed = false;
igt_display_commit(display);
 
igt_plane_set_fb(plane, >fb);
 
-   if (!plane->is_cursor)
+   if (plane->type != DRM_PLANE_TYPE_CURSOR)
igt_plane_set_position(plane, data->pos_x, data->pos_y);
 
-   if (plane->is_primary || plane->is_cursor)
+   if (plane->type == DRM_PLANE_TYPE_PRIMARY ||
+   plane->type == DRM_PLANE_TYPE_CURSOR)
commit = COMMIT_UNIVERSAL;
 
if (data->display.is_atomic)
@@ -154,7 +155,7 @@ static void prepare_crtc(data_t *data, igt_output_t 
*output, enum pipe pipe,
tiling = data->override_tiling ?
 data->override_tiling : LOCAL_I915_FORMAT_MOD_Y_TILED;
w = h =  mode->vdisplay;
-   } else if (plane->is_cursor) {
+   } else if (plane->type == DRM_PLANE_TYPE_CURSOR) {
pixel_format = data->override_fmt ?
   data->override_fmt : DRM_FORMAT_ARGB;
w = h = 128;
@@ -206,10 +207,10 @@ static void cleanup_crtc(data_t *data, igt_output_t 
*output, igt_plane_t *plane)
igt_remove_fb(data->gfx_fd, >fb_flip);
 
/* XXX: see the note in prepare_crtc() */
-   if (!plane->is_primary) {
+   if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
igt_plane_t *primary;
 
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(output, 
DRM_PLANE_TYPE_PRIMARY);
igt_plane_set_fb(primary, NULL);
}
 
@@ -236,7 +237,7 @@ static void wait_for_pageflip(int fd)
igt_assert(drmHandleEvent(fd, ) == 0);
 }
 
-static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
+static void test_plane_rotation(data_t *data, int plane_type)
 {
igt_display_t *display = >display;
igt_output_t *output;
@@ -247,10 +248,10 @@ static void test_plane_rotation(data_t *data, enum 
igt_plane plane_type)
unsigned int flip_count;
int ret;
 
-   if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR)
+   if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type == 
DRM_PLANE_TYPE_CURSOR)
commit = COMMIT_UNIVERSAL;
 
-   if (plane_type == IGT_PLANE_CURSOR)
+   if (plane_type == DRM_PLANE_TYPE_CURSOR)
igt_require(display->has_cursor_plane);
 
if (data->display.is_atomic)
@@ -261,7 +262,7 @@ static void test_plane_rotation(data_t *data, enum 
igt_plane plane_type)
 
igt_output_set_pipe(output, pipe);
 
-   plane = igt_output_get_plane(output, plane_type);
+   plane = igt_output_get_plane_type(output, plane_type);
igt_require(igt_plane_supports_rotation(plane));
 
prepare_crtc(data, output, pipe, plane);
@@ -321,7 +322,7 @@ static void test_plane_rotation(data_t *data, enum 
igt_plane plane_type)
 
 static void test_plane_rotation_ytiled_obj(data_t *data,
   igt_output_t *output,
-  enum igt_plane plane_type)
+  int plane_type)
 {
igt_display_t *display = >display;
uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
@@ -335,13 +336,13 @@ static void test_plane_rotation_ytiled_obj(data_t *data,
uint32_t gem_handle;
int ret;
 
-   plane = igt_output_get_plane(output, plane_type);
+   plane = igt_output_get_plane_type(output, plane_type);
igt_require(igt_plane_supports_rotation(plane));
 
-   if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR)
+   if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type == 
DRM_PLANE_TYPE_CURSOR)
commit = COMMIT_UNIVERSAL;
 
-   if (plane_type == IGT_PLANE_CURSOR)
+   if (plane_type == DRM_PLANE_TYPE_CURSOR)
igt_require(display->has_cursor_plane);
 
if (data->display.is_atomic)
@@ -388,7 +389,7 @@ static void test_plane_rotation_ytiled_obj(data_t *data,
 
 static void 

[Intel-gfx] [PATCH i-g-t v3 24/33] tests/kms_pwrite_crc: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_pwrite_crc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/kms_pwrite_crc.c b/tests/kms_pwrite_crc.c
index b63afbc6..1e626375 100644
--- a/tests/kms_pwrite_crc.c
+++ b/tests/kms_pwrite_crc.c
@@ -116,7 +116,7 @@ static void prepare_crtc(data_t *data)
DRM_FORMAT_XRGB, LOCAL_DRM_FORMAT_MOD_NONE,
1.0, 1.0, 1.0, >fb[0]);
 
-   data->primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   data->primary = igt_output_get_plane_type(output, 
DRM_PLANE_TYPE_PRIMARY);
 
igt_plane_set_fb(data->primary, >fb[0]);
igt_display_commit(display);
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 27/33] tests/kms_sink_crc_basic: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_sink_crc_basic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/kms_sink_crc_basic.c b/tests/kms_sink_crc_basic.c
index c332eb1e..953ead10 100644
--- a/tests/kms_sink_crc_basic.c
+++ b/tests/kms_sink_crc_basic.c
@@ -138,7 +138,7 @@ static void run_test(data_t *data)
1.0, 0.0, 0.0,
>fb_red);
 
-   data->primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   data->primary = igt_output_get_plane_type(output, 
DRM_PLANE_TYPE_PRIMARY);
 
basic_sink_crc_check(data);
return;
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 32/33] tests/kms_plane_lowres: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_plane_lowres.c | 27 +--
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
index 424ecb97..689c248e 100644
--- a/tests/kms_plane_lowres.c
+++ b/tests/kms_plane_lowres.c
@@ -40,8 +40,8 @@ typedef struct {
int drm_fd;
igt_display_t display;
igt_pipe_crc_t *pipe_crc;
-   igt_plane_t *plane[IGT_MAX_PLANES];
-   struct igt_fb fb[IGT_MAX_PLANES];
+   igt_plane_t **plane;
+   struct igt_fb *fb;
 } data_t;
 
 static drmModeModeInfo
@@ -113,6 +113,12 @@ static void
 test_init(data_t *data, enum pipe pipe)
 {
data->pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+   data->plane = calloc(data->display.pipes[pipe].n_planes, 
sizeof(data->plane));\
+   igt_assert_f(data->plane, "Failed to allocate memory for %d planes\n",
+data->display.pipes[pipe].n_planes);
+   data->fb = calloc(data->display.pipes[pipe].n_planes, sizeof(struct 
igt_fb));
+   igt_assert_f(data->fb, "Failed to allocate memory for %d FBs\n",
+data->display.pipes[pipe].n_planes);
 }
 
 static void
@@ -128,6 +134,11 @@ test_fini(data_t *data, igt_output_t *output)
igt_output_set_pipe(output, PIPE_ANY);
 
igt_pipe_crc_free(data->pipe_crc);
+
+   free(data->plane);
+   data->plane = NULL;
+   free(data->fb);
+   data->fb = NULL;
 }
 
 static int
@@ -178,6 +189,8 @@ test_setup(data_t *data, enum pipe pipe, uint64_t modifier, 
int flags,
int size;
int i, x, y;
 
+   crtc.planes = calloc(sizeof(struct kmstest_plane), 
data->display.pipes[pipe].n_planes);
+   igt_assert_f(crtc.planes, "Failed to allocate memory for %d planes\n", 
data->display.pipes[pipe].n_planes);
igt_output_set_pipe(output, pipe);
 
kmstest_get_crtc(pipe, );
@@ -198,8 +211,10 @@ test_setup(data_t *data, enum pipe pipe, uint64_t 
modifier, int flags,
igt_plane_set_fb(data->plane[0], >fb[0]);
 
/* yellow sprite plane in lower left corner */
-   for (i = IGT_PLANE_2; i < crtc.n_planes; i++) {
-   if (data->plane[i]->is_cursor)
+   for (i = 0; i < crtc.n_planes; i++) {
+   if (data->plane[i]->type == DRM_PLANE_TYPE_PRIMARY)
+   continue;
+   if (data->plane[i]->type == DRM_PLANE_TYPE_CURSOR)
size = 64;
else
size = SIZE;
@@ -209,8 +224,8 @@ test_setup(data_t *data, enum pipe pipe, uint64_t modifier, 
int flags,
 
igt_create_color_fb(data->drm_fd,
size, size,
-   data->plane[i]->is_cursor ? 
DRM_FORMAT_ARGB : DRM_FORMAT_XRGB,
-   data->plane[i]->is_cursor ? 
LOCAL_DRM_FORMAT_MOD_NONE : modifier,
+   data->plane[i]->type == 
DRM_PLANE_TYPE_CURSOR ? DRM_FORMAT_ARGB : DRM_FORMAT_XRGB,
+   data->plane[i]->type == 
DRM_PLANE_TYPE_CURSOR ? LOCAL_DRM_FORMAT_MOD_NONE : modifier,
1.0, 1.0, 0.0,
>fb[i]);
 
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 25/33] tests/kms_rmfb: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_rmfb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/kms_rmfb.c b/tests/kms_rmfb.c
index 17a3065a..5753d74c 100644
--- a/tests/kms_rmfb.c
+++ b/tests/kms_rmfb.c
@@ -83,7 +83,7 @@ test_rmfb(struct rmfb_data *data, igt_output_t *output, enum 
pipe pipe, bool reo
 * later on.
 */
for_each_plane_on_pipe(>display, pipe, plane) {
-   if (plane->is_cursor) {
+   if (plane->type == DRM_PLANE_TYPE_CURSOR) {
igt_plane_set_fb(plane, _fb);
igt_fb_set_size(_fb, plane, cursor_width, 
cursor_height);
igt_plane_set_size(plane, cursor_width, cursor_height);
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 14/33] tests/kms_legacy_colorkey: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_legacy_colorkey.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/kms_legacy_colorkey.c b/tests/kms_legacy_colorkey.c
index 25f98aad..150520ce 100644
--- a/tests/kms_legacy_colorkey.c
+++ b/tests/kms_legacy_colorkey.c
@@ -55,8 +55,10 @@ igt_simple_main
 
for_each_pipe(, p) {
for_each_plane_on_pipe(, p, plane) {
+   bool is_valid = (plane->type == DRM_PLANE_TYPE_PRIMARY 
||
+plane->type == DRM_PLANE_TYPE_CURSOR);
test_plane(plane->drm_plane->plane_id,
-  (plane->is_cursor || plane->is_primary) ? 
-ENOENT : 0);
+  is_valid ? -ENOENT : 0);
 
max_id = max(max_id, plane->drm_plane->plane_id);
}
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 18/33] tests/kms_pipe_color: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_pipe_color.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/kms_pipe_color.c b/tests/kms_pipe_color.c
index 1aff7d54..c7a5d2f1 100644
--- a/tests/kms_pipe_color.c
+++ b/tests/kms_pipe_color.c
@@ -857,9 +857,9 @@ run_tests_for_pipe(data_t *data, enum pipe p)
igt_require(p < data->display.n_pipes);
 
pipe = >display.pipes[p];
-   igt_require(pipe->n_planes >= IGT_PLANE_PRIMARY);
+   igt_require(pipe->n_planes >= 0);
 
-   primary = >planes[IGT_PLANE_PRIMARY];
+   primary = igt_pipe_get_plane_type(pipe, DRM_PLANE_TYPE_PRIMARY);
 
data->pipe_crc = igt_pipe_crc_new(primary->pipe->pipe,
  INTEL_PIPE_CRC_SOURCE_AUTO);
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 16/33] tests/kms_mmio_vs_cs_flip: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_mmio_vs_cs_flip.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/kms_mmio_vs_cs_flip.c b/tests/kms_mmio_vs_cs_flip.c
index 2f64f633..09217b31 100644
--- a/tests/kms_mmio_vs_cs_flip.c
+++ b/tests/kms_mmio_vs_cs_flip.c
@@ -191,7 +191,7 @@ static void make_gpu_busy(data_t *data, uint32_t 
flip_handle)
  * supposed to be.
  */
 static void
-test_plane(data_t *data, igt_output_t *output, enum pipe pipe, enum igt_plane 
plane)
+test_plane(data_t *data, igt_output_t *output, enum pipe pipe, int plane)
 {
struct igt_fb red_fb, green_fb, blue_fb;
drmModeModeInfo *mode;
@@ -201,7 +201,7 @@ test_plane(data_t *data, igt_output_t *output, enum pipe 
pipe, enum igt_plane pl
 
igt_output_set_pipe(output, pipe);
 
-   primary = igt_output_get_plane(output, 0);
+   primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
sprite = igt_output_get_plane(output, plane);
 
mode = igt_output_get_mode(output);
@@ -455,7 +455,7 @@ static void
 run_plane_test(data_t *data)
 {
igt_output_t *output;
-   enum igt_plane plane = 1; /* testing with one sprite is enough */
+   int plane = 1; /* testing with one sprite is enough */
int valid_tests = 0;
enum pipe pipe;
 
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 12/33] tests/kms_fence_pin_leak: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_fence_pin_leak.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/kms_fence_pin_leak.c b/tests/kms_fence_pin_leak.c
index 6301e01a..8bbd5563 100644
--- a/tests/kms_fence_pin_leak.c
+++ b/tests/kms_fence_pin_leak.c
@@ -115,7 +115,7 @@ static void run_single_test(data_t *data, enum pipe pipe, 
igt_output_t *output)
igt_output_set_pipe(output, pipe);
 
mode = igt_output_get_mode(output);
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
DRM_FORMAT_XRGB,
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 11/33] tests/kms_fbc_crc: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_fbc_crc.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c
index a696e124..96af06a0 100644
--- a/tests/kms_fbc_crc.c
+++ b/tests/kms_fbc_crc.c
@@ -372,7 +372,7 @@ static bool prepare_test(data_t *data, enum test_mode 
test_mode)
igt_output_t *output = data->output;
igt_pipe_crc_t *pipe_crc;
 
-   data->primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
+   data->primary = igt_output_get_plane_type(data->output, 
DRM_PLANE_TYPE_PRIMARY);
 
create_fbs(data, true, data->fb);
 
@@ -457,10 +457,11 @@ static void finish_crtc(data_t *data, enum test_mode mode)
 static void reset_display(data_t *data)
 {
igt_display_t *display = >display;
-   enum pipe pipe;
+   enum pipe pipe_id;
 
-   for_each_pipe(display, pipe) {
-   igt_plane_t *plane = 
>pipes[pipe].planes[IGT_PLANE_PRIMARY];
+   for_each_pipe(display, pipe_id) {
+igt_pipe_t *pipe = >pipes[pipe_id];
+   igt_plane_t *plane = igt_pipe_get_plane_type(pipe, 
DRM_PLANE_TYPE_PRIMARY);
 
if (plane->fb)
igt_plane_set_fb(plane, NULL);
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 09/33] tests/kms_cursor_crc: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_cursor_crc.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index ff931607..4851e18f 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -92,7 +92,7 @@ static void cursor_enable(data_t *data)
igt_output_t *output = data->output;
igt_plane_t *cursor;
 
-   cursor = igt_output_get_plane(output, IGT_PLANE_CURSOR);
+   cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
igt_plane_set_fb(cursor, >fb);
igt_plane_set_size(cursor, data->curw, data->curh);
 }
@@ -102,7 +102,7 @@ static void cursor_disable(data_t *data)
igt_output_t *output = data->output;
igt_plane_t *cursor;
 
-   cursor = igt_output_get_plane(output, IGT_PLANE_CURSOR);
+   cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
igt_plane_set_fb(cursor, NULL);
 }
 
@@ -120,7 +120,7 @@ static void do_single_test(data_t *data, int x, int y)
/* Hardware test */
igt_paint_test_pattern(cr, data->screenw, data->screenh);
cursor_enable(data);
-   cursor = igt_output_get_plane(data->output, IGT_PLANE_CURSOR);
+   cursor = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_CURSOR);
igt_plane_set_position(cursor, x, y);
igt_display_commit(display);
igt_wait_for_vblank(data->drm_fd, data->pipe);
@@ -174,7 +174,7 @@ static void do_fail_test(data_t *data, int x, int y, int 
expect)
/* Hardware test */
igt_paint_test_pattern(cr, data->screenw, data->screenh);
cursor_enable(data);
-   cursor = igt_output_get_plane(data->output, IGT_PLANE_CURSOR);
+   cursor = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_CURSOR);
igt_plane_set_position(cursor, x, y);
ret = igt_display_try_commit2(display, COMMIT_LEGACY);
 
@@ -301,7 +301,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output,
0.0, 0.0, 0.0,
>primary_fb);
 
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
igt_plane_set_fb(primary, >primary_fb);
 
igt_display_commit(display);
@@ -342,7 +342,7 @@ static void cleanup_crtc(data_t *data, igt_output_t *output)
 
igt_remove_fb(data->drm_fd, >primary_fb);
 
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
igt_plane_set_fb(primary, NULL);
 
igt_output_set_pipe(output, PIPE_ANY);
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 07/33] tests/kms_chv_cursor_fail: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_chv_cursor_fail.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/kms_chv_cursor_fail.c b/tests/kms_chv_cursor_fail.c
index 0158580c..ce6e8df6 100644
--- a/tests/kms_chv_cursor_fail.c
+++ b/tests/kms_chv_cursor_fail.c
@@ -65,7 +65,7 @@ static void cursor_disable(data_t *data)
igt_output_t *output = data->output;
igt_plane_t *cursor;
 
-   cursor = igt_output_get_plane(output, IGT_PLANE_CURSOR);
+   cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
igt_plane_set_fb(cursor, NULL);
 }
 
@@ -242,7 +242,7 @@ static void prepare_crtc(data_t *data)
  LOCAL_DRM_FORMAT_MOD_NONE,
  >primary_fb);
 
-   primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(data->output, 
DRM_PLANE_TYPE_PRIMARY);
igt_plane_set_fb(primary, >primary_fb);
 
igt_display_commit(display);
@@ -277,7 +277,7 @@ static void cleanup_crtc(data_t *data)
 
igt_remove_fb(data->drm_fd, >primary_fb);
 
-   primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(data->output, 
DRM_PLANE_TYPE_PRIMARY);
igt_plane_set_fb(primary, NULL);
 
igt_output_set_pipe(data->output, PIPE_ANY);
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 13/33] tests/kms_flip_event_leak: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_flip_event_leak.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/kms_flip_event_leak.c b/tests/kms_flip_event_leak.c
index f22af0f0..f1a8abd8 100644
--- a/tests/kms_flip_event_leak.c
+++ b/tests/kms_flip_event_leak.c
@@ -50,7 +50,7 @@ static void test(data_t *data, enum pipe pipe, igt_output_t 
*output)
/* select the pipe we want to use */
igt_output_set_pipe(output, pipe);
 
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
mode = igt_output_get_mode(output);
 
igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 15/33] tests/kms_mmap_write_crc: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_mmap_write_crc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/kms_mmap_write_crc.c b/tests/kms_mmap_write_crc.c
index eb8586d1..8a1331cc 100644
--- a/tests/kms_mmap_write_crc.c
+++ b/tests/kms_mmap_write_crc.c
@@ -177,7 +177,7 @@ static void prepare_crtc(data_t *data)
DRM_FORMAT_XRGB, LOCAL_DRM_FORMAT_MOD_NONE,
1.0, 1.0, 1.0, >fb[0]);
 
-   data->primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   data->primary = igt_output_get_plane_type(output, 
DRM_PLANE_TYPE_PRIMARY);
 
igt_plane_set_fb(data->primary, >fb[0]);
igt_display_commit(display);
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 08/33] tests/kms_crtc_background_color: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_crtc_background_color.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/kms_crtc_background_color.c 
b/tests/kms_crtc_background_color.c
index 537d4ce6..d6dd8d90 100644
--- a/tests/kms_crtc_background_color.c
+++ b/tests/kms_crtc_background_color.c
@@ -136,7 +136,7 @@ static void test_crtc_background(data_t *data)
 
igt_output_set_pipe(output, pipe);
 
-   plane = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   plane = igt_output_get_plane_type(output, 
DRM_PLANE_TYPE_PRIMARY);
igt_require(plane->pipe->background_property);
 
prepare_crtc(data, output, pipe, plane, 1, PURPLE, BLACK64);
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 10/33] tests/kms_cursor_legacy: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_cursor_legacy.c | 32 ++--
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index 707546cd..c7083a07 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -166,7 +166,7 @@ static igt_output_t *set_fb_on_crtc(igt_display_t *display, 
int pipe, struct igt
  mode->hdisplay, mode->vdisplay,
  DRM_FORMAT_XRGB, I915_TILING_NONE, fb_info);
 
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(output, 
DRM_PLANE_TYPE_PRIMARY);
igt_plane_set_fb(primary, fb_info);
 
return output;
@@ -180,7 +180,7 @@ static void set_cursor_on_pipe(igt_display_t *display, enum 
pipe pipe, struct ig
igt_plane_t *plane, *cursor = NULL;
 
for_each_plane_on_pipe(display, pipe, plane) {
-   if (!plane->is_cursor)
+   if (plane->type != DRM_PLANE_TYPE_CURSOR)
continue;
 
cursor = plane;
@@ -250,13 +250,14 @@ static enum pipe find_connected_pipe(igt_display_t 
*display, bool second)
return pipe;
 }
 
-static void flip_nonblocking(igt_display_t *display, enum pipe pipe, bool 
atomic, struct igt_fb *fb)
+static void flip_nonblocking(igt_display_t *display, enum pipe pipe_id, bool 
atomic, struct igt_fb *fb)
 {
-   igt_plane_t *primary = >pipes[pipe].planes[IGT_PLANE_PRIMARY];
+   igt_pipe_t *pipe = >pipes[pipe_id];
+   igt_plane_t *primary = igt_pipe_get_plane_type(pipe, 
DRM_PLANE_TYPE_PRIMARY);
 
if (!atomic) {
/* Schedule a nonblocking flip for the next vblank */
-   do_or_die(drmModePageFlip(display->drm_fd, 
display->pipes[pipe].crtc_id, fb->fb_id,
+   do_or_die(drmModePageFlip(display->drm_fd, pipe->crtc_id, 
fb->fb_id,
DRM_MODE_PAGE_FLIP_EVENT, fb));
} else {
igt_plane_set_fb(primary, fb);
@@ -298,12 +299,13 @@ static bool mode_requires_extra_vblank(enum flip_test 
mode)
return false;
 }
 
-static void transition_nonblocking(igt_display_t *display, enum pipe pipe,
+static void transition_nonblocking(igt_display_t *display, enum pipe pipe_id,
   struct igt_fb *prim_fb, struct igt_fb 
*argb_fb,
   bool hide_sprite)
 {
-   igt_plane_t *primary = >pipes[pipe].planes[IGT_PLANE_PRIMARY];
-   igt_plane_t *sprite = >pipes[pipe].planes[IGT_PLANE_2];
+   igt_pipe_t *pipe = >pipes[pipe_id];
+   igt_plane_t *primary = igt_pipe_get_plane_type(pipe, 
DRM_PLANE_TYPE_PRIMARY);
+   igt_plane_t *sprite = igt_pipe_get_plane_type(pipe, 
DRM_PLANE_TYPE_OVERLAY);
 
if (hide_sprite) {
igt_plane_set_fb(primary, prim_fb);
@@ -369,7 +371,7 @@ static void prepare_flip_test(igt_display_t *display,
if (mode == flip_test_atomic_transitions ||
mode == flip_test_atomic_transitions_varying_size) {
igt_require(display->pipes[flip_pipe].n_planes > 1 &&
-   
!display->pipes[flip_pipe].planes[IGT_PLANE_2].is_cursor);
+   display->pipes[flip_pipe].planes[1].type != 
DRM_PLANE_TYPE_CURSOR);
 
igt_create_color_pattern_fb(display->drm_fd, prim_fb->width, 
prim_fb->height,
DRM_FORMAT_ARGB, 0, .1, .1, .1, 
argb_fb);
@@ -868,7 +870,7 @@ static void nonblocking_modeset_vs_cursor(igt_display_t 
*display, int loops)
arg[0].flags |= DRM_MODE_CURSOR_BO;
 
for_each_plane_on_pipe(display, pipe, plane) {
-   if (!plane->is_cursor)
+   if (plane->type != DRM_PLANE_TYPE_CURSOR)
continue;
 
cursor = plane;
@@ -1008,7 +1010,7 @@ static void two_screens_flip_vs_cursor(igt_display_t 
*display, int nloops, bool
 * in the same commit.
 */
 
-   igt_plane_set_fb(igt_output_get_plane(output, 
IGT_PLANE_PRIMARY), _info);
+   igt_plane_set_fb(igt_output_get_plane_type(output, 
DRM_PLANE_TYPE_PRIMARY), _info);
igt_output_set_pipe(output2, (nloops & 1) ? PIPE_NONE : 
pipe2);
igt_display_commit_atomic(display, 
DRM_MODE_ATOMIC_ALLOW_MODESET | DRM_MODE_ATOMIC_NONBLOCK, NULL);
}
@@ -1308,6 +1310,8 @@ static void flip_vs_cursor_busy_crc(igt_display_t 
*display, bool atomic)
unsigned vblank_start;
enum pipe pipe = find_connected_pipe(display, false);
igt_pipe_crc_t *pipe_crc;
+   igt_pipe_t *pipe_connected = 

[Intel-gfx] [PATCH i-g-t v3 06/33] tests/kms_busy: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_busy.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/kms_busy.c b/tests/kms_busy.c
index d2be7212..ea35fb0b 100644
--- a/tests/kms_busy.c
+++ b/tests/kms_busy.c
@@ -53,7 +53,7 @@ set_fb_on_crtc(igt_display_t *dpy, int pipe, struct igt_fb 
*fb)
  LOCAL_I915_FORMAT_MOD_X_TILED,
  fb);
 
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(output, 
DRM_PLANE_TYPE_PRIMARY);
igt_plane_set_fb(primary, fb);
 
return output;
@@ -106,7 +106,7 @@ static void flip_to_fb(igt_display_t *dpy, int pipe,
  dpy->pipes[pipe].crtc_id, 
fb->fb_id,
  DRM_MODE_PAGE_FLIP_EVENT, 
fb));
else {
-   igt_plane_set_fb(igt_output_get_plane(output, 
IGT_PLANE_PRIMARY), fb);
+   igt_plane_set_fb(igt_output_get_plane_type(output, 
DRM_PLANE_TYPE_PRIMARY), fb);
igt_output_set_pipe(output, PIPE_NONE);
igt_display_commit_atomic(dpy,
  DRM_MODE_ATOMIC_NONBLOCK |
@@ -232,7 +232,7 @@ static void test_hang(igt_display_t *dpy, unsigned ring,
 
igt_require((output = set_fb_on_crtc(dpy, pipe, [0])));
igt_display_commit2(dpy, COMMIT_ATOMIC);
-   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
igt_create_pattern_fb(dpy->drm_fd,
  fb[0].width, fb[0].height,
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 05/33] tests/kms_atomic_transition: Add support for dynamic number of planes

2017-01-30 Thread Robert Foss
Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 tests/kms_atomic_transition.c | 27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 851ffc95..5fdb6175 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -120,7 +120,8 @@ static void set_sprite_wh(igt_display_t *display, enum pipe 
pipe,
for_each_plane_on_pipe(display, pipe, plane) {
int i = plane->index;
 
-   if (plane->is_primary || plane->is_cursor)
+   if (plane->type == DRM_PLANE_TYPE_PRIMARY ||
+   plane->type == DRM_PLANE_TYPE_CURSOR)
continue;
 
parms[i].width = w;
@@ -156,20 +157,16 @@ static void setup_parms(igt_display_t *display, enum pipe 
pipe,
for_each_plane_on_pipe(display, pipe, plane) {
int i = plane->index;
 
-   if (plane->is_primary)
+   if (plane->type == DRM_PLANE_TYPE_PRIMARY) {
parms[i].fb = plane->fb;
-   else if (plane->is_cursor)
-   parms[i].fb = argb_fb;
-   else
-   parms[i].fb = sprite_fb;
-
-   if (plane->is_primary) {
parms[i].width = mode->hdisplay;
parms[i].height = mode->vdisplay;
-   } else if (plane->is_cursor) {
+   } else if (plane->type == DRM_PLANE_TYPE_CURSOR) {
+   parms[i].fb = argb_fb;
parms[i].width = cursor_width;
parms[i].height = cursor_height;
-   }
+   } else
+   parms[i].fb = sprite_fb;
}
 
igt_create_fb(display->drm_fd, cursor_width, cursor_height,
@@ -273,7 +270,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, 
igt_output_t *output
drmModeModeInfo *mode, override_mode;
igt_plane_t *plane;
uint32_t iter_max = 1 << display->pipes[pipe].n_planes, i;
-   struct plane_parms parms[IGT_MAX_PLANES];
+   struct plane_parms parms[display->pipes[pipe].n_planes];
bool skip_test = false;
unsigned flags = DRM_MODE_PAGE_FLIP_EVENT;
 
@@ -421,7 +418,8 @@ static unsigned set_combinations(igt_display_t *display, 
unsigned mask, struct i
igt_output_set_pipe(output, PIPE_NONE);
 
for_each_pipe(display, pipe) {
-   igt_plane_t *plane = 
>pipes[pipe].planes[IGT_PLANE_PRIMARY];
+   igt_plane_t *plane = 
igt_pipe_get_plane_type(>pipes[pipe],
+   DRM_PLANE_TYPE_PRIMARY);
drmModeModeInfo *mode = NULL;
 
if (!(mask & (1 << pipe))) {
@@ -462,7 +460,7 @@ static void refresh_primaries(igt_display_t *display)
 
for_each_pipe(display, pipe)
for_each_plane_on_pipe(display, pipe, plane)
-   if (plane->is_primary && plane->fb)
+   if (plane->type == DRM_PLANE_TYPE_PRIMARY && plane->fb)
plane->fb_changed = true;
 }
 
@@ -506,7 +504,8 @@ static void run_modeset_tests(igt_display_t *display, int 
howmany, bool nonblock
DRM_FORMAT_XRGB, 0, .5, .5, .5, 
[1]);
 
for_each_pipe(display, i) {
-   igt_plane_t *plane = 
>pipes[i].planes[IGT_PLANE_PRIMARY];
+   igt_pipe_t *pipe = >pipes[i];
+   igt_plane_t *plane = igt_pipe_get_plane_type(pipe, 
DRM_PLANE_TYPE_PRIMARY);
drmModeModeInfo *mode = NULL;
 
if (is_i915_device(display->drm_fd))
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 04/33] lib/igt_kms: Implement dynamic plane count support

2017-01-30 Thread Robert Foss
In upcoming drm-misc-next changes, the number of planes per pipe has
been increased as more than one primary plane can be associated with
a pipe.

The simple fix for this would be to simply bump hardcoded value for
number of frames per pipe.
But a better solution would be to add support for dynamic number of
planes per pipe to i-g-t.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 lib/igt_kms.c | 160 --
 lib/igt_kms.h |  37 --
 2 files changed, 143 insertions(+), 54 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index a073c8c3..961a3e4d 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -349,7 +349,7 @@ int kmstest_pipe_to_index(char pipe)
  * kmstest_plane_name:
  * @plane: display plane
  *
- * Returns: String represnting @pipe, e.g. "plane1".
+ * Returns: String representing @plane, e.g. "plane1".
  */
 const char *kmstest_plane_name(enum igt_plane plane)
 {
@@ -371,6 +371,25 @@ const char *kmstest_plane_name(enum igt_plane plane)
return names[plane];
 }
 
+/**
+ * kmstest_plane_type_name:
+ * @plane: display plane
+ *
+ * Returns: String representing @plane, e.g. "overlay".
+ */
+const char *kmstest_plane_type_name(int plane_type)
+{
+   static const char *names[] = {
+   [DRM_PLANE_TYPE_OVERLAY] = "overlay",
+   [DRM_PLANE_TYPE_PRIMARY] = "primary",
+   [DRM_PLANE_TYPE_CURSOR] = "cursor",
+   };
+
+   igt_assert(plane_type < ARRAY_SIZE(names) && names[plane_type]);
+
+   return names[plane_type];
+}
+
 static const char *mode_stereo_name(const drmModeModeInfo *mode)
 {
switch (mode->flags & DRM_MODE_FLAG_3D_MASK) {
@@ -1570,14 +1589,17 @@ void igt_display_init(igt_display_t *display, int 
drm_fd)
for (i = 0; i < display->n_pipes; i++) {
igt_pipe_t *pipe = >pipes[i];
igt_plane_t *plane;
-   int p = IGT_PLANE_2;
+   int p = 1;
int j, type;
-   uint8_t n_planes = 0;
+   uint8_t last_plane = 0, n_planes = 0;
uint64_t prop_value;
 
pipe->crtc_id = resources->crtcs[i];
pipe->display = display;
pipe->pipe = i;
+   pipe->plane_cursor = -1;
+   pipe->plane_primary = -1;
+   pipe->planes = NULL;
 
get_crtc_property(display->drm_fd, pipe->crtc_id,
"background_color",
@@ -1603,6 +1625,27 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 
igt_atomic_fill_pipe_props(display, pipe, IGT_NUM_CRTC_PROPS, 
igt_crtc_prop_names);
 
+   /* count number of valid planes */
+   for (j = 0; j < plane_resources->count_planes; j++) {
+   drmModePlane *drm_plane;
+
+   drm_plane = drmModeGetPlane(display->drm_fd,
+   plane_resources->planes[j]);
+   igt_assert(drm_plane);
+
+   if (!(drm_plane->possible_crtcs & (1 << i))) {
+   drmModeFreePlane(drm_plane);
+   continue;
+   }
+
+   n_planes++;
+   }
+
+   igt_assert_lte(0, n_planes);
+   pipe->planes = calloc(sizeof(igt_plane_t), n_planes);
+   igt_assert_f(pipe->planes, "Failed to allocate memory for %d 
planes\n", n_planes);
+   last_plane = n_planes - 1;
+
/* add the planes that can be used with that pipe */
for (j = 0; j < plane_resources->count_planes; j++) {
drmModePlane *drm_plane;
@@ -1620,22 +1663,27 @@ void igt_display_init(igt_display_t *display, int 
drm_fd)
  plane_resources->planes[j]);
switch (type) {
case DRM_PLANE_TYPE_PRIMARY:
-   plane = >planes[IGT_PLANE_PRIMARY];
+   if (pipe->plane_primary == -1) {
+   plane = >planes[0];
+   plane->index = 0;
+   pipe->plane_primary = 0;
+   } else {
+   plane = >planes[p];
+   plane->index = p++;
+   }
plane->is_primary = 1;
-   plane->index = IGT_PLANE_PRIMARY;
break;
case DRM_PLANE_TYPE_CURSOR:
-   /*
-* Cursor should be the highest index in our
-* internal list, but we don't know what that
-  

[Intel-gfx] [PATCH i-g-t v3 03/33] lib/igt_kms: Rename kmstest properties nplanes and plane

2017-01-30 Thread Robert Foss
Rename these properties to have them use the same naming convention
as the igt_*_t structs.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 lib/igt_kms.c| 16 +---
 lib/igt_kms.h|  4 ++--
 tests/kms_plane_lowres.c | 10 +-
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 382b0864..a073c8c3 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1348,11 +1348,13 @@ void kmstest_get_crtc(enum pipe pipe, struct 
kmstest_crtc *crtc)
crtc->active = true;
parse_crtc(tmp, crtc);
 
-   crtc->nplanes = parse_planes(fid, NULL);
-   crtc->plane = calloc(crtc->nplanes, 
sizeof(*crtc->plane));
+   crtc->n_planes = parse_planes(fid, NULL);
+   crtc->planes = calloc(crtc->n_planes, 
sizeof(*crtc->planes));
+   igt_assert_f(crtc->planes, "Failed to allocate 
memory for %d planes\n", crtc->n_planes);
+
fseek(fid, 0, SEEK_END);
fseek(fid, 0, SEEK_SET);
-   parse_planes(fid, crtc->plane);
+   parse_planes(fid, crtc->planes);
 
if (crtc->pipe != pipe)
crtc = NULL;
@@ -1378,14 +1380,14 @@ void igt_assert_plane_visible(enum pipe pipe, bool 
visibility)
kmstest_get_crtc(pipe, );
 
visible = true;
-   for (i = 0; i < crtc.nplanes; i++) {
-   if (crtc.plane[i].type == DRM_PLANE_TYPE_PRIMARY)
+   for (i = 0; i < crtc.n_planes; i++) {
+   if (crtc.planes[i].type == DRM_PLANE_TYPE_PRIMARY)
continue;
 
-   if (crtc.plane[i].pos_x > crtc.width) {
+   if (crtc.planes[i].pos_x > crtc.width) {
visible = false;
break;
-   } else if (crtc.plane[i].pos_y > crtc.height) {
+   } else if (crtc.planes[i].pos_y > crtc.height) {
visible = false;
break;
}
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 635702b6..4e298f89 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -149,8 +149,8 @@ struct kmstest_crtc {
bool active;
int width;
int height;
-   int nplanes;
-   struct kmstest_plane *plane;
+   int n_planes;
+   struct kmstest_plane *planes;
 };
 
 /**
diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
index 858cc482..424ecb97 100644
--- a/tests/kms_plane_lowres.c
+++ b/tests/kms_plane_lowres.c
@@ -181,11 +181,11 @@ test_setup(data_t *data, enum pipe pipe, uint64_t 
modifier, int flags,
igt_output_set_pipe(output, pipe);
 
kmstest_get_crtc(pipe, );
-   igt_skip_on(crtc.nplanes > data->display.pipes[pipe].n_planes);
-   igt_skip_on(crtc.nplanes == 0);
+   igt_skip_on(crtc.n_planes > data->display.pipes[pipe].n_planes);
+   igt_skip_on(crtc.n_planes == 0);
 
-   for (i = 0; i < crtc.nplanes; i++)
-   data->plane[i] = igt_output_get_plane(output, 
crtc.plane[i].index);
+   for (i = 0; i < crtc.n_planes; i++)
+   data->plane[i] = igt_output_get_plane(output, 
crtc.planes[i].index);
 
mode = igt_output_get_mode(output);
 
@@ -198,7 +198,7 @@ test_setup(data_t *data, enum pipe pipe, uint64_t modifier, 
int flags,
igt_plane_set_fb(data->plane[0], >fb[0]);
 
/* yellow sprite plane in lower left corner */
-   for (i = IGT_PLANE_2; i < crtc.nplanes; i++) {
+   for (i = IGT_PLANE_2; i < crtc.n_planes; i++) {
if (data->plane[i]->is_cursor)
size = 64;
else
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 02/33] lib/igt_kms: Avoid depencency on static plane count

2017-01-30 Thread Robert Foss
Rework kmstest_crtc and kmstest_plane structs and their usage
to not depend on a static plane count.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 lib/igt_kms.c | 47 ++-
 lib/igt_kms.h |  4 ++--
 2 files changed, 32 insertions(+), 19 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 188b0ceb..382b0864 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1265,7 +1265,7 @@ static void get_plane(char *str, int type, struct 
kmstest_plane *plane)
int ret;
char buf[256];
 
-   plane->plane = type;
+   plane->type = type;
ret = sscanf(str + 12, "%d%*c %*s %[^n]s",
 >id,
 buf);
@@ -1278,31 +1278,36 @@ static void get_plane(char *str, int type, struct 
kmstest_plane *plane)
igt_assert_eq(ret, 2);
 }
 
-static int parse_planes(FILE *fid, struct kmstest_plane *plane)
+static int parse_planes(FILE *fid, struct kmstest_plane *planes)
 {
char tmp[256];
-   int nplanes;
+   int n_planes;
 
-   nplanes = 0;
+   n_planes = 0;
while (fgets(tmp, 256, fid) != NULL) {
-   igt_assert_neq(nplanes, IGT_MAX_PLANES);
if (strstr(tmp, "type=PRI") != NULL) {
-   get_plane(tmp, DRM_PLANE_TYPE_PRIMARY, [nplanes]);
-   plane[nplanes].index = nplanes;
-   nplanes++;
+   if (planes) {
+   get_plane(tmp, DRM_PLANE_TYPE_PRIMARY, 
[n_planes]);
+   planes[n_planes].index = n_planes;
+   }
+   n_planes++;
} else if (strstr(tmp, "type=OVL") != NULL) {
-   get_plane(tmp, DRM_PLANE_TYPE_OVERLAY, [nplanes]);
-   plane[nplanes].index = nplanes;
-   nplanes++;
+   if (planes) {
+   get_plane(tmp, DRM_PLANE_TYPE_OVERLAY, 
[n_planes]);
+   planes[n_planes].index = n_planes;
+   }
+   n_planes++;
} else if (strstr(tmp, "type=CUR") != NULL) {
-   get_plane(tmp, DRM_PLANE_TYPE_CURSOR, [nplanes]);
-   plane[nplanes].index = nplanes;
-   nplanes++;
+   if (planes) {
+   get_plane(tmp, DRM_PLANE_TYPE_CURSOR, 
[n_planes]);
+   planes[n_planes].index = n_planes;
+   }
+   n_planes++;
break;
}
}
 
-   return nplanes;
+   return n_planes;
 }
 
 static void parse_crtc(char *info, struct kmstest_crtc *crtc)
@@ -1342,7 +1347,12 @@ void kmstest_get_crtc(enum pipe pipe, struct 
kmstest_crtc *crtc)
if (strstr(tmp, "active=yes") != NULL) {
crtc->active = true;
parse_crtc(tmp, crtc);
-   crtc->nplanes = parse_planes(fid, crtc->plane);
+
+   crtc->nplanes = parse_planes(fid, NULL);
+   crtc->plane = calloc(crtc->nplanes, 
sizeof(*crtc->plane));
+   fseek(fid, 0, SEEK_END);
+   fseek(fid, 0, SEEK_SET);
+   parse_planes(fid, crtc->plane);
 
if (crtc->pipe != pipe)
crtc = NULL;
@@ -1368,7 +1378,10 @@ void igt_assert_plane_visible(enum pipe pipe, bool 
visibility)
kmstest_get_crtc(pipe, );
 
visible = true;
-   for (i = IGT_PLANE_2; i < crtc.nplanes; i++) {
+   for (i = 0; i < crtc.nplanes; i++) {
+   if (crtc.plane[i].type == DRM_PLANE_TYPE_PRIMARY)
+   continue;
+
if (crtc.plane[i].pos_x > crtc.width) {
visible = false;
break;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index a6a0d0c4..635702b6 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -135,8 +135,8 @@ struct kmstest_connector_config {
 
 struct kmstest_plane {
int id;
-   int plane;
int index;
+   int type;
int pos_x;
int pos_y;
int width;
@@ -150,7 +150,7 @@ struct kmstest_crtc {
int width;
int height;
int nplanes;
-   struct kmstest_plane plane[IGT_MAX_PLANES];
+   struct kmstest_plane *plane;
 };
 
 /**
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 01/33] lib/igt_kms: Add index property to kmstest_plane struct

2017-01-30 Thread Robert Foss
Add an index property which helps accessing the corresponding
igt_plane_t structure through the igt_*_get_plane() functions.

Signed-off-by: Robert Foss 
Reviewed-by: Mika Kahola 
---
 lib/igt_kms.c| 12 ++--
 lib/igt_kms.h|  1 +
 tests/kms_plane_lowres.c |  2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 35a6bc4d..188b0ceb 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1282,21 +1282,21 @@ static int parse_planes(FILE *fid, struct kmstest_plane 
*plane)
 {
char tmp[256];
int nplanes;
-   int ovl;
 
-   ovl = 0;
nplanes = 0;
while (fgets(tmp, 256, fid) != NULL) {
igt_assert_neq(nplanes, IGT_MAX_PLANES);
if (strstr(tmp, "type=PRI") != NULL) {
-   get_plane(tmp, IGT_PLANE_PRIMARY, [nplanes]);
+   get_plane(tmp, DRM_PLANE_TYPE_PRIMARY, [nplanes]);
+   plane[nplanes].index = nplanes;
nplanes++;
} else if (strstr(tmp, "type=OVL") != NULL) {
-   get_plane(tmp, IGT_PLANE_2 + ovl, [nplanes]);
-   ovl++;
+   get_plane(tmp, DRM_PLANE_TYPE_OVERLAY, [nplanes]);
+   plane[nplanes].index = nplanes;
nplanes++;
} else if (strstr(tmp, "type=CUR") != NULL) {
-   get_plane(tmp, IGT_PLANE_CURSOR, [nplanes]);
+   get_plane(tmp, DRM_PLANE_TYPE_CURSOR, [nplanes]);
+   plane[nplanes].index = nplanes;
nplanes++;
break;
}
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 171df668..a6a0d0c4 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -136,6 +136,7 @@ struct kmstest_connector_config {
 struct kmstest_plane {
int id;
int plane;
+   int index;
int pos_x;
int pos_y;
int width;
diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
index 93aefdaa..858cc482 100644
--- a/tests/kms_plane_lowres.c
+++ b/tests/kms_plane_lowres.c
@@ -185,7 +185,7 @@ test_setup(data_t *data, enum pipe pipe, uint64_t modifier, 
int flags,
igt_skip_on(crtc.nplanes == 0);
 
for (i = 0; i < crtc.nplanes; i++)
-   data->plane[i] = igt_output_get_plane(output, 
crtc.plane[i].plane);
+   data->plane[i] = igt_output_get_plane(output, 
crtc.plane[i].index);
 
mode = igt_output_get_mode(output);
 
-- 
2.11.0.453.g787f75f05

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


[Intel-gfx] [PATCH i-g-t v3 00/33] lib/igt_kms: Implement dynamic plane count support

2017-01-30 Thread Robert Foss
This series implements dynamic plane count support in lib/igt_kms and modifies
all of the tests that rely on a static plane count.

Currently it has has gone through incomplete testing on vc4 (many tests are 
intel only)
and intel (on intel-ci).

This series can be found in the branch dyn_n_planes_$VERSION on:
https://git.collabora.com/cgit/user/robertfoss/intel-gpu-tools.git/


Changes since v2:
 Rebased on upstream/master
 Added "Reviewed-by: Mika Kahola " to all patches

 * igt_kms:
   - Fixed misaligned bracket
 * kms_fbc_crc:
   - Harmonize variable name with the rest of series

 * kms_plane:
   - Fixed misaligned function argument

 * kms_plane_multiple:
   - Increased size of memory allocations
   - Switched malloc to calloc
   - test_fini() skip planes that are NULL
   - test_fini() set free'd plane pointers to NULL
   - test_fini() fix off-by-one in induction variable
   - prepare_planes() make if-else statement more legible

Changes since v1:
 Rebased on upstream/master

 * igt_kms:
  - Added back kmstest_pipe_to_index() declaration
  - Fixed kmstest_plane_type_name() comment
  - Split up dyn n_planes implementation into a an additive part
and a subtractive part to make sure that all tests work at all times
  - Fixed two igt_assert_f's that tested the wrong variable
  - Added igt_assert_f to verify that plane->index never is >= n_planes
during igt_display_init()

 * kms_plane_multiple:
   - Fix printf cast of size_t varibles


Changes since rfc:
 Rebased on upstream/master

 * igt_debugfs:
  - Change read to read at most MAX_LINE_LEN

 * igt_kms:
  - Actually fix typo
  - Removed unused function declaration
  - Set free'd pointer to NULL after free
  - Check allocations for failures
  - Rework kmstest_crtc and kmstest_plane to support dyn n_planes

 * kms_cursor_legacy:
  - Added support for dyn n_planes

 * kms_cursor_legacy:
  - Switch to using for_each_pipe construct

 * kms_plane_lowres:
  - Added support for dyn n_planes

 * kms_plane_multiple:
  - Set free'd pointer to NULL after free
  - Check allocations for failures

Robert Foss (33):
  lib/igt_kms: Add index property to kmstest_plane struct
  lib/igt_kms: Avoid depencency on static plane count
  lib/igt_kms: Rename kmstest properties nplanes and plane
  lib/igt_kms: Implement dynamic plane count support
  tests/kms_atomic_transition: Add support for dynamic number of planes
  tests/kms_busy: Add support for dynamic number of planes
  tests/kms_chv_cursor_fail: Add support for dynamic number of planes
  tests/kms_crtc_background_color: Add support for dynamic number of
planes
  tests/kms_cursor_crc: Add support for dynamic number of planes
  tests/kms_cursor_legacy: Add support for dynamic number of planes
  tests/kms_fbc_crc: Add support for dynamic number of planes
  tests/kms_fence_pin_leak: Add support for dynamic number of planes
  tests/kms_flip_event_leak: Add support for dynamic number of planes
  tests/kms_legacy_colorkey: Add support for dynamic number of planes
  tests/kms_mmap_write_crc: Add support for dynamic number of planes
  tests/kms_mmio_vs_cs_flip: Add support for dynamic number of planes
  tests/kms_panel_fitting: Add support for dynamic number of planes
  tests/kms_pipe_color: Add support for dynamic number of planes
  tests/kms_plane: Add support for dynamic number of planes
  tests/kms_plane_multiple: Add support for dynamic number of planes
  tests/kms_plane_scaling: Add support for dynamic number of planes
  tests/kms_properties: Add support for dynamic number of planes
  tests/kms_psr_sink_crc: Add support for dynamic number of planes
  tests/kms_pwrite_crc: Add support for dynamic number of planes
  tests/kms_rmfb: Add support for dynamic number of planes
  tests/kms_rotation_crc: Add support for dynamic number of planes
  tests/kms_sink_crc_basic: Add support for dynamic number of planes
  tests/kms_universal_plane: Add support for dynamic number of planes
  tests/kms_vblank: Add support for dynamic number of planes
  tests/prime_mmap_kms: Add support for dynamic number of planes
  tests/kms_ccs: Add support for dynamic number of planes
  tests/kms_plane_lowres: Add support for dynamic number of planes
  lib/igt_kms: Remove code obsoleted by dyn n_planes implementation

 lib/igt_kms.c | 215 +++
 lib/igt_kms.h |  40 +++
 tests/kms_atomic_transition.c |  27 +++--
 tests/kms_busy.c  |   6 +-
 tests/kms_ccs.c   |   4 +-
 tests/kms_chv_cursor_fail.c   |   6 +-
 tests/kms_crtc_background_color.c |   2 +-
 tests/kms_cursor_crc.c|  12 +-
 tests/kms_cursor_legacy.c |  32 +++---
 tests/kms_fbc_crc.c   |   9 +-
 tests/kms_fence_pin_leak.c|   2 +-
 tests/kms_flip_event_leak.c   |   2 +-
 tests/kms_legacy_colorkey.c   |   4 +-
 tests/kms_mmap_write_crc.c|   2 +-
 tests/kms_mmio_vs_cs_flip.c   |   6 +-
 

[Intel-gfx] [PATCH v2] drm/i915: Sanity check the computed size and base of stolen memory

2017-01-30 Thread Chris Wilson
Just do a quick check that the stolen memory address range doesn't
overflow our chosen integer type.

v2: Add add_overflows() to utils with the promise that gcc7 can do this
better than C and then maybe it will have a proper definition in core.

Signed-off-by: Chris Wilson 
Cc: Joonas Lahtinen 
---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 2 +-
 drivers/gpu/drm/i915/i915_utils.h  | 7 +++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c 
b/drivers/gpu/drm/i915/i915_gem_stolen.c
index 42bbc4b04fd6..f3abdc27c5dd 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -189,7 +189,7 @@ static dma_addr_t i915_stolen_to_dma(struct 
drm_i915_private *dev_priv)
base = tom - tseg_size - ggtt->stolen_size;
}
 
-   if (base == 0)
+   if (base == 0 || add_overflows(base, ggtt->stolen_size))
return 0;
 
/* make sure we don't clobber the GTT if it's within stolen memory */
diff --git a/drivers/gpu/drm/i915/i915_utils.h 
b/drivers/gpu/drm/i915/i915_utils.h
index 34020873e1f6..69e00c94ee13 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -25,6 +25,13 @@
 #ifndef __I915_UTILS_H
 #define __I915_UTILS_H
 
+#if GCC_VERSION >= 7
+#define add_overflows(A, B) \
+   __builtin_add_overflow_p((A), (B), (typeof((A) + (B)))0)
+#else
+#define add_overflows(A, B) ((A) + (B) < (A))
+#endif
+
 #define range_overflows(start, size, max) ({ \
typeof(start) start__ = (start); \
typeof(size) size__ = (size); \
-- 
2.11.0

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


Re: [Intel-gfx] [PATCH] drm/i915: Sanity check the computed size and base of stolen memory

2017-01-30 Thread Joonas Lahtinen
On ma, 2017-01-30 at 13:15 +, Chris Wilson wrote:
> 
> if (base == 0 || range_overflows(base, ggtt->stolen_size, U64_MAX /* 
> DMA_ADDR_MAX */))
> 
> Bleh.
> 
> #define add_overflows(A, B) __builtin_add_overflow_p((A), (B), (typeof((A) + 
> (B)))0)
> 
> if (base == 0 || add_overflows(base, ggtt->stolen_size))

Looks good.

Regards, Joonas
-- 
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 i-g-t v2] tests: Validate TEST_ONLY correctness against full atomic commit

2017-01-30 Thread Mika Kahola
On Mon, 2017-01-30 at 13:43 +0100, Maarten Lankhorst wrote:
> Op 30-01-17 om 12:37 schreef Mika Kahola:
> > 
> > Validate atomic commit correctness before actual commit.
> > 
> > For: VIZ-6956
> > 
> > v2: Add flag to toggle TEST_ONLY for atomic commit.
> > Remove DRM_MODE_PAGE_FLIP_EVENT flag, if enabled, before trying
> > atomic
> > commit with TEST_ONLY flag (Maarten)
> > 
> > Cc: Maarten Lankhorst 
> > 
> > Signed-off-by: Mika Kahola 
> > 
> Hey,
> 
> Way too complicated, I thought of something like this instead too run
> a whole test with TEST_ONLY.
Ok, let's go with this approach. 

To follow JIRA description for this test I was thinking to add yet
another subtest for each kms_* that tests first with TEST_ONLY flag and
if that fails with -EINVAL then test with the real deal.

> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 77de678e121b..c935203f5b5c 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -2332,7 +2332,23 @@ static int igt_atomic_commit(igt_display_t
> *display, uint32_t flags, void *user_
>   igt_atomic_prepare_connector_commit(output, req);
>   }
>  
> - ret = drmModeAtomicCommit(display->drm_fd, req, flags,
> user_data);
> + if (display->force_test_atomic &&
> + !(flags & DRM_MODE_ATOMIC_TEST_ONLY)) {
> + unsigned int test_flags = flags &
> ~DRM_MODE_PAGE_FLIP_EVENT;
> + int test_ret;
> +
> + test_flags |= DRM_MODE_ATOMIC_TEST_ONLY;
> +
> + test_ret = drmModeAtomicCommit(display->drm_fd, req,
> test_flags, user_data);
> + ret = drmModeAtomicCommit(display->drm_fd, req,
> flags, user_data);
> +
> + if (test_ret)
> + igt_assert_eq(test_ret, ret);
> + else
> + igt_assert(ret != -EINVAL);
> + } else
> + ret = drmModeAtomicCommit(display->drm_fd, req,
> flags, user_data);
> +
>   drmModeAtomicFree(req);
>   return ret;
>  
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 81be77f5a16f..8ac7eb074fe7 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -335,7 +335,7 @@ struct igt_display {
>   igt_output_t *outputs;
>   igt_pipe_t *pipes;
>   bool has_cursor_plane;
> - bool is_atomic;
> + bool is_atomic, force_test_atomic;
>  };
>  
>  void igt_display_init(igt_display_t *display, int drm_fd);
> 
-- 
Mika Kahola - Intel OTC

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


Re: [Intel-gfx] [PATCH v2 2/3] drm/i915: Mark the kernel as tainted if we fail the preproduction check

2017-01-30 Thread Chris Wilson
On Mon, Jan 30, 2017 at 02:31:57PM +0200, Joonas Lahtinen wrote:
> On ma, 2017-01-30 at 10:44 +, Chris Wilson wrote:
> > Preproduction sdv are not supported beyond the release of production
> > hardware, and continued use is ill-advised. Mark the kernel as tainted
> > to reinforce the error.
> > 
> > Signed-off-by: Chris Wilson 
> > Cc: "Zanoni, Paulo R" 
> > Cc: Rodrigo Vivi 
> > Cc: Jani Nikula 
> > Cc: Ville Syrjälä 
> > Acked-by: Jani Nikula 
> 
> Correct use of taint flags. I think CPU_OUT_OF_SPEC could be more
> correct flag, though?

No idea. I figure that our usage will be spotted one day and we will be
told which one to use, maybe even a new taint.

On x86 CPU_OUT_OF_SPEC is used if the user forces pae, sounds reasonable
but I wanted not to imply that this was a CPU issue itself, but relates
to out-of-spec GPU. MCE was broader and can be triggered by other
components failing.
-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: success for drm/i915: use variadic macros and arrays to choose port/pipe based registers

2017-01-30 Thread Patchwork
== Series Details ==

Series: drm/i915: use variadic macros and arrays to choose port/pipe based 
registers
URL   : https://patchwork.freedesktop.org/series/18691/
State : success

== Summary ==

Series 18691v1 drm/i915: use variadic macros and arrays to choose port/pipe 
based registers
https://patchwork.freedesktop.org/api/1.0/series/18691/revisions/1/mbox/

Test kms_pipe_crc_basic:
Subgroup nonblocking-crc-pipe-b-frame-sequence:
dmesg-warn -> PASS   (fi-snb-2520m)

fi-bdw-5557u total:246  pass:232  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050 total:246  pass:207  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205 total:246  pass:224  dwarn:0   dfail:0   fail:0   skip:22 
fi-bxt-t5700 total:78   pass:65   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900 total:246  pass:219  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820 total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770  total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-ivb-3520m total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-ivb-3770  total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u total:246  pass:223  dwarn:0   dfail:0   fail:2   skip:21 
fi-skl-6260u total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hqtotal:246  pass:226  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k total:246  pass:221  dwarn:4   dfail:0   fail:0   skip:21 
fi-skl-6770hqtotal:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2520m total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-snb-2600  total:246  pass:214  dwarn:0   dfail:0   fail:0   skip:32 

dc47d8d6ed4ea669aeccad104fde843fe039b9a5 drm-tip: 2017y-01m-30d-09h-12m-47s UTC 
integration manifest
39ff6fc1 drm/i915: use variadic macros and arrays to choose port/pipe based 
registers

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3635/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] tools: rename intel_bios_reader to intel_vbt_decode

2017-01-30 Thread Ville Syrjälä
On Mon, Jan 30, 2017 at 10:00:54AM +0200, Jani Nikula wrote:
> On Tue, 24 Jan 2017, Jani Nikula  wrote:
> > After all these years intel_bios_reader and intel_bios_dumper still
> > manage to confuse me. Read or dump, which one decodes. Rename
> > intel_bios_reader to intel_vbt_decode to be in line with the naming of
> > all the other tools (particularly the closely related
> > intel_opregion_decode tool) that decode previously gathered or dumped
> > information.
> >
> > Signed-off-by: Jani Nikula 
> 
> Pushed patches 1-5 because they were trivial and I don't expect anyone
> to care.
> 
> How about this one? I don't dare push without acks on the change.

You're not alone in your confusion. I routinely end up trying to use
the wrong tool. So I for one welcome this change.

Acked-by: Ville Syrjälä 

> 
> BR,
> Jani.
> 
> >
> > ---
> >
> > Patch 6/6 with -M option.
> > ---
> >  man/Makefile.am |  4 ++--
> >  man/intel_bios_dumper.rst   |  2 +-
> >  man/{intel_bios_reader.rst => intel_vbt_decode.rst} | 10 +-
> >  tools/.gitignore|  2 +-
> >  tools/Makefile.sources  |  6 +++---
> >  tools/intel_opregion_decode.c   |  2 +-
> >  tools/{intel_bios_reader.c => intel_vbt_decode.c}   |  0
> >  7 files changed, 13 insertions(+), 13 deletions(-)
> >  rename man/{intel_bios_reader.rst => intel_vbt_decode.rst} (89%)
> >  rename tools/{intel_bios_reader.c => intel_vbt_decode.c} (100%)
> >
> > diff --git a/man/Makefile.am b/man/Makefile.am
> > index e40e2e931ada..0098fa45a618 100644
> > --- a/man/Makefile.am
> > +++ b/man/Makefile.am
> > @@ -3,7 +3,6 @@ appman_RST =\
> > intel_aubdump.rst   \
> > intel_audio_dump.rst\
> > intel_bios_dumper.rst   \
> > -   intel_bios_reader.rst   \
> > intel_error_decode.rst  \
> > intel_gpu_frequency.rst \
> > intel_gpu_top.rst   \
> > @@ -16,7 +15,8 @@ appman_RST =  \
> > intel_upload_blit_large.rst \
> > intel_upload_blit_large_gtt.rst \
> > intel_upload_blit_large_map.rst \
> > -   intel_upload_blit_small.rst
> > +   intel_upload_blit_small.rst \
> > +   intel_vbt_decode.rst
> >  
> >  if HAVE_RST2MAN
> >  appman_DATA = $(appman_RST:rst=$(APP_MAN_SUFFIX))
> > diff --git a/man/intel_bios_dumper.rst b/man/intel_bios_dumper.rst
> > index 89e0001a70f7..b271b9b1afef 100644
> > --- a/man/intel_bios_dumper.rst
> > +++ b/man/intel_bios_dumper.rst
> > @@ -33,4 +33,4 @@ Report bugs to https://bugs.freedesktop.org.
> >  SEE ALSO
> >  
> >  
> > -**intel_bios_reader(1)**
> > +**intel_vbt_decode(1)**
> > diff --git a/man/intel_bios_reader.rst b/man/intel_vbt_decode.rst
> > similarity index 89%
> > rename from man/intel_bios_reader.rst
> > rename to man/intel_vbt_decode.rst
> > index 0e935904bcfb..a8d36d500b6d 100644
> > --- a/man/intel_bios_reader.rst
> > +++ b/man/intel_vbt_decode.rst
> > @@ -1,6 +1,6 @@
> > -=
> > -intel_bios_reader
> > -=
> > +
> > +intel_vbt_decode
> > +
> >  
> >  -
> >  Intel Video BIOS Table parser
> > @@ -16,12 +16,12 @@ Intel Video BIOS Table parser
> >  SYNOPSIS
> >  
> >  
> > -**intel_bios_reader** [*OPTIONS*]
> > +**intel_vbt_decode** [*OPTIONS*]
> >  
> >  DESCRIPTION
> >  ===
> >  
> > -**intel_bios_reader** is a tool to parse the Intel Video BIOS Tables (VBT) 
> > and
> > +**intel_vbt_decode** is a tool to parse the Intel Video BIOS Tables (VBT) 
> > and
> >  present the information in a human readable format.
> >  
> >  The preferred ways of getting the binary VBT to parse are:
> > diff --git a/tools/.gitignore b/tools/.gitignore
> > index 13825a3c9a74..7f5de26f1d07 100644
> > --- a/tools/.gitignore
> > +++ b/tools/.gitignore
> > @@ -5,7 +5,7 @@ intel_aubdump
> >  intel_audio_dump
> >  intel_backlight
> >  intel_bios_dumper
> > -intel_bios_reader
> > +intel_vbt_decode
> >  intel_display_crc
> >  intel_display_poller
> >  intel_dump_decode
> > diff --git a/tools/Makefile.sources b/tools/Makefile.sources
> > index e2451ea1272c..2c41afffea39 100644
> > --- a/tools/Makefile.sources
> > +++ b/tools/Makefile.sources
> > @@ -10,7 +10,6 @@ tools_prog_lists =\
> > intel_reg   \
> > intel_backlight \
> > intel_bios_dumper   \
> > -   intel_bios_reader   \
> > intel_display_crc   \
> > intel_display_poller\
> > intel_forcewaked\
> > @@ -28,6 +27,7 @@ tools_prog_lists =\
> > intel_reg_checker   \
> > intel_residency \
> > intel_stepping  \
> > +   intel_vbt_decode\
> > intel_watermark \
> > intel_gem_info  \
> 

Re: [Intel-gfx] [PATCH v2 1/3] drm/i915: Make intel_detect_preproduction_hw easier to extend

2017-01-30 Thread Chris Wilson
On Mon, Jan 30, 2017 at 03:11:07PM +0200, Jani Nikula wrote:
> On Mon, 30 Jan 2017, Joonas Lahtinen  wrote:
> > On ma, 2017-01-30 at 10:44 +, Chris Wilson wrote:
> >> As we add new generations, we should keep detecting new pre-production
> >> system development platforms that were temporarily enabled to facilitate
> >> initial development and now superseded by production systems. To make
> >> it easier to add more platforms, split the if into a series of logical
> >> operations.
> >> 
> >> v2: s/sdv/pre/ - not all system development vehicles are for
> >> preproduction usage.
> >> 
> >> Signed-off-by: Chris Wilson 
> >> Cc: "Zanoni, Paulo R" 
> >> Cc: Rodrigo Vivi 
> >> Cc: Jani Nikula 
> >> Cc: Ville Syrjälä 
> >
> > 
> >
> >>  static void intel_detect_preproduction_hw(struct drm_i915_private 
> >> *dev_priv)
> >>  {
> >> -  if (IS_HSW_EARLY_SDV(dev_priv) ||
> >> -  IS_SKL_REVID(dev_priv, 0, SKL_REVID_F0))
> >> +  bool pre = false;
> >> +
> >> +  pre |= IS_HSW_EARLY_SDV(dev_priv);
> >> +  pre |= IS_SKL_REVID(dev_priv, 0, SKL_REVID_F0);
> >
> > Did you compare the asm with "pre = pre || ..."?
> 
> Yeah, this definitely needs to be optimized. :p

Thank goodness it makes no difference!
-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


  1   2   >