Re: [Intel-gfx] [PATCH 02/15] drm: Remove drm_modeset_(un)lock_crtc

2017-04-03 Thread Daniel Vetter
On Tue, Apr 4, 2017 at 12:13 AM, kbuild test robot  wrote:
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improve the system]

It should compile just fine on latest linux-next (if there is one)
where this code in vmwgfx is already removed. Well you just need the
latest drm-next from Dave Airlie.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v5 3/5] drm/dp: Add DP MST helpers to atomically find and release vcpi slots

2017-04-03 Thread Pandiyan, Dhinakaran
On Thu, 2017-03-30 at 01:42 -0700, Dhinakaran Pandiyan wrote:
> From: "Pandiyan, Dhinakaran" 
> 
> drm_dp_atomic_find_vcpi_slots() should be called from ->atomic_check() to
> check there are sufficient vcpi slots for a mode and to add that to the
> state. This should be followed by a call to drm_dp_mst_allocate_vcpi()
> in ->atomic_commit() to initialize a struct vcpi for the port.
> 
> drm_dp_atomic_release_vcpi_slots() should be called from
> ->atomic_check() to release a port's vcpi slot allocation from the
> state.
> 
> Drivers that do not make use of this atomic helper are expected to call
> drm_dp_find_vcpi_slots() instead before calling
> drm_dp_mst_allocate_vcpi().
> 
> v2:
> Added checks for verifying the port reference is valid
> Moved get_mst_topology_state() into the helpers (Daniel)
> Changed find_vcpi_slots() to not depend on current allocation
> 
> Cc: Daniel Vetter 
> Cc: Maarten Lankhorst 
> Cc: Archit Taneja 
> Cc: Chris Wilson 
> Cc: Harry Wentland 
> Reviewed-by: Maarten Lankhorst 
> Signed-off-by: Dhinakaran Pandiyan 
> ---
>  drivers/gpu/drm/drm_dp_mst_topology.c | 75 
> +++
>  include/drm/drm_dp_mst_helper.h   |  6 +++
>  2 files changed, 81 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
> b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 0ad0baa..9f3954e 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -2498,6 +2498,81 @@ static int drm_dp_init_vcpi(struct 
> drm_dp_mst_topology_mgr *mgr,
>  }
>  
>  /**
> + * drm_dp_atomic_find_vcpi_slots() - Find and add vcpi slots to the state
> + * @state: global atomic state
> + * @mgr: MST topology manager for the port
> + * @port: port to find vcpi slots for
> + * @pbn: bandwidth required for the mode in PBN
> + *
> + * RETURNS:
> + * Total slots in the atomic state assigned for this port or error
> + */
> +int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,
> +   struct drm_dp_mst_topology_mgr *mgr,
> +   struct drm_dp_mst_port *port, int pbn)
> +{
> + struct drm_dp_mst_topology_state *topology_state;
> + int req_slots;
> +
> + topology_state = drm_atomic_get_mst_topology_state(state, mgr);
> + if (topology_state == NULL)
> + return -ENOMEM;
> +
> + port = drm_dp_get_validated_port_ref(mgr, port);
> + if (port == NULL)
> + return -EINVAL;
> + req_slots = DIV_ROUND_UP(pbn, mgr->pbn_div);
> + DRM_DEBUG_KMS("vcpi slots req=%d, avail=%d\n",
> + req_slots, topology_state->avail_slots);
> +
> + if (req_slots > topology_state->avail_slots) {
> + drm_dp_put_port(port);
> + return -ENOSPC;
> + }
> +
> + topology_state->avail_slots -= req_slots;
> + DRM_DEBUG_KMS("vcpi slots avail=%d", topology_state->avail_slots);
> +
> + drm_dp_put_port(port);
> + return req_slots;
> +}
> +EXPORT_SYMBOL(drm_dp_atomic_find_vcpi_slots);
> +
> +/**
> + * drm_dp_atomic_release_vcpi_slots() - Release allocated vcpi slots
> + * @state: global atomic state
> + * @mgr: MST topology manager for the port
> + * @port: port to release the vcpi slots for
> + *
> + * RETURNS:
> + * Number of slots released from the atomic state for this port
> + */
> +int drm_dp_atomic_release_vcpi_slots(struct drm_atomic_state *state,
> +  struct drm_dp_mst_topology_mgr *mgr,
> +  struct drm_dp_mst_port *port)
> +{
> + struct drm_dp_mst_topology_state *topology_state;
> + int curr_slots;
> +
> + topology_state = drm_atomic_get_mst_topology_state(state, mgr);
> + if (topology_state == NULL)
> + return -ENOMEM;
> +
> + port = drm_dp_get_validated_port_ref(mgr, port);
> + if (port == NULL)
> + return -EINVAL;
> +
> + curr_slots = port->vcpi.num_slots;

This is a problem if the port has been destroyed.

> + topology_state->avail_slots += curr_slots;
> + DRM_DEBUG_KMS("vcpi slots released=%d, avail=%d\n",
> + curr_slots, topology_state->avail_slots);
> +
> + drm_dp_put_port(port);
> + return curr_slots;
> +}

Should we do this instead?

int drm_dp_atomic_release_vcpi_slots(struct drm_atomic_state *state,
struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_port *port, int
slots)
{
   struct drm_dp_mst_topology_state *topology_state;

   topology_state = drm_atomic_get_mst_topology_state(state, mgr);
   if (topology_state == NULL)
   return -ENOMEM;

   /* We cannot rely on port->vcpi.num_slots to update
* 

Re: [Intel-gfx] [PATCH 18/19] drm: Add acquire ctx parameter to ->set_config

2017-04-03 Thread Sinclair Yeh

I missed this one, and looks like it's already in.  So a belated:
Reviewed-by: Sinclair Yeh 

for the vmwgfx part

On Wed, Mar 22, 2017 at 10:50:57PM +0100, Daniel Vetter wrote:
> Surprisingly a lot of legacy drivers roll their own, for
> runtime pm and because vmwgfx.
> 
> Also make nouveau's set_config static while at it.
> 
> Cc: Sinclair Yeh 
> Cc: Thomas Hellstrom 
> Cc: Ben Skeggs 
> Cc: Patrik Jakobsson 
> Cc: Alex Deucher 
> Cc: Christian König 
> 
> Signed-off-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 5 +++--
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h| 3 ++-
>  drivers/gpu/drm/drm_atomic_helper.c | 4 +++-
>  drivers/gpu/drm/drm_crtc.c  | 2 +-
>  drivers/gpu/drm/drm_crtc_helper.c   | 4 +++-
>  drivers/gpu/drm/drm_plane_helper.c  | 2 +-
>  drivers/gpu/drm/gma500/gma_display.c| 7 ---
>  drivers/gpu/drm/gma500/gma_display.h| 3 ++-
>  drivers/gpu/drm/nouveau/dispnv04/crtc.c | 7 ---
>  drivers/gpu/drm/nouveau/nouveau_display.h   | 1 -
>  drivers/gpu/drm/radeon/radeon_display.c | 5 +++--
>  drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 3 ++-
>  drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c| 3 ++-
>  drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c| 3 ++-
>  include/drm/drm_atomic_helper.h | 3 ++-
>  include/drm/drm_crtc.h  | 3 ++-
>  include/drm/drm_crtc_helper.h   | 3 ++-
>  17 files changed, 38 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 7b4fe91d3aec..ce15721cadda 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -333,7 +333,8 @@ int amdgpu_crtc_page_flip_target(struct drm_crtc *crtc,
>   return 0;
>  }
>  
> -int amdgpu_crtc_set_config(struct drm_mode_set *set)
> +int amdgpu_crtc_set_config(struct drm_mode_set *set,
> +struct drm_modeset_acquire_ctx *ctx)
>  {
>   struct drm_device *dev;
>   struct amdgpu_device *adev;
> @@ -350,7 +351,7 @@ int amdgpu_crtc_set_config(struct drm_mode_set *set)
>   if (ret < 0)
>   return ret;
>  
> - ret = drm_crtc_helper_set_config(set);
> + ret = drm_crtc_helper_set_config(set, ctx);
>  
>   list_for_each_entry(crtc, >mode_config.crtc_list, head)
>   if (crtc->enabled)
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> index d19b803ba509..20d6522fd7b4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> @@ -593,7 +593,8 @@ int amdgpu_align_pitch(struct amdgpu_device *adev, int 
> width, int bpp, bool tile
>  /* amdgpu_display.c */
>  void amdgpu_print_display_setup(struct drm_device *dev);
>  int amdgpu_modeset_create_props(struct amdgpu_device *adev);
> -int amdgpu_crtc_set_config(struct drm_mode_set *set);
> +int amdgpu_crtc_set_config(struct drm_mode_set *set,
> +struct drm_modeset_acquire_ctx *ctx);
>  int amdgpu_crtc_page_flip_target(struct drm_crtc *crtc,
>struct drm_framebuffer *fb,
>struct drm_pending_vblank_event *event,
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
> b/drivers/gpu/drm/drm_atomic_helper.c
> index 08d10abcece0..b502e2809ebd 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2266,6 +2266,7 @@ static int update_output_state(struct drm_atomic_state 
> *state,
>  /**
>   * drm_atomic_helper_set_config - set a new config from userspace
>   * @set: mode set configuration
> + * @ctx: lock acquisition context
>   *
>   * Provides a default crtc set_config handler using the atomic driver 
> interface.
>   *
> @@ -2278,7 +2279,8 @@ static int update_output_state(struct drm_atomic_state 
> *state,
>   * Returns:
>   * Returns 0 on success, negative errno numbers on failure.
>   */
> -int drm_atomic_helper_set_config(struct drm_mode_set *set)
> +int drm_atomic_helper_set_config(struct drm_mode_set *set,
> +  struct drm_modeset_acquire_ctx *ctx)
>  {
>   struct drm_atomic_state *state;
>   struct drm_crtc *crtc = set->crtc;
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index bfaa0e769ea6..3fe1ec23c87e 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -462,7 +462,7 @@ static int __drm_mode_set_config_internal(struct 
> drm_mode_set *set,
>  
>   fb = set->fb;
>  
> - ret = crtc->funcs->set_config(set);
> + ret = crtc->funcs->set_config(set, ctx);
>   if (ret == 0) {
>   crtc->primary->crtc = crtc;
>   

[Intel-gfx] ✓ Fi.CI.BAT: success for drm: Add DPCD definitions for DP 1.4 DSC feature (rev5)

2017-04-03 Thread Patchwork
== Series Details ==

Series: drm: Add DPCD definitions for DP 1.4 DSC feature (rev5)
URL   : https://patchwork.freedesktop.org/series/19666/
State : success

== Summary ==

Series 19666v5 drm: Add DPCD definitions for DP 1.4 DSC feature
https://patchwork.freedesktop.org/api/1.0/series/19666/revisions/5/mbox/

Test gem_exec_suspend:
Subgroup basic-s4-devices:
pass   -> DMESG-WARN (fi-kbl-7560u) fdo#100125

fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125

fi-bdw-5557u total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  
time: 430s
fi-bdw-gvtdvmtotal:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  
time: 425s
fi-bsw-n3050 total:278  pass:239  dwarn:0   dfail:0   fail:0   skip:39  
time: 583s
fi-bxt-j4205 total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  
time: 508s
fi-bxt-t5700 total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  
time: 551s
fi-byt-j1900 total:278  pass:251  dwarn:0   dfail:0   fail:0   skip:27  
time: 487s
fi-byt-n2820 total:278  pass:247  dwarn:0   dfail:0   fail:0   skip:31  
time: 494s
fi-hsw-4770  total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  
time: 402s
fi-hsw-4770r total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  
time: 405s
fi-ilk-650   total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  
time: 422s
fi-ivb-3520m total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time: 485s
fi-ivb-3770  total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time: 477s
fi-kbl-7500u total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time: 456s
fi-kbl-7560u total:278  pass:267  dwarn:1   dfail:0   fail:0   skip:10  
time: 566s
fi-skl-6260u total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time: 457s
fi-skl-6700hqtotal:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  
time: 570s
fi-skl-6700k total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  
time: 456s
fi-skl-6770hqtotal:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time: 491s
fi-skl-gvtdvmtotal:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  
time: 432s
fi-snb-2520m total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  
time: 533s
fi-snb-2600  total:278  pass:248  dwarn:0   dfail:0   fail:1   skip:29  
time: 406s

5bc82ec7f62322a91ecf48fa966e68c876637fcd drm-tip: 2017y-04m-03d-16h-44m-48s UTC 
integration manifest
fd63abe drm: Add DPCD definitions for DP 1.4 DSC feature

== Logs ==

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


[Intel-gfx] [PATCH v4] drm: Add DPCD definitions for DP 1.4 DSC feature

2017-04-03 Thread Manasi Navare
From: "Navare, Manasi D" 

Display stream compression is supported on DP 1.4 DP
devices. This patch adds the corersponding DPCD
register definitions for DSC.

v4:
* Add DSC Enable DPCD register def (Ander)
v3:
* Add some SHIFTS and MASKS for uniformity (Jani Nikula)
v2:
* Rebased on drm-tip

Signed-off-by: Manasi Navare 
Cc: Jani Nikula 
Cc: Paulo Zanoni 
Cc: dri-de...@lists.freedesktop.org
---
 include/drm/drm_dp_helper.h | 107 
 1 file changed, 107 insertions(+)

diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index c0bd0d7..f6258ed 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -179,6 +179,111 @@
 
 #define DP_GUID0x030   /* 1.2 */
 
+#define DP_DSC_SUPPORT  0x060   /* DP 1.4 */
+# define DP_DSC_DECOMPRESSION_IS_SUPPORTED  (1 << 0)
+
+#define DP_DSC_REV  0x061
+# define DP_DSC_MAJOR_MASK  (0xf << 0)
+# define DP_DSC_MINOR_MASK  (0xf << 4)
+# define DP_DSC_MAJOR_SHIFT 0
+# define DP_DSC_MINOR_SHIFT 4
+
+#define DP_DSC_RC_BUF_BLK_SIZE  0x062
+# define DP_DSC_RC_BUF_BLK_SIZE_1   0x0
+# define DP_DSC_RC_BUF_BLK_SIZE_4   0x1
+# define DP_DSC_RC_BUF_BLK_SIZE_16  0x2
+# define DP_DSC_RC_BUF_BLK_SIZE_64  0x3
+
+#define DP_DSC_RC_BUF_SIZE  0x063
+
+#define DP_DSC_SLICE_CAP_1  0x064
+# define DP_DSC_1_PER_DP_DSC_SINK   (1 << 0)
+# define DP_DSC_2_PER_DP_DSC_SINK   (1 << 1)
+# define DP_DSC_4_PER_DP_DSC_SINK   (1 << 3)
+# define DP_DSC_6_PER_DP_DSC_SINK   (1 << 4)
+# define DP_DSC_8_PER_DP_DSC_SINK   (1 << 5)
+# define DP_DSC_10_PER_DP_DSC_SINK  (1 << 6)
+# define DP_DSC_12_PER_DP_DSC_SINK  (1 << 7)
+
+#define DP_DSC_LINE_BUF_BIT_DEPTH   0x065
+# define DP_DSC_LINE_BUF_BIT_DEPTH_MASK (0xf << 0)
+# define DP_DSC_LINE_BUF_BIT_DEPTH_90x0
+# define DP_DSC_LINE_BUF_BIT_DEPTH_10   0x1
+# define DP_DSC_LINE_BUF_BIT_DEPTH_11   0x2
+# define DP_DSC_LINE_BUF_BIT_DEPTH_12   0x3
+# define DP_DSC_LINE_BUF_BIT_DEPTH_13   0x4
+# define DP_DSC_LINE_BUF_BIT_DEPTH_14   0x5
+# define DP_DSC_LINE_BUF_BIT_DEPTH_15   0x6
+# define DP_DSC_LINE_BUF_BIT_DEPTH_16   0x7
+# define DP_DSC_LINE_BUF_BIT_DEPTH_80x8
+
+#define DP_DSC_BLK_PREDICTION_SUPPORT   0x066
+# define DP_DSC_BLK_PREDICTION_IS_SUPPORTED (1 << 0)
+
+#define DP_DSC_MAX_BITS_PER_PIXEL_LOW   0x067   /* eDP 1.4 */
+
+#define DP_DSC_MAX_BITS_PER_PIXEL_HI0x068   /* eDP 1.4 */
+
+#define DP_DSC_DEC_COLOR_FORMAT_CAP 0x069
+# define DP_DSC_RGB (1 << 0)
+# define DP_DSC_YCbCr444(1 << 1)
+# define DP_DSC_YCbCr422_Simple (1 << 2)
+# define DP_DSC_YCbCr422_Native (1 << 3)
+# define DP_DSC_YCbCr420_Native (1 << 4)
+
+#define DP_DSC_DEC_COLOR_DEPTH_CAP  0x06A
+# define DP_DSC_8_BPC   (1 << 1)
+# define DP_DSC_10_BPC  (1 << 2)
+# define DP_DSC_12_BPC  (1 << 3)
+
+#define DP_DSC_PEAK_THROUGHPUT  0x06B
+# define DP_DSC_THROUGHPUT_MODE_0_MASK  (0xf << 0)
+# define DP_DSC_THROUGHPUT_MODE_0_SHIFT 0
+# define DP_DSC_THROUGHPUT_MODE_0_340   (1 << 0)
+# define DP_DSC_THROUGHPUT_MODE_0_400   (2 << 0)
+# define DP_DSC_THROUGHPUT_MODE_0_450   (3 << 0)
+# define DP_DSC_THROUGHPUT_MODE_0_500   (4 << 0)
+# define DP_DSC_THROUGHPUT_MODE_0_550   (5 << 0)
+# define DP_DSC_THROUGHPUT_MODE_0_600   (6 << 0)
+# define DP_DSC_THROUGHPUT_MODE_0_650   (7 << 0)
+# define DP_DSC_THROUGHPUT_MODE_0_700   (8 << 0)
+# define DP_DSC_THROUGHPUT_MODE_0_750   (9 << 0)
+# define DP_DSC_THROUGHPUT_MODE_0_800   (10 << 0)
+# define DP_DSC_THROUGHPUT_MODE_0_850   (11 << 0)
+# define DP_DSC_THROUGHPUT_MODE_0_900   (12 << 0)
+# define DP_DSC_THROUGHPUT_MODE_0_950   (13 << 0)
+# define DP_DSC_THROUGHPUT_MODE_0_1000  (14 << 0)
+# define DP_DSC_THROUGHPUT_MODE_1_MASK  (0xf << 4)
+# define DP_DSC_THROUGHPUT_MODE_1_SHIFT 4
+# define DP_DSC_THROUGHPUT_MODE_1_340   (1 << 4)
+# define DP_DSC_THROUGHPUT_MODE_1_400   (2 << 4)
+# define DP_DSC_THROUGHPUT_MODE_1_450   (3 << 4)
+# define DP_DSC_THROUGHPUT_MODE_1_500   (4 << 4)
+# define DP_DSC_THROUGHPUT_MODE_1_550   (5 << 4)
+# define DP_DSC_THROUGHPUT_MODE_1_600   (6 << 4)
+# define DP_DSC_THROUGHPUT_MODE_1_650   (7 << 4)
+# define DP_DSC_THROUGHPUT_MODE_1_700   (8 << 4)
+# define DP_DSC_THROUGHPUT_MODE_1_750   (9 << 4)
+# define DP_DSC_THROUGHPUT_MODE_1_800   (10 << 4)
+# define DP_DSC_THROUGHPUT_MODE_1_850   (11 << 4)
+# define DP_DSC_THROUGHPUT_MODE_1_900   (12 

Re: [Intel-gfx] [PATCH v3] drm: Add DPCD definitions for DP 1.4 DSC feature

2017-04-03 Thread Manasi Navare
On Thu, Mar 16, 2017 at 03:47:46PM +0200, Ander Conselvan De Oliveira wrote:
> On Tue, 2017-03-14 at 13:01 -0700, Manasi Navare wrote:
> > From: "Navare, Manasi D" 
> > 
> > Display stream compression is supported on DP 1.4 DP
> > devices. This patch adds the corersponding DPCD
> > register definitions for DSC.
> > 
> > v3:
> > * Add some SHIFTS and MASKS for uniformity (Jani Nikula)
> > v2:
> > * Rebased on drm-tip
> > 
> > Signed-off-by: Manasi Navare 
> > Cc: Jani Nikula 
> > Cc: Paulo Zanoni 
> > Cc: dri-de...@lists.freedesktop.org
> > ---
> >  include/drm/drm_dp_helper.h | 105 
> > 
> >  1 file changed, 105 insertions(+)
> > 
> > diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
> > index c0bd0d7..e1fb04f 100644
> > --- a/include/drm/drm_dp_helper.h
> > +++ b/include/drm/drm_dp_helper.h
> > @@ -179,6 +179,111 @@
> >  
> >  #define DP_GUID0x030   /* 1.2 */
> >  
> > +#define DP_DSC_SUPPORT  0x060   /* DP 1.4 */
> > +# define DP_DSC_DECOMPRESSION_IS_SUPPORTED  (1 << 0)
> > +
> > +#define DP_DSC_REV  0x061
> > +# define DP_DSC_MAJOR_MASK  (0xf << 0)
> > +# define DP_DSC_MINOR_MASK  (0xf << 4)
> > +# define DP_DSC_MAJOR_SHIFT 0
> > +# define DP_DSC_MINOR_SHIFT 4
> > +
> > +#define DP_DSC_RC_BUF_BLK_SIZE  0x062
> > +# define DP_DSC_RC_BUF_BLK_SIZE_1   0x0
> > +# define DP_DSC_RC_BUF_BLK_SIZE_4   0x1
> > +# define DP_DSC_RC_BUF_BLK_SIZE_16  0x2
> > +# define DP_DSC_RC_BUF_BLK_SIZE_64  0x3
> > +
> > +#define DP_DSC_RC_BUF_SIZE  0x063
> > +
> > +#define DP_DSC_SLICE_CAP_1  0x064
> > +# define DP_DSC_1_PER_DP_DSC_SINK   (1 << 0)
> > +# define DP_DSC_2_PER_DP_DSC_SINK   (1 << 1)
> > +# define DP_DSC_4_PER_DP_DSC_SINK   (1 << 3)
> > +# define DP_DSC_6_PER_DP_DSC_SINK   (1 << 4)
> > +# define DP_DSC_8_PER_DP_DSC_SINK   (1 << 5)
> > +# define DP_DSC_10_PER_DP_DSC_SINK  (1 << 6)
> > +# define DP_DSC_12_PER_DP_DSC_SINK  (1 << 7)
> > +
> > +#define DP_DSC_LINE_BUF_BIT_DEPTH   0x065
> > +# define DP_DSC_LINE_BUF_BIT_DEPTH_MASK (0xf << 0)
> > +# define DP_DSC_LINE_BUF_BIT_DEPTH_90x0
> > +# define DP_DSC_LINE_BUF_BIT_DEPTH_10   0x1
> > +# define DP_DSC_LINE_BUF_BIT_DEPTH_11   0x2
> > +# define DP_DSC_LINE_BUF_BIT_DEPTH_12   0x3
> > +# define DP_DSC_LINE_BUF_BIT_DEPTH_13   0x4
> > +# define DP_DSC_LINE_BUF_BIT_DEPTH_14   0x5
> > +# define DP_DSC_LINE_BUF_BIT_DEPTH_15   0x6
> > +# define DP_DSC_LINE_BUF_BIT_DEPTH_16   0x7
> > +# define DP_DSC_LINE_BUF_BIT_DEPTH_80x8
> > +
> > +#define DP_DSC_BLK_PREDICTION_SUPPORT   0x066
> > +# define DP_DSC_BLK_PREDICTION_IS_SUPPORTED (1 << 0)
> > +
> > +#define DP_DSC_MAX_BITS_PER_PIXEL_LOW   0x067   /* eDP 1.4 */
> > +
> > +#define DP_DSC_MAX_BITS_PER_PIXEL_HI0x068   /* eDP 1.4 */
> > +
> > +#define DP_DSC_DEC_COLOR_FORMAT_CAP 0x069
> > +# define DP_DSC_RGB (1 << 0)
> > +# define DP_DSC_YCbCr444(1 << 1)
> > +# define DP_DSC_YCbCr422_Simple (1 << 2)
> > +# define DP_DSC_YCbCr422_Native (1 << 3)
> > +# define DP_DSC_YCbCr420_Native (1 << 4)
> > +
> > +#define DP_DSC_DEC_COLOR_DEPTH_CAP  0x06A
> > +# define DP_DSC_8_BPC   (1 << 1)
> > +# define DP_DSC_10_BPC  (1 << 2)
> > +# define DP_DSC_12_BPC  (1 << 3)
> > +
> > +#define DP_DSC_PEAK_THROUGHPUT  0x06B
> > +# define DP_DSC_THROUGHPUT_MODE_0_MASK  (0xf << 0)
> > +# define DP_DSC_THROUGHPUT_MODE_0_SHIFT 0
> > +# define DP_DSC_THROUGHPUT_MODE_0_340   (1 << 0)
> > +# define DP_DSC_THROUGHPUT_MODE_0_400   (2 << 0)
> > +# define DP_DSC_THROUGHPUT_MODE_0_450   (3 << 0)
> > +# define DP_DSC_THROUGHPUT_MODE_0_500   (4 << 0)
> > +# define DP_DSC_THROUGHPUT_MODE_0_550   (5 << 0)
> > +# define DP_DSC_THROUGHPUT_MODE_0_600   (6 << 0)
> > +# define DP_DSC_THROUGHPUT_MODE_0_650   (7 << 0)
> > +# define DP_DSC_THROUGHPUT_MODE_0_700   (8 << 0)
> > +# define DP_DSC_THROUGHPUT_MODE_0_750   (9 << 0)
> > +# define DP_DSC_THROUGHPUT_MODE_0_800   (10 << 0)
> > +# define DP_DSC_THROUGHPUT_MODE_0_850   (11 << 0)
> > +# define DP_DSC_THROUGHPUT_MODE_0_900   (12 << 0)
> > +# define DP_DSC_THROUGHPUT_MODE_0_950   (13 << 0)
> > +# define DP_DSC_THROUGHPUT_MODE_0_1000  (14 << 0)
> > +# define DP_DSC_THROUGHPUT_MODE_1_MASK  (0xf << 4)
> > +# define DP_DSC_THROUGHPUT_MODE_1_SHIFT 4
> > +# define DP_DSC_THROUGHPUT_MODE_1_340   (1 << 4)
> > +# define DP_DSC_THROUGHPUT_MODE_1_400   (2 << 4)
> > +# define 

Re: [Intel-gfx] [PATCH 02/15] drm: Remove drm_modeset_(un)lock_crtc

2017-04-03 Thread kbuild test robot
Hi Daniel,

[auto build test ERROR on next-20170330]
[cannot apply to drm/drm-next drm-intel/for-linux-next robclark/msm-next 
v4.9-rc8 v4.9-rc7 v4.9-rc6 v4.11-rc5]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Daniel-Vetter/acquire-ctx-wire-up-part-2/20170404-053514
config: i386-randconfig-x010-201714 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/gpu/drm/vmwgfx/vmwgfx_kms.c: In function 'vmw_du_crtc_cursor_set2':
>> drivers/gpu/drm/vmwgfx/vmwgfx_kms.c:158:2: error: implicit declaration of 
>> function 'drm_modeset_unlock_crtc' [-Werror=implicit-function-declaration]
 drm_modeset_unlock_crtc(crtc);
 ^~~
   drivers/gpu/drm/vmwgfx/vmwgfx_kms.c:228:2: error: implicit declaration of 
function 'drm_modeset_lock_crtc' [-Werror=implicit-function-declaration]
 drm_modeset_lock_crtc(crtc, crtc->cursor);
 ^
   cc1: some warnings being treated as errors

vim +/drm_modeset_unlock_crtc +158 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c

bfb89928 Daniel Vetter2012-12-02  152* FIXME: Unclear whether 
there's any global state touched by the
bfb89928 Daniel Vetter2012-12-02  153* cursor_set function, 
especially vmw_cursor_update_position looks
bfb89928 Daniel Vetter2012-12-02  154* suspicious. For now take the 
easy route and reacquire all locks. We
bfb89928 Daniel Vetter2012-12-02  155* can do this since the caller 
in the drm core doesn't check anything
bfb89928 Daniel Vetter2012-12-02  156* which is protected by any 
looks.
bfb89928 Daniel Vetter2012-12-02  157*/
21e88620 Rob Clark2014-10-30 @158   drm_modeset_unlock_crtc(crtc);
bfb89928 Daniel Vetter2012-12-02  159   
drm_modeset_lock_all(dev_priv->dev);
8fbf9d92 Thomas Hellstrom 2015-11-26  160   hotspot_x = hot_x + 
du->hotspot_x;
8fbf9d92 Thomas Hellstrom 2015-11-26  161   hotspot_y = hot_y + 
du->hotspot_y;

:: The code at line 158 was first introduced by commit
:: 21e88620aa21b48d4f62d29275e3e2944a5ea2b5 drm/vmwgfx: fix lock breakage

:: TO: Rob Clark 
:: CC: Thomas Hellstrom 

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


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


Re: [Intel-gfx] [PATCH] drm/i915/psr: Clean-up intel_enable_source_psr1()

2017-04-03 Thread Jim Bride
On Mon, Apr 03, 2017 at 05:42:39PM +, Vivi, Rodrigo wrote:
> On Mon, 2017-04-03 at 10:07 -0700, Jim Bride wrote:
> > On SKL+ there is a bit in SRD_CTL that software is not supposed to
> > modify, but we currently clobber that bit when we enable PSR.  In
> > order to preserve the value of that bit, go ahead and read SRD_CTL and
> > do a field-wise setting of the various bits that we need to initialize
> > before writing the register back out.  Additionally, go ahead and
> > explicitly disable single-frame update since we aren't currently
> > supporting it.
> > 
> > Cc: Rodrigo Vivi 
> > Cc: Wayne Boyer 
> > 
> > Signed-off-by: Jim Bride 
> > ---
> >  drivers/gpu/drm/i915/i915_reg.h  |  3 +++
> >  drivers/gpu/drm/i915/intel_psr.c | 23 +--
> >  2 files changed, 24 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_reg.h 
> > b/drivers/gpu/drm/i915/i915_reg.h
> > index 11b12f4..54d39e4 100644
> > --- a/drivers/gpu/drm/i915/i915_reg.h
> > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > @@ -3590,14 +3590,17 @@ enum {
> >  #define   EDP_PSR_SKIP_AUX_EXIT(1<<12)
> >  #define   EDP_PSR_TP1_TP2_SEL  (0<<11)
> >  #define   EDP_PSR_TP1_TP3_SEL  (1<<11)
> > +#define   EDP_PSR_TP2_TP3_TIME_MASK (3<<8)
> >  #define   EDP_PSR_TP2_TP3_TIME_500us   (0<<8)
> >  #define   EDP_PSR_TP2_TP3_TIME_100us   (1<<8)
> >  #define   EDP_PSR_TP2_TP3_TIME_2500us  (2<<8)
> >  #define   EDP_PSR_TP2_TP3_TIME_0us (3<<8)
> > +#define   EDP_PSR_TP1_TIME_MASK (0x3<<4)
> >  #define   EDP_PSR_TP1_TIME_500us   (0<<4)
> >  #define   EDP_PSR_TP1_TIME_100us   (1<<4)
> >  #define   EDP_PSR_TP1_TIME_2500us  (2<<4)
> >  #define   EDP_PSR_TP1_TIME_0us (3<<4)
> > +#define   EDP_PSR_IDLE_FRAME_MASK   (0xf<<0)
> >  #define   EDP_PSR_IDLE_FRAME_SHIFT 0
> >  
> >  #define EDP_PSR_AUX_CTL
> > _MMIO(dev_priv->psr_mmio_base + 0x10)
> > diff --git a/drivers/gpu/drm/i915/intel_psr.c 
> > b/drivers/gpu/drm/i915/intel_psr.c
> > index c3780d0..a050859 100644
> > --- a/drivers/gpu/drm/i915/intel_psr.c
> > +++ b/drivers/gpu/drm/i915/intel_psr.c
> > @@ -280,17 +280,34 @@ static void intel_enable_source_psr1(struct intel_dp 
> > *intel_dp)
> >  * with the 5 or 6 idle patterns.
> >  */
> > uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
> > -   uint32_t val = EDP_PSR_ENABLE;
> > +   uint32_t val = I915_READ(EDP_PSR_CTL);
> >  
> > +   val |= EDP_PSR_ENABLE;
> > +
> > +   /* We always set the max sleep time to the maximum value, so
> > +* no need to zero out the field first.
> > +*/
> 
> I believe it is better to zero out instead of adding a comment.
> So we could play with max_sleep_time if needed.
> 
> Otherwise we shouldn't allow the flexible value here so we should create
> a define EDP_PSR_MAX_SLEEP_TIME (0x1f << 20)
> and here do a val |= EDP_PSR_MAX_SLEEP_TIME;

That's fair.  I'll wait a bit in case there's further comments, and then
spin a new version without said comment and with zeroing out the field.

Jim


> > val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT;
> > +
> > +   val &= ~EDP_PSR_IDLE_FRAME_MASK;
> > val |= idle_frames << EDP_PSR_IDLE_FRAME_SHIFT;
> >  
> > +   val &= ~EDP_PSR_MIN_LINK_ENTRY_TIME_MASK;
> > if (IS_HASWELL(dev_priv))
> > val |= EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES;
> >  
> > -   if (dev_priv->psr.link_standby)
> > +   if (dev_priv->psr.link_standby) {
> > val |= EDP_PSR_LINK_STANDBY;
> >  
> > +   /* SFU should only be enabled with link standby, but for
> > +* now we do not support it. */
> > +   val &= ~BDW_PSR_SINGLE_FRAME;
> > +   } else {
> > +   val &= ~EDP_PSR_LINK_STANDBY;
> > +   val &= ~BDW_PSR_SINGLE_FRAME;
> > +   }
> > +
> > +   val &= ~EDP_PSR_TP1_TIME_MASK;
> > if (dev_priv->vbt.psr.tp1_wakeup_time > 5)
> > val |= EDP_PSR_TP1_TIME_2500us;
> > else if (dev_priv->vbt.psr.tp1_wakeup_time > 1)
> > @@ -300,6 +317,7 @@ static void intel_enable_source_psr1(struct intel_dp 
> > *intel_dp)
> > else
> > val |= EDP_PSR_TP1_TIME_0us;
> >  
> > +   val &= ~EDP_PSR_TP2_TP3_TIME_MASK;
> > if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
> > val |= EDP_PSR_TP2_TP3_TIME_2500us;
> > else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
> > @@ -309,6 +327,7 @@ static void intel_enable_source_psr1(struct intel_dp 
> > *intel_dp)
> > else
> > val |= EDP_PSR_TP2_TP3_TIME_0us;
> >  
> > +   val &= ~EDP_PSR_TP1_TP3_SEL;
> > if (intel_dp_source_supports_hbr2(intel_dp) &&
> > drm_dp_tps3_supported(intel_dp->dpcd))
> > val |= EDP_PSR_TP1_TP3_SEL;
> 
___
Intel-gfx 

Re: [Intel-gfx] [PATCH] dim: Add apply-pull command

2017-04-03 Thread Daniel Vetter
On Mon, Apr 03, 2017 at 06:17:51PM +0300, Jani Nikula wrote:
> On Thu, 30 Mar 2017, Daniel Vetter  wrote:
> > I'm getting real lazy, let's start scripting this. Very rough draft,
> > but adds a Link: (patchwork tracks pull requests too, maybe we'll
> > start CI-ing them too), and sob line. In the future we might add more
> > checks here ...
> >
> > Signed-off-by: Daniel Vetter 
> > ---
> >  dim | 34 ++
> >  dim.rst |  4 
> >  2 files changed, 38 insertions(+)
> >
> > diff --git a/dim b/dim
> > index 0903f6c2634d..73c25a195f17 100755
> > --- a/dim
> > +++ b/dim
> > @@ -717,6 +717,40 @@ function dim_apply_branch
> > return $rv
> >  }
> >  
> > +dim_alias_ap=apply-pull
> > +function dim_apply_pull
> > +{
> > +   local branch file message_id pull_branch rv
> > +
> > +   branch=${1:?$usage}
> > +   shift
> > +   file=$(mktemp)
> > +
> > +   assert_branch $branch
> > +   assert_repo_clean
> > +
> > +   cat > $file
> > +
> > +   pull_branch=$(sed -e '0,/git repository at:$/d' $file | head -n 2 | 
> > tail -n 1)
> > +
> > +   echo $pull_branch
> > +
> > +   git pull $pull_branch
> > +
> > +   message_id=$(message_get_id $file)
> > +
> > +   if [ -n "$message_id" ]; then
> > +   dim_commit_add_tag "\nLink: 
> > http://patchwork.freedesktop.org/patch/msgid/$message_id;
> 
> The \n there doesn't do what you think it does, at least not for me. I
> end up with "nLink: " in the commit message.

wfm. Any idea what's different on your side? This is supposed to be all
bash ...

> > +   else
> > +   echoerr "WARNING: No message-id found in the patch file."
> > +   rv=1
> > +   fi
> > +
> > +   git commit --amend -s
> 
> I think the intention is to just add the signoff, but this ends up
> trying to fire up the editor, which is really not good for piping.

Well it's my workflow again, I'd like to auto-edit patches after applying,
same for pull requests. I guess we could try to add the sob through other
means, and then invoke the post commit cmd again?
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 01/15] drm: Make drm_modeset_lock_crtc internal

2017-04-03 Thread kbuild test robot
Hi Daniel,

[auto build test ERROR on next-20170330]
[also build test ERROR on v4.11-rc5]
[cannot apply to drm/drm-next drm-intel/for-linux-next robclark/msm-next 
v4.9-rc8 v4.9-rc7 v4.9-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Daniel-Vetter/acquire-ctx-wire-up-part-2/20170404-053514
config: i386-randconfig-x010-201714 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/gpu//drm/vmwgfx/vmwgfx_kms.c: In function 'vmw_du_crtc_cursor_set2':
>> drivers/gpu//drm/vmwgfx/vmwgfx_kms.c:228:2: error: implicit declaration of 
>> function 'drm_modeset_lock_crtc' [-Werror=implicit-function-declaration]
 drm_modeset_lock_crtc(crtc, crtc->cursor);
 ^
   cc1: some warnings being treated as errors

vim +/drm_modeset_lock_crtc +228 drivers/gpu//drm/vmwgfx/vmwgfx_kms.c

8fbf9d92 Thomas Hellstrom  2015-11-26  222  du->core_hotspot_x = 
hot_x;
8fbf9d92 Thomas Hellstrom  2015-11-26  223  du->core_hotspot_y = 
hot_y;
8fbf9d92 Thomas Hellstrom  2015-11-26  224  }
fb1d9738 Jakob Bornecrantz 2009-12-10  225  
bfb89928 Daniel Vetter 2012-12-02  226  out:
bfb89928 Daniel Vetter 2012-12-02  227  
drm_modeset_unlock_all(dev_priv->dev);
4d02e2de Daniel Vetter 2014-11-11 @228  drm_modeset_lock_crtc(crtc, 
crtc->cursor);
bfb89928 Daniel Vetter 2012-12-02  229  
bfb89928 Daniel Vetter 2012-12-02  230  return ret;
fb1d9738 Jakob Bornecrantz 2009-12-10  231  }

:: The code at line 228 was first introduced by commit
:: 4d02e2de0e80a786452e70d7f3a20a50641e6620 drm: Per-plane locking

:: TO: Daniel Vetter 
:: CC: Dave Airlie 

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


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


Re: [Intel-gfx] [PATCH v3] drm/i915/dp: Read link status more times when EQ not done

2017-04-03 Thread Jim Bride
On Fri, Mar 31, 2017 at 04:25:31PM -0700, Rodrigo Vivi wrote:
> On Mon, Mar 13, 2017 at 1:12 AM, Lee, Shawn C  wrote:
> > From: "Lee, Shawn C" 
> >
> > Display driver read DPCD register 0x202, 0x203 and 0x204 to identify
> > eDP sink status.If PSR exit is ongoing at eDP sink, and eDP source
> > read these registers at the same time. Panel will report EQ & symbol
> > lock not done. It will cause panel display flicking.
> >
> > Try to read link status more times if eDP EQ not done. Panel side
> > request at least 1000us for fast link train while doing PSR exit.
> > So wait more than 1000us then retrieve sink's status again.
> 
> it is missing a v2 and v3 here with explanations on the changes.
> It was hard to follow the changes.
> 
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99639
> > TEST=Reboot DUT and no flicking on local display at login screen
> >
> > Cc: Cooper Chiou 
> > Cc: Wei Shun Chen 
> > Cc: Gary C Wang 
> > Cc: Jani Nikula 
> > Cc: Rodrigo Vivi 
> >
> > Signed-off-by: Lee, Shawn C 
> > ---
> >  drivers/gpu/drm/i915/intel_dp.c |   34 --
> >  1 file changed, 24 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c 
> > b/drivers/gpu/drm/i915/intel_dp.c
> > index 024798a9c016..d50827a92aa2 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -4225,15 +4225,11 @@ static void intel_dp_handle_test_request(struct 
> > intel_dp *intel_dp)
> >  {
> > struct intel_encoder *intel_encoder = 
> > _to_dig_port(intel_dp)->base;
> > struct drm_device *dev = intel_dp_to_dev(intel_dp);
> > -   u8 link_status[DP_LINK_STATUS_SIZE];
> > +   struct drm_i915_private *dev_priv = dev->dev_private;
> > +   u8 link_status[DP_LINK_STATUS_SIZE], retry = 1;
> >
> > WARN_ON(!drm_modeset_is_locked(>mode_config.connection_mutex));
> >
> > -   if (!intel_dp_get_link_status(intel_dp, link_status)) {
> > -   DRM_ERROR("Failed to get link status\n");
> > -   return;
> > -   }
> > -
> > if (!intel_encoder->base.crtc)
> > return;
> >
> > @@ -4245,13 +4241,31 @@ static void intel_dp_handle_test_request(struct 
> > intel_dp *intel_dp)
> > if (!intel_dp->lane_count)
> > return;
> >
> > +   if (is_edp(intel_dp) && dev_priv->psr.enabled)
> > +   retry = 3;
> > +
> > /* Retrain if Channel EQ or CR not ok */
> > -   if (!drm_dp_channel_eq_ok(link_status, intel_dp->lane_count)) {
> > -   DRM_DEBUG_KMS("%s: channel EQ not ok, retraining\n",
> > - intel_encoder->base.name);
> > +   while ( retry-- ) {
> > +   if (!intel_dp_get_link_status(intel_dp, link_status)) {
> > +   DRM_ERROR("Failed to get link status\n");
> > +   return;
> 
> Well, if link status is not ok you return without retrying, so, why is
> this here?
> 
> > +   }
> >
> > -   intel_dp_retrain_link(intel_dp);
> > +   if (drm_dp_channel_eq_ok(link_status, intel_dp->lane_count))
> > +   return;
> > +
> > +   /*
> > +* EQ not ok may caused by fast link train while exit PSR 
> > active,
> > +* wait at least 1000 us then read it again.
> > +*/
> > +   if (retry)
> > +   usleep_range(1000, 1500);
> 
> maybe this retry is randomly just masking the real issue.
> Jim recently found out that on psr enable we are clearing a bit that
> we should never touch by spec.
> I'd try Jim's patch(es) first to see if they solve the issue for you.

Actually, I'd go one better.  If you look at the code, we should
never get to running the actual link status checks due to the
following snippet a few lines up.

   if (!to_intel_crtc(intel_encoder->base.crtc)->active)
   return;
   
Basically, we only check the link status if the pipe is not active.
If the pipe isn't active, then PSR should be disabled.  If it's not,
then that's a scarier problem.  I've been tempted to throw a WARN_ON
in intel_dp_start_link_training() to ensure that PSR is off before
we start modifying the link state, because it really messes
with the re-syncing done at PSR exit time (which this patch was
trying to compensate for.)  In any event, assuming the pipe is
disabled, then PSR shouldn't be an issue.

The patch that Rodrigo is referring to is
https://patchwork.freedesktop.org/patch/147942/ and it could
certainly help if on SKL+.

Jim


> 
> > }
> > +
> > +   DRM_DEBUG_KMS("%s: channel EQ not ok, retraining\n",
> > +   intel_encoder->base.name);
> > +
> > +   

[Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [1/3] drm/i915: Use LINEAR modifier instead of NONE (rev3)

2017-04-03 Thread Patchwork
== Series Details ==

Series: series starting with [1/3] drm/i915: Use LINEAR modifier instead of 
NONE (rev3)
URL   : https://patchwork.freedesktop.org/series/21854/
State : failure

== Summary ==

  LD  drivers/acpi/acpica/built-in.o
  CC [M]  drivers/gpu/drm/i915/gvt/execlist.o
  CC [M]  drivers/gpu/drm/i915/gvt/scheduler.o
  LD  lib/raid6/built-in.o
  CC [M]  drivers/gpu/drm/i915/gvt/sched_policy.o
  CC [M]  drivers/gpu/drm/i915/gvt/render.o
  CC [M]  drivers/gpu/drm/i915/gvt/cmd_parser.o
  CC [M]  drivers/gpu/drm/i915/intel_lpe_audio.o
  LD  drivers/pci/pcie/aer/aerdriver.o
  LD  drivers/pci/pcie/aer/built-in.o
  LD  drivers/pci/pcie/built-in.o
  LD [M]  drivers/usb/serial/usbserial.o
  LD  drivers/acpi/built-in.o
  LD [M]  sound/pci/hda/snd-hda-codec-realtek.o
  LD [M]  sound/pci/hda/snd-hda-codec-hdmi.o
  LD  drivers/spi/built-in.o
  LD  drivers/scsi/scsi_mod.o
  LD  drivers/pci/built-in.o
  LD  net/packet/built-in.o
  LD  drivers/video/fbdev/core/fb.o
  LD  drivers/video/fbdev/core/built-in.o
  LD  drivers/iommu/built-in.o
  LD [M]  drivers/gpu/drm/vgem/vgem.o
  LD  drivers/usb/storage/usb-storage.o
  LD  drivers/usb/storage/built-in.o
  LD  drivers/video/fbdev/built-in.o
  LD  drivers/usb/gadget/libcomposite.o
  LD [M]  drivers/net/ethernet/intel/e1000/e1000.o
  LD  lib/lz4/built-in.o
  LD  drivers/scsi/sd_mod.o
  LD  drivers/scsi/built-in.o
  LD  kernel/sched/built-in.o
  LD [M]  drivers/net/ethernet/intel/igbvf/igbvf.o
  LD  kernel/built-in.o
  LD  drivers/tty/serial/8250/8250_base.o
  LD  drivers/tty/serial/8250/built-in.o
  LD  drivers/tty/serial/built-in.o
  LD  net/xfrm/built-in.o
  LD  drivers/usb/gadget/udc/udc-core.o
  LD  drivers/usb/gadget/udc/built-in.o
  LD  drivers/usb/gadget/built-in.o
drivers/gpu/drm/i915/intel_display.c: In function ‘intel_primary_plane_create’:
drivers/gpu/drm/i915/intel_display.c:13746:1: error: expected expression before 
‘<<’ token
 <<< f09b91b0901f5fd3fabeb887a6fd38b0dafd1474
 ^
drivers/gpu/drm/i915/intel_display.c:13753:27: error: 
‘ironlake_update_primary_plane’ undeclared (first use in this function)
   primary->update_plane = ironlake_update_primary_plane;
   ^
drivers/gpu/drm/i915/intel_display.c:13753:27: note: each undeclared identifier 
is reported only once for each function it appears in
drivers/gpu/drm/i915/intel_display.c:13755:1: error: expected expression before 
‘>>’ token
 >>> drm/i915: Add format modifiers for Intel
 ^
  LD  drivers/gpu/drm/drm.o
  LD  drivers/video/console/built-in.o
  LD  drivers/video/built-in.o
  LD  net/ipv6/ipv6.o
  AR  lib/lib.a
scripts/Makefile.build:294: recipe for target 
'drivers/gpu/drm/i915/intel_display.o' failed
make[4]: *** [drivers/gpu/drm/i915/intel_display.o] Error 1
make[4]: *** Waiting for unfinished jobs
  EXPORTS lib/lib-ksyms.o
  LD  net/ipv6/built-in.o
  LD  lib/built-in.o
  LD  fs/btrfs/btrfs.o
  LD  drivers/usb/core/usbcore.o
  LD  drivers/usb/core/built-in.o
  LD  drivers/md/md-mod.o
  LD  drivers/md/built-in.o
  LD  fs/btrfs/built-in.o
  LD  drivers/tty/vt/built-in.o
  LD  drivers/tty/built-in.o
  LD [M]  sound/pci/hda/snd-hda-codec-generic.o
  LD  sound/pci/built-in.o
  LD  sound/built-in.o
  CC  arch/x86/kernel/cpu/capflags.o
  LD  arch/x86/kernel/cpu/built-in.o
  LD  arch/x86/kernel/built-in.o
  LD  arch/x86/built-in.o
  LD [M]  drivers/net/ethernet/intel/igb/igb.o
  LD  net/ipv4/built-in.o
  LD  drivers/usb/host/xhci-hcd.o
  LD  fs/ext4/ext4.o
  LD  fs/ext4/built-in.o
  LD  drivers/usb/host/built-in.o
  LD  fs/built-in.o
  LD  drivers/usb/built-in.o
  LD [M]  drivers/net/ethernet/intel/e1000e/e1000e.o
  LD  net/core/built-in.o
  LD  net/built-in.o
scripts/Makefile.build:553: recipe for target 'drivers/gpu/drm/i915' failed
make[3]: *** [drivers/gpu/drm/i915] Error 2
scripts/Makefile.build:553: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:553: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
make[1]: *** Waiting for unfinished jobs
  LD  drivers/net/ethernet/built-in.o
  LD  drivers/net/built-in.o
Makefile:1002: recipe for target 'drivers' failed
make: *** [drivers] Error 2

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


[Intel-gfx] [PATCH 3/3] [v5] drm/i915: Add format modifiers for Intel

2017-04-03 Thread Ben Widawsky
This was based on a patch originally by Kristian. It has been modified
pretty heavily to use the new callbacks from the previous patch.

v2:
  - Add LINEAR and Yf modifiers to list (Ville)
  - Combine i8xx and i965 into one list of formats (Ville)
  - Allow 1010102 formats for Y/Yf tiled (Ville)

v3:
  - Handle cursor formats (Ville)
  - Put handling for LINEAR in the mod_support functions (Ville)

v4:
  - List each modifier explicitly in supported modifiers (Ville)
  - Handle the CURSOR plane (Ville)

v5:
  - Split out cursor and sprite handling (Ville)

Cc: Ville Syrjälä 
Cc: Kristian H. Kristensen 
Signed-off-by: Ben Widawsky 
---
 drivers/gpu/drm/i915/intel_display.c | 132 +--
 drivers/gpu/drm/i915/intel_sprite.c  |  76 +++-
 2 files changed, 202 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 802a8449c5d3..67de3c267290 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -72,6 +72,12 @@ static const uint32_t i965_primary_formats[] = {
DRM_FORMAT_XBGR2101010,
 };
 
+static const uint64_t i9xx_format_modifiers[] = {
+   I915_FORMAT_MOD_X_TILED,
+   DRM_FORMAT_MOD_LINEAR,
+   DRM_FORMAT_MOD_INVALID
+};
+
 static const uint32_t skl_primary_formats[] = {
DRM_FORMAT_C8,
DRM_FORMAT_RGB565,
@@ -87,6 +93,14 @@ static const uint32_t skl_primary_formats[] = {
DRM_FORMAT_VYUY,
 };
 
+static const uint64_t skl_format_modifiers[] = {
+   I915_FORMAT_MOD_Yf_TILED,
+   I915_FORMAT_MOD_Y_TILED,
+   I915_FORMAT_MOD_X_TILED,
+   DRM_FORMAT_MOD_LINEAR,
+   DRM_FORMAT_MOD_INVALID
+};
+
 /* Cursor formats */
 static const uint32_t intel_cursor_formats[] = {
DRM_FORMAT_ARGB,
@@ -13453,6 +13467,103 @@ void intel_plane_destroy(struct drm_plane *plane)
kfree(to_intel_plane(plane));
 }
 
+static bool i8xx_mod_supported(uint32_t format, uint64_t modifier)
+{
+   switch (format) {
+   case DRM_FORMAT_C8:
+   case DRM_FORMAT_RGB565:
+   case DRM_FORMAT_XRGB1555:
+   case DRM_FORMAT_XRGB:
+   return modifier == DRM_FORMAT_MOD_LINEAR ||
+   modifier == I915_FORMAT_MOD_X_TILED;
+   default:
+   return false;
+   }
+}
+
+static bool i965_mod_supported(uint32_t format, uint64_t modifier)
+{
+   switch (format) {
+   case DRM_FORMAT_C8:
+   case DRM_FORMAT_RGB565:
+   case DRM_FORMAT_XRGB:
+   case DRM_FORMAT_XBGR:
+   case DRM_FORMAT_XRGB2101010:
+   case DRM_FORMAT_XBGR2101010:
+   return modifier == DRM_FORMAT_MOD_LINEAR ||
+   modifier == I915_FORMAT_MOD_X_TILED;
+   default:
+   return false;
+   }
+}
+
+static bool skl_mod_supported(uint32_t format, uint64_t modifier)
+{
+   switch (format) {
+   case DRM_FORMAT_C8:
+   switch (modifier) {
+   case DRM_FORMAT_MOD_LINEAR:
+   case I915_FORMAT_MOD_X_TILED:
+   case I915_FORMAT_MOD_Y_TILED:
+   return true;
+   default:
+   return false;
+   }
+   case DRM_FORMAT_RGB565:
+   case DRM_FORMAT_XRGB:
+   case DRM_FORMAT_XBGR:
+   case DRM_FORMAT_ARGB:
+   case DRM_FORMAT_ABGR:
+   case DRM_FORMAT_XRGB2101010:
+   case DRM_FORMAT_XBGR2101010:
+   case DRM_FORMAT_YUYV:
+   case DRM_FORMAT_YVYU:
+   case DRM_FORMAT_UYVY:
+   case DRM_FORMAT_VYUY:
+   /* All i915 modifiers are fine */
+   switch (modifier) {
+   case DRM_FORMAT_MOD_LINEAR:
+   case I915_FORMAT_MOD_X_TILED:
+   case I915_FORMAT_MOD_Y_TILED:
+   case I915_FORMAT_MOD_Yf_TILED:
+   return true;
+   default:
+   return false;
+   }
+   default:
+   return false;
+   }
+}
+
+static bool intel_primary_plane_format_mod_supported(struct drm_plane *plane,
+uint32_t format,
+uint64_t modifier)
+{
+   struct drm_i915_private *dev_priv = to_i915(plane->dev);
+
+   if (WARN_ON(modifier == DRM_FORMAT_MOD_INVALID))
+   return false;
+
+   if (INTEL_GEN(dev_priv) >= 9)
+   return skl_mod_supported(format, modifier);
+   else if (INTEL_GEN(dev_priv) >= 4)
+   return i965_mod_supported(format, modifier);
+   else
+   return i8xx_mod_supported(format, modifier);
+
+   return false;
+}
+
+static bool intel_cursor_plane_format_mod_supported(struct drm_plane *plane,
+   uint32_t format,
+   

[Intel-gfx] [maintainer-tools PATCH v2 2/2] dim: Curate and insert tags into patch(es)

2017-04-03 Thread Sean Paul
Launch $EDITOR when extracting tags to curate the tags immediately. Once the
tags are proper, automatically add them before the first Signed-off-by line
to all patches in the range.

Signed-off-by: Sean Paul 
---
Changes in v2:
- Append the tags before the committer's SoB (Ville)
- Make launching $EDITOR contingent on -i flag (Ville/Jani)
- Fix tty issues when launching editor


 dim | 44 +++-
 1 file changed, 35 insertions(+), 9 deletions(-)

diff --git a/dim b/dim
index 334882b..8b9a876 100755
--- a/dim
+++ b/dim
@@ -670,13 +670,23 @@ function dim_push_fixes
dim_push_branch drm-intel-fixes "$@"
 }
 
+function get_committer_email
+{
+   local committer_email
+
+   if ! committer_email=$(git config --get user.email) ; then
+   committer_email=$EMAIL
+   fi
+   echo -n $committer_email
+}
+
 # ensure we're on branch $1, and apply patches. the rest of the arguments are
 # passed to git am.
 dim_alias_ab=apply-branch
 dim_alias_sob=apply-branch
 function dim_apply_branch
 {
-   local branch file message_id commiter_email patch_from sob rv
+   local branch file message_id committer_email patch_from sob rv
 
branch=${1:?$usage}
shift
@@ -688,13 +698,10 @@ function dim_apply_branch
cat > $file
 
message_id=$(message_get_id $file)
-
-   if ! commiter_email=$(git config --get user.email) ; then
-   commiter_email=$EMAIL
-   fi
+   committer_email=$(get_committer_email)
 
patch_from=$(grep "From:" "$file" | head -1)
-   if [[ "$patch_from" != *"$commiter_email"* ]] ; then
+   if [[ "$patch_from" != *"$committer_email"* ]] ; then
sob=-s
fi
 
@@ -1156,6 +1163,15 @@ function rangeish()
fi
 }
 
+function insert_extracted_tags
+{
+   local committer_email new_tags sob
+   committer_email=$(get_committer_email)
+   new_tags=$(awk '{ORS="n"} {print $0}' $1 | head -c-3)
+   sob="Signed-off-by: .*<$committer_email>"
+   awk "/$sob/{p++} p==1{print \"$new_tags\"; p++} p!=1{print}"
+}
+
 function dim_extract_tags
 {
local branch range file tags
@@ -1177,9 +1193,19 @@ function dim_extract_tags
return 0
fi
 
-   tags=$(printf -- "# *** extracted tags ***\n%s" "$tags")
-
-   git filter-branch -f --msg-filter "cat ; echo \"$tags\"" $range
+   # If interactive is selected, launch an editor to allow tag editing
+   # If it's not, just append the tags at the bottom of the commit
+   if [ "$INTERACTIVE" ]; then
+   echo "$tags" > $file
+   ${EDITOR:-vi} $file >/dev/tty/dev/tty
+   cmd="insert_extracted_tags $file"
+   else
+   tags=$(printf -- "# *** extracted tags ***\n%s" "$tags")
+   cmd="cat ; echo \"$tags\""
+   fi
+   git filter-branch -f --msg-filter "$cmd" $range
 }
 
 function dim_extract_queued
-- 
2.12.2.715.g7642488e1d-goog

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


[Intel-gfx] [maintainer-tools PATCH v2] dim: Use mktemp for pull-request mails

2017-04-03 Thread Sean Paul
Instead of hardcoding ~/tmp in dim (and failing when it doesn't
exist), use mktemp to create the pull-request mail file.

Signed-off-by: Sean Paul 
---
 dim | 33 +++--
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/dim b/dim
index 8357d4f..d51be6b 100755
--- a/dim
+++ b/dim
@@ -1278,9 +1278,12 @@ function prep_pull_mail_overview
 # $@: tags, if any, to extract into the pull request overview
 function prep_pull_mail
 {
-   prep_pull_mail_greetings > ~/tmp/dim-pull-request
-   prep_pull_mail_overview "$@" >> ~/tmp/dim-pull-request
-   prep_pull_mail_signature >> ~/tmp/dim-pull-request
+   local file
+   file=$1
+   shift
+   prep_pull_mail_greetings > $file
+   prep_pull_mail_overview "$@" >> $file
+   prep_pull_mail_signature >> $file
 }
 
 function dim_create_workdir
@@ -1368,7 +1371,7 @@ function dim_update_next
 
 function dim_update_next_continue
 {
-   local remote suffix tag tag_testing
+   local remote req_file suffix tag tag_testing
 
assert_branch drm-intel-next-queued
 
@@ -1391,17 +1394,18 @@ function dim_update_next_continue
$DRY git tag $tag_testing $DIM_DRM_INTEL_REMOTE/drm-intel-testing
$DRY git push $DIM_DRM_INTEL_REMOTE $tag_testing
 
-   cat > ~/tmp/test-request <<-HERE
+   req_file=$(mktemp)
+   cat > $req_file <<-HERE
Hi all,
 
HERE
obj=$(git rev-parse $tag)
if [[ "$(git cat-file -t $obj)" == "tag" ]] ; then
-   git cat-file -p $obj | tail -n+6 >> ~/tmp/test-request
+   git cat-file -p $obj | tail -n+6 >> $req_file
else
-   echo "" >> 
~/tmp/test-request
+   echo "" >> 
$req_file
fi
-   cat >> ~/tmp/test-request <<-HERE
+   cat >> $req_file <<-HERE
 
Happy testing!
 
@@ -1409,7 +1413,7 @@ function dim_update_next_continue
HERE
 
$DRY $DIM_MUA -s "Updated drm-intel-testing" \
--i ~/tmp/test-request \
+-i $req_file \
 -c "$addr_intel_gfx" \
 -c "$addr_intel_gfx_maintainer1" \
 -c "$addr_intel_gfx_maintainer2" \
@@ -1443,11 +1447,12 @@ function dim_tag_next
 # dim_pull_request branch upstream
 function dim_pull_request
 {
-   local branch upstream remote repo url git_url suffix tag
+   local branch upstream remote repo req_file url git_url suffix tag
 
branch=${1:?$usage}
upstream=${2:?$usage}
remote=$(branch_to_remote $branch)
+   req_file=$(mktemp)
 
if [ "$branch" != "drm-intel-next" ]; then
assert_branch $branch
@@ -1461,7 +1466,7 @@ function dim_pull_request
if [ "$branch" = "drm-intel-next" ]; then
# drm-intel-next pulls have been tagged using dim update-next
drm_intel_next_tags=$(git log "$branch@{upstream}" ^$upstream 
--decorate | grep "(.*tag: drm-intel-next-" | sed -e "s/^.*(.*tag: 
\(drm-intel-next-[^ ,]*\).*)$/\1/")
-   prep_pull_mail $drm_intel_next_tags
+   prep_pull_mail $req_file $drm_intel_next_tags
tag=$(git describe --all --exact "$branch@{upstream}")
 
repo="drm-intel"
@@ -1475,7 +1480,7 @@ function dim_pull_request
gitk "$branch@{upstream}" ^$upstream &
$DRY git tag -a $tag "$branch@{upstream}"
$DRY git push $remote $tag
-   prep_pull_mail $tag
+   prep_pull_mail $req_file $tag
 
repo=$(branch_to_repo $branch)
fi
@@ -1483,9 +1488,9 @@ function dim_pull_request
url=${drm_tip_repos[$repo]}
git_url=$(echo $url | sed -e 's/git\./anongit./' -e 's/ssh:/git:/')
 
-   git request-pull $upstream $git_url $tag >> ~/tmp/dim-pull-request
+   git request-pull $upstream $git_url $tag >> $req_file
$DRY $DIM_MUA -s "[PULL] $branch" \
-   -i ~/tmp/dim-pull-request \
+   -i $req_file \
-c "$addr_intel_gfx" \
-c "$addr_dri_devel" \
-c "$addr_intel_gfx_maintainer1" \
-- 
2.12.2.564.g063fe858b8-goog

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


Re: [Intel-gfx] [PATCH 12/15] drm: Add acquire ctx to ->gamma_set hook

2017-04-03 Thread Sinclair Yeh
vmwgfx part:  Reviewed-by: Sinclair Yeh 

On Mon, Apr 03, 2017 at 10:33:01AM +0200, Daniel Vetter wrote:
> Atomic helpers really want this instead of the hacked-up legacy
> backoff trick, which unfortunately prevents drivers from using their
> own private drm_modeset_locks.
> 
> Aside: There's a few atomic drivers (nv50, vc4, soon vmwgfx) which
> don't yet use the new atomic color mgmt/gamma table stuff. Would be
> nice if they could switch over and just hook up
> drm_atomic_helper_legacy_gamma_set() instead.
> 
> Cc: Dave Airlie 
> Cc: Alex Deucher 
> Cc: Christian König 
> Cc: Gerd Hoffmann 
> Cc: Ben Skeggs 
> Cc: Sinclair Yeh 
> Cc: Thomas Hellstrom 
> Cc: Eric Anholt 
> Signed-off-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c   | 3 ++-
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c   | 3 ++-
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c| 3 ++-
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c| 3 ++-
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 3 ++-
>  drivers/gpu/drm/ast/ast_mode.c   | 3 ++-
>  drivers/gpu/drm/cirrus/cirrus_mode.c | 3 ++-
>  drivers/gpu/drm/drm_atomic_helper.c  | 4 +++-
>  drivers/gpu/drm/drm_color_mgmt.c | 3 ++-
>  drivers/gpu/drm/drm_fb_helper.c  | 3 ++-
>  drivers/gpu/drm/gma500/gma_display.c | 3 ++-
>  drivers/gpu/drm/gma500/gma_display.h | 3 ++-
>  drivers/gpu/drm/mgag200/mgag200_mode.c   | 3 ++-
>  drivers/gpu/drm/nouveau/dispnv04/crtc.c  | 3 ++-
>  drivers/gpu/drm/nouveau/nv50_display.c   | 3 ++-
>  drivers/gpu/drm/radeon/radeon_display.c  | 3 ++-
>  drivers/gpu/drm/vc4/vc4_crtc.c   | 3 ++-
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c  | 3 ++-
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.h  | 3 ++-
>  include/drm/drm_atomic_helper.h  | 3 ++-
>  include/drm/drm_crtc.h   | 3 ++-
>  21 files changed, 43 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c 
> b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index f525ae4e0576..daf003dd2351 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2631,7 +2631,8 @@ static void dce_v10_0_cursor_reset(struct drm_crtc 
> *crtc)
>  }
>  
>  static int dce_v10_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 
> *green,
> - u16 *blue, uint32_t size)
> + u16 *blue, uint32_t size,
> + struct drm_modeset_acquire_ctx *ctx)
>  {
>   struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
>   int i;
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c 
> b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 3eac27f24d94..3a7296724457 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2651,7 +2651,8 @@ static void dce_v11_0_cursor_reset(struct drm_crtc 
> *crtc)
>  }
>  
>  static int dce_v11_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 
> *green,
> - u16 *blue, uint32_t size)
> + u16 *blue, uint32_t size,
> + struct drm_modeset_acquire_ctx *ctx)
>  {
>   struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
>   int i;
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c 
> b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index 838cf1a778f2..8ccada5d6f39 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -1998,7 +1998,8 @@ static void dce_v6_0_cursor_reset(struct drm_crtc *crtc)
>  }
>  
>  static int dce_v6_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 
> *green,
> -u16 *blue, uint32_t size)
> +u16 *blue, uint32_t size,
> +struct drm_modeset_acquire_ctx *ctx)
>  {
>   struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
>   int i;
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c 
> b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 1b0717b11efe..6943f2641c90 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -2482,7 +2482,8 @@ static void dce_v8_0_cursor_reset(struct drm_crtc *crtc)
>  }
>  
>  static int dce_v8_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 
> *green,
> -u16 *blue, uint32_t size)
> +u16 *blue, uint32_t size,
> +struct drm_modeset_acquire_ctx *ctx)
>  {
>   struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
>   int i;
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c 
> b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index 5c51f9a97811..81a24b6b4846 100644
> --- 

Re: [Intel-gfx] [PATCH] drm/i915/huc: Simplify intel_huc_init_hw()

2017-04-03 Thread Srivatsa, Anusha
I like the changes, definitely simplifies things.

>-Original Message-
>From: Wajdeczko, Michal
>Sent: Friday, March 31, 2017 4:57 AM
>To: intel-gfx@lists.freedesktop.org
>Cc: Wajdeczko, Michal ; Srivatsa, Anusha
>; Hiler, Arkadiusz ;
>Ursulin, Tvrtko 
>Subject: [PATCH] drm/i915/huc: Simplify intel_huc_init_hw()
>
>On last guc/huc cleanup series we've simplified guc init hw function but missed
>the one for the huc. While here, change its signature as we don't care about 
>huc
>loading status.
>
>Signed-off-by: Michal Wajdeczko 
>Cc: Anusha Srivatsa 
>Cc: Arkadiusz Hiler 
>Cc: Tvrtko Ursulin 

Reviewed-by: Anusha Srivatsa 

> drivers/gpu/drm/i915/intel_huc.c | 48 +++-
> drivers/gpu/drm/i915/intel_uc.h  |  2 +-
> 2 files changed, 9 insertions(+), 41 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/intel_huc.c 
>b/drivers/gpu/drm/i915/intel_huc.c
>index 9ee8196..385cacb 100644
>--- a/drivers/gpu/drm/i915/intel_huc.c
>+++ b/drivers/gpu/drm/i915/intel_huc.c
>@@ -186,68 +186,36 @@ void intel_huc_select_fw(struct intel_huc *huc)
>  * earlier call to intel_huc_init(), so here we need only check that
>  * is succeeded, and then transfer the image to the h/w.
>  *
>- * Return:non-zero code on error
>  */
>-int intel_huc_init_hw(struct intel_huc *huc)
>+void intel_huc_init_hw(struct intel_huc *huc)
> {
>   struct drm_i915_private *dev_priv = huc_to_i915(huc);
>   int err;
>
>-  if (huc->fw.fetch_status == INTEL_UC_FIRMWARE_NONE)
>-  return 0;
>-
>   DRM_DEBUG_DRIVER("%s fw status: fetch %s, load %s\n",
>   huc->fw.path,
>   intel_uc_fw_status_repr(huc->fw.fetch_status),
>   intel_uc_fw_status_repr(huc->fw.load_status));
>
>-  if (huc->fw.fetch_status == INTEL_UC_FIRMWARE_SUCCESS &&
>-  huc->fw.load_status == INTEL_UC_FIRMWARE_FAIL)
>-  return -ENOEXEC;
>+  if (huc->fw.fetch_status != INTEL_UC_FIRMWARE_SUCCESS)
>+  return;
>
>   huc->fw.load_status = INTEL_UC_FIRMWARE_PENDING;
>
>-  switch (huc->fw.fetch_status) {
>-  case INTEL_UC_FIRMWARE_FAIL:
>-  /* something went wrong :( */
>-  err = -EIO;
>-  goto fail;
>-
>-  case INTEL_UC_FIRMWARE_NONE:
>-  case INTEL_UC_FIRMWARE_PENDING:
>-  default:
>-  /* "can't happen" */
>-  WARN_ONCE(1, "HuC fw %s invalid fetch_status %s [%d]\n",
>-  huc->fw.path,
>-  intel_uc_fw_status_repr(huc->fw.fetch_status),
>-  huc->fw.fetch_status);
>-  err = -ENXIO;
>-  goto fail;
>-
>-  case INTEL_UC_FIRMWARE_SUCCESS:
>-  break;
>-  }
>-
>   err = huc_ucode_xfer(dev_priv);
>-  if (err)
>-  goto fail;
>
>-  huc->fw.load_status = INTEL_UC_FIRMWARE_SUCCESS;
>+  huc->fw.load_status = err ?
>+  INTEL_UC_FIRMWARE_FAIL : INTEL_UC_FIRMWARE_SUCCESS;
>
>   DRM_DEBUG_DRIVER("%s fw status: fetch %s, load %s\n",
>   huc->fw.path,
>   intel_uc_fw_status_repr(huc->fw.fetch_status),
>   intel_uc_fw_status_repr(huc->fw.load_status));
>
>-  return 0;
>-
>-fail:
>-  if (huc->fw.load_status == INTEL_UC_FIRMWARE_PENDING)
>-  huc->fw.load_status = INTEL_UC_FIRMWARE_FAIL;
>-
>-  DRM_ERROR("Failed to complete HuC uCode load with ret %d\n", err);
>+  if (huc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
>+  DRM_ERROR("Failed to complete HuC uCode load with ret
>%d\n", err);
>
>-  return err;
>+  return;
> }
>
> /**
>diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
>index 4b7f73a..2f0229d 100644
>--- a/drivers/gpu/drm/i915/intel_uc.h
>+++ b/drivers/gpu/drm/i915/intel_uc.h
>@@ -266,7 +266,7 @@ static inline u32 guc_ggtt_offset(struct i915_vma *vma)
>
> /* intel_huc.c */
> void intel_huc_select_fw(struct intel_huc *huc); -int intel_huc_init_hw(struct
>intel_huc *huc);
>+void intel_huc_init_hw(struct intel_huc *huc);
> void intel_guc_auth_huc(struct drm_i915_private *dev_priv);
>
> #endif
>--
>2.7.4

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


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

2017-04-03 Thread Sinclair Yeh
Thanks for this.   This and "drm/vmwgfx: merge fixup for set_config API change":

Reviewed-by: Sinclair Yeh 

On Mon, Apr 03, 2017 at 01:31:29PM +1000, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the drm-misc tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
> 
> drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c: In function 'vmw_sou_crtc_page_flip':
> drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c:327:8: error: too few arguments to 
> function 'drm_atomic_helper_page_flip'
>   ret = drm_atomic_helper_page_flip(crtc, new_fb, NULL, flags);
> ^
> In file included from drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c:31:0:
> include/drm/drm_atomic_helper.h:126:5: note: declared here
>  int drm_atomic_helper_page_flip(struct drm_crtc *crtc,
>  ^
> drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c: In function 'vmw_stdu_crtc_page_flip':
> drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c:508:8: error: too few arguments to 
> function 'drm_atomic_helper_page_flip'
>   ret = drm_atomic_helper_page_flip(crtc, new_fb, NULL, flags);
> ^
> In file included from drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c:32:0:
> include/drm/drm_atomic_helper.h:126:5: note: declared here
>  int drm_atomic_helper_page_flip(struct drm_crtc *crtc,
>  ^
> 
> Caused by commit
> 
>   41292b1fa13a ("drm: Add acquire ctx parameter to ->page_flip(_target)")
> 
> interacting with commits
> 
>   904bb5e5817f ("drm/vmwgfx: Switch over to internal atomic API for STDU")
>   b0119cb9229d ("drm/vmwgfx: Switch over to internal atomic API for SOU and 
> LDU")
> 
> from the drm tree.
> 
> I added this merge fix patch for today:
> 
> From: Stephen Rothwell 
> Date: Mon, 3 Apr 2017 13:25:55 +1000
> Subject: [PATCH] drm/vmwgfx: merge fixup for page_flip API change
> 
> Signed-off-by: Stephen Rothwell 
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 2 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c 
> b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
> index 02b8f2541dca..8d7dc9def7c2 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
> @@ -324,7 +324,7 @@ static int vmw_sou_crtc_page_flip(struct drm_crtc *crtc,
>   return -EINVAL;
>  
>   flags &= ~DRM_MODE_PAGE_FLIP_ASYNC;
> - ret = drm_atomic_helper_page_flip(crtc, new_fb, NULL, flags);
> + ret = drm_atomic_helper_page_flip(crtc, new_fb, NULL, flags, ctx);
>   if (ret) {
>   DRM_ERROR("Page flip error %d.\n", ret);
>   return ret;
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c 
> b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
> index e59bbcd8b226..bad31bdf09b6 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
> @@ -505,7 +505,7 @@ static int vmw_stdu_crtc_page_flip(struct drm_crtc *crtc,
>* don't hand it to the helper.
>*/
>   flags &= ~DRM_MODE_PAGE_FLIP_ASYNC;
> - ret = drm_atomic_helper_page_flip(crtc, new_fb, NULL, flags);
> + ret = drm_atomic_helper_page_flip(crtc, new_fb, NULL, flags, ctx);
>   if (ret) {
>   DRM_ERROR("Page flip error %d.\n", ret);
>   return ret;
> -- 
> 2.11.0
> 
> -- 
> Cheers,
> Stephen Rothwell
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 3/3] drm/i915: Fix 90/270 rotated coordinates for FBC

2017-04-03 Thread Paulo Zanoni
Em Sex, 2017-03-31 às 21:00 +0300, ville.syrj...@linux.intel.com
escreveu:
> From: Ville Syrjälä 
> 
> The clipped src coordinates have already been rotated by 270 degrees
> for
> when the plane rotation is 90/270 degrees, hence the FBC code should
> no
> longer swap the width and height.

I've never payed too much attention to rotation, but based on the
mentioned commits, what's said on the messages and my understanding of
the code, this looks sane, so:

Reviewed-by: Paulo Zanoni 

And in case someone suggests to just kill
intel_fbc_get_plane_source_size(), I'd like to point that "plane source
size" is wording used by our spec and there's a nice comment explaining
what exactly it's supposed to be, so I'd be in favor of keeping it.

Super bonus point if you end up writing some sort of rotation test for
kms_frontbuffer_tracking or kms_fbc_crc. The problem is that I'm not
entirely too sure about how much the current code structure for those
tests is ready to easily support such a test with minimal efforts.
Needs to be studied.

> 
> Cc: sta...@vger.kernel.org
> Cc: Tvrtko Ursulin 
> Cc: Paulo Zanoni 
> Fixes: b63a16f6cd89 ("drm/i915: Compute display surface offset in the
> plane check hook for SKL+")
> Signed-off-by: Ville Syrjälä 
> ---
>  drivers/gpu/drm/i915/intel_fbc.c | 19 +++
>  1 file changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_fbc.c
> b/drivers/gpu/drm/i915/intel_fbc.c
> index ded2add18b26..d93c58410bff 100644
> --- a/drivers/gpu/drm/i915/intel_fbc.c
> +++ b/drivers/gpu/drm/i915/intel_fbc.c
> @@ -82,20 +82,10 @@ static unsigned int
> get_crtc_fence_y_offset(struct intel_crtc *crtc)
>  static void intel_fbc_get_plane_source_size(struct
> intel_fbc_state_cache *cache,
>   int *width, int *height)
>  {
> - int w, h;
> -
> - if (drm_rotation_90_or_270(cache->plane.rotation)) {
> - w = cache->plane.src_h;
> - h = cache->plane.src_w;
> - } else {
> - w = cache->plane.src_w;
> - h = cache->plane.src_h;
> - }
> -
>   if (width)
> - *width = w;
> + *width = cache->plane.src_w;
>   if (height)
> - *height = h;
> + *height = cache->plane.src_h;
>  }
>  
>  static int intel_fbc_calculate_cfb_size(struct drm_i915_private
> *dev_priv,
> @@ -746,6 +736,11 @@ static void intel_fbc_update_state_cache(struct
> intel_crtc *crtc,
>   cache->crtc.hsw_bdw_pixel_rate = crtc_state-
> >pixel_rate;
>  
>   cache->plane.rotation = plane_state->base.rotation;
> + /*
> +  * Src coordinates are already rotated by 270 degrees for
> +  * the 90/270 degree plane rotation cases (to match the
> +  * GTT mapping), hence no need to account for rotation here.
> +  */
>   cache->plane.src_w = drm_rect_width(_state->base.src)
> >> 16;
>   cache->plane.src_h = drm_rect_height(_state->base.src) 
> >> 16;
>   cache->plane.visible = plane_state->base.visible;
___
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/psr: Clean-up intel_enable_source_psr1()

2017-04-03 Thread Patchwork
== Series Details ==

Series: drm/i915/psr: Clean-up intel_enable_source_psr1()
URL   : https://patchwork.freedesktop.org/series/22375/
State : success

== Summary ==

Series 22375v1 drm/i915/psr: Clean-up intel_enable_source_psr1()
https://patchwork.freedesktop.org/api/1.0/series/22375/revisions/1/mbox/

Test gem_exec_suspend:
Subgroup basic-s4-devices:
pass   -> DMESG-WARN (fi-kbl-7560u) fdo#100125

fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125

fi-bdw-5557u total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  
time: 430s
fi-bdw-gvtdvmtotal:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  
time: 432s
fi-bsw-n3050 total:278  pass:239  dwarn:0   dfail:0   fail:0   skip:39  
time: 577s
fi-bxt-j4205 total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  
time: 509s
fi-bxt-t5700 total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  
time: 547s
fi-byt-j1900 total:278  pass:251  dwarn:0   dfail:0   fail:0   skip:27  
time: 487s
fi-byt-n2820 total:278  pass:247  dwarn:0   dfail:0   fail:0   skip:31  
time: 481s
fi-hsw-4770  total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  
time: 410s
fi-hsw-4770r total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  
time: 406s
fi-ilk-650   total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  
time: 424s
fi-ivb-3520m total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time: 485s
fi-ivb-3770  total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time: 467s
fi-kbl-7500u total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time: 458s
fi-kbl-7560u total:278  pass:267  dwarn:1   dfail:0   fail:0   skip:10  
time: 567s
fi-skl-6260u total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time: 447s
fi-skl-6700hqtotal:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  
time: 577s
fi-skl-6700k total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  
time: 462s
fi-skl-6770hqtotal:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time: 490s
fi-skl-gvtdvmtotal:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  
time: 436s
fi-snb-2520m total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  
time: 532s
fi-snb-2600  total:278  pass:248  dwarn:0   dfail:0   fail:1   skip:29  
time: 408s

5bc82ec7f62322a91ecf48fa966e68c876637fcd drm-tip: 2017y-04m-03d-16h-44m-48s UTC 
integration manifest
c8cb54e drm/i915/psr: Clean-up intel_enable_source_psr1()

== Logs ==

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


Re: [Intel-gfx] [PATCH] drm/i915/psr: Clean-up intel_enable_source_psr1()

2017-04-03 Thread Vivi, Rodrigo
On Mon, 2017-04-03 at 10:07 -0700, Jim Bride wrote:
> On SKL+ there is a bit in SRD_CTL that software is not supposed to
> modify, but we currently clobber that bit when we enable PSR.  In
> order to preserve the value of that bit, go ahead and read SRD_CTL and
> do a field-wise setting of the various bits that we need to initialize
> before writing the register back out.  Additionally, go ahead and
> explicitly disable single-frame update since we aren't currently
> supporting it.
> 
> Cc: Rodrigo Vivi 
> Cc: Wayne Boyer 
> 
> Signed-off-by: Jim Bride 
> ---
>  drivers/gpu/drm/i915/i915_reg.h  |  3 +++
>  drivers/gpu/drm/i915/intel_psr.c | 23 +--
>  2 files changed, 24 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 11b12f4..54d39e4 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -3590,14 +3590,17 @@ enum {
>  #define   EDP_PSR_SKIP_AUX_EXIT  (1<<12)
>  #define   EDP_PSR_TP1_TP2_SEL(0<<11)
>  #define   EDP_PSR_TP1_TP3_SEL(1<<11)
> +#define   EDP_PSR_TP2_TP3_TIME_MASK (3<<8)
>  #define   EDP_PSR_TP2_TP3_TIME_500us (0<<8)
>  #define   EDP_PSR_TP2_TP3_TIME_100us (1<<8)
>  #define   EDP_PSR_TP2_TP3_TIME_2500us(2<<8)
>  #define   EDP_PSR_TP2_TP3_TIME_0us   (3<<8)
> +#define   EDP_PSR_TP1_TIME_MASK (0x3<<4)
>  #define   EDP_PSR_TP1_TIME_500us (0<<4)
>  #define   EDP_PSR_TP1_TIME_100us (1<<4)
>  #define   EDP_PSR_TP1_TIME_2500us(2<<4)
>  #define   EDP_PSR_TP1_TIME_0us   (3<<4)
> +#define   EDP_PSR_IDLE_FRAME_MASK   (0xf<<0)
>  #define   EDP_PSR_IDLE_FRAME_SHIFT   0
>  
>  #define EDP_PSR_AUX_CTL  
> _MMIO(dev_priv->psr_mmio_base + 0x10)
> diff --git a/drivers/gpu/drm/i915/intel_psr.c 
> b/drivers/gpu/drm/i915/intel_psr.c
> index c3780d0..a050859 100644
> --- a/drivers/gpu/drm/i915/intel_psr.c
> +++ b/drivers/gpu/drm/i915/intel_psr.c
> @@ -280,17 +280,34 @@ static void intel_enable_source_psr1(struct intel_dp 
> *intel_dp)
>* with the 5 or 6 idle patterns.
>*/
>   uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
> - uint32_t val = EDP_PSR_ENABLE;
> + uint32_t val = I915_READ(EDP_PSR_CTL);
>  
> + val |= EDP_PSR_ENABLE;
> +
> + /* We always set the max sleep time to the maximum value, so
> +  * no need to zero out the field first.
> +  */

I believe it is better to zero out instead of adding a comment.
So we could play with max_sleep_time if needed.

Otherwise we shouldn't allow the flexible value here so we should create
a define EDP_PSR_MAX_SLEEP_TIME (0x1f << 20)
and here do a val |= EDP_PSR_MAX_SLEEP_TIME;

>   val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT;
> +
> + val &= ~EDP_PSR_IDLE_FRAME_MASK;
>   val |= idle_frames << EDP_PSR_IDLE_FRAME_SHIFT;
>  
> + val &= ~EDP_PSR_MIN_LINK_ENTRY_TIME_MASK;
>   if (IS_HASWELL(dev_priv))
>   val |= EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES;
>  
> - if (dev_priv->psr.link_standby)
> + if (dev_priv->psr.link_standby) {
>   val |= EDP_PSR_LINK_STANDBY;
>  
> + /* SFU should only be enabled with link standby, but for
> +  * now we do not support it. */
> + val &= ~BDW_PSR_SINGLE_FRAME;
> + } else {
> + val &= ~EDP_PSR_LINK_STANDBY;
> + val &= ~BDW_PSR_SINGLE_FRAME;
> + }
> +
> + val &= ~EDP_PSR_TP1_TIME_MASK;
>   if (dev_priv->vbt.psr.tp1_wakeup_time > 5)
>   val |= EDP_PSR_TP1_TIME_2500us;
>   else if (dev_priv->vbt.psr.tp1_wakeup_time > 1)
> @@ -300,6 +317,7 @@ static void intel_enable_source_psr1(struct intel_dp 
> *intel_dp)
>   else
>   val |= EDP_PSR_TP1_TIME_0us;
>  
> + val &= ~EDP_PSR_TP2_TP3_TIME_MASK;
>   if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
>   val |= EDP_PSR_TP2_TP3_TIME_2500us;
>   else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
> @@ -309,6 +327,7 @@ static void intel_enable_source_psr1(struct intel_dp 
> *intel_dp)
>   else
>   val |= EDP_PSR_TP2_TP3_TIME_0us;
>  
> + val &= ~EDP_PSR_TP1_TP3_SEL;
>   if (intel_dp_source_supports_hbr2(intel_dp) &&
>   drm_dp_tps3_supported(intel_dp->dpcd))
>   val |= EDP_PSR_TP1_TP3_SEL;

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


[Intel-gfx] [maintainer-tools PATCH] dim: Add examples section to dim.rst

2017-04-03 Thread Sean Paul
Along with a recipe for creating a topic branch and sending a pull
request from it.

Signed-off-by: Sean Paul 
---
 dim.rst | 50 ++
 1 file changed, 50 insertions(+)

diff --git a/dim.rst b/dim.rst
index bc4d9a0..4b905ad 100644
--- a/dim.rst
+++ b/dim.rst
@@ -465,6 +465,56 @@ listed using the **list-aliases** subcommand.
 
 The alias functionality requires **bash(1)** version 4.3 or later to work.
 
+EXAMPLES
+
+
+Cross-subsystem pull requests
+-
+So you want to send a pull request to another subsystem? Maintainers will 
likely
+get cranky if you ask them to pull a swath of unrelated drm patches, so we'll
+use a topic branch based upon Linus' tree with only the relevant patches.
+
+First, create the topic branch using dim. Use whichever dim remote is most
+applicable, and name the branch in a manner that describes the set of patches
+you want pulled. The upstream will be Linus' tree.
+
+  $ dim create-branch *dim-remote*/topic/*topic-branch* origin/master
+
+Once the branch is created, you can apply the patches to be pulled.
+
+  $ dim apply-branch topic/*topic-branch*
+
+Build test your new topic branch and push it.
+
+  $ dim push-branch topic/*topic-branch*
+
+Ensure that your topic branch was merged into drm-tip. The drm-tip tree is
+located in $DIM_PREFIX/drm-tip, build test it to ensure the new topic branch
+didn't break anything.
+
+Once you're satisfied that nothing is broken, create the pull request.
+
+  $ dim pull-request topic/*topic-branch* origin/master
+
+You'll be prompted to enter a tag description and your mail user agent will 
open
+with the pull request email. Change names and emails as appropriate to reflect
+who the sender and recipient of the pull is, and send it.
+
+Once the pull has been acked by your maintainer counterpart, you can pull it
+into the appropriate local dim branch.
+
+  $ dim apply-pull *dim-branch*
+
+Perform a final build test, and push *dim-branch* to *dim-remote*.
+
+  $ dim push-branch *dim-branch*
+
+You can now remove the topic branch, as it is no longer useful (you could 
remove
+it any time after the pull request, since it creates a tag, but this is as good
+a place as any).
+
+  $ dim remote-branch topic/*topic-branch*
+
 CONTRIBUTING
 
 
-- 
2.12.2.564.g063fe858b8-goog

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


Re: [Intel-gfx] [GIT PULL] GVT-g fixes for 4.11-rc6

2017-04-03 Thread Jani Nikula
On Sat, 01 Apr 2017, Zhenyu Wang  wrote:
> Hi,
>
> Here's left gvt fixes for 4.11.

Pulled to drm-intel-fixes, thanks.

BR,
Jani.

>
> p.s It's working day for us really, so we can be out for next three days. ;)
>
> Thanks
> --
> The following changes since commit bc2d4b62db67f817b09c782219996630e9c2f5e2:
>
>   drm/i915/gvt: Use force single submit flag to distinguish gvt request from 
> i915 request (2017-03-22 13:18:56 +0800)
>
> are available in the git repository at:
>
>   https://github.com/01org/gvt-linux.git tags/gvt-fixes-2017-04-01
>
> for you to fetch changes up to aa4ce4493c88dc324911152d1ccd25469366dba3:
>
>   drm/i915/gvt: Fix firmware loading interface for GVT-g golden HW state 
> (2017-04-01 13:13:27 +0800)
>
> 
> gvt-fixes-2017-04-01
>
> - Fix cfg space in failsafe (Changbin)
> - Fix a race for irq inject with vgpu release (Zhi)
> - Fix golden state firmware load (Zhi)
>
> 
> Changbin Du (1):
>   drm/i915/gvt: exclude cfg space from failsafe mode
>
> Zhi Wang (2):
>   drm/i915/gvt: Activate/de-activate vGPU in mdev ops.
>   drm/i915/gvt: Fix firmware loading interface for GVT-g golden HW state
>
>  drivers/gpu/drm/i915/gvt/cfg_space.c |  3 ---
>  drivers/gpu/drm/i915/gvt/firmware.c  |  9 +---
>  drivers/gpu/drm/i915/gvt/gvt.c   |  2 ++
>  drivers/gpu/drm/i915/gvt/gvt.h   |  5 -
>  drivers/gpu/drm/i915/gvt/kvmgt.c |  4 
>  drivers/gpu/drm/i915/gvt/vgpu.c  | 43 
> +++-
>  6 files changed, 54 insertions(+), 12 deletions(-)

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


Re: [Intel-gfx] [PATCH] dim: Use mktemp for pull-request mails

2017-04-03 Thread Jani Nikula
On Fri, 31 Mar 2017, Sean Paul  wrote:
> Instead of hardcoding ~/tmp in dim (and failing when it doesn't
> exist), use mktemp to create the pull-request mail file.

A few nitpicks below, otherwise lgtm.

BR,
Jani.


>
> Signed-off-by: Sean Paul 
> ---
>  dim | 28 
>  1 file changed, 16 insertions(+), 12 deletions(-)
>
> diff --git a/dim b/dim
> index 8357d4f..8b61fd8 100755
> --- a/dim
> +++ b/dim
> @@ -1278,9 +1278,11 @@ function prep_pull_mail_overview
>  # $@: tags, if any, to extract into the pull request overview
>  function prep_pull_mail
>  {

Please add "local file" here.

> - prep_pull_mail_greetings > ~/tmp/dim-pull-request
> - prep_pull_mail_overview "$@" >> ~/tmp/dim-pull-request
> - prep_pull_mail_signature >> ~/tmp/dim-pull-request
> + file=$1
> + shift
> + prep_pull_mail_greetings > $file
> + prep_pull_mail_overview "$@" >> $file
> + prep_pull_mail_signature >> $file
>  }
>  
>  function dim_create_workdir
> @@ -1391,17 +1393,18 @@ function dim_update_next_continue
>   $DRY git tag $tag_testing $DIM_DRM_INTEL_REMOTE/drm-intel-testing
>   $DRY git push $DIM_DRM_INTEL_REMOTE $tag_testing
>  
> - cat > ~/tmp/test-request <<-HERE
> + req_file=$(mktemp)

Please add "local req_file" at the top of the function.

> + cat > $req_file <<-HERE
>   Hi all,
>  
>   HERE
>   obj=$(git rev-parse $tag)
>   if [[ "$(git cat-file -t $obj)" == "tag" ]] ; then
> - git cat-file -p $obj | tail -n+6 >> ~/tmp/test-request
> + git cat-file -p $obj | tail -n+6 >> $req_file
>   else
> - echo "" >> 
> ~/tmp/test-request
> + echo "" >> 
> $req_file
>   fi
> - cat >> ~/tmp/test-request <<-HERE
> + cat >> $req_file <<-HERE
>  
>   Happy testing!
>  
> @@ -1409,7 +1412,7 @@ function dim_update_next_continue
>   HERE
>  
>   $DRY $DIM_MUA -s "Updated drm-intel-testing" \
> -  -i ~/tmp/test-request \
> +  -i $req_file \
>-c "$addr_intel_gfx" \
>-c "$addr_intel_gfx_maintainer1" \
>-c "$addr_intel_gfx_maintainer2" \
> @@ -1448,6 +1451,7 @@ function dim_pull_request
>   branch=${1:?$usage}
>   upstream=${2:?$usage}
>   remote=$(branch_to_remote $branch)
> + req_file=$(mktemp)

Please add "local req_file" at the top of the function.

>  
>   if [ "$branch" != "drm-intel-next" ]; then
>   assert_branch $branch
> @@ -1461,7 +1465,7 @@ function dim_pull_request
>   if [ "$branch" = "drm-intel-next" ]; then
>   # drm-intel-next pulls have been tagged using dim update-next
>   drm_intel_next_tags=$(git log "$branch@{upstream}" ^$upstream 
> --decorate | grep "(.*tag: drm-intel-next-" | sed -e "s/^.*(.*tag: 
> \(drm-intel-next-[^ ,]*\).*)$/\1/")
> - prep_pull_mail $drm_intel_next_tags
> + prep_pull_mail $req_file $drm_intel_next_tags
>   tag=$(git describe --all --exact "$branch@{upstream}")
>  
>   repo="drm-intel"
> @@ -1475,7 +1479,7 @@ function dim_pull_request
>   gitk "$branch@{upstream}" ^$upstream &
>   $DRY git tag -a $tag "$branch@{upstream}"
>   $DRY git push $remote $tag
> - prep_pull_mail $tag
> + prep_pull_mail $req_file $tag
>  
>   repo=$(branch_to_repo $branch)
>   fi
> @@ -1483,9 +1487,9 @@ function dim_pull_request
>   url=${drm_tip_repos[$repo]}
>   git_url=$(echo $url | sed -e 's/git\./anongit./' -e 's/ssh:/git:/')
>  
> - git request-pull $upstream $git_url $tag >> ~/tmp/dim-pull-request
> + git request-pull $upstream $git_url $tag >> $req_file
>   $DRY $DIM_MUA -s "[PULL] $branch" \
> - -i ~/tmp/dim-pull-request \
> + -i $req_file \
>   -c "$addr_intel_gfx" \
>   -c "$addr_dri_devel" \
>   -c "$addr_intel_gfx_maintainer1" \

-- 
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] drm/i915/psr: Clean-up intel_enable_source_psr1()

2017-04-03 Thread Jim Bride
On SKL+ there is a bit in SRD_CTL that software is not supposed to
modify, but we currently clobber that bit when we enable PSR.  In
order to preserve the value of that bit, go ahead and read SRD_CTL and
do a field-wise setting of the various bits that we need to initialize
before writing the register back out.  Additionally, go ahead and
explicitly disable single-frame update since we aren't currently
supporting it.

Cc: Rodrigo Vivi 
Cc: Wayne Boyer 

Signed-off-by: Jim Bride 
---
 drivers/gpu/drm/i915/i915_reg.h  |  3 +++
 drivers/gpu/drm/i915/intel_psr.c | 23 +--
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 11b12f4..54d39e4 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -3590,14 +3590,17 @@ enum {
 #define   EDP_PSR_SKIP_AUX_EXIT(1<<12)
 #define   EDP_PSR_TP1_TP2_SEL  (0<<11)
 #define   EDP_PSR_TP1_TP3_SEL  (1<<11)
+#define   EDP_PSR_TP2_TP3_TIME_MASK (3<<8)
 #define   EDP_PSR_TP2_TP3_TIME_500us   (0<<8)
 #define   EDP_PSR_TP2_TP3_TIME_100us   (1<<8)
 #define   EDP_PSR_TP2_TP3_TIME_2500us  (2<<8)
 #define   EDP_PSR_TP2_TP3_TIME_0us (3<<8)
+#define   EDP_PSR_TP1_TIME_MASK (0x3<<4)
 #define   EDP_PSR_TP1_TIME_500us   (0<<4)
 #define   EDP_PSR_TP1_TIME_100us   (1<<4)
 #define   EDP_PSR_TP1_TIME_2500us  (2<<4)
 #define   EDP_PSR_TP1_TIME_0us (3<<4)
+#define   EDP_PSR_IDLE_FRAME_MASK   (0xf<<0)
 #define   EDP_PSR_IDLE_FRAME_SHIFT 0
 
 #define EDP_PSR_AUX_CTL
_MMIO(dev_priv->psr_mmio_base + 0x10)
diff --git a/drivers/gpu/drm/i915/intel_psr.c b/drivers/gpu/drm/i915/intel_psr.c
index c3780d0..a050859 100644
--- a/drivers/gpu/drm/i915/intel_psr.c
+++ b/drivers/gpu/drm/i915/intel_psr.c
@@ -280,17 +280,34 @@ static void intel_enable_source_psr1(struct intel_dp 
*intel_dp)
 * with the 5 or 6 idle patterns.
 */
uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
-   uint32_t val = EDP_PSR_ENABLE;
+   uint32_t val = I915_READ(EDP_PSR_CTL);
 
+   val |= EDP_PSR_ENABLE;
+
+   /* We always set the max sleep time to the maximum value, so
+* no need to zero out the field first.
+*/
val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT;
+
+   val &= ~EDP_PSR_IDLE_FRAME_MASK;
val |= idle_frames << EDP_PSR_IDLE_FRAME_SHIFT;
 
+   val &= ~EDP_PSR_MIN_LINK_ENTRY_TIME_MASK;
if (IS_HASWELL(dev_priv))
val |= EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES;
 
-   if (dev_priv->psr.link_standby)
+   if (dev_priv->psr.link_standby) {
val |= EDP_PSR_LINK_STANDBY;
 
+   /* SFU should only be enabled with link standby, but for
+* now we do not support it. */
+   val &= ~BDW_PSR_SINGLE_FRAME;
+   } else {
+   val &= ~EDP_PSR_LINK_STANDBY;
+   val &= ~BDW_PSR_SINGLE_FRAME;
+   }
+
+   val &= ~EDP_PSR_TP1_TIME_MASK;
if (dev_priv->vbt.psr.tp1_wakeup_time > 5)
val |= EDP_PSR_TP1_TIME_2500us;
else if (dev_priv->vbt.psr.tp1_wakeup_time > 1)
@@ -300,6 +317,7 @@ static void intel_enable_source_psr1(struct intel_dp 
*intel_dp)
else
val |= EDP_PSR_TP1_TIME_0us;
 
+   val &= ~EDP_PSR_TP2_TP3_TIME_MASK;
if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
val |= EDP_PSR_TP2_TP3_TIME_2500us;
else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
@@ -309,6 +327,7 @@ static void intel_enable_source_psr1(struct intel_dp 
*intel_dp)
else
val |= EDP_PSR_TP2_TP3_TIME_0us;
 
+   val &= ~EDP_PSR_TP1_TP3_SEL;
if (intel_dp_source_supports_hbr2(intel_dp) &&
drm_dp_tps3_supported(intel_dp->dpcd))
val |= EDP_PSR_TP1_TP3_SEL;
-- 
2.7.4

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


[Intel-gfx] [PATCH] dim: add backmerge tool

2017-04-03 Thread Daniel Vetter
Does a few sanity checks to avoid common gotchas:
- make sure the backmerge is in drm-tip already
- check that git rerere resolves all conflict, and cuation if not
- merge commit template.

Cc: Sean Paul 
Signed-off-by: Daniel Vetter 
---
 bash_completion |  2 +-
 dim | 54 ++
 dim.rst |  7 +++
 3 files changed, 62 insertions(+), 1 deletion(-)

diff --git a/bash_completion b/bash_completion
index 7dfc4b86cb13..451db26aae8c 100644
--- a/bash_completion
+++ b/bash_completion
@@ -75,7 +75,7 @@ _dim ()
checkpatch)
# FIXME needs a git sha1
;;
-   pull-request)
+   pull-request|backmerge)
if [[ $args == 2 ]]; then
COMPREPLY=( $( compgen -W "$nightly_branches" 
-- $cur ) )
elif [[ $args == 3 ]]; then
diff --git a/dim b/dim
index 8357d4f635e7..6474d078af67 100755
--- a/dim
+++ b/dim
@@ -749,6 +749,60 @@ function dim_apply_pull
return $rv
 }
 
+function dim_backmerge
+{
+   local branch upstream patch_file
+
+   branch=${1:?$usage}
+   upstream=${2:?$usage}
+
+   cd $DIM_PREFIX/drm-tip
+   tip_remote=$(url_to_remote $drm_tip_ssh)
+   git fetch -q $tip_remote || true
+
+   if ! git merge-base --is-ancestor $upstream $tip_remote/drm-tip ; then
+   echoerr "Upstream $upstream not merged into drm-tip, aborting."
+   echoerr "Please make sure any backmerge is tested in drm-tip,"
+   echoerr "to give all the CI bots some time to find bugs."
+   exit 1
+   fi
+
+   assert_branch $branch
+   assert_repo_clean
+
+   git merge --rerere-autoupdate --no-commit $upstream >& /dev/null || true
+
+   if [[ -d .git ]]; then
+   patch_file=".git"
+   else
+   patch_file=$(cut -d ' ' -f 2 .git)
+   fi
+   patch_file=$patch_file/MERGE_MSG
+
+
+   cat > $patch_file <<-HERE
+   Merge $upstream into $branch
+
+   Explain here why you've done the backmerge, e.g. which patches
+   or which driver pull request you need to be able to merge
+   \$feature_work from \$author.
+
+   HERE
+
+   if git diff | grep -q '\(<<<\|===\|>>>\\)' ; then
+   echoerr "Conflicts find while merging $upstream into $branch."
+   echoerr "This should only happen when git rerere gets confused" 
+   echoerr "or if there's a manual fixup patch in drm-rerere." 
+   echoerr "Please proceed with extreme caution." 
+   echoerr "Once the conflict is resolved, commit it with" 
+   echoerr "   git commit -a" 
+   fi
+
+   git add -u
+   git commit -s
+
+}
+
 function dim_add_link
 {
local branch file message_id
diff --git a/dim.rst b/dim.rst
index bc4d9a0b2a76..b99248e24a8d 100644
--- a/dim.rst
+++ b/dim.rst
@@ -360,6 +360,13 @@ apply-pull *branch*
 ---
 Reads a pull request mail from stdin and merges it into the given *branch*.
 
+backmerge *branch* *upstream*
+-
+
+Backmerges *upstream* into *branch*, making a few sanity checks on the way. The
+*upstream* we backmerge should be the same as used for sending out pull 
requests
+using **pull-request**.
+
 update-next
 ---
 Pushes out the latest dinq to drm-intel-next and tags it. Also
-- 
2.11.0

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


Re: [Intel-gfx] [PATCH] dim: Add apply-pull command

2017-04-03 Thread Gabriel Krisman Bertazi
Jani Nikula  writes:

>> +
>> +git commit --amend -s
>
> I think the intention is to just add the signoff, but this ends up
> trying to fire up the editor, which is really not good for piping.
>

You probably want --no-edit for that.


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


Re: [Intel-gfx] [PATCH] dim: Add apply-pull command

2017-04-03 Thread Jani Nikula
On Thu, 30 Mar 2017, Daniel Vetter  wrote:
> I'm getting real lazy, let's start scripting this. Very rough draft,
> but adds a Link: (patchwork tracks pull requests too, maybe we'll
> start CI-ing them too), and sob line. In the future we might add more
> checks here ...
>
> Signed-off-by: Daniel Vetter 
> ---
>  dim | 34 ++
>  dim.rst |  4 
>  2 files changed, 38 insertions(+)
>
> diff --git a/dim b/dim
> index 0903f6c2634d..73c25a195f17 100755
> --- a/dim
> +++ b/dim
> @@ -717,6 +717,40 @@ function dim_apply_branch
>   return $rv
>  }
>  
> +dim_alias_ap=apply-pull
> +function dim_apply_pull
> +{
> + local branch file message_id pull_branch rv
> +
> + branch=${1:?$usage}
> + shift
> + file=$(mktemp)
> +
> + assert_branch $branch
> + assert_repo_clean
> +
> + cat > $file
> +
> + pull_branch=$(sed -e '0,/git repository at:$/d' $file | head -n 2 | 
> tail -n 1)
> +
> + echo $pull_branch
> +
> + git pull $pull_branch
> +
> + message_id=$(message_get_id $file)
> +
> + if [ -n "$message_id" ]; then
> + dim_commit_add_tag "\nLink: 
> http://patchwork.freedesktop.org/patch/msgid/$message_id;

The \n there doesn't do what you think it does, at least not for me. I
end up with "nLink: " in the commit message.

> + else
> + echoerr "WARNING: No message-id found in the patch file."
> + rv=1
> + fi
> +
> + git commit --amend -s

I think the intention is to just add the signoff, but this ends up
trying to fire up the editor, which is really not good for piping.

BR,
Jani.

> +
> + return $rv
> +}
> +
>  function dim_add_link
>  {
>   local branch file message_id
> diff --git a/dim.rst b/dim.rst
> index aed79ca1d43c..a1c67143d910 100644
> --- a/dim.rst
> +++ b/dim.rst
> @@ -356,6 +356,10 @@ tag; this must have been done previously using 
> **update-next**. This also means
>  that the pull request can be regenerated with the same commands if something
>  goes wrong.
>  
> +apply-pull *branch*
> +---
> +Reads a pull request mail from stdin and merges it into the given *branch*.
> +
>  update-next
>  ---
>  Pushes out the latest dinq to drm-intel-next and tags it. Also

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


Re: [Intel-gfx] [BUG][REGRESSION] i915 gpu hangs under load

2017-04-03 Thread Jani Nikula
On Sun, 02 Apr 2017, Martin Kepplinger  wrote:
> Am 2. April 2017 13:50:26 MESZ schrieb Thorsten Leemhuis 
> :
>>Lo! On 22.03.2017 11:36, Jani Nikula wrote:
>>> On Wed, 22 Mar 2017, Martin Kepplinger  wrote:
 I know something similar is here: 
 https://bugs.freedesktop.org/show_bug.cgi?id=100110 too.
 But this is rc3 and my machine is totally *not usable*. Let me be 
 annoying :) I hope I can help:
>>> Please file a bug over at [1].
>>> […]
>>> [1]
>>https://bugs.freedesktop.org/enter_bug.cgi?product=DRI=DRM/Intel
>>
>>@Martin: did you file that bug? I could not find one :-/
>
> I did. Got marked as duplicate of 
> https://bugs.freedesktop.org/show_bug.cgi?id=100181 and there's a fix out 
> there. I don't know if it's in rc5 though.

Should be fixed in v4.11-rc5 by

commit 0abfe7e2570d7c729a7662e82c09a23f00f29346
Author: Chris Wilson 
Date:   Wed Mar 22 20:59:30 2017 +

drm/i915: Restore marking context objects as dirty on pinning

>>@Jani: In similar situations could you do me a favour and ask people to
>>send one more reply to the public list which contains the link to the
>>bug filed? Regression tracking is quite hard already; searching various
>>bug tracker for follow up bug entries makes it even harder :-(

I'll try, thanks for the feedback.

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


Re: [Intel-gfx] [PATCH 12/13] drm/i915: Async GPU relocation processing

2017-04-03 Thread Joonas Lahtinen
On ke, 2017-03-29 at 16:56 +0100, Chris Wilson wrote:
> If the user requires patching of their batch or auxiliary buffers, we
> currently make the alterations on the cpu. If they are active on the GPU
> at the time, we wait under the struct_mutex for them to finish executing
> before we rewrite the contents. This happens if shared relocation trees
> are used between different contexts with separate address space (and the
> buffers then have different addresses in each), the 3D state will need
> to be adjusted between execution on each context. However, we don't need
> to use the CPU to do the relocation patching, as we could queue commands
> to the GPU to perform it and use fences to serialise the operation with
> the current activity and future - so the operation on the GPU appears
> just as atomic as performing it immediately. Performing the relocation
> rewrites on the GPU is not free, in terms of pure throughput, the number
> of relocations/s is about halved - but more importantly so is the time
> under the struct_mutex.
> 
> v2: Break out the request/batch allocation for clearer error flow.
> 
> Signed-off-by: Chris Wilson 



>  static void reloc_cache_reset(struct reloc_cache *cache)
>  {
>   void *vaddr;
>  
> + if (cache->rq)
> + reloc_gpu_flush(cache);

An odd place to do the flush, I was expecting GEM_BUG_ON(cache->rq);

The instruction generation I've gone through in one spot in the code,
no intention going over it more times.

Reviewed-by: Joonas Lahtinen 

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] ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: intel_ring.engine is unused

2017-04-03 Thread Chris Wilson
On Mon, Apr 03, 2017 at 11:54:47AM -, Patchwork wrote:
> == Series Details ==
> 
> Series: series starting with [1/2] drm/i915: intel_ring.engine is unused
> URL   : https://patchwork.freedesktop.org/series/22358/
> State : success
> 
> == Summary ==
> 
> Series 22358v1 Series without cover letter
> https://patchwork.freedesktop.org/api/1.0/series/22358/revisions/1/mbox/
> 
> Test kms_pipe_crc_basic:
> Subgroup suspend-read-crc-pipe-c:
> pass   -> DMESG-WARN (fi-bsw-n3050) fdo#100113
> 
> fdo#100113 https://bugs.freedesktop.org/show_bug.cgi?id=100113

Pushed the really minor tidy.
-Chris

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


Re: [Intel-gfx] [PATCH 2/2] drm/i915: Onion unwind for intel_init_ring_common()

2017-04-03 Thread Joonas Lahtinen
On ma, 2017-04-03 at 12:34 +0100, Chris Wilson wrote:
> Rather than call intel_engine_cleanup() with a partially constructed
> engine, unwind the error during intel_init_ring_common().
> 
> Signed-off-by: Chris Wilson 
> Cc: Joonas Lahtinen 

Reviewed-by: Joonas Lahtinen 

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


[Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: intel_ring.engine is unused

2017-04-03 Thread Patchwork
== Series Details ==

Series: series starting with [1/2] drm/i915: intel_ring.engine is unused
URL   : https://patchwork.freedesktop.org/series/22358/
State : success

== Summary ==

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

Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-c:
pass   -> DMESG-WARN (fi-bsw-n3050) fdo#100113

fdo#100113 https://bugs.freedesktop.org/show_bug.cgi?id=100113

fi-bdw-5557u total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  
time: 430s
fi-bdw-gvtdvmtotal:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  
time: 430s
fi-bsw-n3050 total:278  pass:238  dwarn:1   dfail:0   fail:0   skip:39  
time: 571s
fi-bxt-j4205 total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  
time: 509s
fi-bxt-t5700 total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  
time: 540s
fi-byt-j1900 total:278  pass:251  dwarn:0   dfail:0   fail:0   skip:27  
time: 484s
fi-byt-n2820 total:278  pass:247  dwarn:0   dfail:0   fail:0   skip:31  
time: 486s
fi-hsw-4770  total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  
time: 405s
fi-hsw-4770r total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  
time: 407s
fi-ilk-650   total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  
time: 423s
fi-ivb-3520m total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time: 493s
fi-ivb-3770  total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time: 474s
fi-kbl-7500u total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time: 457s
fi-kbl-7560u total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time: 574s
fi-skl-6260u total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time: 451s
fi-skl-6700hqtotal:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  
time: 568s
fi-skl-6700k total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  
time: 461s
fi-skl-6770hqtotal:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time: 492s
fi-skl-gvtdvmtotal:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  
time: 437s
fi-snb-2520m total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  
time: 528s
fi-snb-2600  total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  
time: 407s

61a93a2f9a2d9a611d673ecd0dfa693f0c888003 drm-tip: 2017y-04m-03d-09h-50m-53s UTC 
integration manifest
5f8f5aa drm/i915: Onion unwind for intel_init_ring_common()
cc2e8ad drm/i915: intel_ring.engine is unused

== Logs ==

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


[Intel-gfx] [PATCH 2/2] drm/i915: Onion unwind for intel_init_ring_common()

2017-04-03 Thread Chris Wilson
Rather than call intel_engine_cleanup() with a partially constructed
engine, unwind the error during intel_init_ring_common().

Signed-off-by: Chris Wilson 
Cc: Joonas Lahtinen 
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 77 +++--
 1 file changed, 36 insertions(+), 41 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c 
b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 5e7634c00cbd..c98acc27279a 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1259,6 +1259,8 @@ static int init_phys_status_page(struct intel_engine_cs 
*engine)
 {
struct drm_i915_private *dev_priv = engine->i915;
 
+   GEM_BUG_ON(engine->id != RCS);
+
dev_priv->status_page_dmah =
drm_pci_alloc(_priv->drm, PAGE_SIZE, PAGE_SIZE);
if (!dev_priv->status_page_dmah)
@@ -1481,76 +1483,69 @@ static void intel_ring_context_unpin(struct 
intel_engine_cs *engine,
 static int intel_init_ring_buffer(struct intel_engine_cs *engine)
 {
struct intel_ring *ring;
-   int ret;
-
-   WARN_ON(engine->buffer);
+   int err;
 
intel_engine_setup_common(engine);
 
-   ret = intel_engine_init_common(engine);
-   if (ret)
-   goto error;
+   err = intel_engine_init_common(engine);
+   if (err)
+   goto err;
 
-   if (HWS_NEEDS_PHYSICAL(engine->i915)) {
-   WARN_ON(engine->id != RCS);
-   ret = init_phys_status_page(engine);
-   if (ret)
-   goto error;
-   } else {
-   ret = init_status_page(engine);
-   if (ret)
-   goto error;
-   }
+   if (HWS_NEEDS_PHYSICAL(engine->i915))
+   err = init_phys_status_page(engine);
+   else
+   err = init_status_page(engine);
+   if (err)
+   goto err;
 
ring = intel_engine_create_ring(engine, 32 * PAGE_SIZE);
if (IS_ERR(ring)) {
-   ret = PTR_ERR(ring);
-   goto error;
+   err = PTR_ERR(ring);
+   goto err_hws;
}
 
/* Ring wraparound at offset 0 sometimes hangs. No idea why. */
-   ret = intel_ring_pin(ring, engine->i915, I915_GTT_PAGE_SIZE);
-   if (ret) {
-   intel_ring_free(ring);
-   goto error;
-   }
+   err = intel_ring_pin(ring, engine->i915, I915_GTT_PAGE_SIZE);
+   if (err)
+   goto err_ring;
+
+   GEM_BUG_ON(engine->buffer);
engine->buffer = ring;
 
return 0;
 
-error:
-   intel_engine_cleanup(engine);
-   return ret;
+err_ring:
+   intel_ring_free(ring);
+err_hws:
+   if (HWS_NEEDS_PHYSICAL(engine->i915))
+   cleanup_phys_status_page(engine);
+   else
+   cleanup_status_page(engine);
+err:
+   intel_engine_cleanup_common(engine);
+   return err;
 }
 
 void intel_engine_cleanup(struct intel_engine_cs *engine)
 {
-   struct drm_i915_private *dev_priv;
-
-   dev_priv = engine->i915;
+   struct drm_i915_private *dev_priv = engine->i915;
 
-   if (engine->buffer) {
-   WARN_ON(INTEL_GEN(dev_priv) > 2 &&
-   (I915_READ_MODE(engine) & MODE_IDLE) == 0);
+   WARN_ON(INTEL_GEN(dev_priv) > 2 &&
+   (I915_READ_MODE(engine) & MODE_IDLE) == 0);
 
-   intel_ring_unpin(engine->buffer);
-   intel_ring_free(engine->buffer);
-   engine->buffer = NULL;
-   }
+   intel_ring_unpin(engine->buffer);
+   intel_ring_free(engine->buffer);
 
if (engine->cleanup)
engine->cleanup(engine);
 
-   if (HWS_NEEDS_PHYSICAL(dev_priv)) {
-   WARN_ON(engine->id != RCS);
+   if (HWS_NEEDS_PHYSICAL(dev_priv))
cleanup_phys_status_page(engine);
-   } else {
+   else
cleanup_status_page(engine);
-   }
 
intel_engine_cleanup_common(engine);
 
-   engine->i915 = NULL;
dev_priv->engine[engine->id] = NULL;
kfree(engine);
 }
-- 
2.11.0

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


[Intel-gfx] [PATCH 1/2] drm/i915: intel_ring.engine is unused

2017-04-03 Thread Chris Wilson
Or rather it is used only by intel_ring_pin() to extract the
drm_i915_private which we can easily pass in. As this is a relatively
rare operation, save the space in the struct, and as such it is even
break even in the extra code for passing around the parameter:

add/remove: 0/0 grow/shrink: 2/3 up/down: 15/-15 (0)
function old new   delta
intel_init_ring_buffer   906 918 +12
execlists_context_pin   13081311  +3
mock_engine  407 403  -4
intel_engine_create_ring 367 363  -4
intel_ring_pin   326 319  -7
Total: Before=1261794, After=1261794, chg +0.00%

v2: Reorder intel_init_ring_buffer to keep the ring setup together:

add/remove: 0/0 grow/shrink: 2/3 up/down: 9/-15 (-6)
function old new   delta
intel_init_ring_buffer   906 912  +6
execlists_context_pin   13081311  +3
mock_engine  407 403  -4
intel_engine_create_ring 367 363  -4
intel_ring_pin   326 319  -7
Total: Before=1261794, After=1261788, chg -0.00%

Signed-off-by: Chris Wilson 
Reviewed-by: Joonas Lahtinen 
---
 drivers/gpu/drm/i915/intel_lrc.c |  2 +-
 drivers/gpu/drm/i915/intel_ringbuffer.c  | 28 +---
 drivers/gpu/drm/i915/intel_ringbuffer.h  |  6 +++---
 drivers/gpu/drm/i915/selftests/mock_engine.c |  1 -
 4 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index c8f7c631fc1f..0dc1cc4ad6e7 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -771,7 +771,7 @@ static int execlists_context_pin(struct intel_engine_cs 
*engine,
goto unpin_vma;
}
 
-   ret = intel_ring_pin(ce->ring, ctx->ggtt_offset_bias);
+   ret = intel_ring_pin(ce->ring, ctx->i915, ctx->ggtt_offset_bias);
if (ret)
goto unpin_map;
 
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c 
b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 66a2b8b83972..5e7634c00cbd 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1270,17 +1270,18 @@ static int init_phys_status_page(struct intel_engine_cs 
*engine)
return 0;
 }
 
-int intel_ring_pin(struct intel_ring *ring, unsigned int offset_bias)
+int intel_ring_pin(struct intel_ring *ring,
+  struct drm_i915_private *i915,
+  unsigned int offset_bias)
 {
-   unsigned int flags;
-   enum i915_map_type map;
+   enum i915_map_type map = HAS_LLC(i915) ? I915_MAP_WB : I915_MAP_WC;
struct i915_vma *vma = ring->vma;
+   unsigned int flags;
void *addr;
int ret;
 
GEM_BUG_ON(ring->vaddr);
 
-   map = HAS_LLC(ring->engine->i915) ? I915_MAP_WB : I915_MAP_WC;
 
flags = PIN_GLOBAL;
if (offset_bias)
@@ -1369,8 +1370,6 @@ intel_engine_create_ring(struct intel_engine_cs *engine, 
int size)
if (!ring)
return ERR_PTR(-ENOMEM);
 
-   ring->engine = engine;
-
INIT_LIST_HEAD(>request_list);
 
ring->size = size;
@@ -1481,7 +1480,6 @@ static void intel_ring_context_unpin(struct 
intel_engine_cs *engine,
 
 static int intel_init_ring_buffer(struct intel_engine_cs *engine)
 {
-   struct drm_i915_private *dev_priv = engine->i915;
struct intel_ring *ring;
int ret;
 
@@ -1493,13 +1491,7 @@ static int intel_init_ring_buffer(struct intel_engine_cs 
*engine)
if (ret)
goto error;
 
-   ring = intel_engine_create_ring(engine, 32 * PAGE_SIZE);
-   if (IS_ERR(ring)) {
-   ret = PTR_ERR(ring);
-   goto error;
-   }
-
-   if (HWS_NEEDS_PHYSICAL(dev_priv)) {
+   if (HWS_NEEDS_PHYSICAL(engine->i915)) {
WARN_ON(engine->id != RCS);
ret = init_phys_status_page(engine);
if (ret)
@@ -1510,8 +1502,14 @@ static int intel_init_ring_buffer(struct intel_engine_cs 
*engine)
goto error;
}
 
+   ring = intel_engine_create_ring(engine, 32 * PAGE_SIZE);
+   if (IS_ERR(ring)) {
+   ret = PTR_ERR(ring);
+   goto error;
+   }
+
/* Ring wraparound at offset 0 sometimes hangs. No idea why. */
-   ret = intel_ring_pin(ring, I915_GTT_PAGE_SIZE);
+   ret = intel_ring_pin(ring, engine->i915, I915_GTT_PAGE_SIZE);
if (ret) {
intel_ring_free(ring);
goto error;
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h 
b/drivers/gpu/drm/i915/intel_ringbuffer.h
index a82a0807f64d..cbe61d3f31da 100644
--- 

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Park the signaler before sleeping

2017-04-03 Thread Patchwork
== Series Details ==

Series: drm/i915: Park the signaler before sleeping
URL   : https://patchwork.freedesktop.org/series/22357/
State : success

== Summary ==

Series 22357v1 drm/i915: Park the signaler before sleeping
https://patchwork.freedesktop.org/api/1.0/series/22357/revisions/1/mbox/

Test gem_exec_suspend:
Subgroup basic-s4-devices:
pass   -> DMESG-WARN (fi-kbl-7560u) fdo#100125

fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125

fi-bdw-5557u total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  
time: 430s
fi-bdw-gvtdvmtotal:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  
time: 428s
fi-bsw-n3050 total:278  pass:239  dwarn:0   dfail:0   fail:0   skip:39  
time: 571s
fi-bxt-j4205 total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  
time: 505s
fi-bxt-t5700 total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  
time: 552s
fi-byt-j1900 total:278  pass:251  dwarn:0   dfail:0   fail:0   skip:27  
time: 488s
fi-byt-n2820 total:278  pass:247  dwarn:0   dfail:0   fail:0   skip:31  
time: 476s
fi-hsw-4770  total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  
time: 408s
fi-hsw-4770r total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  
time: 412s
fi-ilk-650   total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  
time: 414s
fi-ivb-3520m total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time: 490s
fi-ivb-3770  total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time: 464s
fi-kbl-7500u total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time: 455s
fi-kbl-7560u total:278  pass:267  dwarn:1   dfail:0   fail:0   skip:10  
time: 571s
fi-skl-6260u total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time: 456s
fi-skl-6700hqtotal:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  
time: 571s
fi-skl-6700k total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  
time: 460s
fi-skl-6770hqtotal:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time: 489s
fi-skl-gvtdvmtotal:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  
time: 433s
fi-snb-2520m total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  
time: 529s
fi-snb-2600  total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  
time: 407s

61a93a2f9a2d9a611d673ecd0dfa693f0c888003 drm-tip: 2017y-04m-03d-09h-50m-53s UTC 
integration manifest
7064b74 drm/i915: Park the signaler before sleeping

== Logs ==

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


Re: [Intel-gfx] [PATCH 1/3] drm: Document maintainer duties

2017-04-03 Thread Eric Engestrom
On Monday, 2017-03-27 10:45:44 +0200, Daniel Vetter wrote:
> I wanted to get Sean Paul to run the drm-misc show for a bit, for
> training reasons and to increase the bus factor. And then realized
> there's no docs about what maintainers are doing.
> 
> Fix that.
> 
> v2: Add backmerges and taking the blame.
> 
> Signed-off-by: Daniel Vetter 
> ---
>  drm-misc.rst | 36 
>  1 file changed, 36 insertions(+)
> 
> diff --git a/drm-misc.rst b/drm-misc.rst
> index 139d45e92edf..b6d01f2c7c2b 100644
> --- a/drm-misc.rst
> +++ b/drm-misc.rst
> @@ -142,6 +142,42 @@ Slightly different rules apply:
>more involved rework in follow-up work. This way lengthy review cycles get
>avoided, which are a drag for both reviewer and author.
>  
> +Maintainer's Duties
> +===
> +
> +Maintainers mostly provide services to keep drm-misc running smoothly:
> +
> +* Coordinate cross-subsystem depencies and handle topic branches, sending out

s/depencies/dependencies/

> +  pull request and merging topic pull requests from other subsystems.
> +
> +* At least once per week check for pending bugfixes (using ``dim status``) 
> and
> +  if there are any (either in `-fixes` or `-next-fixes`), send out the pull
> +  request.
> +
> +* Fast-forward (when possible) `-fixes` to each released -rc kernel tag, to
> +  keep it current. We try to avoid backmerges for bugfix branches, and 
> rebasing
> +  isn't an option with multiple committers.
> +
> +* During the merge-windo blackout, i.e. from -rc6 on until the merge window

s/windo/window/

> +  closes with the release of -rc1, try to track `drm-next` with the
> +  `-next-fixes` branch. Do not advance past -rc1, otherwise the automagic in
> +  the scripts will push the wrong patches to the linux-next tree.
> +
> +* Between -rc1 and -rc6 send pull requests for the `-next` branch every 1-2
> +  weeks, depending upon how much is queued up.
> +
> +* Backmerge `drm-next` into the `-next` branch when needed, properly 
> recording
> +  that reason in the merge commit message. Do a backmerge at least once per
> +  month to avoid conflict chaos, and specifically merge in the main drm 
> feature
> +  pull request, to resync with all the late driver submissions during the 
> merge
> +  window.
> +
> +* Last resort fallback for applying patches, in case all area expert 
> committers
> +  are somehow unavailable.
> +
> +* Take the blame when something goes wrong. Maintainers interface and 
> represent
> +  the entire group of committers to the wider kernel community.

:)

> +
>  Tooling
>  ===
>  
> -- 
> 2.11.0
> 
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm/i915: Park the signaler before sleeping

2017-04-03 Thread Chris Wilson
If the signal to park arrives before we sleep, then we need to check
kthread_should_park() before sleeping to avoid missing the signal.
Otherwise, if the signal arrives whilst we are processing completed
requests, we will reset the current->state back to TASK_INTERRUPTIBLE
and so miss the wakeup.

Fixes: fe3288b5da2c ("drm/i915: Park the breadcrumbs signaler across a GPU 
reset")
Signed-off-by: Chris Wilson 
Cc: Mika Kuoppala 
Cc: Tvrtko Ursulin 
---
 drivers/gpu/drm/i915/intel_breadcrumbs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_breadcrumbs.c 
b/drivers/gpu/drm/i915/intel_breadcrumbs.c
index b6ea192ad550..308c56a021ab 100644
--- a/drivers/gpu/drm/i915/intel_breadcrumbs.c
+++ b/drivers/gpu/drm/i915/intel_breadcrumbs.c
@@ -629,6 +629,9 @@ static int intel_breadcrumbs_signaler(void *arg)
} else {
DEFINE_WAIT(exec);
 
+   if (kthread_should_park())
+   kthread_parkme();
+
if (kthread_should_stop()) {
GEM_BUG_ON(request);
break;
@@ -641,9 +644,6 @@ static int intel_breadcrumbs_signaler(void *arg)
 
if (request)
remove_wait_queue(>execute, );
-
-   if (kthread_should_park())
-   kthread_parkme();
}
i915_gem_request_put(request);
} while (1);
-- 
2.11.0

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


[Intel-gfx] ✓ Fi.CI.BAT: success for acquire ctx wire-up, part 2

2017-04-03 Thread Patchwork
== Series Details ==

Series: acquire ctx wire-up, part 2
URL   : https://patchwork.freedesktop.org/series/22354/
State : success

== Summary ==

Series 22354v1 acquire ctx wire-up, part 2
https://patchwork.freedesktop.org/api/1.0/series/22354/revisions/1/mbox/

Test gem_exec_flush:
Subgroup basic-batch-kernel-default-uc:
pass   -> FAIL   (fi-snb-2600) fdo#17

fdo#17 https://bugs.freedesktop.org/show_bug.cgi?id=17

fi-bdw-5557u total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  
time: 429s
fi-bdw-gvtdvmtotal:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  
time: 423s
fi-bsw-n3050 total:278  pass:239  dwarn:0   dfail:0   fail:0   skip:39  
time: 574s
fi-bxt-j4205 total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  
time: 513s
fi-bxt-t5700 total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  
time: 552s
fi-byt-j1900 total:278  pass:251  dwarn:0   dfail:0   fail:0   skip:27  
time: 485s
fi-byt-n2820 total:278  pass:247  dwarn:0   dfail:0   fail:0   skip:31  
time: 483s
fi-hsw-4770  total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  
time: 407s
fi-hsw-4770r total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  
time: 409s
fi-ilk-650   total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  
time: 419s
fi-ivb-3520m total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time: 492s
fi-ivb-3770  total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time: 473s
fi-kbl-7500u total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  
time: 453s
fi-kbl-7560u total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time: 569s
fi-skl-6260u total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time: 449s
fi-skl-6700hqtotal:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  
time: 568s
fi-skl-6700k total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  
time: 457s
fi-skl-6770hqtotal:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  
time: 494s
fi-skl-gvtdvmtotal:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  
time: 434s
fi-snb-2520m total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  
time: 524s
fi-snb-2600  total:278  pass:248  dwarn:0   dfail:0   fail:1   skip:29  
time: 400s

7eae9908d29d1e42ab9fdb19a7c04eb05dd23b16 drm-tip: 2017y-04m-03d-07h-59m-44s UTC 
integration manifest
285584b drm/fb-helper: Extract _legacy kms functions
7d9c945 drm: extract legacy framebuffer remove
af8e639 drm/atomic-helper: Remove legacy backoff hack from gamma_set
ab35545 drm: Add acquire ctx to ->gamma_set hook
46b4289 drm: Add explicit acquire ctx handling around ->gamma_set
7d1bb0f drm/fb-helper: Give up on kgdb for atomic drivers
e7dd123 drm/msm: Nerf zpos property
162c8da drm/i915: Nuke intel_atomic_legacy_gamma_set
0c3a80a drm: Only take crtc lock in get_gamma ioctl
9563470 drm: Drop modeset_lock_all from the getproperty ioctl
1cb7c34 drm: drop modeset_lock_all from drm_state_info
281bcd1 drm/atomic-helper: remove modeset_lock_all from helper_resume
9bc6756 drm: Remove drm_modeset_legacy_acquire_ctx and crtc->acquire_ctx
8ee3151 drm: Remove drm_modeset_(un)lock_crtc
b3c2439 drm: Make drm_modeset_lock_crtc internal

== Logs ==

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


Re: [Intel-gfx] [PATCH 1/2] drm/i915: Redefine ptr_pack_bits() and friends

2017-04-03 Thread Joonas Lahtinen
On pe, 2017-03-31 at 15:10 +0100, Chris Wilson wrote:
> Rebrand the current (pointer | bits) pack/unpack utility macros as
> explicit bit twiddling for PAGE_SIZE so that we can use the more
> flexible underlying macros for different bits.
> 
> Signed-off-by: Chris Wilson 

Pass by pointer when the values get written to. Also, I'm rather unsure
how intuitive ptr_unpack_bits is, could be worth splitting to two
lines.

Reviewed-by: Joonas Lahtinen 

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 v3 06/10] drm/fb-helper: Support deferred setup

2017-04-03 Thread Daniel Vetter
On Tue, Mar 21, 2017 at 09:13:54AM +0100, Thierry Reding wrote:
> From: Thierry Reding 
> 
> FB helper code falls back to a 1024x768 mode if no outputs are connected
> or don't report back any modes upon initialization. This can be annoying
> because outputs that are added to FB helper later on can't be used with
> FB helper if they don't support a matching mode.
> 
> The fallback is in place because VGA connectors can happen to report an
> unknown connection status even when they are in fact connected.
> 
> Some drivers have custom solutions in place to defer FB helper setup
> until at least one output is connected. But the logic behind these
> solutions is always the same and there is nothing driver-specific about
> it, so a better alterative is to fix the FB helper core and add support
> for all drivers automatically.
> 
> This patch adds support for deferred FB helper setup. It checks all the
> connectors for their connection status, and if all of them report to be
> disconnected marks the FB helper as needing deferred setup. Whet setup
> is deferred, the FB helper core will automatically retry setup after a
> hotplug event, and it will keep trying until it succeeds.
> 
> Tested-by: John Stultz 
> Signed-off-by: Thierry Reding 

Ok 2nd attempt at making this work, probably easier to go back to v2.
> ---
>  drivers/gpu/drm/drm_fb_helper.c | 60 
> +
>  include/drm/drm_fb_helper.h | 21 +++
>  2 files changed, 76 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 9060adcf7cf8..d4a2c97d8b02 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -511,6 +511,9 @@ int drm_fb_helper_restore_fbdev_mode_unlocked(struct 
> drm_fb_helper *fb_helper)
>   if (!drm_fbdev_emulation)
>   return -ENODEV;
>  
> + if (fb_helper->deferred_setup)
> + return 0;

Please wrap in READ_ONCE to make it clear we're doing lockless checking
here.

> +
>   mutex_lock(_helper->lock);
>   drm_modeset_lock_all(dev);
>  
> @@ -1597,6 +1600,23 @@ int drm_fb_helper_pan_display(struct fb_var_screeninfo 
> *var,
>  }
>  EXPORT_SYMBOL(drm_fb_helper_pan_display);
>  
> +static bool drm_fb_helper_maybe_connected(struct drm_fb_helper *helper)
> +{
> + bool connected = false;
> + unsigned int i;
> +
> + for (i = 0; i < helper->connector_count; i++) {
> + struct drm_fb_helper_connector *fb = helper->connector_info[i];
> +
> + if (fb->connector->status != connector_status_disconnected) {
> + connected = true;
> + break;
> + }
> + }
> +
> + return connected;
> +}
> +
>  /*
>   * Allocates the backing storage and sets up the fbdev info structure through
>   * the ->fb_probe callback and then registers the fbdev and sets up the panic
> @@ -2254,8 +2274,6 @@ static void drm_setup_crtcs(struct drm_fb_helper 
> *fb_helper,
>   int i;
>  
>   DRM_DEBUG_KMS("\n");
> - if (drm_fb_helper_probe_connector_modes(fb_helper, width, height) == 0)
> - DRM_DEBUG_KMS("No connectors reported connected with modes\n");
>  
>   /* prevent concurrent modification of connector_count by hotplug */
>   lockdep_assert_held(_helper->dev->mode_config.mutex);
> @@ -2378,6 +2396,7 @@ static void drm_setup_crtcs(struct drm_fb_helper 
> *fb_helper,
>  int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int 
> bpp_sel)
>  {
>   struct drm_device *dev = fb_helper->dev;
> + unsigned int width, height;
>   struct fb_info *info;
>   int ret;
>  
> @@ -2385,14 +2404,34 @@ int drm_fb_helper_initial_config(struct drm_fb_helper 
> *fb_helper, int bpp_sel)
>   return 0;
>  

From here ...
>   mutex_lock(>mode_config.mutex);
> - drm_setup_crtcs(fb_helper,
> - dev->mode_config.max_width,
> - dev->mode_config.max_height);
> +
> + width = dev->mode_config.max_width;
> + height = dev->mode_config.max_height;
> +
> + if (drm_fb_helper_probe_connector_modes(fb_helper, width, height) == 0)
> + DRM_DEBUG_KMS("No connectors reported connected with modes\n");
> +
> + /*
> +  * If everything's disconnected, there's no use in attempting to set
> +  * up fbdev.
> +  */
> + if (!drm_fb_helper_maybe_connected(fb_helper)) {
> + DRM_INFO("No outputs connected, deferring setup\n");
> + fb_helper->preferred_bpp = bpp_sel;
> + fb_helper->deferred_setup = true;
> + mutex_unlock(>mode_config.mutex);
> + return 0;
> + }
> +
> + drm_setup_crtcs(fb_helper, width, height);
> +
>   ret = drm_fb_helper_single_fb_probe(fb_helper, bpp_sel);
>   mutex_unlock(>mode_config.mutex);
>   if (ret)
>   return ret;
>  
> 

Re: [Intel-gfx] [PATCH v4 06/11] drm/fb-helper: Make top-level lock more robust

2017-04-03 Thread Daniel Vetter
On Wed, Mar 29, 2017 at 04:43:56PM +0200, Thierry Reding wrote:
> From: Thierry Reding 
> 
> The existing drm_fb_helper_hotplug_event() function needs to take the
> top-level fb-helper lock. However, the function can also be called from
> code that has already taken this lock. Introduce an unlocked variant of
> this function that can be used in the latter case.
> 
> This function calls drm_fb_helper_restore_fbdev_mode_unlocked(), via
> drm_fb_helper_set_par(), so we also need to introduce an unlocked copy
> of that to avoid recursive locking issues.
> 
> Similarly, the drm_fb_helper_initial_config() function ends up calling
> drm_fb_helper_set_par(), via register_framebuffer(), and needs an
> unlocked variant to avoid recursive locking.
> 
> Signed-off-by: Thierry Reding 
> ---
>  drivers/gpu/drm/drm_fb_helper.c | 167 
> +---
>  1 file changed, 104 insertions(+), 63 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 860be51d92f6..21a90322531c 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -491,18 +491,10 @@ static int restore_fbdev_mode(struct drm_fb_helper 
> *fb_helper)
>   return 0;
>  }
>  
> -/**
> - * drm_fb_helper_restore_fbdev_mode_unlocked - restore fbdev configuration
> - * @fb_helper: fbcon to restore
> - *
> - * This should be called from driver's drm _driver.lastclose callback
> - * when implementing an fbcon on top of kms using this helper. This ensures 
> that
> - * the user isn't greeted with a black screen when e.g. X dies.
> - *
> - * RETURNS:
> - * Zero if everything went ok, negative error code otherwise.
> - */
> -int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper 
> *fb_helper)
> +static int __drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper);
> +
> +static int
> +__drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
>  {
>   struct drm_device *dev = fb_helper->dev;
>   bool do_delayed;
> @@ -511,7 +503,8 @@ int drm_fb_helper_restore_fbdev_mode_unlocked(struct 
> drm_fb_helper *fb_helper)
>   if (!drm_fbdev_emulation)
>   return -ENODEV;
>  
> - mutex_lock(_helper->lock);
> + WARN_ON(!mutex_is_locked(_helper->lock));

lockdep_assert_held is the new cool.

> +
>   drm_modeset_lock_all(dev);
>  
>   ret = restore_fbdev_mode(fb_helper);
> @@ -521,10 +514,31 @@ int drm_fb_helper_restore_fbdev_mode_unlocked(struct 
> drm_fb_helper *fb_helper)
>   fb_helper->delayed_hotplug = false;
>  
>   drm_modeset_unlock_all(dev);
> - mutex_unlock(_helper->lock);
>  
>   if (do_delayed)
> - drm_fb_helper_hotplug_event(fb_helper);
> + __drm_fb_helper_hotplug_event(fb_helper);
> +
> + return ret;
> +}
> +
> +/**
> + * drm_fb_helper_restore_fbdev_mode_unlocked - restore fbdev configuration
> + * @fb_helper: fbcon to restore
> + *
> + * This should be called from driver's drm _driver.lastclose callback
> + * when implementing an fbcon on top of kms using this helper. This ensures 
> that
> + * the user isn't greeted with a black screen when e.g. X dies.
> + *
> + * RETURNS:
> + * Zero if everything went ok, negative error code otherwise.
> + */
> +int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper 
> *fb_helper)
> +{
> + int ret;
> +
> + mutex_lock(_helper->lock);
> + ret = __drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper);
> + mutex_unlock(_helper->lock);
>  
>   return ret;
>  }
> @@ -1486,7 +1500,7 @@ int drm_fb_helper_set_par(struct fb_info *info)
>   return -EINVAL;
>   }
>  
> - drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper);
> + __drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper);

Nah, you need the locking still for when this is called from userspace
through fbdev ioctl.
>  
>   return 0;
>  }
> @@ -2333,6 +2347,46 @@ static void drm_setup_crtcs(struct drm_fb_helper 
> *fb_helper,
>   kfree(enabled);
>  }
>  
> +static int __drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper,
> +   int bpp_sel)
> +{
> + struct drm_device *dev = fb_helper->dev;
> + struct fb_info *info;
> + int ret;
> +
> + if (!drm_fbdev_emulation)
> + return 0;
> +
> + WARN_ON(!mutex_is_locked(_helper->lock));
> +
> + mutex_lock(>mode_config.mutex);
> + drm_setup_crtcs(fb_helper,
> + dev->mode_config.max_width,
> + dev->mode_config.max_height);
> + ret = drm_fb_helper_single_fb_probe(fb_helper, bpp_sel);
> + mutex_unlock(>mode_config.mutex);
> + if (ret)
> + return ret;
> +
> + info = fb_helper->fbdev;
> + info->var.pixclock = 0;
> + ret = register_framebuffer(info);
> + if (ret < 0)
> + return ret;
> +
> + dev_info(dev->dev, "fb%d: %s frame buffer 

[Intel-gfx] [PATCH 11/15] drm: Add explicit acquire ctx handling around ->gamma_set

2017-04-03 Thread Daniel Vetter
Just the groundwork to prepare for adding the acquire cxt parameter to
the ->gamma_set hook. Again we need a temporary hack to fill out
mode_config.acquire_ctx until the atomic helpers are switched over.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_color_mgmt.c | 33 -
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c
index a32be59a72d1..e1b4084c3d16 100644
--- a/drivers/gpu/drm/drm_color_mgmt.c
+++ b/drivers/gpu/drm/drm_color_mgmt.c
@@ -218,28 +218,29 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev,
struct drm_crtc *crtc;
void *r_base, *g_base, *b_base;
int size;
+   struct drm_modeset_acquire_ctx ctx;
int ret = 0;
 
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL;
 
-   drm_modeset_lock_all(dev);
crtc = drm_crtc_find(dev, crtc_lut->crtc_id);
-   if (!crtc) {
-   ret = -ENOENT;
-   goto out;
-   }
+   if (!crtc)
+   return -ENOENT;
 
-   if (crtc->funcs->gamma_set == NULL) {
-   ret = -ENOSYS;
-   goto out;
-   }
+   if (crtc->funcs->gamma_set == NULL)
+   return -ENOSYS;
 
/* memcpy into gamma store */
-   if (crtc_lut->gamma_size != crtc->gamma_size) {
-   ret = -EINVAL;
+   if (crtc_lut->gamma_size != crtc->gamma_size)
+   return -EINVAL;
+
+   drm_modeset_acquire_init(, 0);
+   dev->mode_config.acquire_ctx = 
+retry:
+   ret = drm_modeset_lock_all_ctx(dev, );
+   if (ret)
goto out;
-   }
 
size = crtc_lut->gamma_size * (sizeof(uint16_t));
r_base = crtc->gamma_store;
@@ -263,7 +264,13 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev,
ret = crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, 
crtc->gamma_size);
 
 out:
-   drm_modeset_unlock_all(dev);
+   if (ret == -EDEADLK) {
+   drm_modeset_backoff();
+   goto retry;
+   }
+   drm_modeset_drop_locks();
+   drm_modeset_acquire_fini();
+
return ret;
 
 }
-- 
2.11.0

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


[Intel-gfx] [PATCH 14/15] drm: extract legacy framebuffer remove

2017-04-03 Thread Daniel Vetter
I got confused every time I audited what that lock_all is doing in
there until realizing it's for legacy kms only. Make that a notch more
obvious by having 2 entirely different paths.

While at it also move the atomic version of this into
drm_framebuffer.c, there's no reason it needs to be in drm_atomic.c.
That way it becomes a simple static function.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_atomic.c|  88 ---
 drivers/gpu/drm/drm_crtc_internal.h |   1 -
 drivers/gpu/drm/drm_framebuffer.c   | 137 ++--
 3 files changed, 115 insertions(+), 111 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 9afb14371ce0..f32506a7c1d6 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -2081,94 +2081,6 @@ static void complete_crtc_signaling(struct drm_device 
*dev,
kfree(fence_state);
 }
 
-int drm_atomic_remove_fb(struct drm_framebuffer *fb)
-{
-   struct drm_modeset_acquire_ctx ctx;
-   struct drm_device *dev = fb->dev;
-   struct drm_atomic_state *state;
-   struct drm_plane *plane;
-   struct drm_connector *conn;
-   struct drm_connector_state *conn_state;
-   int i, ret = 0;
-   unsigned plane_mask;
-
-   state = drm_atomic_state_alloc(dev);
-   if (!state)
-   return -ENOMEM;
-
-   drm_modeset_acquire_init(, 0);
-   state->acquire_ctx = 
-
-retry:
-   plane_mask = 0;
-   ret = drm_modeset_lock_all_ctx(dev, );
-   if (ret)
-   goto unlock;
-
-   drm_for_each_plane(plane, dev) {
-   struct drm_plane_state *plane_state;
-
-   if (plane->state->fb != fb)
-   continue;
-
-   plane_state = drm_atomic_get_plane_state(state, plane);
-   if (IS_ERR(plane_state)) {
-   ret = PTR_ERR(plane_state);
-   goto unlock;
-   }
-
-   if (plane_state->crtc->primary == plane) {
-   struct drm_crtc_state *crtc_state;
-
-   crtc_state = drm_atomic_get_existing_crtc_state(state, 
plane_state->crtc);
-
-   ret = drm_atomic_add_affected_connectors(state, 
plane_state->crtc);
-   if (ret)
-   goto unlock;
-
-   crtc_state->active = false;
-   ret = drm_atomic_set_mode_for_crtc(crtc_state, NULL);
-   if (ret)
-   goto unlock;
-   }
-
-   drm_atomic_set_fb_for_plane(plane_state, NULL);
-   ret = drm_atomic_set_crtc_for_plane(plane_state, NULL);
-   if (ret)
-   goto unlock;
-
-   plane_mask |= BIT(drm_plane_index(plane));
-
-   plane->old_fb = plane->fb;
-   }
-
-   for_each_connector_in_state(state, conn, conn_state, i) {
-   ret = drm_atomic_set_crtc_for_connector(conn_state, NULL);
-
-   if (ret)
-   goto unlock;
-   }
-
-   if (plane_mask)
-   ret = drm_atomic_commit(state);
-
-unlock:
-   if (plane_mask)
-   drm_atomic_clean_old_fb(dev, plane_mask, ret);
-
-   if (ret == -EDEADLK) {
-   drm_modeset_backoff();
-   goto retry;
-   }
-
-   drm_atomic_state_put(state);
-
-   drm_modeset_drop_locks();
-   drm_modeset_acquire_fini();
-
-   return ret;
-}
-
 int drm_mode_atomic_ioctl(struct drm_device *dev,
  void *data, struct drm_file *file_priv)
 {
diff --git a/drivers/gpu/drm/drm_crtc_internal.h 
b/drivers/gpu/drm/drm_crtc_internal.h
index 8c04275cf226..d077c5490041 100644
--- a/drivers/gpu/drm/drm_crtc_internal.h
+++ b/drivers/gpu/drm/drm_crtc_internal.h
@@ -182,7 +182,6 @@ int drm_atomic_get_property(struct drm_mode_object *obj,
struct drm_property *property, uint64_t *val);
 int drm_mode_atomic_ioctl(struct drm_device *dev,
  void *data, struct drm_file *file_priv);
-int drm_atomic_remove_fb(struct drm_framebuffer *fb);
 
 
 /* drm_plane.c */
diff --git a/drivers/gpu/drm/drm_framebuffer.c 
b/drivers/gpu/drm/drm_framebuffer.c
index e8f9c13a0afd..fc8ef42203ec 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "drm_crtc_internal.h"
 
@@ -755,6 +756,117 @@ void drm_framebuffer_cleanup(struct drm_framebuffer *fb)
 }
 EXPORT_SYMBOL(drm_framebuffer_cleanup);
 
+static int atomic_remove_fb(struct drm_framebuffer *fb)
+{
+   struct drm_modeset_acquire_ctx ctx;
+   struct drm_device *dev = fb->dev;
+   struct drm_atomic_state *state;
+   struct drm_plane *plane;
+   struct drm_connector *conn;
+   struct drm_connector_state *conn_state;
+ 

[Intel-gfx] [PATCH 10/15] drm/fb-helper: Give up on kgdb for atomic drivers

2017-04-03 Thread Daniel Vetter
It just doesn't work. It probably stopped working way, way before that
(e.g. i915 grabbed random mutexes all over in modeset code at least
since gen6), but with atomic and all the ww_mutex stuff it's indeed
hopeless.

Remove ->mode_set_base_atomic from the 2 atomic drivers (i915 and
nouveau) that still had one (both had dummy implementations already
anyway), and shunt atomic drivers in the helpers debug_enter/leave
functions.

I'll leave the code in for radeon and amdgpu, but I think as soon as
amdgpu is atomic we should think about just ripping it out. Only
having it around for radeon and pre-nv50 is rather pointless. This
would also allow us to nuke all that code from fbdev.

Funny part is that _all_ kms drivers set this hook, despite that no
one else provides the required ->mode_set_base_atomic implementation.

The reason I'm jumping on this is that I want to wire up a full
acquire ctx for the benefit of atomic drivers, everywhere. And the
debug_enter/leave implementations call ->gamma_set. And there's just
no way ever we can create an acquire_ctx in the nmi context of kgdb.

Cc: Ben Skeggs 
Cc: Alex Deucher 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_fb_helper.c|  6 ++
 drivers/gpu/drm/i915/intel_display.c   | 12 
 drivers/gpu/drm/nouveau/nv50_display.c | 10 --
 3 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 673a47445d61..9147abb774e8 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -281,6 +281,9 @@ int drm_fb_helper_debug_enter(struct fb_info *info)
if (funcs->mode_set_base_atomic == NULL)
continue;
 
+   if (drm_drv_uses_atomic_modeset(mode_set->crtc->dev))
+   continue;
+
drm_fb_helper_save_lut_atomic(mode_set->crtc, helper);
funcs->mode_set_base_atomic(mode_set->crtc,
mode_set->fb,
@@ -338,6 +341,9 @@ int drm_fb_helper_debug_leave(struct fb_info *info)
if (funcs->mode_set_base_atomic == NULL)
continue;
 
+   if (drm_drv_uses_atomic_modeset(crtc->dev))
+   continue;
+
drm_fb_helper_restore_lut_atomic(mode_set->crtc);
funcs->mode_set_base_atomic(mode_set->crtc, fb, crtc->x,
crtc->y, LEAVE_ATOMIC_MODE_SET);
diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 779ab46200c2..2bc9f2f609a9 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3412,17 +3412,6 @@ static void skylake_disable_primary_plane(struct 
drm_plane *primary,
spin_unlock_irqrestore(_priv->uncore.lock, irqflags);
 }
 
-/* Assume fb object is pinned & idle & fenced and just update base pointers */
-static int
-intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb,
-  int x, int y, enum mode_set_atomic state)
-{
-   /* Support for kgdboc is disabled, this needs a major rework. */
-   DRM_ERROR("legacy panic handler not supported any more.\n");
-
-   return -ENODEV;
-}
-
 static void intel_complete_page_flips(struct drm_i915_private *dev_priv)
 {
struct intel_crtc *crtc;
@@ -11017,7 +11006,6 @@ static int intel_crtc_atomic_check(struct drm_crtc 
*crtc,
 }
 
 static const struct drm_crtc_helper_funcs intel_helper_funcs = {
-   .mode_set_base_atomic = intel_pipe_set_base_atomic,
.atomic_begin = intel_begin_crtc_commit,
.atomic_flush = intel_finish_crtc_commit,
.atomic_check = intel_crtc_atomic_check,
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c 
b/drivers/gpu/drm/nouveau/nv50_display.c
index 418872b493a3..3d381d5c82ce 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -2210,18 +2210,8 @@ nv50_head_lut_load(struct drm_crtc *crtc)
}
 }
 
-static int
-nv50_head_mode_set_base_atomic(struct drm_crtc *crtc,
-  struct drm_framebuffer *fb, int x, int y,
-  enum mode_set_atomic state)
-{
-   WARN_ON(1);
-   return 0;
-}
-
 static const struct drm_crtc_helper_funcs
 nv50_head_help = {
-   .mode_set_base_atomic = nv50_head_mode_set_base_atomic,
.load_lut = nv50_head_lut_load,
.atomic_check = nv50_head_atomic_check,
 };
-- 
2.11.0

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


[Intel-gfx] [PATCH 13/15] drm/atomic-helper: Remove legacy backoff hack from gamma_set

2017-04-03 Thread Daniel Vetter
Another one knocked down.

With this we can also remove the temporary hack in the gamma_set
ioctl.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_atomic_helper.c | 13 ++---
 drivers/gpu/drm/drm_color_mgmt.c|  1 -
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index d5915317e7d3..8de6cea733f4 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -3520,8 +3520,7 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc 
*crtc,
blob_data[i].blue = blue[i];
}
 
-   state->acquire_ctx = crtc->dev->mode_config.acquire_ctx;
-retry:
+   state->acquire_ctx = ctx;
crtc_state = drm_atomic_get_crtc_state(state, crtc);
if (IS_ERR(crtc_state)) {
ret = PTR_ERR(crtc_state);
@@ -3545,18 +3544,10 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc 
*crtc,
goto fail;
 
ret = drm_atomic_commit(state);
-fail:
-   if (ret == -EDEADLK)
-   goto backoff;
 
+fail:
drm_atomic_state_put(state);
drm_property_blob_put(blob);
return ret;
-
-backoff:
-   drm_atomic_state_clear(state);
-   drm_atomic_legacy_backoff(state);
-
-   goto retry;
 }
 EXPORT_SYMBOL(drm_atomic_helper_legacy_gamma_set);
diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c
index b81dcb1d4cb3..533f3a3e6877 100644
--- a/drivers/gpu/drm/drm_color_mgmt.c
+++ b/drivers/gpu/drm/drm_color_mgmt.c
@@ -236,7 +236,6 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev,
return -EINVAL;
 
drm_modeset_acquire_init(, 0);
-   dev->mode_config.acquire_ctx = 
 retry:
ret = drm_modeset_lock_all_ctx(dev, );
if (ret)
-- 
2.11.0

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


[Intel-gfx] [PATCH 15/15] drm/fb-helper: Extract _legacy kms functions

2017-04-03 Thread Daniel Vetter
The goal is to push all the kms locking down into these separate
_atomic and _legacy functions, so that we can correctly pass the
acquire ctx into all atomic drivers. Instead of playing games with
hidden ctx in mode_config.acquire_ctx. All the fbdev state will be
protected by a new fbdev private lock that Thierry is working on.

This here is just prep by creating a clean split between atomic and
legacy paths, which also simplifies the control flow a bit.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_fb_helper.c | 72 +
 1 file changed, 44 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 6dc5381e1c45..a0ea3241c651 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -418,17 +418,12 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper 
*fb_helper)
goto retry;
 }
 
-static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
+static int restore_fbdev_mode_legacy(struct drm_fb_helper *fb_helper)
 {
struct drm_device *dev = fb_helper->dev;
struct drm_plane *plane;
int i;
 
-   drm_warn_on_modeset_not_all_locked(dev);
-
-   if (drm_drv_uses_atomic_modeset(dev))
-   return restore_fbdev_mode_atomic(fb_helper);
-
drm_for_each_plane(plane, dev) {
if (plane->type != DRM_PLANE_TYPE_PRIMARY)
drm_plane_force_disable(plane);
@@ -462,6 +457,18 @@ static int restore_fbdev_mode(struct drm_fb_helper 
*fb_helper)
return 0;
 }
 
+static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
+{
+   struct drm_device *dev = fb_helper->dev;
+
+   drm_warn_on_modeset_not_all_locked(dev);
+
+   if (drm_drv_uses_atomic_modeset(dev))
+   return restore_fbdev_mode_atomic(fb_helper);
+   else
+   return restore_fbdev_mode_legacy(fb_helper);
+}
+
 /**
  * drm_fb_helper_restore_fbdev_mode_unlocked - restore fbdev configuration
  * @fb_helper: fbcon to restore
@@ -1513,34 +1520,14 @@ static int pan_display_atomic(struct fb_var_screeninfo 
*var,
goto retry;
 }
 
-/**
- * drm_fb_helper_pan_display - implementation for _ops.fb_pan_display
- * @var: updated screen information
- * @info: fbdev registered by the helper
- */
-int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
+static int pan_display_legacy(struct fb_var_screeninfo *var,
  struct fb_info *info)
 {
struct drm_fb_helper *fb_helper = info->par;
-   struct drm_device *dev = fb_helper->dev;
struct drm_mode_set *modeset;
int ret = 0;
int i;
 
-   if (oops_in_progress)
-   return -EBUSY;
-
-   drm_modeset_lock_all(dev);
-   if (!drm_fb_helper_is_bound(fb_helper)) {
-   drm_modeset_unlock_all(dev);
-   return -EBUSY;
-   }
-
-   if (drm_drv_uses_atomic_modeset(dev)) {
-   ret = pan_display_atomic(var, info);
-   goto unlock;
-   }
-
for (i = 0; i < fb_helper->crtc_count; i++) {
modeset = _helper->crtc_info[i].mode_set;
 
@@ -1555,8 +1542,37 @@ int drm_fb_helper_pan_display(struct fb_var_screeninfo 
*var,
}
}
}
-unlock:
+
+   return ret;
+}
+
+/**
+ * drm_fb_helper_pan_display - implementation for _ops.fb_pan_display
+ * @var: updated screen information
+ * @info: fbdev registered by the helper
+ */
+int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
+ struct fb_info *info)
+{
+   struct drm_fb_helper *fb_helper = info->par;
+   struct drm_device *dev = fb_helper->dev;
+   int ret;
+
+   if (oops_in_progress)
+   return -EBUSY;
+
+   drm_modeset_lock_all(dev);
+   if (!drm_fb_helper_is_bound(fb_helper)) {
+   drm_modeset_unlock_all(dev);
+   return -EBUSY;
+   }
+
+   if (drm_drv_uses_atomic_modeset(dev))
+   ret = pan_display_atomic(var, info);
+   else
+   ret = pan_display_legacy(var, info);
drm_modeset_unlock_all(dev);
+
return ret;
 }
 EXPORT_SYMBOL(drm_fb_helper_pan_display);
-- 
2.11.0

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


[Intel-gfx] [PATCH 12/15] drm: Add acquire ctx to ->gamma_set hook

2017-04-03 Thread Daniel Vetter
Atomic helpers really want this instead of the hacked-up legacy
backoff trick, which unfortunately prevents drivers from using their
own private drm_modeset_locks.

Aside: There's a few atomic drivers (nv50, vc4, soon vmwgfx) which
don't yet use the new atomic color mgmt/gamma table stuff. Would be
nice if they could switch over and just hook up
drm_atomic_helper_legacy_gamma_set() instead.

Cc: Dave Airlie 
Cc: Alex Deucher 
Cc: Christian König 
Cc: Gerd Hoffmann 
Cc: Ben Skeggs 
Cc: Sinclair Yeh 
Cc: Thomas Hellstrom 
Cc: Eric Anholt 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c   | 3 ++-
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c   | 3 ++-
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c| 3 ++-
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c| 3 ++-
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 3 ++-
 drivers/gpu/drm/ast/ast_mode.c   | 3 ++-
 drivers/gpu/drm/cirrus/cirrus_mode.c | 3 ++-
 drivers/gpu/drm/drm_atomic_helper.c  | 4 +++-
 drivers/gpu/drm/drm_color_mgmt.c | 3 ++-
 drivers/gpu/drm/drm_fb_helper.c  | 3 ++-
 drivers/gpu/drm/gma500/gma_display.c | 3 ++-
 drivers/gpu/drm/gma500/gma_display.h | 3 ++-
 drivers/gpu/drm/mgag200/mgag200_mode.c   | 3 ++-
 drivers/gpu/drm/nouveau/dispnv04/crtc.c  | 3 ++-
 drivers/gpu/drm/nouveau/nv50_display.c   | 3 ++-
 drivers/gpu/drm/radeon/radeon_display.c  | 3 ++-
 drivers/gpu/drm/vc4/vc4_crtc.c   | 3 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c  | 3 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.h  | 3 ++-
 include/drm/drm_atomic_helper.h  | 3 ++-
 include/drm/drm_crtc.h   | 3 ++-
 21 files changed, 43 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index f525ae4e0576..daf003dd2351 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -2631,7 +2631,8 @@ static void dce_v10_0_cursor_reset(struct drm_crtc *crtc)
 }
 
 static int dce_v10_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 
*green,
-   u16 *blue, uint32_t size)
+   u16 *blue, uint32_t size,
+   struct drm_modeset_acquire_ctx *ctx)
 {
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
int i;
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 3eac27f24d94..3a7296724457 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -2651,7 +2651,8 @@ static void dce_v11_0_cursor_reset(struct drm_crtc *crtc)
 }
 
 static int dce_v11_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 
*green,
-   u16 *blue, uint32_t size)
+   u16 *blue, uint32_t size,
+   struct drm_modeset_acquire_ctx *ctx)
 {
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
int i;
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index 838cf1a778f2..8ccada5d6f39 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -1998,7 +1998,8 @@ static void dce_v6_0_cursor_reset(struct drm_crtc *crtc)
 }
 
 static int dce_v6_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
-  u16 *blue, uint32_t size)
+  u16 *blue, uint32_t size,
+  struct drm_modeset_acquire_ctx *ctx)
 {
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
int i;
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 1b0717b11efe..6943f2641c90 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -2482,7 +2482,8 @@ static void dce_v8_0_cursor_reset(struct drm_crtc *crtc)
 }
 
 static int dce_v8_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
-  u16 *blue, uint32_t size)
+  u16 *blue, uint32_t size,
+  struct drm_modeset_acquire_ctx *ctx)
 {
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
int i;
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c 
b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
index 5c51f9a97811..81a24b6b4846 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
@@ -165,7 +165,8 @@ static void dce_virtual_bandwidth_update(struct 
amdgpu_device *adev)
 }
 
 static int dce_virtual_crtc_gamma_set(struct drm_crtc *crtc, u16 *red,
- u16 *green, u16 

[Intel-gfx] [PATCH 01/15] drm: Make drm_modeset_lock_crtc internal

2017-04-03 Thread Daniel Vetter
This is only for legacy paths that need to grab the crtc/plane lock
combo. If you want to lock a crtc, just use drm_modeset_lock().

Reviewed-by: Harry Wentland 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_crtc_internal.h |  3 +++
 drivers/gpu/drm/drm_modeset_lock.c  | 14 --
 include/drm/drm_modeset_lock.h  |  2 --
 3 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_internal.h 
b/drivers/gpu/drm/drm_crtc_internal.h
index 8c04275cf226..de1047530e07 100644
--- a/drivers/gpu/drm/drm_crtc_internal.h
+++ b/drivers/gpu/drm/drm_crtc_internal.h
@@ -61,6 +61,9 @@ int drm_mode_getresources(struct drm_device *dev,
  void *data, struct drm_file *file_priv);
 
 
+/* drm_modeset_lock.c */
+void drm_modeset_lock_crtc(struct drm_crtc *crtc,
+  struct drm_plane *plane);
 /* drm_dumb_buffers.c */
 /* IOCTLs */
 int drm_mode_create_dumb_ioctl(struct drm_device *dev,
diff --git a/drivers/gpu/drm/drm_modeset_lock.c 
b/drivers/gpu/drm/drm_modeset_lock.c
index bf60f2645e55..c94eff9d7544 100644
--- a/drivers/gpu/drm/drm_modeset_lock.c
+++ b/drivers/gpu/drm/drm_modeset_lock.c
@@ -148,19 +148,6 @@ void drm_modeset_unlock_all(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_modeset_unlock_all);
 
-/**
- * drm_modeset_lock_crtc - lock crtc with hidden acquire ctx for a plane update
- * @crtc: DRM CRTC
- * @plane: DRM plane to be updated on @crtc
- *
- * This function locks the given crtc and plane (which should be either the
- * primary or cursor plane) using a hidden acquire context. This is necessary 
so
- * that drivers internally using the atomic interfaces can grab further locks
- * with the lock acquire context.
- *
- * Note that @plane can be NULL, e.g. when the cursor support hasn't yet been
- * converted to universal planes yet.
- */
 void drm_modeset_lock_crtc(struct drm_crtc *crtc,
   struct drm_plane *plane)
 {
@@ -205,7 +192,6 @@ void drm_modeset_lock_crtc(struct drm_crtc *crtc,
goto retry;
}
 }
-EXPORT_SYMBOL(drm_modeset_lock_crtc);
 
 /**
  * drm_modeset_legacy_acquire_ctx - find acquire ctx for legacy ioctls
diff --git a/include/drm/drm_modeset_lock.h b/include/drm/drm_modeset_lock.h
index 96d39fbd12ca..88d35bfc9cd8 100644
--- a/include/drm/drm_modeset_lock.h
+++ b/include/drm/drm_modeset_lock.h
@@ -121,8 +121,6 @@ struct drm_plane;
 
 void drm_modeset_lock_all(struct drm_device *dev);
 void drm_modeset_unlock_all(struct drm_device *dev);
-void drm_modeset_lock_crtc(struct drm_crtc *crtc,
-  struct drm_plane *plane);
 void drm_modeset_unlock_crtc(struct drm_crtc *crtc);
 void drm_warn_on_modeset_not_all_locked(struct drm_device *dev);
 struct drm_modeset_acquire_ctx *
-- 
2.11.0

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


[Intel-gfx] [PATCH 09/15] drm/msm: Nerf zpos property

2017-04-03 Thread Daniel Vetter
It's not wired up, and if it is, it should be moved over to the new
fancy standardized zpos property exposed through
drm_plane_create_zpos_property().

Cc: Rob Clark 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
index 60a5451ae0b9..9229c6e201a2 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
@@ -108,8 +108,6 @@ static void mdp5_plane_install_properties(struct drm_plane 
*plane,
create_enum, name##_prop_enum_list, \
ARRAY_SIZE(name##_prop_enum_list))
 
-   INSTALL_RANGE_PROPERTY(zpos, ZPOS, 1, 255, 1);
-
mdp5_plane_install_rotation_property(dev, plane);
 
 #undef INSTALL_RANGE_PROPERTY
-- 
2.11.0

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


[Intel-gfx] [PATCH 05/15] drm: drop modeset_lock_all from drm_state_info

2017-04-03 Thread Daniel Vetter
If we push the locks down we don't have to take them all at the same
time.

Aside: Making dump_info fully safe should be fairly simple, if we
protect the ->state pointers with rcu. Simply putting a
synchronize_rcu() into the drm_atomic_state free function should be
all that's roughly needed. Well except we shouldn't block in there, so
better to put that into a work_struct. But I've not set out to fix
that little issue.

Cc: Rob Clark 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_atomic.c | 60 
 1 file changed, 39 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 345310213820..9afb14371ce0 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1676,22 +1676,8 @@ static void drm_atomic_print_state(const struct 
drm_atomic_state *state)
drm_atomic_connector_print_state(, connector_state);
 }
 
-/**
- * drm_state_dump - dump entire device atomic state
- * @dev: the drm device
- * @p: where to print the state to
- *
- * Just for debugging.  Drivers might want an option to dump state
- * to dmesg in case of error irq's.  (Hint, you probably want to
- * ratelimit this!)
- *
- * The caller must drm_modeset_lock_all(), or if this is called
- * from error irq handler, it should not be enabled by default.
- * (Ie. if you are debugging errors you might not care that this
- * is racey.  But calling this without all modeset locks held is
- * not inherently safe.)
- */
-void drm_state_dump(struct drm_device *dev, struct drm_printer *p)
+static void __drm_state_dump(struct drm_device *dev, struct drm_printer *p,
+bool take_locks)
 {
struct drm_mode_config *config = >mode_config;
struct drm_plane *plane;
@@ -1702,17 +1688,51 @@ void drm_state_dump(struct drm_device *dev, struct 
drm_printer *p)
if (!drm_core_check_feature(dev, DRIVER_ATOMIC))
return;
 
-   list_for_each_entry(plane, >plane_list, head)
+   list_for_each_entry(plane, >plane_list, head) {
+   if (take_locks)
+   drm_modeset_lock(>mutex, NULL);
drm_atomic_plane_print_state(p, plane->state);
+   if (take_locks)
+   drm_modeset_unlock(>mutex);
+   }
 
-   list_for_each_entry(crtc, >crtc_list, head)
+   list_for_each_entry(crtc, >crtc_list, head) {
+   if (take_locks)
+   drm_modeset_lock(>mutex, NULL);
drm_atomic_crtc_print_state(p, crtc->state);
+   if (take_locks)
+   drm_modeset_unlock(>mutex);
+   }
 
drm_connector_list_iter_begin(dev, _iter);
+   if (take_locks)
+   drm_modeset_lock(>mode_config.connection_mutex, NULL);
drm_for_each_connector_iter(connector, _iter)
drm_atomic_connector_print_state(p, connector->state);
+   if (take_locks)
+   drm_modeset_unlock(>mode_config.connection_mutex);
drm_connector_list_iter_end(_iter);
 }
+
+/**
+ * drm_state_dump - dump entire device atomic state
+ * @dev: the drm device
+ * @p: where to print the state to
+ *
+ * Just for debugging.  Drivers might want an option to dump state
+ * to dmesg in case of error irq's.  (Hint, you probably want to
+ * ratelimit this!)
+ *
+ * The caller must drm_modeset_lock_all(), or if this is called
+ * from error irq handler, it should not be enabled by default.
+ * (Ie. if you are debugging errors you might not care that this
+ * is racey.  But calling this without all modeset locks held is
+ * not inherently safe.)
+ */
+void drm_state_dump(struct drm_device *dev, struct drm_printer *p)
+{
+   __drm_state_dump(dev, p, false);
+}
 EXPORT_SYMBOL(drm_state_dump);
 
 #ifdef CONFIG_DEBUG_FS
@@ -1722,9 +1742,7 @@ static int drm_state_info(struct seq_file *m, void *data)
struct drm_device *dev = node->minor->dev;
struct drm_printer p = drm_seq_file_printer(m);
 
-   drm_modeset_lock_all(dev);
-   drm_state_dump(dev, );
-   drm_modeset_unlock_all(dev);
+   __drm_state_dump(dev, , true);
 
return 0;
 }
-- 
2.11.0

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


[Intel-gfx] [PATCH 02/15] drm: Remove drm_modeset_(un)lock_crtc

2017-04-03 Thread Daniel Vetter
The last user, the cursor ioctl, can just open-code this too. We
simply have to move the acquire ctx dance from the universal function
up into the top-level ioctl handler.

Reviewed-by: Harry Wentland 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_crtc_internal.h |  3 --
 drivers/gpu/drm/drm_modeset_lock.c  | 67 -
 drivers/gpu/drm/drm_plane.c | 49 +--
 include/drm/drm_modeset_lock.h  |  1 -
 4 files changed, 24 insertions(+), 96 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_internal.h 
b/drivers/gpu/drm/drm_crtc_internal.h
index de1047530e07..8c04275cf226 100644
--- a/drivers/gpu/drm/drm_crtc_internal.h
+++ b/drivers/gpu/drm/drm_crtc_internal.h
@@ -61,9 +61,6 @@ int drm_mode_getresources(struct drm_device *dev,
  void *data, struct drm_file *file_priv);
 
 
-/* drm_modeset_lock.c */
-void drm_modeset_lock_crtc(struct drm_crtc *crtc,
-  struct drm_plane *plane);
 /* drm_dumb_buffers.c */
 /* IOCTLs */
 int drm_mode_create_dumb_ioctl(struct drm_device *dev,
diff --git a/drivers/gpu/drm/drm_modeset_lock.c 
b/drivers/gpu/drm/drm_modeset_lock.c
index c94eff9d7544..c3ca6b859236 100644
--- a/drivers/gpu/drm/drm_modeset_lock.c
+++ b/drivers/gpu/drm/drm_modeset_lock.c
@@ -148,51 +148,6 @@ void drm_modeset_unlock_all(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_modeset_unlock_all);
 
-void drm_modeset_lock_crtc(struct drm_crtc *crtc,
-  struct drm_plane *plane)
-{
-   struct drm_modeset_acquire_ctx *ctx;
-   int ret;
-
-   ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
-   if (WARN_ON(!ctx))
-   return;
-
-   drm_modeset_acquire_init(ctx, 0);
-
-retry:
-   ret = drm_modeset_lock(>mutex, ctx);
-   if (ret)
-   goto fail;
-
-   if (plane) {
-   ret = drm_modeset_lock(>mutex, ctx);
-   if (ret)
-   goto fail;
-
-   if (plane->crtc) {
-   ret = drm_modeset_lock(>crtc->mutex, ctx);
-   if (ret)
-   goto fail;
-   }
-   }
-
-   WARN_ON(crtc->acquire_ctx);
-
-   /* now we hold the locks, so now that it is safe, stash the
-* ctx for drm_modeset_unlock_crtc():
-*/
-   crtc->acquire_ctx = ctx;
-
-   return;
-
-fail:
-   if (ret == -EDEADLK) {
-   drm_modeset_backoff(ctx);
-   goto retry;
-   }
-}
-
 /**
  * drm_modeset_legacy_acquire_ctx - find acquire ctx for legacy ioctls
  * @crtc: drm crtc
@@ -215,28 +170,6 @@ drm_modeset_legacy_acquire_ctx(struct drm_crtc *crtc)
 EXPORT_SYMBOL(drm_modeset_legacy_acquire_ctx);
 
 /**
- * drm_modeset_unlock_crtc - drop crtc lock
- * @crtc: drm crtc
- *
- * This drops the crtc lock acquire with drm_modeset_lock_crtc() and all other
- * locks acquired through the hidden context.
- */
-void drm_modeset_unlock_crtc(struct drm_crtc *crtc)
-{
-   struct drm_modeset_acquire_ctx *ctx = crtc->acquire_ctx;
-
-   if (WARN_ON(!ctx))
-   return;
-
-   crtc->acquire_ctx = NULL;
-   drm_modeset_drop_locks(ctx);
-   drm_modeset_acquire_fini(ctx);
-
-   kfree(ctx);
-}
-EXPORT_SYMBOL(drm_modeset_unlock_crtc);
-
-/**
  * drm_warn_on_modeset_not_all_locked - check that all modeset locks are locked
  * @dev: device
  *
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index bc71aa2b7872..838ca742a28b 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -620,7 +620,8 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
 
 static int drm_mode_cursor_universal(struct drm_crtc *crtc,
 struct drm_mode_cursor2 *req,
-struct drm_file *file_priv)
+struct drm_file *file_priv,
+struct drm_modeset_acquire_ctx *ctx)
 {
struct drm_device *dev = crtc->dev;
struct drm_framebuffer *fb = NULL;
@@ -634,21 +635,11 @@ static int drm_mode_cursor_universal(struct drm_crtc 
*crtc,
int32_t crtc_x, crtc_y;
uint32_t crtc_w = 0, crtc_h = 0;
uint32_t src_w = 0, src_h = 0;
-   struct drm_modeset_acquire_ctx ctx;
int ret = 0;
 
BUG_ON(!crtc->cursor);
WARN_ON(crtc->cursor->crtc != crtc && crtc->cursor->crtc != NULL);
 
-   drm_modeset_acquire_init(, 0);
-retry:
-   ret = drm_modeset_lock(>mutex, );
-   if (ret)
-   goto fail;
-   ret = drm_modeset_lock(>cursor->mutex, );
-   if (ret)
-   goto fail;
-
/*
 * Obtain fb we'll be using (either new or existing) and take an extra
 * reference to it if fb != null.  setplane will take care of dropping
@@ -693,7 +684,7 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
  

[Intel-gfx] [PATCH 06/15] drm: Drop modeset_lock_all from the getproperty ioctl

2017-04-03 Thread Daniel Vetter
Properties, i.e. the struct drm_property specifying the type and value
range of a property, not the instantiation on a given object, are
invariant over the lifetime of a driver.

Hence no locking at all is needed, we can just remove it.

While at it give the function some love and simplify it, to get it
under the 80 char limit:
- Straighten the loops to reduce the nesting.
- use u64_to_user_ptr casting helper
- use put_user for fixed u64 copies.

Note there's a small behavioural change in that we now copy parts of
the values to userspace if the arrays are a bit too small. Since
userspace will immediately retry anyway, this doesn't matter.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_property.c | 72 +-
 1 file changed, 29 insertions(+), 43 deletions(-)

diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
index b17959c3e099..3feef0659940 100644
--- a/drivers/gpu/drm/drm_property.c
+++ b/drivers/gpu/drm/drm_property.c
@@ -442,8 +442,7 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
struct drm_property *property;
int enum_count = 0;
int value_count = 0;
-   int ret = 0, i;
-   int copied;
+   int i, copied;
struct drm_property_enum *prop_enum;
struct drm_mode_property_enum __user *enum_ptr;
uint64_t __user *values_ptr;
@@ -451,55 +450,43 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL;
 
-   drm_modeset_lock_all(dev);
property = drm_property_find(dev, out_resp->prop_id);
-   if (!property) {
-   ret = -ENOENT;
-   goto done;
-   }
-
-   if (drm_property_type_is(property, DRM_MODE_PROP_ENUM) ||
-   drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) {
-   list_for_each_entry(prop_enum, >enum_list, head)
-   enum_count++;
-   }
-
-   value_count = property->num_values;
+   if (!property)
+   return -ENOENT;
 
strncpy(out_resp->name, property->name, DRM_PROP_NAME_LEN);
out_resp->name[DRM_PROP_NAME_LEN-1] = 0;
out_resp->flags = property->flags;
 
-   if ((out_resp->count_values >= value_count) && value_count) {
-   values_ptr = (uint64_t __user *)(unsigned 
long)out_resp->values_ptr;
-   for (i = 0; i < value_count; i++) {
-   if (copy_to_user(values_ptr + i, >values[i], 
sizeof(uint64_t))) {
-   ret = -EFAULT;
-   goto done;
-   }
+   value_count = property->num_values;
+   values_ptr = u64_to_user_ptr(out_resp->values_ptr);
+
+   for (i = 0; i < value_count; i++) {
+   if (i < out_resp->count_values &&
+   put_user(property->values[i], values_ptr + i)) {
+   return -EFAULT;
}
}
out_resp->count_values = value_count;
 
+   copied = 0;
+   enum_ptr = u64_to_user_ptr(out_resp->enum_blob_ptr);
+
if (drm_property_type_is(property, DRM_MODE_PROP_ENUM) ||
-   drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) {
-   if ((out_resp->count_enum_blobs >= enum_count) && enum_count) {
-   copied = 0;
-   enum_ptr = (struct drm_mode_property_enum __user 
*)(unsigned long)out_resp->enum_blob_ptr;
-   list_for_each_entry(prop_enum, >enum_list, 
head) {
-
-   if (copy_to_user(_ptr[copied].value, 
_enum->value, sizeof(uint64_t))) {
-   ret = -EFAULT;
-   goto done;
-   }
-
-   if (copy_to_user(_ptr[copied].name,
-_enum->name, 
DRM_PROP_NAME_LEN)) {
-   ret = -EFAULT;
-   goto done;
-   }
-   copied++;
-   }
+   drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) {
+   list_for_each_entry(prop_enum, >enum_list, head) {
+   enum_count++;
+   if (out_resp->count_enum_blobs <= enum_count)
+   continue;
+
+   if (copy_to_user(_ptr[copied].value,
+_enum->value, sizeof(uint64_t)))
+   return -EFAULT;
+
+   if (copy_to_user(_ptr[copied].name,
+_enum->name, DRM_PROP_NAME_LEN))
+   return -EFAULT;
+   copied++;
}
out_resp->count_enum_blobs = 

[Intel-gfx] [PATCH 04/15] drm/atomic-helper: remove modeset_lock_all from helper_resume

2017-04-03 Thread Daniel Vetter
Atomic code rely shouldn't rely on the magic hidden acquire context.

v2: Remove unused config local var (gcc).

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_atomic_helper.c | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 8999da789bb0..978dd8f49476 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2623,14 +2623,22 @@ 
EXPORT_SYMBOL(drm_atomic_helper_commit_duplicated_state);
 int drm_atomic_helper_resume(struct drm_device *dev,
 struct drm_atomic_state *state)
 {
-   struct drm_mode_config *config = >mode_config;
+   struct drm_modeset_acquire_ctx ctx;
int err;
 
drm_mode_config_reset(dev);
 
-   drm_modeset_lock_all(dev);
-   err = drm_atomic_helper_commit_duplicated_state(state, 
config->acquire_ctx);
-   drm_modeset_unlock_all(dev);
+   drm_modeset_acquire_init(, 0);
+   while (1) {
+   err = drm_atomic_helper_commit_duplicated_state(state, );
+   if (err != -EDEADLK)
+   break;
+
+   drm_modeset_backoff();
+   }
+
+   drm_modeset_drop_locks();
+   drm_modeset_acquire_fini();
 
return err;
 }
-- 
2.11.0

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


[Intel-gfx] [PATCH 07/15] drm: Only take crtc lock in get_gamma ioctl

2017-04-03 Thread Daniel Vetter
We don't call into drivers at all here, this is enough. Also, we can
reduce the critical section a bit to simplify the code.
crtc->gamma_size is set up once at driver load and then invariant, so
also doesn't need any protection.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_color_mgmt.c | 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c
index cc23b9a505c0..a32be59a72d1 100644
--- a/drivers/gpu/drm/drm_color_mgmt.c
+++ b/drivers/gpu/drm/drm_color_mgmt.c
@@ -295,19 +295,15 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev,
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL;
 
-   drm_modeset_lock_all(dev);
crtc = drm_crtc_find(dev, crtc_lut->crtc_id);
-   if (!crtc) {
-   ret = -ENOENT;
-   goto out;
-   }
+   if (!crtc)
+   return -ENOENT;
 
/* memcpy into gamma store */
-   if (crtc_lut->gamma_size != crtc->gamma_size) {
-   ret = -EINVAL;
-   goto out;
-   }
+   if (crtc_lut->gamma_size != crtc->gamma_size)
+   return -EINVAL;
 
+   drm_modeset_lock(>mutex, NULL);
size = crtc_lut->gamma_size * (sizeof(uint16_t));
r_base = crtc->gamma_store;
if (copy_to_user((void __user *)(unsigned long)crtc_lut->red, r_base, 
size)) {
@@ -327,6 +323,6 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev,
goto out;
}
 out:
-   drm_modeset_unlock_all(dev);
+   drm_modeset_unlock(>mutex);
return ret;
 }
-- 
2.11.0

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


[Intel-gfx] [PATCH 08/15] drm/i915: Nuke intel_atomic_legacy_gamma_set

2017-04-03 Thread Daniel Vetter
We do set DRIVER_ATOMIC now.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/intel_display.c | 44 +---
 1 file changed, 1 insertion(+), 43 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index ba6687e31cbd..779ab46200c2 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13113,50 +13113,8 @@ void intel_crtc_restore_mode(struct drm_crtc *crtc)
drm_atomic_state_put(state);
 }
 
-/*
- * FIXME: Remove this once i915 is fully DRIVER_ATOMIC by calling
- *drm_atomic_helper_legacy_gamma_set() directly.
- */
-static int intel_atomic_legacy_gamma_set(struct drm_crtc *crtc,
-u16 *red, u16 *green, u16 *blue,
-uint32_t size)
-{
-   struct drm_device *dev = crtc->dev;
-   struct drm_mode_config *config = >mode_config;
-   struct drm_crtc_state *state;
-   int ret;
-
-   ret = drm_atomic_helper_legacy_gamma_set(crtc, red, green, blue, size);
-   if (ret)
-   return ret;
-
-   /*
-* Make sure we update the legacy properties so this works when
-* atomic is not enabled.
-*/
-
-   state = crtc->state;
-
-   drm_object_property_set_value(>base,
- config->degamma_lut_property,
- (state->degamma_lut) ?
- state->degamma_lut->base.id : 0);
-
-   drm_object_property_set_value(>base,
- config->ctm_property,
- (state->ctm) ?
- state->ctm->base.id : 0);
-
-   drm_object_property_set_value(>base,
- config->gamma_lut_property,
- (state->gamma_lut) ?
- state->gamma_lut->base.id : 0);
-
-   return 0;
-}
-
 static const struct drm_crtc_funcs intel_crtc_funcs = {
-   .gamma_set = intel_atomic_legacy_gamma_set,
+   .gamma_set = drm_atomic_helper_legacy_gamma_set,
.set_config = drm_atomic_helper_set_config,
.set_property = drm_atomic_helper_crtc_set_property,
.destroy = intel_crtc_destroy,
-- 
2.11.0

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


[Intel-gfx] [PATCH 03/15] drm: Remove drm_modeset_legacy_acquire_ctx and crtc->acquire_ctx

2017-04-03 Thread Daniel Vetter
With all the callers of drm_modeset_lock_crtc gone, and all the places
it was formerly used properly wiring the acquire ctx through, we can
remove this.

The only hidden context magic we still have is now the global one.

Reviewed-by: Harry Wentland 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_atomic.c  | 14 --
 drivers/gpu/drm/drm_atomic_helper.c   |  2 +-
 drivers/gpu/drm/drm_modeset_lock.c| 21 -
 drivers/gpu/drm/i915/intel_display.c  |  4 ++--
 drivers/gpu/drm/i915/intel_pipe_crc.c |  2 +-
 include/drm/drm_crtc.h|  9 -
 include/drm/drm_modeset_lock.h|  2 --
 7 files changed, 4 insertions(+), 50 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 9b892af7811a..345310213820 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1516,19 +1516,9 @@ EXPORT_SYMBOL(drm_atomic_add_affected_planes);
 void drm_atomic_legacy_backoff(struct drm_atomic_state *state)
 {
struct drm_device *dev = state->dev;
-   unsigned crtc_mask = 0;
-   struct drm_crtc *crtc;
int ret;
bool global = false;
 
-   drm_for_each_crtc(crtc, dev) {
-   if (crtc->acquire_ctx != state->acquire_ctx)
-   continue;
-
-   crtc_mask |= drm_crtc_mask(crtc);
-   crtc->acquire_ctx = NULL;
-   }
-
if (WARN_ON(dev->mode_config.acquire_ctx == state->acquire_ctx)) {
global = true;
 
@@ -1542,10 +1532,6 @@ void drm_atomic_legacy_backoff(struct drm_atomic_state 
*state)
if (ret)
goto retry;
 
-   drm_for_each_crtc(crtc, dev)
-   if (drm_crtc_mask(crtc) & crtc_mask)
-   crtc->acquire_ctx = state->acquire_ctx;
-
if (global)
dev->mode_config.acquire_ctx = state->acquire_ctx;
 }
diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index f2d62620e5f8..8999da789bb0 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2976,7 +2976,7 @@ int drm_atomic_helper_connector_dpms(struct drm_connector 
*connector,
if (!state)
return -ENOMEM;
 
-   state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
+   state->acquire_ctx = crtc->dev->mode_config.acquire_ctx;
 retry:
crtc_state = drm_atomic_get_crtc_state(state, crtc);
if (IS_ERR(crtc_state)) {
diff --git a/drivers/gpu/drm/drm_modeset_lock.c 
b/drivers/gpu/drm/drm_modeset_lock.c
index c3ca6b859236..64ef09a6cccb 100644
--- a/drivers/gpu/drm/drm_modeset_lock.c
+++ b/drivers/gpu/drm/drm_modeset_lock.c
@@ -149,27 +149,6 @@ void drm_modeset_unlock_all(struct drm_device *dev)
 EXPORT_SYMBOL(drm_modeset_unlock_all);
 
 /**
- * drm_modeset_legacy_acquire_ctx - find acquire ctx for legacy ioctls
- * @crtc: drm crtc
- *
- * Legacy ioctl operations like cursor updates or page flips only have per-crtc
- * locking, and store the acquire ctx in the corresponding crtc. All other
- * legacy operations take all locks and use a global acquire context. This
- * function grabs the right one.
- */
-struct drm_modeset_acquire_ctx *
-drm_modeset_legacy_acquire_ctx(struct drm_crtc *crtc)
-{
-   if (crtc->acquire_ctx)
-   return crtc->acquire_ctx;
-
-   WARN_ON(!crtc->dev->mode_config.acquire_ctx);
-
-   return crtc->dev->mode_config.acquire_ctx;
-}
-EXPORT_SYMBOL(drm_modeset_legacy_acquire_ctx);
-
-/**
  * drm_warn_on_modeset_not_all_locked - check that all modeset locks are locked
  * @dev: device
  *
diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 81baa5a9780c..ba6687e31cbd 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -10727,7 +10727,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
state = drm_atomic_state_alloc(dev);
if (!state)
return -ENOMEM;
-   state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
+   state->acquire_ctx = dev->mode_config.acquire_ctx;
 
 retry:
plane_state = drm_atomic_get_plane_state(state, primary);
@@ -13090,7 +13090,7 @@ void intel_crtc_restore_mode(struct drm_crtc *crtc)
return;
}
 
-   state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
+   state->acquire_ctx = crtc->dev->mode_config.acquire_ctx;
 
 retry:
crtc_state = drm_atomic_get_crtc_state(state, crtc);
diff --git a/drivers/gpu/drm/i915/intel_pipe_crc.c 
b/drivers/gpu/drm/i915/intel_pipe_crc.c
index 9fd9c70baeed..206ee4f0150e 100644
--- a/drivers/gpu/drm/i915/intel_pipe_crc.c
+++ b/drivers/gpu/drm/i915/intel_pipe_crc.c
@@ -522,7 +522,7 @@ static void hsw_trans_edp_pipe_A_crc_wa(struct 
drm_i915_private *dev_priv,
goto unlock;
}
 
- 

[Intel-gfx] [PATCH 00/15] acquire ctx wire-up, part 2

2017-04-03 Thread Daniel Vetter
Hi all,

Partially this is a resend of the patches now unblocked by the vmwgfx atomic
conversion just merged. I could entirely drop the vmwgfx patch since it's all
fixed now.

Then a bit of follow-up, plus converting the gamma_set/get ioctls. fbdev
emulation and the property paths are still infested by drm_modeset_lock_all, but
I think at least for fbdev we now have a semi-clear path with Thierry's series.
Properties are still unclear to me, because it's a rather layered maze with lots
of different callsites.

As always, comments and review highly welcome.

Cheers, Daniel

Daniel Vetter (15):
  drm: Make drm_modeset_lock_crtc internal
  drm: Remove drm_modeset_(un)lock_crtc
  drm: Remove drm_modeset_legacy_acquire_ctx and crtc->acquire_ctx
  drm/atomic-helper: remove modeset_lock_all from helper_resume
  drm: drop modeset_lock_all from drm_state_info
  drm: Drop modeset_lock_all from the getproperty ioctl
  drm: Only take crtc lock in get_gamma ioctl
  drm/i915: Nuke intel_atomic_legacy_gamma_set
  drm/msm: Nerf zpos property
  drm/fb-helper: Give up on kgdb for atomic drivers
  drm: Add explicit acquire ctx handling around ->gamma_set
  drm: Add acquire ctx to ->gamma_set hook
  drm/atomic-helper: Remove legacy backoff hack from gamma_set
  drm: extract legacy framebuffer remove
  drm/fb-helper: Extract _legacy kms functions

 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c|   3 +-
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c|   3 +-
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c |   3 +-
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c |   3 +-
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c  |   3 +-
 drivers/gpu/drm/ast/ast_mode.c|   3 +-
 drivers/gpu/drm/cirrus/cirrus_mode.c  |   3 +-
 drivers/gpu/drm/drm_atomic.c  | 162 +++---
 drivers/gpu/drm/drm_atomic_helper.c   |  35 +++
 drivers/gpu/drm/drm_color_mgmt.c  |  51 +-
 drivers/gpu/drm/drm_crtc_internal.h   |   1 -
 drivers/gpu/drm/drm_fb_helper.c   |  81 +--
 drivers/gpu/drm/drm_framebuffer.c | 137 +
 drivers/gpu/drm/drm_modeset_lock.c| 102 ---
 drivers/gpu/drm/drm_plane.c   |  49 +
 drivers/gpu/drm/drm_property.c|  72 ++---
 drivers/gpu/drm/gma500/gma_display.c  |   3 +-
 drivers/gpu/drm/gma500/gma_display.h  |   3 +-
 drivers/gpu/drm/i915/intel_display.c  |  60 +--
 drivers/gpu/drm/i915/intel_pipe_crc.c |   2 +-
 drivers/gpu/drm/mgag200/mgag200_mode.c|   3 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c |   2 -
 drivers/gpu/drm/nouveau/dispnv04/crtc.c   |   3 +-
 drivers/gpu/drm/nouveau/nv50_display.c|  13 +--
 drivers/gpu/drm/radeon/radeon_display.c   |   3 +-
 drivers/gpu/drm/vc4/vc4_crtc.c|   3 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c   |   3 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.h   |   3 +-
 include/drm/drm_atomic_helper.h   |   3 +-
 include/drm/drm_crtc.h|  12 +--
 include/drm/drm_modeset_lock.h|   5 -
 31 files changed, 344 insertions(+), 488 deletions(-)

-- 
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: intel_ring.engine is unused

2017-04-03 Thread Joonas Lahtinen
On la, 2017-04-01 at 11:01 +0100, Chris Wilson wrote:
> Or rather it is used only by intel_ring_pin() to extract the
> drm_i915_private which we can easily pass in. As this is a relatively
> rare operation, save the space in the struct, and as such it is even
> break even in the extra code for passing around the parameter:
> 
> add/remove: 0/0 grow/shrink: 2/3 up/down: 15/-15 (0)
> function old new   delta
> intel_init_ring_buffer   906 918 +12
> execlists_context_pin   13081311  +3
> mock_engine  407 403  -4
> intel_engine_create_ring 367 363  -4
> intel_ring_pin   326 319  -7
> Total: Before=1261794, After=1261794, chg +0.00%
> 
> v2: Reorder intel_init_ring_buffer to keep the ring setup together:
> 
> add/remove: 0/0 grow/shrink: 2/3 up/down: 9/-15 (-6)
> function old new   delta
> intel_init_ring_buffer   906 912  +6
> execlists_context_pin   13081311  +3
> mock_engine  407 403  -4
> intel_engine_create_ring 367 363  -4
> intel_ring_pin   326 319  -7
> Total: Before=1261794, After=1261788, chg -0.00%
> 
> Signed-off-by: Chris Wilson 


 
> @@ -1493,13 +1491,7 @@ static int intel_init_ring_buffer(struct 
> intel_engine_cs *engine)
>   if (ret)
>   goto error;
>  
> - ring = intel_engine_create_ring(engine, 32 * PAGE_SIZE);
> - if (IS_ERR(ring)) {
> - ret = PTR_ERR(ring);
> - goto error;
> - }
> -
> - if (HWS_NEEDS_PHYSICAL(dev_priv)) {
> + if (HWS_NEEDS_PHYSICAL(engine->i915)) {
>   WARN_ON(engine->id != RCS);
>   ret = init_phys_status_page(engine);
>   if (ret)

Onion teardown would be great while you move the code around.

With that,

Reviewed-by: Joonas Lahtinen 

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] [RFC]: Arbitrated system memory bandwidth workarounds implementation for watermark.

2017-04-03 Thread Mahesh Kumar

Hi Maarten,
sorry for delay in reply...

In Option 3:

We know maximum number of plane for any given CRTC, We also know, what 
is the maximum downscaling supported (only downscaling affects WM) per 
pipe/plane.


Maximum downscaling per plane can be :

max plane hscale * max plane vscale,which is 2.99x2.99 
in GEN9


This scaling should also be less than cdclk / pixel clock.

same limitation applies for pipe downscaling as well.

following patch implements limitation related to cdclk/pixel_clock 
(max supported pixel rate).


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

So our downscaling related final limitation will be something like

min ( (max_plane_hscale * max_plane_vscale) * 
(max_pipe_hscale * max_pipe_vscale), (cdclk / pixel_clock))


min (2.99*2.99*2.99*2.99, (cdclk / pixel_clock))

During modeset we can compute the same & enable the WA.

One of mem bandwidth limitation is, if Y_tile is enabled in any of the 
plane & total display bandwidth is > 20% then enable Y-tile specific WA, 
20% mark will hit only in case of DRAM connected is of lower frequency 
OR high resolution & high refresh-rate  monitors are connected.


for X-tile WA this % is 35% OR 60%, So we have pretty slim chances of 
hitting the situation.


for e.g. 4K@60 display will have pixel clock about 540-545MHz, & cdclk 
will be 594MHz


if 1600MHz dual-channel DRAM is connected to the system, then available 
system bandwidth will be :


1600 * 2 * 8 = 25600,

if 3 planes are enabled & all 3 pipes are enables in that case total 
display bandwidth requirement will be approx


545 * 3 * 3 = 4905, which is roughly 20% (19.16%) of total 
available bandwidth, & y-tile WA maybe needed


if downscaling is enabled max supported downscaling will be (594 / 545) 
1.08%,


in such case max display bandwidth requirement may reach

545 * 1.08 * 3 * 3 = 5297.4, which is 20.69%, & Y-tile WA will be 
needed.


for higher frequency DRAM this % will be even less

so whenever total bandwidth is going > 20% & Y-tile is enabled, then 
only we may need to take the mutex of all CRTC, so there will be fairly 
less changes of holding any lock.


Regards,

-Mahesh

On Tuesday 28 March 2017 01:38 PM, Maarten Lankhorst wrote:

Op 27-03-17 om 17:52 schreef Mahesh Kumar:

*Arbitrated system bandwidth workarounds for watermark.*

All GEN-9 based platforms require watermark related WA to be enabled 
if Display memory bandwidth requirement is exceeding XX% of total 
available system memory bandwidth.

This XX% depend on multiple factors.
*e.g.* if all the enabled planes have X-tiled or linear memory then,
XX = 60
if any Y-tiled plane is enabled then
XX = 20 etc.
In current implementation of workarounds we enable maximum WA (i.e. 
add 15us latency during WM calculation) irrespective of workaround is 
required OR not.
total display bandwidth requirement is sum of display requirement of 
individual pipe, In order to calculate correct BW requirement plane 
configuration of any pipe should not be changing during calculation.


To implement & optimize above requirement many implementations are 
possible, I'm proposing few of options.

Please review & let know which option is better to implement WA's.

*Option 1:*

Use connection_mutex (this will change to i915 specific lock only
that is available in atomic design) to serialize all the commits.
If memory bandwidth WA is changing then get all crtc_states for
calculating watermark values.
*Pros:*

  * In each flip optimum WM values (not more than the required
value) will be used.

*Cons:*

  * This approach will serialize all the flips so there will be
performance impact, in case of blocking commits this impact
will be even worse, e.g. three display with refresh-rate of
30fps, 60fps & 90fps.
  * If commit is going-on in 30FPS display, all other flip will
be blocked & frames in 60 & 90fps display will be
dropped/blocked.

*Option 2:*

Use two levels of system bandwidth check, once during calculation
& second during commit.
During intel_atomic_check (as part of compute_ddb) don’t hold any
system level mutex, instead hold WM mutex & compute system
bandwidth requirement. If WA is changing then get crtc_state of
all other pipes & go  ahead with commit.
During intel_atomic_commit, again take wm_mutex & recalculate
complete system bandwidth requirement. If requirement is changed
in a way that computed WM are not valid anymore fail the flip.
Update the bandwidth requirement for each plane in global state
(dev_priv->wm) so other flips don’t need to recalculate it.

*Pros:*

  * It reduces critical section time.
  * Still optimum use of available DDB & optimum WM values are used.

*Cons:*

  * If memory bandwidth WA are changing very frequently then
there 

[Intel-gfx] Updated drm-intel-testing

2017-04-03 Thread Daniel Vetter
Hi all,

Last 4.12 feature pile:

GVT updates:
- Add mdev attribute group for per-vgpu info
- Time slice based vGPU scheduling QoS support (Gao Ping)
- Initial KBL support for E3 server (Han Xu)
- other misc.

i915:
- lots and lots of small fixes and improvements all over
- refactor fw_domain code (Chris Wilson)
- improve guc code (Oscar Mateo)
- refactor cursor/sprite code, precompute more for less overhead in
  the critical path (Ville)
- refactor guc/huc fw loading code a bit (Michal Wajdeczko)

Happy testing!

Cheers, 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