Re: [Intel-gfx] [PATCH v4 2/4] drm/i915: Add _TRANS2()

2019-04-20 Thread Pandiyan, Dhinakaran
On Wed, 2019-04-17 at 15:37 -0700, José Roberto de Souza wrote:
> A new macro that is going to be added in a further patch will need to
> adjust the offset returned by _MMIO_TRANS2(), so here adding
> _TRANS2() and moving most of the implementation of _MMIO_TRANS2() to
> it and while at it taking the opportunity to rename pipe to trans.
> 
> Cc: Rodrigo Vivi 
> Signed-off-by: José Roberto de Souza 
> ---
>  drivers/gpu/drm/i915/i915_reg.h | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index b74824f0b5b1..9ef306b79e0d 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -250,9 +250,10 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
>  #define _MMIO_PIPE2(pipe, reg)   _MMIO(INTEL_INFO(dev_priv)-
> >pipe_offsets[pipe] - \
> INTEL_INFO(dev_priv)-
> >pipe_offsets[PIPE_A] + (reg) + \
> DISPLAY_MMIO_BASE(dev_priv))
> -#define _MMIO_TRANS2(pipe, reg)  _MMIO(INTEL_INFO(dev_priv)-
> >trans_offsets[(pipe)] - \
> -   INTEL_INFO(dev_priv)-
> >trans_offsets[TRANSCODER_A] + (reg) + \
> -   DISPLAY_MMIO_BASE(dev_priv))
> +#define _TRANS2(trans, reg)  (INTEL_INFO(dev_priv)-
_TRANS() and _MMIO_TRANS() name the first argument "tran"

Can you please keep the same name "tran"?

Reviewed-by: Dhinakaran Pandiyan 

> >trans_offsets[(trans)] - \
> +  INTEL_INFO(dev_priv)-
> >trans_offsets[TRANSCODER_A] + (reg) + \
> +  DISPLAY_MMIO_BASE(dev_priv))
> +#define _MMIO_TRANS2(trans, reg) _MMIO(_TRANS2(trans, reg))
>  #define _CURSOR2(pipe, reg)  _MMIO(INTEL_INFO(dev_priv)-
> >cursor_offsets[(pipe)] - \
> INTEL_INFO(dev_priv)-
> >cursor_offsets[PIPE_A] + (reg) + \
> DISPLAY_MMIO_BASE(dev_priv))
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Intel-gfx] ✓ Fi.CI.IGT: success for series starting with [v5,1/3] drm/i915/bdw+: Move misc display IRQ handling to it own function

2019-04-20 Thread Patchwork
== Series Details ==

Series: series starting with [v5,1/3] drm/i915/bdw+: Move misc display IRQ 
handling to it own function
URL   : https://patchwork.freedesktop.org/series/59787/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5964_full -> Patchwork_12853_full


Summary
---

  **WARNING**

  Minor unknown changes coming with Patchwork_12853_full need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_12853_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_12853_full:

### IGT changes ###

 Warnings 

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- shard-skl:  PASS -> ( 2 PASS ) +55

  
Known issues


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

### IGT changes ###

 Issues hit 

  * igt@gem_busy@extended-parallel-bsd1:
- shard-iclb: NOTRUN -> SKIP [fdo#109276] +3

  * igt@gem_ctx_isolation@vcs0-s3:
- shard-kbl:  NOTRUN -> DMESG-WARN [fdo#108566]

  * igt@gem_exec_parse@basic-rejected:
- shard-iclb: NOTRUN -> SKIP [fdo#109289] +2

  * igt@gem_exec_schedule@preempt-other-chain-blt:
- shard-snb:  NOTRUN -> SKIP [fdo#109271] +108

  * igt@gem_mocs_settings@mocs-reset-ctx-dirty-render:
- shard-iclb: NOTRUN -> SKIP [fdo#110206]

  * igt@gem_tiled_swapping@non-threaded:
- shard-iclb: PASS -> INCOMPLETE [fdo#107713] / [fdo#108686]
- shard-glk:  PASS -> DMESG-WARN [fdo#108686]

  * igt@i915_pm_rpm@debugfs-forcewake-user:
- shard-skl:  NOTRUN -> INCOMPLETE [fdo#107807]

  * igt@i915_pm_rpm@universal-planes:
- shard-skl:  PASS -> INCOMPLETE [fdo#107807]

  * igt@i915_suspend@debugfs-reader:
- shard-kbl:  PASS -> DMESG-WARN [fdo#108566] +2

  * igt@kms_atomic_transition@4x-modeset-transitions:
- shard-snb:  NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +10

  * igt@kms_busy@extended-modeset-hang-oldfb-render-d:
- shard-skl:  NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +6

  * igt@kms_chamelium@dp-frame-dump:
- shard-iclb: NOTRUN -> SKIP [fdo#109284] +1

  * igt@kms_concurrent@pipe-e:
- shard-apl:  NOTRUN -> SKIP [fdo#109271] / [fdo#109278]

  * igt@kms_cursor_legacy@cursora-vs-flipb-varying-size:
- shard-iclb: NOTRUN -> SKIP [fdo#109274] +3

  * igt@kms_flip@2x-plain-flip-ts-check:
- shard-apl:  NOTRUN -> SKIP [fdo#109271] +20

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-pwrite:
- shard-iclb: PASS -> FAIL [fdo#103167] +5

  * igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-blt:
- shard-skl:  NOTRUN -> SKIP [fdo#109271] +86

  * igt@kms_frontbuffer_tracking@fbcpsr-2p-scndscrn-cur-indfb-onoff:
- shard-iclb: NOTRUN -> SKIP [fdo#109280] +4

  * igt@kms_frontbuffer_tracking@psr-1p-primscrn-pri-shrfb-draw-mmap-wc:
- shard-skl:  NOTRUN -> FAIL [fdo#103167]

  * igt@kms_frontbuffer_tracking@psr-suspend:
- shard-skl:  NOTRUN -> INCOMPLETE [fdo#104108] / [fdo#106978]

  * igt@kms_lease@cursor_implicit_plane:
- shard-skl:  NOTRUN -> FAIL [fdo#110278]

  * igt@kms_lease@page_flip_implicit_plane:
- shard-skl:  NOTRUN -> FAIL [fdo#110281]

  * igt@kms_pipe_crc_basic@nonblocking-crc-pipe-f:
- shard-iclb: NOTRUN -> SKIP [fdo#109278]

  * igt@kms_plane_alpha_blend@pipe-a-alpha-7efc:
- shard-kbl:  NOTRUN -> FAIL [fdo#108145]

  * igt@kms_plane_alpha_blend@pipe-a-coverage-7efc:
- shard-skl:  NOTRUN -> FAIL [fdo#108145] +1

  * igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
- shard-skl:  PASS -> FAIL [fdo#108145] / [fdo#110403]

  * igt@kms_psr@psr2_cursor_blt:
- shard-iclb: PASS -> SKIP [fdo#109441] +1

  * igt@kms_psr@psr2_primary_mmap_cpu:
- shard-iclb: NOTRUN -> SKIP [fdo#109441] +1

  * igt@kms_rotation_crc@multiplane-rotation-cropping-bottom:
- shard-kbl:  PASS -> DMESG-FAIL [fdo#105763]

  * igt@kms_sysfs_edid_timing:
- shard-iclb: PASS -> FAIL [fdo#100047]
- shard-skl:  NOTRUN -> FAIL [fdo#100047]

  * igt@kms_universal_plane@disable-primary-vs-flip-pipe-d:
- shard-kbl:  NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +4

  * igt@kms_vblank@pipe-a-ts-continuation-suspend:
- shard-apl:  PASS -> DMESG-WARN [fdo#108566]

  * igt@prime_nv_api@i915_self_import_to_different_fd:
- shard-iclb: NOTRUN -> SKIP [fdo#109291]

  * igt@prime_nv_pcopy@test3_4:
- shard-kbl:  NOTRUN -> SKIP [fdo#109271] +36

  
 Possible fixes 

  * 

[Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [v5,1/3] drm/i915/bdw+: Move misc display IRQ handling to it own function

2019-04-20 Thread Patchwork
== Series Details ==

Series: series starting with [v5,1/3] drm/i915/bdw+: Move misc display IRQ 
handling to it own function
URL   : https://patchwork.freedesktop.org/series/59787/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5964 -> Patchwork_12853


Summary
---

  **SUCCESS**

  No regressions found.

  External URL: 
https://patchwork.freedesktop.org/api/1.0/series/59787/revisions/1/mbox/

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@amdgpu/amd_cs_nop@fork-compute0:
- fi-icl-y:   NOTRUN -> SKIP [fdo#109315] +17

  * igt@gem_exec_basic@basic-bsd2:
- fi-icl-y:   NOTRUN -> SKIP [fdo#109276] +7

  * igt@gem_exec_parse@basic-rejected:
- fi-icl-y:   NOTRUN -> SKIP [fdo#109289] +1

  * igt@i915_selftest@live_contexts:
- fi-bdw-gvtdvm:  PASS -> DMESG-FAIL [fdo#110235 ]

  * igt@kms_chamelium@dp-crc-fast:
- fi-icl-y:   NOTRUN -> SKIP [fdo#109284] +8

  * igt@kms_force_connector_basic@force-load-detect:
- fi-icl-y:   NOTRUN -> SKIP [fdo#109285] +3

  * igt@kms_frontbuffer_tracking@basic:
- fi-byt-clapper: PASS -> FAIL [fdo#103167]

  * igt@kms_pipe_crc_basic@read-crc-pipe-b:
- fi-byt-clapper: PASS -> FAIL [fdo#103191] +1

  * igt@kms_psr@primary_mmap_gtt:
- fi-icl-y:   NOTRUN -> SKIP [fdo#110189] +3

  * igt@prime_vgem@basic-fence-flip:
- fi-icl-y:   NOTRUN -> SKIP [fdo#109294]

  
 Possible fixes 

  * igt@i915_selftest@live_hangcheck:
- fi-skl-iommu:   INCOMPLETE [fdo#108602] / [fdo#108744] -> PASS

  * igt@kms_pipe_crc_basic@read-crc-pipe-a-frame-sequence:
- fi-byt-clapper: FAIL [fdo#103191] -> PASS

  
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
  [fdo#108602]: https://bugs.freedesktop.org/show_bug.cgi?id=108602
  [fdo#108744]: https://bugs.freedesktop.org/show_bug.cgi?id=108744
  [fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
  [fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
  [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
  [fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
  [fdo#109294]: https://bugs.freedesktop.org/show_bug.cgi?id=109294
  [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
  [fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
  [fdo#110235 ]: https://bugs.freedesktop.org/show_bug.cgi?id=110235 


Participating hosts (45 -> 39)
--

  Additional (1): fi-icl-y 
  Missing(7): fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-bwr-2160 
fi-ctg-p8600 fi-icl-u3 fi-bdw-samus 


Build changes
-

  * Linux: CI_DRM_5964 -> Patchwork_12853

  CI_DRM_5964: 9b6a59cae93143b34f19ed05c84b6a0eb668c52c @ 
git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4959: 504367d33b787de2ba8e007a5b620cfd6f0b3074 @ 
git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_12853: e13cbaaf2c48d49058b34f4ca8871cc8c2ddfd46 @ 
git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

e13cbaaf2c48 drm/i915: Make PSR registers relative to transcoders
2395a4b837cc drm/i915: Add _TRANS2()
c17cacf29b8b drm/i915/bdw+: Move misc display IRQ handling to it own function

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12853/
___
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 [v5,1/3] drm/i915/bdw+: Move misc display IRQ handling to it own function

2019-04-20 Thread Patchwork
== Series Details ==

Series: series starting with [v5,1/3] drm/i915/bdw+: Move misc display IRQ 
handling to it own function
URL   : https://patchwork.freedesktop.org/series/59787/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Sparse version: v0.5.2
Commit: drm/i915/bdw+: Move misc display IRQ handling to it own function
Okay!

Commit: drm/i915: Add _TRANS2()
Okay!

Commit: drm/i915: Make PSR registers relative to transcoders
-drivers/gpu/drm/i915/selftests/../i915_drv.h:3619:16: warning: expression 
using sizeof(void)
+drivers/gpu/drm/i915/selftests/../i915_drv.h:3618:16: warning: expression 
using sizeof(void)

___
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 [v5,1/3] drm/i915/bdw+: Move misc display IRQ handling to it own function

2019-04-20 Thread Patchwork
== Series Details ==

Series: series starting with [v5,1/3] drm/i915/bdw+: Move misc display IRQ 
handling to it own function
URL   : https://patchwork.freedesktop.org/series/59787/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
c17cacf29b8b drm/i915/bdw+: Move misc display IRQ handling to it own function
2395a4b837cc drm/i915: Add _TRANS2()
-:31: WARNING:LONG_LINE: line over 100 characters
#31: FILE: drivers/gpu/drm/i915/i915_reg.h:254:
+
INTEL_INFO(dev_priv)->trans_offsets[TRANSCODER_A] + (reg) + \

total: 0 errors, 1 warnings, 0 checks, 13 lines checked
e13cbaaf2c48 drm/i915: Make PSR registers relative to transcoders
-:166: WARNING:LONG_LINE: line over 100 characters
#166: FILE: drivers/gpu/drm/i915/i915_reg.h:4225:
+#define _PSR_ADJ(tran, reg)(IS_HASWELL(dev_priv) ? 
_HSW_PSR_ADJ(reg) : _TRANS2(tran, reg))

-:166: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'reg' - possible 
side-effects?
#166: FILE: drivers/gpu/drm/i915/i915_reg.h:4225:
+#define _PSR_ADJ(tran, reg)(IS_HASWELL(dev_priv) ? 
_HSW_PSR_ADJ(reg) : _TRANS2(tran, reg))

-:189: WARNING:LONG_LINE_COMMENT: line over 100 characters
#189: FILE: drivers/gpu/drm/i915/i915_reg.h:4275:
+#define EDP_PSR_AUX_DATA(tran, i)  _MMIO(_PSR_ADJ(tran, 
_SRD_AUX_DATA_A) + (i) + 4) /* 5 registers */

total: 0 errors, 2 warnings, 1 checks, 316 lines checked

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

[Intel-gfx] [PATCH v5 2/3] drm/i915: Add _TRANS2()

2019-04-20 Thread José Roberto de Souza
A new macro that is going to be added in a further patch will need to
adjust the offset returned by _MMIO_TRANS2(), so here adding
_TRANS2() and moving most of the implementation of _MMIO_TRANS2() to
it and while at it taking the opportunity to rename pipe to trans.

Cc: Rodrigo Vivi 
Cc: Dhinakaran Pandiyan 
Reviewed-by: Dhinakaran Pandiyan 
Signed-off-by: José Roberto de Souza 
---
 drivers/gpu/drm/i915/i915_reg.h | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index b74824f0b5b1..31163415479d 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -250,9 +250,10 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define _MMIO_PIPE2(pipe, reg) 
_MMIO(INTEL_INFO(dev_priv)->pipe_offsets[pipe] - \
  
INTEL_INFO(dev_priv)->pipe_offsets[PIPE_A] + (reg) + \
  DISPLAY_MMIO_BASE(dev_priv))
-#define _MMIO_TRANS2(pipe, reg)
_MMIO(INTEL_INFO(dev_priv)->trans_offsets[(pipe)] - \
- 
INTEL_INFO(dev_priv)->trans_offsets[TRANSCODER_A] + (reg) + \
- DISPLAY_MMIO_BASE(dev_priv))
+#define _TRANS2(tran, reg) 
(INTEL_INFO(dev_priv)->trans_offsets[(tran)] - \
+
INTEL_INFO(dev_priv)->trans_offsets[TRANSCODER_A] + (reg) + \
+DISPLAY_MMIO_BASE(dev_priv))
+#define _MMIO_TRANS2(tran, reg)_MMIO(_TRANS2(tran, reg))
 #define _CURSOR2(pipe, reg)
_MMIO(INTEL_INFO(dev_priv)->cursor_offsets[(pipe)] - \
  
INTEL_INFO(dev_priv)->cursor_offsets[PIPE_A] + (reg) + \
  DISPLAY_MMIO_BASE(dev_priv))
-- 
2.21.0

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

[Intel-gfx] [PATCH v5 3/3] drm/i915: Make PSR registers relative to transcoders

2019-04-20 Thread José Roberto de Souza
PSR registers are a mess, some have the full address while others just
have the additional offset from psr_mmio_base.

For BDW+ psr_mmio_base is nothing more than TRANSCODER_EDP_OFFSET +
0x800 and using it makes more difficult for people with an PSR
register address or PSR register name from from BSpec as i915 also
don't match the BSpec names.
For HSW psr_mmio_base is _DDI_BUF_CTL_A + 0x800 and PSR registers are
only available in DDIA.

Other reason to make relative to transcoder is that since BDW every
transcoder have PSR registers, so in theory it should be possible to
have PSR enabled in a non-eDP transcoder.

So for BDW+ we can use _TRANS2() to get the register offset of any
PSR register in any transcoder while for HSW we have _HSW_PSR_ADJ
that will calculate the register offset for the single PSR instance,
noting that we are already guarded about trying to enable PSR in other
port than DDIA on HSW by the 'if (dig_port->base.port != PORT_A)' in
intel_psr_compute_config(), this check should only be valid for HSW
and will be changed in future.
PSR2 registers and PSR_EVENT was added after Haswell so that is why
_PSR_ADJ() is not used in some macros.

The only registers that can not be relative to transcoder are
PSR_IMR and PSR_IIR that are not relative to anything, so keeping it
hardcoded.

Also removing BDW_EDP_PSR_BASE from GVT because it is not used as it
is the only PSR register that GVT have.

v5:
- Macros changed to be more explicit about HSW (Dhinakaran)
- Squashed with the patch that added the tran parameter to the
macros (Dhinakaran)

Cc: Dhinakaran Pandiyan 
Cc: Rodrigo Vivi 
Cc: Jani Nikula 
Cc: Ville Syrjälä 
Cc: Zhi Wang 
Signed-off-by: José Roberto de Souza 
---
 drivers/gpu/drm/i915/gvt/handlers.c |  1 -
 drivers/gpu/drm/i915/i915_debugfs.c | 18 +
 drivers/gpu/drm/i915/i915_drv.h |  3 +-
 drivers/gpu/drm/i915/i915_reg.h | 57 -
 drivers/gpu/drm/i915/intel_psr.c| 55 
 5 files changed, 83 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/handlers.c 
b/drivers/gpu/drm/i915/gvt/handlers.c
index 18f01eeb2510..749e3e4204f2 100644
--- a/drivers/gpu/drm/i915/gvt/handlers.c
+++ b/drivers/gpu/drm/i915/gvt/handlers.c
@@ -2776,7 +2776,6 @@ static int init_broadwell_mmio_info(struct intel_gvt *gvt)
MMIO_D(CHICKEN_PIPESL_1(PIPE_C), D_BDW_PLUS);
 
MMIO_D(WM_MISC, D_BDW);
-   MMIO_D(_MMIO(BDW_EDP_PSR_BASE), D_BDW);
 
MMIO_D(_MMIO(0x6671c), D_BDW_PLUS);
MMIO_D(_MMIO(0x66c00), D_BDW_PLUS);
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index 5823ffb17821..2a0f5871e9a8 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2470,7 +2470,7 @@ psr_source_status(struct drm_i915_private *dev_priv, 
struct seq_file *m)
"BUF_ON",
"TG_ON"
};
-   val = I915_READ(EDP_PSR2_STATUS);
+   val = I915_READ(EDP_PSR2_STATUS(dev_priv->psr.transcoder));
status_val = (val & EDP_PSR2_STATUS_STATE_MASK) >>
  EDP_PSR2_STATUS_STATE_SHIFT;
if (status_val < ARRAY_SIZE(live_status))
@@ -2486,7 +2486,7 @@ psr_source_status(struct drm_i915_private *dev_priv, 
struct seq_file *m)
"SRDOFFACK",
"SRDENT_ON",
};
-   val = I915_READ(EDP_PSR_STATUS);
+   val = I915_READ(EDP_PSR_STATUS(dev_priv->psr.transcoder));
status_val = (val & EDP_PSR_STATUS_STATE_MASK) >>
  EDP_PSR_STATUS_STATE_SHIFT;
if (status_val < ARRAY_SIZE(live_status))
@@ -2529,10 +2529,10 @@ static int i915_edp_psr_status(struct seq_file *m, void 
*data)
goto unlock;
 
if (psr->psr2_enabled) {
-   val = I915_READ(EDP_PSR2_CTL);
+   val = I915_READ(EDP_PSR2_CTL(dev_priv->psr.transcoder));
enabled = val & EDP_PSR2_ENABLE;
} else {
-   val = I915_READ(EDP_PSR_CTL);
+   val = I915_READ(EDP_PSR_CTL(dev_priv->psr.transcoder));
enabled = val & EDP_PSR_ENABLE;
}
seq_printf(m, "Source PSR ctl: %s [0x%08x]\n",
@@ -2545,7 +2545,8 @@ static int i915_edp_psr_status(struct seq_file *m, void 
*data)
 * SKL+ Perf counter is reset to 0 everytime DC state is entered
 */
if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
-   val = I915_READ(EDP_PSR_PERF_CNT) & EDP_PSR_PERF_CNT_MASK;
+   val = I915_READ(EDP_PSR_PERF_CNT(dev_priv->psr.transcoder));
+   val &= EDP_PSR_PERF_CNT_MASK;
seq_printf(m, "Performance counter: %u\n", val);
}
 
@@ -2563,8 +2564,11 @@ static int i915_edp_psr_status(struct seq_file *m, void 
*data)
 * Reading all 3 registers before hand to minimize 

[Intel-gfx] [PATCH v5 1/3] drm/i915/bdw+: Move misc display IRQ handling to it own function

2019-04-20 Thread José Roberto de Souza
Just moving it to reduce the tabs and avoid break code lines.
No behavior changes intended here.

v2:
- Reading misc display IRQ outside of gen8_de_misc_irq_handler() as
other irq handlers (Dhinakaran)

Cc: Dhinakaran Pandiyan 
Reviewed-by: Dhinakaran Pandiyan 
Reviewed-by: Rodrigo Vivi 
Signed-off-by: José Roberto de Souza 
---
 drivers/gpu/drm/i915/i915_irq.c | 45 ++---
 1 file changed, 25 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index b92cfd69134b..a1299f10ed49 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -2768,6 +2768,28 @@ static u32 gen8_de_port_aux_mask(struct drm_i915_private 
*dev_priv)
return mask;
 }
 
+static void
+gen8_de_misc_irq_handler(struct drm_i915_private *dev_priv, u32 iir)
+{
+   bool found = false;
+
+   if (iir & GEN8_DE_MISC_GSE) {
+   intel_opregion_asle_intr(dev_priv);
+   found = true;
+   }
+
+   if (iir & GEN8_DE_EDP_PSR) {
+   u32 psr_iir = I915_READ(EDP_PSR_IIR);
+
+   intel_psr_irq_handler(dev_priv, psr_iir);
+   I915_WRITE(EDP_PSR_IIR, psr_iir);
+   found = true;
+   }
+
+   if (!found)
+   DRM_ERROR("Unexpected DE Misc interrupt\n");
+}
+
 static irqreturn_t
 gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
 {
@@ -2778,29 +2800,12 @@ gen8_de_irq_handler(struct drm_i915_private *dev_priv, 
u32 master_ctl)
if (master_ctl & GEN8_DE_MISC_IRQ) {
iir = I915_READ(GEN8_DE_MISC_IIR);
if (iir) {
-   bool found = false;
-
I915_WRITE(GEN8_DE_MISC_IIR, iir);
ret = IRQ_HANDLED;
-
-   if (iir & GEN8_DE_MISC_GSE) {
-   intel_opregion_asle_intr(dev_priv);
-   found = true;
-   }
-
-   if (iir & GEN8_DE_EDP_PSR) {
-   u32 psr_iir = I915_READ(EDP_PSR_IIR);
-
-   intel_psr_irq_handler(dev_priv, psr_iir);
-   I915_WRITE(EDP_PSR_IIR, psr_iir);
-   found = true;
-   }
-
-   if (!found)
-   DRM_ERROR("Unexpected DE Misc interrupt\n");
-   }
-   else
+   gen8_de_misc_irq_handler(dev_priv, iir);
+   } else {
DRM_ERROR("The master control interrupt lied (DE 
MISC)!\n");
+   }
}
 
if (INTEL_GEN(dev_priv) >= 11 && (master_ctl & GEN11_DE_HPD_IRQ)) {
-- 
2.21.0

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

Re: [Intel-gfx] [patch V2 14/29] dm bufio: Simplify stack trace retrieval

2019-04-20 Thread Alexander Potapenko
On Thu, Apr 18, 2019 at 1:54 PM Thomas Gleixner  wrote:
>
> On Thu, 18 Apr 2019, Alexander Potapenko wrote:
> > On Thu, Apr 18, 2019 at 11:06 AM Thomas Gleixner  wrote:
> > > -   save_stack_trace(>stack_trace);
> > > +   b->stack_len = stack_trace_save(b->stack_entries, MAX_STACK, 2);
> > As noted in one of similar patches before, can we have an inline
> > comment to indicate what does this "2" stand for?
>
> Come on. We have gazillion of functions which take numerical constant
> arguments. Should we add comments to all of them?
Ok, sorry. I might not be familiar enough with the kernel style guide.
> Thanks,
>
> tglx



-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [patch V2 08/29] mm/kmemleak: Simplify stacktrace handling

2019-04-20 Thread Catalin Marinas
On Thu, Apr 18, 2019 at 10:41:27AM +0200, Thomas Gleixner wrote:
> Replace the indirection through struct stack_trace by using the storage
> array based interfaces.
> 
> Signed-off-by: Thomas Gleixner 
> Cc: Catalin Marinas 
> Cc: linux...@kvack.org

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

Re: [Intel-gfx] [patch V2 28/29] stacktrace: Provide common infrastructure

2019-04-20 Thread Mike Rapoport
On Thu, Apr 18, 2019 at 10:41:47AM +0200, Thomas Gleixner wrote:
> All architectures which support stacktrace carry duplicated code and
> do the stack storage and filtering at the architecture side.
> 
> Provide a consolidated interface with a callback function for consuming the
> stack entries provided by the architecture specific stack walker. This
> removes lots of duplicated code and allows to implement better filtering
> than 'skip number of entries' in the future without touching any
> architecture specific code.
> 
> Signed-off-by: Thomas Gleixner 
> Cc: linux-a...@vger.kernel.org
> ---
>  include/linux/stacktrace.h |   38 +
>  kernel/stacktrace.c|  173 
> +
>  lib/Kconfig|4 +
>  3 files changed, 215 insertions(+)
> 
> --- a/include/linux/stacktrace.h
> +++ b/include/linux/stacktrace.h
> @@ -23,6 +23,43 @@ unsigned int stack_trace_save_regs(struc
>  unsigned int stack_trace_save_user(unsigned long *store, unsigned int size);
> 
>  /* Internal interfaces. Do not use in generic code */
> +#ifdef CONFIG_ARCH_STACKWALK
> +
> +/**
> + * stack_trace_consume_fn - Callback for arch_stack_walk()
> + * @cookie:  Caller supplied pointer handed back by arch_stack_walk()
> + * @addr:The stack entry address to consume
> + * @reliable:True when the stack entry is reliable. Required by
> + *   some printk based consumers.
> + *
> + * Returns:  True, if the entry was consumed or skipped
> + *   False, if there is no space left to store
> + */
> +typedef bool (*stack_trace_consume_fn)(void *cookie, unsigned long addr,
> +bool reliable);
> +/**
> + * arch_stack_walk - Architecture specific function to walk the stack
> +

Nit: no '*' at line beginning makes kernel-doc unhappy

> + * @consume_entry:   Callback which is invoked by the architecture code for
> + *   each entry.
> + * @cookie:  Caller supplied pointer which is handed back to
> + *   @consume_entry
> + * @task:Pointer to a task struct, can be NULL
> + * @regs:Pointer to registers, can be NULL
> + *
> + * @task @regs:
> + * NULL  NULLStack trace from current
> + * task  NULLStack trace from task (can be current)
> + * NULL  regsStack trace starting on regs->stackpointer

This will render as a single line with 'make *docs'.
Adding line separators makes this actually a table in the generated docs:

 *  === 
 * task regs
 *  === 
 * NULL NULLStack trace from current
 * task NULLStack trace from task (can be current)
 * NULL regsStack trace starting on regs->stackpointer
 *  === 


> + */
> +void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
> +  struct task_struct *task, struct pt_regs *regs);
> +int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry, void 
> *cookie,
> +  struct task_struct *task);
> +void arch_stack_walk_user(stack_trace_consume_fn consume_entry, void *cookie,
> +   const struct pt_regs *regs);
> +
> +#else /* CONFIG_ARCH_STACKWALK */
>  struct stack_trace {
>   unsigned int nr_entries, max_entries;
>   unsigned long *entries;
> @@ -37,6 +74,7 @@ extern void save_stack_trace_tsk(struct
>  extern int save_stack_trace_tsk_reliable(struct task_struct *tsk,
>struct stack_trace *trace);
>  extern void save_stack_trace_user(struct stack_trace *trace);
> +#endif /* !CONFIG_ARCH_STACKWALK */
>  #endif /* CONFIG_STACKTRACE */
> 
>  #if defined(CONFIG_STACKTRACE) && defined(CONFIG_HAVE_RELIABLE_STACKTRACE)
> --- a/kernel/stacktrace.c
> +++ b/kernel/stacktrace.c
> @@ -5,6 +5,8 @@
>   *
>   *  Copyright (C) 2006 Red Hat, Inc., Ingo Molnar 
>   */
> +#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -64,6 +66,175 @@ int stack_trace_snprint(char *buf, size_
>  }
>  EXPORT_SYMBOL_GPL(stack_trace_snprint);
> 
> +#ifdef CONFIG_ARCH_STACKWALK
> +
> +struct stacktrace_cookie {
> + unsigned long   *store;
> + unsigned intsize;
> + unsigned intskip;
> + unsigned intlen;
> +};
> +
> +static bool stack_trace_consume_entry(void *cookie, unsigned long addr,
> +   bool reliable)
> +{
> + struct stacktrace_cookie *c = cookie;
> +
> + if (c->len >= c->size)
> + return false;
> +
> + if (c->skip > 0) {
> + c->skip--;
> + return true;
> + }
> + c->store[c->len++] = addr;
> + return c->len < c->size;
> +}
> +
> +static bool stack_trace_consume_entry_nosched(void *cookie, unsigned long 
> addr,
> +  

Re: [Intel-gfx] [patch V2 14/29] dm bufio: Simplify stack trace retrieval

2019-04-20 Thread Alexander Potapenko
On Thu, Apr 18, 2019 at 11:06 AM Thomas Gleixner  wrote:
>
> Replace the indirection through struct stack_trace with an invocation of
> the storage array based interface.
>
> Signed-off-by: Thomas Gleixner 
> Cc: dm-de...@redhat.com
> Cc: Mike Snitzer 
> Cc: Alasdair Kergon 
> ---
>  drivers/md/dm-bufio.c |   15 ++-
>  1 file changed, 6 insertions(+), 9 deletions(-)
>
> --- a/drivers/md/dm-bufio.c
> +++ b/drivers/md/dm-bufio.c
> @@ -150,7 +150,7 @@ struct dm_buffer {
> void (*end_io)(struct dm_buffer *, blk_status_t);
>  #ifdef CONFIG_DM_DEBUG_BLOCK_STACK_TRACING
>  #define MAX_STACK 10
> -   struct stack_trace stack_trace;
> +   unsigned int stack_len;
> unsigned long stack_entries[MAX_STACK];
>  #endif
>  };
> @@ -232,11 +232,7 @@ static DEFINE_MUTEX(dm_bufio_clients_loc
>  #ifdef CONFIG_DM_DEBUG_BLOCK_STACK_TRACING
>  static void buffer_record_stack(struct dm_buffer *b)
>  {
> -   b->stack_trace.nr_entries = 0;
> -   b->stack_trace.max_entries = MAX_STACK;
> -   b->stack_trace.entries = b->stack_entries;
> -   b->stack_trace.skip = 2;
> -   save_stack_trace(>stack_trace);
> +   b->stack_len = stack_trace_save(b->stack_entries, MAX_STACK, 2);
As noted in one of similar patches before, can we have an inline
comment to indicate what does this "2" stand for?
>  }
>  #endif
>
> @@ -438,7 +434,7 @@ static struct dm_buffer *alloc_buffer(st
> adjust_total_allocated(b->data_mode, (long)c->block_size);
>
>  #ifdef CONFIG_DM_DEBUG_BLOCK_STACK_TRACING
> -   memset(>stack_trace, 0, sizeof(b->stack_trace));
> +   b->stack_len = 0;
>  #endif
> return b;
>  }
> @@ -1520,8 +1516,9 @@ static void drop_buffers(struct dm_bufio
> DMERR("leaked buffer %llx, hold count %u, list %d",
>   (unsigned long long)b->block, b->hold_count, i);
>  #ifdef CONFIG_DM_DEBUG_BLOCK_STACK_TRACING
> -   print_stack_trace(>stack_trace, 1);
> -   b->hold_count = 0; /* mark unclaimed to avoid BUG_ON 
> below */
> +   stack_trace_print(b->stack_entries, b->stack_len, 1);
> +   /* mark unclaimed to avoid BUG_ON below */
> +   b->hold_count = 0;
>  #endif
> }
>
>
>


-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [patch V2 03/29] lib/stackdepot: Provide functions which operate on plain storage arrays

2019-04-20 Thread Mike Rapoport
On Thu, Apr 18, 2019 at 10:41:22AM +0200, Thomas Gleixner wrote:
> The struct stack_trace indirection in the stack depot functions is a truly
> pointless excercise which requires horrible code at the callsites.
> 
> Provide interfaces based on plain storage arrays.
> 
> Signed-off-by: Thomas Gleixner 
> Acked-by: Alexander Potapenko 
> ---
>  include/linux/stackdepot.h |4 ++
>  lib/stackdepot.c   |   66 
> -
>  2 files changed, 51 insertions(+), 19 deletions(-)
> 
> --- a/include/linux/stackdepot.h
> +++ b/include/linux/stackdepot.h
> @@ -26,7 +26,11 @@ typedef u32 depot_stack_handle_t;
>  struct stack_trace;
> 
>  depot_stack_handle_t depot_save_stack(struct stack_trace *trace, gfp_t 
> flags);
> +depot_stack_handle_t stack_depot_save(unsigned long *entries,
> +   unsigned int nr_entries, gfp_t gfp_flags);
> 
>  void depot_fetch_stack(depot_stack_handle_t handle, struct stack_trace 
> *trace);
> +unsigned int stack_depot_fetch(depot_stack_handle_t handle,
> +unsigned long **entries);
> 
>  #endif
> --- a/lib/stackdepot.c
> +++ b/lib/stackdepot.c
> @@ -194,40 +194,56 @@ static inline struct stack_record *find_
>   return NULL;
>  }
> 
> -void depot_fetch_stack(depot_stack_handle_t handle, struct stack_trace 
> *trace)
> +/**
> + * stack_depot_fetch - Fetch stack entries from a depot
> + *

Nit: kernel-doc will complain about missing description of @handle.

> + * @entries: Pointer to store the entries address
> + */
> +unsigned int stack_depot_fetch(depot_stack_handle_t handle,
> +unsigned long **entries)
>  {
>   union handle_parts parts = { .handle = handle };
>   void *slab = stack_slabs[parts.slabindex];
>   size_t offset = parts.offset << STACK_ALLOC_ALIGN;
>   struct stack_record *stack = slab + offset;
> 
> - trace->nr_entries = trace->max_entries = stack->size;
> - trace->entries = stack->entries;
> - trace->skip = 0;
> + *entries = stack->entries;
> + return stack->size;
> +}
> +EXPORT_SYMBOL_GPL(stack_depot_fetch);
> +
> +void depot_fetch_stack(depot_stack_handle_t handle, struct stack_trace 
> *trace)
> +{
> + unsigned int nent = stack_depot_fetch(handle, >entries);
> +
> + trace->max_entries = trace->nr_entries = nent;
>  }
>  EXPORT_SYMBOL_GPL(depot_fetch_stack);
> 
>  /**
> - * depot_save_stack - save stack in a stack depot.
> - * @trace - the stacktrace to save.
> - * @alloc_flags - flags for allocating additional memory if required.
> + * stack_depot_save - Save a stack trace from an array
>   *
> - * Returns the handle of the stack struct stored in depot.
> + * @entries: Pointer to storage array
> + * @nr_entries:  Size of the storage array
> + * @alloc_flags: Allocation gfp flags
> + *
> + * Returns the handle of the stack struct stored in depot

Can you please s/Returns/Return:/ so that kernel-doc will recognize this as
return section.

>   */
> -depot_stack_handle_t depot_save_stack(struct stack_trace *trace,
> - gfp_t alloc_flags)
> +depot_stack_handle_t stack_depot_save(unsigned long *entries,
> +   unsigned int nr_entries,
> +   gfp_t alloc_flags)
>  {
> - u32 hash;
> - depot_stack_handle_t retval = 0;
>   struct stack_record *found = NULL, **bucket;
> - unsigned long flags;
> + depot_stack_handle_t retval = 0;
>   struct page *page = NULL;
>   void *prealloc = NULL;
> + unsigned long flags;
> + u32 hash;
> 
> - if (unlikely(trace->nr_entries == 0))
> + if (unlikely(nr_entries == 0))
>   goto fast_exit;
> 
> - hash = hash_stack(trace->entries, trace->nr_entries);
> + hash = hash_stack(entries, nr_entries);
>   bucket = _table[hash & STACK_HASH_MASK];
> 
>   /*
> @@ -235,8 +251,8 @@ depot_stack_handle_t depot_save_stack(st
>* The smp_load_acquire() here pairs with smp_store_release() to
>* |bucket| below.
>*/
> - found = find_stack(smp_load_acquire(bucket), trace->entries,
> -trace->nr_entries, hash);
> + found = find_stack(smp_load_acquire(bucket), entries,
> +nr_entries, hash);
>   if (found)
>   goto exit;
> 
> @@ -264,10 +280,10 @@ depot_stack_handle_t depot_save_stack(st
> 
>   spin_lock_irqsave(_lock, flags);
> 
> - found = find_stack(*bucket, trace->entries, trace->nr_entries, hash);
> + found = find_stack(*bucket, entries, nr_entries, hash);
>   if (!found) {
>   struct stack_record *new =
> - depot_alloc_stack(trace->entries, trace->nr_entries,
> + depot_alloc_stack(entries, nr_entries,
> hash, , alloc_flags);
>   if (new) {
>   new->next = *bucket;
> @@ 

Re: [Intel-gfx] [PATCH 1/2] drm/i915: remove DRM_AUTH from IOCTLs which also have DRM_RENDER_ALLOW

2019-04-20 Thread Emil Velikov
On 2019/04/17, Emil Velikov wrote:
> On 2019/04/17, Christian König wrote:
> > This is to work around problems with libva and vainfo.
> > 
> This part reverts a commit from 2013. Something I would wager that will cause
> multiple problems across the board.
> 
> If we look at the intel libva driver in particular, as-is this will cause all
> get param queries on the render node to fail. Something that used to work
> since render node support was introduced.
> 
> Analogously this will break the Intel Mesa driver when using the render node
> and issuing the ioctls.
> 
Silly moment of mine - I've misread which piece gets reverted.
Pardon for the noise.

Personally I would use something like the following, which helps the reader
understand what's happening.


At the moment the following ioctls are exposed by both primary and render
nodes. Yet there's no code-flow difference based on the originating node type.
Thus in reality the exact same code is executed without the "authentication".

So let's drop the DRM_AUTH annotation.

In practise this fixes cases like (but not limited to) libva where the primary
node is opened, yet authentication is lacking prior to issuing the ioctl.

I915_GETPARAM
I915_GEM_EXECBUFFER2_WR
I915_GEM_BUSY
I915_GEM_THROTTLE
I915_GEM_WAIT

HTH
Emil


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

Re: [Intel-gfx] [PATCH 1/2] drm/i915: remove DRM_AUTH from IOCTLs which also have DRM_RENDER_ALLOW

2019-04-20 Thread Emil Velikov
On 2019/04/17, Christian König wrote:
> This is to work around problems with libva and vainfo.
> 
This part reverts a commit from 2013. Something I would wager that will cause
multiple problems across the board.

If we look at the intel libva driver in particular, as-is this will cause all
get param queries on the render node to fail. Something that used to work
since render node support was introduced.

Analogously this will break the Intel Mesa driver when using the render node
and issuing the ioctls.

HTH
Emil




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

Re: [Intel-gfx] [PATCH 1/2] include: linux: Regularise the use of FIELD_SIZEOF macro

2019-04-20 Thread Shyam Saini
Hi William,

Sorry for the late reply.

> > Currently, there are 3 different macros, namely sizeof_field, SIZEOF_FIELD
> > and FIELD_SIZEOF which are used to calculate the size of a member of
> > structure, so to bring uniformity in entire kernel source tree lets use
> > FIELD_SIZEOF and replace all occurrences of other two macros with this.
> >
> > For this purpose, redefine FIELD_SIZEOF in include/linux/stddef.h and
> > tools/testing/selftests/bpf/bpf_util.h and remove its defination from
> > include/linux/kernel.h
>
>
> > --- a/include/linux/stddef.h
> > +++ b/include/linux/stddef.h
> > @@ -20,6 +20,15 @@ enum {
> > #endif
> >
> > /**
> > + * FIELD_SIZEOF - get the size of a struct's field
> > + * @t: the target struct
> > + * @f: the target struct's field
> > + * Return: the size of @f in the struct definition without having a
> > + * declared instance of @t.
> > + */
> > +#define FIELD_SIZEOF(t, f) (sizeof(((t *)0)->f))
> > +
> > +/**
> >  * sizeof_field(TYPE, MEMBER)
> >  *
> >  * @TYPE: The structure containing the field of interest
> > @@ -34,6 +43,6 @@ enum {
> >  * @MEMBER: The member within the structure to get the end offset of
> >  */
> > #define offsetofend(TYPE, MEMBER) \
> > - (offsetof(TYPE, MEMBER) + sizeof_field(TYPE, MEMBER))
> > + (offsetof(TYPE, MEMBER) + FIELD_SIZEOF(TYPE, MEMBER))
>
> If you're doing this, why are you leaving the definition of sizeof_field() in
> stddef.h untouched?

I have removed definition of sizeof_field in [1/2] patch.

> Given the way this has worked historically, if you are leaving it in place for
> source compatibility reasons, shouldn't it be redefined in terms of
> FIELD_SIZEOF(), e.g.:
>
> #define sizeof_field(TYPE, MEMBER) FIELD_SIZEOF(TYPE, MEMBER)

Actually, never thought this way. So,Thanks a lot for this valuable feedback.

I'll re-spin and post again.
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH] drm/i915: fix spelling mistake "resseting" -> "resetting"

2019-04-20 Thread Mukesh Ojha


On 4/18/2019 4:36 PM, Colin King wrote:

From: Colin Ian King 

There is a spelling mistake in a gvt_dbg_core debug message. Fix it.

Signed-off-by: Colin Ian King 



Reviewed-by: Mukesh Ojha 

Cheers,
-Mukesh


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

diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c
index 44ce3c2b9ac1..d1e818f2b521 100644
--- a/drivers/gpu/drm/i915/gvt/vgpu.c
+++ b/drivers/gpu/drm/i915/gvt/vgpu.c
@@ -533,7 +533,7 @@ void intel_gvt_reset_vgpu_locked(struct intel_vgpu *vgpu, 
bool dmlr,
intel_engine_mask_t resetting_eng = dmlr ? ALL_ENGINES : engine_mask;
  
  	gvt_dbg_core("--\n");

-   gvt_dbg_core("resseting vgpu%d, dmlr %d, engine_mask %08x\n",
+   gvt_dbg_core("resetting vgpu%d, dmlr %d, engine_mask %08x\n",
 vgpu->id, dmlr, engine_mask);
  
  	vgpu->resetting_eng = resetting_eng;

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

Re: [Intel-gfx] [PATCH v3 00/11] drm/fb-helper: Move modesetting code to drm_client

2019-04-20 Thread Noralf Trønnes


Den 20.04.2019 12.45, skrev Noralf Trønnes:
> This moves the modesetting code from drm_fb_helper to drm_client so it
> can be shared by all internal clients.
> 
> Changes this time:
> - Use full drm_client_init/release for the modesets (Daniel Vetter)
> - drm_client_for_each_modeset: use lockdep_assert_held (Daniel Vetter)
> - Hook up to Documentation/gpu/drm-client.rst (Daniel Vetter)
> 

I got Fi.CI.IGT failures on this one:

  * igt@kms_fbcon_fbt@psr:
- shard-skl:  PASS -> FAIL

  * igt@kms_fbcon_fbt@psr-suspend:
- shard-iclb: PASS -> FAIL +1
- shard-skl:  NOTRUN -> FAIL

https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12850/
https://patchwork.freedesktop.org/series/58597/

The previous version of this series reported success:
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12720/
But AFAICT those fbcon tests didn't succeed when I look at the details.

I'd appreciate if someone with Intel CI knowledge could have a look at this.

Noralf.

> Noralf.
> 
> Noralf Trønnes (11):
>   drm/atomic: Move __drm_atomic_helper_disable_plane/set_config()
>   drm/fb-helper: Avoid race with DRM userspace
>   drm/fb-helper: No need to cache rotation and sw_rotations
>   drm/fb-helper: Remove drm_fb_helper_crtc->{x,y,desired_mode}
>   drm/fb-helper: Remove drm_fb_helper_crtc
>   drm/fb-helper: Prepare to move out commit code
>   drm/fb-helper: Move out commit code
>   drm/fb-helper: Remove drm_fb_helper_connector
>   drm/fb-helper: Prepare to move out modeset config code
>   drm/fb-helper: Move out modeset config code
>   drm/client: Hack: Add bootsplash example
> 
>  Documentation/gpu/drm-client.rst |3 +
>  Documentation/gpu/todo.rst   |   10 +
>  drivers/gpu/drm/Kconfig  |5 +
>  drivers/gpu/drm/Makefile |3 +-
>  drivers/gpu/drm/drm_atomic.c |  168 
>  drivers/gpu/drm/drm_atomic_helper.c  |  164 ---
>  drivers/gpu/drm/drm_auth.c   |   20 +
>  drivers/gpu/drm/drm_bootsplash.c |  362 +++
>  drivers/gpu/drm/drm_client.c |   17 +-
>  drivers/gpu/drm/drm_client_modeset.c | 1085 
>  drivers/gpu/drm/drm_crtc_internal.h  |5 +
>  drivers/gpu/drm/drm_drv.c|4 +
>  drivers/gpu/drm/drm_fb_helper.c  | 1381 +++---
>  drivers/gpu/drm/drm_internal.h   |2 +
>  include/drm/drm_atomic_helper.h  |4 -
>  include/drm/drm_client.h |   49 +
>  include/drm/drm_fb_helper.h  |  102 +-
>  17 files changed, 1864 insertions(+), 1520 deletions(-)
>  create mode 100644 drivers/gpu/drm/drm_bootsplash.c
>  create mode 100644 drivers/gpu/drm/drm_client_modeset.c
> 
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Intel-gfx] [drm-tip:drm-tip 9/9] drivers/acpi/processor_driver.c:69:7: error: 'INTEL_FAM6_ICELAKE_MOBILE' undeclared here (not in a function); did you mean 'CONFIG_PINCTRL_ICELAKE_MODULE'?

2019-04-20 Thread kbuild test robot
tree:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
head:   c5fdcd8bd5c596bfc70b6be93e6f04d910c51308
commit: c5fdcd8bd5c596bfc70b6be93e6f04d910c51308 [9/9] drm-tip: 
2019y-04m-19d-20h-56m-16s UTC integration manifest
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 8.1.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout c5fdcd8bd5c596bfc70b6be93e6f04d910c51308
# save the attached .config to linux build tree
GCC_VERSION=8.1.0 make.cross ARCH=ia64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 


All errors (new ones prefixed by >>):

   drivers/acpi/processor_driver.c:67:23: error: 'X86_VENDOR_INTEL' undeclared 
here (not in a function); did you mean 'X86_VENDOR_ANY'?
#define ICPU(model) { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, }
  ^~~~
   drivers/acpi/processor_driver.c:69:2: note: in expansion of macro 'ICPU'
 ICPU(INTEL_FAM6_ICELAKE_MOBILE), /* ICL */
 ^~~~
>> drivers/acpi/processor_driver.c:69:7: error: 'INTEL_FAM6_ICELAKE_MOBILE' 
>> undeclared here (not in a function); did you mean 
>> 'CONFIG_PINCTRL_ICELAKE_MODULE'?
 ICPU(INTEL_FAM6_ICELAKE_MOBILE), /* ICL */
  ^
   drivers/acpi/processor_driver.c:67:44: note: in definition of macro 'ICPU'
#define ICPU(model) { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, }
   ^
   drivers/acpi/processor_driver.c: In function '__acpi_processor_start':
   drivers/acpi/processor_driver.c:256:7: error: implicit declaration of 
function 'x86_match_cpu'; did you mean 'on_each_cpu'? 
[-Werror=implicit-function-declaration]
 id = x86_match_cpu(intel_cpu_ids);
  ^
  on_each_cpu
   drivers/acpi/processor_driver.c:256:5: warning: assignment to 'const struct 
x86_cpu_id *' from 'int' makes pointer from integer without a cast 
[-Wint-conversion]
 id = x86_match_cpu(intel_cpu_ids);
^
   cc1: some warnings being treated as errors

vim +69 drivers/acpi/processor_driver.c

1ba90e3a drivers/acpi/processor_core.c   Thomas Renninger 2007-07-23  66  
b573fba5 drivers/acpi/processor_driver.c Anshuman Gupta   2019-04-09 @67  
#define ICPU(model)   { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, }
b573fba5 drivers/acpi/processor_driver.c Anshuman Gupta   2019-04-09  68  
static const struct x86_cpu_id intel_cpu_ids[] = {
b573fba5 drivers/acpi/processor_driver.c Anshuman Gupta   2019-04-09 @69
ICPU(INTEL_FAM6_ICELAKE_MOBILE),/* ICL */
b573fba5 drivers/acpi/processor_driver.c Anshuman Gupta   2019-04-09  70
{}
b573fba5 drivers/acpi/processor_driver.c Anshuman Gupta   2019-04-09  71  };
b573fba5 drivers/acpi/processor_driver.c Anshuman Gupta   2019-04-09  72  
MODULE_DEVICE_TABLE(x86cpu, intel_cpu_ids);
b573fba5 drivers/acpi/processor_driver.c Anshuman Gupta   2019-04-09  73  

:: The code at line 69 was first introduced by commit
:: b573fba52f339dc4fadef7282af4a9413fd6173d ICL HACK: Disable ACPI idle 
driver

:: TO: Anshuman Gupta 
:: CC: Chris Wilson 

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


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

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm: Fire off KMS hotplug events if probe detect says the connector is connected (rev3)

2019-04-20 Thread Patchwork
== Series Details ==

Series: drm: Fire off KMS hotplug events if probe detect says the connector is 
connected (rev3)
URL   : https://patchwork.freedesktop.org/series/59691/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_5964 -> Patchwork_12852


Summary
---

  **FAILURE**

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

  External URL: 
https://patchwork.freedesktop.org/api/1.0/series/59691/revisions/3/mbox/

Possible new issues
---

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

### IGT changes ###

 Possible regressions 

  * igt@i915_module_load@reload-with-fault-injection:
- fi-byt-n2820:   PASS -> DMESG-WARN

  * igt@kms_chamelium@common-hpd-after-suspend:
- fi-icl-u2:  NOTRUN -> FAIL

  * igt@runner@aborted:
- fi-byt-n2820:   NOTRUN -> FAIL

  
Known issues


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

### IGT changes ###

 Issues hit 

  * igt@amdgpu/amd_cs_nop@fork-compute0:
- fi-icl-y:   NOTRUN -> SKIP [fdo#109315] +17

  * igt@amdgpu/amd_cs_nop@fork-gfx0:
- fi-icl-u2:  NOTRUN -> SKIP [fdo#109315] +17

  * igt@gem_exec_basic@basic-bsd2:
- fi-icl-y:   NOTRUN -> SKIP [fdo#109276] +7

  * igt@gem_exec_basic@readonly-bsd1:
- fi-icl-u2:  NOTRUN -> SKIP [fdo#109276] +7

  * igt@gem_exec_parse@basic-allowed:
- fi-icl-u2:  NOTRUN -> SKIP [fdo#109289] +1

  * igt@gem_exec_parse@basic-rejected:
- fi-icl-y:   NOTRUN -> SKIP [fdo#109289] +1

  * igt@i915_module_load@reload-with-fault-injection:
- fi-bsw-n3050:   PASS -> DMESG-WARN [fdo#107732]

  * igt@i915_selftest@live_contexts:
- fi-bdw-gvtdvm:  PASS -> DMESG-FAIL [fdo#110235 ]
- fi-skl-gvtdvm:  PASS -> DMESG-FAIL [fdo#110235 ]

  * igt@kms_chamelium@dp-crc-fast:
- fi-icl-y:   NOTRUN -> SKIP [fdo#109284] +8

  * igt@kms_chamelium@dp-edid-read:
- fi-icl-u2:  NOTRUN -> SKIP [fdo#109316] +2

  * igt@kms_chamelium@vga-hpd-fast:
- fi-icl-u2:  NOTRUN -> SKIP [fdo#109309] +1

  * igt@kms_force_connector_basic@force-load-detect:
- fi-icl-y:   NOTRUN -> SKIP [fdo#109285] +3

  * igt@kms_force_connector_basic@prune-stale-modes:
- fi-icl-u2:  NOTRUN -> SKIP [fdo#109285] +3

  * igt@kms_frontbuffer_tracking@basic:
- fi-byt-clapper: PASS -> FAIL [fdo#103167]

  * igt@kms_pipe_crc_basic@read-crc-pipe-b:
- fi-byt-clapper: PASS -> FAIL [fdo#103191] +1

  * igt@kms_psr@primary_mmap_gtt:
- fi-icl-y:   NOTRUN -> SKIP [fdo#110189] +3

  * igt@prime_vgem@basic-fence-flip:
- fi-icl-y:   NOTRUN -> SKIP [fdo#109294]

  * igt@runner@aborted:
- fi-bsw-n3050:   NOTRUN -> FAIL [fdo#110446]

  
 Possible fixes 

  * igt@i915_selftest@live_hangcheck:
- fi-skl-iommu:   INCOMPLETE [fdo#108602] / [fdo#108744] -> PASS

  * igt@kms_pipe_crc_basic@read-crc-pipe-a-frame-sequence:
- fi-byt-clapper: FAIL [fdo#103191] -> PASS

  
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
  [fdo#107732]: https://bugs.freedesktop.org/show_bug.cgi?id=107732
  [fdo#108602]: https://bugs.freedesktop.org/show_bug.cgi?id=108602
  [fdo#108744]: https://bugs.freedesktop.org/show_bug.cgi?id=108744
  [fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
  [fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
  [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
  [fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
  [fdo#109294]: https://bugs.freedesktop.org/show_bug.cgi?id=109294
  [fdo#109309]: https://bugs.freedesktop.org/show_bug.cgi?id=109309
  [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
  [fdo#109316]: https://bugs.freedesktop.org/show_bug.cgi?id=109316
  [fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
  [fdo#110235 ]: https://bugs.freedesktop.org/show_bug.cgi?id=110235 
  [fdo#110446]: https://bugs.freedesktop.org/show_bug.cgi?id=110446


Participating hosts (45 -> 41)
--

  Additional (2): fi-icl-y fi-icl-u2 
  Missing(6): fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-ilk-650 
fi-ctg-p8600 fi-bdw-samus 


Build changes
-

  * Linux: CI_DRM_5964 -> Patchwork_12852

  CI_DRM_5964: 9b6a59cae93143b34f19ed05c84b6a0eb668c52c @ 
git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4959: 504367d33b787de2ba8e007a5b620cfd6f0b3074 @ 
git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm: Fire off KMS hotplug events if probe detect says the connector is connected (rev3)

2019-04-20 Thread Patchwork
== Series Details ==

Series: drm: Fire off KMS hotplug events if probe detect says the connector is 
connected (rev3)
URL   : https://patchwork.freedesktop.org/series/59691/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
56fec13ce383 drm: Fire off KMS hotplug events if probe detect says the 
connector is connected
-:32: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description 
(prefer a maximum 75 chars per line)
#32: 
References: 
https://lists.freedesktop.org/archives/dri-devel/2019-April/214572.html

-:48: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch 
author 'Gwan-gyeong Mun '

total: 0 errors, 2 warnings, 0 checks, 9 lines checked

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

[Intel-gfx] [PATCH v3] drm: Fire off KMS hotplug events if probe detect says the connector is connected

2019-04-20 Thread Gwan-gyeong Mun
The hotplug detection routine of drm_helper_hpd_irq_event() can detect
changing of status of connector, but it can not detect changing of
properties of the connector.
e.g. changing of edid while suspend/resume, changing of dp lanes in dp aux.

Following scenario explains one of them; A detection of changing of edid.

 1) plug display device to a connector
 2) system suspend
 3) unplug 1)'s display device and plug the other display device to a
connector
 4) system resume

To solve explained cases, It fires off KMS hotplug events if
drm_helper_probe_detect() says the connector is connected.

Testcase: igt/kms_chamelium/hdmi-edid-change-during-hibernate
Testcase: igt/kms_chamelium/hdmi-edid-change-during-suspend
Testcase: igt/kms_chamelium/dp-edid-change-during-hibernate
Testcase: igt/kms_chamelium/dp-edid-change-during-suspend

v2: Remove suggested-by line (danvet)
v3: Remove a misused Link line and add References (Jani)

References: https://bugs.freedesktop.org/show_bug.cgi?id=105540
References: 
https://lists.freedesktop.org/archives/dri-devel/2019-April/214572.html
Signed-off-by: Gwan-gyeong Mun 
---
 drivers/gpu/drm/drm_probe_helper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_probe_helper.c 
b/drivers/gpu/drm/drm_probe_helper.c
index 6fd08e04b323..081a849104f2 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -780,7 +780,8 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev)
  connector->name,
  drm_get_connector_status_name(old_status),
  drm_get_connector_status_name(connector->status));
-   if (old_status != connector->status)
+   if (old_status != connector->status ||
+   connector->status == connector_status_connected)
changed = true;
}
drm_connector_list_iter_end(_iter);
-- 
2.21.0

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

Re: [Intel-gfx] [PATCH v2] drm: Fire off KMS hotplug events if probe detect says the connector is connected

2019-04-20 Thread Mun, Gwan-gyeong
On Thu, Apr 18, 2019 at 7:33 PM Jani Nikula  wrote:
>
> On Thu, 18 Apr 2019, Gwan-gyeong Mun  wrote:
> > The hotplug detection routine of drm_helper_hpd_irq_event() can detect
> > changing of status of connector, but it can not detect changing of
> > properties of the connector.
> > e.g. changing of edid while suspend/resume, changing of dp lanes in dp aux.
> >
> > Following scenario explains one of them; A detection of changing of edid.
> >
> >  1) plug display device to a connector
> >  2) system suspend
> >  3) unplug 1)'s display device and plug the other display device to a
> > connector
> >  4) system resume
> >
> > To solve explained cases, It fires off KMS hotplug events if
> > drm_helper_probe_detect() says the connector is connected.
> >
> > Testcase: igt/kms_chamelium/hdmi-edid-change-during-hibernate
> > Testcase: igt/kms_chamelium/hdmi-edid-change-during-suspend
> > Testcase: igt/kms_chamelium/dp-edid-change-during-hibernate
> > Testcase: igt/kms_chamelium/dp-edid-change-during-suspend
> >
> > v2: Remove suggested-by line (danvet)
> > Signed-off-by: Gwan-gyeong Mun 
> > Link: 
> > https://lists.freedesktop.org/archives/dri-devel/2019-April/214572.html
>
> Link: is something added by our tooling (dim), not to be added
> yourself. It points at the patch at patchwork using the message-id of
> the patch email.
>
> If you want to refer to some other work, please use References: tag.
>
> BR,
> Jani.
>
>
Hi,
Sorry for misusing of that. I didn't know that.
I'll replace Link to References and resend the patch as soon as possible.
Thank you for letting me know that.
Br,
G.G.
> > ---
> >  drivers/gpu/drm/drm_probe_helper.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/drm_probe_helper.c 
> > b/drivers/gpu/drm/drm_probe_helper.c
> > index 6fd08e04b323..081a849104f2 100644
> > --- a/drivers/gpu/drm/drm_probe_helper.c
> > +++ b/drivers/gpu/drm/drm_probe_helper.c
> > @@ -780,7 +780,8 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev)
> > connector->name,
> > drm_get_connector_status_name(old_status),
> > 
> > drm_get_connector_status_name(connector->status));
> > - if (old_status != connector->status)
> > + if (old_status != connector->status ||
> > + connector->status == connector_status_connected)
> >   changed = true;
> >   }
> >   drm_connector_list_iter_end(_iter);
>
> --
> Jani Nikula, Intel Open Source Graphics Center
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Gwan-gyeong Mun
___
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: Start writeback from the shrinker (rev2)

2019-04-20 Thread Patchwork
== Series Details ==

Series: drm/i915: Start writeback from the shrinker (rev2)
URL   : https://patchwork.freedesktop.org/series/25332/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5963_full -> Patchwork_12851_full


Summary
---

  **SUCCESS**

  No regressions found.

  

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@debugfs_test@read_all_entries_display_off:
- shard-skl:  PASS -> INCOMPLETE [fdo#104108]

  * igt@gem_ctx_isolation@rcs0-s3:
- shard-kbl:  PASS -> DMESG-WARN [fdo#108566] +1

  * igt@gem_eio@in-flight-suspend:
- shard-skl:  NOTRUN -> INCOMPLETE [fdo#104108] / [fdo#107773]

  * igt@gem_exec_capture@capture-bsd2:
- shard-snb:  NOTRUN -> SKIP [fdo#109271] +83

  * igt@gem_flink_basic@basic:
- shard-apl:  PASS -> INCOMPLETE [fdo#103927]

  * igt@gem_tiled_swapping@non-threaded:
- shard-iclb: PASS -> FAIL [fdo#108686]
- shard-apl:  PASS -> DMESG-WARN [fdo#108686]

  * igt@i915_pm_rpm@gem-execbuf:
- shard-skl:  PASS -> INCOMPLETE [fdo#107803] / [fdo#107807]

  * igt@i915_pm_rpm@gem-idle:
- shard-skl:  NOTRUN -> INCOMPLETE [fdo#107807]

  * igt@i915_suspend@fence-restore-tiled2untiled:
- shard-skl:  PASS -> INCOMPLETE [fdo#104108] / [fdo#107773]

  * igt@i915_suspend@forcewake:
- shard-apl:  PASS -> DMESG-WARN [fdo#108566] +4

  * igt@kms_busy@extended-modeset-hang-oldfb-render-f:
- shard-skl:  NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +17

  * igt@kms_busy@extended-pageflip-hang-newfb-render-d:
- shard-kbl:  NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +1

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-blt:
- shard-iclb: PASS -> FAIL [fdo#103167] +5

  * igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-blt:
- shard-skl:  NOTRUN -> SKIP [fdo#109271] +148

  * igt@kms_frontbuffer_tracking@psr-1p-primscrn-indfb-plflip-blt:
- shard-kbl:  NOTRUN -> SKIP [fdo#109271] +14

  * igt@kms_lease@atomic_implicit_crtc:
- shard-skl:  NOTRUN -> FAIL [fdo#110279]

  * igt@kms_lease@cursor_implicit_plane:
- shard-skl:  NOTRUN -> FAIL [fdo#110278]

  * igt@kms_lease@page_flip_implicit_plane:
- shard-skl:  NOTRUN -> FAIL [fdo#110281]

  * igt@kms_plane_alpha_blend@pipe-a-alpha-7efc:
- shard-skl:  NOTRUN -> FAIL [fdo#108145] +1

  * igt@kms_plane_alpha_blend@pipe-b-alpha-7efc:
- shard-kbl:  NOTRUN -> FAIL [fdo#108145]

  * igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
- shard-skl:  PASS -> FAIL [fdo#108145] / [fdo#110403]

  * igt@kms_plane_scaling@pipe-a-scaler-with-rotation:
- shard-snb:  NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +8

  * igt@kms_psr2_su@frontbuffer:
- shard-iclb: PASS -> SKIP [fdo#109642] +1

  * igt@kms_psr@psr2_sprite_plane_onoff:
- shard-iclb: PASS -> SKIP [fdo#109441]

  
 Possible fixes 

  * igt@gem_ctx_isolation@vecs0-s3:
- shard-kbl:  DMESG-WARN [fdo#108566] -> PASS

  * igt@i915_suspend@fence-restore-tiled2untiled:
- shard-apl:  DMESG-WARN [fdo#108566] -> PASS +1

  * igt@kms_dp_dsc@basic-dsc-enable-edp:
- shard-iclb: SKIP [fdo#109349] -> PASS

  * igt@kms_frontbuffer_tracking@fbc-1p-indfb-fliptrack:
- shard-skl:  FAIL [fdo#108040] -> PASS

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-shrfb-draw-render:
- shard-iclb: FAIL [fdo#103167] -> PASS +2

  * igt@kms_frontbuffer_tracking@psr-1p-primscrn-cur-indfb-draw-mmap-gtt:
- shard-skl:  FAIL [fdo#103167] -> PASS

  * igt@kms_plane_alpha_blend@pipe-a-constant-alpha-min:
- shard-skl:  FAIL [fdo#108145] -> PASS

  * igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
- shard-skl:  FAIL [fdo#108145] / [fdo#110403] -> PASS

  * igt@kms_plane_lowres@pipe-a-tiling-y:
- shard-iclb: FAIL [fdo#103166] -> PASS

  * igt@kms_psr@psr2_cursor_mmap_cpu:
- shard-iclb: SKIP [fdo#109441] -> PASS +1

  
 Warnings 

  * igt@i915_pm_rpm@i2c:
- shard-iclb: DMESG-FAIL [fdo#110271] -> FAIL [fdo#104097]

  * igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes:
- shard-apl:  DMESG-WARN [fdo#108566] -> INCOMPLETE [fdo#103927]

  
  {name}: This element is suppressed. This means it is ignored when computing
  the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#104097]: https://bugs.freedesktop.org/show_bug.cgi?id=104097
  [fdo#104108]: 

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Start writeback from the shrinker (rev2)

2019-04-20 Thread Patchwork
== Series Details ==

Series: drm/i915: Start writeback from the shrinker (rev2)
URL   : https://patchwork.freedesktop.org/series/25332/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5963 -> Patchwork_12851


Summary
---

  **SUCCESS**

  No regressions found.

  External URL: 
https://patchwork.freedesktop.org/api/1.0/series/25332/revisions/2/mbox/

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@amdgpu/amd_cs_nop@fork-compute0:
- fi-icl-y:   NOTRUN -> SKIP [fdo#109315] +17

  * igt@debugfs_test@read_all_entries:
- fi-icl-u2:  PASS -> INCOMPLETE [fdo#107713] / [fdo#110246]

  * igt@gem_exec_basic@basic-bsd2:
- fi-icl-y:   NOTRUN -> SKIP [fdo#109276] +7

  * igt@gem_exec_parse@basic-rejected:
- fi-icl-y:   NOTRUN -> SKIP [fdo#109289] +1

  * igt@i915_selftest@live_contexts:
- fi-bdw-gvtdvm:  PASS -> DMESG-FAIL [fdo#110235 ]

  * igt@i915_selftest@live_execlists:
- fi-apl-guc: PASS -> INCOMPLETE [fdo#103927] / [fdo#109720]

  * igt@kms_chamelium@dp-crc-fast:
- fi-icl-y:   NOTRUN -> SKIP [fdo#109284] +8

  * igt@kms_force_connector_basic@force-load-detect:
- fi-icl-y:   NOTRUN -> SKIP [fdo#109285] +3

  * igt@kms_psr@primary_mmap_gtt:
- fi-icl-y:   NOTRUN -> SKIP [fdo#110189] +3

  * igt@prime_vgem@basic-fence-flip:
- fi-icl-y:   NOTRUN -> SKIP [fdo#109294]

  * igt@runner@aborted:
- fi-apl-guc: NOTRUN -> FAIL [fdo#108622] / [fdo#109720]

  
 Possible fixes 

  * igt@gem_exec_basic@gtt-default:
- fi-skl-6770hq:  DMESG-WARN [fdo#105541] -> PASS

  
 Warnings 

  * igt@kms_chamelium@dp-crc-fast:
- fi-kbl-7500u:   DMESG-WARN [fdo#103841] -> DMESG-FAIL [fdo#109627]

  
  [fdo#103841]: https://bugs.freedesktop.org/show_bug.cgi?id=103841
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#105541]: https://bugs.freedesktop.org/show_bug.cgi?id=105541
  [fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
  [fdo#108622]: https://bugs.freedesktop.org/show_bug.cgi?id=108622
  [fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
  [fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
  [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
  [fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
  [fdo#109294]: https://bugs.freedesktop.org/show_bug.cgi?id=109294
  [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
  [fdo#109627]: https://bugs.freedesktop.org/show_bug.cgi?id=109627
  [fdo#109720]: https://bugs.freedesktop.org/show_bug.cgi?id=109720
  [fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
  [fdo#110235 ]: https://bugs.freedesktop.org/show_bug.cgi?id=110235 
  [fdo#110246]: https://bugs.freedesktop.org/show_bug.cgi?id=110246


Participating hosts (46 -> 40)
--

  Additional (1): fi-icl-y 
  Missing(7): fi-hsw-4770r fi-ilk-m540 fi-byt-squawks fi-bsw-cyan 
fi-ctg-p8600 fi-gdg-551 fi-bdw-samus 


Build changes
-

  * Linux: CI_DRM_5963 -> Patchwork_12851

  CI_DRM_5963: 1653c8da31bcdf8ec465b273e5b713e03a6c1d12 @ 
git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4959: 504367d33b787de2ba8e007a5b620cfd6f0b3074 @ 
git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_12851: 034e8a2fe897b164180ff42b6bda4441829a122c @ 
git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

034e8a2fe897 drm/i915: Start writeback from the shrinker

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12851/
___
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/fb-helper: Move modesetting code to drm_client (rev3)

2019-04-20 Thread Patchwork
== Series Details ==

Series: drm/fb-helper: Move modesetting code to drm_client (rev3)
URL   : https://patchwork.freedesktop.org/series/58597/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_5963_full -> Patchwork_12850_full


Summary
---

  **FAILURE**

  Serious unknown changes coming with Patchwork_12850_full absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_12850_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_12850_full:

### IGT changes ###

 Possible regressions 

  * igt@kms_fbcon_fbt@psr:
- shard-skl:  PASS -> FAIL

  * igt@kms_fbcon_fbt@psr-suspend:
- shard-iclb: PASS -> FAIL +1
- shard-skl:  NOTRUN -> FAIL

  
 Suppressed 

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * {igt@audio@hdmi-integrity}:
- shard-glk:  FAIL -> TIMEOUT

  
Known issues


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

### IGT changes ###

 Issues hit 

  * igt@gem_exec_capture@capture-bsd2:
- shard-snb:  NOTRUN -> SKIP [fdo#109271] +83

  * igt@gem_workarounds@suspend-resume:
- shard-apl:  PASS -> DMESG-WARN [fdo#108566] +3

  * igt@i915_pm_rpm@modeset-stress-extra-wait:
- shard-skl:  PASS -> INCOMPLETE [fdo#107807]

  * igt@kms_busy@extended-modeset-hang-oldfb-render-f:
- shard-skl:  NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +13

  * igt@kms_busy@extended-pageflip-hang-newfb-render-d:
- shard-kbl:  NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +1

  * igt@kms_busy@extended-pageflip-hang-oldfb-render-a:
- shard-snb:  PASS -> SKIP [fdo#109271] / [fdo#109278]

  * igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-blt:
- shard-skl:  NOTRUN -> SKIP [fdo#109271] +149

  * igt@kms_frontbuffer_tracking@fbc-rgb565-draw-pwrite:
- shard-glk:  PASS -> FAIL [fdo#103167]

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-indfb-draw-blt:
- shard-iclb: PASS -> FAIL [fdo#103167] +8

  * igt@kms_frontbuffer_tracking@psr-1p-primscrn-indfb-plflip-blt:
- shard-kbl:  NOTRUN -> SKIP [fdo#109271] +14

  * igt@kms_lease@cursor_implicit_plane:
- shard-skl:  NOTRUN -> FAIL [fdo#110278]

  * igt@kms_lease@page_flip_implicit_plane:
- shard-skl:  NOTRUN -> FAIL [fdo#110281]

  * igt@kms_plane_alpha_blend@pipe-b-alpha-7efc:
- shard-skl:  NOTRUN -> FAIL [fdo#108145] +2
- shard-kbl:  NOTRUN -> FAIL [fdo#108145]

  * igt@kms_plane_scaling@pipe-a-scaler-with-rotation:
- shard-snb:  NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +8

  * igt@kms_psr2_su@frontbuffer:
- shard-iclb: PASS -> SKIP [fdo#109642] +1

  * igt@kms_psr@psr2_sprite_plane_onoff:
- shard-iclb: PASS -> SKIP [fdo#109441]

  * igt@kms_rmfb@rmfb-ioctl:
- shard-snb:  PASS -> SKIP [fdo#109271]

  * igt@kms_rotation_crc@multiplane-rotation:
- shard-kbl:  PASS -> INCOMPLETE [fdo#103665]

  * igt@kms_rotation_crc@multiplane-rotation-cropping-top:
- shard-kbl:  PASS -> FAIL [fdo#109016]

  * igt@kms_setmode@basic:
- shard-apl:  PASS -> FAIL [fdo#99912]

  
 Possible fixes 

  * igt@gem_ctx_isolation@vecs0-s3:
- shard-kbl:  DMESG-WARN [fdo#108566] -> PASS

  * igt@i915_pm_rpm@debugfs-forcewake-user:
- shard-skl:  INCOMPLETE [fdo#107807] -> PASS

  * igt@i915_suspend@fence-restore-tiled2untiled:
- shard-apl:  DMESG-WARN [fdo#108566] -> PASS +7

  * igt@kms_draw_crc@draw-method-xrgb2101010-mmap-wc-xtiled:
- shard-skl:  FAIL [fdo#103184] -> PASS

  * igt@kms_frontbuffer_tracking@fbc-1p-indfb-fliptrack:
- shard-skl:  FAIL [fdo#108040] -> PASS

  * igt@kms_frontbuffer_tracking@fbc-rgb565-draw-pwrite:
- shard-iclb: FAIL [fdo#103167] -> PASS +3

  * igt@kms_frontbuffer_tracking@psr-1p-primscrn-cur-indfb-draw-mmap-gtt:
- shard-skl:  FAIL [fdo#103167] -> PASS +1

  * igt@kms_plane_alpha_blend@pipe-a-coverage-7efc:
- shard-skl:  FAIL [fdo#108145] -> PASS +1

  * igt@kms_plane_lowres@pipe-a-tiling-x:
- shard-iclb: FAIL [fdo#103166] -> PASS

  * igt@kms_plane_scaling@pipe-c-scaler-with-rotation:
- shard-glk:  SKIP [fdo#109271] / [fdo#109278] -> PASS

  * igt@kms_psr@psr2_dpms:
- shard-iclb: SKIP [fdo#109441] -> PASS

  
 Warnings 

  * igt@i915_pm_rpm@i2c:
- shard-iclb: DMESG-FAIL [fdo#110271] -> FAIL [fdo#104097]

  
  {name}: This element is 

[Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915: Start writeback from the shrinker (rev2)

2019-04-20 Thread Patchwork
== Series Details ==

Series: drm/i915: Start writeback from the shrinker (rev2)
URL   : https://patchwork.freedesktop.org/series/25332/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Sparse version: v0.5.2
Commit: drm/i915: Start writeback from the shrinker
-drivers/gpu/drm/i915/selftests/../i915_drv.h:3618:16: warning: expression 
using sizeof(void)
+drivers/gpu/drm/i915/selftests/../i915_drv.h:3619:16: warning: expression 
using sizeof(void)

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

[Intel-gfx] [CI] drm/i915: Start writeback from the shrinker

2019-04-20 Thread Chris Wilson
When we are called to relieve mempressue via the shrinker, the only way
we can make progress is either by discarding unwanted pages (those
objects that userspace has marked MADV_DONTNEED) or by reclaiming the
dirty objects via swap. As we know that is the only way to make further
progress, we can initiate the writeback as we invalidate the objects.
This means the objects we put onto the inactive anon lru list are
already marked for reclaim+writeback and so will trigger a wait upon the
writeback inside direct reclaim, greatly improving the success rate of
direct reclaim on i915 objects.

The corollary is that we may start a slow swap on opportunistic
mempressure from the likes of the compaction + migration kthreads. This
is limited by those threads only being allowed to shrink idle pages, but
also that if we reactivate the page before it is swapped out by gpu
activity, we only page the cost of repinning the page. The cost is most
felt when an object is reused after mempressure, which hopefully
excludes the latency sensitive tasks (as we are just extending the
impact of swap thrashing to them).

Apparently this is not the first time we've had this idea. Back in
commit 5537252b6b6d ("drm/i915: Invalidate our pages under memory
pressure") we wanted to start writeback but settled on invalidate after
Hugh Dickins warned us about a possibility of a deadlock within shmemfs
if we started writeback from shrink_slab. Looking at the callchain,
using writeback from i915_gem_shrink should be equivalent to the pageout
also employed by shrink_slab, i.e. it should not be any riskier afaict.

v2: Leave mmapings intact. At this point, the only mmapings of our
objects will be via CPU mmaps on the shmemfs filp, which are
out-of-scope for our LRU tracking. Instead leave those pages to the
inactive anon LRU page list for aging and pageout as normal.

v3: Be selective on which paths trigger writeback, in particular
excluding paths shrinking just to reclaim vm space (e.g. mmap, vmap
reapers) and avoid starting writeback on the entire process space from
within the pm freezer.

References: https://bugs.freedesktop.org/show_bug.cgi?id=108686
Signed-off-by: Chris Wilson 
Cc: Mika Kuoppala 
Cc: Joonas Lahtinen 
Cc: Tvrtko Ursulin 
Cc: Matthew Auld 
Cc: Daniel Vetter 
Cc: Michal Hocko 
Reviewed-by: Joonas Lahtinen  #v1
---
 drivers/gpu/drm/i915/i915_drv.h  | 13 ++--
 drivers/gpu/drm/i915/i915_gem.c  | 27 +
 drivers/gpu/drm/i915/i915_gem_shrinker.c | 75 ++--
 3 files changed, 79 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 71612e7fc8bc..dc74d33c20aa 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -3007,7 +3007,7 @@ enum i915_mm_subclass { /* lockdep subclass for 
obj->mm.lock/struct_mutex */
 
 int __i915_gem_object_put_pages(struct drm_i915_gem_object *obj,
enum i915_mm_subclass subclass);
-void __i915_gem_object_invalidate(struct drm_i915_gem_object *obj);
+void __i915_gem_object_truncate(struct drm_i915_gem_object *obj);
 
 enum i915_map_type {
I915_MAP_WB = 0,
@@ -3268,11 +3268,12 @@ unsigned long i915_gem_shrink(struct drm_i915_private 
*i915,
  unsigned long target,
  unsigned long *nr_scanned,
  unsigned flags);
-#define I915_SHRINK_PURGEABLE 0x1
-#define I915_SHRINK_UNBOUND 0x2
-#define I915_SHRINK_BOUND 0x4
-#define I915_SHRINK_ACTIVE 0x8
-#define I915_SHRINK_VMAPS 0x10
+#define I915_SHRINK_PURGEABLE  BIT(0)
+#define I915_SHRINK_UNBOUNDBIT(1)
+#define I915_SHRINK_BOUND  BIT(2)
+#define I915_SHRINK_ACTIVE BIT(3)
+#define I915_SHRINK_VMAPS  BIT(4)
+#define I915_SHRINK_WRITEBACK  BIT(5)
 unsigned long i915_gem_shrink_all(struct drm_i915_private *i915);
 void i915_gem_shrinker_register(struct drm_i915_private *i915);
 void i915_gem_shrinker_unregister(struct drm_i915_private *i915);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index e5462639de0b..a2bf94c3cfca 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2143,8 +2143,7 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void 
*data,
 }
 
 /* Immediately discard the backing storage */
-static void
-i915_gem_object_truncate(struct drm_i915_gem_object *obj)
+void __i915_gem_object_truncate(struct drm_i915_gem_object *obj)
 {
i915_gem_object_free_mmap_offset(obj);
 
@@ -2161,28 +2160,6 @@ i915_gem_object_truncate(struct drm_i915_gem_object *obj)
obj->mm.pages = ERR_PTR(-EFAULT);
 }
 
-/* Try to discard unwanted pages */
-void __i915_gem_object_invalidate(struct drm_i915_gem_object *obj)
-{
-   struct address_space *mapping;
-
-   lockdep_assert_held(>mm.lock);
-   GEM_BUG_ON(i915_gem_object_has_pages(obj));
-
-   switch (obj->mm.madv) {
-   case I915_MADV_DONTNEED:
-   

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/fb-helper: Move modesetting code to drm_client (rev3)

2019-04-20 Thread Patchwork
== Series Details ==

Series: drm/fb-helper: Move modesetting code to drm_client (rev3)
URL   : https://patchwork.freedesktop.org/series/58597/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5963 -> Patchwork_12850


Summary
---

  **SUCCESS**

  No regressions found.

  External URL: 
https://patchwork.freedesktop.org/api/1.0/series/58597/revisions/3/mbox/

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@i915_selftest@live_execlists:
- fi-apl-guc: PASS -> INCOMPLETE [fdo#103927] / [fdo#109720]

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- fi-byt-clapper: PASS -> FAIL [fdo#103191]

  * igt@runner@aborted:
- fi-apl-guc: NOTRUN -> FAIL [fdo#108622] / [fdo#109720]

  
 Possible fixes 

  * igt@gem_exec_basic@gtt-default:
- fi-skl-6770hq:  DMESG-WARN [fdo#105541] -> PASS

  
  [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#105541]: https://bugs.freedesktop.org/show_bug.cgi?id=105541
  [fdo#108622]: https://bugs.freedesktop.org/show_bug.cgi?id=108622
  [fdo#109720]: https://bugs.freedesktop.org/show_bug.cgi?id=109720


Participating hosts (46 -> 41)
--

  Missing(5): fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 
fi-bdw-samus 


Build changes
-

  * Linux: CI_DRM_5963 -> Patchwork_12850

  CI_DRM_5963: 1653c8da31bcdf8ec465b273e5b713e03a6c1d12 @ 
git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4959: 504367d33b787de2ba8e007a5b620cfd6f0b3074 @ 
git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_12850: f3bc7c2597baf42b6ecbeb0bf598aef6e388ebca @ 
git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

f3bc7c2597ba drm/client: Hack: Add bootsplash example
afd7a5c0d93a drm/fb-helper: Move out modeset config code
6b040d9eea72 drm/fb-helper: Prepare to move out modeset config code
6df8bfed31b4 drm/fb-helper: Remove drm_fb_helper_connector
6281457e241a drm/fb-helper: Move out commit code
c06c68c07e73 drm/fb-helper: Prepare to move out commit code
2658ed72b240 drm/fb-helper: Remove drm_fb_helper_crtc
531a1b30d7b8 drm/fb-helper: Remove drm_fb_helper_crtc->{x, y, desired_mode}
b301bc13788f drm/fb-helper: No need to cache rotation and sw_rotations
3f7a665802ce drm/fb-helper: Avoid race with DRM userspace
caf4eff8b046 drm/atomic: Move __drm_atomic_helper_disable_plane/set_config()

== Logs ==

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

[Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/fb-helper: Move modesetting code to drm_client (rev3)

2019-04-20 Thread Patchwork
== Series Details ==

Series: drm/fb-helper: Move modesetting code to drm_client (rev3)
URL   : https://patchwork.freedesktop.org/series/58597/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Sparse version: v0.5.2
Commit: drm/atomic: Move __drm_atomic_helper_disable_plane/set_config()
Okay!

Commit: drm/fb-helper: Avoid race with DRM userspace
Okay!

Commit: drm/fb-helper: No need to cache rotation and sw_rotations
Okay!

Commit: drm/fb-helper: Remove drm_fb_helper_crtc->{x, y, desired_mode}
-O:drivers/gpu/drm/drm_fb_helper.c:2035:40: warning: expression using 
sizeof(void)
-O:drivers/gpu/drm/drm_fb_helper.c:2035:40: warning: expression using 
sizeof(void)
-O:drivers/gpu/drm/drm_fb_helper.c:2036:40: warning: expression using 
sizeof(void)
-O:drivers/gpu/drm/drm_fb_helper.c:2036:40: warning: expression using 
sizeof(void)
+drivers/gpu/drm/drm_fb_helper.c:2035:40: warning: expression using sizeof(void)
+drivers/gpu/drm/drm_fb_helper.c:2035:40: warning: expression using sizeof(void)
+drivers/gpu/drm/drm_fb_helper.c:2036:40: warning: expression using sizeof(void)
+drivers/gpu/drm/drm_fb_helper.c:2036:40: warning: expression using sizeof(void)

Commit: drm/fb-helper: Remove drm_fb_helper_crtc
-O:drivers/gpu/drm/drm_fb_helper.c:2052:43: warning: expression using 
sizeof(void)
-O:drivers/gpu/drm/drm_fb_helper.c:2052:43: warning: expression using 
sizeof(void)
+drivers/gpu/drm/drm_fb_helper.c:2015:43: warning: expression using sizeof(void)
+drivers/gpu/drm/drm_fb_helper.c:2015:43: warning: expression using sizeof(void)
-./include/linux/slab.h:666:13: error: not a function 
+./include/linux/slab.h:666:13: error: undefined identifier 
'__builtin_mul_overflow'
+./include/linux/slab.h:666:13: warning: call with no type!

Commit: drm/fb-helper: Prepare to move out commit code
+drivers/gpu/drm/drm_fb_helper.c:404:6: warning: symbol 
'drm_client_panel_rotation' was not declared. Should it be static?
+drivers/gpu/drm/drm_fb_helper.c:579:5: warning: symbol 
'drm_client_modeset_commit_force' was not declared. Should it be static?
+drivers/gpu/drm/drm_fb_helper.c:603:5: warning: symbol 
'drm_client_modeset_commit' was not declared. Should it be static?
+drivers/gpu/drm/drm_fb_helper.c:739:5: warning: symbol 
'drm_client_modeset_dpms' was not declared. Should it be static?

Commit: drm/fb-helper: Move out commit code
+drivers/gpu/drm/drm_fb_helper.c:1756:40: warning: expression using sizeof(void)
+drivers/gpu/drm/drm_fb_helper.c:1756:40: warning: expression using sizeof(void)
+drivers/gpu/drm/drm_fb_helper.c:1757:40: warning: expression using sizeof(void)
+drivers/gpu/drm/drm_fb_helper.c:1757:40: warning: expression using sizeof(void)
+drivers/gpu/drm/drm_fb_helper.c:1771:43: warning: expression using sizeof(void)
+drivers/gpu/drm/drm_fb_helper.c:1771:43: warning: expression using sizeof(void)
+drivers/gpu/drm/drm_fb_helper.c:1773:43: warning: expression using sizeof(void)
+drivers/gpu/drm/drm_fb_helper.c:1773:43: warning: expression using sizeof(void)
+drivers/gpu/drm/drm_fb_helper.c:2277:30: warning: expression using sizeof(void)
+drivers/gpu/drm/drm_fb_helper.c:3223:12: warning: symbol 
'drm_fb_helper_modinit' was not declared. Should it be static?
-drivers/gpu/drm/drm_fb_helper.c:1756:40: warning: expression using sizeof(void)
-drivers/gpu/drm/drm_fb_helper.c:1756:40: warning: expression using sizeof(void)
-drivers/gpu/drm/drm_fb_helper.c:1757:40: warning: expression using sizeof(void)
-drivers/gpu/drm/drm_fb_helper.c:1757:40: warning: expression using sizeof(void)
-drivers/gpu/drm/drm_fb_helper.c:1771:43: warning: expression using sizeof(void)
-drivers/gpu/drm/drm_fb_helper.c:1771:43: warning: expression using sizeof(void)
-drivers/gpu/drm/drm_fb_helper.c:1773:43: warning: expression using sizeof(void)
-drivers/gpu/drm/drm_fb_helper.c:1773:43: warning: expression using sizeof(void)
-drivers/gpu/drm/drm_fb_helper.c:2277:30: warning: expression using sizeof(void)
-O:drivers/gpu/drm/drm_fb_helper.c:404:6: warning: symbol 
'drm_client_panel_rotation' was not declared. Should it be static?
-O:drivers/gpu/drm/drm_fb_helper.c:579:5: warning: symbol 
'drm_client_modeset_commit_force' was not declared. Should it be static?
-O:drivers/gpu/drm/drm_fb_helper.c:603:5: warning: symbol 
'drm_client_modeset_commit' was not declared. Should it be static?
-O:drivers/gpu/drm/drm_fb_helper.c:739:5: warning: symbol 
'drm_client_modeset_dpms' was not declared. Should it be static?

Commit: drm/fb-helper: Remove drm_fb_helper_connector
-O:drivers/gpu/drm/drm_fb_helper.c:2277:30: warning: expression using 
sizeof(void)
+drivers/gpu/drm/drm_fb_helper.c:2076:30: warning: expression using sizeof(void)
-./include/linux/slab.h:666:13: error: not a function 

Commit: drm/fb-helper: Prepare to move out modeset config code
-O:drivers/gpu/drm/drm_fb_helper.c:2076:30: warning: expression using 
sizeof(void)
+drivers/gpu/drm/drm_fb_helper.c:2080:30: warning: expression using sizeof(void)

Commit: drm/fb-helper: Move out modeset config code

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/fb-helper: Move modesetting code to drm_client (rev3)

2019-04-20 Thread Patchwork
== Series Details ==

Series: drm/fb-helper: Move modesetting code to drm_client (rev3)
URL   : https://patchwork.freedesktop.org/series/58597/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
caf4eff8b046 drm/atomic: Move __drm_atomic_helper_disable_plane/set_config()
3f7a665802ce drm/fb-helper: Avoid race with DRM userspace
b301bc13788f drm/fb-helper: No need to cache rotation and sw_rotations
531a1b30d7b8 drm/fb-helper: Remove drm_fb_helper_crtc->{x, y, desired_mode}
2658ed72b240 drm/fb-helper: Remove drm_fb_helper_crtc
-:127: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does 
MAINTAINERS need updating?
#127: 
new file mode 100644

-:204: CHECK:LINE_SPACING: Please use a blank line after 
function/struct/union/enum declarations
#204: FILE: drivers/gpu/drm/drm_client_modeset.c:73:
+}
+/* TODO: Remove export when modeset code has been moved over */

-:234: CHECK:LINE_SPACING: Please use a blank line after 
function/struct/union/enum declarations
#234: FILE: drivers/gpu/drm/drm_client_modeset.c:103:
+}
+/* TODO: Remove export when modeset code has been moved over */

-:928: WARNING:LONG_LINE: line over 100 characters
#928: FILE: drivers/gpu/drm/drm_fb_helper.c:2755:
+   if (WARN_ON_ONCE(modeset->num_connectors == 
DRM_CLIENT_MAX_CLONED_CONNECTORS ||

-:929: WARNING:LONG_LINE: line over 100 characters
#929: FILE: drivers/gpu/drm/drm_fb_helper.c:2756:
+(dev->mode_config.num_crtc > 1 && 
modeset->num_connectors == 1)))

-:1063: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'modeset' - possible 
side-effects?
#1063: FILE: include/drm/drm_client.h:164:
+#define drm_client_for_each_modeset(modeset, client) \
+   for (({ lockdep_assert_held(&(client)->modeset_mutex); }), \
+modeset = (client)->modesets; modeset->crtc; modeset++)

-:1063: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'client' - possible 
side-effects?
#1063: FILE: include/drm/drm_client.h:164:
+#define drm_client_for_each_modeset(modeset, client) \
+   for (({ lockdep_assert_held(&(client)->modeset_mutex); }), \
+modeset = (client)->modesets; modeset->crtc; modeset++)

total: 0 errors, 3 warnings, 4 checks, 962 lines checked
c06c68c07e73 drm/fb-helper: Prepare to move out commit code
6281457e241a drm/fb-helper: Move out commit code
-:152: WARNING:LONG_LINE: line over 100 characters
#152: FILE: drivers/gpu/drm/drm_client_modeset.c:223:
+   struct drm_crtc_state *crtc_state = 
drm_atomic_get_new_crtc_state(state, crtc);

-:285: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#285: FILE: drivers/gpu/drm/drm_client_modeset.c:356:
+   drm_object_property_set_value(>base,
+   dev->mode_config.dpms_property, dpms_mode);

total: 0 errors, 1 warnings, 1 checks, 610 lines checked
6df8bfed31b4 drm/fb-helper: Remove drm_fb_helper_connector
-:588: WARNING:LONG_LINE: line over 100 characters
#588: FILE: drivers/gpu/drm/drm_fb_helper.c:1959:
+ connector->base.id, connector->tile_group 
? connector->tile_group->id : 0);

-:945: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in 
parentheses
#945: FILE: include/drm/drm_client.h:183:
+#define drm_client_for_each_connector_iter(connector, iter) \
+   drm_for_each_connector_iter(connector, iter) \
+   if (connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK)

-:945: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'connector' - possible 
side-effects?
#945: FILE: include/drm/drm_client.h:183:
+#define drm_client_for_each_connector_iter(connector, iter) \
+   drm_for_each_connector_iter(connector, iter) \
+   if (connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK)

total: 1 errors, 1 warnings, 1 checks, 1006 lines checked
6b040d9eea72 drm/fb-helper: Prepare to move out modeset config code
-:169: WARNING:LONG_LINE: line over 100 characters
#169: FILE: drivers/gpu/drm/drm_fb_helper.c:2351:
+(dev->mode_config.num_crtc > 1 && 
modeset->num_connectors == 1))) {

total: 0 errors, 1 warnings, 0 checks, 179 lines checked
afd7a5c0d93a drm/fb-helper: Move out modeset config code
-:99: CHECK:BOOL_COMPARISON: Using comparison to false is error prone
#99: FILE: drivers/gpu/drm/drm_client_modeset.c:140:
+   if (cmdline_mode->specified == false)

-:170: WARNING:LONG_LINE: line over 100 characters
#170: FILE: drivers/gpu/drm/drm_client_modeset.c:211:
+ connector->display_info.non_desktop ? "non 
desktop" : enabled[i] ? "yes" : "no");

-:314: CHECK:BOOL_COMPARISON: Using comparison to false is error prone
#314: FILE: drivers/gpu/drm/drm_client_modeset.c:355:
+   if (enabled[i] == false) {

-:348: WARNING:LONG_LINE: line over 100 characters
#348: FILE: drivers/gpu/drm/drm_client_modeset.c:389:
+ connector->base.id, 

[Intel-gfx] [PATCH v3 10/11] drm/fb-helper: Move out modeset config code

2019-04-20 Thread Noralf Trønnes
No functional changes, just moving code as-is and fixing includes.

Signed-off-by: Noralf Trønnes 
Reviewed-by: Maxime Ripard 
---
 drivers/gpu/drm/drm_client_modeset.c | 706 ++-
 drivers/gpu/drm/drm_fb_helper.c  | 691 --
 include/drm/drm_client.h |   5 +-
 3 files changed, 701 insertions(+), 701 deletions(-)

diff --git a/drivers/gpu/drm/drm_client_modeset.c 
b/drivers/gpu/drm/drm_client_modeset.c
index b2aedec65637..0dc46bdbca18 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -13,13 +13,22 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "drm_crtc_internal.h"
 #include "drm_internal.h"
 
+#define DRM_CLIENT_MAX_CLONED_CONNECTORS   8
+
+struct drm_client_offset {
+   int x, y;
+};
+
 int drm_client_modeset_create(struct drm_client_dev *client)
 {
struct drm_device *dev = client->dev;
@@ -58,7 +67,7 @@ int drm_client_modeset_create(struct drm_client_dev *client)
return -ENOMEM;
 }
 
-void drm_client_modeset_release(struct drm_client_dev *client)
+static void drm_client_modeset_release(struct drm_client_dev *client)
 {
struct drm_mode_set *modeset;
unsigned int i;
@@ -75,8 +84,6 @@ void drm_client_modeset_release(struct drm_client_dev *client)
modeset->num_connectors = 0;
}
 }
-/* TODO: Remove export when modeset code has been moved over */
-EXPORT_SYMBOL(drm_client_modeset_release);
 
 void drm_client_modeset_free(struct drm_client_dev *client)
 {
@@ -95,7 +102,8 @@ void drm_client_modeset_free(struct drm_client_dev *client)
kfree(client->modesets);
 }
 
-struct drm_mode_set *drm_client_find_modeset(struct drm_client_dev *client, 
struct drm_crtc *crtc)
+static struct drm_mode_set *
+drm_client_find_modeset(struct drm_client_dev *client, struct drm_crtc *crtc)
 {
struct drm_mode_set *modeset;
 
@@ -105,8 +113,694 @@ struct drm_mode_set *drm_client_find_modeset(struct 
drm_client_dev *client, stru
 
return NULL;
 }
-/* TODO: Remove export when modeset code has been moved over */
-EXPORT_SYMBOL(drm_client_find_modeset);
+
+static struct drm_display_mode *
+drm_connector_has_preferred_mode(struct drm_connector *connector, int width, 
int height)
+{
+   struct drm_display_mode *mode;
+
+   list_for_each_entry(mode, >modes, head) {
+   if (mode->hdisplay > width ||
+   mode->vdisplay > height)
+   continue;
+   if (mode->type & DRM_MODE_TYPE_PREFERRED)
+   return mode;
+   }
+   return NULL;
+}
+
+static struct drm_display_mode *
+drm_connector_pick_cmdline_mode(struct drm_connector *connector)
+{
+   struct drm_cmdline_mode *cmdline_mode;
+   struct drm_display_mode *mode;
+   bool prefer_non_interlace;
+
+   cmdline_mode = >cmdline_mode;
+   if (cmdline_mode->specified == false)
+   return NULL;
+
+   /* attempt to find a matching mode in the list of modes
+*  we have gotten so far, if not add a CVT mode that conforms
+*/
+   if (cmdline_mode->rb || cmdline_mode->margins)
+   goto create_mode;
+
+   prefer_non_interlace = !cmdline_mode->interlace;
+again:
+   list_for_each_entry(mode, >modes, head) {
+   /* check width/height */
+   if (mode->hdisplay != cmdline_mode->xres ||
+   mode->vdisplay != cmdline_mode->yres)
+   continue;
+
+   if (cmdline_mode->refresh_specified) {
+   if (mode->vrefresh != cmdline_mode->refresh)
+   continue;
+   }
+
+   if (cmdline_mode->interlace) {
+   if (!(mode->flags & DRM_MODE_FLAG_INTERLACE))
+   continue;
+   } else if (prefer_non_interlace) {
+   if (mode->flags & DRM_MODE_FLAG_INTERLACE)
+   continue;
+   }
+   return mode;
+   }
+
+   if (prefer_non_interlace) {
+   prefer_non_interlace = false;
+   goto again;
+   }
+
+create_mode:
+   mode = drm_mode_create_from_cmdline_mode(connector->dev, cmdline_mode);
+   list_add(>head, >modes);
+
+   return mode;
+}
+
+static bool drm_connector_enabled(struct drm_connector *connector, bool strict)
+{
+   bool enable;
+
+   if (connector->display_info.non_desktop)
+   return false;
+
+   if (strict)
+   enable = connector->status == connector_status_connected;
+   else
+   enable = connector->status != connector_status_disconnected;
+
+   return enable;
+}
+
+static void drm_client_connectors_enabled(struct drm_connector **connectors,
+ unsigned int connector_count,
+   

[Intel-gfx] [PATCH v3 11/11] drm/client: Hack: Add bootsplash example

2019-04-20 Thread Noralf Trønnes
An example to showcase the client API.

TODO:
A bootsplash client needs a way to tell drm_fb_helper to stay away,
otherwise it will chime in on setup and hotplug.
Most DRM drivers register fbdev before calling drm_dev_register() (the
generic emulation is an exception). This have to be reversed for
bootsplash to fend off fbdev.

Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/Kconfig  |   5 +
 drivers/gpu/drm/Makefile |   1 +
 drivers/gpu/drm/drm_bootsplash.c | 362 +++
 drivers/gpu/drm/drm_client.c |   7 +
 drivers/gpu/drm/drm_drv.c|   4 +
 include/drm/drm_client.h |   3 +
 6 files changed, 382 insertions(+)
 create mode 100644 drivers/gpu/drm/drm_bootsplash.c

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 39d5f7562f1c..23678a2f36be 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -65,6 +65,11 @@ config DRM_DEBUG_SELFTEST
 
  If in doubt, say "N".
 
+config DRM_CLIENT_BOOTSPLASH
+   bool "DRM Bootsplash"
+   help
+ DRM Bootsplash
+
 config DRM_KMS_HELPER
tristate
depends on DRM
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 228ac9e3b645..be25caee734a 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -32,6 +32,7 @@ drm-$(CONFIG_OF) += drm_of.o
 drm-$(CONFIG_AGP) += drm_agpsupport.o
 drm-$(CONFIG_DEBUG_FS) += drm_debugfs.o drm_debugfs_crc.o
 drm-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
+drm-$(CONFIG_DRM_CLIENT_BOOTSPLASH) += drm_bootsplash.o
 
 drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_dsc.o 
drm_probe_helper.o \
drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o \
diff --git a/drivers/gpu/drm/drm_bootsplash.c b/drivers/gpu/drm/drm_bootsplash.c
new file mode 100644
index ..caf7d4813eae
--- /dev/null
+++ b/drivers/gpu/drm/drm_bootsplash.c
@@ -0,0 +1,362 @@
+/* DRM internal client example */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+// drm_lastclose()
+#include "drm_internal.h"
+
+static bool drm_bootsplash_enabled = true;
+module_param_named(bootsplash_enabled, drm_bootsplash_enabled, bool, 0600);
+MODULE_PARM_DESC(bootsplash_enabled, "Enable bootsplash client 
[default=true]");
+
+struct drm_bootsplash {
+   struct drm_client_dev client;
+   struct mutex lock;
+   struct work_struct worker;
+   bool started;
+   bool stop;
+
+   unsigned int modeset_mask;
+   struct drm_client_buffer *buffers[2];
+};
+
+static bool drm_bootsplash_key_pressed;
+
+static int drm_bootsplash_keyboard_notifier_call(struct notifier_block *blk,
+unsigned long code, void 
*_param)
+{
+   /* Any key is good */
+   drm_bootsplash_key_pressed = true;
+
+   return NOTIFY_OK;
+}
+
+static struct notifier_block drm_bootsplash_keyboard_notifier_block = {
+   .notifier_call = drm_bootsplash_keyboard_notifier_call,
+};
+
+static void drm_bootsplash_buffer_delete(struct drm_bootsplash *splash)
+{
+   unsigned int i;
+
+   for (i = 0; i < 2; i++) {
+   if (!IS_ERR_OR_NULL(splash->buffers[i]))
+   drm_client_framebuffer_delete(splash->buffers[i]);
+   splash->buffers[i] = NULL;
+   }
+}
+
+static int drm_bootsplash_buffer_create(struct drm_bootsplash *splash, u32 
width, u32 height)
+{
+   unsigned int i;
+
+   for (i = 0; i < 2; i++) {
+   splash->buffers[i] = 
drm_client_framebuffer_create(>client, width, height, 
DRM_FORMAT_XRGB);
+   if (IS_ERR(splash->buffers[i])) {
+   drm_bootsplash_buffer_delete(splash);
+   return PTR_ERR(splash->buffers[i]);
+   }
+   }
+
+   return 0;
+}
+
+static int drm_bootsplash_display_probe(struct drm_bootsplash *splash)
+{
+   struct drm_client_dev *client = >client;
+   unsigned int width = 0, height = 0;
+   unsigned int num_non_tiled = 0, i;
+   struct drm_mode_set *modeset;
+   bool tiled = false;
+   int ret;
+
+   splash->modeset_mask = 0;
+
+   ret = drm_client_modeset_probe(client, 0, 0);
+   if (ret)
+   return ret;
+
+   mutex_lock(>modeset_mutex);
+
+   drm_client_for_each_modeset(modeset, client) {
+   if (!modeset->mode)
+   continue;
+
+   if (modeset->connectors[0]->has_tile)
+   tiled = true;
+   else
+   num_non_tiled++;
+   }
+
+   if (!tiled && !num_non_tiled) {
+   drm_bootsplash_buffer_delete(splash);
+   ret = -ENOENT;
+   goto out;
+   }
+
+   /* Assume only one tiled monitor is possible */
+   if (tiled) {
+   int hdisplay = 0, vdisplay = 0;
+
+   i = 0;
+ 

[Intel-gfx] [PATCH v3 00/11] drm/fb-helper: Move modesetting code to drm_client

2019-04-20 Thread Noralf Trønnes
This moves the modesetting code from drm_fb_helper to drm_client so it
can be shared by all internal clients.

Changes this time:
- Use full drm_client_init/release for the modesets (Daniel Vetter)
- drm_client_for_each_modeset: use lockdep_assert_held (Daniel Vetter)
- Hook up to Documentation/gpu/drm-client.rst (Daniel Vetter)

Noralf.

Noralf Trønnes (11):
  drm/atomic: Move __drm_atomic_helper_disable_plane/set_config()
  drm/fb-helper: Avoid race with DRM userspace
  drm/fb-helper: No need to cache rotation and sw_rotations
  drm/fb-helper: Remove drm_fb_helper_crtc->{x,y,desired_mode}
  drm/fb-helper: Remove drm_fb_helper_crtc
  drm/fb-helper: Prepare to move out commit code
  drm/fb-helper: Move out commit code
  drm/fb-helper: Remove drm_fb_helper_connector
  drm/fb-helper: Prepare to move out modeset config code
  drm/fb-helper: Move out modeset config code
  drm/client: Hack: Add bootsplash example

 Documentation/gpu/drm-client.rst |3 +
 Documentation/gpu/todo.rst   |   10 +
 drivers/gpu/drm/Kconfig  |5 +
 drivers/gpu/drm/Makefile |3 +-
 drivers/gpu/drm/drm_atomic.c |  168 
 drivers/gpu/drm/drm_atomic_helper.c  |  164 ---
 drivers/gpu/drm/drm_auth.c   |   20 +
 drivers/gpu/drm/drm_bootsplash.c |  362 +++
 drivers/gpu/drm/drm_client.c |   17 +-
 drivers/gpu/drm/drm_client_modeset.c | 1085 
 drivers/gpu/drm/drm_crtc_internal.h  |5 +
 drivers/gpu/drm/drm_drv.c|4 +
 drivers/gpu/drm/drm_fb_helper.c  | 1381 +++---
 drivers/gpu/drm/drm_internal.h   |2 +
 include/drm/drm_atomic_helper.h  |4 -
 include/drm/drm_client.h |   49 +
 include/drm/drm_fb_helper.h  |  102 +-
 17 files changed, 1864 insertions(+), 1520 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_bootsplash.c
 create mode 100644 drivers/gpu/drm/drm_client_modeset.c

-- 
2.20.1

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

[Intel-gfx] [PATCH v3 07/11] drm/fb-helper: Move out commit code

2019-04-20 Thread Noralf Trønnes
Move the modeset commit code to drm_client_modeset.
No changes except exporting API.

v2: Move to drm_client_modeset.c instead of drm_client.c

Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/drm_client_modeset.c | 287 +++
 drivers/gpu/drm/drm_fb_helper.c  | 282 --
 include/drm/drm_client.h |   4 +
 3 files changed, 291 insertions(+), 282 deletions(-)

diff --git a/drivers/gpu/drm/drm_client_modeset.c 
b/drivers/gpu/drm/drm_client_modeset.c
index 66770ed3299e..b2aedec65637 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -11,9 +11,14 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
+#include 
+
+#include "drm_crtc_internal.h"
+#include "drm_internal.h"
 
 int drm_client_modeset_create(struct drm_client_dev *client)
 {
@@ -102,3 +107,285 @@ struct drm_mode_set *drm_client_find_modeset(struct 
drm_client_dev *client, stru
 }
 /* TODO: Remove export when modeset code has been moved over */
 EXPORT_SYMBOL(drm_client_find_modeset);
+
+/**
+ * drm_client_panel_rotation() - Check panel orientation
+ * @modeset: DRM modeset
+ * @rotation: Returned rotation value
+ *
+ * This function checks if the primary plane in @modeset can hw rotate to match
+ * the panel orientation on its connector.
+ *
+ * Note: Currently only 0 and 180 degrees are supported.
+ *
+ * Return:
+ * True if the plane can do the rotation, false otherwise.
+ */
+bool drm_client_panel_rotation(struct drm_mode_set *modeset, unsigned int 
*rotation)
+{
+   struct drm_connector *connector = modeset->connectors[0];
+   struct drm_plane *plane = modeset->crtc->primary;
+   u64 valid_mask = 0;
+   unsigned int i;
+
+   if (!modeset->num_connectors)
+   return false;
+
+   switch (connector->display_info.panel_orientation) {
+   case DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP:
+   *rotation = DRM_MODE_ROTATE_180;
+   break;
+   case DRM_MODE_PANEL_ORIENTATION_LEFT_UP:
+   *rotation = DRM_MODE_ROTATE_90;
+   break;
+   case DRM_MODE_PANEL_ORIENTATION_RIGHT_UP:
+   *rotation = DRM_MODE_ROTATE_270;
+   break;
+   default:
+   *rotation = DRM_MODE_ROTATE_0;
+   }
+
+   /*
+* TODO: support 90 / 270 degree hardware rotation,
+* depending on the hardware this may require the framebuffer
+* to be in a specific tiling format.
+*/
+   if (*rotation != DRM_MODE_ROTATE_180 || !plane->rotation_property)
+   return false;
+
+   for (i = 0; i < plane->rotation_property->num_values; i++)
+   valid_mask |= (1ULL << plane->rotation_property->values[i]);
+
+   if (!(*rotation & valid_mask))
+   return false;
+
+   return true;
+}
+
+static int drm_client_modeset_commit_atomic(struct drm_client_dev *client, 
bool active)
+{
+   struct drm_device *dev = client->dev;
+   struct drm_plane_state *plane_state;
+   struct drm_plane *plane;
+   struct drm_atomic_state *state;
+   struct drm_modeset_acquire_ctx ctx;
+   struct drm_mode_set *mode_set;
+   int ret;
+
+   drm_modeset_acquire_init(, 0);
+
+   state = drm_atomic_state_alloc(dev);
+   if (!state) {
+   ret = -ENOMEM;
+   goto out_ctx;
+   }
+
+   state->acquire_ctx = 
+retry:
+   drm_for_each_plane(plane, dev) {
+   plane_state = drm_atomic_get_plane_state(state, plane);
+   if (IS_ERR(plane_state)) {
+   ret = PTR_ERR(plane_state);
+   goto out_state;
+   }
+
+   plane_state->rotation = DRM_MODE_ROTATE_0;
+
+   /* disable non-primary: */
+   if (plane->type == DRM_PLANE_TYPE_PRIMARY)
+   continue;
+
+   ret = __drm_atomic_helper_disable_plane(plane, plane_state);
+   if (ret != 0)
+   goto out_state;
+   }
+
+   drm_client_for_each_modeset(mode_set, client) {
+   struct drm_plane *primary = mode_set->crtc->primary;
+   unsigned int rotation;
+
+   if (drm_client_panel_rotation(mode_set, )) {
+   /* Cannot fail as we've already gotten the plane state 
above */
+   plane_state = drm_atomic_get_new_plane_state(state, 
primary);
+   plane_state->rotation = rotation;
+   }
+
+   ret = __drm_atomic_helper_set_config(mode_set, state);
+   if (ret != 0)
+   goto out_state;
+
+   /*
+* __drm_atomic_helper_set_config() sets active when a
+* mode is set, unconditionally clear it if we force DPMS off
+*/
+   if (!active) {
+   struct drm_crtc *crtc = mode_set->crtc;
+  

[Intel-gfx] [PATCH v3 04/11] drm/fb-helper: Remove drm_fb_helper_crtc->{x, y, desired_mode}

2019-04-20 Thread Noralf Trønnes
The values are already present in the modeset.

This is done in preparation for the removal of struct drm_fb_helper_crtc.

Signed-off-by: Noralf Trønnes 
Reviewed-by: Daniel Vetter 
Reviewed-by: Maxime Ripard 
---
 drivers/gpu/drm/drm_fb_helper.c | 12 
 include/drm/drm_fb_helper.h |  2 --
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 1c70ecb84738..61f0b01e394e 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -2021,16 +2021,16 @@ static int drm_fb_helper_single_fb_probe(struct 
drm_fb_helper *fb_helper,
 */
bool lastv = true, lasth = true;
 
-   desired_mode = fb_helper->crtc_info[i].desired_mode;
mode_set = _helper->crtc_info[i].mode_set;
+   desired_mode = mode_set->mode;
 
if (!desired_mode)
continue;
 
crtc_count++;
 
-   x = fb_helper->crtc_info[i].x;
-   y = fb_helper->crtc_info[i].y;
+   x = mode_set->x;
+   y = mode_set->y;
 
sizes.surface_width  = max_t(u32, desired_mode->hdisplay + x, 
sizes.surface_width);
sizes.surface_height = max_t(u32, desired_mode->vdisplay + y, 
sizes.surface_height);
@@ -2803,11 +2803,7 @@ static void drm_setup_crtcs(struct drm_fb_helper 
*fb_helper,
DRM_DEBUG_KMS("desired mode %s set on crtc %d 
(%d,%d)\n",
  mode->name, 
fb_crtc->mode_set.crtc->base.id, offset->x, offset->y);
 
-   fb_crtc->desired_mode = mode;
-   fb_crtc->x = offset->x;
-   fb_crtc->y = offset->y;
-   modeset->mode = drm_mode_duplicate(dev,
-  
fb_crtc->desired_mode);
+   modeset->mode = drm_mode_duplicate(dev, mode);
drm_connector_get(connector);
modeset->connectors[modeset->num_connectors++] = 
connector;
modeset->x = offset->x;
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index b0a14aef2e39..2af1c6d3e147 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -49,8 +49,6 @@ struct drm_fb_offset {
 
 struct drm_fb_helper_crtc {
struct drm_mode_set mode_set;
-   struct drm_display_mode *desired_mode;
-   int x, y;
 };
 
 /**
-- 
2.20.1

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

[Intel-gfx] [PATCH v3 01/11] drm/atomic: Move __drm_atomic_helper_disable_plane/set_config()

2019-04-20 Thread Noralf Trønnes
Prepare for moving drm_fb_helper modesetting code to drm_client.
drm_client will be linked to drm.ko, so move
__drm_atomic_helper_disable_plane() and __drm_atomic_helper_set_config()
out of drm_kms_helper.ko.

While at it, fix two checkpatch complaints:
- WARNING: Block comments use a trailing */ on a separate line
- CHECK: Alignment should match open parenthesis

Signed-off-by: Noralf Trønnes 
Reviewed-by: Daniel Vetter 
Reviewed-by: Maxime Ripard 
---
 drivers/gpu/drm/drm_atomic.c| 168 
 drivers/gpu/drm/drm_atomic_helper.c | 164 ---
 drivers/gpu/drm/drm_crtc_internal.h |   5 +
 include/drm/drm_atomic_helper.h |   4 -
 4 files changed, 173 insertions(+), 168 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 5eb40130fafb..c3a9ffbf2310 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1130,6 +1130,174 @@ int drm_atomic_nonblocking_commit(struct 
drm_atomic_state *state)
 }
 EXPORT_SYMBOL(drm_atomic_nonblocking_commit);
 
+/* just used from drm-client and atomic-helper: */
+int __drm_atomic_helper_disable_plane(struct drm_plane *plane,
+ struct drm_plane_state *plane_state)
+{
+   int ret;
+
+   ret = drm_atomic_set_crtc_for_plane(plane_state, NULL);
+   if (ret != 0)
+   return ret;
+
+   drm_atomic_set_fb_for_plane(plane_state, NULL);
+   plane_state->crtc_x = 0;
+   plane_state->crtc_y = 0;
+   plane_state->crtc_w = 0;
+   plane_state->crtc_h = 0;
+   plane_state->src_x = 0;
+   plane_state->src_y = 0;
+   plane_state->src_w = 0;
+   plane_state->src_h = 0;
+
+   return 0;
+}
+EXPORT_SYMBOL(__drm_atomic_helper_disable_plane);
+
+static int update_output_state(struct drm_atomic_state *state,
+  struct drm_mode_set *set)
+{
+   struct drm_device *dev = set->crtc->dev;
+   struct drm_crtc *crtc;
+   struct drm_crtc_state *new_crtc_state;
+   struct drm_connector *connector;
+   struct drm_connector_state *new_conn_state;
+   int ret, i;
+
+   ret = drm_modeset_lock(>mode_config.connection_mutex,
+  state->acquire_ctx);
+   if (ret)
+   return ret;
+
+   /* First disable all connectors on the target crtc. */
+   ret = drm_atomic_add_affected_connectors(state, set->crtc);
+   if (ret)
+   return ret;
+
+   for_each_new_connector_in_state(state, connector, new_conn_state, i) {
+   if (new_conn_state->crtc == set->crtc) {
+   ret = drm_atomic_set_crtc_for_connector(new_conn_state,
+   NULL);
+   if (ret)
+   return ret;
+
+   /* Make sure legacy setCrtc always re-trains */
+   new_conn_state->link_status = DRM_LINK_STATUS_GOOD;
+   }
+   }
+
+   /* Then set all connectors from set->connectors on the target crtc */
+   for (i = 0; i < set->num_connectors; i++) {
+   new_conn_state = drm_atomic_get_connector_state(state,
+   
set->connectors[i]);
+   if (IS_ERR(new_conn_state))
+   return PTR_ERR(new_conn_state);
+
+   ret = drm_atomic_set_crtc_for_connector(new_conn_state,
+   set->crtc);
+   if (ret)
+   return ret;
+   }
+
+   for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
+   /*
+* Don't update ->enable for the CRTC in the set_config request,
+* since a mismatch would indicate a bug in the upper layers.
+* The actual modeset code later on will catch any
+* inconsistencies here.
+*/
+   if (crtc == set->crtc)
+   continue;
+
+   if (!new_crtc_state->connector_mask) {
+   ret = drm_atomic_set_mode_prop_for_crtc(new_crtc_state,
+   NULL);
+   if (ret < 0)
+   return ret;
+
+   new_crtc_state->active = false;
+   }
+   }
+
+   return 0;
+}
+
+/* just used from drm-client and atomic-helper: */
+int __drm_atomic_helper_set_config(struct drm_mode_set *set,
+  struct drm_atomic_state *state)
+{
+   struct drm_crtc_state *crtc_state;
+   struct drm_plane_state *primary_state;
+   struct drm_crtc *crtc = set->crtc;
+   int hdisplay, vdisplay;
+   int ret;
+
+   crtc_state = drm_atomic_get_crtc_state(state, crtc);
+   if (IS_ERR(crtc_state))
+   return PTR_ERR(crtc_state);
+

[Intel-gfx] [PATCH v3 08/11] drm/fb-helper: Remove drm_fb_helper_connector

2019-04-20 Thread Noralf Trønnes
All drivers add all their connectors so there's no need to keep around an
array of available connectors.

Rename functions which signature is changed since they will be moved to
drm_client in a later patch.

Signed-off-by: Noralf Trønnes 
---
 Documentation/gpu/todo.rst  |   3 +
 drivers/gpu/drm/drm_fb_helper.c | 498 ++--
 include/drm/drm_client.h|  15 +
 include/drm/drm_fb_helper.h |  80 ++---
 4 files changed, 192 insertions(+), 404 deletions(-)

diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
index 8fa08b5feab7..f6cdd1c26788 100644
--- a/Documentation/gpu/todo.rst
+++ b/Documentation/gpu/todo.rst
@@ -306,6 +306,9 @@ drm_fb_helper cleanup tasks
 - The max connector argument for drm_fb_helper_init() and
   drm_fb_helper_fbdev_setup() isn't used anymore and can be removed.
 
+- The helper doesn't keep an array of connectors anymore so these can be
+  removed: drm_fb_helper_single_add_all_connectors(),
+  drm_fb_helper_add_one_connector() and drm_fb_helper_remove_one_connector().
 
 Core refactorings
 =
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 88d2f6dedff2..3a57210c9ec9 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -90,12 +90,6 @@ static DEFINE_MUTEX(kernel_fb_helper_lock);
  * Setup fbdev emulation by calling drm_fb_helper_fbdev_setup() and tear it
  * down by calling drm_fb_helper_fbdev_teardown().
  *
- * Drivers that need to handle connector hotplugging (e.g. dp mst) can't use
- * the setup helper and will need to do the whole four-step setup process with
- * drm_fb_helper_prepare(), drm_fb_helper_init(),
- * drm_fb_helper_single_add_all_connectors(), enable hotplugging and
- * drm_fb_helper_initial_config() to avoid a possible race window.
- *
  * At runtime drivers should restore the fbdev console by using
  * drm_fb_helper_lastclose() as their _driver.lastclose callback.
  * They should also notify the fb helper code from updates to the output
@@ -118,8 +112,7 @@ static DEFINE_MUTEX(kernel_fb_helper_lock);
  * encoders and connectors. To finish up the fbdev helper initialization, the
  * drm_fb_helper_init() function is called. To probe for all attached displays
  * and set up an initial configuration using the detected hardware, drivers
- * should call drm_fb_helper_single_add_all_connectors() followed by
- * drm_fb_helper_initial_config().
+ * should call drm_fb_helper_initial_config().
  *
  * If _framebuffer_funcs.dirty is set, the
  * drm_fb_helper_{cfb,sys}_{write,fillrect,copyarea,imageblit} functions will
@@ -132,165 +125,6 @@ static DEFINE_MUTEX(kernel_fb_helper_lock);
  * deferred I/O (coupled with drm_fb_helper_fbdev_teardown()).
  */
 
-#define drm_fb_helper_for_each_connector(fbh, i__) \
-   for (({ lockdep_assert_held(&(fbh)->lock); }), \
-i__ = 0; i__ < (fbh)->connector_count; i__++)
-
-static int __drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper,
-struct drm_connector *connector)
-{
-   struct drm_fb_helper_connector *fb_conn;
-   struct drm_fb_helper_connector **temp;
-   unsigned int count;
-
-   if (!drm_fbdev_emulation)
-   return 0;
-
-   lockdep_assert_held(_helper->lock);
-
-   count = fb_helper->connector_count + 1;
-
-   if (count > fb_helper->connector_info_alloc_count) {
-   size_t size = count * sizeof(fb_conn);
-
-   temp = krealloc(fb_helper->connector_info, size, GFP_KERNEL);
-   if (!temp)
-   return -ENOMEM;
-
-   fb_helper->connector_info_alloc_count = count;
-   fb_helper->connector_info = temp;
-   }
-
-   fb_conn = kzalloc(sizeof(*fb_conn), GFP_KERNEL);
-   if (!fb_conn)
-   return -ENOMEM;
-
-   drm_connector_get(connector);
-   fb_conn->connector = connector;
-   fb_helper->connector_info[fb_helper->connector_count++] = fb_conn;
-
-   return 0;
-}
-
-int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper,
-   struct drm_connector *connector)
-{
-   int err;
-
-   if (!fb_helper)
-   return 0;
-
-   mutex_lock(_helper->lock);
-   err = __drm_fb_helper_add_one_connector(fb_helper, connector);
-   mutex_unlock(_helper->lock);
-
-   return err;
-}
-EXPORT_SYMBOL(drm_fb_helper_add_one_connector);
-
-/**
- * drm_fb_helper_single_add_all_connectors() - add all connectors to fbdev
- *emulation helper
- * @fb_helper: fbdev initialized with drm_fb_helper_init, can be NULL
- *
- * This functions adds all the available connectors for use with the given
- * fb_helper. This is a separate step to allow drivers to freely assign
- * connectors to the fbdev, e.g. if some are reserved for special purposes or
- * not adequate to be used for the fbcon.
- *
- * This 

[Intel-gfx] [PATCH v3 02/11] drm/fb-helper: Avoid race with DRM userspace

2019-04-20 Thread Noralf Trønnes
drm_fb_helper_is_bound() is used to check if DRM userspace is in control.
This is done by looking at the fb on the primary plane. By the time
fb-helper gets around to committing, it's possible that the facts have
changed.

Avoid this race by holding the drm_device->master_mutex lock while
committing. When DRM userspace does its first open, it will now wait
until fb-helper is done. The helper will stay away if there's a master.

Locking rule: Always take the fb-helper lock first.

v2:
- Remove drm_fb_helper_is_bound() (Daniel Vetter)
- No need to check fb_helper->dev->master in
  drm_fb_helper_single_fb_probe(), restore_fbdev_mode() has the check.

Suggested-by: Daniel Vetter 
Signed-off-by: Noralf Trønnes 
Reviewed-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_auth.c  | 20 
 drivers/gpu/drm/drm_fb_helper.c | 90 -
 drivers/gpu/drm/drm_internal.h  |  2 +
 3 files changed, 67 insertions(+), 45 deletions(-)

diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
index 1669c42c40ed..db199807b7dc 100644
--- a/drivers/gpu/drm/drm_auth.c
+++ b/drivers/gpu/drm/drm_auth.c
@@ -368,3 +368,23 @@ void drm_master_put(struct drm_master **master)
*master = NULL;
 }
 EXPORT_SYMBOL(drm_master_put);
+
+/* Used by drm_client and drm_fb_helper */
+bool drm_master_internal_acquire(struct drm_device *dev)
+{
+   mutex_lock(>master_mutex);
+   if (dev->master) {
+   mutex_unlock(>master_mutex);
+   return false;
+   }
+
+   return true;
+}
+EXPORT_SYMBOL(drm_master_internal_acquire);
+
+/* Used by drm_client and drm_fb_helper */
+void drm_master_internal_release(struct drm_device *dev)
+{
+   mutex_unlock(>master_mutex);
+}
+EXPORT_SYMBOL(drm_master_internal_release);
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 2339f0f8f5a8..578428461391 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -44,6 +44,7 @@
 
 #include "drm_crtc_internal.h"
 #include "drm_crtc_helper_internal.h"
+#include "drm_internal.h"
 
 static bool drm_fbdev_emulation = true;
 module_param_named(fbdev_emulation, drm_fbdev_emulation, bool, 0600);
@@ -509,7 +510,7 @@ static int restore_fbdev_mode_legacy(struct drm_fb_helper 
*fb_helper)
return ret;
 }
 
-static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
+static int restore_fbdev_mode_force(struct drm_fb_helper *fb_helper)
 {
struct drm_device *dev = fb_helper->dev;
 
@@ -519,6 +520,21 @@ static int restore_fbdev_mode(struct drm_fb_helper 
*fb_helper)
return restore_fbdev_mode_legacy(fb_helper);
 }
 
+static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
+{
+   struct drm_device *dev = fb_helper->dev;
+   int ret;
+
+   if (!drm_master_internal_acquire(dev))
+   return -EBUSY;
+
+   ret = restore_fbdev_mode_force(fb_helper);
+
+   drm_master_internal_release(dev);
+
+   return ret;
+}
+
 /**
  * drm_fb_helper_restore_fbdev_mode_unlocked - restore fbdev configuration
  * @fb_helper: driver-allocated fbdev helper, can be NULL
@@ -556,34 +572,6 @@ int drm_fb_helper_restore_fbdev_mode_unlocked(struct 
drm_fb_helper *fb_helper)
 }
 EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode_unlocked);
 
-static bool drm_fb_helper_is_bound(struct drm_fb_helper *fb_helper)
-{
-   struct drm_device *dev = fb_helper->dev;
-   struct drm_crtc *crtc;
-   int bound = 0, crtcs_bound = 0;
-
-   /*
-* Sometimes user space wants everything disabled, so don't steal the
-* display if there's a master.
-*/
-   if (READ_ONCE(dev->master))
-   return false;
-
-   drm_for_each_crtc(crtc, dev) {
-   drm_modeset_lock(>mutex, NULL);
-   if (crtc->primary->fb)
-   crtcs_bound++;
-   if (crtc->primary->fb == fb_helper->fb)
-   bound++;
-   drm_modeset_unlock(>mutex);
-   }
-
-   if (bound < crtcs_bound)
-   return false;
-
-   return true;
-}
-
 #ifdef CONFIG_MAGIC_SYSRQ
 /*
  * restore fbcon display for all kms driver's using this helper, used for sysrq
@@ -604,7 +592,7 @@ static bool drm_fb_helper_force_kernel_mode(void)
continue;
 
mutex_lock(>lock);
-   ret = restore_fbdev_mode(helper);
+   ret = restore_fbdev_mode_force(helper);
if (ret)
error = true;
mutex_unlock(>lock);
@@ -663,20 +651,22 @@ static void dpms_legacy(struct drm_fb_helper *fb_helper, 
int dpms_mode)
 static void drm_fb_helper_dpms(struct fb_info *info, int dpms_mode)
 {
struct drm_fb_helper *fb_helper = info->par;
+   struct drm_device *dev = fb_helper->dev;
 
/*
 * For each CRTC in this fb, turn the connectors on/off.
 */
mutex_lock(_helper->lock);
-   if 

[Intel-gfx] [PATCH v3 05/11] drm/fb-helper: Remove drm_fb_helper_crtc

2019-04-20 Thread Noralf Trønnes
It now only contains the modeset so use that directly instead and attach
a modeset array to drm_client_dev. drm_fb_helper will use this array.
Code will later be moved to drm_client, so add code there in a new file
drm_client_modeset.c with MIT license to match drm_fb_helper.c.

The modeset connector array size is hardcoded for the cloned case to avoid
having to pass in a value from the driver. A value of 8 is chosen to err
on the safe side. This means that the max connector argument for
drm_fb_helper_init() and drm_fb_helper_fbdev_setup() isn't used anymore,
a todo entry for this is added.

In pan_display_atomic() restore_fbdev_mode_force() is used instead of
restore_fbdev_mode_atomic() because that one will later become internal
to drm_client_modeset.

Locking order:
1. drm_fb_helper->lock
2. drm_master_internal_acquire
3. drm_client_dev->modeset_mutex

v3:
- Use full drm_client_init/release for the modesets (Daniel Vetter)
- drm_client_for_each_modeset: use lockdep_assert_held (Daniel Vetter)
- Hook up to Documentation/gpu/drm-client.rst (Daniel Vetter)

v2:
- Add modesets array to drm_client (Daniel Vetter)
- Use a new file for the modeset code (Daniel Vetter)
- File has to be MIT licensed (Emmanuel Vadot)
- Add copyrights from drm_fb_helper.c

Signed-off-by: Noralf Trønnes 
---
 Documentation/gpu/drm-client.rst |   3 +
 Documentation/gpu/todo.rst   |   7 +
 drivers/gpu/drm/Makefile |   2 +-
 drivers/gpu/drm/drm_client.c |  10 +-
 drivers/gpu/drm/drm_client_modeset.c | 104 +
 drivers/gpu/drm/drm_fb_helper.c  | 301 +++
 include/drm/drm_client.h |  30 +++
 include/drm/drm_fb_helper.h  |   8 -
 8 files changed, 278 insertions(+), 187 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_client_modeset.c

diff --git a/Documentation/gpu/drm-client.rst b/Documentation/gpu/drm-client.rst
index 7e672063e7eb..58b5a1d1219d 100644
--- a/Documentation/gpu/drm-client.rst
+++ b/Documentation/gpu/drm-client.rst
@@ -10,3 +10,6 @@ Kernel clients
 
 .. kernel-doc:: drivers/gpu/drm/drm_client.c
:export:
+
+.. kernel-doc:: drivers/gpu/drm/drm_client_modeset.c
+   :export:
diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
index 1528ad2d598b..8fa08b5feab7 100644
--- a/Documentation/gpu/todo.rst
+++ b/Documentation/gpu/todo.rst
@@ -300,6 +300,13 @@ it to use drm_mode_hsync() instead.
 
 Contact: Sean Paul
 
+drm_fb_helper cleanup tasks
+---
+
+- The max connector argument for drm_fb_helper_init() and
+  drm_fb_helper_fbdev_setup() isn't used anymore and can be removed.
+
+
 Core refactorings
 =
 
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 3d0c75cd687c..228ac9e3b645 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -19,7 +19,7 @@ drm-y   :=drm_auth.o drm_bufs.o drm_cache.o \
drm_plane.o drm_color_mgmt.o drm_print.o \
drm_dumb_buffers.o drm_mode_config.o drm_vblank.o \
drm_syncobj.o drm_lease.o drm_writeback.o drm_client.o \
-   drm_atomic_uapi.o
+   drm_client_modeset.o drm_atomic_uapi.o
 
 drm-$(CONFIG_DRM_LIB_RANDOM) += lib/drm_random.o
 drm-$(CONFIG_DRM_VM) += drm_vm.o
diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
index f20d1dda3961..3dd08c6b264d 100644
--- a/drivers/gpu/drm/drm_client.c
+++ b/drivers/gpu/drm/drm_client.c
@@ -27,7 +27,6 @@
  * DOC: overview
  *
  * This library provides support for clients running in the kernel like fbdev 
and bootsplash.
- * Currently it's only partially implemented, just enough to support fbdev.
  *
  * GEM drivers which provide a GEM based dumb buffer with a virtual address 
are supported.
  */
@@ -92,14 +91,20 @@ int drm_client_init(struct drm_device *dev, struct 
drm_client_dev *client,
client->name = name;
client->funcs = funcs;
 
-   ret = drm_client_open(client);
+   ret = drm_client_modeset_create(client);
if (ret)
goto err_put_module;
 
+   ret = drm_client_open(client);
+   if (ret)
+   goto err_free;
+
drm_dev_get(dev);
 
return 0;
 
+err_free:
+   drm_client_modeset_free(client);
 err_put_module:
if (funcs)
module_put(funcs->owner);
@@ -148,6 +153,7 @@ void drm_client_release(struct drm_client_dev *client)
 
DRM_DEV_DEBUG_KMS(dev->dev, "%s\n", client->name);
 
+   drm_client_modeset_free(client);
drm_client_close(client);
drm_dev_put(dev);
if (client->funcs)
diff --git a/drivers/gpu/drm/drm_client_modeset.c 
b/drivers/gpu/drm/drm_client_modeset.c
new file mode 100644
index ..66770ed3299e
--- /dev/null
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -0,0 +1,104 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright 2018 Noralf Trønnes
+ * Copyright (c) 2006-2009 Red Hat Inc.
+ * Copyright (c) 2006-2008 Intel 

[Intel-gfx] [PATCH v3 09/11] drm/fb-helper: Prepare to move out modeset config code

2019-04-20 Thread Noralf Trønnes
This prepares the modeset code so it can be moved out as-is in the next
patch.

v3: Remove stray newline

Signed-off-by: Noralf Trønnes 
Reviewed-by: Maxime Ripard 
---
 drivers/gpu/drm/drm_fb_helper.c | 62 +++--
 include/drm/drm_fb_helper.h |  4 ---
 2 files changed, 44 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 3a57210c9ec9..68391f0d88b7 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -43,6 +43,10 @@
 
 #include "drm_internal.h"
 
+struct drm_client_offset {
+   int x, y;
+};
+
 static bool drm_fbdev_emulation = true;
 module_param_named(fbdev_emulation, drm_fbdev_emulation, bool, 0600);
 MODULE_PARM_DESC(fbdev_emulation,
@@ -1794,7 +1798,7 @@ static bool drm_client_target_cloned(struct drm_device 
*dev,
 struct drm_connector **connectors,
 unsigned int connector_count,
 struct drm_display_mode **modes,
-struct drm_fb_offset *offsets,
+struct drm_client_offset *offsets,
 bool *enabled, int width, int height)
 {
int count, i, j;
@@ -1873,7 +1877,7 @@ static bool drm_client_target_cloned(struct drm_device 
*dev,
 static int drm_client_get_tile_offsets(struct drm_connector **connectors,
   unsigned int connector_count,
   struct drm_display_mode **modes,
-  struct drm_fb_offset *offsets,
+  struct drm_client_offset *offsets,
   int idx,
   int h_idx, int v_idx)
 {
@@ -1906,7 +1910,7 @@ static int drm_client_get_tile_offsets(struct 
drm_connector **connectors,
 static bool drm_client_target_preferred(struct drm_connector **connectors,
unsigned int connector_count,
struct drm_display_mode **modes,
-   struct drm_fb_offset *offsets,
+   struct drm_client_offset *offsets,
bool *enabled, int width, int height)
 {
const u64 mask = BIT_ULL(connector_count) - 1;
@@ -2070,7 +2074,7 @@ static bool drm_client_firmware_config(struct 
drm_client_dev *client,
   unsigned int connector_count,
   struct drm_crtc **crtcs,
   struct drm_display_mode **modes,
-  struct drm_fb_offset *offsets,
+  struct drm_client_offset *offsets,
   bool *enabled, int width, int height)
 {
unsigned int count = min_t(unsigned int, connector_count, 
BITS_PER_LONG);
@@ -2239,30 +2243,47 @@ static bool drm_client_firmware_config(struct 
drm_client_dev *client,
return ret;
 }
 
-static void drm_setup_crtcs(struct drm_fb_helper *fb_helper,
-   u32 width, u32 height)
+/**
+ * drm_client_modeset_probe() - Probe for displays
+ * @client: DRM client
+ * @width: Maximum display mode width (optional)
+ * @height: Maximum display mode height (optional)
+ *
+ * This function sets up display pipelines for enabled connectors and stores 
the
+ * config in the client's modeset array.
+ *
+ * Returns:
+ * Zero on success or negative error code on failure.
+ */
+int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int 
width, unsigned int height)
 {
struct drm_connector *connector, **connectors = NULL;
-   struct drm_client_dev *client = _helper->client;
struct drm_connector_list_iter conn_iter;
-   struct drm_device *dev = fb_helper->dev;
+   struct drm_device *dev = client->dev;
unsigned int total_modes_count = 0;
+   struct drm_client_offset *offsets;
unsigned int connector_count = 0;
struct drm_display_mode **modes;
-   struct drm_fb_offset *offsets;
struct drm_crtc **crtcs;
+   int i, ret = 0;
bool *enabled;
-   int i;
 
DRM_DEBUG_KMS("\n");
 
+   if (!width)
+   width = dev->mode_config.max_width;
+   if (!height)
+   height = dev->mode_config.max_height;
+
drm_connector_list_iter_begin(dev, _iter);
drm_client_for_each_connector_iter(connector, _iter) {
struct drm_connector **tmp;
 
tmp = krealloc(connectors, (connector_count + 1) * 
sizeof(*connectors), GFP_KERNEL);
-   if (!tmp)
+   if (!tmp) {
+   ret = -ENOMEM;
goto free_connectors;
+   }
 

[Intel-gfx] [PATCH v3 06/11] drm/fb-helper: Prepare to move out commit code

2019-04-20 Thread Noralf Trønnes
This makes the necessary changes so the commit code can be moved out to
drm_client as-is in the next patch. It's split up to ease review.

Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/drm_fb_helper.c | 122 +---
 1 file changed, 81 insertions(+), 41 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 041ca7461b81..c6ab50810906 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -388,9 +388,20 @@ int drm_fb_helper_debug_leave(struct fb_info *info)
 }
 EXPORT_SYMBOL(drm_fb_helper_debug_leave);
 
-/* Check if the plane can hw rotate to match panel orientation */
-static bool drm_fb_helper_panel_rotation(struct drm_mode_set *modeset,
-unsigned int *rotation)
+/**
+ * drm_client_panel_rotation() - Check panel orientation
+ * @modeset: DRM modeset
+ * @rotation: Returned rotation value
+ *
+ * This function checks if the primary plane in @modeset can hw rotate to match
+ * the panel orientation on its connector.
+ *
+ * Note: Currently only 0 and 180 degrees are supported.
+ *
+ * Return:
+ * True if the plane can do the rotation, false otherwise.
+ */
+bool drm_client_panel_rotation(struct drm_mode_set *modeset, unsigned int 
*rotation)
 {
struct drm_connector *connector = modeset->connectors[0];
struct drm_plane *plane = modeset->crtc->primary;
@@ -431,10 +442,9 @@ static bool drm_fb_helper_panel_rotation(struct 
drm_mode_set *modeset,
return true;
 }
 
-static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool 
active)
+static int drm_client_modeset_commit_atomic(struct drm_client_dev *client, 
bool active)
 {
-   struct drm_client_dev *client = _helper->client;
-   struct drm_device *dev = fb_helper->dev;
+   struct drm_device *dev = client->dev;
struct drm_plane_state *plane_state;
struct drm_plane *plane;
struct drm_atomic_state *state;
@@ -474,7 +484,7 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper 
*fb_helper, bool activ
struct drm_plane *primary = mode_set->crtc->primary;
unsigned int rotation;
 
-   if (drm_fb_helper_panel_rotation(mode_set, )) {
+   if (drm_client_panel_rotation(mode_set, )) {
/* Cannot fail as we've already gotten the plane state 
above */
plane_state = drm_atomic_get_new_plane_state(state, 
primary);
plane_state->rotation = rotation;
@@ -516,15 +526,14 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper 
*fb_helper, bool activ
goto retry;
 }
 
-static int restore_fbdev_mode_legacy(struct drm_fb_helper *fb_helper)
+static int drm_client_modeset_commit_legacy(struct drm_client_dev *client)
 {
-   struct drm_client_dev *client = _helper->client;
-   struct drm_device *dev = fb_helper->dev;
+   struct drm_device *dev = client->dev;
struct drm_mode_set *mode_set;
struct drm_plane *plane;
int ret = 0;
 
-   drm_modeset_lock_all(fb_helper->dev);
+   drm_modeset_lock_all(dev);
drm_for_each_plane(plane, dev) {
if (plane->type != DRM_PLANE_TYPE_PRIMARY)
drm_plane_force_disable(plane);
@@ -553,35 +562,53 @@ static int restore_fbdev_mode_legacy(struct drm_fb_helper 
*fb_helper)
goto out;
}
 out:
-   drm_modeset_unlock_all(fb_helper->dev);
+   drm_modeset_unlock_all(dev);
 
return ret;
 }
 
-static int restore_fbdev_mode_force(struct drm_fb_helper *fb_helper)
+/**
+ * drm_client_modeset_commit_force() - Force commit CRTC configuration
+ * @client: DRM client
+ *
+ * Commit modeset configuration to crtcs without checking if there is a DRM 
master.
+ *
+ * Returns:
+ * Zero on success or negative error code on failure.
+ */
+int drm_client_modeset_commit_force(struct drm_client_dev *client)
 {
-   struct drm_device *dev = fb_helper->dev;
+   struct drm_device *dev = client->dev;
int ret;
 
-   mutex_lock(_helper->client.modeset_mutex);
+   mutex_lock(>modeset_mutex);
if (drm_drv_uses_atomic_modeset(dev))
-   ret = restore_fbdev_mode_atomic(fb_helper, true);
+   ret = drm_client_modeset_commit_atomic(client, true);
else
-   ret = restore_fbdev_mode_legacy(fb_helper);
-   mutex_unlock(_helper->client.modeset_mutex);
+   ret = drm_client_modeset_commit_legacy(client);
+   mutex_unlock(>modeset_mutex);
 
return ret;
 }
 
-static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
+/**
+ * drm_client_modeset_commit() - Commit CRTC configuration
+ * @client: DRM client
+ *
+ * Commit modeset configuration to crtcs.
+ *
+ * Returns:
+ * Zero on success or negative error code on failure.
+ */
+int drm_client_modeset_commit(struct drm_client_dev *client)
 {
-   struct 

[Intel-gfx] [PATCH v3 03/11] drm/fb-helper: No need to cache rotation and sw_rotations

2019-04-20 Thread Noralf Trønnes
Getting rotation info is cheap so we can do it on demand.

This is done in preparation for the removal of struct drm_fb_helper_crtc.

Cc: Hans de Goede 
Signed-off-by: Noralf Trønnes 
Acked-by: Daniel Vetter 
Reviewed-by: Maxime Ripard 
---
 drivers/gpu/drm/drm_fb_helper.c | 131 
 include/drm/drm_fb_helper.h |   8 --
 2 files changed, 65 insertions(+), 74 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 578428461391..1c70ecb84738 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -388,6 +388,49 @@ int drm_fb_helper_debug_leave(struct fb_info *info)
 }
 EXPORT_SYMBOL(drm_fb_helper_debug_leave);
 
+/* Check if the plane can hw rotate to match panel orientation */
+static bool drm_fb_helper_panel_rotation(struct drm_mode_set *modeset,
+unsigned int *rotation)
+{
+   struct drm_connector *connector = modeset->connectors[0];
+   struct drm_plane *plane = modeset->crtc->primary;
+   u64 valid_mask = 0;
+   unsigned int i;
+
+   if (!modeset->num_connectors)
+   return false;
+
+   switch (connector->display_info.panel_orientation) {
+   case DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP:
+   *rotation = DRM_MODE_ROTATE_180;
+   break;
+   case DRM_MODE_PANEL_ORIENTATION_LEFT_UP:
+   *rotation = DRM_MODE_ROTATE_90;
+   break;
+   case DRM_MODE_PANEL_ORIENTATION_RIGHT_UP:
+   *rotation = DRM_MODE_ROTATE_270;
+   break;
+   default:
+   *rotation = DRM_MODE_ROTATE_0;
+   }
+
+   /*
+* TODO: support 90 / 270 degree hardware rotation,
+* depending on the hardware this may require the framebuffer
+* to be in a specific tiling format.
+*/
+   if (*rotation != DRM_MODE_ROTATE_180 || !plane->rotation_property)
+   return false;
+
+   for (i = 0; i < plane->rotation_property->num_values; i++)
+   valid_mask |= (1ULL << plane->rotation_property->values[i]);
+
+   if (!(*rotation & valid_mask))
+   return false;
+
+   return true;
+}
+
 static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool 
active)
 {
struct drm_device *dev = fb_helper->dev;
@@ -428,10 +471,13 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper 
*fb_helper, bool activ
for (i = 0; i < fb_helper->crtc_count; i++) {
struct drm_mode_set *mode_set = 
_helper->crtc_info[i].mode_set;
struct drm_plane *primary = mode_set->crtc->primary;
+   unsigned int rotation;
 
-   /* Cannot fail as we've already gotten the plane state above */
-   plane_state = drm_atomic_get_new_plane_state(state, primary);
-   plane_state->rotation = fb_helper->crtc_info[i].rotation;
+   if (drm_fb_helper_panel_rotation(mode_set, )) {
+   /* Cannot fail as we've already gotten the plane state 
above */
+   plane_state = drm_atomic_get_new_plane_state(state, 
primary);
+   plane_state->rotation = rotation;
+   }
 
ret = __drm_atomic_helper_set_config(mode_set, state);
if (ret != 0)
@@ -871,7 +917,6 @@ int drm_fb_helper_init(struct drm_device *dev,
if (!fb_helper->crtc_info[i].mode_set.connectors)
goto out_free;
fb_helper->crtc_info[i].mode_set.num_connectors = 0;
-   fb_helper->crtc_info[i].rotation = DRM_MODE_ROTATE_0;
}
 
i = 0;
@@ -2500,62 +2545,6 @@ static int drm_pick_crtcs(struct drm_fb_helper 
*fb_helper,
return best_score;
 }
 
-/*
- * This function checks if rotation is necessary because of panel orientation
- * and if it is, if it is supported.
- * If rotation is necessary and supported, it gets set in fb_crtc.rotation.
- * If rotation is necessary but not supported, a DRM_MODE_ROTATE_* flag gets
- * or-ed into fb_helper->sw_rotations. In drm_setup_crtcs_fb() we check if only
- * one bit is set and then we set fb_info.fbcon_rotate_hint to make fbcon do
- * the unsupported rotation.
- */
-static void drm_setup_crtc_rotation(struct drm_fb_helper *fb_helper,
-   struct drm_fb_helper_crtc *fb_crtc,
-   struct drm_connector *connector)
-{
-   struct drm_plane *plane = fb_crtc->mode_set.crtc->primary;
-   uint64_t valid_mask = 0;
-   int i, rotation;
-
-   fb_crtc->rotation = DRM_MODE_ROTATE_0;
-
-   switch (connector->display_info.panel_orientation) {
-   case DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP:
-   rotation = DRM_MODE_ROTATE_180;
-   break;
-   case DRM_MODE_PANEL_ORIENTATION_LEFT_UP:
-   rotation = DRM_MODE_ROTATE_90;
-   break;
-   case 

Re: [Intel-gfx] [PATCH v3 5/5] drm/i915/selftests: Check that gpu reset is usable from atomic context

2019-04-20 Thread Chris Wilson
Quoting Fernando Pacheco (2019-04-20 00:00:15)
> GPU reset is now available with GuC enabled,
> so re-enable our check that this reset is usable
> from atomic context.
> 
> Signed-off-by: Fernando Pacheco 
Reviewed-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 v3 4/5] Revert "drm/i915/guc: Disable global reset"

2019-04-20 Thread Chris Wilson
Quoting Fernando Pacheco (2019-04-20 00:00:14)
> This reverts commit fe62365f9f80a1c1d438c54fba21f5108a182de8.
> 
> Signed-off-by: Fernando Pacheco 

Many thanks,
Reviewed-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 v3 3/5] drm/i915/uc: Place uC firmware in upper range of GGTT

2019-04-20 Thread Chris Wilson
Quoting Fernando Pacheco (2019-04-20 00:00:13)
> Currently we pin the GuC or HuC firmware image just
> before uploading. Perma-pin during uC initialization
> instead and use the range reserved at the top of the
> address space.
> 
> Moving the firmware resulted in needing to:
> - use an additional pinning for the rsa signature which will
>   be used during HuC auth as addresses above GUC_GGTT_TOP
>   do not map through GTT.
> 
> v2: Remove call to set to gtt domain
> Do not restore fw gtt mapping unconditionally
> Separate out pin/unpin functions and drop usage of pin/unpin
> Use uc_fw init/fini functions to bind/unbind fw object
> 
> v3: Bind is only needed during xfer (Chris)
> Remove attempts to bind outside of xfer (Chris)
> Mark fw bind/unbind static
> 
> Signed-off-by: Fernando Pacheco 
> ---
>  drivers/gpu/drm/i915/intel_guc.c|   9 ++-
>  drivers/gpu/drm/i915/intel_guc_fw.c |  18 ++---
>  drivers/gpu/drm/i915/intel_huc.c|  74 +++-
>  drivers/gpu/drm/i915/intel_huc.h|   4 ++
>  drivers/gpu/drm/i915/intel_huc_fw.c |  47 +
>  drivers/gpu/drm/i915/intel_uc.c |  23 +--
>  drivers/gpu/drm/i915/intel_uc_fw.c  | 103 
>  drivers/gpu/drm/i915/intel_uc_fw.h  |   7 +-
>  8 files changed, 212 insertions(+), 73 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_guc.c 
> b/drivers/gpu/drm/i915/intel_guc.c
> index 299b6aa4fe28..3bbf45a3bf78 100644
> --- a/drivers/gpu/drm/i915/intel_guc.c
> +++ b/drivers/gpu/drm/i915/intel_guc.c
> @@ -189,9 +189,13 @@ int intel_guc_init(struct intel_guc *guc)
> struct drm_i915_private *dev_priv = guc_to_i915(guc);
> int ret;
>  
> -   ret = guc_shared_data_create(guc);
> +   ret = intel_uc_fw_init(>fw);
> if (ret)
> goto err_fetch;
> +
> +   ret = guc_shared_data_create(guc);
> +   if (ret)
> +   goto err_fw;
> GEM_BUG_ON(!guc->shared_data);
>  
> ret = intel_guc_log_create(>log);
> @@ -220,6 +224,8 @@ int intel_guc_init(struct intel_guc *guc)
> intel_guc_log_destroy(>log);
>  err_shared:
> guc_shared_data_destroy(guc);
> +err_fw:
> +   intel_uc_fw_fini(>fw);
>  err_fetch:
> intel_uc_fw_cleanup_fetch(>fw);
> return ret;
> @@ -237,6 +243,7 @@ void intel_guc_fini(struct intel_guc *guc)
> intel_guc_ads_destroy(guc);
> intel_guc_log_destroy(>log);
> guc_shared_data_destroy(guc);
> +   intel_uc_fw_fini(>fw);
> intel_uc_fw_cleanup_fetch(>fw);
>  }
>  
> diff --git a/drivers/gpu/drm/i915/intel_guc_fw.c 
> b/drivers/gpu/drm/i915/intel_guc_fw.c
> index 4385d9ef02bb..8b2dcc70b956 100644
> --- a/drivers/gpu/drm/i915/intel_guc_fw.c
> +++ b/drivers/gpu/drm/i915/intel_guc_fw.c
> @@ -122,14 +122,16 @@ static void guc_prepare_xfer(struct intel_guc *guc)
>  }
>  
>  /* Copy RSA signature from the fw image to HW for verification */
> -static void guc_xfer_rsa(struct intel_guc *guc, struct i915_vma *vma)
> +static void guc_xfer_rsa(struct intel_guc *guc)
>  {
> struct drm_i915_private *dev_priv = guc_to_i915(guc);
> +   struct intel_uc_fw *fw = >fw;
> +   struct sg_table *pages = fw->obj->mm.pages;
> u32 rsa[UOS_RSA_SCRATCH_COUNT];
> int i;
>  
> -   sg_pcopy_to_buffer(vma->pages->sgl, vma->pages->nents,
> -  rsa, sizeof(rsa), guc->fw.rsa_offset);
> +   sg_pcopy_to_buffer(pages->sgl, pages->nents,
> +  rsa, sizeof(rsa), fw->rsa_offset);
>  
> for (i = 0; i < UOS_RSA_SCRATCH_COUNT; i++)
> I915_WRITE(UOS_RSA_SCRATCH(i), rsa[i]);
> @@ -201,7 +203,7 @@ static int guc_wait_ucode(struct intel_guc *guc)
>   * transfer between GTT locations. This functionality is left out of the API
>   * for now as there is no need for it.
>   */
> -static int guc_xfer_ucode(struct intel_guc *guc, struct i915_vma *vma)
> +static int guc_xfer_ucode(struct intel_guc *guc)
>  {
> struct drm_i915_private *dev_priv = guc_to_i915(guc);
> struct intel_uc_fw *guc_fw = >fw;
> @@ -214,7 +216,7 @@ static int guc_xfer_ucode(struct intel_guc *guc, struct 
> i915_vma *vma)
> I915_WRITE(DMA_COPY_SIZE, guc_fw->header_size + guc_fw->ucode_size);
>  
> /* Set the source address for the new blob */
> -   offset = intel_guc_ggtt_offset(guc, vma) + guc_fw->header_offset;
> +   offset = intel_uc_fw_ggtt_offset(guc_fw) + guc_fw->header_offset;
> I915_WRITE(DMA_ADDR_0_LOW, lower_32_bits(offset));
> I915_WRITE(DMA_ADDR_0_HIGH, upper_32_bits(offset) & 0x);
>  
> @@ -233,7 +235,7 @@ static int guc_xfer_ucode(struct intel_guc *guc, struct 
> i915_vma *vma)
>  /*
>   * Load the GuC firmware blob into the MinuteIA.
>   */
> -static int guc_fw_xfer(struct intel_uc_fw *guc_fw, struct i915_vma *vma)
> +static int guc_fw_xfer(struct intel_uc_fw *guc_fw)
>  {
> struct intel_guc *guc = container_of(guc_fw, struct intel_guc, fw);

Re: [Intel-gfx] [PATCH v3 2/5] drm/i915/uc: Reserve upper range of GGTT

2019-04-20 Thread Chris Wilson
Quoting Fernando Pacheco (2019-04-20 00:00:12)
> GuC and HuC depend on struct_mutex for device
> reinitialization. Moving away from this dependency
> requires perma-pinning the firmware images in GGTT.
> The upper portion of the GuC address space has
> a sizeable hole (several MB) that is inaccessible
> by GuC. Reserve this range within GGTT as it can
> comfortably hold GuC/HuC firmware images.
> 
> v2: Reserve node rather than insert (Chris)
> Simpler determination of node start/size (Daniele)
> Move reserve/release out to intel_guc.* files
> 
> v3: Reserve starting at GUC_GGTT_TOP only and bail if this
> fails (Chris)
> 
> Signed-off-by: Fernando Pacheco 
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 25 -
>  drivers/gpu/drm/i915/i915_gem_gtt.h |  1 +
>  drivers/gpu/drm/i915/intel_guc.c| 28 
>  drivers/gpu/drm/i915/intel_guc.h|  2 ++
>  4 files changed, 43 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c 
> b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 8f460cc4cc1f..0b4c22e68574 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -2752,6 +2752,12 @@ int i915_gem_init_ggtt(struct drm_i915_private 
> *dev_priv)
> if (ret)
> return ret;
>  
> +   if (USES_GUC(dev_priv)) {
> +   ret = intel_guc_reserve_ggtt_top(_priv->guc);
> +   if (ret)
> +   goto err_reserve;
> +   }
> +
> /* Clear any non-preallocated blocks */
> drm_mm_for_each_hole(entry, >vm.mm, hole_start, hole_end) {
> DRM_DEBUG_KMS("clearing unused GTT space: [%lx, %lx]\n",
> @@ -2766,12 +2772,14 @@ int i915_gem_init_ggtt(struct drm_i915_private 
> *dev_priv)
> if (INTEL_PPGTT(dev_priv) == INTEL_PPGTT_ALIASING) {
> ret = i915_gem_init_aliasing_ppgtt(dev_priv);
> if (ret)
> -   goto err;
> +   goto err_appgtt;
> }
>  
> return 0;
>  
> -err:
> +err_appgtt:
> +   intel_guc_release_ggtt_top(_priv->guc);
> +err_reserve:
> drm_mm_remove_node(>error_capture);
> return ret;
>  }
> @@ -2797,6 +2805,8 @@ void i915_ggtt_cleanup_hw(struct drm_i915_private 
> *dev_priv)
> if (drm_mm_node_allocated(>error_capture))
> drm_mm_remove_node(>error_capture);
>  
> +   intel_guc_release_ggtt_top(_priv->guc);
> +
> if (drm_mm_initialized(>vm.mm)) {
> intel_vgt_deballoon(dev_priv);
> i915_address_space_fini(>vm);
> @@ -3369,17 +3379,6 @@ int i915_ggtt_probe_hw(struct drm_i915_private 
> *dev_priv)
> if (ret)
> return ret;
>  
> -   /* Trim the GGTT to fit the GuC mappable upper range (when enabled).
> -* This is easier than doing range restriction on the fly, as we
> -* currently don't have any bits spare to pass in this upper
> -* restriction!
> -*/
> -   if (USES_GUC(dev_priv)) {
> -   ggtt->vm.total = min_t(u64, ggtt->vm.total, GUC_GGTT_TOP);
> -   ggtt->mappable_end =
> -   min_t(u64, ggtt->mappable_end, ggtt->vm.total);
> -   }
> -
> if ((ggtt->vm.total - 1) >> 32) {
> DRM_ERROR("We never expected a Global GTT with more than 
> 32bits"
>   " of address space! Found %lldM!\n",
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h 
> b/drivers/gpu/drm/i915/i915_gem_gtt.h
> index f597f35b109b..b51e779732c3 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.h
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
> @@ -384,6 +384,7 @@ struct i915_ggtt {
> u32 pin_bias;
>  
> struct drm_mm_node error_capture;
> +   struct drm_mm_node uc_fw;

I thought this might have been a better fit in with intel_uc if there's
a common spot for it. Likewise, I should move error_capture over to
i915_gpu_error.

>  };
>  
>  struct i915_hw_ppgtt {
> diff --git a/drivers/gpu/drm/i915/intel_guc.c 
> b/drivers/gpu/drm/i915/intel_guc.c
> index d81a02b0f525..299b6aa4fe28 100644
> --- a/drivers/gpu/drm/i915/intel_guc.c
> +++ b/drivers/gpu/drm/i915/intel_guc.c
> @@ -721,3 +721,31 @@ u32 intel_guc_reserved_gtt_size(struct intel_guc *guc)
>  {
> return guc_to_i915(guc)->wopcm.guc.size;
>  }
> +
> +int intel_guc_reserve_ggtt_top(struct intel_guc *guc)
> +{
> +   struct drm_i915_private *i915 = guc_to_i915(guc);
> +   struct i915_ggtt *ggtt = >ggtt;
> +   u64 size;
> +   int ret;
> +
> +   size = ggtt->vm.total - GUC_GGTT_TOP;
> +
> +   ret = i915_gem_gtt_reserve(>vm, >uc_fw, size,
> +  GUC_GGTT_TOP, I915_COLOR_UNEVICTABLE,
> +  PIN_NOEVICT);
> +

We don't tend to leave newlines before conditions.

> +   if (ret)
> +   DRM_DEBUG_DRIVER("GuC: failed to reserve top of ggtt\n");
> +
> +

Re: [Intel-gfx] [PATCH v3 1/5] drm/i915/uc: Rename uC firmware init/fini functions

2019-04-20 Thread Chris Wilson
Quoting Fernando Pacheco (2019-04-20 00:00:11)
> The uC firmware init function is called during
> GuC/HuC init early phases. Rename to include "_early"
> and properly reflect which phase we are at.
> 
> The uC firmware fini function is cleaning up the
> state set/created on firmware fetch. Replace
> "_fini" with "_cleanup_fetch".
> 
> v2: also rename uC fw fini function
> 
> Signed-off-by: Fernando Pacheco 
Reviewed-by: Chris Wilson 
-Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx