[PATCH v7 02/14] drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.

2015-12-15 Thread Daniel Kurtz
HI Philipp,

This driver is looking really good.

But, still some things to think about (mostly small) inline below...

On Tue, Dec 1, 2015 at 5:07 AM, Philipp Zabel  wrote:
> From: CK Hu 
>
> This patch adds an initial DRM driver for the Mediatek MT8173 DISP
> subsystem. It currently supports two fixed output streams from the
> OVL0/OVL1 sources to the DSI0/DPI0 sinks, respectively.
>
> Signed-off-by: CK Hu 
> Signed-off-by: YT Shen 
> Signed-off-by: Philipp Zabel 
> ---
> Changes since v6:
>  - Split disp_ovl driver from mtk_drm_crtc code
>  - Added crtc and plane state atomic reset functions
>  - Toned down debug messages
>  - Improved error handling for hardware initialization
>  - Get/put smi_larb in crtc_enable/disable
>  - Added memory barrier before marking crtc state as ready
>  - Changed crtc_disable to wait for vblank
>  - Renamed component power_on/off to start/stop
>  - Made component ops optional
>  - Moved crtc creation from disp_ovl driver bind callback into 
> mtk_drm_kms_init
>  - Various fixes
>  - Added support for DRIVER_PRIME feature
>  - Moved DISP_OVL, DSI, DPI and component initialization into the respective 
> drivers
> ---
>  drivers/gpu/drm/Kconfig |   2 +
>  drivers/gpu/drm/Makefile|   1 +
>  drivers/gpu/drm/mediatek/Kconfig|  16 +
>  drivers/gpu/drm/mediatek/Makefile   |  11 +
>  drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 301 +++
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 565 
> 
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.h |  31 ++
>  drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 355 +
>  drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |  41 ++
>  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 275 ++
>  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 148 
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c  | 562 +++
>  drivers/gpu/drm/mediatek/mtk_drm_drv.h  |  53 +++
>  drivers/gpu/drm/mediatek/mtk_drm_fb.c   | 135 +++
>  drivers/gpu/drm/mediatek/mtk_drm_fb.h   |  28 ++
>  drivers/gpu/drm/mediatek/mtk_drm_gem.c  | 227 +++
>  drivers/gpu/drm/mediatek/mtk_drm_gem.h  |  55 +++
>  drivers/gpu/drm/mediatek/mtk_drm_plane.c| 238 
>  drivers/gpu/drm/mediatek/mtk_drm_plane.h|  58 +++
>  19 files changed, 3102 insertions(+)
>  create mode 100644 drivers/gpu/drm/mediatek/Kconfig
>  create mode 100644 drivers/gpu/drm/mediatek/Makefile
>  create mode 100644 drivers/gpu/drm/mediatek/mtk_disp_ovl.c
>  create mode 100644 drivers/gpu/drm/mediatek/mtk_drm_crtc.c
>  create mode 100644 drivers/gpu/drm/mediatek/mtk_drm_crtc.h
>  create mode 100644 drivers/gpu/drm/mediatek/mtk_drm_ddp.c
>  create mode 100644 drivers/gpu/drm/mediatek/mtk_drm_ddp.h
>  create mode 100644 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
>  create mode 100644 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
>  create mode 100644 drivers/gpu/drm/mediatek/mtk_drm_drv.c
>  create mode 100644 drivers/gpu/drm/mediatek/mtk_drm_drv.h
>  create mode 100644 drivers/gpu/drm/mediatek/mtk_drm_fb.c
>  create mode 100644 drivers/gpu/drm/mediatek/mtk_drm_fb.h
>  create mode 100644 drivers/gpu/drm/mediatek/mtk_drm_gem.c
>  create mode 100644 drivers/gpu/drm/mediatek/mtk_drm_gem.h
>  create mode 100644 drivers/gpu/drm/mediatek/mtk_drm_plane.c
>  create mode 100644 drivers/gpu/drm/mediatek/mtk_drm_plane.h
>
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index c4bf9a1..8fdb0c2 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -266,3 +266,5 @@ source "drivers/gpu/drm/amd/amdkfd/Kconfig"
>  source "drivers/gpu/drm/imx/Kconfig"
>
>  source "drivers/gpu/drm/vc4/Kconfig"
> +
> +source "drivers/gpu/drm/mediatek/Kconfig"
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index 1e9ff4c..607a49f 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -71,6 +71,7 @@ obj-$(CONFIG_DRM_MSM) += msm/
>  obj-$(CONFIG_DRM_TEGRA) += tegra/
>  obj-$(CONFIG_DRM_STI) += sti/
>  obj-$(CONFIG_DRM_IMX) += imx/
> +obj-$(CONFIG_DRM_MEDIATEK) += mediatek/
>  obj-y  += i2c/
>  obj-y  += panel/
>  obj-y  += bridge/
> diff --git a/drivers/gpu/drm/mediatek/Kconfig 
> b/drivers/gpu/drm/mediatek/Kconfig
> new file mode 100644
> index 000..5343cf1
> --- /dev/null
> +++ b/drivers/gpu/drm/mediatek/Kconfig
> @@ -0,0 +1,16 @@
> +config DRM_MEDIATEK
> +   tristate "DRM Support for Mediatek SoCs"
> +   depends on DRM
> +   depends on ARCH_MEDIATEK || (ARM && COMPILE_TEST)
> +   select MTK_SMI
> +   select DRM_PANEL
> +   select DRM_MIPI_DSI
> +   select DRM_PANEL_SIMPLE
> +   select DRM_KMS_HELPER
> +   select IOMMU_DMA

nit: alphabetize these selects ?

> +   help
> + Choose this option if you have a Mediatek SoCs.
> + The module will be called mediatek-drm
> + This driver provid

[PATCH v10 0/17] Add Analogix Core Display Port Driver

2015-12-15 Thread Heiko Stübner
Hi Yakir,

Am Montag, 7. Dezember 2015, 14:37:19 schrieb Yakir Yang:
>The Samsung Exynos eDP controller and Rockchip RK3288 eDP controller
> share the same IP, so a lot of parts can be re-used. I split the common
> code into bridge directory, then rk3288 and exynos only need to keep
> some platform code. Cause I can't find the exact IP name of exynos dp
> controller, so I decide to name dp core driver with "analogix" which I
> find in rk3288 eDP TRM

so it looks like the hotplug works nicely now. I was able to test it 
sucessfully on both a Jerry and a Minnie device without needing to force 
hotplug :-) .

As I needed to adapt some patches when applying the lastest ones, I think it 
would be good for a full send of the latest version as v11.

When going over the patches before sending, please also fix the indentation 
issues in analogix_dp_core.h - both newly added elements to analogix_dp_device 
use spaces between type and name, where the rest uses tabs.
[This should of course be fixed in the patches adding these lines :-) ]


Heiko


i915 warning in drm-next

2015-12-15 Thread Dave Airlie
home/airlied/devel/kernel/drm-next/drivers/gpu/drm/i915/intel_display.c:5217:0:
warning: "for_each_power_domain" redefined
 #define for_each_power_domain(domain, mask)\
 ^
In file included from
/home/airlied/devel/kernel/drm-next/drivers/gpu/drm/i915/intel_drv.h:32:0,
 from
/home/airlied/devel/kernel/drm-next/drivers/gpu/drm/i915/intel_display.c:36:
/home/airlied/devel/kernel/drm-next/drivers/gpu/drm/i915/i915_drv.h:312:0:
note: this is the location of the previous definition
 #define for_each_power_domain(domain, mask)\
 ^
I may have mismerged something.

Dave.


[Bug 93217] [tonga] [powerplay] Radon M395X isn't initialised with the powerplay branch

2015-12-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93217

Mike Lothian  changed:

   What|Removed |Added

 Attachment #120285|0   |1
is obsolete||
 Attachment #120501|0   |1
is obsolete||

--- Comment #16 from Mike Lothian  ---
Created attachment 120507
  --> https://bugs.freedesktop.org/attachment.cgi?id=120507&action=edit
Powerplay working

I still have to set pcie_dpm_key_disabled = 1 

I had to turn of pid cgroups for some reason

I also had to turn off runpm, it seems the card is initialised the first time
then when it's powered back up has a hissy fit

I tested Metro 2033 Redux so I know I was definitely running on Tonga but I
locked up the system setting everything to max

Progress :D

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20151215/7362d28a/attachment-0001.html>


[Bug 93217] [tonga] [powerplay] Radon M395X isn't initialised with the powerplay branch

2015-12-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93217

--- Comment #17 from Mike Lothian  ---
The card is also reported my lm_sensors - someone asked about this on IRC the
other day

amdgpu-pci-0100
Adapter: PCI adapter
temp1:+59.0°C  (crit =  +0.0°C, hyst =  +0.0°C)

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20151215/ab8d59fa/attachment.html>


i915 warning in drm-next

2015-12-15 Thread Dave Airlie
> In file included from
> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/i915/intel_drv.h:32:0,
>  from
> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/i915/intel_display.c:36:
> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/i915/i915_drv.h:312:0:
> note: this is the location of the previous definition
>  #define for_each_power_domain(domain, mask)\
>  ^
> I may have mismerged something.

Ah ignore me the subsequent drm-intel-next pull fixed it up.

Thanks.
Dave.


-next trees and my time this cycle

2015-12-15 Thread Dave Airlie
On 13 December 2015 at 05:09, Linus Torvalds
 wrote:
> On Thu, Dec 10, 2015 at 10:58 PM, Dave Airlie  wrote:
>>
>> So since Xmas is coming up and I've got an impending new arrival, I'm
>> betting this merge window might get a bit haphazard. So I'd like
>> people to start telling me now via git pull's what they'd like to get
>> in.
>
> So the rest of the world may not have an impending new arrival, but
> with pretty much everybody doing Christmas break, I don't really
> foresee opening the merge window immediately after the holidays. I
> can't reasonably expect people to get ready for the merge window while
> being drunk on eggnog or whatever.
>
> If 4.4 stays on the usual schedule (and there's currently no big
> reason to think it shouldn't), I'd do the final rc late December, and
> final release on the Sunday of Jan 3rd.
>
> But really, if I want people to be *ready* when the merge window
> opens, rather than start working on it, I'd better delay the opening
> of the merge window by at least a week.
>
> So right now my tentative plan is to open the 4.5 merge window on Jan 10th.

Cool I might be a bit late, but that should work for me.

>
> Can't help with your impending new arrival, though. I thought you said
> you had figured out why that kept happening?

I thought becoming a kernel hacker would fix it.

Dave.


[PATCH v6 1/2] Documentation: bridge: Add documentation for ps8640 DT properties

2015-12-15 Thread Jitao Shi
Add documentation for DT properties supported by
ps8640 DSI-eDP converter.

Signed-off-by: Jitao Shi 
Acked-by: Rob Herring 
Reviewed-by: Philipp Zabel 
---
Changes since v5
-no changes
---
 .../devicetree/bindings/display/bridge/ps8640.txt  |   43 
 1 file changed, 43 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/ps8640.txt

diff --git a/Documentation/devicetree/bindings/display/bridge/ps8640.txt 
b/Documentation/devicetree/bindings/display/bridge/ps8640.txt
new file mode 100644
index 000..a3e0971
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/ps8640.txt
@@ -0,0 +1,43 @@
+ps8640-bridge bindings
+
+Required properties:
+   - compatible: "parade,ps8640"
+   - reg: first page address of the bridge.
+   - sleep-gpios: OF device-tree gpio specification for PD_ pin.
+   - reset-gpios: OF device-tree gpio specification for reset pin.
+   - mode-sel-gpios: OF device-tree gpio specification for mode-sel pin.
+   - vdd12-supply: OF device-tree regulator specification for 1.2V power.
+   - vdd33-supply: OF device-tree regulator specification for 3.3V power.
+   - ports: The device node can contain video interface port nodes per
+the video-interfaces bind[1]. For port at 0,set the reg = <0> 
as
+ps8640 dsi in and port at 1,set the reg = <1> as ps8640 eDP 
out.
+
+[1]: Documentation/devicetree/bindings/media/video-interfaces.txt
+
+Example:
+   edp-bridge at 18 {
+   compatible = "parade,ps8640";
+   reg = <0x18>;
+   sleep-gpios = <&pio 116 GPIO_ACTIVE_HIGH>;
+   reset-gpios = <&pio 115 GPIO_ACTIVE_HIGH>;
+   mode-sel-gpios = <&pio 92 GPIO_ACTIVE_HIGH>;
+   vdd12-supply = <&ps8640_fixed_1v2>;
+   vdd33-supply = <&mt6397_vgp2_reg>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   port at 0 {
+   reg = <0>;
+   ps8640_in: endpoint {
+   remote-endpoint = <&dsi0_out>;
+   };
+   };
+   port at 1 {
+   reg = <1>;
+   ps8640_out: endpoint {
+   remote-endpoint = <&panel_in>;
+   };
+   };
+   };
+   };
-- 
1.7.9.5



[PATCH v6 2/2] drm/bridge: Add I2C based driver for ps8640 bridge

2015-12-15 Thread Jitao Shi
This patch adds drm_bridge driver for parade DSI to eDP bridge chip.

Signed-off-by: Jitao Shi 
---
Changes since v5
-fix compile errors when CONFIG_GPIOLIB=n
---
 drivers/gpu/drm/bridge/Kconfig |   10 +
 drivers/gpu/drm/bridge/Makefile|1 +
 drivers/gpu/drm/bridge/parade-ps8640.c |  472 
 3 files changed, 483 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/parade-ps8640.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 639..dcfdbc9 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -41,4 +41,14 @@ config DRM_PARADE_PS8622
---help---
  Parade eDP-LVDS bridge chip driver.

+config DRM_PARADE_PS8640
+   tristate "Parade PS8640 MIPI DSI to eDP Converter"
+   depends on OF
+   select DRM_KMS_HELPER
+   select DRM_PANEL
+   ---help---
+ Choose this option if you have PS8640 for display
+ The PS8640 is a high-performance and low-power
+ MIPI DSI to eDP converter
+
 endmenu
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index d4e28be..272e3c01 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -4,3 +4,4 @@ obj-$(CONFIG_DRM_DW_HDMI) += dw_hdmi.o
 obj-$(CONFIG_DRM_DW_HDMI_AHB_AUDIO) += dw_hdmi-ahb-audio.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
 obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
+obj-$(CONFIG_DRM_PARADE_PS8640) += parade-ps8640.o
diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c 
b/drivers/gpu/drm/bridge/parade-ps8640.c
new file mode 100644
index 000..bf0c3c37
--- /dev/null
+++ b/drivers/gpu/drm/bridge/parade-ps8640.c
@@ -0,0 +1,472 @@
+/*
+ * Copyright (c) 2014 MediaTek Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define PAGE2_GPIO_L   0xa6
+#define PAGE2_GPIO_H   0xa7
+#define PS_GPIO9   BIT(1)
+#define PAGE2_I2C_BYPASS   0xea
+#define I2C_BYPASS_EN  0xd0
+
+#define PAGE3_SET_ADD  0xfe
+#define PAGE3_SET_VAL  0xff
+#define VDO_CTL_ADD0x13
+#define VDO_DIS0x18
+#define VDO_EN 0x1c
+
+#define PAGE4_REV_L0xf0
+#define PAGE4_REV_H0xf1
+#define PAGE4_CHIP_L   0xf2
+#define PAGE4_CHIP_H   0xf3
+
+#define bridge_to_ps8640(e)container_of(e, struct ps8640, bridge)
+#define connector_to_ps8640(e) container_of(e, struct ps8640, connector)
+
+struct ps8640 {
+   struct drm_connector connector;
+   struct drm_bridge bridge;
+   struct i2c_client *page[6];
+   struct ps8640_driver_data *driver_data;
+   struct regulator *pwr_1v2_supply;
+   struct regulator *pwr_3v3_supply;
+   struct drm_panel *panel;
+   struct gpio_desc *gpio_rst_n;
+   struct gpio_desc *gpio_slp_n;
+   struct gpio_desc *gpio_mode_sel_n;
+   bool enabled;
+};
+
+static int ps8640_regr(struct i2c_client *client, u8 reg, u8 *value)
+{
+   int ret;
+
+   ret = i2c_master_send(client, ®, 1);
+   if (ret <= 0) {
+   dev_err(&client->dev, "Failed to send i2c command, ret=%d\n",
+   ret);
+   return ret;
+   }
+
+   ret = i2c_master_recv(client, value, 1);
+   if (ret <= 0) {
+   dev_err(&client->dev, "Failed to recv i2c data, ret=%d\n", ret);
+   return ret;
+   }
+
+   return 0;
+}
+
+static int ps8640_regw(struct i2c_client *client, u8 reg, u8 value)
+{
+   int ret;
+   char buf[2];
+
+   buf[0] = reg;
+   buf[1] = value;
+   ret = i2c_master_send(client, buf, ARRAY_SIZE(buf));
+   if (ret <= 0) {
+   dev_err(&client->dev, "Failed to send i2c command, ret=%d\n",
+   ret);
+   return ret;
+   }
+
+   return 0;
+}
+
+static bool ps8640_check_valid_id(struct ps8640 *ps_bridge)
+{
+   struct i2c_client *client = ps_bridge->page[4];
+   u8 rev_id_low, rev_id_high, chip_id_low, chip_id_high;
+   int retry_cnt = 0;
+
+   do {
+   ps8640_regr(client, PAGE4_CHIP_H, &chip_id_high);
+   if (chip_id_high != 0x30)
+   dev_info(&client->dev, "chip_id_high = 0x%x\n",
+chip_id_high);
+   } while ((retry_cnt++ < 2) && (chip_id_high != 0x30));
+
+

[PATCH v6 2/2] drm/bridge: Add I2C based driver for ps8640 bridge

2015-12-15 Thread Daniel Kurtz
On Tue, Dec 15, 2015 at 11:30 AM, Jitao Shi  wrote:
> This patch adds drm_bridge driver for parade DSI to eDP bridge chip.
>
> Signed-off-by: Jitao Shi 
> ---
> Changes since v5
> -fix compile errors when CONFIG_GPIOLIB=n
> ---
>  drivers/gpu/drm/bridge/Kconfig |   10 +
>  drivers/gpu/drm/bridge/Makefile|1 +
>  drivers/gpu/drm/bridge/parade-ps8640.c |  472 
> 
>  3 files changed, 483 insertions(+)
>  create mode 100644 drivers/gpu/drm/bridge/parade-ps8640.c
>
> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> index 639..dcfdbc9 100644
> --- a/drivers/gpu/drm/bridge/Kconfig
> +++ b/drivers/gpu/drm/bridge/Kconfig
> @@ -41,4 +41,14 @@ config DRM_PARADE_PS8622
> ---help---
>   Parade eDP-LVDS bridge chip driver.
>
> +config DRM_PARADE_PS8640
> +   tristate "Parade PS8640 MIPI DSI to eDP Converter"
> +   depends on OF
> +   select DRM_KMS_HELPER
> +   select DRM_PANEL
> +   ---help---
> + Choose this option if you have PS8640 for display
> + The PS8640 is a high-performance and low-power
> + MIPI DSI to eDP converter
> +
>  endmenu
> diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
> index d4e28be..272e3c01 100644
> --- a/drivers/gpu/drm/bridge/Makefile
> +++ b/drivers/gpu/drm/bridge/Makefile
> @@ -4,3 +4,4 @@ obj-$(CONFIG_DRM_DW_HDMI) += dw_hdmi.o
>  obj-$(CONFIG_DRM_DW_HDMI_AHB_AUDIO) += dw_hdmi-ahb-audio.o
>  obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
>  obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
> +obj-$(CONFIG_DRM_PARADE_PS8640) += parade-ps8640.o
> diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c 
> b/drivers/gpu/drm/bridge/parade-ps8640.c
> new file mode 100644
> index 000..bf0c3c37
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/parade-ps8640.c
> @@ -0,0 +1,472 @@
> +/*
> + * Copyright (c) 2014 MediaTek Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define PAGE2_GPIO_L   0xa6
> +#define PAGE2_GPIO_H   0xa7
> +#define PS_GPIO9   BIT(1)
> +#define PAGE2_I2C_BYPASS   0xea
> +#define I2C_BYPASS_EN  0xd0
> +
> +#define PAGE3_SET_ADD  0xfe
> +#define PAGE3_SET_VAL  0xff
> +#define VDO_CTL_ADD0x13
> +#define VDO_DIS0x18
> +#define VDO_EN 0x1c
> +
> +#define PAGE4_REV_L0xf0
> +#define PAGE4_REV_H0xf1
> +#define PAGE4_CHIP_L   0xf2
> +#define PAGE4_CHIP_H   0xf3
> +
> +#define bridge_to_ps8640(e)container_of(e, struct ps8640, bridge)
> +#define connector_to_ps8640(e) container_of(e, struct ps8640, connector)
> +
> +struct ps8640 {
> +   struct drm_connector connector;
> +   struct drm_bridge bridge;
> +   struct i2c_client *page[6];
> +   struct ps8640_driver_data *driver_data;
> +   struct regulator *pwr_1v2_supply;
> +   struct regulator *pwr_3v3_supply;
> +   struct drm_panel *panel;
> +   struct gpio_desc *gpio_rst_n;
> +   struct gpio_desc *gpio_slp_n;
> +   struct gpio_desc *gpio_mode_sel_n;
> +   bool enabled;
> +};
> +
> +static int ps8640_regr(struct i2c_client *client, u8 reg, u8 *value)
> +{
> +   int ret;
> +
> +   ret = i2c_master_send(client, ®, 1);
> +   if (ret <= 0) {
> +   dev_err(&client->dev, "Failed to send i2c command, ret=%d\n",
> +   ret);
> +   return ret;
> +   }
> +
> +   ret = i2c_master_recv(client, value, 1);
> +   if (ret <= 0) {
> +   dev_err(&client->dev, "Failed to recv i2c data, ret=%d\n", 
> ret);
> +   return ret;
> +   }

i2c_transfer should be a bit more efficient for reading one byte.

> +
> +   return 0;
> +}
> +
> +static int ps8640_regw(struct i2c_client *client, u8 reg, u8 value)
> +{
> +   int ret;
> +   char buf[2];
> +
> +   buf[0] = reg;
> +   buf[1] = value;
> +   ret = i2c_master_send(client, buf, ARRAY_SIZE(buf));
> +   if (ret <= 0) {
> +   dev_err(&client->dev, "Failed to send i2c command, ret=%d\n",
> +   ret);
> +   return ret;
> +   }
> +
> +   return 0;
> +}
> +
> +static bool ps8640_check_valid_id(struct ps8640 *ps_bridge)
> +{
> +   struct i2c_clien

[PATCH v6 2/2] drm/bridge: Add I2C based driver for ps8640 bridge

2015-12-15 Thread Archit Taneja
Hi,

On 12/15/2015 09:00 AM, Jitao Shi wrote:
> This patch adds drm_bridge driver for parade DSI to eDP bridge chip.
>
> Signed-off-by: Jitao Shi 
> ---
> Changes since v5
> -fix compile errors when CONFIG_GPIOLIB=n
> ---
>   drivers/gpu/drm/bridge/Kconfig |   10 +
>   drivers/gpu/drm/bridge/Makefile|1 +
>   drivers/gpu/drm/bridge/parade-ps8640.c |  472 
> 
>   3 files changed, 483 insertions(+)
>   create mode 100644 drivers/gpu/drm/bridge/parade-ps8640.c
>
> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> index 639..dcfdbc9 100644
> --- a/drivers/gpu/drm/bridge/Kconfig
> +++ b/drivers/gpu/drm/bridge/Kconfig
> @@ -41,4 +41,14 @@ config DRM_PARADE_PS8622
>   ---help---
> Parade eDP-LVDS bridge chip driver.
>
> +config DRM_PARADE_PS8640
> + tristate "Parade PS8640 MIPI DSI to eDP Converter"
> + depends on OF
> + select DRM_KMS_HELPER
> + select DRM_PANEL
> + ---help---
> +   Choose this option if you have PS8640 for display
> +   The PS8640 is a high-performance and low-power
> +   MIPI DSI to eDP converter
> +
>   endmenu
> diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
> index d4e28be..272e3c01 100644
> --- a/drivers/gpu/drm/bridge/Makefile
> +++ b/drivers/gpu/drm/bridge/Makefile
> @@ -4,3 +4,4 @@ obj-$(CONFIG_DRM_DW_HDMI) += dw_hdmi.o
>   obj-$(CONFIG_DRM_DW_HDMI_AHB_AUDIO) += dw_hdmi-ahb-audio.o
>   obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
>   obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
> +obj-$(CONFIG_DRM_PARADE_PS8640) += parade-ps8640.o
> diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c 
> b/drivers/gpu/drm/bridge/parade-ps8640.c
> new file mode 100644
> index 000..bf0c3c37
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/parade-ps8640.c
> @@ -0,0 +1,472 @@
> +/*
> + * Copyright (c) 2014 MediaTek Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 

This doesn't seem to be used at the moment.



> +
> +static int ps8640_probe(struct i2c_client *client,
> + const struct i2c_device_id *id)
> +{
> + struct device *dev = &client->dev;
> + struct ps8640 *ps_bridge;
> + struct device_node *np = dev->of_node;
> + struct device_node *port, *out_ep;
> + struct device_node *panel_node = NULL;
> + int i, ret;
> +
> + ps_bridge = devm_kzalloc(dev, sizeof(*ps_bridge), GFP_KERNEL);
> + if (!ps_bridge)
> + return -ENOMEM;
> +
> + /* port at 1 is ps8640 output port */
> + port = of_graph_get_port_by_id(np, 1);
> + if (port) {
> + out_ep = of_get_child_by_name(port, "endpoint");
> + of_node_put(port);
> + if (out_ep) {
> + panel_node = of_graph_get_remote_port_parent(out_ep);
> + of_node_put(out_ep);
> + }
> + }
> + if (panel_node) {
> + ps_bridge->panel = of_drm_find_panel(panel_node);
> + of_node_put(panel_node);
> + if (!ps_bridge->panel)
> + return -EPROBE_DEFER;
> + }

The driver retrieves the panel from the output port via DT, but doesn't
retrieve the DSI host from the input port?

Wouldn't this driver need to call a "mipi_dsi_attach" at some point to
link with the DSI host (and pass parameters like number of lanes, color
format etc)?

I've been working on a patchset[1] which lets i2c drivers create mipi
dsi devices. I think this would be needed for the ps8640 driver too.

[1] https://lkml.org/lkml/2015/12/10/283

Archit

> +
> + ps_bridge->page[0] = client;
> + for (i = 1; i < 6; i++)
> + ps_bridge->page[i] = i2c_new_dummy(client->adapter,
> +client->addr + i);
> +
> + ps_bridge->pwr_3v3_supply = devm_regulator_get(dev, "vdd33");
> + if (IS_ERR(ps_bridge->pwr_3v3_supply)) {
> + ret = PTR_ERR(ps_bridge->pwr_3v3_supply);
> + dev_err(dev, "cannot get vdd33 supply: %d\n", ret);
> + return ret;
> + }
> +
> + ps_bridge->pwr_1v2_supply = devm_regulator_get(dev, "vdd12");
> + if (IS_ERR(ps_bridge->pwr_1v2_supply)) {
> + ret = PTR_ERR(ps_bridge->pwr_1v2_supply);
> + dev_err(dev, "cannot get vdd12 supply: %d\n", ret);
> + return ret;
> + 

[Bug 93374] [radeonsi] Tonga (Radeon R9 380) hangs on running hello world OpenCL program

2015-12-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93374

--- Comment #1 from Michel Dänzer  ---
Basically, OpenCL support for VI isn't implemented yet.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20151215/14dbde99/attachment.html>


[Bug 93374] [radeonsi] Tonga (Radeon R9 380) hangs on running hello world OpenCL program

2015-12-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93374

--- Comment #2 from Vedran Miletić  ---
What is missing? Can it at least not crash?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20151215/8ce91f70/attachment.html>


[Intel-gfx] [PATCH 9/9] drm/atomic: Add encoder_mask to crtc_state.

2015-12-15 Thread Daniel Vetter
On Mon, Dec 14, 2015 at 01:06:12PM +0100, Maarten Lankhorst wrote:
> Op 04-12-15 om 09:12 schreef Daniel Vetter:
> > On Thu, Dec 03, 2015 at 12:01:02PM +0100, Maarten Lankhorst wrote:
> >> Op 03-12-15 om 10:53 schreef Daniel Vetter:
> >>> On Tue, Nov 24, 2015 at 10:34:36AM +0100, Maarten Lankhorst wrote:
>  This allows iteration over encoders without requiring connection_mutex.
> 
>  Signed-off-by: Maarten Lankhorst 
>  ---
>   drivers/gpu/drm/drm_atomic_helper.c  | 4 
>   drivers/gpu/drm/i915/intel_display.c | 3 +++
>   include/drm/drm_crtc.h   | 2 ++
>   3 files changed, 9 insertions(+)
> 
>  diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
>  b/drivers/gpu/drm/drm_atomic_helper.c
>  index fb79c54b2aed..f3fd8f131f92 100644
>  --- a/drivers/gpu/drm/drm_atomic_helper.c
>  +++ b/drivers/gpu/drm/drm_atomic_helper.c
>  @@ -269,6 +269,8 @@ mode_fixup(struct drm_atomic_state *state)
>   continue;
>   
>   drm_mode_copy(&crtc_state->adjusted_mode, 
>  &crtc_state->mode);
>  +
>  +crtc_state->encoder_mask = 0;
> >>> Hm, I think a small function to set the best_encoder (like we do to set
> >>> the crtc for connector or planes) would be good. Otherwise we'll frob
> >>> around the code and forget this, and much confusion will ensue.
> >>>
> >>> That helper should probably be in core drm_atomic.c, like the other
> >>> set_foo_for_bar helpers.
> >> As always only i915 assigns best_encoder outside 
> >> drm_atomic_helper_check_modeset, and the i915 calls can't be fixed because 
> >> of hw readout. :(
> >> At the time of mode_fixup all encoders should have been updated, so I'm 
> >> not sure adding a helper for best_encoder would help much..
> > I've meant just for the atomic helpers. i915 is a mess, yes, but that's
> > not really an excuse to not make shared code pretty ;-)
> >
> It's not really possible to do it in a helper. The encoder might be
> moved with the connector, or have a fixed mapping depending on crtc.
> (i915 MST)
> 
> So unfortunately there can be no generic helper, but it has to be dealt
> with in this function, when assigning best_encoder per crtc.

I meant a drm_atomic_set_best_encoder function, which sets both
best_encoder and updates the encoder_mask for the crtc. Why would that not
work? Of course actually figuring out what the best_encoder is would not
be done by that function, it would only update the book-keeping. And then
we could reuse it in our state reconstruction code too.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[PATCH] drm: Use the driver's gem_object_free function from CMA helpers.

2015-12-15 Thread Daniel Vetter
On Mon, Dec 14, 2015 at 04:26:26PM -0800, Eric Anholt wrote:
> VC4 wraps the CMA objects in its own structures, so it needs to do its
> own teardown (waiting for GPU to finish, updating bo_stats tracking).
> The other CMA drivers are using drm_gem_cma_free_object as their
> gem_free_object, so this should be a no-op for them.
> 
> Signed-off-by: Eric Anholt 

Reviewed-by: Daniel Vetter 

Since vc4 landed already I'll pull this into drm-misc.
-Daniel

> ---
>  drivers/gpu/drm/drm_fb_cma_helper.c  | 6 +++---
>  drivers/gpu/drm/drm_gem_cma_helper.c | 4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c 
> b/drivers/gpu/drm/drm_fb_cma_helper.c
> index 5c1aca4..99b5673 100644
> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> @@ -279,7 +279,7 @@ static int drm_fbdev_cma_create(struct drm_fb_helper 
> *helper,
>   if (!fbi) {
>   dev_err(dev->dev, "Failed to allocate framebuffer info.\n");
>   ret = -ENOMEM;
> - goto err_drm_gem_cma_free_object;
> + goto err_gem_free_object;
>   }
>  
>   fbdev_cma->fb = drm_fb_cma_alloc(dev, &mode_cmd, &obj, 1);
> @@ -322,8 +322,8 @@ err_drm_fb_cma_destroy:
>   drm_fb_cma_destroy(fb);
>  err_framebuffer_release:
>   framebuffer_release(fbi);
> -err_drm_gem_cma_free_object:
> - drm_gem_cma_free_object(&obj->base);
> +err_gem_free_object:
> + dev->driver->gem_free_object(&obj->base);
>   return ret;
>  }
>  
> diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c 
> b/drivers/gpu/drm/drm_gem_cma_helper.c
> index 7dcb43f..b409123 100644
> --- a/drivers/gpu/drm/drm_gem_cma_helper.c
> +++ b/drivers/gpu/drm/drm_gem_cma_helper.c
> @@ -121,7 +121,7 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct 
> drm_device *drm,
>   return cma_obj;
>  
>  error:
> - drm_gem_cma_free_object(&cma_obj->base);
> + drm->driver->gem_free_object(&cma_obj->base);
>   return ERR_PTR(ret);
>  }
>  EXPORT_SYMBOL_GPL(drm_gem_cma_create);
> @@ -171,7 +171,7 @@ drm_gem_cma_create_with_handle(struct drm_file *file_priv,
>   return cma_obj;
>  
>  err_handle_create:
> - drm_gem_cma_free_object(gem_obj);
> + drm->driver->gem_free_object(gem_obj);
>  
>   return ERR_PTR(ret);
>  }
> -- 
> 2.6.2
> 
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[PATCH] android: fix warning when releasing active sync point

2015-12-15 Thread Daniel Vetter
On Mon, Dec 14, 2015 at 05:29:55PM -0800, Dmitry Torokhov wrote:
> Userspace can close the sync device while there are still active fence
> points, in which case kernel produces the following warning:
> 
> [   43.853176] [ cut here ]
> [   43.857834] WARNING: CPU: 0 PID: 892 at 
> /mnt/host/source/src/third_party/kernel/v3.18/drivers/staging/android/sync.c:439
>  android_fence_release+0x88/0x104()
> [   43.871741] CPU: 0 PID: 892 Comm: Binder_5 Tainted: G U 
> 3.18.0-07661-g0550ce9 #1
> [   43.880176] Hardware name: Google Tegra210 Smaug Rev 1+ (DT)
> [   43.885834] Call trace:
> [   43.888294] [] dump_backtrace+0x0/0x10c
> [   43.893697] [] show_stack+0x10/0x1c
> [   43.898756] [] dump_stack+0x74/0xb8
> [   43.903814] [] warn_slowpath_common+0x84/0xb0
> [   43.909736] [] warn_slowpath_null+0x14/0x20
> [   43.915482] [] android_fence_release+0x84/0x104
> [   43.921582] [] fence_release+0x104/0x134
> [   43.927066] [] sync_fence_free+0x74/0x9c
> [   43.932552] [] sync_fence_release+0x34/0x48
> [   43.938304] [] __fput+0x100/0x1b8
> [   43.943185] [] fput+0x8/0x14
> [   43.947982] [] task_work_run+0xb0/0xe4
> [   43.953297] [] do_notify_resume+0x44/0x5c
> [   43.958867] ---[ end trace 5a2aa4027cc5d171 ]---
> 
> Let's fix it by introducing a new optional callback (disable_signaling)
> to fence operations so that drivers can do proper clean ups when we
> remove last callback for given fence.
> 
> Reviewed-by: Andrew Bresticker 
> Signed-off-by: Dmitry Torokhov 
> ---
>  drivers/dma-buf/fence.c| 6 +-
>  drivers/staging/android/sync.c | 8 
>  include/linux/fence.h  | 2 ++
>  3 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma-buf/fence.c b/drivers/dma-buf/fence.c
> index 7b05dbe..0ed73ad 100644
> --- a/drivers/dma-buf/fence.c
> +++ b/drivers/dma-buf/fence.c
> @@ -304,8 +304,12 @@ fence_remove_callback(struct fence *fence, struct 
> fence_cb *cb)
>   spin_lock_irqsave(fence->lock, flags);
>  
>   ret = !list_empty(&cb->node);
> - if (ret)
> + if (ret) {
>   list_del_init(&cb->node);
> + if (list_empty(&fence->cb_list))
> + if (fence->ops->disable_signaling)
> + fence->ops->disable_signaling(fence);

What exactly is the bug here? A fence with no callbacks registered any
more shouldn't have any problem. Why exactly does this blow up?

I guess I don't really understand the bug ... we do seem to remove the
callback already.

Thanks, Daniel


> + }
>  
>   spin_unlock_irqrestore(fence->lock, flags);
>  
> diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
> index e0c1acb..f8566c1 100644
> --- a/drivers/staging/android/sync.c
> +++ b/drivers/staging/android/sync.c
> @@ -465,6 +465,13 @@ static bool android_fence_enable_signaling(struct fence 
> *fence)
>   return true;
>  }
>  
> +static void android_fence_disable_signaling(struct fence *fence)
> +{
> + struct sync_pt *pt = container_of(fence, struct sync_pt, base);
> +
> + list_del_init(&pt->active_list);
> +}
> +
>  static int android_fence_fill_driver_data(struct fence *fence,
> void *data, int size)
>  {
> @@ -508,6 +515,7 @@ static const struct fence_ops android_fence_ops = {
>   .get_driver_name = android_fence_get_driver_name,
>   .get_timeline_name = android_fence_get_timeline_name,
>   .enable_signaling = android_fence_enable_signaling,
> + .disable_signaling = android_fence_disable_signaling,
>   .signaled = android_fence_signaled,
>   .wait = fence_default_wait,
>   .release = android_fence_release,
> diff --git a/include/linux/fence.h b/include/linux/fence.h
> index bb52201..ce44348 100644
> --- a/include/linux/fence.h
> +++ b/include/linux/fence.h
> @@ -107,6 +107,7 @@ struct fence_cb {
>   * @get_driver_name: returns the driver name.
>   * @get_timeline_name: return the name of the context this fence belongs to.
>   * @enable_signaling: enable software signaling of fence.
> + * @disable_signaling: disable software signaling of fence (optional).
>   * @signaled: [optional] peek whether the fence is signaled, can be null.
>   * @wait: custom wait implementation, or fence_default_wait.
>   * @release: [optional] called on destruction of fence, can be null
> @@ -166,6 +167,7 @@ struct fence_ops {
>   const char * (*get_driver_name)(struct fence *fence);
>   const char * (*get_timeline_name)(struct fence *fence);
>   bool (*enable_signaling)(struct fence *fence);
> + void (*disable_signaling)(struct fence *fence);
>   bool (*signaled)(struct fence *fence);
>   signed long (*wait)(struct fence *fence, bool intr, signed long 
> timeout);
>   void (*release)(struct fence *fence);
> -- 
> 2.6.0.rc2.230.g3dd15c0
> 
> 
> -- 
> Dmitry
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://li

[PATCH] android: fix warning when releasing active sync point

2015-12-15 Thread Maarten Lankhorst
Op 15-12-15 om 02:29 schreef Dmitry Torokhov:
> Userspace can close the sync device while there are still active fence
> points, in which case kernel produces the following warning:
>
> [   43.853176] [ cut here ]
> [   43.857834] WARNING: CPU: 0 PID: 892 at 
> /mnt/host/source/src/third_party/kernel/v3.18/drivers/staging/android/sync.c:439
>  android_fence_release+0x88/0x104()
> [   43.871741] CPU: 0 PID: 892 Comm: Binder_5 Tainted: G U 
> 3.18.0-07661-g0550ce9 #1
> [   43.880176] Hardware name: Google Tegra210 Smaug Rev 1+ (DT)
> [   43.885834] Call trace:
> [   43.888294] [] dump_backtrace+0x0/0x10c
> [   43.893697] [] show_stack+0x10/0x1c
> [   43.898756] [] dump_stack+0x74/0xb8
> [   43.903814] [] warn_slowpath_common+0x84/0xb0
> [   43.909736] [] warn_slowpath_null+0x14/0x20
> [   43.915482] [] android_fence_release+0x84/0x104
> [   43.921582] [] fence_release+0x104/0x134
> [   43.927066] [] sync_fence_free+0x74/0x9c
> [   43.932552] [] sync_fence_release+0x34/0x48
> [   43.938304] [] __fput+0x100/0x1b8
> [   43.943185] [] fput+0x8/0x14
> [   43.947982] [] task_work_run+0xb0/0xe4
> [   43.953297] [] do_notify_resume+0x44/0x5c
> [   43.958867] ---[ end trace 5a2aa4027cc5d171 ]---
>
> Let's fix it by introducing a new optional callback (disable_signaling)
> to fence operations so that drivers can do proper clean ups when we
> remove last callback for given fence.
>
> Reviewed-by: Andrew Bresticker 
> Signed-off-by: Dmitry Torokhov 
>
NACK! There's no way to do this race free.
The driver should hold a refcount until fence is signaled.


[PATCH 2/3] drm/radeon: fix typo

2015-12-15 Thread Michel Dänzer
On 13.12.2015 01:42, Nicolai Hähnle wrote:
> From: Nicolai Hähnle 
> 
> Signed-off-by: Nicolai Hähnle 
> ---
>  drivers/gpu/drm/radeon/cik.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
> index 248953d..d93539d 100644
> --- a/drivers/gpu/drm/radeon/cik.c
> +++ b/drivers/gpu/drm/radeon/cik.c
> @@ -4135,7 +4135,7 @@ struct radeon_fence *cik_copy_cpdma(struct 
> radeon_device *rdev,
>   * Emits an DE (drawing engine) or CE (constant engine) IB

Could remove the superfluous n from "an" while you're at it. :)


>   * on the gfx ring.  IBs are usually generated by userspace
>   * acceleration drivers and submitted to the kernel for
> - * sheduling on the ring.  This function schedules the IB
> + * scheduling on the ring.  This function schedules the IB
>   * on the gfx ring for execution by the GPU.
>   */
>  void cik_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib)
> 

Either way, this patch and patch 3 are

Reviewed-by: Michel Dänzer 


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer


[PATCH 12/12] ARM: dts: imx6: add Vivante GPU nodes

2015-12-15 Thread Lucas Stach
Am Dienstag, den 15.12.2015, 16:25 +0800 schrieb Shawn Guo:
> On Mon, Dec 14, 2015 at 10:52:25AM +0100, Lucas Stach wrote:
> > Are you okay with merging the DT changes through the DRM tree, or do you
> > want to pick them separate?
> 
> To accelerate the merge process, I'm okay with merging the DT changes
> through DRM tree, as long as DRM maintainers don't mind.
> 
As the Dove maintainers prefer to take the DT changes through their
tree, I think we should do the same thing for i.MX.

I will send out the fixed patch together with the pull for the DRM and
DT bindings bits, so you can pick it up for 4.5.

Regards,
Lucas

-- 
Pengutronix e.K. | Lucas Stach |
Industrial Linux Solutions   | http://www.pengutronix.de/  |



[RESEND PATCH 2/3] drm: atmel-hlcdc: add support for sama5d2 SoCs

2015-12-15 Thread Boris Brezillon
From: Nicolas Ferre 

As the hardware description for this chip is the same as the sama5d4, we use
this SoC structures for layers and DC descriptions. Thus only 2 lines are added
to the atmel_hlcdc_of_match table.
The compatible string is already documented in the parent MFD driver's binding.

Signed-off-by: Nicolas Ferre 
Acked-by: Boris Brezillon 
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c 
b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index 0126918..44e670b 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -333,6 +333,10 @@ static const struct of_device_id atmel_hlcdc_of_match[] = {
.data = &atmel_hlcdc_dc_at91sam9x5,
},
{
+   .compatible = "atmel,sama5d2-hlcdc",
+   .data = &atmel_hlcdc_dc_sama5d4,
+   },
+   {
.compatible = "atmel,sama5d3-hlcdc",
.data = &atmel_hlcdc_dc_sama5d3,
},
-- 
2.1.4



[RESEND PATCH 1/3] drm: atmel-hlcdc: Fix module autoload for OF platform driver

2015-12-15 Thread Boris Brezillon
From: Luis de Bethencourt 

This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt 
Acked-by: Boris Brezillon 
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c 
b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index 244df0a..0126918 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -342,6 +342,7 @@ static const struct of_device_id atmel_hlcdc_of_match[] = {
},
{ /* sentinel */ },
 };
+MODULE_DEVICE_TABLE(of, atmel_hlcdc_of_match);

 int atmel_hlcdc_dc_mode_valid(struct atmel_hlcdc_dc *dc,
  struct drm_display_mode *mode)
-- 
2.1.4



[RESEND PATCH 3/3] drm/atmel-hlcdc: Constify function pointer structs

2015-12-15 Thread Boris Brezillon
From: Ville Syrjälä 

Moves a bunch of junk to .rodata from .data.

drivers/gpu/drm/atmel-hlcdc/atmel-hlcdc-dc.ko:
-.text   12488
+.text   12480
-.rodata  1696
+.rodata  1760
-.data 776
+.data 712

Signed-off-by: Ville Syrjälä 
Reviewed-by: Alex Deucher 
Acked-by: Boris Brezillon 
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c 
b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
index 067e4c1..250f69e 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
@@ -146,7 +146,7 @@ atmel_hlcdc_rgb_encoder_mode_set(struct drm_encoder 
*encoder,
   cfg);
 }

-static struct drm_encoder_helper_funcs atmel_hlcdc_panel_encoder_helper_funcs 
= {
+static const struct drm_encoder_helper_funcs 
atmel_hlcdc_panel_encoder_helper_funcs = {
.mode_fixup = atmel_hlcdc_panel_encoder_mode_fixup,
.mode_set = atmel_hlcdc_rgb_encoder_mode_set,
.disable = atmel_hlcdc_panel_encoder_disable,
@@ -192,7 +192,7 @@ atmel_hlcdc_rgb_best_encoder(struct drm_connector 
*connector)
return &rgb->encoder;
 }

-static struct drm_connector_helper_funcs 
atmel_hlcdc_panel_connector_helper_funcs = {
+static const struct drm_connector_helper_funcs 
atmel_hlcdc_panel_connector_helper_funcs = {
.get_modes = atmel_hlcdc_panel_get_modes,
.mode_valid = atmel_hlcdc_rgb_mode_valid,
.best_encoder = atmel_hlcdc_rgb_best_encoder,
-- 
2.1.4



[PATCH 03/12] drm/dp: Turn link capabilities into booleans

2015-12-15 Thread Daniel Vetter
On Mon, Dec 14, 2015 at 01:55:55PM +0100, Thierry Reding wrote:
> From: Thierry Reding 
> 
> Rather than storing capabilities as flags in an integer, use a separate
> boolean per capability. This simplifies the code that checks for these
> capabilities.
> 
> Cc: Rob Clark 
> Signed-off-by: Thierry Reding 

I still don't really see all that much benefit in storing this in decoded
form, but explicit bools instead of creating a new bitfiled with new DP_*
#defines that look awfully close to the spec ones but arent is much
better. This way there's at least no confusion.

Besides that bikeshed I think this patch series looks like a good step
towards unifying our dp helpers again overall. Tow comments below,
otherwise Ack on the approach from my side. Didn't do a detailed review
though.
> ---
>  drivers/gpu/drm/drm_dp_helper.c| 18 +++---
>  drivers/gpu/drm/msm/edp/edp_ctrl.c |  4 ++--
>  drivers/gpu/drm/tegra/sor.c|  4 ++--
>  include/drm/drm_dp_helper.h| 10 --
>  4 files changed, 27 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index c00896ab8b04..cdc0da67e8ad 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -284,6 +284,17 @@ int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
>  }
>  EXPORT_SYMBOL(drm_dp_dpcd_read_link_status);
>  
> +static void drm_dp_link_caps_reset(struct drm_dp_link_caps *caps)
> +{
> + caps->enhanced_framing = false;

memset imo.

> +}
> +
> +void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest,
> +const struct drm_dp_link_caps *src)
> +{
> + dest->enhanced_framing = src->enhanced_framing;

memcpy imo.

-Daniel

> +}
> +
>  static void drm_dp_link_reset(struct drm_dp_link *link)
>  {
>   if (!link)
> @@ -292,7 +303,8 @@ static void drm_dp_link_reset(struct drm_dp_link *link)
>   link->revision = 0;
>   link->max_rate = 0;
>   link->max_lanes = 0;
> - link->capabilities = 0;
> +
> + drm_dp_link_caps_reset(&link->caps);
>  
>   link->rate = 0;
>   link->lanes = 0;
> @@ -325,7 +337,7 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct 
> drm_dp_link *link)
>   link->max_lanes = values[2] & DP_MAX_LANE_COUNT_MASK;
>  
>   if (values[2] & DP_ENHANCED_FRAME_CAP)
> - link->capabilities |= DP_LINK_CAP_ENHANCED_FRAMING;
> + link->caps.enhanced_framing = true;
>  
>   link->rate = link->max_rate;
>   link->lanes = link->max_lanes;
> @@ -418,7 +430,7 @@ int drm_dp_link_configure(struct drm_dp_aux *aux, struct 
> drm_dp_link *link)
>   values[0] = drm_dp_link_rate_to_bw_code(link->rate);
>   values[1] = link->lanes;
>  
> - if (link->capabilities & DP_LINK_CAP_ENHANCED_FRAMING)
> + if (link->caps.enhanced_framing)
>   values[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN;
>  
>   err = drm_dp_dpcd_write(aux, DP_LINK_BW_SET, values, sizeof(values));
> diff --git a/drivers/gpu/drm/msm/edp/edp_ctrl.c 
> b/drivers/gpu/drm/msm/edp/edp_ctrl.c
> index c87a03561246..12e2a5cd9582 100644
> --- a/drivers/gpu/drm/msm/edp/edp_ctrl.c
> +++ b/drivers/gpu/drm/msm/edp/edp_ctrl.c
> @@ -452,7 +452,7 @@ static void edp_config_ctrl(struct edp_ctrl *ctrl)
>  
>   data = EDP_CONFIGURATION_CTRL_LANES(ctrl->lane_cnt - 1);
>  
> - if (ctrl->dp_link.capabilities & DP_LINK_CAP_ENHANCED_FRAMING)
> + if (ctrl->dp_link.caps.enhanced_framing)
>   data |= EDP_CONFIGURATION_CTRL_ENHANCED_FRAMING;
>  
>   depth = EDP_6BIT;
> @@ -774,7 +774,7 @@ static int edp_do_link_train(struct edp_ctrl *ctrl)
>*/
>   dp_link.lanes = ctrl->lane_cnt;
>   dp_link.rate = drm_dp_bw_code_to_link_rate(ctrl->link_rate);
> - dp_link.capabilities = ctrl->dp_link.capabilities;
> + drm_dp_link_caps_copy(&dp_link.caps, &ctrl->dp_link.caps);
>   if (drm_dp_link_configure(ctrl->drm_aux, &dp_link) < 0)
>   return EDP_TRAIN_FAIL;
>  
> diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
> index 7bf444bd1588..f26dfaca7586 100644
> --- a/drivers/gpu/drm/tegra/sor.c
> +++ b/drivers/gpu/drm/tegra/sor.c
> @@ -645,7 +645,7 @@ static int tegra_sor_calc_config(struct tegra_sor *sor,
>   num = ((mode->htotal - mode->hdisplay) - 7) * link_rate;
>   config->hblank_symbols = div_u64(num, pclk);
>  
> - if (link->capabilities & DP_LINK_CAP_ENHANCED_FRAMING)
> + if (link->caps.enhanced_framing)
>   config->hblank_symbols -= 3;
>  
>   config->hblank_symbols -= 12 / link->lanes;
> @@ -1464,7 +1464,7 @@ static void tegra_sor_edp_enable(struct drm_encoder 
> *encoder)
>   value &= ~SOR_DP_LINKCTL_LANE_COUNT_MASK;
>   value |= SOR_DP_LINKCTL_LANE_COUNT(lanes);
>  
> - if (link.capabilities & DP_LINK_CAP_ENHANCED_FRAMING)
> + if (link.caps.enhanced_framing)
>   value |= SOR_DP_LINKCTL_ENHANCED_FRAME;
>  
>   

[PATCH 11/12] drm/dp: Read AUX read interval from DPCD

2015-12-15 Thread Daniel Vetter
On Mon, Dec 14, 2015 at 01:56:03PM +0100, Thierry Reding wrote:
> From: Thierry Reding 
> 
> Store the AUX read interval from DPCD, so that it can be used to wait
> for the durations given in the specification during link training.
> 
> Signed-off-by: Thierry Reding 
> ---
>  drivers/gpu/drm/drm_dp_helper.c |  4 
>  include/drm/drm_dp_helper.h | 17 +
>  2 files changed, 21 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index 76ac68bc1042..da519acfeba7 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -339,6 +339,7 @@ static void drm_dp_link_reset(struct drm_dp_link *link)
>   link->max_lanes = 0;
>  
>   drm_dp_link_caps_reset(&link->caps);
> + link->aux_rd_interval = 0;
>   link->edp = 0;
>  
>   link->rate = 0;
> @@ -392,6 +393,9 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct 
> drm_dp_link *link)
>   link->edp = edp_revs[value];
>   }
>  
> + /* DP_TRAINING_AUX_RD_INTERVAL is in units of 4 milliseconds */
> + link->aux_rd_interval = drm_dp_aux_rd_interval(values);

Hm, just wondering a bit of the relationship between link and cap. Is link
all about sink really, and not the source? At least in my experience it
makes a lot of sense to strictly keep these two separate, since otherwise
you'll have lots of fun aligning things in generic code. Anyway, just a
thougth.

> +
>   link->rate = link->max_rate;
>   link->lanes = link->max_lanes;
>  
> diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
> index 825aaf4e8c71..20ae0e413b64 100644
> --- a/include/drm/drm_dp_helper.h
> +++ b/include/drm/drm_dp_helper.h
> @@ -678,6 +678,22 @@ drm_dp_alternate_scrambler_reset_cap(const u8 
> dpcd[DP_RECEIVER_CAP_SIZE])
>   DP_ALTERNATE_SCRAMBLER_RESET_CAP;
>  }
>  
> +/**
> + * drm_dp_read_aux_interval() - read the AUX read interval from the DPCD
> + * @dpcd: receiver capacity buffer
> + *
> + * Reads the AUX read interval (in microseconds) from the DPCD. Note that the
> + * TRAINING_AUX_RD_INTERVAL stores the value in units of 4 milliseconds.
> + *
> + * Returns:
> + * The read AUX interval in microseconds.
> + */
> +static inline unsigned int
> +drm_dp_aux_rd_interval(const u8 dpcd[DP_RECEIVER_CAP_SIZE])

We should use this one here in the 2 delay helpers for channel_eq and
clock_recovery imo.
-Daniel

> +{
> + return dpcd[DP_TRAINING_AUX_RD_INTERVAL] * 4000;
> +}
> +
>  /*
>   * DisplayPort AUX channel
>   */
> @@ -805,6 +821,7 @@ struct drm_dp_link {
>   unsigned int max_lanes;
>  
>   struct drm_dp_link_caps caps;
> + unsigned int aux_rd_interval;
>   unsigned char edp;
>  
>   unsigned int rate;
> -- 
> 2.5.0
> 
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[PATCH] drm/nouveau: Fix pre-nv50 pageflip events (v4)

2015-12-15 Thread poma
On 10.11.2015 17:41, Thierry Reding wrote:
> On Tue, Nov 10, 2015 at 05:37:31PM +0100, Thierry Reding wrote:
>> From: Daniel Vetter 
>>
>> Apparently pre-nv50 pageflip events happen before the actual vblank
>> period. Therefore that functionality got semi-disabled in
>>
>> commit af4870e406126b7ac0ae7c7ce5751f25ebe60f28
>> Author: Mario Kleiner 
>> Date:   Tue May 13 00:42:08 2014 +0200
>>
>> drm/nouveau/kms/nv04-nv40: fix pageflip events via special case.
>>
>> Unfortunately that hack got uprooted in
>>
>> commit cc1ef118fc099295ae6aabbacc8af94d8d8885eb
>> Author: Thierry Reding 
>> Date:   Wed Aug 12 17:00:31 2015 +0200
>>
>> drm/irq: Make pipe unsigned and name consistent
>>
>> Triggering a warning when trying to sample the vblank timestamp for a
>> non-existing pipe. There's a few ways to fix this:
>>
>> - Open-code the old behaviour, which just enshrines this slight
>>   breakage of the userspace ABI.
>>
>> - Revert Mario's commit and again inflict broken timestamps, again not
>>   pretty.
>>
>> - Fix this for real by delaying the pageflip TS until the next vblank
>>   interrupt, thereby making it accurate.
>>
>> This patch implements the third option. Since having a page flip
>> interrupt that happens when the pageflip gets armed and not when it
>> completes in the next vblank seems to be fairly common (older i915 hw
>> works very similarly) create a new helper to arm vblank events for
>> such drivers.
>>
>> v2 (Mario Kleiner):
>> - Fix function prototypes in drmP.h
>> - Add missing vblank_put() for pageflip completion without
>>   pageflip event.
>> - Initialize sequence number for queued pageflip event to avoid
>>   trouble in drm_handle_vblank_events().
>> - Remove dead code and spelling fix.
>>
>> v3 (Mario Kleiner):
>> - Add a signed-off-by and cc stable tag per Ilja's advice.
>>
>> v4 (Thierry Reding):
>> - Fix kerneldoc typo, discovered by Michel Dänzer
>> - Rearrange tags and changelog
>>
>> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=106431
>> Cc: Thierry Reding 
>> Cc: Mario Kleiner 
>> Cc: Ben Skeggs 
>> Cc: Ilia Mirkin 
>> Signed-off-by: Daniel Vetter 
>> Reviewed-by: Mario Kleiner 
>> Cc: stable at vger.kernel.org # v4.3
>> Signed-off-by: Mario Kleiner 
>> Signed-off-by: Thierry Reding 
>> ---
>>  drivers/gpu/drm/drm_irq.c | 54 
>> ++-
>>  drivers/gpu/drm/nouveau/nouveau_display.c | 19 ++-
>>  include/drm/drmP.h|  4 +++
>>  3 files changed, 68 insertions(+), 9 deletions(-)
> 
> Hi Dave,
> 
> It'd be great if you could queue this up for fixes, since it gets rid of
> a WARN_ON() that is triggered on a number of cards in v4.3. I realize
> that this is a tad big for stable, but it's the right way to fix this.
> If you'd prefer something smaller, I think we can fix the regression
> using a one-line band-aid and then apply this one on top for v4.4.
> 
> Thierry
> 


Apparently not reached @stable (stable: 4.3.3 2015-12-15),
so here's one more time.




[RESEND PATCH 01/28] drm/gma500: Sanity-check pipe index

2015-12-15 Thread Boris Brezillon
From: Thierry Reding 

If the DSI output isn't connected, then mdfld_dsi_encoder_get_pipe()
will return -1. The mdfld_dsi_dp_mode_set() function doesn't properly
check for this condition and causes the following compiler warnings:

  CC  drivers/gpu/drm/gma500/mdfld_dsi_dpi.o
drivers/gpu/drm/gma500/mdfld_dsi_dpi.c: In function 
‘mdfld_dsi_dpi_mode_set’:
drivers/gpu/drm/gma500/mdfld_dsi_dpi.c:828:35: warning: array subscript 
is below array bounds [-Warray-bounds]
  u32 pipeconf = dev_priv->pipeconf[pipe];
   ^
drivers/gpu/drm/gma500/mdfld_dsi_dpi.c:829:33: warning: array subscript 
is below array bounds [-Warray-bounds]
  u32 dspcntr = dev_priv->dspcntr[pipe];
 ^

Fix this by checking for a valid pipe before indexing the pipeconf and
dspcntr arrays.

Cc: Patrik Jakobsson 
Reviewed-by: Patrik Jakobsson 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/gma500/mdfld_dsi_dpi.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c 
b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
index 1a1acd3..7cd87a0 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
@@ -821,14 +821,18 @@ void mdfld_dsi_dpi_mode_set(struct drm_encoder *encoder,
struct drm_device *dev = dsi_config->dev;
struct drm_psb_private *dev_priv = dev->dev_private;
int pipe = mdfld_dsi_encoder_get_pipe(dsi_encoder);
-
u32 pipeconf_reg = PIPEACONF;
u32 dspcntr_reg = DSPACNTR;
+   u32 pipeconf, dspcntr;

-   u32 pipeconf = dev_priv->pipeconf[pipe];
-   u32 dspcntr = dev_priv->dspcntr[pipe];
u32 mipi = MIPI_PORT_EN | PASS_FROM_SPHY_TO_AFE | SEL_FLOPPED_HSTX;

+   if (WARN_ON(pipe < 0))
+   return;
+
+   pipeconf = dev_priv->pipeconf[pipe];
+   dspcntr = dev_priv->dspcntr[pipe];
+
if (pipe) {
pipeconf_reg = PIPECCONF;
dspcntr_reg = DSPCCNTR;
-- 
2.1.4



[RESEND PATCH 00/28] drm: trivial patches from drm/trivial branch

2015-12-15 Thread Boris Brezillon
Hi Daniel,

As discussed on IRC, here are the patches taken by Thierry in his
drm/trivial/for-next branch. I rebased it on drm-next, and had to fix
a few conflicts, so it would be safer if someone else takes a closer
look at those changes.

The atmel-hlcdc are good, so feel free to take them.

Best Regards,

Boris

Frediano Ziglio (1):
  drm/qxl: use to_qxl_bo macro

Luis de Bethencourt (1):
  drm: atmel-hlcdc: Fix module autoload for OF platform driver

Nicolas Ferre (1):
  drm: atmel-hlcdc: add support for sama5d2 SoCs

Rasmus Villemoes (3):
  drm/omap: use kzalloc in sita_init()
  drm/vmwgfx: use kzalloc in vmw_surface_define_ioctl()
  drm/vmwgfx: check kmalloc return value

Thierry Reding (4):
  drm/gma500: Sanity-check pipe index
  drm/bochs: Store correct CRTC index in events
  drm/imx: Make pipe number unsigned
  drm/imx: Drop pipe field from struct imx_drm_crtc

Ville Syrjälä (18):
  drm: Constify drm_encoder_slave_funcs
  drm/armada: Constify function pointer structs
  drm/atmel-hlcdc: Constify function pointer structs
  drm/bochs: Constify function pointer structs
  drm/bridge/dw_hdmi: Constify function pointer structs
  drm/bridge/nxp-ptn3460: Constify function pointer structs
  drm/i2c/ch7006: Constify function pointer structs
  drm/cirrus: Constify function pointer structs
  drm/exynos: Constify function pointer structs
  drm/i2c/adv7511: Constify function pointer structs
  drm/i2c/sil164: Constify function pointer structs
  drm/imx: Constify function pointer structs
  drm/mgag200: Constify function pointer structs
  drm/nouveau: Constify function pointer structs
  drm/rockchip: Constify function pointer structs
  drm/tegra: Constify function pointer structs
  drm/udl: Constify function pointer structs
  drm/vmwgfx: Constify function pointer structs

 drivers/gpu/drm/armada/armada_crtc.c |  2 +-
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c |  5 +
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c |  4 ++--
 drivers/gpu/drm/bochs/bochs_kms.c|  8 
 drivers/gpu/drm/bridge/dw_hdmi.c |  6 +++---
 drivers/gpu/drm/bridge/nxp-ptn3460.c |  6 +++---
 drivers/gpu/drm/cirrus/cirrus_mode.c |  4 ++--
 drivers/gpu/drm/drm_encoder_slave.c  |  2 +-
 drivers/gpu/drm/exynos/exynos_dp_core.c  |  8 
 drivers/gpu/drm/exynos/exynos_drm_crtc.c |  4 ++--
 drivers/gpu/drm/exynos/exynos_drm_dpi.c  |  8 
 drivers/gpu/drm/exynos/exynos_drm_dsi.c  |  8 
 drivers/gpu/drm/exynos/exynos_drm_fb.c   |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_mic.c  |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_vidi.c |  8 
 drivers/gpu/drm/exynos/exynos_hdmi.c |  8 
 drivers/gpu/drm/gma500/mdfld_dsi_dpi.c   | 10 +++---
 drivers/gpu/drm/i2c/adv7511.c|  2 +-
 drivers/gpu/drm/i2c/ch7006_drv.c |  2 +-
 drivers/gpu/drm/i2c/sil164_drv.c |  2 +-
 drivers/gpu/drm/imx/dw_hdmi-imx.c|  4 ++--
 drivers/gpu/drm/imx/imx-drm-core.c   | 23 +++
 drivers/gpu/drm/imx/imx-drm.h|  2 +-
 drivers/gpu/drm/imx/imx-ldb.c|  8 
 drivers/gpu/drm/imx/imx-tve.c|  8 
 drivers/gpu/drm/imx/ipuv3-crtc.c |  2 +-
 drivers/gpu/drm/imx/parallel-display.c   |  8 
 drivers/gpu/drm/mgag200/mgag200_mode.c   |  4 ++--
 drivers/gpu/drm/nouveau/dispnv04/tvnv17.c|  6 +++---
 drivers/gpu/drm/nouveau/nouveau_encoder.h|  2 +-
 drivers/gpu/drm/omapdrm/tcm-sita.c   |  7 ++-
 drivers/gpu/drm/qxl/qxl_object.c |  2 +-
 drivers/gpu/drm/qxl/qxl_ttm.c|  4 ++--
 drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c|  6 +++---
 drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c|  8 
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c  |  4 ++--
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c   |  2 +-
 drivers/gpu/drm/tegra/fb.c   |  2 +-
 drivers/gpu/drm/udl/udl_connector.c  |  4 ++--
 drivers/gpu/drm/udl/udl_modeset.c|  2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c  |  4 ++--
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c  |  6 +++---
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c |  6 +++---
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c |  6 +++---
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c  |  9 +++--
 include/drm/drm_encoder_slave.h  |  2 +-
 46 files changed, 122 insertions(+), 120 deletions(-)

-- 
2.1.4



[RESEND PATCH 05/28] drm/omap: use kzalloc in sita_init()

2015-12-15 Thread Boris Brezillon
From: Rasmus Villemoes 

Signed-off-by: Rasmus Villemoes 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/omapdrm/tcm-sita.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/tcm-sita.c 
b/drivers/gpu/drm/omapdrm/tcm-sita.c
index efb6095..6df1f2a 100644
--- a/drivers/gpu/drm/omapdrm/tcm-sita.c
+++ b/drivers/gpu/drm/omapdrm/tcm-sita.c
@@ -87,14 +87,11 @@ struct tcm *sita_init(u16 width, u16 height, struct tcm_pt 
*attr)
if (width == 0 || height == 0)
return NULL;

-   tcm = kmalloc(sizeof(*tcm), GFP_KERNEL);
-   pvt = kmalloc(sizeof(*pvt), GFP_KERNEL);
+   tcm = kzalloc(sizeof(*tcm), GFP_KERNEL);
+   pvt = kzalloc(sizeof(*pvt), GFP_KERNEL);
if (!tcm || !pvt)
goto error;

-   memset(tcm, 0, sizeof(*tcm));
-   memset(pvt, 0, sizeof(*pvt));
-
/* Updating the pointers to SiTA implementation APIs */
tcm->height = height;
tcm->width = width;
-- 
2.1.4



[RESEND PATCH 06/28] drm/vmwgfx: use kzalloc in vmw_surface_define_ioctl()

2015-12-15 Thread Boris Brezillon
From: Rasmus Villemoes 

Signed-off-by: Rasmus Villemoes 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 7d620e8..a3ae985 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -815,11 +815,8 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void 
*data,
srf->sizes[0].height == 64 &&
srf->format == SVGA3D_A8R8G8B8) {

-   srf->snooper.image = kmalloc(64 * 64 * 4, GFP_KERNEL);
-   /* clear the image */
-   if (srf->snooper.image) {
-   memset(srf->snooper.image, 0x00, 64 * 64 * 4);
-   } else {
+   srf->snooper.image = kzalloc(64 * 64 * 4, GFP_KERNEL);
+   if (!srf->snooper.image) {
DRM_ERROR("Failed to allocate cursor_image\n");
ret = -ENOMEM;
goto out_no_copy;
-- 
2.1.4



[RESEND PATCH 08/28] drm/qxl: use to_qxl_bo macro

2015-12-15 Thread Boris Brezillon
From: Frediano Ziglio 

Instead of using container_of directly use to_qxl_bo macro.

Signed-off-by: Frediano Ziglio 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/qxl/qxl_object.c | 2 +-
 drivers/gpu/drm/qxl/qxl_ttm.c| 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_object.c b/drivers/gpu/drm/qxl/qxl_object.c
index b28370e..5e1d789 100644
--- a/drivers/gpu/drm/qxl/qxl_object.c
+++ b/drivers/gpu/drm/qxl/qxl_object.c
@@ -32,7 +32,7 @@ static void qxl_ttm_bo_destroy(struct ttm_buffer_object *tbo)
struct qxl_bo *bo;
struct qxl_device *qdev;

-   bo = container_of(tbo, struct qxl_bo, tbo);
+   bo = to_qxl_bo(tbo);
qdev = (struct qxl_device *)bo->gem_base.dev->dev_private;

qxl_surface_evict(qdev, bo, false);
diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
index 0cbc4c9..9534127 100644
--- a/drivers/gpu/drm/qxl/qxl_ttm.c
+++ b/drivers/gpu/drm/qxl/qxl_ttm.c
@@ -201,7 +201,7 @@ static void qxl_evict_flags(struct ttm_buffer_object *bo,
placement->num_busy_placement = 1;
return;
}
-   qbo = container_of(bo, struct qxl_bo, tbo);
+   qbo = to_qxl_bo(bo);
qxl_ttm_placement_from_domain(qbo, QXL_GEM_DOMAIN_CPU, false);
*placement = qbo->placement;
 }
@@ -365,7 +365,7 @@ static void qxl_bo_move_notify(struct ttm_buffer_object *bo,

if (!qxl_ttm_bo_is_qxl_bo(bo))
return;
-   qbo = container_of(bo, struct qxl_bo, tbo);
+   qbo = to_qxl_bo(bo);
qdev = qbo->gem_base.dev->dev_private;

if (bo->mem.mem_type == TTM_PL_PRIV0 && qbo->surface_id)
-- 
2.1.4



[RESEND PATCH 09/28] drm: atmel-hlcdc: add support for sama5d2 SoCs

2015-12-15 Thread Boris Brezillon
From: Nicolas Ferre 

As the hardware description for this chip is the same as the sama5d4, we use
this SoC structures for layers and DC descriptions. Thus only 2 lines are added
to the atmel_hlcdc_of_match table.
The compatible string is already documented in the parent MFD driver's binding.

Signed-off-by: Nicolas Ferre 
Acked-by: Boris Brezillon 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c 
b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index 8168954..378 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -333,6 +333,10 @@ static const struct of_device_id atmel_hlcdc_of_match[] = {
.data = &atmel_hlcdc_dc_at91sam9x5,
},
{
+   .compatible = "atmel,sama5d2-hlcdc",
+   .data = &atmel_hlcdc_dc_sama5d4,
+   },
+   {
.compatible = "atmel,sama5d3-hlcdc",
.data = &atmel_hlcdc_dc_sama5d3,
},
-- 
2.1.4



[RESEND PATCH 10/28] drm: Constify drm_encoder_slave_funcs

2015-12-15 Thread Boris Brezillon
From: Ville Syrjälä 

Signed-off-by: Ville Syrjälä 
Reviewed-by: Alex Deucher 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/drm_encoder_slave.c   | 2 +-
 drivers/gpu/drm/nouveau/nouveau_encoder.h | 2 +-
 drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c | 6 +++---
 drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c | 8 
 include/drm/drm_encoder_slave.h   | 2 +-
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_encoder_slave.c 
b/drivers/gpu/drm/drm_encoder_slave.c
index d18b88b..e862907 100644
--- a/drivers/gpu/drm/drm_encoder_slave.c
+++ b/drivers/gpu/drm/drm_encoder_slave.c
@@ -124,7 +124,7 @@ EXPORT_SYMBOL(drm_i2c_encoder_destroy);
  * Wrapper fxns which can be plugged in to drm_encoder_helper_funcs:
  */

-static inline struct drm_encoder_slave_funcs *
+static inline const struct drm_encoder_slave_funcs *
 get_slave_funcs(struct drm_encoder *enc)
 {
return to_encoder_slave(enc)->slave_funcs;
diff --git a/drivers/gpu/drm/nouveau/nouveau_encoder.h 
b/drivers/gpu/drm/nouveau/nouveau_encoder.h
index c38a864..ee6a6d3 100644
--- a/drivers/gpu/drm/nouveau/nouveau_encoder.h
+++ b/drivers/gpu/drm/nouveau/nouveau_encoder.h
@@ -83,7 +83,7 @@ static inline struct drm_encoder *to_drm_encoder(struct 
nouveau_encoder *enc)
return &enc->base.base;
 }

-static inline struct drm_encoder_slave_funcs *
+static inline const struct drm_encoder_slave_funcs *
 get_slave_funcs(struct drm_encoder *enc)
 {
return to_encoder_slave(enc)->slave_funcs;
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c 
b/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c
index 96f2eb4..a37b6e2 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c
@@ -28,7 +28,7 @@ static int rcar_du_hdmi_connector_get_modes(struct 
drm_connector *connector)
 {
struct rcar_du_connector *con = to_rcar_connector(connector);
struct drm_encoder *encoder = rcar_encoder_to_drm_encoder(con->encoder);
-   struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder);
+   const struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder);

if (sfuncs->get_modes == NULL)
return 0;
@@ -41,7 +41,7 @@ static int rcar_du_hdmi_connector_mode_valid(struct 
drm_connector *connector,
 {
struct rcar_du_connector *con = to_rcar_connector(connector);
struct drm_encoder *encoder = rcar_encoder_to_drm_encoder(con->encoder);
-   struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder);
+   const struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder);

if (sfuncs->mode_valid == NULL)
return MODE_OK;
@@ -66,7 +66,7 @@ rcar_du_hdmi_connector_detect(struct drm_connector 
*connector, bool force)
 {
struct rcar_du_connector *con = to_rcar_connector(connector);
struct drm_encoder *encoder = rcar_encoder_to_drm_encoder(con->encoder);
-   struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder);
+   const struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder);

if (sfuncs->detect == NULL)
return connector_status_unknown;
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c 
b/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c
index 11267de..2567efc 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c
@@ -35,7 +35,7 @@ struct rcar_du_hdmienc {
 static void rcar_du_hdmienc_disable(struct drm_encoder *encoder)
 {
struct rcar_du_hdmienc *hdmienc = to_rcar_hdmienc(encoder);
-   struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder);
+   const struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder);

if (sfuncs->dpms)
sfuncs->dpms(encoder, DRM_MODE_DPMS_OFF);
@@ -50,7 +50,7 @@ static void rcar_du_hdmienc_disable(struct drm_encoder 
*encoder)
 static void rcar_du_hdmienc_enable(struct drm_encoder *encoder)
 {
struct rcar_du_hdmienc *hdmienc = to_rcar_hdmienc(encoder);
-   struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder);
+   const struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder);

if (hdmienc->renc->lvds)
rcar_du_lvdsenc_enable(hdmienc->renc->lvds, encoder->crtc,
@@ -67,7 +67,7 @@ static int rcar_du_hdmienc_atomic_check(struct drm_encoder 
*encoder,
struct drm_connector_state *conn_state)
 {
struct rcar_du_hdmienc *hdmienc = to_rcar_hdmienc(encoder);
-   struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder);
+   const struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder);
struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode;
const struct drm_display_mode *mode = &crtc_state->mode;

@@ -89,7 +89,7 @@ static void rcar_du_hdmienc_mode_set(struct drm_encoder 
*encoder,
 struct drm_display_mode *ad

[RESEND PATCH 12/28] drm/atmel-hlcdc: Constify function pointer structs

2015-12-15 Thread Boris Brezillon
From: Ville Syrjälä 

Moves a bunch of junk to .rodata from .data.

drivers/gpu/drm/atmel-hlcdc/atmel-hlcdc-dc.ko:
-.text   12488
+.text   12480
-.rodata  1696
+.rodata  1760
-.data 776
+.data 712

Signed-off-by: Ville Syrjälä 
Reviewed-by: Alex Deucher 
Acked-by: Boris Brezillon 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c 
b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
index d112900..0f7ec01 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
@@ -146,7 +146,7 @@ atmel_hlcdc_rgb_encoder_mode_set(struct drm_encoder 
*encoder,
   cfg);
 }

-static struct drm_encoder_helper_funcs atmel_hlcdc_panel_encoder_helper_funcs 
= {
+static const struct drm_encoder_helper_funcs 
atmel_hlcdc_panel_encoder_helper_funcs = {
.mode_fixup = atmel_hlcdc_panel_encoder_mode_fixup,
.mode_set = atmel_hlcdc_rgb_encoder_mode_set,
.disable = atmel_hlcdc_panel_encoder_disable,
@@ -192,7 +192,7 @@ atmel_hlcdc_rgb_best_encoder(struct drm_connector 
*connector)
return &rgb->encoder;
 }

-static struct drm_connector_helper_funcs 
atmel_hlcdc_panel_connector_helper_funcs = {
+static const struct drm_connector_helper_funcs 
atmel_hlcdc_panel_connector_helper_funcs = {
.get_modes = atmel_hlcdc_panel_get_modes,
.mode_valid = atmel_hlcdc_rgb_mode_valid,
.best_encoder = atmel_hlcdc_rgb_best_encoder,
-- 
2.1.4



[RESEND PATCH 13/28] drm/bochs: Constify function pointer structs

2015-12-15 Thread Boris Brezillon
From: Ville Syrjälä 

Moves a bunch of junk to .rodata from .data.

 drivers/gpu/drm/bochs/bochs-drm.ko:
-.text7608
+.text7600
-.rodata   648
+.rodata   716
-.data 612
+.data 544

Signed-off-by: Ville Syrjälä 
Reviewed-by: Alex Deucher 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/bochs/bochs_kms.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bochs/bochs_kms.c 
b/drivers/gpu/drm/bochs/bochs_kms.c
index 823858f..2849f1b 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -245,13 +245,13 @@ static enum drm_connector_status 
bochs_connector_detect(struct drm_connector
return connector_status_connected;
 }

-struct drm_connector_helper_funcs bochs_connector_connector_helper_funcs = {
+static const struct drm_connector_helper_funcs 
bochs_connector_connector_helper_funcs = {
.get_modes = bochs_connector_get_modes,
.mode_valid = bochs_connector_mode_valid,
.best_encoder = bochs_connector_best_encoder,
 };

-struct drm_connector_funcs bochs_connector_connector_funcs = {
+static const struct drm_connector_funcs bochs_connector_connector_funcs = {
.dpms = drm_helper_connector_dpms,
.detect = bochs_connector_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
@@ -283,7 +283,7 @@ int bochs_kms_init(struct bochs_device *bochs)
bochs->dev->mode_config.preferred_depth = 24;
bochs->dev->mode_config.prefer_shadow = 0;

-   bochs->dev->mode_config.funcs = (void *)&bochs_mode_funcs;
+   bochs->dev->mode_config.funcs = &bochs_mode_funcs;

bochs_crtc_init(bochs->dev);
bochs_encoder_init(bochs->dev);
-- 
2.1.4



[RESEND PATCH 14/28] drm/bridge/dw_hdmi: Constify function pointer structs

2015-12-15 Thread Boris Brezillon
From: Ville Syrjälä 

Moves a bunch of junk to .rodata from .data.

 drivers/gpu/drm/bridge/dw_hdmi.ko:
-.rodata  120
+.rodata  216
-.data 96
+.data  0

Signed-off-by: Ville Syrjälä 
Reviewed-by: Alex Deucher 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/bridge/dw_hdmi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index 56de9f1..210d8df 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -1514,7 +1514,7 @@ static void dw_hdmi_connector_force(struct drm_connector 
*connector)
mutex_unlock(&hdmi->mutex);
 }

-static struct drm_connector_funcs dw_hdmi_connector_funcs = {
+static const struct drm_connector_funcs dw_hdmi_connector_funcs = {
.dpms = drm_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = dw_hdmi_connector_detect,
@@ -1522,13 +1522,13 @@ static struct drm_connector_funcs 
dw_hdmi_connector_funcs = {
.force = dw_hdmi_connector_force,
 };

-static struct drm_connector_helper_funcs dw_hdmi_connector_helper_funcs = {
+static const struct drm_connector_helper_funcs dw_hdmi_connector_helper_funcs 
= {
.get_modes = dw_hdmi_connector_get_modes,
.mode_valid = dw_hdmi_connector_mode_valid,
.best_encoder = dw_hdmi_connector_best_encoder,
 };

-static struct drm_bridge_funcs dw_hdmi_bridge_funcs = {
+static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = {
.enable = dw_hdmi_bridge_enable,
.disable = dw_hdmi_bridge_disable,
.pre_enable = dw_hdmi_bridge_nop,
-- 
2.1.4



[RESEND PATCH 02/28] drm/bochs: Store correct CRTC index in events

2015-12-15 Thread Boris Brezillon
From: Thierry Reding 

Previously a negative pipe caused a special case to be triggered for
drivers that didn't have proper VBLANK support. The trigger for this
special case is now independent of the pipe, so the correct CRTC index
can now be stored in events.

v2: convert to use drm_crtc_send_vblank_event()

Cc: Gerd Hoffmann 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/bochs/bochs_kms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bochs/bochs_kms.c 
b/drivers/gpu/drm/bochs/bochs_kms.c
index a88be6d..823858f 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -119,7 +119,7 @@ static int bochs_crtc_page_flip(struct drm_crtc *crtc,
bochs_crtc_mode_set_base(crtc, 0, 0, old_fb);
if (event) {
spin_lock_irqsave(&bochs->dev->event_lock, irqflags);
-   drm_send_vblank_event(bochs->dev, -1, event);
+   drm_crtc_send_vblank_event(crtc, event);
spin_unlock_irqrestore(&bochs->dev->event_lock, irqflags);
}
return 0;
-- 
2.1.4



[RESEND PATCH 03/28] drm/imx: Make pipe number unsigned

2015-12-15 Thread Boris Brezillon
From: Thierry Reding 

There's no reason whatsoever why this should ever be negative. The same
goes for the number of pipes added to the DRM device.

Cc: Philipp Zabel 
Acked-by: Philipp Zabel 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/imx/imx-drm-core.c | 6 +++---
 drivers/gpu/drm/imx/imx-drm.h  | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c 
b/drivers/gpu/drm/imx/imx-drm-core.c
index 09e20ea..9211473 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -39,13 +39,13 @@ struct imx_drm_component {
 struct imx_drm_device {
struct drm_device   *drm;
struct imx_drm_crtc *crtc[MAX_CRTC];
-   int pipes;
+   unsigned intpipes;
struct drm_fbdev_cma*fbhelper;
 };

 struct imx_drm_crtc {
struct drm_crtc *crtc;
-   int pipe;
+   unsigned intpipe;
struct imx_drm_crtc_helper_funcsimx_drm_helper_funcs;
 };

@@ -54,7 +54,7 @@ static int legacyfb_depth = 16;
 module_param(legacyfb_depth, int, 0444);
 #endif

-int imx_drm_crtc_id(struct imx_drm_crtc *crtc)
+unsigned int imx_drm_crtc_id(struct imx_drm_crtc *crtc)
 {
return crtc->pipe;
 }
diff --git a/drivers/gpu/drm/imx/imx-drm.h b/drivers/gpu/drm/imx/imx-drm.h
index 83284b4..71cf6d9 100644
--- a/drivers/gpu/drm/imx/imx-drm.h
+++ b/drivers/gpu/drm/imx/imx-drm.h
@@ -13,7 +13,7 @@ struct drm_plane;
 struct imx_drm_crtc;
 struct platform_device;

-int imx_drm_crtc_id(struct imx_drm_crtc *crtc);
+unsigned int imx_drm_crtc_id(struct imx_drm_crtc *crtc);

 struct imx_drm_crtc_helper_funcs {
int (*enable_vblank)(struct drm_crtc *crtc);
-- 
2.1.4



[RESEND PATCH 04/28] drm/imx: Drop pipe field from struct imx_drm_crtc

2015-12-15 Thread Boris Brezillon
From: Thierry Reding 

Use the drm_crtc_index() helper to determine the pipe number of the CRTC
instead.

Cc: Philipp Zabel 
Acked-by: Philipp Zabel 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/imx/imx-drm-core.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c 
b/drivers/gpu/drm/imx/imx-drm-core.c
index 9211473..303a673 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -45,7 +45,6 @@ struct imx_drm_device {

 struct imx_drm_crtc {
struct drm_crtc *crtc;
-   unsigned intpipe;
struct imx_drm_crtc_helper_funcsimx_drm_helper_funcs;
 };

@@ -56,7 +55,7 @@ module_param(legacyfb_depth, int, 0444);

 unsigned int imx_drm_crtc_id(struct imx_drm_crtc *crtc)
 {
-   return crtc->pipe;
+   return drm_crtc_index(crtc->crtc);
 }
 EXPORT_SYMBOL_GPL(imx_drm_crtc_id);

@@ -124,19 +123,19 @@ EXPORT_SYMBOL_GPL(imx_drm_set_bus_format);

 int imx_drm_crtc_vblank_get(struct imx_drm_crtc *imx_drm_crtc)
 {
-   return drm_vblank_get(imx_drm_crtc->crtc->dev, imx_drm_crtc->pipe);
+   return drm_crtc_vblank_get(imx_drm_crtc->crtc);
 }
 EXPORT_SYMBOL_GPL(imx_drm_crtc_vblank_get);

 void imx_drm_crtc_vblank_put(struct imx_drm_crtc *imx_drm_crtc)
 {
-   drm_vblank_put(imx_drm_crtc->crtc->dev, imx_drm_crtc->pipe);
+   drm_crtc_vblank_put(imx_drm_crtc->crtc);
 }
 EXPORT_SYMBOL_GPL(imx_drm_crtc_vblank_put);

 void imx_drm_handle_vblank(struct imx_drm_crtc *imx_drm_crtc)
 {
-   drm_handle_vblank(imx_drm_crtc->crtc->dev, imx_drm_crtc->pipe);
+   drm_crtc_handle_vblank(imx_drm_crtc->crtc);
 }
 EXPORT_SYMBOL_GPL(imx_drm_handle_vblank);

@@ -356,12 +355,11 @@ int imx_drm_add_crtc(struct drm_device *drm, struct 
drm_crtc *crtc,
return -ENOMEM;

imx_drm_crtc->imx_drm_helper_funcs = *imx_drm_helper_funcs;
-   imx_drm_crtc->pipe = imxdrm->pipes++;
imx_drm_crtc->crtc = crtc;

crtc->port = port;

-   imxdrm->crtc[imx_drm_crtc->pipe] = imx_drm_crtc;
+   imxdrm->crtc[imxdrm->pipes++] = imx_drm_crtc;

*new_crtc = imx_drm_crtc;

@@ -378,7 +376,7 @@ int imx_drm_add_crtc(struct drm_device *drm, struct 
drm_crtc *crtc,
return 0;

 err_register:
-   imxdrm->crtc[imx_drm_crtc->pipe] = NULL;
+   imxdrm->crtc[--imxdrm->pipes] = NULL;
kfree(imx_drm_crtc);
return ret;
 }
@@ -390,10 +388,11 @@ EXPORT_SYMBOL_GPL(imx_drm_add_crtc);
 int imx_drm_remove_crtc(struct imx_drm_crtc *imx_drm_crtc)
 {
struct imx_drm_device *imxdrm = imx_drm_crtc->crtc->dev->dev_private;
+   unsigned int pipe = drm_crtc_index(imx_drm_crtc->crtc);

drm_crtc_cleanup(imx_drm_crtc->crtc);

-   imxdrm->crtc[imx_drm_crtc->pipe] = NULL;
+   imxdrm->crtc[pipe] = NULL;

kfree(imx_drm_crtc);

-- 
2.1.4



[RESEND PATCH 07/28] drm/vmwgfx: check kmalloc return value

2015-12-15 Thread Boris Brezillon
From: Rasmus Villemoes 

srf->sizes has been allocated and checked a few lines above; fix up
the copy-pasto so that we check srf->offsets.

Reported-by: kbuild test robot 
Signed-off-by: Rasmus Villemoes 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index a3ae985..c2a721a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -771,7 +771,7 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void 
*data,
}
srf->offsets = kmalloc(srf->num_sizes * sizeof(*srf->offsets),
   GFP_KERNEL);
-   if (unlikely(srf->sizes == NULL)) {
+   if (unlikely(srf->offsets == NULL)) {
ret = -ENOMEM;
goto out_no_offsets;
}
-- 
2.1.4



[RESEND PATCH 11/28] drm/armada: Constify function pointer structs

2015-12-15 Thread Boris Brezillon
From: Ville Syrjälä 

Moves a bunch of junk to .rodata from .data.

drivers/gpu/drm/armada/armada.ko:
-.rodata  1040
+.rodata  1100
-.data1156
+.data1096

Signed-off-by: Ville Syrjälä 
Reviewed-by: Alex Deucher 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/armada/armada_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/armada/armada_crtc.c 
b/drivers/gpu/drm/armada/armada_crtc.c
index 9bdc28c..4123680 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -1074,7 +1074,7 @@ armada_drm_crtc_set_property(struct drm_crtc *crtc,
return 0;
 }

-static struct drm_crtc_funcs armada_crtc_funcs = {
+static const struct drm_crtc_funcs armada_crtc_funcs = {
.cursor_set = armada_drm_crtc_cursor_set,
.cursor_move= armada_drm_crtc_cursor_move,
.destroy= armada_drm_crtc_destroy,
-- 
2.1.4



[RESEND PATCH 15/28] drm/bridge/nxp-ptn3460: Constify function pointer structs

2015-12-15 Thread Boris Brezillon
From: Ville Syrjälä 

Moves a bunch of junk to .rodata from .data.

 drivers/gpu/drm/bridge/nxp-ptn3460.ko:
-.rodata  440
+.rodata  536
-.data208
+.data112

Signed-off-by: Ville Syrjälä 
Reviewed-by: Alex Deucher 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/bridge/nxp-ptn3460.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/nxp-ptn3460.c 
b/drivers/gpu/drm/bridge/nxp-ptn3460.c
index 0ffa3a6..7ecd59f 100644
--- a/drivers/gpu/drm/bridge/nxp-ptn3460.c
+++ b/drivers/gpu/drm/bridge/nxp-ptn3460.c
@@ -242,7 +242,7 @@ static struct drm_encoder *ptn3460_best_encoder(struct 
drm_connector *connector)
return ptn_bridge->bridge.encoder;
 }

-static struct drm_connector_helper_funcs ptn3460_connector_helper_funcs = {
+static const struct drm_connector_helper_funcs ptn3460_connector_helper_funcs 
= {
.get_modes = ptn3460_get_modes,
.best_encoder = ptn3460_best_encoder,
 };
@@ -258,7 +258,7 @@ static void ptn3460_connector_destroy(struct drm_connector 
*connector)
drm_connector_cleanup(connector);
 }

-static struct drm_connector_funcs ptn3460_connector_funcs = {
+static const struct drm_connector_funcs ptn3460_connector_funcs = {
.dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = ptn3460_detect,
@@ -299,7 +299,7 @@ static int ptn3460_bridge_attach(struct drm_bridge *bridge)
return ret;
 }

-static struct drm_bridge_funcs ptn3460_bridge_funcs = {
+static const struct drm_bridge_funcs ptn3460_bridge_funcs = {
.pre_enable = ptn3460_pre_enable,
.enable = ptn3460_enable,
.disable = ptn3460_disable,
-- 
2.1.4



[RESEND PATCH 16/28] drm/i2c/ch7006: Constify function pointer structs

2015-12-15 Thread Boris Brezillon
From: Ville Syrjälä 

Moves a bunch of junk to .rodata from .data.

 drivers/gpu/drm/i2c/ch7006.ko:
-.text5752
+.text5760
-.rodata  6608
+.rodata  6656
-.data 216
+.data 168

Signed-off-by: Ville Syrjälä 
Reviewed-by: Alex Deucher 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/i2c/ch7006_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c
index d9a72c9..90db5f4 100644
--- a/drivers/gpu/drm/i2c/ch7006_drv.c
+++ b/drivers/gpu/drm/i2c/ch7006_drv.c
@@ -371,7 +371,7 @@ static int ch7006_encoder_set_property(struct drm_encoder 
*encoder,
return 0;
 }

-static struct drm_encoder_slave_funcs ch7006_encoder_funcs = {
+static const struct drm_encoder_slave_funcs ch7006_encoder_funcs = {
.set_config = ch7006_encoder_set_config,
.destroy = ch7006_encoder_destroy,
.dpms = ch7006_encoder_dpms,
-- 
2.1.4



[RESEND PATCH 19/28] drm/i2c/adv7511: Constify function pointer structs

2015-12-15 Thread Boris Brezillon
From: Ville Syrjälä 

Moves a bunch of junk to .rodata from .data.

 drivers/gpu/drm/i2c/adv7511.ko:
-.rodata 1368
+.rodata 1416
-.data164
+.data116

Signed-off-by: Ville Syrjälä 
Reviewed-by: Alex Deucher 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/i2c/adv7511.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c
index 00416f2..533d1e3 100644
--- a/drivers/gpu/drm/i2c/adv7511.c
+++ b/drivers/gpu/drm/i2c/adv7511.c
@@ -752,7 +752,7 @@ static void adv7511_encoder_mode_set(struct drm_encoder 
*encoder,
adv7511->f_tmds = mode->clock;
 }

-static struct drm_encoder_slave_funcs adv7511_encoder_funcs = {
+static const struct drm_encoder_slave_funcs adv7511_encoder_funcs = {
.dpms = adv7511_encoder_dpms,
.mode_valid = adv7511_encoder_mode_valid,
.mode_set = adv7511_encoder_mode_set,
-- 
2.1.4



[RESEND PATCH 17/28] drm/cirrus: Constify function pointer structs

2015-12-15 Thread Boris Brezillon
From: Ville Syrjälä 

Moves a bunch of junk to .rodata from .data.

 drivers/gpu/drm/cirrus/cirrus.ko:
-.text   10104
+.text   10092
-.rodata   528
+.rodata   596
-.data 608
+.data 540

Signed-off-by: Ville Syrjälä 
Reviewed-by: Alex Deucher 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/cirrus/cirrus_mode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c 
b/drivers/gpu/drm/cirrus/cirrus_mode.c
index 276719e..4a02854 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -533,12 +533,12 @@ static void cirrus_connector_destroy(struct drm_connector 
*connector)
kfree(connector);
 }

-struct drm_connector_helper_funcs cirrus_vga_connector_helper_funcs = {
+static const struct drm_connector_helper_funcs 
cirrus_vga_connector_helper_funcs = {
.get_modes = cirrus_vga_get_modes,
.best_encoder = cirrus_connector_best_encoder,
 };

-struct drm_connector_funcs cirrus_vga_connector_funcs = {
+static const struct drm_connector_funcs cirrus_vga_connector_funcs = {
.dpms = drm_helper_connector_dpms,
.detect = cirrus_vga_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
-- 
2.1.4



[RESEND PATCH 18/28] drm/exynos: Constify function pointer structs

2015-12-15 Thread Boris Brezillon
From: Ville Syrjälä 

Moves a bunch of junk to .rodata from .data.

 drivers/gpu/drm/exynos/exynosdrm.ko:
-.text   125792
+.text   125788
-.rodata  10972
+.rodata  11748
-.data 6720
+.data 5944

Signed-off-by: Ville Syrjälä 
Reviewed-by: Alex Deucher 
Reviewed-by: Gustavo Padovan 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/exynos/exynos_dp_core.c  | 8 
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 4 ++--
 drivers/gpu/drm/exynos/exynos_drm_dpi.c  | 8 
 drivers/gpu/drm/exynos/exynos_drm_dsi.c  | 8 
 drivers/gpu/drm/exynos/exynos_drm_fb.c   | 2 +-
 drivers/gpu/drm/exynos/exynos_drm_mic.c  | 2 +-
 drivers/gpu/drm/exynos/exynos_drm_vidi.c | 8 
 drivers/gpu/drm/exynos/exynos_hdmi.c | 8 
 8 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 793e497..b79c316 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -953,7 +953,7 @@ static void exynos_dp_connector_destroy(struct 
drm_connector *connector)
drm_connector_cleanup(connector);
 }

-static struct drm_connector_funcs exynos_dp_connector_funcs = {
+static const struct drm_connector_funcs exynos_dp_connector_funcs = {
.dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = exynos_dp_detect,
@@ -998,7 +998,7 @@ static struct drm_encoder *exynos_dp_best_encoder(
return &dp->encoder;
 }

-static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = {
+static const struct drm_connector_helper_funcs 
exynos_dp_connector_helper_funcs = {
.get_modes = exynos_dp_get_modes,
.best_encoder = exynos_dp_best_encoder,
 };
@@ -1176,14 +1176,14 @@ static void exynos_dp_disable(struct drm_encoder 
*encoder)
 {
 }

-static struct drm_encoder_helper_funcs exynos_dp_encoder_helper_funcs = {
+static const struct drm_encoder_helper_funcs exynos_dp_encoder_helper_funcs = {
.mode_fixup = exynos_dp_mode_fixup,
.mode_set = exynos_dp_mode_set,
.enable = exynos_dp_enable,
.disable = exynos_dp_disable,
 };

-static struct drm_encoder_funcs exynos_dp_encoder_funcs = {
+static const struct drm_encoder_funcs exynos_dp_encoder_funcs = {
.destroy = drm_encoder_cleanup,
 };

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 9d30a0f..80f7974 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -93,7 +93,7 @@ static void exynos_crtc_atomic_flush(struct drm_crtc *crtc,
}
 }

-static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
+static const struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
.enable = exynos_drm_crtc_enable,
.disable= exynos_drm_crtc_disable,
.mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
@@ -113,7 +113,7 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
kfree(exynos_crtc);
 }

-static struct drm_crtc_funcs exynos_crtc_funcs = {
+static const struct drm_crtc_funcs exynos_crtc_funcs = {
.set_config = drm_atomic_helper_set_config,
.page_flip  = drm_atomic_helper_page_flip,
.destroy= exynos_drm_crtc_destroy,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c 
b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index 1dbf8dc..05350ae 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -57,7 +57,7 @@ static void exynos_dpi_connector_destroy(struct drm_connector 
*connector)
drm_connector_cleanup(connector);
 }

-static struct drm_connector_funcs exynos_dpi_connector_funcs = {
+static const struct drm_connector_funcs exynos_dpi_connector_funcs = {
.dpms = drm_atomic_helper_connector_dpms,
.detect = exynos_dpi_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
@@ -100,7 +100,7 @@ exynos_dpi_best_encoder(struct drm_connector *connector)
return &ctx->encoder;
 }

-static struct drm_connector_helper_funcs exynos_dpi_connector_helper_funcs = {
+static const struct drm_connector_helper_funcs 
exynos_dpi_connector_helper_funcs = {
.get_modes = exynos_dpi_get_modes,
.best_encoder = exynos_dpi_best_encoder,
 };
@@ -161,14 +161,14 @@ static void exynos_dpi_disable(struct drm_encoder 
*encoder)
}
 }

-static struct drm_encoder_helper_funcs exynos_dpi_encoder_helper_funcs = {
+static const struct drm_encoder_helper_funcs exynos_dpi_encoder_helper_funcs = 
{
.mode_fixup = exynos_dpi_mode_fixup,
.mode_set = exynos_dpi_mode_set,
.enable = exynos_dpi_enable,
.disable = exynos_dpi_disable,
 };

-static struct drm_encoder_funcs exynos_dpi_encod

[RESEND PATCH 21/28] drm/imx: Constify function pointer structs

2015-12-15 Thread Boris Brezillon
From: Ville Syrjälä 

Moves a bunch of junk to .rodata from .data.

 drivers/gpu/drm/imx/imxdrm.ko:
-.rodata  624
+.rodata  652
-.data372
+.data344

 drivers/gpu/drm/imx/imx-ipuv3-crtc.ko:
-.rodata  224
+.rodata  280
-.data184
+.data128

 drivers/gpu/drm/imx/imx-ldb.ko:
-.rodata  660
+.rodata  784
-.data240
+.data116

 drivers/gpu/drm/imx/imx-tve.ko:
-.rodata  400
+.rodata  524
-.data416
+.data292

 drivers/gpu/drm/imx/parallel-display.ko:
-.rodata  400
+.rodata  524
-.data216
+.data 92

Signed-off-by: Ville Syrjälä 
Reviewed-by: Alex Deucher 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/imx/dw_hdmi-imx.c  | 4 ++--
 drivers/gpu/drm/imx/imx-drm-core.c | 2 +-
 drivers/gpu/drm/imx/imx-ldb.c  | 8 
 drivers/gpu/drm/imx/imx-tve.c  | 8 
 drivers/gpu/drm/imx/ipuv3-crtc.c   | 2 +-
 drivers/gpu/drm/imx/parallel-display.c | 8 
 6 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c 
b/drivers/gpu/drm/imx/dw_hdmi-imx.c
index 35fcf6b..063825f 100644
--- a/drivers/gpu/drm/imx/dw_hdmi-imx.c
+++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c
@@ -137,7 +137,7 @@ static void dw_hdmi_imx_encoder_prepare(struct drm_encoder 
*encoder)
imx_drm_set_bus_format(encoder, MEDIA_BUS_FMT_RGB888_1X24);
 }

-static struct drm_encoder_helper_funcs dw_hdmi_imx_encoder_helper_funcs = {
+static const struct drm_encoder_helper_funcs dw_hdmi_imx_encoder_helper_funcs 
= {
.mode_fixup = dw_hdmi_imx_encoder_mode_fixup,
.mode_set   = dw_hdmi_imx_encoder_mode_set,
.prepare= dw_hdmi_imx_encoder_prepare,
@@ -145,7 +145,7 @@ static struct drm_encoder_helper_funcs 
dw_hdmi_imx_encoder_helper_funcs = {
.disable= dw_hdmi_imx_encoder_disable,
 };

-static struct drm_encoder_funcs dw_hdmi_imx_encoder_funcs = {
+static const struct drm_encoder_funcs dw_hdmi_imx_encoder_funcs = {
.destroy = drm_encoder_cleanup,
 };

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c 
b/drivers/gpu/drm/imx/imx-drm-core.c
index 303a673..7be7ac8 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -214,7 +214,7 @@ static void imx_drm_output_poll_changed(struct drm_device 
*drm)
drm_fbdev_cma_hotplug_event(imxdrm->fbhelper);
 }

-static struct drm_mode_config_funcs imx_drm_mode_config_funcs = {
+static const struct drm_mode_config_funcs imx_drm_mode_config_funcs = {
.fb_create = drm_fb_cma_create,
.output_poll_changed = imx_drm_output_poll_changed,
 };
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index c79a61b..22ac482 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -358,23 +358,23 @@ static void imx_ldb_encoder_disable(struct drm_encoder 
*encoder)
drm_panel_unprepare(imx_ldb_ch->panel);
 }

-static struct drm_connector_funcs imx_ldb_connector_funcs = {
+static const struct drm_connector_funcs imx_ldb_connector_funcs = {
.dpms = drm_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = imx_ldb_connector_detect,
.destroy = imx_drm_connector_destroy,
 };

-static struct drm_connector_helper_funcs imx_ldb_connector_helper_funcs = {
+static const struct drm_connector_helper_funcs imx_ldb_connector_helper_funcs 
= {
.get_modes = imx_ldb_connector_get_modes,
.best_encoder = imx_ldb_connector_best_encoder,
 };

-static struct drm_encoder_funcs imx_ldb_encoder_funcs = {
+static const struct drm_encoder_funcs imx_ldb_encoder_funcs = {
.destroy = imx_drm_encoder_destroy,
 };

-static struct drm_encoder_helper_funcs imx_ldb_encoder_helper_funcs = {
+static const struct drm_encoder_helper_funcs imx_ldb_encoder_helper_funcs = {
.dpms = imx_ldb_encoder_dpms,
.mode_fixup = imx_ldb_encoder_mode_fixup,
.prepare = imx_ldb_encoder_prepare,
diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c
index e61a8fc..292349f 100644
--- a/drivers/gpu/drm/imx/imx-tve.c
+++ b/drivers/gpu/drm/imx/imx-tve.c
@@ -360,24 +360,24 @@ static void imx_tve_encoder_disable(struct drm_encoder 
*encoder)
tve_disable(tve);
 }

-static struct drm_connector_funcs imx_tve_connector_funcs = {
+static const struct drm_connector_funcs imx_tve_connector_funcs = {
.dpms = drm_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = imx_tve_connector_detect,
.destroy = imx_drm_connector_destroy,
 };

-static struct drm

[RESEND PATCH 20/28] drm/i2c/sil164: Constify function pointer structs

2015-12-15 Thread Boris Brezillon
From: Ville Syrjälä 

Moves a bunch of junk to .rodata from .data.

 drivers/gpu/drm/i2c/sil164.ko:
-.text   1660
+.text   1656
-.rodata   56
+.rodata  104
-.data212
+.data164

Signed-off-by: Ville Syrjälä 
Reviewed-by: Alex Deucher 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/i2c/sil164_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i2c/sil164_drv.c b/drivers/gpu/drm/i2c/sil164_drv.c
index 002ce78..c400428 100644
--- a/drivers/gpu/drm/i2c/sil164_drv.c
+++ b/drivers/gpu/drm/i2c/sil164_drv.c
@@ -341,7 +341,7 @@ sil164_encoder_destroy(struct drm_encoder *encoder)
drm_i2c_encoder_destroy(encoder);
 }

-static struct drm_encoder_slave_funcs sil164_encoder_funcs = {
+static const struct drm_encoder_slave_funcs sil164_encoder_funcs = {
.set_config = sil164_encoder_set_config,
.destroy = sil164_encoder_destroy,
.dpms = sil164_encoder_dpms,
-- 
2.1.4



[RESEND PATCH 22/28] drm/mgag200: Constify function pointer structs

2015-12-15 Thread Boris Brezillon
From: Ville Syrjälä 

Moves a bunch of junk to .rodata from .data.

 drivers/gpu/drm/mgag200/mgag200.ko:
-.text   29244
+.text   29232
-.rodata   600
+.rodata   668
-.data 688
+.data 620

Signed-off-by: Ville Syrjälä 
Reviewed-by: Alex Deucher 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/mgag200/mgag200_mode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c 
b/drivers/gpu/drm/mgag200/mgag200_mode.c
index 3180212..19c18b7 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -1684,13 +1684,13 @@ static void mga_connector_destroy(struct drm_connector 
*connector)
kfree(connector);
 }

-struct drm_connector_helper_funcs mga_vga_connector_helper_funcs = {
+static const struct drm_connector_helper_funcs mga_vga_connector_helper_funcs 
= {
.get_modes = mga_vga_get_modes,
.mode_valid = mga_vga_mode_valid,
.best_encoder = mga_connector_best_encoder,
 };

-struct drm_connector_funcs mga_vga_connector_funcs = {
+static const struct drm_connector_funcs mga_vga_connector_funcs = {
.dpms = drm_helper_connector_dpms,
.detect = mga_vga_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
-- 
2.1.4



[RESEND PATCH 25/28] drm/tegra: Constify function pointer structs

2015-12-15 Thread Boris Brezillon
From: Ville Syrjälä 

Moves a bunch of junk to .rodata from .data.

 drivers/gpu/drm/tegra/tegra-drm.ko:
-.rodata 13672
+.rodata 13684
-.data1108
+.data1096

Signed-off-by: Ville Syrjälä 
Reviewed-by: Alex Deucher 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/tegra/fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c
index ede9e94..a3515be 100644
--- a/drivers/gpu/drm/tegra/fb.c
+++ b/drivers/gpu/drm/tegra/fb.c
@@ -86,7 +86,7 @@ static int tegra_fb_create_handle(struct drm_framebuffer 
*framebuffer,
return drm_gem_handle_create(file, &fb->planes[0]->gem, handle);
 }

-static struct drm_framebuffer_funcs tegra_fb_funcs = {
+static const struct drm_framebuffer_funcs tegra_fb_funcs = {
.destroy = tegra_fb_destroy,
.create_handle = tegra_fb_create_handle,
 };
-- 
2.1.4



[RESEND PATCH 26/28] drm/udl: Constify function pointer structs

2015-12-15 Thread Boris Brezillon
From: Ville Syrjälä 

Moves a bunch of junk to .rodata from .data.

 drivers/gpu/drm/udl/udl.ko:
-.text   11336
+.text   11332
-.rodata   560
+.rodata   684
-.data 696
+.data 572

Signed-off-by: Ville Syrjälä 
Reviewed-by: Alex Deucher 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/udl/udl_connector.c | 4 ++--
 drivers/gpu/drm/udl/udl_modeset.c   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/udl/udl_connector.c 
b/drivers/gpu/drm/udl/udl_connector.c
index 0110d95..4709b54 100644
--- a/drivers/gpu/drm/udl/udl_connector.c
+++ b/drivers/gpu/drm/udl/udl_connector.c
@@ -122,13 +122,13 @@ static void udl_connector_destroy(struct drm_connector 
*connector)
kfree(connector);
 }

-static struct drm_connector_helper_funcs udl_connector_helper_funcs = {
+static const struct drm_connector_helper_funcs udl_connector_helper_funcs = {
.get_modes = udl_get_modes,
.mode_valid = udl_mode_valid,
.best_encoder = udl_best_single_encoder,
 };

-static struct drm_connector_funcs udl_connector_funcs = {
+static const struct drm_connector_funcs udl_connector_funcs = {
.dpms = drm_helper_connector_dpms,
.detect = udl_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
diff --git a/drivers/gpu/drm/udl/udl_modeset.c 
b/drivers/gpu/drm/udl/udl_modeset.c
index 677190a6..160ef2a 100644
--- a/drivers/gpu/drm/udl/udl_modeset.c
+++ b/drivers/gpu/drm/udl/udl_modeset.c
@@ -400,7 +400,7 @@ static void udl_crtc_commit(struct drm_crtc *crtc)
udl_crtc_dpms(crtc, DRM_MODE_DPMS_ON);
 }

-static struct drm_crtc_helper_funcs udl_helper_funcs = {
+static const struct drm_crtc_helper_funcs udl_helper_funcs = {
.dpms = udl_crtc_dpms,
.mode_fixup = udl_crtc_mode_fixup,
.mode_set = udl_crtc_mode_set,
-- 
2.1.4



[RESEND PATCH 27/28] drm/vmwgfx: Constify function pointer structs

2015-12-15 Thread Boris Brezillon
From: Ville Syrjälä 

Moves a bunch of junk to .rodata from .data.

 drivers/gpu/drm/vmwgfx/vmwgfx.ko:
-.text   132244
+.text   132240
-.rodata  18296
+.rodata  18680
-.data 5096
+.data 4712

Signed-off-by: Ville Syrjälä 
Reviewed-by: Alex Deucher 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c  | 4 ++--
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c  | 6 +++---
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 6 +++---
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 6 +++---
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 9394c35..162f188 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -470,7 +470,7 @@ int vmw_kms_readback(struct vmw_private *dev_priv,
 }


-static struct drm_framebuffer_funcs vmw_framebuffer_surface_funcs = {
+static const struct drm_framebuffer_funcs vmw_framebuffer_surface_funcs = {
.destroy = vmw_framebuffer_surface_destroy,
.dirty = vmw_framebuffer_surface_dirty,
 };
@@ -647,7 +647,7 @@ static int vmw_framebuffer_dmabuf_dirty(struct 
drm_framebuffer *framebuffer,
return ret;
 }

-static struct drm_framebuffer_funcs vmw_framebuffer_dmabuf_funcs = {
+static const struct drm_framebuffer_funcs vmw_framebuffer_dmabuf_funcs = {
.destroy = vmw_framebuffer_dmabuf_destroy,
.dirty = vmw_framebuffer_dmabuf_dirty,
 };
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
index 2aff5e5..2def684 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
@@ -294,7 +294,7 @@ static int vmw_ldu_crtc_set_config(struct drm_mode_set *set)
return vmw_ldu_commit_list(dev_priv);
 }

-static struct drm_crtc_funcs vmw_legacy_crtc_funcs = {
+static const struct drm_crtc_funcs vmw_legacy_crtc_funcs = {
.cursor_set = vmw_du_crtc_cursor_set,
.cursor_move = vmw_du_crtc_cursor_move,
.gamma_set = vmw_du_crtc_gamma_set,
@@ -312,7 +312,7 @@ static void vmw_ldu_encoder_destroy(struct drm_encoder 
*encoder)
vmw_ldu_destroy(vmw_encoder_to_ldu(encoder));
 }

-static struct drm_encoder_funcs vmw_legacy_encoder_funcs = {
+static const struct drm_encoder_funcs vmw_legacy_encoder_funcs = {
.destroy = vmw_ldu_encoder_destroy,
 };

@@ -325,7 +325,7 @@ static void vmw_ldu_connector_destroy(struct drm_connector 
*connector)
vmw_ldu_destroy(vmw_connector_to_ldu(connector));
 }

-static struct drm_connector_funcs vmw_legacy_connector_funcs = {
+static const struct drm_connector_funcs vmw_legacy_connector_funcs = {
.dpms = vmw_du_connector_dpms,
.detect = vmw_du_connector_detect,
.fill_modes = vmw_du_connector_fill_modes,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
index 6bb7af3..ecac70a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
@@ -530,7 +530,7 @@ out_no_fence:
return ret;
 }

-static struct drm_crtc_funcs vmw_screen_object_crtc_funcs = {
+static const struct drm_crtc_funcs vmw_screen_object_crtc_funcs = {
.cursor_set = vmw_du_crtc_cursor_set,
.cursor_move = vmw_du_crtc_cursor_move,
.gamma_set = vmw_du_crtc_gamma_set,
@@ -548,7 +548,7 @@ static void vmw_sou_encoder_destroy(struct drm_encoder 
*encoder)
vmw_sou_destroy(vmw_encoder_to_sou(encoder));
 }

-static struct drm_encoder_funcs vmw_screen_object_encoder_funcs = {
+static const struct drm_encoder_funcs vmw_screen_object_encoder_funcs = {
.destroy = vmw_sou_encoder_destroy,
 };

@@ -561,7 +561,7 @@ static void vmw_sou_connector_destroy(struct drm_connector 
*connector)
vmw_sou_destroy(vmw_connector_to_sou(connector));
 }

-static struct drm_connector_funcs vmw_sou_connector_funcs = {
+static const struct drm_connector_funcs vmw_sou_connector_funcs = {
.dpms = vmw_du_connector_dpms,
.set_property = vmw_du_connector_set_property,
.destroy = vmw_sou_connector_destroy,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
index 45e72c2..87fc00a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
@@ -1040,7 +1040,7 @@ out_finish:
 /*
  *  Screen Target CRTC dispatch table
  */
-static struct drm_crtc_funcs vmw_stdu_crtc_funcs = {
+static const struct drm_crtc_funcs vmw_stdu_crtc_funcs = {
.cursor_set = vmw_du_crtc_cursor_set,
.cursor_move = vmw_du_crtc_cursor_move,
.gamma_set = vmw_du_crtc_gamma_set,
@@ -1070,7 +1070,7 @@ static void vmw_stdu_encoder_destroy(struct drm_encoder 
*encoder)
vmw_stdu_destroy(vmw_encoder_to_stdu(encoder));
 }

-static struct drm_encoder_funcs vmw_stdu_encoder_funcs = {
+static const struct drm_encoder_funcs vmw_stdu_encod

[RESEND PATCH 28/28] drm: atmel-hlcdc: Fix module autoload for OF platform driver

2015-12-15 Thread Boris Brezillon
From: Luis de Bethencourt 

This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt 
Acked-by: Boris Brezillon 
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c 
b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index 378..bf64380 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -346,6 +346,7 @@ static const struct of_device_id atmel_hlcdc_of_match[] = {
},
{ /* sentinel */ },
 };
+MODULE_DEVICE_TABLE(of, atmel_hlcdc_of_match);

 int atmel_hlcdc_dc_mode_valid(struct atmel_hlcdc_dc *dc,
  struct drm_display_mode *mode)
-- 
2.1.4



[RESEND PATCH 24/28] drm/rockchip: Constify function pointer structs

2015-12-15 Thread Boris Brezillon
From: Ville Syrjälä 

Moves a bunch of junk to .rodata from .data.

 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.ko:
-.rodata  772
+.rodata  828
-.data148
+.data 92

 drivers/gpu/drm/rockchip/rockchipdrm.ko:
-.rodata  748
+.rodata  760
-.data448
+.data436

Signed-off-by: Ville Syrjälä 
Reviewed-by: Alex Deucher 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 4 ++--
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 
b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index 525b5a8..bddcabd 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -173,7 +173,7 @@ dw_hdmi_rockchip_mode_valid(struct drm_connector *connector,
return (valid) ? MODE_OK : MODE_BAD;
 }

-static struct drm_encoder_funcs dw_hdmi_rockchip_encoder_funcs = {
+static const struct drm_encoder_funcs dw_hdmi_rockchip_encoder_funcs = {
.destroy = drm_encoder_cleanup,
 };

@@ -218,7 +218,7 @@ static void dw_hdmi_rockchip_encoder_prepare(struct 
drm_encoder *encoder)
  ROCKCHIP_OUT_MODE_);
 }

-static struct drm_encoder_helper_funcs dw_hdmi_rockchip_encoder_helper_funcs = 
{
+static const struct drm_encoder_helper_funcs 
dw_hdmi_rockchip_encoder_helper_funcs = {
.mode_fixup = dw_hdmi_rockchip_encoder_mode_fixup,
.mode_set   = dw_hdmi_rockchip_encoder_mode_set,
.prepare= dw_hdmi_rockchip_encoder_prepare,
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
index b8ac591..621f25c 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
@@ -66,7 +66,7 @@ static int rockchip_drm_fb_create_handle(struct 
drm_framebuffer *fb,
 rockchip_fb->obj[0], handle);
 }

-static struct drm_framebuffer_funcs rockchip_drm_fb_funcs = {
+static const struct drm_framebuffer_funcs rockchip_drm_fb_funcs = {
.destroy= rockchip_drm_fb_destroy,
.create_handle  = rockchip_drm_fb_create_handle,
 };
-- 
2.1.4



[Nouveau] [PATCH] drm/nouveau: Fix pre-nv50 pageflip events (v4)

2015-12-15 Thread Emil Velikov
On 15 December 2015 at 11:11, poma  wrote:

>
> Apparently not reached @stable (stable: 4.3.3 2015-12-15),
> so here's one more time.
>
It has reached 4.4-rcX and will get picked by the stable maintainer
(Greg?) in due time. Meanwhile you can ask your distro maintainers to
apply it locally until we get an official release that includes it.

-Emil


[RESEND PATCH 23/28] drm/nouveau: Constify function pointer structs

2015-12-15 Thread Boris Brezillon
From: Ville Syrjälä 

Moves a bunch of junk to .rodata from .data.

 drivers/gpu/drm/nouveau/nouveau.ko:
-.rodata  105688
+.rodata  105792
-.data125724
+.data125620

Signed-off-by: Ville Syrjälä 
Reviewed-by: Alex Deucher 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c 
b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
index d9644c0..163317d 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
@@ -769,7 +769,7 @@ static void nv17_tv_destroy(struct drm_encoder *encoder)
kfree(tv_enc);
 }

-static struct drm_encoder_helper_funcs nv17_tv_helper_funcs = {
+static const struct drm_encoder_helper_funcs nv17_tv_helper_funcs = {
.dpms = nv17_tv_dpms,
.mode_fixup = nv17_tv_mode_fixup,
.prepare = nv17_tv_prepare,
@@ -778,14 +778,14 @@ static struct drm_encoder_helper_funcs 
nv17_tv_helper_funcs = {
.detect = nv17_tv_detect,
 };

-static struct drm_encoder_slave_funcs nv17_tv_slave_funcs = {
+static const struct drm_encoder_slave_funcs nv17_tv_slave_funcs = {
.get_modes = nv17_tv_get_modes,
.mode_valid = nv17_tv_mode_valid,
.create_resources = nv17_tv_create_resources,
.set_property = nv17_tv_set_property,
 };

-static struct drm_encoder_funcs nv17_tv_funcs = {
+static const struct drm_encoder_funcs nv17_tv_funcs = {
.destroy = nv17_tv_destroy,
 };

-- 
2.1.4



[RESEND PATCH 00/28] drm: trivial patches from drm/trivial branch

2015-12-15 Thread Boris Brezillon
On Tue, 15 Dec 2015 12:20:48 +0100
Boris Brezillon  wrote:

> Hi Daniel,
> 
> As discussed on IRC, here are the patches taken by Thierry in his
> drm/trivial/for-next branch. I rebased it on drm-next, and had to fix
> a few conflicts, so it would be safer if someone else takes a closer
> look at those changes.
> 
> The atmel-hlcdc are good, so feel free to take them.

I forgot to add them while rebasing the series, so for the whole
patchset:

Signed-off-by: Boris Brezillon 

> 
> Best Regards,
> 
> Boris
> 
> Frediano Ziglio (1):
>   drm/qxl: use to_qxl_bo macro
> 
> Luis de Bethencourt (1):
>   drm: atmel-hlcdc: Fix module autoload for OF platform driver
> 
> Nicolas Ferre (1):
>   drm: atmel-hlcdc: add support for sama5d2 SoCs
> 
> Rasmus Villemoes (3):
>   drm/omap: use kzalloc in sita_init()
>   drm/vmwgfx: use kzalloc in vmw_surface_define_ioctl()
>   drm/vmwgfx: check kmalloc return value
> 
> Thierry Reding (4):
>   drm/gma500: Sanity-check pipe index
>   drm/bochs: Store correct CRTC index in events
>   drm/imx: Make pipe number unsigned
>   drm/imx: Drop pipe field from struct imx_drm_crtc
> 
> Ville Syrjälä (18):
>   drm: Constify drm_encoder_slave_funcs
>   drm/armada: Constify function pointer structs
>   drm/atmel-hlcdc: Constify function pointer structs
>   drm/bochs: Constify function pointer structs
>   drm/bridge/dw_hdmi: Constify function pointer structs
>   drm/bridge/nxp-ptn3460: Constify function pointer structs
>   drm/i2c/ch7006: Constify function pointer structs
>   drm/cirrus: Constify function pointer structs
>   drm/exynos: Constify function pointer structs
>   drm/i2c/adv7511: Constify function pointer structs
>   drm/i2c/sil164: Constify function pointer structs
>   drm/imx: Constify function pointer structs
>   drm/mgag200: Constify function pointer structs
>   drm/nouveau: Constify function pointer structs
>   drm/rockchip: Constify function pointer structs
>   drm/tegra: Constify function pointer structs
>   drm/udl: Constify function pointer structs
>   drm/vmwgfx: Constify function pointer structs
> 
>  drivers/gpu/drm/armada/armada_crtc.c |  2 +-
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c |  5 +
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c |  4 ++--
>  drivers/gpu/drm/bochs/bochs_kms.c|  8 
>  drivers/gpu/drm/bridge/dw_hdmi.c |  6 +++---
>  drivers/gpu/drm/bridge/nxp-ptn3460.c |  6 +++---
>  drivers/gpu/drm/cirrus/cirrus_mode.c |  4 ++--
>  drivers/gpu/drm/drm_encoder_slave.c  |  2 +-
>  drivers/gpu/drm/exynos/exynos_dp_core.c  |  8 
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c |  4 ++--
>  drivers/gpu/drm/exynos/exynos_drm_dpi.c  |  8 
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c  |  8 
>  drivers/gpu/drm/exynos/exynos_drm_fb.c   |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_mic.c  |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_vidi.c |  8 
>  drivers/gpu/drm/exynos/exynos_hdmi.c |  8 
>  drivers/gpu/drm/gma500/mdfld_dsi_dpi.c   | 10 +++---
>  drivers/gpu/drm/i2c/adv7511.c|  2 +-
>  drivers/gpu/drm/i2c/ch7006_drv.c |  2 +-
>  drivers/gpu/drm/i2c/sil164_drv.c |  2 +-
>  drivers/gpu/drm/imx/dw_hdmi-imx.c|  4 ++--
>  drivers/gpu/drm/imx/imx-drm-core.c   | 23 +++
>  drivers/gpu/drm/imx/imx-drm.h|  2 +-
>  drivers/gpu/drm/imx/imx-ldb.c|  8 
>  drivers/gpu/drm/imx/imx-tve.c|  8 
>  drivers/gpu/drm/imx/ipuv3-crtc.c |  2 +-
>  drivers/gpu/drm/imx/parallel-display.c   |  8 
>  drivers/gpu/drm/mgag200/mgag200_mode.c   |  4 ++--
>  drivers/gpu/drm/nouveau/dispnv04/tvnv17.c|  6 +++---
>  drivers/gpu/drm/nouveau/nouveau_encoder.h|  2 +-
>  drivers/gpu/drm/omapdrm/tcm-sita.c   |  7 ++-
>  drivers/gpu/drm/qxl/qxl_object.c |  2 +-
>  drivers/gpu/drm/qxl/qxl_ttm.c|  4 ++--
>  drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c|  6 +++---
>  drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c|  8 
>  drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c  |  4 ++--
>  drivers/gpu/drm/rockchip/rockchip_drm_fb.c   |  2 +-
>  drivers/gpu/drm/tegra/fb.c   |  2 +-
>  drivers/gpu/drm/udl/udl_connector.c  |  4 ++--
>  drivers/gpu/drm/udl/udl_modeset.c|  2 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c  |  4 ++--
>  drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c  |  6 +++---
>  drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c |  6 +++---
>  drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c |  6 +++---
>  drivers/gpu/drm/vmwgfx/vmwgfx_surface.c  |  9 +++--
>  include/drm/drm_encoder_slave.h  |  2 +-
>  46 files chang

[RESEND PATCH 00/28] drm: trivial patches from drm/trivial branch

2015-12-15 Thread Daniel Vetter
On Tue, Dec 15, 2015 at 01:37:44PM +0100, Boris Brezillon wrote:
> On Tue, 15 Dec 2015 12:20:48 +0100
> Boris Brezillon  wrote:
> 
> > Hi Daniel,
> > 
> > As discussed on IRC, here are the patches taken by Thierry in his
> > drm/trivial/for-next branch. I rebased it on drm-next, and had to fix
> > a few conflicts, so it would be safer if someone else takes a closer
> > look at those changes.
> > 
> > The atmel-hlcdc are good, so feel free to take them.
> 
> I forgot to add them while rebasing the series, so for the whole
> patchset:
> 
> Signed-off-by: Boris Brezillon 

Thanks. I've take a look at them again to check whether they might no
longer be applicable, and then pulled them all into drm-misc. So much for
me telling Dave that drm-misc should be done for 4.5 ;-)

Cheers, Daniel

> 
> > 
> > Best Regards,
> > 
> > Boris
> > 
> > Frediano Ziglio (1):
> >   drm/qxl: use to_qxl_bo macro
> > 
> > Luis de Bethencourt (1):
> >   drm: atmel-hlcdc: Fix module autoload for OF platform driver
> > 
> > Nicolas Ferre (1):
> >   drm: atmel-hlcdc: add support for sama5d2 SoCs
> > 
> > Rasmus Villemoes (3):
> >   drm/omap: use kzalloc in sita_init()
> >   drm/vmwgfx: use kzalloc in vmw_surface_define_ioctl()
> >   drm/vmwgfx: check kmalloc return value
> > 
> > Thierry Reding (4):
> >   drm/gma500: Sanity-check pipe index
> >   drm/bochs: Store correct CRTC index in events
> >   drm/imx: Make pipe number unsigned
> >   drm/imx: Drop pipe field from struct imx_drm_crtc
> > 
> > Ville Syrjälä (18):
> >   drm: Constify drm_encoder_slave_funcs
> >   drm/armada: Constify function pointer structs
> >   drm/atmel-hlcdc: Constify function pointer structs
> >   drm/bochs: Constify function pointer structs
> >   drm/bridge/dw_hdmi: Constify function pointer structs
> >   drm/bridge/nxp-ptn3460: Constify function pointer structs
> >   drm/i2c/ch7006: Constify function pointer structs
> >   drm/cirrus: Constify function pointer structs
> >   drm/exynos: Constify function pointer structs
> >   drm/i2c/adv7511: Constify function pointer structs
> >   drm/i2c/sil164: Constify function pointer structs
> >   drm/imx: Constify function pointer structs
> >   drm/mgag200: Constify function pointer structs
> >   drm/nouveau: Constify function pointer structs
> >   drm/rockchip: Constify function pointer structs
> >   drm/tegra: Constify function pointer structs
> >   drm/udl: Constify function pointer structs
> >   drm/vmwgfx: Constify function pointer structs
> > 
> >  drivers/gpu/drm/armada/armada_crtc.c |  2 +-
> >  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c |  5 +
> >  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c |  4 ++--
> >  drivers/gpu/drm/bochs/bochs_kms.c|  8 
> >  drivers/gpu/drm/bridge/dw_hdmi.c |  6 +++---
> >  drivers/gpu/drm/bridge/nxp-ptn3460.c |  6 +++---
> >  drivers/gpu/drm/cirrus/cirrus_mode.c |  4 ++--
> >  drivers/gpu/drm/drm_encoder_slave.c  |  2 +-
> >  drivers/gpu/drm/exynos/exynos_dp_core.c  |  8 
> >  drivers/gpu/drm/exynos/exynos_drm_crtc.c |  4 ++--
> >  drivers/gpu/drm/exynos/exynos_drm_dpi.c  |  8 
> >  drivers/gpu/drm/exynos/exynos_drm_dsi.c  |  8 
> >  drivers/gpu/drm/exynos/exynos_drm_fb.c   |  2 +-
> >  drivers/gpu/drm/exynos/exynos_drm_mic.c  |  2 +-
> >  drivers/gpu/drm/exynos/exynos_drm_vidi.c |  8 
> >  drivers/gpu/drm/exynos/exynos_hdmi.c |  8 
> >  drivers/gpu/drm/gma500/mdfld_dsi_dpi.c   | 10 +++---
> >  drivers/gpu/drm/i2c/adv7511.c|  2 +-
> >  drivers/gpu/drm/i2c/ch7006_drv.c |  2 +-
> >  drivers/gpu/drm/i2c/sil164_drv.c |  2 +-
> >  drivers/gpu/drm/imx/dw_hdmi-imx.c|  4 ++--
> >  drivers/gpu/drm/imx/imx-drm-core.c   | 23 
> > +++
> >  drivers/gpu/drm/imx/imx-drm.h|  2 +-
> >  drivers/gpu/drm/imx/imx-ldb.c|  8 
> >  drivers/gpu/drm/imx/imx-tve.c|  8 
> >  drivers/gpu/drm/imx/ipuv3-crtc.c |  2 +-
> >  drivers/gpu/drm/imx/parallel-display.c   |  8 
> >  drivers/gpu/drm/mgag200/mgag200_mode.c   |  4 ++--
> >  drivers/gpu/drm/nouveau/dispnv04/tvnv17.c|  6 +++---
> >  drivers/gpu/drm/nouveau/nouveau_encoder.h|  2 +-
> >  drivers/gpu/drm/omapdrm/tcm-sita.c   |  7 ++-
> >  drivers/gpu/drm/qxl/qxl_object.c |  2 +-
> >  drivers/gpu/drm/qxl/qxl_ttm.c|  4 ++--
> >  drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c|  6 +++---
> >  drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c|  8 
> >  drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c  |  4 ++--
> >  drivers/gpu/drm/rockchip/rockchip_drm_fb.c   |  2 +-
> >  drivers/gpu/drm/tegra/fb.c   |  2 +-
> >  drivers/gpu/drm/udl/udl_co

[PATCH 1/2] video:omap2:dss: fix timings for VENC to match what omapdrm expects

2015-12-15 Thread Tomi Valkeinen

On 13/12/15 20:41, H. Nikolaus Schaller wrote:

> Great that you did find the real reason of the problem.
> 
> I have tested it on the GTA04 and it also works.
> 
> Will the patches arrive in 4.5?

4.4, I hope.

 Tomi

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20151215/2f24ced2/attachment.sig>


[PATCH v2 2/2] drm: use dev_name as default unique name in drm_dev_alloc()

2015-12-15 Thread Daniel Vetter
On Fri, Dec 11, 2015 at 11:20:28AM +0100, Nicolas Iooss wrote:
> The following code pattern exists in some DRM drivers:
> 
> ddev = drm_dev_alloc(&driver, parent_dev);
> drm_dev_set_unique(ddev, dev_name(parent_dev));
> 
> (Sometimes dev_name(ddev->dev) is used, which is the same.)
> 
> As suggested in
> http://lists.freedesktop.org/archives/dri-devel/2015-December/096441.html,
> the unique name of a new DRM device can be set as dev_name(parent_dev)
> when parent_dev is not NULL (vgem is a special case).
> 
> Signed-off-by: Nicolas Iooss 
> Acked-by: Boris Brezillon 

Pulled these two in, but there's some other drivers floating around and
heading towards 4.5 with which it will conflict. If it's causing too much
trouble I'll drop it again and we have to get it in right around 4.5-rc1
to avoid trouble with new drivers.

Thanks, Daniel

> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 4 
>  drivers/gpu/drm/drm_drv.c| 9 +
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c| 1 -
>  drivers/gpu/drm/nouveau/nouveau_drm.c| 4 
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c  | 4 
>  drivers/gpu/drm/tegra/drm.c  | 1 -
>  drivers/gpu/drm/vc4/vc4_drv.c| 2 --
>  7 files changed, 9 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c 
> b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index 244df0a440b7..fba4f72e7ae1 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -733,10 +733,6 @@ static int atmel_hlcdc_dc_drm_probe(struct 
> platform_device *pdev)
>   if (!ddev)
>   return -ENOMEM;
>  
> - ret = drm_dev_set_unique(ddev, dev_name(ddev->dev));
> - if (ret)
> - goto err_unref;
> -
>   ret = atmel_hlcdc_dc_load(ddev);
>   if (ret)
>   goto err_unref;
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index eaa4316f3c45..bf934cdea21c 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -633,8 +633,17 @@ struct drm_device *drm_dev_alloc(struct drm_driver 
> *driver,
>   }
>   }
>  
> + if (parent) {
> + ret = drm_dev_set_unique(dev, dev_name(parent));
> + if (ret)
> + goto err_setunique;
> + }
> +
>   return dev;
>  
> +err_setunique:
> + if (drm_core_check_feature(dev, DRIVER_GEM))
> + drm_gem_destroy(dev);
>  err_ctxbitmap:
>   drm_legacy_ctxbitmap_cleanup(dev);
>   drm_ht_remove(&dev->map_hash);
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c 
> b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> index 1930234ba5f1..fca97d3fc846 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> @@ -363,7 +363,6 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
>   fsl_dev->np = dev->of_node;
>   drm->dev_private = fsl_dev;
>   dev_set_drvdata(dev, fsl_dev);
> - drm_dev_set_unique(drm, dev_name(dev));
>  
>   ret = drm_dev_register(drm, 0);
>   if (ret < 0)
> diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
> b/drivers/gpu/drm/nouveau/nouveau_drm.c
> index 2d23f95f17ce..b3a563c44bcd 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
> @@ -1046,10 +1046,6 @@ nouveau_platform_device_create(const struct 
> nvkm_device_tegra_func *func,
>   goto err_free;
>   }
>  
> - err = drm_dev_set_unique(drm, dev_name(&pdev->dev));
> - if (err < 0)
> - goto err_free;
> -
>   drm->platformdev = pdev;
>   platform_set_drvdata(pdev, drm);
>  
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c 
> b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> index 215d6c44af55..afbb7407c44f 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> @@ -450,10 +450,6 @@ static int rockchip_drm_bind(struct device *dev)
>   if (!drm)
>   return -ENOMEM;
>  
> - ret = drm_dev_set_unique(drm, dev_name(dev));
> - if (ret)
> - goto err_free;
> -
>   ret = drm_dev_register(drm, 0);
>   if (ret)
>   goto err_free;
> diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
> index 159ef515cab1..12e2d3ccbc9d 100644
> --- a/drivers/gpu/drm/tegra/drm.c
> +++ b/drivers/gpu/drm/tegra/drm.c
> @@ -991,7 +991,6 @@ static int host1x_drm_probe(struct host1x_device *dev)
>   if (!drm)
>   return -ENOMEM;
>  
> - drm_dev_set_unique(drm, dev_name(&dev->dev));
>   dev_set_drvdata(&dev->dev, drm);
>  
>   err = drm_dev_register(drm, 0);
> diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
> index d5db9e0f3b73..647772305e8f 100644
> --- a/drivers/gpu/drm/vc4/vc4_drv.c
> +++ b/drivers/gpu/drm/vc4/vc4_drv.c
> @@ -168,8 +168,6 @@ static 

[PATCH] android: fix warning when releasing active sync point

2015-12-15 Thread Gustavo Padovan
2015-12-14 Dmitry Torokhov :

> Userspace can close the sync device while there are still active fence
> points, in which case kernel produces the following warning:
> 
> [   43.853176] [ cut here ]
> [   43.857834] WARNING: CPU: 0 PID: 892 at 
> /mnt/host/source/src/third_party/kernel/v3.18/drivers/staging/android/sync.c:439
>  android_fence_release+0x88/0x104()
> [   43.871741] CPU: 0 PID: 892 Comm: Binder_5 Tainted: G U 
> 3.18.0-07661-g0550ce9 #1
> [   43.880176] Hardware name: Google Tegra210 Smaug Rev 1+ (DT)
> [   43.885834] Call trace:
> [   43.888294] [] dump_backtrace+0x0/0x10c
> [   43.893697] [] show_stack+0x10/0x1c
> [   43.898756] [] dump_stack+0x74/0xb8
> [   43.903814] [] warn_slowpath_common+0x84/0xb0
> [   43.909736] [] warn_slowpath_null+0x14/0x20
> [   43.915482] [] android_fence_release+0x84/0x104
> [   43.921582] [] fence_release+0x104/0x134
> [   43.927066] [] sync_fence_free+0x74/0x9c
> [   43.932552] [] sync_fence_release+0x34/0x48
> [   43.938304] [] __fput+0x100/0x1b8
> [   43.943185] [] fput+0x8/0x14
> [   43.947982] [] task_work_run+0xb0/0xe4
> [   43.953297] [] do_notify_resume+0x44/0x5c
> [   43.958867] ---[ end trace 5a2aa4027cc5d171 ]---

This crash report seems to be for a 3.18 kernel. Can you reproduce it
on upstream kernel as well?

Gustavo


[PATCH 12/12] ARM: dts: imx6: add Vivante GPU nodes

2015-12-15 Thread Shawn Guo
On Mon, Dec 14, 2015 at 10:52:25AM +0100, Lucas Stach wrote:
> Are you okay with merging the DT changes through the DRM tree, or do you
> want to pick them separate?

To accelerate the merge process, I'm okay with merging the DT changes
through DRM tree, as long as DRM maintainers don't mind.

Shawn


[PATCH libdrm] Fix memory leak with drmModeGetConnectorCurrent()

2015-12-15 Thread ville.syrj...@linux.intel.com
From: Ville Syrjälä 

drmModeGetConnectorCurrent() must provide temporary storage for the
kernel to fill in at least one mode (asking for !=0 modes is how
you prevent the heavyweight probe in the kernel). Currently we malloc
that temp storage but we fail to free it before overwriting the
pointer with the address of the actual storage we use to store the
real mode list we get from the kernel in the second ioctl call.

Let's just keep the temporary storage on the stack and thus we avoid the
leak and also eliminate some pointless mallocs.

Cc: Chris Wilson 
Fixes: 5ed5fa10600f ("mode: Retrieve only the current information for a 
Connector")
Signed-off-by: Ville Syrjälä 
---
 xf86drmMode.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/xf86drmMode.c b/xf86drmMode.c
index ab6b5195e8d3..7710061865ee 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -475,12 +475,13 @@ _drmModeGetConnector(int fd, uint32_t connector_id, int 
probe)
 {
struct drm_mode_get_connector conn, counts;
drmModeConnectorPtr r = NULL;
+   struct drm_mode_modeinfo stack_mode;

memclear(conn);
conn.connector_id = connector_id;
if (!probe) {
conn.count_modes = 1;
-   conn.modes_ptr = VOID2U64(drmMalloc(sizeof(struct 
drm_mode_modeinfo)));
+   conn.modes_ptr = VOID2U64(&stack_mode);
}

if (drmIoctl(fd, DRM_IOCTL_MODE_GETCONNECTOR, &conn))
@@ -504,7 +505,7 @@ retry:
goto err_allocs;
} else {
conn.count_modes = 1;
-   conn.modes_ptr = VOID2U64(drmMalloc(sizeof(struct 
drm_mode_modeinfo)));
+   conn.modes_ptr = VOID2U64(&stack_mode);
}

if (conn.count_encoders) {
@@ -525,7 +526,8 @@ retry:
counts.count_encoders < conn.count_encoders) {
drmFree(U642VOID(conn.props_ptr));
drmFree(U642VOID(conn.prop_values_ptr));
-   drmFree(U642VOID(conn.modes_ptr));
+   if (U642VOID(conn.modes_ptr) != &stack_mode)
+   drmFree(U642VOID(conn.modes_ptr));
drmFree(U642VOID(conn.encoders_ptr));

goto retry;
@@ -567,7 +569,8 @@ retry:
 err_allocs:
drmFree(U642VOID(conn.prop_values_ptr));
drmFree(U642VOID(conn.props_ptr));
-   drmFree(U642VOID(conn.modes_ptr));
+   if (U642VOID(conn.modes_ptr) != &stack_mode)
+   drmFree(U642VOID(conn.modes_ptr));
drmFree(U642VOID(conn.encoders_ptr));

return r;
-- 
2.4.10



[PATCH 0/2] Two small patches for MST

2015-12-15 Thread Wentland, Harry
Awesome. Thanks, Daniel.

Harry


From: Daniel Vetter  on behalf of Daniel Vetter 

Sent: Monday, December 14, 2015 12:32 PM
To: Wentland, Harry
Cc: Alex Deucher; Maling list - DRI developers
Subject: Re: [PATCH 0/2] Two small patches for MST

On Mon, Dec 14, 2015 at 05:14:47PM +, Wentland, Harry wrote:
> Thanks, Alex.
>
> Dave, will you pick these up when pulling from Alex's tree if he includes 
> them?

I stuffed them into drm-misc, should land still for 4.5.

Cheers, Daniel

>
> Thanks,
> Harry
>
> 
> From: Alex Deucher 
> Sent: Monday, December 14, 2015 10:26 AM
> To: Wentland, Harry
> Cc: Maling list - DRI developers
> Subject: Re: [PATCH 0/2] Two small patches for MST
>
> On Mon, Dec 7, 2015 at 1:55 PM, Harry Wentland  
> wrote:
> > Two minor patches for MST here. We were replying NACK to UP requests
> > when we intended to ACK them. We were also not filling in the vcpi
> > field for mst_mgr->payloads although it's defined. Saving the vcpi
> > simplifies the new amdgpu MST implementation that we currently work
> > on.
>
> For the series:
> Reviewed-by: Alex Deucher 
>
>
> >
> > Harry Wentland (1):
> >   drm/dp/mst: save vcpi with payloads
> >
> > Mykola Lysenko (1):
> >   drm/dp/mst: reply with ACK for UP reqs
> >
> >  drivers/gpu/drm/drm_dp_mst_topology.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > --
> > 2.1.4
> >
> > ___
> > dri-devel mailing list
> > dri-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[PATCH libdrm] Fix memory leak with drmModeGetConnectorCurrent()

2015-12-15 Thread Chris Wilson
On Tue, Dec 15, 2015 at 03:59:28PM +0200, ville.syrjala at linux.intel.com 
wrote:
> From: Ville Syrjälä 
> 
> drmModeGetConnectorCurrent() must provide temporary storage for the
> kernel to fill in at least one mode (asking for !=0 modes is how
> you prevent the heavyweight probe in the kernel). Currently we malloc
> that temp storage but we fail to free it before overwriting the
> pointer with the address of the actual storage we use to store the
> real mode list we get from the kernel in the second ioctl call.
> 
> Let's just keep the temporary storage on the stack and thus we avoid the
> leak and also eliminate some pointless mallocs.
> 
> Cc: Chris Wilson 
> Fixes: 5ed5fa10600f ("mode: Retrieve only the current information for a 
> Connector")
> Signed-off-by: Ville Syrjälä 
> ---
>  xf86drmMode.c | 11 +++
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/xf86drmMode.c b/xf86drmMode.c
> index ab6b5195e8d3..7710061865ee 100644
> --- a/xf86drmMode.c
> +++ b/xf86drmMode.c
> @@ -475,12 +475,13 @@ _drmModeGetConnector(int fd, uint32_t connector_id, int 
> probe)
>  {
>   struct drm_mode_get_connector conn, counts;
>   drmModeConnectorPtr r = NULL;
> + struct drm_mode_modeinfo stack_mode;
>  
>   memclear(conn);
>   conn.connector_id = connector_id;
>   if (!probe) {
>   conn.count_modes = 1;
> - conn.modes_ptr = VOID2U64(drmMalloc(sizeof(struct 
> drm_mode_modeinfo)));
> + conn.modes_ptr = VOID2U64(&stack_mode);
>   }

If you just made this change, we wouldn't need the hunks below (and I
wouln't have to look at so much shouting).

Either way,
Reviewed-by: Chris Wilson 
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


[PATCH] android: fix warning when releasing active sync point

2015-12-15 Thread Frank Binns
Is this not the issue fixed by 8e43c9c75?

Thanks
Frank

On 15/12/15 13:30, Gustavo Padovan wrote:
> 2015-12-14 Dmitry Torokhov :
>
>> Userspace can close the sync device while there are still active fence
>> points, in which case kernel produces the following warning:
>>
>> [   43.853176] [ cut here ]
>> [   43.857834] WARNING: CPU: 0 PID: 892 at 
>> /mnt/host/source/src/third_party/kernel/v3.18/drivers/staging/android/sync.c:439
>>  android_fence_release+0x88/0x104()
>> [   43.871741] CPU: 0 PID: 892 Comm: Binder_5 Tainted: G U 
>> 3.18.0-07661-g0550ce9 #1
>> [   43.880176] Hardware name: Google Tegra210 Smaug Rev 1+ (DT)
>> [   43.885834] Call trace:
>> [   43.888294] [] dump_backtrace+0x0/0x10c
>> [   43.893697] [] show_stack+0x10/0x1c
>> [   43.898756] [] dump_stack+0x74/0xb8
>> [   43.903814] [] warn_slowpath_common+0x84/0xb0
>> [   43.909736] [] warn_slowpath_null+0x14/0x20
>> [   43.915482] [] android_fence_release+0x84/0x104
>> [   43.921582] [] fence_release+0x104/0x134
>> [   43.927066] [] sync_fence_free+0x74/0x9c
>> [   43.932552] [] sync_fence_release+0x34/0x48
>> [   43.938304] [] __fput+0x100/0x1b8
>> [   43.943185] [] fput+0x8/0x14
>> [   43.947982] [] task_work_run+0xb0/0xe4
>> [   43.953297] [] do_notify_resume+0x44/0x5c
>> [   43.958867] ---[ end trace 5a2aa4027cc5d171 ]---
> This crash report seems to be for a 3.18 kernel. Can you reproduce it
> on upstream kernel as well?
>
>   Gustavo
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel



[PATCH libdrm] Fix memory leak with drmModeGetConnectorCurrent()

2015-12-15 Thread Ville Syrjälä
On Tue, Dec 15, 2015 at 02:05:45PM +, Chris Wilson wrote:
> On Tue, Dec 15, 2015 at 03:59:28PM +0200, ville.syrjala at linux.intel.com 
> wrote:
> > From: Ville Syrjälä 
> > 
> > drmModeGetConnectorCurrent() must provide temporary storage for the
> > kernel to fill in at least one mode (asking for !=0 modes is how
> > you prevent the heavyweight probe in the kernel). Currently we malloc
> > that temp storage but we fail to free it before overwriting the
> > pointer with the address of the actual storage we use to store the
> > real mode list we get from the kernel in the second ioctl call.
> > 
> > Let's just keep the temporary storage on the stack and thus we avoid the
> > leak and also eliminate some pointless mallocs.
> > 
> > Cc: Chris Wilson 
> > Fixes: 5ed5fa10600f ("mode: Retrieve only the current information for a 
> > Connector")
> > Signed-off-by: Ville Syrjälä 
> > ---
> >  xf86drmMode.c | 11 +++
> >  1 file changed, 7 insertions(+), 4 deletions(-)
> > 
> > diff --git a/xf86drmMode.c b/xf86drmMode.c
> > index ab6b5195e8d3..7710061865ee 100644
> > --- a/xf86drmMode.c
> > +++ b/xf86drmMode.c
> > @@ -475,12 +475,13 @@ _drmModeGetConnector(int fd, uint32_t connector_id, 
> > int probe)
> >  {
> > struct drm_mode_get_connector conn, counts;
> > drmModeConnectorPtr r = NULL;
> > +   struct drm_mode_modeinfo stack_mode;
> >  
> > memclear(conn);
> > conn.connector_id = connector_id;
> > if (!probe) {
> > conn.count_modes = 1;
> > -   conn.modes_ptr = VOID2U64(drmMalloc(sizeof(struct 
> > drm_mode_modeinfo)));
> > +   conn.modes_ptr = VOID2U64(&stack_mode);
> > }
> 
> If you just made this change, we wouldn't need the hunks below (and I
> wouln't have to look at so much shouting).

That was my initial plan, but then I figured we could also skip the
other malloc for disconnected connectors.

> 
> Either way,
> Reviewed-by: Chris Wilson 
> -Chris
> 
> -- 
> Chris Wilson, Intel Open Source Technology Centre

-- 
Ville Syrjälä
Intel OTC


[Intel-gfx] [PATCH] drm: Documentation style guide

2015-12-15 Thread Dave Gordon
On 14/12/15 15:39, Thierry Reding wrote:
> On Wed, Dec 09, 2015 at 05:08:02PM +0100, Daniel Vetter wrote:
>> Every time I type or review docs this seems a bit different. Try to
>> document the common style so we can try to unify at least new docs.
>>
>> v2: Spelling fixes from Pierre, Laurent and Jani.
>>
>> v3: More spelling fixes from Lukas.
>>
>> Cc: Pierre Moreau 
>> Cc: Jani Nikula 
>> Cc: Laurent Pinchart 
>> Cc: Lukas Wunner 
>> Acked-by: Laurent Pinchart 
>> Signed-off-by: Daniel Vetter 
>> Link: 
>> http://patchwork.freedesktop.org/patch/msgid/1449564561-3896-1-git-send-email-daniel.vetter
>>  at ffwll.ch
>> ---
>>   Documentation/DocBook/gpu.tmpl | 37 +
>>   1 file changed, 37 insertions(+)
>>
>> diff --git a/Documentation/DocBook/gpu.tmpl b/Documentation/DocBook/gpu.tmpl
>> index 749b8e2f2113..c66d6412f573 100644
>> --- a/Documentation/DocBook/gpu.tmpl
>> +++ b/Documentation/DocBook/gpu.tmpl
>> @@ -124,6 +124,43 @@
>>   
>> [Insert diagram of typical DRM stack here]
>>   
>> +  
>> +Style Guidelines
>> +
>> +  For consistency this documentation uses American English. 
>> Abbreviations
>> +  are written as all-uppercase, for example: DRM, KMS, IOCTL, CRTC, and 
>> so
>> +  on. To aid in reading, documentations make full use of the markup
>
> "..., the documentation makes full use of..." and perhaps "makes use of
> the full set of markup characters that kerneldoc provides".
>
>> +  characters kerneldoc provides: @parameter for function parameters, 
>> @member
>> +  for structure members, &structure to reference structures and
>> +  function() for functions. These all get automatically hyperlinked if
>> +  kerneldoc for the referenced objects exists. When referencing entries 
>> in
>> +  function vtables please use ->vfunc(). Note that kerneldoc does
>> +  not support referencing struct members directly, so please add a 
>> reference
>> +  to the vtable struct somewhere in the same paragraph or at least 
>> section.
>> +
>> +
>> +  Except in special situations (to separate locked from unlocked 
>> variants)
>> +  locking requirements for functions aren't documented in the kerneldoc.
>> +  Instead locking should be check at runtime using e.g.
>
> "should be checked"
>
>> +  WARN_ON(!mutex_is_locked(...));. Since it's much easier 
>> to
>> +  ignore documentation than runtime noise this provides more value. And 
>> on
>> +  top of that runtime checks do need to be updated when the locking 
>> rules
>> +  change, increasing the chances that they're correct. Within the

A few commas to delimit subclauses would make this more readable:

Since it's much easier to ignore documentation than runtime noise, this 
provides more value. And on top of that, runtime checks have to be 
updated when the locking rules change, thus increasing the chances that 
they're correct.

>> +  documentation the locking rules should be explained in the relevant
>> +  structures: Either in the comment for the lock explaining what it
>> +  protects, or data fields need a note about which lock protects them, 
>> or
>> +  both.
>
> I think you're supposed to have the "or" only in the final subsentence:
>
>   "either ... protects, data fields need ..., or both."

Within the documentation, the locking rules should be explained in 
comments on the relevant structures; these comments may be with the 
lock, explaining what it protects, or with the data, noting which lock 
protects it, or both -- in which case they should agree!

>> +
>> +
>> +  Functions which have a non-void return value should have 
>> a
>> +  section called "Returns" explaining the expected return values in
>> +  different cases and their meanings. Currently there's no consensus 
>> whether
>> +  that section name should be all upper-case or not, and whether it 
>> should
>> +  end in a colon or not. Go with the file-local style. Other common 
>> section
>
> I thought the colon was necessary for kerneldoc to turn it into a
> section?
>
> Overall, long overdue, so thanks for writing it up:
>
> Acked-by: Thierry Reding 
>
>
>
> ___
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>



[Nouveau] [PATCH] drm/nouveau: Fix pre-nv50 pageflip events (v4)

2015-12-15 Thread poma
On 15.12.2015 12:21, Emil Velikov wrote:
> On 15 December 2015 at 11:11, poma  wrote:
> 
>>
>> Apparently not reached @stable (stable: 4.3.3 2015-12-15),
>> so here's one more time.
>>
> It has reached 4.4-rcX and will get picked by the stable maintainer
> (Greg?) in due time. Meanwhile you can ask your distro maintainers to
> apply it locally until we get an official release that includes it.
> 
> -Emil
> 

It is all but unknown ;)
https://bugzilla.redhat.com/show_bug.cgi?id=1281368

Emil, the point is - if it has -not- reached stable at vger.kernel.org, how can 
it be applied, in the first place.

Aye



[Nouveau] [PATCH] drm/nouveau: Fix pre-nv50 pageflip events (v4)

2015-12-15 Thread Emil Velikov
On 15 December 2015 at 15:01, poma  wrote:
> On 15.12.2015 12:21, Emil Velikov wrote:
>> On 15 December 2015 at 11:11, poma  wrote:
>>
>>>
>>> Apparently not reached @stable (stable: 4.3.3 2015-12-15),
>>> so here's one more time.
>>>
>> It has reached 4.4-rcX and will get picked by the stable maintainer
>> (Greg?) in due time. Meanwhile you can ask your distro maintainers to
>> apply it locally until we get an official release that includes it.
>>
>> -Emil
>>
>
> It is all but unknown ;)
> https://bugzilla.redhat.com/show_bug.cgi?id=1281368
>
> Emil, the point is - if it has -not- reached stable at vger.kernel.org, how 
> can it be applied, in the first place.
>
The same way many others do ? I'd imagine there is a tool/script which
parses through the development tree, which would explain why (many?)
people explicitly suppress git from sending an email yet things still
work. There is extra information in the documentation [1] if you're
interested.

-Emil
[1] https://www.kernel.org/doc/Documentation/stable_kernel_rules.txt


[Intel-gfx] [PATCH] drm: Documentation style guide

2015-12-15 Thread Daniel Vetter
On Tue, Dec 15, 2015 at 02:56:10PM +, Dave Gordon wrote:
> On 14/12/15 15:39, Thierry Reding wrote:
> >On Wed, Dec 09, 2015 at 05:08:02PM +0100, Daniel Vetter wrote:
> >>Every time I type or review docs this seems a bit different. Try to
> >>document the common style so we can try to unify at least new docs.
> >>
> >>v2: Spelling fixes from Pierre, Laurent and Jani.
> >>
> >>v3: More spelling fixes from Lukas.
> >>
> >>Cc: Pierre Moreau 
> >>Cc: Jani Nikula 
> >>Cc: Laurent Pinchart 
> >>Cc: Lukas Wunner 
> >>Acked-by: Laurent Pinchart 
> >>Signed-off-by: Daniel Vetter 
> >>Link: 
> >>http://patchwork.freedesktop.org/patch/msgid/1449564561-3896-1-git-send-email-daniel.vetter
> >> at ffwll.ch
> >>---
> >>  Documentation/DocBook/gpu.tmpl | 37 +
> >>  1 file changed, 37 insertions(+)
> >>
> >>diff --git a/Documentation/DocBook/gpu.tmpl b/Documentation/DocBook/gpu.tmpl
> >>index 749b8e2f2113..c66d6412f573 100644
> >>--- a/Documentation/DocBook/gpu.tmpl
> >>+++ b/Documentation/DocBook/gpu.tmpl
> >>@@ -124,6 +124,43 @@
> >>  
> >>[Insert diagram of typical DRM stack here]
> >>  
> >>+  
> >>+Style Guidelines
> >>+
> >>+  For consistency this documentation uses American English. 
> >>Abbreviations
> >>+  are written as all-uppercase, for example: DRM, KMS, IOCTL, CRTC, 
> >>and so
> >>+  on. To aid in reading, documentations make full use of the markup
> >
> >"..., the documentation makes full use of..." and perhaps "makes use of
> >the full set of markup characters that kerneldoc provides".
> >
> >>+  characters kerneldoc provides: @parameter for function parameters, 
> >>@member
> >>+  for structure members, &structure to reference structures and
> >>+  function() for functions. These all get automatically hyperlinked if
> >>+  kerneldoc for the referenced objects exists. When referencing 
> >>entries in
> >>+  function vtables please use ->vfunc(). Note that kerneldoc does
> >>+  not support referencing struct members directly, so please add a 
> >>reference
> >>+  to the vtable struct somewhere in the same paragraph or at least 
> >>section.
> >>+
> >>+
> >>+  Except in special situations (to separate locked from unlocked 
> >>variants)
> >>+  locking requirements for functions aren't documented in the 
> >>kerneldoc.
> >>+  Instead locking should be check at runtime using e.g.
> >
> >"should be checked"
> >
> >>+  WARN_ON(!mutex_is_locked(...));. Since it's much easier 
> >>to
> >>+  ignore documentation than runtime noise this provides more value. 
> >>And on
> >>+  top of that runtime checks do need to be updated when the locking 
> >>rules
> >>+  change, increasing the chances that they're correct. Within the
> 
> A few commas to delimit subclauses would make this more readable:
> 
> Since it's much easier to ignore documentation than runtime noise, this
> provides more value. And on top of that, runtime checks have to be updated
> when the locking rules change, thus increasing the chances that they're
> correct.
> 
> >>+  documentation the locking rules should be explained in the relevant
> >>+  structures: Either in the comment for the lock explaining what it
> >>+  protects, or data fields need a note about which lock protects them, 
> >>or
> >>+  both.
> >
> >I think you're supposed to have the "or" only in the final subsentence:
> >
> > "either ... protects, data fields need ..., or both."
> 
> Within the documentation, the locking rules should be explained in comments
> on the relevant structures; these comments may be with the lock, explaining
> what it protects, or with the data, noting which lock protects it, or both
> -- in which case they should agree!
> 
> >>+
> >>+
> >>+  Functions which have a non-void return value should 
> >>have a
> >>+  section called "Returns" explaining the expected return values in
> >>+  different cases and their meanings. Currently there's no consensus 
> >>whether
> >>+  that section name should be all upper-case or not, and whether it 
> >>should
> >>+  end in a colon or not. Go with the file-local style. Other common 
> >>section
> >
> >I thought the colon was necessary for kerneldoc to turn it into a
> >section?
> >
> >Overall, long overdue, so thanks for writing it up:
> >
> >Acked-by: Thierry Reding 

Unfortunately pull request with this already went to Dave before I could
take your feedback into account. Anyone up for a quick follow-up patch
that I could vacuum up in time for 4.5 (i.e. until Thu latest)?

Thanks, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[GIT PULL] etnaviv DRM driver

2015-12-15 Thread Lucas Stach
Hi Dave,

here is the pull request for the etnaviv DRM driver. It includes the DT bindings
and the driver itself, platform devicetree changes will be merged through the
respective SoC trees. Otherwise it's just a squashed version of the V2 patches
that have been on the list for a while.

Regards,
Lucas

The following changes since commit 8005c49d9aea74d382f474ce11afbbc7d7130bec:

  Linux 4.4-rc1 (2015-11-15 17:00:27 -0800)

are available in the git repository at:

  git://git.pengutronix.de/git/lst/linux.git drm-etnaviv-next

for you to fetch changes up to 8bb0bce92ec9330b0ea931df90f719fb5c4a5224:

  MAINTAINERS: add maintainer and reviewers for the etnaviv DRM driver 
(2015-12-15 14:50:04 +0100)


This pull request includes the etnaviv DRM driver, providing graphics
acceleration on top of the Vivante GPU IP cores used in different SoCs,
such as the Freescale i.MX6 and Marvell Dove. The driver is a
collaborative work of Christian Gmeiner, Russell King and Lucas Stach.


Lucas Stach (2):
  drm/etnaviv: add devicetree bindings
  MAINTAINERS: add maintainer and reviewers for the etnaviv DRM driver

Philipp Zabel (1):
  devicetree: add vendor prefix for Vivante Corporation

The etnaviv authors (1):
  drm/etnaviv: add initial etnaviv DRM driver

 Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt |   54 +++
 Documentation/devicetree/bindings/vendor-prefixes.txt |1 +
 MAINTAINERS   |9 +
 drivers/gpu/drm/Kconfig   |2 +
 drivers/gpu/drm/Makefile  |1 +
 drivers/gpu/drm/etnaviv/Kconfig   |   20 +
 drivers/gpu/drm/etnaviv/Makefile  |   14 +
 drivers/gpu/drm/etnaviv/cmdstream.xml.h   |  218 
+++
 drivers/gpu/drm/etnaviv/common.xml.h  |  249 
+
 drivers/gpu/drm/etnaviv/etnaviv_buffer.c  |  268 
++
 drivers/gpu/drm/etnaviv/etnaviv_cmd_parser.c  |  209 
+++
 drivers/gpu/drm/etnaviv/etnaviv_drv.c |  707 

 drivers/gpu/drm/etnaviv/etnaviv_drv.h |  161 
+
 drivers/gpu/drm/etnaviv/etnaviv_dump.c|  227 

 drivers/gpu/drm/etnaviv/etnaviv_dump.h|   54 +++
 drivers/gpu/drm/etnaviv/etnaviv_gem.c |  897 
+
 drivers/gpu/drm/etnaviv/etnaviv_gem.h |  117 ++
 drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c   |  122 
+++
 drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c  |  443 
+++
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 1644 
+++
 drivers/gpu/drm/etnaviv/etnaviv_gpu.h |  209 
+++
 drivers/gpu/drm/etnaviv/etnaviv_iommu.c   |  240 

 drivers/gpu/drm/etnaviv/etnaviv_iommu.h   |   28 ++
 drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c|   33 ++
 drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.h|   25 ++
 drivers/gpu/drm/etnaviv/etnaviv_mmu.c |  299 
+++
 drivers/gpu/drm/etnaviv/etnaviv_mmu.h |   71 
 drivers/gpu/drm/etnaviv/state.xml.h   |  351 
++
 drivers/gpu/drm/etnaviv/state_hi.xml.h|  407 
+
 include/uapi/drm/etnaviv_drm.h|  222 

 30 files changed, 7302 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
 create mode 100644 drivers/gpu/drm/etnaviv/Kconfig
 create mode 100644 drivers/gpu/drm/etnaviv/Makefile
 create mode 100644 drivers/gpu/drm/etnaviv/cmdstream.xml.h
 create mode 100644 drivers/gpu/drm/etnaviv/common.xml.h
 create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_buffer.c
 create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_cmd_parser.c
 create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_drv.c
 create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_drv.h
 create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_dump.c
 create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_dump.h
 create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_gem.c
 create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_gem.h
 create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
 create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_gem_sub

[Nouveau] [PATCH] drm/nouveau: Fix pre-nv50 pageflip events (v4)

2015-12-15 Thread Greg KH
On Tue, Dec 15, 2015 at 03:17:21PM +, Emil Velikov wrote:
> On 15 December 2015 at 15:01, poma  wrote:
> > On 15.12.2015 12:21, Emil Velikov wrote:
> >> On 15 December 2015 at 11:11, poma  wrote:
> >>
> >>>
> >>> Apparently not reached @stable (stable: 4.3.3 2015-12-15),
> >>> so here's one more time.
> >>>
> >> It has reached 4.4-rcX and will get picked by the stable maintainer
> >> (Greg?) in due time. Meanwhile you can ask your distro maintainers to
> >> apply it locally until we get an official release that includes it.
> >>
> >> -Emil
> >>
> >
> > It is all but unknown ;)
> > https://bugzilla.redhat.com/show_bug.cgi?id=1281368
> >
> > Emil, the point is - if it has -not- reached stable at vger.kernel.org, how 
> > can it be applied, in the first place.
> >
> The same way many others do ? I'd imagine there is a tool/script which
> parses through the development tree, which would explain why (many?)
> people explicitly suppress git from sending an email yet things still
> work. There is extra information in the documentation [1] if you're
> interested.

Yes, this is in the queue, along with 276 other patches that I need to
apply as well.  The backlog is large this time of year, sorry.

greg k-h


[PATCH 2/2] drm/panel: simple: Add support for Kyocera TCG121XGLP panel

2015-12-15 Thread Lucas Stach
This has been on the list for 2 weeks without a reaction, so please
consider this a friendly ping.

Regards,
Lucas

Am Mittwoch, den 02.12.2015, 19:41 +0100 schrieb Lucas Stach:
> The Kyocera TCG121XGLP panel is an XGA LCD TFT panel connected through
> LVDS, which can be supported by the simple panel driver.
> 
> Signed-off-by: Lucas Stach 
> ---
>  .../bindings/display/panel/kyo,tcg121xglp.txt  |  7 ++
>  drivers/gpu/drm/panel/panel-simple.c   | 27 
> ++
>  2 files changed, 34 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/kyo,tcg121xglp.txt
> 
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/kyo,tcg121xglp.txt 
> b/Documentation/devicetree/bindings/display/panel/kyo,tcg121xglp.txt
> new file mode 100644
> index ..a8e940fe731e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/panel/kyo,tcg121xglp.txt
> @@ -0,0 +1,7 @@
> +Kyocera Corporation 12.1" XGA (1024x768) TFT LCD panel
> +
> +Required properties:
> +- compatible: should be "kyo,tcg121xglp"
> +
> +This binding is compatible with the simple-panel binding, which is specified
> +in simple-panel.txt in this directory.
> diff --git a/drivers/gpu/drm/panel/panel-simple.c 
> b/drivers/gpu/drm/panel/panel-simple.c
> index f97b73ec4713..1476bb90ac14 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -902,6 +902,30 @@ static const struct panel_desc innolux_zj070na_01p = {
>   },
>  };
>  
> +static const struct display_timing kyo_tcg121xglp_timing = {
> + .pixelclock = { 5200, 6500, 7100 },
> + .hactive = { 1024, 1024, 1024 },
> + .hfront_porch = { 2, 2, 2 },
> + .hback_porch = { 2, 2, 2 },
> + .hsync_len = { 86, 124, 244 },
> + .vactive = { 768, 768, 768 },
> + .vfront_porch = { 2, 2, 2 },
> + .vback_porch = { 2, 2, 2 },
> + .vsync_len = { 6, 34, 73 },
> + .flags = DISPLAY_FLAGS_DE_HIGH,
> +};
> +
> +static const struct panel_desc kyo_tcg121xglp = {
> + .timings = &kyo_tcg121xglp_timing,
> + .num_timings = 1,
> + .bpc = 8,
> + .size = {
> + .width = 246,
> + .height = 184,
> + },
> + .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
> +};
> +
>  static const struct drm_display_mode lg_lb070wv8_mode = {
>   .clock = 33246,
>   .hdisplay = 800,
> @@ -1167,6 +1191,9 @@ static const struct of_device_id platform_of_match[] = {
>   .compatible = "innolux,zj070na-01p",
>   .data = &innolux_zj070na_01p,
>   }, {
> + .compatible = "kyo,tcg121xglp",
> + .data = &kyo_tcg121xglp,
> + }, {
>   .compatible = "lg,lb070wv8",
>   .data = &lg_lb070wv8,
>   }, {

-- 
Pengutronix e.K. | Lucas Stach |
Industrial Linux Solutions   | http://www.pengutronix.de/  |



[Bug 93353] GRID Autosport crash on loading screen with an HD 6950

2015-12-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93353

--- Comment #11 from Thomas Rohloff  ---
(In reply to serge from comment #10)
> I found that with R600_DEBUG=nosb the game launch and do not crash with any
> setting i choose.

With this setting I was finally able to complete the games benchmark! :)

(In reply to Ilia Mirkin from comment #8)
> that should hopefully show
> which shader r600 is having trouble compiling.

Maybe it would be a good idea for you to take the offer from
https://bugs.freedesktop.org/show_bug.cgi?id=93352#c20 ("Please let us know if
we can assist by providing people working on driver issues a copy of the
title") - I'm sure this will speed up debugging a lot.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20151215/21e3cce9/attachment.html>


[Bug 93352] GRID Autosport crashes on start of race

2015-12-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93352

--- Comment #21 from Thomas Rohloff  ---
(In reply to Edwin Smith from comment #20)
> My name is Edwin Smith and I work for Feral Interactive who make the Linux
> version of the game.

Hi Edwin. As this bug here is closed it would be great if you could have a look
at bug #93353.

> Please let us know if we can assist by providing people working on driver
> issues a copy of the title or other information to help with your driver
> work.
I would say gift Ilia Mirkin a copy, please, but let's see if he wants one
first. :)

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20151215/5eb173d7/attachment.html>


[PATCH] Revert "drm: Stop resetting connector state to unknown"

2015-12-15 Thread Lyude
This reverts commit 5677d67ae394 ("drm: Stop resetting connector state to
unknown")

Unfortunately, not resetting the connector status to unknown actually
breaks reprobing on suspend/resume in i915, which is important to have
working since it means a user docking their laptop in suspend won't have
their monitors work after resume. This commit was originally pushed to fix
a bug with systemd[1], however said bug has already been fixed in
userspace.

Since "unknown" is technically a valid option to return to userspace for a
connector's status, I would think that this sort of behavior should
probably be expected from userspace. Some good examples of this are the
radeon driver reporting "unknown" for connectors that have done something
wonky during a hotplug event (e.g. part of the initialization of the
connector failed), and the omapdrm driver returns "unknown" for certain
connector types by default.

[1]: https://bugzilla.kernel.org/show_bug.cgi?id=100641

Signed-off-by: Lyude 
---
 drivers/gpu/drm/drm_crtc.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 24c5434..474e636 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -5312,11 +5312,12 @@ void drm_mode_config_reset(struct drm_device *dev)
if (encoder->funcs->reset)
encoder->funcs->reset(encoder);

-   mutex_lock(&dev->mode_config.mutex);
-   drm_for_each_connector(connector, dev)
+   list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
+   connector->status = connector_status_unknown;
+
if (connector->funcs->reset)
connector->funcs->reset(connector);
-   mutex_unlock(&dev->mode_config.mutex);
+   }
 }
 EXPORT_SYMBOL(drm_mode_config_reset);

-- 
2.5.0



[PATCH] drm: Use the driver's gem_object_free function from CMA helpers.

2015-12-15 Thread Eric Anholt
Daniel Vetter  writes:

> On Mon, Dec 14, 2015 at 04:26:26PM -0800, Eric Anholt wrote:
>> VC4 wraps the CMA objects in its own structures, so it needs to do its
>> own teardown (waiting for GPU to finish, updating bo_stats tracking).
>> The other CMA drivers are using drm_gem_cma_free_object as their
>> gem_free_object, so this should be a no-op for them.
>> 
>> Signed-off-by: Eric Anholt 
>
> Reviewed-by: Daniel Vetter 
>
> Since vc4 landed already I'll pull this into drm-misc.

Sounds good to me.  Thanks!
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20151215/6e379ba9/attachment.sig>


[PATCH] Revert "drm: Stop resetting connector state to unknown"

2015-12-15 Thread Rob Clark
On Tue, Dec 15, 2015 at 1:07 PM, Lyude  wrote:
> This reverts commit 5677d67ae394 ("drm: Stop resetting connector state to
> unknown")
>
> Unfortunately, not resetting the connector status to unknown actually
> breaks reprobing on suspend/resume in i915, which is important to have
> working since it means a user docking their laptop in suspend won't have
> their monitors work after resume. This commit was originally pushed to fix
> a bug with systemd[1], however said bug has already been fixed in
> userspace.
>
> Since "unknown" is technically a valid option to return to userspace for a
> connector's status, I would think that this sort of behavior should
> probably be expected from userspace. Some good examples of this are the
> radeon driver reporting "unknown" for connectors that have done something
> wonky during a hotplug event (e.g. part of the initialization of the
> connector failed), and the omapdrm driver returns "unknown" for certain
> connector types by default.
>
> [1]: https://bugzilla.kernel.org/show_bug.cgi?id=100641
>
> Signed-off-by: Lyude 
> ---
>  drivers/gpu/drm/drm_crtc.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 24c5434..474e636 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -5312,11 +5312,12 @@ void drm_mode_config_reset(struct drm_device *dev)
> if (encoder->funcs->reset)
> encoder->funcs->reset(encoder);
>
> -   mutex_lock(&dev->mode_config.mutex);
> -   drm_for_each_connector(connector, dev)
> +   list_for_each_entry(connector, &dev->mode_config.connector_list, 
> head) {
> +   connector->status = connector_status_unknown;
> +
> if (connector->funcs->reset)
> connector->funcs->reset(connector);
> -   mutex_unlock(&dev->mode_config.mutex);
> +   }
>  }

looks like git-revert might have been a bit over-ambitious and
clobbered a couple subsequent changes.. but that is easy enough to fix
once we figure out what the right thing to do is.

Beyond that.. I'm not really sure how to apply the "do not break
userspace" rule here.. since prior to
c484f02d0f02fbbfc6decc945a69aae011041a27 userspace could see "unknown"
for certain hardware.  But after that commit it could start seeing
"unknown" for drivers/connectors that never would have returned
"unknown" before.  If userspace had a problem with "unknown", it
sounds like a userspace bug that was just unnoticed because no one
tested on the right hardware.

But anyways, one idea to revert things to original behavior prior to
c484f02d0f02fbbfc6decc945a69aae011041a27 (so at least userspace
doesn't see 'unknown' for drivers/connectors that never used to report
'unknown') would be to do something roughly like this in
status_show():

  if (status == unknown)
 status = connector->funcs->detect(connector)

So I could go with either just reverting this commit, or reverting
commit plus above change.  My $0.02 anyways..

BR,
-R

>  EXPORT_SYMBOL(drm_mode_config_reset);
>
> --
> 2.5.0
>


[PATCH] Revert "drm: Stop resetting connector state to unknown"

2015-12-15 Thread Ville Syrjälä
On Tue, Dec 15, 2015 at 01:23:06PM -0500, Rob Clark wrote:
> On Tue, Dec 15, 2015 at 1:07 PM, Lyude  wrote:
> > This reverts commit 5677d67ae394 ("drm: Stop resetting connector state to
> > unknown")
> >
> > Unfortunately, not resetting the connector status to unknown actually
> > breaks reprobing on suspend/resume in i915, which is important to have
> > working since it means a user docking their laptop in suspend won't have
> > their monitors work after resume. This commit was originally pushed to fix
> > a bug with systemd[1], however said bug has already been fixed in
> > userspace.
> >
> > Since "unknown" is technically a valid option to return to userspace for a
> > connector's status, I would think that this sort of behavior should
> > probably be expected from userspace. Some good examples of this are the
> > radeon driver reporting "unknown" for connectors that have done something
> > wonky during a hotplug event (e.g. part of the initialization of the
> > connector failed), and the omapdrm driver returns "unknown" for certain
> > connector types by default.
> >
> > [1]: https://bugzilla.kernel.org/show_bug.cgi?id=100641
> >
> > Signed-off-by: Lyude 
> > ---
> >  drivers/gpu/drm/drm_crtc.c | 7 ---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> > index 24c5434..474e636 100644
> > --- a/drivers/gpu/drm/drm_crtc.c
> > +++ b/drivers/gpu/drm/drm_crtc.c
> > @@ -5312,11 +5312,12 @@ void drm_mode_config_reset(struct drm_device *dev)
> > if (encoder->funcs->reset)
> > encoder->funcs->reset(encoder);
> >
> > -   mutex_lock(&dev->mode_config.mutex);
> > -   drm_for_each_connector(connector, dev)
> > +   list_for_each_entry(connector, &dev->mode_config.connector_list, 
> > head) {
> > +   connector->status = connector_status_unknown;
> > +
> > if (connector->funcs->reset)
> > connector->funcs->reset(connector);
> > -   mutex_unlock(&dev->mode_config.mutex);
> > +   }
> >  }
> 
> looks like git-revert might have been a bit over-ambitious and
> clobbered a couple subsequent changes.. but that is easy enough to fix
> once we figure out what the right thing to do is.
> 
> Beyond that.. I'm not really sure how to apply the "do not break
> userspace" rule here.. since prior to
> c484f02d0f02fbbfc6decc945a69aae011041a27 userspace could see "unknown"
> for certain hardware.  But after that commit it could start seeing
> "unknown" for drivers/connectors that never would have returned
> "unknown" before.  If userspace had a problem with "unknown", it
> sounds like a userspace bug that was just unnoticed because no one
> tested on the right hardware.
> 
> But anyways, one idea to revert things to original behavior prior to
> c484f02d0f02fbbfc6decc945a69aae011041a27 (so at least userspace
> doesn't see 'unknown' for drivers/connectors that never used to report
> 'unknown') would be to do something roughly like this in
> status_show():
> 
>   if (status == unknown)
>  status = connector->funcs->detect(connector)
> 
> So I could go with either just reverting this commit, or reverting
> commit plus above change.  My $0.02 anyways..

Hmm. Or maybe leave the states alone, and just fire off the uevent
unconditionally and let userspace initiate the probe. That way we could
skip all ->detect() calls during resume for a bit of extra speed.

Not 100% if that would be safe. Maybe something internal depends on the
->detect() having been called? DP stuff perhaps? Which makes me wonder
how i915 copes with a DP monitor geting unplugged/change while
suspended. I should probably try that.

-- 
Ville Syrjälä
Intel OTC


[PATCH] Revert "drm: Stop resetting connector state to unknown"

2015-12-15 Thread Rob Clark
On Tue, Dec 15, 2015 at 1:33 PM, Ville Syrjälä
 wrote:
> On Tue, Dec 15, 2015 at 01:23:06PM -0500, Rob Clark wrote:
>> On Tue, Dec 15, 2015 at 1:07 PM, Lyude  wrote:
>> > This reverts commit 5677d67ae394 ("drm: Stop resetting connector state to
>> > unknown")
>> >
>> > Unfortunately, not resetting the connector status to unknown actually
>> > breaks reprobing on suspend/resume in i915, which is important to have
>> > working since it means a user docking their laptop in suspend won't have
>> > their monitors work after resume. This commit was originally pushed to fix
>> > a bug with systemd[1], however said bug has already been fixed in
>> > userspace.
>> >
>> > Since "unknown" is technically a valid option to return to userspace for a
>> > connector's status, I would think that this sort of behavior should
>> > probably be expected from userspace. Some good examples of this are the
>> > radeon driver reporting "unknown" for connectors that have done something
>> > wonky during a hotplug event (e.g. part of the initialization of the
>> > connector failed), and the omapdrm driver returns "unknown" for certain
>> > connector types by default.
>> >
>> > [1]: https://bugzilla.kernel.org/show_bug.cgi?id=100641
>> >
>> > Signed-off-by: Lyude 
>> > ---
>> >  drivers/gpu/drm/drm_crtc.c | 7 ---
>> >  1 file changed, 4 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
>> > index 24c5434..474e636 100644
>> > --- a/drivers/gpu/drm/drm_crtc.c
>> > +++ b/drivers/gpu/drm/drm_crtc.c
>> > @@ -5312,11 +5312,12 @@ void drm_mode_config_reset(struct drm_device *dev)
>> > if (encoder->funcs->reset)
>> > encoder->funcs->reset(encoder);
>> >
>> > -   mutex_lock(&dev->mode_config.mutex);
>> > -   drm_for_each_connector(connector, dev)
>> > +   list_for_each_entry(connector, &dev->mode_config.connector_list, 
>> > head) {
>> > +   connector->status = connector_status_unknown;
>> > +
>> > if (connector->funcs->reset)
>> > connector->funcs->reset(connector);
>> > -   mutex_unlock(&dev->mode_config.mutex);
>> > +   }
>> >  }
>>
>> looks like git-revert might have been a bit over-ambitious and
>> clobbered a couple subsequent changes.. but that is easy enough to fix
>> once we figure out what the right thing to do is.
>>
>> Beyond that.. I'm not really sure how to apply the "do not break
>> userspace" rule here.. since prior to
>> c484f02d0f02fbbfc6decc945a69aae011041a27 userspace could see "unknown"
>> for certain hardware.  But after that commit it could start seeing
>> "unknown" for drivers/connectors that never would have returned
>> "unknown" before.  If userspace had a problem with "unknown", it
>> sounds like a userspace bug that was just unnoticed because no one
>> tested on the right hardware.
>>
>> But anyways, one idea to revert things to original behavior prior to
>> c484f02d0f02fbbfc6decc945a69aae011041a27 (so at least userspace
>> doesn't see 'unknown' for drivers/connectors that never used to report
>> 'unknown') would be to do something roughly like this in
>> status_show():
>>
>>   if (status == unknown)
>>  status = connector->funcs->detect(connector)
>>
>> So I could go with either just reverting this commit, or reverting
>> commit plus above change.  My $0.02 anyways..
>
> Hmm. Or maybe leave the states alone, and just fire off the uevent
> unconditionally and let userspace initiate the probe. That way we could
> skip all ->detect() calls during resume for a bit of extra speed.

That is, iirc, something that Lyude suggested when we discussed in
person (but I asked him to send revert patch just to start broader
discussion on what the right solution would be).  Depending on
userspace to reprobe seems like at least the wrong thing for fbcon..
which as much as I wish it would go away, as long as it is enabled in
kernel config, I don't think we can ignore.

BR,
-R

> Not 100% if that would be safe. Maybe something internal depends on the
> ->detect() having been called? DP stuff perhaps? Which makes me wonder
> how i915 copes with a DP monitor geting unplugged/change while
> suspended. I should probably try that.
>
> --
> Ville Syrjälä
> Intel OTC


[Bug 93353] GRID Autosport crash on loading screen with an HD 6950

2015-12-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93353

--- Comment #12 from Ilia Mirkin  ---
(In reply to Thomas Rohloff from comment #11)
> Maybe it would be a good idea for you to take the offer from
> https://bugs.freedesktop.org/show_bug.cgi?id=93352#c20 ("Please let us know
> if we can assist by providing people working on driver issues a copy of the
> title") - I'm sure this will speed up debugging a lot.

Not that this is the proper channel for this, but I replied to that offer here:
http://lists.freedesktop.org/archives/mesa-dev/2015-December/103085.html

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20151215/7c26b666/attachment.html>


[Bug 108561] nouveau: external monitor can not be enabled with hindsight

2015-12-15 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=108561

--- Comment #3 from Elmar Stellnberger  ---
s2ram; new test results:
* when booted with nouveau.modeset=0 the external monitor is not enabled at all
(i.e. definitely a bug related to the nouveau kernel module).
* suspecting this to be backlight issue I have tried to boot into runlevel 1
with the following kernel parameters the nouveau module being loaded
 - video.use_bios_initial_backlight=0
 - video.use_native_backlight=1 
 - acpi_osi=
 Unfortunately none of the above kernel command line parameters did yield any
difference with respect to s2ram: the external monitor always got disabled by
suspend.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[PATCH] android: fix warning when releasing active sync point

2015-12-15 Thread Gustavo Padovan
2015-12-15 Daniel Vetter :

> On Mon, Dec 14, 2015 at 05:29:55PM -0800, Dmitry Torokhov wrote:
> > Userspace can close the sync device while there are still active fence
> > points, in which case kernel produces the following warning:
> > 
> > [   43.853176] [ cut here ]
> > [   43.857834] WARNING: CPU: 0 PID: 892 at 
> > /mnt/host/source/src/third_party/kernel/v3.18/drivers/staging/android/sync.c:439
> >  android_fence_release+0x88/0x104()
> > [   43.871741] CPU: 0 PID: 892 Comm: Binder_5 Tainted: G U 
> > 3.18.0-07661-g0550ce9 #1
> > [   43.880176] Hardware name: Google Tegra210 Smaug Rev 1+ (DT)
> > [   43.885834] Call trace:
> > [   43.888294] [] dump_backtrace+0x0/0x10c
> > [   43.893697] [] show_stack+0x10/0x1c
> > [   43.898756] [] dump_stack+0x74/0xb8
> > [   43.903814] [] warn_slowpath_common+0x84/0xb0
> > [   43.909736] [] warn_slowpath_null+0x14/0x20
> > [   43.915482] [] android_fence_release+0x84/0x104
> > [   43.921582] [] fence_release+0x104/0x134
> > [   43.927066] [] sync_fence_free+0x74/0x9c
> > [   43.932552] [] sync_fence_release+0x34/0x48
> > [   43.938304] [] __fput+0x100/0x1b8
> > [   43.943185] [] fput+0x8/0x14
> > [   43.947982] [] task_work_run+0xb0/0xe4
> > [   43.953297] [] do_notify_resume+0x44/0x5c
> > [   43.958867] ---[ end trace 5a2aa4027cc5d171 ]---
> > 
> > Let's fix it by introducing a new optional callback (disable_signaling)
> > to fence operations so that drivers can do proper clean ups when we
> > remove last callback for given fence.
> > 
> > Reviewed-by: Andrew Bresticker 
> > Signed-off-by: Dmitry Torokhov 
> > ---
> >  drivers/dma-buf/fence.c| 6 +-
> >  drivers/staging/android/sync.c | 8 
> >  include/linux/fence.h  | 2 ++
> >  3 files changed, 15 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/dma-buf/fence.c b/drivers/dma-buf/fence.c
> > index 7b05dbe..0ed73ad 100644
> > --- a/drivers/dma-buf/fence.c
> > +++ b/drivers/dma-buf/fence.c
> > @@ -304,8 +304,12 @@ fence_remove_callback(struct fence *fence, struct 
> > fence_cb *cb)
> > spin_lock_irqsave(fence->lock, flags);
> >  
> > ret = !list_empty(&cb->node);
> > -   if (ret)
> > +   if (ret) {
> > list_del_init(&cb->node);
> > +   if (list_empty(&fence->cb_list))
> > +   if (fence->ops->disable_signaling)
> > +   fence->ops->disable_signaling(fence);
> 
> What exactly is the bug here? A fence with no callbacks registered any
> more shouldn't have any problem. Why exactly does this blow up?

The WARN_ON is probably this one:
https://android.googlesource.com/kernel/common/+/android-3.18/drivers/staging/android/sync.c#433

I've been wondering in the last few days if this warning is really
necessary. If the user is closing a sync_timeline that has unsignalled
fences it should probably be aware of that already. Then I think it is
okay to remove the the sync_pt from the active_list at the release-time.
In fact I've already prepared a patch doing that. Thoughts?  

Gustavo


[PATCH 00/12] drm/tilcdc: fixes and added features from TI tree

2015-12-15 Thread Jyri Sarha
Most of these patches are quite old and they have been used in TI
linux for some time already. I forward ported the applicaple patches
from TI tree on top of the latest drm-next, fixed checkpatch issues
and tested the driver.

Darren Etheridge (8):
  drm/tilcdc: disable console switching during pm operations
  drm/tilcdc: rewrite pixel clock calculation
  drm/tilcdc: fix kernel panic on suspend when no hdmi monitor connected
  drm/tilcdc: make frame_done interrupt active at all times
  drm/tilcdc: disable the lcd controller/dma engine when suspend invoked
  drm/tilcdc: fix the ping-pong dma tearing issue seen on buffer
flipping
  drm/tilcdc: correct the dmachannel tracking logic
  drm/tilcdc: make frame completion interrupt always enabled

Dave Gerlach (1):
  drm/tilcdc: adopt pinctrl support

Grygorii Strashko (1):
  drm/tilcdc: fix build error when !CONFIG_CPU_FREQ

Jyri Sarha (1):
  drm/tilcdc: Implement dma-buf support for tilcdc

Tomi Valkeinen (1):
  drm/tilcdc: verify fb pitch

 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 91 +++---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c  | 94 +---
 drivers/gpu/drm/tilcdc/tilcdc_drv.h  |  3 +-
 3 files changed, 129 insertions(+), 59 deletions(-)

-- 
1.9.1



[PATCH 01/12] drm/tilcdc: disable console switching during pm operations

2015-12-15 Thread Jyri Sarha
From: Darren Etheridge 

The default behavior of consoles during power management operations is: On
entry to suspend a new console is allocated and switched to. On resume the
original console is restored.

However this isn't the observed behavior and the original console is not
restored. This commit avoids the problem by disabling the switching of
consoles at suspend/resume. This works because the driver already restores
all necessary hardware context during such pm operations.

Signed-off-by: Darren Etheridge 
Signed-off-by: Jyri Sarha 
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c 
b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 4ddb21e..02525b2 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -18,6 +18,7 @@
 /* LCDC DRM driver, based on da8xx-fb */

 #include 
+#include 

 #include "tilcdc_drv.h"
 #include "tilcdc_regs.h"
@@ -229,6 +230,14 @@ static int tilcdc_load(struct drm_device *dev, unsigned 
long flags)
pm_runtime_enable(dev->dev);
pm_runtime_irq_safe(dev->dev);

+   /*
+* disable creation of new console during suspend.
+* this works around a problem where a ctrl-c is needed
+* to be entered on the VT to actually get the device
+* to continue into the suspend state.
+*/
+   pm_set_vt_switch(0);
+
/* Determine LCD IP Version */
pm_runtime_get_sync(dev->dev);
switch (tilcdc_read(dev, LCDC_PID_REG)) {
-- 
1.9.1



[PATCH 02/12] drm/tilcdc: rewrite pixel clock calculation

2015-12-15 Thread Jyri Sarha
From: Darren Etheridge 

Updating the tilcdc DRM driver code to calculate the LCD controller
pixel clock more accurately. Based on a suggested implementation by
Tomi Valkeinen.

The current code does not work correctly and produces wrong results
with many requested clock rates. It also oddly uses two different
clocks, a display pll clock and a divider clock (child of display
pll), instead of just using the clock coming to the lcdc.

This patch removes the use of the display pll clock, and rewrites the
code to calculate the clock rates. The idea is simply to request a
clock rate of pixelclock*2, as the LCD controller has an internal
divider which we set to 2.

Signed-off-by: Darren Etheridge 
[Rewrapped description]
Signed-off-by: Jyri Sarha 
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 16 
 drivers/gpu/drm/tilcdc/tilcdc_drv.c  | 11 +--
 drivers/gpu/drm/tilcdc/tilcdc_drv.h  |  1 -
 3 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c 
b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index 7d07733..7b687ae 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -573,7 +573,8 @@ void tilcdc_crtc_update_clk(struct drm_crtc *crtc)
struct drm_device *dev = crtc->dev;
struct tilcdc_drm_private *priv = dev->dev_private;
int dpms = tilcdc_crtc->dpms;
-   unsigned int lcd_clk, div;
+   unsigned long lcd_clk;
+   const unsigned clkdiv = 2; /* using a fixed divider of 2 */
int ret;

pm_runtime_get_sync(dev->dev);
@@ -581,22 +582,21 @@ void tilcdc_crtc_update_clk(struct drm_crtc *crtc)
if (dpms == DRM_MODE_DPMS_ON)
tilcdc_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);

-   /* in raster mode, minimum divisor is 2: */
-   ret = clk_set_rate(priv->disp_clk, crtc->mode.clock * 1000 * 2);
-   if (ret) {
+   /* mode.clock is in KHz, set_rate wants parameter in Hz */
+   ret = clk_set_rate(priv->clk, crtc->mode.clock * 1000 * clkdiv);
+   if (ret < 0) {
dev_err(dev->dev, "failed to set display clock rate to: %d\n",
crtc->mode.clock);
goto out;
}

lcd_clk = clk_get_rate(priv->clk);
-   div = lcd_clk / (crtc->mode.clock * 1000);

-   DBG("lcd_clk=%u, mode clock=%d, div=%u", lcd_clk, crtc->mode.clock, 
div);
-   DBG("fck=%lu, dpll_disp_ck=%lu", clk_get_rate(priv->clk), 
clk_get_rate(priv->disp_clk));
+   DBG("lcd_clk=%lu, mode clock=%d, div=%u",
+   lcd_clk, crtc->mode.clock, clkdiv);

/* Configure the LCD clock divisor. */
-   tilcdc_write(dev, LCDC_CTRL_REG, LCDC_CLK_DIVISOR(div) |
+   tilcdc_write(dev, LCDC_CTRL_REG, LCDC_CLK_DIVISOR(clkdiv) |
LCDC_RASTER_MODE);

if (priv->rev == 2)
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c 
b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 02525b2..2b2780e 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -193,13 +193,6 @@ static int tilcdc_load(struct drm_device *dev, unsigned 
long flags)
goto fail_iounmap;
}

-   priv->disp_clk = clk_get(dev->dev, "dpll_disp_ck");
-   if (IS_ERR(priv->clk)) {
-   dev_err(dev->dev, "failed to get display clock\n");
-   ret = -ENODEV;
-   goto fail_put_clk;
-   }
-
 #ifdef CONFIG_CPU_FREQ
priv->lcd_fck_rate = clk_get_rate(priv->clk);
priv->freq_transition.notifier_call = cpufreq_transition;
@@ -207,7 +200,7 @@ static int tilcdc_load(struct drm_device *dev, unsigned 
long flags)
CPUFREQ_TRANSITION_NOTIFIER);
if (ret) {
dev_err(dev->dev, "failed to register cpufreq notifier\n");
-   goto fail_put_disp_clk;
+   goto fail_put_clk;
}
 #endif

@@ -338,8 +331,6 @@ fail_cpufreq_unregister:
 #ifdef CONFIG_CPU_FREQ
cpufreq_unregister_notifier(&priv->freq_transition,
CPUFREQ_TRANSITION_NOTIFIER);
-fail_put_disp_clk:
-   clk_put(priv->disp_clk);
 #endif

 fail_put_clk:
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h 
b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
index e863ad0..c00f518 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
@@ -49,7 +49,6 @@
 struct tilcdc_drm_private {
void __iomem *mmio;

-   struct clk *disp_clk;/* display dpll */
struct clk *clk; /* functional clock */
int rev; /* IP revision */

-- 
1.9.1



[PATCH 04/12] drm/tilcdc: adopt pinctrl support

2015-12-15 Thread Jyri Sarha
From: Dave Gerlach 

Update tilcdc driver to set the state of the pins to:
- "default on resume
- "sleep" on suspend

By optionally putting the pins into sleep state in the suspend callback
we can accomplish two things.
- minimize current leakage from pins and thus save power,
- prevent the IP from driving pins output in an uncontrolled manner,
which may happen if the power domain drops the domain regulator.

Signed-off-by: Dave Gerlach 
Signed-off-by: Darren Etheridge 
Signed-off-by: Jyri Sarha 
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c 
b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 2b2780e..146399a 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -18,6 +18,7 @@
 /* LCDC DRM driver, based on da8xx-fb */

 #include 
+#include 
 #include 

 #include "tilcdc_drv.h"
@@ -601,6 +602,9 @@ static int tilcdc_pm_suspend(struct device *dev)
if (registers[i].save && (priv->rev >= registers[i].rev))
priv->saved_register[n++] = tilcdc_read(ddev, 
registers[i].reg);

+   /* Select sleep pin state */
+   pinctrl_pm_select_sleep_state(dev);
+
return 0;
 }

@@ -610,6 +614,9 @@ static int tilcdc_pm_resume(struct device *dev)
struct tilcdc_drm_private *priv = ddev->dev_private;
unsigned i, n = 0;

+   /* Select default pin state */
+   pinctrl_pm_select_default_state(dev);
+
/* Restore register state: */
for (i = 0; i < ARRAY_SIZE(registers); i++)
if (registers[i].save && (priv->rev >= registers[i].rev))
-- 
1.9.1



[PATCH 03/12] drm/tilcdc: verify fb pitch

2015-12-15 Thread Jyri Sarha
From: Tomi Valkeinen 

LCDC hardware does not support fb pitch that is different (i.e. larger)
than the screen size. The driver currently does no checks for this, and
the results of too big pitch are are flickering and lower fps.

This issue easily happens when using libdrm's modetest tool with non-32
bpp modes. As modetest always allocated 4 bytes per pixel, it implies a
bigger pitch for 16 or 24 bpp modes.

This patch adds a check to reject pitches the hardware cannot support.

Signed-off-by: Tomi Valkeinen 
Signed-off-by: Darren Etheridge 
Signed-off-by: Jyri Sarha 
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c 
b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index 7b687ae..105f286 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -151,6 +151,22 @@ static void tilcdc_crtc_destroy(struct drm_crtc *crtc)
kfree(tilcdc_crtc);
 }

+static int tilcdc_verify_fb(struct drm_crtc *crtc, struct drm_framebuffer *fb)
+{
+   struct drm_device *dev = crtc->dev;
+   unsigned int depth, bpp;
+
+   drm_fb_get_bpp_depth(fb->pixel_format, &depth, &bpp);
+
+   if (fb->pitches[0] != crtc->mode.hdisplay * bpp / 8) {
+   dev_err(dev->dev,
+   "Invalid pitch: fb and crtc widths must be the same");
+   return -EINVAL;
+   }
+
+   return 0;
+}
+
 static int tilcdc_crtc_page_flip(struct drm_crtc *crtc,
struct drm_framebuffer *fb,
struct drm_pending_vblank_event *event,
@@ -158,6 +174,11 @@ static int tilcdc_crtc_page_flip(struct drm_crtc *crtc,
 {
struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc);
struct drm_device *dev = crtc->dev;
+   int r;
+
+   r = tilcdc_verify_fb(crtc, fb);
+   if (r)
+   return r;

if (tilcdc_crtc->event) {
dev_err(dev->dev, "already pending page flip!\n");
@@ -272,6 +293,10 @@ static int tilcdc_crtc_mode_set(struct drm_crtc *crtc,
if (WARN_ON(!info))
return -EINVAL;

+   ret = tilcdc_verify_fb(crtc, crtc->primary->fb);
+   if (ret)
+   return ret;
+
pm_runtime_get_sync(dev->dev);

/* Configure the Burst Size and fifo threshold of DMA: */
@@ -431,6 +456,12 @@ static int tilcdc_crtc_mode_set(struct drm_crtc *crtc,
 static int tilcdc_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
struct drm_framebuffer *old_fb)
 {
+   int r;
+
+   r = tilcdc_verify_fb(crtc, crtc->primary->fb);
+   if (r)
+   return r;
+
update_scanout(crtc);
return 0;
 }
-- 
1.9.1



[PATCH 05/12] drm/tilcdc: fix kernel panic on suspend when no hdmi monitor connected

2015-12-15 Thread Jyri Sarha
From: Darren Etheridge 

On BeagleBone Black if no HDMI monitor is connected and suspend
is requested a kernel panic will result:

root at am335x-evm:~# echo mem > /sys/power/state
[ 65.548710] PM: Syncing filesystems ... done.
[ 65.631311] Freezing user space processes ... (elapsed 0.006 seconds) done.
[ 65.648619] Freezing remaining freezable tasks ... (elapsed 0.005 seconds) 
done.
[ 65.833500] Unhandled fault: external abort on non-linefetch (0x1028) at 
0xfa30e004
[ 65.841692] Internal error: : 1028 [#1] SMP ARM
  
[ 66.105287] [] (platform_pm_suspend) from [] 
(dpm_run_callback+0x34/0x70)
[ 66.114370] [] (dpm_run_callback) from [] 
(__device_suspend+0x10c/0x2f4)
[ 66.123357] [] (__device_suspend) from [] 
(dpm_suspend+0x58/0x218)
[ 66.131796] [] (dpm_suspend) from [] 
(suspend_devices_and_enter+0x9c/0x3c0)
[ 66.141055] [] (suspend_devices_and_enter) from [] 
(pm_suspend+0x210/0x24c)
[ 66.150312] [] (pm_suspend) from [] (state_store+0x68/0xb8)
[ 66.158103] [] (state_store) from [] 
(kobj_attr_store+0x14/0x20)
[ 66.166355] [] (kobj_attr_store) from [] 
(sysfs_kf_write+0x4c/0x50)
[ 66.174883] [] (sysfs_kf_write) from [] 
(kernfs_fop_write+0xb4/0x150)
[ 66.183598] [] (kernfs_fop_write) from [] 
(vfs_write+0xa8/0x180)
[ 66.191846] [] (vfs_write) from [] (SyS_write+0x40/0x8c)
[ 66.199365] [] (SyS_write) from [] 
(ret_fast_syscall+0x0/0x48)
[ 66.207426] Code: e595c210 e5932000 e59cc000 e08c2002 (e592c000)

This is because the lcdc module is not enabled when no monitor is detected
to save power.  However the suspend handler just blindly tries to save the
lcdc state by copying out the pertinent registers. However module is off
so no good things happen when you try and access it.

This patch only saves off the registers if the module is enabled, and
then only restores the registers on resume if they were saved off during
suspend.

Signed-off-by: Darren Etheridge 
Tested-by: Dave Gerlach 
Acked-by: Felipe Balbi 
Signed-off-by: Jyri Sarha 
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 23 +--
 drivers/gpu/drm/tilcdc/tilcdc_drv.h |  1 +
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c 
b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 146399a..083b8d4 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -597,13 +597,20 @@ static int tilcdc_pm_suspend(struct device *dev)

drm_kms_helper_poll_disable(ddev);

+   /* Select sleep pin state */
+   pinctrl_pm_select_sleep_state(dev);
+
+   if (pm_runtime_suspended(dev)) {
+   priv->ctx_valid = false;
+   return 0;
+   }
+
/* Save register state: */
for (i = 0; i < ARRAY_SIZE(registers); i++)
if (registers[i].save && (priv->rev >= registers[i].rev))
priv->saved_register[n++] = tilcdc_read(ddev, 
registers[i].reg);

-   /* Select sleep pin state */
-   pinctrl_pm_select_sleep_state(dev);
+   priv->ctx_valid = true;

return 0;
 }
@@ -617,10 +624,14 @@ static int tilcdc_pm_resume(struct device *dev)
/* Select default pin state */
pinctrl_pm_select_default_state(dev);

-   /* Restore register state: */
-   for (i = 0; i < ARRAY_SIZE(registers); i++)
-   if (registers[i].save && (priv->rev >= registers[i].rev))
-   tilcdc_write(ddev, registers[i].reg, 
priv->saved_register[n++]);
+   if (priv->ctx_valid == true) {
+   /* Restore register state: */
+   for (i = 0; i < ARRAY_SIZE(registers); i++)
+   if (registers[i].save &&
+   (priv->rev >= registers[i].rev))
+   tilcdc_write(ddev, registers[i].reg,
+priv->saved_register[n++]);
+   }

drm_kms_helper_poll_enable(ddev);

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h 
b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
index c00f518..7d214cc 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
@@ -67,6 +67,7 @@ struct tilcdc_drm_private {

/* register contents saved across suspend/resume: */
u32 saved_register[12];
+   bool ctx_valid;

 #ifdef CONFIG_CPU_FREQ
struct notifier_block freq_transition;
-- 
1.9.1



[PATCH 06/12] drm/tilcdc: make frame_done interrupt active at all times

2015-12-15 Thread Jyri Sarha
From: Darren Etheridge 

The frame_done interrupt was only being enabled when the vsync
interrupts were being enabled by DRM.  However the frame_done is
used to determine if the LCD controller has successfully completed
the raster_enable, raster_disable commands and the vsync interrupts
are not always enabled during these operations.

Signed-off-by: Darren Etheridge 
Tested-by: Dave Gerlach 
Signed-off-by: Jyri Sarha 
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c 
b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 083b8d4..b5563be 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -383,7 +383,9 @@ static int tilcdc_irq_postinstall(struct drm_device *dev)
if (priv->rev == 1)
tilcdc_set(dev, LCDC_RASTER_CTRL_REG, 
LCDC_V1_UNDERFLOW_INT_ENA);
else
-   tilcdc_set(dev, LCDC_INT_ENABLE_SET_REG, 
LCDC_V2_UNDERFLOW_INT_ENA);
+   tilcdc_set(dev, LCDC_INT_ENABLE_SET_REG,
+  LCDC_V2_UNDERFLOW_INT_ENA |
+  LCDC_FRAME_DONE);

return 0;
 }
@@ -417,7 +419,7 @@ static void enable_vblank(struct drm_device *dev, bool 
enable)
} else {
reg = LCDC_INT_ENABLE_SET_REG;
mask = LCDC_V2_END_OF_FRAME0_INT_ENA |
-   LCDC_V2_END_OF_FRAME1_INT_ENA | LCDC_FRAME_DONE;
+   LCDC_V2_END_OF_FRAME1_INT_ENA;
}

if (enable)
-- 
1.9.1



[PATCH 08/12] drm/tilcdc: fix the ping-pong dma tearing issue seen on buffer flipping

2015-12-15 Thread Jyri Sarha
From: Darren Etheridge 

Update the DMA pointers during the pan display ioctl. Borrowed from
da8xx_fb.c update the scanout buffers immediately so the DMA ping/pong
doesn't end up out of sync with what we really want it to DMA,
otherwise part of the screen ends up tearing during rapid flip
operations.

Ported from commit deb95c6c958f ("video: da8xx-fb: fix flicker due to
1 frame delay in updated frame")

Signed-off-by: Darren Etheridge 
[Rewrapped description and fixed commit reference]
Signed-off-by: Jyri Sarha 
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 36 +++-
 1 file changed, 31 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c 
b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index cc45818..50384fa 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -31,6 +31,8 @@ struct tilcdc_crtc {
int dpms;
wait_queue_head_t frame_done_wq;
bool frame_done;
+   spinlock_t irq_lock;
+   int dma_completed_channel;

/* fb currently set to scanout 0/1: */
struct drm_framebuffer *scanout[2];
@@ -102,10 +104,23 @@ static void update_scanout(struct drm_crtc *crtc)
(crtc->mode.vdisplay * fb->pitches[0]);

if (tilcdc_crtc->dpms == DRM_MODE_DPMS_ON) {
-   /* already enabled, so just mark the frames that need
-* updating and they will be updated on vblank:
+   /*
+* already enabled, so just mark the frames that need
+* updating and they will be updated on vblank
+* and update the inactive DMA channel immediately
+* to avoid any tearing due to the DMA already starting
+* on the pending dma buffer when we hit the vblank IRQ
 */
-   tilcdc_crtc->dirty |= LCDC_END_OF_FRAME0 | LCDC_END_OF_FRAME1;
+   if (tilcdc_crtc->dma_completed_channel == 0) {
+   tilcdc_crtc->dirty |= LCDC_END_OF_FRAME1;
+   set_scanout(crtc, 0);
+   }
+
+   if (tilcdc_crtc->dma_completed_channel == 1) {
+   tilcdc_crtc->dirty |= LCDC_END_OF_FRAME0;
+   set_scanout(crtc, 1);
+   }
+
drm_vblank_get(dev, 0);
} else {
/* not enabled yet, so update registers immediately: */
@@ -647,6 +662,7 @@ irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc)
struct drm_device *dev = crtc->dev;
struct tilcdc_drm_private *priv = dev->dev_private;
uint32_t stat = tilcdc_read_irqstatus(dev);
+   unsigned long irq_flags;

if ((stat & LCDC_SYNC_LOST) && (stat & LCDC_FIFO_UNDERFLOW)) {
stop(crtc);
@@ -662,11 +678,19 @@ irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc)

tilcdc_clear_irqstatus(dev, stat);

-   if (dirty & LCDC_END_OF_FRAME0)
+   spin_lock_irqsave(&tilcdc_crtc->irq_lock, irq_flags);
+
+   if (dirty & LCDC_END_OF_FRAME0) {
set_scanout(crtc, 0);
+   tilcdc_crtc->dma_completed_channel = 0;
+   }

-   if (dirty & LCDC_END_OF_FRAME1)
+   if (dirty & LCDC_END_OF_FRAME1) {
set_scanout(crtc, 1);
+   tilcdc_crtc->dma_completed_channel = 1;
+   }
+
+   spin_unlock_irqrestore(&tilcdc_crtc->irq_lock, irq_flags);

drm_handle_vblank(dev, 0);

@@ -732,6 +756,8 @@ struct drm_crtc *tilcdc_crtc_create(struct drm_device *dev)
drm_flip_work_init(&tilcdc_crtc->unref_work,
"unref", unref_worker);

+   spin_lock_init(&tilcdc_crtc->irq_lock);
+
ret = drm_crtc_init(dev, crtc, &tilcdc_crtc_funcs);
if (ret < 0)
goto fail;
-- 
1.9.1



[PATCH 07/12] drm/tilcdc: disable the lcd controller/dma engine when suspend invoked

2015-12-15 Thread Jyri Sarha
From: Darren Etheridge 

The LCD controller must be deactivated and all DMA transactions stopped
when the suspend power state is entered otherwise the PRCM causes the L3
bus to get stuck in transition state.

This commit forces the lcdc to be shut down and waits for all pending DMA
transactions to complete as part of the suspend handler for this driver.

Signed-off-by: Darren Etheridge 
Tested-by: Dave Gerlach 
Signed-off-by: Jyri Sarha 
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 3 +--
 drivers/gpu/drm/tilcdc/tilcdc_drv.c  | 3 +++
 drivers/gpu/drm/tilcdc/tilcdc_drv.h  | 1 +
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c 
b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index 105f286..cc45818 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -138,7 +138,6 @@ static void stop(struct drm_crtc *crtc)
tilcdc_clear(dev, LCDC_RASTER_CTRL_REG, LCDC_RASTER_ENABLE);
 }

-static void tilcdc_crtc_dpms(struct drm_crtc *crtc, int mode);
 static void tilcdc_crtc_destroy(struct drm_crtc *crtc)
 {
struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc);
@@ -192,7 +191,7 @@ static int tilcdc_crtc_page_flip(struct drm_crtc *crtc,
return 0;
 }

-static void tilcdc_crtc_dpms(struct drm_crtc *crtc, int mode)
+void tilcdc_crtc_dpms(struct drm_crtc *crtc, int mode)
 {
struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc);
struct drm_device *dev = crtc->dev;
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c 
b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index b5563be..f640b37 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -607,6 +607,9 @@ static int tilcdc_pm_suspend(struct device *dev)
return 0;
}

+   /* Disable the LCDC controller, to avoid locking up the PRCM */
+   tilcdc_crtc_dpms(priv->crtc, DRM_MODE_DPMS_OFF);
+
/* Save register state: */
for (i = 0; i < ARRAY_SIZE(registers); i++)
if (registers[i].save && (priv->rev >= registers[i].rev))
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h 
b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
index 7d214cc..77c600d 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
@@ -172,5 +172,6 @@ void tilcdc_crtc_set_simulate_vesa_sync(struct drm_crtc 
*crtc,
bool simulate_vesa_sync);
 int tilcdc_crtc_mode_valid(struct drm_crtc *crtc, struct drm_display_mode 
*mode);
 int tilcdc_crtc_max_width(struct drm_crtc *crtc);
+void tilcdc_crtc_dpms(struct drm_crtc *crtc, int mode);

 #endif /* __TILCDC_DRV_H__ */
-- 
1.9.1



[PATCH 09/12] drm/tilcdc: correct the dmachannel tracking logic

2015-12-15 Thread Jyri Sarha
From: Darren Etheridge 

dma_channel_completed should be reset to channel 0 when the start
function is called and the dma channel in use should be tracked even
when no flip is pending.

Signed-off-by: Darren Etheridge 
[Rewrapped description]
Signed-off-by: Jyri Sarha 
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c 
b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index 50384fa..720a43a 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -133,6 +133,7 @@ static void start(struct drm_crtc *crtc)
 {
struct drm_device *dev = crtc->dev;
struct tilcdc_drm_private *priv = dev->dev_private;
+   struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc);

if (priv->rev == 2) {
tilcdc_set(dev, LCDC_CLK_RESET_REG, LCDC_CLK_MAIN_RESET);
@@ -141,6 +142,8 @@ static void start(struct drm_crtc *crtc)
msleep(1);
}

+   tilcdc_crtc->dma_completed_channel = 0;
+
tilcdc_set(dev, LCDC_DMA_CTRL_REG, LCDC_DUAL_FRAME_BUFFER_ENABLE);
tilcdc_set(dev, LCDC_RASTER_CTRL_REG, 
LCDC_PALETTE_LOAD_MODE(DATA_ONLY));
tilcdc_set(dev, LCDC_RASTER_CTRL_REG, LCDC_RASTER_ENABLE);
@@ -680,15 +683,17 @@ irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc)

spin_lock_irqsave(&tilcdc_crtc->irq_lock, irq_flags);

-   if (dirty & LCDC_END_OF_FRAME0) {
-   set_scanout(crtc, 0);
+   if (stat & LCDC_END_OF_FRAME0)
tilcdc_crtc->dma_completed_channel = 0;
-   }

-   if (dirty & LCDC_END_OF_FRAME1) {
-   set_scanout(crtc, 1);
+   if (stat & LCDC_END_OF_FRAME1)
tilcdc_crtc->dma_completed_channel = 1;
-   }
+
+   if (dirty & LCDC_END_OF_FRAME0)
+   set_scanout(crtc, 0);
+
+   if (dirty & LCDC_END_OF_FRAME1)
+   set_scanout(crtc, 1);

spin_unlock_irqrestore(&tilcdc_crtc->irq_lock, irq_flags);

-- 
1.9.1



[PATCH 10/12] drm/tilcdc: make frame completion interrupt always enabled

2015-12-15 Thread Jyri Sarha
From: Darren Etheridge 

DRM allows vblank handling to be controlled dynamically. Therefore if
vblank interrupts are not needed by anybody they are disabled.
However on tilcdc a ping-pong dma is used and there is no way to find
out from the hardware which dma channel will be used for the next
frame to program the corresponding dma registers with the new
framebuffer address. The only way currently known is to use the vsync
handler to track the channel currently used. This means that disabling
the vsync is a bad idea because it is always needed to track the dma
channel.

This patch removes the enable/disable_vblank functions, moves the
enabling of the FRAME0/FRAME1_DONE interrupts into the
post_install_interrupt handler so they are always active and removes
the calls to drm_vblank_get, drm_vblank_put.

Signed-off-by: Darren Etheridge 
[Rewrapped descrription]
Signed-off-by: Jyri Sarha 
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c |  6 --
 drivers/gpu/drm/tilcdc/tilcdc_drv.c  | 26 +++---
 2 files changed, 3 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c 
b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index 720a43a..8543d6b 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -89,7 +89,6 @@ static void set_scanout(struct drm_crtc *crtc, int n)
 static void update_scanout(struct drm_crtc *crtc)
 {
struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc);
-   struct drm_device *dev = crtc->dev;
struct drm_framebuffer *fb = crtc->primary->fb;
struct drm_gem_cma_object *gem;
unsigned int depth, bpp;
@@ -120,8 +119,6 @@ static void update_scanout(struct drm_crtc *crtc)
tilcdc_crtc->dirty |= LCDC_END_OF_FRAME0;
set_scanout(crtc, 1);
}
-
-   drm_vblank_get(dev, 0);
} else {
/* not enabled yet, so update registers immediately: */
set_scanout(crtc, 0);
@@ -706,8 +703,6 @@ irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc)
drm_send_vblank_event(dev, 0, event);
spin_unlock_irqrestore(&dev->event_lock, flags);

-   if (dirty && !tilcdc_crtc->dirty)
-   drm_vblank_put(dev, 0);
}

if (priv->rev == 2) {
@@ -736,7 +731,6 @@ void tilcdc_crtc_cancel_page_flip(struct drm_crtc *crtc, 
struct drm_file *file)
if (event && event->base.file_priv == file) {
tilcdc_crtc->event = NULL;
event->base.destroy(&event->base);
-   drm_vblank_put(dev, 0);
}
spin_unlock_irqrestore(&dev->event_lock, flags);
 }
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c 
b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index f640b37..2b6d2dc 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -385,6 +385,8 @@ static int tilcdc_irq_postinstall(struct drm_device *dev)
else
tilcdc_set(dev, LCDC_INT_ENABLE_SET_REG,
   LCDC_V2_UNDERFLOW_INT_ENA |
+  LCDC_V2_END_OF_FRAME0_INT_ENA |
+  LCDC_V2_END_OF_FRAME1_INT_ENA |
   LCDC_FRAME_DONE);

return 0;
@@ -405,38 +407,16 @@ static void tilcdc_irq_uninstall(struct drm_device *dev)
LCDC_V2_END_OF_FRAME0_INT_ENA | 
LCDC_V2_END_OF_FRAME1_INT_ENA |
LCDC_FRAME_DONE);
}
-
-}
-
-static void enable_vblank(struct drm_device *dev, bool enable)
-{
-   struct tilcdc_drm_private *priv = dev->dev_private;
-   u32 reg, mask;
-
-   if (priv->rev == 1) {
-   reg = LCDC_DMA_CTRL_REG;
-   mask = LCDC_V1_END_OF_FRAME_INT_ENA;
-   } else {
-   reg = LCDC_INT_ENABLE_SET_REG;
-   mask = LCDC_V2_END_OF_FRAME0_INT_ENA |
-   LCDC_V2_END_OF_FRAME1_INT_ENA;
-   }
-
-   if (enable)
-   tilcdc_set(dev, reg, mask);
-   else
-   tilcdc_clear(dev, reg, mask);
 }

 static int tilcdc_enable_vblank(struct drm_device *dev, unsigned int pipe)
 {
-   enable_vblank(dev, true);
return 0;
 }

 static void tilcdc_disable_vblank(struct drm_device *dev, unsigned int pipe)
 {
-   enable_vblank(dev, false);
+   return;
 }

 #if defined(CONFIG_DEBUG_FS) || defined(CONFIG_PM_SLEEP)
-- 
1.9.1



[PATCH 12/12] drm/tilcdc: fix build error when !CONFIG_CPU_FREQ

2015-12-15 Thread Jyri Sarha
From: Grygorii Strashko 

Fix build error when !CONFIG_CPU_FREQ
drivers/gpu/drm/tilcdc/tilcdc_drv.c: In function 'tilcdc_load':
drivers/gpu/drm/tilcdc/tilcdc_drv.c:327:1: error: label 'fail_put_clk' defined 
but not used [-Werror=unused-label]
 fail_put_clk:
 ^

Signed-off-by: Grygorii Strashko 
Signed-off-by: Jyri Sarha 
---
 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 105d938..294e6c5 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -332,9 +332,9 @@ fail_cpufreq_unregister:
 #ifdef CONFIG_CPU_FREQ
cpufreq_unregister_notifier(&priv->freq_transition,
CPUFREQ_TRANSITION_NOTIFIER);
-#endif

 fail_put_clk:
+#endif
clk_put(priv->clk);

 fail_iounmap:
-- 
1.9.1



[PATCH 11/12] drm/tilcdc: Implement dma-buf support for tilcdc

2015-12-15 Thread Jyri Sarha
There is nothing special about tilcdc HW when the video memory is
concerned. Just using the standard drm helpers for implementation is
enough.

Signed-off-by: Jyri Sarha 
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c 
b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 2b6d2dc..105d938 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -536,7 +536,8 @@ static const struct file_operations fops = {
 };

 static struct drm_driver tilcdc_driver = {
-   .driver_features= DRIVER_HAVE_IRQ | DRIVER_GEM | DRIVER_MODESET,
+   .driver_features= (DRIVER_HAVE_IRQ | DRIVER_GEM | DRIVER_MODESET |
+  DRIVER_PRIME),
.load   = tilcdc_load,
.unload = tilcdc_unload,
.preclose   = tilcdc_preclose,
@@ -554,6 +555,16 @@ static struct drm_driver tilcdc_driver = {
.dumb_create= drm_gem_cma_dumb_create,
.dumb_map_offset= drm_gem_cma_dumb_map_offset,
.dumb_destroy   = drm_gem_dumb_destroy,
+
+   .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
+   .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
+   .gem_prime_import   = drm_gem_prime_import,
+   .gem_prime_export   = drm_gem_prime_export,
+   .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
+   .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
+   .gem_prime_vmap = drm_gem_cma_prime_vmap,
+   .gem_prime_vunmap   = drm_gem_cma_prime_vunmap,
+   .gem_prime_mmap = drm_gem_cma_prime_mmap,
 #ifdef CONFIG_DEBUG_FS
.debugfs_init   = tilcdc_debugfs_init,
.debugfs_cleanup= tilcdc_debugfs_cleanup,
-- 
1.9.1



[PATCH] Revert "drm: Stop resetting connector state to unknown"

2015-12-15 Thread Lyude
On Tue, 2015-12-15 at 13:42 -0500, Rob Clark wrote:
> On Tue, Dec 15, 2015 at 1:33 PM, Ville Syrjälä
>  wrote:
> > On Tue, Dec 15, 2015 at 01:23:06PM -0500, Rob Clark wrote:
> > > On Tue, Dec 15, 2015 at 1:07 PM, Lyude  wrote:
> > > > This reverts commit 5677d67ae394 ("drm: Stop resetting connector state
> > > > to
> > > > unknown")
> > > > 
> > > > Unfortunately, not resetting the connector status to unknown actually
> > > > breaks reprobing on suspend/resume in i915, which is important to have
> > > > working since it means a user docking their laptop in suspend won't have
> > > > their monitors work after resume. This commit was originally pushed to
> > > > fix
> > > > a bug with systemd[1], however said bug has already been fixed in
> > > > userspace.
> > > > 
> > > > Since "unknown" is technically a valid option to return to userspace for
> > > > a
> > > > connector's status, I would think that this sort of behavior should
> > > > probably be expected from userspace. Some good examples of this are the
> > > > radeon driver reporting "unknown" for connectors that have done
> > > > something
> > > > wonky during a hotplug event (e.g. part of the initialization of the
> > > > connector failed), and the omapdrm driver returns "unknown" for certain
> > > > connector types by default.
> > > > 
> > > > [1]: https://bugzilla.kernel.org/show_bug.cgi?id=100641
> > > > 
> > > > Signed-off-by: Lyude 
> > > > ---
> > > >  drivers/gpu/drm/drm_crtc.c | 7 ---
> > > >  1 file changed, 4 insertions(+), 3 deletions(-)
> > > > 
> > > > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> > > > index 24c5434..474e636 100644
> > > > --- a/drivers/gpu/drm/drm_crtc.c
> > > > +++ b/drivers/gpu/drm/drm_crtc.c
> > > > @@ -5312,11 +5312,12 @@ void drm_mode_config_reset(struct drm_device
> > > > *dev)
> > > >                 if (encoder->funcs->reset)
> > > >                         
> > > > encoder->funcs->reset(encoder);
> > > > 
> > > > -       mutex_lock(&dev->mode_config.mutex);
> > > > -       drm_for_each_connector(connector, dev)
> > > > +       list_for_each_entry(connector, 
> > > > &dev->mode_config.connector_list, 
> > > > head) {
> > > > +               connector->status = 
> > > > connector_status_unknown;
> > > > +
> > > >                 if (connector->funcs->reset)
> > > >                         
> > > > connector->funcs->reset(connector);
> > > > -       mutex_unlock(&dev->mode_config.mutex);
> > > > +       }
> > > >  }
> > > 
> > > looks like git-revert might have been a bit over-ambitious and
> > > clobbered a couple subsequent changes.. but that is easy enough to fix
> > > once we figure out what the right thing to do is.
> > > 
> > > Beyond that.. I'm not really sure how to apply the "do not break
> > > userspace" rule here.. since prior to
> > > c484f02d0f02fbbfc6decc945a69aae011041a27 userspace could see "unknown"
> > > for certain hardware.  But after that commit it could start seeing
> > > "unknown" for drivers/connectors that never would have returned
> > > "unknown" before.  If userspace had a problem with "unknown", it
> > > sounds like a userspace bug that was just unnoticed because no one
> > > tested on the right hardware.
> > > 
> > > But anyways, one idea to revert things to original behavior prior to
> > > c484f02d0f02fbbfc6decc945a69aae011041a27 (so at least userspace
> > > doesn't see 'unknown' for drivers/connectors that never used to report
> > > 'unknown') would be to do something roughly like this in
> > > status_show():
> > > 
> > >   if (status == unknown)
> > >      status = connector->funcs->detect(connector)
> > > 
> > > So I could go with either just reverting this commit, or reverting
> > > commit plus above change.  My $0.02 anyways..
> > 
> > Hmm. Or maybe leave the states alone, and just fire off the uevent
> > unconditionally and let userspace initiate the probe. That way we could
> > skip all ->detect() calls during resume for a bit of extra speed.
The current purpose of all of the detect() calls is to check whether or not it
would be appropriate to send the hotplug event (assuming you mean
drm_kms_helper_hotplug_event()), just so that we can save reprobing a display if
nothing changed. Anyway, if speed were an issue here we could just fire off a
worker so that the reprobing doesn't hold up the resume process.

While I'd be fine with just firing off a probe, I don't think it makes sense to
avoid having an unknown state here when numerous drivers already use unknown
states regularly, unless there was a reason other then the one mentioned in the
bugzilla for doing this.

> That is, iirc, something that Lyude suggested when we discussed in
> person (but I asked him to send revert patch just to start broader
*her please :)

> discussion on what the right solution would be).  Depending on
> userspace to reprobe s

[PATCH] Revert "drm: Stop resetting connector state to unknown"

2015-12-15 Thread Ville Syrjälä
On Tue, Dec 15, 2015 at 03:34:18PM -0500, Lyude wrote:
> On Tue, 2015-12-15 at 13:42 -0500, Rob Clark wrote:
> > On Tue, Dec 15, 2015 at 1:33 PM, Ville Syrjälä
> >  wrote:
> > > On Tue, Dec 15, 2015 at 01:23:06PM -0500, Rob Clark wrote:
> > > > On Tue, Dec 15, 2015 at 1:07 PM, Lyude  wrote:
> > > > > This reverts commit 5677d67ae394 ("drm: Stop resetting connector state
> > > > > to
> > > > > unknown")
> > > > > 
> > > > > Unfortunately, not resetting the connector status to unknown actually
> > > > > breaks reprobing on suspend/resume in i915, which is important to have
> > > > > working since it means a user docking their laptop in suspend won't 
> > > > > have
> > > > > their monitors work after resume. This commit was originally pushed to
> > > > > fix
> > > > > a bug with systemd[1], however said bug has already been fixed in
> > > > > userspace.
> > > > > 
> > > > > Since "unknown" is technically a valid option to return to userspace 
> > > > > for
> > > > > a
> > > > > connector's status, I would think that this sort of behavior should
> > > > > probably be expected from userspace. Some good examples of this are 
> > > > > the
> > > > > radeon driver reporting "unknown" for connectors that have done
> > > > > something
> > > > > wonky during a hotplug event (e.g. part of the initialization of the
> > > > > connector failed), and the omapdrm driver returns "unknown" for 
> > > > > certain
> > > > > connector types by default.
> > > > > 
> > > > > [1]: https://bugzilla.kernel.org/show_bug.cgi?id=100641
> > > > > 
> > > > > Signed-off-by: Lyude 
> > > > > ---
> > > > >  drivers/gpu/drm/drm_crtc.c | 7 ---
> > > > >  1 file changed, 4 insertions(+), 3 deletions(-)
> > > > > 
> > > > > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> > > > > index 24c5434..474e636 100644
> > > > > --- a/drivers/gpu/drm/drm_crtc.c
> > > > > +++ b/drivers/gpu/drm/drm_crtc.c
> > > > > @@ -5312,11 +5312,12 @@ void drm_mode_config_reset(struct drm_device
> > > > > *dev)
> > > > >                 if (encoder->funcs->reset)
> > > > >                         
> > > > > encoder->funcs->reset(encoder);
> > > > > 
> > > > > -       mutex_lock(&dev->mode_config.mutex);
> > > > > -       drm_for_each_connector(connector, dev)
> > > > > +       list_for_each_entry(connector, 
> > > > > &dev->mode_config.connector_list, 
> > > > > head) {
> > > > > +               connector->status = 
> > > > > connector_status_unknown;
> > > > > +
> > > > >                 if (connector->funcs->reset)
> > > > >                         
> > > > > connector->funcs->reset(connector);
> > > > > -       mutex_unlock(&dev->mode_config.mutex);
> > > > > +       }
> > > > >  }
> > > > 
> > > > looks like git-revert might have been a bit over-ambitious and
> > > > clobbered a couple subsequent changes.. but that is easy enough to fix
> > > > once we figure out what the right thing to do is.
> > > > 
> > > > Beyond that.. I'm not really sure how to apply the "do not break
> > > > userspace" rule here.. since prior to
> > > > c484f02d0f02fbbfc6decc945a69aae011041a27 userspace could see "unknown"
> > > > for certain hardware.  But after that commit it could start seeing
> > > > "unknown" for drivers/connectors that never would have returned
> > > > "unknown" before.  If userspace had a problem with "unknown", it
> > > > sounds like a userspace bug that was just unnoticed because no one
> > > > tested on the right hardware.
> > > > 
> > > > But anyways, one idea to revert things to original behavior prior to
> > > > c484f02d0f02fbbfc6decc945a69aae011041a27 (so at least userspace
> > > > doesn't see 'unknown' for drivers/connectors that never used to report
> > > > 'unknown') would be to do something roughly like this in
> > > > status_show():
> > > > 
> > > >   if (status == unknown)
> > > >      status = connector->funcs->detect(connector)
> > > > 
> > > > So I could go with either just reverting this commit, or reverting
> > > > commit plus above change.  My $0.02 anyways..
> > > 
> > > Hmm. Or maybe leave the states alone, and just fire off the uevent
> > > unconditionally and let userspace initiate the probe. That way we could
> > > skip all ->detect() calls during resume for a bit of extra speed.
> The current purpose of all of the detect() calls is to check whether or not it
> would be appropriate to send the hotplug event (assuming you mean
> drm_kms_helper_hotplug_event()), just so that we can save reprobing a display 
> if
> nothing changed. Anyway, if speed were an issue here we could just fire off a
> worker so that the reprobing doesn't hold up the resume process.

AFAICS if you force everything to unknown you are effectively forcing it
to send the uevent anyway (unless the probe actually returns "unknown"
for everything). Seems a bit pointless to do the probe at all when you
really 

[Bug 108561] nouveau: external monitor can not be enabled with hindsight

2015-12-15 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=108561

--- Comment #4 from Elmar Stellnberger  ---
Now I have tested it with the proprietary Nvidia 340.xx driver: s2ram works
flawlessly with the proprietary driver the external monitor getting re-enabled
normally. However the non-oss driver runs unstable on my machine and is not an
option. The bug is apparently a  driver issue and not a firmware/acpi problem.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[Bug 108561] nouveau: external monitor can not be enabled with hindsight

2015-12-15 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=108561

--- Comment #5 from Elmar Stellnberger  ---
Created attachment 197481
  --> https://bugzilla.kernel.org/attachment.cgi?id=197481&action=edit
clean journal under runlevel 1 with s2ram at last

Would anyone mind to have a look at the logs or propose any further actions?

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


  1   2   >