[Bug 108096] [amd-staging-drm-next] SDDM screen corruption (not useable) with RX580, amdgpu, dc=1 (of course), regression

2018-09-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108096

--- Comment #7 from Dieter Nützel  ---
Created attachment 141793
  --> https://bugs.freedesktop.org/attachment.cgi?id=141793&action=edit
Xorg.0.log.25.09

-- 
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 108096] [amd-staging-drm-next] SDDM screen corruption (not useable) with RX580, amdgpu, dc=1 (of course), regression

2018-09-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108096

Dieter Nützel  changed:

   What|Removed |Added

 Attachment #141791|0   |1
is obsolete||

--- Comment #6 from Dieter Nützel  ---
Created attachment 141792
  --> https://bugs.freedesktop.org/attachment.cgi?id=141792&action=edit
dmesg-4.19.0-rc1-1.g7262353-default+.log-25.09

-- 
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 108096] [amd-staging-drm-next] SDDM screen corruption (not useable) with RX580, amdgpu, dc=1 (of course), regression

2018-09-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108096

--- Comment #5 from Dieter Nützel  ---
Created attachment 141791
  --> https://bugs.freedesktop.org/attachment.cgi?id=141791&action=edit
dmesg-4.19.0-rc1-1.g7262353-default+.log-25.10

-- 
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 108096] [amd-staging-drm-next] SDDM screen corruption (not useable) with RX580, amdgpu, dc=1 (of course), regression

2018-09-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108096

--- Comment #4 from Dieter Nützel  ---
Created attachment 141790
  --> https://bugs.freedesktop.org/attachment.cgi?id=141790&action=edit
dmesg-4.18.0-rc1-1.g7262353-default+.log3

-- 
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 108096] [amd-staging-drm-next] SDDM screen corruption (not useable) with RX580, amdgpu, dc=1 (of course), regression

2018-09-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108096

--- Comment #3 from Dieter Nützel  ---
Created attachment 141789
  --> https://bugs.freedesktop.org/attachment.cgi?id=141789&action=edit
dmesg-4.18.0-rc1-1.g7262353-default+.log

-- 
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 108096] [amd-staging-drm-next] SDDM screen corruption (not useable) with RX580, amdgpu, dc=1 (of course), regression

2018-09-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108096

--- Comment #2 from Dieter Nützel  ---
Created attachment 141788
  --> https://bugs.freedesktop.org/attachment.cgi?id=141788&action=edit
SDDM corruption 4.19.0-rc1

-- 
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 108096] [amd-staging-drm-next] SDDM screen corruption (not useable) with RX580, amdgpu, dc=1 (of course), regression

2018-09-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108096

--- Comment #1 from Dieter Nützel  ---
Created attachment 141787
  --> https://bugs.freedesktop.org/attachment.cgi?id=141787&action=edit
SDDM corruption 4.18.0-rc1 (with some recognizable parts)

-- 
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 108096] [amd-staging-drm-next] SDDM screen corruption (not useable) with RX580, amdgpu, dc=1 (of course), regression

2018-09-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108096

Bug ID: 108096
   Summary: [amd-staging-drm-next] SDDM screen corruption (not
useable) with RX580, amdgpu, dc=1 (of course),
regression
   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: die...@nuetzel-hh.de

Created attachment 141786
  --> https://bugs.freedesktop.org/attachment.cgi?id=141786&action=edit
SDDM corruption 4.18.0-rc1

amd-staging-drm-next (since 21/22 August 2018)
didn't work any longer with my nice RX580

Latest working amd-staging-drm-next kernel was from 16th August 2018
#5024f8dfe478 (my testing for Huang Rui ray.huang at amd.com)
https://lists.freedesktop.org/archives/amd-gfx/2018-August/025332.html

On 22th August I got first SDDM corruption (see attchament) and
[   14.322826] [drm:amdgpu_cs_ioctl [amdgpu]] *ERROR* Failed to initialize
parser !
in dmesg with amd-staging-drm-next 4.18.0-rc1.
(see attchament) dmesg-4.18.0-rc1-1.g7262353-default+.log

Later (23th August) I saw SDDM corruption and
[drm:amdgpu_cs_ioctl [amdgpu]] *ERROR* Failed to initialize parser !
plus
[3.487757] RIP: 0010:amdgpu_bo_gpu_offset+0x56/0x90 [amdgpu]
(see attchament) dmesg-4.18.0-rc1-1.g7262353-default+.log3


After Alex's upgrade to amd-staging-drm-next 4.19.0-rc1
I got SDDM corruption (see attchament)
and
[   14.439424] [drm:amdgpu_cs_ioctl [amdgpu]] *ERROR* Failed to initialize
parser !
(see attchament) dmesg-4.19.0-rc1-1.g7262353-default+.log-25.10

First 'bisect' attempt went nuts  'cause the big merge with Linus tree didn't
resolve.
Can't find my former amd-staging-drm-next tag (#5024f8dfe478, see above) any
longer ;-(

-- 
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 201275] Power consumption RX460 idle raised from 7 W to 13 W

2018-09-28 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=201275

Dieter Nützel (die...@nuetzel-hh.de) changed:

   What|Removed |Added

 CC||die...@nuetzel-hh.de,
   ||sndir...@suse.de

--- Comment #4 from Dieter Nützel (die...@nuetzel-hh.de) ---
I can second that for RX580 (Polaris20)

It raised to 60 W 'idle' (from ~31/32 W with 4.18.9)

bisect? - Not so fast 'cause I use openSUSE Tumbleweed 'Kernel:stable' when
'amd-staging-drm-next' do NOT work for me --- and it do NOT work for me since
21/22 August but that come with another ticket.

amdgpu-pci-0100
Adapter: PCI adapter
vddgfx:   +1.20 V  
fan1: 886 RPM
temp1:+43.0°C  (crit = +94.0°C, hyst = -273.1°C)
power1:   59.16 W  (cap = 175.00 W)

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


[PATCH v9 2/2] dt-bindings: Add Truly NT35597 panel driver bindings

2018-09-28 Thread Abhinav Kumar
Add the device tree bindings for Truly NT35597 panel driver. This panel
driver supports both single DSI and dual DSI.

However, this patch series supports only dual DSI.

Changes in v9:
  - None

Reviewed-by: Linus Walleij 
Reviewed-by: Sean Paul 
Signed-off-by: Abhinav Kumar 
---
 .../devicetree/bindings/display/truly,nt35597.txt  | 60 ++
 1 file changed, 60 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/truly,nt35597.txt

diff --git a/Documentation/devicetree/bindings/display/truly,nt35597.txt 
b/Documentation/devicetree/bindings/display/truly,nt35597.txt
new file mode 100644
index 000..46b29eb
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/truly,nt35597.txt
@@ -0,0 +1,60 @@
+Truly model NT35597 DSI display driver
+
+The Truly NT35597 is a generic display driver, currently only configured
+for use in the 2K display on the Qualcomm SDM845.
+
+Required properties:
+- compatible: should be "truly,nt35597-2K-display"
+- vdda-supply: phandle of the regulator that provides the supply voltage
+  Power IC supply
+- vdispp-supply: phandle of the regulator that provides the supply voltage
+  for positive LCD bias
+- vdispn-supply: phandle of the regulator that provides the supply voltage
+  for negative LCD bias
+- reset-gpios: phandle of gpio for reset line
+  This should be 8mA, gpio can be configured using mux, pinctrl, pinctrl-names
+  (active low)
+- mode-gpios: phandle of the gpio for choosing the mode of the display
+  for single DSI or Dual DSI
+  (active high)
+  This should be low for dual DSI and high for single DSI mode
+- ports: This device has two video ports driven by two DSIs. Their connections
+  are modelled using the OF graph bindings specified in
+  Documentation/devicetree/bindings/graph.txt.
+  - port@0: DSI input port driven by master DSI
+  - port@1: DSI input port driven by secondary DSI
+
+Example:
+
+   dsi@ae94000 {
+   panel@0 {
+   compatible = "truly,nt35597-2K-display";
+   reg = <0>;
+   vdda-supply = <&pm8998_l14>;
+   vdispp-supply = <&lab_regulator>;
+   vdispn-supply = <&ibb_regulator>;
+   pinctrl-names = "default", "suspend";
+   pinctrl-0 = <&dpu_dsi_active>;
+   pinctrl-1 = <&dpu_dsi_suspend>;
+
+   reset-gpios = <&tlmm 6 GPIO_ACTIVE_LOW>;
+   mode-gpios = <&tlmm 52 GPIO_ACTIVE_HIGH>;
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   port@0 {
+   reg = <0>;
+   panel0_in: endpoint {
+   remote-endpoint = <&dsi0_out>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+   panel1_in: endpoint {
+   remote-endpoint = <&dsi1_out>;
+   };
+   };
+   };
+   };
+   };
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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


[PATCH v9 1/2] drm/panel: Add support for Truly NT35597 panel driver

2018-09-28 Thread Abhinav Kumar
Add support for Truly NT35597 panel driver used in MSM reference
platforms. This panel driver supports both single DSI and dual
DSI modes.

However, this patch series adds support only for dual DSI mode.

Changes in v9:
- Sorted headers alphabetically
- Remove void type for commands
- Reduce number of lines used by comments
- Fix return value in probe
- Fix driver name to use '-' instead of '_'

Reviewed-by: Sean Paul 
Signed-off-by: Archit Taneja 
Signed-off-by: Abhinav Kumar 
---
 drivers/gpu/drm/panel/Kconfig   |   7 +
 drivers/gpu/drm/panel/Makefile  |   1 +
 drivers/gpu/drm/panel/panel-truly-nt35597.c | 675 
 3 files changed, 683 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-truly-nt35597.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 6020c30..073ffa0 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -186,4 +186,11 @@ config DRM_PANEL_SITRONIX_ST7789V
  Say Y here if you want to enable support for the Sitronix
  ST7789V controller for 240x320 LCD panels
 
+config DRM_PANEL_TRULY_NT35597_WQXGA
+   tristate "Truly WQXGA"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   help
+ Say Y here if you want to enable support for Truly NT35597 WQXGA Dual 
DSI
+ Video Mode panel
 endmenu
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 5ccaaa9..80fd19f 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -19,3 +19,4 @@ obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += panel-seiko-43wvf1g.o
 obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o
 obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o
 obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o
+obj-$(CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA) += panel-truly-nt35597.o
diff --git a/drivers/gpu/drm/panel/panel-truly-nt35597.c 
b/drivers/gpu/drm/panel/panel-truly-nt35597.c
new file mode 100644
index 000..fc2a66c
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-truly-nt35597.c
@@ -0,0 +1,675 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+static const char * const regulator_names[] = {
+   "vdda",
+   "vdispp",
+   "vdispn",
+};
+
+static unsigned long const regulator_enable_loads[] = {
+   62000,
+   10,
+   10,
+};
+
+static unsigned long const regulator_disable_loads[] = {
+   80,
+   100,
+   100,
+};
+
+struct cmd_set {
+   u8 commands[4];
+   u8 size;
+};
+
+struct nt35597_config {
+   u32 width_mm;
+   u32 height_mm;
+   const char *panel_name;
+   const struct cmd_set *panel_on_cmds;
+   u32 num_on_cmds;
+   const struct drm_display_mode *dm;
+};
+
+struct truly_nt35597 {
+   struct device *dev;
+   struct drm_panel panel;
+
+   struct regulator_bulk_data supplies[ARRAY_SIZE(regulator_names)];
+
+   struct gpio_desc *reset_gpio;
+   struct gpio_desc *mode_gpio;
+
+   struct backlight_device *backlight;
+
+   struct mipi_dsi_device *dsi[2];
+
+   const struct nt35597_config *config;
+   bool prepared;
+   bool enabled;
+};
+
+static inline struct truly_nt35597 *panel_to_ctx(struct drm_panel *panel)
+{
+   return container_of(panel, struct truly_nt35597, panel);
+}
+
+static const struct cmd_set qcom_2k_panel_magic_cmds[] = {
+   /* CMD2_P0 */
+   { { 0xff, 0x20 }, 2 },
+   { { 0xfb, 0x01 }, 2 },
+   { { 0x00, 0x01 }, 2 },
+   { { 0x01, 0x55 }, 2 },
+   { { 0x02, 0x45 }, 2 },
+   { { 0x05, 0x40 }, 2 },
+   { { 0x06, 0x19 }, 2 },
+   { { 0x07, 0x1e }, 2 },
+   { { 0x0b, 0x73 }, 2 },
+   { { 0x0c, 0x73 }, 2 },
+   { { 0x0e, 0xb0 }, 2 },
+   { { 0x0f, 0xae }, 2 },
+   { { 0x11, 0xb8 }, 2 },
+   { { 0x13, 0x00 }, 2 },
+   { { 0x58, 0x80 }, 2 },
+   { { 0x59, 0x01 }, 2 },
+   { { 0x5a, 0x00 }, 2 },
+   { { 0x5b, 0x01 }, 2 },
+   { { 0x5c, 0x80 }, 2 },
+   { { 0x5d, 0x81 }, 2 },
+   { { 0x5e, 0x00 }, 2 },
+   { { 0x5f, 0x01 }, 2 },
+   { { 0x72, 0x11 }, 2 },
+   { { 0x68, 0x03 }, 2 },
+   /* CMD2_P4 */
+   { { 0xFF, 0x24 }, 2 },
+   { { 0xFB, 0x01 }, 2 },
+   { { 0x00, 0x1C }, 2 },
+   { { 0x01, 0x0B }, 2 },
+   { { 0x02, 0x0C }, 2 },
+   { { 0x03, 0x01 }, 2 },
+   { { 0x04, 0x0F }, 2 },
+   { { 0x05, 0x10 }, 2 },
+   { { 0x06, 0x10 }, 2 },
+   { { 0x07, 0x10 }, 2 },
+   { { 0x08, 0x89 }, 2 },
+   { { 0x09, 0x8A }, 2 },
+   { { 0x0A, 0x13 }, 2 },
+   { { 0x0B, 0x13 }, 2 },
+   { { 0x0C, 0x15 }, 2 },
+   { { 0x0D, 0x15 }, 2 },
+   { { 0x0E, 0x17 }, 2 },
+   { { 0x0F, 0x17 }, 2 },
+   { { 0x10, 0x1C }, 2 },
+

[PATCH 4/4] drm/v3d: Skip debugfs dumping GCA on platforms without GCA.

2018-09-28 Thread Eric Anholt
Fixes an oops reading this debugfs entry on BCM7278.

Signed-off-by: Eric Anholt 
---
 drivers/gpu/drm/v3d/v3d_debugfs.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/v3d/v3d_debugfs.c 
b/drivers/gpu/drm/v3d/v3d_debugfs.c
index d48008adb085..eb2b2d2f8553 100644
--- a/drivers/gpu/drm/v3d/v3d_debugfs.c
+++ b/drivers/gpu/drm/v3d/v3d_debugfs.c
@@ -71,10 +71,13 @@ static int v3d_v3d_debugfs_regs(struct seq_file *m, void 
*unused)
   V3D_READ(v3d_hub_reg_defs[i].reg));
}
 
-   for (i = 0; i < ARRAY_SIZE(v3d_gca_reg_defs); i++) {
-   seq_printf(m, "%s (0x%04x): 0x%08x\n",
-  v3d_gca_reg_defs[i].name, v3d_gca_reg_defs[i].reg,
-  V3D_GCA_READ(v3d_gca_reg_defs[i].reg));
+   if (v3d->ver < 41) {
+   for (i = 0; i < ARRAY_SIZE(v3d_gca_reg_defs); i++) {
+   seq_printf(m, "%s (0x%04x): 0x%08x\n",
+  v3d_gca_reg_defs[i].name,
+  v3d_gca_reg_defs[i].reg,
+  V3D_GCA_READ(v3d_gca_reg_defs[i].reg));
+   }
}
 
for (core = 0; core < v3d->cores; core++) {
-- 
2.18.0

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


[PATCH 1/4] drm/v3d: Fix a use-after-free race accessing the scheduler's fences.

2018-09-28 Thread Eric Anholt
Once we push the job, the scheduler could run it and free it.  So, if
we want to reference their fences, we need to grab them before then.
I haven't seen this happen in many days of conformance test runtime,
but let's still close the race.

Signed-off-by: Eric Anholt 
Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D 
V3.x+")
---
 drivers/gpu/drm/v3d/v3d_drv.h | 5 +
 drivers/gpu/drm/v3d/v3d_gem.c | 8 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/v3d/v3d_drv.h b/drivers/gpu/drm/v3d/v3d_drv.h
index 5042573e97f4..83c55ab6e1c0 100644
--- a/drivers/gpu/drm/v3d/v3d_drv.h
+++ b/drivers/gpu/drm/v3d/v3d_drv.h
@@ -204,6 +204,11 @@ struct v3d_exec_info {
 */
struct dma_fence *bin_done_fence;
 
+   /* Fence for when the scheduler considers the render to be
+* done, for when the BOs reservations should be complete.
+*/
+   struct dma_fence *render_done_fence;
+
struct kref refcount;
 
/* This is the array of BOs that were looked up at the start of exec. */
diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c
index e1fcbb4cd0ae..c98fbfbdb68e 100644
--- a/drivers/gpu/drm/v3d/v3d_gem.c
+++ b/drivers/gpu/drm/v3d/v3d_gem.c
@@ -209,7 +209,7 @@ v3d_flush_caches(struct v3d_dev *v3d)
 static void
 v3d_attach_object_fences(struct v3d_exec_info *exec)
 {
-   struct dma_fence *out_fence = &exec->render.base.s_fence->finished;
+   struct dma_fence *out_fence = exec->render_done_fence;
struct v3d_bo *bo;
int i;
 
@@ -409,6 +409,7 @@ v3d_exec_cleanup(struct kref *ref)
dma_fence_put(exec->render.done_fence);
 
dma_fence_put(exec->bin_done_fence);
+   dma_fence_put(exec->render_done_fence);
 
for (i = 0; i < exec->bo_count; i++)
drm_gem_object_put_unlocked(&exec->bo[i]->base);
@@ -574,6 +575,9 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data,
if (ret)
goto fail_unreserve;
 
+   exec->render_done_fence =
+   dma_fence_get(&exec->render.base.s_fence->finished);
+
kref_get(&exec->refcount); /* put by scheduler job completion */
drm_sched_entity_push_job(&exec->render.base,
  &v3d_priv->sched_entity[V3D_RENDER]);
@@ -587,7 +591,7 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data,
sync_out = drm_syncobj_find(file_priv, args->out_sync);
if (sync_out) {
drm_syncobj_replace_fence(sync_out,
- &exec->render.base.s_fence->finished);
+ exec->render_done_fence);
drm_syncobj_put(sync_out);
}
 
-- 
2.18.0

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


[PATCH 3/4] drm/v3d: Add some better documentation of the in_sync arguments.

2018-09-28 Thread Eric Anholt
Since this is UAPI, it's good to document what exactly the guarantees
we're providing are.

Signed-off-by: Eric Anholt 
---
 include/uapi/drm/v3d_drm.h | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/include/uapi/drm/v3d_drm.h b/include/uapi/drm/v3d_drm.h
index 7b6627783608..f446656d00b1 100644
--- a/include/uapi/drm/v3d_drm.h
+++ b/include/uapi/drm/v3d_drm.h
@@ -58,6 +58,11 @@ struct drm_v3d_submit_cl {
 * coordinate shader to determine where primitives land on the screen,
 * then writes out the state updates and draw calls necessary per tile
 * to the tile allocation BO.
+*
+* This BCL will block on any previous BCL submitted on the
+* same FD, but not on any RCL or BCLs submitted by other
+* clients -- that is left up to the submitter to control
+* using in_sync_bcl if necessary.
 */
__u32 bcl_start;
 
@@ -69,6 +74,11 @@ struct drm_v3d_submit_cl {
 * This is the second set of commands executed, which will either
 * execute the tiles that have been set up by the BCL, or a fixed set
 * of tiles (in the case of RCL-only blits).
+*
+* This RCL will block on this submit's BCL, and any previous
+* RCL submitted on the same FD, but not on any RCL or BCLs
+* submitted by other clients -- that is left up to the
+* submitter to control using in_sync_rcl if necessary.
 */
__u32 rcl_start;
 
-- 
2.18.0

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


[PATCH 2/4] drm/v3d: Add a little debugfs entry for measuring the core clock.

2018-09-28 Thread Eric Anholt
This adds just enough performance counter support to measure the
clock.  We don't have linux kernel drivers for the clock driving the
HW, and this was useful for determining that the V3D HW is running on
a slow clock, not that the driver was slow.

Signed-off-by: Eric Anholt 
---
 drivers/gpu/drm/v3d/v3d_debugfs.c | 35 +++
 drivers/gpu/drm/v3d/v3d_regs.h| 30 ++
 2 files changed, 65 insertions(+)

diff --git a/drivers/gpu/drm/v3d/v3d_debugfs.c 
b/drivers/gpu/drm/v3d/v3d_debugfs.c
index 4db62c545748..d48008adb085 100644
--- a/drivers/gpu/drm/v3d/v3d_debugfs.c
+++ b/drivers/gpu/drm/v3d/v3d_debugfs.c
@@ -176,9 +176,44 @@ static int v3d_debugfs_bo_stats(struct seq_file *m, void 
*unused)
return 0;
 }
 
+static int v3d_measure_clock(struct seq_file *m, void *unused)
+{
+   struct drm_info_node *node = (struct drm_info_node *)m->private;
+   struct drm_device *dev = node->minor->dev;
+   struct v3d_dev *v3d = to_v3d_dev(dev);
+   uint32_t cycles;
+   int core = 0;
+   int measure_ms = 1000;
+
+   if (v3d->ver >= 40) {
+   V3D_CORE_WRITE(core, V3D_V4_PCTR_0_SRC_0_3,
+  V3D_SET_FIELD(V3D_PCTR_CYCLE_COUNT,
+V3D_PCTR_S0));
+   V3D_CORE_WRITE(core, V3D_V4_PCTR_0_CLR, 1);
+   V3D_CORE_WRITE(core, V3D_V4_PCTR_0_EN, 1);
+   } else {
+   V3D_CORE_WRITE(core, V3D_V3_PCTR_0_PCTRS0,
+  V3D_PCTR_CYCLE_COUNT);
+   V3D_CORE_WRITE(core, V3D_V3_PCTR_0_CLR, 1);
+   V3D_CORE_WRITE(core, V3D_V3_PCTR_0_EN,
+  V3D_V3_PCTR_0_EN_ENABLE |
+  1);
+   }
+   msleep(measure_ms);
+   cycles = V3D_CORE_READ(core, V3D_PCTR_0_PCTR0);
+
+   seq_printf(m, "cycles: %d (%d.%d Mhz)\n",
+  cycles,
+  cycles / (measure_ms * 1000),
+  (cycles / (measure_ms * 100)) % 10);
+
+   return 0;
+}
+
 static const struct drm_info_list v3d_debugfs_list[] = {
{"v3d_ident", v3d_v3d_debugfs_ident, 0},
{"v3d_regs", v3d_v3d_debugfs_regs, 0},
+   {"measure_clock", v3d_measure_clock, 0},
{"bo_stats", v3d_debugfs_bo_stats, 0},
 };
 
diff --git a/drivers/gpu/drm/v3d/v3d_regs.h b/drivers/gpu/drm/v3d/v3d_regs.h
index 854046565989..c3a5e4e44f73 100644
--- a/drivers/gpu/drm/v3d/v3d_regs.h
+++ b/drivers/gpu/drm/v3d/v3d_regs.h
@@ -267,6 +267,36 @@
 # define V3D_PTB_BXCF_RWORDERDISA  BIT(1)
 # define V3D_PTB_BXCF_CLIPDISA BIT(0)
 
+#define V3D_V3_PCTR_0_EN   0x00674
+#define V3D_V3_PCTR_0_EN_ENABLEBIT(31)
+#define V3D_V4_PCTR_0_EN   0x00650
+/* When a bit is set, resets the counter to 0. */
+#define V3D_V3_PCTR_0_CLR  0x00670
+#define V3D_V4_PCTR_0_CLR  0x00654
+#define V3D_PCTR_0_OVERFLOW0x00658
+
+#define V3D_V3_PCTR_0_PCTRS0   0x00684
+#define V3D_V3_PCTR_0_PCTRS15  0x00660
+#define V3D_V3_PCTR_0_PCTRSX(x)(V3D_V3_PCTR_0_PCTRS0 + 
\
+   4 * (x))
+/* Each src reg muxes four counters each. */
+#define V3D_V4_PCTR_0_SRC_0_3  0x00660
+#define V3D_V4_PCTR_0_SRC_28_310x0067c
+# define V3D_PCTR_S0_MASK  V3D_MASK(6, 0)
+# define V3D_PCTR_S0_SHIFT 0
+# define V3D_PCTR_S1_MASK  V3D_MASK(14, 8)
+# define V3D_PCTR_S1_SHIFT 8
+# define V3D_PCTR_S2_MASK  V3D_MASK(22, 16)
+# define V3D_PCTR_S2_SHIFT 16
+# define V3D_PCTR_S3_MASK  V3D_MASK(30, 24)
+# define V3D_PCTR_S3_SHIFT 24
+# define V3D_PCTR_CYCLE_COUNT  32
+
+/* Output values of the counters. */
+#define V3D_PCTR_0_PCTR0   0x00680
+#define V3D_PCTR_0_PCTR31  0x006fc
+#define V3D_PCTR_0_PCTRX(x)(V3D_PCTR_0_PCTR0 + \
+   4 * (x))
 #define V3D_GMP_STATUS 0x00800
 # define V3D_GMP_STATUS_GMPRST BIT(31)
 # define V3D_GMP_STATUS_WR_COUNT_MASK  V3D_MASK(30, 24)
-- 
2.18.0

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


[PATCH v2] drm: Convert to using %pOFn instead of device_node.name

2018-09-28 Thread Rob Herring
In preparation to remove the node name pointer from struct device_node,
convert printf users to use the %pOFn format specifier.

For drm_modes.c, the full node path is already printed out, so printing
just the node name a 2nd time is redundant and can be removed.

Cc: Gustavo Padovan 
Cc: Maarten Lankhorst 
Cc: Sean Paul 
Cc: David Airlie 
Acked-by: Rob Clark 
Cc: dri-devel@lists.freedesktop.org
Cc: linux-arm-...@vger.kernel.org
Cc: freedr...@lists.freedesktop.org
Signed-off-by: Rob Herring 
---
v2:
- Add to commit msg that we're dropping redundant printing of node name.

 drivers/gpu/drm/drm_modes.c | 4 ++--
 drivers/gpu/drm/msm/hdmi/hdmi.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 02db9ac82d7a..24a750436559 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -716,8 +716,8 @@ int of_get_drm_display_mode(struct device_node *np,
if (bus_flags)
drm_bus_flags_from_videomode(&vm, bus_flags);
 
-   pr_debug("%pOF: got %dx%d display mode from %s\n",
-   np, vm.hactive, vm.vactive, np->name);
+   pr_debug("%pOF: got %dx%d display mode\n",
+   np, vm.hactive, vm.vactive);
drm_mode_debug_printmodeline(dmode);
 
return 0;
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index c79659ca5706..23670907a29d 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -579,7 +579,7 @@ static int msm_hdmi_bind(struct device *dev, struct device 
*master, void *data)
hdmi_cfg = (struct hdmi_platform_config *)
of_device_get_match_data(dev);
if (!hdmi_cfg) {
-   dev_err(dev, "unknown hdmi_cfg: %s\n", of_node->name);
+   dev_err(dev, "unknown hdmi_cfg: %pOFn\n", of_node);
return -ENXIO;
}
 
-- 
2.17.1

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


Re: [PATCH] fbdev: Convert to using %pOFn instead of device_node.name

2018-09-28 Thread Rob Herring
On Mon, Aug 27, 2018 at 8:55 PM Rob Herring  wrote:
>
> In preparation to remove the node name pointer from struct device_node,
> convert printf users to use the %pOFn format specifier.
>
> Cc: Bartlomiej Zolnierkiewicz 
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-fb...@vger.kernel.org
> Signed-off-by: Rob Herring 
> ---
>  drivers/video/fbdev/cg14.c|  4 +---
>  drivers/video/fbdev/cg3.c |  2 +-
>  drivers/video/fbdev/core/fbmon.c  |  4 ++--
>  drivers/video/fbdev/imsttfb.c |  2 +-
>  drivers/video/fbdev/leo.c |  2 +-
>  drivers/video/fbdev/offb.c| 12 
>  drivers/video/fbdev/p9100.c   |  2 +-
>  drivers/video/of_display_timing.c |  2 +-
>  8 files changed, 16 insertions(+), 14 deletions(-)

Ping!

>
> diff --git a/drivers/video/fbdev/cg14.c b/drivers/video/fbdev/cg14.c
> index 8de88b129b62..9af54c2368fd 100644
> --- a/drivers/video/fbdev/cg14.c
> +++ b/drivers/video/fbdev/cg14.c
> @@ -355,9 +355,7 @@ static int cg14_ioctl(struct fb_info *info, unsigned int 
> cmd, unsigned long arg)
>  static void cg14_init_fix(struct fb_info *info, int linebytes,
>   struct device_node *dp)
>  {
> -   const char *name = dp->name;
> -
> -   strlcpy(info->fix.id, name, sizeof(info->fix.id));
> +   snprintf(info->fix.id, sizeof(info->fix.id), "%pOFn", dp);
>
> info->fix.type = FB_TYPE_PACKED_PIXELS;
> info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
> diff --git a/drivers/video/fbdev/cg3.c b/drivers/video/fbdev/cg3.c
> index 6c334260cf53..1bd95b02f3aa 100644
> --- a/drivers/video/fbdev/cg3.c
> +++ b/drivers/video/fbdev/cg3.c
> @@ -246,7 +246,7 @@ static int cg3_ioctl(struct fb_info *info, unsigned int 
> cmd, unsigned long arg)
>  static void cg3_init_fix(struct fb_info *info, int linebytes,
>  struct device_node *dp)
>  {
> -   strlcpy(info->fix.id, dp->name, sizeof(info->fix.id));
> +   snprintf(info->fix.id, sizeof(info->fix.id), "%pOFn", dp);
>
> info->fix.type = FB_TYPE_PACKED_PIXELS;
> info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
> diff --git a/drivers/video/fbdev/core/fbmon.c 
> b/drivers/video/fbdev/core/fbmon.c
> index 852d86c1c527..dd3128990776 100644
> --- a/drivers/video/fbdev/core/fbmon.c
> +++ b/drivers/video/fbdev/core/fbmon.c
> @@ -1480,8 +1480,8 @@ int of_get_fb_videomode(struct device_node *np, struct 
> fb_videomode *fb,
> if (ret)
> return ret;
>
> -   pr_debug("%pOF: got %dx%d display mode from %s\n",
> -   np, vm.hactive, vm.vactive, np->name);
> +   pr_debug("%pOF: got %dx%d display mode\n",
> +   np, vm.hactive, vm.vactive);
> dump_fb_videomode(fb);
>
> return 0;
> diff --git a/drivers/video/fbdev/imsttfb.c b/drivers/video/fbdev/imsttfb.c
> index ecdcf358ad5e..901ca4ed10e9 100644
> --- a/drivers/video/fbdev/imsttfb.c
> +++ b/drivers/video/fbdev/imsttfb.c
> @@ -1473,7 +1473,7 @@ static int imsttfb_probe(struct pci_dev *pdev, const 
> struct pci_device_id *ent)
>
> dp = pci_device_to_OF_node(pdev);
> if(dp)
> -   printk(KERN_INFO "%s: OF name %s\n",__func__, dp->name);
> +   printk(KERN_INFO "%s: OF name %pOFn\n",__func__, dp);
> else if (IS_ENABLED(CONFIG_OF))
> printk(KERN_ERR "imsttfb: no OF node for pci device\n");
>
> diff --git a/drivers/video/fbdev/leo.c b/drivers/video/fbdev/leo.c
> index 71862188f528..446ac3364bad 100644
> --- a/drivers/video/fbdev/leo.c
> +++ b/drivers/video/fbdev/leo.c
> @@ -434,7 +434,7 @@ static int leo_ioctl(struct fb_info *info, unsigned int 
> cmd, unsigned long arg)
>  static void
>  leo_init_fix(struct fb_info *info, struct device_node *dp)
>  {
> -   strlcpy(info->fix.id, dp->name, sizeof(info->fix.id));
> +   snprintf(info->fix.id, sizeof(info->fix.id), "%pOFn", dp);
>
> info->fix.type = FB_TYPE_PACKED_PIXELS;
> info->fix.visual = FB_VISUAL_TRUECOLOR;
> diff --git a/drivers/video/fbdev/offb.c b/drivers/video/fbdev/offb.c
> index 77c0a2f45b3b..31f769d67195 100644
> --- a/drivers/video/fbdev/offb.c
> +++ b/drivers/video/fbdev/offb.c
> @@ -419,9 +419,13 @@ static void __init offb_init_fb(const char *name,
> var = &info->var;
> info->par = par;
>
> -   strcpy(fix->id, "OFfb ");
> -   strncat(fix->id, name, sizeof(fix->id) - sizeof("OFfb "));
> -   fix->id[sizeof(fix->id) - 1] = '\0';
> +   if (name) {
> +   strcpy(fix->id, "OFfb ");
> +   strncat(fix->id, name, sizeof(fix->id) - sizeof("OFfb "));
> +   fix->id[sizeof(fix->id) - 1] = '\0';
> +   } else
> +   snprintf(fix->id, sizeof(fix->id), "OFfb %pOFn", dp);
> +
>
> var->xres = var->xres_virtual = width;
> var->yres = var->yres_virtual = height;
> @@ -644,7 +648,7 @@ static void __init offb_init_nodriver(struct device_node 
> *dp, int no_real_node)
> /* kludge for valkyrie */
> if (strcm

Re: [Intel-gfx] [PATCH 5/5] drm/dp/mst: Provide better debugs for NAK replies

2018-09-28 Thread kbuild test robot
Hi Ville,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on sof-driver-fuweitax/master]
[also build test WARNING on v4.19-rc5 next-20180928]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Ville-Syrjala/drm-dp-mst-Configure-no_stop_bit-correctly-for-remote-i2c-xfers/20180929-040153
base:   https://github.com/fuweitax/linux master
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=m68k 

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/drm_dp_mst_topology.c:70:0: warning: "STR" redefined
#define STR(x) [DP_ ## x] = #x

   In file included from arch/m68k/include/asm/irqflags.h:8:0,
from include/linux/irqflags.h:16,
from arch/m68k/include/asm/atomic.h:6,
from include/linux/atomic.h:5,
from include/linux/rcupdate.h:38,
from include/linux/rculist.h:11,
from include/linux/pid.h:5,
from include/linux/sched.h:14,
from drivers/gpu/drm/drm_dp_mst_topology.c:27:
   arch/m68k/include/asm/entry.h:244:0: note: this is the location of the 
previous definition
#define STR(X) STR1(X)


vim +/STR +70 drivers/gpu/drm/drm_dp_mst_topology.c

69  
  > 70  #define STR(x) [DP_ ## x] = #x
71  

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


.config.gz
Description: application/gzip
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 201275] Power consumption RX460 idle raised from 7 W to 13 W

2018-09-28 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=201275

--- Comment #3 from quirin.blae...@freenet.de ---
Am 28.09.18 um 20:14 schrieb bugzilla-dae...@bugzilla.kernel.org:
> https://bugzilla.kernel.org/show_bug.cgi?id=201275
> 
> --- Comment #2 from Alex Deucher (alexdeuc...@gmail.com) ---
> Git bisect howto:
> https://www.kernel.org/doc/html/v4.18/admin-guide/bug-bisect.html
> 
Sounds prakticable, but may take 1-2 days.

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


vc4: NULL pointer dereference in drm_client_dev_hotplug

2018-09-28 Thread Stefan Wahren
Hi,

Sergey Suloev already reported this NULL pointer dereference [1]. Now he was 
able to provide a Kernel config and i'm able to reproduce it with a Raspberry 
Pi 3 (arm64) and Linux 4.19-rc5. It seems like a invalid config [2] for vc4, 
but nevertheless the driver shouldn't crash at boot.


[9.124598] vc4_hdmi 3f902000.hdmi: ASoC: Failed to create component debugfs 
directory
[9.147667] vc4_hdmi 3f902000.hdmi: vc4-hdmi-hifi <-> 3f902000.hdmi mapping 
ok
[9.155184] vc4_hdmi 3f902000.hdmi: ASoC: no DMI vendor name!
[9.166544] vc4-drm soc:gpu: bound 3f902000.hdmi (ops vc4_hdmi_ops [vc4])
[9.173840] vc4-drm soc:gpu: bound 3f806000.vec (ops vc4_vec_ops [vc4])
[9.181029] vc4-drm soc:gpu: bound 3f004000.txp (ops vc4_txp_ops [vc4])
[9.188519] vc4-drm soc:gpu: bound 3f40.hvs (ops vc4_hvs_ops [vc4])
[9.195690] vc4-drm soc:gpu: bound 3f206000.pixelvalve (ops vc4_crtc_ops 
[vc4])
[9.203523] vc4-drm soc:gpu: bound 3f207000.pixelvalve (ops vc4_crtc_ops 
[vc4])
[9.215032] vc4-drm soc:gpu: bound 3f807000.pixelvalve (ops vc4_crtc_ops 
[vc4])
[9.274785] vc4-drm soc:gpu: bound 3fc0.v3d (ops vc4_v3d_ops [vc4])
[9.290246] [drm] Initialized vc4 0.0.0 20140616 for soc:gpu on minor 0
[9.297464] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[9.304600] [drm] Driver supports precise vblank timestamp query.
[9.323839] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio 
for chip BCM43430/1
[9.382856] vc4-drm soc:gpu: [drm:drm_fb_helper_fbdev_setup 
[drm_kms_helper]] *ERROR* Failed to set fbdev configuration
[9.513495] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio 
for chip BCM43430/1
[9.522507] brcmfmac mmc1:0001:1: Direct firmware load for 
brcm/brcmfmac43430-sdio.clm_blob failed with error -2
[9.532939] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available 
(err=-2), device may have limited channels available
[9.545064] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Oct 
23 2017 03:55:53 version 7.45.98.38 (r674442 CY) FWID 01-e58d219f
[   10.404937] Unable to handle kernel paging request at virtual address 
00330a656369768a
[   10.413081] Mem abort info:
[   10.415939]   ESR = 0x9604
[   10.419082]   Exception class = DABT (current EL), IL = 32 bits
[   10.425357]   SET = 0, FnV = 0
[   10.428533]   EA = 0, S1PTW = 0
[   10.431729] Data abort info:
[   10.434674]   ISV = 0, ISS = 0x0004
[   10.438589]   CM = 0, WnR = 0
[   10.441620] [00330a656369768a] address between user and kernel address ranges
[   10.449087] Internal error: Oops: 9604 [#1] PREEMPT SMP
[   10.454762] Modules linked in: brcmfmac vc4 drm_kms_helper cfg80211 drm 
rfkill smsc95xx brcmutil usbnet drm_panel_orientation_quirks raspberrypi_hwmon 
bcm2835_dma crc32_ce pwm_bcm2835 bcm2835_rng virt_dma rng_core i2c_bcm2835 
ip_tables x_tables ipv6
[   10.477296] CPU: 2 PID: 45 Comm: kworker/2:1 Not tainted 4.19.0-rc5 #3
[   10.483934] Hardware name: Raspberry Pi 3 Model B Rev 1.2 (DT)
[   10.489966] Workqueue: events output_poll_execute [drm_kms_helper]
[   10.496261] pstate: 8005 (Nzcv daif -PAN -UAO)
[   10.501321] pc : drm_client_dev_hotplug+0x5c/0xb0 [drm]
[   10.506776] lr : drm_client_dev_hotplug+0x38/0xb0 [drm]
[   10.512087] sp : 08e83cd0
[   10.515455] x29: 08e83cd0 x28:  
[   10.520859] x27: 00ad1c60 x26: 800034207230 
[   10.526263] x25: 0001 x24: 0002 
[   10.531666] x23: 8000342070f8 x22: 009bd398 
[   10.537070] x21: 800034207118 x20: 800034207000 
[   10.542474] x19: 800035638800 x18:  
[   10.547877] x17:  x16:  
[   10.553281] x15: 0400 x14: 0400 
[   10.558685] x13: 0002 x12:  
[   10.564088] x11:  x10:  
[   10.569492] x9 : 0001 x8 :  
[   10.574896] x7 : 8000373a52a0 x6 : 800033087500 
[   10.580298] x5 : 08e83ba0 x4 : 8000373bdc20 
[   10.585701] x3 : 8000342070f8 x2 : 800035fb9a80 
[   10.591104] x1 : 30330a6563697672 x0 : 800035638800 
[   10.596515] Process kworker/2:1 (pid: 45, stack limit = 0x7e8924dc)
[   10.603590] Call trace:
[   10.606259]  drm_client_dev_hotplug+0x5c/0xb0 [drm]
[   10.611303]  drm_kms_helper_hotplug_event+0x30/0x40 [drm_kms_helper]
[   10.617849]  output_poll_execute+0xc4/0x1e0 [drm_kms_helper]
[   10.623616]  process_one_work+0x1c8/0x318
[   10.627695]  worker_thread+0x48/0x428
[   10.631420]  kthread+0xf8/0x128
[   10.634615]  ret_from_fork+0x10/0x18
[   10.638255] Code: 54000220 f9401261 aa1303e0 b4000141 (f9400c21) 
[   10.644456] ---[ end trace c75b4a4b0e141908 ]---

[1] - 
https://lists.freedesktop.org/archives/dri-devel/2018-September/188812.html
[2] - https://github.com/anholt/linux/files/2429699/arm64_config.txt
___
dri-d

[Bug 108037] Turning monitors off and on again makes the kernel panic and system freeze

2018-09-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108037

Öyvind Saether  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Öyvind Saether  ---
After 1 day, 12:48 with 4.19.0-rc5-ChaeKyung-April I've yet to trigger this and
I've tried. I don't see why it would magically be fixed but I can't really
provide any useful information. I could between rc1 and rc3 but I couldn't
trigger it too reliably and do an accurate bisect. Might as well re-open if I
it happens again and I can provide any actual useful information.

-- 
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/imx: Switch to SPDX identifier

2018-09-28 Thread Fabio Estevam
Adopt the SPDX license identifier headers to ease license compliance
management.

Signed-off-by: Fabio Estevam 
---
 drivers/gpu/drm/imx/dw_hdmi-imx.c  |  5 +
 drivers/gpu/drm/imx/imx-drm-core.c | 11 +--
 drivers/gpu/drm/imx/imx-ldb.c  | 10 +-
 drivers/gpu/drm/imx/imx-tve.c  | 10 +-
 drivers/gpu/drm/imx/ipuv3-crtc.c   | 10 +-
 drivers/gpu/drm/imx/ipuv3-plane.c  | 10 +-
 drivers/gpu/drm/imx/parallel-display.c | 10 +-
 7 files changed, 7 insertions(+), 59 deletions(-)

diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c 
b/drivers/gpu/drm/imx/dw_hdmi-imx.c
index fe6becd..77a26fd 100644
--- a/drivers/gpu/drm/imx/dw_hdmi-imx.c
+++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c
@@ -1,10 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
 /* Copyright (C) 2011-2013 Freescale Semiconductor, Inc.
  *
  * derived from imx-hdmi.c(renamed to bridge/dw_hdmi.c now)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
  */
 #include 
 #include 
diff --git a/drivers/gpu/drm/imx/imx-drm-core.c 
b/drivers/gpu/drm/imx/imx-drm-core.c
index 0e6942f..820c7e3 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -1,17 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Freescale i.MX drm driver
  *
  * Copyright (C) 2011 Sascha Hauer, Pengutronix
- *
- * 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.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
  */
 #include 
 #include 
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index 3bd0f8a..2c5bbe3 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -1,16 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * i.MX drm driver - LVDS display bridge
  *
  * Copyright (C) 2012 Sascha Hauer, Pengutronix
- *
- * 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.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include 
diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c
index cffd331..4bc3ead 100644
--- a/drivers/gpu/drm/imx/imx-tve.c
+++ b/drivers/gpu/drm/imx/imx-tve.c
@@ -1,16 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * i.MX drm driver - Television Encoder (TVEv2)
  *
  * Copyright (C) 2013 Philipp Zabel, Pengutronix
- *
- * 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.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include 
diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c
index 7d4b710..058b53c 100644
--- a/drivers/gpu/drm/imx/ipuv3-crtc.c
+++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
@@ -1,16 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * i.MX IPUv3 Graphics driver
  *
  * Copyright (C) 2011 Sascha Hauer, Pengutronix
- *
- * 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.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 #include 
 #include 
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c 
b/drivers/gpu/drm/imx/ipuv3-plane.c
index 40605fd..9db833b 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -1,16 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * i.MX IPUv3 DP Overlay Planes
  *
  * Copyright (C) 2013 Philipp Zabel, Pengutronix
- *
- * This program is free softwa

[Bug 201275] Power consumption RX460 idle raised from 7 W to 13 W

2018-09-28 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=201275

--- Comment #2 from Alex Deucher (alexdeuc...@gmail.com) ---
Git bisect howto:
https://www.kernel.org/doc/html/v4.18/admin-guide/bug-bisect.html

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


[PATCH 2/5] drm/dp/mst: Validate REMOTE_I2C_READ harder

2018-09-28 Thread Ville Syrjala
From: Ville Syrjälä 

Make sure i2c msgs we're asked to transfer conform to the
requirements of REMOTE_I2C_READ. We were only checking that the
last message is a read, but we must also check that the preceding
messages are all writes. Also check that the length of each
message isn't too long.

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 25 ++---
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index 3b400eab18a2..a0652fc166c6 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -3239,6 +3239,23 @@ void drm_dp_mst_topology_mgr_destroy(struct 
drm_dp_mst_topology_mgr *mgr)
 }
 EXPORT_SYMBOL(drm_dp_mst_topology_mgr_destroy);
 
+static bool remote_i2c_read_ok(const struct i2c_msg msgs[], int num)
+{
+   int i;
+
+   if (num - 1 > DP_REMOTE_I2C_READ_MAX_TRANSACTIONS)
+   return false;
+
+   for (i = 0; i < num - 1; i++) {
+   if (msgs[i].flags & I2C_M_RD ||
+   msgs[i].len > 0xff)
+   return false;
+   }
+
+   return msgs[num - 1].flags & I2C_M_RD &&
+   msgs[num - 1].len <= 0xff;
+}
+
 /* I2C device */
 static int drm_dp_mst_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg 
*msgs,
   int num)
@@ -3248,7 +3265,6 @@ static int drm_dp_mst_i2c_xfer(struct i2c_adapter 
*adapter, struct i2c_msg *msgs
struct drm_dp_mst_branch *mstb;
struct drm_dp_mst_topology_mgr *mgr = port->mgr;
unsigned int i;
-   bool reading = false;
struct drm_dp_sideband_msg_req_body msg;
struct drm_dp_sideband_msg_tx *txmsg = NULL;
int ret;
@@ -3257,12 +3273,7 @@ static int drm_dp_mst_i2c_xfer(struct i2c_adapter 
*adapter, struct i2c_msg *msgs
if (!mstb)
return -EREMOTEIO;
 
-   /* construct i2c msg */
-   /* see if last msg is a read */
-   if (msgs[num - 1].flags & I2C_M_RD)
-   reading = true;
-
-   if (!reading || (num - 1 > DP_REMOTE_I2C_READ_MAX_TRANSACTIONS)) {
+   if (!remote_i2c_read_ok(msgs, num)) {
DRM_DEBUG_KMS("Unsupported I2C transaction for MST device\n");
ret = -EIO;
goto out;
-- 
2.16.4

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


[PATCH 3/5] drm/dp: Implement I2C_M_STOP for i2c-over-aux

2018-09-28 Thread Ville Syrjala
From: Ville Syrjälä 

Consult the I2C_M_STOP flag to determine whether to set the MOT bit or
not. Makes it possible to send multiple messages in one go with
stop+start generated between the messages (as opposed nothing or
repstart depending on whether thr address/rw changed).

Not sure anyone has actual use for this but figured I'd handle it
since I started to look at that flag for MST remote i2c xfers.

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/drm_dp_helper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 37c01b6076ec..e85cea299d2a 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -884,7 +884,8 @@ static void drm_dp_i2c_msg_set_request(struct 
drm_dp_aux_msg *msg,
 {
msg->request = (i2c_msg->flags & I2C_M_RD) ?
DP_AUX_I2C_READ : DP_AUX_I2C_WRITE;
-   msg->request |= DP_AUX_I2C_MOT;
+   if (!(i2c_msg->flags & I2C_M_STOP))
+   msg->request |= DP_AUX_I2C_MOT;
 }
 
 /*
-- 
2.16.4

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


[PATCH 5/5] drm/dp/mst: Provide better debugs for NAK replies

2018-09-28 Thread Ville Syrjala
From: Ville Syrjälä 

Decode the NAK reply fields to make it easier to parse the logs.

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 65 ++-
 include/drm/drm_dp_helper.h   |  1 +
 2 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index c0f754364cc7..1178c1655f9a 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -66,6 +66,64 @@ static bool drm_dp_validate_guid(struct 
drm_dp_mst_topology_mgr *mgr,
 static int drm_dp_mst_register_i2c_bus(struct drm_dp_aux *aux);
 static void drm_dp_mst_unregister_i2c_bus(struct drm_dp_aux *aux);
 static void drm_dp_mst_kick_tx(struct drm_dp_mst_topology_mgr *mgr);
+
+#define STR(x) [DP_ ## x] = #x
+
+static const char *drm_dp_mst_req_type_str(u8 req_type)
+{
+   static const char * const req_type_str[] = {
+   STR(GET_MSG_TRANSACTION_VERSION),
+   STR(LINK_ADDRESS),
+   STR(CONNECTION_STATUS_NOTIFY),
+   STR(ENUM_PATH_RESOURCES),
+   STR(ALLOCATE_PAYLOAD),
+   STR(QUERY_PAYLOAD),
+   STR(RESOURCE_STATUS_NOTIFY),
+   STR(CLEAR_PAYLOAD_ID_TABLE),
+   STR(REMOTE_DPCD_READ),
+   STR(REMOTE_DPCD_WRITE),
+   STR(REMOTE_I2C_READ),
+   STR(REMOTE_I2C_WRITE),
+   STR(POWER_UP_PHY),
+   STR(POWER_DOWN_PHY),
+   STR(SINK_EVENT_NOTIFY),
+   STR(QUERY_STREAM_ENC_STATUS),
+   };
+
+   if (req_type >= ARRAY_SIZE(req_type_str) ||
+   !req_type_str[req_type])
+   return "unknown";
+
+   return req_type_str[req_type];
+}
+
+#undef STR
+#define STR(x) [DP_NAK_ ## x] = #x
+
+static const char *drm_dp_mst_nak_reason_str(u8 nak_reason)
+{
+   static const char * const nak_reason_str[] = {
+   STR(WRITE_FAILURE),
+   STR(INVALID_READ),
+   STR(CRC_FAILURE),
+   STR(BAD_PARAM),
+   STR(DEFER),
+   STR(LINK_FAILURE),
+   STR(NO_RESOURCES),
+   STR(DPCD_FAIL),
+   STR(I2C_NAK),
+   STR(ALLOCATE_FAIL),
+   };
+
+   if (nak_reason >= ARRAY_SIZE(nak_reason_str) ||
+   !nak_reason_str[nak_reason])
+   return "unknown";
+
+   return nak_reason_str[nak_reason];
+}
+
+#undef STR
+
 /* sideband msg handling */
 static u8 drm_dp_msg_header_crc4(const uint8_t *data, size_t num_nibbles)
 {
@@ -2349,7 +2407,12 @@ static int drm_dp_mst_handle_down_rep(struct 
drm_dp_mst_topology_mgr *mgr)
 
drm_dp_sideband_parse_reply(&mgr->down_rep_recv, &txmsg->reply);
if (txmsg->reply.reply_type == DP_REPLY_NAK) {
-   DRM_DEBUG_KMS("Got NAK reply: req 0x%02x, reason 
0x%02x, nak data 0x%02x\n", txmsg->reply.req_type, txmsg->reply.u.nak.reason, 
txmsg->reply.u.nak.nak_data);
+   DRM_DEBUG_KMS("Got NAK reply: req 0x%02x (%s), reason 
0x%02x (%s), nak data 0x%02x\n",
+ txmsg->reply.req_type,
+ 
drm_dp_mst_req_type_str(txmsg->reply.req_type),
+ txmsg->reply.u.nak.reason,
+ 
drm_dp_mst_nak_reason_str(txmsg->reply.u.nak.reason),
+ txmsg->reply.u.nak.nak_data);
}
 
memset(&mgr->down_rep_recv, 0, sizeof(struct 
drm_dp_sideband_msg_rx));
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 2a0fd9d7066e..2453767246fb 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -918,6 +918,7 @@
 #define DP_PEER_DEVICE_DP_LEGACY_CONV  0x4
 
 /* DP 1.2 MST sideband request names DP 1.2a Table 2-80 */
+#define DP_GET_MSG_TRANSACTION_VERSION 0x00 /* DP 1.3 */
 #define DP_LINK_ADDRESS0x01
 #define DP_CONNECTION_STATUS_NOTIFY0x02
 #define DP_ENUM_PATH_RESOURCES 0x10
-- 
2.16.4

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


[PATCH 1/5] drm/dp/mst: Configure no_stop_bit correctly for remote i2c xfers

2018-09-28 Thread Ville Syrjala
From: Ville Syrjälä 

We aren't supposed to force a stop+start between every i2c msg
when performing multi message transfers. This should eg. cause
the DDC segment address to be reset back to 0 between writing
the segment address and reading the actual EDID extension block.

To quote the E-DDC spec:
"... this standard requires that the segment pointer be
 reset to 00h when a NO ACK or a STOP condition is received."

Since we're going to touch this might as well consult the
I2C_M_STOP flag to determine whether we want to force the stop
or not.

Cc: Brian Vincent 
References: https://bugs.freedesktop.org/show_bug.cgi?id=108081
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index 5ff1d79b86c4..3b400eab18a2 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -3276,6 +3276,7 @@ static int drm_dp_mst_i2c_xfer(struct i2c_adapter 
*adapter, struct i2c_msg *msgs
msg.u.i2c_read.transactions[i].i2c_dev_id = msgs[i].addr;
msg.u.i2c_read.transactions[i].num_bytes = msgs[i].len;
msg.u.i2c_read.transactions[i].bytes = msgs[i].buf;
+   msg.u.i2c_read.transactions[i].no_stop_bit = !(msgs[i].flags & 
I2C_M_STOP);
}
msg.u.i2c_read.read_i2c_device_id = msgs[num - 1].addr;
msg.u.i2c_read.num_bytes_read = msgs[num - 1].len;
-- 
2.16.4

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


[PATCH 4/5] drm/dp/mst: Provide defines for ACK vs. NAK reply type

2018-09-28 Thread Ville Syrjala
From: Ville Syrjälä 

Make the code a bit easier to read by providing symbolic names
for the reply_type (ACK vs. NAK). Also clean up some brace stuff
while at it.

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 26 +-
 include/drm/drm_dp_helper.h   |  4 
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index a0652fc166c6..c0f754364cc7 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -567,7 +567,7 @@ static bool drm_dp_sideband_parse_reply(struct 
drm_dp_sideband_msg_rx *raw,
msg->reply_type = (raw->msg[0] & 0x80) >> 7;
msg->req_type = (raw->msg[0] & 0x7f);
 
-   if (msg->reply_type) {
+   if (msg->reply_type == DP_REPLY_NAK) {
memcpy(msg->u.nak.guid, &raw->msg[1], 16);
msg->u.nak.reason = raw->msg[17];
msg->u.nak.nak_data = raw->msg[18];
@@ -1614,9 +1614,9 @@ static void drm_dp_send_link_address(struct 
drm_dp_mst_topology_mgr *mgr,
if (ret > 0) {
int i;
 
-   if (txmsg->reply.reply_type == 1)
+   if (txmsg->reply.reply_type == DP_REPLY_NAK) {
DRM_DEBUG_KMS("link address nak received\n");
-   else {
+   } else {
DRM_DEBUG_KMS("link address reply: %d\n", 
txmsg->reply.u.link_addr.nports);
for (i = 0; i < txmsg->reply.u.link_addr.nports; i++) {
DRM_DEBUG_KMS("port %d: input %d, pdt: %d, pn: 
%d, dpcd_rev: %02x, mcs: %d, ddps: %d, ldps %d, sdp %d/%d\n", i,
@@ -1665,9 +1665,9 @@ static int drm_dp_send_enum_path_resources(struct 
drm_dp_mst_topology_mgr *mgr,
 
ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
if (ret > 0) {
-   if (txmsg->reply.reply_type == 1)
+   if (txmsg->reply.reply_type == DP_REPLY_NAK) {
DRM_DEBUG_KMS("enum path resources nak received\n");
-   else {
+   } else {
if (port->port_num != 
txmsg->reply.u.path_resources.port_number)
DRM_ERROR("got incorrect port in response\n");
DRM_DEBUG_KMS("enum path resources %d: %d %d\n", 
txmsg->reply.u.path_resources.port_number, 
txmsg->reply.u.path_resources.full_payload_bw_number,
@@ -1755,9 +1755,9 @@ static int drm_dp_payload_send_msg(struct 
drm_dp_mst_topology_mgr *mgr,
 
ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
if (ret > 0) {
-   if (txmsg->reply.reply_type == 1) {
+   if (txmsg->reply.reply_type == DP_REPLY_NAK)
ret = -EINVAL;
-   } else
+   else
ret = 0;
}
kfree(txmsg);
@@ -1789,7 +1789,7 @@ int drm_dp_send_power_updown_phy(struct 
drm_dp_mst_topology_mgr *mgr,
 
ret = drm_dp_mst_wait_tx_reply(port->parent, txmsg);
if (ret > 0) {
-   if (txmsg->reply.reply_type == 1)
+   if (txmsg->reply.reply_type == DP_REPLY_NAK)
ret = -EINVAL;
else
ret = 0;
@@ -2026,9 +2026,9 @@ static int drm_dp_send_dpcd_write(struct 
drm_dp_mst_topology_mgr *mgr,
 
ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
if (ret > 0) {
-   if (txmsg->reply.reply_type == 1) {
+   if (txmsg->reply.reply_type == DP_REPLY_NAK)
ret = -EINVAL;
-   } else
+   else
ret = 0;
}
kfree(txmsg);
@@ -2041,7 +2041,7 @@ static int drm_dp_encode_up_ack_reply(struct 
drm_dp_sideband_msg_tx *msg, u8 req
 {
struct drm_dp_sideband_msg_reply_body reply;
 
-   reply.reply_type = 0;
+   reply.reply_type = DP_REPLY_ACK;
reply.req_type = req_type;
drm_dp_encode_sideband_reply(&reply, msg);
return 0;
@@ -2348,7 +2348,7 @@ static int drm_dp_mst_handle_down_rep(struct 
drm_dp_mst_topology_mgr *mgr)
}
 
drm_dp_sideband_parse_reply(&mgr->down_rep_recv, &txmsg->reply);
-   if (txmsg->reply.reply_type == 1) {
+   if (txmsg->reply.reply_type == DP_REPLY_NAK) {
DRM_DEBUG_KMS("Got NAK reply: req 0x%02x, reason 
0x%02x, nak data 0x%02x\n", txmsg->reply.req_type, txmsg->reply.u.nak.reason, 
txmsg->reply.u.nak.nak_data);
}
 
@@ -3306,7 +3306,7 @@ static int drm_dp_mst_i2c_xfer(struct i2c_adapter 
*adapter, struct i2c_msg *msgs
ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
if (ret > 0) {
 
-   if (txmsg->reply.reply_type == 1) { /* got a NAK back */
+   if (txmsg->reply.reply_type == DP_REPLY_NAK) {
ret = -EREMOTEIO;
goto out;
   

Re: [git pull[ drm fixes for 4.19-rc6

2018-09-28 Thread Greg Kroah-Hartman
On Fri, Sep 28, 2018 at 09:59:11AM +1000, Dave Airlie wrote:
> Hi Greg,
> 
> Looks like a pretty normal week for graphics,
> 
> core: syncobj fix, panel link regression revert
> amd: suspend/resume fixes, EDID emulation fix
> mali-dp: NV12 writeback and vblank reset fixes
> etnaviv: DMA setup fix
> 
> Regards,
> Dave.
> 
> drm-fixes-2018-09-28:
> amd, etnaviv, mali_dp, syncobj and panel fixes
> The following changes since commit 6bf4ca7fbc85d80446ac01c0d1d77db4d91a6d84:
> 
>   Linux 4.19-rc5 (2018-09-23 19:15:18 +0200)
> 
> are available in the Git repository at:
> 
>   git://anongit.freedesktop.org/drm/drm tags/drm-fixes-2018-09-28

Now pulled, thanks.

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


[Bug 201275] Power consumption RX460 idle raised from 7 W to 13 W

2018-09-28 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=201275

Alex Deucher (alexdeuc...@gmail.com) changed:

   What|Removed |Added

 CC||alexdeuc...@gmail.com

--- Comment #1 from Alex Deucher (alexdeuc...@gmail.com) ---
Can you bisect?

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


Re: [PATCH] drm/msm/a6xx: Vote for a reasonable bus quota before starting GMU init

2018-09-28 Thread kbuild test robot
Hi Jordan,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on robclark/msm-next]
[also build test ERROR on v4.19-rc5 next-20180928]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Jordan-Crouse/drm-msm-a6xx-Vote-for-a-reasonable-bus-quota-before-starting-GMU-init/20180928-223510
base:   git://people.freedesktop.org/~robclark/linux msm-next
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=arm 

All error/warnings (new ones prefixed by >>):

   drivers/gpu//drm/msm/adreno/a6xx_gmu.c: In function 'a6xx_gmu_resume':
>> drivers/gpu//drm/msm/adreno/a6xx_gmu.c:658:2: error: implicit declaration of 
>> function 'icc_set' [-Werror=implicit-function-declaration]
 icc_set(gpu->icc_path, 0, 307200);
 ^~~
>> drivers/gpu//drm/msm/adreno/a6xx_gmu.c:658:13: error: 'struct msm_gpu' has 
>> no member named 'icc_path'
 icc_set(gpu->icc_path, 0, 307200);
^~
>> drivers/gpu//drm/msm/adreno/a6xx_gmu.c:658:2: warning: this decimal constant 
>> is unsigned only in ISO C90
 icc_set(gpu->icc_path, 0, 307200);
 ^~~
   drivers/gpu//drm/msm/adreno/a6xx_gmu.c: In function 'a6xx_gmu_stop':
   drivers/gpu//drm/msm/adreno/a6xx_gmu.c:749:13: error: 'struct msm_gpu' has 
no member named 'icc_path'
 icc_set(gpu->icc_path, 0, 0);
^~
   cc1: some warnings being treated as errors

vim +/icc_set +658 drivers/gpu//drm/msm/adreno/a6xx_gmu.c

   637  
   638  int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
   639  {
   640  struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;
   641  struct msm_gpu *gpu = &adreno_gpu->base;
   642  struct a6xx_gmu *gmu = &a6xx_gpu->gmu;
   643  int status, ret;
   644  
   645  if (WARN(!gmu->mmio, "The GMU is not set up yet\n"))
   646  return 0;
   647  
   648  /* Turn on the resources */
   649  pm_runtime_get_sync(gmu->dev);
   650  
   651  /* Use a known rate to bring up the GMU */
   652  clk_set_rate(gmu->core_clk, 2);
   653  ret = clk_bulk_prepare_enable(gmu->nr_clocks, gmu->clocks);
   654  if (ret)
   655  goto out;
   656  
   657  /* Set the bus quota to a reasonable value for boot */
 > 658  icc_set(gpu->icc_path, 0, 307200);
   659  
   660  a6xx_gmu_irq_enable(gmu);
   661  
   662  /* Check to see if we are doing a cold or warm boot */
   663  status = gmu_read(gmu, REG_A6XX_GMU_GENERAL_7) == 1 ?
   664  GMU_WARM_BOOT : GMU_COLD_BOOT;
   665  
   666  ret = a6xx_gmu_fw_start(gmu, status);
   667  if (ret)
   668  goto out;
   669  
   670  ret = a6xx_hfi_start(gmu, status);
   671  
   672  /* Set the GPU to the highest power frequency */
   673  a6xx_gmu_set_freq(gmu, gmu->nr_gpu_freqs - 1);
   674  
   675  out:
   676  /* Make sure to turn off the boot OOB request on error */
   677  if (ret)
   678  a6xx_gmu_clear_oob(gmu, GMU_OOB_BOOT_SLUMBER);
   679  
   680  return ret;
   681  }
   682  

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


.config.gz
Description: application/gzip
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 201275] New: Power consumption RX460 idle raised from 7 W to 13 W

2018-09-28 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=201275

Bug ID: 201275
   Summary: Power consumption RX460 idle raised from  7 W to 13 W
   Product: Drivers
   Version: 2.5
Kernel Version: 4.18.10
  Hardware: All
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: low
  Priority: P1
 Component: Video(DRI - non Intel)
  Assignee: drivers_video-...@kernel-bugs.osdl.org
  Reporter: quirin.blae...@freenet.de
Regression: No

Created attachment 278829
  --> https://bugzilla.kernel.org/attachment.cgi?id=278829&action=edit
lsusb lspci cpuinfo config url sensors

sensors reports a power consumption of 13 W idle for 4.18.10
sensors reports a power consumption of 7 W idle for 4.18.9

Attached:
lsusb
lspci
cpuinfo
url to mainboard an graphics card
kernel config
output of sensors while idle

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


[Bug 201273] New: Fatal error during GPU init amdgpu

2018-09-28 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=201273

Bug ID: 201273
   Summary: Fatal error during GPU init amdgpu
   Product: Drivers
   Version: 2.5
Kernel Version: 4.18.9 4.18.10 and possibly earlier
  Hardware: x86-64
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: normal
  Priority: P1
 Component: Video(DRI - non Intel)
  Assignee: drivers_video-...@kernel-bugs.osdl.org
  Reporter: quirin.blae...@freenet.de
Regression: No

Created attachment 278827
  --> https://bugzilla.kernel.org/attachment.cgi?id=278827&action=edit
dmesg lsmod lspci lsusb cpuinfo url

Since an installation of an AMD-Radeon RX 560 to an APU-based system it
sometimes shows a black screen at bootup ( USB-Keyboard hangs too, no sysreq ->
reset)
Sometimes system boots to GUI, console garbled, dmesg shows fatal error during
GPU init, reboot/shutdown hangs.
BIOS: APU auto or disabled (on not tested)
Attached:
dmesg with/without Error
lsmod with/without Error
lspci / lsusb
/proc/cpuinfo
url to MB and graphics card

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


Re: [PATCH 01/15] staging: vboxvideo: Cleanup vbox_set_up_input_mapping()

2018-09-28 Thread Greg Kroah-Hartman
On Wed, Sep 26, 2018 at 09:41:52PM +0200, Hans de Goede wrote:
> This cleanups 2 things:
> 
> 1) The first time we loop over the crtc-s, to compare framebuffers, fb1 may
> get set to NULL by the fb1 = CRTC_FB(crtci); statement and then we call
> to_vbox_framebuffer() on it. The result of this call is only used for
> an address comparison, so we don't end up dereferencing the bad pointer,
> but still it is better to not do this.
> 
> 2) Since we already figure out the first crtc with a fb in the first loop
> and store that in fb1, there is no need to loop over the crtc-s again just
> to find the first crtc with a fb again.
> 
> Signed-off-by: Hans de Goede 

I have two patch 1/15 in this series, making it 16 patches?

Something went odd on your end, can you please resend these properly?

thanks,

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


Re: [PATCH] drm/exynos: Use selected dma_dev default iommu domain instead of a fake one

2018-09-28 Thread Robin Murphy

On 2018-09-28 5:09 PM, Marek Szyprowski wrote:

Instead of allocating a fake IOMMU domain for all Exynos DRM components,
simply reuse the default IOMMU domain of the already selected DMA device.
This allows some design changes in IOMMU framework without breaking IOMMU
support in Exynos DRM.


Reviewed-by: Robin Murphy 


Signed-off-by: Marek Szyprowski 
---
Inki:
If possible, please consider this patch as a fix for v4.19-rc, this will
help doing a rework in IOMMU and DMA-IOMMU frameworks in v4.20 without
breaking Exynos DRM. It worked for current IOMMU code, but such usage is
considered as a hack.
---
  drivers/gpu/drm/exynos/exynos_drm_iommu.h | 34 ---
  1 file changed, 6 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_iommu.h 
b/drivers/gpu/drm/exynos/exynos_drm_iommu.h
index 87f6b5672e11..797d9ee5f15a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_iommu.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_iommu.h
@@ -55,37 +55,12 @@ static inline void __exynos_iommu_detach(struct 
exynos_drm_private *priv,
  static inline int __exynos_iommu_create_mapping(struct exynos_drm_private 
*priv,
unsigned long start, unsigned long size)
  {
-   struct iommu_domain *domain;
-   int ret;
-
-   domain = iommu_domain_alloc(priv->dma_dev->bus);
-   if (!domain)
-   return -ENOMEM;
-
-   ret = iommu_get_dma_cookie(domain);
-   if (ret)
-   goto free_domain;
-
-   ret = iommu_dma_init_domain(domain, start, size, NULL);
-   if (ret)
-   goto put_cookie;
-
-   priv->mapping = domain;
+   priv->mapping = iommu_get_domain_for_dev(priv->dma_dev);
return 0;
-
-put_cookie:
-   iommu_put_dma_cookie(domain);
-free_domain:
-   iommu_domain_free(domain);
-   return ret;
  }
  
  static inline void __exynos_iommu_release_mapping(struct exynos_drm_private *priv)

  {
-   struct iommu_domain *domain = priv->mapping;
-
-   iommu_put_dma_cookie(domain);
-   iommu_domain_free(domain);
priv->mapping = NULL;
  }
  
@@ -94,7 +69,9 @@ static inline int __exynos_iommu_attach(struct exynos_drm_private *priv,

  {
struct iommu_domain *domain = priv->mapping;
  
-	return iommu_attach_device(domain, dev);

+   if (dev != priv->dma_dev)
+   return iommu_attach_device(domain, dev);
+   return 0;
  }
  
  static inline void __exynos_iommu_detach(struct exynos_drm_private *priv,

@@ -102,7 +79,8 @@ static inline void __exynos_iommu_detach(struct 
exynos_drm_private *priv,
  {
struct iommu_domain *domain = priv->mapping;
  
-	iommu_detach_device(domain, dev);

+   if (dev != priv->dma_dev)
+   iommu_detach_device(domain, dev);
  }
  #else
  #error Unsupported architecture and IOMMU/DMA-mapping glue code


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


[PATCH] drm/exynos: Use selected dma_dev default iommu domain instead of a fake one

2018-09-28 Thread Marek Szyprowski
Instead of allocating a fake IOMMU domain for all Exynos DRM components,
simply reuse the default IOMMU domain of the already selected DMA device.
This allows some design changes in IOMMU framework without breaking IOMMU
support in Exynos DRM.

Signed-off-by: Marek Szyprowski 
---
Inki:
If possible, please consider this patch as a fix for v4.19-rc, this will
help doing a rework in IOMMU and DMA-IOMMU frameworks in v4.20 without
breaking Exynos DRM. It worked for current IOMMU code, but such usage is
considered as a hack.
---
 drivers/gpu/drm/exynos/exynos_drm_iommu.h | 34 ---
 1 file changed, 6 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_iommu.h 
b/drivers/gpu/drm/exynos/exynos_drm_iommu.h
index 87f6b5672e11..797d9ee5f15a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_iommu.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_iommu.h
@@ -55,37 +55,12 @@ static inline void __exynos_iommu_detach(struct 
exynos_drm_private *priv,
 static inline int __exynos_iommu_create_mapping(struct exynos_drm_private 
*priv,
unsigned long start, unsigned long size)
 {
-   struct iommu_domain *domain;
-   int ret;
-
-   domain = iommu_domain_alloc(priv->dma_dev->bus);
-   if (!domain)
-   return -ENOMEM;
-
-   ret = iommu_get_dma_cookie(domain);
-   if (ret)
-   goto free_domain;
-
-   ret = iommu_dma_init_domain(domain, start, size, NULL);
-   if (ret)
-   goto put_cookie;
-
-   priv->mapping = domain;
+   priv->mapping = iommu_get_domain_for_dev(priv->dma_dev);
return 0;
-
-put_cookie:
-   iommu_put_dma_cookie(domain);
-free_domain:
-   iommu_domain_free(domain);
-   return ret;
 }
 
 static inline void __exynos_iommu_release_mapping(struct exynos_drm_private 
*priv)
 {
-   struct iommu_domain *domain = priv->mapping;
-
-   iommu_put_dma_cookie(domain);
-   iommu_domain_free(domain);
priv->mapping = NULL;
 }
 
@@ -94,7 +69,9 @@ static inline int __exynos_iommu_attach(struct 
exynos_drm_private *priv,
 {
struct iommu_domain *domain = priv->mapping;
 
-   return iommu_attach_device(domain, dev);
+   if (dev != priv->dma_dev)
+   return iommu_attach_device(domain, dev);
+   return 0;
 }
 
 static inline void __exynos_iommu_detach(struct exynos_drm_private *priv,
@@ -102,7 +79,8 @@ static inline void __exynos_iommu_detach(struct 
exynos_drm_private *priv,
 {
struct iommu_domain *domain = priv->mapping;
 
-   iommu_detach_device(domain, dev);
+   if (dev != priv->dma_dev)
+   iommu_detach_device(domain, dev);
 }
 #else
 #error Unsupported architecture and IOMMU/DMA-mapping glue code
-- 
2.17.1

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


Re: [PATCH] drm/rcar-du: Convert drm_atomic_helper_suspend/resume()

2018-09-28 Thread Laurent Pinchart
Hi Souptick,

On Friday, 28 September 2018 18:05:18 EEST Laurent Pinchart wrote:
> On Thursday, 27 September 2018 09:34:18 EEST Souptick Joarder wrote:
> > On Tue, Sep 18, 2018 at 10:05 PM Souptick Joarder wrote:
> >> convert drm_atomic_helper_suspend/resume() to use
> >> drm_mode_config_helper_suspend/resume().
> >> 
> >> remove suspend_state field from the rcar_du_device
> >> structure as it is no more required.
> >> 
> >> With this conversion, also drm_fbdev_cma_set_suspend_unlocked()
> >> will left with no consumer. So this function can be removed.
> >> 
> >> Signed-off-by: Souptick Joarder 
> > 
> > Laurent, any comment on this patch ??
> 
> Sorry for the delay, and thanks for pinging me.
> 
> Reviewed-by: Laurent Pinchart 
> 
> Should I apply this to my tree or do you plan to merge it through drm-misc
> as it touches drm_fb_cma_helper.c ?

I just realized that the same patch got supplied by Noralf Trønnes nearly a 
year ago, and was later superseded by https://patchwork.freedesktop.org/patch/
247861/. I think we should thus apply Noralf's patches instead (once he sends 
v4 out).

> >> ---
> >> 
> >>  drivers/gpu/drm/drm_fb_cma_helper.c   | 18 --
> >>  drivers/gpu/drm/rcar-du/rcar_du_drv.c | 21 ++---
> >>  drivers/gpu/drm/rcar-du/rcar_du_drv.h |  1 -
> >>  include/drm/drm_fb_cma_helper.h   |  2 --
> >>  4 files changed, 2 insertions(+), 40 deletions(-)
> >> 
> >> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c
> >> b/drivers/gpu/drm/drm_fb_cma_helper.c index 47e0e2f..96efc88 100644
> >> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> >> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> >> @@ -224,21 +224,3 @@ void drm_fbdev_cma_hotplug_event(struct
> >> drm_fbdev_cma *fbdev_cma)
> >> drm_fb_helper_hotplug_event(&fbdev_cma->fb_helper);
> >>  }
> >>  EXPORT_SYMBOL_GPL(drm_fbdev_cma_hotplug_event);
> >> 
> >> -
> >> -/**
> >> - * drm_fbdev_cma_set_suspend_unlocked - wrapper around
> >> - *
> >> drm_fb_helper_set_suspend_unlocked
> >> - * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
> >> - * @state: desired state, zero to resume, non-zero to suspend
> >> - *
> >> - * Calls drm_fb_helper_set_suspend, which is a wrapper around
> >> - * fb_set_suspend implemented by fbdev core.
> >> - */
> >> -void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma
> >> *fbdev_cma,
> >> -   bool state)
> >> -{
> >> -   if (fbdev_cma)
> >> -  
> >> drm_fb_helper_set_suspend_unlocked(&fbdev_cma->fb_helper,
> >> -  state);
> >> -}
> >> -EXPORT_SYMBOL(drm_fbdev_cma_set_suspend_unlocked);
> >> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> >> b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index 02aee6c..288220f 100644
> >> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> >> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> >> @@ -357,32 +357,15 @@ static void rcar_du_lastclose(struct drm_device
> >> *dev)
> >> 
> >>  static int rcar_du_pm_suspend(struct device *dev)
> >>  {
> >> struct rcar_du_device *rcdu = dev_get_drvdata(dev);
> >> -   struct drm_atomic_state *state;
> >> 
> >> -   drm_kms_helper_poll_disable(rcdu->ddev);
> >> -   drm_fbdev_cma_set_suspend_unlocked(rcdu->fbdev, true);
> >> -
> >> -   state = drm_atomic_helper_suspend(rcdu->ddev);
> >> -   if (IS_ERR(state)) {
> >> -   drm_fbdev_cma_set_suspend_unlocked(rcdu->fbdev, false);
> >> -   drm_kms_helper_poll_enable(rcdu->ddev);
> >> -   return PTR_ERR(state);
> >> -   }
> >> -
> >> -   rcdu->suspend_state = state;
> >> -
> >> -   return 0;
> >> +   return drm_mode_config_helper_suspend(rcdu->ddev);
> >>  }
> >>  
> >>  static int rcar_du_pm_resume(struct device *dev)
> >>  {
> >> struct rcar_du_device *rcdu = dev_get_drvdata(dev);
> >> 
> >> -   drm_atomic_helper_resume(rcdu->ddev, rcdu->suspend_state);
> >> -   drm_fbdev_cma_set_suspend_unlocked(rcdu->fbdev, false);
> >> -   drm_kms_helper_poll_enable(rcdu->ddev);
> >> -
> >> -   return 0;
> >> +   return drm_mode_config_helper_resume(rcdu->ddev);
> >>  }
> >>  #endif
> >> 
> >> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> >> b/drivers/gpu/drm/rcar-du/rcar_du_drv.h index b3a25e8..ff25c8d 100644
> >> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> >> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> >> @@ -78,7 +78,6 @@ struct rcar_du_device {
> >> struct drm_device *ddev;
> >> struct drm_fbdev_cma *fbdev;
> >> 
> >> -   struct drm_atomic_state *suspend_state;
> >> 
> >> struct rcar_du_crtc crtcs[RCAR_DU_MAX_CRTCS];
> >> unsigned int num_crtcs;
> >> diff --git a/include/drm/drm_fb_cma_helper.h
> >> b/include/drm/drm_fb_cma_helper.h index 4a65f0d..8dbbe1e 100644
> >> --- a/include/drm/drm_fb_cma_helper.h
> >> +++ b/include/drm/drm_fb_cma_helper.h
> >> @@ -26,8 +26,6 @@ struct drm_fbdev_cma *drm_fbdev_cma_init(struct
> >> drm_device 

Re: [PATCH v2 06/16] drm: rcar-du: Perform the initial CRTC setup from rcar_du_crtc_get()

2018-09-28 Thread Laurent Pinchart
Hi Ulrich,

Thank you for the review. Patches have however landed upstream already, so I 
can't add any Reviewed-by tag anymore. I will submit a follow-up patch, unless 
you would prefer doing it yourself.

On Wednesday, 26 September 2018 18:55:14 EEST Ulrich Hecht wrote:
> Thank you for your patch.
> 
> > On September 14, 2018 at 11:10 AM Laurent Pinchart
> >  wrote:
> > 
> > 
> > The rcar_du_crtc_get() function is always immediately followed by a call
> > to rcar_du_crtc_setup(). Call the later from the former to simplify the
> > code, and add a comment to explain how the get and put calls are
> > balanced.
> > 
> > Signed-off-by: Laurent Pinchart
> > 
> > Tested-by: Jacopo Mondi 
> > ---
> > 
> >  drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 107 +++-
> >  1 file changed, 56 insertions(+), 51 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> > b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 6288b9ad9e24..c89751c26f9c
> > 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> > @@ -66,39 +66,6 @@ static void rcar_du_crtc_clr_set(struct rcar_du_crtc
> > *rcrtc, u32 reg,> 
> > rcar_du_write(rcdu, rcrtc->mmio_offset + reg, (value & ~clr) | set);
> >  
> >  }
> > 
> > -static int rcar_du_crtc_get(struct rcar_du_crtc *rcrtc)
> > -{
> > -   int ret;
> > -
> > -   ret = clk_prepare_enable(rcrtc->clock);
> > -   if (ret < 0)
> > -   return ret;
> > -
> > -   ret = clk_prepare_enable(rcrtc->extclock);
> > -   if (ret < 0)
> > -   goto error_clock;
> > -
> > -   ret = rcar_du_group_get(rcrtc->group);
> > -   if (ret < 0)
> > -   goto error_group;
> > -
> > -   return 0;
> > -
> > -error_group:
> > -   clk_disable_unprepare(rcrtc->extclock);
> > -error_clock:
> > -   clk_disable_unprepare(rcrtc->clock);
> > -   return ret;
> > -}
> > -
> > -static void rcar_du_crtc_put(struct rcar_du_crtc *rcrtc)
> > -{
> > -   rcar_du_group_put(rcrtc->group);
> > -
> > -   clk_disable_unprepare(rcrtc->extclock);
> > -   clk_disable_unprepare(rcrtc->clock);
> > -}
> > -
> > 
> >  /*
> >  
> >  ->  
> >   * Hardware Setup
> >   */
> > 
> > @@ -546,6 +513,51 @@ static void rcar_du_crtc_setup(struct rcar_du_crtc
> > *rcrtc)> 
> > drm_crtc_vblank_on(&rcrtc->crtc);
> >  
> >  }
> > 
> > +static int rcar_du_crtc_get(struct rcar_du_crtc *rcrtc)
> > +{
> > +   int ret;
> > +
> > +   /*
> > +* Guard against double-get, as the function is called from both the
> > +* .atomic_enable() and .atomic_begin() handlers.
> > +*/
> > +   if (rcrtc->initialized)
> > +   return 0;
> > +
> > +   ret = clk_prepare_enable(rcrtc->clock);
> > +   if (ret < 0)
> > +   return ret;
> > +
> > +   ret = clk_prepare_enable(rcrtc->extclock);
> > +   if (ret < 0)
> > +   goto error_clock;
> > +
> > +   ret = rcar_du_group_get(rcrtc->group);
> > +   if (ret < 0)
> > +   goto error_group;
> > +
> > +   rcar_du_crtc_setup(rcrtc);
> > +   rcrtc->initialized = true;
> > +
> > +   return 0;
> > +
> > +error_group:
> > +   clk_disable_unprepare(rcrtc->extclock);
> > +error_clock:
> > +   clk_disable_unprepare(rcrtc->clock);
> > +   return ret;
> > +}
> > +
> > +static void rcar_du_crtc_put(struct rcar_du_crtc *rcrtc)
> > +{
> > +   rcar_du_group_put(rcrtc->group);
> > +
> > +   clk_disable_unprepare(rcrtc->extclock);
> > +   clk_disable_unprepare(rcrtc->clock);
> > +
> > +   rcrtc->initialized = false;
> > +}
> > +
> > 
> >  static void rcar_du_crtc_start(struct rcar_du_crtc *rcrtc)
> >  {
> >  
> > bool interlaced;
> > 
> > @@ -639,16 +651,7 @@ static void rcar_du_crtc_atomic_enable(struct
> > drm_crtc *crtc,> 
> >  {
> >  
> > struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
> > 
> > -   /*
> > -* If the CRTC has already been setup by the .atomic_begin() handler we
> > -* can skip the setup stage.
> > -*/
> > -   if (!rcrtc->initialized) {
> > -   rcar_du_crtc_get(rcrtc);
> > -   rcar_du_crtc_setup(rcrtc);
> > -   rcrtc->initialized = true;
> > -   }
> > -
> > +   rcar_du_crtc_get(rcrtc);
> > 
> > rcar_du_crtc_start(rcrtc);
> >  
> >  }
> > 
> > @@ -667,7 +670,6 @@ static void rcar_du_crtc_atomic_disable(struct
> > drm_crtc *crtc,> 
> > }
> > spin_unlock_irq(&crtc->dev->event_lock);
> > 
> > -   rcrtc->initialized = false;
> > 
> > rcrtc->outputs = 0;
> >  
> >  }
> > 
> > @@ -680,14 +682,17 @@ static void rcar_du_crtc_atomic_begin(struct
> > drm_crtc *crtc,> 
> > /*
> > 
> >  * If a mode set is in progress we can be called with the CRTC 
disabled.
> > 
> > -* We then need to first setup the CRTC in order to configure planes.
> > -* The .atomic_enable() handler will notice and skip the CRTC setup.
> > +* We thus need to first get and setup the CRTC in order to configure
> > +* planes. We must *not* put the CRTC in .atomic_flush(), as it must

Re: [PATCH] drm/rcar-du: Convert drm_atomic_helper_suspend/resume()

2018-09-28 Thread Laurent Pinchart
Hi Souptick,

Thank you for the patch.

On Thursday, 27 September 2018 09:34:18 EEST Souptick Joarder wrote:
> On Tue, Sep 18, 2018 at 10:05 PM Souptick Joarder wrote:
> > convert drm_atomic_helper_suspend/resume() to use
> > drm_mode_config_helper_suspend/resume().
> > 
> > remove suspend_state field from the rcar_du_device
> > structure as it is no more required.
> > 
> > With this conversion, also drm_fbdev_cma_set_suspend_unlocked()
> > will left with no consumer. So this function can be removed.
> > 
> > Signed-off-by: Souptick Joarder 
> 
> Laurent, any comment on this patch ??

Sorry for the delay, and thanks for pinging me.

Reviewed-by: Laurent Pinchart 

Should I apply this to my tree or do you plan to merge it through drm-misc as 
it touches drm_fb_cma_helper.c ?

> > ---
> > 
> >  drivers/gpu/drm/drm_fb_cma_helper.c   | 18 --
> >  drivers/gpu/drm/rcar-du/rcar_du_drv.c | 21 ++---
> >  drivers/gpu/drm/rcar-du/rcar_du_drv.h |  1 -
> >  include/drm/drm_fb_cma_helper.h   |  2 --
> >  4 files changed, 2 insertions(+), 40 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c
> > b/drivers/gpu/drm/drm_fb_cma_helper.c index 47e0e2f..96efc88 100644
> > --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> > +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> > @@ -224,21 +224,3 @@ void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma
> > *fbdev_cma)> 
> > drm_fb_helper_hotplug_event(&fbdev_cma->fb_helper);
> >  
> >  }
> >  EXPORT_SYMBOL_GPL(drm_fbdev_cma_hotplug_event);
> > 
> > -
> > -/**
> > - * drm_fbdev_cma_set_suspend_unlocked - wrapper around
> > - * 
> > drm_fb_helper_set_suspend_unlocked
> > - * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
> > - * @state: desired state, zero to resume, non-zero to suspend
> > - *
> > - * Calls drm_fb_helper_set_suspend, which is a wrapper around
> > - * fb_set_suspend implemented by fbdev core.
> > - */
> > -void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
> > -   bool state)
> > -{
> > -   if (fbdev_cma)
> > -   drm_fb_helper_set_suspend_unlocked(&fbdev_cma->fb_helper,
> > -  state);
> > -}
> > -EXPORT_SYMBOL(drm_fbdev_cma_set_suspend_unlocked);
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> > b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index 02aee6c..288220f 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> > @@ -357,32 +357,15 @@ static void rcar_du_lastclose(struct drm_device
> > *dev)
> > 
> >  static int rcar_du_pm_suspend(struct device *dev)
> >  {
> >  
> > struct rcar_du_device *rcdu = dev_get_drvdata(dev);
> > 
> > -   struct drm_atomic_state *state;
> > 
> > -   drm_kms_helper_poll_disable(rcdu->ddev);
> > -   drm_fbdev_cma_set_suspend_unlocked(rcdu->fbdev, true);
> > -
> > -   state = drm_atomic_helper_suspend(rcdu->ddev);
> > -   if (IS_ERR(state)) {
> > -   drm_fbdev_cma_set_suspend_unlocked(rcdu->fbdev, false);
> > -   drm_kms_helper_poll_enable(rcdu->ddev);
> > -   return PTR_ERR(state);
> > -   }
> > -
> > -   rcdu->suspend_state = state;
> > -
> > -   return 0;
> > +   return drm_mode_config_helper_suspend(rcdu->ddev);
> > 
> >  }
> >  
> >  static int rcar_du_pm_resume(struct device *dev)
> >  {
> >  
> > struct rcar_du_device *rcdu = dev_get_drvdata(dev);
> > 
> > -   drm_atomic_helper_resume(rcdu->ddev, rcdu->suspend_state);
> > -   drm_fbdev_cma_set_suspend_unlocked(rcdu->fbdev, false);
> > -   drm_kms_helper_poll_enable(rcdu->ddev);
> > -
> > -   return 0;
> > +   return drm_mode_config_helper_resume(rcdu->ddev);
> > 
> >  }
> >  #endif
> > 
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> > b/drivers/gpu/drm/rcar-du/rcar_du_drv.h index b3a25e8..ff25c8d 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> > @@ -78,7 +78,6 @@ struct rcar_du_device {
> > 
> > struct drm_device *ddev;
> > struct drm_fbdev_cma *fbdev;
> > 
> > -   struct drm_atomic_state *suspend_state;
> > 
> > struct rcar_du_crtc crtcs[RCAR_DU_MAX_CRTCS];
> > unsigned int num_crtcs;
> > 
> > diff --git a/include/drm/drm_fb_cma_helper.h
> > b/include/drm/drm_fb_cma_helper.h index 4a65f0d..8dbbe1e 100644
> > --- a/include/drm/drm_fb_cma_helper.h
> > +++ b/include/drm/drm_fb_cma_helper.h
> > @@ -26,8 +26,6 @@ struct drm_fbdev_cma *drm_fbdev_cma_init(struct
> > drm_device *dev,> 
> >  void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma);
> >  void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma);
> > 
> > -void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
> > -   bool state);
> > 
> >  struct drm_gem_cma_object *drm_fb_cma_ge

Re: [PATCH 03/20] drm/fsl-dcu: Use drm_fbdev_generic_setup()

2018-09-28 Thread Stefan Agner
On 28.09.2018 16:57, Noralf Trønnes wrote:
> Den 28.09.2018 16.11, skrev Stefan Agner:
>> On 27.09.2018 23:23, Noralf Trønnes wrote:
>>> Den 27.09.2018 23.08, skrev Stefan Agner:
 On 08.09.2018 15:46, Noralf Trønnes wrote:
> The CMA helper is already using the drm_fb_helper_generic_probe part of
> the generic fbdev emulation. This patch makes full use of the generic
> fbdev emulation by using its drm_client callbacks. This means that
> drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are
> now handled by the emulation code. Additionally fbdev unregister happens
> automatically on drm_dev_unregister().
>
> The drm_fbdev_generic_setup() call is put after drm_dev_register() in the
> driver. This is done to highlight the fact that fbdev emulation is an
> internal client that makes use of the driver, it is not part of the
> driver as such. If fbdev setup fails, an error is printed, but the driver
> succeeds probing.
 I think the last sentence is currently not implemented, I think it will
 silently succeed probing. Can we add something like this, similar to
 tinydrm-core.c?

if (ret)
DRM_ERROR("Failed to initialize fbdev: %d\n", ret);
>>> It was implemented in the first patch in the series, now applied:
>>>
>>> drm/fb-helper: Improve error reporting in setup
>>> https://cgit.freedesktop.org/drm/drm-misc/commit/?id=6129369a96183f28c7912dfd37cb5869433aa904
>> That patch adds error reporting for drm_fb_helper_fbdev_setup().
>>
>> But you are using drm_fbdev_generic_setup() here...
> 
> Yep, this is the callchain:
> 
> drm_fbdev_generic_setup()
>   -> drm_fbdev_client_hotplug()
>     -> drm_fb_helper_fbdev_setup()
> 
> The benefit of having setup in the hotplug callback is that now fbdev is
> supported in the case where there are no connectors at driver load.
> 

Oh ok, I see.

Then, this patch looks good for me:

Acked-by: Stefan Agner 

--
Stefan

> Noralf.
> 
>> --
>> Stefan
>>
>>> Noralf.
>>>
 --
 Stefan

> Cc: Stefan Agner 
> Cc: Alison Wang 
> Signed-off-by: Noralf Trønnes 
> ---
>drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 25 
> +++--
>drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h |  1 -
>2 files changed, 3 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> index 80232321a244..15816141e5fb 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> @@ -26,6 +26,7 @@
>#include 
>#include 
>#include 
> +#include 
>#include 
>#include 
>@@ -89,20 +90,11 @@ static int fsl_dcu_load(struct drm_device *dev,
> unsigned long flags)
>   "Invalid legacyfb_depth.  Defaulting to 
> 24bpp\n");
>   legacyfb_depth = 24;
>   }
> - fsl_dev->fbdev = drm_fbdev_cma_init(dev, legacyfb_depth, 1);
> - if (IS_ERR(fsl_dev->fbdev)) {
> - ret = PTR_ERR(fsl_dev->fbdev);
> - fsl_dev->fbdev = NULL;
> - goto done;
> - }
>   return 0;
>done:
>   drm_kms_helper_poll_fini(dev);
>-  if (fsl_dev->fbdev)
> - drm_fbdev_cma_fini(fsl_dev->fbdev);
> -
>   drm_mode_config_cleanup(dev);
>   drm_irq_uninstall(dev);
>   dev->dev_private = NULL;
> @@ -112,14 +104,9 @@ static int fsl_dcu_load(struct drm_device *dev,
> unsigned long flags)
>  static void fsl_dcu_unload(struct drm_device *dev)
>{
> - struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> -
>   drm_atomic_helper_shutdown(dev);
>   drm_kms_helper_poll_fini(dev);
>-  if (fsl_dev->fbdev)
> - drm_fbdev_cma_fini(fsl_dev->fbdev);
> -
>   drm_mode_config_cleanup(dev);
>   drm_irq_uninstall(dev);
>@@ -147,19 +134,11 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void 
> *arg)
>   return IRQ_HANDLED;
>}
>-static void fsl_dcu_drm_lastclose(struct drm_device *dev)
> -{
> - struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> -
> - drm_fbdev_cma_restore_mode(fsl_dev->fbdev);
> -}
> -
>DEFINE_DRM_GEM_CMA_FOPS(fsl_dcu_drm_fops);
>  static struct drm_driver fsl_dcu_drm_driver = {
>   .driver_features= DRIVER_HAVE_IRQ | DRIVER_GEM | 
> DRIVER_MODESET
>   | DRIVER_PRIME | DRIVER_ATOMIC,
> - .lastclose  = fsl_dcu_drm_lastclose,
>   .load   = fsl_dcu_load,
>   .unload = fsl_dcu_unload,
>   .irq_handler= fsl_dcu_drm_irq,
> @@ -355,6 +334,8 @@ static int fsl_dcu_drm

Re: [PATCH 03/20] drm/fsl-dcu: Use drm_fbdev_generic_setup()

2018-09-28 Thread Noralf Trønnes


Den 28.09.2018 16.11, skrev Stefan Agner:

On 27.09.2018 23:23, Noralf Trønnes wrote:

Den 27.09.2018 23.08, skrev Stefan Agner:

On 08.09.2018 15:46, Noralf Trønnes wrote:

The CMA helper is already using the drm_fb_helper_generic_probe part of
the generic fbdev emulation. This patch makes full use of the generic
fbdev emulation by using its drm_client callbacks. This means that
drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are
now handled by the emulation code. Additionally fbdev unregister happens
automatically on drm_dev_unregister().

The drm_fbdev_generic_setup() call is put after drm_dev_register() in the
driver. This is done to highlight the fact that fbdev emulation is an
internal client that makes use of the driver, it is not part of the
driver as such. If fbdev setup fails, an error is printed, but the driver
succeeds probing.

I think the last sentence is currently not implemented, I think it will
silently succeed probing. Can we add something like this, similar to
tinydrm-core.c?

if (ret)
DRM_ERROR("Failed to initialize fbdev: %d\n", ret);

It was implemented in the first patch in the series, now applied:

drm/fb-helper: Improve error reporting in setup
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=6129369a96183f28c7912dfd37cb5869433aa904

That patch adds error reporting for drm_fb_helper_fbdev_setup().

But you are using drm_fbdev_generic_setup() here...


Yep, this is the callchain:

drm_fbdev_generic_setup()
  -> drm_fbdev_client_hotplug()
    -> drm_fb_helper_fbdev_setup()

The benefit of having setup in the hotplug callback is that now fbdev is
supported in the case where there are no connectors at driver load.

Noralf.


--
Stefan


Noralf.


--
Stefan


Cc: Stefan Agner 
Cc: Alison Wang 
Signed-off-by: Noralf Trønnes 
---
   drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 25 +++--
   drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h |  1 -
   2 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index 80232321a244..15816141e5fb 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -26,6 +26,7 @@
   #include 
   #include 
   #include 
+#include 
   #include 
   #include 
   @@ -89,20 +90,11 @@ static int fsl_dcu_load(struct drm_device *dev,
unsigned long flags)
"Invalid legacyfb_depth.  Defaulting to 24bpp\n");
legacyfb_depth = 24;
}
-   fsl_dev->fbdev = drm_fbdev_cma_init(dev, legacyfb_depth, 1);
-   if (IS_ERR(fsl_dev->fbdev)) {
-   ret = PTR_ERR(fsl_dev->fbdev);
-   fsl_dev->fbdev = NULL;
-   goto done;
-   }
return 0;
   done:
drm_kms_helper_poll_fini(dev);
   -if (fsl_dev->fbdev)
-   drm_fbdev_cma_fini(fsl_dev->fbdev);
-
drm_mode_config_cleanup(dev);
drm_irq_uninstall(dev);
dev->dev_private = NULL;
@@ -112,14 +104,9 @@ static int fsl_dcu_load(struct drm_device *dev,
unsigned long flags)
 static void fsl_dcu_unload(struct drm_device *dev)
   {
-   struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
-
drm_atomic_helper_shutdown(dev);
drm_kms_helper_poll_fini(dev);
   -if (fsl_dev->fbdev)
-   drm_fbdev_cma_fini(fsl_dev->fbdev);
-
drm_mode_config_cleanup(dev);
drm_irq_uninstall(dev);
   @@ -147,19 +134,11 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
return IRQ_HANDLED;
   }
   -static void fsl_dcu_drm_lastclose(struct drm_device *dev)
-{
-   struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
-
-   drm_fbdev_cma_restore_mode(fsl_dev->fbdev);
-}
-
   DEFINE_DRM_GEM_CMA_FOPS(fsl_dcu_drm_fops);
 static struct drm_driver fsl_dcu_drm_driver = {
.driver_features= DRIVER_HAVE_IRQ | DRIVER_GEM | DRIVER_MODESET
| DRIVER_PRIME | DRIVER_ATOMIC,
-   .lastclose  = fsl_dcu_drm_lastclose,
.load   = fsl_dcu_load,
.unload = fsl_dcu_unload,
.irq_handler= fsl_dcu_drm_irq,
@@ -355,6 +334,8 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
if (ret < 0)
goto unref;
   +drm_fbdev_generic_setup(drm, legacyfb_depth);
+
return 0;
 unref:
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
index 93bfb98012d4..cb87bb74cb87 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
@@ -191,7 +191,6 @@ struct fsl_dcu_drm_device {
/*protects hardware register*/
spinlock_t irq_lock;
struct drm_device *drm;
-   struct drm_fbdev_cma *fbdev;
struct drm_crtc crtc;
struct drm_encoder encoder;
struct fsl_dcu_drm_connector connector;


_

[PATCH libdrm v2 2/2] amdgpu/test: Fix deadlock tests for AI and RV v2

2018-09-28 Thread Andrey Grodzovsky
Seems like AI and RV requires uncashed memory mapping to be able
to pickup value written to memory by CPU after the WAIT_REG_MEM
command was already launched.
.
Enable the test for AI and RV.

v2:
Update commit description.

Signed-off-by: Andrey Grodzovsky 
---
 tests/amdgpu/deadlock_tests.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/tests/amdgpu/deadlock_tests.c b/tests/amdgpu/deadlock_tests.c
index 304482d..292ec4e 100644
--- a/tests/amdgpu/deadlock_tests.c
+++ b/tests/amdgpu/deadlock_tests.c
@@ -80,6 +80,8 @@ static  uint32_t  minor_version;
 static pthread_t stress_thread;
 static uint32_t *ptr;
 
+int use_uc_mtype = 0;
+
 static void amdgpu_deadlock_helper(unsigned ip_type);
 static void amdgpu_deadlock_gfx(void);
 static void amdgpu_deadlock_compute(void);
@@ -92,13 +94,14 @@ CU_BOOL suite_deadlock_tests_enable(void)
 &minor_version, &device_handle))
return CU_FALSE;
 
-   if (device_handle->info.family_id == AMDGPU_FAMILY_AI ||
-   device_handle->info.family_id == AMDGPU_FAMILY_SI ||
-   device_handle->info.family_id == AMDGPU_FAMILY_RV) {
+   if (device_handle->info.family_id == AMDGPU_FAMILY_SI) {
printf("\n\nCurrently hangs the CP on this ASIC, deadlock suite 
disabled\n");
enable = CU_FALSE;
}
 
+   if (device_handle->info.family_id >= AMDGPU_FAMILY_AI)
+   use_uc_mtype = 1;
+
if (amdgpu_device_deinitialize(device_handle))
return CU_FALSE;
 
@@ -183,8 +186,8 @@ static void amdgpu_deadlock_helper(unsigned ip_type)
r = amdgpu_cs_ctx_create(device_handle, &context_handle);
CU_ASSERT_EQUAL(r, 0);
 
-   r = amdgpu_bo_alloc_and_map(device_handle, 4096, 4096,
-   AMDGPU_GEM_DOMAIN_GTT, 0,
+   r = amdgpu_bo_alloc_and_map_raw(device_handle, 4096, 4096,
+   AMDGPU_GEM_DOMAIN_GTT, 0, use_uc_mtype ? 
AMDGPU_VM_MTYPE_UC : 0,
&ib_result_handle, 
&ib_result_cpu,
&ib_result_mc_address, 
&va_handle);
CU_ASSERT_EQUAL(r, 0);
-- 
2.7.4

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


[PATCH libdrm v2 1/2] amdgpu/test: Allow BO mapping flags to be passed in tests

2018-09-28 Thread Andrey Grodzovsky
v2:
Call amdgpu_bo_va_op_raw directly in amdgpu_bo_alloc_and_map_raw
Move amdgpu_bo_alloc_and_map_raw into C file to avoid including
unistd.h in amdgpu_test.h

Signed-off-by: Andrey Grodzovsky 
---
 tests/amdgpu/amdgpu_test.h | 59 +---
 tests/amdgpu/basic_tests.c | 61 ++
 2 files changed, 72 insertions(+), 48 deletions(-)

diff --git a/tests/amdgpu/amdgpu_test.h b/tests/amdgpu/amdgpu_test.h
index 0609a74..a3830bd 100644
--- a/tests/amdgpu/amdgpu_test.h
+++ b/tests/amdgpu/amdgpu_test.h
@@ -280,7 +280,7 @@ static inline int gpu_mem_free(amdgpu_bo_handle bo,
 
 static inline int
 amdgpu_bo_alloc_wrap(amdgpu_device_handle dev, unsigned size,
-unsigned alignment, unsigned heap, uint64_t flags,
+unsigned alignment, unsigned heap, uint64_t alloc_flags,
 amdgpu_bo_handle *bo)
 {
struct amdgpu_bo_alloc_request request = {};
@@ -290,7 +290,7 @@ amdgpu_bo_alloc_wrap(amdgpu_device_handle dev, unsigned 
size,
request.alloc_size = size;
request.phys_alignment = alignment;
request.preferred_heap = heap;
-   request.flags = flags;
+   request.flags = alloc_flags;
 
r = amdgpu_bo_alloc(dev, &request, &buf_handle);
if (r)
@@ -301,57 +301,20 @@ amdgpu_bo_alloc_wrap(amdgpu_device_handle dev, unsigned 
size,
return 0;
 }
 
+int amdgpu_bo_alloc_and_map_raw(amdgpu_device_handle dev, unsigned size,
+   unsigned alignment, unsigned heap, uint64_t alloc_flags,
+   uint64_t mapping_flags, amdgpu_bo_handle *bo, void 
**cpu,
+   uint64_t *mc_address,
+   amdgpu_va_handle *va_handle);
+
 static inline int
 amdgpu_bo_alloc_and_map(amdgpu_device_handle dev, unsigned size,
-   unsigned alignment, unsigned heap, uint64_t flags,
+   unsigned alignment, unsigned heap, uint64_t alloc_flags,
amdgpu_bo_handle *bo, void **cpu, uint64_t *mc_address,
amdgpu_va_handle *va_handle)
 {
-   struct amdgpu_bo_alloc_request request = {};
-   amdgpu_bo_handle buf_handle;
-   amdgpu_va_handle handle;
-   uint64_t vmc_addr;
-   int r;
-
-   request.alloc_size = size;
-   request.phys_alignment = alignment;
-   request.preferred_heap = heap;
-   request.flags = flags;
-
-   r = amdgpu_bo_alloc(dev, &request, &buf_handle);
-   if (r)
-   return r;
-
-   r = amdgpu_va_range_alloc(dev,
- amdgpu_gpu_va_range_general,
- size, alignment, 0, &vmc_addr,
- &handle, 0);
-   if (r)
-   goto error_va_alloc;
-
-   r = amdgpu_bo_va_op(buf_handle, 0, size, vmc_addr, 0, AMDGPU_VA_OP_MAP);
-   if (r)
-   goto error_va_map;
-
-   r = amdgpu_bo_cpu_map(buf_handle, cpu);
-   if (r)
-   goto error_cpu_map;
-
-   *bo = buf_handle;
-   *mc_address = vmc_addr;
-   *va_handle = handle;
-
-   return 0;
-
-error_cpu_map:
-   amdgpu_bo_cpu_unmap(buf_handle);
-
-error_va_map:
-   amdgpu_bo_va_op(buf_handle, 0, size, vmc_addr, 0, AMDGPU_VA_OP_UNMAP);
-
-error_va_alloc:
-   amdgpu_bo_free(buf_handle);
-   return r;
+   return amdgpu_bo_alloc_and_map_raw(dev, size, alignment, heap,
+   alloc_flags, 0, bo, cpu, mc_address, 
va_handle);
 }
 
 static inline int
diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c
index 1adbddd..cceffc7 100644
--- a/tests/amdgpu/basic_tests.c
+++ b/tests/amdgpu/basic_tests.c
@@ -33,6 +33,7 @@
 
 #include "amdgpu_test.h"
 #include "amdgpu_drm.h"
+#include "util_math.h"
 
 static  amdgpu_device_handle device_handle;
 static  uint32_t  major_version;
@@ -286,6 +287,66 @@ static  uint32_t shader_bin[] = {
 #define DATA_OFFSET 1024
 
 
+int amdgpu_bo_alloc_and_map_raw(amdgpu_device_handle dev, unsigned size,
+   unsigned alignment, unsigned heap, uint64_t alloc_flags,
+   uint64_t mapping_flags, amdgpu_bo_handle *bo, void 
**cpu,
+   uint64_t *mc_address,
+   amdgpu_va_handle *va_handle)
+{
+   struct amdgpu_bo_alloc_request request = {};
+   amdgpu_bo_handle buf_handle;
+   amdgpu_va_handle handle;
+   uint64_t vmc_addr;
+   int r;
+
+   request.alloc_size = size;
+   request.phys_alignment = alignment;
+   request.preferred_heap = heap;
+   request.flags = alloc_flags;
+
+   r = amdgpu_bo_alloc(dev, &request, &buf_handle);
+   if (r)
+   return r;
+
+   r = amdgpu_va_range_alloc(dev,
+ amdgpu_gpu_va_range_general,
+ size, alignment, 0, &vmc_addr,
+ &handle, 0);
+   

[Bug 108095] Window becomes partially transparent for short time

2018-09-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108095

--- Comment #3 from Paul Menzel  ---
Created attachment 141779
  --> https://bugs.freedesktop.org/attachment.cgi?id=141779&action=edit
/var/log/gdm/:0.log

-- 
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 108095] Window becomes partially transparent for short time

2018-09-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108095

--- Comment #2 from Paul Menzel  ---
Created attachment 141778
  --> https://bugs.freedesktop.org/attachment.cgi?id=141778&action=edit
Linux 4.14.55 messages

-- 
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: UDL: get rid of useless vblank initialization

2018-09-28 Thread Eugeniy Paltsev
UDL doesn't support vblank functionality so we don't need to
initialize vblank here (we are able to send page flip
completion events even without vblank initialization)

Moreover current drm_vblank_init call with num_crtcs > 0 causes
sending DRM_EVENT_FLIP_COMPLETE event with zero timestamp every
time. This breaks userspace apps (for example weston) which
relies on timestamp value.

Cc: sta...@vger.kernel.org
Signed-off-by: Eugeniy Paltsev 
---
 drivers/gpu/drm/udl/udl_main.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/udl/udl_main.c b/drivers/gpu/drm/udl/udl_main.c
index f455f095a146..1b014d92855b 100644
--- a/drivers/gpu/drm/udl/udl_main.c
+++ b/drivers/gpu/drm/udl/udl_main.c
@@ -350,15 +350,10 @@ int udl_driver_load(struct drm_device *dev, unsigned long 
flags)
if (ret)
goto err;
 
-   ret = drm_vblank_init(dev, 1);
-   if (ret)
-   goto err_fb;
-
drm_kms_helper_poll_init(dev);
 
return 0;
-err_fb:
-   udl_fbdev_cleanup(dev);
+
 err:
if (udl->urbs.count)
udl_free_urb_list(dev);
-- 
2.14.4

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


Re: [PATCH] DRM: VBLANK: provide valid timestamp for EVENT_FLIP

2018-09-28 Thread Eugeniy Paltsev
On Wed, 2018-09-26 at 19:37 +0300, Ville Syrjälä wrote:
> On Wed, Sep 26, 2018 at 05:25:35PM +0300, Eugeniy Paltsev wrote:
> > If driver/HW doesn't support vblank functionality (for example
> > UDL driver, ARCPGU driver, ...) we always have vblank->time == 0.
> > In result we always provide zero timestamp for
> > DRM_EVENT_FLIP_COMPLETE. This breaks userspace apps (for example
> > weston) which relies on timestamp value.
> > 
> > Setup time to provide valid timestamp for DRM_EVENT_FLIP_COMPLETE
> > event.
> > 
> > Signed-off-by: Eugeniy Paltsev 
> > ---
> >  drivers/gpu/drm/drm_vblank.c | 9 +
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> > index 28cdcf76b6f9..0d19aca48782 100644
> > --- a/drivers/gpu/drm/drm_vblank.c
> > +++ b/drivers/gpu/drm/drm_vblank.c
> > @@ -911,6 +911,15 @@ void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
> >  
> > if (dev->num_crtcs > 0) {
> 
> If those drivers don't support vblank stuff why are they calling
> bldrm_vank_init() w/ num_crtcs > 0? If they didn't they'd take the
> else branch which already does what you want.

Hmm...
As I can see UDL call drm_vblank_init() with num_crtcs = 1 but UDL HW
doesn't support vblank at all.
I guess I need to fix it.

> > seq = drm_vblank_count_and_time(dev, pipe, &now);
> > +
> > +   /*
> > +* If driver/HW doesn't support vblank functionality we
> > +* always have vblank->time == 0. Setup time to provide valid
> > +* timestamp for DRM_EVENT_FLIP_COMPLETE event.
> > +*/
> > +   if (!now && e->event.base.type == DRM_EVENT_FLIP_COMPLETE)
> > +   now = ktime_get();
> > +
> > } else {
> > seq = 0;
> >  
> > -- 
> > 2.14.4
> > 
> > ___
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_dri-2Ddevel&d=DwIDAw&c=DPL6_X_6JkXFx7AXWqB0tg&r=ZlJN1M
> > riPUTkBKCrPSx67GmaplEUGcAEk9yPtCLdUXI&m=5bbb9SeVXTMPDa1bXQxqlBIOnSdKaKY5W0BkMCgwijE&s=50EhApCZAeMMDUEd6FVpXf5owd1Bi3vn5GaBt0KE2Cw&e=
> 
> 
-- 
 Eugeniy Paltsev
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/msm/a6xx: Vote for a reasonable bus quota before starting GMU init

2018-09-28 Thread Jordan Crouse
To avoid possible issues during GMU init make sure to vote the bus
quota to a reasonable level before starting the sequence. Also
remove the bus vote during power off to avoid leaking power we don't
need.

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

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index bce66ed9638d..9ddf64ff968e 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -692,6 +692,8 @@ int a6xx_gmu_reset(struct a6xx_gpu *a6xx_gpu)
 
 int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
 {
+   struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;
+   struct msm_gpu *gpu = &adreno_gpu->base;
struct a6xx_gmu *gmu = &a6xx_gpu->gmu;
int status, ret;
 
@@ -707,6 +709,9 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
if (ret)
goto out;
 
+   /* Set the bus quota to a reasonable value for boot */
+   icc_set(gpu->icc_path, 0, 307200);
+
a6xx_gmu_irq_enable(gmu);
 
/* Check to see if we are doing a cold or warm boot */
@@ -747,6 +752,8 @@ bool a6xx_gmu_isidle(struct a6xx_gmu *gmu)
 
 int a6xx_gmu_stop(struct a6xx_gpu *a6xx_gpu)
 {
+   struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;
+   struct msm_gpu *gpu = &adreno_gpu->base;
struct a6xx_gmu *gmu = &a6xx_gpu->gmu;
u32 val;
 
@@ -793,6 +800,9 @@ int a6xx_gmu_stop(struct a6xx_gpu *a6xx_gpu)
/* Tell RPMh to power off the GPU */
a6xx_rpmh_stop(gmu);
 
+   /* Remove the bus vote */
+   icc_set(gpu->icc_path, 0, 0);
+
clk_bulk_disable_unprepare(gmu->nr_clocks, gmu->clocks);
 
pm_runtime_put_sync(gmu->dev);
-- 
2.18.0

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


[PATCH] drm/msm/a6xx: Add inactive_period for a6xx

2018-09-28 Thread Jordan Crouse
The target definition for a630 didn't set a reasonable
value for inactive_period so it defaulted to zero and
we were essentially powering down after every submission.
Set it back to the default value to keep the GPU from
bouncing too much during regular workloads.

Signed-off-by: Jordan Crouse 
---
 drivers/gpu/drm/msm/adreno/adreno_device.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c 
b/drivers/gpu/drm/msm/adreno/adreno_device.c
index 7d3e9a129ac7..86abdb2b3a9c 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_device.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
@@ -120,6 +120,7 @@ static const struct adreno_info gpulist[] = {
[ADRENO_FW_GMU] = "a630_gmu.bin",
},
.gmem = SZ_1M,
+   .inactive_period = DRM_MSM_INACTIVE_PERIOD,
.init = a6xx_gpu_init,
},
 };
-- 
2.18.0

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


[Bug 108095] Window becomes partially transparent for short time

2018-09-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108095

--- Comment #1 from Michel Dänzer  ---
Please attach the corresponding Xorg log file and the outputs of dmesg and
glxinfo.

-- 
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/20] drm/fsl-dcu: Use drm_fbdev_generic_setup()

2018-09-28 Thread Stefan Agner
On 27.09.2018 23:23, Noralf Trønnes wrote:
> Den 27.09.2018 23.08, skrev Stefan Agner:
>> On 08.09.2018 15:46, Noralf Trønnes wrote:
>>> The CMA helper is already using the drm_fb_helper_generic_probe part of
>>> the generic fbdev emulation. This patch makes full use of the generic
>>> fbdev emulation by using its drm_client callbacks. This means that
>>> drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are
>>> now handled by the emulation code. Additionally fbdev unregister happens
>>> automatically on drm_dev_unregister().
>>>
>>> The drm_fbdev_generic_setup() call is put after drm_dev_register() in the
>>> driver. This is done to highlight the fact that fbdev emulation is an
>>> internal client that makes use of the driver, it is not part of the
>>> driver as such. If fbdev setup fails, an error is printed, but the driver
>>> succeeds probing.
>> I think the last sentence is currently not implemented, I think it will
>> silently succeed probing. Can we add something like this, similar to
>> tinydrm-core.c?
>>
>>  if (ret)
>>  DRM_ERROR("Failed to initialize fbdev: %d\n", ret);
> 
> It was implemented in the first patch in the series, now applied:
> 
> drm/fb-helper: Improve error reporting in setup
> https://cgit.freedesktop.org/drm/drm-misc/commit/?id=6129369a96183f28c7912dfd37cb5869433aa904

That patch adds error reporting for drm_fb_helper_fbdev_setup().

But you are using drm_fbdev_generic_setup() here...

--
Stefan

> 
> Noralf.
> 
>> --
>> Stefan
>>
>>> Cc: Stefan Agner 
>>> Cc: Alison Wang 
>>> Signed-off-by: Noralf Trønnes 
>>> ---
>>>   drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 25 +++--
>>>   drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h |  1 -
>>>   2 files changed, 3 insertions(+), 23 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
>>> b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
>>> index 80232321a244..15816141e5fb 100644
>>> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
>>> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
>>> @@ -26,6 +26,7 @@
>>>   #include 
>>>   #include 
>>>   #include 
>>> +#include 
>>>   #include 
>>>   #include 
>>>   @@ -89,20 +90,11 @@ static int fsl_dcu_load(struct drm_device *dev,
>>> unsigned long flags)
>>> "Invalid legacyfb_depth.  Defaulting to 24bpp\n");
>>> legacyfb_depth = 24;
>>> }
>>> -   fsl_dev->fbdev = drm_fbdev_cma_init(dev, legacyfb_depth, 1);
>>> -   if (IS_ERR(fsl_dev->fbdev)) {
>>> -   ret = PTR_ERR(fsl_dev->fbdev);
>>> -   fsl_dev->fbdev = NULL;
>>> -   goto done;
>>> -   }
>>> return 0;
>>>   done:
>>> drm_kms_helper_poll_fini(dev);
>>>   - if (fsl_dev->fbdev)
>>> -   drm_fbdev_cma_fini(fsl_dev->fbdev);
>>> -
>>> drm_mode_config_cleanup(dev);
>>> drm_irq_uninstall(dev);
>>> dev->dev_private = NULL;
>>> @@ -112,14 +104,9 @@ static int fsl_dcu_load(struct drm_device *dev,
>>> unsigned long flags)
>>> static void fsl_dcu_unload(struct drm_device *dev)
>>>   {
>>> -   struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
>>> -
>>> drm_atomic_helper_shutdown(dev);
>>> drm_kms_helper_poll_fini(dev);
>>>   - if (fsl_dev->fbdev)
>>> -   drm_fbdev_cma_fini(fsl_dev->fbdev);
>>> -
>>> drm_mode_config_cleanup(dev);
>>> drm_irq_uninstall(dev);
>>>   @@ -147,19 +134,11 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void 
>>> *arg)
>>> return IRQ_HANDLED;
>>>   }
>>>   -static void fsl_dcu_drm_lastclose(struct drm_device *dev)
>>> -{
>>> -   struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
>>> -
>>> -   drm_fbdev_cma_restore_mode(fsl_dev->fbdev);
>>> -}
>>> -
>>>   DEFINE_DRM_GEM_CMA_FOPS(fsl_dcu_drm_fops);
>>> static struct drm_driver fsl_dcu_drm_driver = {
>>> .driver_features= DRIVER_HAVE_IRQ | DRIVER_GEM | DRIVER_MODESET
>>> | DRIVER_PRIME | DRIVER_ATOMIC,
>>> -   .lastclose  = fsl_dcu_drm_lastclose,
>>> .load   = fsl_dcu_load,
>>> .unload = fsl_dcu_unload,
>>> .irq_handler= fsl_dcu_drm_irq,
>>> @@ -355,6 +334,8 @@ static int fsl_dcu_drm_probe(struct platform_device 
>>> *pdev)
>>> if (ret < 0)
>>> goto unref;
>>>   + drm_fbdev_generic_setup(drm, legacyfb_depth);
>>> +
>>> return 0;
>>> unref:
>>> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
>>> b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
>>> index 93bfb98012d4..cb87bb74cb87 100644
>>> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
>>> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
>>> @@ -191,7 +191,6 @@ struct fsl_dcu_drm_device {
>>> /*protects hardware register*/
>>> spinlock_t irq_lock;
>>> struct drm_device *drm;
>>> -   struct drm_fbdev_cma *fbdev;
>>> struct drm_crtc crtc;
>>> struct drm_encoder encoder;
>>> struct fsl_dcu_drm_connector connector;
___
dri-devel mailing li

Re: [PATCH v3] backlight: pwm_bl: switch to using "atomic" PWM API

2018-09-28 Thread Heiko Stuebner
Hi Lee,

Am Montag, 10. September 2018, 16:49:24 CEST schrieb Lee Jones:
> On Tue, 14 Aug 2018, Enric Balletbo i Serra wrote:
> 
> > The "atomic" API allows us to configure PWM period and duty_cycle and
> > enable it in one call.
> > 
> > The patch also moves the pwm_init_state just before any use of the
> > pwm_state struct, this fixes a potential bug where pwm_get_state
> > can be called before pwm_init_state.
> > 
> > Signed-off-by: Enric Balletbo i Serra 
> > ---
> > 
> > Changes in v3:
> > - Get rid of duty_cycle variable from pwm_backlight_update_status.
> > - Get rid of pb->enabled and use only the status.enabled variable.
> > - Make power_on match power_off.
> > - Do not share status between ...update_status and ...power_on
> > 
> > Changes in v2:
> > - Do not force the PWM be off in the first call to pwm_apply_state.
> > - Delayed applying the state until we know what the period is.
> > - Removed pb->period as after the conversion is not needed.
> > 
> >  drivers/video/backlight/pwm_bl.c | 81 +---
> >  1 file changed, 42 insertions(+), 39 deletions(-)
> 
> Applied, thanks.

did this miss some push or so, because looking at [0], I don't see
any new patches for a while now?

Heiko

[0] https://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git/


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


[git pull] vmwgfx-next

2018-09-28 Thread Thomas Hellstrom
Hi, Dave

I realize this is probably too late for the next merge window. If that's the 
case, then
we can just postpone it for 4.21.

Mostly code reorganizations and optimizations for vmwgfx.
- Move TTM code that's only used by vmwgfx to vmwgfx
- Break out the vmwgfx buffer- and resource validation code to a separate 
source file
- Get rid of a number of atomic operations during command buffer validation.

The following changes since commit 36c9c3c91128e2b892c9be0dd9ee9bd82cbe82ad:

  Merge branch 'drm-next-4.20' of git://people.freedesktop.org/~agd5f/linux 
into drm-next (2018-09-21 09:52:53 +1000)

are available in the Git repository at:

  git://people.freedesktop.org/~thomash/linux vmwgfx-next

for you to fetch changes up to e8c66efbfe3a2e3cbc573f2474a3d51690f1b857:

  drm/vmwgfx: Make user resource lookups reference-free during validation 
(2018-09-28 08:57:09 +0200)


Thomas Hellstrom (19):
  drm/ttm, drm/vmwgfx: Move the lock- and object functionality to the 
vmwgfx driver
  drm/vmwgfx: Add a validation module v2
  drm/vmwgfx: Modify the resource validation interface
  drm/vmwgfx: Adapt execbuf to the new validation api
  drm/vmwgfx: Use new validation interface for the modesetting code v2
  drm/vmwgfx: Use a validation context allocator for relocations and 
validations
  drm/vmwgfx: Reduce the size of buffer object relocations
  drm/vmwgfx: Replace unconditional mutex unlocked warnings with lockdep 
counterpart
  drm/vmwgfx: Remove the resource avail field
  drm/vmwgfx: Remove the user resource destructor check
  drm/vmwgfx: Make the object handles idr-generated
  drm/vmwgfx: Look up objects without taking a reference
  drm/ttm: Export ttm_bo_get_unless_zero()
  drm/vmwgfx: Adapt validation code for reference-free lookups
  drm/vmwgfx: Look up user buffer objects without taking a reference
  drm/vmwgfx: Make buffer object lookups reference-free during validation
  drm/vmwgfx: Don't refcount command-buffer managed resource lookups during 
command buffer validation
  drm/vmwgfx: Don't refcount cotable lookups during command buffer 
validation
  drm/vmwgfx: Make user resource lookups reference-free during validation

 drivers/gpu/drm/ttm/Makefile   |4 +-
 drivers/gpu/drm/ttm/ttm_bo_vm.c|3 +-
 drivers/gpu/drm/vmwgfx/Makefile|4 +-
 drivers/gpu/drm/{ttm => vmwgfx}/ttm_lock.c |   15 +-
 .../drm/ttm => drivers/gpu/drm/vmwgfx}/ttm_lock.h  |0
 drivers/gpu/drm/{ttm => vmwgfx}/ttm_object.c   |   97 +-
 .../ttm => drivers/gpu/drm/vmwgfx}/ttm_object.h|   31 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_bo.c |   50 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c |4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c |3 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_context.c|   23 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c|2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c|4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h|  147 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c| 1288 
 drivers/gpu/drm/vmwgfx/vmwgfx_fence.c  |7 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c|  199 +--
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.h|   24 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_prime.c  |2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c   |  124 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_resource_priv.h  |7 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c   |   48 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_shader.c |   25 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c|7 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_so.c |   11 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c   |   31 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c|   20 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_validation.c |  770 
 drivers/gpu/drm/vmwgfx/vmwgfx_validation.h |  227 
 include/drm/ttm/ttm_bo_api.h   |   18 +
 30 files changed, 1966 insertions(+), 1229 deletions(-)
 rename drivers/gpu/drm/{ttm => vmwgfx}/ttm_lock.c (94%)
 rename {include/drm/ttm => drivers/gpu/drm/vmwgfx}/ttm_lock.h (100%)
 rename drivers/gpu/drm/{ttm => vmwgfx}/ttm_object.c (90%)
 rename {include/drm/ttm => drivers/gpu/drm/vmwgfx}/ttm_object.h (94%)
 create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_validation.c
 create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_validation.h
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 108095] Window becomes partially transparent for short time

2018-09-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108095

Bug ID: 108095
   Summary: Window becomes partially transparent for short time
   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: pmenzel+bugs.freedesk...@molgen.mpg.de

Created attachment 141774
  --> https://bugs.freedesktop.org/attachment.cgi?id=141774&action=edit
(manually edited) screenshot showing the problem

With Linux 4.14.55 and 4.19-rc5 (drm-tip), Xfce 4.13 and the Radeon device
below, a user reports, that sometimes parts of the terminal window (Xfce and
GNOME Terminal) get transparent.

$ lspci -nn -s 65:00.0
65:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc.
[AMD/ATI] Lexa XT [Radeon PRO WX 3100] [1002:6985]

After one or two seconds the problem fixes itself. Nothing is in the Linux logs
regarding this issue.

-- 
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/fb_helper: Allow leaking fbdev smem_start

2018-09-28 Thread Neil Armstrong
Since "drm/fb: Stop leaking physical address", the default behaviour of
the DRM fbdev emulation is to set the smem_base to 0 and pass the new
FBINFO_HIDE_SMEM_START flag.

The main reason is to avoid leaking physical addresse to user-space, and
it follows a general move over the kernel code to avoid user-space to
manipulate physical addresses and then use some other mechanisms like
dma-buf to transfer physical buffer handles over multiple subsystems.

But, a lot of devices depends on closed sources binaries to enable
OpenGL hardware acceleration that uses this smem_start value to
pass physical addresses to out-of-tree modules in order to render
into these physical adresses. These should use dma-buf buffers allocated
from the DRM display device instead and stop relying on fbdev overallocation
to gather DMA memory (some HW vendors delivers GBM and Wayland capable
binaries, but older unsupported devices won't have these new binaries
and are doomed until an Open Source solution like Lima finalizes).

Since these devices heavily depends on this kind of software and because
the smem_start population was available for years, it's a breakage to
stop leaking smem_start without any alternative solutions.

This patch adds a Kconfig depending on the EXPERT config and an unsafe
kernel module parameter tainting the kernel when enabled.

A clear comment and Kconfig help text was added to clarify why and when
this patch should be reverted, but in the meantime it's a necessary
feature to keep.

Cc: Dave Airlie 
Cc: Daniel Vetter 
Cc: Bartlomiej Zolnierkiewicz 
Cc: Noralf Trønnes 
Cc: Maxime Ripard 
Cc: Eric Anholt 
Cc: Lucas Stach 
Cc: Rob Clark 
Cc: Ben Skeggs 
Cc: Christian König 
Signed-off-by: Neil Armstrong 
Reviewed-by: Maxime Ripard 
Tested-by: Maxime Ripard 
Acked-by: Daniel Vetter 
---
 drivers/gpu/drm/Kconfig | 20 
 drivers/gpu/drm/drm_fb_helper.c | 33 +++--
 2 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 8871b3f..0b4067f 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -110,6 +110,26 @@ config DRM_FBDEV_OVERALLOC
  is 100. Typical values for double buffering will be 200,
  triple buffering 300.
 
+config DRM_FBDEV_LEAK_PHYS_SMEM
+   bool "Shamelessly allow leaking of fbdev physical address (DANGEROUS)"
+   depends on DRM_FBDEV_EMULATION && EXPERT
+   default n
+   help
+ In order to keep user-space compatibility, we want in certain
+ use-cases to keep leaking the fbdev physical address to the
+ user-space program handling the fbdev buffer.
+ This affects, not only, Amlogic, Allwinner or Rockchip devices
+ with ARM Mali GPUs using an userspace Blob.
+ This option is not supported by upstream developers and should be
+ removed as soon as possible and be considered as a broken and
+ legacy behaviour from a modern fbdev device driver.
+
+ Please send any bug reports when using this to your proprietary
+ software vendor that requires this.
+
+ If in doubt, say "N" or spread the word to your closed source
+ library vendor.
+
 config DRM_LOAD_EDID_FIRMWARE
bool "Allow to specify an EDID data set instead of probing for it"
depends on DRM
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index bf2190c..61a0d2b 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -56,6 +56,25 @@ MODULE_PARM_DESC(drm_fbdev_overalloc,
 "Overallocation of the fbdev buffer (%) [default="
 __MODULE_STRING(CONFIG_DRM_FBDEV_OVERALLOC) "]");
 
+/*
+ * In order to keep user-space compatibility, we want in certain use-cases
+ * to keep leaking the fbdev physical address to the user-space program
+ * handling the fbdev buffer.
+ * This is a bad habit essentially kept into closed source opengl driver
+ * that should really be moved into open-source upstream projects instead
+ * of using legacy physical addresses in user space to communicate with
+ * other out-of-tree kernel modules.
+ *
+ * This module_param *should* be removed as soon as possible and be
+ * considered as a broken and legacy behaviour from a modern fbdev device.
+ */
+#if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM)
+static bool drm_leak_fbdev_smem = false;
+module_param_unsafe(drm_leak_fbdev_smem, bool, 0600);
+MODULE_PARM_DESC(fbdev_emulation,
+"Allow unsafe leaking fbdev physical smem address 
[default=false]");
+#endif
+
 static LIST_HEAD(kernel_fb_helper_list);
 static DEFINE_MUTEX(kernel_fb_helper_lock);
 
@@ -2673,8 +2692,12 @@ __drm_fb_helper_initial_config_and_unlock(struct 
drm_fb_helper *fb_helper,
 
info = fb_helper->fbdev;
info->var.pixclock = 0;
-   /* don't leak any physical addresses to userspace */
-   info->flags |= FBINFO_HIDE_SMEM_START;
+  

Re: [PATCH v5 0/6] drm/rockchip: hdmi support for rk3328

2018-09-28 Thread Heiko Stuebner
Am Mittwoch, 12. September 2018, 14:47:34 CEST schrieb Heiko Stuebner:
> The rk3228/rk3229 and rk3328 socs started using a new type of hdmi-phy
> from Innosilicon that resides completely separate from the dw-hdmi block
> and gets accessed via mmio.
> 
> Additionally the rk3328 dw-hdmi does not report the vendor-phy type
> but a different one instead, so add the possibility to override the
> phy type when the glue driver knows better than the ip block itself.
> 
> changes in v5:
> - disable CEC_5V option to make CEC actually work (Jonas)
> 
> changes in v4:
> - rebased onto 4.19-rc2 - no actual changes
> - added Rob's Ack on the dw-hdmi compatible
> 
> changes in v3:
> - split off phy driver into a separate series
> - only allow forcing vendor phy type
> - wording fixes and other nits
> 
> changes in v2:
> - phy: prevent overflow in tmdsclk calculation
>   as reported by Martin Cerveny
> - phy: use unsigned long for all tmdsclk rate uses
> - phy: simplify tmds rate calculation
> - dropped patch exporting some dw-hdmi phy functions
>   as a similar patch entered drm-misc already
> 
> Heiko Stuebner (6):
>   drm/bridge: dw-hdmi: allow forcing vendor phy-type
>   drm/rockchip: dw_hdmi: Allow outputs that don't need output switching
>   dt-bindings: allow optional phys in Rockchip dw_hdmi binding
>   drm/rockchip: dw_hdmi: allow including external phys
>   drm/rockchip: dw_hdmi: store rockchip_hdmi reference in phy_data
> object
>   drm/rockchip: dw_hdmi: add dw-hdmi support for the rk3328

applied to drm-misc-next with the received Reviews


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


[Bug 108094] [CI][BAT] KBL-G: Test assertion failure function amdgpu_command_submission_compute_nop

2018-09-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108094

Bug ID: 108094
   Summary: [CI][BAT] KBL-G: Test assertion failure function
amdgpu_command_submission_compute_nop
   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: tomi.p.sarv...@intel.com

>From CI_DRM_4904 on Hades Canyon (KBL-G):
https://intel-gfx-ci.01.org/tree/drm-tip/igt@amdgpu_amd_ba...@cs-compute.html

Starting subtest: cs-compute
(amd_basic:3890) CRITICAL: Test assertion failure function
amdgpu_command_submission_compute_nop, file ../tests/amdgpu/amd_basic.c:722:
(amd_basic:3890) CRITICAL: Failed assertion: r == 0
(amd_basic:3890) CRITICAL: Last errno: 22, Invalid argument
(amd_basic:3890) CRITICAL: error: -22 != 0
Subtest cs-compute failed.

-- 
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/20] drm/arc: Use drm_fbdev_generic_setup()

2018-09-28 Thread Noralf Trønnes


Den 28.09.2018 09.34, skrev Alexey Brodkin:

Hi Noralf,

On Sat, 2018-09-08 at 15:46 +0200, Noralf Trønnes wrote:

The CMA helper is already using the drm_fb_helper_generic_probe part of
the generic fbdev emulation. This patch makes full use of the generic
fbdev emulation by using its drm_client callbacks. This means that
drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are
now handled by the emulation code. Additionally fbdev unregister happens
automatically on drm_dev_unregister().

The drm_fbdev_generic_setup() call is put after drm_dev_register() in the
driver. This is done to highlight the fact that fbdev emulation is an
internal client that makes use of the driver, it is not part of the
driver as such. If fbdev setup fails, an error is printed, but the driver
succeeds probing.

Cc: Alexey Brodkin 
Signed-off-by: Noralf Trønnes 

Thanks for doing that!
Quite some code removed from the driver and still FBDEV emulation works :)


Yeah we're down to one line of code in the driver to get fbdev emulation
which is quite nice a think :D

Noralf.


Acked-by: Alexey Brodkin 



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


Re: [PATCH] Revert "drm/panel: Add device_link from panel device to DRM device"

2018-09-28 Thread Linus Walleij
On Thu, Sep 27, 2018 at 3:50 PM Sean Paul  wrote:

> What's different in your in-development driver that's causing you to hit
> this?

I think Andrzej answered it well, but I couldn't see what I did
different from the Exynos driver, so I was puzzled that it would
still work, but as it turns out that one breaks too.

As far as I can tell, the proper fix is more complex and require
embedding a struct device into struct drm_device like most
subsystems do and create a link to that device instead of
parent (dev->dev), because the parent device may be
the parent of several subdevices, not just the drm_device,
but also (in my case at least) the DSI devices. A typical case
would be if the DSI host is in the same address range as the
display controller (then it is usually represented by the same
device).

On other platforms the parent device may just be parent for
the drm_device but we can't just assume that.

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


Re: [PATCH v5 1/6] drm/bridge: dw-hdmi: allow forcing vendor phy-type

2018-09-28 Thread Andrzej Hajda
On 12.09.2018 14:47, Heiko Stuebner wrote:
> In some IP implementations the reading of the phy-type may be broken.
> One example are the Rockchip rk3228 and rk3328 socs that use a separate
> vendor-type phy from Innosilicon but still report the HDMI20_TX type.
>
> So allow the glue driver to force the vendor-phy for these cases.
> In the future it may be necessary to allow forcing other types, but
> for now we'll keep it simply to the case actually seen in the wild.
>
> changes in v3:
> - only allow forcing vendor type, as suggested by Laurent
>
> Signed-off-by: Heiko Stuebner 
> Tested-by: Robin Murphy 
Reviewed-by: Andrzej Hajda 

 --
Regards
Andrzej

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


Re: Fwd: [PATCH v5 4/6] drm/rockchip: dw_hdmi: allow including external phys

2018-09-28 Thread Zheng Yang

Hi, Heiko:

Reviewed-by: zhengyang 


Some variants of the dw-hdmi on Rockchip socs use a separate phy block
accessed via the generic phy framework, so allow them to be included
if such a phy reference is found.

Signed-off-by: Heiko Stuebner 
Tested-by: Robin Murphy 
---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 
b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c

index b09c3531305b..57e76dfd5f6d 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
  #include 
@@ -49,6 +50,7 @@ struct rockchip_hdmi {
 struct clk *vpll_clk;
 struct clk *grf_clk;
 struct dw_hdmi *hdmi;
+    struct phy *phy;
 };
  #define to_rockchip_hdmi(x)    container_of(x, struct rockchip_hdmi, x)
@@ -376,6 +378,14 @@ static int dw_hdmi_rockchip_bind(struct device 
*dev, struct device *master,

 return ret;
 }
 +    hdmi->phy = devm_phy_optional_get(dev, "hdmi");
+    if (IS_ERR(hdmi->phy)) {
+    ret = PTR_ERR(hdmi->phy);
+    if (ret != -EPROBE_DEFER)
+    DRM_DEV_ERROR(hdmi->dev, "failed to get phy\n");
+    return ret;
+    }
+
 drm_encoder_helper_add(encoder, 
&dw_hdmi_rockchip_encoder_helper_funcs);

 drm_encoder_init(drm, encoder, &dw_hdmi_rockchip_encoder_funcs,
  DRM_MODE_ENCODER_TMDS, NULL);



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


Re: Fwd: [PATCH v5 5/6] drm/rockchip: dw_hdmi: store rockchip_hdmi reference in phy_data object

2018-09-28 Thread Zheng Yang

Hi, Heiko:

Reviewed-by: zhengyang 



When using special phy handling operations we'll often need access to
the rockchip_hdmi struct.

As the chip-data that occupies the phy_data pointer initially gets
assigned to the rockchip_hdmi struct, we can now re-use this phy_data
pointer to hold the reference to the rockchip_hdmi struct and use this
reference later on.

Inspiration for this comes from meson and sunxi dw-hdmi, which are using
the same method.

Signed-off-by: Heiko Stuebner 
Tested-by: Robin Murphy 

changes in v3:
- reword commit message
---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 
b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c

index 57e76dfd5f6d..19f002fa0a09 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -335,7 +335,7 @@ static int dw_hdmi_rockchip_bind(struct device 
*dev, struct device *master,

  void *data)
 {
 struct platform_device *pdev = to_platform_device(dev);
-    const struct dw_hdmi_plat_data *plat_data;
+    struct dw_hdmi_plat_data *plat_data;
 const struct of_device_id *match;
 struct drm_device *drm = data;
 struct drm_encoder *encoder;
@@ -350,9 +350,14 @@ static int dw_hdmi_rockchip_bind(struct device 
*dev, struct device *master,

 return -ENOMEM;
  match = of_match_node(dw_hdmi_rockchip_dt_ids, pdev->dev.of_node);
-    plat_data = match->data;
+    plat_data = devm_kmemdup(&pdev->dev, match->data,
+ sizeof(*plat_data), GFP_KERNEL);
+    if (!plat_data)
+    return -ENOMEM;
+
 hdmi->dev = &pdev->dev;
 hdmi->chip_data = plat_data->phy_data;
+    plat_data->phy_data = hdmi;
 encoder = &hdmi->encoder;
  encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, 
dev->of_node);



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


Re: [PATCH v5 1/6] drm/bridge: dw-hdmi: allow forcing vendor phy-type

2018-09-28 Thread Zheng Yang

Hi, Heiko:

Reviewed-by: zhengyang 



In some IP implementations the reading of the phy-type may be broken.
One example are the Rockchip rk3228 and rk3328 socs that use a separate
vendor-type phy from Innosilicon but still report the HDMI20_TX type.

So allow the glue driver to force the vendor-phy for these cases.
In the future it may be necessary to allow forcing other types, but
for now we'll keep it simply to the case actually seen in the wild.

changes in v3:
- only allow forcing vendor type, as suggested by Laurent

Signed-off-by: Heiko Stuebner 
Tested-by: Robin Murphy 
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 +++-
 include/drm/bridge/dw_hdmi.h  | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c 
b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c

index 5971976284bf..ac37c50d6c4b 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -2205,7 +2205,9 @@ static int dw_hdmi_detect_phy(struct dw_hdmi *hdmi)
 unsigned int i;
 u8 phy_type;
 -    phy_type = hdmi_readb(hdmi, HDMI_CONFIG2_ID);
+    phy_type = hdmi->plat_data->phy_force_vendor ?
+    DW_HDMI_PHY_VENDOR_PHY :
+    hdmi_readb(hdmi, HDMI_CONFIG2_ID);
  if (phy_type == DW_HDMI_PHY_VENDOR_PHY) {
 /* Vendor PHYs require support from the glue layer. */
diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
index ccb5aa8468e0..6ef3236bb6dd 100644
--- a/include/drm/bridge/dw_hdmi.h
+++ b/include/drm/bridge/dw_hdmi.h
@@ -133,6 +133,7 @@ struct dw_hdmi_plat_data {
 const struct dw_hdmi_phy_ops *phy_ops;
 const char *phy_name;
 void *phy_data;
+    bool phy_force_vendor;
  /* Synopsys PHY support */
 const struct dw_hdmi_mpll_config *mpll_cfg;



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


Re: Fwd: [PATCH v5 2/6] drm/rockchip: dw_hdmi: Allow outputs that don't need output switching

2018-09-28 Thread Zheng Yang

Hi, Heiko:

Hi, Heiko:

Hi, Heiko:

Reviewed-by: zhengyang 



So far we always encountered socs with 2 output crtcs needing the driver
to tell the hdmi block which output to connect to. But there also exist
socs with only one crtc like the rk3228, rk3328 and rk3368.

So adapt the register field to simply carry a negative value to signal
that no output-switching is necessary.

Signed-off-by: Heiko Stuebner 
Tested-by: Robin Murphy 

changes in v3:
- fixed wording issue found by Robin Murphy
---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 
b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c

index 11309a2a4e43..b09c3531305b 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -36,7 +36,7 @@
  * @lcdsel_lit: reg value of selecting vop little for HDMI
  */
 struct rockchip_hdmi_chip_data {
-    u32    lcdsel_grf_reg;
+    int    lcdsel_grf_reg;
 u32    lcdsel_big;
 u32    lcdsel_lit;
 };
@@ -245,6 +245,9 @@ static void dw_hdmi_rockchip_encoder_enable(struct 
drm_encoder *encoder)

 u32 val;
 int ret;
 +    if (hdmi->chip_data->lcdsel_grf_reg < 0)
+    return;
+
 ret = drm_of_encoder_active_endpoint_id(hdmi->dev->of_node, 
encoder);

 if (ret)
 val = hdmi->chip_data->lcdsel_lit;



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


Re: [PATCH v5 3/5] drm/dp: make dp_get_lane_status usable from outside of the core

2018-09-28 Thread Sean Paul
On Tue, Sep 25, 2018 at 10:13:33AM +0100, Damian Kos wrote:
> From: Quentin Schulz 
> 
> dp_get_lane_status is pretty generic and can be used for other means,
> so let's make it "public".
> 
> This adds drm_dp_get_lane_status to the header file and add the appropriate
> EXPORT_SYMBOL for it so that it can be used by other drivers, be they compiled
> built-in or as modules.
> 
> Signed-off-by: Quentin Schulz 
> Signed-off-by: Damian Kos 

Now that you've refactored mhdp_validate_cr(), you no longer need this patch.

Sean

> ---
>  drivers/gpu/drm/drm_dp_helper.c | 9 +
>  include/drm/drm_dp_helper.h | 2 ++
>  2 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index 735ebde5c2f0..169db52f92f5 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -48,14 +48,15 @@ static u8 dp_link_status(const u8 
> link_status[DP_LINK_STATUS_SIZE], int r)
>   return link_status[r - DP_LANE0_1_STATUS];
>  }
>  
> -static u8 dp_get_lane_status(const u8 link_status[DP_LINK_STATUS_SIZE],
> -  int lane)
> +u8 drm_dp_get_lane_status(const u8 link_status[DP_LINK_STATUS_SIZE],
> +   int lane)
>  {
>   int i = DP_LANE0_1_STATUS + (lane >> 1);
>   int s = (lane & 1) * 4;
>   u8 l = dp_link_status(link_status, i);
>   return (l >> s) & 0xf;
>  }
> +EXPORT_SYMBOL(drm_dp_get_lane_status);
>  
>  bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
> int lane_count)
> @@ -69,7 +70,7 @@ bool drm_dp_channel_eq_ok(const u8 
> link_status[DP_LINK_STATUS_SIZE],
>   if ((lane_align & DP_INTERLANE_ALIGN_DONE) == 0)
>   return false;
>   for (lane = 0; lane < lane_count; lane++) {
> - lane_status = dp_get_lane_status(link_status, lane);
> + lane_status = drm_dp_get_lane_status(link_status, lane);
>   if ((lane_status & DP_CHANNEL_EQ_BITS) != DP_CHANNEL_EQ_BITS)
>   return false;
>   }
> @@ -84,7 +85,7 @@ bool drm_dp_clock_recovery_ok(const u8 
> link_status[DP_LINK_STATUS_SIZE],
>   u8 lane_status;
>  
>   for (lane = 0; lane < lane_count; lane++) {
> - lane_status = dp_get_lane_status(link_status, lane);
> + lane_status = drm_dp_get_lane_status(link_status, lane);
>   if ((lane_status & DP_LANE_CR_DONE) == 0)
>   return false;
>   }
> diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
> index 698082a02b97..973d2fda9654 100644
> --- a/include/drm/drm_dp_helper.h
> +++ b/include/drm/drm_dp_helper.h
> @@ -952,6 +952,8 @@
>  #define DP_MST_LOGICAL_PORT_0 8
>  
>  #define DP_LINK_STATUS_SIZE 6
> +
> +u8 drm_dp_get_lane_status(const u8 link_status[DP_LINK_STATUS_SIZE], int 
> lane);
>  bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
> int lane_count);
>  bool drm_dp_clock_recovery_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
> -- 
> 2.17.1
> 

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