Re: [Intel-gfx] [RFC 23/33] drm/i915: Convert i915_gem_flush_ggtt_writes to intel_gt

2019-06-18 Thread Tvrtko Ursulin


On 17/06/2019 21:01, Chris Wilson wrote:

Quoting Tvrtko Ursulin (2019-06-17 19:12:26)

From: Tvrtko Ursulin 

Having introduced struct intel_gt (named the anonymous structure in i915)
we can start using it to compartmentalize our code better. It makes more
sense logically to have the code internally like this and it will also
help with future split between gt and display in i915.

v2:
  * Keep ggtt flush before fb obj flush. (Chris)

Signed-off-by: Tvrtko Ursulin 
---
  drivers/gpu/drm/i915/gem/i915_gem_object.c| 12 +++---
  .../drm/i915/gem/selftests/i915_gem_mman.c|  3 +-
  drivers/gpu/drm/i915/gt/intel_gt.c| 41 +++
  drivers/gpu/drm/i915/gt/intel_gt.h|  2 +
  drivers/gpu/drm/i915/i915_drv.h   |  2 -
  drivers/gpu/drm/i915/i915_gem.c   | 40 --
  drivers/gpu/drm/i915/i915_vma.c   |  3 +-
  drivers/gpu/drm/i915/selftests/i915_gem_gtt.c |  2 +-
  8 files changed, 54 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c 
b/drivers/gpu/drm/i915/gem/i915_gem_object.c
index a4047a585c8b..f58d45ae10d0 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
@@ -22,6 +22,7 @@
   *
   */
  
+#include "gt/intel_gt.h"

  #include "i915_drv.h"
  #include "i915_gem_clflush.h"
  #include "i915_gem_context.h"
@@ -367,7 +368,6 @@ void
  i915_gem_object_flush_write_domain(struct drm_i915_gem_object *obj,
unsigned int flush_domains)
  {
-   struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
 struct i915_vma *vma;
  
 assert_object_held(obj);

@@ -377,17 +377,17 @@ i915_gem_object_flush_write_domain(struct 
drm_i915_gem_object *obj,
  
 switch (obj->write_domain) {

 case I915_GEM_DOMAIN_GTT:
-   i915_gem_flush_ggtt_writes(dev_priv);
-
-   intel_fb_obj_flush(obj,
-  fb_write_origin(obj, I915_GEM_DOMAIN_GTT));
-
 for_each_ggtt_vma(vma, obj) {
 if (vma->iomap)
 continue;
  
+   intel_gt_flush_ggtt_writes(vma->vm->gt);

 i915_vma_unset_ggtt_write(vma);
+   break;


So we no longer flush writes from user GGTT mmaps, nor clear all the
dirty bits? And now despite the move to be gt centric we end up assuming
that it is still really device centric (breaking after one gt flush).


I did not realize the significance of vma->iomap and the break was not 
supposed to be there, sneaked up after some back and forth refactoring.


So it sounds like it needs to be two loops to preserve existing behaviour.

Regards,

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

Re: [Intel-gfx] [PATCH] Documentation/i915: fix file references after display/ subdir renames

2019-06-18 Thread Jani Nikula
On Mon, 17 Jun 2019, Rodrigo Vivi  wrote:
> On Mon, Jun 17, 2019 at 01:29:44PM +0300, Jani Nikula wrote:
>> Fix the plethora of Sphinx build errors after moving the display files
>> under a subdirectory.
>> 
>> Fixes: 379bc100232a ("drm/i915: move modesetting output/encoder code under 
>> display/")
>> Fixes: df0566a641f9 ("drm/i915: move modesetting core code under display/")
>> Cc: Chris Wilson 
>> Cc: Rodrigo Vivi 
>> Cc: Ville Syrjälä 
>> Cc: Maarten Lankhorst 
>> Signed-off-by: Jani Nikula 
>
> Reviewed-by: Rodrigo Vivi 

Pushed to dinq, thanks for the review.

Any igt failures are hardly due to to pure .rst file changes.

BR,
Jani.


>
>> ---
>>  Documentation/gpu/i915.rst | 66 +++---
>>  1 file changed, 33 insertions(+), 33 deletions(-)
>> 
>> diff --git a/Documentation/gpu/i915.rst b/Documentation/gpu/i915.rst
>> index 300220c4b498..c38ef0dda605 100644
>> --- a/Documentation/gpu/i915.rst
>> +++ b/Documentation/gpu/i915.rst
>> @@ -82,13 +82,13 @@ change.
>>  Frontbuffer Tracking
>>  
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/intel_frontbuffer.c
>> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_frontbuffer.c
>> :doc: frontbuffer tracking
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/intel_frontbuffer.h
>> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_frontbuffer.h
>> :internal:
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/intel_frontbuffer.c
>> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_frontbuffer.c
>> :internal:
>>  
>>  .. kernel-doc:: drivers/gpu/drm/i915/i915_gem.c
>> @@ -97,10 +97,10 @@ Frontbuffer Tracking
>>  Display FIFO Underrun Reporting
>>  ---
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/intel_fifo_underrun.c
>> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_fifo_underrun.c
>> :doc: fifo underrun handling
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/intel_fifo_underrun.c
>> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_fifo_underrun.c
>> :internal:
>>  
>>  Plane Configuration
>> @@ -115,10 +115,10 @@ panel self refresh.
>>  Atomic Plane Helpers
>>  
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/intel_atomic_plane.c
>> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_atomic_plane.c
>> :doc: atomic plane helpers
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/intel_atomic_plane.c
>> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_atomic_plane.c
>> :internal:
>>  
>>  Output Probing
>> @@ -132,19 +132,19 @@ probing, so those sections fully apply.
>>  Hotplug
>>  ---
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/intel_hotplug.c
>> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_hotplug.c
>> :doc: Hotplug
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/intel_hotplug.c
>> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_hotplug.c
>> :internal:
>>  
>>  High Definition Audio
>>  -
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/intel_audio.c
>> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_audio.c
>> :doc: High Definition Audio over HDMI and Display Port
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/intel_audio.c
>> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_audio.c
>> :internal:
>>  
>>  .. kernel-doc:: include/drm/i915_component.h
>> @@ -153,58 +153,58 @@ High Definition Audio
>>  Intel HDMI LPE Audio Support
>>  
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/intel_lpe_audio.c
>> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_lpe_audio.c
>> :doc: LPE Audio integration for HDMI or DP playback
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/intel_lpe_audio.c
>> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_lpe_audio.c
>> :internal:
>>  
>>  Panel Self Refresh PSR (PSR/SRD)
>>  
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/intel_psr.c
>> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_psr.c
>> :doc: Panel Self Refresh (PSR/SRD)
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/intel_psr.c
>> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_psr.c
>> :internal:
>>  
>>  Frame Buffer Compression (FBC)
>>  --
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/intel_fbc.c
>> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_fbc.c
>> :doc: Frame Buffer Compression (FBC)
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/intel_fbc.c
>> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_fbc.c
>> :internal:
>>  
>>  Display Refresh Rate Switching (DRRS)
>>  -
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/intel_dp.c
>> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_dp.c
>> :doc: Display Refresh Rate Switching (DRRS)
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/intel_dp.c
>> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_dp.c
>> :functions: intel_dp_set_drrs_state
>>  
>> -.. kernel-doc:: drivers/gpu/drm/i915/i

Re: [Intel-gfx] [PATCH] drm/rcar-du: Fix error check when retrieving crtc state

2019-06-18 Thread Laurent Pinchart
Hi Sean,

Thank you for the patch.

On Mon, Jun 17, 2019 at 02:15:42PM -0400, Sean Paul wrote:
> From: Sean Paul 
> 
> drm_atomic_get_crtc_state() returns an error pointer when it fails, so
> the null check is doing nothing here.
> 
> Credit to 0-day/Dan Carpenter for reporting this.
> 
> Fixes: 6f3b62781bbd ("drm: Convert connector_helper_funcs->atomic_check to 
> accept drm_atomic_state")
> Cc: Daniel Vetter 
> Cc: Ville Syrjälä 
> Cc: Jani Nikula 
> Cc: Joonas Lahtinen 
> Cc: Rodrigo Vivi 
> Cc: Ben Skeggs 
> Cc: Laurent Pinchart 
> Cc: Kieran Bingham 
> Cc: Eric Anholt 
> Cc: Laurent Pinchart  [for rcar lvds]
> Cc: Sean Paul 
> Cc: Maarten Lankhorst 
> Cc: Maxime Ripard 
> Cc: Sean Paul 
> Cc: David Airlie 
> Cc: Lyude Paul 
> Cc: Karol Herbst 
> Cc: Ilia Mirkin 
> Cc: dri-de...@lists.freedesktop.org
> Cc: intel-gfx@lists.freedesktop.org
> Cc: linux-renesas-...@vger.kernel.org
> Reported-by: kbuild test robot 
> Reported-by: Dan Carpenter 
> Signed-off-by: Sean Paul 

Reviewed-by: Laurent Pinchart 

I have no pending conflicting changes for rcar_lvds.c. Do you plan to
merge this through drm-misc ?

> ---
>  drivers/gpu/drm/rcar-du/rcar_lvds.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c 
> b/drivers/gpu/drm/rcar-du/rcar_lvds.c
> index f2a5d4d997073..1c62578590f46 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_lvds.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c
> @@ -115,8 +115,8 @@ static int rcar_lvds_connector_atomic_check(struct 
> drm_connector *connector,
>  
>   /* We're not allowed to modify the resolution. */
>   crtc_state = drm_atomic_get_crtc_state(state, conn_state->crtc);
> - if (!crtc_state)
> - return -EINVAL;
> + if (IS_ERR(crtc_state))
> + return PTR_ERR(crtc_state);
>  
>   if (crtc_state->mode.hdisplay != panel_mode->hdisplay ||
>   crtc_state->mode.vdisplay != panel_mode->vdisplay)

-- 
Regards,

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

[Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/gtt: Serialise both updates to PDE and our shadow (rev2)

2019-06-18 Thread Patchwork
== Series Details ==

Series: drm/i915/gtt: Serialise both updates to PDE and our shadow (rev2)
URL   : https://patchwork.freedesktop.org/series/62203/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6287_full -> Patchwork_13310_full


Summary
---

  **SUCCESS**

  No regressions found.

  

Known issues


  Here are the changes found in Patchwork_13310_full that come from known 
issues:

### IGT changes ###

 Issues hit 

  * igt@gem_tiled_swapping@non-threaded:
- shard-kbl:  [PASS][1] -> [DMESG-WARN][2] ([fdo#108686])
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-kbl6/igt@gem_tiled_swapp...@non-threaded.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13310/shard-kbl3/igt@gem_tiled_swapp...@non-threaded.html

  * igt@gem_userptr_blits@map-fixed-invalidate-busy-gup:
- shard-kbl:  [PASS][3] -> [DMESG-WARN][4] ([fdo#110913 ])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-kbl4/igt@gem_userptr_bl...@map-fixed-invalidate-busy-gup.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13310/shard-kbl6/igt@gem_userptr_bl...@map-fixed-invalidate-busy-gup.html

  * igt@gem_userptr_blits@sync-unmap-cycles:
- shard-apl:  [PASS][5] -> [DMESG-WARN][6] ([fdo#110913 ]) +2 
similar issues
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-apl8/igt@gem_userptr_bl...@sync-unmap-cycles.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13310/shard-apl3/igt@gem_userptr_bl...@sync-unmap-cycles.html

  * igt@i915_suspend@sysfs-reader:
- shard-apl:  [PASS][7] -> [DMESG-WARN][8] ([fdo#108566]) +5 
similar issues
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-apl6/igt@i915_susp...@sysfs-reader.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13310/shard-apl4/igt@i915_susp...@sysfs-reader.html

  * igt@kms_flip@2x-flip-vs-absolute-wf_vblank:
- shard-hsw:  [PASS][9] -> [SKIP][10] ([fdo#109271]) +12 similar 
issues
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-hsw6/igt@kms_flip@2x-flip-vs-absolute-wf_vblank.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13310/shard-hsw1/igt@kms_flip@2x-flip-vs-absolute-wf_vblank.html

  * igt@kms_flip@flip-vs-suspend:
- shard-snb:  [PASS][11] -> [INCOMPLETE][12] ([fdo#105411]) +1 
similar issue
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-snb7/igt@kms_f...@flip-vs-suspend.html
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13310/shard-snb1/igt@kms_f...@flip-vs-suspend.html

  * igt@kms_flip_tiling@flip-yf-tiled:
- shard-skl:  [PASS][13] -> [FAIL][14] ([fdo#108145])
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-skl3/igt@kms_flip_til...@flip-yf-tiled.html
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13310/shard-skl10/igt@kms_flip_til...@flip-yf-tiled.html

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render:
- shard-iclb: [PASS][15] -> [FAIL][16] ([fdo#103167]) +4 similar 
issues
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-iclb8/igt@kms_frontbuffer_track...@fbcpsr-1p-primscrn-cur-indfb-draw-render.html
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13310/shard-iclb7/igt@kms_frontbuffer_track...@fbcpsr-1p-primscrn-cur-indfb-draw-render.html

  * igt@kms_psr@psr2_cursor_render:
- shard-iclb: [PASS][17] -> [SKIP][18] ([fdo#109441]) +1 similar 
issue
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-iclb2/igt@kms_psr@psr2_cursor_render.html
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13310/shard-iclb4/igt@kms_psr@psr2_cursor_render.html

  * igt@kms_vblank@pipe-b-ts-continuation-suspend:
- shard-kbl:  [PASS][19] -> [DMESG-WARN][20] ([fdo#108566])
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-kbl3/igt@kms_vbl...@pipe-b-ts-continuation-suspend.html
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13310/shard-kbl6/igt@kms_vbl...@pipe-b-ts-continuation-suspend.html

  
 Possible fixes 

  * igt@gem_exec_blt@normal-min:
- shard-apl:  [INCOMPLETE][21] ([fdo#103927]) -> [PASS][22]
   [21]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-apl2/igt@gem_exec_...@normal-min.html
   [22]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13310/shard-apl6/igt@gem_exec_...@normal-min.html

  * igt@gem_mmap_gtt@hang:
- shard-snb:  [INCOMPLETE][23] ([fdo#105411]) -> [PASS][24]
   [23]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-snb6/igt@gem_mmap_...@hang.html
   [24]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13310/shard-snb1/igt@gem_mmap_...@hang.html

  * igt@gem_persistent_relocs@forked-faulting-reloc-thrashing:
- shard-snb:  [DMESG-WARN][25] ([f

Re: [Intel-gfx] [PATCH 26/59] drm/rcar-du: Drop drm_gem_prime_export/import

2019-06-18 Thread Laurent Pinchart
Hi Daniel,

Thank you for the patch.

On Fri, Jun 14, 2019 at 10:35:42PM +0200, Daniel Vetter wrote:
> They're the default.
> 
> Aside: Would be really nice to switch the others over to
> drm_gem_object_funcs.
> 
> Signed-off-by: Daniel Vetter 
> Cc: Laurent Pinchart 
> Cc: Kieran Bingham 
> Cc: linux-renesas-...@vger.kernel.org

Reviewed-by: Laurent Pinchart 

Feel free to merged this as part of the series.

> ---
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> index 83685250319d..9c93eb4fad8b 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -446,8 +446,6 @@ static struct drm_driver rcar_du_driver = {
>   .gem_vm_ops = &drm_gem_cma_vm_ops,
>   .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>   .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
> - .gem_prime_import   = drm_gem_prime_import,
> - .gem_prime_export   = drm_gem_prime_export,
>   .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
>   .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
>   .gem_prime_vmap = drm_gem_cma_prime_vmap,

-- 
Regards,

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

Re: [Intel-gfx] [PATCH 28/59] drm/shmob: Drop drm_gem_prime_export/import

2019-06-18 Thread Laurent Pinchart
Hi Daniel,

Thank you for the patch.

On Fri, Jun 14, 2019 at 10:35:44PM +0200, Daniel Vetter wrote:
> They're the default.
> 
> Aside: Would be really nice to switch the others over to
> drm_gem_object_funcs.
> 
> Signed-off-by: Daniel Vetter 
> Cc: Laurent Pinchart 
> Cc: Kieran Bingham 
> Cc: linux-renesas-...@vger.kernel.org

Reviewed-by: Laurent Pinchart 

Feel free to merged this as part of the series.

> ---
>  drivers/gpu/drm/shmobile/shmob_drm_drv.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c 
> b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> index 9047a49ff35e..6c106b7a3bfe 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> @@ -133,8 +133,6 @@ static struct drm_driver shmob_drm_driver = {
>   .gem_vm_ops = &drm_gem_cma_vm_ops,
>   .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>   .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
> - .gem_prime_import   = drm_gem_prime_import,
> - .gem_prime_export   = drm_gem_prime_export,
>   .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
>   .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
>   .gem_prime_vmap = drm_gem_cma_prime_vmap,

-- 
Regards,

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

[Intel-gfx] [PATCH 05/26] drm/i915/execlists: Preempt-to-busy

2019-06-18 Thread Chris Wilson
When using a global seqno, we required a precise stop-the-workd event to
handle preemption and unwind the global seqno counter. To accomplish
this, we would preempt to a special out-of-band context and wait for the
machine to report that it was idle. Given an idle machine, we could very
precisely see which requests had completed and which we needed to feed
back into the run queue.

However, now that we have scrapped the global seqno, we no longer need
to precisely unwind the global counter and only track requests by their
per-context seqno. This allows us to loosely unwind inflight requests
while scheduling a preemption, with the enormous caveat that the
requests we put back on the run queue are still _inflight_ (until the
preemption request is complete). This makes request tracking much more
messy, as at any point then we can see a completed request that we
believe is not currently scheduled for execution. We also have to be
careful not to rewind RING_TAIL past RING_HEAD on preempting to the
running context, and for this we use a semaphore to prevent completion
of the request before continuing.

To accomplish this feat, we change how we track requests scheduled to
the HW. Instead of appending our requests onto a single list as we
submit, we track each submission to ELSP as its own block. Then upon
receiving the CS preemption event, we promote the pending block to the
inflight block (discarding what was previously being tracked). As normal
CS completion events arrive, we then remove stale entries from the
inflight tracker.

Signed-off-by: Chris Wilson 
---
 drivers/gpu/drm/i915/gem/i915_gem_context.c   |   2 +-
 drivers/gpu/drm/i915/gt/intel_context_types.h |   5 +
 drivers/gpu/drm/i915/gt/intel_engine.h|  61 +-
 drivers/gpu/drm/i915/gt/intel_engine_cs.c |  61 +-
 drivers/gpu/drm/i915/gt/intel_engine_types.h  |  52 +-
 drivers/gpu/drm/i915/gt/intel_lrc.c   | 671 --
 drivers/gpu/drm/i915/i915_gpu_error.c |  19 +-
 drivers/gpu/drm/i915/i915_request.c   |   6 +
 drivers/gpu/drm/i915/i915_request.h   |   1 +
 drivers/gpu/drm/i915/i915_scheduler.c |   3 +-
 drivers/gpu/drm/i915/i915_utils.h |  12 +
 drivers/gpu/drm/i915/intel_guc_submission.c   | 175 ++---
 drivers/gpu/drm/i915/selftests/i915_request.c |   8 +-
 13 files changed, 465 insertions(+), 611 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c 
b/drivers/gpu/drm/i915/gem/i915_gem_context.c
index 0f2c22a3bcb6..35871c8a42a6 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
@@ -646,7 +646,7 @@ static void init_contexts(struct drm_i915_private *i915)
 
 static bool needs_preempt_context(struct drm_i915_private *i915)
 {
-   return HAS_EXECLISTS(i915);
+   return USES_GUC_SUBMISSION(i915);
 }
 
 int i915_gem_contexts_init(struct drm_i915_private *dev_priv)
diff --git a/drivers/gpu/drm/i915/gt/intel_context_types.h 
b/drivers/gpu/drm/i915/gt/intel_context_types.h
index e95be4be9612..b565c3ff4378 100644
--- a/drivers/gpu/drm/i915/gt/intel_context_types.h
+++ b/drivers/gpu/drm/i915/gt/intel_context_types.h
@@ -13,6 +13,7 @@
 #include 
 
 #include "i915_active_types.h"
+#include "i915_utils.h"
 #include "intel_engine_types.h"
 #include "intel_sseu.h"
 
@@ -38,6 +39,10 @@ struct intel_context {
struct i915_gem_context *gem_context;
struct intel_engine_cs *engine;
struct intel_engine_cs *inflight;
+#define intel_context_inflight(ce) ptr_mask_bits((ce)->inflight, 2)
+#define intel_context_inflight_count(ce)  ptr_unmask_bits((ce)->inflight, 2)
+#define intel_context_inflight_inc(ce) ptr_count_inc(&(ce)->inflight)
+#define intel_context_inflight_dec(ce) ptr_count_dec(&(ce)->inflight)
 
struct list_head signal_link;
struct list_head signals;
diff --git a/drivers/gpu/drm/i915/gt/intel_engine.h 
b/drivers/gpu/drm/i915/gt/intel_engine.h
index 2f1c6871ee95..9bb6ff76680e 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine.h
+++ b/drivers/gpu/drm/i915/gt/intel_engine.h
@@ -125,71 +125,26 @@ hangcheck_action_to_str(const enum 
intel_engine_hangcheck_action a)
 
 void intel_engines_set_scheduler_caps(struct drm_i915_private *i915);
 
-static inline void
-execlists_set_active(struct intel_engine_execlists *execlists,
-unsigned int bit)
-{
-   __set_bit(bit, (unsigned long *)&execlists->active);
-}
-
-static inline bool
-execlists_set_active_once(struct intel_engine_execlists *execlists,
- unsigned int bit)
-{
-   return !__test_and_set_bit(bit, (unsigned long *)&execlists->active);
-}
-
-static inline void
-execlists_clear_active(struct intel_engine_execlists *execlists,
-  unsigned int bit)
-{
-   __clear_bit(bit, (unsigned long *)&execlists->active);
-}
-
-static inline void
-execlists_clear_all_active(struct intel_engine_execlists *execlists)
+static inline unsigned int
+execlists_num_ports(const st

[Intel-gfx] [PATCH 11/26] dma-fence: Refactor signaling for manual invocation

2019-06-18 Thread Chris Wilson
Move the duplicated code within dma-fence.c into the header for wider
reuse. In the process apply a small micro-optimisation to only prune the
fence->cb_list once rather than use list_del on every entry.

Signed-off-by: Chris Wilson 
Cc: Tvrtko Ursulin 
---
 drivers/dma-buf/Makefile|  10 +-
 drivers/dma-buf/dma-fence-trace.c   |  28 +++
 drivers/dma-buf/dma-fence.c |  33 +--
 drivers/gpu/drm/i915/gt/intel_breadcrumbs.c |  32 +--
 include/linux/dma-fence-impl.h  |  84 +++
 include/linux/dma-fence-types.h | 252 
 include/linux/dma-fence.h   | 222 +
 7 files changed, 381 insertions(+), 280 deletions(-)
 create mode 100644 drivers/dma-buf/dma-fence-trace.c
 create mode 100644 include/linux/dma-fence-impl.h
 create mode 100644 include/linux/dma-fence-types.h

diff --git a/drivers/dma-buf/Makefile b/drivers/dma-buf/Makefile
index e8c7310cb800..65c43778e571 100644
--- a/drivers/dma-buf/Makefile
+++ b/drivers/dma-buf/Makefile
@@ -1,6 +1,12 @@
 # SPDX-License-Identifier: GPL-2.0-only
-obj-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \
-reservation.o seqno-fence.o
+obj-y := \
+   dma-buf.o \
+   dma-fence.o \
+   dma-fence-array.o \
+   dma-fence-chain.o \
+   dma-fence-trace.o \
+   reservation.o \
+   seqno-fence.o
 obj-$(CONFIG_SYNC_FILE)+= sync_file.o
 obj-$(CONFIG_SW_SYNC)  += sw_sync.o sync_debug.o
 obj-$(CONFIG_UDMABUF)  += udmabuf.o
diff --git a/drivers/dma-buf/dma-fence-trace.c 
b/drivers/dma-buf/dma-fence-trace.c
new file mode 100644
index ..eb6f282be4c0
--- /dev/null
+++ b/drivers/dma-buf/dma-fence-trace.c
@@ -0,0 +1,28 @@
+/*
+ * Fence mechanism for dma-buf and to allow for asynchronous dma access
+ *
+ * Copyright (C) 2012 Canonical Ltd
+ * Copyright (C) 2012 Texas Instruments
+ *
+ * Authors:
+ * Rob Clark 
+ * Maarten Lankhorst 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#include 
+
+#define CREATE_TRACE_POINTS
+#include 
+
+EXPORT_TRACEPOINT_SYMBOL(dma_fence_emit);
+EXPORT_TRACEPOINT_SYMBOL(dma_fence_enable_signal);
+EXPORT_TRACEPOINT_SYMBOL(dma_fence_signaled);
diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index 59ac96ec7ba8..027a6a894abd 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -14,15 +14,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
-#define CREATE_TRACE_POINTS
-#include 
-
-EXPORT_TRACEPOINT_SYMBOL(dma_fence_emit);
-EXPORT_TRACEPOINT_SYMBOL(dma_fence_enable_signal);
-EXPORT_TRACEPOINT_SYMBOL(dma_fence_signaled);
-
 static DEFINE_SPINLOCK(dma_fence_stub_lock);
 static struct dma_fence dma_fence_stub;
 
@@ -128,7 +122,6 @@ EXPORT_SYMBOL(dma_fence_context_alloc);
  */
 int dma_fence_signal_locked(struct dma_fence *fence)
 {
-   struct dma_fence_cb *cur, *tmp;
int ret = 0;
 
lockdep_assert_held(fence->lock);
@@ -136,7 +129,7 @@ int dma_fence_signal_locked(struct dma_fence *fence)
if (WARN_ON(!fence))
return -EINVAL;
 
-   if (test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) {
+   if (!__dma_fence_signal(fence)) {
ret = -EINVAL;
 
/*
@@ -144,15 +137,10 @@ int dma_fence_signal_locked(struct dma_fence *fence)
 * still run through all callbacks
 */
} else {
-   fence->timestamp = ktime_get();
-   set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
-   trace_dma_fence_signaled(fence);
+   __dma_fence_signal__timestamp(fence, ktime_get());
}
 
-   list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
-   list_del_init(&cur->node);
-   cur->func(fence, cur);
-   }
+   __dma_fence_signal__notify(fence);
return ret;
 }
 EXPORT_SYMBOL(dma_fence_signal_locked);
@@ -177,21 +165,14 @@ int dma_fence_signal(struct dma_fence *fence)
if (!fence)
return -EINVAL;
 
-   if (test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
+   if (!__dma_fence_signal(fence))
return -EINVAL;
 
-   fence->timestamp = ktime_get();
-   set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
-   trace_dma_fence_signaled(fence);
+   __dma_fence_signal__timestamp(fence, ktime_get());
 
if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags)) {
-   struct dma_fence_cb *cur, *tmp;
-
spin_lock

[Intel-gfx] [PATCH 06/26] drm/i915/execlists: Minimalistic timeslicing

2019-06-18 Thread Chris Wilson
If we have multiple contexts of equal priority pending execution,
activate a timer to demote the currently executing context in favour of
the next in the queue when that timeslice expires. This enforces
fairness between contexts (so long as they allow preemption -- forced
preemption, in the future, will kick those who do not obey) and allows
us to avoid userspace blocking forward progress with e.g. unbounded
MI_SEMAPHORE_WAIT.

For the starting point here, we use the jiffie as our timeslice so that
we should be reasonably efficient wrt frequent CPU wakeups.

Testcase: igt/gem_exec_scheduler/semaphore-resolve
Signed-off-by: Chris Wilson 
---
 drivers/gpu/drm/i915/gt/intel_engine_types.h |   6 +
 drivers/gpu/drm/i915/gt/intel_lrc.c  | 111 +
 drivers/gpu/drm/i915/gt/selftest_lrc.c   | 223 +++
 drivers/gpu/drm/i915/i915_scheduler.c|   1 +
 drivers/gpu/drm/i915/i915_scheduler_types.h  |   1 +
 5 files changed, 342 insertions(+)

diff --git a/drivers/gpu/drm/i915/gt/intel_engine_types.h 
b/drivers/gpu/drm/i915/gt/intel_engine_types.h
index dd0082df42cc..11a25f060fed 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_types.h
+++ b/drivers/gpu/drm/i915/gt/intel_engine_types.h
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "i915_gem.h"
@@ -137,6 +138,11 @@ struct intel_engine_execlists {
 */
struct tasklet_struct tasklet;
 
+   /**
+* @timer: kick the current context if its timeslice expires
+*/
+   struct timer_list timer;
+
/**
 * @default_priolist: priority list for I915_PRIORITY_NORMAL
 */
diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c 
b/drivers/gpu/drm/i915/gt/intel_lrc.c
index 65c91b7db59d..cea08d665ef5 100644
--- a/drivers/gpu/drm/i915/gt/intel_lrc.c
+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
@@ -255,6 +255,7 @@ static int effective_prio(const struct i915_request *rq)
prio |= I915_PRIORITY_NOSEMAPHORE;
 
/* Restrict mere WAIT boosts from triggering preemption */
+   BUILD_BUG_ON(__NO_PREEMPTION & ~I915_PRIORITY_MASK); /* only internal */
return prio | __NO_PREEMPTION;
 }
 
@@ -811,6 +812,81 @@ last_active(const struct intel_engine_execlists *execlists)
return *last;
 }
 
+static void
+defer_request(struct i915_request * const rq, struct list_head * const pl)
+{
+   struct i915_dependency *p;
+
+   /*
+* We want to move the interrupted request to the back of
+* the round-robin list (i.e. its priority level), but
+* in doing so, we must then move all requests that were in
+* flight and were waiting for the interrupted request to
+* be run after it again.
+*/
+   list_move_tail(&rq->sched.link, pl);
+
+   list_for_each_entry(p, &rq->sched.waiters_list, wait_link) {
+   struct i915_request *w =
+   container_of(p->waiter, typeof(*w), sched);
+
+   /* Leave semaphores spinning on the other engines */
+   if (w->engine != rq->engine)
+   continue;
+
+   /* No waiter should start before the active request completed */
+   GEM_BUG_ON(i915_request_started(w));
+
+   GEM_BUG_ON(rq_prio(w) > rq_prio(rq));
+   if (rq_prio(w) < rq_prio(rq))
+   continue;
+
+   if (list_empty(&w->sched.link))
+   continue; /* Not yet submitted; unready */
+
+   /*
+* This should be very shallow as it is limited by the
+* number of requests that can fit in a ring (<64) and
+* the number of contexts that can be in flight on this
+* engine.
+*/
+   defer_request(w, pl);
+   }
+}
+
+static void defer_active(struct intel_engine_cs *engine)
+{
+   struct i915_request *rq;
+
+   rq = __unwind_incomplete_requests(engine);
+   if (!rq)
+   return;
+
+   defer_request(rq, i915_sched_lookup_priolist(engine, rq_prio(rq)));
+}
+
+static bool
+need_timeslice(struct intel_engine_cs *engine, const struct i915_request *rq)
+{
+   int hint;
+
+   if (list_is_last(&rq->sched.link, &engine->active.requests))
+   return false;
+
+   hint = max(rq_prio(list_next_entry(rq, sched.link)),
+  engine->execlists.queue_priority_hint);
+
+   return hint >= rq_prio(rq);
+}
+
+static bool
+enable_timeslice(struct intel_engine_cs *engine)
+{
+   struct i915_request *last = last_active(&engine->execlists);
+
+   return last && need_timeslice(engine, last);
+}
+
 static void execlists_dequeue(struct intel_engine_cs *engine)
 {
struct intel_engine_execlists * const execlists = &engine->execlists;
@@ -904,6 +980,27 @@ static void execlists_dequeue(struct intel_engine_cs 
*engine)
 */
last->hw_context->lrc_desc |=

[Intel-gfx] [PATCH 01/26] drm/i915: Keep engine alive as we retire the context

2019-06-18 Thread Chris Wilson
Though we pin the context first before taking the pm wakeref, during
retire we need to unpin before dropping the pm wakeref (breaking the
"natural" onion). During the unpin, we may need to attach a cleanup
operation on to the engine wakeref, ergo we want to keep the engine
awake until after the unpin.

v2: Push the engine wakeref into the barrier so we keep the onion unwind
ordering in the request itself

Fixes: ce476c80b8bf ("drm/i915: Keep contexts pinned until after the next 
kernel context switch")
Signed-off-by: Chris Wilson 
Cc: Mika Kuoppala 
---
 drivers/gpu/drm/i915/i915_active.c | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_active.c 
b/drivers/gpu/drm/i915/i915_active.c
index 2d019ac6db20..41ed2798687d 100644
--- a/drivers/gpu/drm/i915/i915_active.c
+++ b/drivers/gpu/drm/i915/i915_active.c
@@ -4,6 +4,8 @@
  * Copyright © 2019 Intel Corporation
  */
 
+#include "gt/intel_engine_pm.h"
+
 #include "i915_drv.h"
 #include "i915_active.h"
 #include "i915_globals.h"
@@ -268,8 +270,9 @@ int i915_active_acquire_preallocate_barrier(struct 
i915_active *ref,
struct intel_engine_cs *engine)
 {
struct drm_i915_private *i915 = engine->i915;
+   struct llist_node *pos, *next;
unsigned long tmp;
-   int err = 0;
+   int err;
 
GEM_BUG_ON(!engine->mask);
for_each_engine_masked(engine, i915, engine->mask, tmp) {
@@ -279,7 +282,7 @@ int i915_active_acquire_preallocate_barrier(struct 
i915_active *ref,
node = kmem_cache_alloc(global.slab_cache, GFP_KERNEL);
if (unlikely(!node)) {
err = -ENOMEM;
-   break;
+   goto unwind;
}
 
i915_active_request_init(&node->base,
@@ -288,10 +291,24 @@ int i915_active_acquire_preallocate_barrier(struct 
i915_active *ref,
node->ref = ref;
ref->count++;
 
+   intel_engine_pm_get(engine);
llist_add((struct llist_node *)&node->base.link,
  &ref->barriers);
}
 
+   return 0;
+
+unwind:
+   llist_for_each_safe(pos, next, llist_del_all(&ref->barriers)) {
+   struct active_node *node;
+
+   node = container_of((struct list_head *)pos,
+   typeof(*node), base.link);
+   engine = (void *)rcu_access_pointer(node->base.request);
+
+   intel_engine_pm_put(engine);
+   kfree(node);
+   }
return err;
 }
 
@@ -328,6 +345,7 @@ void i915_active_acquire_barrier(struct i915_active *ref)
 
llist_add((struct llist_node *)&node->base.link,
  &engine->barrier_tasks);
+   intel_engine_pm_put(engine);
}
i915_active_release(ref);
 }
-- 
2.20.1

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

[Intel-gfx] [PATCH 03/26] drm/i915: Stop passing I915_WAIT_LOCKED to i915_request_wait()

2019-06-18 Thread Chris Wilson
Since commit eb8d0f5af4ec ("drm/i915: Remove GPU reset dependence on
struct_mutex"), the I915_WAIT_LOCKED flags passed to i915_request_wait()
has been defunct. Now go ahead and remove it from all callers.

References: eb8d0f5af4ec ("drm/i915: Remove GPU reset dependence on 
struct_mutex")
Signed-off-by: Chris Wilson 
---
 .../drm/i915/gem/selftests/i915_gem_context.c | 14 +++--
 drivers/gpu/drm/i915/gt/intel_ringbuffer.c|  2 +-
 drivers/gpu/drm/i915/gt/intel_workarounds.c   |  2 +-
 drivers/gpu/drm/i915/gt/selftest_hangcheck.c  |  9 ++
 drivers/gpu/drm/i915/gt/selftest_lrc.c| 24 ++-
 .../gpu/drm/i915/gt/selftest_workarounds.c|  6 ++--
 drivers/gpu/drm/i915/i915_active.h|  2 +-
 drivers/gpu/drm/i915/i915_request.c   |  4 ---
 drivers/gpu/drm/i915/i915_trace.h |  3 +-
 drivers/gpu/drm/i915/selftests/i915_request.c | 30 +++
 .../gpu/drm/i915/selftests/i915_timeline.c|  6 ++--
 11 files changed, 36 insertions(+), 66 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c 
b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
index 03ac5003abf1..eaa2b16574c7 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
@@ -83,9 +83,7 @@ static int live_nop_switch(void *arg)
}
i915_request_add(rq);
}
-   if (i915_request_wait(rq,
- I915_WAIT_LOCKED,
- HZ / 5) < 0) {
+   if (i915_request_wait(rq, 0, HZ / 5) < 0) {
pr_err("Failed to populated %d contexts\n", nctx);
i915_gem_set_wedged(i915);
err = -EIO;
@@ -128,9 +126,7 @@ static int live_nop_switch(void *arg)
 
i915_request_add(rq);
}
-   if (i915_request_wait(rq,
- I915_WAIT_LOCKED,
- HZ / 5) < 0) {
+   if (i915_request_wait(rq, 0, HZ / 5) < 0) {
pr_err("Switching between %ld contexts timed 
out\n",
   prime);
i915_gem_set_wedged(i915);
@@ -893,7 +889,7 @@ __read_slice_count(struct drm_i915_private *i915,
if (spin)
igt_spinner_end(spin);
 
-   ret = i915_request_wait(rq, I915_WAIT_LOCKED, MAX_SCHEDULE_TIMEOUT);
+   ret = i915_request_wait(rq, 0, MAX_SCHEDULE_TIMEOUT);
i915_request_put(rq);
if (ret < 0)
return ret;
@@ -980,9 +976,7 @@ __sseu_finish(struct drm_i915_private *i915,
igt_spinner_end(spin);
 
if ((flags & TEST_IDLE) && ret == 0) {
-   ret = i915_gem_wait_for_idle(i915,
-I915_WAIT_LOCKED,
-MAX_SCHEDULE_TIMEOUT);
+   ret = i915_gem_wait_for_idle(i915, 0, MAX_SCHEDULE_TIMEOUT);
if (ret)
return ret;
 
diff --git a/drivers/gpu/drm/i915/gt/intel_ringbuffer.c 
b/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
index bd35ad202459..c6023bc9452d 100644
--- a/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
@@ -1815,7 +1815,7 @@ static noinline int wait_for_space(struct intel_ring 
*ring, unsigned int bytes)
return -ENOSPC;
 
timeout = i915_request_wait(target,
-   I915_WAIT_INTERRUPTIBLE | I915_WAIT_LOCKED,
+   I915_WAIT_INTERRUPTIBLE,
MAX_SCHEDULE_TIMEOUT);
if (timeout < 0)
return timeout;
diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c 
b/drivers/gpu/drm/i915/gt/intel_workarounds.c
index 165b0a45e009..9624d9e776e3 100644
--- a/drivers/gpu/drm/i915/gt/intel_workarounds.c
+++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c
@@ -1384,7 +1384,7 @@ static int engine_wa_list_verify(struct intel_context *ce,
goto err_vma;
 
i915_request_add(rq);
-   if (i915_request_wait(rq, I915_WAIT_LOCKED, HZ / 5) < 0) {
+   if (i915_request_wait(rq, 0, HZ / 5) < 0) {
err = -ETIME;
goto err_vma;
}
diff --git a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c 
b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c
index b0b2998e56b8..1ee4c923044f 100644
--- a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c
+++ b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c
@@ -339,8 +339,7 @@ static int igt_hang_sanitycheck(void *arg)
 
timeout = 0;
igt_wedge_on_timeout(&w, i915, HZ / 10 /* 100ms timeout*/)
-   timeout = i915_request_wait(rq,
-   

[Intel-gfx] [PATCH 07/26] drm/i915/execlists: Force preemption

2019-06-18 Thread Chris Wilson
If the preempted context takes too long to relinquish control, e.g. it
is stuck inside a shader with arbitration disabled, evict that context
with an engine reset. This ensures that preemptions are reasonably
responsive, providing a tighter QoS for the more important context at
the cost of flagging unresponsive contexts more frequently (i.e. instead
of using an ~10s hangcheck, we now evict at ~10ms).  The challenge of
lies in picking a timeout that can be reasonably serviced by HW for
typical workloads, balancing the existing clients against the needs for
responsiveness.

Signed-off-by: Chris Wilson 
Cc: Mika Kuoppala 
Cc: Tvrtko Ursulin 
---
 drivers/gpu/drm/i915/Kconfig.profile | 12 ++
 drivers/gpu/drm/i915/gt/intel_lrc.c  | 56 ++--
 2 files changed, 65 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/Kconfig.profile 
b/drivers/gpu/drm/i915/Kconfig.profile
index 48df8889a88a..8273d3baafe4 100644
--- a/drivers/gpu/drm/i915/Kconfig.profile
+++ b/drivers/gpu/drm/i915/Kconfig.profile
@@ -25,3 +25,15 @@ config DRM_I915_SPIN_REQUEST
  May be 0 to disable the initial spin. In practice, we estimate
  the cost of enabling the interrupt (if currently disabled) to be
  a few microseconds.
+
+config DRM_I915_PREEMPT_TIMEOUT
+   int "Preempt timeout (ms)"
+   default 10 # milliseconds
+   help
+ How long to wait (in milliseconds) for a preemption event to occur
+ when submitting a new context via execlists. If the current context
+ does not hit an arbitration point and yield to HW before the timer
+ expires, the HW will be reset to allow the more important context
+ to execute.
+
+ May be 0 to disable the timeout.
diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c 
b/drivers/gpu/drm/i915/gt/intel_lrc.c
index cea08d665ef5..0563fe8398c5 100644
--- a/drivers/gpu/drm/i915/gt/intel_lrc.c
+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
@@ -887,6 +887,15 @@ enable_timeslice(struct intel_engine_cs *engine)
return last && need_timeslice(engine, last);
 }
 
+static unsigned long preempt_expires(void)
+{
+   unsigned long timeout =
+   msecs_to_jiffies_timeout(CONFIG_DRM_I915_PREEMPT_TIMEOUT);
+
+   barrier();
+   return jiffies + timeout;
+}
+
 static void execlists_dequeue(struct intel_engine_cs *engine)
 {
struct intel_engine_execlists * const execlists = &engine->execlists;
@@ -1218,6 +1227,9 @@ static void execlists_dequeue(struct intel_engine_cs 
*engine)
*port = execlists_schedule_in(last, port - execlists->pending);
memset(port + 1, 0, (last_port - port) * sizeof(*port));
execlists_submit_ports(engine);
+
+   if (CONFIG_DRM_I915_PREEMPT_TIMEOUT)
+   mod_timer(&execlists->timer, preempt_expires());
}
 }
 
@@ -1373,13 +1385,48 @@ static void process_csb(struct intel_engine_cs *engine)
invalidate_csb_entries(&buf[0], &buf[num_entries - 1]);
 }
 
-static void __execlists_submission_tasklet(struct intel_engine_cs *const 
engine)
+static bool __execlists_submission_tasklet(struct intel_engine_cs *const 
engine)
 {
lockdep_assert_held(&engine->active.lock);
 
process_csb(engine);
-   if (!engine->execlists.pending[0])
+   if (!engine->execlists.pending[0]) {
execlists_dequeue(engine);
+   return true;
+   }
+
+   return false;
+}
+
+static void preempt_reset(struct intel_engine_cs *engine)
+{
+   const unsigned int bit = I915_RESET_ENGINE + engine->id;
+   unsigned long *lock = &engine->i915->gpu_error.flags;
+
+   if (test_and_set_bit(bit, lock))
+   return;
+
+   tasklet_disable_nosync(&engine->execlists.tasklet);
+   spin_unlock(&engine->active.lock);
+
+   i915_reset_engine(engine, "preemption time out");
+
+   spin_lock(&engine->active.lock);
+   tasklet_enable(&engine->execlists.tasklet);
+
+   clear_bit(bit, lock);
+   wake_up_bit(lock, bit);
+}
+
+static bool preempt_timeout(struct intel_engine_cs *const engine)
+{
+   if (!CONFIG_DRM_I915_PREEMPT_TIMEOUT)
+   return false;
+
+   if (!intel_engine_has_preemption(engine))
+   return false;
+
+   return !timer_pending(&engine->execlists.timer);
 }
 
 /*
@@ -1392,7 +1439,10 @@ static void execlists_submission_tasklet(unsigned long 
data)
unsigned long flags;
 
spin_lock_irqsave(&engine->active.lock, flags);
-   __execlists_submission_tasklet(engine);
+
+   if (!__execlists_submission_tasklet(engine) && preempt_timeout(engine))
+   preempt_reset(engine);
+
spin_unlock_irqrestore(&engine->active.lock, flags);
 }
 
-- 
2.20.1

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

[Intel-gfx] [PATCH 08/26] drm/i915: Make the semaphore saturation mask global

2019-06-18 Thread Chris Wilson
The idea behind keeping the saturation mask local to a context backfired
spectacularly. The premise with the local mask was that we would be more
proactive in attempting to use semaphores after each time the context
idled, and that all new contexts would attempt to use semaphores
ignoring the current state of the system. This turns out to be horribly
optimistic. If the system state is still oversaturated and the existing
workloads have all stopped using semaphores, the new workloads would
attempt to use semaphores and be deprioritised behind real work. The
new contexts would not switch off using semaphores until their initial
batch of low priority work had completed. Given sufficient backload load
of equal user priority, this would completely starve the new work of any
GPU time.

To compensate, remove the local tracking in favour of keeping it as
global state on the engine -- once the system is saturated and
semaphores are disabled, everyone stops attempting to use semaphores
until the system is idle again. One of the reason for preferring local
context tracking was that it worked with virtual engines, so for
switching to global state we could either do a complete check of all the
virtual siblings or simply disable semaphores for those requests. This
takes the simpler approach of disabling semaphores on virtual engines.

The downside is that the decision that the engine is saturated is a
local measure -- we are only checking whether or not this context was
scheduled in a timely fashion, it may be legitimately delayed due to user
priorities. We still have the same dilemma though, that we do not want
to employ the semaphore poll unless it will be used.

Fixes: ca6e56f654e7 ("drm/i915: Disable semaphore busywaits on saturated 
systems")
Signed-off-by: Chris Wilson 
Cc: Tvrtko Ursulin 
Cc: Dmitry Rogozhkin 
Cc: Dmitry Ermilov 
---
 drivers/gpu/drm/i915/gt/intel_context.c   | 2 --
 drivers/gpu/drm/i915/gt/intel_context_types.h | 2 --
 drivers/gpu/drm/i915/gt/intel_engine_pm.c | 2 ++
 drivers/gpu/drm/i915/gt/intel_engine_types.h  | 2 ++
 drivers/gpu/drm/i915/gt/intel_lrc.c   | 2 +-
 drivers/gpu/drm/i915/i915_request.c   | 4 ++--
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_context.c 
b/drivers/gpu/drm/i915/gt/intel_context.c
index 42f45744d859..2c454f227c2e 100644
--- a/drivers/gpu/drm/i915/gt/intel_context.c
+++ b/drivers/gpu/drm/i915/gt/intel_context.c
@@ -142,7 +142,6 @@ intel_context_init(struct intel_context *ce,
ce->engine = engine;
ce->ops = engine->cops;
ce->sseu = engine->sseu;
-   ce->saturated = 0;
 
INIT_LIST_HEAD(&ce->signal_link);
INIT_LIST_HEAD(&ce->signals);
@@ -223,7 +222,6 @@ void intel_context_enter_engine(struct intel_context *ce)
 
 void intel_context_exit_engine(struct intel_context *ce)
 {
-   ce->saturated = 0;
intel_engine_pm_put(ce->engine);
 }
 
diff --git a/drivers/gpu/drm/i915/gt/intel_context_types.h 
b/drivers/gpu/drm/i915/gt/intel_context_types.h
index b565c3ff4378..4c0e211c715d 100644
--- a/drivers/gpu/drm/i915/gt/intel_context_types.h
+++ b/drivers/gpu/drm/i915/gt/intel_context_types.h
@@ -58,8 +58,6 @@ struct intel_context {
atomic_t pin_count;
struct mutex pin_mutex; /* guards pinning and associated on-gpuing */
 
-   intel_engine_mask_t saturated; /* submitting semaphores too late? */
-
/**
 * active: Active tracker for the rq activity (inc. external) on this
 * intel_context object.
diff --git a/drivers/gpu/drm/i915/gt/intel_engine_pm.c 
b/drivers/gpu/drm/i915/gt/intel_engine_pm.c
index d14e352b0b17..2ce00d3dc42a 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_pm.c
+++ b/drivers/gpu/drm/i915/gt/intel_engine_pm.c
@@ -100,6 +100,8 @@ static int __engine_park(struct intel_wakeref *wf)
struct intel_engine_cs *engine =
container_of(wf, typeof(*engine), wakeref);
 
+   engine->saturated = 0;
+
/*
 * If one and only one request is completed between pm events,
 * we know that we are inside the kernel context and it is
diff --git a/drivers/gpu/drm/i915/gt/intel_engine_types.h 
b/drivers/gpu/drm/i915/gt/intel_engine_types.h
index 11a25f060fed..1cbe10a0fec7 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_types.h
+++ b/drivers/gpu/drm/i915/gt/intel_engine_types.h
@@ -258,6 +258,8 @@ struct intel_engine_cs {
struct intel_context *kernel_context; /* pinned */
struct intel_context *preempt_context; /* pinned; optional */
 
+   intel_engine_mask_t saturated; /* submitting semaphores too late? */
+
unsigned long serial;
 
unsigned long wakeref_serial;
diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c 
b/drivers/gpu/drm/i915/gt/intel_lrc.c
index 0563fe8398c5..bbbdc63906c6 100644
--- a/drivers/gpu/drm/i915/gt/intel_lrc.c
+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
@@ -3198,7 +3198,6 @@ static void virtual_context_exit(struct intel_conte

[Intel-gfx] [PATCH 02/26] drm/i915: Skip shrinking already freed pages

2019-06-18 Thread Chris Wilson
Previously, we want to shrink the pages of freed objects before they
were RCU collected. However, by removing the struct_mutex serialisation
around the active reference, we need to acquire an extra reference
around the wait. Unfortunately this means that we have to skip objects
that are waiting RCU collection.

Signed-off-by: Chris Wilson 
---
 drivers/gpu/drm/i915/gem/i915_gem_object.c   | 47 +---
 drivers/gpu/drm/i915/gem/i915_gem_shrinker.c |  5 +++
 2 files changed, 6 insertions(+), 46 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c 
b/drivers/gpu/drm/i915/gem/i915_gem_object.c
index 272ce30ce1d3..1b571fd26ed4 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
@@ -149,33 +149,6 @@ void i915_gem_close_object(struct drm_gem_object *gem, 
struct drm_file *file)
}
 }
 
-static bool discard_backing_storage(struct drm_i915_gem_object *obj)
-{
-   /*
-* If we are the last user of the backing storage (be it shmemfs
-* pages or stolen etc), we know that the pages are going to be
-* immediately released. In this case, we can then skip copying
-* back the contents from the GPU.
-*/
-   if (!i915_gem_object_is_shrinkable(obj))
-   return false;
-
-   if (obj->mm.madv != I915_MADV_WILLNEED)
-   return false;
-
-   if (!obj->base.filp)
-   return true;
-
-   /* At first glance, this looks racy, but then again so would be
-* userspace racing mmap against close. However, the first external
-* reference to the filp can only be obtained through the
-* i915_gem_mmap_ioctl() which safeguards us against the user
-* acquiring such a reference whilst we are in the middle of
-* freeing the object.
-*/
-   return file_count(obj->base.filp) == 1;
-}
-
 static void __i915_gem_free_objects(struct drm_i915_private *i915,
struct llist_node *freed)
 {
@@ -225,8 +198,7 @@ static void __i915_gem_free_objects(struct drm_i915_private 
*i915,
if (obj->ops->release)
obj->ops->release(obj);
 
-   if (WARN_ON(i915_gem_object_has_pinned_pages(obj)))
-   atomic_set(&obj->mm.pages_pin_count, 0);
+   atomic_set(&obj->mm.pages_pin_count, 0);
__i915_gem_object_put_pages(obj, I915_MM_NORMAL);
GEM_BUG_ON(i915_gem_object_has_pages(obj));
 
@@ -324,23 +296,6 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj)
 {
struct drm_i915_gem_object *obj = to_intel_bo(gem_obj);
 
-   if (obj->mm.quirked)
-   __i915_gem_object_unpin_pages(obj);
-
-   if (discard_backing_storage(obj)) {
-   struct drm_i915_private *i915 = to_i915(obj->base.dev);
-
-   obj->mm.madv = I915_MADV_DONTNEED;
-
-   if (i915_gem_object_has_pages(obj)) {
-   unsigned long flags;
-
-   spin_lock_irqsave(&i915->mm.obj_lock, flags);
-   list_move_tail(&obj->mm.link, &i915->mm.purge_list);
-   spin_unlock_irqrestore(&i915->mm.obj_lock, flags);
-   }
-   }
-
/*
 * Before we free the object, make sure any pure RCU-only
 * read-side critical sections are complete, e.g.
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c 
b/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
index c851c4029597..3a926a8755c6 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
@@ -241,6 +241,9 @@ i915_gem_shrink(struct drm_i915_private *i915,
if (!can_release_pages(obj))
continue;
 
+   if (!kref_get_unless_zero(&obj->base.refcount))
+   continue;
+
spin_unlock_irqrestore(&i915->mm.obj_lock, flags);
 
if (unsafe_drop_pages(obj)) {
@@ -253,7 +256,9 @@ i915_gem_shrink(struct drm_i915_private *i915,
}
mutex_unlock(&obj->mm.lock);
}
+
scanned += obj->base.size >> PAGE_SHIFT;
+   i915_gem_object_put(obj);
 
spin_lock_irqsave(&i915->mm.obj_lock, flags);
}
-- 
2.20.1

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

[Intel-gfx] [PATCH 26/26] drm/i915: Move idle barrier cleanup into engine-pm

2019-06-18 Thread Chris Wilson
Now that we now longer need to guarantee that the active callback is
under the struct_mutex, we can lift it out of the i915_gem_park() and
into the engine parking itself.

Signed-off-by: Chris Wilson 
---
 drivers/gpu/drm/i915/gem/i915_gem_pm.c| 19 ---
 drivers/gpu/drm/i915/gt/intel_engine_pm.c | 15 +++
 drivers/gpu/drm/i915/i915_active.c|  1 +
 3 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pm.c 
b/drivers/gpu/drm/i915/gem/i915_gem_pm.c
index 1f53feac2b22..c233a0955630 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_pm.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_pm.c
@@ -10,29 +10,10 @@
 #include "i915_drv.h"
 #include "i915_globals.h"
 
-static void call_idle_barriers(struct intel_engine_cs *engine)
-{
-   struct llist_node *node, *next;
-
-   llist_for_each_safe(node, next, llist_del_all(&engine->barrier_tasks)) {
-   struct dma_fence_cb *cb =
-   container_of((struct list_head *)node,
-typeof(*cb), node);
-
-   cb->func(NULL, cb);
-   }
-}
-
 static void i915_gem_park(struct drm_i915_private *i915)
 {
-   struct intel_engine_cs *engine;
-   enum intel_engine_id id;
-
lockdep_assert_held(&i915->drm.struct_mutex);
 
-   for_each_engine(engine, i915, id)
-   call_idle_barriers(engine); /* cleanup after wedging */
-
i915_timelines_park(i915);
i915_vma_parked(i915);
 
diff --git a/drivers/gpu/drm/i915/gt/intel_engine_pm.c 
b/drivers/gpu/drm/i915/gt/intel_engine_pm.c
index d5d3aac5c268..5488c3e557de 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_pm.c
+++ b/drivers/gpu/drm/i915/gt/intel_engine_pm.c
@@ -96,6 +96,19 @@ static bool switch_to_kernel_context(struct intel_engine_cs 
*engine)
return false;
 }
 
+static void call_idle_barriers(struct intel_engine_cs *engine)
+{
+   struct llist_node *node, *next;
+
+   llist_for_each_safe(node, next, llist_del_all(&engine->barrier_tasks)) {
+   struct dma_fence_cb *cb =
+   container_of((struct list_head *)node,
+typeof(*cb), node);
+
+   cb->func(NULL, cb);
+   }
+}
+
 static int __engine_park(struct intel_wakeref *wf)
 {
struct intel_engine_cs *engine =
@@ -115,6 +128,8 @@ static int __engine_park(struct intel_wakeref *wf)
 
GEM_TRACE("%s\n", engine->name);
 
+   call_idle_barriers(engine); /* cleanup after wedging */
+
intel_engine_disarm_breadcrumbs(engine);
intel_engine_pool_park(&engine->pool);
 
diff --git a/drivers/gpu/drm/i915/i915_active.c 
b/drivers/gpu/drm/i915/i915_active.c
index cf31ef63713d..505ee42017d0 100644
--- a/drivers/gpu/drm/i915/i915_active.c
+++ b/drivers/gpu/drm/i915/i915_active.c
@@ -429,6 +429,7 @@ void i915_active_acquire_barrier(struct i915_active *ref)
rb_link_node(&node->node, parent, p);
rb_insert_color(&node->node, &ref->tree);
 
+   GEM_BUG_ON(!intel_engine_is_active(engine));
llist_add((struct llist_node *)&node->base.cb.node,
  &engine->barrier_tasks);
intel_engine_pm_put(engine);
-- 
2.20.1

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

[Intel-gfx] [PATCH 24/26] drm/i915: Teach execbuffer to take the engine wakeref not GT

2019-06-18 Thread Chris Wilson
In the next patch, we would like to couple into the engine wakeref to
free the batch pool on idling. The caveat here is that we therefore want
to track the engine wakeref more precisely and to hold it instead of the
broader GT wakeref as we process the ioctl.

Signed-off-by: Chris Wilson 
---
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c| 36 ---
 drivers/gpu/drm/i915/gt/intel_context.h   |  7 
 2 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c 
b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index e847a8079705..8fb8613a1555 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -2142,13 +2142,35 @@ static int eb_pin_context(struct i915_execbuffer *eb, 
struct intel_context *ce)
if (err)
return err;
 
+   /*
+* Take a local wakeref for preparing to dispatch the execbuf as
+* we expect to access the hardware fairly frequently in the
+* process. Upon first dispatch, we acquire another prolonged
+* wakeref that we hold until the GPU has been idle for at least
+* 100ms.
+*/
+   err = intel_context_timeline_lock(ce);
+   if (err)
+   goto err_unpin;
+
+   intel_context_enter(ce);
+   intel_context_timeline_unlock(ce);
+
eb->engine = ce->engine;
eb->context = ce;
return 0;
+
+err_unpin:
+   intel_context_unpin(ce);
+   return err;
 }
 
 static void eb_unpin_context(struct i915_execbuffer *eb)
 {
+   __intel_context_timeline_lock(eb->context);
+   intel_context_exit(eb->context);
+   intel_context_timeline_unlock(eb->context);
+
intel_context_unpin(eb->context);
 }
 
@@ -2429,18 +2451,9 @@ i915_gem_do_execbuffer(struct drm_device *dev,
if (unlikely(err))
goto err_destroy;
 
-   /*
-* Take a local wakeref for preparing to dispatch the execbuf as
-* we expect to access the hardware fairly frequently in the
-* process. Upon first dispatch, we acquire another prolonged
-* wakeref that we hold until the GPU has been idle for at least
-* 100ms.
-*/
-   intel_gt_pm_get(eb.i915);
-
err = i915_mutex_lock_interruptible(dev);
if (err)
-   goto err_rpm;
+   goto err_context;
 
err = eb_select_engine(&eb, file, args);
if (unlikely(err))
@@ -2605,8 +2618,7 @@ i915_gem_do_execbuffer(struct drm_device *dev,
eb_unpin_context(&eb);
 err_unlock:
mutex_unlock(&dev->struct_mutex);
-err_rpm:
-   intel_gt_pm_put(eb.i915);
+err_context:
i915_gem_context_put(eb.gem_context);
 err_destroy:
eb_destroy(&eb);
diff --git a/drivers/gpu/drm/i915/gt/intel_context.h 
b/drivers/gpu/drm/i915/gt/intel_context.h
index 40cd8320fcc3..065ba4ac4e87 100644
--- a/drivers/gpu/drm/i915/gt/intel_context.h
+++ b/drivers/gpu/drm/i915/gt/intel_context.h
@@ -126,6 +126,13 @@ static inline void intel_context_put(struct intel_context 
*ce)
kref_put(&ce->ref, ce->ops->destroy);
 }
 
+static inline void
+__intel_context_timeline_lock(struct intel_context *ce)
+   __acquires(&ce->ring->timeline->mutex)
+{
+   mutex_lock(&ce->ring->timeline->mutex);
+}
+
 static inline int __must_check
 intel_context_timeline_lock(struct intel_context *ce)
__acquires(&ce->ring->timeline->mutex)
-- 
2.20.1

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

[Intel-gfx] [PATCH 25/26] drm/i915: Replace struct_mutex for batch pool serialisation

2019-06-18 Thread Chris Wilson
Switch to tracking activity via i915_active on individual nodes, only
keeping a list of retired objects in the cache, and reaping the cache
when the engine itself idles.

Signed-off-by: Chris Wilson 
---
 drivers/gpu/drm/i915/Makefile |   2 +-
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c|  58 ---
 drivers/gpu/drm/i915/gem/i915_gem_object.c|   1 -
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |   1 -
 drivers/gpu/drm/i915/gem/i915_gem_pm.c|   4 +-
 drivers/gpu/drm/i915/gt/intel_engine.h|   1 -
 drivers/gpu/drm/i915/gt/intel_engine_cs.c |  11 +-
 drivers/gpu/drm/i915/gt/intel_engine_pm.c |   2 +
 drivers/gpu/drm/i915/gt/intel_engine_pool.c   | 163 ++
 drivers/gpu/drm/i915/gt/intel_engine_pool.h   |  33 
 .../gpu/drm/i915/gt/intel_engine_pool_types.h |  29 
 drivers/gpu/drm/i915/gt/intel_engine_types.h  |   4 +-
 drivers/gpu/drm/i915/gt/mock_engine.c |   3 +
 drivers/gpu/drm/i915/i915_debugfs.c   |  68 
 drivers/gpu/drm/i915/i915_gem_batch_pool.c| 132 --
 drivers/gpu/drm/i915/i915_gem_batch_pool.h|  26 ---
 16 files changed, 274 insertions(+), 264 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/gt/intel_engine_pool.c
 create mode 100644 drivers/gpu/drm/i915/gt/intel_engine_pool.h
 create mode 100644 drivers/gpu/drm/i915/gt/intel_engine_pool_types.h
 delete mode 100644 drivers/gpu/drm/i915/i915_gem_batch_pool.c
 delete mode 100644 drivers/gpu/drm/i915/i915_gem_batch_pool.h

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 91355c2ea8a5..68936d5d8096 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -72,6 +72,7 @@ obj-y += gt/
 gt-y += \
gt/intel_breadcrumbs.o \
gt/intel_context.o \
+   gt/intel_engine_pool.o \
gt/intel_engine_cs.o \
gt/intel_engine_pm.o \
gt/intel_gt_pm.o \
@@ -116,7 +117,6 @@ i915-y += \
  $(gem-y) \
  i915_active.o \
  i915_cmd_parser.o \
- i915_gem_batch_pool.o \
  i915_gem_evict.o \
  i915_gem_fence_reg.o \
  i915_gem_gtt.o \
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c 
b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index 8fb8613a1555..70e4436dc2a8 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -16,6 +16,7 @@
 
 #include "gem/i915_gem_ioctls.h"
 #include "gt/intel_context.h"
+#include "gt/intel_engine_pool.h"
 #include "gt/intel_gt_pm.h"
 
 #include "i915_gem_ioctls.h"
@@ -1201,25 +1202,26 @@ static int __reloc_gpu_alloc(struct i915_execbuffer *eb,
 unsigned int len)
 {
struct reloc_cache *cache = &eb->reloc_cache;
-   struct drm_i915_gem_object *obj;
+   struct intel_engine_pool_node *pool;
struct i915_request *rq;
struct i915_vma *batch;
u32 *cmd;
int err;
 
-   obj = i915_gem_batch_pool_get(&eb->engine->batch_pool, PAGE_SIZE);
-   if (IS_ERR(obj))
-   return PTR_ERR(obj);
+   pool = intel_engine_pool_get(&eb->engine->pool, PAGE_SIZE);
+   if (IS_ERR(pool))
+   return PTR_ERR(pool);
 
-   cmd = i915_gem_object_pin_map(obj,
+   cmd = i915_gem_object_pin_map(pool->obj,
  cache->has_llc ?
  I915_MAP_FORCE_WB :
  I915_MAP_FORCE_WC);
-   i915_gem_object_unpin_pages(obj);
-   if (IS_ERR(cmd))
-   return PTR_ERR(cmd);
+   if (IS_ERR(cmd)) {
+   err = PTR_ERR(cmd);
+   goto out_pool;
+   }
 
-   batch = i915_vma_instance(obj, vma->vm, NULL);
+   batch = i915_vma_instance(pool->obj, vma->vm, NULL);
if (IS_ERR(batch)) {
err = PTR_ERR(batch);
goto err_unmap;
@@ -1235,6 +1237,10 @@ static int __reloc_gpu_alloc(struct i915_execbuffer *eb,
goto err_unpin;
}
 
+   err = intel_engine_pool_mark_active(pool, rq);
+   if (err)
+   goto err_request;
+
err = reloc_move_to_gpu(rq, vma);
if (err)
goto err_request;
@@ -1260,7 +1266,7 @@ static int __reloc_gpu_alloc(struct i915_execbuffer *eb,
cache->rq_size = 0;
 
/* Return with batch mapping (cmd) still pinned */
-   return 0;
+   goto out_pool;
 
 skip_request:
i915_request_skip(rq, err);
@@ -1269,7 +1275,9 @@ static int __reloc_gpu_alloc(struct i915_execbuffer *eb,
 err_unpin:
i915_vma_unpin(batch);
 err_unmap:
-   i915_gem_object_unpin_map(obj);
+   i915_gem_object_unpin_map(pool->obj);
+out_pool:
+   intel_engine_pool_put(pool);
return err;
 }
 
@@ -2013,18 +2021,17 @@ static int i915_reset_gen7_sol_offsets(struct 
i915_request *rq)
 
 static struct i915_vma *eb_parse(struct i915_execbuffer *eb, bool is_master)
 {
-   struct

[Intel-gfx] [PATCH 21/26] drm/i915: Extract intel_frontbuffer active tracking

2019-06-18 Thread Chris Wilson
Move the active tracking for the frontbuffer operations out of the
i915_gem_object and into its own first class (refcounted) object. In the
process of detangling, we switch from low level request tracking to the
easier i915_active -- with the plan that this avoids any potential
atomic callbacks as the frontbuffer tracking wishes to sleep as it
flushes.

Signed-off-by: Chris Wilson 
---
 drivers/gpu/drm/i915/display/intel_display.c  |  70 +++--
 drivers/gpu/drm/i915/display/intel_fbdev.c|  40 ++-
 .../gpu/drm/i915/display/intel_frontbuffer.c  | 255 +-
 .../gpu/drm/i915/display/intel_frontbuffer.h  |  70 +++--
 drivers/gpu/drm/i915/display/intel_overlay.c  |   8 +-
 drivers/gpu/drm/i915/gem/i915_gem_clflush.c   |   2 +-
 drivers/gpu/drm/i915/gem/i915_gem_domain.c|  14 +-
 drivers/gpu/drm/i915/gem/i915_gem_mman.c  |   4 -
 drivers/gpu/drm/i915/gem/i915_gem_object.c|  28 +-
 drivers/gpu/drm/i915/gem/i915_gem_object.h|   2 +-
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |   8 +-
 drivers/gpu/drm/i915/i915_debugfs.c   |   5 -
 drivers/gpu/drm/i915/i915_drv.h   |   4 -
 drivers/gpu/drm/i915/i915_gem.c   |  47 +---
 drivers/gpu/drm/i915/i915_vma.c   |   6 +-
 drivers/gpu/drm/i915/intel_drv.h  |   1 +
 16 files changed, 306 insertions(+), 258 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 8d7e4c8b60bc..fe0918157621 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -3048,12 +3048,13 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc,
 {
struct drm_device *dev = crtc->base.dev;
struct drm_i915_private *dev_priv = to_i915(dev);
-   struct drm_i915_gem_object *obj = NULL;
struct drm_mode_fb_cmd2 mode_cmd = { 0 };
struct drm_framebuffer *fb = &plane_config->fb->base;
u32 base_aligned = round_down(plane_config->base, PAGE_SIZE);
u32 size_aligned = round_up(plane_config->base + plane_config->size,
PAGE_SIZE);
+   struct drm_i915_gem_object *obj;
+   bool ret = false;
 
size_aligned -= base_aligned;
 
@@ -3095,7 +3096,7 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc,
break;
default:
MISSING_CASE(plane_config->tiling);
-   return false;
+   goto out;
}
 
mode_cmd.pixel_format = fb->format->format;
@@ -3107,16 +3108,15 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc,
 
if (intel_framebuffer_init(to_intel_framebuffer(fb), obj, &mode_cmd)) {
DRM_DEBUG_KMS("intel fb init failed\n");
-   goto out_unref_obj;
+   goto out;
}
 
 
DRM_DEBUG_KMS("initial plane fb obj %p\n", obj);
-   return true;
-
-out_unref_obj:
+   ret = true;
+out:
i915_gem_object_put(obj);
-   return false;
+   return ret;
 }
 
 static void
@@ -3173,6 +3173,12 @@ static void intel_plane_disable_noatomic(struct 
intel_crtc *crtc,
intel_disable_plane(plane, crtc_state);
 }
 
+static struct intel_frontbuffer *
+to_intel_frontbuffer(struct drm_framebuffer *fb)
+{
+   return fb ? to_intel_framebuffer(fb)->frontbuffer : NULL;
+}
+
 static void
 intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
 struct intel_initial_plane_config *plane_config)
@@ -3180,7 +3186,6 @@ intel_find_initial_plane_obj(struct intel_crtc 
*intel_crtc,
struct drm_device *dev = intel_crtc->base.dev;
struct drm_i915_private *dev_priv = to_i915(dev);
struct drm_crtc *c;
-   struct drm_i915_gem_object *obj;
struct drm_plane *primary = intel_crtc->base.primary;
struct drm_plane_state *plane_state = primary->state;
struct intel_plane *intel_plane = to_intel_plane(primary);
@@ -3256,8 +3261,7 @@ intel_find_initial_plane_obj(struct intel_crtc 
*intel_crtc,
return;
}
 
-   obj = intel_fb_obj(fb);
-   intel_fb_obj_flush(obj, ORIGIN_DIRTYFB);
+   intel_frontbuffer_flush(to_intel_frontbuffer(fb), ORIGIN_DIRTYFB);
 
plane_state->src_x = 0;
plane_state->src_y = 0;
@@ -3272,14 +3276,14 @@ intel_find_initial_plane_obj(struct intel_crtc 
*intel_crtc,
intel_state->base.src = drm_plane_state_src(plane_state);
intel_state->base.dst = drm_plane_state_dest(plane_state);
 
-   if (i915_gem_object_is_tiled(obj))
+   if (plane_config->tiling)
dev_priv->preserve_bios_swizzle = true;
 
plane_state->fb = fb;
plane_state->crtc = &intel_crtc->base;
 
atomic_or(to_intel_plane(primary)->frontbuffer_bit,
- &obj->frontbuffer_bits);
+ &to_intel_frontbuffer(fb)->bits);
 }
 
 static int skl_max_plane_width(const struct drm_framebuffer *fb,
@@ -13982,9 +13986,9 @@ st

[Intel-gfx] [PATCH 23/26] drm/i915: Rename intel_wakeref_[is]_active

2019-06-18 Thread Chris Wilson
Our general rule is to use is/has as the verb for boolean functions,
rename intel_wakeref_active to intel_wakeref_is_active so the question
being asked is clear.

Signed-off-by: Chris Wilson 
---
 drivers/gpu/drm/i915/gem/i915_gem_pm.c| 3 ++-
 drivers/gpu/drm/i915/gt/intel_engine.h| 6 ++
 drivers/gpu/drm/i915/gt/intel_engine_cs.c | 2 +-
 drivers/gpu/drm/i915/gt/intel_lrc.c   | 2 +-
 drivers/gpu/drm/i915/gt/intel_reset.c | 2 +-
 drivers/gpu/drm/i915/intel_wakeref.h  | 4 ++--
 6 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pm.c 
b/drivers/gpu/drm/i915/gem/i915_gem_pm.c
index 35b73c347887..8570e2a64737 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_pm.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_pm.c
@@ -51,7 +51,8 @@ static void idle_work_handler(struct work_struct *work)
mutex_lock(&i915->drm.struct_mutex);
 
intel_wakeref_lock(&i915->gt.wakeref);
-   park = !intel_wakeref_active(&i915->gt.wakeref) && !work_pending(work);
+   park = (!intel_wakeref_is_active(&i915->gt.wakeref) &&
+   !work_pending(work));
intel_wakeref_unlock(&i915->gt.wakeref);
if (park)
i915_gem_park(i915);
diff --git a/drivers/gpu/drm/i915/gt/intel_engine.h 
b/drivers/gpu/drm/i915/gt/intel_engine.h
index 9bb6ff76680e..5c3b15835af6 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine.h
+++ b/drivers/gpu/drm/i915/gt/intel_engine.h
@@ -17,6 +17,7 @@
 #include "i915_timeline.h"
 #include "intel_engine_types.h"
 #include "intel_gpu_commands.h"
+#include "intel_wakeref.h"
 #include "intel_workarounds.h"
 
 struct drm_printer;
@@ -422,6 +423,11 @@ static inline void intel_engine_reset(struct 
intel_engine_cs *engine,
 bool intel_engine_is_idle(struct intel_engine_cs *engine);
 bool intel_engines_are_idle(struct drm_i915_private *dev_priv);
 
+static inline bool intel_engine_is_active(const struct intel_engine_cs *engine)
+{
+   return intel_wakeref_is_active(&engine->wakeref);
+}
+
 void intel_engines_reset_default_submission(struct drm_i915_private *i915);
 unsigned int intel_engines_has_context_isolation(struct drm_i915_private 
*i915);
 
diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c 
b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
index 65cf08a8b209..65424eed8f99 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
@@ -1152,7 +1152,7 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)
if (i915_reset_failed(engine->i915))
return true;
 
-   if (!intel_wakeref_active(&engine->wakeref))
+   if (!intel_engine_is_active(engine))
return true;
 
/* Waiting to drain ELSP? */
diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c 
b/drivers/gpu/drm/i915/gt/intel_lrc.c
index 5dbc43c70496..c77b2819b092 100644
--- a/drivers/gpu/drm/i915/gt/intel_lrc.c
+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
@@ -663,7 +663,7 @@ static void execlists_submit_ports(struct intel_engine_cs 
*engine)
 * that all ELSP are drained i.e. we have processed the CSB,
 * before allowing ourselves to idle and calling intel_runtime_pm_put().
 */
-   GEM_BUG_ON(!intel_wakeref_active(&engine->wakeref));
+   GEM_BUG_ON(!intel_engine_is_active(engine));
 
/*
 * ELSQ note: the submit queue is not cleared after being submitted
diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c 
b/drivers/gpu/drm/i915/gt/intel_reset.c
index d204aadf5d6f..919cce816f65 100644
--- a/drivers/gpu/drm/i915/gt/intel_reset.c
+++ b/drivers/gpu/drm/i915/gt/intel_reset.c
@@ -1081,7 +1081,7 @@ int i915_reset_engine(struct intel_engine_cs *engine, 
const char *msg)
GEM_TRACE("%s flags=%lx\n", engine->name, error->flags);
GEM_BUG_ON(!test_bit(I915_RESET_ENGINE + engine->id, &error->flags));
 
-   if (!intel_wakeref_active(&engine->wakeref))
+   if (!intel_engine_is_active(engine))
return 0;
 
reset_prepare_engine(engine);
diff --git a/drivers/gpu/drm/i915/intel_wakeref.h 
b/drivers/gpu/drm/i915/intel_wakeref.h
index 9cbb2ebf575b..ccefe731ba9f 100644
--- a/drivers/gpu/drm/i915/intel_wakeref.h
+++ b/drivers/gpu/drm/i915/intel_wakeref.h
@@ -121,13 +121,13 @@ intel_wakeref_unlock(struct intel_wakeref *wf)
 }
 
 /**
- * intel_wakeref_active: Query whether the wakeref is currently held
+ * intel_wakeref_is_active: Query whether the wakeref is currently held
  * @wf: the wakeref
  *
  * Returns: true if the wakeref is currently held.
  */
 static inline bool
-intel_wakeref_active(struct intel_wakeref *wf)
+intel_wakeref_is_active(const struct intel_wakeref *wf)
 {
return READ_ONCE(wf->wakeref);
 }
-- 
2.20.1

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

[Intel-gfx] [PATCH 18/26] drm/i915: Push the i915_active.retire into a worker

2019-06-18 Thread Chris Wilson
As we need to use a mutex to serialise i915_active activation
(because we want to allow the callback to sleep), we need to push the
i915_active.retire into a worker callback in case we get need to retire
from an atomic context.

Signed-off-by: Chris Wilson 
Reviewed-by: Matthew Auld 
---
 drivers/gpu/drm/i915/gem/i915_gem_context.c |  1 +
 drivers/gpu/drm/i915/gt/intel_context.c |  1 +
 drivers/gpu/drm/i915/i915_active.c  | 72 -
 drivers/gpu/drm/i915/i915_active_types.h| 12 
 drivers/gpu/drm/i915/i915_timeline.c|  1 +
 drivers/gpu/drm/i915/i915_vma.c |  3 +-
 6 files changed, 74 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c 
b/drivers/gpu/drm/i915/gem/i915_gem_context.c
index 911f3564972d..55b8f0e04846 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
@@ -891,6 +891,7 @@ struct context_barrier_task {
void *data;
 };
 
+__i915_active_call
 static void cb_retire(struct i915_active *base)
 {
struct context_barrier_task *cb = container_of(base, typeof(*cb), base);
diff --git a/drivers/gpu/drm/i915/gt/intel_context.c 
b/drivers/gpu/drm/i915/gt/intel_context.c
index 20c708ae6dc0..70d3b2568227 100644
--- a/drivers/gpu/drm/i915/gt/intel_context.c
+++ b/drivers/gpu/drm/i915/gt/intel_context.c
@@ -123,6 +123,7 @@ static void __context_unpin_state(struct i915_vma *vma)
__i915_vma_unpin(vma);
 }
 
+__i915_active_call
 static void __intel_context_retire(struct i915_active *active)
 {
struct intel_context *ce = container_of(active, typeof(*ce), active);
diff --git a/drivers/gpu/drm/i915/i915_active.c 
b/drivers/gpu/drm/i915/i915_active.c
index 3070fccbc08b..710805605bb3 100644
--- a/drivers/gpu/drm/i915/i915_active.c
+++ b/drivers/gpu/drm/i915/i915_active.c
@@ -97,18 +97,14 @@ static void debug_active_assert(struct i915_active *ref)
 #endif
 
 static void
-active_retire(struct i915_active *ref)
+__active_retire(struct i915_active *ref)
 {
struct active_node *it, *n;
struct rb_root root;
bool retire = false;
 
-   GEM_BUG_ON(!atomic_read(&ref->count));
-   if (atomic_add_unless(&ref->count, -1, 1))
-   return;
-
-   /* One active may be flushed from inside the acquire of another */
-   mutex_lock_nested(&ref->mutex, SINGLE_DEPTH_NESTING);
+   lockdep_assert_held(&ref->mutex);
+   GEM_BUG_ON(i915_active_is_idle(ref));
 
/* return the unused nodes to our slabcache -- flushing the allocator */
if (atomic_dec_and_test(&ref->count)) {
@@ -131,6 +127,36 @@ active_retire(struct i915_active *ref)
}
 }
 
+static void
+active_work(struct work_struct *wrk)
+{
+   struct i915_active *ref = container_of(wrk, typeof(*ref), work);
+
+   GEM_BUG_ON(!atomic_read(&ref->count));
+   if (atomic_add_unless(&ref->count, -1, 1))
+   return;
+
+   mutex_lock(&ref->mutex);
+   __active_retire(ref);
+}
+
+static void
+active_retire(struct i915_active *ref)
+{
+   GEM_BUG_ON(!atomic_read(&ref->count));
+   if (atomic_add_unless(&ref->count, -1, 1))
+   return;
+
+   /* If we are inside interrupt context (fence signaling), defer */
+   if (ref->flags & I915_ACTIVE_RETIRE_SLEEPS ||
+   !mutex_trylock(&ref->mutex)) {
+   queue_work(system_unbound_wq, &ref->work);
+   return;
+   }
+
+   __active_retire(ref);
+}
+
 static void
 node_retire(struct i915_active_request *base, struct i915_request *rq)
 {
@@ -200,16 +226,24 @@ void __i915_active_init(struct drm_i915_private *i915,
void (*retire)(struct i915_active *ref),
struct lock_class_key *key)
 {
+   unsigned long bits;
+
debug_active_init(ref);
 
ref->i915 = i915;
+
+   ref->flags = 0;
ref->active = active;
-   ref->retire = retire;
+   ref->retire = ptr_unpack_bits(retire, &bits, 2);
+   if (bits & I915_ACTIVE_MAY_SLEEP)
+   ref->flags |= I915_ACTIVE_RETIRE_SLEEPS;
+
ref->tree = RB_ROOT;
ref->cache = NULL;
init_llist_head(&ref->barriers);
atomic_set(&ref->count, 0);
__mutex_init(&ref->mutex, "i915_active", key);
+   INIT_WORK(&ref->work, active_work);
 }
 
 int i915_active_ref(struct i915_active *ref,
@@ -282,8 +316,10 @@ int i915_active_wait(struct i915_active *ref)
if (err)
return err;
 
-   if (!atomic_add_unless(&ref->count, 1, 0))
-   goto unlock;
+   if (!atomic_add_unless(&ref->count, 1, 0)) {
+   mutex_unlock(&ref->mutex);
+   return 0;
+   }
 
rbtree_postorder_for_each_entry_safe(it, n, &ref->tree, node) {
err = i915_active_request_retire(&it->base, BKL(ref));
@@ -291,10 +327,15 @@ int i915_active_wait(struct i915_active *ref)
break;
}
 
-   activ

[Intel-gfx] [PATCH 04/26] drm/i915: Flush the execution-callbacks on retiring

2019-06-18 Thread Chris Wilson
In the unlikely case the request completes while we regard it as not even
executing on the GPU (see the next patch!), we have to flush any pending
execution callbacks at retirement and ensure that we do not add any
more.

Signed-off-by: Chris Wilson 
---
 drivers/gpu/drm/i915/i915_request.c | 93 +++--
 1 file changed, 49 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_request.c 
b/drivers/gpu/drm/i915/i915_request.c
index d7fd77e8a789..51b068a57193 100644
--- a/drivers/gpu/drm/i915/i915_request.c
+++ b/drivers/gpu/drm/i915/i915_request.c
@@ -119,6 +119,50 @@ const struct dma_fence_ops i915_fence_ops = {
.release = i915_fence_release,
 };
 
+static void irq_execute_cb(struct irq_work *wrk)
+{
+   struct execute_cb *cb = container_of(wrk, typeof(*cb), work);
+
+   i915_sw_fence_complete(cb->fence);
+   kmem_cache_free(global.slab_execute_cbs, cb);
+}
+
+static void irq_execute_cb_hook(struct irq_work *wrk)
+{
+   struct execute_cb *cb = container_of(wrk, typeof(*cb), work);
+
+   cb->hook(container_of(cb->fence, struct i915_request, submit),
+&cb->signal->fence);
+   i915_request_put(cb->signal);
+
+   irq_execute_cb(wrk);
+}
+
+static void __notify_execute_cb(struct i915_request *rq)
+{
+   struct execute_cb *cb;
+
+   lockdep_assert_held(&rq->lock);
+
+   if (list_empty(&rq->execute_cb))
+   return;
+
+   list_for_each_entry(cb, &rq->execute_cb, link)
+   irq_work_queue(&cb->work);
+
+   /*
+* XXX Rollback on __i915_request_unsubmit()
+*
+* In the future, perhaps when we have an active time-slicing scheduler,
+* it will be interesting to unsubmit parallel execution and remove
+* busywaits from the GPU until their master is restarted. This is
+* quite hairy, we have to carefully rollback the fence and do a
+* preempt-to-idle cycle on the target engine, all the while the
+* master execute_cb may refire.
+*/
+   INIT_LIST_HEAD(&rq->execute_cb);
+}
+
 static inline void
 i915_request_remove_from_client(struct i915_request *request)
 {
@@ -246,6 +290,11 @@ static bool i915_request_retire(struct i915_request *rq)
GEM_BUG_ON(!atomic_read(&rq->i915->gt_pm.rps.num_waiters));
atomic_dec(&rq->i915->gt_pm.rps.num_waiters);
}
+   if (!test_bit(I915_FENCE_FLAG_ACTIVE, &rq->fence.flags)) {
+   set_bit(I915_FENCE_FLAG_ACTIVE, &rq->fence.flags);
+   __notify_execute_cb(rq);
+   }
+   GEM_BUG_ON(!list_empty(&rq->execute_cb));
spin_unlock(&rq->lock);
 
local_irq_enable();
@@ -285,50 +334,6 @@ void i915_request_retire_upto(struct i915_request *rq)
} while (i915_request_retire(tmp) && tmp != rq);
 }
 
-static void irq_execute_cb(struct irq_work *wrk)
-{
-   struct execute_cb *cb = container_of(wrk, typeof(*cb), work);
-
-   i915_sw_fence_complete(cb->fence);
-   kmem_cache_free(global.slab_execute_cbs, cb);
-}
-
-static void irq_execute_cb_hook(struct irq_work *wrk)
-{
-   struct execute_cb *cb = container_of(wrk, typeof(*cb), work);
-
-   cb->hook(container_of(cb->fence, struct i915_request, submit),
-&cb->signal->fence);
-   i915_request_put(cb->signal);
-
-   irq_execute_cb(wrk);
-}
-
-static void __notify_execute_cb(struct i915_request *rq)
-{
-   struct execute_cb *cb;
-
-   lockdep_assert_held(&rq->lock);
-
-   if (list_empty(&rq->execute_cb))
-   return;
-
-   list_for_each_entry(cb, &rq->execute_cb, link)
-   irq_work_queue(&cb->work);
-
-   /*
-* XXX Rollback on __i915_request_unsubmit()
-*
-* In the future, perhaps when we have an active time-slicing scheduler,
-* it will be interesting to unsubmit parallel execution and remove
-* busywaits from the GPU until their master is restarted. This is
-* quite hairy, we have to carefully rollback the fence and do a
-* preempt-to-idle cycle on the target engine, all the while the
-* master execute_cb may refire.
-*/
-   INIT_LIST_HEAD(&rq->execute_cb);
-}
-
 static int
 __i915_request_await_execution(struct i915_request *rq,
   struct i915_request *signal,
-- 
2.20.1

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

[Intel-gfx] [PATCH 17/26] drm/i915: Provide an i915_active.acquire callback

2019-06-18 Thread Chris Wilson
If we introduce a callback for i915_active that is only called the first
time we use the i915_active and is symmetrically paired with the
i915_active.retire callback, we can replace the open-coded and
non-atomic implementations -- which will be very fragile (i.e. broken)
upon removing the struct_mutex serialisation.

Signed-off-by: Chris Wilson 
Reviewed-by: Matthew Auld 
---
 drivers/gpu/drm/i915/gem/i915_gem_context.c  |   8 +-
 drivers/gpu/drm/i915/gt/intel_context.c  |  83 ---
 drivers/gpu/drm/i915/gt/intel_context.h  |  14 +-
 drivers/gpu/drm/i915/gt/intel_lrc.c  |   6 +-
 drivers/gpu/drm/i915/gt/intel_ringbuffer.c   |   2 +-
 drivers/gpu/drm/i915/gt/mock_engine.c|   2 +-
 drivers/gpu/drm/i915/i915_active.c   | 226 +--
 drivers/gpu/drm/i915/i915_active.h   |  25 +-
 drivers/gpu/drm/i915/i915_active_types.h |  10 +-
 drivers/gpu/drm/i915/i915_gem_gtt.c  |   2 +-
 drivers/gpu/drm/i915/i915_timeline.c |  16 +-
 drivers/gpu/drm/i915/i915_vma.c  |  22 +-
 drivers/gpu/drm/i915/selftests/i915_active.c |  53 -
 13 files changed, 265 insertions(+), 204 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c 
b/drivers/gpu/drm/i915/gem/i915_gem_context.c
index 35871c8a42a6..911f3564972d 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
@@ -923,8 +923,12 @@ static int context_barrier_task(struct i915_gem_context 
*ctx,
if (!cb)
return -ENOMEM;
 
-   i915_active_init(i915, &cb->base, cb_retire);
-   i915_active_acquire(&cb->base);
+   i915_active_init(i915, &cb->base, NULL, cb_retire);
+   err = i915_active_acquire(&cb->base);
+   if (err) {
+   kfree(cb);
+   return err;
+   }
 
for_each_gem_engine(ce, i915_gem_context_lock_engines(ctx), it) {
struct i915_request *rq;
diff --git a/drivers/gpu/drm/i915/gt/intel_context.c 
b/drivers/gpu/drm/i915/gt/intel_context.c
index 2c454f227c2e..20c708ae6dc0 100644
--- a/drivers/gpu/drm/i915/gt/intel_context.c
+++ b/drivers/gpu/drm/i915/gt/intel_context.c
@@ -95,11 +95,15 @@ void intel_context_unpin(struct intel_context *ce)
intel_context_put(ce);
 }
 
-static int __context_pin_state(struct i915_vma *vma, unsigned long flags)
+static int __context_pin_state(struct i915_vma *vma)
 {
+   u64 flags;
int err;
 
-   err = i915_vma_pin(vma, 0, 0, flags | PIN_GLOBAL);
+   flags = i915_ggtt_pin_bias(vma) | PIN_OFFSET_BIAS;
+   flags |= PIN_HIGH | PIN_GLOBAL;
+
+   err = i915_vma_pin(vma, 0, 0, flags);
if (err)
return err;
 
@@ -119,7 +123,7 @@ static void __context_unpin_state(struct i915_vma *vma)
__i915_vma_unpin(vma);
 }
 
-static void intel_context_retire(struct i915_active *active)
+static void __intel_context_retire(struct i915_active *active)
 {
struct intel_context *ce = container_of(active, typeof(*ce), active);
 
@@ -129,65 +133,58 @@ static void intel_context_retire(struct i915_active 
*active)
intel_context_put(ce);
 }
 
-void
-intel_context_init(struct intel_context *ce,
-  struct i915_gem_context *ctx,
-  struct intel_engine_cs *engine)
-{
-   GEM_BUG_ON(!engine->cops);
-
-   kref_init(&ce->ref);
-
-   ce->gem_context = ctx;
-   ce->engine = engine;
-   ce->ops = engine->cops;
-   ce->sseu = engine->sseu;
-
-   INIT_LIST_HEAD(&ce->signal_link);
-   INIT_LIST_HEAD(&ce->signals);
-
-   mutex_init(&ce->pin_mutex);
-
-   i915_active_init(ctx->i915, &ce->active, intel_context_retire);
-}
-
-int intel_context_active_acquire(struct intel_context *ce, unsigned long flags)
+static int __intel_context_active(struct i915_active *active)
 {
+   struct intel_context *ce = container_of(active, typeof(*ce), active);
int err;
 
-   if (!i915_active_acquire(&ce->active))
-   return 0;
-
intel_context_get(ce);
 
if (!ce->state)
return 0;
 
-   err = __context_pin_state(ce->state, flags);
-   if (err) {
-   i915_active_cancel(&ce->active);
-   intel_context_put(ce);
-   return err;
-   }
+   err = __context_pin_state(ce->state);
+   if (err)
+   goto err_put;
 
/* Preallocate tracking nodes */
if (!i915_gem_context_is_kernel(ce->gem_context)) {
err = i915_active_acquire_preallocate_barrier(&ce->active,
  ce->engine);
-   if (err) {
-   i915_active_release(&ce->active);
-   return err;
-   }
+   if (err)
+   goto err_unpin;
}
 
return 0;
+
+err_unpin:
+   __context_unpin_state(ce->state);
+err_put:
+   intel_context_put(ce);
+   return err;

[Intel-gfx] [PATCH 14/26] drm/i915: Signal fence completion from i915_request_wait

2019-06-18 Thread Chris Wilson
With the upcoming change to automanaged i915_active, the intent is that
whenever we wait on the set of active fences, they are signaled and
collected.  The requirement is that all successful returns from
i915_request_wait() signal the fence, so fixup the one remaining path
where we may return before the interrupt has been run.

Signed-off-by: Chris Wilson 
Cc: Tvrtko Ursulin 
---
 drivers/gpu/drm/i915/i915_request.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_request.c 
b/drivers/gpu/drm/i915/i915_request.c
index 27b9893fa8e3..201bd8d1506f 100644
--- a/drivers/gpu/drm/i915/i915_request.c
+++ b/drivers/gpu/drm/i915/i915_request.c
@@ -1458,8 +1458,10 @@ long i915_request_wait(struct i915_request *rq,
for (;;) {
set_current_state(state);
 
-   if (i915_request_completed(rq))
+   if (i915_request_completed(rq)) {
+   dma_fence_signal(&rq->fence);
break;
+   }
 
if (signal_pending_state(state, current)) {
timeout = -ERESTARTSYS;
-- 
2.20.1

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

[Intel-gfx] [PATCH 15/26] drm/i915: Remove waiting & retiring from shrinker paths

2019-06-18 Thread Chris Wilson
i915_gem_wait_for_idle() and i915_retire_requests() introduce a
dependency on the timeline->mutex. This is problematic as we want to
later perform allocations underneath i915_active.mutex, forming a link
between the shrinker, the timeline and active mutexes. Nip this cycle in
the bud by removing the acquisition of the timeline mutex (i.e.
retiring) from inside the shrinker.

Signed-off-by: Chris Wilson 
---
 drivers/gpu/drm/i915/gem/i915_gem_shrinker.c | 10 --
 drivers/gpu/drm/i915/i915_timeline.c |  3 ---
 2 files changed, 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c 
b/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
index 3a926a8755c6..1bbc690494c7 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
@@ -169,7 +169,6 @@ i915_gem_shrink(struct drm_i915_private *i915,
 */
 
trace_i915_gem_shrink(i915, target, shrink);
-   i915_retire_requests(i915);
 
/*
 * Unbinding of objects will require HW access; Let us not wake the
@@ -269,8 +268,6 @@ i915_gem_shrink(struct drm_i915_private *i915,
if (shrink & I915_SHRINK_BOUND)
intel_runtime_pm_put(&i915->runtime_pm, wakeref);
 
-   i915_retire_requests(i915);
-
shrinker_unlock(i915, unlock);
 
if (nr_scanned)
@@ -427,12 +424,6 @@ i915_gem_shrinker_vmap(struct notifier_block *nb, unsigned 
long event, void *ptr
if (!shrinker_lock(i915, 0, &unlock))
return NOTIFY_DONE;
 
-   /* Force everything onto the inactive lists */
-   if (i915_gem_wait_for_idle(i915,
-  I915_WAIT_LOCKED,
-  MAX_SCHEDULE_TIMEOUT))
-   goto out;
-
with_intel_runtime_pm(&i915->runtime_pm, wakeref)
freed_pages += i915_gem_shrink(i915, -1UL, NULL,
   I915_SHRINK_BOUND |
@@ -455,7 +446,6 @@ i915_gem_shrinker_vmap(struct notifier_block *nb, unsigned 
long event, void *ptr
}
mutex_unlock(&i915->ggtt.vm.mutex);
 
-out:
shrinker_unlock(i915, unlock);
 
*(unsigned long *)ptr += freed_pages;
diff --git a/drivers/gpu/drm/i915/i915_timeline.c 
b/drivers/gpu/drm/i915/i915_timeline.c
index c311ce9c6f9d..f3ee264d7dd5 100644
--- a/drivers/gpu/drm/i915/i915_timeline.c
+++ b/drivers/gpu/drm/i915/i915_timeline.c
@@ -270,9 +270,6 @@ void i915_timelines_init(struct drm_i915_private *i915)
 
spin_lock_init(>->hwsp_lock);
INIT_LIST_HEAD(>->hwsp_free_list);
-
-   /* via i915_gem_wait_for_idle() */
-   i915_gem_shrinker_taints_mutex(i915, >->mutex);
 }
 
 static void timeline_add_to_active(struct i915_timeline *tl)
-- 
2.20.1

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

[Intel-gfx] [PATCH 10/26] dma-fence: Report the composite sync_file status

2019-06-18 Thread Chris Wilson
Same as for the individual fences, we want to report the actual status
of the fence when queried.

Reported-by: Petri Latvala 
Signed-off-by: Chris Wilson 
Cc: Sumit Semwal 
Cc: Gustavo Padovan 
Cc: Petri Latvala 
---
 drivers/dma-buf/sync_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index ee4d1a96d779..25c5c071645b 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -419,7 +419,7 @@ static long sync_file_ioctl_fence_info(struct sync_file 
*sync_file,
 * info->num_fences.
 */
if (!info.num_fences) {
-   info.status = dma_fence_is_signaled(sync_file->fence);
+   info.status = dma_fence_get_status(sync_file->fence);
goto no_fences;
} else {
info.status = 1;
-- 
2.20.1

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

[Intel-gfx] [PATCH 20/26] drm/i915: Forgo last_fence active request tracking

2019-06-18 Thread Chris Wilson
We were using the last_fence to track the last request that used this
vma that might be interpreted by a fence register and forced ourselves
to wait for this request before modifying any fence register that
overlapped our vma. Due to requirement that we need to track any XY_BLT
command, linear or tiled, this in effect meant that we have to track the
vma for its active lifespan anyway, so we can forgo the explicit
last_fence tracking and just use the whole vma->active.

Another solution would be to pipeline the register updates, and would
help resolve some long running stalls for gen3 (but only gen 2 and 3!)

Signed-off-by: Chris Wilson 
Reviewed-by: Matthew Auld 
---
 drivers/gpu/drm/i915/i915_debugfs.c   |  4 +---
 drivers/gpu/drm/i915/i915_gem_fence_reg.c |  6 ++
 drivers/gpu/drm/i915/i915_gem_gtt.c   |  1 -
 drivers/gpu/drm/i915/i915_vma.c   | 13 -
 drivers/gpu/drm/i915/i915_vma.h   |  1 -
 5 files changed, 3 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index eeecdad0e3ca..2c8580f375fb 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -210,9 +210,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object 
*obj)
}
}
if (vma->fence)
-   seq_printf(m, " , fence: %d%s",
-  vma->fence->id,
-  i915_active_request_isset(&vma->last_fence) 
? "*" : "");
+   seq_printf(m, " , fence: %d", vma->fence->id);
seq_puts(m, ")");
 
spin_lock(&obj->vma.lock);
diff --git a/drivers/gpu/drm/i915/i915_gem_fence_reg.c 
b/drivers/gpu/drm/i915/i915_gem_fence_reg.c
index 0bf53ac1c835..754eceaf0b23 100644
--- a/drivers/gpu/drm/i915/i915_gem_fence_reg.c
+++ b/drivers/gpu/drm/i915/i915_gem_fence_reg.c
@@ -230,16 +230,14 @@ static int fence_update(struct i915_fence_reg *fence,
 i915_gem_object_get_tiling(vma->obj)))
return -EINVAL;
 
-   ret = i915_active_request_retire(&vma->last_fence,
-&vma->obj->base.dev->struct_mutex);
+   ret = i915_active_wait(&vma->active);
if (ret)
return ret;
}
 
old = xchg(&fence->vma, NULL);
if (old) {
-   ret = i915_active_request_retire(&old->last_fence,
-&old->obj->base.dev->struct_mutex);
+   ret = i915_active_wait(&old->active);
if (ret) {
fence->vma = old;
return ret;
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c 
b/drivers/gpu/drm/i915/i915_gem_gtt.c
index ee22c34d071a..8c58e6f0a2b4 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2050,7 +2050,6 @@ static struct i915_vma *pd_vma_create(struct gen6_ppgtt 
*ppgtt, int size)
return ERR_PTR(-ENOMEM);
 
i915_active_init(i915, &vma->active, NULL, NULL);
-   INIT_ACTIVE_REQUEST(&vma->last_fence);
 
vma->vm = &ggtt->vm;
vma->ops = &pd_vma_ops;
diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index f694bfa54e0d..b888ddab3c8b 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -118,7 +118,6 @@ vma_create(struct drm_i915_gem_object *obj,
 
i915_active_init(vm->i915, &vma->active,
 __i915_vma_active, __i915_vma_retire);
-   INIT_ACTIVE_REQUEST(&vma->last_fence);
 
INIT_LIST_HEAD(&vma->closed_link);
 
@@ -793,8 +792,6 @@ static void __i915_vma_destroy(struct i915_vma *vma)
GEM_BUG_ON(vma->node.allocated);
GEM_BUG_ON(vma->fence);
 
-   GEM_BUG_ON(i915_active_request_isset(&vma->last_fence));
-
mutex_lock(&vma->vm->mutex);
list_del(&vma->vm_link);
mutex_unlock(&vma->vm->mutex);
@@ -930,9 +927,6 @@ int i915_vma_move_to_active(struct i915_vma *vma,
obj->read_domains |= I915_GEM_GPU_DOMAINS;
obj->mm.dirty = true;
 
-   if (flags & EXEC_OBJECT_NEEDS_FENCE)
-   __i915_active_request_set(&vma->last_fence, rq);
-
export_fence(vma, rq, flags);
 
GEM_BUG_ON(!i915_vma_is_active(vma));
@@ -965,14 +959,7 @@ int i915_vma_unbind(struct i915_vma *vma)
 * before we are finished).
 */
__i915_vma_pin(vma);
-
ret = i915_active_wait(&vma->active);
-   if (ret)
-   goto unpin;
-
-   ret = i915_active_request_retire(&vma->last_fence,
- &vma->vm->i915->drm.struct_mutex);
-unpin:
__i915_vma_unpin(vma);
if (ret)
return ret;
diff --git a/dri

[Intel-gfx] [PATCH 22/26] drm/i915: Coordinate i915_active with its own mutex

2019-06-18 Thread Chris Wilson
Forgo the struct_mutex serialisation for i915_active, and interpose its
own mutex handling for active/retire.

This is a multi-layered sleight-of-hand. First, we had to ensure that no
active/retire callbacks accidentally inverted the mutex ordering rules,
nor assumed that they were themselves serialised by struct_mutex. More
challenging though, is the rule over updating elements of the active
rbtree. Instead of the whole i915_active now being serialised by
struct_mutex, allocations/rotations of the tree are serialised by the
i915_active.mutex and individual nodes are serialised by the caller
using the i915_timeline.mutex (we need to use nested spinlocks to
interact with the dma_fence callback lists).

The pain point here is that instead of a single mutex around execbuf, we
now have to take a mutex for active tracker (one for each vma, context,
etc) and a couple of spinlocks for each fence update. The improvement in
fine grained locking allowing for multiple concurrent clients
(eventually!) should be worth it in typical loads.

Signed-off-by: Chris Wilson 
---
 .../gpu/drm/i915/display/intel_frontbuffer.c  |   2 +-
 drivers/gpu/drm/i915/display/intel_overlay.c  |   6 +-
 drivers/gpu/drm/i915/gem/i915_gem_context.c   |  12 +-
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c|   2 +-
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |   2 +
 drivers/gpu/drm/i915/gem/i915_gem_pm.c|   9 +-
 drivers/gpu/drm/i915/gt/intel_context.c   |   2 +-
 drivers/gpu/drm/i915/gt/intel_reset.c |  10 +-
 drivers/gpu/drm/i915/gt/selftest_lrc.c|  10 +-
 drivers/gpu/drm/i915/gvt/scheduler.c  |   3 -
 drivers/gpu/drm/i915/i915_active.c| 153 +
 drivers/gpu/drm/i915/i915_active.h| 305 --
 drivers/gpu/drm/i915/i915_active_types.h  |  17 +-
 drivers/gpu/drm/i915/i915_gem.c   |  42 ++-
 drivers/gpu/drm/i915/i915_gem_gtt.c   |   2 +-
 drivers/gpu/drm/i915/i915_request.c   |  58 +---
 drivers/gpu/drm/i915/i915_request.h   |   1 -
 drivers/gpu/drm/i915/i915_timeline.c  |   9 +-
 drivers/gpu/drm/i915/i915_timeline_types.h|   2 +-
 drivers/gpu/drm/i915/i915_vma.c   |  36 +--
 drivers/gpu/drm/i915/selftests/i915_active.c  |  35 +-
 .../gpu/drm/i915/selftests/mock_timeline.c|   2 +-
 22 files changed, 234 insertions(+), 486 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_frontbuffer.c 
b/drivers/gpu/drm/i915/display/intel_frontbuffer.c
index 7128148155dc..e01509c6877b 100644
--- a/drivers/gpu/drm/i915/display/intel_frontbuffer.c
+++ b/drivers/gpu/drm/i915/display/intel_frontbuffer.c
@@ -248,7 +248,7 @@ intel_frontbuffer_get(struct drm_i915_gem_object *obj)
front->obj = obj;
kref_init(&front->ref);
atomic_set(&front->bits, 0);
-   i915_active_init(i915, &front->write,
+   i915_active_init(&front->write,
 frontbuffer_active,
 i915_active_may_sleep(frontbuffer_retire));
 
diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c 
b/drivers/gpu/drm/i915/display/intel_overlay.c
index f0743af79fcb..d50a0196b166 100644
--- a/drivers/gpu/drm/i915/display/intel_overlay.c
+++ b/drivers/gpu/drm/i915/display/intel_overlay.c
@@ -230,7 +230,8 @@ alloc_request(struct intel_overlay *overlay, void 
(*fn)(struct intel_overlay *))
if (IS_ERR(rq))
return rq;
 
-   err = i915_active_ref(&overlay->last_flip, rq->fence.context, rq);
+   err = i915_active_ref(&overlay->last_flip,
+ rq->fence.context, &rq->fence);
if (err) {
i915_request_add(rq);
return ERR_PTR(err);
@@ -1366,8 +1367,7 @@ void intel_overlay_setup(struct drm_i915_private 
*dev_priv)
overlay->contrast = 75;
overlay->saturation = 146;
 
-   i915_active_init(dev_priv,
-&overlay->last_flip,
+   i915_active_init(&overlay->last_flip,
 NULL, intel_overlay_last_flip_retire);
 
ret = get_registers(overlay, OVERLAY_NEEDS_PHYSICAL(dev_priv));
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c 
b/drivers/gpu/drm/i915/gem/i915_gem_context.c
index 55b8f0e04846..1c8869b8ec20 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
@@ -911,20 +911,18 @@ static int context_barrier_task(struct i915_gem_context 
*ctx,
void (*task)(void *data),
void *data)
 {
-   struct drm_i915_private *i915 = ctx->i915;
struct context_barrier_task *cb;
struct i915_gem_engines_iter it;
struct intel_context *ce;
int err = 0;
 
-   lockdep_assert_held(&i915->drm.struct_mutex);
GEM_BUG_ON(!task);
 
cb = kmalloc(sizeof(*cb), GFP_KERNEL);
if (!cb)
return -ENOMEM;
 
-   i915_active_init(i915, &cb->base, NULL, cb_retire);
+   

[Intel-gfx] [PATCH 19/26] drm/i915/overlay: Switch to using i915_active tracking

2019-06-18 Thread Chris Wilson
Remove the raw i915_active_request tracking in favour of the higher
level i915_active tracking for the sole purpose of making the lockless
transition easier in later patches.

Signed-off-by: Chris Wilson 
---
 drivers/gpu/drm/i915/display/intel_overlay.c | 130 +--
 drivers/gpu/drm/i915/i915_active.h   |  19 ---
 2 files changed, 64 insertions(+), 85 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c 
b/drivers/gpu/drm/i915/display/intel_overlay.c
index 21339b7f6a3e..c7d2d980df8c 100644
--- a/drivers/gpu/drm/i915/display/intel_overlay.c
+++ b/drivers/gpu/drm/i915/display/intel_overlay.c
@@ -190,7 +190,8 @@ struct intel_overlay {
struct overlay_registers __iomem *regs;
u32 flip_addr;
/* flip handling */
-   struct i915_active_request last_flip;
+   struct i915_active last_flip;
+   void (*flip_complete)(struct intel_overlay *ovl);
 };
 
 static void i830_overlay_clock_gating(struct drm_i915_private *dev_priv,
@@ -216,32 +217,26 @@ static void i830_overlay_clock_gating(struct 
drm_i915_private *dev_priv,
  PCI_DEVFN(0, 0), I830_CLOCK_GATE, val);
 }
 
-static void intel_overlay_submit_request(struct intel_overlay *overlay,
-struct i915_request *rq,
-i915_active_retire_fn retire)
+static struct i915_request *
+alloc_request(struct intel_overlay *overlay, void (*fn)(struct intel_overlay 
*))
 {
-   GEM_BUG_ON(i915_active_request_peek(&overlay->last_flip,
-   &overlay->i915->drm.struct_mutex));
-   i915_active_request_set_retire_fn(&overlay->last_flip, retire,
- &overlay->i915->drm.struct_mutex);
-   __i915_active_request_set(&overlay->last_flip, rq);
-   i915_request_add(rq);
-}
+   struct intel_engine_cs *engine = overlay->i915->engine[RCS0];
+   struct i915_request *rq;
+   int err;
 
-static int intel_overlay_do_wait_request(struct intel_overlay *overlay,
-struct i915_request *rq,
-i915_active_retire_fn retire)
-{
-   intel_overlay_submit_request(overlay, rq, retire);
-   return i915_active_request_retire(&overlay->last_flip,
- &overlay->i915->drm.struct_mutex);
-}
+   overlay->flip_complete = fn;
 
-static struct i915_request *alloc_request(struct intel_overlay *overlay)
-{
-   struct intel_engine_cs *engine = overlay->i915->engine[RCS0];
+   rq = i915_request_create(engine->kernel_context);
+   if (IS_ERR(rq))
+   return rq;
+
+   err = i915_active_ref(&overlay->last_flip, rq->fence.context, rq);
+   if (err) {
+   i915_request_add(rq);
+   return ERR_PTR(err);
+   }
 
-   return i915_request_create(engine->kernel_context);
+   return rq;
 }
 
 /* overlay needs to be disable in OCMD reg */
@@ -253,7 +248,7 @@ static int intel_overlay_on(struct intel_overlay *overlay)
 
WARN_ON(overlay->active);
 
-   rq = alloc_request(overlay);
+   rq = alloc_request(overlay, NULL);
if (IS_ERR(rq))
return PTR_ERR(rq);
 
@@ -274,7 +269,9 @@ static int intel_overlay_on(struct intel_overlay *overlay)
*cs++ = MI_NOOP;
intel_ring_advance(rq, cs);
 
-   return intel_overlay_do_wait_request(overlay, rq, NULL);
+   i915_request_add(rq);
+
+   return i915_active_wait(&overlay->last_flip);
 }
 
 static void intel_overlay_flip_prepare(struct intel_overlay *overlay,
@@ -318,7 +315,7 @@ static int intel_overlay_continue(struct intel_overlay 
*overlay,
if (tmp & (1 << 17))
DRM_DEBUG("overlay underrun, DOVSTA: %x\n", tmp);
 
-   rq = alloc_request(overlay);
+   rq = alloc_request(overlay, NULL);
if (IS_ERR(rq))
return PTR_ERR(rq);
 
@@ -333,8 +330,7 @@ static int intel_overlay_continue(struct intel_overlay 
*overlay,
intel_ring_advance(rq, cs);
 
intel_overlay_flip_prepare(overlay, vma);
-
-   intel_overlay_submit_request(overlay, rq, NULL);
+   i915_request_add(rq);
 
return 0;
 }
@@ -355,20 +351,13 @@ static void intel_overlay_release_old_vma(struct 
intel_overlay *overlay)
 }
 
 static void
-intel_overlay_release_old_vid_tail(struct i915_active_request *active,
-  struct i915_request *rq)
+intel_overlay_release_old_vid_tail(struct intel_overlay *overlay)
 {
-   struct intel_overlay *overlay =
-   container_of(active, typeof(*overlay), last_flip);
-
intel_overlay_release_old_vma(overlay);
 }
 
-static void intel_overlay_off_tail(struct i915_active_request *active,
-  struct i915_request *rq)
+static void intel_overlay_off_tail(struct intel_overlay *overlay)
 {
-   struct intel_overlay *overlay =
-

[Intel-gfx] [PATCH 12/26] dma-fence: Always execute signal callbacks

2019-06-18 Thread Chris Wilson
Allow for some users to surreptiously insert lazy signal callbacks that
do not depend on enabling the signaling mechanism around every fence.
This means that we may have a cb_list even if the signaling bit is not
enabled, so always notify the callbacks.

The cost is that dma_fence_signal() must always acquire the spinlock to
ensure that the cb_list is flushed.

Signed-off-by: Chris Wilson 
---
 drivers/dma-buf/dma-fence.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index 027a6a894abd..ab4a456bba04 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -170,11 +170,9 @@ int dma_fence_signal(struct dma_fence *fence)
 
__dma_fence_signal__timestamp(fence, ktime_get());
 
-   if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags)) {
-   spin_lock_irqsave(fence->lock, flags);
-   __dma_fence_signal__notify(fence);
-   spin_unlock_irqrestore(fence->lock, flags);
-   }
+   spin_lock_irqsave(fence->lock, flags);
+   __dma_fence_signal__notify(fence);
+   spin_unlock_irqrestore(fence->lock, flags);
return 0;
 }
 EXPORT_SYMBOL(dma_fence_signal);
-- 
2.20.1

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

[Intel-gfx] [PATCH 09/26] dma-fence: Propagate errors to dma-fence-array container

2019-06-18 Thread Chris Wilson
When one of the array of fences is signaled, propagate its errors to the
parent fence-array (keeping the first error to be raised).

v2: Opencode cmpxchg_local to avoid compiler freakout.

Signed-off-by: Chris Wilson 
Cc: Sumit Semwal 
Cc: Gustavo Padovan 
---
 drivers/dma-buf/dma-fence-array.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/dma-buf/dma-fence-array.c 
b/drivers/dma-buf/dma-fence-array.c
index 12c6f64c0bc2..d90675bb4fcc 100644
--- a/drivers/dma-buf/dma-fence-array.c
+++ b/drivers/dma-buf/dma-fence-array.c
@@ -13,6 +13,12 @@
 #include 
 #include 
 
+static void fence_set_error_once(struct dma_fence *fence, int error)
+{
+   if (!fence->error && error)
+   dma_fence_set_error(fence, error);
+}
+
 static const char *dma_fence_array_get_driver_name(struct dma_fence *fence)
 {
return "dma_fence_array";
@@ -38,6 +44,13 @@ static void dma_fence_array_cb_func(struct dma_fence *f,
container_of(cb, struct dma_fence_array_cb, cb);
struct dma_fence_array *array = array_cb->array;
 
+   /*
+* Propagate the first error reported by any of our fences, but only
+* before we ourselves are signaled.
+*/
+   if (atomic_read(&array->num_pending) > 0)
+   fence_set_error_once(&array->base, f->error);
+
if (atomic_dec_and_test(&array->num_pending))
irq_work_queue(&array->work);
else
@@ -63,6 +76,8 @@ static bool dma_fence_array_enable_signaling(struct dma_fence 
*fence)
dma_fence_get(&array->base);
if (dma_fence_add_callback(array->fences[i], &cb[i].cb,
   dma_fence_array_cb_func)) {
+   fence_set_error_once(&array->base,
+array->fences[i]->error);
dma_fence_put(&array->base);
if (atomic_dec_and_test(&array->num_pending))
return false;
-- 
2.20.1

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

[Intel-gfx] [PATCH 16/26] drm/i915: Throw away the active object retirement complexity

2019-06-18 Thread Chris Wilson
Remove the accumulated optimisations that we have for i915_vma_retire
and reduce it to the bare essential of tracking the active object
reference. This allows us to only use atomic operations, and so will be
able to avoid the struct_mutex requirement.

The principal loss here is the shrinker MRU bumping, so now if we have
to shrink, we will do so in much more random order and more likely to
try and shrink recently used objects. That is a nuisance, but shrinking
active objects is a second step we try to avoid and will always be a
system-wide performance issue.

The other loss is here is in the automatic pruning of the
reservation_object when idling. This is not as large an issue as upon
reservation_object introduction as now adding new fences into the object
replaces already signaled fences, keeping the array compact. But we do
lose the auto-expiration of stale fences and unused arrays. That may be
a noticeable problem for which we need to re-implement autopruning.

Signed-off-by: Chris Wilson 
Reviewed-by: Matthew Auld 
---
 drivers/gpu/drm/i915/gem/i915_gem_object.c|  1 -
 drivers/gpu/drm/i915/gem/i915_gem_object.h|  6 ---
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |  1 -
 drivers/gpu/drm/i915/gem/i915_gem_shrinker.c  |  5 +-
 .../drm/i915/gem/selftests/i915_gem_mman.c|  9 
 drivers/gpu/drm/i915/gt/intel_lrc.c   |  4 +-
 drivers/gpu/drm/i915/gt/intel_ringbuffer.c|  1 -
 drivers/gpu/drm/i915/gt/selftest_hangcheck.c  | 32 +--
 drivers/gpu/drm/i915/i915_debugfs.c   |  8 +--
 drivers/gpu/drm/i915/i915_gem_batch_pool.c| 42 ++-
 drivers/gpu/drm/i915/i915_vma.c   | 54 ---
 11 files changed, 47 insertions(+), 116 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c 
b/drivers/gpu/drm/i915/gem/i915_gem_object.c
index 1b571fd26ed4..0a105bc29494 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
@@ -163,7 +163,6 @@ static void __i915_gem_free_objects(struct drm_i915_private 
*i915,
 
mutex_lock(&i915->drm.struct_mutex);
 
-   GEM_BUG_ON(i915_gem_object_is_active(obj));
list_for_each_entry_safe(vma, vn, &obj->vma.list, obj_link) {
GEM_BUG_ON(i915_vma_is_active(vma));
vma->flags &= ~I915_VMA_PIN_MASK;
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.h 
b/drivers/gpu/drm/i915/gem/i915_gem_object.h
index 7cb1871d7128..454bfb498001 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.h
@@ -158,12 +158,6 @@ i915_gem_object_needs_async_cancel(const struct 
drm_i915_gem_object *obj)
return obj->ops->flags & I915_GEM_OBJECT_ASYNC_CANCEL;
 }
 
-static inline bool
-i915_gem_object_is_active(const struct drm_i915_gem_object *obj)
-{
-   return READ_ONCE(obj->active_count);
-}
-
 static inline bool
 i915_gem_object_is_framebuffer(const struct drm_i915_gem_object *obj)
 {
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object_types.h 
b/drivers/gpu/drm/i915/gem/i915_gem_object_types.h
index 5b05698619ce..c299fed2c6b1 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object_types.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object_types.h
@@ -156,7 +156,6 @@ struct drm_i915_gem_object {
 
/** Count of VMA actually bound by this object */
atomic_t bind_count;
-   unsigned int active_count;
/** Count of how many global VMA are currently pinned for use by HW */
unsigned int pin_global;
 
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c 
b/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
index 1bbc690494c7..6670fa2350c9 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
@@ -229,8 +229,9 @@ i915_gem_shrink(struct drm_i915_private *i915,
continue;
 
if (!(shrink & I915_SHRINK_ACTIVE) &&
-   (i915_gem_object_is_active(obj) ||
-i915_gem_object_is_framebuffer(obj)))
+   (i915_gem_object_is_framebuffer(obj) ||
+!reservation_object_test_signaled_rcu(obj->resv,
+  true)))
continue;
 
if (!(shrink & I915_SHRINK_BOUND) &&
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c 
b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
index 5c81f4b4813a..2053194a8b70 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
@@ -474,15 +474,6 @@ static int igt_mmap_offset_exhaustion(void *arg)
pr_err("[loop %d] Failed to busy the object\n", loop);
goto err_obj;
}
-
-   /* NB we rely on the _active_ reference to access obj now

[Intel-gfx] [PATCH 13/26] drm/i915: Track i915_active using debugobjects

2019-06-18 Thread Chris Wilson
Provide runtime asserts and tracking of i915_active via debugobjects.
For example, this should allow us to check that the i915_active is only
active when we expect it to be and is never freed too early.

One consequence is that, for simplicity, we no longer allow i915_active
to be on-stack which only affected the selftests.

Signed-off-by: Chris Wilson 
---
 drivers/gpu/drm/i915/i915_active.c   | 80 +++-
 drivers/gpu/drm/i915/selftests/i915_active.c | 78 ++-
 2 files changed, 137 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_active.c 
b/drivers/gpu/drm/i915/i915_active.c
index 41ed2798687d..e716baab276f 100644
--- a/drivers/gpu/drm/i915/i915_active.c
+++ b/drivers/gpu/drm/i915/i915_active.c
@@ -4,6 +4,8 @@
  * Copyright © 2019 Intel Corporation
  */
 
+#include 
+
 #include "gt/intel_engine_pm.h"
 
 #include "i915_drv.h"
@@ -31,6 +33,69 @@ struct active_node {
u64 timeline;
 };
 
+#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM) && IS_ENABLED(CONFIG_DEBUG_OBJECTS)
+
+static void *active_debug_hint(void *addr)
+{
+   struct i915_active *ref = addr;
+
+   return (void *)ref->retire ?: (void *)ref;
+}
+
+static struct debug_obj_descr active_debug_desc = {
+   .name = "i915_active",
+   .debug_hint = active_debug_hint,
+};
+
+static void debug_active_init(struct i915_active *ref)
+{
+   debug_object_init(ref, &active_debug_desc);
+}
+
+static void debug_active_activate(struct i915_active *ref)
+{
+   debug_object_activate(ref, &active_debug_desc);
+}
+
+static void debug_active_deactivate(struct i915_active *ref)
+{
+   debug_object_deactivate(ref, &active_debug_desc);
+}
+
+static void debug_active_fini(struct i915_active *ref)
+{
+   debug_object_free(ref, &active_debug_desc);
+}
+
+static void debug_active_assert(struct i915_active *ref)
+{
+   debug_object_assert_init(ref, &active_debug_desc);
+}
+
+#else
+
+static void debug_active_init(struct i915_active *ref)
+{
+}
+
+static void debug_active_activate(struct i915_active *ref)
+{
+}
+
+static void debug_active_deactivate(struct i915_active *ref)
+{
+}
+
+static void debug_active_fini(struct i915_active *ref)
+{
+}
+
+static void debug_active_assert(struct i915_active *ref)
+{
+}
+
+#endif
+
 static void
 __active_park(struct i915_active *ref)
 {
@@ -50,6 +115,8 @@ __active_retire(struct i915_active *ref)
if (--ref->count)
return;
 
+   debug_active_deactivate(ref);
+
/* return the unused nodes to our slabcache */
__active_park(ref);
 
@@ -155,6 +222,8 @@ void i915_active_init(struct drm_i915_private *i915,
  struct i915_active *ref,
  void (*retire)(struct i915_active *ref))
 {
+   debug_active_init(ref);
+
ref->i915 = i915;
ref->retire = retire;
ref->tree = RB_ROOT;
@@ -191,13 +260,21 @@ int i915_active_ref(struct i915_active *ref,
 
 bool i915_active_acquire(struct i915_active *ref)
 {
+   debug_active_assert(ref);
lockdep_assert_held(BKL(ref));
-   return !ref->count++;
+
+   if (ref->count++)
+   return false;
+
+   debug_active_activate(ref);
+   return true;
 }
 
 void i915_active_release(struct i915_active *ref)
 {
+   debug_active_assert(ref);
lockdep_assert_held(BKL(ref));
+
__active_retire(ref);
 }
 
@@ -260,6 +337,7 @@ int i915_request_await_active(struct i915_request *rq, 
struct i915_active *ref)
 #if IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)
 void i915_active_fini(struct i915_active *ref)
 {
+   debug_active_fini(ref);
GEM_BUG_ON(i915_active_request_isset(&ref->last));
GEM_BUG_ON(!RB_EMPTY_ROOT(&ref->tree));
GEM_BUG_ON(ref->count);
diff --git a/drivers/gpu/drm/i915/selftests/i915_active.c 
b/drivers/gpu/drm/i915/selftests/i915_active.c
index c0b3537a5fa6..98493bcc91f2 100644
--- a/drivers/gpu/drm/i915/selftests/i915_active.c
+++ b/drivers/gpu/drm/i915/selftests/i915_active.c
@@ -16,28 +16,51 @@ struct live_active {
bool retired;
 };
 
-static void __live_active_retire(struct i915_active *base)
+static void __live_free(struct live_active *active)
+{
+   i915_active_fini(&active->base);
+   kfree(active);
+}
+
+static void __live_retire(struct i915_active *base)
 {
struct live_active *active = container_of(base, typeof(*active), base);
 
active->retired = true;
 }
 
-static int __live_active_setup(struct drm_i915_private *i915,
-  struct live_active *active)
+static struct live_active *__live_alloc(struct drm_i915_private *i915)
+{
+   struct live_active *active;
+
+   active = kzalloc(sizeof(*active), GFP_KERNEL);
+   if (!active)
+   return NULL;
+
+   i915_active_init(i915, &active->base, __live_retire);
+
+   return active;
+}
+
+static struct live_active *
+__live_active_setup(struct drm_i915_private *i915)
 {
struct intel_engine_cs *engine;
 

Re: [Intel-gfx] [PATCH 01/22] drm/i915: Restore -Wunused-but-set-variable

2019-06-18 Thread Jani Nikula
On Mon, 17 Jun 2019, Chris Wilson  wrote:
> We appear to be clear of this warning, so time to re-enable the gcc error
> checking.
>
> Signed-off-by: Chris Wilson 

Acked-by: Jani Nikula 


> ---
>  drivers/gpu/drm/i915/Makefile | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index c0a7b2994077..f4971900087a 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -17,7 +17,6 @@ subdir-ccflags-y += $(call cc-disable-warning, 
> unused-parameter)
>  subdir-ccflags-y += $(call cc-disable-warning, type-limits)
>  subdir-ccflags-y += $(call cc-disable-warning, missing-field-initializers)
>  subdir-ccflags-y += $(call cc-disable-warning, implicit-fallthrough)
> -subdir-ccflags-y += $(call cc-disable-warning, unused-but-set-variable)
>  # clang warnings
>  subdir-ccflags-y += $(call cc-disable-warning, sign-compare)
>  subdir-ccflags-y += $(call cc-disable-warning, sometimes-uninitialized)

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

Re: [Intel-gfx] [PATCH 40/59] drm/vram-helper: Drop drm_gem_prime_export/import

2019-06-18 Thread Daniel Vetter
On Tue, Jun 18, 2019 at 6:49 AM Gerd Hoffmann  wrote:
>
>   Hi,
>
> > > While most callbacks are pretty straight forward (just hook the same
> > > callbacks into the drm_gem_object_funcs. struct) the mmap bits are a
> > > bit more obscure.
> > >
> > > First, there seem to be two ways to mmap a gem buffer:
> > >
> > >   (1) drm_driver->fops->mmap, and
> > >   (2) drm_driver->gem_prime_mmap.
> > >
> > > drm_gem_object_funcs has just a single vm_ops ...
> > >
> > > Also it is not obvious how one would convert something which basically
> > > calls ttm_bo_mmap() in drm_driver->fops->mmap to the new interface.
> >
> > Yeah the mmap side is still a mess, but my series here was getting a bit
> > too long already. There's a bunch of problems here:
> >
> > drm_driver->gem_prime_mmap could be nuked and instead we use
> > drm_gem_prime_mmap everywhere. Especially the various versions in helpers
> > really don't add much.
>
> Well, everything using ttm has the problem that we have another
> duplication here: both gem and ttm have a vma_node ...
>
> So (for example) drm_gem_vram_driver_gem_prime_mmap() is a thin wrapper
> which does (a) copy vm_node.start from ttm to gem vma_node and (b) calls
> drm_gem_prime_mmap().

Hm ... maybe we should ditch the ttm vma offset stuff and fold that
over entirely to the gem way of doing things. The only thing you're
going to loose is the ->verify_access callback, which again is just to
get back to gem I think. You would need a slightly differrent vm_ops
structure though, since the ttm vm ops expect a ttm_buffer_object,
whereas gem gives you a drm_gem_buffer_object. So either need to
overwrite all those, or maybe it's inded time to just make ttm_bo a
subclass of gem_bo.

> > Second one is drm_driver->fops->mmap. That one we need to keep, but this
> > isn't mmap on a buffer, but mmap on the entire drm_device. The one which
> > should be replaced by drm_gem_object_funcs.vm_ops is
> > drm_driver->gem_vm_ops.
>
> Hmm, seems ttm hasn't something I can hook into drm_driver->gem_vm_ops ...

ttm_bo_vm_ops seems to be the thing you want.

Cheers, 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] ✗ Fi.CI.BAT: failure for linux-next: build failure after merge of the drm-misc tree

2019-06-18 Thread Jani Nikula
On Fri, 14 Jun 2019, Stephen Rothwell  wrote:
> Hi all,
>
> On Fri, 14 Jun 2019 04:47:35 - Patchwork 
>  wrote:
>>
>> == Series Details ==
>> 
>> Series: linux-next: build failure after merge of the drm-misc tree
>> URL   : https://patchwork.freedesktop.org/series/62080/
>> State : failure
>> 
>> == Summary ==
>> 
>> CALLscripts/checksyscalls.sh
>>   CALLscripts/atomic/check-atomics.sh
>>   DESCEND  objtool
>>   CHK include/generated/compile.h
>>   CC [M]  drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.o
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4024:18: error: 
>> initialization from incompatible pointer type 
>> [-Werror=incompatible-pointer-types]
>>   .atomic_check = amdgpu_dm_connector_atomic_check,
>>   ^~~~
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4024:18: note: 
>> (near initialization for ‘amdgpu_dm_connector_helper_funcs.atomic_check’)
>> cc1: some warnings being treated as errors
>> scripts/Makefile.build:278: recipe for target 
>> 'drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.o' failed
>> make[4]: *** [drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.o] 
>> Error 1
>> scripts/Makefile.build:489: recipe for target 'drivers/gpu/drm/amd/amdgpu' 
>> failed
>> make[3]: *** [drivers/gpu/drm/amd/amdgpu] Error 2
>> scripts/Makefile.build:489: recipe for target 'drivers/gpu/drm' failed
>> make[2]: *** [drivers/gpu/drm] Error 2
>> scripts/Makefile.build:489: recipe for target 'drivers/gpu' failed
>> make[1]: *** [drivers/gpu] Error 2
>> Makefile:1071: recipe for target 'drivers' failed
>> make: *** [drivers] Error 2
>> 
>
> Can someone please stop this CI from trying to validate linux-next
> merge fix patches ...

Half the complaints are about CI trying to validate too much, and the
other half are about not validating enough...

Arek?

BR,
Jani.


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

Re: [Intel-gfx] [PATCH 23/26] drm/i915: Rename intel_wakeref_[is]_active

2019-06-18 Thread Chris Wilson
Quoting Chris Wilson (2019-06-18 08:41:50)
> @@ -422,6 +423,11 @@ static inline void intel_engine_reset(struct 
> intel_engine_cs *engine,
>  bool intel_engine_is_idle(struct intel_engine_cs *engine);
>  bool intel_engines_are_idle(struct drm_i915_private *dev_priv);
>  
> +static inline bool intel_engine_is_active(const struct intel_engine_cs 
> *engine)

On review, I think I prefer intel_engine_is_awake() here so that it is
slightly more distinct from intel_engine_is_idle().
-Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Intel-gfx] ✓ Fi.CI.IGT: success for prime doc polish and ... a few cleanups (rev2)

2019-06-18 Thread Patchwork
== Series Details ==

Series: prime doc polish and ... a few cleanups (rev2)
URL   : https://patchwork.freedesktop.org/series/62135/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6287_full -> Patchwork_13311_full


Summary
---

  **SUCCESS**

  No regressions found.

  

Known issues


  Here are the changes found in Patchwork_13311_full that come from known 
issues:

### IGT changes ###

 Issues hit 

  * igt@gem_userptr_blits@map-fixed-invalidate-busy-gup:
- shard-kbl:  [PASS][1] -> [DMESG-WARN][2] ([fdo#110913 ]) +1 
similar issue
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-kbl4/igt@gem_userptr_bl...@map-fixed-invalidate-busy-gup.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13311/shard-kbl3/igt@gem_userptr_bl...@map-fixed-invalidate-busy-gup.html

  * igt@gem_userptr_blits@sync-unmap-cycles:
- shard-apl:  [PASS][3] -> [DMESG-WARN][4] ([fdo#110913 ]) +1 
similar issue
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-apl8/igt@gem_userptr_bl...@sync-unmap-cycles.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13311/shard-apl7/igt@gem_userptr_bl...@sync-unmap-cycles.html

  * igt@gem_workarounds@suspend-resume-context:
- shard-apl:  [PASS][5] -> [DMESG-WARN][6] ([fdo#108566]) +3 
similar issues
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-apl3/igt@gem_workarou...@suspend-resume-context.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13311/shard-apl5/igt@gem_workarou...@suspend-resume-context.html

  * igt@i915_pm_backlight@fade_with_suspend:
- shard-skl:  [PASS][7] -> [INCOMPLETE][8] ([fdo#104108] / 
[fdo#107773])
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-skl9/igt@i915_pm_backlight@fade_with_suspend.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13311/shard-skl3/igt@i915_pm_backlight@fade_with_suspend.html

  * igt@i915_selftest@live_hangcheck:
- shard-iclb: [PASS][9] -> [INCOMPLETE][10] ([fdo#107713] / 
[fdo#108569])
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-iclb4/igt@i915_selftest@live_hangcheck.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13311/shard-iclb5/igt@i915_selftest@live_hangcheck.html

  * igt@kms_cursor_crc@pipe-a-cursor-suspend:
- shard-skl:  [PASS][11] -> [INCOMPLETE][12] ([fdo#110741])
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-skl4/igt@kms_cursor_...@pipe-a-cursor-suspend.html
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13311/shard-skl5/igt@kms_cursor_...@pipe-a-cursor-suspend.html

  * igt@kms_cursor_crc@pipe-b-cursor-64x21-sliding:
- shard-kbl:  [PASS][13] -> [FAIL][14] ([fdo#103232])
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-kbl2/igt@kms_cursor_...@pipe-b-cursor-64x21-sliding.html
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13311/shard-kbl4/igt@kms_cursor_...@pipe-b-cursor-64x21-sliding.html

  * igt@kms_flip@2x-flip-vs-absolute-wf_vblank:
- shard-hsw:  [PASS][15] -> [SKIP][16] ([fdo#109271]) +11 similar 
issues
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-hsw6/igt@kms_flip@2x-flip-vs-absolute-wf_vblank.html
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13311/shard-hsw1/igt@kms_flip@2x-flip-vs-absolute-wf_vblank.html

  * igt@kms_frontbuffer_tracking@basic:
- shard-iclb: [PASS][17] -> [FAIL][18] ([fdo#103167]) +8 similar 
issues
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-iclb4/igt@kms_frontbuffer_track...@basic.html
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13311/shard-iclb7/igt@kms_frontbuffer_track...@basic.html

  * igt@kms_frontbuffer_tracking@psr-rgb101010-draw-mmap-cpu:
- shard-iclb: [PASS][19] -> [INCOMPLETE][20] ([fdo#106978] / 
[fdo#107713])
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-iclb3/igt@kms_frontbuffer_track...@psr-rgb101010-draw-mmap-cpu.html
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13311/shard-iclb7/igt@kms_frontbuffer_track...@psr-rgb101010-draw-mmap-cpu.html

  * igt@kms_plane_lowres@pipe-a-tiling-x:
- shard-iclb: [PASS][21] -> [FAIL][22] ([fdo#103166]) +1 similar 
issue
   [21]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-iclb7/igt@kms_plane_low...@pipe-a-tiling-x.html
   [22]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13311/shard-iclb4/igt@kms_plane_low...@pipe-a-tiling-x.html

  * igt@kms_psr@psr2_cursor_render:
- shard-iclb: [PASS][23] -> [SKIP][24] ([fdo#109441]) +1 similar 
issue
   [23]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-iclb2/igt@kms_psr@psr2_cursor_render.html
   [24]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13311/shard-iclb1/igt@kms_psr@psr2

Re: [Intel-gfx] [PATCH 1/6] drm/i915: use vfuncs for reg_read/write_fw_domains

2019-06-18 Thread Tvrtko Ursulin


On 17/06/2019 19:09, Daniele Ceraolo Spurio wrote:

Instead of going through the if-else chain every time, let's save the
function in the uncore structure. Note that the new functions are
purposely not used from the reg read/write functions to keep the
inlining there.


Looks good to me.

Reviewed-by: Tvrtko Ursulin 

On the point of inlining, alternative would be to let compiler decide. 
It doesn't matter a lot though and I don't remember/know how the end of 
the gt/display split will look to see if that influences here somehow.


Regards,

Tvrtko


While at it, use the new macro to call the old ones to clean the code a
bit.

v2: Rename macros for no-forcewake function assignment (Tvrtko)

Signed-off-by: Daniele Ceraolo Spurio 
Cc: Tvrtko Ursulin 
---
  drivers/gpu/drm/i915/intel_uncore.c  | 172 ---
  drivers/gpu/drm/i915/intel_uncore.h  |   5 +
  drivers/gpu/drm/i915/selftests/mock_uncore.c |   4 +-
  3 files changed, 75 insertions(+), 106 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_uncore.c 
b/drivers/gpu/drm/i915/intel_uncore.c
index da33aa672c3d..8e5716bc53e2 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -901,6 +901,12 @@ static bool is_gen##x##_shadowed(u32 offset) \
  __is_genX_shadowed(8)
  __is_genX_shadowed(11)
  
+static enum forcewake_domains

+gen6_reg_write_fw_domains(struct intel_uncore *uncore, i915_reg_t reg)
+{
+   return FORCEWAKE_RENDER;
+}
+
  #define __gen8_reg_write_fw_domains(uncore, offset) \
  ({ \
enum forcewake_domains __fwd; \
@@ -1145,26 +1151,23 @@ func##_read##x(struct intel_uncore *uncore, i915_reg_t 
reg, bool trace) { \
val = __raw_uncore_read##x(uncore, reg); \
GEN6_READ_FOOTER; \
  }
-#define __gen6_read(x) __gen_read(gen6, x)
-#define __fwtable_read(x) __gen_read(fwtable, x)
-#define __gen11_fwtable_read(x) __gen_read(gen11_fwtable, x)
-
-__gen11_fwtable_read(8)
-__gen11_fwtable_read(16)
-__gen11_fwtable_read(32)
-__gen11_fwtable_read(64)
-__fwtable_read(8)
-__fwtable_read(16)
-__fwtable_read(32)
-__fwtable_read(64)
-__gen6_read(8)
-__gen6_read(16)
-__gen6_read(32)
-__gen6_read(64)
-
-#undef __gen11_fwtable_read
-#undef __fwtable_read
-#undef __gen6_read
+
+#define __gen_reg_read_funcs(func) \
+static enum forcewake_domains \
+func##_reg_read_fw_domains(struct intel_uncore *uncore, i915_reg_t reg) { \
+   return __##func##_reg_read_fw_domains(uncore, 
i915_mmio_reg_offset(reg)); \
+} \
+\
+__gen_read(func, 8) \
+__gen_read(func, 16) \
+__gen_read(func, 32) \
+__gen_read(func, 64)
+
+__gen_reg_read_funcs(gen11_fwtable);
+__gen_reg_read_funcs(fwtable);
+__gen_reg_read_funcs(gen6);
+
+#undef __gen_reg_read_funcs
  #undef GEN6_READ_FOOTER
  #undef GEN6_READ_HEADER
  
@@ -1225,6 +1228,9 @@ gen6_write##x(struct intel_uncore *uncore, i915_reg_t reg, u##x val, bool trace)

__raw_uncore_write##x(uncore, reg, val); \
GEN6_WRITE_FOOTER; \
  }
+__gen6_write(8)
+__gen6_write(16)
+__gen6_write(32)
  
  #define __gen_write(func, x) \

  static void \
@@ -1237,38 +1243,33 @@ func##_write##x(struct intel_uncore *uncore, i915_reg_t 
reg, u##x val, bool trac
__raw_uncore_write##x(uncore, reg, val); \
GEN6_WRITE_FOOTER; \
  }
-#define __gen8_write(x) __gen_write(gen8, x)
-#define __fwtable_write(x) __gen_write(fwtable, x)
-#define __gen11_fwtable_write(x) __gen_write(gen11_fwtable, x)
-
-__gen11_fwtable_write(8)
-__gen11_fwtable_write(16)
-__gen11_fwtable_write(32)
-__fwtable_write(8)
-__fwtable_write(16)
-__fwtable_write(32)
-__gen8_write(8)
-__gen8_write(16)
-__gen8_write(32)
-__gen6_write(8)
-__gen6_write(16)
-__gen6_write(32)
  
-#undef __gen11_fwtable_write

-#undef __fwtable_write
-#undef __gen8_write
-#undef __gen6_write
+#define __gen_reg_write_funcs(func) \
+static enum forcewake_domains \
+func##_reg_write_fw_domains(struct intel_uncore *uncore, i915_reg_t reg) { \
+   return __##func##_reg_write_fw_domains(uncore, 
i915_mmio_reg_offset(reg)); \
+} \
+\
+__gen_write(func, 8) \
+__gen_write(func, 16) \
+__gen_write(func, 32)
+
+__gen_reg_write_funcs(gen11_fwtable);
+__gen_reg_write_funcs(fwtable);
+__gen_reg_write_funcs(gen8);
+
+#undef __gen_reg_write_funcs
  #undef GEN6_WRITE_FOOTER
  #undef GEN6_WRITE_HEADER
  
-#define ASSIGN_WRITE_MMIO_VFUNCS(uncore, x) \

+#define ASSIGN_RAW_WRITE_MMIO_VFUNCS(uncore, x) \
  do { \
(uncore)->funcs.mmio_writeb = x##_write8; \
(uncore)->funcs.mmio_writew = x##_write16; \
(uncore)->funcs.mmio_writel = x##_write32; \
  } while (0)
  
-#define ASSIGN_READ_MMIO_VFUNCS(uncore, x) \

+#define ASSIGN_RAW_READ_MMIO_VFUNCS(uncore, x) \
  do { \
(uncore)->funcs.mmio_readb = x##_read8; \
(uncore)->funcs.mmio_readw = x##_read16; \
@@ -1276,6 +1277,17 @@ do { \
(uncore)->funcs.mmio_readq = x##_read64; \
  } while (0)
  
+#define ASSIGN_WRITE_MMIO_VFUNCS(uncore, x) \

+do { \
+   ASSIGN_RAW_WRITE_MMIO_VFUNCS((uncore), x); \
+   (uncore)->funcs.w

Re: [Intel-gfx] [igt-dev] [PATCH i-g-t v2 1/4] meson: add libatomic dependency

2019-06-18 Thread Guillaume Tucker
On 14/06/2019 09:07, Ser, Simon wrote:
> On Thu, 2019-06-13 at 14:53 +0100, Guillaume Tucker wrote:
>> Add conditional dependency on libatomic in order to be able to use the
>> __atomic_* functions instead of the older __sync_* ones.  The
>> libatomic library is only needed when there aren't any native support
>> on the current architecture, so a linker test is used for this
>> purpose.  This enables atomic operations to be on a wider number of
>> architectures including MIPS.
>>
>> Signed-off-by: Guillaume Tucker 
>> ---
>>  meson.build | 13 +
>>  1 file changed, 13 insertions(+)
>>
>> diff --git a/meson.build b/meson.build
>> index 6268c58d3634..da25a28f3268 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -179,6 +179,19 @@ math = cc.find_library('m')
>>  realtime = cc.find_library('rt')
>>  dlsym = cc.find_library('dl')
>>  zlib = cc.find_library('z')
>> +if cc.links('''
>> +#include 
>> +int main(void) {
>> +  uint32_t x32 = 0;
>> +  uint64_t x64 = 0;
>> +  __atomic_load_n(&x32, __ATOMIC_SEQ_CST);
>> +  __atomic_load_n(&x64, __ATOMIC_SEQ_CST);
> 
> Minor: maybe we could've used stdatomic.h's atomic_* functions (without
> the "__" prefix) for consistency with the actual IGT code?

I actually thought it was more correct to use the __atomic_*
functions directly from the libatomic library as this is a linker
test.  If for any reason stdatomic.h changes between versions or
compilers and uses something else than libatomic, then this test
would become invalid.

>> +  return 0;
>> +}''', name : 'built-in atomics')
>> +libatomic = []
> 
> We could use null_dep instead, to make it consistent with the other
> branch.

Ack, will fix that in v3.

>> +else
>> +libatomic = cc.find_library('atomic')
>> +endif
>>  
>>  if cc.has_header('linux/kd.h')
>>  config.set('HAVE_LINUX_KD_H', 1)

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

Re: [Intel-gfx] [PATCH 3/6] drm/i915: kill uncore_to_i915

2019-06-18 Thread Tvrtko Ursulin


On 17/06/2019 19:09, Daniele Ceraolo Spurio wrote:

Let's get rid of it before it proliferates, since with split GT/Display
uncores the container_of won't work anymore.

I've kept the rpm pointer as well to minimize the pointer chasing in the
MMIO accessors.

Signed-off-by: Daniele Ceraolo Spurio 
---
  drivers/gpu/drm/i915/i915_drv.c |  2 +-
  drivers/gpu/drm/i915/i915_drv.h |  5 -
  drivers/gpu/drm/i915/intel_uncore.c | 24 
  drivers/gpu/drm/i915/intel_uncore.h |  4 +++-
  4 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 6cf8f1838cec..d113296cbe34 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -894,7 +894,7 @@ static int i915_driver_init_early(struct drm_i915_private 
*dev_priv)
  
  	intel_device_info_subplatform_init(dev_priv);
  
-	intel_uncore_init_early(&dev_priv->uncore);

+   intel_uncore_init_early(dev_priv, &dev_priv->uncore);


Would swapped parameter order make more sense?

intel_uncore_init_early -> "I am operating on uncore" -> pass in uncore 
first, and dev_priv as additional information second. I think that would 
be better. With that:


Reviewed-by: Tvrtko Ursulin 

Regards,

Tvrtko

  
  	spin_lock_init(&dev_priv->irq_lock);

spin_lock_init(&dev_priv->gpu_error.lock);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 7a9c2392cc7c..3b42588b7194 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1949,11 +1949,6 @@ static inline struct drm_i915_private 
*huc_to_i915(struct intel_huc *huc)
return container_of(huc, struct drm_i915_private, huc);
  }
  
-static inline struct drm_i915_private *uncore_to_i915(struct intel_uncore *uncore)

-{
-   return container_of(uncore, struct drm_i915_private, uncore);
-}
-
  /* Simple iterator over all initialised engines */
  #define for_each_engine(engine__, dev_priv__, id__) \
for ((id__) = 0; \
diff --git a/drivers/gpu/drm/i915/intel_uncore.c 
b/drivers/gpu/drm/i915/intel_uncore.c
index 63bdadacadcc..88a69bf713c9 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -322,7 +322,7 @@ static void __gen6_gt_wait_for_fifo(struct intel_uncore 
*uncore)
  
  	/* On VLV, FIFO will be shared by both SW and HW.

 * So, we need to read the FREE_ENTRIES everytime */
-   if (IS_VALLEYVIEW(uncore_to_i915(uncore)))
+   if (IS_VALLEYVIEW(uncore->i915))
n = fifo_free_entries(uncore);
else
n = uncore->fifo_count;
@@ -493,7 +493,7 @@ static void __intel_uncore_early_sanitize(struct 
intel_uncore *uncore,
DRM_DEBUG("unclaimed mmio detected on uncore init, clearing\n");
  
  	/* WaDisableShadowRegForCpd:chv */

-   if (IS_CHERRYVIEW(uncore_to_i915(uncore))) {
+   if (IS_CHERRYVIEW(uncore->i915)) {
__raw_uncore_write32(uncore, GTFIFOCTL,
 __raw_uncore_read32(uncore, GTFIFOCTL) |
 GT_FIFO_CTL_BLOCK_ALL_POLICY_STALL |
@@ -622,7 +622,7 @@ void intel_uncore_forcewake_user_put(struct intel_uncore 
*uncore)
spin_lock_irq(&uncore->lock);
if (!--uncore->user_forcewake.count) {
if (intel_uncore_unclaimed_mmio(uncore))
-   dev_info(uncore_to_i915(uncore)->drm.dev,
+   dev_info(uncore->i915->drm.dev,
 "Invalid mmio detected during user access\n");
  
  		uncore->unclaimed_mmio_check =

@@ -1346,7 +1346,7 @@ static void fw_domain_fini(struct intel_uncore *uncore,
  
  static void intel_uncore_fw_domains_init(struct intel_uncore *uncore)

  {
-   struct drm_i915_private *i915 = uncore_to_i915(uncore);
+   struct drm_i915_private *i915 = uncore->i915;
  
  	if (!intel_uncore_has_forcewake(uncore))

return;
@@ -1499,7 +1499,7 @@ static int i915_pmic_bus_access_notifier(struct 
notifier_block *nb,
  
  static int uncore_mmio_setup(struct intel_uncore *uncore)

  {
-   struct drm_i915_private *i915 = uncore_to_i915(uncore);
+   struct drm_i915_private *i915 = uncore->i915;
struct pci_dev *pdev = i915->drm.pdev;
int mmio_bar;
int mmio_size;
@@ -1529,20 +1529,22 @@ static int uncore_mmio_setup(struct intel_uncore 
*uncore)
  
  static void uncore_mmio_cleanup(struct intel_uncore *uncore)

  {
-   struct drm_i915_private *i915 = uncore_to_i915(uncore);
-   struct pci_dev *pdev = i915->drm.pdev;
+   struct pci_dev *pdev = uncore->i915->drm.pdev;
  
  	pci_iounmap(pdev, uncore->regs);

  }
  
-void intel_uncore_init_early(struct intel_uncore *uncore)

+void intel_uncore_init_early(struct drm_i915_private *i915,
+struct intel_uncore *uncore)
  {
spin_lock_init(&uncore->lock);
+   uncore->i915 = i915;
+   uncore->rpm =

Re: [Intel-gfx] [igt-dev] [PATCH i-g-t v2 2/4] gitlab-ci: add libatomic to docker images

2019-06-18 Thread Guillaume Tucker
On 14/06/2019 13:53, Ser, Simon wrote:
> On Fri, 2019-06-14 at 15:43 +0300, Petri Latvala wrote:
>> On Fri, Jun 14, 2019 at 02:24:53PM +0300, Ser, Simon wrote:
>>> On Fri, 2019-06-14 at 13:00 +0300, Petri Latvala wrote:
 On Thu, Jun 13, 2019 at 02:53:20PM +0100, Guillaume Tucker wrote:
> Add libatomic to the Fedora docker image so it can link binaries that
> use __atomic_* functions.  Also explicitly add libatomic1 to Debian
> docker images even though it's already installed as a dependency.
>
> Signed-off-by: Guillaume Tucker 
> ---
>  Dockerfile.debian   | 1 +
>  Dockerfile.debian-arm64 | 1 +
>  Dockerfile.debian-armhf | 1 +
>  Dockerfile.fedora   | 2 +-
>  4 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/Dockerfile.debian b/Dockerfile.debian
> index b9c3be3945e0..d23591850c4e 100644
> --- a/Dockerfile.debian
> +++ b/Dockerfile.debian
> @@ -6,6 +6,7 @@ RUN apt-get install -y \
>   flex \
>   bison \
>   pkg-config \
> + libatomic1 \
>   libpciaccess-dev \
>   libkmod-dev \
>   libprocps-dev \
> diff --git a/Dockerfile.debian-arm64 b/Dockerfile.debian-arm64
> index 7b3a3c7ca803..003bb22b3215 100644
> --- a/Dockerfile.debian-arm64
> +++ b/Dockerfile.debian-arm64
> @@ -5,6 +5,7 @@ RUN apt-get install -y \
>   flex \
>   bison \
>   pkg-config \
> + libatomic1 \
>   x11proto-dri2-dev \
>   python-docutils \
>   valgrind \
> diff --git a/Dockerfile.debian-armhf b/Dockerfile.debian-armhf
> index c67a1e2acf6a..3139927c193a 100644
> --- a/Dockerfile.debian-armhf
> +++ b/Dockerfile.debian-armhf
> @@ -5,6 +5,7 @@ RUN apt-get install -y \
>   flex \
>   bison \
>   pkg-config \
> + libatomic1 \

 libatomic1 is the runtime lib, for linking you need the package that
 contains libatomic.so. That is *quick search*
 libgcc-$version-dev. There doesn't seem to be a generic metapackage
 for "the latest libgcc-dev", other than... 'gcc'.

 Since Debian is acting a bit speshul here I'd just drop the explicit
 libatomic installation.
>>>
>>> Hmm, I see the .so in libatomic1…
>>>
>>> https://packages.debian.org/jessie/amd64/libatomic1/filelist
>>
>> Where? I only see the .so.1 and .so.1.1.0
> 
> Bleh, indeed
So, I've dropped the libatomic1 as it's indeed not required
*except* that it is for non-x86 architectures at run-time with
multi-arch file systems.  I found that when adding ci tests for
mips, as of course it then needs it when running gem_create.  I'm
sending a v3 with this.

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

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/26] drm/i915: Keep engine alive as we retire the context

2019-06-18 Thread Patchwork
== Series Details ==

Series: series starting with [01/26] drm/i915: Keep engine alive as we retire 
the context
URL   : https://patchwork.freedesktop.org/series/62278/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
cda76c80993d drm/i915: Keep engine alive as we retire the context
42021f601d33 drm/i915: Skip shrinking already freed pages
ab6a6e6954bf drm/i915: Stop passing I915_WAIT_LOCKED to i915_request_wait()
-:11: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description 
(prefer a maximum 75 chars per line)
#11: 
References: eb8d0f5af4ec ("drm/i915: Remove GPU reset dependence on 
struct_mutex")

-:11: ERROR:GIT_COMMIT_ID: Please use git commit description style 'commit <12+ 
chars of sha1> ("")' - ie: 'commit eb8d0f5af4ec ("drm/i915: Remove 
GPU reset dependence on struct_mutex")'
#11: 
References: eb8d0f5af4ec ("drm/i915: Remove GPU reset dependence on 
struct_mutex")

total: 1 errors, 1 warnings, 0 checks, 328 lines checked
145d0e3ed4ef drm/i915: Flush the execution-callbacks on retiring
78b85c062e30 drm/i915/execlists: Preempt-to-busy
-:1494: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'p_ptr' - possible 
side-effects?
#1494: FILE: drivers/gpu/drm/i915/i915_utils.h:134:
+#define ptr_count_dec(p_ptr) do {  \
+   typeof(p_ptr) __p = (p_ptr);\
+   unsigned long __v = (unsigned long)(*__p);  \
+   *__p = (typeof(*p_ptr))(--__v); \
+} while (0)

-:1500: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'p_ptr' - possible 
side-effects?
#1500: FILE: drivers/gpu/drm/i915/i915_utils.h:140:
+#define ptr_count_inc(p_ptr) do {  \
+   typeof(p_ptr) __p = (p_ptr);\
+   unsigned long __v = (unsigned long)(*__p);  \
+   *__p = (typeof(*p_ptr))(++__v); \
+} while (0)

-:1783: WARNING:LINE_SPACING: Missing a blank line after declarations
#1783: FILE: drivers/gpu/drm/i915/intel_guc_submission.c:820:
+   int rem = ARRAY_SIZE(execlists->inflight) - idx;
+   memmove(execlists->inflight, port, rem * sizeof(*port));

total: 0 errors, 1 warnings, 2 checks, 1682 lines checked
71d1fe05be01 drm/i915/execlists: Minimalistic timeslicing
-:345: WARNING:LONG_LINE: line over 100 characters
#345: FILE: drivers/gpu/drm/i915/gt/selftest_lrc.c:211:
+ 2 * RUNTIME_INFO(outer->i915)->num_engines * 
(count + 2) * (count + 3)) < 0) {

total: 0 errors, 1 warnings, 0 checks, 426 lines checked
40741878cefb drm/i915/execlists: Force preemption
e42940af0600 drm/i915: Make the semaphore saturation mask global
913184b36dae dma-fence: Propagate errors to dma-fence-array container
fbc685fee7cf dma-fence: Report the composite sync_file status
d2298deb220a dma-fence: Refactor signaling for manual invocation
-:33: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does 
MAINTAINERS need updating?
#33: 
new file mode 100644

-:38: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier 
tag in line 1
#38: FILE: drivers/dma-buf/dma-fence-trace.c:1:
+/*

-:293: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier 
tag in line 1
#293: FILE: include/linux/dma-fence-types.h:1:
+/*

-:368: CHECK:UNCOMMENTED_DEFINITION: spinlock_t definition without comment
#368: FILE: include/linux/dma-fence-types.h:76:
+   spinlock_t *lock;

total: 0 errors, 3 warnings, 1 checks, 728 lines checked
fe5ceef08681 dma-fence: Always execute signal callbacks
e6baddc16878 drm/i915: Track i915_active using debugobjects
626786997753 drm/i915: Signal fence completion from i915_request_wait
d80318d1c748 drm/i915: Remove waiting & retiring from shrinker paths
8b858b38bcfc drm/i915: Throw away the active object retirement complexity
c38757f3f210 drm/i915: Provide an i915_active.acquire callback
-:708: CHECK:UNCOMMENTED_DEFINITION: struct mutex definition without comment
#708: FILE: drivers/gpu/drm/i915/i915_active_types.h:36:
+   struct mutex mutex;

total: 0 errors, 0 warnings, 1 checks, 842 lines checked
6b856a93ddbf drm/i915: Push the i915_active.retire into a worker
babae9b85e46 drm/i915/overlay: Switch to using i915_active tracking
295efee4f1d6 drm/i915: Forgo last_fence active request tracking
044650684354 drm/i915: Extract intel_frontbuffer active tracking
1ba725af6d0c drm/i915: Coordinate i915_active with its own mutex
962860b4976d drm/i915: Rename intel_wakeref_[is]_active
b1132180c60a drm/i915: Teach execbuffer to take the engine wakeref not GT
38774404475a drm/i915: Replace struct_mutex for batch pool serialisation
-:304: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does 
MAINTAINERS need updating?
#304: 
new file mode 100644

-:309: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier 
tag in line 1
#309: FILE: drivers/gpu/drm/i915/gt/intel_engine_pool.

[Intel-gfx] [PATCH] drm/i915: Switch to per-crtc vblank vfuncs

2019-06-18 Thread Ville Syrjala
From: Ville Syrjälä 

Switch from the driver-wide vblank vfuncs to the per-crtc ones so that
we don't have so many platform specific vfuncs in the driver struct.

We still need to do something about the rest fo the irq vfuncs...

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/display/intel_display.c | 104 ---
 drivers/gpu/drm/i915/i915_irq.c  |  93 +++--
 drivers/gpu/drm/i915/i915_irq.h  |  14 +++
 3 files changed, 143 insertions(+), 68 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 8d7e4c8b60bc..dc602a8a52fe 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -13556,7 +13556,7 @@ u32 intel_crtc_get_vblank_counter(struct intel_crtc 
*crtc)
if (!vblank->max_vblank_count)
return (u32)drm_crtc_accurate_vblank_count(&crtc->base);
 
-   return dev->driver->get_vblank_counter(dev, crtc->pipe);
+   return crtc->base.funcs->get_vblank_counter(&crtc->base);
 }
 
 static void intel_update_crtc(struct drm_crtc *crtc,
@@ -14094,18 +14094,6 @@ static int intel_atomic_commit(struct drm_device *dev,
return 0;
 }
 
-static const struct drm_crtc_funcs intel_crtc_funcs = {
-   .gamma_set = drm_atomic_helper_legacy_gamma_set,
-   .set_config = drm_atomic_helper_set_config,
-   .destroy = intel_crtc_destroy,
-   .page_flip = drm_atomic_helper_page_flip,
-   .atomic_duplicate_state = intel_crtc_duplicate_state,
-   .atomic_destroy_state = intel_crtc_destroy_state,
-   .set_crc_source = intel_crtc_set_crc_source,
-   .verify_crc_source = intel_crtc_verify_crc_source,
-   .get_crc_sources = intel_crtc_get_crc_sources,
-};
-
 struct wait_rps_boost {
struct wait_queue_entry wait;
 
@@ -14899,8 +14887,76 @@ static void intel_crtc_init_scalers(struct intel_crtc 
*crtc,
scaler_state->scaler_id = -1;
 }
 
+#define INTEL_CRTC_FUNCS \
+   .gamma_set = drm_atomic_helper_legacy_gamma_set, \
+   .set_config = drm_atomic_helper_set_config, \
+   .destroy = intel_crtc_destroy, \
+   .page_flip = drm_atomic_helper_page_flip, \
+   .atomic_duplicate_state = intel_crtc_duplicate_state, \
+   .atomic_destroy_state = intel_crtc_destroy_state, \
+   .set_crc_source = intel_crtc_set_crc_source, \
+   .verify_crc_source = intel_crtc_verify_crc_source, \
+   .get_crc_sources = intel_crtc_get_crc_sources
+
+static const struct drm_crtc_funcs bdw_crtc_funcs = {
+   INTEL_CRTC_FUNCS,
+
+   .get_vblank_counter = g4x_get_vblank_counter,
+   .enable_vblank = bdw_enable_vblank,
+   .disable_vblank = bdw_disable_vblank,
+};
+
+static const struct drm_crtc_funcs ilk_crtc_funcs = {
+   INTEL_CRTC_FUNCS,
+
+   .get_vblank_counter = g4x_get_vblank_counter,
+   .enable_vblank = ilk_enable_vblank,
+   .disable_vblank = ilk_disable_vblank,
+};
+
+static const struct drm_crtc_funcs g4x_crtc_funcs = {
+   INTEL_CRTC_FUNCS,
+
+   .get_vblank_counter = g4x_get_vblank_counter,
+   .enable_vblank = i965_enable_vblank,
+   .disable_vblank = i965_disable_vblank,
+};
+
+static const struct drm_crtc_funcs i965_crtc_funcs = {
+   INTEL_CRTC_FUNCS,
+
+   .get_vblank_counter = i915_get_vblank_counter,
+   .enable_vblank = i965_enable_vblank,
+   .disable_vblank = i965_disable_vblank,
+};
+
+static const struct drm_crtc_funcs i945gm_crtc_funcs = {
+   INTEL_CRTC_FUNCS,
+
+   .get_vblank_counter = i915_get_vblank_counter,
+   .enable_vblank = i945gm_enable_vblank,
+   .disable_vblank = i945gm_disable_vblank,
+};
+
+static const struct drm_crtc_funcs i915_crtc_funcs = {
+   INTEL_CRTC_FUNCS,
+
+   .get_vblank_counter = i915_get_vblank_counter,
+   .enable_vblank = i8xx_enable_vblank,
+   .disable_vblank = i8xx_disable_vblank,
+};
+
+static const struct drm_crtc_funcs i8xx_crtc_funcs = {
+   INTEL_CRTC_FUNCS,
+
+   /* no hw vblank counter */
+   .enable_vblank = i8xx_enable_vblank,
+   .disable_vblank = i8xx_disable_vblank,
+};
+
 static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
 {
+   const struct drm_crtc_funcs *funcs;
struct intel_crtc *intel_crtc;
struct intel_crtc_state *crtc_state = NULL;
struct intel_plane *primary = NULL;
@@ -14944,10 +15000,28 @@ static int intel_crtc_init(struct drm_i915_private 
*dev_priv, enum pipe pipe)
}
intel_crtc->plane_ids_mask |= BIT(cursor->id);
 
+   if (HAS_GMCH(dev_priv)) {
+   if (IS_CHERRYVIEW(dev_priv) ||
+   IS_VALLEYVIEW(dev_priv) || IS_G4X(dev_priv))
+   funcs = &g4x_crtc_funcs;
+   else if (IS_GEN(dev_priv, 4))
+   funcs = &i965_crtc_funcs;
+   else if (IS_I945GM(dev_priv))
+   funcs = &i945gm_crtc_funcs;
+ 

Re: [Intel-gfx] [PATCH 4/6] drm/i915: skip forcewake actions on forcewake-less uncore

2019-06-18 Thread Tvrtko Ursulin


On 17/06/2019 19:09, Daniele Ceraolo Spurio wrote:

We always call some of the setup/cleanup functions for forcewake, even
if the feature is not actually available. Skipping these operations if
forcewake is not available saves us some operations on older gens and
prepares us for having a forcewake-less display uncore.
The suspend/resume functions have also been renamed to clearly indicate
that they only operate on forcewake status.

Signed-off-by: Daniele Ceraolo Spurio 
---
  drivers/gpu/drm/i915/i915_drv.c |  15 +--
  drivers/gpu/drm/i915/intel_uncore.c | 147 +---
  drivers/gpu/drm/i915/intel_uncore.h |   8 +-
  3 files changed, 101 insertions(+), 69 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index d113296cbe34..95b36fe17f99 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -996,7 +996,7 @@ static int i915_driver_init_mmio(struct drm_i915_private 
*dev_priv)
  
  	intel_device_info_init_mmio(dev_priv);
  
-	intel_uncore_prune_mmio_domains(&dev_priv->uncore);

+   intel_uncore_prune_forcewake_domains(&dev_priv->uncore);
  
  	intel_uc_init_mmio(dev_priv);
  
@@ -2152,7 +2152,7 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
  
  	i915_gem_suspend_late(dev_priv);
  
-	intel_uncore_suspend(&dev_priv->uncore);

+   intel_uncore_forcewake_suspend(&dev_priv->uncore);
  
  	intel_power_domains_suspend(dev_priv,

get_suspend_mode(dev_priv, hibernation));
@@ -2348,7 +2348,10 @@ static int i915_drm_resume_early(struct drm_device *dev)
DRM_ERROR("Resume prepare failed: %d, continuing anyway\n",
  ret);
  
-	intel_uncore_resume_early(&dev_priv->uncore);

+   if (intel_uncore_unclaimed_mmio(&dev_priv->uncore))
+   DRM_DEBUG("unclaimed mmio detected on resume, clearing\n");
+


Why does this bit needs to be pulled up to this level? My first line of 
thinking is that we should aim to keep the component specific steps 
down, if possible.



+   intel_uncore_forcewake_resume_early(&dev_priv->uncore);
  
  	i915_check_and_clear_faults(dev_priv);
  
@@ -2923,7 +2926,7 @@ static int intel_runtime_suspend(struct device *kdev)
  
  	intel_runtime_pm_disable_interrupts(dev_priv);
  
-	intel_uncore_suspend(&dev_priv->uncore);

+   intel_uncore_forcewake_suspend(&dev_priv->uncore);
  
  	ret = 0;

if (INTEL_GEN(dev_priv) >= 11) {
@@ -2940,7 +2943,7 @@ static int intel_runtime_suspend(struct device *kdev)
  
  	if (ret) {

DRM_ERROR("Runtime suspend failed, disabling it (%d)\n", ret);
-   intel_uncore_runtime_resume(&dev_priv->uncore);
+   intel_uncore_forcewake_runtime_resume(&dev_priv->uncore);
  
  		intel_runtime_pm_enable_interrupts(dev_priv);
  
@@ -3038,7 +3041,7 @@ static int intel_runtime_resume(struct device *kdev)

ret = vlv_resume_prepare(dev_priv, true);
}
  
-	intel_uncore_runtime_resume(&dev_priv->uncore);

+   intel_uncore_forcewake_runtime_resume(&dev_priv->uncore);
  
  	intel_runtime_pm_enable_interrupts(dev_priv);
  
diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c

index 88a69bf713c9..c0f5567ee096 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -485,12 +485,11 @@ check_for_unclaimed_mmio(struct intel_uncore *uncore)
return ret;
  }
  
-static void __intel_uncore_early_sanitize(struct intel_uncore *uncore,

+static void forcewake_early_sanitize(struct intel_uncore *uncore,
  unsigned int restore_forcewake)
  {
-   /* clear out unclaimed reg detection bit */
-   if (check_for_unclaimed_mmio(uncore))
-   DRM_DEBUG("unclaimed mmio detected on uncore init, clearing\n");
+   if (!intel_uncore_has_forcewake(uncore))
+   return;
  
  	/* WaDisableShadowRegForCpd:chv */

if (IS_CHERRYVIEW(uncore->i915)) {
@@ -513,8 +512,11 @@ static void __intel_uncore_early_sanitize(struct 
intel_uncore *uncore,
iosf_mbi_punit_release();
  }
  
-void intel_uncore_suspend(struct intel_uncore *uncore)

+void intel_uncore_forcewake_suspend(struct intel_uncore *uncore)
  {
+   if (!intel_uncore_has_forcewake(uncore))
+   return;
+
iosf_mbi_punit_acquire();
iosf_mbi_unregister_pmic_bus_access_notifier_unlocked(
&uncore->pmic_bus_access_nb);
@@ -522,18 +524,24 @@ void intel_uncore_suspend(struct intel_uncore *uncore)
iosf_mbi_punit_release();
  }
  
-void intel_uncore_resume_early(struct intel_uncore *uncore)

+void intel_uncore_forcewake_resume_early(struct intel_uncore *uncore)
  {
unsigned int restore_forcewake;
  
+	if (!intel_uncore_has_forcewake(uncore))

+   return;
+
restore_forcewake = fetch_and_zero(&uncore->fw_domains_saved);
-   __intel_

[Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [01/26] drm/i915: Keep engine alive as we retire the context

2019-06-18 Thread Patchwork
== Series Details ==

Series: series starting with [01/26] drm/i915: Keep engine alive as we retire 
the context
URL   : https://patchwork.freedesktop.org/series/62278/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Sparse version: v0.5.2
Commit: drm/i915: Keep engine alive as we retire the context
Okay!

Commit: drm/i915: Skip shrinking already freed pages
Okay!

Commit: drm/i915: Stop passing I915_WAIT_LOCKED to i915_request_wait()
Okay!

Commit: drm/i915: Flush the execution-callbacks on retiring
Okay!

Commit: drm/i915/execlists: Preempt-to-busy
-drivers/gpu/drm/i915/selftests/../i915_utils.h:220:16: warning: expression 
using sizeof(void)
+drivers/gpu/drm/i915/selftests/../i915_utils.h:232:16: warning: expression 
using sizeof(void)

Commit: drm/i915/execlists: Minimalistic timeslicing
+drivers/gpu/drm/i915/gt/intel_lrc.c:876:16: warning: expression using 
sizeof(void)
+drivers/gpu/drm/i915/gt/intel_lrc.c:876:16: warning: expression using 
sizeof(void)

Commit: drm/i915/execlists: Force preemption
+
+drivers/gpu/drm/i915/i915_utils.h:232:16: warning: expression using 
sizeof(void)
+Error in reading or end of file.

Commit: drm/i915: Make the semaphore saturation mask global
Okay!

Commit: dma-fence: Propagate errors to dma-fence-array container
Okay!

Commit: dma-fence: Report the composite sync_file status
Okay!

Commit: dma-fence: Refactor signaling for manual invocation
Okay!

Commit: dma-fence: Always execute signal callbacks
Okay!

Commit: drm/i915: Track i915_active using debugobjects
Okay!

Commit: drm/i915: Signal fence completion from i915_request_wait
Okay!

Commit: drm/i915: Remove waiting & retiring from shrinker paths
Okay!

Commit: drm/i915: Throw away the active object retirement complexity
Okay!

Commit: drm/i915: Provide an i915_active.acquire callback
Okay!

Commit: drm/i915: Push the i915_active.retire into a worker
Okay!

Commit: drm/i915/overlay: Switch to using i915_active tracking
Okay!

Commit: drm/i915: Forgo last_fence active request tracking
Okay!

Commit: drm/i915: Extract intel_frontbuffer active tracking
+drivers/gpu/drm/i915/display/intel_frontbuffer.c:218:13: warning: context 
imbalance in 'frontbuffer_release' - unexpected unlock

Commit: drm/i915: Coordinate i915_active with its own mutex
-./include/uapi/linux/perf_event.h:147:56: warning: cast truncates bits from 
constant value (8000 becomes 0)
-./include/uapi/linux/perf_event.h:147:56: warning: cast truncates bits from 
constant value (8000 becomes 0)
-./include/uapi/linux/perf_event.h:147:56: warning: cast truncates bits from 
constant value (8000 becomes 0)
-./include/uapi/linux/perf_event.h:147:56: warning: cast truncates bits from 
constant value (8000 becomes 0)

Commit: drm/i915: Rename intel_wakeref_[is]_active
Okay!

Commit: drm/i915: Teach execbuffer to take the engine wakeref not GT
Okay!

Commit: drm/i915: Replace struct_mutex for batch pool serialisation
+./include/uapi/linux/perf_event.h:147:56: warning: cast truncates bits from 
constant value (8000 becomes 0)

Commit: drm/i915: Move idle barrier cleanup into engine-pm
Okay!

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

[Intel-gfx] ✓ Fi.CI.IGT: success for Display uncore prep patches

2019-06-18 Thread Patchwork
== Series Details ==

Series: Display uncore prep patches
URL   : https://patchwork.freedesktop.org/series/62232/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6287_full -> Patchwork_13312_full


Summary
---

  **SUCCESS**

  No regressions found.

  

Known issues


  Here are the changes found in Patchwork_13312_full that come from known 
issues:

### IGT changes ###

 Issues hit 

  * igt@gem_eio@in-flight-10ms:
- shard-kbl:  [PASS][1] -> [DMESG-WARN][2] ([fdo#110913 ]) +1 
similar issue
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-kbl3/igt@gem_...@in-flight-10ms.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13312/shard-kbl3/igt@gem_...@in-flight-10ms.html

  * igt@gem_eio@in-flight-internal-immediate:
- shard-apl:  [PASS][3] -> [DMESG-WARN][4] ([fdo#110913 ]) +2 
similar issues
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-apl1/igt@gem_...@in-flight-internal-immediate.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13312/shard-apl8/igt@gem_...@in-flight-internal-immediate.html

  * igt@gem_eio@in-flight-suspend:
- shard-skl:  [PASS][5] -> [FAIL][6] ([fdo#110667])
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-skl2/igt@gem_...@in-flight-suspend.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13312/shard-skl5/igt@gem_...@in-flight-suspend.html
- shard-glk:  [PASS][7] -> [FAIL][8] ([fdo#110667])
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-glk5/igt@gem_...@in-flight-suspend.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13312/shard-glk2/igt@gem_...@in-flight-suspend.html

  * igt@gem_userptr_blits@sync-unmap-cycles:
- shard-snb:  [PASS][9] -> [DMESG-WARN][10] ([fdo#110913 ]) +1 
similar issue
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-snb2/igt@gem_userptr_bl...@sync-unmap-cycles.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13312/shard-snb1/igt@gem_userptr_bl...@sync-unmap-cycles.html

  * igt@i915_suspend@debugfs-reader:
- shard-kbl:  [PASS][11] -> [DMESG-WARN][12] ([fdo#108566])
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-kbl1/igt@i915_susp...@debugfs-reader.html
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13312/shard-kbl6/igt@i915_susp...@debugfs-reader.html

  * igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-spr-indfb-move:
- shard-hsw:  [PASS][13] -> [SKIP][14] ([fdo#109271]) +21 similar 
issues
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-hsw5/igt@kms_frontbuffer_track...@fbc-2p-scndscrn-spr-indfb-move.html
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13312/shard-hsw1/igt@kms_frontbuffer_track...@fbc-2p-scndscrn-spr-indfb-move.html

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-indfb-draw-pwrite:
- shard-iclb: [PASS][15] -> [FAIL][16] ([fdo#103167]) +3 similar 
issues
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-iclb8/igt@kms_frontbuffer_track...@fbcpsr-1p-primscrn-pri-indfb-draw-pwrite.html
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13312/shard-iclb2/igt@kms_frontbuffer_track...@fbcpsr-1p-primscrn-pri-indfb-draw-pwrite.html

  * igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes:
- shard-skl:  [PASS][17] -> [INCOMPLETE][18] ([fdo#104108])
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-skl6/igt@kms_pl...@plane-panning-bottom-right-suspend-pipe-b-planes.html
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13312/shard-skl4/igt@kms_pl...@plane-panning-bottom-right-suspend-pipe-b-planes.html

  * igt@kms_psr@psr2_cursor_render:
- shard-iclb: [PASS][19] -> [SKIP][20] ([fdo#109441])
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-iclb2/igt@kms_psr@psr2_cursor_render.html
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13312/shard-iclb1/igt@kms_psr@psr2_cursor_render.html

  * igt@kms_rotation_crc@multiplane-rotation-cropping-bottom:
- shard-glk:  [PASS][21] -> [DMESG-FAIL][22] ([fdo#105763] / 
[fdo#106538])
   [21]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-glk4/igt@kms_rotation_...@multiplane-rotation-cropping-bottom.html
   [22]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13312/shard-glk6/igt@kms_rotation_...@multiplane-rotation-cropping-bottom.html

  * igt@kms_vblank@pipe-b-ts-continuation-suspend:
- shard-apl:  [PASS][23] -> [DMESG-WARN][24] ([fdo#108566]) +2 
similar issues
   [23]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-apl1/igt@kms_vbl...@pipe-b-ts-continuation-suspend.html
   [24]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13312/shard-apl4/igt@kms_vbl...@pipe-b-ts-continuation-suspend.html

  
#

Re: [Intel-gfx] [PATCH] drm/i915: Check visibility in icl_build_plane_wm

2019-06-18 Thread Maarten Lankhorst
Op 17-06-2019 om 14:34 schreef Ville Syrjälä:
> On Fri, Jun 14, 2019 at 12:39:41PM +0200, Maarten Lankhorst wrote:
>> When a planar YUV plane is configured, but the crtc is
>> marked inactive, we can end up with a linked plane without
>> visibility.
> How is that possible? I don't think we should be adding the slave plane
> if the master is not visible.


DPMS off, we calculate the various fields as if the CRTC is on, then disable 
visibility.

crtc_state->nv12_planes etc still get set, so it works as if the crtc is on.

It's a way of not allowing an invalid result when dpms is off, then breaking on 
crtc enable.

___
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 [01/26] drm/i915: Keep engine alive as we retire the context

2019-06-18 Thread Patchwork
== Series Details ==

Series: series starting with [01/26] drm/i915: Keep engine alive as we retire 
the context
URL   : https://patchwork.freedesktop.org/series/62278/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6290 -> Patchwork_13320


Summary
---

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13320/

Known issues


  Here are the changes found in Patchwork_13320 that come from known issues:

### IGT changes ###

 Issues hit 

  * igt@i915_selftest@live_contexts:
- fi-bdw-gvtdvm:  [PASS][1] -> [DMESG-FAIL][2] ([fdo#110235])
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6290/fi-bdw-gvtdvm/igt@i915_selftest@live_contexts.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13320/fi-bdw-gvtdvm/igt@i915_selftest@live_contexts.html

  * igt@i915_selftest@live_hangcheck:
- fi-icl-dsi: [PASS][3] -> [INCOMPLETE][4] ([fdo#107713] / 
[fdo#108569])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6290/fi-icl-dsi/igt@i915_selftest@live_hangcheck.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13320/fi-icl-dsi/igt@i915_selftest@live_hangcheck.html

  * igt@kms_prop_blob@basic:
- fi-icl-u3:  [PASS][5] -> [DMESG-WARN][6] ([fdo#107724])
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6290/fi-icl-u3/igt@kms_prop_b...@basic.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13320/fi-icl-u3/igt@kms_prop_b...@basic.html

  * igt@prime_vgem@basic-fence-flip:
- fi-ilk-650: [PASS][7] -> [DMESG-WARN][8] ([fdo#106387]) +1 
similar issue
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6290/fi-ilk-650/igt@prime_v...@basic-fence-flip.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13320/fi-ilk-650/igt@prime_v...@basic-fence-flip.html

  
 Possible fixes 

  * igt@gem_ctx_switch@basic-default:
- fi-icl-guc: [INCOMPLETE][9] ([fdo#107713] / [fdo#108569]) -> 
[PASS][10]
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6290/fi-icl-guc/igt@gem_ctx_swi...@basic-default.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13320/fi-icl-guc/igt@gem_ctx_swi...@basic-default.html

  * igt@gem_render_tiled_blits@basic:
- fi-icl-u3:  [DMESG-WARN][11] ([fdo#107724]) -> [PASS][12]
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6290/fi-icl-u3/igt@gem_render_tiled_bl...@basic.html
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13320/fi-icl-u3/igt@gem_render_tiled_bl...@basic.html

  * igt@i915_selftest@live_hangcheck:
- fi-icl-y:   [INCOMPLETE][13] ([fdo#107713] / [fdo#108569]) -> 
[PASS][14]
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6290/fi-icl-y/igt@i915_selftest@live_hangcheck.html
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13320/fi-icl-y/igt@i915_selftest@live_hangcheck.html

  * igt@kms_frontbuffer_tracking@basic:
- fi-hsw-peppy:   [DMESG-WARN][15] ([fdo#102614]) -> [PASS][16]
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6290/fi-hsw-peppy/igt@kms_frontbuffer_track...@basic.html
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13320/fi-hsw-peppy/igt@kms_frontbuffer_track...@basic.html

  
  [fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
  [fdo#106387]: https://bugs.freedesktop.org/show_bug.cgi?id=106387
  [fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
  [fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
  [fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
  [fdo#110235]: https://bugs.freedesktop.org/show_bug.cgi?id=110235


Participating hosts (51 -> 38)
--

  Additional (1): fi-icl-u2 
  Missing(14): fi-kbl-soraka fi-cml-u2 fi-ilk-m540 fi-hsw-4200u 
fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-whl-u fi-kbl-x1275 fi-skl-iommu 
fi-kbl-8809g fi-byt-clapper fi-bdw-samus fi-cml-u 


Build changes
-

  * Linux: CI_DRM_6290 -> Patchwork_13320

  CI_DRM_6290: a0fa10b5d68fd65375029dd8b61d6c8c6aa1413f @ 
git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5059: 1f67ee0d09d6513f487f2be74aae9700e755258a @ 
git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_13320: cc4a2f29f9fe6c49792503fd6b6fdd4b7182783f @ 
git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

cc4a2f29f9fe drm/i915: Move idle barrier cleanup into engine-pm
38774404475a drm/i915: Replace struct_mutex for batch pool serialisation
b1132180c60a drm/i915: Teach execbuffer to take the engine wakeref not GT
962860b4976d drm/i915: Rename intel_wakeref_[is]_active
1ba725af6d0c drm/i915: Coordinate i915_active with its own mutex
044650684354 drm/i915: Extract intel_frontbuffer active tracking
295efee4f1d6 drm/i915: Forgo last_fence active request tracking
babae9b85e46 drm/i915/overlay: Switch to using i915_active tracki

[Intel-gfx] [PATCH 2/2] drm/prime: Update docs

2019-06-18 Thread Daniel Vetter
Yes this is a bit a big patch, but since it's essentially a complete
rewrite of all the prime docs I didn't see how to better split it up.

Changes:
- Consistently point to drm_gem_object_funcs as the preferred hooks,
  where applicable.

- Document all the hooks in &drm_driver that lacked kerneldoc.

- Completely new overview section, which now also includes the cleaned
  up lifetime/reference counting subchapter. I also mentioned the weak
  references in there due to the lookup caches.

- Completely rewritten helper intro section, highlight the
  import/export related functionality.

- Polish for all the functions and more cross references.

I also sprinkled a bunch of todos all over.

Most important: 0 code changes in here. The cleanup motivated by
reading and improving all this will follow later on.

v2: Actually update the prime helper docs. Plus add a few FIXMEs that
I won't address right away in subsequent cleanup patches.

v3:
- Split out the function moving. This patch is now exclusively
  documentation changes.
- Typos and nits (Sam).

Cc: Sam Ravnborg 
Cc: Eric Anholt 
Cc: Emil Velikov 
Signed-off-by: Daniel Vetter 
---
 Documentation/gpu/drm-mm.rst |  40 +--
 drivers/gpu/drm/drm_prime.c  | 197 +--
 include/drm/drm_drv.h| 104 +++---
 include/drm/drm_gem.h|  18 ++--
 4 files changed, 226 insertions(+), 133 deletions(-)

diff --git a/Documentation/gpu/drm-mm.rst b/Documentation/gpu/drm-mm.rst
index c8ebd4f66a6a..b664f054c259 100644
--- a/Documentation/gpu/drm-mm.rst
+++ b/Documentation/gpu/drm-mm.rst
@@ -433,43 +433,11 @@ PRIME is the cross device buffer sharing framework in 
drm, originally
 created for the OPTIMUS range of multi-gpu platforms. To userspace PRIME
 buffers are dma-buf based file descriptors.
 
-Overview and Driver Interface
--
+Overview and Lifetime Rules
+---
 
-Similar to GEM global names, PRIME file descriptors are also used to
-share buffer objects across processes. They offer additional security:
-as file descriptors must be explicitly sent over UNIX domain sockets to
-be shared between applications, they can't be guessed like the globally
-unique GEM names.
-
-Drivers that support the PRIME API must set the DRIVER_PRIME bit in the
-struct :c:type:`struct drm_driver `
-driver_features field, and implement the prime_handle_to_fd and
-prime_fd_to_handle operations.
-
-int (\*prime_handle_to_fd)(struct drm_device \*dev, struct drm_file
-\*file_priv, uint32_t handle, uint32_t flags, int \*prime_fd); int
-(\*prime_fd_to_handle)(struct drm_device \*dev, struct drm_file
-\*file_priv, int prime_fd, uint32_t \*handle); Those two operations
-convert a handle to a PRIME file descriptor and vice versa. Drivers must
-use the kernel dma-buf buffer sharing framework to manage the PRIME file
-descriptors. Similar to the mode setting API PRIME is agnostic to the
-underlying buffer object manager, as long as handles are 32bit unsigned
-integers.
-
-While non-GEM drivers must implement the operations themselves, GEM
-drivers must use the :c:func:`drm_gem_prime_handle_to_fd()` and
-:c:func:`drm_gem_prime_fd_to_handle()` helper functions. Those
-helpers rely on the driver gem_prime_export and gem_prime_import
-operations to create a dma-buf instance from a GEM object (dma-buf
-exporter role) and to create a GEM object from a dma-buf instance
-(dma-buf importer role).
-
-struct dma_buf \* (\*gem_prime_export)(struct drm_device \*dev,
-struct drm_gem_object \*obj, int flags); struct drm_gem_object \*
-(\*gem_prime_import)(struct drm_device \*dev, struct dma_buf
-\*dma_buf); These two operations are mandatory for GEM drivers that
-support PRIME.
+.. kernel-doc:: drivers/gpu/drm/drm_prime.c
+   :doc: overview and lifetime rules
 
 PRIME Helper Functions
 --
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index 68b4de85370c..2234206288fa 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -38,47 +38,53 @@
 
 #include "drm_internal.h"
 
-/*
- * DMA-BUF/GEM Object references and lifetime overview:
- *
- * On the export the dma_buf holds a reference to the exporting GEM
- * object. It takes this reference in handle_to_fd_ioctl, when it
- * first calls .prime_export and stores the exporting GEM object in
- * the dma_buf priv. This reference needs to be released when the
- * final reference to the &dma_buf itself is dropped and its
- * &dma_buf_ops.release function is called. For GEM-based drivers,
- * the dma_buf should be exported using drm_gem_dmabuf_export() and
- * then released by drm_gem_dmabuf_release().
- *
- * On the import the importing GEM object holds a reference to the
- * dma_buf (which in turn holds a ref to the exporting GEM object).
- * It takes that reference in the fd_to_handle ioctl.
- * It calls dma_buf_get, creates an attachment to it and stores the
- * attachment in the GEM object. When this attachmen

Re: [Intel-gfx] [PULL] topic/remove-fbcon-notifiers for v5.3

2019-06-18 Thread Maarten Lankhorst
Op 14-06-2019 om 11:25 schreef Maarten Lankhorst:
> Hi all,
>
> As discussed with Daniel V, I'm just doing the paperwork here as drm-misc 
> maintainer.
>
> This is the topic pull request for the fbdev notifier removal.
>
> Bar, please make a final check and pull into your fbdev tree.
>
> Lee, please make a final check and pull into your backlight tree.
>
> Greg, this is just fyi, you already acked all the vt and staging patches in 
> here
> to land through other trees.
>
> I'll pull this into drm-misc-next once Bart & Lee acked it.
>
> Cheers, Maarten.

Bart, Lee, ping?


> topic/remove-fbcon-notifiers-2019-06-14-1:
> 
> topic/remove-fbcon-notifiers:
> - remove fbdev notifier usage for fbcon, as prep work to clean up the fbcon 
> locking
> - assorted locking checks in vt/console code
> - assorted notifier and cleanups in fbdev and backlight code
>
> The following changes since commit d1fdb6d8f6a4109a4263176c84b899076a5f8008:
>
>   Linux 5.2-rc4 (2019-06-08 20:24:46 -0700)
>
> are available in the Git repository at:
>
>   git://anongit.freedesktop.org/drm/drm-misc 
> tags/topic/remove-fbcon-notifiers-2019-06-14-1
>
> for you to fetch changes up to 1dcff4ae65185e8c0300972f6d8d39d9a9db2bda:
>
>   backlight: simplify lcd notifier (2019-06-13 10:07:20 +0200)
>
> 
> Daniel Vetter (33):
>   dummycon: Sprinkle locking checks
>   fbdev: locking check for fb_set_suspend
>   vt: might_sleep() annotation for do_blank_screen
>   vt: More locking checks
>   fbdev/sa1100fb: Remove dead code
>   fbdev/cyber2000: Remove struct display
>   fbdev/aty128fb: Remove dead code
>   fbcon: s/struct display/struct fbcon_display/
>   fbcon: Remove fbcon_has_exited
>   fbcon: call fbcon_fb_(un)registered directly
>   fbdev/sh_mobile: remove sh_mobile_lcdc_display_notify
>   fbdev/omap: sysfs files can't disappear before the device is gone
>   fbdev: sysfs files can't disappear before the device is gone
>   staging/olpc: lock_fb_info can't fail
>   fbdev/atyfb: lock_fb_info can't fail
>   fbdev: lock_fb_info cannot fail
>   fbcon: call fbcon_fb_bind directly
>   fbdev: make unregister/unlink functions not fail
>   fbdev: unify unlink_framebuffer paths
>   fbdev/sh_mob: Remove fb notifier callback
>   fbdev: directly call fbcon_suspended/resumed
>   fbcon: Call fbcon_mode_deleted/new_modelist directly
>   fbdev: Call fbcon_get_requirement directly
>   Revert "backlight/fbcon: Add FB_EVENT_CONBLANK"
>   fbmem: pull fbcon_fb_blanked out of fb_blank
>   fbdev: remove FBINFO_MISC_USEREVENT around fb_blank
>   fb: Flatten control flow in fb_set_var
>   fbcon: replace FB_EVENT_MODE_CHANGE/_ALL with direct calls
>   vgaswitcheroo: call fbcon_remap_all directly
>   fbcon: Call con2fb_map functions directly
>   fbcon: Document what I learned about fbcon locking
>   staging/olpc_dcon: Add drm conversion to TODO
>   backlight: simplify lcd notifier
>
>  arch/arm/mach-pxa/am200epd.c|  13 +-
>  drivers/gpu/vga/vga_switcheroo.c|  11 +-
>  drivers/media/pci/ivtv/ivtvfb.c |   6 +-
>  drivers/staging/fbtft/fbtft-core.c  |   4 +-
>  drivers/staging/olpc_dcon/TODO  |   7 +
>  drivers/staging/olpc_dcon/olpc_dcon.c   |   6 +-
>  drivers/tty/vt/vt.c |  18 ++
>  drivers/video/backlight/backlight.c |   2 +-
>  drivers/video/backlight/lcd.c   |  12 -
>  drivers/video/console/dummycon.c|   6 +
>  drivers/video/fbdev/aty/aty128fb.c  |  64 
>  drivers/video/fbdev/aty/atyfb_base.c|   3 +-
>  drivers/video/fbdev/core/fbcmap.c   |   6 +-
>  drivers/video/fbdev/core/fbcon.c| 313 ---
>  drivers/video/fbdev/core/fbcon.h|   6 +-
>  drivers/video/fbdev/core/fbmem.c| 399 
> +---
>  drivers/video/fbdev/core/fbsysfs.c  |  20 +-
>  drivers/video/fbdev/cyber2000fb.c   |   1 -
>  drivers/video/fbdev/neofb.c |   9 +-
>  drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c |  21 +-
>  drivers/video/fbdev/sa1100fb.c  |  25 --
>  drivers/video/fbdev/savage/savagefb_driver.c|   9 +-
>  drivers/video/fbdev/sh_mobile_lcdcfb.c  | 132 +---
>  drivers/video/fbdev/sh_mobile_lcdcfb.h  |   5 -
>  include/linux/console_struct.h  |   5 +-
>  include/linux/fb.h  |  45 +--
>  include/linux/fbcon.h   |  30 ++
>  27 files changed, 396 insertions(+), 782 deletions(-)


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

[Intel-gfx] [PATCH 1/2] drm/prime: Shuffle functions.

2019-06-18 Thread Daniel Vetter
Reorder all the functions in drm_prime.[hc] into three groups: core,
export helpers, import helpers.

Not other changes beyond moving the functions and their unchanged
kerneldoc around in here.

Cc: Sam Ravnborg 
Cc: Eric Anholt 
Cc: Emil Velikov 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_prime.c | 770 ++--
 include/drm/drm_prime.h |  42 +-
 2 files changed, 409 insertions(+), 403 deletions(-)

diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index d0c01318076b..68b4de85370c 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -181,42 +181,6 @@ static int drm_prime_lookup_buf_handle(struct 
drm_prime_file_private *prime_fpri
return -ENOENT;
 }
 
-/**
- * drm_gem_map_attach - dma_buf attach implementation for GEM
- * @dma_buf: buffer to attach device to
- * @attach: buffer attachment data
- *
- * Calls &drm_driver.gem_prime_pin for device specific handling. This can be
- * used as the &dma_buf_ops.attach callback.
- *
- * Returns 0 on success, negative error code on failure.
- */
-int drm_gem_map_attach(struct dma_buf *dma_buf,
-  struct dma_buf_attachment *attach)
-{
-   struct drm_gem_object *obj = dma_buf->priv;
-
-   return drm_gem_pin(obj);
-}
-EXPORT_SYMBOL(drm_gem_map_attach);
-
-/**
- * drm_gem_map_detach - dma_buf detach implementation for GEM
- * @dma_buf: buffer to detach from
- * @attach: attachment to be detached
- *
- * Cleans up &dma_buf_attachment. This can be used as the &dma_buf_ops.detach
- * callback.
- */
-void drm_gem_map_detach(struct dma_buf *dma_buf,
-   struct dma_buf_attachment *attach)
-{
-   struct drm_gem_object *obj = dma_buf->priv;
-
-   drm_gem_unpin(obj);
-}
-EXPORT_SYMBOL(drm_gem_map_detach);
-
 void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private 
*prime_fpriv,
struct dma_buf *dma_buf)
 {
@@ -242,64 +206,18 @@ void drm_prime_remove_buf_handle_locked(struct 
drm_prime_file_private *prime_fpr
}
 }
 
-/**
- * drm_gem_map_dma_buf - map_dma_buf implementation for GEM
- * @attach: attachment whose scatterlist is to be returned
- * @dir: direction of DMA transfer
- *
- * Calls &drm_driver.gem_prime_get_sg_table and then maps the scatterlist. This
- * can be used as the &dma_buf_ops.map_dma_buf callback.
- *
- * Returns sg_table containing the scatterlist to be returned; returns ERR_PTR
- * on error. May return -EINTR if it is interrupted by a signal.
- */
-
-struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach,
-enum dma_data_direction dir)
+void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv)
 {
-   struct drm_gem_object *obj = attach->dmabuf->priv;
-   struct sg_table *sgt;
-
-   if (WARN_ON(dir == DMA_NONE))
-   return ERR_PTR(-EINVAL);
-
-   if (obj->funcs)
-   sgt = obj->funcs->get_sg_table(obj);
-   else
-   sgt = obj->dev->driver->gem_prime_get_sg_table(obj);
-
-   if (!dma_map_sg_attrs(attach->dev, sgt->sgl, sgt->nents, dir,
- DMA_ATTR_SKIP_CPU_SYNC)) {
-   sg_free_table(sgt);
-   kfree(sgt);
-   sgt = ERR_PTR(-ENOMEM);
-   }
-
-   return sgt;
+   mutex_init(&prime_fpriv->lock);
+   prime_fpriv->dmabufs = RB_ROOT;
+   prime_fpriv->handles = RB_ROOT;
 }
-EXPORT_SYMBOL(drm_gem_map_dma_buf);
 
-/**
- * drm_gem_unmap_dma_buf - unmap_dma_buf implementation for GEM
- * @attach: attachment to unmap buffer from
- * @sgt: scatterlist info of the buffer to unmap
- * @dir: direction of DMA transfer
- *
- * This can be used as the &dma_buf_ops.unmap_dma_buf callback.
- */
-void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach,
-  struct sg_table *sgt,
-  enum dma_data_direction dir)
+void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv)
 {
-   if (!sgt)
-   return;
-
-   dma_unmap_sg_attrs(attach->dev, sgt->sgl, sgt->nents, dir,
-  DMA_ATTR_SKIP_CPU_SYNC);
-   sg_free_table(sgt);
-   kfree(sgt);
+   /* by now drm_gem_release should've made sure the list is empty */
+   WARN_ON(!RB_EMPTY_ROOT(&prime_fpriv->dmabufs));
 }
-EXPORT_SYMBOL(drm_gem_unmap_dma_buf);
 
 /**
  * drm_gem_dmabuf_export - dma_buf export implementation for GEM
@@ -351,128 +269,101 @@ void drm_gem_dmabuf_release(struct dma_buf *dma_buf)
 EXPORT_SYMBOL(drm_gem_dmabuf_release);
 
 /**
- * drm_gem_dmabuf_vmap - dma_buf vmap implementation for GEM
- * @dma_buf: buffer to be mapped
- *
- * Sets up a kernel virtual mapping. This can be used as the &dma_buf_ops.vmap
- * callback.
+ * drm_gem_prime_fd_to_handle - PRIME import function for GEM drivers
+ * @dev: dev to export the buffer from
+ * @file_priv: drm file-private structure
+ * @prime_fd:

Re: [Intel-gfx] [PATCH 5/6] drm/i915: dynamically allocate forcewake domains

2019-06-18 Thread Tvrtko Ursulin


On 17/06/2019 19:09, Daniele Ceraolo Spurio wrote:

We'd like to introduce a display uncore with no forcewake domains, so
let's avoid wasting memory and be ready to allocate only what we need.
Even without multiple uncore, we still don't need all the domains on all
gens.


Looks good in principle, only a few conversation points below.



Signed-off-by: Daniele Ceraolo Spurio 
---
  drivers/gpu/drm/i915/intel_uncore.c | 155 ++--
  drivers/gpu/drm/i915/intel_uncore.h |  13 +--
  2 files changed, 102 insertions(+), 66 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_uncore.c 
b/drivers/gpu/drm/i915/intel_uncore.c
index c0f5567ee096..7f311827c3ef 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -344,7 +344,7 @@ intel_uncore_fw_release_timer(struct hrtimer *timer)
  {
struct intel_uncore_forcewake_domain *domain =
   container_of(timer, struct intel_uncore_forcewake_domain, timer);
-   struct intel_uncore *uncore = forcewake_domain_to_uncore(domain);
+   struct intel_uncore *uncore = domain->uncore;
unsigned long irqflags;
  
  	assert_rpm_device_not_suspended(uncore->rpm);

@@ -1291,23 +1291,23 @@ do { \
(uncore)->funcs.read_fw_domains = x##_reg_read_fw_domains; \
  } while (0)
  
-static void fw_domain_init(struct intel_uncore *uncore,

+static int fw_domain_init(struct intel_uncore *uncore,
   enum forcewake_domain_id domain_id,
   i915_reg_t reg_set,
   i915_reg_t reg_ack)
  {
struct intel_uncore_forcewake_domain *d;
  
-	if (WARN_ON(domain_id >= FW_DOMAIN_ID_COUNT))

-   return;
-
-   d = &uncore->fw_domain[domain_id];
+   GEM_BUG_ON(domain_id >= FW_DOMAIN_ID_COUNT);
  
-	WARN_ON(d->wake_count);


I wonder what was this for.

Do you want to add some protection against double init of the same domain?


+   d = kzalloc(sizeof(*d), GFP_KERNEL);
+   if (!d)
+   return -ENOMEM;
  
  	WARN_ON(!i915_mmio_reg_valid(reg_set));

WARN_ON(!i915_mmio_reg_valid(reg_ack));
  
+	d->uncore = uncore;

d->wake_count = 0;
d->reg_set = uncore->regs + i915_mmio_reg_offset(reg_set);
d->reg_ack = uncore->regs + i915_mmio_reg_offset(reg_ack);
@@ -1324,7 +1324,6 @@ static void fw_domain_init(struct intel_uncore *uncore,
BUILD_BUG_ON(FORCEWAKE_MEDIA_VEBOX0 != (1 << 
FW_DOMAIN_ID_MEDIA_VEBOX0));
BUILD_BUG_ON(FORCEWAKE_MEDIA_VEBOX1 != (1 << 
FW_DOMAIN_ID_MEDIA_VEBOX1));
  
-

d->mask = BIT(domain_id);
  
  	hrtimer_init(&d->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);

@@ -1333,6 +1332,10 @@ static void fw_domain_init(struct intel_uncore *uncore,
uncore->fw_domains |= BIT(domain_id);
  
  	fw_domain_reset(d);

+
+   uncore->fw_domain[domain_id] = d;
+
+   return 0;
  }
  
  static void fw_domain_fini(struct intel_uncore *uncore,

@@ -1340,77 +1343,92 @@ static void fw_domain_fini(struct intel_uncore *uncore,
  {
struct intel_uncore_forcewake_domain *d;
  
-	if (WARN_ON(domain_id >= FW_DOMAIN_ID_COUNT))

-   return;
+   GEM_BUG_ON(domain_id >= FW_DOMAIN_ID_COUNT);
  
-	d = &uncore->fw_domain[domain_id];

+   d = fetch_and_zero(&uncore->fw_domain[domain_id]);


Maybe early if !d here and function flow just carries on?


+   uncore->fw_domains &= ~BIT(domain_id);
  
-	WARN_ON(d->wake_count);

-   WARN_ON(hrtimer_cancel(&d->timer));
-   memset(d, 0, sizeof(*d));
+   if (d) {
+   WARN_ON(d->wake_count);
+   WARN_ON(hrtimer_cancel(&d->timer));
+   kfree(d);
+   }
+}
  
-	uncore->fw_domains &= ~BIT(domain_id);

+static void intel_uncore_fw_domains_fini(struct intel_uncore *uncore)
+{
+   struct intel_uncore_forcewake_domain *d;
+   int tmp;
+
+   for_each_fw_domain(d, uncore, tmp)
+   fw_domain_fini(uncore, d->id);
  }
  
-static void intel_uncore_fw_domains_init(struct intel_uncore *uncore)

+static int intel_uncore_fw_domains_init(struct intel_uncore *uncore)
  {
struct drm_i915_private *i915 = uncore->i915;
+   int ret;
  
  	GEM_BUG_ON(!intel_uncore_has_forcewake(uncore));
  
+#define __fw_domain_init(id__, set__, ack__) \

+   ret = fw_domain_init(uncore, (id__), (set__), (ack__)); \
+   if (ret) \
+   goto out_clean;


Hidden control flow is slightly objectionable but I don't offer any nice 
alternatives so I guess will have to pass. Or maybe accumulate the error 
(err |= fw_domain_init(..)) as you go and then cleanup at the end if any 
failed?


On the other hand the idea slightly conflicts with my other suggestion 
to rename existing fw_domain_init to __fw_domain_init and call the macro 
fw_domain_init and avoid all the churn below.



+
if (INTEL_GEN(i915) >= 11) {
int i;
  
-		uncore->funcs.force_wake_get =

-   fw_domains_get_with_fallback;
+

[Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915: Switch to per-crtc vblank vfuncs

2019-06-18 Thread Patchwork
== Series Details ==

Series: drm/i915: Switch to per-crtc vblank vfuncs
URL   : https://patchwork.freedesktop.org/series/62287/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Sparse version: v0.5.2
Commit: drm/i915: Switch to per-crtc vblank vfuncs
+drivers/gpu/drm/i915/i915_irq.c:3385:6: warning: symbol 
'i945gm_vblank_work_func' was not declared. Should it be static?

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

Re: [Intel-gfx] [PATCH 20/59] drm/meson: Drop drm_gem_prime_export/import

2019-06-18 Thread Neil Armstrong
On 14/06/2019 22:35, Daniel Vetter wrote:
> They're the default.
> 
> Aside: Would be really nice to switch the others over to
> drm_gem_object_funcs.

Yep, adding this to my infinite TODO list

> 
> Signed-off-by: Daniel Vetter 
> Cc: Neil Armstrong 
> Cc: Kevin Hilman 
> Cc: linux-amlo...@lists.infradead.org
> Cc: linux-arm-ker...@lists.infradead.org
> ---
>  drivers/gpu/drm/meson/meson_drv.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/meson/meson_drv.c 
> b/drivers/gpu/drm/meson/meson_drv.c
> index 140363f93575..37dca83d6eb1 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -101,8 +101,6 @@ static struct drm_driver meson_driver = {
>   /* PRIME Ops */
>   .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>   .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
> - .gem_prime_import   = drm_gem_prime_import,
> - .gem_prime_export   = drm_gem_prime_export,
>   .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
>   .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
>   .gem_prime_vmap = drm_gem_cma_prime_vmap,
> 

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

[Intel-gfx] [PATCH] drm/i915/blt: Remove recursive vma->lock

2019-06-18 Thread Chris Wilson
As we have already plugged the w->dma into the reservation_object, and
have set ourselves up to automatically signal the request and w->dma on
completion, we do not need to export the rq->fence directly and just use
the w->dma fence.

This avoids having to take the reservation_lock inside the worker which
cross-release lockdep would complain about. :)

Signed-off-by: Chris Wilson 
Cc: Matthew Auld 
---
Patch based on the i915_active overhaul, but on the face of it should be
safe without. But let's pretend it does need the overhaul as this is one
of the motivations :)
-Chris
---
 drivers/gpu/drm/i915/gem/i915_gem_client_blt.c| 10 ++
 .../gpu/drm/i915/gem/selftests/i915_gem_client_blt.c  | 11 ---
 2 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_client_blt.c 
b/drivers/gpu/drm/i915/gem/i915_gem_client_blt.c
index f253ec5765ad..83b5c5d13b93 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_client_blt.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_client_blt.c
@@ -193,10 +193,12 @@ static void clear_pages_worker(struct work_struct *work)
goto out_request;
}
 
-   /* XXX: more feverish nightmares await */
-   i915_vma_lock(vma);
-   err = i915_vma_move_to_active(vma, rq, EXEC_OBJECT_WRITE);
-   i915_vma_unlock(vma);
+   /*
+* w->dma is already exported via (vma|obj)->resv we need only
+* keep track of the GPU activity within this vma/request, and
+* propagate the signal from the request to w->dma.
+*/
+   err = i915_active_ref(&vma->active, rq->fence.context, &rq->fence);
if (err)
goto out_request;
 
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_client_blt.c 
b/drivers/gpu/drm/i915/gem/selftests/i915_gem_client_blt.c
index f3a5eb807c1c..855481252bda 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_client_blt.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_client_blt.c
@@ -63,17 +63,6 @@ static int igt_client_fill(void *arg)
if (err)
goto err_unpin;
 
-   /*
-* XXX: For now do the wait without the object resv lock to
-* ensure we don't deadlock.
-*/
-   err = i915_gem_object_wait(obj,
-  I915_WAIT_INTERRUPTIBLE |
-  I915_WAIT_ALL,
-  MAX_SCHEDULE_TIMEOUT);
-   if (err)
-   goto err_unpin;
-
i915_gem_object_lock(obj);
err = i915_gem_object_set_to_cpu_domain(obj, false);
i915_gem_object_unlock(obj);
-- 
2.20.1

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

Re: [Intel-gfx] [PATCH 30/59] drm/stm: Drop drm_gem_prime_export/import

2019-06-18 Thread Philippe CORNU
Hi Daniel,

Acked-by: Philippe Cornu 

We will have a look to simplify this part of the code.

Thank you for your patch.

Philippe :-)

On 6/14/19 10:35 PM, Daniel Vetter wrote:
> They're the default.
> 
> Aside: Would be really nice to switch the others over to
> drm_gem_object_funcs.
> 
> Signed-off-by: Daniel Vetter 
> Cc: Yannick Fertre 
> Cc: Philippe Cornu 
> Cc: Benjamin Gaignard 
> Cc: Vincent Abriou 
> Cc: Maxime Coquelin 
> Cc: Alexandre Torgue 
> Cc: linux-st...@st-md-mailman.stormreply.com
> Cc: linux-arm-ker...@lists.infradead.org
> ---
>   drivers/gpu/drm/stm/drv.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
> index 4026c33ccc39..331f5e8d779b 100644
> --- a/drivers/gpu/drm/stm/drv.c
> +++ b/drivers/gpu/drm/stm/drv.c
> @@ -67,8 +67,6 @@ static struct drm_driver drv_driver = {
>   .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
>   .gem_free_object_unlocked = drm_gem_cma_free_object,
>   .gem_vm_ops = &drm_gem_cma_vm_ops,
> - .gem_prime_export = drm_gem_prime_export,
> - .gem_prime_import = drm_gem_prime_import,
>   .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
>   .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
>   .gem_prime_vmap = drm_gem_cma_prime_vmap,
> 
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Intel-gfx] ✗ Fi.CI.BAT: failure for prime doc polish and ... a few cleanups (rev4)

2019-06-18 Thread Patchwork
== Series Details ==

Series: prime doc polish and ... a few cleanups (rev4)
URL   : https://patchwork.freedesktop.org/series/62135/
State : failure

== Summary ==

Applying: drm/todo: Improve drm_gem_object funcs todo
Using index info to reconstruct a base tree...
M   Documentation/gpu/todo.rst
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: drm/gem: Unexport drm_gem_(un)pin/v(un)map
Using index info to reconstruct a base tree...
M   drivers/gpu/drm/drm_gem.c
M   drivers/gpu/drm/drm_internal.h
M   include/drm/drm_gem.h
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: drm/prime: Update docs
error: sha1 information is lacking or useless (drivers/gpu/drm/drm_prime.c).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch' to see the failed patch
Patch failed at 0003 drm/prime: Update docs
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

___
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: Switch to per-crtc vblank vfuncs

2019-06-18 Thread Patchwork
== Series Details ==

Series: drm/i915: Switch to per-crtc vblank vfuncs
URL   : https://patchwork.freedesktop.org/series/62287/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6290 -> Patchwork_13321


Summary
---

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13321/

Known issues


  Here are the changes found in Patchwork_13321 that come from known issues:

### IGT changes ###

 Issues hit 

  * igt@gem_basic@bad-close:
- fi-icl-u3:  [PASS][1] -> [DMESG-WARN][2] ([fdo#107724])
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6290/fi-icl-u3/igt@gem_ba...@bad-close.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13321/fi-icl-u3/igt@gem_ba...@bad-close.html

  * igt@gem_ctx_switch@basic-default:
- fi-icl-y:   [PASS][3] -> [INCOMPLETE][4] ([fdo#107713] / 
[fdo#108569])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6290/fi-icl-y/igt@gem_ctx_swi...@basic-default.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13321/fi-icl-y/igt@gem_ctx_swi...@basic-default.html

  
 Possible fixes 

  * igt@gem_render_tiled_blits@basic:
- fi-icl-u3:  [DMESG-WARN][5] ([fdo#107724]) -> [PASS][6]
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6290/fi-icl-u3/igt@gem_render_tiled_bl...@basic.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13321/fi-icl-u3/igt@gem_render_tiled_bl...@basic.html

  * igt@kms_frontbuffer_tracking@basic:
- fi-hsw-peppy:   [DMESG-WARN][7] ([fdo#102614]) -> [PASS][8]
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6290/fi-hsw-peppy/igt@kms_frontbuffer_track...@basic.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13321/fi-hsw-peppy/igt@kms_frontbuffer_track...@basic.html

  
  [fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
  [fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
  [fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
  [fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569


Participating hosts (51 -> 38)
--

  Additional (1): fi-icl-u2 
  Missing(14): fi-kbl-soraka fi-cml-u2 fi-ilk-m540 fi-hsw-4200u 
fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-whl-u fi-kbl-x1275 fi-skl-iommu 
fi-kbl-8809g fi-byt-clapper fi-bdw-samus fi-cml-u 


Build changes
-

  * Linux: CI_DRM_6290 -> Patchwork_13321

  CI_DRM_6290: a0fa10b5d68fd65375029dd8b61d6c8c6aa1413f @ 
git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5059: 1f67ee0d09d6513f487f2be74aae9700e755258a @ 
git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_13321: 0bb011a0f3818ba3df011187e2883ec6380c6882 @ 
git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

0bb011a0f381 drm/i915: Switch to per-crtc vblank vfuncs

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13321/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/blt: Remove recursive vma->lock

2019-06-18 Thread Patchwork
== Series Details ==

Series: drm/i915/blt: Remove recursive vma->lock
URL   : https://patchwork.freedesktop.org/series/62290/
State : failure

== Summary ==

CALLscripts/checksyscalls.sh
  CALLscripts/atomic/check-atomics.sh
  DESCEND  objtool
  CHK include/generated/compile.h
  AR  drivers/gpu/drm/i915/built-in.a
  CC [M]  drivers/gpu/drm/i915/header_test_i915_active_types.o
  CC [M]  drivers/gpu/drm/i915/header_test_i915_debugfs.o
  CC [M]  drivers/gpu/drm/i915/header_test_i915_drv.o
  CC [M]  drivers/gpu/drm/i915/header_test_i915_irq.o
  CC [M]  drivers/gpu/drm/i915/header_test_i915_params.o
  CC [M]  drivers/gpu/drm/i915/header_test_i915_priolist_types.o
  CC [M]  drivers/gpu/drm/i915/header_test_i915_reg.o
  CC [M]  drivers/gpu/drm/i915/header_test_i915_scheduler_types.o
  CC [M]  drivers/gpu/drm/i915/header_test_i915_timeline_types.o
  CC [M]  drivers/gpu/drm/i915/header_test_i915_utils.o
  CC [M]  drivers/gpu/drm/i915/header_test_intel_csr.o
  CC [M]  drivers/gpu/drm/i915/header_test_intel_drv.o
  CC [M]  drivers/gpu/drm/i915/header_test_intel_pm.o
  CC [M]  drivers/gpu/drm/i915/header_test_intel_runtime_pm.o
  CC [M]  drivers/gpu/drm/i915/header_test_intel_sideband.o
  CC [M]  drivers/gpu/drm/i915/header_test_intel_uncore.o
  CC [M]  drivers/gpu/drm/i915/header_test_intel_wakeref.o
  CC [M]  drivers/gpu/drm/i915/gem/i915_gem_client_blt.o
drivers/gpu/drm/i915/gem/i915_gem_client_blt.c: In function 
‘clear_pages_worker’:
drivers/gpu/drm/i915/gem/i915_gem_client_blt.c:201:57: error: passing argument 
3 of ‘i915_active_ref’ from incompatible pointer type 
[-Werror=incompatible-pointer-types]
  err = i915_active_ref(&vma->active, rq->fence.context, &rq->fence);
 ^
In file included from drivers/gpu/drm/i915/gem/i915_gem_object_types.h:14:0,
 from drivers/gpu/drm/i915/gem/i915_gem_object.h:16,
 from drivers/gpu/drm/i915/display/intel_frontbuffer.h:27,
 from drivers/gpu/drm/i915/i915_drv.h:70,
 from drivers/gpu/drm/i915/intel_drv.h:45,
 from drivers/gpu/drm/i915/gem/i915_gem_client_blt.c:8:
drivers/gpu/drm/i915/i915_active.h:376:5: note: expected ‘struct i915_request 
*’ but argument is of type ‘struct dma_fence *’
 int i915_active_ref(struct i915_active *ref,
 ^~~
cc1: all warnings being treated as errors
scripts/Makefile.build:278: recipe for target 
'drivers/gpu/drm/i915/gem/i915_gem_client_blt.o' failed
make[4]: *** [drivers/gpu/drm/i915/gem/i915_gem_client_blt.o] Error 1
scripts/Makefile.build:489: recipe for target 'drivers/gpu/drm/i915' failed
make[3]: *** [drivers/gpu/drm/i915] Error 2
scripts/Makefile.build:489: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:489: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:1071: 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

Re: [Intel-gfx] [PULL] topic/remove-fbcon-notifiers for v5.3

2019-06-18 Thread Lee Jones
On Tue, 18 Jun 2019, Maarten Lankhorst wrote:

> Op 14-06-2019 om 11:25 schreef Maarten Lankhorst:
> > Hi all,
> >
> > As discussed with Daniel V, I'm just doing the paperwork here as drm-misc 
> > maintainer.
> >
> > This is the topic pull request for the fbdev notifier removal.
> >
> > Bar, please make a final check and pull into your fbdev tree.
> >
> > Lee, please make a final check and pull into your backlight tree.
> >
> > Greg, this is just fyi, you already acked all the vt and staging patches in 
> > here
> > to land through other trees.
> >
> > I'll pull this into drm-misc-next once Bart & Lee acked it.
> >
> > Cheers, Maarten.
> 
> Bart, Lee, ping?

Asking for an Ack on a PR is kind of odd.  If you have all of the
patch Acks you need, and you've made the PR has small as possible,
then you should be good to go.

My plan is to see if any of this collides with my PR to Linus.  If it
doesn't then I may not have to pull it in at all.

> > topic/remove-fbcon-notifiers-2019-06-14-1:
> > 
> > topic/remove-fbcon-notifiers:
> > - remove fbdev notifier usage for fbcon, as prep work to clean up the fbcon 
> > locking
> > - assorted locking checks in vt/console code
> > - assorted notifier and cleanups in fbdev and backlight code
> >
> > The following changes since commit d1fdb6d8f6a4109a4263176c84b899076a5f8008:
> >
> >   Linux 5.2-rc4 (2019-06-08 20:24:46 -0700)
> >
> > are available in the Git repository at:
> >
> >   git://anongit.freedesktop.org/drm/drm-misc 
> > tags/topic/remove-fbcon-notifiers-2019-06-14-1
> >
> > for you to fetch changes up to 1dcff4ae65185e8c0300972f6d8d39d9a9db2bda:
> >
> >   backlight: simplify lcd notifier (2019-06-13 10:07:20 +0200)
> >
> > 
> > Daniel Vetter (33):
> >   dummycon: Sprinkle locking checks
> >   fbdev: locking check for fb_set_suspend
> >   vt: might_sleep() annotation for do_blank_screen
> >   vt: More locking checks
> >   fbdev/sa1100fb: Remove dead code
> >   fbdev/cyber2000: Remove struct display
> >   fbdev/aty128fb: Remove dead code
> >   fbcon: s/struct display/struct fbcon_display/
> >   fbcon: Remove fbcon_has_exited
> >   fbcon: call fbcon_fb_(un)registered directly
> >   fbdev/sh_mobile: remove sh_mobile_lcdc_display_notify
> >   fbdev/omap: sysfs files can't disappear before the device is gone
> >   fbdev: sysfs files can't disappear before the device is gone
> >   staging/olpc: lock_fb_info can't fail
> >   fbdev/atyfb: lock_fb_info can't fail
> >   fbdev: lock_fb_info cannot fail
> >   fbcon: call fbcon_fb_bind directly
> >   fbdev: make unregister/unlink functions not fail
> >   fbdev: unify unlink_framebuffer paths
> >   fbdev/sh_mob: Remove fb notifier callback
> >   fbdev: directly call fbcon_suspended/resumed
> >   fbcon: Call fbcon_mode_deleted/new_modelist directly
> >   fbdev: Call fbcon_get_requirement directly
> >   Revert "backlight/fbcon: Add FB_EVENT_CONBLANK"
> >   fbmem: pull fbcon_fb_blanked out of fb_blank
> >   fbdev: remove FBINFO_MISC_USEREVENT around fb_blank
> >   fb: Flatten control flow in fb_set_var
> >   fbcon: replace FB_EVENT_MODE_CHANGE/_ALL with direct calls
> >   vgaswitcheroo: call fbcon_remap_all directly
> >   fbcon: Call con2fb_map functions directly
> >   fbcon: Document what I learned about fbcon locking
> >   staging/olpc_dcon: Add drm conversion to TODO
> >   backlight: simplify lcd notifier
> >
> >  arch/arm/mach-pxa/am200epd.c|  13 +-
> >  drivers/gpu/vga/vga_switcheroo.c|  11 +-
> >  drivers/media/pci/ivtv/ivtvfb.c |   6 +-
> >  drivers/staging/fbtft/fbtft-core.c  |   4 +-
> >  drivers/staging/olpc_dcon/TODO  |   7 +
> >  drivers/staging/olpc_dcon/olpc_dcon.c   |   6 +-
> >  drivers/tty/vt/vt.c |  18 ++
> >  drivers/video/backlight/backlight.c |   2 +-
> >  drivers/video/backlight/lcd.c   |  12 -
> >  drivers/video/console/dummycon.c|   6 +
> >  drivers/video/fbdev/aty/aty128fb.c  |  64 
> >  drivers/video/fbdev/aty/atyfb_base.c|   3 +-
> >  drivers/video/fbdev/core/fbcmap.c   |   6 +-
> >  drivers/video/fbdev/core/fbcon.c| 313 ---
> >  drivers/video/fbdev/core/fbcon.h|   6 +-
> >  drivers/video/fbdev/core/fbmem.c| 399 
> > +---
> >  drivers/video/fbdev/core/fbsysfs.c  |  20 +-
> >  drivers/video/fbdev/cyber2000fb.c   |   1 -
> >  drivers/video/fbdev/neofb.c |   9 +-
> >  drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c |  21 +-
> >  drivers/video/fbdev/sa1100fb.c  |  25 --
> >  drivers/video/fbdev/savage/savagefb_dri

[Intel-gfx] ✓ Fi.CI.IGT: success for drm/rcar-du: Fix error check when retrieving crtc state

2019-06-18 Thread Patchwork
== Series Details ==

Series: drm/rcar-du: Fix error check when retrieving crtc state
URL   : https://patchwork.freedesktop.org/series/62234/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6287_full -> Patchwork_13314_full


Summary
---

  **SUCCESS**

  No regressions found.

  

Known issues


  Here are the changes found in Patchwork_13314_full that come from known 
issues:

### IGT changes ###

 Issues hit 

  * igt@gem_softpin@noreloc-s3:
- shard-skl:  [PASS][1] -> [INCOMPLETE][2] ([fdo#104108]) +1 
similar issue
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-skl8/igt@gem_soft...@noreloc-s3.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13314/shard-skl4/igt@gem_soft...@noreloc-s3.html

  * igt@gem_userptr_blits@map-fixed-invalidate-busy:
- shard-snb:  [PASS][3] -> [DMESG-WARN][4] ([fdo#110913 ]) +1 
similar issue
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-snb5/igt@gem_userptr_bl...@map-fixed-invalidate-busy.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13314/shard-snb5/igt@gem_userptr_bl...@map-fixed-invalidate-busy.html
- shard-kbl:  [PASS][5] -> [DMESG-WARN][6] ([fdo#110913 ]) +2 
similar issues
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-kbl7/igt@gem_userptr_bl...@map-fixed-invalidate-busy.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13314/shard-kbl3/igt@gem_userptr_bl...@map-fixed-invalidate-busy.html

  * igt@i915_selftest@live_evict:
- shard-kbl:  [PASS][7] -> [INCOMPLETE][8] ([fdo#103665] / 
[fdo#110938])
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-kbl2/igt@i915_selftest@live_evict.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13314/shard-kbl3/igt@i915_selftest@live_evict.html

  * igt@i915_selftest@live_hangcheck:
- shard-iclb: [PASS][9] -> [INCOMPLETE][10] ([fdo#107713] / 
[fdo#108569])
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-iclb4/igt@i915_selftest@live_hangcheck.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13314/shard-iclb1/igt@i915_selftest@live_hangcheck.html

  * igt@kms_cursor_crc@pipe-c-cursor-suspend:
- shard-apl:  [PASS][11] -> [DMESG-WARN][12] ([fdo#108566]) +5 
similar issues
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-apl6/igt@kms_cursor_...@pipe-c-cursor-suspend.html
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13314/shard-apl8/igt@kms_cursor_...@pipe-c-cursor-suspend.html

  * igt@kms_flip@flip-vs-expired-vblank-interruptible:
- shard-glk:  [PASS][13] -> [FAIL][14] ([fdo#102887] / [fdo#105363])
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-glk2/igt@kms_f...@flip-vs-expired-vblank-interruptible.html
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13314/shard-glk1/igt@kms_f...@flip-vs-expired-vblank-interruptible.html

  * igt@kms_flip@flip-vs-suspend-interruptible:
- shard-kbl:  [PASS][15] -> [DMESG-WARN][16] ([fdo#108566])
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-kbl4/igt@kms_f...@flip-vs-suspend-interruptible.html
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13314/shard-kbl6/igt@kms_f...@flip-vs-suspend-interruptible.html

  * igt@kms_flip_tiling@flip-x-tiled:
- shard-iclb: [PASS][17] -> [FAIL][18] ([fdo#108303])
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-iclb1/igt@kms_flip_til...@flip-x-tiled.html
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13314/shard-iclb7/igt@kms_flip_til...@flip-x-tiled.html

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-shrfb-draw-pwrite:
- shard-iclb: [PASS][19] -> [FAIL][20] ([fdo#103167]) +5 similar 
issues
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-iclb8/igt@kms_frontbuffer_track...@fbc-1p-primscrn-pri-shrfb-draw-pwrite.html
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13314/shard-iclb8/igt@kms_frontbuffer_track...@fbc-1p-primscrn-pri-shrfb-draw-pwrite.html

  * igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-spr-indfb-draw-pwrite:
- shard-hsw:  [PASS][21] -> [SKIP][22] ([fdo#109271]) +14 similar 
issues
   [21]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-hsw8/igt@kms_frontbuffer_track...@fbc-2p-scndscrn-spr-indfb-draw-pwrite.html
   [22]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13314/shard-hsw1/igt@kms_frontbuffer_track...@fbc-2p-scndscrn-spr-indfb-draw-pwrite.html

  * igt@kms_plane_lowres@pipe-a-tiling-x:
- shard-iclb: [PASS][23] -> [FAIL][24] ([fdo#103166]) +1 similar 
issue
   [23]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-iclb7/igt@kms_plane_low...@pipe-a-tiling-x.html
   [24]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13314/shard-icl

Re: [Intel-gfx] [PATCH 4/6] drm/i915: skip forcewake actions on forcewake-less uncore

2019-06-18 Thread Chris Wilson
Quoting Daniele Ceraolo Spurio (2019-06-17 19:09:33)
> We always call some of the setup/cleanup functions for forcewake, even
> if the feature is not actually available. Skipping these operations if
> forcewake is not available saves us some operations on older gens and
> prepares us for having a forcewake-less display uncore.
> The suspend/resume functions have also been renamed to clearly indicate
> that they only operate on forcewake status.
> 
> Signed-off-by: Daniele Ceraolo Spurio 
> ---
>  drivers/gpu/drm/i915/i915_drv.c |  15 +--
>  drivers/gpu/drm/i915/intel_uncore.c | 147 +---
>  drivers/gpu/drm/i915/intel_uncore.h |   8 +-
>  3 files changed, 101 insertions(+), 69 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index d113296cbe34..95b36fe17f99 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -996,7 +996,7 @@ static int i915_driver_init_mmio(struct drm_i915_private 
> *dev_priv)
>  
> intel_device_info_init_mmio(dev_priv);
>  
> -   intel_uncore_prune_mmio_domains(&dev_priv->uncore);
> +   intel_uncore_prune_forcewake_domains(&dev_priv->uncore);

The _prune_ was the exceptional case...

> intel_uc_init_mmio(dev_priv);
>  
> @@ -2152,7 +2152,7 @@ static int i915_drm_suspend_late(struct drm_device 
> *dev, bool hibernation)
>  
> i915_gem_suspend_late(dev_priv);
>  
> -   intel_uncore_suspend(&dev_priv->uncore);
> +   intel_uncore_forcewake_suspend(&dev_priv->uncore);

But are you sure you want to delegate all the fw control to i915_drv.c,
and not keep this as a call into intel_uncore_suspend() ? It is meant to
be telling the uncore functionality that it is time to suspend, and it
has to work out what to save.

I am not sold on this yet. (One day this will just be a bunch of async
tasks plugged into signals with ordering determined by their
self-declared dependency tree. One day.)

So sell me on why we want an uncore_forcewake object, as currently you
are proposing a intel_uncore_suspend_forcewake().
-Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH] drm/i915/guc: Reduce verbosity on log overflows

2019-06-18 Thread Chris Wilson
Quoting Michal Wajdeczko (2019-06-17 15:38:53)
> On Mon, 17 Jun 2019 12:09:17 +0200, Chris Wilson  
>  wrote:
> 
> > If the user is clearing the log buffer too slowly, we overflow. As this
> > is an expected condition, and the driver tries to handle it, reduce the
> > error message down to a notice.
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110817
> > Signed-off-by: Chris Wilson 
> > Cc: Michal Wajdeczko 
> > Cc: Tvrtko Ursulin 
> > ---
> >  drivers/gpu/drm/i915/intel_guc_log.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_guc_log.c  
> > b/drivers/gpu/drm/i915/intel_guc_log.c
> > index bf1446629703..e3b83ecb90b5 100644
> > --- a/drivers/gpu/drm/i915/intel_guc_log.c
> > +++ b/drivers/gpu/drm/i915/intel_guc_log.c
> > @@ -208,7 +208,9 @@ static bool guc_check_log_buf_overflow(struct  
> > intel_guc_log *log,
> >   /* buffer_full_cnt is a 4 bit counter */
> >   log->stats[type].sampled_overflow += 16;
> >   }
> > - DRM_ERROR_RATELIMITED("GuC log buffer overflow\n");
> > +
> > + dev_notice_ratelimited(guc_to_i915(log_to_guc(log))->drm.dev,
> > +"GuC log buffer overflow\n");
> 
> While this change alone is not harmful, I'm afraid that there might
> be another reason why we see this message : once buffer_full_cnt is
> turned on by the fw and then we reset the Guc, this field may have
> stale value as it is not cleared by us/uc and we may wrongly assume
> that there was an overflow.

So yay/nay on silencing the test output so I can blissfully ignore it in
bugzilla?
-Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PULL] topic/remove-fbcon-notifiers for v5.3

2019-06-18 Thread Daniel Vetter
On Tue, Jun 18, 2019 at 11:03:47AM +0100, Lee Jones wrote:
> On Tue, 18 Jun 2019, Maarten Lankhorst wrote:
> 
> > Op 14-06-2019 om 11:25 schreef Maarten Lankhorst:
> > > Hi all,
> > >
> > > As discussed with Daniel V, I'm just doing the paperwork here as drm-misc 
> > > maintainer.
> > >
> > > This is the topic pull request for the fbdev notifier removal.
> > >
> > > Bar, please make a final check and pull into your fbdev tree.
> > >
> > > Lee, please make a final check and pull into your backlight tree.
> > >
> > > Greg, this is just fyi, you already acked all the vt and staging patches 
> > > in here
> > > to land through other trees.
> > >
> > > I'll pull this into drm-misc-next once Bart & Lee acked it.
> > >
> > > Cheers, Maarten.
> > 
> > Bart, Lee, ping?
> 
> Asking for an Ack on a PR is kind of odd.  If you have all of the
> patch Acks you need, and you've made the PR has small as possible,
> then you should be good to go.

Ime there's lots of ways to screw up a pull request, so asking for a "yup
looks good to me" seems reasonable. I've done that with all the topic
pulls in the past.

> My plan is to see if any of this collides with my PR to Linus.  If it
> doesn't then I may not have to pull it in at all.

For simple conflicts Linus usually prefers to resolve them himself. The
topic pull is needed if there's more stuff on top, like patches that need
to be rebased ...
-Daniel

> 
> > > topic/remove-fbcon-notifiers-2019-06-14-1:
> > > 
> > > topic/remove-fbcon-notifiers:
> > > - remove fbdev notifier usage for fbcon, as prep work to clean up the 
> > > fbcon locking
> > > - assorted locking checks in vt/console code
> > > - assorted notifier and cleanups in fbdev and backlight code
> > >
> > > The following changes since commit 
> > > d1fdb6d8f6a4109a4263176c84b899076a5f8008:
> > >
> > >   Linux 5.2-rc4 (2019-06-08 20:24:46 -0700)
> > >
> > > are available in the Git repository at:
> > >
> > >   git://anongit.freedesktop.org/drm/drm-misc 
> > > tags/topic/remove-fbcon-notifiers-2019-06-14-1
> > >
> > > for you to fetch changes up to 1dcff4ae65185e8c0300972f6d8d39d9a9db2bda:
> > >
> > >   backlight: simplify lcd notifier (2019-06-13 10:07:20 +0200)
> > >
> > > 
> > > Daniel Vetter (33):
> > >   dummycon: Sprinkle locking checks
> > >   fbdev: locking check for fb_set_suspend
> > >   vt: might_sleep() annotation for do_blank_screen
> > >   vt: More locking checks
> > >   fbdev/sa1100fb: Remove dead code
> > >   fbdev/cyber2000: Remove struct display
> > >   fbdev/aty128fb: Remove dead code
> > >   fbcon: s/struct display/struct fbcon_display/
> > >   fbcon: Remove fbcon_has_exited
> > >   fbcon: call fbcon_fb_(un)registered directly
> > >   fbdev/sh_mobile: remove sh_mobile_lcdc_display_notify
> > >   fbdev/omap: sysfs files can't disappear before the device is gone
> > >   fbdev: sysfs files can't disappear before the device is gone
> > >   staging/olpc: lock_fb_info can't fail
> > >   fbdev/atyfb: lock_fb_info can't fail
> > >   fbdev: lock_fb_info cannot fail
> > >   fbcon: call fbcon_fb_bind directly
> > >   fbdev: make unregister/unlink functions not fail
> > >   fbdev: unify unlink_framebuffer paths
> > >   fbdev/sh_mob: Remove fb notifier callback
> > >   fbdev: directly call fbcon_suspended/resumed
> > >   fbcon: Call fbcon_mode_deleted/new_modelist directly
> > >   fbdev: Call fbcon_get_requirement directly
> > >   Revert "backlight/fbcon: Add FB_EVENT_CONBLANK"
> > >   fbmem: pull fbcon_fb_blanked out of fb_blank
> > >   fbdev: remove FBINFO_MISC_USEREVENT around fb_blank
> > >   fb: Flatten control flow in fb_set_var
> > >   fbcon: replace FB_EVENT_MODE_CHANGE/_ALL with direct calls
> > >   vgaswitcheroo: call fbcon_remap_all directly
> > >   fbcon: Call con2fb_map functions directly
> > >   fbcon: Document what I learned about fbcon locking
> > >   staging/olpc_dcon: Add drm conversion to TODO
> > >   backlight: simplify lcd notifier
> > >
> > >  arch/arm/mach-pxa/am200epd.c|  13 +-
> > >  drivers/gpu/vga/vga_switcheroo.c|  11 +-
> > >  drivers/media/pci/ivtv/ivtvfb.c |   6 +-
> > >  drivers/staging/fbtft/fbtft-core.c  |   4 +-
> > >  drivers/staging/olpc_dcon/TODO  |   7 +
> > >  drivers/staging/olpc_dcon/olpc_dcon.c   |   6 +-
> > >  drivers/tty/vt/vt.c |  18 ++
> > >  drivers/video/backlight/backlight.c |   2 +-
> > >  drivers/video/backlight/lcd.c   |  12 -
> > >  drivers/video/console/dummycon.c|   6 +
> > >  drivers/video/fbdev/aty/aty128fb.c  |  64 
> > >  drivers/video/fbdev/aty/atyfb_base.c|   3 +-
> > >  drivers/video/fbdev/core/fbcmap.c   

Re: [Intel-gfx] [PATCH] drm/i915/guc: Reduce verbosity on log overflows

2019-06-18 Thread Michal Wajdeczko
On Tue, 18 Jun 2019 12:24:30 +0200, Chris Wilson  
 wrote:



Quoting Michal Wajdeczko (2019-06-17 15:38:53)

On Mon, 17 Jun 2019 12:09:17 +0200, Chris Wilson
 wrote:

> If the user is clearing the log buffer too slowly, we overflow. As  
this
> is an expected condition, and the driver tries to handle it, reduce  
the

> error message down to a notice.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110817
> Signed-off-by: Chris Wilson 
> Cc: Michal Wajdeczko 
> Cc: Tvrtko Ursulin 
> ---
>  drivers/gpu/drm/i915/intel_guc_log.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_guc_log.c
> b/drivers/gpu/drm/i915/intel_guc_log.c
> index bf1446629703..e3b83ecb90b5 100644
> --- a/drivers/gpu/drm/i915/intel_guc_log.c
> +++ b/drivers/gpu/drm/i915/intel_guc_log.c
> @@ -208,7 +208,9 @@ static bool guc_check_log_buf_overflow(struct
> intel_guc_log *log,
>   /* buffer_full_cnt is a 4 bit counter */
>   log->stats[type].sampled_overflow += 16;
>   }
> - DRM_ERROR_RATELIMITED("GuC log buffer overflow\n");
> +
> +  
dev_notice_ratelimited(guc_to_i915(log_to_guc(log))->drm.dev,

> +"GuC log buffer overflow\n");

While this change alone is not harmful, I'm afraid that there might
be another reason why we see this message : once buffer_full_cnt is
turned on by the fw and then we reset the Guc, this field may have
stale value as it is not cleared by us/uc and we may wrongly assume
that there was an overflow.


So yay/nay on silencing the test output so I can blissfully ignore it in
bugzilla?


OK to merge, we can debug extra 'notice' logs separately

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

Re: [Intel-gfx] [PATCH 00/59] prime doc polish and ... a few cleanups

2019-06-18 Thread Emil Velikov
On 2019/06/17, Emil Velikov wrote:
> Hi Daniel,
> 
> On Fri, 14 Jun 2019 at 21:36, Daniel Vetter  wrote:
> >
> > Hi all,
> >
> > So I figured let's get going and polish the docs for the last part of drm
> > core/helpers that hasn't yet seen some neat polish last few years. With
> > the goal to make docs for driver kapi a requirement henceforth - see last
> > patch. Aside from that final doc patch I also included some todo.rst
> > updates, bunch of things have progressed quite a bit.
> >
> > Of course spotted some lower-hanging fruit to untangle the prime helpers
> > and interfaces, and decided to at least fix a few of those.
> >
> > Patch series survived some light testing on i915+vgem, but that's it. So
> > review, testing, comments and anything else really highgly welcome.
> >
> > Cheers, Daniel
> >
> > Daniel Vetter (59):
> I think this is the larges series from you so far. As already
> mentioned - might be good idea to split this up a bit and merge it
> into a few pieces?
> Should make the churn much more manageable.
> 
> >   drm/prime: Unconditionally set up the prime file private
> >   drm/prime: Make DRIVER_PRIME a no-op
> >   drm/prime: Actually remove DRIVER_PRIME everywhere
> Patch set#1
> Reviewed-by: Emil Velikov 
> 
> >   drm/arm/komeda: Remove DRIVER_HAVE_IRQ
> >   drm/omapdrm: drop fb_debug_enter/leave
> I'd keep these separate - each one is:
> Reviewed-by: Emil Velikov 
> 
> >   drm/arc: Drop drm_gem_prime_export/import
> >   drm/arm: Drop drm_gem_prime_export/import
> >   drm/atmel: Drop drm_gem_prime_export/import
> >   drm/etnaviv: Drop drm_gem_prime_export/import
> >   drm/exynos: Drop drm_gem_prime_export
> >   drm/fsl-dcu: Drop drm_gem_prime_export/import
> >   drm/hisilicon: Drop drm_gem_prime_export/import
> >   drm/imx: Drop drm_gem_prime_export/import
> >   drm/mcde: Drop drm_gem_prime_export/import
> >   drm/mtk: Drop drm_gem_prime_export/import
> >   drm/meson: Drop drm_gem_prime_export/import
> >   drm/msm: Drop drm_gem_prime_export/import
> >   drm/mxsfb: Drop drm_gem_prime_export/import
> >   drm/nouveau: Drop drm_gem_prime_export/import
> >   drm/pl111: Drop drm_gem_prime_export/import
> >   drm/qxl: Drop drm_gem_prime_export/import
> >   drm/rcar-du: Drop drm_gem_prime_export/import
> >   drm/rockchip: Drop drm_gem_prime_export/import
> >   drm/shmob: Drop drm_gem_prime_export/import
> >   drm/sti: Drop drm_gem_prime_export/import
> >   drm/stm: Drop drm_gem_prime_export/import
> >   drm/tilcdc: Drop drm_gem_prime_export/import
> >   drm/tve2000: Drop drm_gem_prime_export/import
> >   drm/vboxvideo: Drop drm_gem_prime_export/import
> >   drm/vc3: Drop drm_gem_prime_import
> >   drm/radeon: Drop drm_gem_prime_import
> >   drm/vgem: Drop drm_gem_prime_export
> >   drm/virtio: Drop drm_gem_prime_export/import
> >   drm/xen: Drop drm_gem_prime_export/import
> >   drm/zte: Drop drm_gem_prime_export/import
> >   drm/vram-helper: Drop drm_gem_prime_export/import
> 
> The above are completely orthogonal of the preceding prime patches. For this 
> lot
> Reviewed-by: Emil Velikov 
> 
> I'll get to the rest tomorrow.
> 
> HTH
> Emil
> 
> >   drm/todo: Improve drm_gem_object funcs todo
> >   drm/gem: Unexport drm_gem_(un)pin/v(un)map
> 
Series X++:
Reviewed-by: Emil Velikov 


> >   drm/prime: Update docs
> 
Will look/reply in v2 of the above.

> >   drm/prime: Align gem_prime_export with obj_funcs.export
> 
Reviewed-by: Emil Velikov 

> >   drm/prime: automatically set gem_obj->resv on import
> >   drm/etnaviv: Drop resv argument from etnaviv_gem_new_impl
> >   drm/lima: Drop resv argument from lima_bo_create_struct
> >   drm/mediatek: Use drm_atomic_helper_wait_for_fences
> >   drm/msm: Drop robj from msm_gem_new_impl
> >   drm/panfrost: don't set gem_obj->resv for prime import anymore
> >   drm/vc4: Don set gem_obj->resv in prime import anymore
> >   drm/vgem: Ditch attach trickery in the fence ioctl
Series X++:
Reviewed-by: Emil Velikov 

> >   drm/msm: Use drm_gem_fb_prepare_fb
> >   drm/vc4: Use drm_gem_fb_prepare_fb
Series X++?
My atomic foo isn't that great so I cannot provide any meaningful review

> >   drm/radeon: Fill out gem_object->resv
> >   drm/nouveau: Fill out gem_object->resv
> >   drm/amdgpu: Fill out gem_object->resv
> >   drm/prime: Ditch gem_prime_res_obj hook
Series X++. For the lot:
Reviewed-by: Emil Velikov 

> >   drm/todo: remove gem_prime_import/export todo
> >   drm/todo: Update backlight todo
> >   drm/todo: Update mmap todo
> >   drm/todo: Add new debugfs todo
> >   drm/doc: Document kapi doc expectations
> >
For the documentation updates
Acked-by: Emil Velikov 

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

Re: [Intel-gfx] [PATCH 6/6] drm/i915/gvt: decouple check_vgpu() from uncore_init()

2019-06-18 Thread Chris Wilson
Quoting Daniele Ceraolo Spurio (2019-06-17 19:09:35)
> With multiple uncore to initialize (GT vs Display), it makes little
> sense to have the vgpu_check inside uncore_init(). We also have
> a catch-22 scenario where the uncore is required to read the vgpu
> capabilities while the vgpu capabilities are required to decide if
> we need to initialize forcewake support. To remove this circular
> dependency, we can perform the required MMIO access by mmapping just
> the vgtif shared page in mmio space and use raw accessors.
> 
> Signed-off-by: Daniele Ceraolo Spurio 
> Cc: Zhenyu Wang 
> ---
>  drivers/gpu/drm/i915/i915_drv.c |  2 ++
>  drivers/gpu/drm/i915/i915_pvinfo.h  |  5 +++--
>  drivers/gpu/drm/i915/i915_vgpu.c| 31 +++--
>  drivers/gpu/drm/i915/intel_uncore.c |  2 --
>  4 files changed, 30 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 95b36fe17f99..c3d9d1a366b0 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -1893,6 +1893,8 @@ int i915_driver_load(struct pci_dev *pdev, const struct 
> pci_device_id *ent)
>  
> disable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
>  
> +   i915_check_vgpu(dev_priv);

Bonus points for s/i915_check_vgpu/i915_detect_vgpu/ ?
-Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915: Signal fence completion from i915_request_wait

2019-06-18 Thread Patchwork
== Series Details ==

Series: drm/i915: Signal fence completion from i915_request_wait
URL   : https://patchwork.freedesktop.org/series/62241/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6287_full -> Patchwork_13315_full


Summary
---

  **SUCCESS**

  No regressions found.

  

Known issues


  Here are the changes found in Patchwork_13315_full that come from known 
issues:

### IGT changes ###

 Issues hit 

  * igt@gem_ctx_isolation@rcs0-s3:
- shard-apl:  [PASS][1] -> [DMESG-WARN][2] ([fdo#108566]) +4 
similar issues
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-apl6/igt@gem_ctx_isolat...@rcs0-s3.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13315/shard-apl4/igt@gem_ctx_isolat...@rcs0-s3.html

  * igt@gem_eio@unwedge-stress:
- shard-apl:  [PASS][3] -> [DMESG-WARN][4] ([fdo#110913 ])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-apl5/igt@gem_...@unwedge-stress.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13315/shard-apl5/igt@gem_...@unwedge-stress.html

  * igt@gem_persistent_relocs@forked-interruptible-thrash-inactive:
- shard-apl:  [PASS][5] -> [INCOMPLETE][6] ([fdo#103927])
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-apl6/igt@gem_persistent_rel...@forked-interruptible-thrash-inactive.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13315/shard-apl5/igt@gem_persistent_rel...@forked-interruptible-thrash-inactive.html

  * igt@gem_userptr_blits@map-fixed-invalidate-busy-gup:
- shard-kbl:  [PASS][7] -> [DMESG-WARN][8] ([fdo#110913 ])
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-kbl4/igt@gem_userptr_bl...@map-fixed-invalidate-busy-gup.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13315/shard-kbl1/igt@gem_userptr_bl...@map-fixed-invalidate-busy-gup.html

  * igt@gem_userptr_blits@sync-unmap-cycles:
- shard-snb:  [PASS][9] -> [DMESG-WARN][10] ([fdo#110913 ]) +1 
similar issue
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-snb2/igt@gem_userptr_bl...@sync-unmap-cycles.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13315/shard-snb7/igt@gem_userptr_bl...@sync-unmap-cycles.html

  * igt@kms_cursor_crc@pipe-a-cursor-suspend:
- shard-iclb: [PASS][11] -> [INCOMPLETE][12] ([fdo#107713])
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-iclb6/igt@kms_cursor_...@pipe-a-cursor-suspend.html
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13315/shard-iclb7/igt@kms_cursor_...@pipe-a-cursor-suspend.html

  * igt@kms_cursor_crc@pipe-b-cursor-256x256-sliding:
- shard-hsw:  [PASS][13] -> [INCOMPLETE][14] ([fdo#103540])
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-hsw7/igt@kms_cursor_...@pipe-b-cursor-256x256-sliding.html
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13315/shard-hsw4/igt@kms_cursor_...@pipe-b-cursor-256x256-sliding.html

  * igt@kms_cursor_crc@pipe-b-cursor-64x21-sliding:
- shard-kbl:  [PASS][15] -> [FAIL][16] ([fdo#103232])
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-kbl2/igt@kms_cursor_...@pipe-b-cursor-64x21-sliding.html
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13315/shard-kbl6/igt@kms_cursor_...@pipe-b-cursor-64x21-sliding.html

  * igt@kms_cursor_legacy@2x-long-cursor-vs-flip-atomic:
- shard-hsw:  [PASS][17] -> [FAIL][18] ([fdo#105767])
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-hsw4/igt@kms_cursor_leg...@2x-long-cursor-vs-flip-atomic.html
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13315/shard-hsw6/igt@kms_cursor_leg...@2x-long-cursor-vs-flip-atomic.html

  * igt@kms_flip@2x-plain-flip-ts-check-interruptible:
- shard-hsw:  [PASS][19] -> [SKIP][20] ([fdo#109271]) +3 similar 
issues
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-hsw7/igt@kms_f...@2x-plain-flip-ts-check-interruptible.html
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13315/shard-hsw1/igt@kms_f...@2x-plain-flip-ts-check-interruptible.html

  * igt@kms_flip@flip-vs-suspend:
- shard-snb:  [PASS][21] -> [INCOMPLETE][22] ([fdo#105411])
   [21]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-snb7/igt@kms_f...@flip-vs-suspend.html
   [22]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13315/shard-snb1/igt@kms_f...@flip-vs-suspend.html

  * igt@kms_flip_tiling@flip-yf-tiled:
- shard-skl:  [PASS][23] -> [FAIL][24] ([fdo#108145])
   [23]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-skl3/igt@kms_flip_til...@flip-yf-tiled.html
   [24]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13315/shard-skl5/igt@kms_flip_til...@flip-yf-tiled.html

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-prim

[Intel-gfx] [PATCH] drm/i915/execlists: Detect cross-contamination with GuC

2019-06-18 Thread Chris Wilson
The process_csb routine from execlists_submission is incompatible with
the GuC backend. Add a warning to detect if we accidentally end up in
the wrong spot.

Signed-off-by: Chris Wilson 
Cc: Tvrtko Ursulin 
Cc: Michal Wajdeczko 
Cc: Michał Winiarski 
---
 drivers/gpu/drm/i915/gt/intel_lrc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c 
b/drivers/gpu/drm/i915/gt/intel_lrc.c
index c400c66d0ee5..bbe6ece9b010 100644
--- a/drivers/gpu/drm/i915/gt/intel_lrc.c
+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
@@ -1169,6 +1169,7 @@ static void process_csb(struct intel_engine_cs *engine)
u8 head, tail;
 
lockdep_assert_held(&engine->active.lock);
+   GEM_BUG_ON(USES_GUC_SUBMISSION(engine->i915));
 
/*
 * Note that csb_write, csb_status may be either in HWSP or mmio.
-- 
2.20.1

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

Re: [Intel-gfx] [PULL] topic/remove-fbcon-notifiers for v5.3

2019-06-18 Thread Bartlomiej Zolnierkiewicz

Hi,

On 6/18/19 11:20 AM, Maarten Lankhorst wrote:
> Op 14-06-2019 om 11:25 schreef Maarten Lankhorst:
>> Hi all,
>>
>> As discussed with Daniel V, I'm just doing the paperwork here as drm-misc 
>> maintainer.
>>
>> This is the topic pull request for the fbdev notifier removal.
>>
>> Bar, please make a final check and pull into your fbdev tree.
>>
>> Lee, please make a final check and pull into your backlight tree.
>>
>> Greg, this is just fyi, you already acked all the vt and staging patches in 
>> here
>> to land through other trees.
>>
>> I'll pull this into drm-misc-next once Bart & Lee acked it.
>>
>> Cheers, Maarten.
> 
> Bart, Lee, ping?

Looks OK to me (I have test pulled it locally and there is only trivial
merge conflict on removed mxsfb fbdev driver) but it seems that all
patches miss your "S-o-B:" line (there is only "Reviewed-by:" tag which
is OK but has a different meaning)?

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

> 
>> topic/remove-fbcon-notifiers-2019-06-14-1:
>> 
>> topic/remove-fbcon-notifiers:
>> - remove fbdev notifier usage for fbcon, as prep work to clean up the fbcon 
>> locking
>> - assorted locking checks in vt/console code
>> - assorted notifier and cleanups in fbdev and backlight code
>>
>> The following changes since commit d1fdb6d8f6a4109a4263176c84b899076a5f8008:
>>
>>   Linux 5.2-rc4 (2019-06-08 20:24:46 -0700)
>>
>> are available in the Git repository at:
>>
>>   git://anongit.freedesktop.org/drm/drm-misc 
>> tags/topic/remove-fbcon-notifiers-2019-06-14-1
>>
>> for you to fetch changes up to 1dcff4ae65185e8c0300972f6d8d39d9a9db2bda:
>>
>>   backlight: simplify lcd notifier (2019-06-13 10:07:20 +0200)
>>
>> 
>> Daniel Vetter (33):
>>   dummycon: Sprinkle locking checks
>>   fbdev: locking check for fb_set_suspend
>>   vt: might_sleep() annotation for do_blank_screen
>>   vt: More locking checks
>>   fbdev/sa1100fb: Remove dead code
>>   fbdev/cyber2000: Remove struct display
>>   fbdev/aty128fb: Remove dead code
>>   fbcon: s/struct display/struct fbcon_display/
>>   fbcon: Remove fbcon_has_exited
>>   fbcon: call fbcon_fb_(un)registered directly
>>   fbdev/sh_mobile: remove sh_mobile_lcdc_display_notify
>>   fbdev/omap: sysfs files can't disappear before the device is gone
>>   fbdev: sysfs files can't disappear before the device is gone
>>   staging/olpc: lock_fb_info can't fail
>>   fbdev/atyfb: lock_fb_info can't fail
>>   fbdev: lock_fb_info cannot fail
>>   fbcon: call fbcon_fb_bind directly
>>   fbdev: make unregister/unlink functions not fail
>>   fbdev: unify unlink_framebuffer paths
>>   fbdev/sh_mob: Remove fb notifier callback
>>   fbdev: directly call fbcon_suspended/resumed
>>   fbcon: Call fbcon_mode_deleted/new_modelist directly
>>   fbdev: Call fbcon_get_requirement directly
>>   Revert "backlight/fbcon: Add FB_EVENT_CONBLANK"
>>   fbmem: pull fbcon_fb_blanked out of fb_blank
>>   fbdev: remove FBINFO_MISC_USEREVENT around fb_blank
>>   fb: Flatten control flow in fb_set_var
>>   fbcon: replace FB_EVENT_MODE_CHANGE/_ALL with direct calls
>>   vgaswitcheroo: call fbcon_remap_all directly
>>   fbcon: Call con2fb_map functions directly
>>   fbcon: Document what I learned about fbcon locking
>>   staging/olpc_dcon: Add drm conversion to TODO
>>   backlight: simplify lcd notifier
>>
>>  arch/arm/mach-pxa/am200epd.c|  13 +-
>>  drivers/gpu/vga/vga_switcheroo.c|  11 +-
>>  drivers/media/pci/ivtv/ivtvfb.c |   6 +-
>>  drivers/staging/fbtft/fbtft-core.c  |   4 +-
>>  drivers/staging/olpc_dcon/TODO  |   7 +
>>  drivers/staging/olpc_dcon/olpc_dcon.c   |   6 +-
>>  drivers/tty/vt/vt.c |  18 ++
>>  drivers/video/backlight/backlight.c |   2 +-
>>  drivers/video/backlight/lcd.c   |  12 -
>>  drivers/video/console/dummycon.c|   6 +
>>  drivers/video/fbdev/aty/aty128fb.c  |  64 
>>  drivers/video/fbdev/aty/atyfb_base.c|   3 +-
>>  drivers/video/fbdev/core/fbcmap.c   |   6 +-
>>  drivers/video/fbdev/core/fbcon.c| 313 ---
>>  drivers/video/fbdev/core/fbcon.h|   6 +-
>>  drivers/video/fbdev/core/fbmem.c| 399 
>> +---
>>  drivers/video/fbdev/core/fbsysfs.c  |  20 +-
>>  drivers/video/fbdev/cyber2000fb.c   |   1 -
>>  drivers/video/fbdev/neofb.c |   9 +-
>>  drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c |  21 +-
>>  drivers/video/fbdev/sa1100fb.c  |  25 --
>>  drivers/video/fbdev/savage/savagefb_driver.c|   9 +-
>>  drivers/vide

Re: [Intel-gfx] [PATCH i-g-t v2] gitlab-ci: add build for MIPS

2019-06-18 Thread Guillaume Tucker
On 14/06/2019 11:33, Arkadiusz Hiler wrote:
> On Thu, Jun 13, 2019 at 03:01:06PM +0100, Guillaume Tucker wrote:
>> Add Docker image and Gitlab CI steps to run builds for the MIPS
>> architecture using Debian Stretch with backports.
>>
>> Signed-off-by: Guillaume Tucker 
>> ---
>>  .gitlab-ci.yml | 28 
>>  Dockerfile.debian-mips | 39 +++
>>  meson-cross-mips.txt   | 12 
>>  3 files changed, 79 insertions(+)
>>  create mode 100644 Dockerfile.debian-mips
>>  create mode 100644 meson-cross-mips.txt
>>
>> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
>> index 771143a9ea95..e390f8f472d5 100644
>> --- a/.gitlab-ci.yml
>> +++ b/.gitlab-ci.yml
>> @@ -90,6 +90,17 @@ build:tests-debian-meson-arm64:
>>  paths:
>>- build
>>  
>> +build:tests-debian-meson-mips:
>> +  image: $CI_REGISTRY/$CI_PROJECT_PATH/igt-debian-mips:latest
>> +  stage: build
>> +  script:
>> +- export PKG_CONFIG_PATH=/usr/lib/mips-linux-gnu/pkgconfig/
>> +- meson --cross-file meson-cross-mips.txt build
>> +- ninja -C build
>> +  artifacts:
>> +paths:
>> +  - build
>> +
>>  build:tests-debian-autotools:
>>image: $CI_REGISTRY/$CI_PROJECT_PATH/igt-debian:latest
>>stage: build
>> @@ -221,6 +232,23 @@ containers:igt-debian-arm64:
>>  - docker build -t $CI_REGISTRY/$CI_PROJECT_PATH/igt-debian-arm64 -f 
>> Dockerfile.debian-arm64 .
>>  - docker push $CI_REGISTRY/$CI_PROJECT_PATH/igt-debian-arm64
> 
> Any particular reason for not having ninja-test step for MIPS?

Sorry I overlooked that bit, I'm adding it in a v3.  That made me
realise that the libatomic1:mips package was required for
run-time linking on multi-arch file systems.

> Other than that (and Petri's concern, since I don't speak Debian),
> looks good.

Thanks, I also replied on the other thread about adding
libatomic1 for sub-architectures.

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

Re: [Intel-gfx] [PULL] topic/remove-fbcon-notifiers for v5.3

2019-06-18 Thread Lee Jones
On Tue, 18 Jun 2019, Daniel Vetter wrote:

> On Tue, Jun 18, 2019 at 11:03:47AM +0100, Lee Jones wrote:
> > On Tue, 18 Jun 2019, Maarten Lankhorst wrote:
> > 
> > > Op 14-06-2019 om 11:25 schreef Maarten Lankhorst:
> > > > Hi all,
> > > >
> > > > As discussed with Daniel V, I'm just doing the paperwork here as 
> > > > drm-misc maintainer.
> > > >
> > > > This is the topic pull request for the fbdev notifier removal.
> > > >
> > > > Bar, please make a final check and pull into your fbdev tree.
> > > >
> > > > Lee, please make a final check and pull into your backlight tree.
> > > >
> > > > Greg, this is just fyi, you already acked all the vt and staging 
> > > > patches in here
> > > > to land through other trees.
> > > >
> > > > I'll pull this into drm-misc-next once Bart & Lee acked it.
> > > >
> > > > Cheers, Maarten.
> > > 
> > > Bart, Lee, ping?
> > 
> > Asking for an Ack on a PR is kind of odd.  If you have all of the
> > patch Acks you need, and you've made the PR has small as possible,
> > then you should be good to go.
> 
> Ime there's lots of ways to screw up a pull request, so asking for a "yup
> looks good to me" seems reasonable. I've done that with all the topic
> pulls in the past.

Instead of burdening others, it's probably best to take 'no news is
good news' stance.  In all of the immutable branch PRs I've sent out,
other than the occasional 'pulled thanks', no one has ever reviewed/
acked them before.

> > My plan is to see if any of this collides with my PR to Linus.  If it
> > doesn't then I may not have to pull it in at all.
> 
> For simple conflicts Linus usually prefers to resolve them himself. The
> topic pull is needed if there's more stuff on top, like patches that need
> to be rebased ...

There are multiple uses for immutable branches.  I'll pull this one if
the need arises.

> > > > topic/remove-fbcon-notifiers-2019-06-14-1:
> > > > 
> > > > topic/remove-fbcon-notifiers:
> > > > - remove fbdev notifier usage for fbcon, as prep work to clean up the 
> > > > fbcon locking
> > > > - assorted locking checks in vt/console code
> > > > - assorted notifier and cleanups in fbdev and backlight code
> > > >
> > > > The following changes since commit 
> > > > d1fdb6d8f6a4109a4263176c84b899076a5f8008:
> > > >
> > > >   Linux 5.2-rc4 (2019-06-08 20:24:46 -0700)
> > > >
> > > > are available in the Git repository at:
> > > >
> > > >   git://anongit.freedesktop.org/drm/drm-misc 
> > > > tags/topic/remove-fbcon-notifiers-2019-06-14-1
> > > >
> > > > for you to fetch changes up to 1dcff4ae65185e8c0300972f6d8d39d9a9db2bda:
> > > >
> > > >   backlight: simplify lcd notifier (2019-06-13 10:07:20 +0200)
> > > >
> > > > 
> > > > Daniel Vetter (33):
> > > >   dummycon: Sprinkle locking checks
> > > >   fbdev: locking check for fb_set_suspend
> > > >   vt: might_sleep() annotation for do_blank_screen
> > > >   vt: More locking checks
> > > >   fbdev/sa1100fb: Remove dead code
> > > >   fbdev/cyber2000: Remove struct display
> > > >   fbdev/aty128fb: Remove dead code
> > > >   fbcon: s/struct display/struct fbcon_display/
> > > >   fbcon: Remove fbcon_has_exited
> > > >   fbcon: call fbcon_fb_(un)registered directly
> > > >   fbdev/sh_mobile: remove sh_mobile_lcdc_display_notify
> > > >   fbdev/omap: sysfs files can't disappear before the device is gone
> > > >   fbdev: sysfs files can't disappear before the device is gone
> > > >   staging/olpc: lock_fb_info can't fail
> > > >   fbdev/atyfb: lock_fb_info can't fail
> > > >   fbdev: lock_fb_info cannot fail
> > > >   fbcon: call fbcon_fb_bind directly
> > > >   fbdev: make unregister/unlink functions not fail
> > > >   fbdev: unify unlink_framebuffer paths
> > > >   fbdev/sh_mob: Remove fb notifier callback
> > > >   fbdev: directly call fbcon_suspended/resumed
> > > >   fbcon: Call fbcon_mode_deleted/new_modelist directly
> > > >   fbdev: Call fbcon_get_requirement directly
> > > >   Revert "backlight/fbcon: Add FB_EVENT_CONBLANK"
> > > >   fbmem: pull fbcon_fb_blanked out of fb_blank
> > > >   fbdev: remove FBINFO_MISC_USEREVENT around fb_blank
> > > >   fb: Flatten control flow in fb_set_var
> > > >   fbcon: replace FB_EVENT_MODE_CHANGE/_ALL with direct calls
> > > >   vgaswitcheroo: call fbcon_remap_all directly
> > > >   fbcon: Call con2fb_map functions directly
> > > >   fbcon: Document what I learned about fbcon locking
> > > >   staging/olpc_dcon: Add drm conversion to TODO
> > > >   backlight: simplify lcd notifier
> > > >
> > > >  arch/arm/mach-pxa/am200epd.c|  13 +-
> > > >  drivers/gpu/vga/vga_switcheroo.c|  11 +-
> > > >  drivers/media/pci/ivtv/ivtvfb.c |   6 +-
> > > >  drivers/staging/fbtft/fbtft-core.c  |   4 +-
> > > 

Re: [Intel-gfx] [PATCH] drm/i915: Check visibility in icl_build_plane_wm

2019-06-18 Thread Ville Syrjälä
On Tue, Jun 18, 2019 at 11:16:41AM +0200, Maarten Lankhorst wrote:
> Op 17-06-2019 om 14:34 schreef Ville Syrjälä:
> > On Fri, Jun 14, 2019 at 12:39:41PM +0200, Maarten Lankhorst wrote:
> >> When a planar YUV plane is configured, but the crtc is
> >> marked inactive, we can end up with a linked plane without
> >> visibility.
> > How is that possible? I don't think we should be adding the slave plane
> > if the master is not visible.
> 
> 
> DPMS off, we calculate the various fields as if the CRTC is on, then disable 
> visibility.
> 
> crtc_state->nv12_planes etc still get set, so it works as if the crtc is on.
> 
> It's a way of not allowing an invalid result when dpms is off, then breaking 
> on crtc enable.

Hmm. I wonder when we started to do that. If we're already doing this
much then I wonder how far we are from just dealing with the FIXME in
intel_wm_plane_visible() instead?

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

Re: [Intel-gfx] [PULL] topic/remove-fbcon-notifiers for v5.3

2019-06-18 Thread Maarten Lankhorst
Op 18-06-2019 om 13:17 schreef Bartlomiej Zolnierkiewicz:
> Hi,
>
> On 6/18/19 11:20 AM, Maarten Lankhorst wrote:
>> Op 14-06-2019 om 11:25 schreef Maarten Lankhorst:
>>> Hi all,
>>>
>>> As discussed with Daniel V, I'm just doing the paperwork here as drm-misc 
>>> maintainer.
>>>
>>> This is the topic pull request for the fbdev notifier removal.
>>>
>>> Bar, please make a final check and pull into your fbdev tree.
>>>
>>> Lee, please make a final check and pull into your backlight tree.
>>>
>>> Greg, this is just fyi, you already acked all the vt and staging patches in 
>>> here
>>> to land through other trees.
>>>
>>> I'll pull this into drm-misc-next once Bart & Lee acked it.
>>>
>>> Cheers, Maarten.
>> Bart, Lee, ping?
> Looks OK to me (I have test pulled it locally and there is only trivial
> merge conflict on removed mxsfb fbdev driver) but it seems that all
> patches miss your "S-o-B:" line (there is only "Reviewed-by:" tag which
> is OK but has a different meaning)?

Hey,

I created the topic branch, but daniel pushed the patches to it. :)

That explains why there's a R-B but no S-o-B.

Cheers,

Maarten

> Best regards,
> --
> Bartlomiej Zolnierkiewicz
> Samsung R&D Institute Poland
> Samsung Electronics
>
>>> topic/remove-fbcon-notifiers-2019-06-14-1:
>>> 
>>> topic/remove-fbcon-notifiers:
>>> - remove fbdev notifier usage for fbcon, as prep work to clean up the fbcon 
>>> locking
>>> - assorted locking checks in vt/console code
>>> - assorted notifier and cleanups in fbdev and backlight code
>>>
>>> The following changes since commit d1fdb6d8f6a4109a4263176c84b899076a5f8008:
>>>
>>>   Linux 5.2-rc4 (2019-06-08 20:24:46 -0700)
>>>
>>> are available in the Git repository at:
>>>
>>>   git://anongit.freedesktop.org/drm/drm-misc 
>>> tags/topic/remove-fbcon-notifiers-2019-06-14-1
>>>
>>> for you to fetch changes up to 1dcff4ae65185e8c0300972f6d8d39d9a9db2bda:
>>>
>>>   backlight: simplify lcd notifier (2019-06-13 10:07:20 +0200)
>>>
>>> 
>>> Daniel Vetter (33):
>>>   dummycon: Sprinkle locking checks
>>>   fbdev: locking check for fb_set_suspend
>>>   vt: might_sleep() annotation for do_blank_screen
>>>   vt: More locking checks
>>>   fbdev/sa1100fb: Remove dead code
>>>   fbdev/cyber2000: Remove struct display
>>>   fbdev/aty128fb: Remove dead code
>>>   fbcon: s/struct display/struct fbcon_display/
>>>   fbcon: Remove fbcon_has_exited
>>>   fbcon: call fbcon_fb_(un)registered directly
>>>   fbdev/sh_mobile: remove sh_mobile_lcdc_display_notify
>>>   fbdev/omap: sysfs files can't disappear before the device is gone
>>>   fbdev: sysfs files can't disappear before the device is gone
>>>   staging/olpc: lock_fb_info can't fail
>>>   fbdev/atyfb: lock_fb_info can't fail
>>>   fbdev: lock_fb_info cannot fail
>>>   fbcon: call fbcon_fb_bind directly
>>>   fbdev: make unregister/unlink functions not fail
>>>   fbdev: unify unlink_framebuffer paths
>>>   fbdev/sh_mob: Remove fb notifier callback
>>>   fbdev: directly call fbcon_suspended/resumed
>>>   fbcon: Call fbcon_mode_deleted/new_modelist directly
>>>   fbdev: Call fbcon_get_requirement directly
>>>   Revert "backlight/fbcon: Add FB_EVENT_CONBLANK"
>>>   fbmem: pull fbcon_fb_blanked out of fb_blank
>>>   fbdev: remove FBINFO_MISC_USEREVENT around fb_blank
>>>   fb: Flatten control flow in fb_set_var
>>>   fbcon: replace FB_EVENT_MODE_CHANGE/_ALL with direct calls
>>>   vgaswitcheroo: call fbcon_remap_all directly
>>>   fbcon: Call con2fb_map functions directly
>>>   fbcon: Document what I learned about fbcon locking
>>>   staging/olpc_dcon: Add drm conversion to TODO
>>>   backlight: simplify lcd notifier
>>>
>>>  arch/arm/mach-pxa/am200epd.c|  13 +-
>>>  drivers/gpu/vga/vga_switcheroo.c|  11 +-
>>>  drivers/media/pci/ivtv/ivtvfb.c |   6 +-
>>>  drivers/staging/fbtft/fbtft-core.c  |   4 +-
>>>  drivers/staging/olpc_dcon/TODO  |   7 +
>>>  drivers/staging/olpc_dcon/olpc_dcon.c   |   6 +-
>>>  drivers/tty/vt/vt.c |  18 ++
>>>  drivers/video/backlight/backlight.c |   2 +-
>>>  drivers/video/backlight/lcd.c   |  12 -
>>>  drivers/video/console/dummycon.c|   6 +
>>>  drivers/video/fbdev/aty/aty128fb.c  |  64 
>>>  drivers/video/fbdev/aty/atyfb_base.c|   3 +-
>>>  drivers/video/fbdev/core/fbcmap.c   |   6 +-
>>>  drivers/video/fbdev/core/fbcon.c| 313 ---
>>>  drivers/video/fbdev/core/fbcon.h|   6 +-
>>>  drivers/video/fbdev/core/fbmem.c| 399 
>>> +---
>>>  drivers/video/fbdev/core/fbsysfs.c  |  20 +-
>>>  driver

[Intel-gfx] [PATCH 2/6] drm/ttm: remove the backing store if no placement is given

2019-06-18 Thread Christian König
Pipeline removal of the BOs backing store when no placement is given
during validation.

Signed-off-by: Christian König 
---
 drivers/gpu/drm/ttm/ttm_bo.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index c7de667d482a..682a1a035b35 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1240,6 +1240,18 @@ int ttm_bo_validate(struct ttm_buffer_object *bo,
uint32_t new_flags;
 
reservation_object_assert_held(bo->resv);
+
+   /*
+* Remove the backing store if no placement is given.
+*/
+   if (!placement->num_placement && !placement->num_busy_placement) {
+   ret = ttm_bo_pipeline_gutting(bo);
+   if (ret)
+   return ret;
+
+   return ttm_tt_create(bo, false);
+   }
+
/*
 * Check whether we need to move buffer.
 */
-- 
2.17.1

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

[Intel-gfx] [PATCH 1/6] dma-buf: add dynamic DMA-buf handling v10

2019-06-18 Thread Christian König
On the exporter side we add optional explicit pinning callbacks. If those
callbacks are implemented the framework no longer caches sg tables and the
map/unmap callbacks are always called with the lock of the reservation object
held.

On the importer side we add an optional invalidate callback. This callback is
used by the exporter to inform the importers that their mappings should be
destroyed as soon as possible.

This allows the exporter to provide the mappings without the need to pin
the backing store.

v2: don't try to invalidate mappings when the callback is NULL,
lock the reservation obj while using the attachments,
add helper to set the callback
v3: move flag for invalidation support into the DMA-buf,
use new attach_info structure to set the callback
v4: use importer_priv field instead of mangling exporter priv.
v5: drop invalidation_supported flag
v6: squash together with pin/unpin changes
v7: pin/unpin takes an attachment now
v8: nuke dma_buf_attachment_(map|unmap)_locked,
everything is now handled backward compatible
v9: always cache when export/importer don't agree on dynamic handling
v10: minimal style cleanup

Signed-off-by: Christian König 
---
 drivers/dma-buf/dma-buf.c | 188 --
 include/linux/dma-buf.h   | 109 --
 2 files changed, 283 insertions(+), 14 deletions(-)

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index 6c15deb5d4ad..9c9c95a88655 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -531,6 +531,9 @@ struct dma_buf *dma_buf_export(const struct 
dma_buf_export_info *exp_info)
return ERR_PTR(-EINVAL);
}
 
+   if (WARN_ON(exp_info->ops->cache_sgt_mapping && exp_info->ops->pin))
+   return ERR_PTR(-EINVAL);
+
if (!try_module_get(exp_info->owner))
return ERR_PTR(-ENOENT);
 
@@ -651,10 +654,12 @@ void dma_buf_put(struct dma_buf *dmabuf)
 EXPORT_SYMBOL_GPL(dma_buf_put);
 
 /**
- * dma_buf_attach - Add the device to dma_buf's attachments list; optionally,
+ * dma_buf_dynamic_attach - Add the device to dma_buf's attachments list; 
optionally,
  * calls attach() of dma_buf_ops to allow device-specific attach functionality
- * @dmabuf:[in]buffer to attach device to.
- * @dev:   [in]device to be attached.
+ * @dmabuf:[in]buffer to attach device to.
+ * @dev:   [in]device to be attached.
+ * @importer_ops   [in]importer operations for the attachment
+ * @importer_priv  [in]importer private pointer for the attachment
  *
  * Returns struct dma_buf_attachment pointer for this attachment. Attachments
  * must be cleaned up by calling dma_buf_detach().
@@ -668,8 +673,10 @@ EXPORT_SYMBOL_GPL(dma_buf_put);
  * accessible to @dev, and cannot be moved to a more suitable place. This is
  * indicated with the error code -EBUSY.
  */
-struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
- struct device *dev)
+struct dma_buf_attachment *
+dma_buf_dynamic_attach(struct dma_buf *dmabuf, struct device *dev,
+  const struct dma_buf_attach_ops *importer_ops,
+  void *importer_priv)
 {
struct dma_buf_attachment *attach;
int ret;
@@ -683,6 +690,8 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf 
*dmabuf,
 
attach->dev = dev;
attach->dmabuf = dmabuf;
+   attach->importer_ops = importer_ops;
+   attach->importer_priv = importer_priv;
 
mutex_lock(&dmabuf->lock);
 
@@ -691,16 +700,72 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf 
*dmabuf,
if (ret)
goto err_attach;
}
+   reservation_object_lock(dmabuf->resv, NULL);
list_add(&attach->node, &dmabuf->attachments);
+   reservation_object_unlock(dmabuf->resv);
 
mutex_unlock(&dmabuf->lock);
 
+   /* When either the importer or the exporter can't handle dynamic
+* mappings we cache the mapping here to avoid issues with the
+* reservation object lock.
+*/
+   if (dma_buf_attachment_is_dynamic(attach) !=
+   dma_buf_is_dynamic(dmabuf)) {
+   struct sg_table *sgt;
+
+   if (dma_buf_is_dynamic(attach->dmabuf)) {
+   reservation_object_lock(attach->dmabuf->resv, NULL);
+   ret = dma_buf_pin(attach);
+   if (ret)
+   goto err_unlock;
+   }
+
+   sgt = dmabuf->ops->map_dma_buf(attach, DMA_BIDIRECTIONAL);
+   if (!sgt)
+   sgt = ERR_PTR(-ENOMEM);
+   if (IS_ERR(sgt)) {
+   ret = PTR_ERR(sgt);
+   goto err_unpin;
+   }
+   if (dma_buf_is_dynamic(attach->dmabuf))
+   reservation_object_unlock(attach->dmabuf->re

[Intel-gfx] [PATCH 6/6] drm/amdgpu: add independent DMA-buf import v6

2019-06-18 Thread Christian König
Instead of relying on the DRM functions just implement our own import
functions. This prepares support for taking care of unpinned DMA-buf.

v2: enable for all exporters, not just amdgpu, fix invalidation
handling, lock reservation object while setting callback
v3: change to new dma_buf attach interface
v4: split out from unpinned DMA-buf work
v5: rebased and cleanup on new DMA-buf interface
v6: squash with invalidation callback change,
stop using _(map|unmap)_locked

Signed-off-by: Christian König 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 65 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h |  4 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c  |  6 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 32 --
 5 files changed, 83 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
index 579e33b31f2d..31511d7de8a0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
@@ -424,31 +424,28 @@ struct dma_buf *amdgpu_gem_prime_export(struct drm_device 
*dev,
 }
 
 /**
- * amdgpu_gem_prime_import_sg_table - &drm_driver.gem_prime_import_sg_table
- * implementation
+ * amdgpu_dma_buf_create_obj - create BO for DMA-buf import
+ *
  * @dev: DRM device
- * @attach: DMA-buf attachment
- * @sg: Scatter/gather table
+ * @dma_buf: DMA-buf
  *
- * Imports shared DMA buffer memory exported by another device.
+ * Creates an empty SG BO for DMA-buf import.
  *
  * Returns:
  * A new GEM BO of the given DRM device, representing the memory
  * described by the given DMA-buf attachment and scatter/gather table.
  */
-struct drm_gem_object *
-amdgpu_gem_prime_import_sg_table(struct drm_device *dev,
-struct dma_buf_attachment *attach,
-struct sg_table *sg)
+static struct drm_gem_object *
+amdgpu_dma_buf_create_obj(struct drm_device *dev, struct dma_buf *dma_buf)
 {
-   struct reservation_object *resv = attach->dmabuf->resv;
+   struct reservation_object *resv = dma_buf->resv;
struct amdgpu_device *adev = dev->dev_private;
struct amdgpu_bo *bo;
struct amdgpu_bo_param bp;
int ret;
 
memset(&bp, 0, sizeof(bp));
-   bp.size = attach->dmabuf->size;
+   bp.size = dma_buf->size;
bp.byte_align = PAGE_SIZE;
bp.domain = AMDGPU_GEM_DOMAIN_CPU;
bp.flags = 0;
@@ -459,11 +456,9 @@ amdgpu_gem_prime_import_sg_table(struct drm_device *dev,
if (ret)
goto error;
 
-   bo->tbo.sg = sg;
-   bo->tbo.ttm->sg = sg;
bo->allowed_domains = AMDGPU_GEM_DOMAIN_GTT;
bo->preferred_domains = AMDGPU_GEM_DOMAIN_GTT;
-   if (attach->dmabuf->ops != &amdgpu_dmabuf_ops)
+   if (dma_buf->ops != &amdgpu_dmabuf_ops)
bo->prime_shared_count = 1;
 
ww_mutex_unlock(&resv->lock);
@@ -474,6 +469,32 @@ amdgpu_gem_prime_import_sg_table(struct drm_device *dev,
return ERR_PTR(ret);
 }
 
+/**
+ * amdgpu_gem_prime_invalidate_mappings - &attach.invalidate implementation
+ *
+ * @attach: the DMA-buf attachment
+ *
+ * Invalidate the DMA-buf attachment, making sure that the we re-create the
+ * mapping before the next use.
+ */
+static void
+amdgpu_gem_prime_invalidate_mappings(struct dma_buf_attachment *attach)
+{
+   struct ttm_operation_ctx ctx = { false, false };
+   struct drm_gem_object *obj = attach->importer_priv;
+   struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
+   struct ttm_placement placement = {};
+   int r;
+
+   r = ttm_bo_validate(&bo->tbo, &placement, &ctx);
+   if (r)
+   DRM_ERROR("Failed to invalidate DMA-buf import (%d))\n", r);
+}
+
+static const struct dma_buf_attach_ops amdgpu_dma_buf_attach_ops = {
+   .invalidate = amdgpu_gem_prime_invalidate_mappings
+};
+
 /**
  * amdgpu_gem_prime_import - &drm_driver.gem_prime_import implementation
  * @dev: DRM device
@@ -488,6 +509,7 @@ amdgpu_gem_prime_import_sg_table(struct drm_device *dev,
 struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev,
struct dma_buf *dma_buf)
 {
+   struct dma_buf_attachment *attach;
struct drm_gem_object *obj;
 
if (dma_buf->ops == &amdgpu_dmabuf_ops) {
@@ -502,5 +524,18 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct 
drm_device *dev,
}
}
 
-   return drm_gem_prime_import(dev, dma_buf);
+   obj = amdgpu_dma_buf_create_obj(dev, dma_buf);
+   if (IS_ERR(obj))
+   return obj;
+
+   attach = dma_buf_dynamic_attach(dma_buf, dev->dev,
+   &amdgpu_dma_buf_attach_ops, obj);
+   if (IS_ERR(attach)) {
+   drm_gem_object_put(obj);
+   return ERR_CAST(attach);
+   }
+
+   get_dma_buf(dma_buf);
+   

[Intel-gfx] [PATCH 4/6] drm/amdgpu: use allowed_domains for exported DMA-bufs

2019-06-18 Thread Christian König
Avoid that we ping/pong the buffers when we stop to pin DMA-buf
exports by using the allowed domains for exported buffers.

Signed-off-by: Christian König 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index dc63707e426f..0da512341194 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -414,7 +415,9 @@ static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
/* Don't move this buffer if we have depleted our allowance
 * to move it. Don't move anything if the threshold is zero.
 */
-   if (p->bytes_moved < p->bytes_moved_threshold) {
+   if (p->bytes_moved < p->bytes_moved_threshold &&
+   (!bo->gem_base.dma_buf ||
+   list_empty(&bo->gem_base.dma_buf->attachments))) {
if (!amdgpu_gmc_vram_full_visible(&adev->gmc) &&
(bo->flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED)) {
/* And don't move a CPU_ACCESS_REQUIRED BO to limited
-- 
2.17.1

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

[Intel-gfx] [PATCH 5/6] drm/amdgpu: add independent DMA-buf export v6

2019-06-18 Thread Christian König
The caching of SGT's is actually quite harmful and should probably removed
altogether when all drivers are audited.

Start by providing a separate DMA-buf export implementation in amdgpu.
This is also a prerequisite of unpinned DMA-buf handling.

v2: fix unintended recursion, remove debugging leftovers
v3: split out from unpinned DMA-buf work
v4: rebase on top of new no_sgt_cache flag
v5: fix some warnings by including amdgpu_dma_buf.h
v6: fix locking for non amdgpu exports

Signed-off-by: Christian König 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 210 +---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h |   1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |   1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c  |   5 +
 4 files changed, 139 insertions(+), 78 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
index 489041df1f45..579e33b31f2d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
@@ -34,26 +34,11 @@
 #include "amdgpu.h"
 #include "amdgpu_display.h"
 #include "amdgpu_gem.h"
+#include "amdgpu_dma_buf.h"
 #include 
 #include 
 #include 
 
-/**
- * amdgpu_gem_prime_get_sg_table - &drm_driver.gem_prime_get_sg_table
- * implementation
- * @obj: GEM buffer object (BO)
- *
- * Returns:
- * A scatter/gather table for the pinned pages of the BO's memory.
- */
-struct sg_table *amdgpu_gem_prime_get_sg_table(struct drm_gem_object *obj)
-{
-   struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
-   int npages = bo->tbo.num_pages;
-
-   return drm_prime_pages_to_sg(bo->tbo.ttm->pages, npages);
-}
-
 /**
  * amdgpu_gem_prime_vmap - &dma_buf_ops.vmap implementation
  * @obj: GEM BO
@@ -179,92 +164,163 @@ __reservation_object_make_exclusive(struct 
reservation_object *obj)
 }
 
 /**
- * amdgpu_dma_buf_map_attach - &dma_buf_ops.attach implementation
- * @dma_buf: Shared DMA buffer
+ * amdgpu_dma_buf_attach - &dma_buf_ops.attach implementation
+ *
+ * @dmabuf: DMA-buf where we attach to
+ * @attach: attachment to add
+ *
+ * Add the attachment as user to the exported DMA-buf.
+ */
+static int amdgpu_dma_buf_attach(struct dma_buf *dmabuf,
+struct dma_buf_attachment *attach)
+{
+   struct drm_gem_object *obj = dmabuf->priv;
+   struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
+   struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
+   int r;
+
+   if (attach->dev->driver == adev->dev->driver)
+   return 0;
+
+   r = amdgpu_bo_reserve(bo, false);
+   if (unlikely(r != 0))
+   return r;
+
+   /*
+* We only create shared fences for internal use, but importers
+* of the dmabuf rely on exclusive fences for implicitly
+* tracking write hazards. As any of the current fences may
+* correspond to a write, we need to convert all existing
+* fences on the reservation object into a single exclusive
+* fence.
+*/
+   r = __reservation_object_make_exclusive(bo->tbo.resv);
+   if (r)
+   return r;
+
+   bo->prime_shared_count++;
+   amdgpu_bo_unreserve(bo);
+   return 0;
+}
+
+/**
+ * amdgpu_dma_buf_detach - &dma_buf_ops.detach implementation
+ *
+ * @dmabuf: DMA-buf where we remove the attachment from
+ * @attach: the attachment to remove
+ *
+ * Called when an attachment is removed from the DMA-buf.
+ */
+static void amdgpu_dma_buf_detach(struct dma_buf *dmabuf,
+ struct dma_buf_attachment *attach)
+{
+   struct drm_gem_object *obj = dmabuf->priv;
+   struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
+   struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
+
+   if (attach->dev->driver != adev->dev->driver && bo->prime_shared_count)
+   bo->prime_shared_count--;
+}
+
+/**
+ * amdgpu_dma_buf_pin - &dma_buf_ops.pin implementation
+ *
+ * @attach: attachment to pin down
+ *
+ * Pin the BO which is backing the DMA-buf so that it can't move any more.
+ */
+static int amdgpu_dma_buf_pin(struct dma_buf_attachment *attach)
+{
+   struct drm_gem_object *obj = attach->dmabuf->priv;
+   struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
+
+   /* pin buffer into GTT */
+   return amdgpu_bo_pin(bo, AMDGPU_GEM_DOMAIN_GTT);
+}
+
+/**
+ * amdgpu_dma_buf_unpin - &dma_buf_ops.unpin implementation
+ *
+ * @attach: attachment to unpin
+ *
+ * Unpin a previously pinned BO to make it movable again.
+ */
+static void amdgpu_dma_buf_unpin(struct dma_buf_attachment *attach)
+{
+   struct drm_gem_object *obj = attach->dmabuf->priv;
+   struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
+
+   amdgpu_bo_unpin(bo);
+}
+
+/**
+ * amdgpu_dma_buf_map_dma_buf - &dma_buf_ops.map_dma_buf implementation
  * @attach: DMA-buf attachment
+ * @dir: DMA direction
  *
  * Makes sure that the shared DMA buffer can be accessed by the target device.
  * For now, simply pi

[Intel-gfx] [PATCH 3/6] drm/ttm: use the parent resv for ghost objects v2

2019-06-18 Thread Christian König
This way we can even pipeline imported BO evictions.

v2: Limit this to only cases when the parent object uses a separate
reservation object as well. This fixes another OOM problem.

Signed-off-by: Christian König 
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c 
b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 895d77d799e4..95f47d685921 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -517,9 +517,11 @@ static int ttm_buffer_object_transfer(struct 
ttm_buffer_object *bo,
kref_init(&fbo->base.kref);
fbo->base.destroy = &ttm_transfered_destroy;
fbo->base.acc_size = 0;
-   fbo->base.resv = &fbo->base.ttm_resv;
-   reservation_object_init(fbo->base.resv);
-   ret = reservation_object_trylock(fbo->base.resv);
+   if (bo->resv == &bo->ttm_resv)
+   fbo->base.resv = &fbo->base.ttm_resv;
+
+   reservation_object_init(&fbo->base.ttm_resv);
+   ret = reservation_object_trylock(&fbo->base.ttm_resv);
WARN_ON(!ret);
 
*new_obj = &fbo->base;
@@ -716,7 +718,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
if (ret)
return ret;
 
-   reservation_object_add_excl_fence(ghost_obj->resv, fence);
+   reservation_object_add_excl_fence(&ghost_obj->ttm_resv, fence);
 
/**
 * If we're not moving to fixed memory, the TTM object
@@ -729,7 +731,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
else
bo->ttm = NULL;
 
-   ttm_bo_unreserve(ghost_obj);
+   reservation_object_unlock(&ghost_obj->ttm_resv);
ttm_bo_put(ghost_obj);
}
 
@@ -772,7 +774,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
if (ret)
return ret;
 
-   reservation_object_add_excl_fence(ghost_obj->resv, fence);
+   reservation_object_add_excl_fence(&ghost_obj->ttm_resv, fence);
 
/**
 * If we're not moving to fixed memory, the TTM object
@@ -785,7 +787,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
else
bo->ttm = NULL;
 
-   ttm_bo_unreserve(ghost_obj);
+   reservation_object_unlock(&ghost_obj->ttm_resv);
ttm_bo_put(ghost_obj);
 
} else if (from->flags & TTM_MEMTYPE_FLAG_FIXED) {
@@ -841,7 +843,7 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)
if (ret)
return ret;
 
-   ret = reservation_object_copy_fences(ghost->resv, bo->resv);
+   ret = reservation_object_copy_fences(&ghost->ttm_resv, bo->resv);
/* Last resort, wait for the BO to be idle when we are OOM */
if (ret)
ttm_bo_wait(bo, false, false);
@@ -850,7 +852,7 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)
bo->mem.mem_type = TTM_PL_SYSTEM;
bo->ttm = NULL;
 
-   ttm_bo_unreserve(ghost);
+   reservation_object_unlock(&ghost->ttm_resv);
ttm_bo_put(ghost);
 
return 0;
-- 
2.17.1

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

Re: [Intel-gfx] [PATCH] drm/i915: Check visibility in icl_build_plane_wm

2019-06-18 Thread Ville Syrjälä
On Tue, Jun 18, 2019 at 02:44:00PM +0300, Ville Syrjälä wrote:
> On Tue, Jun 18, 2019 at 11:16:41AM +0200, Maarten Lankhorst wrote:
> > Op 17-06-2019 om 14:34 schreef Ville Syrjälä:
> > > On Fri, Jun 14, 2019 at 12:39:41PM +0200, Maarten Lankhorst wrote:
> > >> When a planar YUV plane is configured, but the crtc is
> > >> marked inactive, we can end up with a linked plane without
> > >> visibility.
> > > How is that possible? I don't think we should be adding the slave plane
> > > if the master is not visible.
> > 
> > 
> > DPMS off, we calculate the various fields as if the CRTC is on, then 
> > disable visibility.
> > 
> > crtc_state->nv12_planes etc still get set, so it works as if the crtc is on.
> > 
> > It's a way of not allowing an invalid result when dpms is off, then 
> > breaking on crtc enable.
> 
> Hmm. I wonder when we started to do that. If we're already doing this
> much then I wonder how far we are from just dealing with the FIXME in
> intel_wm_plane_visible() instead?

Still far I guess. Would potentially need to do some surgery on
the pipe ddb allocation as well.

This whole thing is a bit borked. We clear active_planes but still
use it when allocating the Y plane. Hence dpms on could just fail
anyway due to not having a free Y plane (as well as due to
insufficient watermarks).

So if we want to make the Y plane allocation robust I guess we would
also need to move clearing the plane visibility to happen after the 
crtc .atomic_check().

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

[Intel-gfx] ✗ Fi.CI.IGT: failure for drm/i915/psr: Force manual PSR exit in older gens

2019-06-18 Thread Patchwork
== Series Details ==

Series: drm/i915/psr: Force manual PSR exit in older gens
URL   : https://patchwork.freedesktop.org/series/62249/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_6287_full -> Patchwork_13316_full


Summary
---

  **FAILURE**

  Serious unknown changes coming with Patchwork_13316_full absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_13316_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  

Possible new issues
---

  Here are the unknown changes that may have been introduced in 
Patchwork_13316_full:

### IGT changes ###

 Possible regressions 

  * igt@gem_eio@hibernate:
- shard-snb:  [PASS][1] -> [DMESG-WARN][2]
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-snb4/igt@gem_...@hibernate.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13316/shard-snb6/igt@gem_...@hibernate.html

  
Known issues


  Here are the changes found in Patchwork_13316_full that come from known 
issues:

### IGT changes ###

 Issues hit 

  * igt@gem_eio@throttle:
- shard-kbl:  [PASS][3] -> [DMESG-WARN][4] ([fdo#110913 ]) +2 
similar issues
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-kbl7/igt@gem_...@throttle.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13316/shard-kbl4/igt@gem_...@throttle.html

  * igt@gem_userptr_blits@sync-unmap-cycles:
- shard-apl:  [PASS][5] -> [DMESG-WARN][6] ([fdo#110913 ])
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-apl8/igt@gem_userptr_bl...@sync-unmap-cycles.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13316/shard-apl4/igt@gem_userptr_bl...@sync-unmap-cycles.html

  * igt@i915_pm_rpm@i2c:
- shard-hsw:  [PASS][7] -> [FAIL][8] ([fdo#104097])
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-hsw4/igt@i915_pm_...@i2c.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13316/shard-hsw1/igt@i915_pm_...@i2c.html

  * igt@i915_selftest@live_evict:
- shard-kbl:  [PASS][9] -> [INCOMPLETE][10] ([fdo#103665] / 
[fdo#110938])
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-kbl2/igt@i915_selftest@live_evict.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13316/shard-kbl4/igt@i915_selftest@live_evict.html

  * igt@i915_suspend@sysfs-reader:
- shard-apl:  [PASS][11] -> [DMESG-WARN][12] ([fdo#108566]) +2 
similar issues
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-apl6/igt@i915_susp...@sysfs-reader.html
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13316/shard-apl3/igt@i915_susp...@sysfs-reader.html

  * igt@kms_cursor_crc@pipe-c-cursor-suspend:
- shard-kbl:  [PASS][13] -> [DMESG-WARN][14] ([fdo#108566]) +2 
similar issues
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-kbl2/igt@kms_cursor_...@pipe-c-cursor-suspend.html
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13316/shard-kbl2/igt@kms_cursor_...@pipe-c-cursor-suspend.html

  * igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
- shard-glk:  [PASS][15] -> [FAIL][16] ([fdo#105363])
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-glk9/igt@kms_f...@2x-flip-vs-expired-vblank-interruptible.html
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13316/shard-glk5/igt@kms_f...@2x-flip-vs-expired-vblank-interruptible.html

  * igt@kms_flip@flip-vs-suspend-interruptible:
- shard-skl:  [PASS][17] -> [INCOMPLETE][18] ([fdo#109507])
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-skl3/igt@kms_f...@flip-vs-suspend-interruptible.html
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13316/shard-skl8/igt@kms_f...@flip-vs-suspend-interruptible.html

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-blt:
- shard-iclb: [PASS][19] -> [FAIL][20] ([fdo#103167]) +4 similar 
issues
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-iclb4/igt@kms_frontbuffer_track...@fbc-1p-primscrn-spr-indfb-draw-blt.html
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13316/shard-iclb2/igt@kms_frontbuffer_track...@fbc-1p-primscrn-spr-indfb-draw-blt.html

  * igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-spr-indfb-move:
- shard-hsw:  [PASS][21] -> [SKIP][22] ([fdo#109271]) +18 similar 
issues
   [21]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6287/shard-hsw5/igt@kms_frontbuffer_track...@fbc-2p-scndscrn-spr-indfb-move.html
   [22]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13316/shard-hsw1/igt@kms_frontbuffer_track...@fbc-2p-scndscrn-spr-indfb-move.html

  * igt@kms_plane_lowres@pipe-a

Re: [Intel-gfx] [PATCH 02/26] drm/i915: Skip shrinking already freed pages

2019-06-18 Thread Chris Wilson
Quoting Chris Wilson (2019-06-18 08:41:29)
> Previously, we want to shrink the pages of freed objects before they
> were RCU collected. However, by removing the struct_mutex serialisation
> around the active reference, we need to acquire an extra reference
> around the wait. Unfortunately this means that we have to skip objects
> that are waiting RCU collection.
> 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110937
> Signed-off-by: Chris Wilson 
-Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH v2 1/4] drm/i915: Don't clobber M/N values during fastset check

2019-06-18 Thread Imre Deak
On Thu, Jun 13, 2019 at 12:24:59PM +0300, Ville Syrjälä wrote:
> On Wed, Jun 12, 2019 at 08:24:23PM +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä 
> > 
> > We're now calling intel_pipe_config_compare(..., true) uncoditionally
> > which means we're always going clobber the calculated M/N values with
> > the old values if the fuzzy M/N check passes. That causes problems
> > because the fuzzy check allows for a huge difference in the values.
> > 
> > I'm actually tempted to just make the M/N checks exact, but that might
> > prevent fastboot from kicking in when people want it. So for now let's
> > overwrite the computed values with the old values only if decide to skip
> > the modeset.
> > 
> > v2: Copy has_drrs along with M/N M2/N2 values
> > 
> > Cc: sta...@vger.kernel.org
> > Cc: blubber...@protonmail.com
> > Cc: Maarten Lankhorst 
> > Cc: Hans de Goede 
> > Tested-by: blubber...@protonmail.com
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110782
> > Fixes: d19f958db23c ("drm/i915: Enable fastset for non-boot modesets.")
> > Signed-off-by: Ville Syrjälä 
> 
> Looks like also
> https://bugs.freedesktop.org/show_bug.cgi?id=110675

Ok, the copying from old-state to new-state is needed to keep HW/SW
state verification later pass, but we want to preserve the calculated
state if we'll need to reprogram everything based on that. Makes sense:

Reviewed-by: Imre Deak 

> 
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 36 +---
> >  1 file changed, 28 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c 
> > b/drivers/gpu/drm/i915/intel_display.c
> > index 1b1ddb48ca7a..3d8ed1cf0ab7 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -12299,9 +12299,6 @@ intel_compare_link_m_n(const struct intel_link_m_n 
> > *m_n,
> >   m2_n2->gmch_m, m2_n2->gmch_n, !adjust) &&
> > intel_compare_m_n(m_n->link_m, m_n->link_n,
> >   m2_n2->link_m, m2_n2->link_n, !adjust)) {
> > -   if (adjust)
> > -   *m2_n2 = *m_n;
> > -
> > return true;
> > }
> >  
> > @@ -13433,6 +13430,33 @@ static int calc_watermark_data(struct 
> > intel_atomic_state *state)
> > return 0;
> >  }
> >  
> > +static void intel_crtc_check_fastset(struct intel_crtc_state 
> > *old_crtc_state,
> > +struct intel_crtc_state *new_crtc_state)
> > +{
> > +   struct drm_i915_private *dev_priv =
> > +   to_i915(new_crtc_state->base.crtc->dev);
> > +
> > +   if (!intel_pipe_config_compare(dev_priv, old_crtc_state,
> > +  new_crtc_state, true))
> > +   return;
> > +
> > +   new_crtc_state->base.mode_changed = false;
> > +   new_crtc_state->update_pipe = true;
> > +
> > +   /*
> > +* If we're not doing the full modeset we want to
> > +* keep the current M/N values as they may be
> > +* sufficiently different to the computed values
> > +* to cause problems.
> > +*
> > +* FIXME: should really copy more fuzzy state here
> > +*/
> > +   new_crtc_state->fdi_m_n = old_crtc_state->fdi_m_n;
> > +   new_crtc_state->dp_m_n = old_crtc_state->dp_m_n;
> > +   new_crtc_state->dp_m2_n2 = old_crtc_state->dp_m2_n2;
> > +   new_crtc_state->has_drrs = old_crtc_state->has_drrs;
> > +}
> > +
> >  /**
> >   * intel_atomic_check - validate state object
> >   * @dev: drm device
> > @@ -13474,11 +13498,7 @@ static int intel_atomic_check(struct drm_device 
> > *dev,
> > if (ret)
> > goto fail;
> >  
> > -   if (intel_pipe_config_compare(dev_priv, old_crtc_state,
> > - new_crtc_state, true)) {
> > -   new_crtc_state->base.mode_changed = false;
> > -   new_crtc_state->update_pipe = true;
> > -   }
> > +   intel_crtc_check_fastset(old_crtc_state, new_crtc_state);
> >  
> > if (needs_modeset(&new_crtc_state->base))
> > any_ms = true;
> > -- 
> > 2.21.0
> 
> -- 
> Ville Syrjälä
> Intel
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH 2/4] drm/i915: Constify intel_pipe_config_compare()

2019-06-18 Thread Imre Deak
On Wed, Jun 12, 2019 at 04:07:59PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä 
> 
> Now that intel_pipe_config_compare() no longer clobbers the passed
> in state we can make both crtc states const. And while at we simplify
> the calling convention, and clean up intel_compare_link_m_n() a bit.
> 
> Signed-off-by: Ville Syrjälä 

Reviewed-by: Imre Deak 

> ---
>  drivers/gpu/drm/i915/intel_display.c | 43 +++-
>  1 file changed, 17 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c 
> b/drivers/gpu/drm/i915/intel_display.c
> index 73b3e92b7ed5..dcc301df6174 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -12291,18 +12291,14 @@ intel_compare_m_n(unsigned int m, unsigned int n,
>  
>  static bool
>  intel_compare_link_m_n(const struct intel_link_m_n *m_n,
> -struct intel_link_m_n *m2_n2,
> -bool adjust)
> -{
> - if (m_n->tu == m2_n2->tu &&
> - intel_compare_m_n(m_n->gmch_m, m_n->gmch_n,
> -   m2_n2->gmch_m, m2_n2->gmch_n, !adjust) &&
> - intel_compare_m_n(m_n->link_m, m_n->link_n,
> -   m2_n2->link_m, m2_n2->link_n, !adjust)) {
> - return true;
> - }
> -
> - return false;
> +const struct intel_link_m_n *m2_n2,
> +bool exact)
> +{
> + return m_n->tu == m2_n2->tu &&
> + intel_compare_m_n(m_n->gmch_m, m_n->gmch_n,
> +   m2_n2->gmch_m, m2_n2->gmch_n, exact) &&
> + intel_compare_m_n(m_n->link_m, m_n->link_n,
> +   m2_n2->link_m, m2_n2->link_n, exact);
>  }
>  
>  static bool
> @@ -12372,11 +12368,11 @@ static bool fastboot_enabled(struct 
> drm_i915_private *dev_priv)
>  }
>  
>  static bool
> -intel_pipe_config_compare(struct drm_i915_private *dev_priv,
> -   struct intel_crtc_state *current_config,
> -   struct intel_crtc_state *pipe_config,
> +intel_pipe_config_compare(const struct intel_crtc_state *current_config,
> +   const struct intel_crtc_state *pipe_config,
> bool adjust)
>  {
> + struct drm_i915_private *dev_priv = 
> to_i915(current_config->base.crtc->dev);
>   bool ret = true;
>   bool fixup_inherited = adjust &&
>   (current_config->base.mode.private_flags & 
> I915_MODE_FLAG_INHERITED) &&
> @@ -12447,7 +12443,7 @@ intel_pipe_config_compare(struct drm_i915_private 
> *dev_priv,
>  #define PIPE_CONF_CHECK_M_N(name) do { \
>   if (!intel_compare_link_m_n(¤t_config->name, \
>   &pipe_config->name,\
> - adjust)) { \
> + !adjust)) { \
>   pipe_config_err(adjust, __stringify(name), \
> "(expected tu %i gmch %i/%i link %i/%i, " \
> "found tu %i, gmch %i/%i link %i/%i)\n", \
> @@ -12472,9 +12468,9 @@ intel_pipe_config_compare(struct drm_i915_private 
> *dev_priv,
>   */
>  #define PIPE_CONF_CHECK_M_N_ALT(name, alt_name) do { \
>   if (!intel_compare_link_m_n(¤t_config->name, \
> - &pipe_config->name, adjust) && \
> + &pipe_config->name, !adjust) && \
>   !intel_compare_link_m_n(¤t_config->alt_name, \
> - &pipe_config->name, adjust)) { \
> + &pipe_config->name, !adjust)) { \
>   pipe_config_err(adjust, __stringify(name), \
> "(expected tu %i gmch %i/%i link %i/%i, " \
> "or tu %i gmch %i/%i link %i/%i, " \
> @@ -12984,8 +12980,7 @@ verify_crtc_state(struct drm_crtc *crtc,
>   intel_pipe_config_sanity_check(dev_priv, pipe_config);
>  
>   sw_config = to_intel_crtc_state(new_crtc_state);
> - if (!intel_pipe_config_compare(dev_priv, sw_config,
> -pipe_config, false)) {
> + if (!intel_pipe_config_compare(sw_config, pipe_config, false)) {
>   I915_STATE_WARN(1, "pipe state doesn't match!\n");
>   intel_dump_pipe_config(pipe_config, NULL, "[hw state]");
>   intel_dump_pipe_config(sw_config, NULL, "[sw state]");
> @@ -13430,14 +13425,10 @@ static int calc_watermark_data(struct 
> intel_atomic_state *state)
>   return 0;
>  }
>  
> -static void intel_crtc_check_fastset(struct intel_crtc_state *old_crtc_state,
> +static void intel_crtc_check_fastset(const struct intel_crtc_state 
> *old_crtc_state,
>struct intel_crtc_state *new_crtc_state)
>  {
> - struct drm_i915_private *dev_priv =
> - to_i915(new_crtc_state->base.crtc->dev);
> -
> - if (!intel_pipe_config_compare(dev_priv, old_crtc_state,
> -new_crtc_state, true)

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/execlists: Detect cross-contamination with GuC

2019-06-18 Thread Patchwork
== Series Details ==

Series: drm/i915/execlists: Detect cross-contamination with GuC
URL   : https://patchwork.freedesktop.org/series/62296/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6291 -> Patchwork_13324


Summary
---

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13324/

Known issues


  Here are the changes found in Patchwork_13324 that come from known issues:

### IGT changes ###

 Issues hit 

  * igt@core_auth@basic-auth:
- fi-icl-u3:  [PASS][1] -> [DMESG-WARN][2] ([fdo#107724])
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6291/fi-icl-u3/igt@core_a...@basic-auth.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13324/fi-icl-u3/igt@core_a...@basic-auth.html

  * igt@gem_ctx_switch@basic-default:
- fi-icl-guc: [PASS][3] -> [INCOMPLETE][4] ([fdo#107713] / 
[fdo#108569])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6291/fi-icl-guc/igt@gem_ctx_swi...@basic-default.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13324/fi-icl-guc/igt@gem_ctx_swi...@basic-default.html

  * igt@gem_exec_suspend@basic-s3:
- fi-blb-e6850:   [PASS][5] -> [INCOMPLETE][6] ([fdo#107718])
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6291/fi-blb-e6850/igt@gem_exec_susp...@basic-s3.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13324/fi-blb-e6850/igt@gem_exec_susp...@basic-s3.html

  * igt@i915_selftest@live_evict:
- fi-bsw-kefka:   [PASS][7] -> [DMESG-WARN][8] ([fdo#107709])
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6291/fi-bsw-kefka/igt@i915_selftest@live_evict.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13324/fi-bsw-kefka/igt@i915_selftest@live_evict.html

  
 Possible fixes 

  * igt@gem_mmap_gtt@basic-short:
- fi-icl-u3:  [DMESG-WARN][9] ([fdo#107724]) -> [PASS][10] +2 
similar issues
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6291/fi-icl-u3/igt@gem_mmap_...@basic-short.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13324/fi-icl-u3/igt@gem_mmap_...@basic-short.html

  * igt@kms_frontbuffer_tracking@basic:
- fi-icl-u3:  [FAIL][11] ([fdo#103167]) -> [PASS][12]
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6291/fi-icl-u3/igt@kms_frontbuffer_track...@basic.html
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13324/fi-icl-u3/igt@kms_frontbuffer_track...@basic.html

  * igt@prime_vgem@basic-wait-default:
- fi-icl-dsi: [DMESG-WARN][13] ([fdo#106107]) -> [PASS][14]
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6291/fi-icl-dsi/igt@prime_v...@basic-wait-default.html
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13324/fi-icl-dsi/igt@prime_v...@basic-wait-default.html

  
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#106107]: https://bugs.freedesktop.org/show_bug.cgi?id=106107
  [fdo#107709]: https://bugs.freedesktop.org/show_bug.cgi?id=107709
  [fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
  [fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
  [fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
  [fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569


Participating hosts (48 -> 39)
--

  Additional (1): fi-skl-iommu 
  Missing(10): fi-kbl-soraka fi-cml-u2 fi-ilk-m540 fi-hsw-4200u 
fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus fi-cml-u 


Build changes
-

  * Linux: CI_DRM_6291 -> Patchwork_13324

  CI_DRM_6291: 30a8dd688b1e9b56df650976b5058da5022dcfb8 @ 
git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5059: 1f67ee0d09d6513f487f2be74aae9700e755258a @ 
git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_13324: 6288ed271df7d3fba2d0ef4989dd51f0b7fc774a @ 
git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

6288ed271df7 drm/i915/execlists: Detect cross-contamination with GuC

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13324/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Intel-gfx] [PATCH i-g-t v3 4/4] tests/sw_sync: use atomic_* instead of __sync_*

2019-06-18 Thread Guillaume Tucker
Replace calls to the older __sync_* functions with the new atomic_*
standard ones to be consistent with other tests and improve
portability across CPU architectures.  Add dependency of sw_sync on
libatomic.

Signed-off-by: Guillaume Tucker 
Reviewed-by: Simon Ser 
---

Notes:
v2: use atomic_* and only link libatomic with sw_sync

 tests/Makefile.am |  1 +
 tests/meson.build |  8 +++-
 tests/sw_sync.c   | 12 ++--
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index bbd386c9c2db..7d71df8c7a2e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -122,6 +122,7 @@ prime_self_import_LDADD = $(LDADD) -lpthread
 gem_userptr_blits_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
 gem_userptr_blits_LDADD = $(LDADD) -lpthread
 perf_pmu_LDADD = $(LDADD) $(top_builddir)/lib/libigt_perf.la
+sw_sync_LDADD = $(LDADD) -latomic
 
 kms_flip_LDADD = $(LDADD) -lpthread
 
diff --git a/tests/meson.build b/tests/meson.build
index ffd432d38193..34a74025a537 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -76,7 +76,6 @@ test_progs = [
'prime_self_import',
'prime_udl',
'prime_vgem',
-   'sw_sync',
'syncobj_basic',
'syncobj_wait',
'template',
@@ -329,6 +328,13 @@ executable('testdisplay', ['testdisplay.c', 
'testdisplay_hotplug.c'],
   install : true)
 test_list += 'testdisplay'
 
+test_executables += executable('sw_sync', 'sw_sync.c',
+  dependencies : test_deps + [ libatomic ],
+  install_dir : libexecdir,
+  install_rpath : libexecdir_rpathdir,
+  install : true)
+test_list += 'sw_sync'
+
 subdir('amdgpu')
 
 gen_testlist = find_program('generate_testlist.sh')
diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 950b8b614759..62d1d17cab45 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -26,6 +26,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -43,7 +44,7 @@ IGT_TEST_DESCRIPTION("Test SW Sync Framework");
 typedef struct {
int timeline;
uint32_t thread_id;
-   uint32_t *counter;
+   _Atomic(uint32_t) *counter;
sem_t *sem;
 } data_t;
 
@@ -489,7 +490,7 @@ static void test_sync_multi_consumer(void)
pthread_t thread_arr[MULTI_CONSUMER_THREADS];
sem_t sem;
int timeline;
-   uint32_t counter = 0;
+   _Atomic(uint32_t) counter = 0;
uintptr_t thread_ret = 0;
data_t data;
int i, ret;
@@ -517,7 +518,7 @@ static void test_sync_multi_consumer(void)
{
sem_wait(&sem);
 
-   __sync_fetch_and_add(&counter, 1);
+   atomic_fetch_add(&counter, 1);
sw_sync_timeline_inc(timeline, 1);
}
 
@@ -554,7 +555,7 @@ static void * test_sync_multi_consumer_producer_thread(void 
*arg)
if (sync_fence_wait(fence, 1000) < 0)
return (void *) 1;
 
-   if (__sync_fetch_and_add(data->counter, 1) != next_point)
+   if (atomic_fetch_add(data->counter, 1) != next_point)
return (void *) 1;
 
/* Kick off the next thread. */
@@ -570,7 +571,7 @@ static void test_sync_multi_consumer_producer(void)
data_t data_arr[MULTI_CONSUMER_PRODUCER_THREADS];
pthread_t thread_arr[MULTI_CONSUMER_PRODUCER_THREADS];
int timeline;
-   uint32_t counter = 0;
+   _Atomic(uint32_t) counter = 0;
uintptr_t thread_ret = 0;
data_t data;
int i, ret;
@@ -900,4 +901,3 @@ igt_main
igt_subtest("sync_random_merge")
test_sync_random_merge();
 }
-
-- 
2.20.1

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

[Intel-gfx] [PATCH i-g-t v3 3/4] i915/gem_create: use atomic_* instead of __sync_*

2019-06-18 Thread Guillaume Tucker
This fixes builds on some architectures, in particular MIPS which
doesn't have __sync_add_and_fetch_8 and __sync_val_compare_and_swap_8
for 64-bit variable handling.

* replace calls to the older __sync_* functions with the new atomic_*
  standard ones
* use the _Atomic type modifier as required with stdatomic.h functions
* add dependency for gem_create on libatomic

Signed-off-by: Guillaume Tucker 
Reviewed-by: Simon Ser 
---

Notes:
v2: use atomic_* and only link libatomic with gem_create

 tests/Makefile.am   |  2 +-
 tests/i915/gem_create.c | 16 
 tests/meson.build   |  9 -
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5a428b8ac213..bbd386c9c2db 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -90,7 +90,7 @@ AM_LDFLAGS = -Wl,--as-needed
 drm_import_export_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
 drm_import_export_LDADD = $(LDADD) -lpthread
 gem_create_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
-gem_create_LDADD = $(LDADD) -lpthread
+gem_create_LDADD = $(LDADD) -lpthread -latomic
 gem_close_race_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
 gem_close_race_LDADD = $(LDADD) -lpthread
 gem_ctx_thrash_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c
index 43cbf45f289b..9008cd8a21e3 100644
--- a/tests/i915/gem_create.c
+++ b/tests/i915/gem_create.c
@@ -45,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -156,7 +157,14 @@ static void invalid_nonaligned_size(int fd)
gem_close(fd, create.handle);
 }
 
-static uint64_t get_npages(uint64_t *global, uint64_t npages)
+static uint64_t atomic_compare_swap_u64(_Atomic(uint64_t) *ptr,
+   uint64_t oldval, uint64_t newval)
+{
+   atomic_compare_exchange_strong(ptr, &oldval, newval);
+   return oldval;
+}
+
+static uint64_t get_npages(_Atomic(uint64_t) *global, uint64_t npages)
 {
uint64_t try, old, max;
 
@@ -165,13 +173,13 @@ static uint64_t get_npages(uint64_t *global, uint64_t 
npages)
old = max;
try = 1 + npages % (max / 2);
max -= try;
-   } while ((max = __sync_val_compare_and_swap(global, old, max)) != old);
+   } while ((max = atomic_compare_swap_u64(global, old, max)) != old);
 
return try;
 }
 
 struct thread_clear {
-   uint64_t max;
+   _Atomic(uint64_t) max;
int timeout;
int i915;
 };
@@ -202,7 +210,7 @@ static void *thread_clear(void *data)
}
gem_close(i915, create.handle);
 
-   __sync_add_and_fetch(&arg->max, npages);
+   atomic_fetch_add(&arg->max, npages);
}
 
return NULL;
diff --git a/tests/meson.build b/tests/meson.build
index f168fbbae2a8..ffd432d38193 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -110,7 +110,6 @@ i915_progs = [
'gem_close_race',
'gem_concurrent_blit',
'gem_cpu_reloc',
-   'gem_create',
'gem_cs_prefetch',
'gem_cs_tlb',
'gem_ctx_bad_destroy',
@@ -277,6 +276,14 @@ foreach prog : i915_progs
test_list += prog
 endforeach
 
+test_executables += executable('gem_create',
+  join_paths('i915', 'gem_create.c'),
+  dependencies : test_deps + [ libatomic ],
+  install_dir : libexecdir,
+  install_rpath : libexecdir_rpathdir,
+  install : true)
+test_list += 'gem_create'
+
 test_executables += executable('gem_ctx_sseu',
   join_paths('i915', 'gem_ctx_sseu.c'),
   dependencies : test_deps + [ lib_igt_perf ],
-- 
2.20.1

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

[Intel-gfx] [PATCH i-g-t v3 2/4] gitlab-ci: add libatomic to docker images

2019-06-18 Thread Guillaume Tucker
Add libatomic to the Fedora docker image so it can link binaries that
use __atomic_* functions.  Also explicitly add libatomic1 to Debian
docker images as it is needed in particular on non-x86 architectures
for run-time linkage.

Signed-off-by: Guillaume Tucker 
---

Notes:
v2: add libatomic1 in Debian docker images
v3: add libatomic1 for non-x86 arches in Debian docker images

 Dockerfile.debian   | 1 +
 Dockerfile.debian-arm64 | 1 +
 Dockerfile.debian-armhf | 1 +
 Dockerfile.fedora   | 2 +-
 4 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Dockerfile.debian b/Dockerfile.debian
index b9c3be3945e0..d23591850c4e 100644
--- a/Dockerfile.debian
+++ b/Dockerfile.debian
@@ -6,6 +6,7 @@ RUN apt-get install -y \
flex \
bison \
pkg-config \
+   libatomic1 \
libpciaccess-dev \
libkmod-dev \
libprocps-dev \
diff --git a/Dockerfile.debian-arm64 b/Dockerfile.debian-arm64
index 7b3a3c7ca803..c9fb28c804b8 100644
--- a/Dockerfile.debian-arm64
+++ b/Dockerfile.debian-arm64
@@ -14,6 +14,7 @@ RUN dpkg --add-architecture arm64
 RUN apt-get update
 RUN apt-get install -y \
gcc-aarch64-linux-gnu \
+   libatomic1:arm64 \
libpciaccess-dev:arm64 \
libkmod-dev:arm64 \
libprocps-dev:arm64 \
diff --git a/Dockerfile.debian-armhf b/Dockerfile.debian-armhf
index c67a1e2acf6a..3a133d849d68 100644
--- a/Dockerfile.debian-armhf
+++ b/Dockerfile.debian-armhf
@@ -14,6 +14,7 @@ RUN dpkg --add-architecture armhf
 RUN apt-get update
 RUN apt-get install -y \
gcc-arm-linux-gnueabihf \
+   libatomic1:armhf \
libpciaccess-dev:armhf \
libkmod-dev:armhf \
libprocps-dev:armhf \
diff --git a/Dockerfile.fedora b/Dockerfile.fedora
index 6686e587613d..c84b412b0723 100644
--- a/Dockerfile.fedora
+++ b/Dockerfile.fedora
@@ -1,7 +1,7 @@
 FROM fedora:30
 
 RUN dnf install -y \
-   gcc flex bison meson ninja-build xdotool \
+   gcc flex bison libatomic meson ninja-build xdotool \
'pkgconfig(libdrm)' \
'pkgconfig(pciaccess)' \
'pkgconfig(libkmod)' \
-- 
2.20.1

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

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/6] dma-buf: add dynamic DMA-buf handling v10

2019-06-18 Thread Patchwork
== Series Details ==

Series: series starting with [1/6] dma-buf: add dynamic DMA-buf handling v10
URL   : https://patchwork.freedesktop.org/series/62299/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
82449d2b5de6 dma-buf: add dynamic DMA-buf handling v10
-:11: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description 
(prefer a maximum 75 chars per line)
#11: 
map/unmap callbacks are always called with the lock of the reservation object

-:508: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch 
author 'Christian König '

total: 0 errors, 2 warnings, 0 checks, 445 lines checked
30bcd20803c2 drm/ttm: remove the backing store if no placement is given
-:36: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch 
author 'Christian König '

total: 0 errors, 1 warnings, 0 checks, 18 lines checked
054ac5e03be1 drm/ttm: use the parent resv for ghost objects v2
-:88: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch 
author 'Christian König '

total: 0 errors, 1 warnings, 0 checks, 62 lines checked
68121d1e94ed drm/amdgpu: use allowed_domains for exported DMA-bufs
-:36: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch 
author 'Christian König '

total: 0 errors, 1 warnings, 0 checks, 17 lines checked
51ed3e34adf1 drm/amdgpu: add independent DMA-buf export v6
-:338: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch 
author 'Christian König '

total: 0 errors, 1 warnings, 0 checks, 293 lines checked
4ceddd8e2b97 drm/amdgpu: add independent DMA-buf import v6
-:276: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch 
author 'Christian König '

total: 0 errors, 1 warnings, 0 checks, 219 lines checked

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

[Intel-gfx] [PATCH i-g-t v3 1/4] meson: add libatomic dependency

2019-06-18 Thread Guillaume Tucker
Add conditional dependency on libatomic in order to be able to use the
__atomic_* functions instead of the older __sync_* ones.  The
libatomic library is only needed when there aren't any native support
on the current architecture, so a linker test is used for this
purpose.  This enables atomic operations to be on a wider number of
architectures including MIPS.

Signed-off-by: Guillaume Tucker 
---

Notes:
v2: add linker test for libatomic
v3: use null_dep

 meson.build | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/meson.build b/meson.build
index 6268c58d3634..118ad667ffb5 100644
--- a/meson.build
+++ b/meson.build
@@ -180,6 +180,20 @@ realtime = cc.find_library('rt')
 dlsym = cc.find_library('dl')
 zlib = cc.find_library('z')
 
+if cc.links('''
+#include 
+int main(void) {
+  uint32_t x32 = 0;
+  uint64_t x64 = 0;
+  __atomic_load_n(&x32, __ATOMIC_SEQ_CST);
+  __atomic_load_n(&x64, __ATOMIC_SEQ_CST);
+  return 0;
+}''', name : 'built-in atomics')
+   libatomic = null_dep
+else
+   libatomic = cc.find_library('atomic')
+endif
+
 if cc.has_header('linux/kd.h')
config.set('HAVE_LINUX_KD_H', 1)
 endif
-- 
2.20.1

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

[Intel-gfx] [PATCH i-g-t v3 0/4] Use C11 atomics

2019-06-18 Thread Guillaume Tucker
This series replaces calls to the __sync_* functions with the more
recent atomic_* ones defined in stdatomic.h in gem_create and
sw_sync.  It also adds dependency on libatomic when required, that is
to say when the CPU architecture doesn't provide native support for
some atomic operations.  This makes the tests more portable, in
particular for 32-bit MIPS which doesn't support 64-bit atomics.

v2:
 - add linker test to only add dependency on libatomic when needed
 - only add libatomic dependency to gem_create and sw_sync
 - use stdatomic.h and _Atomic type modifier
 - explicitly require libatomic in all Docker images

v3:
 - use sub-arch libatomic1 in Debian docker images
 - use null_dep in meson.build

Guillaume Tucker (4):
  meson: add libatomic dependency
  gitlab-ci: add libatomic to docker images
  i915/gem_create: use atomic_* instead of __sync_*
  tests/sw_sync: use atomic_* instead of __sync_*

 Dockerfile.debian   |  1 +
 Dockerfile.debian-arm64 |  1 +
 Dockerfile.debian-armhf |  1 +
 Dockerfile.fedora   |  2 +-
 meson.build | 14 ++
 tests/Makefile.am   |  3 ++-
 tests/i915/gem_create.c | 16 
 tests/meson.build   | 17 +++--
 tests/sw_sync.c | 12 ++--
 9 files changed, 53 insertions(+), 14 deletions(-)

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

[Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [1/6] dma-buf: add dynamic DMA-buf handling v10

2019-06-18 Thread Patchwork
== Series Details ==

Series: series starting with [1/6] dma-buf: add dynamic DMA-buf handling v10
URL   : https://patchwork.freedesktop.org/series/62299/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Sparse version: v0.5.2
Commit: dma-buf: add dynamic DMA-buf handling v10
Okay!

Commit: drm/ttm: remove the backing store if no placement is given
Okay!

Commit: drm/ttm: use the parent resv for ghost objects v2
Okay!

Commit: drm/amdgpu: use allowed_domains for exported DMA-bufs
Okay!

Commit: drm/amdgpu: add independent DMA-buf export v6
-drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c:89:5: warning: symbol 
'amdgpu_gem_prime_mmap' was not declared. Should it be static?
-drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c:333:27: warning: symbol 
'amdgpu_gem_prime_res_obj' was not declared. Should it be static?
-O:drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c:324:26: warning: symbol 
'amdgpu_dmabuf_ops' was not declared. Should it be static?
-drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c:406:16: warning: symbol 
'amdgpu_gem_prime_export' was not declared. Should it be static?
-drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c:439:23: warning: symbol 
'amdgpu_gem_prime_import_sg_table' was not declared. Should it be static?
-drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c:488:23: warning: symbol 
'amdgpu_gem_prime_import' was not declared. Should it be static?
-O:drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c:49:17: warning: symbol 
'amdgpu_gem_prime_get_sg_table' was not declared. Should it be static?
-drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c:51:6: warning: symbol 
'amdgpu_gem_prime_vmap' was not declared. Should it be static?
-drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c:71:6: warning: symbol 
'amdgpu_gem_prime_vunmap' was not declared. Should it be static?

Commit: drm/amdgpu: add independent DMA-buf import v6
Okay!

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

Re: [Intel-gfx] [PATCH 48/59] drm/vgem: Ditch attach trickery in the fence ioctl

2019-06-18 Thread Chris Wilson
Quoting Daniel Vetter (2019-06-14 21:36:04)
> It looks like this was done purely to get a consistent place to look
> up the reservation object pointer. With the drm_prime.c helper code
> now also setting gem_object->resv for imported objects we can just use
> that pointer directly, instead of first ensuring a dma-buf exists.

Oh. commit 1ba627148ef5 ("drm: Add reservation_object to drm_gem_object")
embedded a reservation_object into the struct. I was wondering what on
earth I was doing if the code should have been so simple.

References: 1ba627148ef5 ("drm: Add reservation_object to drm_gem_object")
> Signed-off-by: Daniel Vetter 
Reviewed-by: Chris Wilson 

Quick leave before I start ranting about the horrors of
reservation_object.
-Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH 4/4] drm/i915: Drop the _INCOMPLETE for has_infoframe

2019-06-18 Thread Imre Deak
On Wed, Jun 12, 2019 at 04:08:01PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä 
> 
> We have full infoframe readout now so we can replace the
> PIPE_CONF_CHECK_BOOL_INCOMPLETE(has_infoframe) with the normal
> PIPE_CONF_CHECK_BOOL(has_infoframe).
> 
> Signed-off-by: Ville Syrjälä 

Reviewed-by: Imre Deak 

Looks like has_audio has the readout too in place.

> ---
>  drivers/gpu/drm/i915/intel_display.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c 
> b/drivers/gpu/drm/i915/intel_display.c
> index ec3b7e825613..72fb04863acd 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -12570,7 +12570,7 @@ intel_pipe_config_compare(const struct 
> intel_crtc_state *current_config,
>  
>   PIPE_CONF_CHECK_BOOL(hdmi_scrambling);
>   PIPE_CONF_CHECK_BOOL(hdmi_high_tmds_clock_ratio);
> - PIPE_CONF_CHECK_BOOL_INCOMPLETE(has_infoframe);
> + PIPE_CONF_CHECK_BOOL(has_infoframe);
>  
>   PIPE_CONF_CHECK_BOOL_INCOMPLETE(has_audio);
>  
> -- 
> 2.21.0
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Intel-gfx] [PATCH i-g-t v3 1/1] gitlab-ci: add build and tests for MIPS

2019-06-18 Thread Guillaume Tucker
Add Docker image and Gitlab CI steps to run builds and tests for the
MIPS architecture using Debian Stretch with backports.

Signed-off-by: Guillaume Tucker 
---

Notes:
v2: use stretch-backports and require libatomic1
v3: add mips ci tests and require Debian libatomic1 for mips

 .gitlab-ci.yml | 42 ++
 Dockerfile.debian-mips | 39 +++
 meson-cross-mips.txt   | 12 
 3 files changed, 93 insertions(+)
 create mode 100644 Dockerfile.debian-mips
 create mode 100644 meson-cross-mips.txt

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 771143a9ea95..bd9619e7e28b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -90,6 +90,17 @@ build:tests-debian-meson-arm64:
 paths:
   - build
 
+build:tests-debian-meson-mips:
+  image: $CI_REGISTRY/$CI_PROJECT_PATH/igt-debian-mips:latest
+  stage: build
+  script:
+- export PKG_CONFIG_PATH=/usr/lib/mips-linux-gnu/pkgconfig/
+- meson --cross-file meson-cross-mips.txt build
+- ninja -C build
+  artifacts:
+paths:
+  - build
+
 build:tests-debian-autotools:
   image: $CI_REGISTRY/$CI_PROJECT_PATH/igt-debian:latest
   stage: build
@@ -145,6 +156,20 @@ test:ninja-test-armhf:
   - build
 when: on_failure
 
+test:ninja-test-mips:
+  image: $CI_REGISTRY/$CI_PROJECT_PATH/igt-debian-mips:latest
+  dependencies:
+- build:tests-debian-meson-mips
+  stage: test
+  script:
+- export PKG_CONFIG_PATH=/usr/lib/mips-linux-gnu/pkgconfig/
+- env > build/envdump.txt
+- ninja -C build test
+  artifacts:
+paths:
+  - build
+when: on_failure
+
 test:test-list-diff:
   dependencies:
 - build:tests-debian-autotools
@@ -221,6 +246,23 @@ containers:igt-debian-arm64:
 - docker build -t $CI_REGISTRY/$CI_PROJECT_PATH/igt-debian-arm64 -f 
Dockerfile.debian-arm64 .
 - docker push $CI_REGISTRY/$CI_PROJECT_PATH/igt-debian-arm64
 
+containers:igt-debian-mips:
+  stage: containers
+  image: docker:stable
+  only:
+changes:
+  - Dockerfile.debian-mips
+  - .gitlab-ci.yml
+  services:
+- docker:dind
+  variables:
+DOCKER_HOST: tcp://docker:2375
+DOCKER_DRIVER: overlay2
+  script:
+- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
+- docker build -t $CI_REGISTRY/$CI_PROJECT_PATH/igt-debian-mips -f 
Dockerfile.debian-mips .
+- docker push $CI_REGISTRY/$CI_PROJECT_PATH/igt-debian-mips
+
 containers:igt-fedora:
   stage: containers
   image: docker:stable
diff --git a/Dockerfile.debian-mips b/Dockerfile.debian-mips
new file mode 100644
index ..ee29f5f4ccda
--- /dev/null
+++ b/Dockerfile.debian-mips
@@ -0,0 +1,39 @@
+FROM debian:stretch-backports
+
+RUN apt-get update
+RUN apt-get install -y \
+   flex \
+   bison \
+   pkg-config \
+   x11proto-dri2-dev \
+   python-docutils \
+   valgrind \
+   peg
+
+RUN dpkg --add-architecture mips
+RUN apt-get update
+RUN apt-get install -y \
+   gcc-mips-linux-gnu \
+   libatomic1:mips \
+   libpciaccess-dev:mips \
+   libkmod-dev:mips \
+   libprocps-dev:mips \
+   libunwind-dev:mips \
+   libdw-dev:mips \
+   zlib1g-dev:mips \
+   liblzma-dev:mips \
+   libcairo-dev:mips \
+   libpixman-1-dev:mips \
+   libudev-dev:mips \
+   libgsl-dev:mips \
+   libasound2-dev:mips \
+   libjson-c-dev:mips \
+   libcurl4-openssl-dev:mips \
+   libxrandr-dev:mips \
+   libxv-dev:mips
+
+RUN apt-get install -t stretch-backports -y \
+   meson \
+   libdrm-dev:mips \
+   qemu-user \
+   qemu-user-static
diff --git a/meson-cross-mips.txt b/meson-cross-mips.txt
new file mode 100644
index ..6350d677e0bc
--- /dev/null
+++ b/meson-cross-mips.txt
@@ -0,0 +1,12 @@
+[binaries]
+c = '/usr/bin/mips-linux-gnu-gcc'
+ar = '/usr/bin/mips-linux-gnu-gcc-ar'
+strip = '/usr/bin/mips-linux-gnu-strip'
+pkgconfig = 'pkg-config'
+exe_wrapper = 'qemu-mips'
+
+[host_machine]
+system = 'linux'
+cpu_family = 'mips'
+cpu = 'mips'
+endian = 'big'
-- 
2.20.1

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

Re: [Intel-gfx] [PATCH] drm/i915/blt: Remove recursive vma->lock

2019-06-18 Thread Matthew Auld
On Tue, 18 Jun 2019 at 10:53, Chris Wilson  wrote:
>
> As we have already plugged the w->dma into the reservation_object, and
> have set ourselves up to automatically signal the request and w->dma on
> completion, we do not need to export the rq->fence directly and just use
> the w->dma fence.
>
> This avoids having to take the reservation_lock inside the worker which
> cross-release lockdep would complain about. :)
>
> Signed-off-by: Chris Wilson 
> Cc: Matthew Auld 
> ---
> Patch based on the i915_active overhaul, but on the face of it should be
> safe without. But let's pretend it does need the overhaul as this is one
> of the motivations :)
> -Chris
> ---
>  drivers/gpu/drm/i915/gem/i915_gem_client_blt.c| 10 ++
>  .../gpu/drm/i915/gem/selftests/i915_gem_client_blt.c  | 11 ---
>  2 files changed, 6 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_client_blt.c 
> b/drivers/gpu/drm/i915/gem/i915_gem_client_blt.c
> index f253ec5765ad..83b5c5d13b93 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_client_blt.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_client_blt.c
> @@ -193,10 +193,12 @@ static void clear_pages_worker(struct work_struct *work)
> goto out_request;
> }
>
> -   /* XXX: more feverish nightmares await */
> -   i915_vma_lock(vma);
> -   err = i915_vma_move_to_active(vma, rq, EXEC_OBJECT_WRITE);
> -   i915_vma_unlock(vma);
> +   /*
> +* w->dma is already exported via (vma|obj)->resv we need only
> +* keep track of the GPU activity within this vma/request, and
> +* propagate the signal from the request to w->dma.
> +*/
> +   err = i915_active_ref(&vma->active, rq->fence.context, &rq->fence);
> if (err)
> goto out_request;

Oh, wow ~o~

Yeah, seems to work locally with the extra ref + active count
tracking, so I guess should fit nicely with your i915_active.acquire,
Reviewed-by: Matthew Auld 
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH] drm/i915: Switch to per-crtc vblank vfuncs

2019-06-18 Thread Jani Nikula
On Tue, 18 Jun 2019, Ville Syrjala  wrote:
> From: Ville Syrjälä 
>
> Switch from the driver-wide vblank vfuncs to the per-crtc ones so that
> we don't have so many platform specific vfuncs in the driver struct.
>
> We still need to do something about the rest fo the irq vfuncs...

We'll also need to do something about having all of this in
intel_display.c. Would intel_crtc.[ch] be too close to intel_crt.[ch]?

Also, intel_encoder.[ch]?

Or, move everything *else* out of intel_display.c?

Not part of this patch, obviously. Some comments inline.

>
> Signed-off-by: Ville Syrjälä 
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 104 ---
>  drivers/gpu/drm/i915/i915_irq.c  |  93 +++--
>  drivers/gpu/drm/i915/i915_irq.h  |  14 +++
>  3 files changed, 143 insertions(+), 68 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
> b/drivers/gpu/drm/i915/display/intel_display.c
> index 8d7e4c8b60bc..dc602a8a52fe 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -13556,7 +13556,7 @@ u32 intel_crtc_get_vblank_counter(struct intel_crtc 
> *crtc)
>   if (!vblank->max_vblank_count)
>   return (u32)drm_crtc_accurate_vblank_count(&crtc->base);
>  
> - return dev->driver->get_vblank_counter(dev, crtc->pipe);
> + return crtc->base.funcs->get_vblank_counter(&crtc->base);
>  }
>  
>  static void intel_update_crtc(struct drm_crtc *crtc,
> @@ -14094,18 +14094,6 @@ static int intel_atomic_commit(struct drm_device 
> *dev,
>   return 0;
>  }
>  
> -static const struct drm_crtc_funcs intel_crtc_funcs = {
> - .gamma_set = drm_atomic_helper_legacy_gamma_set,
> - .set_config = drm_atomic_helper_set_config,
> - .destroy = intel_crtc_destroy,
> - .page_flip = drm_atomic_helper_page_flip,
> - .atomic_duplicate_state = intel_crtc_duplicate_state,
> - .atomic_destroy_state = intel_crtc_destroy_state,
> - .set_crc_source = intel_crtc_set_crc_source,
> - .verify_crc_source = intel_crtc_verify_crc_source,
> - .get_crc_sources = intel_crtc_get_crc_sources,
> -};
> -
>  struct wait_rps_boost {
>   struct wait_queue_entry wait;
>  
> @@ -14899,8 +14887,76 @@ static void intel_crtc_init_scalers(struct 
> intel_crtc *crtc,
>   scaler_state->scaler_id = -1;
>  }
>  
> +#define INTEL_CRTC_FUNCS \
> + .gamma_set = drm_atomic_helper_legacy_gamma_set, \
> + .set_config = drm_atomic_helper_set_config, \
> + .destroy = intel_crtc_destroy, \
> + .page_flip = drm_atomic_helper_page_flip, \
> + .atomic_duplicate_state = intel_crtc_duplicate_state, \
> + .atomic_destroy_state = intel_crtc_destroy_state, \
> + .set_crc_source = intel_crtc_set_crc_source, \
> + .verify_crc_source = intel_crtc_verify_crc_source, \
> + .get_crc_sources = intel_crtc_get_crc_sources
> +
> +static const struct drm_crtc_funcs bdw_crtc_funcs = {
> + INTEL_CRTC_FUNCS,
> +
> + .get_vblank_counter = g4x_get_vblank_counter,
> + .enable_vblank = bdw_enable_vblank,
> + .disable_vblank = bdw_disable_vblank,
> +};
> +
> +static const struct drm_crtc_funcs ilk_crtc_funcs = {
> + INTEL_CRTC_FUNCS,
> +
> + .get_vblank_counter = g4x_get_vblank_counter,
> + .enable_vblank = ilk_enable_vblank,
> + .disable_vblank = ilk_disable_vblank,
> +};
> +
> +static const struct drm_crtc_funcs g4x_crtc_funcs = {
> + INTEL_CRTC_FUNCS,
> +
> + .get_vblank_counter = g4x_get_vblank_counter,
> + .enable_vblank = i965_enable_vblank,
> + .disable_vblank = i965_disable_vblank,
> +};
> +
> +static const struct drm_crtc_funcs i965_crtc_funcs = {
> + INTEL_CRTC_FUNCS,
> +
> + .get_vblank_counter = i915_get_vblank_counter,
> + .enable_vblank = i965_enable_vblank,
> + .disable_vblank = i965_disable_vblank,
> +};
> +
> +static const struct drm_crtc_funcs i945gm_crtc_funcs = {
> + INTEL_CRTC_FUNCS,
> +
> + .get_vblank_counter = i915_get_vblank_counter,
> + .enable_vblank = i945gm_enable_vblank,
> + .disable_vblank = i945gm_disable_vblank,
> +};
> +
> +static const struct drm_crtc_funcs i915_crtc_funcs = {
> + INTEL_CRTC_FUNCS,
> +
> + .get_vblank_counter = i915_get_vblank_counter,
> + .enable_vblank = i8xx_enable_vblank,
> + .disable_vblank = i8xx_disable_vblank,
> +};
> +
> +static const struct drm_crtc_funcs i8xx_crtc_funcs = {
> + INTEL_CRTC_FUNCS,
> +
> + /* no hw vblank counter */
> + .enable_vblank = i8xx_enable_vblank,
> + .disable_vblank = i8xx_disable_vblank,
> +};
> +
>  static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
>  {
> + const struct drm_crtc_funcs *funcs;
>   struct intel_crtc *intel_crtc;
>   struct intel_crtc_state *crtc_state = NULL;
>   struct intel_plane *primary = NULL;
> @@ -14944,10 +15000,28 @@ static int intel_crtc_init(struct drm_i915_private 
> *dev_priv, enum pipe pipe)
>   }
> 

Re: [Intel-gfx] [PATCH 4/4] drm/i915: Drop the _INCOMPLETE for has_infoframe

2019-06-18 Thread Ville Syrjälä
On Tue, Jun 18, 2019 at 03:34:46PM +0300, Imre Deak wrote:
> On Wed, Jun 12, 2019 at 04:08:01PM +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä 
> > 
> > We have full infoframe readout now so we can replace the
> > PIPE_CONF_CHECK_BOOL_INCOMPLETE(has_infoframe) with the normal
> > PIPE_CONF_CHECK_BOOL(has_infoframe).
> > 
> > Signed-off-by: Ville Syrjälä 
> 
> Reviewed-by: Imre Deak 
> 
> Looks like has_audio has the readout too in place.

I suppose audio is using INCOMPLETE due to lack of ELD readout?

> 
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c 
> > b/drivers/gpu/drm/i915/intel_display.c
> > index ec3b7e825613..72fb04863acd 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -12570,7 +12570,7 @@ intel_pipe_config_compare(const struct 
> > intel_crtc_state *current_config,
> >  
> > PIPE_CONF_CHECK_BOOL(hdmi_scrambling);
> > PIPE_CONF_CHECK_BOOL(hdmi_high_tmds_clock_ratio);
> > -   PIPE_CONF_CHECK_BOOL_INCOMPLETE(has_infoframe);
> > +   PIPE_CONF_CHECK_BOOL(has_infoframe);
> >  
> > PIPE_CONF_CHECK_BOOL_INCOMPLETE(has_audio);
> >  
> > -- 
> > 2.21.0
> > 
> > ___
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

[Intel-gfx] [PATCH] drm/i915: Use drm_gem_object.resv

2019-06-18 Thread Chris Wilson
Since commit 1ba627148ef5 ("drm: Add reservation_object to
drm_gem_object"), struct drm_gem_object grew its own builtin
reservation_object rendering our own private own bloat. Remove our
redundant reservation_object and point into obj->base.resv instead.

Signed-off-by: Chris Wilson 
Cc: Tvrtko Ursulin 
Cc: Matthew Auld 
Cc: Mika Kuoppala 
---
 drivers/gpu/drm/i915/display/intel_display.c |  6 +++---
 drivers/gpu/drm/i915/gem/i915_gem_busy.c |  9 +
 drivers/gpu/drm/i915/gem/i915_gem_clflush.c  |  5 +++--
 drivers/gpu/drm/i915/gem/i915_gem_client_blt.c   |  4 ++--
 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c   |  4 ++--
 drivers/gpu/drm/i915/gem/i915_gem_fence.c|  4 ++--
 drivers/gpu/drm/i915/gem/i915_gem_object.c   |  4 
 drivers/gpu/drm/i915/gem/i915_gem_object.h   | 10 +-
 drivers/gpu/drm/i915/gem/i915_gem_object_types.h | 16 
 drivers/gpu/drm/i915/gem/i915_gem_wait.c |  7 ---
 drivers/gpu/drm/i915/i915_gem_batch_pool.c   |  4 ++--
 drivers/gpu/drm/i915/i915_request.c  |  4 ++--
 drivers/gpu/drm/i915/i915_vma.c  | 10 +-
 13 files changed, 35 insertions(+), 52 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 8d7e4c8b60bc..ad5cccf4413d 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -14256,7 +14256,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
 */
if (needs_modeset(crtc_state)) {
ret = 
i915_sw_fence_await_reservation(&intel_state->commit_ready,
- old_obj->resv, 
NULL,
+ 
old_obj->base.resv, NULL,
  false, 0,
  GFP_KERNEL);
if (ret < 0)
@@ -14300,13 +14300,13 @@ intel_prepare_plane_fb(struct drm_plane *plane,
struct dma_fence *fence;
 
ret = 
i915_sw_fence_await_reservation(&intel_state->commit_ready,
- obj->resv, NULL,
+ obj->base.resv, NULL,
  false, I915_FENCE_TIMEOUT,
  GFP_KERNEL);
if (ret < 0)
return ret;
 
-   fence = reservation_object_get_excl_rcu(obj->resv);
+   fence = reservation_object_get_excl_rcu(obj->base.resv);
if (fence) {
add_rps_boost_after_vblank(new_state->crtc, fence);
dma_fence_put(fence);
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_busy.c 
b/drivers/gpu/drm/i915/gem/i915_gem_busy.c
index 5a5eda3003e9..6ad93a09968c 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_busy.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_busy.c
@@ -110,13 +110,14 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data,
 *
 */
 retry:
-   seq = raw_read_seqcount(&obj->resv->seq);
+   seq = raw_read_seqcount(&obj->base.resv->seq);
 
/* Translate the exclusive fence to the READ *and* WRITE engine */
-   args->busy = busy_check_writer(rcu_dereference(obj->resv->fence_excl));
+   args->busy =
+   busy_check_writer(rcu_dereference(obj->base.resv->fence_excl));
 
/* Translate shared fences to READ set of engines */
-   list = rcu_dereference(obj->resv->fence);
+   list = rcu_dereference(obj->base.resv->fence);
if (list) {
unsigned int shared_count = list->shared_count, i;
 
@@ -128,7 +129,7 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data,
}
}
 
-   if (args->busy && read_seqcount_retry(&obj->resv->seq, seq))
+   if (args->busy && read_seqcount_retry(&obj->base.resv->seq, seq))
goto retry;
 
err = 0;
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_clflush.c 
b/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
index 9018e12b536b..5295285d5843 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
@@ -143,11 +143,12 @@ bool i915_gem_clflush_object(struct drm_i915_gem_object 
*obj,
dma_fence_get(&clflush->dma);
 
i915_sw_fence_await_reservation(&clflush->wait,
-   obj->resv, NULL,
+   obj->base.resv, NULL,
true, I915_FENCE_TIMEOUT,
I915_FENCE_GFP);
 
-   reservation_object_add_excl_fence(obj->resv, &clflush->dma);
+   reservation_object_add_exc

  1   2   3   >