[Bug 107082] With 4.18 rc kernel stop working video output on AMD GPU Vega 56

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107082

--- Comment #4 from mikhail.v.gavri...@gmail.com ---
(In reply to Harry Wentland from comment #3)
> Created attachment 140594 [details] [review]
> [PATCH] drm/amd/display: Convert 10kHz clks from PPLib into kHz for Vega
> 
> Don't think the other patch would apply to 4.18 but this one should. There's
> been a bunch of work on the powerplay/DC interface, so this looks different
> for 4.18 and amd-stg.

I can confirm that this patch fix the issue.

But I did not like one thing:
I decided to check how work VEGA GPU through HDMI and connected the second
monitor via HDMI.

The first that I did not like was that on the first monitor which was connected
via DisplayPort, the scaling setting was reset from 200% to 100%.

The second that I did not like was that when I tried to set the scaling at 200%
through gnome-settings, my computer was hung. I even could not connect through
ssh to look at the kernel log.

I tried to repeat this case but unsuccessfully, but unpleasant residue still
remained.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/ttm: use swap macro in ttm_bo_handle_move_mem

2018-07-12 Thread Sinclair Yeh
On Mon, Jul 09, 2018 at 10:24:47AM -0500, Gustavo A. R. Silva wrote:
> Make use of the swap macro and remove unnecessary variable *tmp_mem*.
> This makes the code easier to read and maintain. Also, reduces the
> stack usage.
> 
> This code was detected with the help of Coccinelle.
> 
> Signed-off-by: Gustavo A. R. Silva 
> ---
>  drivers/gpu/drm/ttm/ttm_bo.c | 7 ++-
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index 5d8688e52..5142dcb 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -287,12 +287,9 @@ static int ttm_bo_handle_move_mem(struct 
> ttm_buffer_object *bo,
>  
>   if (ret) {
>   if (bdev->driver->move_notify) {
> - struct ttm_mem_reg tmp_mem = *mem;
> - *mem = bo->mem;
> - bo->mem = tmp_mem;
> + swap(*mem, bo->mem);
>   bdev->driver->move_notify(bo, false, mem);
> - bo->mem = *mem;
> - *mem = tmp_mem;
> + swap(*mem, bo->mem);

This code assumes bo->mem is the same as tmp_mem after the call to
move_notify. Is this always true?



>   }
>  
>   goto out_err;
> -- 
> 2.7.4
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-develdata=02%7C01%7Csyeh%40vmware.com%7C3bd79878de5141b5187408d5e6326e6d%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C1%7C0%7C636668026634710967sdata=2raJ6TBpcEM5W7hi8iCEnrEdcfJa3W5ct3tF%2BlSZLkQ%3Dreserved=0
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


linux-next: build failure after merge of the drm-intel tree

2018-07-12 Thread Stephen Rothwell
Hi all,

[Dave cc'd because this will probably turn up in the drm tree soon.]

After merging the drm-intel tree, today's linux-next build (x86_64
allmodconfig) failed like this:

drivers/gpu/drm/i915/gvt/kvmgt.c: In function 'gvt_dma_map_page':
drivers/gpu/drm/i915/gvt/kvmgt.c:188:17: error: 'pfn' undeclared (first use in 
this function); did you mean 'gfn'?
  if (!pfn_valid(pfn)) {
 ^~~

Caused by commit

  79e542f5af79 ("drm/i915/kvmgt: Support setting dma map for huge pages")

interacting with commit

  39b4cbadb9a9 ("drm/i915/kvmgt: Check the pfn got from vfio_pin_pages")

from Linus' tree (v4.18-rc1).

I added the following merge fix patch:

From: Stephen Rothwell 
Date: Fri, 13 Jul 2018 11:48:41 +1000
Subject: [PATCH] drm/i915/kvmgt: merge fixup for "Check the pfn got from
 vfio_pin_pages"

Signed-off-by: Stephen Rothwell 
---
 drivers/gpu/drm/i915/gvt/kvmgt.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index 718ab307a500..4d2f53ae9f0f 100644
--- a/drivers/gpu/drm/i915/gvt/kvmgt.c
+++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
@@ -185,12 +185,6 @@ static int gvt_dma_map_page(struct intel_vgpu *vgpu, 
unsigned long gfn,
if (ret)
return ret;
 
-   if (!pfn_valid(pfn)) {
-   gvt_vgpu_err("pfn 0x%lx is not mem backed\n", pfn);
-   vfio_unpin_pages(mdev_dev(vgpu->vdev.mdev), , 1);
-   return -EINVAL;
-   }
-
/* Setup DMA mapping. */
*dma_addr = dma_map_page(dev, page, 0, size, PCI_DMA_BIDIRECTIONAL);
ret = dma_mapping_error(dev, *dma_addr);
-- 
2.18.0

-- 
Cheers,
Stephen Rothwell


pgpq7I0WlTUgj.pgp
Description: OpenPGP digital signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 107213] [amdgpu/DisplayPort] KDE Wayland session is segfaulting right after login

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107213

Bug ID: 107213
   Summary: [amdgpu/DisplayPort] KDE Wayland session is
segfaulting right after login
   Product: DRI
   Version: unspecified
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: DRM/AMDgpu
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: shtetl...@gmail.com

I just tried to use a Wayland session with KDE Plasma 5.13.2 (Debian testing)
and it's segfaulting right after login and falling back to sddm.

That's what I see in dmesg:

[  176.359816] [drm:generic_reg_wait [amdgpu]] *ERROR* REG_WAIT timeout 10us *
3000 tries - dce110_stream_encoder_dp_blank line:956
[  176.814144] QThread[2620]: segfault at f ip 7f30f30b0e60 sp
7f30e506e4f0 error 4 in libwayland-client.so.0.3.0[7f30f30a9000+d000]

Not sure whether it's amdgpu problem of something with KWin.

GPU: AMD Vega 56, connected over DisplayPort.

OpenGL renderer string: Radeon RX Vega (VEGA10, DRM 3.25.0, 4.17.0-1-amd64,
LLVM 6.0.1)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 18.1.3

Corresponding KDE bug: https://bugs.kde.org/show_bug.cgi?id=396066

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 105760] [4.17-rc1] RIP: smu7_populate_single_firmware_entry.isra.6+0x57/0xc0 [amdgpu] RSP: ffffa17901efb930

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105760

--- Comment #44 from Thomas Martitz  ---
Disabling runtime pm probably result in poor battery life, right? This is a
laptop with hybrid graphics afterall and the radeon should be disabled most of
the time.

Is there anything I can try? Like checking something in windows or try the pro
driver? Or make more code changes, eg retrying to power up the GPU a couple
times?

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 107153] 4.18-rc3 crash on hdmi (0010:dm_update_crtcs_state+0x41e/0x4a0)

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107153

--- Comment #8 from Leo Li  ---
Thanks for filing the ticket Patrik, can you please give the attached two
patches a shot? I cp'ed them over 4.18-rc3 and they seem to fix it for me.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 107153] 4.18-rc3 crash on hdmi (0010:dm_update_crtcs_state+0x41e/0x4a0)

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107153

--- Comment #7 from Leo Li  ---
Created attachment 140614
  --> https://bugs.freedesktop.org/attachment.cgi?id=140614=edit
Patch 2/2

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 107153] 4.18-rc3 crash on hdmi (0010:dm_update_crtcs_state+0x41e/0x4a0)

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107153

--- Comment #6 from Leo Li  ---
Created attachment 140613
  --> https://bugs.freedesktop.org/attachment.cgi?id=140613=edit
Patch 1/2

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 21/21] arm64: dts: qcom: sdm845: Add dpu to sdm845 dts file

2018-07-12 Thread Sean Paul
DPU is short for the Display Processing Unit. It is the display
controller on Qualcomm SDM845 chips.

While the dts is pretty sparse for sdm845 atm, the only piece
we're missing is the iommu. It's commented out for now, and should be
uncommented once support is provided.

Changes in v2:
 - Beefed up commit message
 - Use SoC specific compatibles for mdss and dpu
 - Use assigned-clocks to set initial clock frequency

Signed-off-by: Sean Paul 
---
 arch/arm64/boot/dts/qcom/sdm845.dtsi | 200 +++
 1 file changed, 200 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi 
b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index cdaabeb3c995..f1f4cdc9cb63 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -5,6 +5,8 @@
  * Copyright (c) 2018, The Linux Foundation. All rights reserved.
  */
 
+#include 
+#include 
 #include 
 
 / {
@@ -221,6 +223,204 @@
#interrupt-cells = <2>;
};
 
+   mdss: mdss@ae0 {
+   compatible = "qcom,sdm845-mdss";
+   reg = <0xae0 0x1000>;
+   reg-names = "mdss_phys";
+
+   power-domains = < 0>;
+
+   clocks = < GCC_DISP_AHB_CLK>,
+< GCC_DISP_AXI_CLK>,
+< DISP_CC_MDSS_MDP_CLK>;
+   clock-names = "iface", "bus", "core";
+
+   assigned-clocks = < DISP_CC_MDSS_MDP_CLK>;
+   assigned-clock-rates = <3>;
+
+   interrupts = ;
+   interrupt-controller;
+   #interrupt-cells = <1>;
+
+   /* iommus = <_iommu 0>; */
+
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+
+   mdss_mdp: mdp@ae01000 {
+   compatible = "qcom,sdm845-dpu";
+   reg = <0x0ae01000 0x8f000>,
+ <0x0aeb 0x2008>;
+   reg-names = "mdp_phys", "vbif_phys";
+
+   clocks = < DISP_CC_MDSS_AHB_CLK>,
+< DISP_CC_MDSS_AXI_CLK>,
+< DISP_CC_MDSS_MDP_CLK>,
+< DISP_CC_MDSS_VSYNC_CLK>;
+   clock-names = "iface", "bus", "core", "vsync";
+
+   assigned-clocks = < 
DISP_CC_MDSS_MDP_CLK>,
+ < 
DISP_CC_MDSS_VSYNC_CLK>;
+   assigned-clock-rates = <3>,
+  <1920>;
+
+   interrupt-parent = <>;
+   interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   dpu_intf1_out: endpoint {
+   remote-endpoint = 
<_in>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+   dpu_intf2_out: endpoint {
+   remote-endpoint = 
<_in>;
+   };
+   };
+   };
+   };
+
+   dsi0: dsi@ae94000 {
+   compatible = "qcom,mdss-dsi-ctrl";
+   reg = <0xae94000 0x400>;
+   reg-names = "dsi_ctrl";
+
+   interrupt-parent = <>;
+   interrupts = <4 0>;
+
+   clocks = < DISP_CC_MDSS_BYTE0_CLK>,
+< DISP_CC_MDSS_BYTE0_INTF_CLK>,
+< DISP_CC_MDSS_PCLK0_CLK>,
+< DISP_CC_MDSS_ESC0_CLK>,
+< DISP_CC_MDSS_AHB_CLK>,
+< DISP_CC_MDSS_AXI_CLK>;
+   clock-names = "byte_clk",
+ "byte_intf_clk",
+ "pixel_clk",
+ "core_clk",
+ "iface_clk",
+  

[PATCH v2 19/21] dt-bindings: msm/disp: Add bindings for Snapdragon 845 DPU

2018-07-12 Thread Sean Paul
From: Jeykumar Sankaran 

Adds bindings for Snapdragon 845 display processing unit

Changes in v2:
 - Use SoC specific compatibles for mdss and dpu
 - Use assigned-clocks to set initial clock frequency

Signed-off-by: Jeykumar Sankaran 
Signed-off-by: Rajesh Yadav 
Signed-off-by: Sean Paul 
---
 .../devicetree/bindings/display/msm/dpu.txt   | 136 ++
 1 file changed, 136 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/msm/dpu.txt

diff --git a/Documentation/devicetree/bindings/display/msm/dpu.txt 
b/Documentation/devicetree/bindings/display/msm/dpu.txt
new file mode 100644
index ..a998028896ba
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/msm/dpu.txt
@@ -0,0 +1,136 @@
+Qualcomm Technologies, Inc. DPU KMS
+
+Description:
+
+Device tree bindings for MSM Mobile Display Subsytem(MDSS) that encapsulates
+sub-blocks like DPU display controller, DSI and DP interfaces etc.
+The DPU display controller is found in SDM845 SoC.
+
+MDSS:
+Required properties:
+- compatible: "qcom,sdm845-mdss"
+- reg: physical base address and length of contoller's registers.
+- reg-names: register region names. The following region is required:
+  * "mdss_phys"
+- power-domains: a power domain consumer specifier according to
+  Documentation/devicetree/bindings/power/power_domain.txt
+- clocks: list of phandles for clock device nodes needed by the device.
+- clock-names: device clock names, must be in same order as clocks property.
+  The following clocks are required:
+  * "iface"
+  * "bus"
+  * "core"
+- interrupts: interrupt signal from MDSS.
+- interrupt-controller: identifies the node as an interrupt controller.
+- #interrupt-cells: specifies the number of cells needed to encode an interrupt
+  source, should be 1.
+- iommus: phandle of iommu device node.
+- #address-cells: number of address cells for the MDSS children. Should be 1.
+- #size-cells: Should be 1.
+- ranges: parent bus address space is the same as the child bus address space.
+
+Optional properties:
+- assigned-clocks: list of phandles for clock device nodes needing rate
+  assignment
+- assigned-clock-rates: list of clock frequencies sorted in the same order as
+  the assigned-clocks property.
+
+MDP:
+Required properties:
+- compatible: "qcom,sdm845-dpu"
+- reg: physical base address and length of controller's registers.
+- reg-names : register region names. The following region is required:
+  * "mdp_phys"
+  * "vbif_phys"
+- clocks: list of phandles for clock device nodes needed by the device.
+- clock-names: device clock names, must be in same order as clocks property.
+  The following clocks are required.
+  * "bus"
+  * "iface"
+  * "core"
+  * "vsync"
+- interrupt-parent: phandle to MDSS block.
+- interrupts: interrupt line from DPU to MDSS.
+- ports: contains the list of output ports from DPU device. These ports connect
+  to interfaces that are external to the DPU hardware, such as DSI, DP etc.
+
+  Each output port contains an endpoint that describes how it is connected to 
an
+  external interface. These are described by the standard properties documented
+  here:
+   Documentation/devicetree/bindings/graph.txt
+   Documentation/devicetree/bindings/media/video-interfaces.txt
+
+   Port 0 -> DPU_INTF1 (DSI1)
+   Port 1 -> DPU_INTF2 (DSI2)
+
+Optional properties:
+- assigned-clocks: list of phandles for clock device nodes needing rate
+  assignment
+- assigned-clock-rates: list of clock frequencies sorted in the same order as
+  the assigned-clocks property.
+
+Example:
+
+   mdss: mdss@ae0 {
+   compatible = "qcom,sdm845-mdss";
+   reg = <0xae0 0x1000>;
+   reg-names = "mdss_phys";
+
+   power-domains = <_dispcc 0>;
+
+   clocks = < GCC_DISP_AHB_CLK>, < GCC_DISP_AXI_CLK>,
+<_dispcc DISP_CC_MDSS_MDP_CLK>;
+   clock-names = "iface", "bus", "core";
+
+   assigned-clocks = <_dispcc DISP_CC_MDSS_MDP_CLK>;
+   assigned-clock-rates = <3>;
+
+   interrupts = ;
+   interrupt-controller;
+   #interrupt-cells = <1>;
+
+   iommus = <_iommu 0>;
+
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+
+   mdss_mdp: mdp@ae01000 {
+   compatible = "qcom,sdm845-dpu";
+   reg = <0x0ae01000 0x8f000>,
+ <0x0aeb 0x2008>;
+   reg-names = "mdp_phys", "vbif_phys";
+
+   clocks = <_dispcc DISP_CC_MDSS_AHB_CLK>,
+<_dispcc DISP_CC_MDSS_AXI_CLK>,
+<_dispcc DISP_CC_MDSS_MDP_CLK>,
+<_dispcc DISP_CC_MDSS_VSYNC_CLK>;
+   clock-names = "iface", "bus", "core", "vsync";
+
+   

[Bug 105760] [4.17-rc1] RIP: smu7_populate_single_firmware_entry.isra.6+0x57/0xc0 [amdgpu] RSP: ffffa17901efb930

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105760

--- Comment #43 from Alex Deucher  ---
It's fine to have one of the patches to stop the segfault applied.  that's just
a symptom of the root cause:
[   54.734549] amdgpu :01:00.0: Refused to change power state, currently in
D3
[   54.810069] amdgpu :01:00.0: Refused to change power state, currently in
D3
For some reason the GPU doesn't power up correctly.  There's not much the
driver can do until we sort out why ACPI is not powering up the GPU correctly.

As a workaround, you can disable runtime pm by appending amdgpu.runpm=0 on the
kernel command line in grub.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/dp_helper: Add DP aux channel tracing

2018-07-12 Thread Daniel Vetter
On Thu, Jul 12, 2018 at 01:24:19PM -0400, Lyude Paul wrote:
> This is something we've needed for a very long time now, as it makes
> debugging issues with faulty MST hubs along with debugging issues
> regarding us interfacing with hubs correctly vastly easier to debug.
> Currently this can actually be done if you trace the i2c devices for DP
> using ftrace but that's significantly less useful for a couple of
> reasons:
> 
> - Tracing the i2c devices through ftrace means all of the traces are
>   going to contain a lot of "garbage" output that we're sending over the
>   i2c line. Most of this garbage comes from retrying transactions, DRM's
>   helper library adding extra transactions to work around bad hubs, etc.
> - Having a user set up ftrace so that they can provide debugging
>   information is a lot more difficult then being able to say "just boot
>   with drm.debug=0x100"
> - We can potentially expand upon this tracing in the future to print
>   debugging information in regards to other DP transactions like MST
>   sideband transactions
> 
> This is inspired by a patch Rob Clark sent to do this a long time back.
> Neither of us could find the patch however, so we both assumed it would
> probably just be easier to rewrite it anyway.
> 
> Cc: Rob Clark 
> Signed-off-by: Lyude Paul 
> ---
>  drivers/gpu/drm/drm_dp_helper.c | 34 -
>  drivers/gpu/drm/drm_drv.c   | 15 ---
>  include/drm/drm_print.h |  6 ++
>  3 files changed, 43 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index a7ba602a43a8..6fa5a59aa17c 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -185,6 +185,21 @@ EXPORT_SYMBOL(drm_dp_bw_code_to_link_rate);
>  
>  #define AUX_RETRY_INTERVAL 500 /* us */
>  
> +static inline void
> +drm_dp_dump_access(const struct drm_dp_aux *aux,
> +u8 request, uint offset, void *buffer, int ret)
> +{
> + const char *arrow = request == DP_AUX_NATIVE_READ ? "->" : "<-";
> +
> + if (ret > 0)
> + drm_dbg(DRM_UT_DP, "%s: 0x%08x AUX %s (ret=%3d) %*ph%s\n",
> + aux->name, offset, arrow, ret, min(ret, 64),
> + buffer, ret > 64 ? "..." : "");

Afaik dp spec limits transfers to 20 bytes max. We should probably update
the docs about this in drm_dp_aux_msg. i915 definitely throws a E2BIG at
you if you try something else.

Similar with addresses, they're only 20 bits afaiui. Again should probably
update the docs of drm_dp_aux_msg.

Otherwise lgtm and I guess we can figure out how to report i2c stuff at a
different time, or delegate that to the i2c core.

With the pretty printing adjusted to follow the dp limits:

Reviewed-by: Daniel Vetter 

btw, want drm-misc commit rights for stuff like this? If yes just ask
seanpaul/mlankhorst/padovan on irc for ack and then poke daniels or
another fdo admin.

Cheers, Daniel

> + else
> + drm_dbg(DRM_UT_DP, "%s: 0x%08x AUX %s (ret=%3d)\n",
> + aux->name, offset, arrow, ret);
> +}
> +
>  /**
>   * DOC: dp helpers
>   *
> @@ -288,10 +303,14 @@ ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, 
> unsigned int offset,
>   ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, DP_DPCD_REV, buffer,
>1);
>   if (ret != 1)
> - return ret;
> + goto out;
>  
> - return drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, offset, buffer,
> -   size);
> + ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, offset, buffer,
> +  size);
> +
> +out:
> + drm_dp_dump_access(aux, DP_AUX_NATIVE_READ, offset, buffer, ret);
> + return ret;
>  }
>  EXPORT_SYMBOL(drm_dp_dpcd_read);
>  
> @@ -312,8 +331,13 @@ EXPORT_SYMBOL(drm_dp_dpcd_read);
>  ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset,
> void *buffer, size_t size)
>  {
> - return drm_dp_dpcd_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer,
> -   size);
> + int ret;
> +
> +
> + ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer,
> +  size);
> + drm_dp_dump_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer, ret);
> + return ret;
>  }
>  EXPORT_SYMBOL(drm_dp_dpcd_write);
>  
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 7af748ed1c58..e555eb5de275 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -53,13 +53,14 @@ MODULE_AUTHOR("Gareth Hughes, Leif Delgass, José Fonseca, 
> Jon Smirl");
>  MODULE_DESCRIPTION("DRM shared core routines");
>  MODULE_LICENSE("GPL and additional rights");
>  MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug 
> category.\n"
> -"\t\tBit 0 (0x01) will enable CORE messages (drm core code)\n"
> -"\t\tBit 1 (0x02) will enable 

Re: [PATCH 10/13] drm/msm/adreno: Convert the show/crash file format

2018-07-12 Thread Daniel Vetter
On Thu, Jul 12, 2018 at 12:59:27PM -0600, Jordan Crouse wrote:
> Convert the format of the 'show' debugfs file and the crash
> dump to a  format resembling YAML. This should be easier to
> parse and be more flexible for future changes and expansions.
> 
> Signed-off-by: Jordan Crouse 
> ---
>  Documentation/gpu/drm-msm-crash-dump.txt | 46 

.rst would be  nice, plus including it some msm.rst overview file like we
have for other drivers. For drivers we also tend to omit the drm prefix in
the documentation.
-Daniel

>  drivers/gpu/drm/msm/adreno/adreno_gpu.c  | 20 ++-
>  2 files changed, 58 insertions(+), 8 deletions(-)
>  create mode 100644 Documentation/gpu/drm-msm-crash-dump.txt
> 
> diff --git a/Documentation/gpu/drm-msm-crash-dump.txt 
> b/Documentation/gpu/drm-msm-crash-dump.txt
> new file mode 100644
> index ..930e4c970a62
> --- /dev/null
> +++ b/Documentation/gpu/drm-msm-crash-dump.txt
> @@ -0,0 +1,46 @@
> +# drm/msm GPU crash dump format
> +#
> +# This is a description of the format of the drm/msm GPU crash dump format 
> that
> +# can be read from /sys/kernel/dri/X/show or from devcoredump following a GPU
> +# hang or fault
> +
> +---
> +kernel:  # [string] The kernel version as printed by UTS_RELEASE
> +module:  # [string] The module that generated the crash dump
> +time:# [seconds.microseconds] The kernel time at crash
> +comm:# [string] comm string for the binary that generated 
> the fault
> + # (if known)
> +cmdline: # [string] the cmdline for the binary that generated the fault
> + # (if known)
> +revision:# [ id core.major.minor.patchlevel] The GPU id followed by the
> + # individual components of the id separated by dots
> +rbbm-status: # [hex] The current value of RBBM_STATUS which shows what GPU
> + # components were in use at the time of the crash
> +ringbuffer:  # Ringbuffer data. There will be a sequence for each ringbuffer
> +  -id:   # [decimal] Ringbuffer identifier (0 based 
> index)
> +   last-fence:   # [decimal] The last fence issued on the ring
> +   retired-fence:# [decimal] THe last fence retired on the ring
> +   rptr: # [decimal] The current read pointer (rptr) for the ring
> +   wptr: # [decimal] The current write pointer (wptr) for the
> + # ring
> +   size: # [decimal] The maximum size of the ring programmed in
> + # the hardware
> +   data: # [ascii85] The contents of the ring encoded as ascii85.
> + # Only the unused portions of the ring will be printed
> + # (up to a maximum of 'size' bytes)
> +bos: # List of buffers from the hanging submission (if known)
> +  -iova: # [hex] GPU address of the buffer
> +   size: # [decimal] Size of the buffer (in bytes)
> +   data: # [ascii85] The contents of the buffer encoded as
> + # ascii85. Only the contents of buffers marked as
> + # readable are dumped. Trailing zeros at the end of the
> + # buffer won't be dumped.
> +registers:   # Sets of register values. This section can be used multiple
> + # times for different ranges of registers. Each register will be
> + # on its own line.
> +  - [offset, value]  # offset: [hex] byte offset of the register
> + # value: [hex] value of the register
> +
> +registers-hlsq: # (5xx only) Same format as registers. Register data that
> + # only accessible from the HLSQ aperture captured by the
> + # HW based crashdumper
> diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c 
> b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> index 163542487e2c..15fe0d029ba6 100644
> --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> @@ -444,23 +444,27 @@ void adreno_show(struct msm_gpu *gpu, struct 
> msm_gpu_state *state,
>   if (IS_ERR_OR_NULL(state))
>   return;
>  
> - drm_printf(p, "status:   %08x\n", state->rbbm_status);
>   drm_printf(p, "revision: %d (%d.%d.%d.%d)\n",
>   adreno_gpu->info->revn, adreno_gpu->rev.core,
>   adreno_gpu->rev.major, adreno_gpu->rev.minor,
>   adreno_gpu->rev.patchid);
>  
> - for (i = 0; i < gpu->nr_rings; i++) {
> - drm_printf(p, "rb %d: fence:%d/%d\n", i,
> - state->ring[i].fence, state->ring[i].seqno);
> + drm_printf(p, "rbbm-status: 0x%08x\n", state->rbbm_status);
> +
> + drm_puts(p, "ringbuffer:\n");
>  
> - drm_printf(p, "  rptr: %d\n", state->ring[i].rptr);
> - drm_printf(p, "rb wptr:  %d\n", state->ring[i].wptr);
> + for (i = 0; i < gpu->nr_rings; i++) {
> + 

Re: [PATCH 03/13] drm: Add drm_puts() to complement drm_printf()

2018-07-12 Thread Daniel Vetter
On Thu, Jul 12, 2018 at 12:59:20PM -0600, Jordan Crouse wrote:
> Add drm_puts() for a much faster path to print constant strings
> into a drm_printer object with memcpy and friends. This can
> shave seconds off of really large outputs such as GPU dumps.
> 
> If the drm_printer object supports a custom puts function then
> use that otherwise fall back to the slower legacy printf call.
> 
> Signed-off-by: Jordan Crouse 
> ---
>  drivers/gpu/drm/drm_print.c | 9 +
>  include/drm/drm_print.h | 2 ++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
> index 03d1f98e5ac7..8fd489248a50 100644
> --- a/drivers/gpu/drm/drm_print.c
> +++ b/drivers/gpu/drm/drm_print.c
> @@ -122,6 +122,15 @@ void __drm_printfn_debug(struct drm_printer *p, struct 
> va_format *vaf)
>  }
>  EXPORT_SYMBOL(__drm_printfn_debug);
>  

Please some small kerneldoc here, with that

Reviewed-by: Daniel Vetter 

btw want commit rights for drm-misc for stuff like this?
-Daniel

> +void drm_puts(struct drm_printer *p, const char *str)
> +{
> + if (p->puts)
> + p->puts(p, str);
> + else
> + drm_printf(p, "%s", str);
> +}
> +EXPORT_SYMBOL(drm_puts);
> +
>  /**
>   * drm_printf - print to a _printer stream
>   * @p: the _printer
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 0ea440fb5ec3..b16f4ecaa984 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -69,6 +69,7 @@
>  struct drm_printer {
>   /* private: */
>   void (*printfn)(struct drm_printer *p, struct va_format *vaf);
> + void (*puts)(struct drm_printer *p, const char *str);
>   void *arg;
>   const char *prefix;
>  };
> @@ -80,6 +81,7 @@ void __drm_printfn_debug(struct drm_printer *p, struct 
> va_format *vaf);
>  
>  __printf(2, 3)
>  void drm_printf(struct drm_printer *p, const char *f, ...);
> +void drm_puts(struct drm_printer *p, const char *str);
>  
>  __printf(2, 0)
>  /**
> -- 
> 2.17.1
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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


Re: [PATCH 08/13] drm/msm/gpu: Rearrange the code that collects the task during a hang

2018-07-12 Thread Chris Wilson
Quoting Jordan Crouse (2018-07-12 19:59:25)
> Do a bit of cleanup to prepare for upcoming changes to pass the
> hanging task comm and cmdline to the crash dump function.
> 
> Signed-off-by: Jordan Crouse 
> ---
>  drivers/gpu/drm/msm/msm_gpu.c | 18 ++
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
> index 1c09acfb4028..2ca354047250 100644
> --- a/drivers/gpu/drm/msm/msm_gpu.c
> +++ b/drivers/gpu/drm/msm/msm_gpu.c
> @@ -314,6 +314,7 @@ static void recover_worker(struct work_struct *work)
> struct msm_drm_private *priv = dev->dev_private;
> struct msm_gem_submit *submit;
> struct msm_ringbuffer *cur_ring = gpu->funcs->active_ring(gpu);
> +   char *comm = NULL, *cmd = NULL;
> int i;
>  
> mutex_lock(>struct_mutex);
> @@ -327,7 +328,7 @@ static void recover_worker(struct work_struct *work)
> rcu_read_lock();
> task = pid_task(submit->pid, PIDTYPE_PID);
> if (task) {
> -   char *cmd;
> +   comm = kstrdup(task->comm, GFP_KERNEL);

Under rcu_read_lock(), GFP_KERNEL is not allowed, you need GFP_NOWAIT or
some such (or grab a reference to the pid and drop rcu then GFP_KERNEL).
-Chris
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 04/13] drm: Add a -puts() function for the seq_file printer

2018-07-12 Thread Daniel Vetter
On Thu, Jul 12, 2018 at 12:59:21PM -0600, Jordan Crouse wrote:
> Add a puts() function to use seq_puts() to help speed up
> up print time for constant strings.
> 
> Signed-off-by: Jordan Crouse 

Reviewed-by: Daniel Vetter 

> ---
>  drivers/gpu/drm/drm_print.c | 6 ++
>  include/drm/drm_print.h | 2 ++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
> index 8fd489248a50..bef8f0ec5d73 100644
> --- a/drivers/gpu/drm/drm_print.c
> +++ b/drivers/gpu/drm/drm_print.c
> @@ -104,6 +104,12 @@ void __drm_printfn_coredump(struct drm_printer *p, 
> struct va_format *vaf)
>  }
>  EXPORT_SYMBOL(__drm_printfn_coredump);
>  
> +void __drm_puts_seq_file(struct drm_printer *p, const char *str)
> +{
> + seq_puts(p->arg, str);
> +}
> +EXPORT_SYMBOL(__drm_puts_seq_file);
> +
>  void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf)
>  {
>   seq_printf(p->arg, "%pV", vaf);
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index b16f4ecaa984..3bc6ba4b7b2c 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -76,6 +76,7 @@ struct drm_printer {
>  
>  void __drm_printfn_coredump(struct drm_printer *p, struct va_format *vaf);
>  void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf);
> +void __drm_puts_seq_file(struct drm_printer *p, const char *str);
>  void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf);
>  void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf);
>  
> @@ -144,6 +145,7 @@ static inline struct drm_printer 
> drm_seq_file_printer(struct seq_file *f)
>  {
>   struct drm_printer p = {
>   .printfn = __drm_printfn_seq_file,
> + .puts = __drm_puts_seq_file,
>   .arg = f,
>   };
>   return p;
> -- 
> 2.17.1
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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


Re: [PATCH 07/13] drm/msm/gpu: Convert the GPU show function to use the GPU state

2018-07-12 Thread Chris Wilson
Quoting Jordan Crouse (2018-07-12 19:59:24)
> Convert the existing GPU show function to use the GPU state to
> dump the information rather than reading it directly from the hardware.
> This will require an additional step to capture the state before
> dumping it for the existing nodes but it will greatly facilitate reusing
> the same code for dumping a previously captured state from a GPU hang.
> 
> Signed-off-by: Jordan Crouse 
> ---
>  drivers/gpu/drm/msm/adreno/a3xx_gpu.c   | 11 +--
>  drivers/gpu/drm/msm/adreno/a4xx_gpu.c   | 12 +---
>  drivers/gpu/drm/msm/adreno/a5xx_gpu.c   | 18 +
>  drivers/gpu/drm/msm/adreno/adreno_gpu.c | 30 
>  drivers/gpu/drm/msm/adreno/adreno_gpu.h |  3 +-
>  drivers/gpu/drm/msm/msm_debugfs.c   | 92 ++---
>  drivers/gpu/drm/msm/msm_gpu.h   |  3 +-
>  7 files changed, 104 insertions(+), 65 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c 
> b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
> index b707b5bca9ab..4cffec2b6adc 100644
> --- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
> @@ -411,15 +411,6 @@ static const unsigned int a3xx_registers[] = {
> ~0   /* sentinel */
>  };
>  
> -#ifdef CONFIG_DEBUG_FS
> -static void a3xx_show(struct msm_gpu *gpu, struct seq_file *m)
> -{
> -   seq_printf(m, "status:   %08x\n",
> -   gpu_read(gpu, REG_A3XX_RBBM_STATUS));
> -   adreno_show(gpu, m);
> -}
> -#endif
> -
>  /* would be nice to not have to duplicate the _show() stuff with printk(): */
>  static void a3xx_dump(struct msm_gpu *gpu)
>  {
> @@ -464,7 +455,7 @@ static const struct adreno_gpu_funcs funcs = {
> .irq = a3xx_irq,
> .destroy = a3xx_destroy,
>  #ifdef CONFIG_DEBUG_FS
> -   .show = a3xx_show,
> +   .show = adreno_show,
>  #endif
> .gpu_state_get = a3xx_gpu_state_get,
> .gpu_state_put = adreno_gpu_state_put,
> diff --git a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c 
> b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
> index 17e97ebc1077..95f08c22e8d7 100644
> --- a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
> @@ -455,16 +455,6 @@ static const unsigned int a4xx_registers[] = {
> ~0 /* sentinel */
>  };
>  
> -#ifdef CONFIG_DEBUG_FS
> -static void a4xx_show(struct msm_gpu *gpu, struct seq_file *m)
> -{
> -   seq_printf(m, "status:   %08x\n",
> -   gpu_read(gpu, REG_A4XX_RBBM_STATUS));
> -   adreno_show(gpu, m);
> -
> -}
> -#endif
> -
>  static struct msm_gpu_state *a4xx_gpu_state_get(struct msm_gpu *gpu)
>  {
> struct msm_gpu_state *state = adreno_gpu_state_get(gpu);
> @@ -551,7 +541,7 @@ static const struct adreno_gpu_funcs funcs = {
> .irq = a4xx_irq,
> .destroy = a4xx_destroy,
>  #ifdef CONFIG_DEBUG_FS
> -   .show = a4xx_show,
> +   .show = adreno_show,
>  #endif
> .gpu_state_get = a4xx_gpu_state_get,
> .gpu_state_put = adreno_gpu_state_put,
> diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
> b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> index 9e85e4f7016d..5f1aab3c1cb1 100644
> --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> @@ -1215,22 +1215,6 @@ static struct msm_gpu_state *a5xx_gpu_state_get(struct 
> msm_gpu *gpu)
> return state;
>  }
>  
> -#ifdef CONFIG_DEBUG_FS
> -static void a5xx_show(struct msm_gpu *gpu, struct seq_file *m)
> -{
> -   seq_printf(m, "status:   %08x\n",
> -   gpu_read(gpu, REG_A5XX_RBBM_STATUS));
> -
> -   /*
> -* Temporarily disable hardware clock gating before going into
> -* adreno_show to avoid issues while reading the registers
> -*/
> -   a5xx_set_hwcg(gpu, false);
> -   adreno_show(gpu, m);
> -   a5xx_set_hwcg(gpu, true);
> -}
> -#endif
> -
>  static struct msm_ringbuffer *a5xx_active_ring(struct msm_gpu *gpu)
>  {
> struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
> @@ -1260,7 +1244,7 @@ static const struct adreno_gpu_funcs funcs = {
> .irq = a5xx_irq,
> .destroy = a5xx_destroy,
>  #ifdef CONFIG_DEBUG_FS
> -   .show = a5xx_show,
> +   .show = adreno_show,
> .debugfs_init = a5xx_debugfs_init,
>  #endif
> .gpu_busy = a5xx_gpu_busy,
> diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c 
> b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> index c7a0d278c59e..0e937eedcec5 100644
> --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> @@ -423,38 +423,34 @@ void adreno_gpu_state_put(struct msm_gpu_state *state)
>  }
>  
>  #ifdef CONFIG_DEBUG_FS
> -void adreno_show(struct msm_gpu *gpu, struct seq_file *m)
> +void adreno_show(struct msm_gpu *gpu, struct msm_gpu_state *state,
> +   struct seq_file *m)
>  {
> 

Re: [PATCH 02/13] drm: drm_printer: Add printer for devcoredump

2018-07-12 Thread Daniel Vetter
On Thu, Jul 12, 2018 at 12:59:19PM -0600, Jordan Crouse wrote:
> Add a drm printer suitable for use with the read callback for
> devcoredump or other suitable buffer based output format that
> isn't otherwise covered by seq_file.
>
> Signed-off-by: Jordan Crouse 

Hm, why not add seq_file support to dev_coredump? Neither git blame nor
google sched any light on why seq_file wasn't picked over the custom read
interface ...

Adding Johannes and Greg about this.

If we go with this, one comment below.

> ---
>  drivers/gpu/drm/drm_print.c | 74 +
>  include/drm/drm_print.h | 27 ++
>  2 files changed, 101 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
> index b25f98f33f6c..03d1f98e5ac7 100644
> --- a/drivers/gpu/drm/drm_print.c
> +++ b/drivers/gpu/drm/drm_print.c
> @@ -30,6 +30,80 @@
>  #include 
>  #include 
>
> +void __drm_printfn_coredump(struct drm_printer *p, struct va_format *vaf)
> +{
> + struct drm_print_iterator *iterator = p->arg;
> + ssize_t len;
> +
> + if (!iterator->remain)
> + return;
> +
> + /* Figure out how big the string will be */
> + len = snprintf(NULL, 0, "%pV", vaf);
> +
> + if (iterator->offset < iterator->start) {
> + char *buf;
> + ssize_t copy;
> +
> + if (iterator->offset + len <= iterator->start) {
> + iterator->offset += len;
> + return;
> + }
> +
> + /* Print the string into a temporary buffer */
> + buf = kmalloc(len + 1,
> + GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY);
> + if (!buf)
> + return;
> +
> + snprintf(buf, len + 1, "%pV", vaf);
> +
> + copy = len - (iterator->start - iterator->offset);
> +
> + if (copy > iterator->remain)
> + copy = iterator->remain;
> +
> + /* Copy out the bit of the string that we need */
> + memcpy(iterator->data,
> + buf + (iterator->start - iterator->offset), copy);
> +
> + iterator->offset = iterator->start + copy;
> + iterator->remain -= copy;
> +
> + kfree(buf);
> + } else {
> + char *buf;
> + ssize_t pos = iterator->offset - iterator->start;
> +
> + if (len < iterator->remain) {
> + snprintf(((char *) iterator->data) + pos,
> + iterator->remain, "%pV", vaf);
> +
> + iterator->offset += len;
> + iterator->remain -= len;
> +
> + return;
> + }
> +
> + /* Print the string into a temporary buffer */
> + buf = kmalloc(len + 1,
> + GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY);
> + if (!buf)
> + return;
> +
> + snprintf(buf, len + 1, "%pV", vaf);
> +
> + /* Copy out the remaining bits */
> + memcpy(iterator->data + pos, buf, iterator->remain);
> +
> + iterator->offset += iterator->remain;
> + iterator->remain = 0;
> +
> + kfree(buf);
> + }
> +}
> +EXPORT_SYMBOL(__drm_printfn_coredump);
> +
>  void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf)
>  {
>   seq_printf(p->arg, "%pV", vaf);
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index e1a46e9991cc..0ea440fb5ec3 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -73,6 +73,7 @@ struct drm_printer {
>   const char *prefix;
>  };
>
> +void __drm_printfn_coredump(struct drm_printer *p, struct va_format *vaf);
>  void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf);
>  void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf);
>  void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf);
> @@ -104,6 +105,32 @@ drm_vprintf(struct drm_printer *p, const char *fmt, 
> va_list *va)
>  #define drm_printf_indent(printer, indent, fmt, ...) \
>   drm_printf((printer), "%.*s" fmt, (indent), "\t\t\t\t\tX", ##__VA_ARGS__)
>
> +struct drm_print_iterator {
> + void *data;
> +
> + ssize_t start;
> + ssize_t offset;
> + ssize_t remain;
> +};
> +
> +/**
> + * drm_coredump_printer - construct a _printer that can output to a 
> buffer
> + * from the read function for devcoredump
> + * @iter: A pointer to a struct drm_print_iterator for the read instance

Bit more flesh for the kerneldoc would be good here, maybe even with a
small in-line example. Definitely a link to dev_coredumpm() which I assume
is the function you're going to use this with.

Pls also make sure it all looks nice using make htmldocs.
-Daniel


> + *
> + * RETURNS:
> + * The _printer object
> + */
> +static inline struct drm_printer
> +drm_coredump_printer(struct drm_print_iterator *iter)
> +{
> + struct drm_printer p = {
> + .printfn = __drm_printfn_coredump,
> + .arg = iter,
> + };
> + return p;
> +}
> +
>  /**
>   * drm_seq_file_printer - construct a _printer that outputs to _file
>   * @f:  the  seq_file to output to
> --
> 2.17.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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


Re: [PATCH 05/13] drm: Add put callback for the coredump printer

2018-07-12 Thread Chris Wilson
Quoting Jordan Crouse (2018-07-12 19:59:22)
> Add a put function for the coredump printer to bypass printf()
> for constant strings for a speed boost.
> 
> v2: Add EXPORT_SYMBOL for _drm_puts_coredump
> Signed-off-by: Jordan Crouse 
> ---
>  drivers/gpu/drm/drm_print.c | 43 +
>  include/drm/drm_print.h |  2 ++
>  2 files changed, 45 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
> index bef8f0ec5d73..ff20f4a764c8 100644
> --- a/drivers/gpu/drm/drm_print.c
> +++ b/drivers/gpu/drm/drm_print.c
> @@ -30,6 +30,49 @@
>  #include 
>  #include 
>  
> +void __drm_puts_coredump(struct drm_printer *p, const char *str)
> +{
> +   struct drm_print_iterator *iterator = p->arg;
> +
> +   ssize_t len;
> +
> +   if (!iterator->remain)
> +   return;
> +
> +   if (iterator->offset < iterator->start) {
> +   ssize_t copy;
> +
> +   len = strlen(str);
> +

printfn_coredump looks like it would then wrap puts_coredump?
-Chris
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 02/13] drm: drm_printer: Add printer for devcoredump

2018-07-12 Thread Chris Wilson
Quoting Jordan Crouse (2018-07-12 19:59:19)
> Add a drm printer suitable for use with the read callback for
> devcoredump or other suitable buffer based output format that
> isn't otherwise covered by seq_file.
> 
> Signed-off-by: Jordan Crouse 
> ---
>  drivers/gpu/drm/drm_print.c | 74 +
>  include/drm/drm_print.h | 27 ++
>  2 files changed, 101 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
> index b25f98f33f6c..03d1f98e5ac7 100644
> --- a/drivers/gpu/drm/drm_print.c
> +++ b/drivers/gpu/drm/drm_print.c
> @@ -30,6 +30,80 @@
>  #include 
>  #include 
>  
> +void __drm_printfn_coredump(struct drm_printer *p, struct va_format *vaf)
> +{
> +   struct drm_print_iterator *iterator = p->arg;
> +   ssize_t len;
> +
> +   if (!iterator->remain)
> +   return;
> +
> +   /* Figure out how big the string will be */
> +   len = snprintf(NULL, 0, "%pV", vaf);

I was thinking there's some duplication here (kmalloc + snprintf) that
could be reduced to kasprintf here. Is avoiding that allocation
important or frequent enough to merit open coding?

It's pity the kernel's printk doesn't support %n, so that leaves with

buf = kasprintf(GFP_... , "%pV", vaf);
if (!buf)
return;

len = strlen(buf);

and even the copy + increment looks like it can then be factored to share
more code.
-Chris
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 105760] [4.17-rc1] RIP: smu7_populate_single_firmware_entry.isra.6+0x57/0xc0 [amdgpu] RSP: ffffa17901efb930

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105760

Thomas Martitz  changed:

   What|Removed |Added

 Attachment #140592|0   |1
is obsolete||

--- Comment #42 from Thomas Martitz  ---
Created attachment 140611
  --> https://bugs.freedesktop.org/attachment.cgi?id=140611=edit
dmesg with 0001-workaround-v2.patch +
0001-drm-amdgpu-add-ATPX-quirk-for-a-polaris-12-laptop.patch

Sorry to say, but this patch makes things actually *worse*.

First, by accident, I added your latest patch on-top of my previous workaround
v2. This gives working suspend/resume but many more error messages in dmesg, in
particular a WARN() triggers:

[  385.996911] Modules linked in: cmac rfcomm ccm arc4 snd_hda_codec_hdmi
snd_hda_codec_conexant snd_hda_codec_generic joydev intel_rapl mousedev
x86_pkg_temp_thermal intel_powerclamp bnep coretemp iwlmvm snd_soc_skl
snd_soc_skl_ipc hid_multitouch snd_soc_sst_ipc mac80211 snd_soc_sst_dsp
hid_generic kvm snd_hda_ext_core mei_wdt snd_soc_core nls_iso8859_1 i915
nls_cp437 iwlwifi btusb irqbypass btrtl vfat btbcm crct10dif_pclmul
snd_compress btintel iTCO_wdt crc32_pclmul iTCO_vendor_support snd_soc_acpi
ghash_clmulni_intel fat bluetooth pcbc intel_wmi_thunderbolt hp_wmi
sparse_keymap snd_hda_intel wmi_bmof snd_hda_codec cfg80211 crc16 snd_hwdep
ecdh_generic aesni_intel snd_hda_core aes_x86_64 crypto_simd snd_pcm cryptd
e1000e snd_timer glue_helper intel_cstate intel_uncore intel_rapl_perf uvcvideo
idma64
[  385.996938]  tpm_crb input_leds led_class videobuf2_vmalloc snd psmouse
videobuf2_memops mei_me i2c_i801 ptp mei videobuf2_v4l2 pps_core
processor_thermal_device ucsi_acpi i2c_hid videobuf2_common typec_ucsi
intel_lpss_pci soundcore typec rfkill intel_pch_thermal wmi intel_gtt
intel_lpss intel_soc_dts_iosf hid videodev tpm_tis tpm_tis_core int3403_thermal
int340x_thermal_zone rtc_cmos media evdev tpm ac int3400_thermal mac_hid
battery acpi_thermal_rel rng_core hp_wireless sg scsi_mod crypto_user ip_tables
x_tables btrfs libcrc32c crc32c_generic xor zstd_decompress zstd_compress
xxhash serio_raw raid6_pq atkbd libps2 xhci_pci xhci_hcd crc32c_intel usbcore
usb_common i8042 serio
[  385.996964] CPU: 4 PID: 215 Comm: kworker/4:2 Tainted: G U  W
4.18.0-rc3-custom+ #73
[  385.996965] Hardware name: HP HP ZBook 14u G5/83B2, BIOS Q78 Ver. 01.00.05
01/25/2018
[  385.996968] Workqueue: pm pm_runtime_work
[  385.996970] RIP: 0010:generic_reg_wait+0xe7/0x160
[  385.996970] Code: 44 24 58 8b 54 24 48 89 de 44 89 4c 24 08 48 8b 4c 24 50
48 c7 c7 f8 29 19 bd e8 c4 24 e5 ff 83 7d 20 01 44 8b 4c 24 08 74 02 <0f> 0b 48
83 c4 10 44 89 c8 5b 5d 41 5c 41 5d 41 5e 41 5f c3 41 0f 
[  385.996989] RSP: 0018:b45681fefbd8 EFLAGS: 00010297
[  385.996990] RAX: 006b RBX: 000a RCX:
0001
[  385.996991] RDX: 8001 RSI: bd1151a6 RDI:

[  385.996991] RBP: 97f4e37e3240 R08: bc499790 R09:

[  385.996992] R10: 0004 R11: bdab8f2d R12:
0bb9
[  385.996992] R13: 4ea4 R14: 0001 R15:

[  385.996993] FS:  () GS:97f4ef50()
knlGS:
[  385.996994] CS:  0010 DS:  ES:  CR0: 80050033
[  385.996994] CR2: 7ff68c6ef000 CR3: 0001ee40a002 CR4:
003606e0
[  385.996995] Call Trace:
[  385.997000]  dce110_stream_encoder_dp_blank+0x11c/0x180
[  385.997002]  power_down_all_hw_blocks+0x3d/0x1c0
[  385.997003]  dce110_power_down+0xe/0x20
[  385.997005]  dc_set_power_state+0x1b/0x70
[  385.997007]  dm_suspend+0x4a/0x60
[  385.997009]  amdgpu_device_ip_suspend+0xe4/0x170
[  385.997011]  amdgpu_device_suspend+0x251/0x3a0
[  385.997013]  amdgpu_pmops_runtime_suspend+0x44/0xb0
[  385.997015]  pci_pm_runtime_suspend+0x64/0x180
[  385.997017]  ? vga_switcheroo_runtime_resume+0x60/0x60
[  385.997019]  vga_switcheroo_runtime_suspend+0x24/0xb0
[  385.997020]  __rpm_callback+0x75/0x1b0
[  385.997022]  ? __switch_to_asm+0x30/0x60
[  385.997024]  ? vga_switcheroo_runtime_resume+0x60/0x60
[  385.997025]  rpm_callback+0x1f/0x70
[  385.997026]  ? vga_switcheroo_runtime_resume+0x60/0x60
[  385.997028]  rpm_suspend+0x12a/0x610
[  385.997030]  ? finish_task_switch+0x83/0x2e0
[  385.997031]  ? __switch_to_asm+0x24/0x60
[  385.997032]  pm_runtime_work+0x7d/0xa0
[  385.997034]  process_one_work+0x1eb/0x3c0
[  385.997035]  worker_thread+0x2d/0x3d0
[  385.997037]  ? process_one_work+0x3c0/0x3c0
[  385.997038]  kthread+0x112/0x130
[  385.997039]  ? kthread_flush_work_fn+0x10/0x10
[  385.997041]  ret_from_fork+0x35/0x40
[  385.997043] ---[ end trace 04724a7f4f9fccf6 ]---

Then, there is new fatal error messages like this (the last line is new with
your patch):

[  436.030371] amdgpu: [powerplay] 
failed to send message 261 ret is 65535 

Re: [PATCH 01/13] include: Move ascii85 functions from i915 to linux/ascii85.h

2018-07-12 Thread Chris Wilson
Quoting Jordan Crouse (2018-07-12 19:59:18)
> The i915 DRM driver very cleverly used ascii85 encoding for their
> GPU state file. Move the encode functions to a general header file to
> support other drivers that might be interested in the same
> functionality.
> 
> v3: Fix error_puts -> err_puts pointed out by the 01.org bot
> v2: Update API to be cleaner for the caller as suggested by Chris Wilson
> 
> Signed-off-by: Jordan Crouse 
> ---
> +static inline long
> +ascii85_encode_len(long len)
> +{
> +   return DIV_ROUND_UP(len, 4);
> +}
> +
> +static inline char *

const char * to avoid a compiler warning with return "z".

Looks like that will be ok with the callers.

With that,
Reviewed-by: Chris Wilson 
-Chris
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 13/13] drm/msm/gpu: Add the buffer objects from the submit to the crash dump

2018-07-12 Thread Jordan Crouse
For hangs, dump copy out the contents of the buffer objects attached to the
guilty submission and print them in the crash dump report.

v2: Use %zd to print the size of the buffer correctly

Signed-off-by: Jordan Crouse 
---
 Documentation/gpu/drm-msm-crash-dump.txt |  7 +++
 drivers/gpu/drm/msm/adreno/adreno_gpu.c  | 58 
 drivers/gpu/drm/msm/msm_gpu.c| 48 ++--
 drivers/gpu/drm/msm/msm_gpu.h|  9 
 4 files changed, 109 insertions(+), 13 deletions(-)

diff --git a/Documentation/gpu/drm-msm-crash-dump.txt 
b/Documentation/gpu/drm-msm-crash-dump.txt
index 7083075c6f87..b9804dd112db 100644
--- a/Documentation/gpu/drm-msm-crash-dump.txt
+++ b/Documentation/gpu/drm-msm-crash-dump.txt
@@ -40,6 +40,13 @@ bos: # List of buffers from the hanging submission 
(if known)
data:   # [ascii85] The contents of the ring encoded as ascii85.
# Only the unused portions of the ring will be printed
# (up to a maximum of 'size' bytes)
+bos:   # List of buffers from the hanging submission (if known)
+  -iova:   # [hex] GPU address of the buffer
+   size:   # [decimal] Size of the buffer (in bytes)
+   data:   # [ascii85] The contents of the buffer encoded as
+   # ascii85. Only the contents of buffers marked as
+   # readable are dumped. Trailing zeros at the end of the
+   # buffer won't be dumped.
 registers: # Sets of register values. This section can be used multiple
# times for different ranges of registers. Each register will be
# on its own line.
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c 
b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index be81fe1f6a35..ce8b7af0a77d 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -438,6 +438,10 @@ void adreno_gpu_state_destroy(struct msm_gpu_state *state)
for (i = 0; i < ARRAY_SIZE(state->ring); i++)
kfree(state->ring[i].data);
 
+   for (i = 0; state->bos && i < state->nr_bos; i++)
+   kvfree(state->bos[i].data);
+
+   kfree(state->bos);
kfree(state->comm);
kfree(state->cmd);
kfree(state->registers);
@@ -461,6 +465,39 @@ int adreno_gpu_state_put(struct msm_gpu_state *state)
 }
 
 #if defined(CONFIG_DEBUG_FS) || defined(CONFIG_DEV_COREDUMP)
+
+static void adreno_show_object(struct drm_printer *p, u32 *ptr, int len)
+{
+   char out[ASCII85_BUFSZ];
+   long l, datalen, i;
+
+   if (!ptr || !len)
+   return;
+
+   /*
+* Only dump the non-zero part of the buffer - rarely will any data
+* completely fill the entire allocated size of the buffer
+*/
+   for (datalen = 0, i = 0; i < len >> 2; i++) {
+   if (ptr[i])
+   datalen = i << 2;
+   }
+
+   /* Skip printing the object if it is empty */
+   if (datalen == 0)
+   return;
+
+   l = ascii85_encode_len(datalen);
+
+   drm_puts(p, "data: !!ascii85 |\n");
+   drm_puts(p, " ");
+
+   for (i = 0; i < l; i++)
+   drm_puts(p, ascii85_encode(ptr[i], out));
+
+   drm_puts(p, "\n");
+}
+
 void adreno_show(struct msm_gpu *gpu, struct msm_gpu_state *state,
struct drm_printer *p)
 {
@@ -487,19 +524,20 @@ void adreno_show(struct msm_gpu *gpu, struct 
msm_gpu_state *state,
drm_printf(p, "wptr: %d\n", state->ring[i].wptr);
drm_printf(p, "size: %d\n", MSM_GPU_RINGBUFFER_SZ);
 
-   if (state->ring[i].data && state->ring[i].data_size) {
-   u32 *ptr = (u32 *) state->ring[i].data;
-   char out[ASCII85_BUFSZ];
-   long len = ascii85_encode_len(state->ring[i].data_size);
-   int j;
+   adreno_show_object(p, state->ring[i].data,
+   state->ring[i].data_size);
+   }
 
-   drm_printf(p, "data: !!ascii85 |\n");
-   drm_printf(p, " ");
+   if (state->bos) {
+   drm_puts(p, "bos:\n");
 
-   for (j = 0; j < len; j++)
-   drm_printf(p, ascii85_encode(ptr[j], out));
+   for (i = 0; i < state->nr_bos; i++) {
+   drm_printf(p, "  - iova: 0x%016llx\n",
+   state->bos[i].iova);
+   drm_printf(p, "size: %ld\n", state->bos[i].size);
 
-   drm_printf(p, "\n");
+   adreno_show_object(p, state->bos[i].data,
+   state->bos[i].size);
}
}
 
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 1945736fc448..03e62f6ea2b6 100644
--- 

[PATCH 09/13] drm/msm/gpu: Capture the GPU state on a GPU hang

2018-07-12 Thread Jordan Crouse
Capture the GPU state on a GPU hang and store it for later playback
via the devcoredump facility. Only one crash state is stored at a
time on the assumption that the first hang is usually the most
interesting. The existing crash state can be cleared after capturing
it and then a new one will be captured on the next hang.

Signed-off-by: Jordan Crouse 
---
 drivers/gpu/drm/msm/Kconfig |  1 +
 drivers/gpu/drm/msm/adreno/a3xx_gpu.c   |  2 +-
 drivers/gpu/drm/msm/adreno/a4xx_gpu.c   |  2 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c   |  4 +-
 drivers/gpu/drm/msm/adreno/adreno_gpu.c | 36 +++
 drivers/gpu/drm/msm/adreno/adreno_gpu.h |  6 +-
 drivers/gpu/drm/msm/msm_debugfs.c   |  5 +-
 drivers/gpu/drm/msm/msm_gpu.c   | 83 -
 drivers/gpu/drm/msm/msm_gpu.h   | 38 ++-
 9 files changed, 154 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index 38cbde971b48..843a9d40c05e 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -12,6 +12,7 @@ config DRM_MSM
select SHMEM
select TMPFS
select QCOM_SCM
+   select WANT_DEV_COREDUMP
select SND_SOC_HDMI_CODEC if SND_SOC
select SYNC_FILE
select PM_OPP
diff --git a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
index 4cffec2b6adc..fc502e412132 100644
--- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
@@ -454,7 +454,7 @@ static const struct adreno_gpu_funcs funcs = {
.active_ring = adreno_active_ring,
.irq = a3xx_irq,
.destroy = a3xx_destroy,
-#ifdef CONFIG_DEBUG_FS
+#if defined(CONFIG_DEBUG_FS) || defined(CONFIG_DEV_COREDUMP)
.show = adreno_show,
 #endif
.gpu_state_get = a3xx_gpu_state_get,
diff --git a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
index 95f08c22e8d7..8129cf037db1 100644
--- a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
@@ -540,7 +540,7 @@ static const struct adreno_gpu_funcs funcs = {
.active_ring = adreno_active_ring,
.irq = a4xx_irq,
.destroy = a4xx_destroy,
-#ifdef CONFIG_DEBUG_FS
+#if defined(CONFIG_DEBUG_FS) || defined(CONFIG_DEV_COREDUMP)
.show = adreno_show,
 #endif
.gpu_state_get = a4xx_gpu_state_get,
diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index 5f1aab3c1cb1..16074fa6bf1e 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -1243,8 +1243,10 @@ static const struct adreno_gpu_funcs funcs = {
.active_ring = a5xx_active_ring,
.irq = a5xx_irq,
.destroy = a5xx_destroy,
-#ifdef CONFIG_DEBUG_FS
+#if defined(CONFIG_DEBUG_FS) || defined(CONFIG_DEV_COREDUMP)
.show = adreno_show,
+#endif
+#if defined(CONFIG_DEBUG_FS)
.debugfs_init = a5xx_debugfs_init,
 #endif
.gpu_busy = a5xx_gpu_busy,
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c 
b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index 0e937eedcec5..163542487e2c 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -378,6 +378,8 @@ struct msm_gpu_state *adreno_gpu_state_get(struct msm_gpu 
*gpu)
if (!state)
return ERR_PTR(-ENOMEM);
 
+   kref_init(>ref);
+
do_gettimeofday(>time);
 
for (i = 0; i < gpu->nr_rings; i++) {
@@ -413,18 +415,28 @@ struct msm_gpu_state *adreno_gpu_state_get(struct msm_gpu 
*gpu)
return state;
 }
 
-void adreno_gpu_state_put(struct msm_gpu_state *state)
+static void adreno_gpu_state_destroy(struct kref *kref)
 {
-   if (IS_ERR_OR_NULL(state))
-   return;
+   struct msm_gpu_state *state = container_of(kref,
+   struct msm_gpu_state, ref);
 
+   kfree(state->comm);
+   kfree(state->cmd);
kfree(state->registers);
kfree(state);
 }
 
-#ifdef CONFIG_DEBUG_FS
+int adreno_gpu_state_put(struct msm_gpu_state *state)
+{
+   if (IS_ERR_OR_NULL(state))
+   return 1;
+
+   return kref_put(>ref, adreno_gpu_state_destroy);
+}
+
+#if defined(CONFIG_DEBUG_FS) || defined(CONFIG_DEV_COREDUMP)
 void adreno_show(struct msm_gpu *gpu, struct msm_gpu_state *state,
-   struct seq_file *m)
+   struct drm_printer *p)
 {
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
int i;
@@ -432,23 +444,23 @@ void adreno_show(struct msm_gpu *gpu, struct 
msm_gpu_state *state,
if (IS_ERR_OR_NULL(state))
return;
 
-   seq_printf(m, "status:   %08x\n", state->rbbm_status);
-   seq_printf(m, "revision: %d (%d.%d.%d.%d)\n",
+   drm_printf(p, "status:   %08x\n", state->rbbm_status);
+   drm_printf(p, 

[PATCH 10/13] drm/msm/adreno: Convert the show/crash file format

2018-07-12 Thread Jordan Crouse
Convert the format of the 'show' debugfs file and the crash
dump to a  format resembling YAML. This should be easier to
parse and be more flexible for future changes and expansions.

Signed-off-by: Jordan Crouse 
---
 Documentation/gpu/drm-msm-crash-dump.txt | 46 
 drivers/gpu/drm/msm/adreno/adreno_gpu.c  | 20 ++-
 2 files changed, 58 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/gpu/drm-msm-crash-dump.txt

diff --git a/Documentation/gpu/drm-msm-crash-dump.txt 
b/Documentation/gpu/drm-msm-crash-dump.txt
new file mode 100644
index ..930e4c970a62
--- /dev/null
+++ b/Documentation/gpu/drm-msm-crash-dump.txt
@@ -0,0 +1,46 @@
+# drm/msm GPU crash dump format
+#
+# This is a description of the format of the drm/msm GPU crash dump format that
+# can be read from /sys/kernel/dri/X/show or from devcoredump following a GPU
+# hang or fault
+
+---
+kernel:# [string] The kernel version as printed by UTS_RELEASE
+module:# [string] The module that generated the crash dump
+time:  # [seconds.microseconds] The kernel time at crash
+comm:  # [string] comm string for the binary that generated the fault
+   # (if known)
+cmdline:   # [string] the cmdline for the binary that generated the fault
+   # (if known)
+revision:  # [ id core.major.minor.patchlevel] The GPU id followed by the
+   # individual components of the id separated by dots
+rbbm-status:   # [hex] The current value of RBBM_STATUS which shows what GPU
+   # components were in use at the time of the crash
+ringbuffer:# Ringbuffer data. There will be a sequence for each ringbuffer
+  -id: # [decimal] Ringbuffer identifier (0 based index)
+   last-fence: # [decimal] The last fence issued on the ring
+   retired-fence:  # [decimal] THe last fence retired on the ring
+   rptr:   # [decimal] The current read pointer (rptr) for the ring
+   wptr:   # [decimal] The current write pointer (wptr) for the
+   # ring
+   size:   # [decimal] The maximum size of the ring programmed in
+   # the hardware
+   data:   # [ascii85] The contents of the ring encoded as ascii85.
+   # Only the unused portions of the ring will be printed
+   # (up to a maximum of 'size' bytes)
+bos:   # List of buffers from the hanging submission (if known)
+  -iova:   # [hex] GPU address of the buffer
+   size:   # [decimal] Size of the buffer (in bytes)
+   data:   # [ascii85] The contents of the buffer encoded as
+   # ascii85. Only the contents of buffers marked as
+   # readable are dumped. Trailing zeros at the end of the
+   # buffer won't be dumped.
+registers: # Sets of register values. This section can be used multiple
+   # times for different ranges of registers. Each register will be
+   # on its own line.
+  - [offset, value]# offset: [hex] byte offset of the register
+   # value: [hex] value of the register
+
+registers-hlsq: # (5xx only) Same format as registers. Register data that
+   # only accessible from the HLSQ aperture captured by the
+   # HW based crashdumper
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c 
b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index 163542487e2c..15fe0d029ba6 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -444,23 +444,27 @@ void adreno_show(struct msm_gpu *gpu, struct 
msm_gpu_state *state,
if (IS_ERR_OR_NULL(state))
return;
 
-   drm_printf(p, "status:   %08x\n", state->rbbm_status);
drm_printf(p, "revision: %d (%d.%d.%d.%d)\n",
adreno_gpu->info->revn, adreno_gpu->rev.core,
adreno_gpu->rev.major, adreno_gpu->rev.minor,
adreno_gpu->rev.patchid);
 
-   for (i = 0; i < gpu->nr_rings; i++) {
-   drm_printf(p, "rb %d: fence:%d/%d\n", i,
-   state->ring[i].fence, state->ring[i].seqno);
+   drm_printf(p, "rbbm-status: 0x%08x\n", state->rbbm_status);
+
+   drm_puts(p, "ringbuffer:\n");
 
-   drm_printf(p, "  rptr: %d\n", state->ring[i].rptr);
-   drm_printf(p, "rb wptr:  %d\n", state->ring[i].wptr);
+   for (i = 0; i < gpu->nr_rings; i++) {
+   drm_printf(p, "  - id: %d\n", i);
+   drm_printf(p, "last-fence: %d\n", state->ring[i].seqno);
+   drm_printf(p, "retired-fence: %d\n", state->ring[i].fence);
+   drm_printf(p, "rptr: %d\n", state->ring[i].rptr);
+   drm_printf(p, "wptr: %d\n", state->ring[i].wptr);
}
 
-   drm_printf(p, 

[PATCH 08/13] drm/msm/gpu: Rearrange the code that collects the task during a hang

2018-07-12 Thread Jordan Crouse
Do a bit of cleanup to prepare for upcoming changes to pass the
hanging task comm and cmdline to the crash dump function.

Signed-off-by: Jordan Crouse 
---
 drivers/gpu/drm/msm/msm_gpu.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 1c09acfb4028..2ca354047250 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -314,6 +314,7 @@ static void recover_worker(struct work_struct *work)
struct msm_drm_private *priv = dev->dev_private;
struct msm_gem_submit *submit;
struct msm_ringbuffer *cur_ring = gpu->funcs->active_ring(gpu);
+   char *comm = NULL, *cmd = NULL;
int i;
 
mutex_lock(>struct_mutex);
@@ -327,7 +328,7 @@ static void recover_worker(struct work_struct *work)
rcu_read_lock();
task = pid_task(submit->pid, PIDTYPE_PID);
if (task) {
-   char *cmd;
+   comm = kstrdup(task->comm, GFP_KERNEL);
 
/*
 * So slightly annoying, in other paths like
@@ -342,20 +343,21 @@ static void recover_worker(struct work_struct *work)
mutex_unlock(>struct_mutex);
cmd = kstrdup_quotable_cmdline(task, GFP_KERNEL);
mutex_lock(>struct_mutex);
+   }
+   rcu_read_unlock();
 
+   if (comm && cmd) {
dev_err(dev->dev, "%s: offending task: %s (%s)\n",
-   gpu->name, task->comm, cmd);
+   gpu->name, comm, cmd);
 
msm_rd_dump_submit(priv->hangrd, submit,
-   "offending task: %s (%s)", task->comm, cmd);
-
-   kfree(cmd);
-   } else {
+   "offending task: %s (%s)", comm, cmd);
+   } else
msm_rd_dump_submit(priv->hangrd, submit, NULL);
-   }
-   rcu_read_unlock();
}
 
+   kfree(cmd);
+   kfree(comm);
 
/*
 * Update all the rings with the latest and greatest fence.. this
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 07/13] drm/msm/gpu: Convert the GPU show function to use the GPU state

2018-07-12 Thread Jordan Crouse
Convert the existing GPU show function to use the GPU state to
dump the information rather than reading it directly from the hardware.
This will require an additional step to capture the state before
dumping it for the existing nodes but it will greatly facilitate reusing
the same code for dumping a previously captured state from a GPU hang.

Signed-off-by: Jordan Crouse 
---
 drivers/gpu/drm/msm/adreno/a3xx_gpu.c   | 11 +--
 drivers/gpu/drm/msm/adreno/a4xx_gpu.c   | 12 +---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c   | 18 +
 drivers/gpu/drm/msm/adreno/adreno_gpu.c | 30 
 drivers/gpu/drm/msm/adreno/adreno_gpu.h |  3 +-
 drivers/gpu/drm/msm/msm_debugfs.c   | 92 ++---
 drivers/gpu/drm/msm/msm_gpu.h   |  3 +-
 7 files changed, 104 insertions(+), 65 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
index b707b5bca9ab..4cffec2b6adc 100644
--- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
@@ -411,15 +411,6 @@ static const unsigned int a3xx_registers[] = {
~0   /* sentinel */
 };
 
-#ifdef CONFIG_DEBUG_FS
-static void a3xx_show(struct msm_gpu *gpu, struct seq_file *m)
-{
-   seq_printf(m, "status:   %08x\n",
-   gpu_read(gpu, REG_A3XX_RBBM_STATUS));
-   adreno_show(gpu, m);
-}
-#endif
-
 /* would be nice to not have to duplicate the _show() stuff with printk(): */
 static void a3xx_dump(struct msm_gpu *gpu)
 {
@@ -464,7 +455,7 @@ static const struct adreno_gpu_funcs funcs = {
.irq = a3xx_irq,
.destroy = a3xx_destroy,
 #ifdef CONFIG_DEBUG_FS
-   .show = a3xx_show,
+   .show = adreno_show,
 #endif
.gpu_state_get = a3xx_gpu_state_get,
.gpu_state_put = adreno_gpu_state_put,
diff --git a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
index 17e97ebc1077..95f08c22e8d7 100644
--- a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
@@ -455,16 +455,6 @@ static const unsigned int a4xx_registers[] = {
~0 /* sentinel */
 };
 
-#ifdef CONFIG_DEBUG_FS
-static void a4xx_show(struct msm_gpu *gpu, struct seq_file *m)
-{
-   seq_printf(m, "status:   %08x\n",
-   gpu_read(gpu, REG_A4XX_RBBM_STATUS));
-   adreno_show(gpu, m);
-
-}
-#endif
-
 static struct msm_gpu_state *a4xx_gpu_state_get(struct msm_gpu *gpu)
 {
struct msm_gpu_state *state = adreno_gpu_state_get(gpu);
@@ -551,7 +541,7 @@ static const struct adreno_gpu_funcs funcs = {
.irq = a4xx_irq,
.destroy = a4xx_destroy,
 #ifdef CONFIG_DEBUG_FS
-   .show = a4xx_show,
+   .show = adreno_show,
 #endif
.gpu_state_get = a4xx_gpu_state_get,
.gpu_state_put = adreno_gpu_state_put,
diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index 9e85e4f7016d..5f1aab3c1cb1 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -1215,22 +1215,6 @@ static struct msm_gpu_state *a5xx_gpu_state_get(struct 
msm_gpu *gpu)
return state;
 }
 
-#ifdef CONFIG_DEBUG_FS
-static void a5xx_show(struct msm_gpu *gpu, struct seq_file *m)
-{
-   seq_printf(m, "status:   %08x\n",
-   gpu_read(gpu, REG_A5XX_RBBM_STATUS));
-
-   /*
-* Temporarily disable hardware clock gating before going into
-* adreno_show to avoid issues while reading the registers
-*/
-   a5xx_set_hwcg(gpu, false);
-   adreno_show(gpu, m);
-   a5xx_set_hwcg(gpu, true);
-}
-#endif
-
 static struct msm_ringbuffer *a5xx_active_ring(struct msm_gpu *gpu)
 {
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
@@ -1260,7 +1244,7 @@ static const struct adreno_gpu_funcs funcs = {
.irq = a5xx_irq,
.destroy = a5xx_destroy,
 #ifdef CONFIG_DEBUG_FS
-   .show = a5xx_show,
+   .show = adreno_show,
.debugfs_init = a5xx_debugfs_init,
 #endif
.gpu_busy = a5xx_gpu_busy,
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c 
b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index c7a0d278c59e..0e937eedcec5 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -423,38 +423,34 @@ void adreno_gpu_state_put(struct msm_gpu_state *state)
 }
 
 #ifdef CONFIG_DEBUG_FS
-void adreno_show(struct msm_gpu *gpu, struct seq_file *m)
+void adreno_show(struct msm_gpu *gpu, struct msm_gpu_state *state,
+   struct seq_file *m)
 {
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
int i;
 
+   if (IS_ERR_OR_NULL(state))
+   return;
+
+   seq_printf(m, "status:   %08x\n", state->rbbm_status);
seq_printf(m, "revision: %d (%d.%d.%d.%d)\n",
adreno_gpu->info->revn, 

[PATCH 12/13] drm/msm/adreno: Add a5xx specific registers for the GPU state

2018-07-12 Thread Jordan Crouse
HLSQ, SP and TP registers are only accessible from a special
aperture and to make matters worse the aperture is blocked from
the CPU on targets that can support secure rendering. Luckily the
GPU hardware has its own purpose built register dumper that can
access the registers from the aperture. Add a5xx specific code
to program the crashdumper and retrieve the wayward registers
and dump them for the crash state.

Also, remove a block of registers the regular CPU accessible
list that aren't useful for debug which helps reduce the size
of the crash state file by a goodly amount.

Signed-off-by: Jordan Crouse 
---
 drivers/gpu/drm/msm/adreno/a3xx_gpu.c   |   8 +-
 drivers/gpu/drm/msm/adreno/a4xx_gpu.c   |   8 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c   | 236 ++--
 drivers/gpu/drm/msm/adreno/adreno_gpu.c |  23 +--
 drivers/gpu/drm/msm/adreno/adreno_gpu.h |   4 +-
 5 files changed, 248 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
index fc502e412132..669c2d4b070d 100644
--- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
@@ -421,10 +421,12 @@ static void a3xx_dump(struct msm_gpu *gpu)
 
 static struct msm_gpu_state *a3xx_gpu_state_get(struct msm_gpu *gpu)
 {
-   struct msm_gpu_state *state = adreno_gpu_state_get(gpu);
+   struct msm_gpu_state *state = kzalloc(sizeof(*state), GFP_KERNEL);
 
-   if (IS_ERR(state))
-   return state;
+   if (!state)
+   return ERR_PTR(-ENOMEM);
+
+   adreno_gpu_state_get(gpu, state);
 
state->rbbm_status = gpu_read(gpu, REG_A3XX_RBBM_STATUS);
 
diff --git a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
index 8129cf037db1..7c4e6dc1ed59 100644
--- a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
@@ -457,10 +457,12 @@ static const unsigned int a4xx_registers[] = {
 
 static struct msm_gpu_state *a4xx_gpu_state_get(struct msm_gpu *gpu)
 {
-   struct msm_gpu_state *state = adreno_gpu_state_get(gpu);
+   struct msm_gpu_state *state = kzalloc(sizeof(*state), GFP_KERNEL);
 
-   if (IS_ERR(state))
-   return state;
+   if (!state)
+   return ERR_PTR(-ENOMEM);
+
+   adreno_gpu_state_get(gpu, state);
 
state->rbbm_status = gpu_read(gpu, REG_A4XX_RBBM_STATUS);
 
diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index 16074fa6bf1e..bd84f71d27d8 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "msm_gem.h"
 #include "msm_mmu.h"
 #include "a5xx_gpu.h"
@@ -1123,8 +1124,9 @@ static const u32 a5xx_registers[] = {
0xE800, 0xE806, 0xE810, 0xE89A, 0xE8A0, 0xE8A4, 0xE8AA, 0xE8EB,
0xE900, 0xE905, 0xEB80, 0xEB8F, 0xEBB0, 0xEBB0, 0xEC00, 0xEC05,
0xEC08, 0xECE9, 0xECF0, 0xECF0, 0xEA80, 0xEA80, 0xEA82, 0xEAA3,
-   0xEAA5, 0xEAC2, 0xA800, 0xA8FF, 0xAC60, 0xAC60, 0xB000, 0xB97F,
-   0xB9A0, 0xB9BF, ~0
+   0xEAA5, 0xEAC2, 0xA800, 0xA800, 0xA820, 0xA828, 0xA840, 0xA87D,
+   0XA880, 0xA88D, 0xA890, 0xA8A3, 0xA8D0, 0xA8D8, 0xA8E0, 0xA8F5,
+   0xAC60, 0xAC60, ~0,
 };
 
 static void a5xx_dump(struct msm_gpu *gpu)
@@ -1195,25 +1197,233 @@ static int a5xx_get_timestamp(struct msm_gpu *gpu, 
uint64_t *value)
return 0;
 }
 
+struct a5xx_crashdumper {
+   void *ptr;
+   struct drm_gem_object *bo;
+   u64 iova;
+};
+
+struct a5xx_gpu_state {
+   struct msm_gpu_state base;
+   u32 *hlsqregs;
+};
+
+#define gpu_poll_timeout(gpu, addr, val, cond, interval, timeout) \
+   readl_poll_timeout((gpu)->mmio + ((addr) << 2), val, cond, \
+   interval, timeout)
+
+static int a5xx_crashdumper_init(struct msm_gpu *gpu,
+   struct a5xx_crashdumper *dumper)
+{
+   dumper->ptr = msm_gem_kernel_new_locked(gpu->dev,
+   SZ_1M, MSM_BO_UNCACHED, gpu->aspace,
+   >bo, >iova);
+
+   if (IS_ERR(dumper->ptr))
+   return PTR_ERR(dumper->ptr);
+
+   return 0;
+}
+
+static void a5xx_crashdumper_free(struct msm_gpu *gpu,
+   struct a5xx_crashdumper *dumper)
+{
+   msm_gem_put_iova(dumper->bo, gpu->aspace);
+   msm_gem_put_vaddr(dumper->bo);
+
+   drm_gem_object_unreference(dumper->bo);
+}
+
+static int a5xx_crashdumper_run(struct msm_gpu *gpu,
+   struct a5xx_crashdumper *dumper)
+{
+   u32 val;
+
+   if (IS_ERR_OR_NULL(dumper->ptr))
+   return -EINVAL;
+
+   gpu_write64(gpu, REG_A5XX_CP_CRASH_SCRIPT_BASE_LO,
+   REG_A5XX_CP_CRASH_SCRIPT_BASE_HI, dumper->iova);
+
+   gpu_write(gpu, REG_A5XX_CP_CRASH_DUMP_CNTL, 1);
+
+   return gpu_poll_timeout(gpu, REG_A5XX_CP_CRASH_DUMP_CNTL, val,
+   val & 0x04, 100, 1);
+}
+
+/*
+ * These are a list of the registers 

[PATCH 11/13] drm/msm/adreno: Add ringbuffer data to the GPU state

2018-07-12 Thread Jordan Crouse
Add the contents of each ringbuffer to the GPU state and dump the
data in the crash file encoded with ascii85. To save space only
the used portions of the ringbuffer are dumped.

Signed-off-by: Jordan Crouse 
---
 Documentation/gpu/drm-msm-crash-dump.txt |  5 +++
 drivers/gpu/drm/msm/adreno/adreno_gpu.c  | 41 
 drivers/gpu/drm/msm/msm_gpu.h|  2 ++
 3 files changed, 48 insertions(+)

diff --git a/Documentation/gpu/drm-msm-crash-dump.txt 
b/Documentation/gpu/drm-msm-crash-dump.txt
index 930e4c970a62..7083075c6f87 100644
--- a/Documentation/gpu/drm-msm-crash-dump.txt
+++ b/Documentation/gpu/drm-msm-crash-dump.txt
@@ -35,6 +35,11 @@ bos: # List of buffers from the hanging submission 
(if known)
# ascii85. Only the contents of buffers marked as
# readable are dumped. Trailing zeros at the end of the
# buffer won't be dumped.
+   size:   # [decimal] The maximum size of the ring programmed in
+   # the hardware
+   data:   # [ascii85] The contents of the ring encoded as ascii85.
+   # Only the unused portions of the ring will be printed
+   # (up to a maximum of 'size' bytes)
 registers: # Sets of register values. This section can be used multiple
# times for different ranges of registers. Each register will be
# on its own line.
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c 
b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index 15fe0d029ba6..92acce377253 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -17,6 +17,7 @@
  * this program.  If not, see .
  */
 
+#include 
 #include 
 #include "adreno_gpu.h"
 #include "msm_gem.h"
@@ -383,10 +384,30 @@ struct msm_gpu_state *adreno_gpu_state_get(struct msm_gpu 
*gpu)
do_gettimeofday(>time);
 
for (i = 0; i < gpu->nr_rings; i++) {
+   int size = 0, j;
+
state->ring[i].fence = gpu->rb[i]->memptrs->fence;
state->ring[i].seqno = gpu->rb[i]->seqno;
state->ring[i].rptr = get_rptr(adreno_gpu, gpu->rb[i]);
state->ring[i].wptr = get_wptr(gpu->rb[i]);
+
+   /*
+* Only copy used parts of the ring buffers (this should save
+* data size for lightly used rings)
+*/
+   for (j = 0; j < MSM_GPU_RINGBUFFER_SZ >> 2; j++)
+   if (gpu->rb[i]->start[j])
+   size = j;
+
+   if (size) {
+   state->ring[i].data = kmalloc((size + 1) << 2,
+   GFP_KERNEL);
+   if (state->ring[i].data) {
+   memcpy(state->ring[i].data, gpu->rb[i]->start,
+   (size + 1) << 2);
+   state->ring[i].data_size = (size + 1) << 2;
+   }
+   }
}
 
/* Count the number of registers */
@@ -417,9 +438,13 @@ struct msm_gpu_state *adreno_gpu_state_get(struct msm_gpu 
*gpu)
 
 static void adreno_gpu_state_destroy(struct kref *kref)
 {
+   int i;
struct msm_gpu_state *state = container_of(kref,
struct msm_gpu_state, ref);
 
+   for (i = 0; i < ARRAY_SIZE(state->ring); i++)
+   kfree(state->ring[i].data);
+
kfree(state->comm);
kfree(state->cmd);
kfree(state->registers);
@@ -459,6 +484,22 @@ void adreno_show(struct msm_gpu *gpu, struct msm_gpu_state 
*state,
drm_printf(p, "retired-fence: %d\n", state->ring[i].fence);
drm_printf(p, "rptr: %d\n", state->ring[i].rptr);
drm_printf(p, "wptr: %d\n", state->ring[i].wptr);
+   drm_printf(p, "size: %d\n", MSM_GPU_RINGBUFFER_SZ);
+
+   if (state->ring[i].data && state->ring[i].data_size) {
+   u32 *ptr = (u32 *) state->ring[i].data;
+   char out[ASCII85_BUFSZ];
+   long len = ascii85_encode_len(state->ring[i].data_size);
+   int j;
+
+   drm_printf(p, "data: !!ascii85 |\n");
+   drm_printf(p, " ");
+
+   for (j = 0; j < len; j++)
+   drm_printf(p, ascii85_encode(ptr[j], out));
+
+   drm_printf(p, "\n");
+   }
}
 
drm_puts(p, "registers:\n");
diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
index e65f507954c0..48f7b21f1cae 100644
--- a/drivers/gpu/drm/msm/msm_gpu.h
+++ b/drivers/gpu/drm/msm/msm_gpu.h
@@ -190,6 +190,8 @@ struct msm_gpu_state {
u32 seqno;
u32 rptr;
u32 wptr;
+   void *data;
+   

[PATCH 05/13] drm: Add put callback for the coredump printer

2018-07-12 Thread Jordan Crouse
Add a put function for the coredump printer to bypass printf()
for constant strings for a speed boost.

v2: Add EXPORT_SYMBOL for _drm_puts_coredump
Signed-off-by: Jordan Crouse 
---
 drivers/gpu/drm/drm_print.c | 43 +
 include/drm/drm_print.h |  2 ++
 2 files changed, 45 insertions(+)

diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
index bef8f0ec5d73..ff20f4a764c8 100644
--- a/drivers/gpu/drm/drm_print.c
+++ b/drivers/gpu/drm/drm_print.c
@@ -30,6 +30,49 @@
 #include 
 #include 
 
+void __drm_puts_coredump(struct drm_printer *p, const char *str)
+{
+   struct drm_print_iterator *iterator = p->arg;
+
+   ssize_t len;
+
+   if (!iterator->remain)
+   return;
+
+   if (iterator->offset < iterator->start) {
+   ssize_t copy;
+
+   len = strlen(str);
+
+   if (iterator->offset + len <= iterator->start) {
+   iterator->offset += len;
+   return;
+   }
+
+   copy = len - (iterator->start - iterator->offset);
+
+   if (copy > iterator->remain)
+   copy = iterator->remain;
+
+   /* Copy out the bit of the string that we need */
+   memcpy(iterator->data,
+   str + (iterator->start - iterator->offset), copy);
+
+   iterator->offset = iterator->start + copy;
+   iterator->remain -= copy;
+   } else {
+   ssize_t pos = iterator->offset - iterator->start;
+
+   len = min_t(ssize_t, strlen(str), iterator->remain);
+
+   memcpy(iterator->data + pos, str, len);
+
+   iterator->offset += len;
+   iterator->remain -= len;
+   }
+}
+EXPORT_SYMBOL(__drm_puts_coredump);
+
 void __drm_printfn_coredump(struct drm_printer *p, struct va_format *vaf)
 {
struct drm_print_iterator *iterator = p->arg;
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index 3bc6ba4b7b2c..2a903ee7b428 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -75,6 +75,7 @@ struct drm_printer {
 };
 
 void __drm_printfn_coredump(struct drm_printer *p, struct va_format *vaf);
+void __drm_puts_coredump(struct drm_printer *p, const char *str);
 void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf);
 void __drm_puts_seq_file(struct drm_printer *p, const char *str);
 void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf);
@@ -129,6 +130,7 @@ drm_coredump_printer(struct drm_print_iterator *iter)
 {
struct drm_printer p = {
.printfn = __drm_printfn_coredump,
+   .puts = __drm_puts_coredump,
.arg = iter,
};
return p;
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 02/13] drm: drm_printer: Add printer for devcoredump

2018-07-12 Thread Jordan Crouse
Add a drm printer suitable for use with the read callback for
devcoredump or other suitable buffer based output format that
isn't otherwise covered by seq_file.

Signed-off-by: Jordan Crouse 
---
 drivers/gpu/drm/drm_print.c | 74 +
 include/drm/drm_print.h | 27 ++
 2 files changed, 101 insertions(+)

diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
index b25f98f33f6c..03d1f98e5ac7 100644
--- a/drivers/gpu/drm/drm_print.c
+++ b/drivers/gpu/drm/drm_print.c
@@ -30,6 +30,80 @@
 #include 
 #include 
 
+void __drm_printfn_coredump(struct drm_printer *p, struct va_format *vaf)
+{
+   struct drm_print_iterator *iterator = p->arg;
+   ssize_t len;
+
+   if (!iterator->remain)
+   return;
+
+   /* Figure out how big the string will be */
+   len = snprintf(NULL, 0, "%pV", vaf);
+
+   if (iterator->offset < iterator->start) {
+   char *buf;
+   ssize_t copy;
+
+   if (iterator->offset + len <= iterator->start) {
+   iterator->offset += len;
+   return;
+   }
+
+   /* Print the string into a temporary buffer */
+   buf = kmalloc(len + 1,
+   GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY);
+   if (!buf)
+   return;
+
+   snprintf(buf, len + 1, "%pV", vaf);
+
+   copy = len - (iterator->start - iterator->offset);
+
+   if (copy > iterator->remain)
+   copy = iterator->remain;
+
+   /* Copy out the bit of the string that we need */
+   memcpy(iterator->data,
+   buf + (iterator->start - iterator->offset), copy);
+
+   iterator->offset = iterator->start + copy;
+   iterator->remain -= copy;
+
+   kfree(buf);
+   } else {
+   char *buf;
+   ssize_t pos = iterator->offset - iterator->start;
+
+   if (len < iterator->remain) {
+   snprintf(((char *) iterator->data) + pos,
+   iterator->remain, "%pV", vaf);
+
+   iterator->offset += len;
+   iterator->remain -= len;
+
+   return;
+   }
+
+   /* Print the string into a temporary buffer */
+   buf = kmalloc(len + 1,
+   GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY);
+   if (!buf)
+   return;
+
+   snprintf(buf, len + 1, "%pV", vaf);
+
+   /* Copy out the remaining bits */
+   memcpy(iterator->data + pos, buf, iterator->remain);
+
+   iterator->offset += iterator->remain;
+   iterator->remain = 0;
+
+   kfree(buf);
+   }
+}
+EXPORT_SYMBOL(__drm_printfn_coredump);
+
 void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf)
 {
seq_printf(p->arg, "%pV", vaf);
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index e1a46e9991cc..0ea440fb5ec3 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -73,6 +73,7 @@ struct drm_printer {
const char *prefix;
 };
 
+void __drm_printfn_coredump(struct drm_printer *p, struct va_format *vaf);
 void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf);
 void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf);
 void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf);
@@ -104,6 +105,32 @@ drm_vprintf(struct drm_printer *p, const char *fmt, 
va_list *va)
 #define drm_printf_indent(printer, indent, fmt, ...) \
drm_printf((printer), "%.*s" fmt, (indent), "\t\t\t\t\tX", 
##__VA_ARGS__)
 
+struct drm_print_iterator {
+   void *data;
+
+   ssize_t start;
+   ssize_t offset;
+   ssize_t remain;
+};
+
+/**
+ * drm_coredump_printer - construct a _printer that can output to a buffer
+ * from the read function for devcoredump
+ * @iter: A pointer to a struct drm_print_iterator for the read instance
+ *
+ * RETURNS:
+ * The _printer object
+ */
+static inline struct drm_printer
+drm_coredump_printer(struct drm_print_iterator *iter)
+{
+   struct drm_printer p = {
+   .printfn = __drm_printfn_coredump,
+   .arg = iter,
+   };
+   return p;
+}
+
 /**
  * drm_seq_file_printer - construct a _printer that outputs to _file
  * @f:  the  seq_file to output to
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 01/13] include: Move ascii85 functions from i915 to linux/ascii85.h

2018-07-12 Thread Jordan Crouse
The i915 DRM driver very cleverly used ascii85 encoding for their
GPU state file. Move the encode functions to a general header file to
support other drivers that might be interested in the same
functionality.

v3: Fix error_puts -> err_puts pointed out by the 01.org bot
v2: Update API to be cleaner for the caller as suggested by Chris Wilson

Signed-off-by: Jordan Crouse 
---
 drivers/gpu/drm/i915/i915_gpu_error.c | 34 +++
 include/linux/ascii85.h   | 39 +++
 2 files changed, 43 insertions(+), 30 deletions(-)
 create mode 100644 include/linux/ascii85.h

diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c 
b/drivers/gpu/drm/i915/i915_gpu_error.c
index df234dc23274..284e899ca8ff 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "i915_gpu_error.h"
 #include "i915_drv.h"
@@ -522,35 +523,12 @@ void i915_error_printf(struct drm_i915_error_state_buf 
*e, const char *f, ...)
va_end(args);
 }
 
-static int
-ascii85_encode_len(int len)
-{
-   return DIV_ROUND_UP(len, 4);
-}
-
-static bool
-ascii85_encode(u32 in, char *out)
-{
-   int i;
-
-   if (in == 0)
-   return false;
-
-   out[5] = '\0';
-   for (i = 5; i--; ) {
-   out[i] = '!' + in % 85;
-   in /= 85;
-   }
-
-   return true;
-}
-
 static void print_error_obj(struct drm_i915_error_state_buf *m,
struct intel_engine_cs *engine,
const char *name,
struct drm_i915_error_object *obj)
 {
-   char out[6];
+   char out[ASCII85_BUFSZ];
int page;
 
if (!obj)
@@ -572,12 +550,8 @@ static void print_error_obj(struct 
drm_i915_error_state_buf *m,
len -= obj->unused;
len = ascii85_encode_len(len);
 
-   for (i = 0; i < len; i++) {
-   if (ascii85_encode(obj->pages[page][i], out))
-   err_puts(m, out);
-   else
-   err_puts(m, "z");
-   }
+   for (i = 0; i < len; i++)
+   err_puts(m, ascii85_encode(obj->pages[page][i], out));
}
err_puts(m, "\n");
 }
diff --git a/include/linux/ascii85.h b/include/linux/ascii85.h
new file mode 100644
index ..11b9146a3bc4
--- /dev/null
+++ b/include/linux/ascii85.h
@@ -0,0 +1,39 @@
+
+/*
+ * SPDX-License-Identifier: GPL-2.0
+ *
+ * Copyright (c) 2008 Intel Corporation
+ * Copyright (c) 2018 The Linux Foundation. All rights reserved.
+ */
+
+#ifndef _ASCII85_H_
+#define _ASCII85_H_
+
+#include 
+
+#define ASCII85_BUFSZ 6
+
+static inline long
+ascii85_encode_len(long len)
+{
+   return DIV_ROUND_UP(len, 4);
+}
+
+static inline char *
+ascii85_encode(u32 in, char *out)
+{
+   int i;
+
+   if (in == 0)
+   return "z";
+
+   out[5] = '\0';
+   for (i = 5; i--; ) {
+   out[i] = '!' + in % 85;
+   in /= 85;
+   }
+
+   return out;
+}
+
+#endif
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 04/13] drm: Add a -puts() function for the seq_file printer

2018-07-12 Thread Jordan Crouse
Add a puts() function to use seq_puts() to help speed up
up print time for constant strings.

Signed-off-by: Jordan Crouse 
---
 drivers/gpu/drm/drm_print.c | 6 ++
 include/drm/drm_print.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
index 8fd489248a50..bef8f0ec5d73 100644
--- a/drivers/gpu/drm/drm_print.c
+++ b/drivers/gpu/drm/drm_print.c
@@ -104,6 +104,12 @@ void __drm_printfn_coredump(struct drm_printer *p, struct 
va_format *vaf)
 }
 EXPORT_SYMBOL(__drm_printfn_coredump);
 
+void __drm_puts_seq_file(struct drm_printer *p, const char *str)
+{
+   seq_puts(p->arg, str);
+}
+EXPORT_SYMBOL(__drm_puts_seq_file);
+
 void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf)
 {
seq_printf(p->arg, "%pV", vaf);
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index b16f4ecaa984..3bc6ba4b7b2c 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -76,6 +76,7 @@ struct drm_printer {
 
 void __drm_printfn_coredump(struct drm_printer *p, struct va_format *vaf);
 void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf);
+void __drm_puts_seq_file(struct drm_printer *p, const char *str);
 void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf);
 void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf);
 
@@ -144,6 +145,7 @@ static inline struct drm_printer 
drm_seq_file_printer(struct seq_file *f)
 {
struct drm_printer p = {
.printfn = __drm_printfn_seq_file,
+   .puts = __drm_puts_seq_file,
.arg = f,
};
return p;
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[v7 00/13] drm/msm: Capture and dump the GPU crash state

2018-07-12 Thread Jordan Crouse
This is revision t implementing a GPU crash state for drm/msm
(https://patchwork.freedesktop.org/series/36097/). This patchset fixes a
few things that the build bot found.

The object of this code is to store and provide enough information to debug
software and hardware issues on the Adreno hardware in a semi human-readable
format that can also be parsed by scripts.

THe full set of changes here capture basic information about the GPU, the
status and contents of the ringbuffers, a snapshot of the current register state
and the active buffers from the hanging submit.

The data is printed with devcoredump.  For example, after a hang you can get
the data from /sys/class/devcoredump/devcdX/data where X is a unique number.

v7: Add EXPORT_SYMBOL for __drm_puts_coredump and use %zd to print a size_t
variable for the bo dump thanks to the ever vigilant zero one bot.
v6: Add drm_puts() and use it in the appropriate place.  Clean up a few minor
bugs here and there.
v5: Fix symbol error in i915_gpu_error.c thanks to 01 dot org bot. Added
open/release functions for the show debugfs file to get the state per Chris
Wilson. Slightly modified the register output format to be more YAML friendly
also per Chris.
v4: Add buffer dump for the active submit. Fix refcount issue with devcoredump.
Change header for a5xx registers to registers-hlsq because I'm told YAML
requires unique tags.
v3: Make recommended changes to ascii85 per Chris Wilson. Use devcoredump to
dump crash states as suggested by Bjorn Andersson and add a new drm_print
facility to facilitate that. Remove the now obsolete 'crash' debugfs node.
Add documentation for the crash dump output.
v2: Convert output to yaml, use ascii85 to dump ringbuffer contents.

Jordan Crouse (13):
  include: Move ascii85 functions from i915 to linux/ascii85.h
  drm: drm_printer: Add printer for devcoredump
  drm: Add drm_puts() to complement drm_printf()
  drm: Add a -puts() function for the seq_file printer
  drm: Add put callback for the coredump printer
  drm/msm/gpu: Capture the state of the GPU
  drm/msm/gpu: Convert the GPU show function to use the GPU state
  drm/msm/gpu: Rearrange the code that collects the task during a hang
  drm/msm/gpu: Capture the GPU state on a GPU hang
  drm/msm/adreno: Convert the show/crash file format
  drm/msm/adreno: Add ringbuffer data to the GPU state
  drm/msm/adreno: Add a5xx specific registers for the GPU state
  drm/msm/gpu: Add the buffer objects from the submit to the crash dump

 Documentation/gpu/drm-msm-crash-dump.txt |  58 ++
 drivers/gpu/drm/drm_print.c  | 132 +
 drivers/gpu/drm/i915/i915_gpu_error.c|  34 +---
 drivers/gpu/drm/msm/Kconfig  |   1 +
 drivers/gpu/drm/msm/adreno/a3xx_gpu.c|  30 +--
 drivers/gpu/drm/msm/adreno/a4xx_gpu.c|  22 ++-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c| 242 +--
 drivers/gpu/drm/msm/adreno/adreno_gpu.c  | 184 +++--
 drivers/gpu/drm/msm/adreno/adreno_gpu.h  |  10 +-
 drivers/gpu/drm/msm/msm_debugfs.c|  93 -
 drivers/gpu/drm/msm/msm_gpu.c| 143 +-
 drivers/gpu/drm/msm/msm_gpu.h|  67 ++-
 include/drm/drm_print.h  |  33 
 include/linux/ascii85.h  |  39 
 14 files changed, 988 insertions(+), 100 deletions(-)
 create mode 100644 Documentation/gpu/drm-msm-crash-dump.txt
 create mode 100644 include/linux/ascii85.h

-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 03/13] drm: Add drm_puts() to complement drm_printf()

2018-07-12 Thread Jordan Crouse
Add drm_puts() for a much faster path to print constant strings
into a drm_printer object with memcpy and friends. This can
shave seconds off of really large outputs such as GPU dumps.

If the drm_printer object supports a custom puts function then
use that otherwise fall back to the slower legacy printf call.

Signed-off-by: Jordan Crouse 
---
 drivers/gpu/drm/drm_print.c | 9 +
 include/drm/drm_print.h | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
index 03d1f98e5ac7..8fd489248a50 100644
--- a/drivers/gpu/drm/drm_print.c
+++ b/drivers/gpu/drm/drm_print.c
@@ -122,6 +122,15 @@ void __drm_printfn_debug(struct drm_printer *p, struct 
va_format *vaf)
 }
 EXPORT_SYMBOL(__drm_printfn_debug);
 
+void drm_puts(struct drm_printer *p, const char *str)
+{
+   if (p->puts)
+   p->puts(p, str);
+   else
+   drm_printf(p, "%s", str);
+}
+EXPORT_SYMBOL(drm_puts);
+
 /**
  * drm_printf - print to a _printer stream
  * @p: the _printer
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index 0ea440fb5ec3..b16f4ecaa984 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -69,6 +69,7 @@
 struct drm_printer {
/* private: */
void (*printfn)(struct drm_printer *p, struct va_format *vaf);
+   void (*puts)(struct drm_printer *p, const char *str);
void *arg;
const char *prefix;
 };
@@ -80,6 +81,7 @@ void __drm_printfn_debug(struct drm_printer *p, struct 
va_format *vaf);
 
 __printf(2, 3)
 void drm_printf(struct drm_printer *p, const char *f, ...);
+void drm_puts(struct drm_printer *p, const char *str);
 
 __printf(2, 0)
 /**
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 06/13] drm/msm/gpu: Capture the state of the GPU

2018-07-12 Thread Jordan Crouse
Add the infrastructure to capture the current state of the GPU and
store it in memory so that it can be dumped later.

For now grab the same basic ringbuffer information and registers
that are provided by the debugfs 'gpu' node but obviously this should
be extended to capture a much larger set of GPU information.

Signed-off-by: Jordan Crouse 
---
 drivers/gpu/drm/msm/adreno/a3xx_gpu.c   | 15 +++
 drivers/gpu/drm/msm/adreno/a4xx_gpu.c   | 14 +++
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c   | 22 ++
 drivers/gpu/drm/msm/adreno/adreno_gpu.c | 54 +
 drivers/gpu/drm/msm/adreno/adreno_gpu.h |  3 ++
 drivers/gpu/drm/msm/msm_gpu.h   | 19 +
 6 files changed, 127 insertions(+)

diff --git a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
index 3ebbeb3a9b68..b707b5bca9ab 100644
--- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
@@ -427,6 +427,19 @@ static void a3xx_dump(struct msm_gpu *gpu)
gpu_read(gpu, REG_A3XX_RBBM_STATUS));
adreno_dump(gpu);
 }
+
+static struct msm_gpu_state *a3xx_gpu_state_get(struct msm_gpu *gpu)
+{
+   struct msm_gpu_state *state = adreno_gpu_state_get(gpu);
+
+   if (IS_ERR(state))
+   return state;
+
+   state->rbbm_status = gpu_read(gpu, REG_A3XX_RBBM_STATUS);
+
+   return state;
+}
+
 /* Register offset defines for A3XX */
 static const unsigned int a3xx_register_offsets[REG_ADRENO_REGISTER_MAX] = {
REG_ADRENO_DEFINE(REG_ADRENO_CP_RB_BASE, REG_AXXX_CP_RB_BASE),
@@ -453,6 +466,8 @@ static const struct adreno_gpu_funcs funcs = {
 #ifdef CONFIG_DEBUG_FS
.show = a3xx_show,
 #endif
+   .gpu_state_get = a3xx_gpu_state_get,
+   .gpu_state_put = adreno_gpu_state_put,
},
 };
 
diff --git a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
index 16d3d596638e..17e97ebc1077 100644
--- a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
@@ -465,6 +465,18 @@ static void a4xx_show(struct msm_gpu *gpu, struct seq_file 
*m)
 }
 #endif
 
+static struct msm_gpu_state *a4xx_gpu_state_get(struct msm_gpu *gpu)
+{
+   struct msm_gpu_state *state = adreno_gpu_state_get(gpu);
+
+   if (IS_ERR(state))
+   return state;
+
+   state->rbbm_status = gpu_read(gpu, REG_A4XX_RBBM_STATUS);
+
+   return state;
+}
+
 /* Register offset defines for A4XX, in order of enum adreno_regs */
 static const unsigned int a4xx_register_offsets[REG_ADRENO_REGISTER_MAX] = {
REG_ADRENO_DEFINE(REG_ADRENO_CP_RB_BASE, REG_A4XX_CP_RB_BASE),
@@ -541,6 +553,8 @@ static const struct adreno_gpu_funcs funcs = {
 #ifdef CONFIG_DEBUG_FS
.show = a4xx_show,
 #endif
+   .gpu_state_get = a4xx_gpu_state_get,
+   .gpu_state_put = adreno_gpu_state_put,
},
.get_timestamp = a4xx_get_timestamp,
 };
diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index d39400e5bc42..9e85e4f7016d 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -1195,6 +1195,26 @@ static int a5xx_get_timestamp(struct msm_gpu *gpu, 
uint64_t *value)
return 0;
 }
 
+static struct msm_gpu_state *a5xx_gpu_state_get(struct msm_gpu *gpu)
+{
+   struct msm_gpu_state *state;
+
+   /*
+* Temporarily disable hardware clock gating before going into
+* adreno_show to avoid issues while reading the registers
+*/
+   a5xx_set_hwcg(gpu, false);
+
+   state = adreno_gpu_state_get(gpu);
+
+   if (!IS_ERR(state))
+   state->rbbm_status = gpu_read(gpu, REG_A5XX_RBBM_STATUS);
+
+   a5xx_set_hwcg(gpu, true);
+
+   return state;
+}
+
 #ifdef CONFIG_DEBUG_FS
 static void a5xx_show(struct msm_gpu *gpu, struct seq_file *m)
 {
@@ -1244,6 +1264,8 @@ static const struct adreno_gpu_funcs funcs = {
.debugfs_init = a5xx_debugfs_init,
 #endif
.gpu_busy = a5xx_gpu_busy,
+   .gpu_state_get = a5xx_gpu_state_get,
+   .gpu_state_put = adreno_gpu_state_put,
},
.get_timestamp = a5xx_get_timestamp,
 };
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c 
b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index bcbf9f2a29f9..c7a0d278c59e 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -368,6 +368,60 @@ bool adreno_idle(struct msm_gpu *gpu, struct 
msm_ringbuffer *ring)
return false;
 }
 
+struct msm_gpu_state *adreno_gpu_state_get(struct msm_gpu *gpu)
+{
+   struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
+   struct msm_gpu_state *state;
+   int i, count = 0;
+
+   state = kzalloc(sizeof(*state), GFP_KERNEL);
+   if (!state)
+   return ERR_PTR(-ENOMEM);
+
+   do_gettimeofday(>time);
+
+   for (i = 0; i < gpu->nr_rings; i++) 

Re: [PATCH 3/3] drm/scheduler: modify args of drm_sched_entity_init

2018-07-12 Thread Eric Anholt
Nayan Deshmukh  writes:
> diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c 
> b/drivers/gpu/drm/scheduler/gpu_scheduler.c
> index 3dc1a4f07e3f..b2dbd1c1ba69 100644
> --- a/drivers/gpu/drm/scheduler/gpu_scheduler.c
> +++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c
> @@ -162,26 +162,32 @@ drm_sched_rq_select_entity(struct drm_sched_rq *rq)
>   * drm_sched_entity_init - Init a context entity used by scheduler when
>   * submit to HW ring.
>   *
> - * @sched: scheduler instance
>   * @entity: scheduler entity to init
> - * @rq: the run queue this entity belongs
> + * @rq_list: the list of run queue on which jobs from this
> + *   entity can be submitted
> + * @num_rq_list: number of run queue in rq_list
>   * @guilty: atomic_t set to 1 when a job on this queue
>   *  is found to be guilty causing a timeout
>   *
> + * Note: the rq_list should have atleast one element to schedule
> + *   the entity
> + *
>   * Returns 0 on success or a negative error code on failure.
>  */
> -int drm_sched_entity_init(struct drm_gpu_scheduler *sched,
> -   struct drm_sched_entity *entity,
> -   struct drm_sched_rq *rq,
> +int drm_sched_entity_init(struct drm_sched_entity *entity,
> +   struct drm_sched_rq **rq_list,
> +   unsigned int num_rq_list,
> atomic_t *guilty)
>  {
> - if (!(sched && entity && rq))
> + if (!(entity && rq_list && num_rq_list > 0 && rq_list[0]))
>   return -EINVAL;
>  
>   memset(entity, 0, sizeof(struct drm_sched_entity));
>   INIT_LIST_HEAD(>list);
> - entity->rq = rq;
> - entity->sched = sched;
> + entity->rq_list = NULL;
> + entity->rq = rq_list[0];
> + entity->sched = rq_list[0]->sched;
> + entity->num_rq_list = num_rq_list;

The API change makes sense as prep work, but I don't really like adding
the field to the struct (and changing the struct's docs for the existing
rq field) if it's going to always be NULL until a future change.

Similarly, I'd rather see patch 2 as part of a series that uses the
value.

That said, while I don't currently have a usecase for load-balancing
between entities, I may in the future, so thanks for working on this!


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/3] drm/scheduler: add a pointer to scheduler in the rq

2018-07-12 Thread Eric Anholt
Nayan Deshmukh  writes:

> Signed-off-by: Nayan Deshmukh 
> ---

Acked-by: Eric Anholt 


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 107183] Enabling Glamor takes half a second

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107183

--- Comment #5 from Paul Menzel  ---
Michel, Chris, I just noticed, that the delay is only there when starting the
X.Org X server for the first time. Could you please make sure, that your
systems are rebooted when trying this?

(During my tests I do not use a graphical login manager, and just log in on a
terminal and execute `exec startx`.)

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/dp_helper: Add DP aux channel tracing

2018-07-12 Thread Lyude Paul
This is something we've needed for a very long time now, as it makes
debugging issues with faulty MST hubs along with debugging issues
regarding us interfacing with hubs correctly vastly easier to debug.
Currently this can actually be done if you trace the i2c devices for DP
using ftrace but that's significantly less useful for a couple of
reasons:

- Tracing the i2c devices through ftrace means all of the traces are
  going to contain a lot of "garbage" output that we're sending over the
  i2c line. Most of this garbage comes from retrying transactions, DRM's
  helper library adding extra transactions to work around bad hubs, etc.
- Having a user set up ftrace so that they can provide debugging
  information is a lot more difficult then being able to say "just boot
  with drm.debug=0x100"
- We can potentially expand upon this tracing in the future to print
  debugging information in regards to other DP transactions like MST
  sideband transactions

This is inspired by a patch Rob Clark sent to do this a long time back.
Neither of us could find the patch however, so we both assumed it would
probably just be easier to rewrite it anyway.

Cc: Rob Clark 
Signed-off-by: Lyude Paul 
---
 drivers/gpu/drm/drm_dp_helper.c | 34 -
 drivers/gpu/drm/drm_drv.c   | 15 ---
 include/drm/drm_print.h |  6 ++
 3 files changed, 43 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index a7ba602a43a8..6fa5a59aa17c 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -185,6 +185,21 @@ EXPORT_SYMBOL(drm_dp_bw_code_to_link_rate);
 
 #define AUX_RETRY_INTERVAL 500 /* us */
 
+static inline void
+drm_dp_dump_access(const struct drm_dp_aux *aux,
+  u8 request, uint offset, void *buffer, int ret)
+{
+   const char *arrow = request == DP_AUX_NATIVE_READ ? "->" : "<-";
+
+   if (ret > 0)
+   drm_dbg(DRM_UT_DP, "%s: 0x%08x AUX %s (ret=%3d) %*ph%s\n",
+   aux->name, offset, arrow, ret, min(ret, 64),
+   buffer, ret > 64 ? "..." : "");
+   else
+   drm_dbg(DRM_UT_DP, "%s: 0x%08x AUX %s (ret=%3d)\n",
+   aux->name, offset, arrow, ret);
+}
+
 /**
  * DOC: dp helpers
  *
@@ -288,10 +303,14 @@ ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned 
int offset,
ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, DP_DPCD_REV, buffer,
 1);
if (ret != 1)
-   return ret;
+   goto out;
 
-   return drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, offset, buffer,
- size);
+   ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, offset, buffer,
+size);
+
+out:
+   drm_dp_dump_access(aux, DP_AUX_NATIVE_READ, offset, buffer, ret);
+   return ret;
 }
 EXPORT_SYMBOL(drm_dp_dpcd_read);
 
@@ -312,8 +331,13 @@ EXPORT_SYMBOL(drm_dp_dpcd_read);
 ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset,
  void *buffer, size_t size)
 {
-   return drm_dp_dpcd_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer,
- size);
+   int ret;
+
+
+   ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer,
+size);
+   drm_dp_dump_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer, ret);
+   return ret;
 }
 EXPORT_SYMBOL(drm_dp_dpcd_write);
 
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 7af748ed1c58..e555eb5de275 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -53,13 +53,14 @@ MODULE_AUTHOR("Gareth Hughes, Leif Delgass, José Fonseca, 
Jon Smirl");
 MODULE_DESCRIPTION("DRM shared core routines");
 MODULE_LICENSE("GPL and additional rights");
 MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug 
category.\n"
-"\t\tBit 0 (0x01) will enable CORE messages (drm core code)\n"
-"\t\tBit 1 (0x02) will enable DRIVER messages (drm controller code)\n"
-"\t\tBit 2 (0x04) will enable KMS messages (modesetting code)\n"
-"\t\tBit 3 (0x08) will enable PRIME messages (prime code)\n"
-"\t\tBit 4 (0x10) will enable ATOMIC messages (atomic code)\n"
-"\t\tBit 5 (0x20) will enable VBL messages (vblank code)\n"
-"\t\tBit 7 (0x80) will enable LEASE messages (leasing code)");
+"\t\tBit 0 (0x01)  will enable CORE messages (drm core code)\n"
+"\t\tBit 1 (0x02)  will enable DRIVER messages (drm controller code)\n"
+"\t\tBit 2 (0x04)  will enable KMS messages (modesetting code)\n"
+"\t\tBit 3 (0x08)  will enable PRIME messages (prime code)\n"
+"\t\tBit 4 (0x10)  will enable ATOMIC messages (atomic code)\n"
+"\t\tBit 5 (0x20)  will enable VBL messages (vblank code)\n"
+"\t\tBit 7 (0x80)  will enable LEASE messages (leasing code)\n"
+"\t\tBit 8 (0x100) will enable DP messages (displayport code)");
 

Re: [PATCH 0/2] drm/nouveau: Add support for dp_mst_info in debugfs

2018-07-12 Thread Daniel Vetter
On Thu, Jul 12, 2018 at 01:10:45PM -0400, Lyude Paul wrote:
> This hooks up the DRM helpers for dumping information on the current
> status of each MST topology from nouveau's perspective to debugfs files,
> similar to what i915 does (albeit, i915 labels their debugfs node for
> this as i915_dp_mst_info).
> 
> Lyude Paul (2):
>   drm/nouveau: Expose nv50 MST structures in disp.h
>   drm/nouveau: Hook up dp_mst_info in debugfs

We already register the i2c-over-aux and dp_aux devnodes in
drm_dp_aux_register(). Could we do the same with a per-devnode debugfs
file for mst? The topology manager sits on top of the dp aux abstraction,
so this could work, with s/encoder->name/dp_aux->name/.

Would give us mst info on every driver for free (plus we could nuke the
ad-hoc version in i915).
-Daniel

> 
>  drivers/gpu/drm/nouveau/dispnv50/disp.c   | 34 
>  drivers/gpu/drm/nouveau/dispnv50/disp.h   | 35 +
>  drivers/gpu/drm/nouveau/nouveau_debugfs.c | 47 ++-
>  3 files changed, 80 insertions(+), 36 deletions(-)
> 
> -- 
> 2.17.1
> 

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


Re: [PATCH v2 3/3] drm/nouveau: Remove bogus crtc check in pmops_runtime_idle

2018-07-12 Thread Daniel Vetter
On Thu, Jul 12, 2018 at 01:02:54PM -0400, Lyude Paul wrote:
> This both uses the legacy modesetting structures in a racy manner, and
> additionally also doesn't even check the right variable (enabled != the
> CRTC is actually turned on for atomic).
> 
> This fixes issues on my P50 regarding the dedicated GPU not entering
> runtime suspend.
> 
> Signed-off-by: Lyude Paul 
> Cc: sta...@vger.kernel.org

On both patch 2&3:

Reviewed-by: Daniel Vetter 

->enable vs. ->active is probably the biggest source of pain in atomic,
and beyond typing even more kerneldoc that will be ignored (there's
another series doing exactly that on the list) I have no idea what to do.
90% rule is to look at ->enable in atomic_check code (since DPMS changes
should always work) and ->active in atomic_commit code.

Wrt the legacy state: For the legacy pointers we can set them to NULL for
atomic, and Ville has done that. That's real effective at stopping drivers
from looking at the wrong thing. But for the others like this one here I
dunno what to do to effectively hide them from atomic drivers.



Cheers, Daniel

> ---
>  drivers/gpu/drm/nouveau/nouveau_drm.c | 11 ---
>  1 file changed, 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
> b/drivers/gpu/drm/nouveau/nouveau_drm.c
> index 0f668e275ee1..c7ec86d6c3c9 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
> @@ -881,22 +881,11 @@ nouveau_pmops_runtime_resume(struct device *dev)
>  static int
>  nouveau_pmops_runtime_idle(struct device *dev)
>  {
> - struct pci_dev *pdev = to_pci_dev(dev);
> - struct drm_device *drm_dev = pci_get_drvdata(pdev);
> - struct nouveau_drm *drm = nouveau_drm(drm_dev);
> - struct drm_crtc *crtc;
> -
>   if (!nouveau_pmops_runtime()) {
>   pm_runtime_forbid(dev);
>   return -EBUSY;
>   }
>  
> - list_for_each_entry(crtc, >dev->mode_config.crtc_list, head) {
> - if (crtc->enabled) {
> - DRM_DEBUG_DRIVER("failing to power off - crtc 
> active\n");
> - return -EBUSY;
> - }
> - }
>   pm_runtime_mark_last_busy(dev);
>   pm_runtime_autosuspend(dev);
>   /* we don't want the main rpm_idle to call suspend - we want to 
> autosuspend */
> -- 
> 2.17.1
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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


[PATCH] drm/nouveau: Don't forget to label dp_aux devices

2018-07-12 Thread Lyude Paul
This makes debugging with DP tracing a lot harder to interpret, so name
each i2c based off the name of the encoder that it's for

Signed-off-by: Lyude Paul 
---
 drivers/gpu/drm/nouveau/dispnv04/disp.c |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/disp.c |  2 +-
 drivers/gpu/drm/nouveau/nouveau_connector.c | 12 ++--
 drivers/gpu/drm/nouveau/nouveau_connector.h |  3 ++-
 4 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c 
b/drivers/gpu/drm/nouveau/dispnv04/disp.c
index 501d2d290e9c..45ff1872d894 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c
@@ -64,7 +64,7 @@ nv04_display_create(struct drm_device *dev)
for (i = 0; i < dcb->entries; i++) {
struct dcb_output *dcbent = >entry[i];
 
-   connector = nouveau_connector_create(dev, dcbent->connector);
+   connector = nouveau_connector_create(dev, dcbent);
if (IS_ERR(connector))
continue;
 
diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c 
b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index 9382e99a0bc7..4f8d51590bbb 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -2198,7 +2198,7 @@ nv50_display_create(struct drm_device *dev)
 
/* create encoder/connector objects based on VBIOS DCB table */
for (i = 0, dcbe = >entry[0]; i < dcb->entries; i++, dcbe++) {
-   connector = nouveau_connector_create(dev, dcbe->connector);
+   connector = nouveau_connector_create(dev, dcbe);
if (IS_ERR(connector))
continue;
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c 
b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 7b557c354307..0c5cc600c973 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -408,8 +408,10 @@ nouveau_connector_destroy(struct drm_connector *connector)
kfree(nv_connector->edid);
drm_connector_unregister(connector);
drm_connector_cleanup(connector);
-   if (nv_connector->aux.transfer)
+   if (nv_connector->aux.transfer) {
drm_dp_aux_unregister(_connector->aux);
+   kfree(nv_connector->aux.name);
+   }
kfree(connector);
 }
 
@@ -1201,13 +1203,16 @@ drm_conntype_from_dcb(enum dcb_connector_type dcb)
 }
 
 struct drm_connector *
-nouveau_connector_create(struct drm_device *dev, int index)
+nouveau_connector_create(struct drm_device *dev,
+const struct dcb_output *dcbe)
 {
const struct drm_connector_funcs *funcs = _connector_funcs;
struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_display *disp = nouveau_display(dev);
struct nouveau_connector *nv_connector = NULL;
struct drm_connector *connector;
+   char aux_name[48] = {0};
+   int index = dcbe->connector;
int type, ret = 0;
bool dummy;
 
@@ -1306,6 +1311,9 @@ nouveau_connector_create(struct drm_device *dev, int 
index)
case DRM_MODE_CONNECTOR_eDP:
nv_connector->aux.dev = dev->dev;
nv_connector->aux.transfer = nouveau_connector_aux_xfer;
+   snprintf(aux_name, sizeof(aux_name), "sor-%04x-%04x",
+dcbe->hasht, dcbe->hashm);
+   nv_connector->aux.name = kstrdup(aux_name, GFP_KERNEL);
ret = drm_dp_aux_register(_connector->aux);
if (ret) {
NV_ERROR(drm, "failed to register aux channel\n");
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.h 
b/drivers/gpu/drm/nouveau/nouveau_connector.h
index a4d1a059bd3d..2c5cb51c7c33 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.h
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.h
@@ -35,6 +35,7 @@
 #include "nouveau_crtc.h"
 
 struct nvkm_i2c_port;
+struct dcb_output;
 
 struct nouveau_connector {
struct drm_connector base;
@@ -76,7 +77,7 @@ nouveau_crtc_connector_get(struct nouveau_crtc *nv_crtc)
 }
 
 struct drm_connector *
-nouveau_connector_create(struct drm_device *, int index);
+nouveau_connector_create(struct drm_device *, const struct dcb_output *);
 
 extern int nouveau_tv_disable;
 extern int nouveau_ignorelid;
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/tinydrm: add backlight dependency for ili9341

2018-07-12 Thread David Lechner

On 07/09/2018 10:20 AM, Arnd Bergmann wrote:

This tinydrm driver fails to link without the backlight support:

drivers/gpu/drm/tinydrm/ili9341.o: In function `ili9341_probe':
ili9341.c:(.text+0x578): undefined reference to `devm_of_find_backlight'

Fixes: 3fa0e8f6f960 ("drm/tinydrm: new driver for ILI9341 display panels")
Signed-off-by: Arnd Bergmann 
---


applied to drm-misc-next.

thanks
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/2] drm/nouveau: Hook up dp_mst_info in debugfs

2018-07-12 Thread Lyude Paul
This is very useful for checking what nouveau thinks the current state
of each MST topology looks like.

Signed-off-by: Lyude Paul 
---
 drivers/gpu/drm/nouveau/nouveau_debugfs.c | 47 ++-
 1 file changed, 45 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c 
b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
index 963a4dba8213..82f10beed0df 100644
--- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c
+++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
@@ -32,13 +32,19 @@
 #include 
 #include 
 #include "nouveau_debugfs.h"
+#include "nouveau_encoder.h"
 #include "nouveau_drv.h"
+#include "dispnv50/disp.h"
+
+static inline struct nouveau_drm *node_to_nouveau(struct drm_info_node *node)
+{
+   return nouveau_drm(node->minor->dev);
+}
 
 static int
 nouveau_debugfs_vbios_image(struct seq_file *m, void *data)
 {
-   struct drm_info_node *node = (struct drm_info_node *) m->private;
-   struct nouveau_drm *drm = nouveau_drm(node->minor->dev);
+   struct nouveau_drm *drm = node_to_nouveau(m->private);
int i;
 
for (i = 0; i < drm->vbios.length; i++)
@@ -46,6 +52,42 @@ nouveau_debugfs_vbios_image(struct seq_file *m, void *data)
return 0;
 }
 
+static int
+nouveau_debugfs_dp_mst_info(struct seq_file *m, void *unused)
+{
+   struct nouveau_drm *drm = node_to_nouveau(m->private);
+   struct drm_device *dev = drm->dev;
+   struct drm_encoder *encoder;
+   struct nv50_mstm *mstm;
+   int ret;
+
+   ret = pm_runtime_get_sync(dev->dev);
+   if (ret < 0 && ret != -EACCES)
+   return ret;
+
+   ret = 
drm_modeset_lock_single_interruptible(>mode_config.connection_mutex);
+   if (ret)
+   goto out;
+
+   drm_for_each_encoder(encoder, dev) {
+   if (encoder->encoder_type != DRM_MODE_ENCODER_TMDS)
+   continue;
+
+   mstm = nouveau_encoder(encoder)->dp.mstm;
+   if (!mstm)
+   continue;
+
+   seq_printf(m, "MST encoder source %s\n", encoder->name);
+   drm_dp_mst_dump_topology(m, >mgr);
+   }
+
+   drm_modeset_unlock(>mode_config.connection_mutex);
+out:
+   pm_runtime_mark_last_busy(dev->dev);
+   pm_runtime_put_autosuspend(dev->dev);
+   return ret;
+}
+
 static int
 nouveau_debugfs_pstate_get(struct seq_file *m, void *data)
 {
@@ -182,6 +224,7 @@ static const struct file_operations nouveau_pstate_fops = {
 
 static struct drm_info_list nouveau_debugfs_list[] = {
{ "vbios.rom", nouveau_debugfs_vbios_image, 0, NULL },
+   { "dp_mst_info", nouveau_debugfs_dp_mst_info, 0, NULL },
 };
 #define NOUVEAU_DEBUGFS_ENTRIES ARRAY_SIZE(nouveau_debugfs_list)
 
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/2] drm/nouveau: Expose nv50 MST structures in disp.h

2018-07-12 Thread Lyude Paul
We're about to need this so that we can hook up dp_mst_info into debugfs
so we can walk the encoder list and find each mst mgr.

Signed-off-by: Lyude Paul 
---
 drivers/gpu/drm/nouveau/dispnv50/disp.c | 34 
 drivers/gpu/drm/nouveau/dispnv50/disp.h | 35 +
 2 files changed, 35 insertions(+), 34 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c 
b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index d9da69c83ae7..f76fe5f260a4 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -568,40 +568,6 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct 
drm_display_mode *mode)
 /**
  * MST
  */
-#define nv50_mstm(p) container_of((p), struct nv50_mstm, mgr)
-#define nv50_mstc(p) container_of((p), struct nv50_mstc, connector)
-#define nv50_msto(p) container_of((p), struct nv50_msto, encoder)
-
-struct nv50_mstm {
-   struct nouveau_encoder *outp;
-
-   struct drm_dp_mst_topology_mgr mgr;
-   struct nv50_msto *msto[4];
-
-   bool modified;
-   bool disabled;
-   int links;
-};
-
-struct nv50_mstc {
-   struct nv50_mstm *mstm;
-   struct drm_dp_mst_port *port;
-   struct drm_connector connector;
-
-   struct drm_display_mode *native;
-   struct edid *edid;
-
-   int pbn;
-};
-
-struct nv50_msto {
-   struct drm_encoder encoder;
-
-   struct nv50_head *head;
-   struct nv50_mstc *mstc;
-   bool disabled;
-};
-
 static struct drm_dp_payload *
 nv50_msto_payload(struct nv50_msto *msto)
 {
diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.h 
b/drivers/gpu/drm/nouveau/dispnv50/disp.h
index e48c5eb35b49..5ba7093f3c74 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.h
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.h
@@ -3,6 +3,7 @@
 #include 
 
 #include "nouveau_display.h"
+#include "nouveau_encoder.h"
 
 struct nv50_disp {
struct nvif_disp *disp;
@@ -65,6 +66,40 @@ struct nv50_dmac {
struct mutex lock;
 };
 
+#define nv50_mstm(p) container_of((p), struct nv50_mstm, mgr)
+#define nv50_mstc(p) container_of((p), struct nv50_mstc, connector)
+#define nv50_msto(p) container_of((p), struct nv50_msto, encoder)
+
+struct nv50_mstm {
+   struct nouveau_encoder *outp;
+
+   struct drm_dp_mst_topology_mgr mgr;
+   struct nv50_msto *msto[4];
+
+   bool modified;
+   bool disabled;
+   int links;
+};
+
+struct nv50_mstc {
+   struct nv50_mstm *mstm;
+   struct drm_dp_mst_port *port;
+   struct drm_connector connector;
+
+   struct drm_display_mode *native;
+   struct edid *edid;
+
+   int pbn;
+};
+
+struct nv50_msto {
+   struct drm_encoder encoder;
+
+   struct nv50_head *head;
+   struct nv50_mstc *mstc;
+   bool disabled;
+};
+
 int nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp,
 const s32 *oclass, u8 head, void *data, u32 size,
 u64 syncbuf, struct nv50_dmac *dmac);
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 0/2] drm/nouveau: Add support for dp_mst_info in debugfs

2018-07-12 Thread Lyude Paul
This hooks up the DRM helpers for dumping information on the current
status of each MST topology from nouveau's perspective to debugfs files,
similar to what i915 does (albeit, i915 labels their debugfs node for
this as i915_dp_mst_info).

Lyude Paul (2):
  drm/nouveau: Expose nv50 MST structures in disp.h
  drm/nouveau: Hook up dp_mst_info in debugfs

 drivers/gpu/drm/nouveau/dispnv50/disp.c   | 34 
 drivers/gpu/drm/nouveau/dispnv50/disp.h   | 35 +
 drivers/gpu/drm/nouveau/nouveau_debugfs.c | 47 ++-
 3 files changed, 80 insertions(+), 36 deletions(-)

-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2] drm/sun4i: Implement zpos for DE2

2018-07-12 Thread Maxime Ripard
On Fri, Jul 06, 2018 at 06:47:32PM +0200, Jernej Skrabec wrote:
> Initial implementation of DE2 planes only supported fixed zpos.
> 
> Expand implementation with configurable zpos property.
> 
> Implementation background:
> Channel in DE2 driver represents one DRM plane, whereas pipe is just
> mapped channel to known Z position. Pipe 0 will always be at the bottom,
> pipe 1 just above pipe 0 and so on. If, for example, channel 1 is mapped
> at pipe 0 and channel 0 at pipe 1, whatever is on channel 0 will appear
> on top.
> 
> Before this commit, channel id was used for addressing channel related
> registers (prefixed with SUN8I_MIXER_CHAN_UI_ or SUN8I_MIXER_CHAN_VI_)
> and pipe registers (prefixed with SUN8I_MIXER_BLEND_). Additionally,
> register SUN8I_MIXER_BLEND_ROUTE, which takes care for mapping channels
> to pipes had fixed value. It mapped channel 0 to pipe 0, 1 to 1 and so
> on. Consequence of all that was fixed Z order of planes.
> 
> With this commit, pipe registers are using zpos property as index and
> channel related registers still use channel id as index. Pipe mapping
> register is now set dynamically too and pipe enable register is rebuild
> every time to make sure only active pipes are enabled.
> 
> Testing was done to confirm that there is no issues if bottom plane
> contains pixels with alpha value < 0xff and if it doesn't whole screen.
> 
> Tested-by: Paul Kocialkowski 
> Signed-off-by: Jernej Skrabec 

Applied, thanks!
Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 3/3] drm/nouveau: Remove bogus crtc check in pmops_runtime_idle

2018-07-12 Thread Lyude Paul
This both uses the legacy modesetting structures in a racy manner, and
additionally also doesn't even check the right variable (enabled != the
CRTC is actually turned on for atomic).

This fixes issues on my P50 regarding the dedicated GPU not entering
runtime suspend.

Signed-off-by: Lyude Paul 
Cc: sta...@vger.kernel.org
---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 0f668e275ee1..c7ec86d6c3c9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -881,22 +881,11 @@ nouveau_pmops_runtime_resume(struct device *dev)
 static int
 nouveau_pmops_runtime_idle(struct device *dev)
 {
-   struct pci_dev *pdev = to_pci_dev(dev);
-   struct drm_device *drm_dev = pci_get_drvdata(pdev);
-   struct nouveau_drm *drm = nouveau_drm(drm_dev);
-   struct drm_crtc *crtc;
-
if (!nouveau_pmops_runtime()) {
pm_runtime_forbid(dev);
return -EBUSY;
}
 
-   list_for_each_entry(crtc, >dev->mode_config.crtc_list, head) {
-   if (crtc->enabled) {
-   DRM_DEBUG_DRIVER("failing to power off - crtc 
active\n");
-   return -EBUSY;
-   }
-   }
pm_runtime_mark_last_busy(dev);
pm_runtime_autosuspend(dev);
/* we don't want the main rpm_idle to call suspend - we want to 
autosuspend */
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 2/3] drm/nouveau: Fix runtime PM leak in nv50_disp_atomic_commit()

2018-07-12 Thread Lyude Paul
A CRTC being enabled doesn't mean it's on! It doesn't even necessarily
mean it's being used. This fixes runtime PM leaks on the P50 I've got
next to me.

Signed-off-by: Lyude Paul 
Cc: sta...@vger.kernel.org
---
 drivers/gpu/drm/nouveau/dispnv50/disp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c 
b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index d9da69c83ae7..9bae4db84cfb 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -1878,7 +1878,7 @@ nv50_disp_atomic_commit(struct drm_device *dev,
nv50_disp_atomic_commit_tail(state);
 
drm_for_each_crtc(crtc, dev) {
-   if (crtc->state->enable) {
+   if (crtc->state->active) {
if (!drm->have_disp_power_ref) {
drm->have_disp_power_ref = true;
return 0;
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 1/3] drm/nouveau: Fix runtime PM leak in drm_open()

2018-07-12 Thread Lyude Paul
Noticed this as I was skimming through, if we fail to allocate memory
for cli we'll end up returning without dropping the runtime PM ref we
got. Additionally, we'll even return the wrong return code! (ret most
likely will == 0 here, we want -ENOMEM).

Signed-off-by: Lyude Paul 
Reviewed-by: Lukas Wunner 
---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 0452b18d36b9..0f668e275ee1 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -919,8 +919,10 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file 
*fpriv)
get_task_comm(tmpname, current);
snprintf(name, sizeof(name), "%s[%d]", tmpname, pid_nr(fpriv->pid));
 
-   if (!(cli = kzalloc(sizeof(*cli), GFP_KERNEL)))
-   return ret;
+   if (!(cli = kzalloc(sizeof(*cli), GFP_KERNEL))) {
+   ret = -ENOMEM;
+   goto done;
+   }
 
ret = nouveau_cli_init(drm, name, cli);
if (ret)
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 0/3] drm/nouveau: Fix runtime PM leaks

2018-07-12 Thread Lyude Paul
This is the latest version of
https://patchwork.freedesktop.org/series/45862/ . One new patch has been
added that also addresses some additional issues I found with
pmops_runtime_idle that would stop nouveau from suspending the GPU when
running under X.

Additionally,
"drm/nouveau: Fix runtime PM leak in nv50_disp_atomic_commit()" has had
it's CC to stable removed.

Lyude Paul (3):
  drm/nouveau: Fix runtime PM leak in drm_open()
  drm/nouveau: Fix runtime PM leak in nv50_disp_atomic_commit()
  drm/nouveau: Remove bogus crtc check in pmops_runtime_idle

 drivers/gpu/drm/nouveau/dispnv50/disp.c |  2 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c   | 17 -
 2 files changed, 5 insertions(+), 14 deletions(-)

-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/sun4i: tcon-top: Fix return type warning

2018-07-12 Thread Maxime Ripard
On Thu, Jul 12, 2018 at 10:35:08AM +0200, Daniel Vetter wrote:
> On Thu, Jul 12, 2018 at 10:08:18AM +0200, Maxime Ripard wrote:
> > When commit af11942ee44e ("drm/sun4i: tcon-top: Cleanup clock handling")
> > was merged, the error handling path of the of_property_match_string was
> > changed to take into account the fact that the returned value of that
> > function wasn't an error pointer but an error code.
> > 
> > Unfortunately, this introduced a warning since the now returned value is an
> > integer, while the sun8i_tcon_top_register_gate function should return an
> > error pointer.
> > 
> > Fix that by calling ERR_PTR.
> > 
> > Cc: Jernej Skrabec 
> > Cc: Chen-Yu Tsai 
> > Fixes: af11942ee44e ("drm/sun4i: tcon-top: Cleanup clock handling")
> > Reported-by: kbuild test robot 
> > Reported-by: Stephen Rothwell 
> > Signed-off-by: Maxime Ripard 
> 
> Matches at least the seamntics of the other returns afaics.
> 
> Reviewed-by: Daniel Vetter 

Applied, thanks!
Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 107209] DM_PPLIB causes a warning on Raven

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107209

Bug ID: 107209
   Summary: DM_PPLIB causes a warning on Raven
   Product: DRI
   Version: DRI git
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: DRM/AMDgpu
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: m...@fireburn.co.uk

Created attachment 140610
  --> https://bugs.freedesktop.org/attachment.cgi?id=140610=edit
Dmesg

Alex's drm-next-4.19-wip branch has been producing a warning with a stack trace
- everything seems to be working though 

[0.334920] amdgpu: [powerplay] dpm has been enabled
[0.334981] [drm] DM_PPLIB: values for Invalid clock
[0.334982] [drm] DM_PPLIB:   0 in kHz
[0.334984] [drm] DM_PPLIB:   0 in kHz
[0.334985] [drm] DM_PPLIB:   0 in kHz
[0.334986] [drm] DM_PPLIB:   1067000 in kHz
[0.334998] WARNING: CPU: 4 PID: 1 at
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:1355
dcn_bw_update_from_pplib+0x166/0x270
[0.335001] Modules linked in:
[0.335005] CPU: 4 PID: 1 Comm: swapper/0 Tainted: GW
4.18.0-rc3-agd5f+ #198
[0.335007] Hardware name: System manufacturer System Product Name/ROG STRIX
X470-I GAMING, BIOS 0601 04/19/2018
[0.335011] RIP: 0010:dcn_bw_update_from_pplib+0x166/0x270
[0.335012] Code: d8 ca d8 f1 d9 5a 50 8b 44 fc 14 49 8b 94 24 70 01 00 00
48 89 04 24 df 2c 24 d8 f1 db 42 78 de c9 de ca de f9 d9 5a 4c eb 02 <0f> 0b 48
89 da be 04 00 00 00 48 89 ef e8 98 89 fe ff 84 c0 0f 84
[0.335034] RSP: 0018:c90379f8 EFLAGS: 00010246
[0.335036] RAX: 0001 RBX: c9037a58 RCX:

[0.335038] RDX:  RSI: 0004 RDI:

[0.335040] RBP: 88081b2e3bc0 R08:  R09:
0296
[0.335042] R10: 88081c091f00 R11: 0720072007200720 R12:
88081b2c2000
[0.335044] R13: 88081b5f8800 R14: 88081b2c2000 R15:
88081b0e3030
[0.335046] FS:  () GS:88083ed0()
knlGS:
[0.335048] CS:  0010 DS:  ES:  CR0: 80050033
[0.335050] CR2: c92c CR3: 0340a000 CR4:
003406a0
[0.335051] Call Trace:
[0.335057]  ? construct+0x799/0x940
[0.335059]  ? dal_aux_engine_dce110_create+0x2f/0x70
[0.335062]  ? dal_i2caux_dce110_construct.part.1+0x5c/0x90
[0.335064]  ? dcn10_create_resource_pool+0x31/0x50
[0.335068]  ? dc_create_resource_pool+0x3d/0x180
[0.335071]  ? __kmalloc+0x166/0x170
[0.335073]  ? dc_create+0x205/0x610
[0.335076]  ? kmem_cache_alloc+0x22/0x120
[0.335078]  ? dm_hw_init+0xc3/0x130
[0.335082]  ? amdgpu_device_init.cold.32+0xc9f/0xe05
[0.335085]  ? __alloc_pages_nodemask+0xc1/0x1d0
[0.335088]  ? amdgpu_driver_load_kms+0x5e/0x190
[0.335091]  ? drm_dev_register+0x104/0x140
[0.335093]  ? amdgpu_pci_probe+0x136/0x1ad
[0.335096]  ? _raw_spin_unlock_irqrestore+0xf/0x30
[0.335099]  ? pci_device_probe+0xd1/0x160
[0.335102]  ? driver_probe_device+0x229/0x2f0
[0.335104]  ? __driver_attach+0xaf/0xd0
[0.335106]  ? driver_probe_device+0x2f0/0x2f0
[0.335108]  ? bus_for_each_dev+0x71/0xb0
[0.335110]  ? bus_add_driver+0x192/0x1d0
[0.335113]  ? do_early_param+0x89/0x89
[0.335115]  ? driver_register+0x66/0xb0
[0.335117]  ? kfd_module_init+0x92/0x92
[0.335120]  ? do_one_initcall+0x42/0x162
[0.335122]  ? do_early_param+0x89/0x89
[0.335125]  ? kernel_init_freeable+0x145/0x1cf
[0.335127]  ? rest_init+0xb0/0xb0
[0.335129]  ? kernel_init+0x5/0xf0
[0.335131]  ? ret_from_fork+0x22/0x40
[0.335133] ---[ end trace 67bfeb8027e23cf6 ]---
[0.335135] [drm] DM_PPLIB: values for Invalid clock
[0.335136] [drm] DM_PPLIB:   30 in kHz
[0.335137] [drm] DM_PPLIB:   60 in kHz
[0.335139] [drm] DM_PPLIB:   626000 in kHz
[0.335140] [drm] DM_PPLIB:   654000 in kHz

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [RFC v3 0/8] Add Plane Color Properties

2018-07-12 Thread Alexandru-Cosmin Gheorghe
Hi Uma,

On Tue, Jun 12, 2018 at 04:01:31AM +, Shankar, Uma wrote:
> 
> 
> >-Original Message-
> >From: dri-devel [mailto:dri-devel-boun...@lists.freedesktop.org] On Behalf Of
> >Alexandru-Cosmin Gheorghe
> >Sent: Monday, June 11, 2018 3:47 PM
> >To: Shankar, Uma 
> >Cc: dcasta...@chromium.org; intel-...@lists.freedesktop.org;
> >emil.l.veli...@gmail.com; dri-devel@lists.freedesktop.org; Syrjala, Ville
> >; n...@arm.com; Lankhorst, Maarten
> >
> >Subject: Re: [RFC v3 0/8] Add Plane Color Properties
> >
> >Hi Uma,
> >
> >Any progress on userspace for this?
> >I was thinking on working on using this in drm_hwcomposer.
> >
> 
> Hi Alex,
> Not much work has been done till now on user space side. You can go ahead
> and try to enable it in drm_hwcomposer.
> 
> Regards,
> Uma Shankar
>

I opened a Merge request in drm_hwcomposer, if you have time please
have a look and let me know what you think.
[1] 
https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/merge_requests/25 
 
> >Thank you,
> >Alex Gheorghe
> >
> >On Fri, Mar 09, 2018 at 11:47:41PM +0530, Uma Shankar wrote:
> >> This patch series adds properties for plane color features. It adds
> >> properties for degamma used to linearize data, CSC used for gamut
> >> conversion, and gamma used to again non-linearize data as per panel
> >> supported color space. These can be utilize by user space to convert
> >> planes from one format to another, one color space to another etc.
> >>
> >> Usersapce can take smart blending decisions and utilize these hardware
> >> supported plane color features to get accurate color profile. The same
> >> can help in consistent color quality from source to panel taking
> >> advantage of advanced color features in hardware.
> >>
> >> These patches just add the property interfaces and enable helper
> >> functions.
> >>
> >> This series adds Intel Gen9 specific plane gamma feature. We can build
> >> up and add other platform/hardware specific implementation on top of
> >> this series
> >>
> >> Note: This is just to get a design feedback whether these interfaces
> >> look ok. Based on community feedback on interfaces, we will implement
> >> IGT tests to validate plane color features. This is un-tested currently.
> >> Also, userspace implementation to use these properties is currently
> >> not available.
> >>
> >> v2: Dropped legacy gamma table for plane as suggested by Maarten.
> >> Added Gen9/BDW plane gamma feature and rebase on tot.
> >>
> >> v3: Added a new drm_color_lut_ext structure to accommodate 32 bit
> >> precision entries, pointed to by Brian, Starkey for HDR usecases.
> >> Addressed Sean,Paul comments and moved plane color properties to
> >> drm_plane instead of mode_config. Added property documentation as
> >suggested by Daniel, Vetter.
> >> Fixed a rebase fumble which occurred in v2, pointed by Emil Velikov.
> >>
> >> Uma Shankar (8):
> >>   drm: Add Enhanced Gamma LUT precision structure
> >>   drm: Add Plane Degamma properties
> >>   drm: Add Plane CTM property
> >>   drm: Add Plane Gamma properties
> >>   drm: Define helper function for plane color enabling
> >>   drm/i915: Enable plane color features
> >>   drm/i915: Implement Plane Gamma for Bdw and Gen9 platforms
> >>   drm/i915: Load plane color luts from atomic flip
> >>
> >>  Documentation/gpu/drm-kms.rst |  18 
> >>  drivers/gpu/drm/drm_atomic.c  |  30 +++
> >>  drivers/gpu/drm/drm_atomic_helper.c   |  12 +++
> >>  drivers/gpu/drm/drm_plane.c   | 131
> >++
> >>  drivers/gpu/drm/i915/i915_drv.h   |   5 ++
> >>  drivers/gpu/drm/i915/i915_pci.c   |   5 +-
> >>  drivers/gpu/drm/i915/i915_reg.h   |  24 ++
> >>  drivers/gpu/drm/i915/intel_atomic_plane.c |   4 +
> >>  drivers/gpu/drm/i915/intel_color.c|  80 ++
> >>  drivers/gpu/drm/i915/intel_device_info.h  |   5 ++
> >>  drivers/gpu/drm/i915/intel_display.c  |   4 +
> >>  drivers/gpu/drm/i915/intel_drv.h  |  10 +++
> >>  drivers/gpu/drm/i915/intel_sprite.c   |   4 +
> >>  include/drm/drm_color_mgmt.h  |   5 ++
> >>  include/drm/drm_plane.h   |  66 +++
> >>  include/uapi/drm/drm_mode.h   |  15 
> >>  16 files changed, 417 insertions(+), 1 deletion(-)
> >>
> >> --
> >> 1.9.1
> >>
> >> ___
> >> dri-devel mailing list
> >> dri-devel@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> >
> >--
> >Cheers,
> >Alex G
> >___
> >dri-devel mailing list
> >dri-devel@lists.freedesktop.org
> >https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Cheers,
Alex G
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/sun41: Fix incorrect return type

2018-07-12 Thread Sean Paul
We're returning -errno instead of ERR_PTR(-errno).

Fixes: af11942ee44e ("drm/sun4i: tcon-top: Cleanup clock handling")
Cc: Chen-Yu Tsai 
Cc: Jernej Skrabec 
Cc: Maxime Ripard 
Cc: dri-devel@lists.freedesktop.org
Cc: linux-arm-ker...@lists.infradead.org
Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/sun4i/sun8i_tcon_top.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c 
b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
index 046f8dd66f90..55fe398d8290 100644
--- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
+++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
@@ -99,7 +99,7 @@ static struct clk_hw *sun8i_tcon_top_register_gate(struct 
device *dev,
 
index = of_property_match_string(dev->of_node, "clock-names", parent);
if (index < 0)
-   return index;
+   return ERR_PTR(index);
 
parent_name = of_clk_get_parent_name(dev->of_node, index);
 
-- 
Sean Paul, Software Engineer, Google / Chromium OS

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 106225] Kernel panic after modesetting (not on every boot) on ryzen 5 2400g

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106225

--- Comment #35 from Andrea Vettorello  ---
Sorry for the spam, I thought the two attachments would be inserted in the same
comment.

I think I'm afflicted by the same bug on different HW (Asrock AB350 ixt, Ryzen
5 2400G), Debian Stretch running vanilla kernel 4.17.5. I would say my boot
rate is 1 in 4~5 attempts.

Feel free to require other info.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 02/12] blk: use for_each_if

2018-07-12 Thread Joe Perches
On Thu, 2018-07-12 at 07:54 -0600, Jens Axboe wrote:
> 
> Thanks for your invaluable and useful feedback, sharing your vast
> experience in patchsets with dependencies.

I've probably more experience sending patchsets
with dependencies across subsystems than anyone.

There is no single style that works and I've
probably tried them all.

It's actually a somewhat significant issue within
this community that could use some arbitration.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 106225] Kernel panic after modesetting (not on every boot) on ryzen 5 2400g

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106225

--- Comment #34 from Andrea Vettorello  ---
Created attachment 140597
  --> https://bugs.freedesktop.org/attachment.cgi?id=140597=edit
relevant kernel 4.17.5 source of the oops

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/sti: Replace drm_dev_unref with drm_dev_put

2018-07-12 Thread Thomas Zimmermann
This patch unifies the naming of DRM functions for reference counting
of struct drm_device. The resulting code is more aligned with the rest
of the Linux kernel interfaces.

Signed-off-by: Thomas Zimmermann 
Acked-by: Benjamin Gaignard 
---
 drivers/gpu/drm/sti/sti_drv.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 90c46b49c931..832fc43960ee 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -224,7 +224,7 @@ static int sti_bind(struct device *dev)
 
ret = sti_init(ddev);
if (ret)
-   goto err_drm_dev_unref;
+   goto err_drm_dev_put;
 
ret = component_bind_all(ddev->dev, ddev);
if (ret)
@@ -248,8 +248,8 @@ static int sti_bind(struct device *dev)
drm_mode_config_cleanup(ddev);
 err_cleanup:
sti_cleanup(ddev);
-err_drm_dev_unref:
-   drm_dev_unref(ddev);
+err_drm_dev_put:
+   drm_dev_put(ddev);
return ret;
 }
 
@@ -259,7 +259,7 @@ static void sti_unbind(struct device *dev)
 
drm_dev_unregister(ddev);
sti_cleanup(ddev);
-   drm_dev_unref(ddev);
+   drm_dev_put(ddev);
 }
 
 static const struct component_master_ops sti_ops = {
-- 
2.18.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 106225] Kernel panic after modesetting (not on every boot) on ryzen 5 2400g

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106225

--- Comment #33 from Andrea Vettorello  ---
Created attachment 140596
  --> https://bugs.freedesktop.org/attachment.cgi?id=140596=edit
relevant kernel 4.17.5 log of the oops

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2] drm/client: Fix double free in error path

2018-07-12 Thread Noralf Trønnes
This fixes a static checker warning:

drivers/gpu/drm/drm_client.c:289 drm_client_buffer_create()
error: double free of 'buffer'

Extend drm_client_buffer_delete() to handle the case when there's no
dumb buffer attached and drop the extra kfree.

Fixes: c76f0f7cb546 ("drm: Begin an API for in-kernel clients")
Reported-by: Dan Carpenter 
Cc: Daniel Vetter 
Signed-off-by: Noralf Trønnes 
Reviewed-by: Daniel Vetter 
---

Changes since version 1:
- Let drm_client_buffer_delete() handle all freeing (Daniel Vetter)

 drivers/gpu/drm/drm_client.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
index 9b142f58d489..baff50a4c234 100644
--- a/drivers/gpu/drm/drm_client.c
+++ b/drivers/gpu/drm/drm_client.c
@@ -218,7 +218,9 @@ static void drm_client_buffer_delete(struct 
drm_client_buffer *buffer)
if (buffer->gem)
drm_gem_object_put_unlocked(buffer->gem);
 
-   drm_mode_destroy_dumb(dev, buffer->handle, buffer->client->file);
+   if (buffer->handle)
+   drm_mode_destroy_dumb(dev, buffer->handle, 
buffer->client->file);
+
kfree(buffer);
 }
 
@@ -243,7 +245,7 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 
width, u32 height, u
dumb_args.bpp = drm_format_plane_cpp(format, 0) * 8;
ret = drm_mode_create_dumb(dev, _args, client->file);
if (ret)
-   goto err_free;
+   goto err_delete;
 
buffer->handle = dumb_args.handle;
buffer->pitch = dumb_args.pitch;
@@ -276,8 +278,6 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 
width, u32 height, u
 
 err_delete:
drm_client_buffer_delete(buffer);
-err_free:
-   kfree(buffer);
 
return ERR_PTR(ret);
 }
-- 
2.15.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Intel-gfx] [PATCH v5 13/40] drm/i915: Implement HDCP2.2 Enable and Disable

2018-07-12 Thread Ramalingam C



On Tuesday 10 July 2018 02:18 AM, Sean Paul wrote:

On Wed, Jun 27, 2018 at 02:10:02PM +0530, Ramalingam C wrote:

Implements a sequence of enabling and disabling the HDCP2.2
(auth and encryption).

This is really hard to review, since all I see are stubs. I'd much rather have
each patch do something useful, instead of just call stubs. That said, I don't
have a vested interest in HDCP2.2 on intel, so if others are fine with it, I am
too.

Sean,

Just to avoid the so lengthy patches, I have split the changes in 
logical patches.
Looks like patches 11, 12, 13 and 14 are not so appealing. Merged these 
patches together.

Hope now the series looks more appealing.

Please have a look at the upcoming series version too. Thanks a lot again.

-Ram


Sean


v2:
   Rebased.
v3:
   No Changes.
v4:
   No Changes.
v5:
   Rebased as part of the patch reordering.
   HDCP2 encryption status is tracked.

Signed-off-by: Ramalingam C 
---
  drivers/gpu/drm/i915/intel_hdcp.c | 105 +-
  1 file changed, 104 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c 
b/drivers/gpu/drm/i915/intel_hdcp.c
index 34bafc2025f7..f72684488bc7 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -994,14 +994,117 @@ int intel_hdcp_check_link(struct intel_connector 
*connector)
return ret;
  }
  
+static int hdcp2_close_mei_session(struct intel_connector *connector)

+{
+   struct mei_hdcp_data *data = >hdcp.mei_data;
+   struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
+   struct i915_hdcp_component *comp = dev_priv->hdcp_comp;
+   int ret;
+
+   if (!comp)
+   return -EINVAL;
+
+   mutex_lock(>mutex);
+   if (!comp->ops || !comp->mei_cldev || data->port == INVALID_PORT) {
+   mutex_unlock(>mutex);
+   return -EINVAL;
+   }
+   ret = comp->ops->close_hdcp_session(comp->mei_cldev, data);
+   mutex_unlock(>mutex);
+
+   return ret;
+}
+
+static int hdcp2_deauthenticate_port(struct intel_connector *connector)
+{
+   return hdcp2_close_mei_session(connector);
+}
+
+static int hdcp2_authenticate_sink(struct intel_connector *connector)
+{
+   return 0;
+}
+
+static int hdcp2_enable_encryption(struct intel_connector *connector)
+{
+   return 0;
+}
+
+static int hdcp2_disable_encryption(struct intel_connector *connector)
+{
+   return 0;
+}
+
+static int hdcp2_authenticate_and_encrypt(struct intel_connector *connector)
+{
+   int ret, i, tries = 3;
+
+   for (i = 0; i < tries; i++) {
+   ret = hdcp2_authenticate_sink(connector);
+   if (!ret)
+   break;
+
+   /* Clearing the mei hdcp session */
+   hdcp2_deauthenticate_port(connector);
+   DRM_DEBUG_KMS("HDCP2.2 Auth %d of %d Failed.(%d)\n",
+ i + 1, tries, ret);
+   }
+
+   if (i != tries) {
+   /*
+* Ensuring the required 200mSec min time interval between
+* Session Key Exchange and encryption.
+*/
+   msleep(HDCP_2_2_DELAY_BEFORE_ENCRYPTION_EN);
+   ret = hdcp2_enable_encryption(connector);
+   if (ret < 0) {
+   DRM_DEBUG_KMS("Encryption Enable Failed.(%d)\n", ret);
+   hdcp2_deauthenticate_port(connector);
+   }
+   }
+
+   return ret;
+}
+
  static int _intel_hdcp2_enable(struct intel_connector *connector)
  {
+   struct intel_hdcp *hdcp = >hdcp;
+   int ret;
+
+   DRM_DEBUG_KMS("[%s:%d] HDCP2.2 is being enabled. Type: %d\n",
+ connector->base.name, connector->base.base.id,
+ hdcp->content_type);
+
+   ret = hdcp2_authenticate_and_encrypt(connector);
+   if (ret) {
+   DRM_ERROR("HDCP2 Type%d  Enabling Failed. (%d)\n",
+ hdcp->content_type, ret);
+   return ret;
+   }
+
+   DRM_DEBUG_KMS("[%s:%d] HDCP2.2 is enabled. Type %d\n",
+ connector->base.name, connector->base.base.id,
+ hdcp->content_type);
+
+   hdcp->hdcp2_in_use = true;
+   hdcp->hdcp_value = DRM_MODE_CONTENT_PROTECTION_ENABLED;
+   schedule_work(>hdcp_prop_work);
return 0;
  }
  
  static int _intel_hdcp2_disable(struct intel_connector *connector)

  {
-   return 0;
+   int ret;
+
+   DRM_DEBUG_KMS("[%s:%d] HDCP2.2 is being Disabled\n",
+ connector->base.name, connector->base.base.id);
+
+   ret = hdcp2_disable_encryption(connector);
+
+   hdcp2_deauthenticate_port(connector);
+   connector->hdcp.hdcp2_in_use = false;
+
+   return ret;
  }
  
  static int i915_hdcp_component_master_bind(struct device *dev)

--
2.7.4

___
Intel-gfx mailing list
intel-...@lists.freedesktop.org

Re: [Intel-gfx] [PATCH v5 06/40] drm/i915: Define HDCP2.2 related variables

2018-07-12 Thread Ramalingam C



On Tuesday 10 July 2018 02:01 AM, Sean Paul wrote:

On Wed, Jun 27, 2018 at 02:09:55PM +0530, Ramalingam C wrote:

For upcoming implementation of HDCP2.2 in I915, important variable
required for HDCP2.2 are defined.

Please just introduce them when you use them. I can't provide useful review on
this patch unless I can see how the variables are used. This will also reduce
the series size, which is an added bonus for reviewers :-)

Squashed these change into the subsequent patches.

Ram.


Sean


HDCP_shim is extended to support encoder specific HDCP2.2 flows.

v2:
   1.4 shim is extended to support hdcp2.2. [Sean Paul]
   platform's/panel's hdcp ver capability is removed. [Sean Paul]
   mei references in i915_private are moved to later patches. [Chris Wilson]
v3:
   mei_cl_device ref is moved into intel_hdcp
v4:
   Extra * in comment is removed [Uma]
v5:
   No Change.

Signed-off-by: Ramalingam C 
---
  drivers/gpu/drm/i915/intel_drv.h | 61 
  1 file changed, 61 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index eb480574a92e..b615ea4a44c3 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -29,6 +29,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include "i915_drv.h"
  #include 
@@ -375,6 +376,32 @@ struct intel_hdcp_shim {
/* Detects panel's hdcp capability. This is optional for HDMI. */
int (*hdcp_capable)(struct intel_digital_port *intel_dig_port,
bool *hdcp_capable);
+
+   /* Write HDCP2.2 messages */
+   int (*write_2_2_msg)(struct intel_digital_port *intel_dig_port,
+void *buf, size_t size);
+
+   /* Read HDCP2.2 messages */
+   int (*read_2_2_msg)(struct intel_digital_port *intel_dig_port,
+   uint8_t msg_id, void *buf, size_t size);
+
+   /*
+* Implementation of DP HDCP2.2 Errata for the communication of stream
+* type to Receivers. In DP HDCP2.2 Stream type is one of the input to
+* the HDCP2.2 Chiper for En/De-Cryption. Not applicable for HDMI.
+*/
+   int (*config_stream_type)(struct intel_digital_port *intel_dig_port,
+ void *buf, size_t size);
+
+   /* HDCP2.2 Link Integrity Check */
+   int (*check_2_2_link)(struct intel_digital_port *intel_dig_port);
+
+   /* Detects whether Panel is HDCP2.2 capable */
+   int (*hdcp_2_2_capable)(struct intel_digital_port *intel_dig_port,
+   bool *capable);
+
+   /* Detects the HDCP protocol(DP/HDMI) required on the port */
+   enum hdcp_protocol (*hdcp_protocol)(void);
  };
  
  struct intel_hdcp {

@@ -384,6 +411,40 @@ struct intel_hdcp {
uint64_t hdcp_value;
struct delayed_work hdcp_check_work;
struct work_struct hdcp_prop_work;
+
+   /* HDCP2.2 related definitions */
+   bool hdcp2_supported;
+
+   /*
+* Content Stream Type defined by content owner. TYPE0(0x0) content can
+* flow in the link protected by HDCP2.2 or HDCP1.4, where as TYPE1(0x1)
+* content can flow only through a link protected by HDCP2.2.
+*/
+   u8 content_type;
+
+   bool is_paired;
+   bool is_repeater;
+
+   /*
+* Count of ReceiverID_List received. Initialized to 0 at AKE_INIT.
+* Incremented after processing the RepeaterAuth_Send_ReceiverID_List.
+* When it rolls over re-auth has to be triggered.
+*/
+   uint32_t seq_num_v;
+
+   /*
+* Count of RepeaterAuth_Stream_Manage msg propagated.
+* Initialized to 0 on AKE_INIT. Incremented after every successful
+* transmission of RepeaterAuth_Stream_Manage message. When it rolls
+* over re-Auth has to be triggered.
+*/
+   uint32_t seq_num_m;
+
+   /* mei interface related information */
+   struct mei_cl_device *cldev;
+   struct mei_hdcp_data mei_data;
+
+   struct delayed_work hdcp2_check_work;
  };
  
  struct intel_connector {

--
2.7.4

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


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Intel-gfx] [PATCH v5 12/40] drm/i915: Enable HDCP1.4 incase of HDCP2.2 failure

2018-07-12 Thread Ramalingam C



On Tuesday 10 July 2018 02:14 AM, Sean Paul wrote:

On Wed, Jun 27, 2018 at 02:10:01PM +0530, Ramalingam C wrote:

When HDCP2.2 enabling fails and HDCP1.4 is supported, HDCP1.4 is
enabled.


Just squash this into patch 11, no need for a separate patch.

Doing it in the next version of the series.

Ram.



v2:
   Rebased.
v3:
   No Changes.
v4:
   Reviewed-by is collected.
v5:
   No Change.

Signed-off-by: Ramalingam C 
Reviewed-by: Uma Shankar 
---
  drivers/gpu/drm/i915/intel_hdcp.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c 
b/drivers/gpu/drm/i915/intel_hdcp.c
index b34e3b1587d6..34bafc2025f7 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -863,7 +863,9 @@ int intel_hdcp_enable(struct intel_connector *connector)
 */
if (intel_hdcp2_capable(connector))
ret = _intel_hdcp2_enable(connector);
-   else if (intel_hdcp_capable(connector))
+
+   /* When HDCP2.2 fails, HDCP1.4 will be attempted */
+   if (ret && intel_hdcp_capable(connector))
ret = _intel_hdcp_enable(connector);
  
  	if (!ret) {

--
2.7.4

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


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 11/40] drm/i915: Enable superior HDCP ver that is capable

2018-07-12 Thread Ramalingam C



On Tuesday 10 July 2018 02:14 AM, Sean Paul wrote:

On Wed, Jun 27, 2018 at 02:10:00PM +0530, Ramalingam C wrote:

Considering that HDCP2.2 is more secure than HDCP1.4, When a setup
supports HDCP2.2 and HDCP1.4, HDCP2.2 will be enabled.

v2:
   Included few optimization suggestions [Chris Wilson]
   Commit message is updated as per the rebased version.
v3:
   No changes.
v4:
   Extra comment added and Style issue fixed [Uma]
v5:
   Rebased as part of patch reordering.
   Flag is added for tracking hdcp2.2 encryption status.

Signed-off-by: Ramalingam C 
---
  drivers/gpu/drm/i915/intel_drv.h  |  1 +
  drivers/gpu/drm/i915/intel_hdcp.c | 90 +++
  2 files changed, 83 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 2eeb82b04953..7624388eecd5 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -414,6 +414,7 @@ struct intel_hdcp {
  
  	/* HDCP2.2 related definitions */

bool hdcp2_supported;
+   bool hdcp2_in_use;
  
  	/*

 * Content Stream Type defined by content owner. TYPE0(0x0) content can
diff --git a/drivers/gpu/drm/i915/intel_hdcp.c 
b/drivers/gpu/drm/i915/intel_hdcp.c
index 32a1a3f39b65..b34e3b1587d6 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -21,6 +21,60 @@
 (enum hdcp_physical_port)(port))
  
  static int intel_hdcp2_init(struct intel_connector *connector);

+static int _intel_hdcp2_enable(struct intel_connector *connector);
+static int _intel_hdcp2_disable(struct intel_connector *connector);
+static
+int intel_hdcp_read_valid_bksv(struct intel_digital_port *intel_dig_port,
+  const struct intel_hdcp_shim *shim, u8 *bksv);
+static
+struct intel_digital_port *conn_to_dig_port(struct intel_connector *connector);

Please avoid forward declarations of static functions. Just place things
appropriately in the file.


+
+static bool panel_supports_hdcp(struct intel_connector *connector)
+{
+   struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
+   struct intel_hdcp *hdcp = >hdcp;
+   bool capable = false;
+   u8 bksv[5];
+
+   if (hdcp->hdcp_shim) {

This function can only be called from
intel_hdcp_enable() -> intel_hdcp_capable() -> panel_supports_hdcp()

Both of those preceding functions check if hdcp_shim is NULL.


+   if (hdcp->hdcp_shim->hdcp_capable) {
+   hdcp->hdcp_shim->hdcp_capable(intel_dig_port, );
+   } else {
+   if (!intel_hdcp_read_valid_bksv(intel_dig_port,
+   hdcp->hdcp_shim, bksv))
+   capable = true;
+   }
+   }
+
+   return capable;
+}
+
+static inline
+bool panel_supports_hdcp2(struct intel_connector *connector)
+{
+   struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
+   struct intel_hdcp *hdcp = >hdcp;
+   bool capable = false;
+
+   /* Check the panel's hdcp2.2 compliance if platform supports it. */
+   if (hdcp->hdcp2_supported)
+   hdcp->hdcp_shim->hdcp_2_2_capable(intel_dig_port, );
+
+   return capable;
+}
+
+/* Is HDCP1.4 capable on Platform and Panel */
+static inline bool intel_hdcp_capable(struct intel_connector *connector)
+{
+   return (connector->hdcp.hdcp_shim && panel_supports_hdcp(connector));

As mentioned, the hdcp_shim check is already covered by the caller. The way
things are setup, the shim checks only need to exist at the entry points
(enable/disable/check_link).


+}
+
+/* Is HDCP2.2 capable on Platform and Panel */
+static inline bool intel_hdcp2_capable(struct intel_connector *connector)
+{
+   return (connector->hdcp.hdcp2_supported &&
+   panel_supports_hdcp2(connector));
+}

The panel_supports_* functions don't seem necessary, just do the work in the
intel_hdcp*_capable functions.

  
  static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port,

const struct intel_hdcp_shim *shim)
@@ -796,20 +850,27 @@ int intel_hdcp_init(struct intel_connector *connector,
  int intel_hdcp_enable(struct intel_connector *connector)
  {
struct intel_hdcp *hdcp = >hdcp;
-   int ret;
+   int ret = -EINVAL;
  
  	if (!hdcp->hdcp_shim)

return -ENOENT;
  
  	mutex_lock(>hdcp_mutex);
  
-	ret = _intel_hdcp_enable(connector);

-   if (ret)
-   goto out;
+   /*
+* Considering that HDCP2.2 is more secure than HDCP1.4, If the setup
+* is capable of HDCP2.2, it is preferred to use HDCP2.2.
+*/
+   if (intel_hdcp2_capable(connector))
+   ret = _intel_hdcp2_enable(connector);
+   else if (intel_hdcp_capable(connector))
+   ret = _intel_hdcp_enable(connector);
+
+   

Re: [PATCH V4 2/4] drm/vkms: Add framebuffer and plane helpers

2018-07-12 Thread Daniel Vetter
On Thu, Jul 12, 2018 at 10:41:02AM -0300, Rodrigo Siqueira wrote:
> This patch appends the minimum helpers related to framebuffer and plane
> to make vkms minimally usable.
> 
> Changes since V1:
> - None
> Changes since V2:
> - Squash "Add plane helper struct" and "Add helper for framebuffer
>   create"
> Changes since V3:
>  Daniel Vetter:
>  - Remove atomic_check from plane helper
> 
> Signed-off-by: Rodrigo Siqueira 

Ok I pulled this one in, plus the 3 other patches from v3. Since I pushed
the v3 patches out already I couldn't pick the v4 ones here, hopefully
that didn't create a chaos. Otherwise I guess we'd need a fixup. So please
rebase onto latest drm-misc-next and check it all.

Thanks, Daniel
> ---
>  drivers/gpu/drm/vkms/vkms_drv.c   |  3 +++
>  drivers/gpu/drm/vkms/vkms_plane.c | 11 +++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
> index 6ea2fd97bef9..b5d597a42f20 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.c
> +++ b/drivers/gpu/drm/vkms/vkms_drv.c
> @@ -9,6 +9,8 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>  #include "vkms_drv.h"
>  
>  #define DRIVER_NAME  "vkms"
> @@ -69,6 +71,7 @@ static struct drm_driver vkms_driver = {
>  };
>  
>  static const struct drm_mode_config_funcs vkms_mode_funcs = {
> + .fb_create = drm_gem_fb_create,
>   .atomic_check = drm_atomic_helper_check,
>   .atomic_commit = drm_atomic_helper_commit,
>  };
> diff --git a/drivers/gpu/drm/vkms/vkms_plane.c 
> b/drivers/gpu/drm/vkms/vkms_plane.c
> index 2c25b1d6ab5b..9f75b1e2c1c4 100644
> --- a/drivers/gpu/drm/vkms/vkms_plane.c
> +++ b/drivers/gpu/drm/vkms/vkms_plane.c
> @@ -19,6 +19,15 @@ static const struct drm_plane_funcs vkms_plane_funcs = {
>   .atomic_destroy_state   = drm_atomic_helper_plane_destroy_state,
>  };
>  
> +static void vkms_primary_plane_update(struct drm_plane *plane,
> +   struct drm_plane_state *old_state)
> +{
> +}
> +
> +static const struct drm_plane_helper_funcs vkms_primary_helper_funcs = {
> + .atomic_update  = vkms_primary_plane_update,
> +};
> +
>  struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev)
>  {
>   struct drm_device *dev = >drm;
> @@ -42,5 +51,7 @@ struct drm_plane *vkms_plane_init(struct vkms_device 
> *vkmsdev)
>   return ERR_PTR(ret);
>   }
>  
> + drm_plane_helper_add(plane, _primary_helper_funcs);
> +
>   return plane;
>  }
> -- 
> 2.18.0
> 

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


[Bug 104611] [fiji, polaris10] BUG: unable to handle kernel NULL pointer dereference when waking up displays with amdgpu.dc=1

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=104611

--- Comment #9 from Vedran Miletić  ---
Created attachment 140595
  --> https://bugs.freedesktop.org/attachment.cgi?id=140595=edit
dmesg with fiji amdgpu.dc_log=1

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 104611] [fiji, polaris10] BUG: unable to handle kernel NULL pointer dereference when waking up displays with amdgpu.dc=1

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=104611

--- Comment #8 from Vedran Miletić  ---
This still occurs on 4.17, despite bug 106194 suggesting otherwise:

[ 7670.095885] BUG: unable to handle kernel NULL pointer dereference at
0208
[ 7670.095899] PGD 8003fcee8067 P4D 8003fcee8067 PUD 3fcee6067 PMD 0
[ 7670.095913] Oops:  [#1] SMP PTI
[ 7670.095917] Modules linked in: fuse rpcsec_gss_krb5 nfsv4 dns_resolver nfs
lockd grace fscache vfat fat intel_rapl x86_pkg_temp_thermal intel_powerclamp
coretemp kvm eeepc_wmi irqbypass asus_wmi joydev crct10dif_pclmul crc32_pclmul
sparse_keymap ghash_clmulni_intel intel_cstate rfkill iTCO_wdt intel_uncore
wmi_bmof mei_wdt iTCO_vendor_support mxm_wmi mei_me ppdev mei intel_rapl_perf
wmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_codec_hdmi video
i2c_i801 snd_hda_intel acpi_pad snd_hda_codec snd_hda_core snd_hwdep parport_pc
parport shpchp snd_seq snd_seq_device snd_pcm snd_timer snd soundcore
binfmt_misc auth_rpcgss sunrpc amdkfd amd_iommu_v2 amdgpu chash i2c_algo_bit
gpu_sched drm_kms_helper ttm r8169 drm crc32c_intel mii hid_cherry  
[ 7670.096014] CPU: 7 PID: 934 Comm: Xorg Not tainted 4.17.4-200.fc28.x86_64 #1
[ 7670.096018] Hardware name: Transtec AG   /B150M-C, BIOS 3601 12/12/2017
[ 7670.096169] RIP: 0010:create_stream_for_sink+0x2cd/0x650 [amdgpu]
[ 7670.096174] RSP: 0018:abfbc20e79d0 EFLAGS: 00010246
[ 7670.096179] RAX:  RBX: 9d9b7ded8000 RCX:

[ 7670.096184] RDX: 0013 RSI: c0757400 RDI:
9d9b7ded80ac
[ 7670.096188] RBP: abfbc20e7b10 R08: 0f00 R09:
0870
[ 7670.096192] R10: 9d9b7ded8000 R11: 0f00 R12:
9d9ba32b1000
[ 7670.096197] R13:  R14: 9d98c0a0c200 R15:
9d99495d8000
[ 7670.096202] FS:  7fa0d0017ac0() GS:9d9bb5dc()
knlGS:
[ 7670.096207] CS:  0010 DS:  ES:  CR0: 80050033
[ 7670.096211] CR2: 0208 CR3: 0003fcf16003 CR4:
003606e0
[ 7670.096216] DR0:  DR1:  DR2:

[ 7670.096220] DR3:  DR6: fffe0ff0 DR7:
0400
[ 7670.096223] Call Trace:
[ 7670.096370]  dm_update_crtcs_state+0x26c/0x4d0 [amdgpu]
[ 7670.096510]  amdgpu_dm_atomic_check+0x1b1/0x3b0 [amdgpu]
[ 7670.096552]  drm_atomic_check_only+0x360/0x4f0 [drm]
[ 7670.096587]  drm_atomic_commit+0x13/0x50 [drm]
[ 7670.096619]  drm_atomic_connector_commit_dpms+0xdb/0x100 [drm]
[ 7670.096652]  drm_mode_obj_set_property_ioctl+0x178/0x280 [drm]
[ 7670.096686]  ? drm_mode_connector_set_obj_prop+0x80/0x80 [drm]
[ 7670.096715]  drm_mode_connector_property_set_ioctl+0x39/0x60 [drm]
[ 7670.096744]  drm_ioctl_kernel+0x5b/0xb0 [drm]
[ 7670.096772]  drm_ioctl+0x1b3/0x370 [drm]
[ 7670.096801]  ? drm_mode_connector_set_obj_prop+0x80/0x80 [drm]
[ 7670.096898]  amdgpu_drm_ioctl+0x49/0x80 [amdgpu]
[ 7670.096910]  do_vfs_ioctl+0xa4/0x610
[ 7670.096918]  ksys_ioctl+0x60/0x90
[ 7670.096925]  __x64_sys_ioctl+0x16/0x20
[ 7670.096934]  do_syscall_64+0x5b/0x160
[ 7670.096944]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 7670.096951] RIP: 0033:0x7fa0cd2dbe17
[ 7670.096955] RSP: 002b:7ffc439d2b38 EFLAGS: 0246 ORIG_RAX:
0010
[ 7670.096962] RAX: ffda RBX: 022374b0 RCX:
7fa0cd2dbe17
[ 7670.096966] RDX: 7ffc439d2b70 RSI: c01064ab RDI:
000c
[ 7670.096970] RBP: 7ffc439d2b70 R08:  R09:
02236100
[ 7670.096974] R10: 0018 R11: 0246 R12:
c01064ab
[ 7670.096978] R13: 000c R14: 02237940 R15:
0223b001
[ 7670.096983] Code: 49 c7 87 28 60 00 00 00 00 00 00 4c 89 bb 98 01 00 00 e8
c7 f9 ff ff 4d 8b ac 24 50 04 00 00 ba 13 00 00 00 48 8d bb ac 00 00 00 <41> 0f
b7 85 08 02 00 00 49 8d b5 12 02 00 00 89 83 c0 00 00 00
[ 7670.097204] RIP: create_stream_for_sink+0x2cd/0x650 [amdgpu] RSP:
abfbc20e79d0
[ 7670.097208] CR2: 0208
[ 7670.097214] ---[ end trace bfc39023ec02bc67 ]---

(In reply to Harry Wentland from comment #7)
> Did you have a chance to capture a repro dmesg with dc_log=1?

Doesn't seem to change anything in the output, but I'll attach it.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Intel-gfx] [PATCH] i915/intel_tv_get_modes: fix strncpy truncation warning

2018-07-12 Thread Ville Syrjälä
On Thu, Jul 12, 2018 at 03:55:26PM +0200, Dominique Martinet wrote:
> Ville Syrjälä wrote on Thu, Jul 12, 2018:
> > On Wed, Jul 11, 2018 at 09:46:15AM +0200, Dominique Martinet wrote:
> > > This is effectively no-op as the next line writes a nul at the final
> > 
> > What is "This". Please write self contained commit messages.
> 
> This could either be 'this commit' as a whole or if you look only at the
> commit message 'this strncpy fix' from the title (which is arguably the
> same), and both interpretations sound fairly understandable in the
> context of the title line without seeing the patch to me... Although
> I'll admit this is difficult to judge of that as the author.

The patch subject is not part of the commit message body though. This is
made all the more clear when I'm editing the response in vim that doesn't
even show the mail subject to me. Hence I'm always left in the dark by
commit messages that aren't fully self contained.

> 
> Thanksfully, the v2 of the patch didn't use this wording but while I
> agree the message could be better I do not think it was horrible.
> 
> 
> > > drivers/gpu/drm/i915/intel_tv.c: In function ‘intel_tv_get_modes’:
> > > drivers/gpu/drm/i915/intel_tv.c:1358:3: error: ‘strncpy’ specified bound 
> > > 32 equals destination size [-Werror=stringop-truncation]
> > >strncpy(mode_ptr->name, input->name, DRM_DISPLAY_MODE_LEN);
> > >^~
> > > cc1: all warnings being treated as errors
> > 
> > That warning should be in the actual commit message.
> 
> Yes and no, I gave it for referrence but when you update to gcc 8 you
> will literally see it all over the place.
> The words "strncpy truncation warning" is really precise once you've
> seen them a few times and there are litteraly hundred of these warnings
> in the kernel, some have already been fixed taking a glance at the git
> log, some with and without the warning message.
> I don't think it's worth polluting the git log with this many
> warnings... Which leads to...

I disagree. Without knowing what exactly is fixed how can you judge 
whether the patch even makes sense? And later you may get another
report of the same warning and then you would want to look through
the git log to see if there's a patch that already fixed it. Quite
hard to do without the exact warning in the log.

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


Re: [PATCH 04/15] drm/doc: polish for sturct drm_connector

2018-07-12 Thread Sean Paul
On Mon, Jul 09, 2018 at 10:40:05AM +0200, Daniel Vetter wrote:
> - switch everything over to inline comments
> - add notes about locking, links to functions and other related stuff
> - also include a note about Ville's soon-to-be-merged
>   drm_connector_for_each_possible_encoder().
> 
> Also check that all the hyperlinks in drm_connector.h work and fix
> them as needed.
> 
> Signed-off-by: Daniel Vetter 

Reviewed-by: Sean Paul 

> ---
>  include/drm/drm_connector.h | 191 ++--
>  1 file changed, 120 insertions(+), 71 deletions(-)
> 
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 6028638f3108..a0300e3468cb 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -557,8 +557,7 @@ struct drm_connector_funcs {
>* received for this output connector->edid must be NULL.
>*
>* Drivers using the probe helpers should use
> -  * drm_helper_probe_single_connector_modes() or
> -  * drm_helper_probe_single_connector_modes_nomerge() to implement this
> +  * drm_helper_probe_single_connector_modes() to implement this
>* function.
>*
>* RETURNS:
> @@ -769,45 +768,6 @@ struct drm_cmdline_mode {
>  
>  /**
>   * struct drm_connector - central DRM connector control structure
> - * @dev: parent DRM device
> - * @kdev: kernel device for sysfs attributes
> - * @attr: sysfs attributes
> - * @head: list management
> - * @base: base KMS object
> - * @name: human readable name, can be overwritten by the driver
> - * @connector_type: one of the DRM_MODE_CONNECTOR_ types from drm_mode.h
> - * @connector_type_id: index into connector type enum
> - * @interlace_allowed: can this connector handle interlaced modes?
> - * @doublescan_allowed: can this connector handle doublescan?
> - * @stereo_allowed: can this connector handle stereo modes?
> - * @funcs: connector control functions
> - * @edid_blob_ptr: DRM property containing EDID if present
> - * @properties: property tracking for this connector
> - * @dpms: current dpms state
> - * @helper_private: mid-layer private data
> - * @cmdline_mode: mode line parsed from the kernel cmdline for this connector
> - * @force: a DRM_FORCE_ state for forced mode sets
> - * @override_edid: has the EDID been overwritten through debugfs for testing?
> - * @encoder_ids: valid encoders for this connector
> - * @eld: EDID-like data, if present
> - * @latency_present: AV delay info from ELD, if found
> - * @video_latency: video latency info from ELD, if found
> - * @audio_latency: audio latency info from ELD, if found
> - * @null_edid_counter: track sinks that give us all zeros for the EDID
> - * @bad_edid_counter: track sinks that give us an EDID with invalid checksum
> - * @edid_corrupt: indicates whether the last read EDID was corrupt
> - * @debugfs_entry: debugfs directory for this connector
> - * @has_tile: is this connector connected to a tiled monitor
> - * @tile_group: tile group for the connected monitor
> - * @tile_is_single_monitor: whether the tile is one monitor housing
> - * @num_h_tile: number of horizontal tiles in the tile group
> - * @num_v_tile: number of vertical tiles in the tile group
> - * @tile_h_loc: horizontal location of this tile
> - * @tile_v_loc: vertical location of this tile
> - * @tile_h_size: horizontal size of this tile.
> - * @tile_v_size: vertical size of this tile.
> - * @scaling_mode_property:  Optional atomic property to control the 
> upscaling.
> - * @content_protection_property: Optional property to control content 
> protection
>   *
>   * Each connector may be connected to one or more CRTCs, or may be clonable 
> by
>   * another connector if they can share a CRTC.  Each connector also has a 
> specific
> @@ -815,13 +775,27 @@ struct drm_cmdline_mode {
>   * span multiple monitors).
>   */
>  struct drm_connector {
> + /** @dev: parent DRM device */
>   struct drm_device *dev;
> + /** @kdev: kernel device for sysfs attributes */
>   struct device *kdev;
> + /** @attr: sysfs attributes */
>   struct device_attribute *attr;
> +
> + /**
> +  * @head:
> +  *
> +  * List of all connectors on a @dev, linked from
> +  * _mode_config.connector_list. Protected by
> +  * _mode_config.connector_list_lock, but please only use
> +  * _connector_list_iter to walk this list.
> +  */
>   struct list_head head;
>  
> + /** @base: base KMS object */
>   struct drm_mode_object base;
>  
> + /** @name: human readable name, can be overwritten by the driver */
>   char *name;
>  
>   /**
> @@ -839,10 +813,30 @@ struct drm_connector {
>*/
>   unsigned index;
>  
> + /**
> +  * @connector_type:
> +  * one of the DRM_MODE_CONNECTOR_ types from drm_mode.h
> +  */
>   int connector_type;
> + /** @connector_type_id: index into connector type enum */
>   int connector_type_id;
> + /**
> +  * @interlace_allowed:
> 

[Bug 107082] With 4.18 rc kernel stop working video output on AMD GPU Vega 56

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107082

--- Comment #3 from Harry Wentland  ---
Created attachment 140594
  --> https://bugs.freedesktop.org/attachment.cgi?id=140594=edit
[PATCH] drm/amd/display: Convert 10kHz clks from PPLib into kHz for Vega

Don't think the other patch would apply to 4.18 but this one should. There's
been a bunch of work on the powerplay/DC interface, so this looks different for
4.18 and amd-stg.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 03/15] drm/doc: switch drm_connector_state to inline comments

2018-07-12 Thread Sean Paul
On Mon, Jul 09, 2018 at 10:40:04AM +0200, Daniel Vetter wrote:
> For consistency. Also spelled out the docs for ->best_encoder a bit
> more while at it.
> 
> Signed-off-by: Daniel Vetter 

Reviewed-by: Sean Paul 

> ---
>  include/drm/drm_connector.h | 14 ++
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index ad397dfc042b..6028638f3108 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -374,12 +374,9 @@ struct drm_tv_connector_state {
>  
>  /**
>   * struct drm_connector_state - mutable connector state
> - * @connector: backpointer to the connector
> - * @best_encoder: can be used by helpers and drivers to select the encoder
> - * @state: backpointer to global drm_atomic_state
> - * @tv: TV connector state
>   */
>  struct drm_connector_state {
> + /** @connector: backpointer to the connector */
>   struct drm_connector *connector;
>  
>   /**
> @@ -390,6 +387,13 @@ struct drm_connector_state {
>*/
>   struct drm_crtc *crtc;
>  
> + /**
> +  * @best_encoder:
> +  *
> +  * Used by the atomic helpers to select the encoder, through the
> +  * _connector_helper_funcs.atomic_best_encoder or
> +  * _connector_helper_funcs.best_encoder callbacks.
> +  */
>   struct drm_encoder *best_encoder;
>  
>   /**
> @@ -398,6 +402,7 @@ struct drm_connector_state {
>*/
>   enum drm_link_status link_status;
>  
> + /** @state: backpointer to global drm_atomic_state */
>   struct drm_atomic_state *state;
>  
>   /**
> @@ -407,6 +412,7 @@ struct drm_connector_state {
>*/
>   struct drm_crtc_commit *commit;
>  
> + /** @tv: TV connector state */
>   struct drm_tv_connector_state tv;
>  
>   /**
> -- 
> 2.18.0
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] ARM: dts: imx6sl: Add vivante gpu nodes

2018-07-12 Thread Lucas Stach
Am Donnerstag, den 12.07.2018, 16:37 +0300 schrieb Leonard Crestez:
> The imx6sl soc has gpu_2d and gpu_vg, no 3d support:
> 
> etnaviv-gpu 220.gpu: model: GC320, revision: 5007
> etnaviv-gpu 2204000.gpu: model: GC355, revision: 1215
> 
> The IP blocks are close enough to supported hardware that they "just
> work" with etnaviv and x11.

According to the kernel log above, they aren't just close enough, but
actually the same revision as the cores on the i.MX6Q.

> Signed-off-by: Leonard Crestez 

I think this DT is ordered by unit address, so both GPU nodes should
move to the end of the dts file, right?

With this fixed:
Reviewed-by: Lucas Stach 

> 
> ---
>  arch/arm/boot/dts/imx6sl.dtsi | 20 
>  1 file changed, 20 insertions(+)
> 
> Tested by using yocto fsl community bsp built in "mainline" mode.
> This
> patch makes x11 start up and turning on drm.debug shows that the
> etnaviv
> driver is being used.
> 
> I don't know if such a patch requires much more testing: all it
> really
> does is "describe the hardware".
> 
> Patch is against shawguo/imx/dt, it depends on newly accepted
> commit 13211eec7b0e ("ARM: dts: imx6sl: Convert gpc to new bindings")
> This is only because of the way it references the PU power domain.
> 
> diff --git a/arch/arm/boot/dts/imx6sl.dtsi
> b/arch/arm/boot/dts/imx6sl.dtsi
> index a6bc21433839..49a56b4fd393 100644
> --- a/arch/arm/boot/dts/imx6sl.dtsi
> +++ b/arch/arm/boot/dts/imx6sl.dtsi
> @@ -130,10 +130,30 @@
>   cache-level = <2>;
>   arm,tag-latency = <4 2 3>;
>   arm,data-latency = <4 2 3>;
>   };
>  
> + gpu_2d: gpu@220 {
> + compatible = "vivante,gc";
> + reg = <0x0220 0x4000>;
> + interrupts = <0 10 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = < IMX6SL_CLK_MMDC_ROOT>,
> +  < IMX6SL_CLK_GPU2D_OVG>;
> + clock-names = "bus", "core";
> + power-domains = <_pu>;
> + };
> +
> + gpu_vg: gpu@2204000 {
> + compatible = "vivante,gc";
> + reg = <0x02204000 0x4000>;
> + interrupts = <0 11 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = < IMX6SL_CLK_MMDC_ROOT>,
> +  < IMX6SL_CLK_GPU2D_OVG>;
> + clock-names = "bus", "core";
> + power-domains = <_pu>;
> + };
> +
>   aips1: aips-bus@200 {
>   compatible = "fsl,aips-bus", "simple-bus";
>   #address-cells = <1>;
>   #size-cells = <1>;
>   reg = <0x0200 0x10>;
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 02/15] drm: Drop drmP.h from drm_connector.c

2018-07-12 Thread Sean Paul
On Mon, Jul 09, 2018 at 10:40:03AM +0200, Daniel Vetter wrote:
> Only needed minimal changes in drm_internal.h (for the drm_ioctl_t
> type and a few forward declarations), plus a few missing includes in
> drm_connector.c.
> 
> Yay, the last stage of the drm header cleanup can finally commence!
> 
> Note: This needs the patch to move for_each_if from drmP.h to kernel.h
> or it won't compile.
> 
> Signed-off-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/drm_connector.c | 6 +-
>  drivers/gpu/drm/drm_internal.h  | 5 +
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 5ada0640de5a..dc5a480200d8 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -20,11 +20,15 @@
>   * OF THIS SOFTWARE.
>   */
>  
> -#include 
>  #include 
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
> +#include 

Whether intentional, or by luck, these were alphabetical. Can we please keep
this convention?

With that nit and for_each_if,

Reviewed-by: Sean Paul 


> +
> +#include 
>  
>  #include "drm_crtc_internal.h"
>  #include "drm_internal.h"
> diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
> index 40179c5fc6b8..0c4eb4a9ab31 100644
> --- a/drivers/gpu/drm/drm_internal.h
> +++ b/drivers/gpu/drm/drm_internal.h
> @@ -21,9 +21,14 @@
>   * OTHER DEALINGS IN THE SOFTWARE.
>   */
>  
> +#include 
> +
>  #define DRM_IF_MAJOR 1
>  #define DRM_IF_MINOR 4
>  
> +struct drm_prime_file_private;
> +struct dma_buf;
> +
>  /* drm_file.c */
>  extern struct mutex drm_global_mutex;
>  struct drm_file *drm_file_alloc(struct drm_minor *minor);
> -- 
> 2.18.0
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 01/15] drm: move drv test macros out of drmP.h

2018-07-12 Thread Sean Paul
On Mon, Jul 09, 2018 at 10:40:02AM +0200, Daniel Vetter wrote:
> Last bit the prevented us from starting to delete the drmP.h monster
> includes from source files!
> 
> Also add kernel-doc while moving them.
> 
> A nice consistent drm_dev_ prefix would be cute for these, but since
> they're used everywhere I've figured I'll leave this bikeshed aside
> for now.
> 
> Signed-off-by: Daniel Vetter 

Reviewed-by: Sean Paul 

> ---
>  include/drm/drmP.h| 19 ---
>  include/drm/drm_drv.h | 29 +
>  2 files changed, 29 insertions(+), 19 deletions(-)
> 
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index c5dfbdb7271d..f7a19c2a7a80 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -102,25 +102,6 @@ struct pci_controller;
>  #define DRM_SWITCH_POWER_CHANGING 2
>  #define DRM_SWITCH_POWER_DYNAMIC_OFF 3
>  
> -static inline bool drm_core_check_feature(struct drm_device *dev, int 
> feature)
> -{
> - return dev->driver->driver_features & feature;
> -}
> -
> -/**
> - * drm_drv_uses_atomic_modeset - check if the driver implements
> - * atomic_commit()
> - * @dev: DRM device
> - *
> - * This check is useful if drivers do not have DRIVER_ATOMIC set but
> - * have atomic modesetting internally implemented.
> - */
> -static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev)
> -{
> - return drm_core_check_feature(dev, DRIVER_ATOMIC) ||
> - dev->mode_config.funcs->atomic_commit != NULL;
> -}
> -
>  /* returns true if currently okay to sleep */
>  static inline bool drm_can_sleep(void)
>  {
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index 7e545f5f94d3..46a8009784df 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -649,6 +649,35 @@ static inline bool drm_dev_is_unplugged(struct 
> drm_device *dev)
>   return true;
>  }
>  
> +/**
> + * drm_core_check_feature - check driver feature flags
> + * @dev: DRM device to check
> + * @feature: feature flag
> + *
> + * This checks @dev for driver features, see _driver.driver_features and 
> the
> + * various DRIVER_\* flags.
> + *
> + * Returns true if the @feature is supported, false otherwise.
> + */
> +static inline bool drm_core_check_feature(struct drm_device *dev, int 
> feature)
> +{
> + return dev->driver->driver_features & feature;
> +}
> +
> +/**
> + * drm_drv_uses_atomic_modeset - check if the driver implements
> + * atomic_commit()
> + * @dev: DRM device
> + *
> + * This check is useful if drivers do not have DRIVER_ATOMIC set but
> + * have atomic modesetting internally implemented.
> + */
> +static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev)
> +{
> + return drm_core_check_feature(dev, DRIVER_ATOMIC) ||
> + dev->mode_config.funcs->atomic_commit != NULL;
> +}
> +
>  
>  int drm_dev_set_unique(struct drm_device *dev, const char *name);
>  
> -- 
> 2.18.0
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 15/15] drm: drop drmP.h include from drm_crtc.c

2018-07-12 Thread Sean Paul
On Mon, Jul 09, 2018 at 10:40:16AM +0200, Daniel Vetter wrote:
> This is starting to become easy!
> 
> Note: This needs the patch to move for_each_if from drmP.h to kernel.h
> or it won't compile.
> 
> Signed-off-by: Daniel Vetter 

Once for_each_if gets sorted out (however it goes).

Reviewed-by: Sean Paul 

> ---
>  drivers/gpu/drm/drm_crtc.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index a6906c4ab880..30f93e460f4e 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -34,7 +34,7 @@
>  #include 
>  #include 
>  #include 
> -#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -42,6 +42,9 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
> +#include 
>  
>  #include "drm_crtc_internal.h"
>  #include "drm_internal.h"
> -- 
> 2.18.0
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/3] drm: mxsfb: Change driver.name to mxsfb-drm

2018-07-12 Thread Stefan Agner
On 12.07.2018 15:03, Leonard Crestez wrote:
> On Thu, 2018-07-12 at 11:21 +0200, Stefan Agner wrote:
>> On 10.07.2018 11:11, Marek Vasut wrote:
>> > On 07/10/2018 11:06 AM, Stefan Agner wrote:
>> > > This is one of the situation where states quo is kinda the worst
>> > > situation.
>> > >
>> > > Currently imx_v6_v7_defconfig and mxs_defconfig actually still uses
>> > > CONFIG_FB_MXS.
>> > >
>> > > I understand that you'd rather prefer to move forward. I suggest we do
>> > > it in steps.
>> > >
>> > > In 4.19:
>> > >
>> > > - Change DRM driver.name to mxsfb-drm so we avoid conflicts for now
>> >
>> > But this will break mesa if it depends on mxsfb name for ie. etnaviv
>> > binding.
>>
>> Does it? grep -r -e mxsfb in libdrm and mesa master returns nothing.
>>
>> There is also .name in struct drm_driver, which is already set to
>> mxsfb-drm... Is that the one exposed to user space?
> 
> Running etnaviv+x11 with a renamed mxsfb driver works fine on imx6sx-
> sdb.
> 
> Tools like modetest already need -M mxsfb-drm, the drm_driver.name
> seems to be what matters.

Ok, almost thought so, thanks for the confirmation! So we should be
good.

> 
>> - Remove CONFIG_FB_MXS from imx_v6_v7_defconfig/mxs_defconfig now, and
>> only enable CONFIG_DRM_MXSFB=y
> 
> If one of the drivers is renamed then they can coexist: since the
> bindings are distinct one driver will return a probe error and the
> other will bind successfully. This can even be adjusted so that it
> doesn't even print ugly scary errors.
> 
> This can last until somebody implements support for old bindings in the
> drm driver and then FB_MXS can just be deleted.

Yeah I guess that is what Marek don't want because it promotes using
FB_MXS for longer than needed.

I don't care as much since we anyway use the MXSFB DRM driver. However,
what I really dislike is that a kernel compiled with both drivers
currently leads to MXSFB DRM being unusable (because fbdev gets probed
first). I feel removing the MXS_FB is rather harsh, so I *really* would
love to see the MXSFB DRM driver renamed.

--
Stefan
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] ARM: dts: imx6sl: Add vivante gpu nodes

2018-07-12 Thread Fabio Estevam
Hi Leonard,

On Thu, Jul 12, 2018 at 10:37 AM, Leonard Crestez
 wrote:

> diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
> index a6bc21433839..49a56b4fd393 100644
> --- a/arch/arm/boot/dts/imx6sl.dtsi
> +++ b/arch/arm/boot/dts/imx6sl.dtsi
> @@ -130,10 +130,30 @@
> cache-level = <2>;
> arm,tag-latency = <4 2 3>;
> arm,data-latency = <4 2 3>;
> };
>
> +   gpu_2d: gpu@220 {
> +   compatible = "vivante,gc";
> +   reg = <0x0220 0x4000>;
> +   interrupts = <0 10 IRQ_TYPE_LEVEL_HIGH>;
> +   clocks = < IMX6SL_CLK_MMDC_ROOT>,
> +< IMX6SL_CLK_GPU2D_OVG>;
> +   clock-names = "bus", "core";
> +   power-domains = <_pu>;
> +   };
> +
> +   gpu_vg: gpu@2204000 {
> +   compatible = "vivante,gc";
> +   reg = <0x02204000 0x4000>;
> +   interrupts = <0 11 IRQ_TYPE_LEVEL_HIGH>;
> +   clocks = < IMX6SL_CLK_MMDC_ROOT>,
> +< IMX6SL_CLK_GPU2D_OVG>;
> +   clock-names = "bus", "core";
> +   power-domains = <_pu>;
> +   };
> +
> aips1: aips-bus@200 {

We try to keep the peripherals sorted by address range in dtsi, so
please put the gpu nodes below aips2.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH V4 4/4] drm/vkms: Add vblank events simulated by hrtimers

2018-07-12 Thread Rodrigo Siqueira
This commit adds regular vblank events simulated through hrtimers, which
is a feature required by VKMS to mimic real hardware. Additionally, all
the vblank event send after pageflip is kept in the atomic_flush
function.

Changes since V1:
 - Compute the vblank timer interval per interruption
 Ville Syrjälä and Daniel Vetter:
 - Removes hardcoded vblank interval to get it from user space

Changes since V2:
 Chris Wilson
 - Removes unnecessary algorithm to compute the next period
 Daniel Vetter:
 - Uses drm_calc_timestamping_constants to get the vblank interval
   instead of calculating it manually
 - Adds disable_vblank helper that turns of crtc
 - Simplifies implementation by using drm_crtc_arm_vblank_event
 - Replaces the code in atomic_begin to atomic_flush
 - Removes unnecessary field in vkms_output

Changes since V3:
 Daniel Vetter:
 - Squash "drm/vkms: Add atomic helpers functions" into the commit that
   handling vblank events simulated by hrtimers

Signed-off-by: Rodrigo Siqueira 
---
 drivers/gpu/drm/vkms/vkms_crtc.c | 95 
 drivers/gpu/drm/vkms/vkms_drv.c  |  9 +++
 drivers/gpu/drm/vkms/vkms_drv.h  | 15 +
 3 files changed, 119 insertions(+)

diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
index bf76cd39ece7..875fca662ac0 100644
--- a/drivers/gpu/drm/vkms/vkms_crtc.c
+++ b/drivers/gpu/drm/vkms/vkms_crtc.c
@@ -10,6 +10,60 @@
 #include 
 #include 
 
+static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer)
+{
+   struct vkms_output *output = container_of(timer, struct vkms_output,
+ vblank_hrtimer);
+   struct drm_crtc *crtc = >crtc;
+   int ret_overrun;
+   bool ret;
+
+   ret = drm_crtc_handle_vblank(crtc);
+   if (!ret)
+   DRM_ERROR("vkms failure on handling vblank");
+
+   ret_overrun = hrtimer_forward_now(>vblank_hrtimer,
+ output->period_ns);
+
+   return HRTIMER_RESTART;
+}
+
+static int vkms_enable_vblank(struct drm_crtc *crtc)
+{
+   struct drm_device *dev = crtc->dev;
+   unsigned int pipe = drm_crtc_index(crtc);
+   struct drm_vblank_crtc *vblank = >vblank[pipe];
+   struct vkms_output *out = drm_crtc_to_vkms_output(crtc);
+
+   drm_calc_timestamping_constants(crtc, >mode);
+
+   hrtimer_init(>vblank_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+   out->vblank_hrtimer.function = _vblank_simulate;
+   out->period_ns = ktime_set(0, vblank->framedur_ns);
+   hrtimer_start(>vblank_hrtimer, out->period_ns, HRTIMER_MODE_REL);
+
+   return 0;
+}
+
+static void vkms_disable_vblank(struct drm_crtc *crtc)
+{
+   struct vkms_output *out = drm_crtc_to_vkms_output(crtc);
+
+   hrtimer_cancel(>vblank_hrtimer);
+}
+
+bool vkms_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,
+  int *max_error, ktime_t *vblank_time,
+  bool in_vblank_irq)
+{
+   struct vkms_device *vkmsdev = drm_device_to_vkms_device(dev);
+   struct vkms_output *output = >output;
+
+   *vblank_time = output->vblank_hrtimer.node.expires;
+
+   return true;
+}
+
 static const struct drm_crtc_funcs vkms_crtc_funcs = {
.set_config = drm_atomic_helper_set_config,
.destroy= drm_crtc_cleanup,
@@ -17,6 +71,45 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = {
.reset  = drm_atomic_helper_crtc_reset,
.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
.atomic_destroy_state   = drm_atomic_helper_crtc_destroy_state,
+   .enable_vblank  = vkms_enable_vblank,
+   .disable_vblank = vkms_disable_vblank,
+};
+
+static void vkms_crtc_atomic_enable(struct drm_crtc *crtc,
+   struct drm_crtc_state *old_state)
+{
+   drm_crtc_vblank_on(crtc);
+}
+
+static void vkms_crtc_atomic_disable(struct drm_crtc *crtc,
+struct drm_crtc_state *old_state)
+{
+   drm_crtc_vblank_off(crtc);
+}
+
+static void vkms_crtc_atomic_flush(struct drm_crtc *crtc,
+  struct drm_crtc_state *old_crtc_state)
+{
+   unsigned long flags;
+
+   if (crtc->state->event) {
+   spin_lock_irqsave(>dev->event_lock, flags);
+
+   if (drm_crtc_vblank_get(crtc) != 0)
+   drm_crtc_send_vblank_event(crtc, crtc->state->event);
+   else
+   drm_crtc_arm_vblank_event(crtc, crtc->state->event);
+
+   spin_unlock_irqrestore(>dev->event_lock, flags);
+
+   crtc->state->event = NULL;
+   }
+}
+
+static const struct drm_crtc_helper_funcs vkms_crtc_helper_funcs = {
+   .atomic_flush   = vkms_crtc_atomic_flush,
+   .atomic_enable  = vkms_crtc_atomic_enable,
+   .atomic_disable = vkms_crtc_atomic_disable,
 };
 
 

[PATCH V4 1/4] drm/vkms: Add dumb operations

2018-07-12 Thread Rodrigo Siqueira
VKMS currently does not handle dumb data, and as a consequence, it does
not provide mechanisms for handling gem. This commit adds the necessary
support for gem object/handler and the dumb functions.

Changes since V1:
 Daniel Vetter:
 - Add dumb buffer support to the same patchset
Changes since V2:
 Haneen:
 - Add missing gem_free_object_unlocked callback to fix the warning
   "Memory manager not clean during takedown"
Changes since V3:
 - None

Signed-off-by: Rodrigo Siqueira 
---
 drivers/gpu/drm/vkms/Makefile   |   2 +-
 drivers/gpu/drm/vkms/vkms_drv.c |  10 ++
 drivers/gpu/drm/vkms/vkms_drv.h |  23 
 drivers/gpu/drm/vkms/vkms_gem.c | 179 
 4 files changed, 213 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/vkms/vkms_gem.c

diff --git a/drivers/gpu/drm/vkms/Makefile b/drivers/gpu/drm/vkms/Makefile
index 3f774a6a9c58..986297da51bf 100644
--- a/drivers/gpu/drm/vkms/Makefile
+++ b/drivers/gpu/drm/vkms/Makefile
@@ -1,3 +1,3 @@
-vkms-y := vkms_drv.o vkms_plane.o vkms_output.o vkms_crtc.o
+vkms-y := vkms_drv.o vkms_plane.o vkms_output.o vkms_crtc.o vkms_gem.o
 
 obj-$(CONFIG_DRM_VKMS) += vkms.o
diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index 740a4cbfed91..6ea2fd97bef9 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -37,6 +37,12 @@ static const struct file_operations vkms_driver_fops = {
.release= drm_release,
 };
 
+static const struct vm_operations_struct vkms_gem_vm_ops = {
+   .fault = vkms_gem_fault,
+   .open = drm_gem_vm_open,
+   .close = drm_gem_vm_close,
+};
+
 static void vkms_release(struct drm_device *dev)
 {
struct vkms_device *vkms = container_of(dev, struct vkms_device, drm);
@@ -50,6 +56,10 @@ static struct drm_driver vkms_driver = {
.driver_features= DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_GEM,
.release= vkms_release,
.fops   = _driver_fops,
+   .dumb_create= vkms_dumb_create,
+   .dumb_map_offset= vkms_dumb_map,
+   .gem_vm_ops = _gem_vm_ops,
+   .gem_free_object_unlocked = vkms_gem_free_object,
 
.name   = DRIVER_NAME,
.desc   = DRIVER_DESC,
diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index b0f9d2e61a42..cce4694cafb9 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -3,6 +3,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 static const u32 vkms_formats[] = {
@@ -21,6 +22,12 @@ struct vkms_device {
struct vkms_output output;
 };
 
+struct vkms_gem_object {
+   struct drm_gem_object gem;
+   struct mutex pages_lock; /* Page lock used in page fault handler */
+   struct page **pages;
+};
+
 int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
   struct drm_plane *primary, struct drm_plane *cursor);
 
@@ -28,4 +35,20 @@ int vkms_output_init(struct vkms_device *vkmsdev);
 
 struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev);
 
+/* Gem stuff */
+struct drm_gem_object *vkms_gem_create(struct drm_device *dev,
+  struct drm_file *file,
+  u32 *handle,
+  u64 size);
+
+int vkms_gem_fault(struct vm_fault *vmf);
+
+int vkms_dumb_create(struct drm_file *file, struct drm_device *dev,
+struct drm_mode_create_dumb *args);
+
+int vkms_dumb_map(struct drm_file *file, struct drm_device *dev,
+ u32 handle, u64 *offset);
+
+void vkms_gem_free_object(struct drm_gem_object *obj);
+
 #endif /* _VKMS_DRV_H_ */
diff --git a/drivers/gpu/drm/vkms/vkms_gem.c b/drivers/gpu/drm/vkms/vkms_gem.c
new file mode 100644
index ..c7e38368602b
--- /dev/null
+++ b/drivers/gpu/drm/vkms/vkms_gem.c
@@ -0,0 +1,179 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+
+#include "vkms_drv.h"
+
+static struct vkms_gem_object *__vkms_gem_create(struct drm_device *dev,
+u64 size)
+{
+   struct vkms_gem_object *obj;
+   int ret;
+
+   obj = kzalloc(sizeof(*obj), GFP_KERNEL);
+   if (!obj)
+   return ERR_PTR(-ENOMEM);
+
+   size = roundup(size, PAGE_SIZE);
+   ret = drm_gem_object_init(dev, >gem, size);
+   if (ret) {
+   kfree(obj);
+   return ERR_PTR(ret);
+   }
+
+   mutex_init(>pages_lock);
+
+   return obj;
+}
+
+void vkms_gem_free_object(struct drm_gem_object *obj)
+{
+   struct vkms_gem_object *gem = container_of(obj, struct vkms_gem_object,

[PATCH V4 2/4] drm/vkms: Add framebuffer and plane helpers

2018-07-12 Thread Rodrigo Siqueira
This patch appends the minimum helpers related to framebuffer and plane
to make vkms minimally usable.

Changes since V1:
- None
Changes since V2:
- Squash "Add plane helper struct" and "Add helper for framebuffer
  create"
Changes since V3:
 Daniel Vetter:
 - Remove atomic_check from plane helper

Signed-off-by: Rodrigo Siqueira 
---
 drivers/gpu/drm/vkms/vkms_drv.c   |  3 +++
 drivers/gpu/drm/vkms/vkms_plane.c | 11 +++
 2 files changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index 6ea2fd97bef9..b5d597a42f20 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -9,6 +9,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include "vkms_drv.h"
 
 #define DRIVER_NAME"vkms"
@@ -69,6 +71,7 @@ static struct drm_driver vkms_driver = {
 };
 
 static const struct drm_mode_config_funcs vkms_mode_funcs = {
+   .fb_create = drm_gem_fb_create,
.atomic_check = drm_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit,
 };
diff --git a/drivers/gpu/drm/vkms/vkms_plane.c 
b/drivers/gpu/drm/vkms/vkms_plane.c
index 2c25b1d6ab5b..9f75b1e2c1c4 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.c
+++ b/drivers/gpu/drm/vkms/vkms_plane.c
@@ -19,6 +19,15 @@ static const struct drm_plane_funcs vkms_plane_funcs = {
.atomic_destroy_state   = drm_atomic_helper_plane_destroy_state,
 };
 
+static void vkms_primary_plane_update(struct drm_plane *plane,
+ struct drm_plane_state *old_state)
+{
+}
+
+static const struct drm_plane_helper_funcs vkms_primary_helper_funcs = {
+   .atomic_update  = vkms_primary_plane_update,
+};
+
 struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev)
 {
struct drm_device *dev = >drm;
@@ -42,5 +51,7 @@ struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev)
return ERR_PTR(ret);
}
 
+   drm_plane_helper_add(plane, _primary_helper_funcs);
+
return plane;
 }
-- 
2.18.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH V4 3/4] drm/vkms: Add connectors helpers

2018-07-12 Thread Rodrigo Siqueira
This patch adds the struct drm_connector_helper_funcs with some
necessary hooks. Additionally, it also adds some missing hooks at
drm_connector_funcs.

Changes since V1:
- None
Changes since V2:
 Daniel Vetter:
 - Remove vkms_conn_mode_valid
Changes since V3:
- None

Signed-off-by: Rodrigo Siqueira 
---
 drivers/gpu/drm/vkms/vkms_drv.c|  6 --
 drivers/gpu/drm/vkms/vkms_drv.h|  9 +
 drivers/gpu/drm/vkms/vkms_output.c | 20 
 3 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index b5d597a42f20..0557d1d8aa5b 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -19,12 +19,6 @@
 #define DRIVER_MAJOR   1
 #define DRIVER_MINOR   0
 
-#define XRES_MIN32
-#define YRES_MIN32
-
-#define XRES_MAX  8192
-#define YRES_MAX  8192
-
 static struct vkms_device *vkms_device;
 
 static const struct file_operations vkms_driver_fops = {
diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index cce4694cafb9..57d7367fd814 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -6,6 +6,15 @@
 #include 
 #include 
 
+#define XRES_MIN32
+#define YRES_MIN32
+
+#define XRES_DEF  1024
+#define YRES_DEF   768
+
+#define XRES_MAX  8192
+#define YRES_MAX  8192
+
 static const u32 vkms_formats[] = {
DRM_FORMAT_XRGB,
 };
diff --git a/drivers/gpu/drm/vkms/vkms_output.c 
b/drivers/gpu/drm/vkms/vkms_output.c
index 48143eac3c12..a7c0ec9b643f 100644
--- a/drivers/gpu/drm/vkms/vkms_output.c
+++ b/drivers/gpu/drm/vkms/vkms_output.c
@@ -8,6 +8,7 @@
 
 #include "vkms_drv.h"
 #include 
+#include 
 
 static void vkms_connector_destroy(struct drm_connector *connector)
 {
@@ -18,12 +19,29 @@ static void vkms_connector_destroy(struct drm_connector 
*connector)
 static const struct drm_connector_funcs vkms_connector_funcs = {
.fill_modes = drm_helper_probe_single_connector_modes,
.destroy = vkms_connector_destroy,
+   .reset = drm_atomic_helper_connector_reset,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static const struct drm_encoder_funcs vkms_encoder_funcs = {
.destroy = drm_encoder_cleanup,
 };
 
+static int vkms_conn_get_modes(struct drm_connector *connector)
+{
+   int count;
+
+   count = drm_add_modes_noedid(connector, XRES_MAX, YRES_MAX);
+   drm_set_preferred_mode(connector, XRES_DEF, YRES_DEF);
+
+   return count;
+}
+
+static const struct drm_connector_helper_funcs vkms_conn_helper_funcs = {
+   .get_modes= vkms_conn_get_modes,
+};
+
 int vkms_output_init(struct vkms_device *vkmsdev)
 {
struct vkms_output *output = >output;
@@ -49,6 +67,8 @@ int vkms_output_init(struct vkms_device *vkmsdev)
goto err_connector;
}
 
+   drm_connector_helper_add(connector, _conn_helper_funcs);
+
ret = drm_connector_register(connector);
if (ret) {
DRM_ERROR("Failed to register connector\n");
-- 
2.18.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH V4 0/4] Add infrastructure for vblank and page flip events in vkms

2018-07-12 Thread Rodrigo Siqueira
Currently, we are working to make VKMS pass in the kms_flip test (IGT).
As a result, we made a series of changes in the module with the goal to
meet some of the necessary steps required by kms_flip. This patchset
comprises all the modifications needed to make kms_flip partially pass.

Finally, this patchset is based on:
- [PATCH V2 0/5] drm/vkms: Updates to meet basic kms_flip requirements
  (https://www.spinics.net/lists/dri-devel/msg180544.html)
- [PATCH V3] drm/vkms: Add vblank events simulated by hrtimers
  (https://www.spinics.net/lists/dri-devel/msg182600.html)

Rodrigo Siqueira (4):
  drm/vkms: Add dumb operations
  drm/vkms: Add framebuffer and plane helpers
  drm/vkms: Add connectors helpers
  drm/vkms: Add vblank events simulated by hrtimers

 drivers/gpu/drm/vkms/Makefile  |   2 +-
 drivers/gpu/drm/vkms/vkms_crtc.c   |  95 +++
 drivers/gpu/drm/vkms/vkms_drv.c|  28 -
 drivers/gpu/drm/vkms/vkms_drv.h|  47 
 drivers/gpu/drm/vkms/vkms_gem.c| 179 +
 drivers/gpu/drm/vkms/vkms_output.c |  20 
 drivers/gpu/drm/vkms/vkms_plane.c  |  11 ++
 7 files changed, 375 insertions(+), 7 deletions(-)
 create mode 100644 drivers/gpu/drm/vkms/vkms_gem.c

-- 
2.18.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 105760] [4.17-rc1] RIP: smu7_populate_single_firmware_entry.isra.6+0x57/0xc0 [amdgpu] RSP: ffffa17901efb930

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105760

--- Comment #41 from Alex Deucher  ---
(In reply to Thomas Martitz from comment #40)
> Further investigations show that toc->num_entires and toc->structure_version
> are set to -1 after the first call to smu7_request_smu_load_fw(). Does that
> makes sense?

If you read back from the BAR resource on an offline pci device it returns all
1s.

> 
> Since you say the GPU does not properly wake up, can you imagine a
> workaround? The laptop works with windows (of course...) so I'd think there
> ought to be a sw workaround.

Does attachment 140593 fix it as a workaround?  I think ultimately it might be
a flaw in how Linux handles d3cold on some platforms.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 105760] [4.17-rc1] RIP: smu7_populate_single_firmware_entry.isra.6+0x57/0xc0 [amdgpu] RSP: ffffa17901efb930

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105760

--- Comment #40 from Thomas Martitz  ---
Further investigations show that toc->num_entires and toc->structure_version
are set to -1 after the first call to smu7_request_smu_load_fw(). Does that
makes sense?

Since you say the GPU does not properly wake up, can you imagine a workaround?
The laptop works with windows (of course...) so I'd think there ought to be a
sw workaround.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2] console: Replace #if 1 with a bool to ignore

2018-07-12 Thread Steven Rostedt
On Thu, 12 Jul 2018 09:29:38 -0400
Steven Rostedt  wrote:

> From: Steven Rostedt (VMware) 
> 
> There's been discussion on the fb list about the addition of
> WARN_CONSOLE_UNLOCKED() inside the fb code. The complaint is that when
> the fb module is loaded with lockless_register_fb the console lock is
> not taken for debugging reasons. With the addition of
> WARN_CONSOLE_UNLOCK() within the fb code, this causes the console to
> fill up with warnings when trying to debug the fb driver.
> 
> There's also a #if 1 that enables the warning which was added before
> git history, and we look down on constant #if's in the kernel nowadays
> anyway.
> 
> Remove the #if 1 and add a ignore_console_lock_warning boolean that can
> be set by drivers to ignore the warning in order to do debugging.
> 
> Link: http://lkml.kernel.org/r/717e6337-e7a6-7a92-1c1b-8929a2569...@suse.de
> Reviewed-by: Hans de Goede 
> Acked-by: Sergey Senozhatsky 
> Signed-off-by: Steven Rostedt (VMware) 

Petr,

If you want this to go by way of fbdev tree, then can you Ack it?

-- Steve

> ---
> Changes since V1:
>  - Added comment to describe ignore_console_unlock_waring variable
>  - Abide by 80 character limit
> 
> Index: linux-trace.git/include/linux/console.h
> ===
> --- linux-trace.git.orig/include/linux/console.h
> +++ linux-trace.git/include/linux/console.h
> @@ -200,11 +200,14 @@ void vcs_make_sysfs(int index);
>  void vcs_remove_sysfs(int index);
>  
>  /* Some debug stub to catch some of the obvious races in the VT code */
> -#if 1
> -#define WARN_CONSOLE_UNLOCKED()  WARN_ON(!is_console_locked() && 
> !oops_in_progress)
> -#else
> -#define WARN_CONSOLE_UNLOCKED()
> -#endif
> +#define WARN_CONSOLE_UNLOCKED()  
> \
> + WARN_ON(!ignore_console_lock_warning && \
> + !is_console_locked() && !oops_in_progress)
> +/*
> + * Set ignore_console_lock_warning to true if you need to quiet
> + * WARN_CONSOLE_UNLOCKED() for debugging purposes.
> + */
> +extern bool ignore_console_lock_warning;
>  
>  /* VESA Blanking Levels */
>  #define VESA_NO_BLANKING0
> Index: linux-trace.git/kernel/printk/printk.c
> ===
> --- linux-trace.git.orig/kernel/printk/printk.c
> +++ linux-trace.git/kernel/printk/printk.c
> @@ -66,6 +66,9 @@ int console_printk[4] = {
>   CONSOLE_LOGLEVEL_DEFAULT,   /* default_console_loglevel */
>  };
>  
> +bool ignore_console_lock_warning __read_mostly;
> +EXPORT_SYMBOL(ignore_console_lock_warning);
> +
>  /*
>   * Low level drivers may need that to know if they can schedule in
>   * their unblank() callback or not. So let's export it.

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2] console: Replace #if 1 with a bool to ignore

2018-07-12 Thread Steven Rostedt

From: Steven Rostedt (VMware) 

There's been discussion on the fb list about the addition of
WARN_CONSOLE_UNLOCKED() inside the fb code. The complaint is that when
the fb module is loaded with lockless_register_fb the console lock is
not taken for debugging reasons. With the addition of
WARN_CONSOLE_UNLOCK() within the fb code, this causes the console to
fill up with warnings when trying to debug the fb driver.

There's also a #if 1 that enables the warning which was added before
git history, and we look down on constant #if's in the kernel nowadays
anyway.

Remove the #if 1 and add a ignore_console_lock_warning boolean that can
be set by drivers to ignore the warning in order to do debugging.

Link: http://lkml.kernel.org/r/717e6337-e7a6-7a92-1c1b-8929a2569...@suse.de
Reviewed-by: Hans de Goede 
Acked-by: Sergey Senozhatsky 
Signed-off-by: Steven Rostedt (VMware) 
---
Changes since V1:
 - Added comment to describe ignore_console_unlock_waring variable
 - Abide by 80 character limit

Index: linux-trace.git/include/linux/console.h
===
--- linux-trace.git.orig/include/linux/console.h
+++ linux-trace.git/include/linux/console.h
@@ -200,11 +200,14 @@ void vcs_make_sysfs(int index);
 void vcs_remove_sysfs(int index);
 
 /* Some debug stub to catch some of the obvious races in the VT code */
-#if 1
-#define WARN_CONSOLE_UNLOCKED()WARN_ON(!is_console_locked() && 
!oops_in_progress)
-#else
-#define WARN_CONSOLE_UNLOCKED()
-#endif
+#define WARN_CONSOLE_UNLOCKED()
\
+   WARN_ON(!ignore_console_lock_warning && \
+   !is_console_locked() && !oops_in_progress)
+/*
+ * Set ignore_console_lock_warning to true if you need to quiet
+ * WARN_CONSOLE_UNLOCKED() for debugging purposes.
+ */
+extern bool ignore_console_lock_warning;
 
 /* VESA Blanking Levels */
 #define VESA_NO_BLANKING0
Index: linux-trace.git/kernel/printk/printk.c
===
--- linux-trace.git.orig/kernel/printk/printk.c
+++ linux-trace.git/kernel/printk/printk.c
@@ -66,6 +66,9 @@ int console_printk[4] = {
CONSOLE_LOGLEVEL_DEFAULT,   /* default_console_loglevel */
 };
 
+bool ignore_console_lock_warning __read_mostly;
+EXPORT_SYMBOL(ignore_console_lock_warning);
+
 /*
  * Low level drivers may need that to know if they can schedule in
  * their unblank() callback or not. So let's export it.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 105760] [4.17-rc1] RIP: smu7_populate_single_firmware_entry.isra.6+0x57/0xc0 [amdgpu] RSP: ffffa17901efb930

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105760

Alex Deucher  changed:

   What|Removed |Added

 Attachment #140584|0   |1
is obsolete||
 Attachment #140590|0   |1
is obsolete||

--- Comment #39 from Alex Deucher  ---
Created attachment 140593
  --> https://bugs.freedesktop.org/attachment.cgi?id=140593=edit
possible fix

Does this patch help fix the root case?  To anyone else testing this patch,
update the pci ids to match those of your chip.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/client: Fix double free in error path

2018-07-12 Thread Daniel Vetter
On Thu, Jul 12, 2018 at 11:18:40AM +0200, Noralf Trønnes wrote:
> This fixes a static checker warning:
> 
>   drivers/gpu/drm/drm_client.c:289 drm_client_buffer_create()
>   error: double free of 'buffer'
> 
> drm_client_buffer_delete() frees the buffer so remove the extra free.
> 
> Fixes: c76f0f7cb546 ("drm: Begin an API for in-kernel clients")
> Reported-by: Dan Carpenter 
> Cc: Daniel Vetter 
> Signed-off-by: Noralf Trønnes 

You could also put an if (buffer->handle) into drm_client_buffer_delete
and simplify the code even more. handle == 0 is the canonical invalid
handle - all our idr start at 1. But this works too. On either approach:

Reviewed-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/drm_client.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
> index 9b142f58d489..83b294ae3e4e 100644
> --- a/drivers/gpu/drm/drm_client.c
> +++ b/drivers/gpu/drm/drm_client.c
> @@ -242,8 +242,10 @@ drm_client_buffer_create(struct drm_client_dev *client, 
> u32 width, u32 height, u
>   dumb_args.height = height;
>   dumb_args.bpp = drm_format_plane_cpp(format, 0) * 8;
>   ret = drm_mode_create_dumb(dev, _args, client->file);
> - if (ret)
> - goto err_free;
> + if (ret) {
> + kfree(buffer);
> + return ERR_PTR(ret);
> + }
>  
>   buffer->handle = dumb_args.handle;
>   buffer->pitch = dumb_args.pitch;
> @@ -276,8 +278,6 @@ drm_client_buffer_create(struct drm_client_dev *client, 
> u32 width, u32 height, u
>  
>  err_delete:
>   drm_client_buffer_delete(buffer);
> -err_free:
> - kfree(buffer);
>  
>   return ERR_PTR(ret);
>  }
> -- 
> 2.15.1
> 

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


[Bug 105760] [4.17-rc1] RIP: smu7_populate_single_firmware_entry.isra.6+0x57/0xc0 [amdgpu] RSP: ffffa17901efb930

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105760

--- Comment #38 from Alex Deucher  ---
(In reply to Thomas Martitz from comment #36)
> Created attachment 140591 [details] [review]
> workaround without memcpy
> 
> I made the following patch as an alternative workaround. The printks I added
> indicate what's going wrong. The smu_data->header pointer does not become
> busted. Instead, the toc->num_entries member somehow gets set to -1 (perhaps
> by accident), and since toc->num_entries is used as an index for the
> toc->entry array, the smu7_populate_single_firmware_entry() function gets
> passed an invalid pointer.
> 
> The workaround uses a temp. variable as the index (which seems to make
> resume work), but it's still to be found out why toc->num_entries changes to
> -1. Also, I still get lots of powerplay error messages with this patch. I'll
> attach dmesg next, below is just the output of the printks I added.

That explains it.  The problem is that the GPU does not power up properly on
resume so when you read back from vram to get the index, it returns all 1s
since the device is offline.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 105760] [4.17-rc1] RIP: smu7_populate_single_firmware_entry.isra.6+0x57/0xc0 [amdgpu] RSP: ffffa17901efb930

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105760

--- Comment #37 from Thomas Martitz  ---
Created attachment 140592
  --> https://bugs.freedesktop.org/attachment.cgi?id=140592=edit
dmesg with 0001-workaround-v2.patch

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 105760] [4.17-rc1] RIP: smu7_populate_single_firmware_entry.isra.6+0x57/0xc0 [amdgpu] RSP: ffffa17901efb930

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105760

--- Comment #35 from Alex Deucher  ---
Created attachment 140590
  --> https://bugs.freedesktop.org/attachment.cgi?id=140590=edit
use gtt for firmware buffers

I still don't understand what's corrupting the cpu pointer.  Ultimately, it
looks like the GPU does not power up correctly after powering down so the
segfault is largely irrelevant.  Does this patch help? memcpy_toio is required
for accessing memory mapped device resources (e.g., vram) on some platforms. 
x86 doesn't matter.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 105760] [4.17-rc1] RIP: smu7_populate_single_firmware_entry.isra.6+0x57/0xc0 [amdgpu] RSP: ffffa17901efb930

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105760

Thomas Martitz  changed:

   What|Removed |Added

 Attachment #140560|0   |1
is obsolete||

--- Comment #36 from Thomas Martitz  ---
Created attachment 140591
  --> https://bugs.freedesktop.org/attachment.cgi?id=140591=edit
workaround without memcpy

I made the following patch as an alternative workaround. The printks I added
indicate what's going wrong. The smu_data->header pointer does not become
busted. Instead, the toc->num_entries member somehow gets set to -1 (perhaps by
accident), and since toc->num_entries is used as an index for the toc->entry
array, the smu7_populate_single_firmware_entry() function gets passed an
invalid pointer.

The workaround uses a temp. variable as the index (which seems to make resume
work), but it's still to be found out why toc->num_entries changes to -1. Also,
I still get lots of powerplay error messages with this patch. I'll attach dmesg
next, below is just the output of the printks I added.

kugel@thomas-nb:linux.git$ dmesg  | grep smu7
[0.908377] amdgpu: [powerplay] smu7_request_smu_load_fw: 10
a8a060081000 0 1
[0.908422] amdgpu: [powerplay] smu7_request_smu_load_fw: 20
a8a060081000 0 1
[   30.042293] amdgpu: [powerplay] smu7_request_smu_load_fw: 10
a8a060081000 0 1
[   30.042309] amdgpu: [powerplay] smu7_request_smu_load_fw: 20
a8a060081000 -1 -1

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: mali-dp: Set encoder possible_clones

2018-07-12 Thread Ville Syrjälä
On Thu, Jul 12, 2018 at 01:54:07PM +0100, Alexandru-Cosmin Gheorghe wrote:
> On Thu, Jul 12, 2018 at 03:37:36PM +0300, Ville Syrjälä wrote:
> > On Thu, Jul 12, 2018 at 09:48:56AM +0100, Alexandru Gheorghe wrote:
> > > Set possible_clones field to report that the writeback connector and
> > > the one driving the display could be enabled at the same time.
> > > 
> > > Signed-off-by: Alexandru Gheorghe 
> > > ---
> > >  drivers/gpu/drm/arm/malidp_drv.c | 10 ++
> > >  1 file changed, 10 insertions(+)
> > > 
> > > diff --git a/drivers/gpu/drm/arm/malidp_drv.c 
> > > b/drivers/gpu/drm/arm/malidp_drv.c
> > > index 5b72605..3664da9 100644
> > > --- a/drivers/gpu/drm/arm/malidp_drv.c
> > > +++ b/drivers/gpu/drm/arm/malidp_drv.c
> > > @@ -616,6 +616,8 @@ static int malidp_bind(struct device *dev)
> > >   struct malidp_hw_device *hwdev;
> > >   struct platform_device *pdev = to_platform_device(dev);
> > >   struct of_device_id const *dev_id;
> > > + struct drm_encoder *encoder;
> > > + int num_encoders = 0;
> > >   /* number of lines for the R, G and B output */
> > >   u8 output_width[MAX_OUTPUT_CHANNELS];
> > >   int ret = 0, i;
> > > @@ -737,6 +739,14 @@ static int malidp_bind(struct device *dev)
> > >   goto bind_fail;
> > >   }
> > >  
> > > + list_for_each_entry(encoder, >mode_config.encoder_list, head) {
> > > + num_encoders++;
> > > + }
> > 
> > dev->mode_config.num_encoder ?
> 
> Thanks for that, I will use it.
> 
> > 
> > > +
> > > + list_for_each_entry(encoder, >mode_config.encoder_list, head) {
> > > + encoder->possible_clones = (1 << num_encoders) -  1;
> > > + }
> > 
> > Your commit message speaks only about two specific encoders but here
> > you're claiming any encoder can be cloned with any other. I can't
> > actually figure out how many encoders there can be because the encoder
> > registration seems to happen by magic means. Some explanation would
> > be nice.
> > 
> > I'm interested because I'd like to clean up the possible_clones stuff
> > to actually reflect reality so that userspace could actually use that
> > information for something. See
> > https://patchwork.freedesktop.org/series/44849/
> > 
> 
> There are just two encoders, encoder->possible_clones = 0x3 would've
> done the job, do you think I should use it to better convey intent?

Are there any direct pointers to those encoders? If there are I
might recommend a more explicit
 a.possible_clones = drm_encoder_mask(a) | drm_encoder_mask(b);
 b.possible_clones = drm_encodrr_mask(a) | drm_encoder_mask(b);
or something like that.

But if there aren't then I think the num_encoder thing should work
fine. But I would suggest adding a comment to explain the situation,
and maybe even a WARN_ON(num_encoder != 2) so that people will
realize that this code needs to be updated if more encoders show up
in the future.

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


Re: [PATCH] drm/probe-helper: Fix modes reporting for writeback connector

2018-07-12 Thread Daniel Vetter
On Thu, Jul 12, 2018 at 10:20:35AM +0100, Alexandru-Cosmin Gheorghe wrote:
> On Thu, Jul 12, 2018 at 10:55:47AM +0200, Daniel Vetter wrote:
> > On Thu, Jul 12, 2018 at 09:48:02AM +0100, Alexandru Gheorghe wrote:
> > > Writeback connector is reported as disconnected, currently this causes
> > > the setting of the edid property to null and then exit.
> > > In order to properly get the modes for writeback we need to add an
> > > exception when connector type is DRM_MODE_CONNECTOR_WRITEBACK.
> > > 
> > > Signed-off-by: Alexandru Gheorghe 
> > 
> > Why do you even need a mode list for writeback?
> 
> It's used by userspace to know how big the writeback buffer could be.
> 
> > 
> > Also, if you're already faking a mode list for the writeback connector,
> > why can't you also fake it's connection status?
> > -Daniel
> 
> AFAIK Reporting it as disconnected was a way of making sure it will be
> ignored by userspace that's not aware of writeback connectorsa. Do you
> think it's superfluous with DRM_CLIENT_CAP_WRITEBACK_CONNECTORS ?

Yes, since we're filtering writeback connectors from userspace that can't
deal with them I think a cleaner solution would be to just mark them as
connected. Old userspace won't ever see them, new userspace should already
correctly ignore them.
-Daniel

> 
> > 
> > > ---
> > >  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 52774339..c7bdbe2 100644
> > > --- a/drivers/gpu/drm/drm_probe_helper.c
> > > +++ b/drivers/gpu/drm/drm_probe_helper.c
> > > @@ -472,7 +472,8 @@ int drm_helper_probe_single_connector_modes(struct 
> > > drm_connector *connector,
> > >  
> > >   dev->mode_config.poll_running = drm_kms_helper_poll;
> > >  
> > > - if (connector->status == connector_status_disconnected) {
> > > + if (connector->status == connector_status_disconnected &&
> > > + connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK) {
> > >   DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n",
> > >   connector->base.id, connector->name);
> > >   drm_mode_connector_update_edid_property(connector, NULL);
> > > -- 
> > > 2.7.4
> > > 
> > > ___
> > > dri-devel mailing list
> > > dri-devel@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> > 
> > -- 
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
> 
> -- 
> Cheers,
> Alex G

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


Re: [PATCH v8 0/6] Add ChromeOS EC CEC Support

2018-07-12 Thread Hans Verkuil
On 12/07/18 14:42, Neil Armstrong wrote:
> Hi Lee,
> 
> On 12/07/2018 14:26, Lee Jones wrote:
>> On Wed, 04 Jul 2018, Neil Armstrong wrote:
>>
>>> Hi All,
>>>
>>> The new Google "Fizz" Intel-based ChromeOS device is gaining CEC support
>>> through it's Embedded Controller, to enable the Linux CEC Core to 
>>> communicate
>>> with it and get the CEC Physical Address from the correct HDMI Connector, 
>>> the
>>> following must be added/changed:
>>> - Add the CEC sub-device registration in the ChromeOS EC MFD Driver
>>> - Add the CEC related commands and events definitions into the EC MFD driver
>>> - Add a way to get a CEC notifier with it's (optional) connector name
>>> - Add the CEC notifier to the i915 HDMI driver
>>> - Add the proper ChromeOS EC CEC Driver
>>>
>>> The CEC notifier with the connector name is the tricky point, since even on
>>> Device-Tree platforms, there is no way to distinguish between multiple HDMI
>>> connectors from the same DRM driver. The solution I implemented is pretty
>>> simple and only adds an optional connector name to eventually distinguish
>>> an HDMI connector notifier from another if they share the same device.
>>>
>>> Feel free to comment this patchset !
>>>
>>> Changes since v7:
>>> - rebased on v4.18-rc1
>>> - Fixed whitespace issues on patch 3
>>> - Added Lee's tags
>>>
>>> Changes since v6:
>>> - Added stable identifier comment in intel_display.h
>>> - Renamed to cec_notifier in intel_hdmi.c/intel_drv.h
>>> - Added Acked-by/Reviewed-By tags
>>>
>>> Changes since v5:
>>>  - Small fixups on include/linux/mfd/cros_ec_commands.h
>>>  - Fixed on cros-ec-cec driver accordingly
>>>  - Added Reviewed-By tags
>>>
>>> Changes since v4:
>>>  - Split patch 3 to move the mkbp event size change into a separate patch
>>>
>>> Changes since v3 (incorrectly reported as v2):
>>>  - Renamed "Chrome OS" to "ChromeOS"
>>>  - Updated cros_ec_commands.h new structs definitions to kernel doc format
>>>  - Added Reviewed-By tags
>>>
>>> Changes since v2:
>>>  - Add i915 port_identifier() and use this stable name as cec_notifier conn 
>>> name
>>>  - Fixed and cleaned up the CEC commands and events handling
>>>  - Rebased the CEC sub-device registration on top of Enric's serie
>>>  - Fixed comments typo on cec driver
>>>  - Protected the DMI match only with PCI and DMI Kconfigs
>>>
>>> Changes since v1:
>>>  - Added cec_notifier_put to intel_hdmi
>>>  - Fixed all small reported issues on the EC CEC driver
>>>  - Moved the cec_notifier_get out of the #if .. #else .. #endif
>>>
>>> Changes since RFC:
>>>  - Moved CEC sub-device registration after CEC commands and events 
>>> definitions patch
>>>  - Removed get_notifier_get_byname
>>>  - Added CEC_CORE select into i915 Kconfig
>>>  - Removed CEC driver fallback if notifier is not configured on HW, added 
>>> explicit warn
>>>  - Fixed CEC core return type on error
>>>  - Moved to cros-ec-cec media platform directory
>>>  - Use bus_find_device() to find the pci i915 device instead of 
>>> get_notifier_get_byname()
>>>  - Fix Logical Address setup
>>>  - Added comment about HW support
>>>  - Removed memset of msg structures
>>>
>>> Neil Armstrong (6):
>>>   media: cec-notifier: Get notifier by device and connector name
>>>   drm/i915: hdmi: add CEC notifier to intel_hdmi
>>>   mfd: cros-ec: Increase maximum mkbp event size
>>>   mfd: cros-ec: Introduce CEC commands and events definitions.
>>>   mfd: cros_ec_dev: Add CEC sub-device registration
>>>   media: platform: Add ChromeOS EC CEC driver
>>>
>>>  drivers/gpu/drm/i915/Kconfig |   1 +
>>>  drivers/gpu/drm/i915/intel_display.h |  24 ++
>>>  drivers/gpu/drm/i915/intel_drv.h |   2 +
>>>  drivers/gpu/drm/i915/intel_hdmi.c|  13 +
>>>  drivers/media/cec/cec-notifier.c |  11 +-
>>>  drivers/media/platform/Kconfig   |  11 +
>>>  drivers/media/platform/Makefile  |   2 +
>>>  drivers/media/platform/cros-ec-cec/Makefile  |   1 +
>>>  drivers/media/platform/cros-ec-cec/cros-ec-cec.c | 347 
>>> +++
>>>  drivers/mfd/cros_ec_dev.c|  16 ++
>>>  drivers/platform/chrome/cros_ec_proto.c  |  40 ++-
>>>  include/linux/mfd/cros_ec.h  |   2 +-
>>>  include/linux/mfd/cros_ec_commands.h |  97 +++
>>>  include/media/cec-notifier.h |  27 +-
>>>  14 files changed, 578 insertions(+), 16 deletions(-)
>>>  create mode 100644 drivers/media/platform/cros-ec-cec/Makefile
>>>  create mode 100644 drivers/media/platform/cros-ec-cec/cros-ec-cec.c
>>
>> How would you like to handle this set?
>>
> 
> Hans proposed you take all the patches throught mfd,
> then drm-intel could merge your immutable branch to avoid any conflicts.
> 
> Rodrigo Vivi gave an ack to merge it through other trees on the v6 patchset.
> 
> Hans, should the media tree also merge the branch ?

No, there is no need for that. It's fine if it all 

Re: [PATCH] drm: mali-dp: Set encoder possible_clones

2018-07-12 Thread Alexandru-Cosmin Gheorghe
On Thu, Jul 12, 2018 at 03:37:36PM +0300, Ville Syrjälä wrote:
> On Thu, Jul 12, 2018 at 09:48:56AM +0100, Alexandru Gheorghe wrote:
> > Set possible_clones field to report that the writeback connector and
> > the one driving the display could be enabled at the same time.
> > 
> > Signed-off-by: Alexandru Gheorghe 
> > ---
> >  drivers/gpu/drm/arm/malidp_drv.c | 10 ++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/arm/malidp_drv.c 
> > b/drivers/gpu/drm/arm/malidp_drv.c
> > index 5b72605..3664da9 100644
> > --- a/drivers/gpu/drm/arm/malidp_drv.c
> > +++ b/drivers/gpu/drm/arm/malidp_drv.c
> > @@ -616,6 +616,8 @@ static int malidp_bind(struct device *dev)
> > struct malidp_hw_device *hwdev;
> > struct platform_device *pdev = to_platform_device(dev);
> > struct of_device_id const *dev_id;
> > +   struct drm_encoder *encoder;
> > +   int num_encoders = 0;
> > /* number of lines for the R, G and B output */
> > u8 output_width[MAX_OUTPUT_CHANNELS];
> > int ret = 0, i;
> > @@ -737,6 +739,14 @@ static int malidp_bind(struct device *dev)
> > goto bind_fail;
> > }
> >  
> > +   list_for_each_entry(encoder, >mode_config.encoder_list, head) {
> > +   num_encoders++;
> > +   }
> 
> dev->mode_config.num_encoder ?

Thanks for that, I will use it.

> 
> > +
> > +   list_for_each_entry(encoder, >mode_config.encoder_list, head) {
> > +   encoder->possible_clones = (1 << num_encoders) -  1;
> > +   }
> 
> Your commit message speaks only about two specific encoders but here
> you're claiming any encoder can be cloned with any other. I can't
> actually figure out how many encoders there can be because the encoder
> registration seems to happen by magic means. Some explanation would
> be nice.
> 
> I'm interested because I'd like to clean up the possible_clones stuff
> to actually reflect reality so that userspace could actually use that
> information for something. See
> https://patchwork.freedesktop.org/series/44849/
> 

There are just two encoders, encoder->possible_clones = 0x3 would've
done the job, do you think I should use it to better convey intent?


> > +
> > ret = malidp_irq_init(pdev);
> > if (ret < 0)
> > goto irq_init_fail;
> > -- 
> > 2.7.4
> > 
> > ___
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> -- 
> Ville Syrjälä
> Intel
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Cheers,
Alex G
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 107204] GPU hang (ring gfx timeout) in OpenGL game

2018-07-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107204

Bug ID: 107204
   Summary: GPU hang (ring gfx timeout) in OpenGL game
   Product: Mesa
   Version: git
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/Gallium/radeonsi
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: fbz...@milek7.pl
QA Contact: dri-devel@lists.freedesktop.org

Created attachment 140587
  --> https://bugs.freedesktop.org/attachment.cgi?id=140587=edit
Dumps from GALLIUM_DDEBUG

It hangs in OpenGL game immediately after startup almost always (but sometimes
it goes through and works) with dmesg message:
>[drm:amdgpu_job_timedout [amdgpu]] *ERROR* ring gfx timeout, last signaled 
>seq=3324, last emitted seq=3327

I tested it on Radeon RX580, mainline kernel 4.18, Mesa 18.1.3 and Mesa git
c0874947f1.

I could provide game code for testing but I would have to package minimal
assets as full game weights pretty much.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Intel-gfx] [PATCH] i915/intel_tv_get_modes: fix strncpy truncation warning

2018-07-12 Thread Ville Syrjälä
On Wed, Jul 11, 2018 at 09:46:15AM +0200, Dominique Martinet wrote:
> This is effectively no-op as the next line writes a nul at the final

What is "This". Please write self contained commit messages.

> byte of the buffer, so copying one letter less does not change the
> behaviour.
> 
> Signed-off-by: Dominique Martinet 
> ---
> 
> gcc 8 gives the following warning, which I am not sure why is treated
> as error for this file, thus making me fix it:
> drivers/gpu/drm/i915/intel_tv.c: In function ‘intel_tv_get_modes’:
> drivers/gpu/drm/i915/intel_tv.c:1358:3: error: ‘strncpy’ specified bound 32 
> equals destination size [-Werror=stringop-truncation]
>strncpy(mode_ptr->name, input->name, DRM_DISPLAY_MODE_LEN);
>^~
> cc1: all warnings being treated as errors

That warning should be in the actual commit message.

> 
> 
> Also, as a side note, while checking if this was already sent I stumbled
> uppon this: 
> https://lists.freedesktop.org/archives/intel-gfx/2018-July/170638.html
> ([Intel-gfx] [PATCH i-g-t 6/7] Fix truncate string in the strncpy)
> which replaces strncpy(dest, src, sizeof(dest)) by strncpy(dest, src,
> strlen(dest))... This isn't for linux but this looks like a pretty bad
> idea to me... (I'm not on the list to reply there, sorry)
> 
>  drivers/gpu/drm/i915/intel_tv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> index b55b5c157e38..f5614d07b10d 100644
> --- a/drivers/gpu/drm/i915/intel_tv.c
> +++ b/drivers/gpu/drm/i915/intel_tv.c
> @@ -1355,7 +1355,7 @@ intel_tv_get_modes(struct drm_connector *connector)
>   mode_ptr = drm_mode_create(connector->dev);
>   if (!mode_ptr)
>   continue;
> - strncpy(mode_ptr->name, input->name, DRM_DISPLAY_MODE_LEN);
> + strncpy(mode_ptr->name, input->name, DRM_DISPLAY_MODE_LEN - 1);
>   mode_ptr->name[DRM_DISPLAY_MODE_LEN - 1] = '\0';

This same pattern is used all over drm. Can you go and fix them all up?
One might even consider writing a cocci patch for it ;)

>  
>   mode_ptr->hdisplay = hactive_s;
> -- 
> 2.17.1
> 
> ___
> Intel-gfx mailing list
> intel-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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


  1   2   >