[PATCH] drm/exynos: Fix dma-buf import

2017-10-30 Thread Marek Szyprowski
When IOMMU support was enabled, dma-buf import in Exynos DRM was broken
since commit f43c35966a5a ("drm/exynos: use real device for DMA-mapping
operations") due to using wrong struct device in drm_gem_prime_import()
function. This patch fixes following kernel BUG caused by incorrect buffer
mapping to DMA address space:

exynos-sysmmu 1465.sysmmu: 1445.mixer: PAGE FAULT occurred at 0xb2e0
[ cut here ]
kernel BUG at drivers/iommu/exynos-iommu.c:449!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 
4.14.0-rc4-next-20171016-00033-g990d723669fd #3165
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
task: c0e0b7c0 task.stack: c0e0
PC is at exynos_sysmmu_irq+0x1d0/0x24c
LR is at exynos_sysmmu_irq+0x154/0x24c
[ cut here ]

Reported-by: Marian Mihailescu 
Fixes: f43c35966a5a ("drm/exynos: use real device for DMA-mapping operations")
Signed-off-by: Marek Szyprowski 
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 +-
 drivers/gpu/drm/exynos/exynos_drm_gem.c | 6 ++
 drivers/gpu/drm/exynos/exynos_drm_gem.h | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index e651a58c18cf..0822c5341ba4 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -148,7 +148,7 @@ static struct drm_driver exynos_drm_driver = {
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
.gem_prime_export   = drm_gem_prime_export,
-   .gem_prime_import   = drm_gem_prime_import,
+   .gem_prime_import   = exynos_drm_gem_prime_import,
.gem_prime_get_sg_table = exynos_drm_gem_prime_get_sg_table,
.gem_prime_import_sg_table  = exynos_drm_gem_prime_import_sg_table,
.gem_prime_vmap = exynos_drm_gem_prime_vmap,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c 
b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index 077de014d610..ef35bc23bb36 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -506,6 +506,12 @@ int exynos_drm_gem_mmap(struct file *filp, struct 
vm_area_struct *vma)
 }
 
 /* low-level interface prime helpers */
+struct drm_gem_object *exynos_drm_gem_prime_import(struct drm_device *dev,
+   struct dma_buf *dma_buf)
+{
+   return drm_gem_prime_import_dev(dev, dma_buf, to_dma_dev(dev));
+}
+
 struct sg_table *exynos_drm_gem_prime_get_sg_table(struct drm_gem_object *obj)
 {
struct exynos_drm_gem *exynos_gem = to_exynos_gem(obj);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h 
b/drivers/gpu/drm/exynos/exynos_drm_gem.h
index e86d1a9518c3..5a4c7de80f65 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h
@@ -117,6 +117,8 @@ int exynos_drm_gem_fault(struct vm_fault *vmf);
 int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
 
 /* low-level interface prime helpers */
+struct drm_gem_object *exynos_drm_gem_prime_import(struct drm_device *dev,
+   struct dma_buf *dma_buf);
 struct sg_table *exynos_drm_gem_prime_get_sg_table(struct drm_gem_object *obj);
 struct drm_gem_object *
 exynos_drm_gem_prime_import_sg_table(struct drm_device *dev,
-- 
2.14.2

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


[PATCH v2 08/10] dt-bindings: add binding for A64 DE2 CCU SRAM

2017-10-30 Thread Icenowy Zheng
A64's Display Engine 2.0 needs a section of SRAM (SRAM C) to be claimed,
otherwise the whole DE2 memory zone cannot be accessed (kept to all 0).

Add binding for this, in order to make the DE2 CCU able to claim the
SRAM and enable access to the DE2 clock and reset registers.

Signed-off-by: Icenowy Zheng 
---
Changes in v2:
- Adds description of the situation when the SRAM is not claimed.

 Documentation/devicetree/bindings/clock/sun8i-de2.txt | 5 +
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/clock/sun8i-de2.txt 
b/Documentation/devicetree/bindings/clock/sun8i-de2.txt
index f2fa87c4765c..a7d558a2b9b2 100644
--- a/Documentation/devicetree/bindings/clock/sun8i-de2.txt
+++ b/Documentation/devicetree/bindings/clock/sun8i-de2.txt
@@ -6,6 +6,7 @@ Required properties :
- "allwinner,sun8i-a83t-de2-clk"
- "allwinner,sun8i-h3-de2-clk"
- "allwinner,sun8i-v3s-de2-clk"
+   - "allwinner,sun50i-a64-de2-clk"
- "allwinner,sun50i-h5-de2-clk"
 
 - reg: Must contain the registers base address and length
@@ -18,6 +19,10 @@ Required properties :
 - #clock-cells : must contain 1
 - #reset-cells : must contain 1
 
+Additional required properties for "allwinner,sun50i-a64-de2-clk" :
+- allwinner,sram: See Documentation/devicetree/bindings/sram/sunxi-sram.txt,
+ should be the SRAM C section on A64 SoC.
+
 Example:
 de2_clocks: clock@100 {
compatible = "allwinner,sun8i-h3-de2-clk";
-- 
2.13.6

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


[PATCH v2 05/10] ARM: sun8i: h3/h5: add DE2 CCU device node for H3

2017-10-30 Thread Icenowy Zheng
The DE2 in H3/H5 has a clock control unit in it, and the behavior is
slightly different between H3 and H5.

Add the common parts in H3/H5 DTSI, and add the compatible string in H3
DTSI.

The compatible string of H5 DE2 CCU will be added in a separated patch.

Signed-off-by: Icenowy Zheng 
---
Changes in v2:
- Use H3 DE2 CCU compatible as it's discovered that H3 and A83T DE2 CCU are
  not equal.

 arch/arm/boot/dts/sun8i-h3.dtsi|  4 
 arch/arm/boot/dts/sunxi-h3-h5.dtsi | 14 ++
 2 files changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
index b36f9f423c39..8495deecedad 100644
--- a/arch/arm/boot/dts/sun8i-h3.dtsi
+++ b/arch/arm/boot/dts/sun8i-h3.dtsi
@@ -85,6 +85,10 @@
compatible = "allwinner,sun8i-h3-ccu";
 };
 
+&display_clocks {
+   compatible = "allwinner,sun8i-h3-de2-clk";
+};
+
 &mmc0 {
compatible = "allwinner,sun7i-a20-mmc";
clocks = <&ccu CLK_BUS_MMC0>,
diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi 
b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
index d7a71e726a9f..367319d22116 100644
--- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi
+++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
@@ -40,9 +40,11 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -85,6 +87,18 @@
#size-cells = <1>;
ranges;
 
+   display_clocks: clock@100 {
+   /* compatible is in per SoC .dtsi file */
+   reg = <0x0100 0x10>;
+   clocks = <&ccu CLK_DE>,
+<&ccu CLK_BUS_DE>;
+   clock-names = "mod",
+ "bus";
+   resets = <&ccu RST_BUS_DE>;
+   #clock-cells = <1>;
+   #reset-cells = <1>;
+   };
+
syscon: syscon@1c0 {
compatible = "allwinner,sun8i-h3-system-controller",
"syscon";
-- 
2.13.6

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


[PATCH v2 1/3] drm/i915: Reject unknown syncobj flags

2017-10-30 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

We have to reject unknown flags for uAPI considerations, and also
because the curent implementation limits their i915 storage space
to two bits.

v2: (Chris Wilson)
 * Fix fail in ABI check.
 * Added unknown flags and BUILD_BUG_ON.

Signed-off-by: Tvrtko Ursulin 
Fixes: cf6e7bac6357 ("drm/i915: Add support for drm syncobjs")
Cc: Jason Ekstrand 
Cc: Chris Wilson 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: David Airlie 
Cc: intel-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 8 
 include/uapi/drm/i915_drm.h| 1 +
 2 files changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c 
b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 3d7190764f10..58e994c4b5c7 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -2100,6 +2100,11 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args,
goto err;
}
 
+   if (fence.flags & __I915_EXEC_FENCE_UNKNOWN_FLAGS) {
+   err = -EINVAL;
+   goto err;
+   }
+
syncobj = drm_syncobj_find(file, fence.handle);
if (!syncobj) {
DRM_DEBUG("Invalid syncobj handle provided\n");
@@ -2107,6 +2112,9 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args,
goto err;
}
 
+   BUILD_BUG_ON(~(__alignof__(void *) - 1) &
+~__I915_EXEC_FENCE_UNKNOWN_FLAGS);
+
fences[n] = ptr_pack_bits(syncobj, fence.flags, 2);
}
 
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 125bde7d9504..ac3c6503ca27 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -839,6 +839,7 @@ struct drm_i915_gem_exec_fence {
 
 #define I915_EXEC_FENCE_WAIT(1<<0)
 #define I915_EXEC_FENCE_SIGNAL  (1<<1)
+#define __I915_EXEC_FENCE_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SIGNAL << 1))
__u32 flags;
 };
 
-- 
2.9.5

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


[PATCH v2 07/10] ARM: sunxi: h3/h5: add simplefb nodes

2017-10-30 Thread Icenowy Zheng
The H3/H5 SoCs have a HDMI output and a TV Composite output.

Add simplefb nodes for these outputs.

Signed-off-by: Icenowy Zheng 
---
 arch/arm/boot/dts/sunxi-h3-h5.dtsi | 29 +
 1 file changed, 29 insertions(+)

diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi 
b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
index 367319d22116..2ce0c3bb9896 100644
--- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi
+++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
@@ -53,6 +53,35 @@
#address-cells = <1>;
#size-cells = <1>;
 
+   chosen {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+
+   framebuffer-hdmi {
+   compatible = "allwinner,simple-framebuffer",
+"simple-framebuffer";
+   allwinner,pipeline = "mixer0-lcd0-hdmi";
+   clocks = <&display_clocks CLK_BUS_MIXER0>,
+<&ccu CLK_BUS_TCON0>, <&ccu CLK_BUS_HDMI>,
+<&display_clocks CLK_MIXER0>,
+<&ccu CLK_TCON0>, <&ccu CLK_HDMI>,
+<&ccu CLK_HDMI_DDC>;
+   status = "disabled";
+   };
+
+   framebuffer-tve {
+   compatible = "allwinner,simple-framebuffer",
+"simple-framebuffer";
+   allwinner,pipeline = "mixer1-lcd1-tve";
+   clocks = <&display_clocks CLK_BUS_MIXER1>,
+<&ccu CLK_BUS_TCON1>, <&ccu CLK_BUS_TVE>,
+<&display_clocks CLK_MIXER1>,
+<&ccu CLK_TVE>;
+   status = "disabled";
+   };
+   };
+
clocks {
#address-cells = <1>;
#size-cells = <1>;
-- 
2.13.6

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


[PATCH v2 02/10] clk: sunxi-ng: add support for Allwinner H3 DE2 CCU

2017-10-30 Thread Icenowy Zheng
Allwinner H3 features a DE2 CCU like the one on A83T, however the
parent of the clocks is the DE module clock, not the PLL_DE clock.

Add support for it.

Signed-off-by: Icenowy Zheng 
---
 drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 47 
 1 file changed, 47 insertions(+)

diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c 
b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c
index 5cc9d9952121..2db5d4e00ea7 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c
@@ -41,6 +41,8 @@ static SUNXI_CCU_GATE(wb_clk, "wb",   
"wb-div",
 
 static SUNXI_CCU_M(mixer0_div_clk, "mixer0-div", "de", 0x0c, 0, 4,
   CLK_SET_RATE_PARENT);
+static SUNXI_CCU_M(mixer1_div_clk, "mixer1-div", "de", 0x0c, 4, 4,
+  CLK_SET_RATE_PARENT);
 static SUNXI_CCU_M(wb_div_clk, "wb-div", "de", 0x0c, 8, 4,
   CLK_SET_RATE_PARENT);
 
@@ -65,6 +67,20 @@ static struct ccu_common *sun8i_a83t_de2_clks[] = {
&wb_div_a83_clk.common,
 };
 
+static struct ccu_common *sun8i_h3_de2_clks[] = {
+   &mixer0_clk.common,
+   &mixer1_clk.common,
+   &wb_clk.common,
+
+   &bus_mixer0_clk.common,
+   &bus_mixer1_clk.common,
+   &bus_wb_clk.common,
+
+   &mixer0_div_clk.common,
+   &mixer1_div_clk.common,
+   &wb_div_clk.common,
+};
+
 static struct ccu_common *sun8i_v3s_de2_clks[] = {
&mixer0_clk.common,
&wb_clk.common,
@@ -93,6 +109,23 @@ static struct clk_hw_onecell_data sun8i_a83t_de2_hw_clks = {
.num= CLK_NUMBER,
 };
 
+static struct clk_hw_onecell_data sun8i_h3_de2_hw_clks = {
+   .hws= {
+   [CLK_MIXER0]= &mixer0_clk.common.hw,
+   [CLK_MIXER1]= &mixer1_clk.common.hw,
+   [CLK_WB]= &wb_clk.common.hw,
+
+   [CLK_BUS_MIXER0]= &bus_mixer0_clk.common.hw,
+   [CLK_BUS_MIXER1]= &bus_mixer1_clk.common.hw,
+   [CLK_BUS_WB]= &bus_wb_clk.common.hw,
+
+   [CLK_MIXER0_DIV]= &mixer0_div_clk.common.hw,
+   [CLK_MIXER1_DIV]= &mixer1_div_clk.common.hw,
+   [CLK_WB_DIV]= &wb_div_clk.common.hw,
+   },
+   .num= CLK_NUMBER,
+};
+
 static struct clk_hw_onecell_data sun8i_v3s_de2_hw_clks = {
.hws= {
[CLK_MIXER0]= &mixer0_clk.common.hw,
@@ -133,6 +166,16 @@ static const struct sunxi_ccu_desc sun8i_a83t_de2_clk_desc 
= {
.num_resets = ARRAY_SIZE(sun8i_a83t_de2_resets),
 };
 
+static const struct sunxi_ccu_desc sun8i_h3_de2_clk_desc = {
+   .ccu_clks   = sun8i_h3_de2_clks,
+   .num_ccu_clks   = ARRAY_SIZE(sun8i_h3_de2_clks),
+
+   .hw_clks= &sun8i_h3_de2_hw_clks,
+
+   .resets = sun8i_a83t_de2_resets,
+   .num_resets = ARRAY_SIZE(sun8i_a83t_de2_resets),
+};
+
 static const struct sunxi_ccu_desc sun50i_a64_de2_clk_desc = {
.ccu_clks   = sun8i_a83t_de2_clks,
.num_ccu_clks   = ARRAY_SIZE(sun8i_a83t_de2_clks),
@@ -238,6 +281,10 @@ static const struct of_device_id sunxi_de2_clk_ids[] = {
.data = &sun8i_a83t_de2_clk_desc,
},
{
+   .compatible = "allwinner,sun8i-h3-de2-clk",
+   .data = &sun8i_h3_de2_clk_desc,
+   },
+   {
.compatible = "allwinner,sun8i-v3s-de2-clk",
.data = &sun8i_v3s_de2_clk_desc,
},
-- 
2.13.6

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


Re: [PATCH] display: panel: Add Tianma tm070rvhg71 display support (800x480)

2017-10-30 Thread Lukasz Majewski
Hi Rob,

> On Sat, Oct 21, 2017 at 12:10:03AM +0200, Lukasz Majewski wrote:
> > Signed-off-by: Lukasz Majewski 
> > ---
> >  .../bindings/display/panel/tianma,tm070rvhg71.txt  |  7 ++
> >  drivers/gpu/drm/panel/panel-simple.c   | 27
> > ++ 2 files changed, 34 insertions(+)
> >  create mode 100644
> > Documentation/devicetree/bindings/display/panel/tianma,tm070rvhg71.txt
> > 
> > diff --git
> > a/Documentation/devicetree/bindings/display/panel/tianma,tm070rvhg71.txt
> > b/Documentation/devicetree/bindings/display/panel/tianma,tm070rvhg71.txt
> > new file mode 100644 index 000..b84217f --- /dev/null
> > +++
> > b/Documentation/devicetree/bindings/display/panel/tianma,tm070rvhg71.txt
> > @@ -0,0 +1,7 @@ +Tianma Micro-electronics TM070RVHG71 7.0" WXGA TFT
> > LCD panel +
> > +Required properties:
> > +- compatible: should be "tianma,tm070rvhg71
> > +
> > +This binding is compatible with the simple-panel binding, which is
> > specified +in simple-panel.txt in this directory.
> 
> No supplies? Still need to list power-supply here if so, so it is
> clear that this display has a single supply (or you need to list
> multiple ones if not).

I took the same approach as several other simple panels having
description in Documentation/devicetree/bindings/display/panel/*
directory (e.g. innolux,g121i1-l01.txt) .

In the description it is stated that this binding is compatible with
one documented in the simple-panel.txt, which defines following
properties:

Required properties:
- power-supply: regulator to provide the supply voltage

Optional properties:
- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
- enable-gpios: GPIO pin to enable or disable the panel
- backlight: phandle of the backlight device attached to the panel


Do I need to do something more?

> 
> Rob


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCHv1 00/14] omapdrm: DSI command mode panel support

2017-10-30 Thread Sebastian Reichel
Hi,

On Thu, Oct 26, 2017 at 02:59:10PM +0300, Tomi Valkeinen wrote:
> On 24/10/17 01:01, Sebastian Reichel wrote:
> > Hi,
> > 
> > On Fri, Oct 13, 2017 at 10:12:08AM -0700, Tony Lindgren wrote:
> >> * Tomi Valkeinen  [171012 01:46]:
> >>> On 29/09/17 16:26, Sebastian Reichel wrote:
>  Hi Tomi & Laurent,
> 
>  ping?
> >>>
> >>> I've been having quick glances at this every now and then, but I'm not
> >>> sure what to do with the series.
> >>>
> >>> We have one work item that more or less overrides everything but
> >>> critical fixes: moving to common DRM encoder/panel drivers. Anything
> >>> that makes that work more difficult should be postponed.
> >>>
> >>> Especially patch 6 in this series most likely falls into that category,
> >>> and might require a very different implementation with common DRM
> >>> drivers. Also everything in panel-dsi-cm needs to be ported to a common
> >>> DRM panel driver when can use them.
> >>>
> >>> So my gut feeling is that it's best to keep this out for now, and rework
> >>> it after Laurent gets the common DRM drivers working with omapdrm.
> >>
> >> Laurent, got any other comments?
> >>
> >> Maybe some of patches can be already applied to shrink down this
> >> set a bit?
> > 
> > I talked with Laurent at ELCE about this patchset and he is fine
> > with this series going in before his work assuming its fine
> > otherwise. He has not yet reviewed it, though and is busy the
> > next two weeks.
> > 
> > Regarding the panel-dsi-cm porting work: I will take care of this
> > once the driver uses common DRM drivers. I don't expect major
> > problems once omapdrm implements common drm's mipi_dsi_host. I
> > do use the standard DT properties already.
> > 
> > I do agree, that not applying this series makes Laurent's porting
> > work easier, since he can rip out all of DSI. It's not used by
> > anything except panel-dsi-cm, which is broken without this patchset.
> > I don't think that's a fair thing to do, though.
> > 
> > P.S.: I got asked by different people about the status of this
> > patchset, which is required for display support on N9, N950 and
> > Droid 4. It's not just me and Tony, that are interested in this :)
> 
> Ok. If you agree to help with the DSI part in the future, I have no
> problems applying these (after review and testing, of course).

Sure.

> My worry is not only with complicating Laurent's work towards common DRM
> drivers, but also with the maintenance burden this brings. Keeping DSI
> working in the future may be challenging due to the lack of users and
> (easy to use) boards. I do have a N950 and OMAP4 Blaze Tablet, though,
> so I'm able to test both command and video modes. But getting those boot
> up is not always trivial, especially for the blaze tablet.

I have N950, N9 and Droid 4 (omap4 based).
All of them have command mode panels.

> I've also spent many hours this year debugging obscure OMAP3 DSS HW
> issues, so my opinion about adding more OMAP3 DSS features may be a bit
> biased =).

This patchset is also for OMAP4 (Droid 4).

> I'll have a look at this series when I find a bit of spare time.

Thanks.

-- Sebastian


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


[PATCH v2 10/10] arm64: allwinner: a64: add simplefb for A64 SoC

2017-10-30 Thread Icenowy Zheng
The A64 SoC features two display pipelines, one has a LCD output, the
other has a HDMI output.

Add support for simplefb for these pipelines on A64 SoC.

Signed-off-by: Icenowy Zheng 
---
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi 
b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index 03a46da0f0fa..65ffd94441a1 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -42,9 +42,11 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 / {
@@ -52,6 +54,35 @@
#address-cells = <1>;
#size-cells = <1>;
 
+   chosen {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+
+   framebuffer-lcd {
+   compatible = "allwinner,simple-framebuffer",
+"simple-framebuffer";
+   allwinner,pipeline = "mixer0-lcd0";
+   clocks = <&display_clocks CLK_BUS_MIXER0>,
+<&ccu CLK_BUS_TCON0>, <&ccu CLK_BUS_TCON0>,
+<&display_clocks CLK_MIXER0>,
+<&ccu CLK_TCON0>;
+   status = "disabled";
+   };
+
+   framebuffer-hdmi {
+   compatible = "allwinner,simple-framebuffer",
+"simple-framebuffer";
+   allwinner,pipeline = "mixer1-lcd1-hdmi";
+   clocks = <&display_clocks CLK_BUS_MIXER1>,
+<&ccu CLK_BUS_TCON1>, <&ccu CLK_BUS_HDMI>,
+<&display_clocks CLK_MIXER1>,
+<&ccu CLK_TCON1>, <&ccu CLK_HDMI>,
+<&ccu CLK_HDMI_DDC>;
+   status = "disabled";
+   };
+   };
+
cpus {
#address-cells = <1>;
#size-cells = <0>;
-- 
2.13.6

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


[PATCH v2 09/10] arm64: allwinner: a64: add DE2 CCU for A64 SoC

2017-10-30 Thread Icenowy Zheng
The A64 SoC features a DE2 CCU like the one in H5, but needs to claim a
section of SRAM (SRAM C) to be accessed.

Adds the device tree nodes for the SRAM controller and the DE2 CCU.

Signed-off-by: Icenowy Zheng 
---
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 34 +++
 1 file changed, 34 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi 
b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index 062040ec2fed..03a46da0f0fa 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -130,6 +130,40 @@
#size-cells = <1>;
ranges;
 
+   display_clocks: clock@100 {
+   compatible = "allwinner,sun50i-a64-de2-clk";
+   reg = <0x0100 0x10>;
+   clocks = <&ccu CLK_DE>,
+<&ccu CLK_BUS_DE>;
+   clock-names = "mod",
+ "bus";
+   resets = <&ccu RST_BUS_DE>;
+   allwinner,sram = <&de2_sram>;
+   #clock-cells = <1>;
+   #reset-cells = <1>;
+   };
+
+   sram-controller@1c0 {
+   compatible = "allwinner,sun50i-a64-sram-controller";
+   reg = <0x01c0 0x1000>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+
+   sram_c: sram@18000 {
+   compatible = "mmio-sram";
+   reg = <0x00018000 0x28000>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges = <0 0x00018000 0x28000>;
+
+   de2_sram: sram-section@0 {
+   compatible = 
"allwinner,sun50i-a64-sram-c";
+   reg = <0x 0x28000>;
+   };
+   };
+   };
+
syscon: syscon@1c0 {
compatible = "allwinner,sun50i-a64-system-controller",
"syscon";
-- 
2.13.6

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


[PATCH v2 01/10] dt-bindings: fix the binding of Allwinner DE2 CCU of A83T and H3

2017-10-30 Thread Icenowy Zheng
The DE2 CCU is different on A83T and H3 -- the parent of the clocks on
A83T is PLL_DE but on H3 it's the DE module clock. This is not noticed
when I develop the DE2 CCU driver.

Fix the binding by using different compatibles for A83T and H3, adding
notes for the PLL_DE usage on A83T, and change the binding example's
compatible from A83T to H3 (as it specifies the DE module clock).

Fixes: ed74f8a8a679 ("dt-bindings: add binding for the Allwinner DE2 CCU")
Signed-off-by: Icenowy Zheng 
---
 Documentation/devicetree/bindings/clock/sun8i-de2.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/clock/sun8i-de2.txt 
b/Documentation/devicetree/bindings/clock/sun8i-de2.txt
index 631d27cd89d6..f2fa87c4765c 100644
--- a/Documentation/devicetree/bindings/clock/sun8i-de2.txt
+++ b/Documentation/devicetree/bindings/clock/sun8i-de2.txt
@@ -4,13 +4,14 @@ Allwinner Display Engine 2.0 Clock Control Binding
 Required properties :
 - compatible: must contain one of the following compatibles:
- "allwinner,sun8i-a83t-de2-clk"
+   - "allwinner,sun8i-h3-de2-clk"
- "allwinner,sun8i-v3s-de2-clk"
- "allwinner,sun50i-h5-de2-clk"
 
 - reg: Must contain the registers base address and length
 - clocks: phandle to the clocks feeding the display engine subsystem.
  Three are needed:
-  - "mod": the display engine module clock
+  - "mod": the display engine module clock (on A83T it's the DE PLL)
   - "bus": the bus clock for the whole display engine subsystem
 - clock-names: Must contain the clock names described just above
 - resets: phandle to the reset control for the display engine subsystem.
@@ -19,7 +20,7 @@ Required properties :
 
 Example:
 de2_clocks: clock@100 {
-   compatible = "allwinner,sun8i-a83t-de2-clk";
+   compatible = "allwinner,sun8i-h3-de2-clk";
reg = <0x0100 0x10>;
clocks = <&ccu CLK_BUS_DE>,
 <&ccu CLK_DE>;
-- 
2.13.6

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


gma500: mmu: unmap the correct address

2017-10-30 Thread Pan Bian
The function kunmap_atomatic() is called on the same variable twice,
i.e. pt->v. In the second call, its parameter should be variable v
rather than pt->v.

Signed-off-by: Pan Bian 
---
 drivers/gpu/drm/gma500/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/gma500/mmu.c b/drivers/gpu/drm/gma500/mmu.c
index 0eaf11c..ccb161c 100644
--- a/drivers/gpu/drm/gma500/mmu.c
+++ b/drivers/gpu/drm/gma500/mmu.c
@@ -395,7 +395,7 @@ static void psb_mmu_pt_unmap_unlock(struct psb_mmu_pt *pt)
psb_mmu_clflush(pd->driver, (void *)&v[pt->index]);
atomic_set(&pd->driver->needs_tlbflush, 1);
}
-   kunmap_atomic(pt->v);
+   kunmap_atomic(v);
spin_unlock(&pd->driver->lock);
psb_mmu_free_pt(pt);
return;
-- 
1.9.1


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


[PATCH v2 03/10] clk: sunxi-ng: fix the A64/H5 clock description of DE2 CCU

2017-10-30 Thread Icenowy Zheng
The clocks of A64/H5 SoCs in the DE2 CCU is the same as the clocks in H3
DE2 CCU rather than the A83T DE2 CCU (the parent of them is the DE
module clock).

Fix this by change the clock descriptions to use the clocks of H3.

Fixes: 763c5bd045b1 ("clk: sunxi-ng: add support for DE2 CCU")
Signed-off-by: Icenowy Zheng 
---
 drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c 
b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c
index 2db5d4e00ea7..468d1abaf0ee 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c
@@ -177,10 +177,10 @@ static const struct sunxi_ccu_desc sun8i_h3_de2_clk_desc 
= {
 };
 
 static const struct sunxi_ccu_desc sun50i_a64_de2_clk_desc = {
-   .ccu_clks   = sun8i_a83t_de2_clks,
-   .num_ccu_clks   = ARRAY_SIZE(sun8i_a83t_de2_clks),
+   .ccu_clks   = sun8i_h3_de2_clks,
+   .num_ccu_clks   = ARRAY_SIZE(sun8i_h3_de2_clks),
 
-   .hw_clks= &sun8i_a83t_de2_hw_clks,
+   .hw_clks= &sun8i_h3_de2_hw_clks,
 
.resets = sun50i_a64_de2_resets,
.num_resets = ARRAY_SIZE(sun50i_a64_de2_resets),
-- 
2.13.6

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


[PATCH v2 04/10] dt-bindings: simplefb-sunxi: add pipelines for DE2

2017-10-30 Thread Icenowy Zheng
As we're going to add simplefb support for Allwinner SoCs with DE2, add
suitable pipeline strings in the device tree binding.

Acked-by: Rob Herring 
Signed-off-by: Icenowy Zheng 
---
Changes in v2:
- Adds Rob's ACK.

 .../devicetree/bindings/display/simple-framebuffer-sunxi.txt  | 4 
 1 file changed, 4 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/display/simple-framebuffer-sunxi.txt 
b/Documentation/devicetree/bindings/display/simple-framebuffer-sunxi.txt
index a9168ae6946c..d693b8dc9a62 100644
--- a/Documentation/devicetree/bindings/display/simple-framebuffer-sunxi.txt
+++ b/Documentation/devicetree/bindings/display/simple-framebuffer-sunxi.txt
@@ -15,6 +15,10 @@ Required properties:
   "de_be1-lcd1"
   "de_be0-lcd0-hdmi"
   "de_be1-lcd1-hdmi"
+  "mixer0-lcd0"
+  "mixer0-lcd0-hdmi"
+  "mixer1-lcd1-hdmi"
+  "mixer1-lcd1-tve"
 
 Example:
 
-- 
2.13.6

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


[PATCH v2 06/10] arm64: allwinner: h5: add compatible string for DE2 CCU

2017-10-30 Thread Icenowy Zheng
The DE2 CCU on Allwinner H5 SoC has a slightly different behavior than
the one on H3, so the compatible string is not set in the common DTSI
file.

Add the compatible string of H5 DE2 CCU in H5 DTSI file.

Signed-off-by: Icenowy Zheng 
---
 arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi 
b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
index d9a720bff05d..e237c05cfdb4 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
@@ -98,6 +98,10 @@
compatible = "allwinner,sun50i-h5-ccu";
 };
 
+&display_clocks {
+   compatible = "allwinner,sun50i-h5-de2-clk";
+};
+
 &mmc0 {
compatible = "allwinner,sun50i-h5-mmc",
 "allwinner,sun50i-a64-mmc";
-- 
2.13.6

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


[PATCH 1/3] drm/i915: Reject unknown syncobj flags

2017-10-30 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

We have to reject unknown flags for uAPI considerations, and also
because the curent implementation limits their i915 storage space
to two bits.

Signed-off-by: Tvrtko Ursulin 
Fixes: cf6e7bac6357 ("drm/i915: Add support for drm syncobjs")
Cc: Jason Ekstrand 
Cc: Chris Wilson 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: David Airlie 
Cc: intel-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c 
b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 3d7190764f10..3bc723ed6e2f 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -2100,6 +2100,11 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args,
goto err;
}
 
+   if (fence.flags & ~((typeof(fence.flags))2)) {
+   err = -EINVAL;
+   goto err;
+   }
+
syncobj = drm_syncobj_find(file, fence.handle);
if (!syncobj) {
DRM_DEBUG("Invalid syncobj handle provided\n");
-- 
2.9.5

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


[PATCH v2 00/10] Allwinner H3/H5/A64(DE2) SimpleFB support

2017-10-30 Thread Icenowy Zheng
This patchset adds support for the SimpleFB on Allwinner SoCs with
"Display Engine 2.0".

PATCH 1 to PATCH 3 are DE2 CCU fixes for H3/H5 SoCs.

PATCH 4 adds the pipeline strings for DE2 SimpleFB.

PATCH 5 to 7 adds necessary device tree nodes (DE2 CCU and SimpleFB)
for H3/H5 SoCs.

PATCH 8 to 10 are for Allwinner A64 SoC to enable SimpleFB.

Icenowy Zheng (10):
  dt-bindings: fix the binding of Allwinner DE2 CCU of A83T and H3
  clk: sunxi-ng: add support for Allwinner H3 DE2 CCU
  clk: sunxi-ng: fix the A64/H5 clock description of DE2 CCU
  dt-bindings: simplefb-sunxi: add pipelines for DE2
  ARM: sun8i: h3/h5: add DE2 CCU device node for H3
  arm64: allwinner: h5: add compatible string for DE2 CCU
  ARM: sunxi: h3/h5: add simplefb nodes
  dt-bindings: add binding for A64 DE2 CCU SRAM
  arm64: allwinner: a64: add DE2 CCU for A64 SoC
  arm64: allwinner: a64: add simplefb for A64 SoC

 .../devicetree/bindings/clock/sun8i-de2.txt| 10 +++-
 .../bindings/display/simple-framebuffer-sunxi.txt  |  4 ++
 arch/arm/boot/dts/sun8i-h3.dtsi|  4 ++
 arch/arm/boot/dts/sunxi-h3-h5.dtsi | 43 ++
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi  | 65 ++
 arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi   |  4 ++
 drivers/clk/sunxi-ng/ccu-sun8i-de2.c   | 53 +-
 7 files changed, 178 insertions(+), 5 deletions(-)

-- 
2.13.6

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


Re: [PATCH] drm/vblank: Tune drm_crtc_accurate_vblank_count() WARN down to a debug

2017-10-30 Thread Daniel Vetter
On Tue, Oct 24, 2017 at 11:01:32AM +0200, Benjamin Gaignard wrote:
> 2017-10-23 17:25 GMT+02:00 Ville Syrjala :
> > From: Ville Syrjälä 
> >
> > Since commit 632c6e4edef1 ("drm/vblank: Fix flip event vblank count")
> > even drivers that don't implement accurate vblank timestamps will end
> > up using drm_crtc_accurate_vblank_count(). That leads to a WARN every
> > time drm_crtc_arm_vblank_event() gets called. The could be as often
> > as every frame for each active crtc.
> >
> > Considering drm_crtc_accurate_vblank_count() is never any worse than
> > the drm_vblank_count() we used previously, let's just skip the WARN
> > unless DRM_UT_VBL is enabled. That way people won't be bothered by
> > this unless they're debugging vblank code. And let's also change it
> > to WARN_ONCE() so that even when you're debugging vblank code you
> > won't get drowned by constant WARNs.
> >
> > Cc: sta...@vger.kernel.org
> > Cc: Daniel Vetter 
> > Cc: "Szyprowski, Marek" 
> > Cc: Andrzej Hajda 
> > Reported-by: Andrzej Hajda 
> > Fixes: 632c6e4edef1 ("drm/vblank: Fix flip event vblank count")
> > Signed-off-by: Ville Syrjälä 
> 
> I have tested it on sti and stm driver, it fix the problem, thanks.
> 
> Acked-by: Benjamin Gaignard 
> 
> > ---
> >  drivers/gpu/drm/drm_vblank.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> > index 13722c373a6a..c81c297995c6 100644
> > --- a/drivers/gpu/drm/drm_vblank.c
> > +++ b/drivers/gpu/drm/drm_vblank.c
> > @@ -299,8 +299,8 @@ u32 drm_crtc_accurate_vblank_count(struct drm_crtc 
> > *crtc)
> > u32 vblank;
> > unsigned long flags;
> >
> > -   WARN(!dev->driver->get_vblank_timestamp,
> > -"This function requires support for accurate vblank 
> > timestamps.");
> > +   WARN_ONCE(drm_debug & DRM_UT_VBL && 
> > !dev->driver->get_vblank_timestamp,
> > + "This function requires support for accurate vblank 
> > timestamps.");

Somewhat a bikeshed, but if we e.g. enable debugging in a CI or piglit
run, then this could change the results. I'd go with a if ()
DRM_DEBUG_VBLANK. Either way:

Reviewed-by: Daniel Vetter 

> >
> > spin_lock_irqsave(&dev->vblank_time_lock, flags);
> >
> > --
> > 2.13.6
> >
> > ___
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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


Re: [PATCH 02/15] drm: Add drm_device->drm_fb_helper_private pointer

2017-10-30 Thread Daniel Vetter
On Fri, Oct 20, 2017 at 07:11:18PM +0200, Noralf Trønnes wrote:
> 
> Den 20.10.2017 18.00, skrev Ville Syrjälä:
> > On Fri, Oct 20, 2017 at 05:44:15PM +0200, Noralf Trønnes wrote:
> > > Den 20.10.2017 15.52, skrev Ville Syrjälä:
> > > > On Fri, Oct 20, 2017 at 01:02:00AM +0200, Noralf Trønnes wrote:
> > > > > drm_fb_helper is *the* way of doing fbdev emulation so add a pointer 
> > > > > to
> > > > > struct drm_device. This makes it possible to add callback helpers for
> > > > > .last_close and .output_poll_changed further reducing fbdev emulation
> > > > > footprint in drivers. The pointer is set by drm_fb_helper_init() and
> > > > > cleared by drm_fb_helper_fini().
> > > > > 
> > > > > Signed-off-by: Noralf Trønnes 
> > > > > ---
> > > > > 
> > > > > This patch was initially part of the patchset: drm/tinydrm: Use 
> > > > > vmalloc BO
> > > > > Changes since previous version:
> > > > > - Change member name: fbdev -> drm_fb_helper_private
> > > > > - Expand docs
> > > > > - Set and clear pointer in drm_fb_helper_init/fini()
> > > > > 
> > > > >drivers/gpu/drm/drm_fb_helper.c | 13 +++--
> > > > >include/drm/drm_device.h|  9 +
> > > > >2 files changed, 20 insertions(+), 2 deletions(-)
> > > > > 
> > > > > diff --git a/drivers/gpu/drm/drm_fb_helper.c 
> > > > > b/drivers/gpu/drm/drm_fb_helper.c
> > > > > index 954cdd48de92..c07b7af8de4c 100644
> > > > > --- a/drivers/gpu/drm/drm_fb_helper.c
> > > > > +++ b/drivers/gpu/drm/drm_fb_helper.c
> > > > > @@ -799,8 +799,10 @@ int drm_fb_helper_init(struct drm_device *dev,
> > > > >   struct drm_mode_config *config = &dev->mode_config;
> > > > >   int i;
> > > > > - if (!drm_fbdev_emulation)
> > > > > + if (!drm_fbdev_emulation) {
> > > > > + dev->drm_fb_helper_private = fb_helper;
> > > > >   return 0;
> > > > > + }
> > > > >   if (!max_conn_count)
> > > > >   return -EINVAL;
> > > > > @@ -835,6 +837,8 @@ int drm_fb_helper_init(struct drm_device *dev,
> > > > >   i++;
> > > > >   }
> > > > > + dev->drm_fb_helper_private = fb_helper;
> > > > > +
> > > > >   return 0;
> > > > >out_free:
> > > > >   drm_fb_helper_crtc_free(fb_helper);
> > > > > @@ -913,7 +917,12 @@ void drm_fb_helper_fini(struct drm_fb_helper 
> > > > > *fb_helper)
> > > > >{
> > > > >   struct fb_info *info;
> > > > > - if (!drm_fbdev_emulation || !fb_helper)
> > > > > + if (!fb_helper)
> > > > > + return;
> > > > > +
> > > > > + fb_helper->dev->drm_fb_helper_private = NULL;
> > > > > +
> > > > > + if (!drm_fbdev_emulation)
> > > > >   return;
> > > > >   cancel_work_sync(&fb_helper->resume_work);
> > > > > diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
> > > > > index e21af87a2f3c..6b26262658ae 100644
> > > > > --- a/include/drm/drm_device.h
> > > > > +++ b/include/drm/drm_device.h
> > > > > @@ -17,6 +17,7 @@ struct drm_vblank_crtc;
> > > > >struct drm_sg_mem;
> > > > >struct drm_local_map;
> > > > >struct drm_vma_offset_manager;
> > > > > +struct drm_fb_helper;
> > > > >struct inode;
> > > > > @@ -185,6 +186,14 @@ struct drm_device {
> > > > >   struct drm_vma_offset_manager *vma_offset_manager;
> > > > >   /*@} */
> > > > >   int switch_power_state;
> > > > > +
> > > > > + /**
> > > > > +  * @drm_fb_helper_private:
> > > > > +  *
> > > > > +  * Pointer to the fbdev emulation structure.
> > > > > +  * Set by drm_fb_helper_init() and cleared by 
> > > > > drm_fb_helper_fini().
> > > > > +  */
> > > > > + struct drm_fb_helper *drm_fb_helper_private;
> > > > Just 'fb_helper' maybe? Not sure what the _private here is supposed to
> > > > mean, and drm_ seems very much redundant.
> > > I first called it fbdev, Daniel suggested fbdev_helper_private, then I
> > > took it all the way and called it drm_fb_helper_private. I believe the
> > > _private part is an indication that this is not part of the core, but a
> > > helper, like drm_plane->helper_private.
> > IMO those we should rename to helper_funcs since that's what they always
> > are. IIRC they used to be void* and then the _private made more sense to
> > me since you couldn't directly know what they were pointing at.
> > 
> > To me _private means that it's totally up to driver to specify what to
> > put there (eg. like we have private_flags in the mode structure).
> > 
> > And I believe the "helper" part in "fb_helper" should be enough of a hint
> > to anyone that this has something to do with a helper ;)
> 
> Daniel, do you have any objections to calling it: fb_helper?

I retract my bikeshed, looks like you&Ville are much more informed :-)
-Daniel

> 
> Noralf.
> 
> > > fb_helper is the common variable name used in drm_fb_helper (which
> > > really should have been called drm_fbdev_helper imo).
> > Yeah. On a first glance one might think drm_fb_helper has something
> > to do with drm_framebuffers.
> > 

Re: RFC: Add drm_dev_suspend/resume() ?

2017-10-30 Thread Daniel Vetter
Hi Noralf,

On Sun, Oct 22, 2017 at 06:52:41PM +0200, Noralf Trønnes wrote:
> Hi,
> 
> I've spent some time in the fbdev emulation code and discovered a
> recurring pattern around suspend/resume.
> Should we add some more helpers :-)

You're maybe a bit too good at spotting these for your own good :-)

But yeah, a "suspend for dummies" is one of the things which would be nice
I think ... Especially since we now have the atomic suspend/resume
helpers.

> struct drm_device {
>     /**
>      * @suspend_state:
>      *
>      * Atomic state when suspended.
>      * Set by drm_dev_suspend(), cleared by drm_dev_resume().
>      */
>     struct drm_atomic_state *suspend_state;
> };

Imo fits better when we put it into drm_mode_config.

> int drm_dev_suspend(struct drm_device *dev)
> {
>     struct drm_atomic_state *state;
> 
>     if (!dev)
>         return 0;
> 
>     drm_kms_helper_poll_disable(dev);
>     drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 1);
>     state = drm_atomic_helper_suspend(dev);
>     if (IS_ERR(state)) {
>         drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0);
>         drm_kms_helper_poll_enable(dev);
>         return PTR_ERR(state);
>     }
> 
>     dev->suspend_state = state;
> 
>     return 0;
> }

This is all about suspending the modeset side ... I'd give it a
drm_mode_config prefix instead of the drm_dev_ (that's maybe a bit too
generic), but then maybe type a general suspend/resume kernel-doc text in
the drm-internals.rst (maybe pulled in from drm_dev.c) which references
these 2 functions as the recommended way to suspend/resume the modeset
side of a driver. These won't suspend/resume a render part (if present),
so drm_dev_ seems a bit too much.

> int drm_dev_resume(struct drm_device *dev)
> {
>     int ret;
> 
>     if (!dev || WARN_ON(!dev->suspend_state))
>         return 0;
> 
>     ret = drm_atomic_helper_resume(dev, dev->suspend_state);
>     if (ret)
>         DRM_ERROR("Failed to resume (%d)\n", ret);
>     dev->suspend_state = NULL;
> 
>     drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0);
>     drm_kms_helper_poll_enable(dev);
> 
>     return 0;
> }
> 
> The drm_kms_helper_poll_enable() docs states that it's not allowed to
> call this function if polling support has been set up, but the code
> allows it. drm_kms_helper_poll_disable() docs states that it's ok to
> call it even if polling is not enabled.

Yeah need to fix that, but need to keep a note that if you want polling,
then you need to follow that order or it goes wrong. Perhaps explain that
this is meant to avoid special-cases in suspend/resume code?

> Here are the suspend/resume code from the drivers that use
> drm_atomic_helper_suspend/resume():

Yeah, looks like a really good idea.

Thanks, Daniel
> 
> static int __maybe_unused hdlcd_pm_suspend(struct device *dev)
> {
>     struct drm_device *drm = dev_get_drvdata(dev);
>     struct hdlcd_drm_private *hdlcd = drm ? drm->dev_private : NULL;
> 
>     if (!hdlcd)
>         return 0;
> 
>     drm_kms_helper_poll_disable(drm);
> 
>     hdlcd->state = drm_atomic_helper_suspend(drm);
>     if (IS_ERR(hdlcd->state)) {
>         drm_kms_helper_poll_enable(drm);
>         return PTR_ERR(hdlcd->state);
>     }
> 
>     return 0;
> }
> 
> static int __maybe_unused hdlcd_pm_resume(struct device *dev)
> {
>     struct drm_device *drm = dev_get_drvdata(dev);
>     struct hdlcd_drm_private *hdlcd = drm ? drm->dev_private : NULL;
> 
>     if (!hdlcd)
>         return 0;
> 
>     drm_atomic_helper_resume(drm, hdlcd->state);
>     drm_kms_helper_poll_enable(drm);
>     pm_runtime_set_active(dev);
> 
>     return 0;
> }
> 
> 
> static int __maybe_unused malidp_pm_suspend(struct device *dev)
> {
>     struct drm_device *drm = dev_get_drvdata(dev);
>     struct malidp_drm *malidp = drm->dev_private;
> 
>     drm_kms_helper_poll_disable(drm);
>     console_lock();
>     drm_fbdev_cma_set_suspend(malidp->fbdev, 1);
>     console_unlock();
>     malidp->pm_state = drm_atomic_helper_suspend(drm);
>     if (IS_ERR(malidp->pm_state)) {
>         console_lock();
>         drm_fbdev_cma_set_suspend(malidp->fbdev, 0);
>         console_unlock();
>         drm_kms_helper_poll_enable(drm);
>         return PTR_ERR(malidp->pm_state);
>     }
> 
>     return 0;
> }
> 
> static int __maybe_unused malidp_pm_resume(struct device *dev)
> {
>     struct drm_device *drm = dev_get_drvdata(dev);
>     struct malidp_drm *malidp = drm->dev_private;
> 
>     drm_atomic_helper_resume(drm, malidp->pm_state);
>     console_lock();
>     drm_fbdev_cma_set_suspend(malidp->fbdev, 0);
>     console_unlock();
>     drm_kms_helper_poll_enable(drm);
> 
>     return 0;
> }
> 
> 
> static int atmel_hlcdc_dc_drm_suspend(struct device *dev)
> {
>     struct drm_device *drm_dev = dev_get_drvdata(dev);
>     struct atmel_hlcdc_dc *dc = drm_dev->dev_private;
>     struct regmap *regmap = dc->hlcdc->regmap;
>     struct drm_atomic_state *state;
> 
>     state = drm_atomic_helper_suspend(drm_dev);
>     

Re: [Intel-gfx] [PATCH v3 2/7] drm: Add panel orientation quirks

2017-10-30 Thread Daniel Vetter
On Mon, Oct 23, 2017 at 09:14:20AM +0200, Hans de Goede wrote:
> Some x86 clamshell design devices use portrait tablet screens and a display
> engine which cannot rotate in hardware, so the firmware just leaves things
> as is and we cannot figure out that the display is oriented non upright
> from the hardware.
> 
> So at least on x86, we need a quirk table for this. This commit adds a DMI
> based quirk table which is initially populated with 5 such devices: Asus
> T100HA, GPD Pocket, GPD win, I.T.Works TW891 and the VIOS LTH17.
> 
> This quirk table will be used by the drm code to let userspace know that
> the display is not mounted upright inside the device's case through a new
> panel orientation drm-connector property, as well as to tell fbcon to
> rotate the console so that it shows the right way up.
> 
> Signed-off-by: Hans de Goede 

Found a few organizational bikesheds below, but makes sense I think.

> ---
>  drivers/gpu/drm/Kconfig|   3 +
>  drivers/gpu/drm/Makefile   |   1 +
>  drivers/gpu/drm/drm_panel_orientation_quirks.c | 157 
> +
>  include/drm/drm_utils.h|  18 +++
>  4 files changed, 179 insertions(+)
>  create mode 100644 drivers/gpu/drm/drm_panel_orientation_quirks.c
>  create mode 100644 include/drm/drm_utils.h
> 
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 4d9f21831741..9d005ac98c2b 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -26,6 +26,9 @@ config DRM_MIPI_DSI
>   bool
>   depends on DRM
>  
> +config DRM_PANEL_ORIENTATION_QUIRKS
> + tristate

Why a config option? We don't make the edid quirks optional either ...

> +
>  config DRM_DP_AUX_CHARDEV
>   bool "DRM DP AUX Interface"
>   depends on DRM
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index a3fdc5a68dff..ffb621819bbf 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -46,6 +46,7 @@ obj-$(CONFIG_DRM_DEBUG_MM_SELFTEST) += selftests/
>  
>  obj-$(CONFIG_DRM)+= drm.o
>  obj-$(CONFIG_DRM_MIPI_DSI) += drm_mipi_dsi.o
> +obj-$(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS) += drm_panel_orientation_quirks.o

Since it's a kms thing, probably should be added to the drm_kms_helper.ko
module. There's panles/bridges which also should be there but aren't, but
those aren't the best examples.

>  obj-$(CONFIG_DRM_ARM)+= arm/
>  obj-$(CONFIG_DRM_TTM)+= ttm/
>  obj-$(CONFIG_DRM_TDFX)   += tdfx/
> diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c 
> b/drivers/gpu/drm/drm_panel_orientation_quirks.c
> new file mode 100644
> index ..cea4d71f4978
> --- /dev/null
> +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c
> @@ -0,0 +1,157 @@
> +/*
> + *  drm_panel_orientation_quirks.c -- Quirks for non-normal panel orientation
> + *
> + *   Copyright (C) 2017 Hans de Goede 
> + *
> + *  This file is subject to the terms and conditions of the GNU General 
> Public
> + *  License.  See the file COPYING in the main directory of this archive for
> + *  more details.
> + */
> +
> +#include 
> +#include 
> +
> +#ifdef CONFIG_DMI
> +
> +/*
> + * Some x86 clamshell design devices use portrait tablet screens and a 
> display
> + * engine which cannot rotate in hardware, so we need to rotate the fbcon to
> + * compensate. Unfortunately these (cheap) devices also typically have quite
> + * generic DMI data, so we match on a combination of DMI data, screen 
> resolution
> + * and a list of known BIOS dates to avoid false positives.
> + */
> +
> +struct drm_dmi_panel_orientation_data {
> + int width;
> + int height;
> + const char * const *bios_dates;
> + int orientation;
> +};
> +
> +static const struct drm_dmi_panel_orientation_data asus_t100ha = {
> + .width = 800,
> + .height = 1280,
> + .orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP,
> +};
> +
> +static const struct drm_dmi_panel_orientation_data gpd_pocket = {
> + .width = 1200,
> + .height = 1920,
> + .bios_dates = (const char * const []){ "05/26/2017", "06/28/2017",
> + "07/05/2017", "08/07/2017", NULL },
> + .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
> +};
> +
> +static const struct drm_dmi_panel_orientation_data gpd_win = {
> + .width = 720,
> + .height = 1280,
> + .bios_dates = (const char * const []){
> + "10/25/2016", "11/18/2016", "12/23/2016", "12/26/2016",
> + "02/21/2017", "03/20/2017", "05/25/2017", NULL },
> + .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
> +};
> +
> +static const struct drm_dmi_panel_orientation_data itworks_tw891 = {
> + .width = 800,
> + .height = 1280,
> + .bios_dates = (const char * const []){ "10/16/2015", NULL },
> + .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
> +};
> +
> +static const struct drm_dmi_panel_orientation_data vios_lth17 = {
> + .width = 800,
> + .height = 1280,
> +   

[Bug 91666] build fail with cunit - OK on amd64 - KO for i386

2017-10-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=91666

--- Comment #3 from Michel Dänzer  ---
(In reply to network723 from comment #2)
> Same error while 32-bit build with git master commit
> 33dcc29f7ccc554de1fc42f4b95adf056822eabb:

It's not exactly the same, so it would have been better to file your own report
than to reopen this one.

Please attach your corresponding config.h and config.log files.

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


Re: [Intel-gfx] [PATCH v3 3/7] drm: Add support for a panel-orientation connector property

2017-10-30 Thread Daniel Vetter
On Mon, Oct 23, 2017 at 09:14:21AM +0200, Hans de Goede wrote:
> On some devices the LCD panel is mounted in the casing in such a way that
> the up/top side of the panel does not match with the top side of the
> device (e.g. it is mounted upside-down).
> 
> This commit adds the necessary infra for lcd-panel drm_connector-s to
> have a "panel orientation" property to communicate how the panel is
> orientated vs the casing.
> 
> Userspace can use this property to check for non-normal orientation and
> then adjust the displayed image accordingly by rotating it to compensate.
> 
> Signed-off-by: Hans de Goede 
> ---
> Changes in v2:
> -Rebased on 4.14-rc1
> -Store panel_orientation in drm_display_info, so that drm_fb_helper.c can
>  access it easily
> -Have a single drm_connector_init_panel_orientation_property rather then
>  create and attach functions. The caller is expected to set
>  drm_display_info.panel_orientation before calling this, then this will
>  check for platform specific quirks overriding the panel_orientation and if
>  the panel_orientation is set after this then it will attach the property.
> ---
>  drivers/gpu/drm/Kconfig |  1 +
>  drivers/gpu/drm/drm_connector.c | 73 
> +
>  include/drm/drm_connector.h | 11 +++
>  include/drm/drm_mode_config.h   |  7 
>  include/uapi/drm/drm_mode.h |  7 
>  5 files changed, 99 insertions(+)
> 
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 9d005ac98c2b..0b166e626eb6 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -7,6 +7,7 @@
>  menuconfig DRM
>   tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI 
> support)"
>   depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
> + select DRM_PANEL_ORIENTATION_QUIRKS
>   select HDMI
>   select FB_CMDLINE
>   select I2C
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 704fc8934616..129c83a84320 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -24,6 +24,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include "drm_crtc_internal.h"
>  #include "drm_internal.h"
> @@ -212,6 +213,8 @@ int drm_connector_init(struct drm_device *dev,
>   mutex_init(&connector->mutex);
>   connector->edid_blob_ptr = NULL;
>   connector->status = connector_status_unknown;
> + connector->display_info.panel_orientation =
> + DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
>  
>   drm_connector_get_cmdline_mode(connector);
>  
> @@ -664,6 +667,13 @@ static const struct drm_prop_enum_list 
> drm_aspect_ratio_enum_list[] = {
>   { DRM_MODE_PICTURE_ASPECT_16_9, "16:9" },
>  };
>  
> +static const struct drm_prop_enum_list drm_panel_orientation_enum_list[] = {
> + { DRM_MODE_PANEL_ORIENTATION_NORMAL,"Normal"},
> + { DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP, "Upside Down"   },
> + { DRM_MODE_PANEL_ORIENTATION_LEFT_UP,   "Left Side Up"  },
> + { DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,  "Right Side Up" },
> +};
> +
>  static const struct drm_prop_enum_list drm_dvi_i_select_enum_list[] = {
>   { DRM_MODE_SUBCONNECTOR_Automatic, "Automatic" }, /* DVI-I and TV-out */
>   { DRM_MODE_SUBCONNECTOR_DVID,  "DVI-D" }, /* DVI-I  */
> @@ -768,6 +778,18 @@ DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name,
>   *
>   * CRTC_ID:
>   *   Mode object ID of the &drm_crtc this connector should be connected to.
> + *
> + * Connectors for LCD panels may also have one standardized property:
> + *
> + * panel orientation:
> + *   On some devices the LCD panel is mounted in the casing in such a way
> + *   that the up/top side of the panel does not match with the top side of
> + *   the device. Userspace can use this property to check for this.
> + *   Note that input coordinates from touchscreens (input devices with
> + *   INPUT_PROP_DIRECT) will still map 1:1 to the actual LCD panel
> + *   coordinates, so if userspace rotates the picture to adjust for
> + *   the orientation it must also apply the same transformation to the
> + *   touchscreen input coordinates.
>   */
>  
>  int drm_connector_create_standard_properties(struct drm_device *dev)
> @@ -1234,6 +1256,57 @@ void 
> drm_mode_connector_set_link_status_property(struct drm_connector *connector
>  }
>  EXPORT_SYMBOL(drm_mode_connector_set_link_status_property);
>  
> +/**
> + * drm_connector_init_panel_orientation_property -
> + *   initialize the connecters panel_orientation property
> + * @connector: connector for which to init the panel-orientation property.
> + * @width: width in pixels of the panel, used for panel quirk detection
> + * @height: height in pixels of the panel, used for panel quirk detection
> + *
> + * This function should only be called for built-in panels, after setting
> + * connector->display_info.panel_orientation first (if known).
> + *
> + * This function will check for platfor

Re: [PATCH 1/2] drm/rcar-du: Use common error handling code in rcar_du_encoders_init()

2017-10-30 Thread Jani Nikula
On Sun, 29 Oct 2017, Laurent Pinchart  wrote:
> Hi Jani,
>
> On Friday, 27 October 2017 21:45:17 EET Jani Nikula wrote:
>> On Tue, 24 Oct 2017, SF Markus Elfring wrote:
>> > Add a jump target so that a bit of exception handling can be better reused
>> > at the end of this function.
>> > 
>> > This issue was detected by using the Coccinelle software.
>> 
>> Please also look into the GCC software, which will detect that your
>> patch does not compile.
>
> Just for the record, I've been bitten in the past by applying one of Markus' 
> patches that seemed to make sense, only to discover later that it introduced 
> a 
> security hole. I now drop his patches altogether, so could you please keep an 
> eye open to make sure none of them touching the rcar-du driver will be 
> applied 
> through drm-misc ?

Ack. You're the maintainer, and we need to respect that.

In general, I'll pick up any patches that are good, but the current
track record is that Markus' patches need extra scrutiny, and many of
the patches contain subjective changes that lead to debate that is not
constructive. There's no return on investment here.

BR,
Jani.

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


Re: [Intel-gfx] [PATCH v3 4/7] drm/fb-helper: Apply panel orientation connector prop to the primary plane

2017-10-30 Thread Daniel Vetter
On Mon, Oct 23, 2017 at 09:14:22AM +0200, Hans de Goede wrote:
> Apply the "panel orientation" drm connector prop to the primary plane so
> that fbcon and fbdev using userspace programs display the right way up.
> 
> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=94894
> Signed-off-by: Hans de Goede 
> ---
> Changes in v2:
> -New patch in v2 of this patch-set
> 
> Changes in v3:
> -Use a rotation member in struct drm_fb_helper_crtc and set that from
>  drm_setup_crtcs instead of looping over all crtc's to find the right one
>  later
> -Since we now no longer look at rotation quirks directly in the fbcon code,
>  set fb_info.fbcon_rotate_hint when the panel is not mounted upright and
>  we cannot use hardware rotation
> ---
>  drivers/gpu/drm/drm_fb_helper.c | 76 
> +++--
>  include/drm/drm_fb_helper.h |  8 +
>  2 files changed, 82 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 116d1f1337c7..e0f95f2cc52f 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -41,6 +41,7 @@
>  #include 
>  #include 
>  
> +#include "drm_crtc_internal.h"
>  #include "drm_crtc_helper_internal.h"
>  
>  static bool drm_fbdev_emulation = true;
> @@ -350,6 +351,7 @@ EXPORT_SYMBOL(drm_fb_helper_debug_leave);
>  static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool 
> active)
>  {
>   struct drm_device *dev = fb_helper->dev;
> + struct drm_plane_state *plane_state;
>   struct drm_plane *plane;
>   struct drm_atomic_state *state;
>   int i, ret;
> @@ -368,8 +370,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper 
> *fb_helper, bool activ
>  retry:
>   plane_mask = 0;
>   drm_for_each_plane(plane, dev) {
> - struct drm_plane_state *plane_state;
> -
>   plane_state = drm_atomic_get_plane_state(state, plane);
>   if (IS_ERR(plane_state)) {
>   ret = PTR_ERR(plane_state);
> @@ -392,6 +392,11 @@ static int restore_fbdev_mode_atomic(struct 
> drm_fb_helper *fb_helper, bool activ
>  
>   for (i = 0; i < fb_helper->crtc_count; i++) {
>   struct drm_mode_set *mode_set = 
> &fb_helper->crtc_info[i].mode_set;
> + struct drm_plane *primary = mode_set->crtc->primary;
> +
> + /* Cannot fail as we've already gotten the plane state above */
> + plane_state = drm_atomic_get_new_plane_state(state, primary);
> + plane_state->rotation = fb_helper->crtc_info[i].rotation;
>  
>   ret = __drm_atomic_helper_set_config(mode_set, state);
>   if (ret != 0)
> @@ -2334,6 +2339,57 @@ static int drm_pick_crtcs(struct drm_fb_helper 
> *fb_helper,
>   return best_score;
>  }
>  
> +/*
> + * This function checks if rotation is necessary because of panel orientation
> + * and if it is, if it is supported.
> + * If rotation is necessary and supported, its gets set in fb_crtc.rotation.
> + * If rotation is necessary but not supported, a DRM_MODE_ROTATE_* flag gets
> + * or-ed into fb_helper->rotations. In drm_setup_crtcs_fb() we check if only
> + * one bit is set and then we set fb_info.fbcon_rotate_hint to make fbcon do
> + * the unsupported rotation.
> + */
> +static void drm_setup_crtc_rotation(struct drm_fb_helper *fb_helper,
> + struct drm_fb_helper_crtc *fb_crtc,
> + struct drm_connector *connector)
> +{
> + struct drm_plane *plane = fb_crtc->mode_set.crtc->primary;
> + uint64_t valid_mask = 0;
> + int i, rotation;
> +
> + fb_crtc->rotation = DRM_MODE_ROTATE_0;
> +
> + switch (connector->display_info.panel_orientation) {
> + case DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP:
> + rotation = DRM_MODE_ROTATE_180;
> + break;
> + case DRM_MODE_PANEL_ORIENTATION_LEFT_UP:
> + rotation = DRM_MODE_ROTATE_90;
> + break;
> + case DRM_MODE_PANEL_ORIENTATION_RIGHT_UP:
> + rotation = DRM_MODE_ROTATE_270;
> + break;

For 90/270 hw rotation you need to flip the coordinates/sizes of the fb.

> + default:
> + rotation = DRM_MODE_ROTATE_0;
> + }
> +
> + if (rotation == DRM_MODE_ROTATE_0 || !plane->rotation_property) {
> + fb_helper->rotations |= rotation;
> + return;
> + }
> +
> + for (i = 0; i < plane->rotation_property->num_values; i++)
> + valid_mask |= (1ULL << plane->rotation_property->values[i]);

This isn't a good enough check for atomic drivers (and not for gen9+ intel
hw), since we might expose 90° rotations, but it only works if you have
the correct tiling format.

For atomic drivers it'd be really good if we could do a TEST_ONLY commit
first, and if that fails, fall back to sw rotation.

But that poses a bit a chicken&egg with creating the framebuffer (we need
one for the TEST_ONLY), 

Re: [Intel-gfx] [PATCH v3 6/7] efifb: Set info->fbcon_rotate_hint based on drm_get_panel_orientation_quirk

2017-10-30 Thread Daniel Vetter
On Mon, Oct 23, 2017 at 09:14:24AM +0200, Hans de Goede wrote:
> On some hardware the LCD panel is not mounted upright in the casing,
> but rotated by 90 degrees. In this case we want the console to
> automatically be rotated to compensate.
> 
> The drm subsys has a quirk table for this, use the
> drm_get_panel_orientation_quirk function to get the panel orientation
> and set info->fbcon_rotate_hint based on this, so that the fbcon console
> on top of efifb gets automatically rotated to compensate for the panel
> orientation.
> 
> Signed-off-by: Hans de Goede 
> ---
>  drivers/video/fbdev/Kconfig |  1 +
>  drivers/video/fbdev/efifb.c | 21 -
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
> index 5e58f5ec0a28..c4a90c497839 100644
> --- a/drivers/video/fbdev/Kconfig
> +++ b/drivers/video/fbdev/Kconfig
> @@ -772,6 +772,7 @@ config FB_VESA
>  config FB_EFI
>   bool "EFI-based Framebuffer Support"
>   depends on (FB = y) && !IA64 && EFI
> + select DRM_PANEL_ORIENTATION_QUIRKS
>   select FB_CFB_FILLRECT
>   select FB_CFB_COPYAREA
>   select FB_CFB_IMAGEBLIT
> diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
> index 3a010641f630..8c7f6aeee205 100644
> --- a/drivers/video/fbdev/efifb.c
> +++ b/drivers/video/fbdev/efifb.c
> @@ -15,6 +15,8 @@
>  #include 
>  #include 
>  #include 
> +#include  /* For drm_get_panel_orientation_quirk */
> +#include   /* For DRM_MODE_PANEL_ORIENTATION_* */
>  
>  static bool request_mem_succeeded = false;
>  static bool nowc = false;
> @@ -156,7 +158,7 @@ static u64 bar_offset;
>  static int efifb_probe(struct platform_device *dev)
>  {
>   struct fb_info *info;
> - int err;
> + int err, orientation;
>   unsigned int size_vmode;
>   unsigned int size_remap;
>   unsigned int size_total;
> @@ -328,6 +330,23 @@ static int efifb_probe(struct platform_device *dev)
>   info->fix = efifb_fix;
>   info->flags = FBINFO_FLAG_DEFAULT | FBINFO_MISC_FIRMWARE;
>  
> + orientation = drm_get_panel_orientation_quirk(efifb_defined.xres,
> +   efifb_defined.yres);

Oh right, that's the reason for the separate function. Still ugh.

Maybe add a comment in the kernel-doc for why it is what it is ...
-Daniel

> + switch (orientation) {
> + default:
> + info->fbcon_rotate_hint = FB_ROTATE_UR;
> + break;
> + case DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP:
> + info->fbcon_rotate_hint = FB_ROTATE_UD;
> + break;
> + case DRM_MODE_PANEL_ORIENTATION_LEFT_UP:
> + info->fbcon_rotate_hint = FB_ROTATE_CCW;
> + break;
> + case DRM_MODE_PANEL_ORIENTATION_RIGHT_UP:
> + info->fbcon_rotate_hint = FB_ROTATE_CW;
> + break;
> + }
> +
>   err = sysfs_create_groups(&dev->dev.kobj, efifb_groups);
>   if (err) {
>   pr_err("efifb: cannot add sysfs attrs\n");
> -- 
> 2.14.2
> 
> ___
> Intel-gfx mailing list
> intel-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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


Re: [Intel-gfx] [PATCH v3 0/7] drm/fbdev: Panel orientation connector property support

2017-10-30 Thread Daniel Vetter
On Mon, Oct 23, 2017 at 09:14:18AM +0200, Hans de Goede wrote:
> Hi All,
> 
> Here is v3 of my series to add a "panel orientation" property to
> the drm-connector for the LCD panel to let userspace know about LCD
> panels which are not mounted upright, as well as detecting upside-down
> panels without needing quirks (like we do for 90 degree rotated screens).
> 
> As requested by Daniel this version moves the quirks over from the fbdev
> subsys to the drm subsys. I've done this by simpy starting with a copy of
> the quirk table and eventually removing the fbdev version.

I think this design makes much more sense. Some nits I spotted and a few
ideas, but otherwise lgtm.

> The 1st patch in this series is a small fbdev/fbcon patch, patches 2-5
> are all drm patches since patches 2-5 depend on patch 1 I believe it
> would be best to merge patches 1-5 through the drm tree.
> 
> For merging patches 6-7 I see 3 options:
> 
> 1) Wait a kernel cycle, things will work fine without them, they are really
> just there to remove the fbdev copy of the quirks
> 
> 2) Merge all 7 patches through the drm tree

My preference. We can do a topic branch that Bartlomiej pulls into fbdev
so that the patches are in both trees. We need them anyway in both for
testing I'd say.

> 3) Use a stable tag in the drm tree which the fbdev tree can merge and then
> merge patches 6-7 through the drm tree.

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


Re: [PATCH] drm/framebuffer: Add framebuffer debugfs file

2017-10-30 Thread Daniel Vetter
On Tue, Oct 24, 2017 at 04:03:46PM -0700, Kristian Høgsberg wrote:
> On Tue, Oct 24, 2017 at 9:39 AM, Noralf Trønnes  wrote:
> >
> > Den 23.10.2017 23.32, skrev Kristian Høgsberg:
> >>
> >> On Mon, Oct 23, 2017 at 9:47 AM, Noralf Trønnes 
> >> wrote:
> >>>
> >>> Add debugfs file that dumps info about the framebuffers and its planes.
> >>> Also dump info about any connected gem object(s).
> >>>
> >>> Signed-off-by: Noralf Trønnes 
> >>> ---
> >>>   drivers/gpu/drm/drm_debugfs.c |  6 +
> >>>   drivers/gpu/drm/drm_framebuffer.c | 51
> >>> +++
> >>>   drivers/gpu/drm/drm_gem.c | 11 +
> >>>   drivers/gpu/drm/drm_internal.h|  4 +++
> >>>   4 files changed, 72 insertions(+)
> >>>
> >>> diff --git a/drivers/gpu/drm/drm_debugfs.c
> >>> b/drivers/gpu/drm/drm_debugfs.c
> >>> index c1807d5754b2..550f29de6c1f 100644
> >>> --- a/drivers/gpu/drm/drm_debugfs.c
> >>> +++ b/drivers/gpu/drm/drm_debugfs.c
> >>> @@ -158,6 +158,12 @@ int drm_debugfs_init(struct drm_minor *minor, int
> >>> minor_id,
> >>>  }
> >>>  }
> >>>
> >>> +   ret = drm_framebuffer_debugfs_init(minor);
> >>> +   if (ret) {
> >>> +   DRM_ERROR("Failed to create framebuffer debugfs file\n");
> >>> +   return ret;
> >>> +   }
> >>> +
> >>>  if (dev->driver->debugfs_init) {
> >>>  ret = dev->driver->debugfs_init(minor);
> >>>  if (ret) {
> >>> diff --git a/drivers/gpu/drm/drm_framebuffer.c
> >>> b/drivers/gpu/drm/drm_framebuffer.c
> >>> index af279844d7ce..ebdfe2b5689f 100644
> >>> --- a/drivers/gpu/drm/drm_framebuffer.c
> >>> +++ b/drivers/gpu/drm/drm_framebuffer.c
> >>> @@ -25,7 +25,9 @@
> >>>   #include 
> >>>   #include 
> >>>   #include 
> >>> +#include 
> >>>
> >>> +#include "drm_internal.h"
> >>>   #include "drm_crtc_internal.h"
> >>>
> >>>   /**
> >>> @@ -955,3 +957,52 @@ int drm_framebuffer_plane_height(int height,
> >>>  return fb_plane_height(height, fb->format, plane);
> >>>   }
> >>>   EXPORT_SYMBOL(drm_framebuffer_plane_height);
> >>> +
> >>> +#ifdef CONFIG_DEBUG_FS
> >>> +static void drm_framebuffer_print(struct drm_framebuffer *fb,
> >>> + struct drm_printer *p)
> >>> +{
> >>> +   unsigned int i;
> >>> +
> >>> +   drm_printf(p, "[FB:%d] %dx%d@%4.4s refcount=%d\n", fb->base.id,
> >>> +  fb->width, fb->height, (char *)&fb->format->format,
> >>> +  drm_framebuffer_read_refcount(fb));
> >>
> >> Could you print the format modifier as well?
> >>
> >>> +
> >>> +   for (i = 0; i < fb->format->num_planes; i++) {
> >>> +   drm_printf(p, "\t%u: offset=%d pitch=%d",
> >>> +  i, fb->offsets[i], fb->pitches[i]);
> >>> +   if (fb->obj[i]) {
> >>> +   drm_printf(p, " GEM: ");
> >>> +   drm_gem_print(fb->obj[i], p);
> >>> +   } else {
> >>> +   drm_printf(p, "\n");
> >>> +   }
> >>> +   }
> >>> +}
> >>> +
> >>> +static int drm_framebuffer_info(struct seq_file *m, void *data)
> >>> +{
> >>> +   struct drm_info_node *node = m->private;
> >>> +   struct drm_device *dev = node->minor->dev;
> >>> +   struct drm_printer p = drm_seq_file_printer(m);
> >>> +   struct drm_framebuffer *fb;
> >>> +
> >>> +   mutex_lock(&dev->mode_config.fb_lock);
> >>> +   drm_for_each_fb(fb, dev)
> >>> +   drm_framebuffer_print(fb, &p);
> >>> +   mutex_unlock(&dev->mode_config.fb_lock);
> >>> +
> >>> +   return 0;
> >>> +}
> >>> +
> >>> +static const struct drm_info_list drm_framebuffer_debugfs_list[] = {
> >>> +   { "framebuffer", drm_framebuffer_info, 0 },
> >>
> >> This is quite useful, thanks. Ultimately, it would be very nice to
> >> have something like i915_display_info, but in a generic way. There's
> >> not much there that's actually i915 specific:
> >
> >
> > How about mimicking drm_state_info(), debugfs file 'state', and create
> > an 'info' file?
> >
> > struct drm_crtc_funcs {
> > /**
> >  * @print_info:
> >  *
> >  * If driver subclasses struct &drm_crtc, it can implement this
> >  * optional hook for printing additional driver specific info.
> >  * See drm_crtc_print_info().
> >  */
> > void (*print_info)(struct drm_printer *p, struct drm_crtc *crtc);
> > }
> >
> > void drm_crtc_print_info(struct drm_printer *p, struct drm_crtc *crtc)
> > {
> > drm_modeset_lock(&crtc->mutex, NULL);
> >
> > drm_printf(p, "[CRTC:%d:%s] ...");
> >
> > if (crtc->funcs->print_info)
> > crtc->funcs->print_info(p, crtc);
> >
> > drm_modeset_unlock(&crtc->mutex);
> > }
> >
> > static int drm_debugfs_info(struct seq_file *m, void *data)
> > {
> > struct drm_info_node *node = m->private;
> > struct drm_device *dev = node->minor->dev;
> > struct drm_printer p = drm_seq_file_printer(m);
> > struct drm_plane 

Re: drm/rcar-du: Use common error handling code in rcar_du_encoders_init()

2017-10-30 Thread SF Markus Elfring
> In general, I'll pick up any patches that are good,

This is usual.


> but the current track record is that Markus' patches need extra scrutiny,

I find that this can be fine according to a safe review for presented
update suggestions.


> and many of the patches contain subjective changes that lead to debate

Some discussion is occasionally needed to achieve the desired change acceptance,
isn't it?


> that is not constructive.

I got an other opinion here.


> There's no return on investment here.

I hope that the view can become more positive.
How will the clarification evolve further?

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


Re: [PATCH] drm/exynos: Fix dma-buf import

2017-10-30 Thread Tobias Jakobi
Marek Szyprowski wrote:
> When IOMMU support was enabled, dma-buf import in Exynos DRM was broken
> since commit f43c35966a5a ("drm/exynos: use real device for DMA-mapping
> operations") due to using wrong struct device in drm_gem_prime_import()
> function. This patch fixes following kernel BUG caused by incorrect buffer
> mapping to DMA address space:
> 
> exynos-sysmmu 1465.sysmmu: 1445.mixer: PAGE FAULT occurred at 
> 0xb2e0
> [ cut here ]
> kernel BUG at drivers/iommu/exynos-iommu.c:449!
> Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
> Modules linked in:
> CPU: 0 PID: 0 Comm: swapper/0 Not tainted 
> 4.14.0-rc4-next-20171016-00033-g990d723669fd #3165
> Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
> task: c0e0b7c0 task.stack: c0e0
> PC is at exynos_sysmmu_irq+0x1d0/0x24c
> LR is at exynos_sysmmu_irq+0x154/0x24c
> [ cut here ]
Reviewed-by: Tobias Jakobi 


- Tobias

> Reported-by: Marian Mihailescu 
> Fixes: f43c35966a5a ("drm/exynos: use real device for DMA-mapping operations")
> Signed-off-by: Marek Szyprowski 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 +-
>  drivers/gpu/drm/exynos/exynos_drm_gem.c | 6 ++
>  drivers/gpu/drm/exynos/exynos_drm_gem.h | 2 ++
>  3 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
> b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index e651a58c18cf..0822c5341ba4 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -148,7 +148,7 @@ static struct drm_driver exynos_drm_driver = {
>   .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>   .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
>   .gem_prime_export   = drm_gem_prime_export,
> - .gem_prime_import   = drm_gem_prime_import,
> + .gem_prime_import   = exynos_drm_gem_prime_import,
>   .gem_prime_get_sg_table = exynos_drm_gem_prime_get_sg_table,
>   .gem_prime_import_sg_table  = exynos_drm_gem_prime_import_sg_table,
>   .gem_prime_vmap = exynos_drm_gem_prime_vmap,
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c 
> b/drivers/gpu/drm/exynos/exynos_drm_gem.c
> index 077de014d610..ef35bc23bb36 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
> @@ -506,6 +506,12 @@ int exynos_drm_gem_mmap(struct file *filp, struct 
> vm_area_struct *vma)
>  }
>  
>  /* low-level interface prime helpers */
> +struct drm_gem_object *exynos_drm_gem_prime_import(struct drm_device *dev,
> + struct dma_buf *dma_buf)
> +{
> + return drm_gem_prime_import_dev(dev, dma_buf, to_dma_dev(dev));
> +}
> +
>  struct sg_table *exynos_drm_gem_prime_get_sg_table(struct drm_gem_object 
> *obj)
>  {
>   struct exynos_drm_gem *exynos_gem = to_exynos_gem(obj);
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h 
> b/drivers/gpu/drm/exynos/exynos_drm_gem.h
> index e86d1a9518c3..5a4c7de80f65 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_gem.h
> +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h
> @@ -117,6 +117,8 @@ int exynos_drm_gem_fault(struct vm_fault *vmf);
>  int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
>  
>  /* low-level interface prime helpers */
> +struct drm_gem_object *exynos_drm_gem_prime_import(struct drm_device *dev,
> + struct dma_buf *dma_buf);
>  struct sg_table *exynos_drm_gem_prime_get_sg_table(struct drm_gem_object 
> *obj);
>  struct drm_gem_object *
>  exynos_drm_gem_prime_import_sg_table(struct drm_device *dev,
> 

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


Re: [PATCH] drm: virtio: replace reference/unreference with get/put

2017-10-30 Thread Daniel Vetter
On Mon, Oct 23, 2017 at 10:08:06PM +0530, Aastha Gupta wrote:
> DRM core uses reference/unreference suffixes for refcounting
> functions, but kernel uses get/put (e.g. kref_get/put()).
> Replace reference/unreference with get/put for consistency
> and also it's shorter.
> 
> The following cocci script was used to generate the patch:
> 
> @@
> expression e;
> @@
> 
> (
> -drm_gem_object_reference(e);
> +drm_gem_object_get(e);
> |
> -drm_gem_object_unreference(e);
> +drm_gem_object_put(e);
> |
> -drm_gem_object_unreference_unlocked(e);
> +drm_gem_object_put_unlocked(e);
> )
> 
> Signed-off-by: Aastha Gupta 

Applied, thanks for your patch.
-Daniel

> ---
>  drivers/gpu/drm/virtio/virtgpu_display.c |  4 ++--
>  drivers/gpu/drm/virtio/virtgpu_gem.c |  4 ++--
>  drivers/gpu/drm/virtio/virtgpu_ioctl.c   | 14 +++---
>  3 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c 
> b/drivers/gpu/drm/virtio/virtgpu_display.c
> index b6d5205..41b0930 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_display.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_display.c
> @@ -53,7 +53,7 @@ static void virtio_gpu_user_framebuffer_destroy(struct 
> drm_framebuffer *fb)
>   struct virtio_gpu_framebuffer *virtio_gpu_fb
>   = to_virtio_gpu_framebuffer(fb);
>  
> - drm_gem_object_unreference_unlocked(virtio_gpu_fb->obj);
> + drm_gem_object_put_unlocked(virtio_gpu_fb->obj);
>   drm_framebuffer_cleanup(fb);
>   kfree(virtio_gpu_fb);
>  }
> @@ -327,7 +327,7 @@ virtio_gpu_user_framebuffer_create(struct drm_device *dev,
>   ret = virtio_gpu_framebuffer_init(dev, virtio_gpu_fb, mode_cmd, obj);
>   if (ret) {
>   kfree(virtio_gpu_fb);
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
>   return NULL;
>   }
>  
> diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c 
> b/drivers/gpu/drm/virtio/virtgpu_gem.c
> index 72ad7b1..92fb277 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_gem.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_gem.c
> @@ -72,7 +72,7 @@ int virtio_gpu_gem_create(struct drm_file *file,
>   *obj_p = &obj->gem_base;
>  
>   /* drop reference from allocate - handle holds it now */
> - drm_gem_object_unreference_unlocked(&obj->gem_base);
> + drm_gem_object_put_unlocked(&obj->gem_base);
>  
>   *handle_p = handle;
>   return 0;
> @@ -130,7 +130,7 @@ int virtio_gpu_mode_dumb_mmap(struct drm_file *file_priv,
>   return -ENOENT;
>   obj = gem_to_virtio_gpu_obj(gobj);
>   *offset_p = virtio_gpu_object_mmap_offset(obj);
> - drm_gem_object_unreference_unlocked(gobj);
> + drm_gem_object_put_unlocked(gobj);
>   return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c 
> b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> index b94bd54..461f81a 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> @@ -86,7 +86,7 @@ static void virtio_gpu_unref_list(struct list_head *head)
>   bo = buf->bo;
>   qobj = container_of(bo, struct virtio_gpu_object, tbo);
>  
> - drm_gem_object_unreference_unlocked(&qobj->gem_base);
> + drm_gem_object_put_unlocked(&qobj->gem_base);
>   }
>  }
>  
> @@ -261,7 +261,7 @@ static int virtio_gpu_resource_create_ioctl(struct 
> drm_device *dev, void *data,
>   ret = virtio_gpu_object_attach(vgdev, qobj, res_id, NULL);
>   } else {
>   /* use a gem reference since unref list undoes them */
> - drm_gem_object_reference(&qobj->gem_base);
> + drm_gem_object_get(&qobj->gem_base);
>   mainbuf.bo = &qobj->tbo;
>   list_add(&mainbuf.head, &validate_list);
>  
> @@ -304,7 +304,7 @@ static int virtio_gpu_resource_create_ioctl(struct 
> drm_device *dev, void *data,
>   }
>   return ret;
>   }
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
>  
>   rc->res_handle = res_id; /* similiar to a VM address */
>   rc->bo_handle = handle;
> @@ -341,7 +341,7 @@ static int virtio_gpu_resource_info_ioctl(struct 
> drm_device *dev, void *data,
>  
>   ri->size = qobj->gem_base.size;
>   ri->res_handle = qobj->hw_res_handle;
> - drm_gem_object_unreference_unlocked(gobj);
> + drm_gem_object_put_unlocked(gobj);
>   return 0;
>  }
>  
> @@ -389,7 +389,7 @@ static int virtio_gpu_transfer_from_host_ioctl(struct 
> drm_device *dev,
>  out_unres:
>   virtio_gpu_object_unreserve(qobj);
>  out:
> - drm_gem_object_unreference_unlocked(gobj);
> + drm_gem_object_put_unlocked(gobj);
>   return ret;
>  }
>  
> @@ -439,7 +439,7 @@ static int virtio_gpu_transfer_to_host_ioctl(struct 
> drm_device *dev, void *data,
>  out_unres:
>   virtio_gpu_object_unreserve(qobj);
>  out:
> - drm_gem_object_unreference_unlocked(gobj);
> + drm_ge

Re: [PATCH] drm: gma500: Convert timers to use timer_setup()

2017-10-30 Thread Daniel Vetter
On Tue, Oct 24, 2017 at 08:16:09AM -0700, Kees Cook wrote:
> In preparation for unconditionally passing the struct timer_list pointer to
> all timer callbacks, switch to using the new timer_setup() and from_timer()
> to pass the timer pointer explicitly.
> 
> Cc: Patrik Jakobsson 
> Cc: David Airlie 
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook 

Do you expect drm folks to apply this, or is this part of a larger refactoring?

A notch more context in the commit message would help ...
-Daniel

> ---
>  drivers/gpu/drm/gma500/psb_lid.c | 8 +++-
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/gma500/psb_lid.c 
> b/drivers/gpu/drm/gma500/psb_lid.c
> index 1d2ebb5e530f..be6dda58fcae 100644
> --- a/drivers/gpu/drm/gma500/psb_lid.c
> +++ b/drivers/gpu/drm/gma500/psb_lid.c
> @@ -23,9 +23,9 @@
>  #include "psb_intel_reg.h"
>  #include 
>  
> -static void psb_lid_timer_func(unsigned long data)
> +static void psb_lid_timer_func(struct timer_list *t)
>  {
> - struct drm_psb_private * dev_priv = (struct drm_psb_private *)data;
> + struct drm_psb_private *dev_priv = from_timer(dev_priv, t, lid_timer);
>   struct drm_device *dev = (struct drm_device *)dev_priv->dev;
>   struct timer_list *lid_timer = &dev_priv->lid_timer;
>   unsigned long irq_flags;
> @@ -77,10 +77,8 @@ void psb_lid_timer_init(struct drm_psb_private *dev_priv)
>   spin_lock_init(&dev_priv->lid_lock);
>   spin_lock_irqsave(&dev_priv->lid_lock, irq_flags);
>  
> - init_timer(lid_timer);
> + timer_setup(lid_timer, psb_lid_timer_func, 0);
>  
> - lid_timer->data = (unsigned long)dev_priv;
> - lid_timer->function = psb_lid_timer_func;
>   lid_timer->expires = jiffies + PSB_LID_DELAY;
>  
>   add_timer(lid_timer);
> -- 
> 2.7.4
> 
> 
> -- 
> Kees Cook
> Pixel Security
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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


[Bug 103489] [Regression bisected]: vblank time outs and machine hangs on RX560 drm-next-4.15-dc

2017-10-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103489

--- Comment #1 from Michel Dänzer  ---
(In reply to oschowa from comment #0)
> Bisecting produced d050f8ed14494ea23c6e10b5893010946ef0f78b as the first bad
> commit, although on this commit the machine hangs immediatly after boot, so
> it might be a different issue.

Since you can't test that commit for this problem, you should run

 git bisect skip

for it, not "bad". Does the following commit boot and exhibit the problem?

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


Re: [Intel-gfx] [PATCH v2 2/2] Test case for drm_vblank_cleanup refcount validation patch

2017-10-30 Thread Daniel Vetter
On Wed, Oct 25, 2017 at 08:44:45PM +0530, PrasannaKumar Muralidharan wrote:
> Hi All,
> 
> On 24 October 2017 at 22:18, PrasannaKumar Muralidharan
>  wrote:
> > In i915 driver unload drm_vblank_get is added to test whether
> > drm_vblank_cleanup refcount validation patch is working.
> >
> > Signed-off-by: PrasannaKumar Muralidharan 
> > ---
> > Changes in v2:
> > Use drm_crtc_vblank_get instead of _put. In previous patch _put was wrongly
> > used.
> >
> >  drivers/gpu/drm/i915/i915_drv.c | 7 +++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_drv.c 
> > b/drivers/gpu/drm/i915/i915_drv.c
> > index 9f45cfe..4aee1c0 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.c
> > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > @@ -1373,6 +1373,13 @@ void i915_driver_unload(struct drm_device *dev)
> > struct drm_i915_private *dev_priv = to_i915(dev);
> > struct pci_dev *pdev = dev_priv->drm.pdev;
> >
> > +   enum pipe pipe;
> > +   for_each_pipe(dev_priv, pipe) {
> > +   struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv,
> > + pipe);
> > +   drm_crtc_vblank_get(&crtc->base);
> > +   }
> > +
> > i915_driver_unregister(dev_priv);
> >
> > if (i915_gem_suspend(dev_priv))
> > --
> > 2.10.0
> >
> 
> From 
> https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6167/fi-ilk-650/igt@drv_module_rel...@basic-reload.html
> it can be seen that this patch triggers warning when vblank->refcount
> > 0 in vblank cleanup. This tests patch 1 successfully.
> 
> I think patch 1 is good to go.

Yeah it works, but we don't know whether it breaks anything yet. Can you
pls resubmit just the first patch? Abusing CI was just an idea to get it
fully tested, before we can merge it still needs to pass full CI. We just
had an issue 2 weeks ago where CI blew up because an untested patch landed
that broke every test :-/
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/3] drm: add connector info/property for non-desktop displays

2017-10-30 Thread Daniel Vetter
On Wed, Oct 25, 2017 at 01:23:58PM -0700, Keith Packard wrote:
> Daniel Stone  writes:
> 
> > I still think putting these behind a client cap is a good idea:
> > https://lists.freedesktop.org/archives/dri-devel/2017-October/155616.html
> 
> Assuming that everyone eventually catches up, this should be a
> short-term issue. So, all we have to do is figure out how to make the
> transition, which seems a lot less weighty than something that will
> affect the environment for a long time.
> 
> We need to consider the cross-version compatibility issues for both the
> window system and the kernel. That means an old window system with new
> kernel or new window system with old kernel should work as well as it
> does today.
> 
> Today, an HMD display is presented as a normal output and applications
> can discover it through the window system and present an image on it by
> placing their image at the right location on the screen. To keep that
> working, we can't hide HMD outputs from an older window system.

Yeah we add flags when old userspace would get more broken by this. If
old/existing userspace is handling stuff incorrectly already, there's no
need to flag that it now works better, and hiding by default seems to have
issues too. In case of doubt I'll opt for less uapi, anytime that's
possible :-)

So my vote on no opt-in flag needed here.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2] drm/framebuffer: Add framebuffer debugfs file

2017-10-30 Thread Daniel Vetter
On Wed, Oct 25, 2017 at 07:18:28PM +0300, Ville Syrjälä wrote:
> It also occurs to me that we might want to combine this fb dumper with
> the atomic state dumper. That one already prints out stuf about
> framebuffers in drm_atomic_plane_print_state(). Not sure if there
> would be a nice way to keep the extra indentation with shared code
> though. I guess one could always pass on some kind of prefix string to
> thee fb dump function.

Yeah dumping the full details with the same function introduced in this
patch here might be useful there too. Since we just pass around seq_file
it should be all cool (well probably should pass around drm_printer if we
don't do that already).
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: gma500: mmu: unmap the correct address

2017-10-30 Thread Daniel Vetter
On Sun, Oct 29, 2017 at 01:55:12PM +0800, Pan Bian wrote:
> The function kunmap_atomatic() is called on the same variable twice,
> i.e. pt->v. In the second call, its parameter should be variable v
> rather than pt->v.
> 
> Signed-off-by: Pan Bian 

Makes sense, not sure this ever worked or how it ever worked, but oh well.

Applied to drm-misc-next for 4.16.
-Daniel

> ---
>  drivers/gpu/drm/gma500/mmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/gma500/mmu.c b/drivers/gpu/drm/gma500/mmu.c
> index 0eaf11c..ccb161c 100644
> --- a/drivers/gpu/drm/gma500/mmu.c
> +++ b/drivers/gpu/drm/gma500/mmu.c
> @@ -395,7 +395,7 @@ static void psb_mmu_pt_unmap_unlock(struct psb_mmu_pt *pt)
>   psb_mmu_clflush(pd->driver, (void *)&v[pt->index]);
>   atomic_set(&pd->driver->needs_tlbflush, 1);
>   }
> - kunmap_atomic(pt->v);
> + kunmap_atomic(v);
>   spin_unlock(&pd->driver->lock);
>   psb_mmu_free_pt(pt);
>   return;
> -- 
> 1.9.1
> 
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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


Re: [PATCH v3 8/8] drm/tinydrm: Use drm_gem_cma_print_info()

2017-10-30 Thread Daniel Vetter
On Thu, Oct 26, 2017 at 06:57:31PM +0200, Noralf Trønnes wrote:
> Use drm_gem_cma_print_info() instead of drm_fb_cma_debugfs_show()
> to print framebuffer/gem info to debugfs. The debugfs file is now:
> /dri//framebuffer
> 
> Signed-off-by: Noralf Trønnes 
> ---
>  drivers/gpu/drm/tinydrm/mipi-dbi.c | 8 +---
>  include/drm/tinydrm/tinydrm.h  | 1 +
>  2 files changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c 
> b/drivers/gpu/drm/tinydrm/mipi-dbi.c
> index d43e992ab432..347f9b226f26 100644
> --- a/drivers/gpu/drm/tinydrm/mipi-dbi.c
> +++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c
> @@ -961,10 +961,6 @@ static const struct file_operations 
> mipi_dbi_debugfs_command_fops = {
>   .write = mipi_dbi_debugfs_command_write,
>  };
>  
> -static const struct drm_info_list mipi_dbi_debugfs_list[] = {
> - { "fb",   drm_fb_cma_debugfs_show, 0 },
> -};
> -
>  /**
>   * mipi_dbi_debugfs_init - Create debugfs entries
>   * @minor: DRM minor
> @@ -987,9 +983,7 @@ int mipi_dbi_debugfs_init(struct drm_minor *minor)
>   debugfs_create_file("command", mode, minor->debugfs_root, mipi,
>   &mipi_dbi_debugfs_command_fops);
>  
> - return drm_debugfs_create_files(mipi_dbi_debugfs_list,
> - ARRAY_SIZE(mipi_dbi_debugfs_list),
> - minor->debugfs_root, minor);
> + return 0;
>  }
>  EXPORT_SYMBOL(mipi_dbi_debugfs_init);
>  
> diff --git a/include/drm/tinydrm/tinydrm.h b/include/drm/tinydrm/tinydrm.h
> index 4774fe3d4273..423828922e5a 100644
> --- a/include/drm/tinydrm/tinydrm.h
> +++ b/include/drm/tinydrm/tinydrm.h
> @@ -46,6 +46,7 @@ pipe_to_tinydrm(struct drm_simple_display_pipe *pipe)
>   */
>  #define TINYDRM_GEM_DRIVER_OPS \
>   .gem_free_object= tinydrm_gem_cma_free_object, \
> + .gem_print_info = drm_gem_cma_print_info, \
>   .gem_vm_ops = &drm_gem_cma_vm_ops, \
>   .prime_handle_to_fd = drm_gem_prime_handle_to_fd, \
>   .prime_fd_to_handle = drm_gem_prime_fd_to_handle, \

I think a DRM_GEM_CMA_DRIVER_OPS like we have for FOPS might be nice
eventually. But probably better to go through with all the other
refactoring. For patches 4-8 (since Ville reviewed the first 3 already):

Reviewed-by: Daniel Vetter 
> -- 
> 2.14.2
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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


Re: [Intel-gfx] [PATCH v3 2/7] drm: Add panel orientation quirks

2017-10-30 Thread Hans de Goede

Hi,

On 30-10-17 10:39, Daniel Vetter wrote:

On Mon, Oct 23, 2017 at 09:14:20AM +0200, Hans de Goede wrote:

Some x86 clamshell design devices use portrait tablet screens and a display
engine which cannot rotate in hardware, so the firmware just leaves things
as is and we cannot figure out that the display is oriented non upright
from the hardware.

So at least on x86, we need a quirk table for this. This commit adds a DMI
based quirk table which is initially populated with 5 such devices: Asus
T100HA, GPD Pocket, GPD win, I.T.Works TW891 and the VIOS LTH17.

This quirk table will be used by the drm code to let userspace know that
the display is not mounted upright inside the device's case through a new
panel orientation drm-connector property, as well as to tell fbcon to
rotate the console so that it shows the right way up.

Signed-off-by: Hans de Goede 


Found a few organizational bikesheds below, but makes sense I think.


---
  drivers/gpu/drm/Kconfig|   3 +
  drivers/gpu/drm/Makefile   |   1 +
  drivers/gpu/drm/drm_panel_orientation_quirks.c | 157 +
  include/drm/drm_utils.h|  18 +++
  4 files changed, 179 insertions(+)
  create mode 100644 drivers/gpu/drm/drm_panel_orientation_quirks.c
  create mode 100644 include/drm/drm_utils.h

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 4d9f21831741..9d005ac98c2b 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -26,6 +26,9 @@ config DRM_MIPI_DSI
bool
depends on DRM
  
+config DRM_PANEL_ORIENTATION_QUIRKS

+   tristate


Why a config option? We don't make the edid quirks optional either ...


You suggested this yourself while discussing v2, since at the end of the
series this is going to be required by both fbcon and the drm series, so
we may want to build it even if the drm subsys is otherwise not used.


+
  config DRM_DP_AUX_CHARDEV
bool "DRM DP AUX Interface"
depends on DRM
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index a3fdc5a68dff..ffb621819bbf 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_DRM_DEBUG_MM_SELFTEST) += selftests/
  
  obj-$(CONFIG_DRM)	+= drm.o

  obj-$(CONFIG_DRM_MIPI_DSI) += drm_mipi_dsi.o
+obj-$(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS) += drm_panel_orientation_quirks.o


Since it's a kms thing, probably should be added to the drm_kms_helper.ko
module. There's panles/bridges which also should be there but aren't, but
those aren't the best examples.


See my reply above why this cannot be done.


  obj-$(CONFIG_DRM_ARM) += arm/
  obj-$(CONFIG_DRM_TTM) += ttm/
  obj-$(CONFIG_DRM_TDFX)+= tdfx/
diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c 
b/drivers/gpu/drm/drm_panel_orientation_quirks.c
new file mode 100644
index ..cea4d71f4978
--- /dev/null
+++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c
@@ -0,0 +1,157 @@
+/*
+ *  drm_panel_orientation_quirks.c -- Quirks for non-normal panel orientation
+ *
+ * Copyright (C) 2017 Hans de Goede 
+ *
+ *  This file is subject to the terms and conditions of the GNU General Public
+ *  License.  See the file COPYING in the main directory of this archive for
+ *  more details.
+ */
+
+#include 
+#include 
+
+#ifdef CONFIG_DMI
+
+/*
+ * Some x86 clamshell design devices use portrait tablet screens and a display
+ * engine which cannot rotate in hardware, so we need to rotate the fbcon to
+ * compensate. Unfortunately these (cheap) devices also typically have quite
+ * generic DMI data, so we match on a combination of DMI data, screen 
resolution
+ * and a list of known BIOS dates to avoid false positives.
+ */
+
+struct drm_dmi_panel_orientation_data {
+   int width;
+   int height;
+   const char * const *bios_dates;
+   int orientation;
+};
+
+static const struct drm_dmi_panel_orientation_data asus_t100ha = {
+   .width = 800,
+   .height = 1280,
+   .orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP,
+};
+
+static const struct drm_dmi_panel_orientation_data gpd_pocket = {
+   .width = 1200,
+   .height = 1920,
+   .bios_dates = (const char * const []){ "05/26/2017", "06/28/2017",
+   "07/05/2017", "08/07/2017", NULL },
+   .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
+};
+
+static const struct drm_dmi_panel_orientation_data gpd_win = {
+   .width = 720,
+   .height = 1280,
+   .bios_dates = (const char * const []){
+   "10/25/2016", "11/18/2016", "12/23/2016", "12/26/2016",
+   "02/21/2017", "03/20/2017", "05/25/2017", NULL },
+   .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
+};
+
+static const struct drm_dmi_panel_orientation_data itworks_tw891 = {
+   .width = 800,
+   .height = 1280,
+   .bios_dates = (const char * const []){ "10/16/2015", NULL },
+   .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_U

Re: [Intel-gfx] [PATCH v3 3/7] drm: Add support for a panel-orientation connector property

2017-10-30 Thread Hans de Goede

Hi,

On 30-10-17 10:43, Daniel Vetter wrote:

On Mon, Oct 23, 2017 at 09:14:21AM +0200, Hans de Goede wrote:

On some devices the LCD panel is mounted in the casing in such a way that
the up/top side of the panel does not match with the top side of the
device (e.g. it is mounted upside-down).

This commit adds the necessary infra for lcd-panel drm_connector-s to
have a "panel orientation" property to communicate how the panel is
orientated vs the casing.

Userspace can use this property to check for non-normal orientation and
then adjust the displayed image accordingly by rotating it to compensate.

Signed-off-by: Hans de Goede 
---
Changes in v2:
-Rebased on 4.14-rc1
-Store panel_orientation in drm_display_info, so that drm_fb_helper.c can
  access it easily
-Have a single drm_connector_init_panel_orientation_property rather then
  create and attach functions. The caller is expected to set
  drm_display_info.panel_orientation before calling this, then this will
  check for platform specific quirks overriding the panel_orientation and if
  the panel_orientation is set after this then it will attach the property.
---
  drivers/gpu/drm/Kconfig |  1 +
  drivers/gpu/drm/drm_connector.c | 73 +
  include/drm/drm_connector.h | 11 +++
  include/drm/drm_mode_config.h   |  7 
  include/uapi/drm/drm_mode.h |  7 
  5 files changed, 99 insertions(+)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 9d005ac98c2b..0b166e626eb6 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -7,6 +7,7 @@
  menuconfig DRM
tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI 
support)"
depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
+   select DRM_PANEL_ORIENTATION_QUIRKS
select HDMI
select FB_CMDLINE
select I2C
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 704fc8934616..129c83a84320 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -24,6 +24,7 @@
  #include 
  #include 
  #include 
+#include 
  
  #include "drm_crtc_internal.h"

  #include "drm_internal.h"
@@ -212,6 +213,8 @@ int drm_connector_init(struct drm_device *dev,
mutex_init(&connector->mutex);
connector->edid_blob_ptr = NULL;
connector->status = connector_status_unknown;
+   connector->display_info.panel_orientation =
+   DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
  
  	drm_connector_get_cmdline_mode(connector);
  
@@ -664,6 +667,13 @@ static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = {

{ DRM_MODE_PICTURE_ASPECT_16_9, "16:9" },
  };
  
+static const struct drm_prop_enum_list drm_panel_orientation_enum_list[] = {

+   { DRM_MODE_PANEL_ORIENTATION_NORMAL,"Normal"  },
+   { DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP, "Upside Down" },
+   { DRM_MODE_PANEL_ORIENTATION_LEFT_UP,   "Left Side Up"},
+   { DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,  "Right Side Up"   },
+};
+
  static const struct drm_prop_enum_list drm_dvi_i_select_enum_list[] = {
{ DRM_MODE_SUBCONNECTOR_Automatic, "Automatic" }, /* DVI-I and TV-out */
{ DRM_MODE_SUBCONNECTOR_DVID,  "DVI-D" }, /* DVI-I  */
@@ -768,6 +778,18 @@ DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name,
   *
   * CRTC_ID:
   *Mode object ID of the &drm_crtc this connector should be connected to.
+ *
+ * Connectors for LCD panels may also have one standardized property:
+ *
+ * panel orientation:
+ * On some devices the LCD panel is mounted in the casing in such a way
+ * that the up/top side of the panel does not match with the top side of
+ * the device. Userspace can use this property to check for this.
+ * Note that input coordinates from touchscreens (input devices with
+ * INPUT_PROP_DIRECT) will still map 1:1 to the actual LCD panel
+ * coordinates, so if userspace rotates the picture to adjust for
+ * the orientation it must also apply the same transformation to the
+ * touchscreen input coordinates.
   */
  
  int drm_connector_create_standard_properties(struct drm_device *dev)

@@ -1234,6 +1256,57 @@ void drm_mode_connector_set_link_status_property(struct 
drm_connector *connector
  }
  EXPORT_SYMBOL(drm_mode_connector_set_link_status_property);
  
+/**

+ * drm_connector_init_panel_orientation_property -
+ * initialize the connecters panel_orientation property
+ * @connector: connector for which to init the panel-orientation property.
+ * @width: width in pixels of the panel, used for panel quirk detection
+ * @height: height in pixels of the panel, used for panel quirk detection
+ *
+ * This function should only be called for built-in panels, after setting
+ * connector->display_info.panel_orientation first (if known).
+ *
+ * This function will check for platform specific (e.g. DMI based) quirks
+ * overriding display_info.panel_orientation first,

Re: [Intel-gfx] [PATCH v3 4/7] drm/fb-helper: Apply panel orientation connector prop to the primary plane

2017-10-30 Thread Hans de Goede

Hi,

On 30-10-17 10:52, Daniel Vetter wrote:

On Mon, Oct 23, 2017 at 09:14:22AM +0200, Hans de Goede wrote:

Apply the "panel orientation" drm connector prop to the primary plane so
that fbcon and fbdev using userspace programs display the right way up.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=94894
Signed-off-by: Hans de Goede 
---
Changes in v2:
-New patch in v2 of this patch-set

Changes in v3:
-Use a rotation member in struct drm_fb_helper_crtc and set that from
  drm_setup_crtcs instead of looping over all crtc's to find the right one
  later
-Since we now no longer look at rotation quirks directly in the fbcon code,
  set fb_info.fbcon_rotate_hint when the panel is not mounted upright and
  we cannot use hardware rotation
---
  drivers/gpu/drm/drm_fb_helper.c | 76 +++--
  include/drm/drm_fb_helper.h |  8 +
  2 files changed, 82 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 116d1f1337c7..e0f95f2cc52f 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -41,6 +41,7 @@
  #include 
  #include 
  
+#include "drm_crtc_internal.h"

  #include "drm_crtc_helper_internal.h"
  
  static bool drm_fbdev_emulation = true;

@@ -350,6 +351,7 @@ EXPORT_SYMBOL(drm_fb_helper_debug_leave);
  static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool 
active)
  {
struct drm_device *dev = fb_helper->dev;
+   struct drm_plane_state *plane_state;
struct drm_plane *plane;
struct drm_atomic_state *state;
int i, ret;
@@ -368,8 +370,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper 
*fb_helper, bool activ
  retry:
plane_mask = 0;
drm_for_each_plane(plane, dev) {
-   struct drm_plane_state *plane_state;
-
plane_state = drm_atomic_get_plane_state(state, plane);
if (IS_ERR(plane_state)) {
ret = PTR_ERR(plane_state);
@@ -392,6 +392,11 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper 
*fb_helper, bool activ
  
  	for (i = 0; i < fb_helper->crtc_count; i++) {

struct drm_mode_set *mode_set = 
&fb_helper->crtc_info[i].mode_set;
+   struct drm_plane *primary = mode_set->crtc->primary;
+
+   /* Cannot fail as we've already gotten the plane state above */
+   plane_state = drm_atomic_get_new_plane_state(state, primary);
+   plane_state->rotation = fb_helper->crtc_info[i].rotation;
  
  		ret = __drm_atomic_helper_set_config(mode_set, state);

if (ret != 0)
@@ -2334,6 +2339,57 @@ static int drm_pick_crtcs(struct drm_fb_helper 
*fb_helper,
return best_score;
  }
  
+/*

+ * This function checks if rotation is necessary because of panel orientation
+ * and if it is, if it is supported.
+ * If rotation is necessary and supported, its gets set in fb_crtc.rotation.
+ * If rotation is necessary but not supported, a DRM_MODE_ROTATE_* flag gets
+ * or-ed into fb_helper->rotations. In drm_setup_crtcs_fb() we check if only
+ * one bit is set and then we set fb_info.fbcon_rotate_hint to make fbcon do
+ * the unsupported rotation.
+ */
+static void drm_setup_crtc_rotation(struct drm_fb_helper *fb_helper,
+   struct drm_fb_helper_crtc *fb_crtc,
+   struct drm_connector *connector)
+{
+   struct drm_plane *plane = fb_crtc->mode_set.crtc->primary;
+   uint64_t valid_mask = 0;
+   int i, rotation;
+
+   fb_crtc->rotation = DRM_MODE_ROTATE_0;
+
+   switch (connector->display_info.panel_orientation) {
+   case DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP:
+   rotation = DRM_MODE_ROTATE_180;
+   break;
+   case DRM_MODE_PANEL_ORIENTATION_LEFT_UP:
+   rotation = DRM_MODE_ROTATE_90;
+   break;
+   case DRM_MODE_PANEL_ORIENTATION_RIGHT_UP:
+   rotation = DRM_MODE_ROTATE_270;
+   break;


For 90/270 hw rotation you need to flip the coordinates/sizes of the fb.


You're probably right, I don't have any hardware supporting
270 degree rotation to test this with.


+   default:
+   rotation = DRM_MODE_ROTATE_0;
+   }
+
+   if (rotation == DRM_MODE_ROTATE_0 || !plane->rotation_property) {
+   fb_helper->rotations |= rotation;
+   return;
+   }
+
+   for (i = 0; i < plane->rotation_property->num_values; i++)
+   valid_mask |= (1ULL << plane->rotation_property->values[i]);


This isn't a good enough check for atomic drivers (and not for gen9+ intel
hw), since we might expose 90° rotations, but it only works if you have
the correct tiling format.

For atomic drivers it'd be really good if we could do a TEST_ONLY commit
first, and if that fails, fall back to sw rotation.

But that poses a bit a chicken&egg with creating the framebuffer (we need

Re: [Intel-gfx] [PATCH v3 6/7] efifb: Set info->fbcon_rotate_hint based on drm_get_panel_orientation_quirk

2017-10-30 Thread Hans de Goede

Hi,

On 30-10-17 10:53, Daniel Vetter wrote:

On Mon, Oct 23, 2017 at 09:14:24AM +0200, Hans de Goede wrote:

On some hardware the LCD panel is not mounted upright in the casing,
but rotated by 90 degrees. In this case we want the console to
automatically be rotated to compensate.

The drm subsys has a quirk table for this, use the
drm_get_panel_orientation_quirk function to get the panel orientation
and set info->fbcon_rotate_hint based on this, so that the fbcon console
on top of efifb gets automatically rotated to compensate for the panel
orientation.

Signed-off-by: Hans de Goede 
---
  drivers/video/fbdev/Kconfig |  1 +
  drivers/video/fbdev/efifb.c | 21 -
  2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 5e58f5ec0a28..c4a90c497839 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -772,6 +772,7 @@ config FB_VESA
  config FB_EFI
bool "EFI-based Framebuffer Support"
depends on (FB = y) && !IA64 && EFI
+   select DRM_PANEL_ORIENTATION_QUIRKS
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
index 3a010641f630..8c7f6aeee205 100644
--- a/drivers/video/fbdev/efifb.c
+++ b/drivers/video/fbdev/efifb.c
@@ -15,6 +15,8 @@
  #include 
  #include 
  #include 
+#include  /* For drm_get_panel_orientation_quirk */
+#include   /* For DRM_MODE_PANEL_ORIENTATION_* */
  
  static bool request_mem_succeeded = false;

  static bool nowc = false;
@@ -156,7 +158,7 @@ static u64 bar_offset;
  static int efifb_probe(struct platform_device *dev)
  {
struct fb_info *info;
-   int err;
+   int err, orientation;
unsigned int size_vmode;
unsigned int size_remap;
unsigned int size_total;
@@ -328,6 +330,23 @@ static int efifb_probe(struct platform_device *dev)
info->fix = efifb_fix;
info->flags = FBINFO_FLAG_DEFAULT | FBINFO_MISC_FIRMWARE;
  
+	orientation = drm_get_panel_orientation_quirk(efifb_defined.xres,

+ efifb_defined.yres);


Oh right, that's the reason for the separate function. Still ugh.


Ack.


Maybe add a comment in the kernel-doc for why it is what it is ...


Ok I will add a comment to the kernel-doc for drm_get_panel_orientation_quirk()
in v4 of this patch-set.

Regards,

Hans




-Daniel


+   switch (orientation) {
+   default:
+   info->fbcon_rotate_hint = FB_ROTATE_UR;
+   break;
+   case DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP:
+   info->fbcon_rotate_hint = FB_ROTATE_UD;
+   break;
+   case DRM_MODE_PANEL_ORIENTATION_LEFT_UP:
+   info->fbcon_rotate_hint = FB_ROTATE_CCW;
+   break;
+   case DRM_MODE_PANEL_ORIENTATION_RIGHT_UP:
+   info->fbcon_rotate_hint = FB_ROTATE_CW;
+   break;
+   }
+
err = sysfs_create_groups(&dev->dev.kobj, efifb_groups);
if (err) {
pr_err("efifb: cannot add sysfs attrs\n");
--
2.14.2

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



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


Re: [Intel-gfx] [PATCH v2 2/2] Test case for drm_vblank_cleanup refcount validation patch

2017-10-30 Thread PrasannaKumar Muralidharan
Hi Daniel,

On 30 October 2017 at 15:40, Daniel Vetter  wrote:
> On Wed, Oct 25, 2017 at 08:44:45PM +0530, PrasannaKumar Muralidharan wrote:
>> Hi All,
>>
>> On 24 October 2017 at 22:18, PrasannaKumar Muralidharan
>>  wrote:
>> > In i915 driver unload drm_vblank_get is added to test whether
>> > drm_vblank_cleanup refcount validation patch is working.
>> >
>> > Signed-off-by: PrasannaKumar Muralidharan 
>> > ---
>> > Changes in v2:
>> > Use drm_crtc_vblank_get instead of _put. In previous patch _put was wrongly
>> > used.
>> >
>> >  drivers/gpu/drm/i915/i915_drv.c | 7 +++
>> >  1 file changed, 7 insertions(+)
>> >
>> > diff --git a/drivers/gpu/drm/i915/i915_drv.c 
>> > b/drivers/gpu/drm/i915/i915_drv.c
>> > index 9f45cfe..4aee1c0 100644
>> > --- a/drivers/gpu/drm/i915/i915_drv.c
>> > +++ b/drivers/gpu/drm/i915/i915_drv.c
>> > @@ -1373,6 +1373,13 @@ void i915_driver_unload(struct drm_device *dev)
>> > struct drm_i915_private *dev_priv = to_i915(dev);
>> > struct pci_dev *pdev = dev_priv->drm.pdev;
>> >
>> > +   enum pipe pipe;
>> > +   for_each_pipe(dev_priv, pipe) {
>> > +   struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv,
>> > + pipe);
>> > +   drm_crtc_vblank_get(&crtc->base);
>> > +   }
>> > +
>> > i915_driver_unregister(dev_priv);
>> >
>> > if (i915_gem_suspend(dev_priv))
>> > --
>> > 2.10.0
>> >
>>
>> From 
>> https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6167/fi-ilk-650/igt@drv_module_rel...@basic-reload.html
>> it can be seen that this patch triggers warning when vblank->refcount
>> > 0 in vblank cleanup. This tests patch 1 successfully.
>>
>> I think patch 1 is good to go.
>
> Yeah it works, but we don't know whether it breaks anything yet. Can you
> pls resubmit just the first patch? Abusing CI was just an idea to get it
> fully tested, before we can merge it still needs to pass full CI. We just
> had an issue 2 weeks ago where CI blew up because an untested patch landed
> that broke every test :-/
> -Daniel
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

I have already sent that patch alone. Please look at
https://patchwork.freedesktop.org/patch/184866/.

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


Re: [PATCH] drm/vgem: Fix vgem_init to get drm device avaliable.

2017-10-30 Thread Sean Paul
On Wed, Oct 25, 2017 at 04:02:26PM -0700, Deepak Sharma wrote:
> From: Deepak Sharma 
> 
> Modify vgem_init to take platform dev as parent in drm_dev_init.
> This will make drm device available at "/sys/devices/platform/vgem"
> in x86 chromebook.
> 
> Signed-off-by: Deepak Sharma 

Reviewed-by: Sean Paul 

> ---
>  drivers/gpu/drm/vgem/vgem_drv.c | 15 +++
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
> index c938af8c40cf..17e2eafc62b8 100644
> --- a/drivers/gpu/drm/vgem/vgem_drv.c
> +++ b/drivers/gpu/drm/vgem/vgem_drv.c
> @@ -471,31 +471,30 @@ static int __init vgem_init(void)
>   if (!vgem_device)
>   return -ENOMEM;
>  
> - ret = drm_dev_init(&vgem_device->drm, &vgem_driver, NULL);
> - if (ret)
> - goto out_free;
> -
>   vgem_device->platform =
>   platform_device_register_simple("vgem", -1, NULL, 0);
>   if (IS_ERR(vgem_device->platform)) {
>   ret = PTR_ERR(vgem_device->platform);
> - goto out_fini;
> + goto out_free;
>   }
>  
>   dma_coerce_mask_and_coherent(&vgem_device->platform->dev,
>DMA_BIT_MASK(64));
> + ret = drm_dev_init(&vgem_device->drm, &vgem_driver, 
> &vgem_device->platform->dev);
> + if (ret)
> + goto out_unregister;
>  
>   /* Final step: expose the device/driver to userspace */
>   ret  = drm_dev_register(&vgem_device->drm, 0);
>   if (ret)
> - goto out_unregister;
> + goto out_fini;
>  
>   return 0;
>  
> -out_unregister:
> - platform_device_unregister(vgem_device->platform);
>  out_fini:
>   drm_dev_fini(&vgem_device->drm);
> +out_unregister:
> + platform_device_unregister(vgem_device->platform);
>  out_free:
>   kfree(vgem_device);
>   return ret;
> -- 
> 2.14.2
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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


[PATCH] MAINTAINERS: Gustavo as drm-misc co-maintainer

2017-10-30 Thread Daniel Vetter
Gustavo volunteered to become a drm-misc co-maintainer, he'll take
care of 4.16 to get started.

Cc: Gustavo Padovan 
Cc: Daniel Vetter 
Cc: Sean Paul 
Cc: Jani Nikula 
Cc: Dave Airlie 
Signed-off-by: Daniel Vetter 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 7ef2b786292e..42b6abb8ab17 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4498,6 +4498,7 @@ F:include/linux/vga*
 DRM DRIVERS AND MISC GPU PATCHES
 M: Daniel Vetter 
 M: Jani Nikula 
+M: Gustavo Padovan 
 M: Sean Paul 
 W: https://01.org/linuxgraphics/gfx-docs/maintainer-tools/drm-misc.html
 S: Maintained
-- 
2.15.0.rc1

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


Re: [PATCH resend v3 0/3] drm/i915: Misc. PMIC bus access notifier fixes

2017-10-30 Thread Hans de Goede

Hi,

On 19-10-17 10:34, Hans de Goede wrote:

Hi All,

Here is a resend of the first 3 of the 4 patches in my Misc. PMIC bus
access notifier fixes series. I'm leaving out the 4th patch this time,
because that includes some changes to the iosf_mbi code under arch/x86
and that has been blocking this series from getting upstream sofar.

I will send out a new version of the 4th patch with the iosf_mbi changes
split out seperately.


Ping? It would be good to get these 3 fixes upstream.

Regards,

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


Re: [PATCH v5 1/2] x86 / i915 iosf_mbi / PMIC bus access fixes

2017-10-30 Thread Hans de Goede

Thomas, Ingo,

Ping? Can we please get an ack for taking this upstream
through the drm subsys tree ?

Regards,

Hans


On 19-10-17 13:16, Hans de Goede wrote:

Hi All,

Here is a split-up version of my "drm/i915: Acquire PUNIT->PMIC bus for
intel_uncore_forcewake_reset()" patch, this time with the
arch/x86/platform/intel/iosf_mbi.c split out into a separate patch.

Since the iosf_mbi changes are fairly isolated, ideally this entire
series would go upstream through the drm tree. X86 maintainers, can
we have an ack for that from one of you please ?

Regards,

Hans


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


[PATCH] drm/TODO: Clarify DRM_DEV_* conversion

2017-10-30 Thread Daniel Vetter
Not everyone agrees this is the best thing, so make it really clear
that maintainers need to be asked first, then the conversion. We've
had a few newbies that did this the other way round, got their patches
rejected, which isn't the best newbie experience.

Cc: Sean Paul 
Signed-off-by: Daniel Vetter 
---
 Documentation/gpu/todo.rst | 4 
 1 file changed, 4 insertions(+)

diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
index 96f8ec7dbe4e..e9840d693a86 100644
--- a/Documentation/gpu/todo.rst
+++ b/Documentation/gpu/todo.rst
@@ -179,6 +179,10 @@ don't do this, drivers used dev_info/warn/err to make this 
differentiation. We
 now have DRM_DEV_* variants of the drm print macros, so we can start to convert
 those drivers back to using drm-formwatted specific log messages.
 
+Before you start this conversion please contact the relevant maintainers to 
make
+sure your work will be merged - not everyone agrees that the DRM dmesg macros
+are better.
+
 Contact: Sean Paul, Maintainer of the driver you plan to convert
 
 Core refactorings
-- 
2.15.0.rc1

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


Re: [PATCH 1/2] drm/rcar-du: Use common error handling code in rcar_du_encoders_init()

2017-10-30 Thread Laurent Pinchart
Hi Jani,

On Monday, 30 October 2017 11:52:07 EET Jani Nikula wrote:
> On Sun, 29 Oct 2017, Laurent Pinchart wrote:
> > On Friday, 27 October 2017 21:45:17 EET Jani Nikula wrote:
> >> On Tue, 24 Oct 2017, SF Markus Elfring wrote:
> >>> Add a jump target so that a bit of exception handling can be better
> >>> reused at the end of this function.
> >>> 
> >>> This issue was detected by using the Coccinelle software.
> >> 
> >> Please also look into the GCC software, which will detect that your
> >> patch does not compile.
> > 
> > Just for the record, I've been bitten in the past by applying one of
> > Markus' patches that seemed to make sense, only to discover later that it
> > introduced a security hole. I now drop his patches altogether, so could
> > you please keep an eye open to make sure none of them touching the
> > rcar-du driver will be applied through drm-misc ?
> 
> Ack. You're the maintainer, and we need to respect that.
> 
> In general, I'll pick up any patches that are good, but the current
> track record is that Markus' patches need extra scrutiny, and many of
> the patches contain subjective changes that lead to debate that is not
> constructive. There's no return on investment here.

That's how I see it too. If there's an important fix I'll look into it, but 
patches that have little value are just a waste of bandwidth.

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH] drm/vgem: Fix vgem_init to get drm device avaliable.

2017-10-30 Thread Emil Velikov
On 26 October 2017 at 00:02, Deepak Sharma  wrote:
> From: Deepak Sharma 
>
> Modify vgem_init to take platform dev as parent in drm_dev_init.
> This will make drm device available at "/sys/devices/platform/vgem"
> in x86 chromebook.
>
Shouldn't one update the drm_dev_init/drm_dev_alloc documentation
while doing this?
But more importantly, this will change the "unique" string (see
drm_dev_set_unique).

The topic around it rather convoluted and messy, so please check this
change doesn't cause subtle regressions.
There's a doc hunk in drm_ioctl.c to begin with, plus userspace such
as IGT [1] might rely on the current behaviour.

HTH
Emil

[1] https://cgit.freedesktop.org/drm/igt-gpu-tools/
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm: Fix checkpatch issue: "WARNING: braces {} are not necessary for single statement blocks."

2017-10-30 Thread Vitor Massaru Iha
Signed-off-by: Vitor Massaru Iha 
---
 drivers/gpu/drm/arm/hdlcd_crtc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
index 72b22b805412..5a5427bbd70e 100644
--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
@@ -317,9 +317,8 @@ static struct drm_plane *hdlcd_plane_init(struct drm_device 
*drm)
   formats, ARRAY_SIZE(formats),
   NULL,
   DRM_PLANE_TYPE_PRIMARY, NULL);
-   if (ret) {
+   if (ret)
return ERR_PTR(ret);
-   }
 
drm_plane_helper_add(plane, &hdlcd_plane_helper_funcs);
hdlcd->plane = plane;
-- 
2.13.6

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


Re: [PATCH] MAINTAINERS: Gustavo as drm-misc co-maintainer

2017-10-30 Thread Jani Nikula
On Mon, 30 Oct 2017, Daniel Vetter  wrote:
> Gustavo volunteered to become a drm-misc co-maintainer, he'll take
> care of 4.16 to get started.
>
> Cc: Gustavo Padovan 
> Cc: Daniel Vetter 
> Cc: Sean Paul 
> Cc: Jani Nikula 
> Cc: Dave Airlie 
> Signed-off-by: Daniel Vetter 

Acked-by: Jani Nikula 

Welcome on board!

BR,
Jani.

> ---
>  MAINTAINERS | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 7ef2b786292e..42b6abb8ab17 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -4498,6 +4498,7 @@ F:  include/linux/vga*
>  DRM DRIVERS AND MISC GPU PATCHES
>  M:   Daniel Vetter 
>  M:   Jani Nikula 
> +M:   Gustavo Padovan 
>  M:   Sean Paul 
>  W:   https://01.org/linuxgraphics/gfx-docs/maintainer-tools/drm-misc.html
>  S:   Maintained

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


Re: [PATCH 1/3] dt-bindings: display/ti: Add optional property to set memory bandwidth limit

2017-10-30 Thread Peter Ujfalusi
Rob,

On 10/27/2017 05:27 AM, Rob Herring wrote:
> On Fri, Oct 20, 2017 at 04:12:56PM +0300, Peter Ujfalusi wrote:
>> max-memory-bandwidth can be used to specify the maximum bandwidth dispc
>> can use when reading display data from main memory.
>>
>> In some SoC (am437x for example) we have memory bandwidth limitation
>> which causes underflow in the display subsystem.
>>
>> Signed-off-by: Peter Ujfalusi 
>> ---
>>  Documentation/devicetree/bindings/display/ti/ti,dra7-dss.txt  | 5 +
>>  Documentation/devicetree/bindings/display/ti/ti,omap2-dss.txt | 4 
>>  Documentation/devicetree/bindings/display/ti/ti,omap3-dss.txt | 4 
>>  Documentation/devicetree/bindings/display/ti/ti,omap4-dss.txt | 4 
>>  Documentation/devicetree/bindings/display/ti/ti,omap5-dss.txt | 4 
>>  5 files changed, 21 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/display/ti/ti,dra7-dss.txt 
>> b/Documentation/devicetree/bindings/display/ti/ti,dra7-dss.txt
>> index c30f9ec189ed..91279f1060fe 100644
>> --- a/Documentation/devicetree/bindings/display/ti/ti,dra7-dss.txt
>> +++ b/Documentation/devicetree/bindings/display/ti/ti,dra7-dss.txt
>> @@ -47,6 +47,11 @@ Required properties:
>>  - clocks: handle to fclk
>>  - clock-names: "fck"
>>  
>> +Optional properties:
>> +- max-memory-bandwidth: Input memory (from main memory to dispc) bandwidth 
>> limit
>> +in bytes per second
> 
> Can we move this to a common location since we already have the same 
> prop for ARM pl11x.

This is why I used the same string for ti,* as I saw that pl11x have it
documented (the driver is not supporting it afaik, it is in the TODO).

I don't see any generic documentation for Display, not sure what would be the
best place for things like this.

While it is true that memory bandwidth limit can be a generic property, but it
might (not sure about it) can apply to different interfaces among different
vendors. The device specific documentation should either way need to mention
that it supports memory bandwidth limitation or not.

-- 
Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] MAINTAINERS: Gustavo as drm-misc co-maintainer

2017-10-30 Thread Sean Paul
On Mon, Oct 30, 2017 at 9:10 AM, Daniel Vetter  wrote:
> Gustavo volunteered to become a drm-misc co-maintainer, he'll take
> care of 4.16 to get started.
>
> Cc: Gustavo Padovan 
> Cc: Daniel Vetter 
> Cc: Sean Paul 
> Cc: Jani Nikula 
> Cc: Dave Airlie 
> Signed-off-by: Daniel Vetter 

Acked-by: Sean Paul 

> ---
>  MAINTAINERS | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 7ef2b786292e..42b6abb8ab17 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -4498,6 +4498,7 @@ F:include/linux/vga*
>  DRM DRIVERS AND MISC GPU PATCHES
>  M: Daniel Vetter 
>  M: Jani Nikula 
> +M: Gustavo Padovan 
>  M: Sean Paul 
>  W: https://01.org/linuxgraphics/gfx-docs/maintainer-tools/drm-misc.html
>  S: Maintained
> --
> 2.15.0.rc1
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/ttm: once more fix ttm_buffer_object_transfer

2017-10-30 Thread Christian König
From: Christian König 

When the mutex is locked just in the moment we copy it we end up with a
warning that we release a locked mutex.

Fix this by properly reinitializing the mutex.

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

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c 
b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 78cb99be7146..e7a519f1849b 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -474,6 +474,7 @@ static int ttm_buffer_object_transfer(struct 
ttm_buffer_object *bo,
INIT_LIST_HEAD(&fbo->lru);
INIT_LIST_HEAD(&fbo->swap);
INIT_LIST_HEAD(&fbo->io_reserve_lru);
+   mutex_init(&fbo->wu_mutex);
fbo->moving = NULL;
drm_vma_node_reset(&fbo->vma_node);
atomic_set(&fbo->cpu_writers, 0);
-- 
2.11.0

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


Re: [PATCH] drm/ttm: once more fix ttm_buffer_object_transfer

2017-10-30 Thread Dieter Nützel

Hello Christian,

is this for these warnings flooding my dmesg-log or do I have to open a 
new ticket:


Current amd-staging-drm-next commit #7781a8c68a6a from you ;-)

[ 6588.429302] WARNING: CPU: 5 PID: 2957 at 
drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h:132 
generic_reg_update_ex+0xdc/0x120 [amdgpu]
[ 6588.429303] Modules linked in: fuse rfcomm rpcsec_gss_krb5 
auth_rpcgss nfsv4 nf_log_ipv6 xt_comment nf_log_ipv4 nf_log_common 
xt_LOG xt_limit dns_resolver nfs lockd nfnetlink_cthelper nfnetlink 
grace sunrpc fscache af_packet ipmi_ssif iscsi_ibft iscsi_boot_sysfs 
ip6t_REJECT nf_reject_ipv6 nf_conntrack_ipv6 nf_defrag_ipv6 ipt_REJECT 
nf_reject_ipv4 xt_pkttype xt_tcpudp iptable_filter ip6table_mangle 
nf_conntrack_netbios_ns nf_conntrack_broadcast nf_conntrack_ipv4 
nf_defrag_ipv4 ip_tables xt_conntrack nf_conntrack libcrc32c bnep 
ip6table_filter ip6_tables x_tables jc42 joydev snd_hda_codec_hdmi 
snd_hda_intel intel_powerclamp coretemp snd_hda_codec kvm_intel 
snd_hwdep kvm snd_hda_core snd_pcm e1000e iTCO_wdt hid_generic snd_timer 
iTCO_vendor_support snd usbhid irqbypass btusb crc32c_intel btrtl btbcm
[ 6588.429340]  pcspkr ptp soundcore btintel bluetooth pps_core 
i7core_edac i2c_i801 tpm_infineon tpm_tis lpc_ich shpchp tpm_tis_core 
ipmi_si tpm ipmi_devintf ipmi_msghandler ac button rfkill ecdh_generic 
acpi_cpufreq tcp_bbr raid1 md_mod amdkfd amd_iommu_v2 serio_raw amdgpu 
sr_mod cdrom chash i2c_algo_bit drm_kms_helper syscopyarea ehci_pci 
sysfillrect sysimgblt ehci_hcd fb_sys_fops mpt3sas raid_class ttm 
scsi_transport_sas usbcore drm sg dm_multipath dm_mod scsi_dh_rdac 
scsi_dh_emc scsi_dh_alua
[ 6588.429370] CPU: 5 PID: 2957 Comm: X Tainted: GW   
4.13.0-rc5-1.g7262353-default+ #1
[ 6588.429371] Hardware name: FUJITSU  PRIMERGY 
TX150 S7 /D2759, BIOS 6.00 Rev. 1.19.2759.A1   
09/26/2012

[ 6588.429373] task: 8841a3658080 task.stack: 9ce4c3c38000
[ 6588.429426] RIP: 0010:generic_reg_update_ex+0xdc/0x120 [amdgpu]
[ 6588.429427] RSP: 0018:9ce4c3c3b760 EFLAGS: 00010246
[ 6588.429429] RAX: 0030 RBX:  RCX: 

[ 6588.429430] RDX: 0001 RSI:  RDI: 
8841a36c1980
[ 6588.429431] RBP: 9ce4c3c3b7c8 R08: 00ff R09: 
9ce4c3c3b778
[ 6588.429432] R10:  R11: 0002 R12: 
9ce4c3c3b7f8
[ 6588.429433] R13:  R14:  R15: 

[ 6588.429436] FS:  7f206d780a40() GS:8841bfd4() 
knlGS:

[ 6588.429437] CS:  0010 DS:  ES:  CR0: 80050033
[ 6588.429439] CR2: 7f745636a000 CR3: 0006654a5000 CR4: 
06e0

[ 6588.429439] Call Trace:
[ 6588.429498]  dce_mi_program_pte_vm+0x211/0x270 [amdgpu]
[ 6588.429555]  dce110_program_front_end_for_pipe+0x256/0x370 [amdgpu]
[ 6588.429613]  dce110_apply_ctx_for_surface+0xda/0x200 [amdgpu]
[ 6588.429668]  dc_commit_updates_for_stream+0x46a/0x4e0 [amdgpu]
[ 6588.429725]  dc_commit_planes_to_stream+0x322/0x380 [amdgpu]
[ 6588.429783]  amdgpu_dm_atomic_commit_tail+0x72a/0xaf0 [amdgpu]
[ 6588.429787]  ? ww_mutex_unlock+0x26/0x30
[ 6588.429844]  ? dm_plane_helper_prepare_fb+0xd2/0x230 [amdgpu]
[ 6588.429853]  ? drm_atomic_helper_wait_for_dependencies+0x89/0x160 
[drm_kms_helper]
[ 6588.429861]  ? drm_atomic_helper_swap_state+0x18d/0x360 
[drm_kms_helper]

[ 6588.429868]  commit_tail+0x3f/0x60 [drm_kms_helper]
[ 6588.429875]  drm_atomic_helper_commit+0x106/0x110 [drm_kms_helper]
[ 6588.429931]  amdgpu_dm_atomic_commit+0x8d/0xa0 [amdgpu]
[ 6588.429948]  drm_atomic_commit+0x4b/0x50 [drm]
[ 6588.429957]  drm_atomic_helper_legacy_gamma_set+0x114/0x150 
[drm_kms_helper]

[ 6588.429971]  drm_mode_gamma_set_ioctl+0x127/0x190 [drm]
[ 6588.429985]  ? drm_mode_crtc_set_gamma_size+0xb0/0xb0 [drm]
[ 6588.429997]  drm_ioctl_kernel+0x5d/0xb0 [drm]
[ 6588.430009]  drm_ioctl+0x31a/0x3d0 [drm]
[ 6588.430024]  ? drm_mode_crtc_set_gamma_size+0xb0/0xb0 [drm]
[ 6588.430027]  ? vfs_writev+0xaa/0xf0
[ 6588.430063]  amdgpu_drm_ioctl+0x4f/0x90 [amdgpu]
[ 6588.430065]  do_vfs_ioctl+0x92/0x5c0
[ 6588.430067]  ? __fget+0x6e/0x90
[ 6588.430069]  ? __fget+0x6e/0x90
[ 6588.430071]  SyS_ioctl+0x79/0x90
[ 6588.430075]  entry_SYSCALL_64_fastpath+0x1e/0xa9
[ 6588.430077] RIP: 0033:0x7f206b0fa077
[ 6588.430078] RSP: 002b:7ffd89a37978 EFLAGS: 3246 ORIG_RAX: 
0010
[ 6588.430080] RAX: ffda RBX: 00c3495ed210 RCX: 
7f206b0fa077
[ 6588.430081] RDX: 7ffd89a379b0 RSI: c02064a5 RDI: 
000d
[ 6588.430082] RBP: 00c34a30a690 R08: 00c349740ce0 R09: 
00c349740ee0
[ 6588.430083] R10: 0001 R11: 3246 R12: 
00c3488cd300
[ 6588.430084] R13: 00c34a30a690 R14: 00c34a6c3980 R15: 
0020
[ 6588.430086] Code: 45 21 e8 44 31 c3 41 39 d3 75 ab 45 84 d2 75 45 48 
8b 7f 18 89 da 48 8b 07 ff 50 38 48 83 c4 48 89 d8 5b 41 5a 41 5c 4

[Bug 103404] HDMI Audio with RX Vega not working on drm-next-4.15-dc (device listed as unconnected)

2017-10-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103404

--- Comment #5 from Harry Wentland  ---
It looks like we missed this when bringing up Vega. We got a patch in the
works. It should land sometime this week.

-- 
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: WARNING in drm_modeset_lock_all

2017-10-30 Thread Chris Wilson
Quoting syzbot (2017-10-27 09:09:50)
> Hello,
> 
> syzkaller hit the following crash on  
> 6f20b7a58cb9c0fe00badcdfd65b1f4a8f28dfc6
> git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master
> compiler: gcc (GCC) 7.1.1 20170620
> .config is attached
> Raw console output is attached.
> 
> 
> 
> 
> [ cut here ]
> WARNING: CPU: 2 PID: 11675 at drivers/gpu/drm/drm_modeset_lock.c:92  
> drm_modeset_lock_all+0x1fc/0x2d0 drivers/gpu/drm/drm_modeset_lock.c:92
> Kernel panic - not syncing: panic_on_warn set ...
> 
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
> Call Trace:
>   __dump_stack lib/dump_stack.c:16 [inline]
>   dump_stack+0x194/0x257 lib/dump_stack.c:52
>   fail_dump lib/fault-inject.c:51 [inline]
>   should_fail+0x8c0/0xa40 lib/fault-inject.c:149
>   should_failslab+0xec/0x120 mm/failslab.c:31
>   slab_pre_alloc_hook mm/slab.h:422 [inline]
>   slab_alloc mm/slab.c:3383 [inline]
>   kmem_cache_alloc_trace+0x4b/0x750 mm/slab.c:3625
>   kmalloc include/linux/slab.h:493 [inline]
>   kzalloc include/linux/slab.h:666 [inline]
>   drm_modeset_lock_all+0x49/0x2d0 drivers/gpu/drm/drm_modeset_lock.c:91
>   drm_mode_obj_get_properties_ioctl+0x87/0x2b0  
> drivers/gpu/drm/drm_mode_object.c:359
>   drm_ioctl_kernel+0x1e7/0x2e0 drivers/gpu/drm/drm_ioctl.c:735
>   drm_ioctl+0x72e/0xa50 drivers/gpu/drm/drm_ioctl.c:831
>   vfs_ioctl fs/ioctl.c:45 [inline]
>   do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:685
>   SYSC_ioctl fs/ioctl.c:700 [inline]
>   SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691
>   entry_SYSCALL_64_fastpath+0x1f/0xbe

This bug is for the unexpected allocation failure inside
drm_modeset_lock_all() (in this case from should_fail). To properly
document this behaviour, we should probably use

diff --git a/drivers/gpu/drm/drm_modeset_lock.c 
b/drivers/gpu/drm/drm_modeset_lock.c
index e123497da0ca..963e23db0fe7 100644
--- a/drivers/gpu/drm/drm_modeset_lock.c
+++ b/drivers/gpu/drm/drm_modeset_lock.c
@@ -93,7 +93,7 @@ void drm_modeset_lock_all(struct drm_device *dev)
struct drm_modeset_acquire_ctx *ctx;
int ret;
 
-   ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
+   ctx = kzalloc(sizeof(*ctx), GFP_KERNEL | __GFP_NOFAIL);
if (WARN_ON(!ctx))
return;

Then it will turn up on somebody'ss too-small-to-fail fix list.
-Chris
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/2] dma-buf: keep only not signaled fence in reservation_object_add_shared_replace v2

2017-10-30 Thread Christian König
From: Christian König 

The amdgpu issue to also need signaled fences in the reservation objects
should be fixed by now.

Optimize the list by keeping only the not signaled yet fences around.

v2: temporary put the signaled fences at the end of the new container

Signed-off-by: Christian König 
---
 drivers/dma-buf/reservation.c | 36 ++--
 1 file changed, 26 insertions(+), 10 deletions(-)

diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
index b44d9d7db347..6fc794576997 100644
--- a/drivers/dma-buf/reservation.c
+++ b/drivers/dma-buf/reservation.c
@@ -145,8 +145,8 @@ reservation_object_add_shared_replace(struct 
reservation_object *obj,
  struct reservation_object_list *fobj,
  struct dma_fence *fence)
 {
-   unsigned i;
struct dma_fence *old_fence = NULL;
+   unsigned i, j, k;
 
dma_fence_get(fence);
 
@@ -162,9 +162,7 @@ reservation_object_add_shared_replace(struct 
reservation_object *obj,
 * references from the old struct are carried over to
 * the new.
 */
-   fobj->shared_count = old->shared_count;
-
-   for (i = 0; i < old->shared_count; ++i) {
+   for (i = 0, j = 0, k = fobj->shared_max; i < old->shared_count; ++i) {
struct dma_fence *check;
 
check = rcu_dereference_protected(old->shared[i],
@@ -172,10 +170,18 @@ reservation_object_add_shared_replace(struct 
reservation_object *obj,
 
if (!old_fence && check->context == fence->context) {
old_fence = check;
-   RCU_INIT_POINTER(fobj->shared[i], fence);
-   } else
-   RCU_INIT_POINTER(fobj->shared[i], check);
+   RCU_INIT_POINTER(fobj->shared[j++], fence);
+   } else if (!dma_fence_is_signaled(check)) {
+   RCU_INIT_POINTER(fobj->shared[j++], check);
+   } else {
+   /*
+* Temporary save the signaled fences at the end of the
+* new container
+*/
+   RCU_INIT_POINTER(fobj->shared[--k], check);
+   }
}
+   fobj->shared_count = j;
if (!old_fence) {
RCU_INIT_POINTER(fobj->shared[fobj->shared_count], fence);
fobj->shared_count++;
@@ -192,10 +198,20 @@ reservation_object_add_shared_replace(struct 
reservation_object *obj,
write_seqcount_end(&obj->seq);
preempt_enable();
 
-   if (old)
-   kfree_rcu(old, rcu);
-
dma_fence_put(old_fence);
+
+   if (!old)
+   return;
+
+   /* Drop the references to the signaled fences */
+   for (i = k; i < fobj->shared_max; ++i) {
+   struct dma_fence *f;
+
+   f = rcu_dereference_protected(fobj->shared[i],
+ reservation_object_held(obj));
+   dma_fence_put(f);
+   }
+   kfree_rcu(old, rcu);
 }
 
 /**
-- 
2.11.0

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


[PATCH 2/2] dma-buf: try to replace a signaled fence in reservation_object_add_shared_inplace

2017-10-30 Thread Christian König
From: Christian König 

The amdgpu issue to also need signaled fences in the reservation objects should
be fixed by now.

Optimize the handling by replacing a signaled fence when adding a new
shared one.

Signed-off-by: Christian König 
---
 drivers/dma-buf/reservation.c | 18 +++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
index 6fc794576997..a3928ce9f311 100644
--- a/drivers/dma-buf/reservation.c
+++ b/drivers/dma-buf/reservation.c
@@ -104,7 +104,8 @@ reservation_object_add_shared_inplace(struct 
reservation_object *obj,
  struct reservation_object_list *fobj,
  struct dma_fence *fence)
 {
-   u32 i;
+   struct dma_fence *signaled = NULL;
+   u32 i, signaled_idx;
 
dma_fence_get(fence);
 
@@ -126,17 +127,28 @@ reservation_object_add_shared_inplace(struct 
reservation_object *obj,
dma_fence_put(old_fence);
return;
}
+
+   if (!signaled && dma_fence_is_signaled(old_fence)) {
+   signaled = old_fence;
+   signaled_idx = i;
+   }
}
 
/*
 * memory barrier is added by write_seqcount_begin,
 * fobj->shared_count is protected by this lock too
 */
-   RCU_INIT_POINTER(fobj->shared[fobj->shared_count], fence);
-   fobj->shared_count++;
+   if (signaled) {
+   RCU_INIT_POINTER(fobj->shared[signaled_idx], fence);
+   } else {
+   RCU_INIT_POINTER(fobj->shared[fobj->shared_count], fence);
+   fobj->shared_count++;
+   }
 
write_seqcount_end(&obj->seq);
preempt_enable();
+
+   dma_fence_put(signaled);
 }
 
 static void
-- 
2.11.0

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


Re: [Intel-gfx] [PATCH v2 1/2] drm/dp: Bit definition for D3 power state that keeps AUX fully powered

2017-10-30 Thread Jani Nikula
On Fri, 27 Oct 2017, Ville Syrjälä  wrote:
> On Fri, Oct 27, 2017 at 01:25:01PM +0300, Jani Nikula wrote:
>> On Mon, 14 Aug 2017, Harry Wentland  wrote:
>> > On 2017-08-11 02:10 PM, Dhinakaran Pandiyan wrote:
>> >> DPCD 600h - SET_POWER & SET_DP_PWR_VOLTAGE defines power state
>> >> 
>> >> 101 = Set Main-Link for local Sink device and all downstream Sink
>> >> devices to D3 (power-down mode), keep AUX block fully powered, ready to
>> >> reply within a Response Timeout period of 300us.
>> >> 
>> >> This state is useful in a MST dock + MST monitor configuration that
>> >> doesn't wake up from D3 state.
>> >> 
>> >> v2: Use spaces instead of tabs (Jani)
>> >> 
>> >> Signed-off-by: Dhinakaran Pandiyan 
>> >
>> > Reviewed-by: Harry Wentland 
>> 
>> Pushed this one to drm-misc-next, thanks for the patch and review, and
>> sorry for the delay.
>
> Sorry to start reviewing after this got pushed, but...
>
>> 
>> BR,
>> Jani.
>> 
>> >
>> > Harry
>> >
>> >> ---
>> >>  include/drm/drm_dp_helper.h | 1 +
>> >>  1 file changed, 1 insertion(+)
>> >> 
>> >> diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
>> >> index b17476a..47a6cdb 100644
>> >> --- a/include/drm/drm_dp_helper.h
>> >> +++ b/include/drm/drm_dp_helper.h
>> >> @@ -618,6 +618,7 @@
>> >>  # define DP_SET_POWER_D00x1
>> >>  # define DP_SET_POWER_D30x2
>> >>  # define DP_SET_POWER_MASK  0x3
>
> This mask doesn't cover the "aux" bit. I guess it's a purely theoretical
> concern at this point since the device should start out in D0 when
> first plugged in.
>
> Also IIRC this stuff was added in DPCD 1.2. We might want a comment to
> reflect that fact.

Okay, the damage is done, someone(tm) please send fixup patches on top
to make it right.

BR,
Jani.



>
>> >> +# define DP_SET_POWER_D3_AUX_ON 0x5
>> >>  
>> >>  #define DP_EDP_DPCD_REV  0x700/* eDP 1.2 */
>> >>  # define DP_EDP_11   0x00
>> >> 
>> > ___
>> > Intel-gfx mailing list
>> > intel-...@lists.freedesktop.org
>> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>> 
>> -- 
>> Jani Nikula, Intel Open Source Technology Center
>> ___
>> Intel-gfx mailing list
>> intel-...@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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


[PATCH v2 05/15] drm/armada: Use drm_fb_helper_lastclose() and _poll_changed()

2017-10-30 Thread Noralf Trønnes
This driver can use drm_fb_helper_lastclose() as its .lastclose callback.
It can also use drm_fb_helper_output_poll_changed() as its
.output_poll_changed callback.

Cc: Russell King 
Signed-off-by: Noralf Trønnes 
Acked-by: Russell King 
---
 drivers/gpu/drm/armada/armada_drm.h   |  1 -
 drivers/gpu/drm/armada/armada_drv.c   |  8 ++--
 drivers/gpu/drm/armada/armada_fb.c| 11 +--
 drivers/gpu/drm/armada/armada_fbdev.c |  8 
 4 files changed, 3 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_drm.h 
b/drivers/gpu/drm/armada/armada_drm.h
index b064879ecdbd..cc4c557c9f66 100644
--- a/drivers/gpu/drm/armada/armada_drm.h
+++ b/drivers/gpu/drm/armada/armada_drm.h
@@ -84,7 +84,6 @@ void armada_drm_queue_unref_work(struct drm_device *,
 extern const struct drm_mode_config_funcs armada_drm_mode_config_funcs;
 
 int armada_fbdev_init(struct drm_device *);
-void armada_fbdev_lastclose(struct drm_device *);
 void armada_fbdev_fini(struct drm_device *);
 
 int armada_overlay_plane_create(struct drm_device *, unsigned long);
diff --git a/drivers/gpu/drm/armada/armada_drv.c 
b/drivers/gpu/drm/armada/armada_drv.c
index e857b88a9799..4b11b6b52f1d 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "armada_crtc.h"
 #include "armada_drm.h"
@@ -54,15 +55,10 @@ static struct drm_ioctl_desc armada_ioctls[] = {
DRM_IOCTL_DEF_DRV(ARMADA_GEM_PWRITE, armada_gem_pwrite_ioctl, 0),
 };
 
-static void armada_drm_lastclose(struct drm_device *dev)
-{
-   armada_fbdev_lastclose(dev);
-}
-
 DEFINE_DRM_GEM_FOPS(armada_drm_fops);
 
 static struct drm_driver armada_drm_driver = {
-   .lastclose  = armada_drm_lastclose,
+   .lastclose  = drm_fb_helper_lastclose,
.gem_free_object_unlocked = armada_gem_free_object,
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
diff --git a/drivers/gpu/drm/armada/armada_fb.c 
b/drivers/gpu/drm/armada/armada_fb.c
index a38d5a0892a9..ac92bce07ecd 100644
--- a/drivers/gpu/drm/armada/armada_fb.c
+++ b/drivers/gpu/drm/armada/armada_fb.c
@@ -154,16 +154,7 @@ static struct drm_framebuffer *armada_fb_create(struct 
drm_device *dev,
return ERR_PTR(ret);
 }
 
-static void armada_output_poll_changed(struct drm_device *dev)
-{
-   struct armada_private *priv = dev->dev_private;
-   struct drm_fb_helper *fbh = priv->fbdev;
-
-   if (fbh)
-   drm_fb_helper_hotplug_event(fbh);
-}
-
 const struct drm_mode_config_funcs armada_drm_mode_config_funcs = {
.fb_create  = armada_fb_create,
-   .output_poll_changed= armada_output_poll_changed,
+   .output_poll_changed= drm_fb_helper_output_poll_changed,
 };
diff --git a/drivers/gpu/drm/armada/armada_fbdev.c 
b/drivers/gpu/drm/armada/armada_fbdev.c
index a2ce83f84800..2a59db0994b2 100644
--- a/drivers/gpu/drm/armada/armada_fbdev.c
+++ b/drivers/gpu/drm/armada/armada_fbdev.c
@@ -159,14 +159,6 @@ int armada_fbdev_init(struct drm_device *dev)
return ret;
 }
 
-void armada_fbdev_lastclose(struct drm_device *dev)
-{
-   struct armada_private *priv = dev->dev_private;
-
-   if (priv->fbdev)
-   drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev);
-}
-
 void armada_fbdev_fini(struct drm_device *dev)
 {
struct armada_private *priv = dev->dev_private;
-- 
2.14.2

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


[PATCH v2 02/15] drm: Add drm_device->fb_helper pointer

2017-10-30 Thread Noralf Trønnes
drm_fb_helper is *the* way of doing fbdev emulation so add a pointer to
struct drm_device. This makes it possible to add callback helpers for
.last_close and .output_poll_changed further reducing fbdev emulation
footprint in drivers. The pointer is set by drm_fb_helper_init() and
cleared by drm_fb_helper_fini().

Signed-off-by: Noralf Trønnes 
Reviewed-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_fb_helper.c | 13 +++--
 include/drm/drm_device.h|  9 +
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 954cdd48de92..19aaca9fea06 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -799,8 +799,10 @@ int drm_fb_helper_init(struct drm_device *dev,
struct drm_mode_config *config = &dev->mode_config;
int i;
 
-   if (!drm_fbdev_emulation)
+   if (!drm_fbdev_emulation) {
+   dev->fb_helper = fb_helper;
return 0;
+   }
 
if (!max_conn_count)
return -EINVAL;
@@ -835,6 +837,8 @@ int drm_fb_helper_init(struct drm_device *dev,
i++;
}
 
+   dev->fb_helper = fb_helper;
+
return 0;
 out_free:
drm_fb_helper_crtc_free(fb_helper);
@@ -913,7 +917,12 @@ void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)
 {
struct fb_info *info;
 
-   if (!drm_fbdev_emulation || !fb_helper)
+   if (!fb_helper)
+   return;
+
+   fb_helper->dev->fb_helper = NULL;
+
+   if (!drm_fbdev_emulation)
return;
 
cancel_work_sync(&fb_helper->resume_work);
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index e21af87a2f3c..7c4fa32f3fc6 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -17,6 +17,7 @@ struct drm_vblank_crtc;
 struct drm_sg_mem;
 struct drm_local_map;
 struct drm_vma_offset_manager;
+struct drm_fb_helper;
 
 struct inode;
 
@@ -185,6 +186,14 @@ struct drm_device {
struct drm_vma_offset_manager *vma_offset_manager;
/*@} */
int switch_power_state;
+
+   /**
+* @fb_helper:
+*
+* Pointer to the fbdev emulation structure.
+* Set by drm_fb_helper_init() and cleared by drm_fb_helper_fini().
+*/
+   struct drm_fb_helper *fb_helper;
 };
 
 #endif
-- 
2.14.2

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


[PATCH v2 01/15] drm/fb-helper: Handle function NULL argument

2017-10-30 Thread Noralf Trønnes
Make functions tolerate that the drm_fb_helper argument is NULL.
This is useful for drivers that continue probing when fbdev emulation
fails and not having to do this check themselves.
Update docs for functions that already handles this.

Signed-off-by: Noralf Trønnes 
Reviewed-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_fb_helper.c | 28 +---
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 116d1f1337c7..954cdd48de92 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -150,6 +150,9 @@ int drm_fb_helper_add_one_connector(struct drm_fb_helper 
*fb_helper,
 {
int err;
 
+   if (!fb_helper)
+   return 0;
+
mutex_lock(&fb_helper->lock);
err = __drm_fb_helper_add_one_connector(fb_helper, connector);
mutex_unlock(&fb_helper->lock);
@@ -161,7 +164,7 @@ EXPORT_SYMBOL(drm_fb_helper_add_one_connector);
 /**
  * drm_fb_helper_single_add_all_connectors() - add all connectors to fbdev
  *emulation helper
- * @fb_helper: fbdev initialized with drm_fb_helper_init
+ * @fb_helper: fbdev initialized with drm_fb_helper_init, can be NULL
  *
  * This functions adds all the available connectors for use with the given
  * fb_helper. This is a separate step to allow drivers to freely assign
@@ -179,7 +182,7 @@ int drm_fb_helper_single_add_all_connectors(struct 
drm_fb_helper *fb_helper)
struct drm_connector_list_iter conn_iter;
int i, ret = 0;
 
-   if (!drm_fbdev_emulation)
+   if (!drm_fbdev_emulation || !fb_helper)
return 0;
 
mutex_lock(&fb_helper->lock);
@@ -245,6 +248,9 @@ int drm_fb_helper_remove_one_connector(struct drm_fb_helper 
*fb_helper,
 {
int err;
 
+   if (!fb_helper)
+   return 0;
+
mutex_lock(&fb_helper->lock);
err = __drm_fb_helper_remove_one_connector(fb_helper, connector);
mutex_unlock(&fb_helper->lock);
@@ -484,7 +490,7 @@ static int restore_fbdev_mode(struct drm_fb_helper 
*fb_helper)
 
 /**
  * drm_fb_helper_restore_fbdev_mode_unlocked - restore fbdev configuration
- * @fb_helper: fbcon to restore
+ * @fb_helper: driver-allocated fbdev helper, can be NULL
  *
  * This should be called from driver's drm &drm_driver.lastclose callback
  * when implementing an fbcon on top of kms using this helper. This ensures 
that
@@ -498,7 +504,7 @@ int drm_fb_helper_restore_fbdev_mode_unlocked(struct 
drm_fb_helper *fb_helper)
bool do_delayed;
int ret;
 
-   if (!drm_fbdev_emulation)
+   if (!drm_fbdev_emulation || !fb_helper)
return -ENODEV;
 
if (READ_ONCE(fb_helper->deferred_setup))
@@ -883,7 +889,7 @@ EXPORT_SYMBOL(drm_fb_helper_alloc_fbi);
 
 /**
  * drm_fb_helper_unregister_fbi - unregister fb_info framebuffer device
- * @fb_helper: driver-allocated fbdev helper
+ * @fb_helper: driver-allocated fbdev helper, can be NULL
  *
  * A wrapper around unregister_framebuffer, to release the fb_info
  * framebuffer device. This must be called before releasing all resources for
@@ -898,7 +904,7 @@ EXPORT_SYMBOL(drm_fb_helper_unregister_fbi);
 
 /**
  * drm_fb_helper_fini - finialize a &struct drm_fb_helper
- * @fb_helper: driver-allocated fbdev helper
+ * @fb_helper: driver-allocated fbdev helper, can be NULL
  *
  * This cleans up all remaining resources associated with @fb_helper. Must be
  * called after drm_fb_helper_unlink_fbi() was called.
@@ -937,7 +943,7 @@ EXPORT_SYMBOL(drm_fb_helper_fini);
 
 /**
  * drm_fb_helper_unlink_fbi - wrapper around unlink_framebuffer
- * @fb_helper: driver-allocated fbdev helper
+ * @fb_helper: driver-allocated fbdev helper, can be NULL
  *
  * A wrapper around unlink_framebuffer implemented by fbdev core
  */
@@ -1138,7 +1144,7 @@ EXPORT_SYMBOL(drm_fb_helper_cfb_imageblit);
 
 /**
  * drm_fb_helper_set_suspend - wrapper around fb_set_suspend
- * @fb_helper: driver-allocated fbdev helper
+ * @fb_helper: driver-allocated fbdev helper, can be NULL
  * @suspend: whether to suspend or resume
  *
  * A wrapper around fb_set_suspend implemented by fbdev core.
@@ -1155,7 +1161,7 @@ EXPORT_SYMBOL(drm_fb_helper_set_suspend);
 /**
  * drm_fb_helper_set_suspend_unlocked - wrapper around fb_set_suspend that also
  *  takes the console lock
- * @fb_helper: driver-allocated fbdev helper
+ * @fb_helper: driver-allocated fbdev helper, can be NULL
  * @suspend: whether to suspend or resume
  *
  * A wrapper around fb_set_suspend() that takes the console lock. If the lock
@@ -2568,7 +2574,7 @@ EXPORT_SYMBOL(drm_fb_helper_initial_config);
 /**
  * drm_fb_helper_hotplug_event - respond to a hotplug notification by
  *   probing all the outputs attached to the fb
- * @fb_helper: the drm_fb_helper
+ * @fb_helper: driver-allocated fbdev helper, can be NULL
  *
  * Scan the 

[PATCH v2 00/15] drm/fb-helper: Add .last_close and .output_poll_changed helpers

2017-10-30 Thread Noralf Trønnes
This patchset adds fbdev .last_close and .output_poll_changed helpers to
reduce fbdev emulation footprint in drivers.

I don't know which drivers have their own tree or not, so if you want me
to apply your patch to drm-misc, please let me know.

I will do a separate patchset for the cma helper drivers.

Noralf.

Changes since version 1:
- drm_device.drm_fb_helper_private -> drm_device.fb_helper (Ville)

Noralf Trønnes (15):
  drm/fb-helper: Handle function NULL argument
  drm: Add drm_device->fb_helper pointer
  drm/fb-helper: Add .last_close and .output_poll_changed helpers
  drm/amdgpu: Use drm_fb_helper_lastclose() and _poll_changed()
  drm/armada: Use drm_fb_helper_lastclose() and _poll_changed()
  drm/exynos: Use drm_fb_helper_lastclose() and _poll_changed()
  drm/gma500: Use drm_fb_helper_lastclose() and _poll_changed()
  drm/i915: Use drm_fb_helper_output_poll_changed()
  drm/msm: Use drm_fb_helper_lastclose() and _poll_changed()
  drm/nouveau: Use drm_fb_helper_output_poll_changed()
  drm/omap: Use drm_fb_helper_lastclose() and _poll_changed()
  drm/radeon: Use drm_fb_helper_lastclose() and _poll_changed()
  drm/rockchip: Use drm_fb_helper_lastclose() and _poll_changed()
  drm/tegra: Use drm_fb_helper_lastclose() and _poll_changed()
  staging: vboxvideo: Use drm_fb_helper_lastclose()

 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |  9 +---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c  | 27 ---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h|  4 --
 drivers/gpu/drm/armada/armada_drm.h |  1 -
 drivers/gpu/drm/armada/armada_drv.c |  8 +---
 drivers/gpu/drm/armada/armada_fb.c  | 11 +
 drivers/gpu/drm/armada/armada_fbdev.c   |  8 
 drivers/gpu/drm/drm_fb_helper.c | 69 +++--
 drivers/gpu/drm/exynos/exynos_drm_drv.c |  8 +---
 drivers/gpu/drm/exynos/exynos_drm_fb.c  |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c   | 18 
 drivers/gpu/drm/exynos/exynos_drm_fbdev.h   |  2 -
 drivers/gpu/drm/gma500/framebuffer.c|  9 +---
 drivers/gpu/drm/gma500/psb_drv.c| 15 +--
 drivers/gpu/drm/i915/intel_display.c|  2 +-
 drivers/gpu/drm/i915/intel_drv.h|  5 ---
 drivers/gpu/drm/i915/intel_fbdev.c  |  8 
 drivers/gpu/drm/msm/msm_drv.c   | 18 +---
 drivers/gpu/drm/nouveau/nouveau_display.c   |  3 +-
 drivers/gpu/drm/nouveau/nouveau_fbcon.c |  8 
 drivers/gpu/drm/nouveau/nouveau_fbcon.h |  2 -
 drivers/gpu/drm/nouveau/nouveau_vga.c   |  3 +-
 drivers/gpu/drm/nouveau/nv50_display.c  |  2 +-
 drivers/gpu/drm/omapdrm/omap_drv.c  | 34 +-
 drivers/gpu/drm/radeon/radeon_display.c |  9 +---
 drivers/gpu/drm/radeon/radeon_fb.c  | 22 -
 drivers/gpu/drm/radeon/radeon_kms.c |  5 +--
 drivers/gpu/drm/radeon/radeon_mode.h|  3 --
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c |  9 +---
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c  |  9 +---
 drivers/gpu/drm/tegra/drm.c | 13 +-
 drivers/gpu/drm/tegra/drm.h |  4 --
 drivers/gpu/drm/tegra/fb.c  | 14 --
 drivers/staging/vboxvideo/vbox_drv.c|  2 +-
 drivers/staging/vboxvideo/vbox_drv.h|  1 -
 drivers/staging/vboxvideo/vbox_main.c   | 12 -
 include/drm/drm_device.h|  9 
 include/drm/drm_fb_helper.h | 11 +
 39 files changed, 106 insertions(+), 297 deletions(-)

-- 
2.14.2

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


[PATCH v2 07/15] drm/gma500: Use drm_fb_helper_lastclose() and _poll_changed()

2017-10-30 Thread Noralf Trønnes
This driver can use drm_fb_helper_lastclose() as its .lastclose callback.
It can also use drm_fb_helper_output_poll_changed() as its
.output_poll_changed callback.

Cc: Patrik Jakobsson 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/gma500/framebuffer.c |  9 +
 drivers/gpu/drm/gma500/psb_drv.c | 15 +--
 2 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/gma500/framebuffer.c 
b/drivers/gpu/drm/gma500/framebuffer.c
index 2570c7f647a6..cb0a2ae916e0 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -576,13 +576,6 @@ static void psb_fbdev_fini(struct drm_device *dev)
dev_priv->fbdev = NULL;
 }
 
-static void psbfb_output_poll_changed(struct drm_device *dev)
-{
-   struct drm_psb_private *dev_priv = dev->dev_private;
-   struct psb_fbdev *fbdev = (struct psb_fbdev *)dev_priv->fbdev;
-   drm_fb_helper_hotplug_event(&fbdev->psb_fb_helper);
-}
-
 /**
  * psb_user_framebuffer_create_handle - add hamdle to a framebuffer
  * @fb: framebuffer
@@ -623,7 +616,7 @@ static void psb_user_framebuffer_destroy(struct 
drm_framebuffer *fb)
 
 static const struct drm_mode_config_funcs psb_mode_funcs = {
.fb_create = psb_user_framebuffer_create,
-   .output_poll_changed = psbfb_output_poll_changed,
+   .output_poll_changed = drm_fb_helper_output_poll_changed,
 };
 
 static void psb_setup_outputs(struct drm_device *dev)
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index 37a3be71acd9..7ab4c532f1d4 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -107,19 +107,6 @@ MODULE_DEVICE_TABLE(pci, pciidlist);
 static const struct drm_ioctl_desc psb_ioctls[] = {
 };
 
-static void psb_driver_lastclose(struct drm_device *dev)
-{
-   int ret;
-   struct drm_psb_private *dev_priv = dev->dev_private;
-   struct psb_fbdev *fbdev = dev_priv->fbdev;
-
-   ret = drm_fb_helper_restore_fbdev_mode_unlocked(&fbdev->psb_fb_helper);
-   if (ret)
-   DRM_DEBUG("failed to restore crtc mode\n");
-
-   return;
-}
-
 static int psb_do_init(struct drm_device *dev)
 {
struct drm_psb_private *dev_priv = dev->dev_private;
@@ -479,7 +466,7 @@ static struct drm_driver driver = {
   DRIVER_MODESET | DRIVER_GEM,
.load = psb_driver_load,
.unload = psb_driver_unload,
-   .lastclose = psb_driver_lastclose,
+   .lastclose = drm_fb_helper_lastclose,
 
.num_ioctls = ARRAY_SIZE(psb_ioctls),
.irq_preinstall = psb_irq_preinstall,
-- 
2.14.2

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


[PATCH v2 03/15] drm/fb-helper: Add .last_close and .output_poll_changed helpers

2017-10-30 Thread Noralf Trønnes
This adds helpers for the drm_driver->last_close and the
drm_mode_config_funcs->output_poll_changed callbacks.

Signed-off-by: Noralf Trønnes 
Reviewed-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_fb_helper.c | 28 
 include/drm/drm_fb_helper.h | 11 +++
 2 files changed, 39 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 19aaca9fea06..defd6a76fef3 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -2633,6 +2633,34 @@ int drm_fb_helper_hotplug_event(struct drm_fb_helper 
*fb_helper)
 }
 EXPORT_SYMBOL(drm_fb_helper_hotplug_event);
 
+/**
+ * drm_fb_helper_lastclose - DRM driver lastclose helper for fbdev emulation
+ * @dev: DRM device
+ *
+ * This function can be used as the &drm_driver->lastclose callback for drivers
+ * that only need to call drm_fb_helper_restore_fbdev_mode_unlocked().
+ */
+void drm_fb_helper_lastclose(struct drm_device *dev)
+{
+   drm_fb_helper_restore_fbdev_mode_unlocked(dev->fb_helper);
+}
+EXPORT_SYMBOL(drm_fb_helper_lastclose);
+
+/**
+ * drm_fb_helper_output_poll_changed - DRM mode config \.output_poll_changed
+ * helper for fbdev emulation
+ * @dev: DRM device
+ *
+ * This function can be used as the
+ * &drm_mode_config_funcs.output_poll_changed callback for drivers that only
+ * need to call drm_fb_helper_hotplug_event().
+ */
+void drm_fb_helper_output_poll_changed(struct drm_device *dev)
+{
+   drm_fb_helper_hotplug_event(dev->fb_helper);
+}
+EXPORT_SYMBOL(drm_fb_helper_output_poll_changed);
+
 /* The Kconfig DRM_KMS_HELPER selects FRAMEBUFFER_CONSOLE (if !EXPERT)
  * but the module doesn't depend on any fb console symbols.  At least
  * attempt to load fbcon to avoid leaving the system without a usable console.
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 33fe95927742..877e5b395c02 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -310,6 +310,9 @@ drm_pick_cmdline_mode(struct drm_fb_helper_connector 
*fb_helper_conn);
 int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct 
drm_connector *connector);
 int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper,
   struct drm_connector *connector);
+
+void drm_fb_helper_lastclose(struct drm_device *dev);
+void drm_fb_helper_output_poll_changed(struct drm_device *dev);
 #else
 static inline void drm_fb_helper_prepare(struct drm_device *dev,
struct drm_fb_helper *helper,
@@ -507,6 +510,14 @@ drm_fb_helper_remove_one_connector(struct drm_fb_helper 
*fb_helper,
return 0;
 }
 
+static inline void drm_fb_helper_lastclose(struct drm_device *dev)
+{
+}
+
+static inline void drm_fb_helper_output_poll_changed(struct drm_device *dev)
+{
+}
+
 #endif
 
 static inline int
-- 
2.14.2

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


[PATCH v2 08/15] drm/i915: Use drm_fb_helper_output_poll_changed()

2017-10-30 Thread Noralf Trønnes
This driver can use drm_fb_helper_output_poll_changed() as its
.output_poll_changed callback.

Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/i915/intel_display.c | 2 +-
 drivers/gpu/drm/i915/intel_drv.h | 5 -
 drivers/gpu/drm/i915/intel_fbdev.c   | 8 
 3 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index f780f39e0758..b205e2c782bb 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -14123,7 +14123,7 @@ static void intel_atomic_state_free(struct 
drm_atomic_state *state)
 static const struct drm_mode_config_funcs intel_mode_funcs = {
.fb_create = intel_user_framebuffer_create,
.get_format_info = intel_get_format_info,
-   .output_poll_changed = intel_fbdev_output_poll_changed,
+   .output_poll_changed = drm_fb_helper_output_poll_changed,
.atomic_check = intel_atomic_check,
.atomic_commit = intel_atomic_commit,
.atomic_state_alloc = intel_atomic_state_alloc,
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 463ed152e6b1..dfcf5ba220e8 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1607,7 +1607,6 @@ extern void intel_fbdev_initial_config_async(struct 
drm_device *dev);
 extern void intel_fbdev_unregister(struct drm_i915_private *dev_priv);
 extern void intel_fbdev_fini(struct drm_i915_private *dev_priv);
 extern void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool 
synchronous);
-extern void intel_fbdev_output_poll_changed(struct drm_device *dev);
 extern void intel_fbdev_restore_mode(struct drm_device *dev);
 #else
 static inline int intel_fbdev_init(struct drm_device *dev)
@@ -1631,10 +1630,6 @@ static inline void intel_fbdev_set_suspend(struct 
drm_device *dev, int state, bo
 {
 }
 
-static inline void intel_fbdev_output_poll_changed(struct drm_device *dev)
-{
-}
-
 static inline void intel_fbdev_restore_mode(struct drm_device *dev)
 {
 }
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c 
b/drivers/gpu/drm/i915/intel_fbdev.c
index f2bb8116227c..35babbadfc5a 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -796,14 +796,6 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int 
state, bool synchronous
console_unlock();
 }
 
-void intel_fbdev_output_poll_changed(struct drm_device *dev)
-{
-   struct intel_fbdev *ifbdev = to_i915(dev)->fbdev;
-
-   if (ifbdev)
-   drm_fb_helper_hotplug_event(&ifbdev->helper);
-}
-
 void intel_fbdev_restore_mode(struct drm_device *dev)
 {
struct intel_fbdev *ifbdev = to_i915(dev)->fbdev;
-- 
2.14.2

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


[PATCH v2 09/15] drm/msm: Use drm_fb_helper_lastclose() and _poll_changed()

2017-10-30 Thread Noralf Trønnes
This driver can use drm_fb_helper_lastclose() as its .lastclose callback.
It can also use drm_fb_helper_output_poll_changed() as its
.output_poll_changed callback.

Cc: Rob Clark 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/msm/msm_drv.c | 18 ++
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 606df7bea97b..1bddbbc6fd3e 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -34,16 +34,9 @@
 #define MSM_VERSION_MINOR  2
 #define MSM_VERSION_PATCHLEVEL 0
 
-static void msm_fb_output_poll_changed(struct drm_device *dev)
-{
-   struct msm_drm_private *priv = dev->dev_private;
-   if (priv->fbdev)
-   drm_fb_helper_hotplug_event(priv->fbdev);
-}
-
 static const struct drm_mode_config_funcs mode_config_funcs = {
.fb_create = msm_framebuffer_create,
-   .output_poll_changed = msm_fb_output_poll_changed,
+   .output_poll_changed = drm_fb_helper_output_poll_changed,
.atomic_check = msm_atomic_check,
.atomic_commit = msm_atomic_commit,
.atomic_state_alloc = msm_atomic_state_alloc,
@@ -545,13 +538,6 @@ static void msm_postclose(struct drm_device *dev, struct 
drm_file *file)
kfree(ctx);
 }
 
-static void msm_lastclose(struct drm_device *dev)
-{
-   struct msm_drm_private *priv = dev->dev_private;
-   if (priv->fbdev)
-   drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev);
-}
-
 static irqreturn_t msm_irq(int irq, void *arg)
 {
struct drm_device *dev = arg;
@@ -825,7 +811,7 @@ static struct drm_driver msm_driver = {
DRIVER_MODESET,
.open   = msm_open,
.postclose   = msm_postclose,
-   .lastclose  = msm_lastclose,
+   .lastclose  = drm_fb_helper_lastclose,
.irq_handler= msm_irq,
.irq_preinstall = msm_irq_preinstall,
.irq_postinstall= msm_irq_postinstall,
-- 
2.14.2

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


[PATCH v2 06/15] drm/exynos: Use drm_fb_helper_lastclose() and _poll_changed()

2017-10-30 Thread Noralf Trønnes
This driver can use drm_fb_helper_lastclose() as its .lastclose callback.
It can also use drm_fb_helper_output_poll_changed() as its
.output_poll_changed callback.

Cc: Inki Dae 
Cc: Joonyoung Shim 
Cc: Seung-Woo Kim 
Cc: Kyungmin Park 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c   |  8 ++--
 drivers/gpu/drm/exynos/exynos_drm_fb.c|  2 +-
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 18 --
 drivers/gpu/drm/exynos/exynos_drm_fbdev.h |  2 --
 4 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index e651a58c18cf..70f4895ac49c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -89,11 +90,6 @@ static void exynos_drm_postclose(struct drm_device *dev, 
struct drm_file *file)
file->driver_priv = NULL;
 }
 
-static void exynos_drm_lastclose(struct drm_device *dev)
-{
-   exynos_drm_fbdev_restore_mode(dev);
-}
-
 static const struct vm_operations_struct exynos_drm_gem_vm_ops = {
.fault = exynos_drm_gem_fault,
.open = drm_gem_vm_open,
@@ -140,7 +136,7 @@ static struct drm_driver exynos_drm_driver = {
.driver_features= DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME
  | DRIVER_ATOMIC | DRIVER_RENDER,
.open   = exynos_drm_open,
-   .lastclose  = exynos_drm_lastclose,
+   .lastclose  = drm_fb_helper_lastclose,
.postclose  = exynos_drm_postclose,
.gem_free_object_unlocked = exynos_drm_gem_free_object,
.gem_vm_ops = &exynos_drm_gem_vm_ops,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c 
b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index 8208df56a88f..0faaf829f5bf 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -205,7 +205,7 @@ static struct drm_mode_config_helper_funcs 
exynos_drm_mode_config_helpers = {
 
 static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = {
.fb_create = exynos_user_fb_create,
-   .output_poll_changed = exynos_drm_output_poll_changed,
+   .output_poll_changed = drm_fb_helper_output_poll_changed,
.atomic_check = exynos_atomic_check,
.atomic_commit = drm_atomic_helper_commit,
 };
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c 
b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index dfb66ecf417b..132dd52d0ac7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -270,24 +270,6 @@ void exynos_drm_fbdev_fini(struct drm_device *dev)
private->fb_helper = NULL;
 }
 
-void exynos_drm_fbdev_restore_mode(struct drm_device *dev)
-{
-   struct exynos_drm_private *private = dev->dev_private;
-
-   if (!private || !private->fb_helper)
-   return;
-
-   drm_fb_helper_restore_fbdev_mode_unlocked(private->fb_helper);
-}
-
-void exynos_drm_output_poll_changed(struct drm_device *dev)
-{
-   struct exynos_drm_private *private = dev->dev_private;
-   struct drm_fb_helper *fb_helper = private->fb_helper;
-
-   drm_fb_helper_hotplug_event(fb_helper);
-}
-
 void exynos_drm_fbdev_suspend(struct drm_device *dev)
 {
struct exynos_drm_private *private = dev->dev_private;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.h 
b/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
index 645d1bb7f665..b33847223a85 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
@@ -19,8 +19,6 @@
 
 int exynos_drm_fbdev_init(struct drm_device *dev);
 void exynos_drm_fbdev_fini(struct drm_device *dev);
-void exynos_drm_fbdev_restore_mode(struct drm_device *dev);
-void exynos_drm_output_poll_changed(struct drm_device *dev);
 void exynos_drm_fbdev_suspend(struct drm_device *drm);
 void exynos_drm_fbdev_resume(struct drm_device *drm);
 
-- 
2.14.2

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


[PATCH v2 04/15] drm/amdgpu: Use drm_fb_helper_lastclose() and _poll_changed()

2017-10-30 Thread Noralf Trønnes
This driver can use drm_fb_helper_lastclose() in its .lastclose function.
It can also use drm_fb_helper_output_poll_changed() as its
.output_poll_changed callback.

Cc: Alex Deucher 
Cc: "Christian König" 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |  9 ++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c  | 27 ---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  4 +---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h|  4 
 4 files changed, 3 insertions(+), 41 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 6ad243293a78..c41262865616 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static void amdgpu_flip_callback(struct dma_fence *f, struct dma_fence_cb *cb)
 {
@@ -556,15 +557,9 @@ amdgpu_user_framebuffer_create(struct drm_device *dev,
return &amdgpu_fb->base;
 }
 
-static void amdgpu_output_poll_changed(struct drm_device *dev)
-{
-   struct amdgpu_device *adev = dev->dev_private;
-   amdgpu_fb_output_poll_changed(adev);
-}
-
 const struct drm_mode_config_funcs amdgpu_mode_funcs = {
.fb_create = amdgpu_user_framebuffer_create,
-   .output_poll_changed = amdgpu_output_poll_changed
+   .output_poll_changed = drm_fb_helper_output_poll_changed,
 };
 
 static const struct drm_prop_enum_list amdgpu_underscan_enum_list[] =
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
index 562930b17a6d..e38bf856f48b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
@@ -288,12 +288,6 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
return ret;
 }
 
-void amdgpu_fb_output_poll_changed(struct amdgpu_device *adev)
-{
-   if (adev->mode_info.rfbdev)
-   drm_fb_helper_hotplug_event(&adev->mode_info.rfbdev->helper);
-}
-
 static int amdgpu_fbdev_destroy(struct drm_device *dev, struct amdgpu_fbdev 
*rfbdev)
 {
struct amdgpu_framebuffer *rfb = &rfbdev->rfb;
@@ -397,24 +391,3 @@ bool amdgpu_fbdev_robj_is_fb(struct amdgpu_device *adev, 
struct amdgpu_bo *robj)
return true;
return false;
 }
-
-void amdgpu_fbdev_restore_mode(struct amdgpu_device *adev)
-{
-   struct amdgpu_fbdev *afbdev;
-   struct drm_fb_helper *fb_helper;
-   int ret;
-
-   if (!adev)
-   return;
-
-   afbdev = adev->mode_info.rfbdev;
-
-   if (!afbdev)
-   return;
-
-   fb_helper = &afbdev->helper;
-
-   ret = drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper);
-   if (ret)
-   DRM_DEBUG("failed to restore crtc mode\n");
-}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 4fd06f8d9768..db1e320be54a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -785,9 +785,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void 
*data, struct drm_file
  */
 void amdgpu_driver_lastclose_kms(struct drm_device *dev)
 {
-   struct amdgpu_device *adev = dev->dev_private;
-
-   amdgpu_fbdev_restore_mode(adev);
+   drm_fb_helper_lastclose(dev);
vga_switcheroo_process_delayed_switch();
 }
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
index 2af2678ddaf6..9e9cd0e1c558 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
@@ -570,10 +570,6 @@ void amdgpu_fbdev_fini(struct amdgpu_device *adev);
 void amdgpu_fbdev_set_suspend(struct amdgpu_device *adev, int state);
 int amdgpu_fbdev_total_size(struct amdgpu_device *adev);
 bool amdgpu_fbdev_robj_is_fb(struct amdgpu_device *adev, struct amdgpu_bo 
*robj);
-void amdgpu_fbdev_restore_mode(struct amdgpu_device *adev);
-
-void amdgpu_fb_output_poll_changed(struct amdgpu_device *adev);
-
 
 int amdgpu_align_pitch(struct amdgpu_device *adev, int width, int bpp, bool 
tiled);
 
-- 
2.14.2

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


[PATCH v2 10/15] drm/nouveau: Use drm_fb_helper_output_poll_changed()

2017-10-30 Thread Noralf Trønnes
This driver can use drm_fb_helper_output_poll_changed() instead of
its own nouveau_fbcon_output_poll_changed().

Cc: Ben Skeggs 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/nouveau/nouveau_display.c | 3 ++-
 drivers/gpu/drm/nouveau/nouveau_fbcon.c   | 8 
 drivers/gpu/drm/nouveau/nouveau_fbcon.h   | 2 --
 drivers/gpu/drm/nouveau/nouveau_vga.c | 3 ++-
 drivers/gpu/drm/nouveau/nv50_display.c| 2 +-
 5 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c 
b/drivers/gpu/drm/nouveau/nouveau_display.c
index 2e7785f49e6d..009713404cc4 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -292,7 +293,7 @@ nouveau_user_framebuffer_create(struct drm_device *dev,
 
 static const struct drm_mode_config_funcs nouveau_mode_config_funcs = {
.fb_create = nouveau_user_framebuffer_create,
-   .output_poll_changed = nouveau_fbcon_output_poll_changed,
+   .output_poll_changed = drm_fb_helper_output_poll_changed,
 };
 
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c 
b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index f7707849bb53..60ca03c27ec4 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
@@ -411,14 +411,6 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,
return ret;
 }
 
-void
-nouveau_fbcon_output_poll_changed(struct drm_device *dev)
-{
-   struct nouveau_drm *drm = nouveau_drm(dev);
-   if (drm->fbcon)
-   drm_fb_helper_hotplug_event(&drm->fbcon->helper);
-}
-
 static int
 nouveau_fbcon_destroy(struct drm_device *dev, struct nouveau_fbdev *fbcon)
 {
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.h 
b/drivers/gpu/drm/nouveau/nouveau_fbcon.h
index e2bca729721e..a6f192ea3fa6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.h
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.h
@@ -68,8 +68,6 @@ void nouveau_fbcon_set_suspend(struct drm_device *dev, int 
state);
 void nouveau_fbcon_accel_save_disable(struct drm_device *dev);
 void nouveau_fbcon_accel_restore(struct drm_device *dev);
 
-void nouveau_fbcon_output_poll_changed(struct drm_device *dev);
-
 extern int nouveau_nofbaccel;
 
 #endif /* __NV50_FBCON_H__ */
diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c 
b/drivers/gpu/drm/nouveau/nouveau_vga.c
index 48393a4f6331..ac97c30c5bbd 100644
--- a/drivers/gpu/drm/nouveau/nouveau_vga.c
+++ b/drivers/gpu/drm/nouveau/nouveau_vga.c
@@ -3,6 +3,7 @@
 
 #include 
 #include 
+#include 
 
 #include "nouveau_drv.h"
 #include "nouveau_acpi.h"
@@ -60,7 +61,7 @@ static void
 nouveau_switcheroo_reprobe(struct pci_dev *pdev)
 {
struct drm_device *dev = pci_get_drvdata(pdev);
-   nouveau_fbcon_output_poll_changed(dev);
+   drm_fb_helper_output_poll_changed(dev);
 }
 
 static bool
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c 
b/drivers/gpu/drm/nouveau/nv50_display.c
index 2dbf62a2ac41..5b3db08e50e4 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -4308,7 +4308,7 @@ nv50_disp_atomic_state_alloc(struct drm_device *dev)
 static const struct drm_mode_config_funcs
 nv50_disp_func = {
.fb_create = nouveau_user_framebuffer_create,
-   .output_poll_changed = nouveau_fbcon_output_poll_changed,
+   .output_poll_changed = drm_fb_helper_output_poll_changed,
.atomic_check = nv50_disp_atomic_check,
.atomic_commit = nv50_disp_atomic_commit,
.atomic_state_alloc = nv50_disp_atomic_state_alloc,
-- 
2.14.2

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


[PATCH v2 11/15] drm/omap: Use drm_fb_helper_lastclose() and _poll_changed()

2017-10-30 Thread Noralf Trønnes
This driver can use drm_fb_helper_lastclose() as its .lastclose callback.
It can also use drm_fb_helper_output_poll_changed() as its
.output_poll_changed callback.

Cc: Tomi Valkeinen 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/omapdrm/omap_drv.c | 34 ++
 1 file changed, 2 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
b/drivers/gpu/drm/omapdrm/omap_drv.c
index cdf5b0601eba..96857c508ee0 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -46,14 +46,6 @@
  * devices
  */
 
-static void omap_fb_output_poll_changed(struct drm_device *dev)
-{
-   struct omap_drm_private *priv = dev->dev_private;
-   DBG("dev=%p", dev);
-   if (priv->fbdev)
-   drm_fb_helper_hotplug_event(priv->fbdev);
-}
-
 static void omap_atomic_wait_for_completion(struct drm_device *dev,
struct drm_atomic_state *old_state)
 {
@@ -132,7 +124,7 @@ static const struct drm_mode_config_helper_funcs 
omap_mode_config_helper_funcs =
 
 static const struct drm_mode_config_funcs omap_mode_config_funcs = {
.fb_create = omap_framebuffer_create,
-   .output_poll_changed = omap_fb_output_poll_changed,
+   .output_poll_changed = drm_fb_helper_output_poll_changed,
.atomic_check = drm_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit,
 };
@@ -467,28 +459,6 @@ static int dev_open(struct drm_device *dev, struct 
drm_file *file)
return 0;
 }
 
-/**
- * lastclose - clean up after all DRM clients have exited
- * @dev: DRM device
- *
- * Take care of cleaning up after all DRM clients have exited.  In the
- * mode setting case, we want to restore the kernel's initial mode (just
- * in case the last client left us in a bad state).
- */
-static void dev_lastclose(struct drm_device *dev)
-{
-   struct omap_drm_private *priv = dev->dev_private;
-   int ret;
-
-   DBG("lastclose: dev=%p", dev);
-
-   if (priv->fbdev) {
-   ret = drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev);
-   if (ret)
-   DBG("failed to restore crtc mode");
-   }
-}
-
 static const struct vm_operations_struct omap_gem_vm_ops = {
.fault = omap_gem_fault,
.open = drm_gem_vm_open,
@@ -511,7 +481,7 @@ static struct drm_driver omap_drm_driver = {
.driver_features = DRIVER_MODESET | DRIVER_GEM  | DRIVER_PRIME |
DRIVER_ATOMIC | DRIVER_RENDER,
.open = dev_open,
-   .lastclose = dev_lastclose,
+   .lastclose = drm_fb_helper_lastclose,
 #ifdef CONFIG_DEBUG_FS
.debugfs_init = omap_debugfs_init,
 #endif
-- 
2.14.2

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


[PATCH v2 14/15] drm/tegra: Use drm_fb_helper_lastclose() and _poll_changed()

2017-10-30 Thread Noralf Trønnes
This driver can use drm_fb_helper_lastclose() as its .lastclose callback.
It can also use drm_fb_helper_output_poll_changed() as its
.output_poll_changed callback.

Cc: Thierry Reding 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/tegra/drm.c | 13 ++---
 drivers/gpu/drm/tegra/drm.h |  4 
 drivers/gpu/drm/tegra/fb.c  | 14 --
 3 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 597d563d636a..73bca7ac1271 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -120,7 +120,7 @@ static int tegra_atomic_commit(struct drm_device *drm,
 static const struct drm_mode_config_funcs tegra_drm_mode_funcs = {
.fb_create = tegra_fb_create,
 #ifdef CONFIG_DRM_FBDEV_EMULATION
-   .output_poll_changed = tegra_fb_output_poll_changed,
+   .output_poll_changed = drm_fb_helper_output_poll_changed,
 #endif
.atomic_check = drm_atomic_helper_check,
.atomic_commit = tegra_atomic_commit,
@@ -287,15 +287,6 @@ static void tegra_drm_context_free(struct 
tegra_drm_context *context)
kfree(context);
 }
 
-static void tegra_drm_lastclose(struct drm_device *drm)
-{
-#ifdef CONFIG_DRM_FBDEV_EMULATION
-   struct tegra_drm *tegra = drm->dev_private;
-
-   tegra_fbdev_restore_mode(tegra->fbdev);
-#endif
-}
-
 static struct host1x_bo *
 host1x_bo_lookup(struct drm_file *file, u32 handle)
 {
@@ -1100,7 +1091,7 @@ static struct drm_driver tegra_drm_driver = {
.unload = tegra_drm_unload,
.open = tegra_drm_open,
.postclose = tegra_drm_postclose,
-   .lastclose = tegra_drm_lastclose,
+   .lastclose = drm_fb_helper_lastclose,
 
 #if defined(CONFIG_DEBUG_FS)
.debugfs_init = tegra_debugfs_init,
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h
index 063f5d397526..55b6aff25b9b 100644
--- a/drivers/gpu/drm/tegra/drm.h
+++ b/drivers/gpu/drm/tegra/drm.h
@@ -290,10 +290,6 @@ int tegra_drm_fb_init(struct drm_device *drm);
 void tegra_drm_fb_exit(struct drm_device *drm);
 void tegra_drm_fb_suspend(struct drm_device *drm);
 void tegra_drm_fb_resume(struct drm_device *drm);
-#ifdef CONFIG_DRM_FBDEV_EMULATION
-void tegra_fbdev_restore_mode(struct tegra_fbdev *fbdev);
-void tegra_fb_output_poll_changed(struct drm_device *drm);
-#endif
 
 extern struct platform_driver tegra_dc_driver;
 extern struct platform_driver tegra_hdmi_driver;
diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c
index 80540c1c66dc..8dfe3c6c217e 100644
--- a/drivers/gpu/drm/tegra/fb.c
+++ b/drivers/gpu/drm/tegra/fb.c
@@ -361,20 +361,6 @@ static void tegra_fbdev_exit(struct tegra_fbdev *fbdev)
drm_fb_helper_fini(&fbdev->base);
tegra_fbdev_free(fbdev);
 }
-
-void tegra_fbdev_restore_mode(struct tegra_fbdev *fbdev)
-{
-   if (fbdev)
-   drm_fb_helper_restore_fbdev_mode_unlocked(&fbdev->base);
-}
-
-void tegra_fb_output_poll_changed(struct drm_device *drm)
-{
-   struct tegra_drm *tegra = drm->dev_private;
-
-   if (tegra->fbdev)
-   drm_fb_helper_hotplug_event(&tegra->fbdev->base);
-}
 #endif
 
 int tegra_drm_fb_prepare(struct drm_device *drm)
-- 
2.14.2

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


[PATCH v2 15/15] staging: vboxvideo: Use drm_fb_helper_lastclose()

2017-10-30 Thread Noralf Trønnes
This driver can use drm_fb_helper_lastclose() as its .lastclose callback.

Cc: Hans de Goede 
Signed-off-by: Noralf Trønnes 
Reviewed-by: Hans de Goede 
---
 drivers/staging/vboxvideo/vbox_drv.c  |  2 +-
 drivers/staging/vboxvideo/vbox_drv.h  |  1 -
 drivers/staging/vboxvideo/vbox_main.c | 12 
 3 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/staging/vboxvideo/vbox_drv.c 
b/drivers/staging/vboxvideo/vbox_drv.c
index e18642e5027e..a4d8d7898e3d 100644
--- a/drivers/staging/vboxvideo/vbox_drv.c
+++ b/drivers/staging/vboxvideo/vbox_drv.c
@@ -229,7 +229,7 @@ static struct drm_driver driver = {
 
.load = vbox_driver_load,
.unload = vbox_driver_unload,
-   .lastclose = vbox_driver_lastclose,
+   .lastclose = drm_fb_helper_lastclose,
.master_set = vbox_master_set,
.master_drop = vbox_master_drop,
 
diff --git a/drivers/staging/vboxvideo/vbox_drv.h 
b/drivers/staging/vboxvideo/vbox_drv.h
index 4b9302703b36..7273d7e9bc9b 100644
--- a/drivers/staging/vboxvideo/vbox_drv.h
+++ b/drivers/staging/vboxvideo/vbox_drv.h
@@ -128,7 +128,6 @@ struct vbox_private {
 
 int vbox_driver_load(struct drm_device *dev, unsigned long flags);
 void vbox_driver_unload(struct drm_device *dev);
-void vbox_driver_lastclose(struct drm_device *dev);
 
 struct vbox_gem_object;
 
diff --git a/drivers/staging/vboxvideo/vbox_main.c 
b/drivers/staging/vboxvideo/vbox_main.c
index 80bd039fa08e..c3d756620fd5 100644
--- a/drivers/staging/vboxvideo/vbox_main.c
+++ b/drivers/staging/vboxvideo/vbox_main.c
@@ -421,18 +421,6 @@ void vbox_driver_unload(struct drm_device *dev)
vbox_hw_fini(vbox);
 }
 
-/**
- * @note this is described in the DRM framework documentation.  AST does not
- * have it, but we get an oops on driver unload if it is not present.
- */
-void vbox_driver_lastclose(struct drm_device *dev)
-{
-   struct vbox_private *vbox = dev->dev_private;
-
-   if (vbox->fbdev)
-   drm_fb_helper_restore_fbdev_mode_unlocked(&vbox->fbdev->helper);
-}
-
 int vbox_gem_create(struct drm_device *dev,
u32 size, bool iskernel, struct drm_gem_object **obj)
 {
-- 
2.14.2

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


[PATCH v2 13/15] drm/rockchip: Use drm_fb_helper_lastclose() and _poll_changed()

2017-10-30 Thread Noralf Trønnes
This driver can use drm_fb_helper_lastclose() as its .lastclose callback.
It can also use drm_fb_helper_output_poll_changed() as its
.output_poll_changed callback.

Cc: Mark Yao 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 9 +
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c  | 9 +
 2 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index 76d63de5921d..d85431400a0d 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -207,13 +207,6 @@ static void rockchip_drm_unbind(struct device *dev)
drm_dev_unref(drm_dev);
 }
 
-static void rockchip_drm_lastclose(struct drm_device *dev)
-{
-   struct rockchip_drm_private *priv = dev->dev_private;
-
-   drm_fb_helper_restore_fbdev_mode_unlocked(&priv->fbdev_helper);
-}
-
 static const struct file_operations rockchip_drm_driver_fops = {
.owner = THIS_MODULE,
.open = drm_open,
@@ -228,7 +221,7 @@ static const struct file_operations 
rockchip_drm_driver_fops = {
 static struct drm_driver rockchip_drm_driver = {
.driver_features= DRIVER_MODESET | DRIVER_GEM |
  DRIVER_PRIME | DRIVER_ATOMIC,
-   .lastclose  = rockchip_drm_lastclose,
+   .lastclose  = drm_fb_helper_lastclose,
.gem_vm_ops = &drm_gem_cma_vm_ops,
.gem_free_object_unlocked = rockchip_gem_free_object,
.dumb_create= rockchip_gem_dumb_create,
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
index cd2ace0c3caa..e266539e04e5 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
@@ -167,20 +167,13 @@ rockchip_user_fb_create(struct drm_device *dev, struct 
drm_file *file_priv,
return ERR_PTR(ret);
 }
 
-static void rockchip_drm_output_poll_changed(struct drm_device *dev)
-{
-   struct rockchip_drm_private *private = dev->dev_private;
-
-   drm_fb_helper_hotplug_event(&private->fbdev_helper);
-}
-
 static const struct drm_mode_config_helper_funcs rockchip_mode_config_helpers 
= {
.atomic_commit_tail = drm_atomic_helper_commit_tail_rpm,
 };
 
 static const struct drm_mode_config_funcs rockchip_drm_mode_config_funcs = {
.fb_create = rockchip_user_fb_create,
-   .output_poll_changed = rockchip_drm_output_poll_changed,
+   .output_poll_changed = drm_fb_helper_output_poll_changed,
.atomic_check = drm_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit,
 };
-- 
2.14.2

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


Re: [PATCH] drm/TODO: Clarify DRM_DEV_* conversion

2017-10-30 Thread Sean Paul
On Mon, Oct 30, 2017 at 9:15 AM, Daniel Vetter  wrote:
> Not everyone agrees this is the best thing, so make it really clear
> that maintainers need to be asked first, then the conversion. We've
> had a few newbies that did this the other way round, got their patches
> rejected, which isn't the best newbie experience.
>
> Cc: Sean Paul 

Acked-by: Sean Paul 

> Signed-off-by: Daniel Vetter 
> ---
>  Documentation/gpu/todo.rst | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
> index 96f8ec7dbe4e..e9840d693a86 100644
> --- a/Documentation/gpu/todo.rst
> +++ b/Documentation/gpu/todo.rst
> @@ -179,6 +179,10 @@ don't do this, drivers used dev_info/warn/err to make 
> this differentiation. We
>  now have DRM_DEV_* variants of the drm print macros, so we can start to 
> convert
>  those drivers back to using drm-formwatted specific log messages.
>
> +Before you start this conversion please contact the relevant maintainers to 
> make
> +sure your work will be merged - not everyone agrees that the DRM dmesg macros
> +are better.
> +
>  Contact: Sean Paul, Maintainer of the driver you plan to convert
>
>  Core refactorings
> --
> 2.15.0.rc1
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 12/15] drm/radeon: Use drm_fb_helper_lastclose() and _poll_changed()

2017-10-30 Thread Noralf Trønnes
This driver can use drm_fb_helper_lastclose() in its .lastclose function.
It can also use drm_fb_helper_output_poll_changed() as its
.output_poll_changed callback.

Cc: Alex Deucher 
Cc: "Christian König" 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/radeon/radeon_display.c |  9 ++---
 drivers/gpu/drm/radeon/radeon_fb.c  | 22 --
 drivers/gpu/drm/radeon/radeon_kms.c |  5 ++---
 drivers/gpu/drm/radeon/radeon_mode.h|  3 ---
 4 files changed, 4 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c 
b/drivers/gpu/drm/radeon/radeon_display.c
index ddfe91efa61e..dfda5e0ed166 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -32,6 +32,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -1362,15 +1363,9 @@ radeon_user_framebuffer_create(struct drm_device *dev,
return &radeon_fb->base;
 }
 
-static void radeon_output_poll_changed(struct drm_device *dev)
-{
-   struct radeon_device *rdev = dev->dev_private;
-   radeon_fb_output_poll_changed(rdev);
-}
-
 static const struct drm_mode_config_funcs radeon_mode_funcs = {
.fb_create = radeon_user_framebuffer_create,
-   .output_poll_changed = radeon_output_poll_changed
+   .output_poll_changed = drm_fb_helper_output_poll_changed,
 };
 
 static const struct drm_prop_enum_list radeon_tmds_pll_enum_list[] =
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c 
b/drivers/gpu/drm/radeon/radeon_fb.c
index 2fcf805d3a16..8a582af52073 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -307,12 +307,6 @@ static int radeonfb_create(struct drm_fb_helper *helper,
return ret;
 }
 
-void radeon_fb_output_poll_changed(struct radeon_device *rdev)
-{
-   if (rdev->mode_info.rfbdev)
-   drm_fb_helper_hotplug_event(&rdev->mode_info.rfbdev->helper);
-}
-
 static int radeon_fbdev_destroy(struct drm_device *dev, struct radeon_fbdev 
*rfbdev)
 {
struct radeon_framebuffer *rfb = &rfbdev->rfb;
@@ -423,19 +417,3 @@ void radeon_fb_remove_connector(struct radeon_device 
*rdev, struct drm_connector
if (rdev->mode_info.rfbdev)

drm_fb_helper_remove_one_connector(&rdev->mode_info.rfbdev->helper, connector);
 }
-
-void radeon_fbdev_restore_mode(struct radeon_device *rdev)
-{
-   struct radeon_fbdev *rfbdev = rdev->mode_info.rfbdev;
-   struct drm_fb_helper *fb_helper;
-   int ret;
-
-   if (!rfbdev)
-   return;
-
-   fb_helper = &rfbdev->helper;
-
-   ret = drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper);
-   if (ret)
-   DRM_DEBUG("failed to restore crtc mode\n");
-}
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
b/drivers/gpu/drm/radeon/radeon_kms.c
index dfee8f7d94ae..e4c1bb8c21fa 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -26,6 +26,7 @@
  *  Jerome Glisse
  */
 #include 
+#include 
 #include "radeon.h"
 #include 
 #include "radeon_asic.h"
@@ -636,9 +637,7 @@ static int radeon_info_ioctl(struct drm_device *dev, void 
*data, struct drm_file
  */
 void radeon_driver_lastclose_kms(struct drm_device *dev)
 {
-   struct radeon_device *rdev = dev->dev_private;
-
-   radeon_fbdev_restore_mode(rdev);
+   drm_fb_helper_lastclose(dev);
vga_switcheroo_process_delayed_switch();
 }
 
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h 
b/drivers/gpu/drm/radeon/radeon_mode.h
index da44ac234f64..567156a7beae 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -988,9 +988,6 @@ int radeon_fbdev_init(struct radeon_device *rdev);
 void radeon_fbdev_fini(struct radeon_device *rdev);
 void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state);
 bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo 
*robj);
-void radeon_fbdev_restore_mode(struct radeon_device *rdev);
-
-void radeon_fb_output_poll_changed(struct radeon_device *rdev);
 
 void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id);
 
-- 
2.14.2

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


[Bug 103463] [drm:amdgpu_get_bios [amdgpu]] *ERROR* ACPI VFCT table present but broken (too short #2)

2017-10-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103463

--- Comment #11 from Dennis Schridde  ---
One more thing: It appears as if the first "cold" boot usually fails -- the
kernel hanging after "[drm:amdgpu_get_bios [amdgpu]] *ERROR* ACPI VFCT table
present but broken (too short #2)" and the blinking cursor freezing.  "Cold"
boot meaning booting the system after it was powered off.  The next boot (hard
resetting the machine) usually succeeds.  I write "usually", because sometimes
the first boot already succeeds, and sometimes it needs two hard resets to
bring up the machine successfully, but I cannot yet make out a pattern.  I will
enable verbose and debug command line arguments to hopefully get some more
information, the next time it happens.

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


Re: [PATCH] drm: Fix checkpatch issue: "WARNING: braces {} are not necessary for single statement blocks."

2017-10-30 Thread Liviu Dudau
Hi Vitor,

Thanks for the patch!

Acked-by: Liviu Dudau 

I will pull the patch and send it to David Airlie in this weeks' pull
request.

Best regards,
Liviu

On Mon, Oct 30, 2017 at 11:36:54AM -0200, Vitor Massaru Iha wrote:
> Signed-off-by: Vitor Massaru Iha 
> ---
>  drivers/gpu/drm/arm/hdlcd_crtc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c 
> b/drivers/gpu/drm/arm/hdlcd_crtc.c
> index 72b22b805412..5a5427bbd70e 100644
> --- a/drivers/gpu/drm/arm/hdlcd_crtc.c
> +++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
> @@ -317,9 +317,8 @@ static struct drm_plane *hdlcd_plane_init(struct 
> drm_device *drm)
>  formats, ARRAY_SIZE(formats),
>  NULL,
>  DRM_PLANE_TYPE_PRIMARY, NULL);
> - if (ret) {
> + if (ret)
>   return ERR_PTR(ret);
> - }
>  
>   drm_plane_helper_add(plane, &hdlcd_plane_helper_funcs);
>   hdlcd->plane = plane;
> -- 
> 2.13.6
> 

-- 

| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---
¯\_(ツ)_/¯
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 103463] [drm:amdgpu_get_bios [amdgpu]] *ERROR* ACPI VFCT table present but broken (too short #2)

2017-10-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103463

--- Comment #12 from Dennis Schridde  ---
P.S. If you have ANY hint, on how to gather more information about this issue,
I would be most grateful.  Maybe there is some way to make the kernel dump
stacktraces somewhere, or to make the hardware itself dump information
someplace...?

-- 
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 103463] [drm:amdgpu_get_bios [amdgpu]] *ERROR* ACPI VFCT table present but broken (too short #2)

2017-10-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103463

--- Comment #13 from Dennis Schridde  ---
Created attachment 135165
  --> https://bugs.freedesktop.org/attachment.cgi?id=135165&action=edit
Linux 4.13.10-gentoo config

-- 
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 v4 08/11] drm/arm/hdlcd: Use drm_gem_cma_print_info()

2017-10-30 Thread Noralf Trønnes
There is a new core debugfs file that prints fb/gem info:
/dri//framebuffer

Use drm_gem_cma_print_info() to provide info to that output instead
of using drm_fb_cma_debugfs_show().

Cc: Liviu Dudau 
Cc: Brian Starkey 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/arm/hdlcd_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index 764d0c83710c..59b21bdc0c30 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -230,7 +230,6 @@ static int hdlcd_show_pxlclock(struct seq_file *m, void 
*arg)
 static struct drm_info_list hdlcd_debugfs_list[] = {
{ "interrupt_count", hdlcd_show_underrun_count, 0 },
{ "clocks", hdlcd_show_pxlclock, 0 },
-   { "fb", drm_fb_cma_debugfs_show, 0 },
 };
 
 static int hdlcd_debugfs_init(struct drm_minor *minor)
@@ -252,6 +251,7 @@ static struct drm_driver hdlcd_driver = {
.irq_postinstall = hdlcd_irq_postinstall,
.irq_uninstall = hdlcd_irq_uninstall,
.gem_free_object_unlocked = drm_gem_cma_free_object,
+   .gem_print_info = drm_gem_cma_print_info,
.gem_vm_ops = &drm_gem_cma_vm_ops,
.dumb_create = drm_gem_cma_dumb_create,
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
-- 
2.14.2

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


[PATCH v4 01/11] drm/vma-manager: drm_vma_node_start() constify argument

2017-10-30 Thread Noralf Trønnes
Constify argument so functions calling into this take a const argument.

Reviewed-by: Ville Syrjälä 
Signed-off-by: Noralf Trønnes 
---
 include/drm/drm_vma_manager.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/drm/drm_vma_manager.h b/include/drm/drm_vma_manager.h
index d84d52f6d2b1..8758df94e9a0 100644
--- a/include/drm/drm_vma_manager.h
+++ b/include/drm/drm_vma_manager.h
@@ -152,7 +152,7 @@ static inline void drm_vma_node_reset(struct 
drm_vma_offset_node *node)
  * Start address of @node for page-based addressing. 0 if the node does not
  * have an offset allocated.
  */
-static inline unsigned long drm_vma_node_start(struct drm_vma_offset_node 
*node)
+static inline unsigned long drm_vma_node_start(const struct 
drm_vma_offset_node *node)
 {
return node->vm_node.start;
 }
-- 
2.14.2

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


[PATCH v4 02/11] drm/framebuffer: drm_framebuffer_read_refcount() constify argument

2017-10-30 Thread Noralf Trønnes
Constify argument so functions calling into this take a const argument.

Reviewed-by: Ville Syrjälä 
Signed-off-by: Noralf Trønnes 
---
 include/drm/drm_framebuffer.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h
index b6996ddb19d6..6cce22e1a0f2 100644
--- a/include/drm/drm_framebuffer.h
+++ b/include/drm/drm_framebuffer.h
@@ -263,7 +263,7 @@ static inline void drm_framebuffer_unreference(struct 
drm_framebuffer *fb)
  *
  * This functions returns the framebuffer's reference count.
  */
-static inline uint32_t drm_framebuffer_read_refcount(struct drm_framebuffer 
*fb)
+static inline uint32_t drm_framebuffer_read_refcount(const struct 
drm_framebuffer *fb)
 {
return kref_read(&fb->base.refcount);
 }
-- 
2.14.2

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


[PATCH v4 07/11] drm/arc: Use drm_gem_cma_print_info()

2017-10-30 Thread Noralf Trønnes
There is a new core debugfs file that prints fb/gem info:
/dri//framebuffer

Use drm_gem_cma_print_info() to provide info to that output instead
of using drm_fb_cma_debugfs_show().

Cc: Alexey Brodkin 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/arc/arcpgu_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
index 074fd4ea7ece..f067de4e1e82 100644
--- a/drivers/gpu/drm/arc/arcpgu_drv.c
+++ b/drivers/gpu/drm/arc/arcpgu_drv.c
@@ -155,7 +155,6 @@ static int arcpgu_show_pxlclock(struct seq_file *m, void 
*arg)
 
 static struct drm_info_list arcpgu_debugfs_list[] = {
{ "clocks", arcpgu_show_pxlclock, 0 },
-   { "fb", drm_fb_cma_debugfs_show, 0 },
 };
 
 static int arcpgu_debugfs_init(struct drm_minor *minor)
@@ -180,6 +179,7 @@ static struct drm_driver arcpgu_drm_driver = {
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
.gem_free_object_unlocked = drm_gem_cma_free_object,
+   .gem_print_info = drm_gem_cma_print_info,
.gem_vm_ops = &drm_gem_cma_vm_ops,
.gem_prime_export = drm_gem_prime_export,
.gem_prime_import = drm_gem_prime_import,
-- 
2.14.2

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


[PATCH v4 06/11] drm/cma-helper: Add drm_gem_cma_print_info()

2017-10-30 Thread Noralf Trønnes
Add drm_gem_cma_print_info() for debugfs printing
struct drm_gem_cma_object specific info.

Reviewed-by: Daniel Vetter 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/drm_gem_cma_helper.c | 19 +++
 include/drm/drm_gem_cma_helper.h |  5 -
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c 
b/drivers/gpu/drm/drm_gem_cma_helper.c
index 020e7668dfab..89dc7f04fae6 100644
--- a/drivers/gpu/drm/drm_gem_cma_helper.c
+++ b/drivers/gpu/drm/drm_gem_cma_helper.c
@@ -423,6 +423,25 @@ void drm_gem_cma_describe(struct drm_gem_cma_object 
*cma_obj,
 EXPORT_SYMBOL_GPL(drm_gem_cma_describe);
 #endif
 
+/**
+ * drm_gem_cma_print_info() - Print &drm_gem_cma_object info for debugfs
+ * @p: DRM printer
+ * @indent: Tab indentation level
+ * @gem: GEM object
+ *
+ * This function can be used as the &drm_driver->gem_print_info callback.
+ * It prints paddr and vaddr for use in e.g. debugfs output.
+ */
+void drm_gem_cma_print_info(struct drm_printer *p, unsigned int indent,
+   const struct drm_gem_object *obj)
+{
+   struct drm_gem_cma_object *cma_obj = to_drm_gem_cma_obj(obj);
+
+   drm_printf_indent(p, indent, "paddr=%pad\n", &cma_obj->paddr);
+   drm_printf_indent(p, indent, "vaddr=%p\n", cma_obj->vaddr);
+}
+EXPORT_SYMBOL(drm_gem_cma_print_info);
+
 /**
  * drm_gem_cma_prime_get_sg_table - provide a scatter/gather table of pinned
  * pages for a CMA GEM object
diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h
index 58a739bf15f1..bc47e6eba271 100644
--- a/include/drm/drm_gem_cma_helper.h
+++ b/include/drm/drm_gem_cma_helper.h
@@ -21,7 +21,7 @@ struct drm_gem_cma_object {
 };
 
 static inline struct drm_gem_cma_object *
-to_drm_gem_cma_obj(struct drm_gem_object *gem_obj)
+to_drm_gem_cma_obj(const struct drm_gem_object *gem_obj)
 {
return container_of(gem_obj, struct drm_gem_cma_object, base);
 }
@@ -94,6 +94,9 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file *filp,
 void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m);
 #endif
 
+void drm_gem_cma_print_info(struct drm_printer *p, unsigned int indent,
+   const struct drm_gem_object *obj);
+
 struct sg_table *drm_gem_cma_prime_get_sg_table(struct drm_gem_object *obj);
 struct drm_gem_object *
 drm_gem_cma_prime_import_sg_table(struct drm_device *dev,
-- 
2.14.2

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


[PATCH v4 04/11] drm/framebuffer: Add framebuffer debugfs file

2017-10-30 Thread Noralf Trønnes
Add debugfs file that dumps info about the framebuffers and its planes.
Also dump info about any connected gem object(s).

Reviewed-by: Daniel Vetter 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/drm_debugfs.c |  6 
 drivers/gpu/drm/drm_framebuffer.c | 59 +++
 drivers/gpu/drm/drm_gem.c | 17 +++
 drivers/gpu/drm/drm_internal.h|  7 +
 include/drm/drm_drv.h | 11 
 5 files changed, 100 insertions(+)

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index c1807d5754b2..550f29de6c1f 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -158,6 +158,12 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
}
}
 
+   ret = drm_framebuffer_debugfs_init(minor);
+   if (ret) {
+   DRM_ERROR("Failed to create framebuffer debugfs file\n");
+   return ret;
+   }
+
if (dev->driver->debugfs_init) {
ret = dev->driver->debugfs_init(minor);
if (ret) {
diff --git a/drivers/gpu/drm/drm_framebuffer.c 
b/drivers/gpu/drm/drm_framebuffer.c
index af279844d7ce..4f7873a1b922 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -25,7 +25,9 @@
 #include 
 #include 
 #include 
+#include 
 
+#include "drm_internal.h"
 #include "drm_crtc_internal.h"
 
 /**
@@ -955,3 +957,60 @@ int drm_framebuffer_plane_height(int height,
return fb_plane_height(height, fb->format, plane);
 }
 EXPORT_SYMBOL(drm_framebuffer_plane_height);
+
+void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent,
+   const struct drm_framebuffer *fb)
+{
+   struct drm_format_name_buf format_name;
+   int i;
+
+   drm_printf_indent(p, indent, "refcount=%d\n",
+ drm_framebuffer_read_refcount(fb));
+   drm_printf_indent(p, indent, "format=%s\n",
+ drm_get_format_name(fb->format->format, 
&format_name));
+   drm_printf_indent(p, indent, "modifier=0x%llx\n", fb->modifier);
+   drm_printf_indent(p, indent, "size=%dx%d\n", fb->width, fb->height);
+   drm_printf_indent(p, indent, "layers:\n");
+
+   for (i = 0; i < fb->format->num_planes; i++) {
+   drm_printf_indent(p, indent + 1, "size[%d]=%dx%d\n", i,
+ drm_framebuffer_plane_width(fb->width, fb, i),
+ drm_framebuffer_plane_height(fb->height, fb, 
i));
+   drm_printf_indent(p, indent + 1, "pitch[%d]=%u\n", i, 
fb->pitches[i]);
+   drm_printf_indent(p, indent + 1, "offset[%d]=%u\n", i, 
fb->offsets[i]);
+   drm_printf_indent(p, indent + 1, "obj[%d]:%s\n", i,
+ fb->obj[i] ? "" : "(null)");
+   if (fb->obj[i])
+   drm_gem_print_info(p, indent + 2, fb->obj[i]);
+   }
+}
+
+#ifdef CONFIG_DEBUG_FS
+static int drm_framebuffer_info(struct seq_file *m, void *data)
+{
+   struct drm_info_node *node = m->private;
+   struct drm_device *dev = node->minor->dev;
+   struct drm_printer p = drm_seq_file_printer(m);
+   struct drm_framebuffer *fb;
+
+   mutex_lock(&dev->mode_config.fb_lock);
+   drm_for_each_fb(fb, dev) {
+   drm_printf(&p, "framebuffer[%d]:\n", fb->base.id);
+   drm_framebuffer_print_info(&p, 1, fb);
+   }
+   mutex_unlock(&dev->mode_config.fb_lock);
+
+   return 0;
+}
+
+static const struct drm_info_list drm_framebuffer_debugfs_list[] = {
+   { "framebuffer", drm_framebuffer_info, 0 },
+};
+
+int drm_framebuffer_debugfs_init(struct drm_minor *minor)
+{
+   return drm_debugfs_create_files(drm_framebuffer_debugfs_list,
+   ARRAY_SIZE(drm_framebuffer_debugfs_list),
+   minor->debugfs_root, minor);
+}
+#endif
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 4c84b23d37cc..152bd6210dde 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "drm_internal.h"
 
 /** @file drm_gem.c
@@ -1040,3 +1041,19 @@ int drm_gem_mmap(struct file *filp, struct 
vm_area_struct *vma)
return ret;
 }
 EXPORT_SYMBOL(drm_gem_mmap);
+
+void drm_gem_print_info(struct drm_printer *p, unsigned int indent,
+   const struct drm_gem_object *obj)
+{
+   drm_printf_indent(p, indent, "name=%d\n", obj->name);
+   drm_printf_indent(p, indent, "refcount=%d\n",
+ kref_read(&obj->refcount));
+   drm_printf_indent(p, indent, "start=%08lx\n",
+ drm_vma_node_start(&obj->vma_node));
+   drm_printf_indent(p, indent, "size=%zu\n", obj->size);
+   drm_printf_indent(p, indent, "imported=%s\n",
+ obj->import_attach ? "yes" : "no");
+

[PATCH v4 00/11] drm/framebuffer: Add framebuffer debugfs file

2017-10-30 Thread Noralf Trønnes
This patchset adds a debugfs file that prints info about the
framebuffers.

I have followed the style of drm_state_info(). This means that the added
drm_framebuffer_print_info() could also be used in
drm_atomic_plane_print_state(). In order to do that I had to add a way
to vary indentation to fit both use cases.

Changes in this version is turning drm_printf_indent() into a macro and
converting the rest of the cma helper drivers.

This is how it looks:

$ sudo cat /sys/kernel/debug/dri/0/framebuffer
framebuffer[33]:
refcount=3
format=RG16 little-endian (0x36314752)
modifier=0x0
size=320x240
layers:
size[0]=320x240
pitch[0]=640
offset[0]=0
obj[0]:
name=0
refcount=1
start=0001
size=155648
imported=no
paddr=0x17c8
vaddr=d7c8

$ sudo cat /sys/kernel/debug/dri/0/state
plane[28]: plane-0
crtc=crtc-0
fb=33
refcount=3
format=RG16 little-endian (0x36314752)
modifier=0x0
size=320x240
layers:
size[0]=320x240
pitch[0]=640
offset[0]=0
obj[0]:
name=0
refcount=1
start=0001
size=155648
imported=no
paddr=0x17c8
vaddr=d7c8
crtc-pos=320x240+0+0
src-pos=320.00x240.00+0.00+0.00
rotation=1
crtc[29]: crtc-0



Changes since version 3:
- Applied patch: drm/gem: Remove trailing whitespace
- Turn drm_printf_indent() into a macro (Ville)
- drm_printf_indent() add overflow marker (Jani)
- Converted arc, hdlcd, tilcdc and removed drm_fb_cma_debugfs_show()

Noralf Trønnes (11):
  drm/vma-manager: drm_vma_node_start() constify argument
  drm/framebuffer: drm_framebuffer_read_refcount() constify argument
  drm/print: Add drm_printf_indent()
  drm/framebuffer: Add framebuffer debugfs file
  drm/atomic: Use drm_framebuffer_print_info()
  drm/cma-helper: Add drm_gem_cma_print_info()
  drm/arc: Use drm_gem_cma_print_info()
  drm/arm/hdlcd: Use drm_gem_cma_print_info()
  drm/tilcdc: Use drm_gem_cma_print_info()
  drm/tinydrm: Use drm_gem_cma_print_info()
  drm/cma-helper: Remove drm_fb_cma_debugfs_show()

 drivers/gpu/drm/arc/arcpgu_drv.c |  2 +-
 drivers/gpu/drm/arm/hdlcd_drv.c  |  2 +-
 drivers/gpu/drm/drm_atomic.c | 18 ++-
 drivers/gpu/drm/drm_debugfs.c|  6 
 drivers/gpu/drm/drm_fb_cma_helper.c  | 37 --
 drivers/gpu/drm/drm_framebuffer.c| 59 
 drivers/gpu/drm/drm_gem.c| 17 +++
 drivers/gpu/drm/drm_gem_cma_helper.c | 31 ---
 drivers/gpu/drm/drm_internal.h   |  7 +
 drivers/gpu/drm/tilcdc/tilcdc_drv.c  |  2 +-
 drivers/gpu/drm/tinydrm/mipi-dbi.c   |  8 +
 include/drm/drm_drv.h| 11 +++
 include/drm/drm_fb_cma_helper.h  |  6 
 include/drm/drm_framebuffer.h|  2 +-
 include/drm/drm_gem_cma_helper.h |  7 ++---
 include/drm/drm_print.h  |  8 +
 include/drm/drm_vma_manager.h|  2 +-
 include/drm/tinydrm/tinydrm.h|  1 +
 18 files changed, 133 insertions(+), 93 deletions(-)

--
2.14.2

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


[PATCH v4 03/11] drm/print: Add drm_printf_indent()

2017-10-30 Thread Noralf Trønnes
Add drm_printf_indent() that adds tab indentation according to argument.
Indentation overflow is marked with an X.

Reviewed-by: Daniel Vetter 
Signed-off-by: Noralf Trønnes 
---

Changes since version 3:
- Turn drm_printf_indent() into a macro (Ville)
- drm_printf_indent() add overflow marker (Jani)

 include/drm/drm_print.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index 7b9c86a6ca3e..7dbfdebec973 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -80,6 +80,14 @@ void __drm_printfn_debug(struct drm_printer *p, struct 
va_format *vaf);
 __printf(2, 3)
 void drm_printf(struct drm_printer *p, const char *f, ...);
 
+/**
+ * drm_printf_indent - Print to a &drm_printer stream with indentation
+ * @printer: DRM printer
+ * @indent: Tab indentation level (max 5)
+ * @fmt: Format string
+ */
+#define drm_printf_indent(printer, indent, fmt, ...) \
+   drm_printf((printer), "%.*s" fmt, (indent), "\t\t\t\t\tX", 
##__VA_ARGS__)
 
 /**
  * drm_seq_file_printer - construct a &drm_printer that outputs to &seq_file
-- 
2.14.2

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


[PATCH v4 09/11] drm/tilcdc: Use drm_gem_cma_print_info()

2017-10-30 Thread Noralf Trønnes
There is a new core debugfs file that prints fb/gem info:
/dri//framebuffer

Use drm_gem_cma_print_info() to provide info to that output instead
of using drm_fb_cma_debugfs_show().

Cc: Jyri Sarha 
Cc: Tomi Valkeinen 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c 
b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 72ce063aa0d8..bc4feb3a84b9 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -507,7 +507,6 @@ static int tilcdc_mm_show(struct seq_file *m, void *arg)
 static struct drm_info_list tilcdc_debugfs_list[] = {
{ "regs", tilcdc_regs_show, 0 },
{ "mm",   tilcdc_mm_show,   0 },
-   { "fb",   drm_fb_cma_debugfs_show, 0 },
 };
 
 static int tilcdc_debugfs_init(struct drm_minor *minor)
@@ -541,6 +540,7 @@ static struct drm_driver tilcdc_driver = {
.lastclose  = tilcdc_lastclose,
.irq_handler= tilcdc_irq,
.gem_free_object_unlocked = drm_gem_cma_free_object,
+   .gem_print_info = drm_gem_cma_print_info,
.gem_vm_ops = &drm_gem_cma_vm_ops,
.dumb_create= drm_gem_cma_dumb_create,
 
-- 
2.14.2

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


[PATCH v4 05/11] drm/atomic: Use drm_framebuffer_print_info()

2017-10-30 Thread Noralf Trønnes
Use drm_framebuffer_print_info() to print framebuffer info in
drm_atomic_plane_print_state(). This will give optional GEM info as well.

Reviewed-by: Daniel Vetter 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/drm_atomic.c | 18 +++---
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 6c9c4a8e09af..6d626355ba4e 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -33,6 +33,7 @@
 #include 
 
 #include "drm_crtc_internal.h"
+#include "drm_internal.h"
 
 void __drm_crtc_commit_free(struct kref *kref)
 {
@@ -934,21 +935,8 @@ static void drm_atomic_plane_print_state(struct 
drm_printer *p,
drm_printf(p, "plane[%u]: %s\n", plane->base.id, plane->name);
drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : 
"(null)");
drm_printf(p, "\tfb=%u\n", state->fb ? state->fb->base.id : 0);
-   if (state->fb) {
-   struct drm_framebuffer *fb = state->fb;
-   int i, n = fb->format->num_planes;
-   struct drm_format_name_buf format_name;
-
-   drm_printf(p, "\t\tformat=%s\n",
- drm_get_format_name(fb->format->format, 
&format_name));
-   drm_printf(p, "\t\t\tmodifier=0x%llx\n", fb->modifier);
-   drm_printf(p, "\t\tsize=%dx%d\n", fb->width, fb->height);
-   drm_printf(p, "\t\tlayers:\n");
-   for (i = 0; i < n; i++) {
-   drm_printf(p, "\t\t\tpitch[%d]=%u\n", i, 
fb->pitches[i]);
-   drm_printf(p, "\t\t\toffset[%d]=%u\n", i, 
fb->offsets[i]);
-   }
-   }
+   if (state->fb)
+   drm_framebuffer_print_info(p, 2, state->fb);
drm_printf(p, "\tcrtc-pos=" DRM_RECT_FMT "\n", DRM_RECT_ARG(&dest));
drm_printf(p, "\tsrc-pos=" DRM_RECT_FP_FMT "\n", DRM_RECT_FP_ARG(&src));
drm_printf(p, "\trotation=%x\n", state->rotation);
-- 
2.14.2

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


[PATCH v4 11/11] drm/cma-helper: Remove drm_fb_cma_debugfs_show()

2017-10-30 Thread Noralf Trønnes
drm_fb_cma_debugfs_show() and drm_gem_cma_describe() are superseded
by drm_framebuffer_debugfs_init() and drm_gem_cma_print_info().

Cc: Laurent Pinchart 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/drm_fb_cma_helper.c  | 37 
 drivers/gpu/drm/drm_gem_cma_helper.c | 26 -
 include/drm/drm_fb_cma_helper.h  |  6 --
 include/drm/drm_gem_cma_helper.h |  4 
 4 files changed, 73 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c 
b/drivers/gpu/drm/drm_fb_cma_helper.c
index 0e3c14174d08..35b56dfba929 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -130,43 +130,6 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer 
*fb,
 }
 EXPORT_SYMBOL_GPL(drm_fb_cma_get_gem_addr);
 
-#ifdef CONFIG_DEBUG_FS
-static void drm_fb_cma_describe(struct drm_framebuffer *fb, struct seq_file *m)
-{
-   int i;
-
-   seq_printf(m, "fb: %dx%d@%4.4s\n", fb->width, fb->height,
-   (char *)&fb->format->format);
-
-   for (i = 0; i < fb->format->num_planes; i++) {
-   seq_printf(m, "   %d: offset=%d pitch=%d, obj: ",
-   i, fb->offsets[i], fb->pitches[i]);
-   drm_gem_cma_describe(drm_fb_cma_get_gem_obj(fb, i), m);
-   }
-}
-
-/**
- * drm_fb_cma_debugfs_show() - Helper to list CMA framebuffer objects
- *in debugfs.
- * @m: output file
- * @arg: private data for the callback
- */
-int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg)
-{
-   struct drm_info_node *node = (struct drm_info_node *) m->private;
-   struct drm_device *dev = node->minor->dev;
-   struct drm_framebuffer *fb;
-
-   mutex_lock(&dev->mode_config.fb_lock);
-   drm_for_each_fb(fb, dev)
-   drm_fb_cma_describe(fb, m);
-   mutex_unlock(&dev->mode_config.fb_lock);
-
-   return 0;
-}
-EXPORT_SYMBOL_GPL(drm_fb_cma_debugfs_show);
-#endif
-
 static int drm_fb_cma_mmap(struct fb_info *info, struct vm_area_struct *vma)
 {
return dma_mmap_writecombine(info->device, vma, info->screen_base,
diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c 
b/drivers/gpu/drm/drm_gem_cma_helper.c
index 89dc7f04fae6..9b99f9feb432 100644
--- a/drivers/gpu/drm/drm_gem_cma_helper.c
+++ b/drivers/gpu/drm/drm_gem_cma_helper.c
@@ -397,32 +397,6 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file 
*filp,
 EXPORT_SYMBOL_GPL(drm_gem_cma_get_unmapped_area);
 #endif
 
-#ifdef CONFIG_DEBUG_FS
-/**
- * drm_gem_cma_describe - describe a CMA GEM object for debugfs
- * @cma_obj: CMA GEM object
- * @m: debugfs file handle
- *
- * This function can be used to dump a human-readable representation of the
- * CMA GEM object into a synthetic file.
- */
-void drm_gem_cma_describe(struct drm_gem_cma_object *cma_obj,
- struct seq_file *m)
-{
-   struct drm_gem_object *obj = &cma_obj->base;
-   uint64_t off;
-
-   off = drm_vma_node_start(&obj->vma_node);
-
-   seq_printf(m, "%2d (%2d) %08llx %pad %p %zu",
-   obj->name, kref_read(&obj->refcount),
-   off, &cma_obj->paddr, cma_obj->vaddr, obj->size);
-
-   seq_printf(m, "\n");
-}
-EXPORT_SYMBOL_GPL(drm_gem_cma_describe);
-#endif
-
 /**
  * drm_gem_cma_print_info() - Print &drm_gem_cma_object info for debugfs
  * @p: DRM printer
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
index 023f052a5873..a613ff022e6c 100644
--- a/include/drm/drm_fb_cma_helper.h
+++ b/include/drm/drm_fb_cma_helper.h
@@ -35,11 +35,5 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer 
*fb,
   struct drm_plane_state *state,
   unsigned int plane);
 
-#ifdef CONFIG_DEBUG_FS
-struct seq_file;
-
-int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg);
-#endif
-
 #endif
 
diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h
index bc47e6eba271..08375115fdc0 100644
--- a/include/drm/drm_gem_cma_helper.h
+++ b/include/drm/drm_gem_cma_helper.h
@@ -90,10 +90,6 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file 
*filp,
unsigned long flags);
 #endif
 
-#ifdef CONFIG_DEBUG_FS
-void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m);
-#endif
-
 void drm_gem_cma_print_info(struct drm_printer *p, unsigned int indent,
const struct drm_gem_object *obj);
 
-- 
2.14.2

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


[PATCH v4 10/11] drm/tinydrm: Use drm_gem_cma_print_info()

2017-10-30 Thread Noralf Trønnes
There is a new core debugfs file that prints fb/gem info:
/dri//framebuffer

Use drm_gem_cma_print_info() to provide info to that output instead
of using drm_fb_cma_debugfs_show().

Reviewed-by: Daniel Vetter 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/tinydrm/mipi-dbi.c | 8 +---
 include/drm/tinydrm/tinydrm.h  | 1 +
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c 
b/drivers/gpu/drm/tinydrm/mipi-dbi.c
index d43e992ab432..347f9b226f26 100644
--- a/drivers/gpu/drm/tinydrm/mipi-dbi.c
+++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c
@@ -961,10 +961,6 @@ static const struct file_operations 
mipi_dbi_debugfs_command_fops = {
.write = mipi_dbi_debugfs_command_write,
 };
 
-static const struct drm_info_list mipi_dbi_debugfs_list[] = {
-   { "fb",   drm_fb_cma_debugfs_show, 0 },
-};
-
 /**
  * mipi_dbi_debugfs_init - Create debugfs entries
  * @minor: DRM minor
@@ -987,9 +983,7 @@ int mipi_dbi_debugfs_init(struct drm_minor *minor)
debugfs_create_file("command", mode, minor->debugfs_root, mipi,
&mipi_dbi_debugfs_command_fops);
 
-   return drm_debugfs_create_files(mipi_dbi_debugfs_list,
-   ARRAY_SIZE(mipi_dbi_debugfs_list),
-   minor->debugfs_root, minor);
+   return 0;
 }
 EXPORT_SYMBOL(mipi_dbi_debugfs_init);
 
diff --git a/include/drm/tinydrm/tinydrm.h b/include/drm/tinydrm/tinydrm.h
index 4774fe3d4273..423828922e5a 100644
--- a/include/drm/tinydrm/tinydrm.h
+++ b/include/drm/tinydrm/tinydrm.h
@@ -46,6 +46,7 @@ pipe_to_tinydrm(struct drm_simple_display_pipe *pipe)
  */
 #define TINYDRM_GEM_DRIVER_OPS \
.gem_free_object= tinydrm_gem_cma_free_object, \
+   .gem_print_info = drm_gem_cma_print_info, \
.gem_vm_ops = &drm_gem_cma_vm_ops, \
.prime_handle_to_fd = drm_gem_prime_handle_to_fd, \
.prime_fd_to_handle = drm_gem_prime_fd_to_handle, \
-- 
2.14.2

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


[Bug 78562] [gma500] wrong pixel clock on LVDS (half the correct frequency)

2017-10-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=78562

mirh  changed:

   What|Removed |Added

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

--- Comment #19 from mirh  ---
Can be closed then?
Fixed in 82bc9a42cf854fdf63155759c0aa790bd1f361b0 that landed in 4.12-rc3

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


RE: [PATCH] drm/ttm: once more fix ttm_buffer_object_transfer

2017-10-30 Thread Deucher, Alexander
> -Original Message-
> From: amd-gfx [mailto:amd-gfx-boun...@lists.freedesktop.org] On Behalf
> Of Christian König
> Sent: Monday, October 30, 2017 10:00 AM
> To: dri-devel@lists.freedesktop.org; amd-...@lists.freedesktop.org
> Subject: [PATCH] drm/ttm: once more fix ttm_buffer_object_transfer
> 
> From: Christian König 
> 
> When the mutex is locked just in the moment we copy it we end up with a
> warning that we release a locked mutex.
> 
> Fix this by properly reinitializing the mutex.
> 
> Signed-off-by: Christian König 

Reviewed-by: Alex Deucher 

Stable?

Alex

> ---
>  drivers/gpu/drm/ttm/ttm_bo_util.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c
> b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index 78cb99be7146..e7a519f1849b 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -474,6 +474,7 @@ static int ttm_buffer_object_transfer(struct
> ttm_buffer_object *bo,
>   INIT_LIST_HEAD(&fbo->lru);
>   INIT_LIST_HEAD(&fbo->swap);
>   INIT_LIST_HEAD(&fbo->io_reserve_lru);
> + mutex_init(&fbo->wu_mutex);
>   fbo->moving = NULL;
>   drm_vma_node_reset(&fbo->vma_node);
>   atomic_set(&fbo->cpu_writers, 0);
> --
> 2.11.0
> 
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 103489] [Regression bisected]: vblank time outs and machine hangs on RX560 drm-next-4.15-dc

2017-10-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103489

--- Comment #2 from osch...@web.de ---
OK, I took another look and the first commit which boots and exhibits the
problem is 8459f633b65a81979b9b233ed0a91a9fdc98b7bd

-- 
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 103519] EFL apps crash on start with mesa 17.2

2017-10-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103519

Bug ID: 103519
   Summary: EFL apps crash on start with mesa 17.2
   Product: Mesa
   Version: 17.2
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/DRI/i915
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: barz...@gmail.com
QA Contact: dri-devel@lists.freedesktop.org

Atom N270, GPU 945GSE. Running wayland and Enlightenment git.

Since mesa 17.2 EFL apps crash on start. Reverting back to 17.1.8 fixes the
problem.

I don't have mesa build with debug symbols but the problem seems to be in
libEGL_mesa.

-- 
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 103463] [drm:amdgpu_get_bios [amdgpu]] *ERROR* ACPI VFCT table present but broken (too short #2)

2017-10-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103463

--- Comment #14 from Dennis Schridde  ---
Created attachment 135171
  --> https://bugs.freedesktop.org/attachment.cgi?id=135171&action=edit
photo of screen when kernel hangs

Please find attached a photo of the screen contents, with "verbose debug" in
the kernel command line, at the time when the kernel hangs. If you have a tip
on how to get the full log in text form, even though the kernel hangs, that
would be great and might give us additional information on what is actually
happening.

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


Re: [PATCH] drm: Enable pr_debug() for drm_printer

2017-10-30 Thread Sean Paul
On Fri, Oct 27, 2017 at 12:06:02PM +0100, Chris Wilson wrote:
> pr_debug() is conditionally compiled and requires either
> dynamic-debugging to be enabled or for the code to opt-in using #define
> DEBUG. Since drm_print provides a central debugging facility using
> pr_debug(), make sure it will always produce output.
> 
> Signed-off-by: Chris Wilson 
> Cc: Rob Clark 
> Cc: Daniel Vetter 

Applied to drm-misc-next

Thanks!

Sean

> ---
>  drivers/gpu/drm/drm_print.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
> index 0b3bf476dc4b..82ff327eb2df 100644
> --- a/drivers/gpu/drm/drm_print.c
> +++ b/drivers/gpu/drm/drm_print.c
> @@ -23,6 +23,8 @@
>   * Rob Clark 
>   */
>  
> +#define DEBUG /* for pr_debug() */
> +
>  #include 
>  #include 
>  #include 
> -- 
> 2.15.0.rc2
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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


  1   2   >