[Bug 94860] [radeonsi/amdgpu] screen is corrupted when logging out of kde

2016-05-30 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=94860

lumks at ymail.com changed:

   What|Removed |Added

 CC||lumks at ymail.com

--- Comment #4 from lumks at ymail.com ---
Created attachment 124194
  --> https://bugs.freedesktop.org/attachment.cgi?id=124194=edit
photo of wayland corruption

https://bugs.kde.org/show_bug.cgi?id=362788 is the bugreport on bko

aaand here is a pic from wayland session. maybe its related

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


[Bug 94860] [radeonsi/amdgpu] screen is corrupted when logging out of kde

2016-05-30 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=94860

--- Comment #3 from lumks at ymail.com ---
Same here. But not only Plasma logout dialog is effected. The whole wayland
session is. 

Also R9 380 with AMDGPU 1.1.0

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


[Bug 96271] TF2: GPU lockup on HD 7950

2016-05-30 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=96271

--- Comment #4 from Stephen Liang <hi+freedesktop at stephenliang.pw> ---
Here's the trace:
https://drive.google.com/file/d/0B9JbOVmvb9ugd3ZlbGJRUVFDdmc/view?usp=sharing

SHA Sum: 7a368bb2a95dd939df604e7c8f239953e2957ec9

The hang occurs near the end after the team selection screen while walking out.
If the GPU doesn't hang, then you'll see it stutter and then eventually
recover. This particular trace was with a GPU soft reset so it recovered. 

I'll see if I can get another one without GPU soft reset.

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


[Bug 96271] TF2: GPU lockup on HD 7950

2016-05-30 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=96271

--- Comment #3 from Nicolai Hähnle  ---
If the trace reproduces the hang at least occasionally, it may still be useful.
Can you upload it to Google Drive or a similar service?

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


[PATCH] drm/virtio: use old_state when disabling a plane

2016-05-30 Thread Gustavo Padovan
From: Gustavo Padovan 

When disabling a plane it current plane->state->crtc is NULL and thus
can't be used to to retrieve the crtc index. In this case we should get
the old_state->crtc and disable the plane on it.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/virtio/virtgpu_plane.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c 
b/drivers/gpu/drm/virtio/virtgpu_plane.c
index 70b44a2..ba1b679 100644
--- a/drivers/gpu/drm/virtio/virtgpu_plane.c
+++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
@@ -63,7 +63,7 @@ static void virtio_gpu_plane_atomic_update(struct drm_plane 
*plane,
 {
struct drm_device *dev = plane->dev;
struct virtio_gpu_device *vgdev = dev->dev_private;
-   struct virtio_gpu_output *output = 
drm_crtc_to_virtio_gpu_output(plane->crtc);
+   struct drm_crtc *crtc = plane->state->crtc ?: old_state->crtc;
struct virtio_gpu_framebuffer *vgfb;
struct virtio_gpu_object *bo;
uint32_t handle;
@@ -86,7 +86,7 @@ static void virtio_gpu_plane_atomic_update(struct drm_plane 
*plane,
DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d\n", handle,
  plane->state->crtc_w, plane->state->crtc_h,
  plane->state->crtc_x, plane->state->crtc_y);
-   virtio_gpu_cmd_set_scanout(vgdev, output->index, handle,
+   virtio_gpu_cmd_set_scanout(vgdev, drm_crtc_index(crtc), handle,
   plane->state->crtc_w,
   plane->state->crtc_h,
   plane->state->crtc_x,
-- 
2.5.5



[path v2 1/7] drm/hisilicon/hibmc: Add hisilicon hibmc drm master driver

2016-05-30 Thread Rongrong Zou
Sorry, forgot to add daniel at ffwll.ch to sendto list.

在 2016/5/30 20:09, Rongrong Zou 写道:
> Hi Daniel,
> Thanks for reveiwing!
>
> 在 2016/5/30 17:03, Daniel Vetter 写道:
>> On Sun, May 29, 2016 at 05:40:49PM +0800, Rongrong Zou wrote:
>>> Add DRM master driver for Hisilicon Hibmc SoC which used for
>>> Out-of-band management. Blow is the general hardware connection,
>>> both the Hibmc and the host CPU are on the same mother board.
>>>
>>> +--+   +--+
>>> |  | PCIe  |  Hibmc   |
>>> |host CPU( |<->| display  |
>>> |arm64,x86)|   |subsystem |
>>> +--+   +--+
>>>
>>> Signed-off-by: Rongrong Zou 
>>> Signed-off-by: Jianhua Li 
>>> ---
>>>   drivers/gpu/drm/hisilicon/Kconfig |   1 +
>>>   drivers/gpu/drm/hisilicon/Makefile|   3 +-
>>>   drivers/gpu/drm/hisilicon/hibmc/Kconfig   |  13 +
>>>   drivers/gpu/drm/hisilicon/hibmc/Makefile  |   4 +
>>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c   | 307 
>>> ++
>>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h   |  39 +++
>>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_power.c |  91 +++
>>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_power.h |  28 ++
>>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h  | 214 +++
>>>   9 files changed, 699 insertions(+), 1 deletion(-)
>>>   create mode 100644 drivers/gpu/drm/hisilicon/hibmc/Kconfig
>>>   create mode 100644 drivers/gpu/drm/hisilicon/hibmc/Makefile
>>>   create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>>>   create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
>>>   create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_power.c
>>>   create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_power.h
>>>   create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h
>>>
>>> diff --git a/drivers/gpu/drm/hisilicon/Kconfig 
>>> b/drivers/gpu/drm/hisilicon/Kconfig
>>> index 558c61b..2fd2724 100644
>>> --- a/drivers/gpu/drm/hisilicon/Kconfig
>>> +++ b/drivers/gpu/drm/hisilicon/Kconfig
>>> @@ -2,4 +2,5 @@
>>>   # hisilicon drm device configuration.
>>>   # Please keep this list sorted alphabetically
>>>
>>> +source "drivers/gpu/drm/hisilicon/hibmc/Kconfig"
>>>   source "drivers/gpu/drm/hisilicon/kirin/Kconfig"
>>> diff --git a/drivers/gpu/drm/hisilicon/Makefile 
>>> b/drivers/gpu/drm/hisilicon/Makefile
>>> index e3f6d49..4d7185c 100644
>>> --- a/drivers/gpu/drm/hisilicon/Makefile
>>> +++ b/drivers/gpu/drm/hisilicon/Makefile
>>> @@ -2,4 +2,5 @@
>>>   # Makefile for hisilicon drm drivers.
>>>   # Please keep this list sorted alphabetically
>>>
>>> -obj-$(CONFIG_DRM_HISI_KIRIN) += kirin/
>>> +obj-$(CONFIG_DRM_HISI_HIBMC) += hibmc/
>>> +obj-$(CONFIG_DRM_HISI_KIRIN) += kirin/
>>> \ No newline at end of file
>>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/Kconfig 
>>> b/drivers/gpu/drm/hisilicon/hibmc/Kconfig
>>> new file mode 100644
>>> index 000..1e7810d
>>> --- /dev/null
>>> +++ b/drivers/gpu/drm/hisilicon/hibmc/Kconfig
>>> @@ -0,0 +1,13 @@
>>> +config DRM_HISI_HIBMC
>>> +tristate "DRM Support for Hisilicon Hibmc"
>>> +depends on DRM && PCI
>>> +select DRM_KMS_HELPER
>>> +select DRM_KMS_FB_HELPER
>>> +select DRM_GEM_CMA_HELPER
>>> +select DRM_KMS_CMA_HELPER
>>> +select FB_SYS_FILLRECT
>>> +select FB_SYS_COPYAREA
>>> +select FB_SYS_IMAGEBLIT
>>> +help
>>> +  Choose this option if you have a Hisilicon Hibmc soc chipset.
>>> +  If M is selected the module will be called hibmc-drm.
>>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/Makefile 
>>> b/drivers/gpu/drm/hisilicon/hibmc/Makefile
>>> new file mode 100644
>>> index 000..533f9ed
>>> --- /dev/null
>>> +++ b/drivers/gpu/drm/hisilicon/hibmc/Makefile
>>> @@ -0,0 +1,4 @@
>>> +hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_power.o
>>> +
>>> +obj-$(CONFIG_DRM_HISI_HIBMC)+=hibmc-drm.o
>>> +#obj-y+= hibmc-drm.o
>>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c 
>>> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>>> new file mode 100644
>>> index 000..7eaacd8
>>> --- /dev/null
>>> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>>> @@ -0,0 +1,307 @@
>>> +/* Hisilicon Hibmc SoC drm driver
>>> + *
>>> + * Based on the bochs drm driver.
>>> + *
>>> + * Copyright (c) 2016 Huawei Limited.
>>> + *
>>> + * Author:
>>> + *Rongrong Zou 
>>> + *Rongrong Zou 
>>> + *Jianhua Li 
>>> + *
>>> + * This program is free software; you can redistribute it and/or modify
>>> + * it under the terms of the GNU General Public License as published by
>>> + * the Free Software Foundation; either version 2 of the License, or
>>> + * (at your option) any later version.
>>> + *
>>> + */
>>> +
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +
>>> +#include "hibmc_drm_drv.h"
>>> +#include "hibmc_drm_regs.h"
>>> +#include "hibmc_drm_power.h"
>>> +
>>> 

[Bug 93748] [r600g]OpenCL driver causes ImageMagick display command to segfault

2016-05-30 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93748

--- Comment #7 from nixscripter at gmail.com ---
I upgraded LLVM to r271203, past the version you suggested, and it does indeed
fix the issue! Thanks!

Closing as FIXED.

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


[Bug 93748] [r600g]OpenCL driver causes ImageMagick display command to segfault

2016-05-30 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93748

nixscripter at gmail.com changed:

   What|Removed |Added

Summary|[r600g]OpenCL driver causes |[r600g]OpenCL driver causes
   |ImageMagick to segfault |ImageMagick display command
   ||to segfault
 Status|NEW |RESOLVED
 Resolution|--- |FIXED

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


[RFC 04/21] drm: bridge/dw_hdmi: add dw hdmi i2c bus adapter support

2016-05-30 Thread Vladimir Zapolskiy
Hi Ulrich,

On 30.05.2016 19:00, Ulrich Hecht wrote:
> From: Vladimir Zapolskiy 
> 
> The change adds support of internal HDMI I2C master controller, this
> subdevice is used by default, if "ddc-i2c-bus" DT property is omitted.
> 
> The main purpose of this functionality is to support reading EDID from
> an HDMI monitor on boards, which don't have an I2C bus connected to
> DDC pins.
> 
> Signed-off-by: Vladimir Zapolskiy 
> Signed-off-by: Koji Matsuoka 
> Signed-off-by: Geert Uytterhoeven 
> ---

thank you for pushing it, this is v3 of the change, right?

I think it might be better to consider to take the latest v5, it has
updated documentation notes, various improvements based on review from
Russell King, Doug Anderson and Philipp Zabel:

  http://www.spinics.net/lists/arm-kernel/msg447954.html

Still you may find it a bit outdated and it may require rebase, the change
was based on v4.3.0-rc3. Please let me know, if I can provide you support
of any kind regarding the change.

--
With best wishes,
Vladimir


[PATCH] drm/exynos: fimd: don't set .has_hw_trigger in s3c6400 driver data

2016-05-30 Thread Javier Martinez Canillas
The field value is only checked in fimd_setup_trigger() if .trg_type is
I80_HW_TRG so there's no point in setting this field for the s3c6400 if
is never going to be used since .trg_type is not set.

Signed-off-by: Javier Martinez Canillas 
---

 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 3efe1aa89416..1c23a8ff5e83 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -120,7 +120,6 @@ static struct fimd_driver_data s3c64xx_fimd_driver_data = {
.timing_base = 0x0,
.has_clksel = 1,
.has_limited_fmt = 1,
-   .has_hw_trigger = 1,
 };

 static struct fimd_driver_data exynos3_fimd_driver_data = {
-- 
2.5.5



[path v2 1/7] drm/hisilicon/hibmc: Add hisilicon hibmc drm master driver

2016-05-30 Thread Rongrong Zou
Hi Daniel,
Thanks for reveiwing!

在 2016/5/30 17:03, Daniel Vetter 写道:
> On Sun, May 29, 2016 at 05:40:49PM +0800, Rongrong Zou wrote:
>> Add DRM master driver for Hisilicon Hibmc SoC which used for
>> Out-of-band management. Blow is the general hardware connection,
>> both the Hibmc and the host CPU are on the same mother board.
>>
>> +--+   +--+
>> |  | PCIe  |  Hibmc   |
>> |host CPU( |<->| display  |
>> |arm64,x86)|   |subsystem |
>> +--+   +--+
>>
>> Signed-off-by: Rongrong Zou 
>> Signed-off-by: Jianhua Li 
>> ---
>>   drivers/gpu/drm/hisilicon/Kconfig |   1 +
>>   drivers/gpu/drm/hisilicon/Makefile|   3 +-
>>   drivers/gpu/drm/hisilicon/hibmc/Kconfig   |  13 +
>>   drivers/gpu/drm/hisilicon/hibmc/Makefile  |   4 +
>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c   | 307 
>> ++
>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h   |  39 +++
>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_power.c |  91 +++
>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_power.h |  28 ++
>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h  | 214 +++
>>   9 files changed, 699 insertions(+), 1 deletion(-)
>>   create mode 100644 drivers/gpu/drm/hisilicon/hibmc/Kconfig
>>   create mode 100644 drivers/gpu/drm/hisilicon/hibmc/Makefile
>>   create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>>   create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
>>   create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_power.c
>>   create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_power.h
>>   create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h
>>
>> diff --git a/drivers/gpu/drm/hisilicon/Kconfig 
>> b/drivers/gpu/drm/hisilicon/Kconfig
>> index 558c61b..2fd2724 100644
>> --- a/drivers/gpu/drm/hisilicon/Kconfig
>> +++ b/drivers/gpu/drm/hisilicon/Kconfig
>> @@ -2,4 +2,5 @@
>>   # hisilicon drm device configuration.
>>   # Please keep this list sorted alphabetically
>>
>> +source "drivers/gpu/drm/hisilicon/hibmc/Kconfig"
>>   source "drivers/gpu/drm/hisilicon/kirin/Kconfig"
>> diff --git a/drivers/gpu/drm/hisilicon/Makefile 
>> b/drivers/gpu/drm/hisilicon/Makefile
>> index e3f6d49..4d7185c 100644
>> --- a/drivers/gpu/drm/hisilicon/Makefile
>> +++ b/drivers/gpu/drm/hisilicon/Makefile
>> @@ -2,4 +2,5 @@
>>   # Makefile for hisilicon drm drivers.
>>   # Please keep this list sorted alphabetically
>>
>> -obj-$(CONFIG_DRM_HISI_KIRIN) += kirin/
>> +obj-$(CONFIG_DRM_HISI_HIBMC) += hibmc/
>> +obj-$(CONFIG_DRM_HISI_KIRIN) += kirin/
>> \ No newline at end of file
>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/Kconfig 
>> b/drivers/gpu/drm/hisilicon/hibmc/Kconfig
>> new file mode 100644
>> index 000..1e7810d
>> --- /dev/null
>> +++ b/drivers/gpu/drm/hisilicon/hibmc/Kconfig
>> @@ -0,0 +1,13 @@
>> +config DRM_HISI_HIBMC
>> +tristate "DRM Support for Hisilicon Hibmc"
>> +depends on DRM && PCI
>> +select DRM_KMS_HELPER
>> +select DRM_KMS_FB_HELPER
>> +select DRM_GEM_CMA_HELPER
>> +select DRM_KMS_CMA_HELPER
>> +select FB_SYS_FILLRECT
>> +select FB_SYS_COPYAREA
>> +select FB_SYS_IMAGEBLIT
>> +help
>> +  Choose this option if you have a Hisilicon Hibmc soc chipset.
>> +  If M is selected the module will be called hibmc-drm.
>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/Makefile 
>> b/drivers/gpu/drm/hisilicon/hibmc/Makefile
>> new file mode 100644
>> index 000..533f9ed
>> --- /dev/null
>> +++ b/drivers/gpu/drm/hisilicon/hibmc/Makefile
>> @@ -0,0 +1,4 @@
>> +hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_power.o
>> +
>> +obj-$(CONFIG_DRM_HISI_HIBMC)+=hibmc-drm.o
>> +#obj-y  += hibmc-drm.o
>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c 
>> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>> new file mode 100644
>> index 000..7eaacd8
>> --- /dev/null
>> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>> @@ -0,0 +1,307 @@
>> +/* Hisilicon Hibmc SoC drm driver
>> + *
>> + * Based on the bochs drm driver.
>> + *
>> + * Copyright (c) 2016 Huawei Limited.
>> + *
>> + * Author:
>> + *  Rongrong Zou 
>> + *  Rongrong Zou 
>> + *  Jianhua Li 
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License as published by
>> + * the Free Software Foundation; either version 2 of the License, or
>> + * (at your option) any later version.
>> + *
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include "hibmc_drm_drv.h"
>> +#include "hibmc_drm_regs.h"
>> +#include "hibmc_drm_power.h"
>> +
>> +static const struct file_operations hibmc_fops = {
>> +.owner  = THIS_MODULE,
>> +.open   = drm_open,
>> +.release= drm_release,
>> +.unlocked_ioctl = drm_ioctl,
>> +#ifdef CONFIG_COMPAT
>> +

[PATCH 27/27] drm/mediatek: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Philipp Zabel 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c 
b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index b1223d54d0ab..06a417b2f91e 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -243,7 +243,7 @@ static struct drm_driver mtk_drm_driver = {
.enable_vblank = mtk_drm_crtc_enable_vblank,
.disable_vblank = mtk_drm_crtc_disable_vblank,

-   .gem_free_object = mtk_drm_gem_free_object,
+   .gem_free_object_unlocked = mtk_drm_gem_free_object,
.gem_vm_ops = _gem_cma_vm_ops,
.dumb_create = mtk_drm_gem_dumb_create,
.dumb_map_offset = mtk_drm_gem_dumb_map_offset,
-- 
2.8.1



[PATCH 26/27] drm/hisilicon: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Xinliang Liu 
Cc: Xinwei Kong 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
index 3f94785fbcca..193657259ee9 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
@@ -173,7 +173,7 @@ static struct drm_driver kirin_drm_driver = {
.fops   = _drm_fops,
.set_busid  = drm_platform_set_busid,

-   .gem_free_object= drm_gem_cma_free_object,
+   .gem_free_object_unlocked = drm_gem_cma_free_object,
.gem_vm_ops = _gem_cma_vm_ops,
.dumb_create= kirin_gem_cma_dumb_create,
.dumb_map_offset= drm_gem_cma_dumb_map_offset,
-- 
2.8.1



[PATCH 25/27] drm/hlcd: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Liviu Dudau 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/arm/hdlcd_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index b987c63ba8d6..4f909378d581 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -316,7 +316,7 @@ static struct drm_driver hdlcd_driver = {
.get_vblank_counter = drm_vblank_no_hw_counter,
.enable_vblank = hdlcd_enable_vblank,
.disable_vblank = hdlcd_disable_vblank,
-   .gem_free_object = drm_gem_cma_free_object,
+   .gem_free_object_unlocked = drm_gem_cma_free_object,
.gem_vm_ops = _gem_cma_vm_ops,
.dumb_create = drm_gem_cma_dumb_create,
.dumb_map_offset = drm_gem_cma_dumb_map_offset,
-- 
2.8.1



[PATCH 24/27] drm/arcpgu: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Alexey Brodkin 
Cc: Carlos Palminha 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/arc/arcpgu_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
index 76e187a5bde0..bc53ebb83f75 100644
--- a/drivers/gpu/drm/arc/arcpgu_drv.c
+++ b/drivers/gpu/drm/arc/arcpgu_drv.c
@@ -207,7 +207,7 @@ static struct drm_driver arcpgu_drm_driver = {
.get_vblank_counter = drm_vblank_no_hw_counter,
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-   .gem_free_object = drm_gem_cma_free_object,
+   .gem_free_object_unlocked = drm_gem_cma_free_object,
.gem_vm_ops = _gem_cma_vm_ops,
.gem_prime_export = drm_gem_prime_export,
.gem_prime_import = drm_gem_prime_import,
-- 
2.8.1



[PATCH 23/27] drm/sun4i: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Maxime Ripard 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/sun4i/sun4i_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c 
b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 76e922bb60e5..68e9d85085fb 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -103,7 +103,7 @@ static struct drm_driver sun4i_drv_driver = {
.dumb_create= drm_gem_cma_dumb_create,
.dumb_destroy   = drm_gem_dumb_destroy,
.dumb_map_offset= drm_gem_cma_dumb_map_offset,
-   .gem_free_object= drm_gem_cma_free_object,
+   .gem_free_object_unlocked = drm_gem_cma_free_object,
.gem_vm_ops = _gem_cma_vm_ops,

/* PRIME Operations */
-- 
2.8.1



[PATCH 22/27] drm/omapdrm: Nuke dummy fb->dirty callback

2016-05-30 Thread Daniel Vetter
It's an optional hook.

Cc: Tomi Valkeinen 
Cc: Laurent Pinchart 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/omapdrm/omap_fb.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c 
b/drivers/gpu/drm/omapdrm/omap_fb.c
index 94ec06d3d737..d639707f67db 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -120,17 +120,9 @@ static void omap_framebuffer_destroy(struct 
drm_framebuffer *fb)
kfree(omap_fb);
 }

-static int omap_framebuffer_dirty(struct drm_framebuffer *fb,
-   struct drm_file *file_priv, unsigned flags, unsigned color,
-   struct drm_clip_rect *clips, unsigned num_clips)
-{
-   return 0;
-}
-
 static const struct drm_framebuffer_funcs omap_framebuffer_funcs = {
.create_handle = omap_framebuffer_create_handle,
.destroy = omap_framebuffer_destroy,
-   .dirty = omap_framebuffer_dirty,
 };

 static uint32_t get_linear_addr(struct plane *plane,
-- 
2.8.1



[PATCH 21/27] drm/msm: Nuke dummy fb->dirty callback

2016-05-30 Thread Daniel Vetter
It's an optional hook.

Cc: Rob Clark 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/msm/msm_fb.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c
index 461dc8b873f0..7919c24c6ddd 100644
--- a/drivers/gpu/drm/msm/msm_fb.c
+++ b/drivers/gpu/drm/msm/msm_fb.c
@@ -56,17 +56,9 @@ static void msm_framebuffer_destroy(struct drm_framebuffer 
*fb)
kfree(msm_fb);
 }

-static int msm_framebuffer_dirty(struct drm_framebuffer *fb,
-   struct drm_file *file_priv, unsigned flags, unsigned color,
-   struct drm_clip_rect *clips, unsigned num_clips)
-{
-   return 0;
-}
-
 static const struct drm_framebuffer_funcs msm_framebuffer_funcs = {
.create_handle = msm_framebuffer_create_handle,
.destroy = msm_framebuffer_destroy,
-   .dirty = msm_framebuffer_dirty,
 };

 #ifdef CONFIG_DEBUG_FS
-- 
2.8.1



[PATCH 20/27] drm/rockchip: Use cma gem vm ops

2016-05-30 Thread Daniel Vetter
No need to reinvent this little wheel.

v2: Like, try to make it compile even.

Cc: Mark Yao 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index b0779261721f..09a4d429c0f0 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -300,11 +301,6 @@ static const struct file_operations 
rockchip_drm_driver_fops = {
.release = drm_release,
 };

-const struct vm_operations_struct rockchip_drm_vm_ops = {
-   .open = drm_gem_vm_open,
-   .close = drm_gem_vm_close,
-};
-
 static struct drm_driver rockchip_drm_driver = {
.driver_features= DRIVER_MODESET | DRIVER_GEM |
  DRIVER_PRIME | DRIVER_ATOMIC,
@@ -315,7 +311,7 @@ static struct drm_driver rockchip_drm_driver = {
.get_vblank_counter = drm_vblank_no_hw_counter,
.enable_vblank  = rockchip_drm_crtc_enable_vblank,
.disable_vblank = rockchip_drm_crtc_disable_vblank,
-   .gem_vm_ops = _drm_vm_ops,
+   .gem_vm_ops = _gem_cma_vm_ops,
.gem_free_object_unlocked = rockchip_gem_free_object,
.dumb_create= rockchip_gem_dumb_create,
.dumb_map_offset= rockchip_gem_dumb_map_offset,
-- 
2.8.1



[PATCH 19/27] drm/virtio: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
With Benjanim's patch to remove the dev->struct_mutex cargo cult the
sti driver is now also entirely legacy locking free. Let's convert it
too.

Cc: Benjamin Gaignard 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/sti/sti_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 1b8dd9e7829d..b440617a7019 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -304,7 +304,7 @@ static struct drm_driver sti_driver = {
.driver_features = DRIVER_HAVE_IRQ | DRIVER_MODESET |
DRIVER_GEM | DRIVER_PRIME | DRIVER_ATOMIC,
.load = sti_load,
-   .gem_free_object = drm_gem_cma_free_object,
+   .gem_free_object_unlocked = drm_gem_cma_free_object,
.gem_vm_ops = _gem_cma_vm_ops,
.dumb_create = drm_gem_cma_dumb_create,
.dumb_map_offset = drm_gem_cma_dumb_map_offset,
-- 
2.8.1



[PATCH 18/27] drm: sti: remove useless call to dev->struct_mutex

2016-05-30 Thread Daniel Vetter
From: Benjamin Gaignard 

No need to protect debugfs functions with dev->struct_mutex

Signed-off-by: Benjamin Gaignard 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/sti/sti_cursor.c |  7 ---
 drivers/gpu/drm/sti/sti_drv.c|  6 --
 drivers/gpu/drm/sti/sti_dvo.c|  7 ---
 drivers/gpu/drm/sti/sti_gdp.c| 14 --
 drivers/gpu/drm/sti/sti_hda.c|  7 ---
 drivers/gpu/drm/sti/sti_hdmi.c   |  7 ---
 drivers/gpu/drm/sti/sti_hqvdp.c  |  7 ---
 drivers/gpu/drm/sti/sti_mixer.c  |  7 ---
 drivers/gpu/drm/sti/sti_tvout.c  |  7 ---
 drivers/gpu/drm/sti/sti_vid.c|  7 ---
 10 files changed, 76 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c
index 4e990299735c..53aa0029295b 100644
--- a/drivers/gpu/drm/sti/sti_cursor.c
+++ b/drivers/gpu/drm/sti/sti_cursor.c
@@ -105,12 +105,6 @@ static int cursor_dbg_show(struct seq_file *s, void *data)
 {
struct drm_info_node *node = s->private;
struct sti_cursor *cursor = (struct sti_cursor *)node->info_ent->data;
-   struct drm_device *dev = node->minor->dev;
-   int ret;
-
-   ret = mutex_lock_interruptible(>struct_mutex);
-   if (ret)
-   return ret;

seq_printf(s, "%s: (vaddr = 0x%p)",
   sti_plane_to_str(>plane), cursor->regs);
@@ -129,7 +123,6 @@ static int cursor_dbg_show(struct seq_file *s, void *data)
DBGFS_DUMP(CUR_AWE);
seq_puts(s, "\n");

-   mutex_unlock(>struct_mutex);
return 0;
 }

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 872495e72294..1b8dd9e7829d 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -72,11 +72,6 @@ static int sti_drm_fps_dbg_show(struct seq_file *s, void 
*data)
struct drm_info_node *node = s->private;
struct drm_device *dev = node->minor->dev;
struct drm_plane *p;
-   int ret;
-
-   ret = mutex_lock_interruptible(>struct_mutex);
-   if (ret)
-   return ret;

list_for_each_entry(p, >mode_config.plane_list, head) {
struct sti_plane *plane = to_sti_plane(p);
@@ -86,7 +81,6 @@ static int sti_drm_fps_dbg_show(struct seq_file *s, void 
*data)
   plane->fps_info.fips_str);
}

-   mutex_unlock(>struct_mutex);
return 0;
 }

diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index 25f76632002c..d439128e6309 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -177,12 +177,6 @@ static int dvo_dbg_show(struct seq_file *s, void *data)
 {
struct drm_info_node *node = s->private;
struct sti_dvo *dvo = (struct sti_dvo *)node->info_ent->data;
-   struct drm_device *dev = node->minor->dev;
-   int ret;
-
-   ret = mutex_lock_interruptible(>struct_mutex);
-   if (ret)
-   return ret;

seq_printf(s, "DVO: (vaddr = 0x%p)", dvo->regs);
DBGFS_DUMP(DVO_AWG_DIGSYNC_CTRL);
@@ -193,7 +187,6 @@ static int dvo_dbg_show(struct seq_file *s, void *data)
dvo_dbg_awg_microcode(s, dvo->regs + DVO_DIGSYNC_INSTR_I);
seq_puts(s, "\n");

-   mutex_unlock(>struct_mutex);
return 0;
 }

diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index ff33c38da197..fdf69b5a041b 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -208,14 +208,8 @@ static int gdp_dbg_show(struct seq_file *s, void *data)
 {
struct drm_info_node *node = s->private;
struct sti_gdp *gdp = (struct sti_gdp *)node->info_ent->data;
-   struct drm_device *dev = node->minor->dev;
struct drm_plane *drm_plane = >plane.drm_plane;
struct drm_crtc *crtc = drm_plane->crtc;
-   int ret;
-
-   ret = mutex_lock_interruptible(>struct_mutex);
-   if (ret)
-   return ret;

seq_printf(s, "%s: (vaddr = 0x%p)",
   sti_plane_to_str(>plane), gdp->regs);
@@ -248,7 +242,6 @@ static int gdp_dbg_show(struct seq_file *s, void *data)
seq_printf(s, "  Connected to DRM CRTC #%d (%s)\n",
   crtc->base.id, sti_mixer_to_str(to_sti_mixer(crtc)));

-   mutex_unlock(>struct_mutex);
return 0;
 }

@@ -279,13 +272,7 @@ static int gdp_node_dbg_show(struct seq_file *s, void *arg)
 {
struct drm_info_node *node = s->private;
struct sti_gdp *gdp = (struct sti_gdp *)node->info_ent->data;
-   struct drm_device *dev = node->minor->dev;
unsigned int b;
-   int ret;
-
-   ret = mutex_lock_interruptible(>struct_mutex);
-   if (ret)
-   return ret;

for (b = 0; b < GDP_NODE_NB_BANK; b++) {
seq_printf(s, "\n%s[%d].top", sti_plane_to_str(>plane), b);
@@ -294,7 +281,6 @@ static int gdp_node_dbg_show(struct seq_file *s, void *arg)

[PATCH 17/27] drm/virtio: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Gerd Hoffmann 
Cc: David Airlie 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/virtio/virtgpu_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c 
b/drivers/gpu/drm/virtio/virtgpu_drv.c
index 3cc7afa77a35..5820b7020ae5 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.c
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
@@ -143,7 +143,7 @@ static struct drm_driver driver = {
.gem_prime_vunmap = virtgpu_gem_prime_vunmap,
.gem_prime_mmap = virtgpu_gem_prime_mmap,

-   .gem_free_object = virtio_gpu_gem_free_object,
+   .gem_free_object_unlocked = virtio_gpu_gem_free_object,
.gem_open_object = virtio_gpu_gem_object_open,
.gem_close_object = virtio_gpu_gem_object_close,
.fops = _gpu_driver_fops,
-- 
2.8.1



[PATCH 16/27] drm/vgem: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: seanpaul at chromium.org
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/vgem/vgem_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
index 341f9be3dde6..1b4cc8b27080 100644
--- a/drivers/gpu/drm/vgem/vgem_drv.c
+++ b/drivers/gpu/drm/vgem/vgem_drv.c
@@ -235,7 +235,7 @@ static const struct file_operations vgem_driver_fops = {

 static struct drm_driver vgem_driver = {
.driver_features= DRIVER_GEM,
-   .gem_free_object= vgem_gem_free_object,
+   .gem_free_object_unlocked   = vgem_gem_free_object,
.gem_vm_ops = _gem_vm_ops,
.ioctls = vgem_ioctls,
.fops   = _driver_fops,
-- 
2.8.1



[PATCH 15/27] drm/vc4: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Eric Anholt 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/vc4/vc4_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 143dd98aa079..b662d0492471 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -99,7 +99,7 @@ static struct drm_driver vc4_drm_driver = {
 #endif

.gem_create_object = vc4_create_object,
-   .gem_free_object = vc4_free_object,
+   .gem_free_object_unlocked = vc4_free_object,
.gem_vm_ops = _gem_cma_vm_ops,

.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
-- 
2.8.1



[PATCH 14/27] drm/vc4: Use drm_gem_object_unreference_unlocked

2016-05-30 Thread Daniel Vetter
Since my last struct_mutex crusade someone escaped!

This already has the advantage that for the common case when someone
else holds a ref the unref won't even acquire dev->struct_mutex. And
I'm working on code to allow drivers to completely opt-out of any and
all dev->struct_mutex usage, but that only works if they use the
_unlocked variants everywhere.

v2: Drop comment too.

v3: Drop the other comment too.

Cc: Eric Anholt 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/vc4/vc4_bo.c  |  2 --
 drivers/gpu/drm/vc4/vc4_gem.c | 11 +++
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
index e5a9d3aaf45f..59adcf8532dd 100644
--- a/drivers/gpu/drm/vc4/vc4_bo.c
+++ b/drivers/gpu/drm/vc4/vc4_bo.c
@@ -291,8 +291,6 @@ static void vc4_bo_cache_free_old(struct drm_device *dev)

 /* Called on the last userspace/kernel unreference of the BO.  Returns
  * it to the BO cache if possible, otherwise frees it.
- *
- * Note that this is called with the struct_mutex held.
  */
 void vc4_free_object(struct drm_gem_object *gem_bo)
 {
diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
index 46899d6de675..6155e8aca1c6 100644
--- a/drivers/gpu/drm/vc4/vc4_gem.c
+++ b/drivers/gpu/drm/vc4/vc4_gem.c
@@ -53,10 +53,8 @@ vc4_free_hang_state(struct drm_device *dev, struct 
vc4_hang_state *state)
 {
unsigned int i;

-   mutex_lock(>struct_mutex);
for (i = 0; i < state->user_state.bo_count; i++)
-   drm_gem_object_unreference(state->bo[i]);
-   mutex_unlock(>struct_mutex);
+   drm_gem_object_unreference_unlocked(state->bo[i]);

kfree(state);
 }
@@ -687,11 +685,9 @@ vc4_complete_exec(struct drm_device *dev, struct 
vc4_exec_info *exec)
struct vc4_dev *vc4 = to_vc4_dev(dev);
unsigned i;

-   /* Need the struct lock for drm_gem_object_unreference(). */
-   mutex_lock(>struct_mutex);
if (exec->bo) {
for (i = 0; i < exec->bo_count; i++)
-   drm_gem_object_unreference(>bo[i]->base);
+   drm_gem_object_unreference_unlocked(>bo[i]->base);
kfree(exec->bo);
}

@@ -699,9 +695,8 @@ vc4_complete_exec(struct drm_device *dev, struct 
vc4_exec_info *exec)
struct vc4_bo *bo = list_first_entry(>unref_list,
 struct vc4_bo, unref_head);
list_del(>unref_head);
-   drm_gem_object_unreference(>base.base);
+   drm_gem_object_unreference_unlocked(>base.base);
}
-   mutex_unlock(>struct_mutex);

mutex_lock(>power_lock);
if (--vc4->power_refcount == 0)
-- 
2.8.1



[PATCH 13/27] drm/tilcdc: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Tomi Valkeinen 
Signed-off-by: Daniel Vetter 
---
 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 709bc903524d..308e197908fc 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -549,7 +549,7 @@ static struct drm_driver tilcdc_driver = {
.get_vblank_counter = drm_vblank_no_hw_counter,
.enable_vblank  = tilcdc_enable_vblank,
.disable_vblank = tilcdc_disable_vblank,
-   .gem_free_object= drm_gem_cma_free_object,
+   .gem_free_object_unlocked = drm_gem_cma_free_object,
.gem_vm_ops = _gem_cma_vm_ops,
.dumb_create= drm_gem_cma_dumb_create,
.dumb_map_offset= drm_gem_cma_dumb_map_offset,
-- 
2.8.1



[PATCH 12/27] drm/shmob: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Laurent Pinchart 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/shmobile/shmob_drm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c 
b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
index 7700ff172079..ee79264b5b6a 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
@@ -264,7 +264,7 @@ static struct drm_driver shmob_drm_driver = {
.get_vblank_counter = drm_vblank_no_hw_counter,
.enable_vblank  = shmob_drm_enable_vblank,
.disable_vblank = shmob_drm_disable_vblank,
-   .gem_free_object= drm_gem_cma_free_object,
+   .gem_free_object_unlocked = drm_gem_cma_free_object,
.gem_vm_ops = _gem_cma_vm_ops,
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-- 
2.8.1



[PATCH 11/27] drm/rockchip: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Mark Yao 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index a409d1f703cb..b0779261721f 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -316,7 +316,7 @@ static struct drm_driver rockchip_drm_driver = {
.enable_vblank  = rockchip_drm_crtc_enable_vblank,
.disable_vblank = rockchip_drm_crtc_disable_vblank,
.gem_vm_ops = _drm_vm_ops,
-   .gem_free_object= rockchip_gem_free_object,
+   .gem_free_object_unlocked = rockchip_gem_free_object,
.dumb_create= rockchip_gem_dumb_create,
.dumb_map_offset= rockchip_gem_dumb_map_offset,
.dumb_destroy   = drm_gem_dumb_destroy,
-- 
2.8.1



[PATCH 10/27] drm/rcar-du: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Laurent Pinchart 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/rcar-du/rcar_du_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c 
b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index fb9242d27883..48ec4b6e8b26 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -217,7 +217,7 @@ static struct drm_driver rcar_du_driver = {
.get_vblank_counter = drm_vblank_no_hw_counter,
.enable_vblank  = rcar_du_enable_vblank,
.disable_vblank = rcar_du_disable_vblank,
-   .gem_free_object= drm_gem_cma_free_object,
+   .gem_free_object_unlocked = drm_gem_cma_free_object,
.gem_vm_ops = _gem_cma_vm_ops,
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-- 
2.8.1



[PATCH 09/27] drm/qxl: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Dave Airlie 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/qxl/qxl_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c
index dc9df5fe50ba..460bbceae297 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.c
+++ b/drivers/gpu/drm/qxl/qxl_drv.c
@@ -256,7 +256,7 @@ static struct drm_driver qxl_driver = {
.gem_prime_vmap = qxl_gem_prime_vmap,
.gem_prime_vunmap = qxl_gem_prime_vunmap,
.gem_prime_mmap = qxl_gem_prime_mmap,
-   .gem_free_object = qxl_gem_object_free,
+   .gem_free_object_unlocked = qxl_gem_object_free,
.gem_open_object = qxl_gem_object_open,
.gem_close_object = qxl_gem_object_close,
.fops = _fops,
-- 
2.8.1



[PATCH 08/27] drm/nouveau: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Ben Skeggs 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 11f8dd9c0edb..d17a969fbd51 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -970,7 +970,7 @@ driver_stub = {
.gem_prime_vmap = nouveau_gem_prime_vmap,
.gem_prime_vunmap = nouveau_gem_prime_vunmap,

-   .gem_free_object = nouveau_gem_object_del,
+   .gem_free_object_unlocked = nouveau_gem_object_del,
.gem_open_object = nouveau_gem_object_open,
.gem_close_object = nouveau_gem_object_close,

-- 
2.8.1



[PATCH 07/27] drm/mga200g: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Dave Airlie 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/mgag200/mgag200_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c 
b/drivers/gpu/drm/mgag200/mgag200_drv.c
index ebb470ff7200..2b4b125eebc3 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.c
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
@@ -101,7 +101,7 @@ static struct drm_driver driver = {
.minor = DRIVER_MINOR,
.patchlevel = DRIVER_PATCHLEVEL,

-   .gem_free_object = mgag200_gem_free_object,
+   .gem_free_object_unlocked = mgag200_gem_free_object,
.dumb_create = mgag200_dumb_create,
.dumb_map_offset = mgag200_dumb_mmap_offset,
.dumb_destroy = drm_gem_dumb_destroy,
-- 
2.8.1



[PATCH 06/27] drm/fls-dcu: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Jianwei Wang 
Cc: Stefan Agner 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 0ec1ad961e0d..33727d5d826a 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -198,7 +198,7 @@ static struct drm_driver fsl_dcu_drm_driver = {
.get_vblank_counter = drm_vblank_no_hw_counter,
.enable_vblank  = fsl_dcu_drm_enable_vblank,
.disable_vblank = fsl_dcu_drm_disable_vblank,
-   .gem_free_object= drm_gem_cma_free_object,
+   .gem_free_object_unlocked = drm_gem_cma_free_object,
.gem_vm_ops = _gem_cma_vm_ops,
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-- 
2.8.1



[PATCH 05/27] drm/cirrus: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Dave Airlie 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/cirrus/cirrus_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c 
b/drivers/gpu/drm/cirrus/cirrus_drv.c
index dc83f69da6f1..b05f7eae32ce 100644
--- a/drivers/gpu/drm/cirrus/cirrus_drv.c
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
@@ -142,7 +142,7 @@ static struct drm_driver driver = {
.major = DRIVER_MAJOR,
.minor = DRIVER_MINOR,
.patchlevel = DRIVER_PATCHLEVEL,
-   .gem_free_object = cirrus_gem_free_object,
+   .gem_free_object_unlocked = cirrus_gem_free_object,
.dumb_create = cirrus_dumb_create,
.dumb_map_offset = cirrus_dumb_mmap_offset,
.dumb_destroy = drm_gem_dumb_destroy,
-- 
2.8.1



[PATCH 04/27] drm/bochs: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Gerd Hoffmann 
Cc: Dave Airlie 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/bochs/bochs_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bochs/bochs_drv.c 
b/drivers/gpu/drm/bochs/bochs_drv.c
index b332b4d3b0e2..abace82de6ea 100644
--- a/drivers/gpu/drm/bochs/bochs_drv.c
+++ b/drivers/gpu/drm/bochs/bochs_drv.c
@@ -89,7 +89,7 @@ static struct drm_driver bochs_driver = {
.date   = "20130925",
.major  = 1,
.minor  = 0,
-   .gem_free_object= bochs_gem_free_object,
+   .gem_free_object_unlocked = bochs_gem_free_object,
.dumb_create= bochs_dumb_create,
.dumb_map_offset= bochs_dumb_mmap_offset,
.dumb_destroy   = drm_gem_dumb_destroy,
-- 
2.8.1



[PATCH 03/27] drm/atmel: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Boris Brezillon 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c 
b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index 8ded7645747e..6485fa5bee8b 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -776,7 +776,7 @@ static struct drm_driver atmel_hlcdc_dc_driver = {
.get_vblank_counter = drm_vblank_no_hw_counter,
.enable_vblank = atmel_hlcdc_dc_enable_vblank,
.disable_vblank = atmel_hlcdc_dc_disable_vblank,
-   .gem_free_object = drm_gem_cma_free_object,
+   .gem_free_object_unlocked = drm_gem_cma_free_object,
.gem_vm_ops = _gem_cma_vm_ops,
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-- 
2.8.1



[PATCH 02/27] drm/ast: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Dave Airlie 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/ast/ast_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
index fcd9c0714836..f54afd2113a9 100644
--- a/drivers/gpu/drm/ast/ast_drv.c
+++ b/drivers/gpu/drm/ast/ast_drv.c
@@ -209,7 +209,7 @@ static struct drm_driver driver = {
.minor = DRIVER_MINOR,
.patchlevel = DRIVER_PATCHLEVEL,

-   .gem_free_object = ast_gem_free_object,
+   .gem_free_object_unlocked = ast_gem_free_object,
.dumb_create = ast_dumb_create,
.dumb_map_offset = ast_dumb_mmap_offset,
.dumb_destroy = drm_gem_dumb_destroy,
-- 
2.8.1



[PATCH 01/27] drm/armada: Use lockless gem BO free callback

2016-05-30 Thread Daniel Vetter
No dev->struct_mutex anywhere to be seen.

Cc: Russell King 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/armada/armada_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/armada/armada_drv.c 
b/drivers/gpu/drm/armada/armada_drv.c
index 439824a61aa5..cb21c0b6374a 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -197,7 +197,7 @@ static struct drm_driver armada_drm_driver = {
.debugfs_init   = armada_drm_debugfs_init,
.debugfs_cleanup= armada_drm_debugfs_cleanup,
 #endif
-   .gem_free_object= armada_gem_free_object,
+   .gem_free_object_unlocked = armada_gem_free_object,
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
.gem_prime_export   = armada_gem_prime_export,
-- 
2.8.1



[PATCH 00/27] locklesss gem BO free driver patches

2016-05-30 Thread Daniel Vetter
HI all,

Here's the pile of lockless gem BO free conversion patches. Assuming I didn't
botch it these are all the ones that didn't yet get an ack. Since this is all
pretty boring stuff I'll just send a pull request to Dave later this week if no
one pipes.

Thanks, Daniel

Benjamin Gaignard (1):
  drm: sti: remove useless call to dev->struct_mutex

Daniel Vetter (26):
  drm/armada: Use lockless gem BO free callback
  drm/ast: Use lockless gem BO free callback
  drm/atmel: Use lockless gem BO free callback
  drm/bochs: Use lockless gem BO free callback
  drm/cirrus: Use lockless gem BO free callback
  drm/fls-dcu: Use lockless gem BO free callback
  drm/mga200g: Use lockless gem BO free callback
  drm/nouveau: Use lockless gem BO free callback
  drm/qxl: Use lockless gem BO free callback
  drm/rcar-du: Use lockless gem BO free callback
  drm/rockchip: Use lockless gem BO free callback
  drm/shmob: Use lockless gem BO free callback
  drm/tilcdc: Use lockless gem BO free callback
  drm/vc4: Use drm_gem_object_unreference_unlocked
  drm/vc4: Use lockless gem BO free callback
  drm/vgem: Use lockless gem BO free callback
  drm/virtio: Use lockless gem BO free callback
  drm/virtio: Use lockless gem BO free callback
  drm/rockchip: Use cma gem vm ops
  drm/msm: Nuke dummy fb->dirty callback
  drm/omapdrm: Nuke dummy fb->dirty callback
  drm/sun4i: Use lockless gem BO free callback
  drm/arcpgu: Use lockless gem BO free callback
  drm/hlcd: Use lockless gem BO free callback
  drm/hisilicon: Use lockless gem BO free callback
  drm/mediatek: Use lockless gem BO free callback

 drivers/gpu/drm/arc/arcpgu_drv.c|  2 +-
 drivers/gpu/drm/arm/hdlcd_drv.c |  2 +-
 drivers/gpu/drm/armada/armada_drv.c |  2 +-
 drivers/gpu/drm/ast/ast_drv.c   |  2 +-
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c|  2 +-
 drivers/gpu/drm/bochs/bochs_drv.c   |  2 +-
 drivers/gpu/drm/cirrus/cirrus_drv.c |  2 +-
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c   |  2 +-
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c |  2 +-
 drivers/gpu/drm/mediatek/mtk_drm_drv.c  |  2 +-
 drivers/gpu/drm/mgag200/mgag200_drv.c   |  2 +-
 drivers/gpu/drm/msm/msm_fb.c|  8 
 drivers/gpu/drm/nouveau/nouveau_drm.c   |  2 +-
 drivers/gpu/drm/omapdrm/omap_fb.c   |  8 
 drivers/gpu/drm/qxl/qxl_drv.c   |  2 +-
 drivers/gpu/drm/rcar-du/rcar_du_drv.c   |  2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 10 +++---
 drivers/gpu/drm/shmobile/shmob_drm_drv.c|  2 +-
 drivers/gpu/drm/sti/sti_cursor.c|  7 ---
 drivers/gpu/drm/sti/sti_drv.c   |  8 +---
 drivers/gpu/drm/sti/sti_dvo.c   |  7 ---
 drivers/gpu/drm/sti/sti_gdp.c   | 14 --
 drivers/gpu/drm/sti/sti_hda.c   |  7 ---
 drivers/gpu/drm/sti/sti_hdmi.c  |  7 ---
 drivers/gpu/drm/sti/sti_hqvdp.c |  7 ---
 drivers/gpu/drm/sti/sti_mixer.c |  7 ---
 drivers/gpu/drm/sti/sti_tvout.c |  7 ---
 drivers/gpu/drm/sti/sti_vid.c   |  7 ---
 drivers/gpu/drm/sun4i/sun4i_drv.c   |  2 +-
 drivers/gpu/drm/tilcdc/tilcdc_drv.c |  2 +-
 drivers/gpu/drm/vc4/vc4_bo.c|  2 --
 drivers/gpu/drm/vc4/vc4_drv.c   |  2 +-
 drivers/gpu/drm/vc4/vc4_gem.c   | 11 +++
 drivers/gpu/drm/vgem/vgem_drv.c |  2 +-
 drivers/gpu/drm/virtio/virtgpu_drv.c|  2 +-
 35 files changed, 27 insertions(+), 130 deletions(-)

-- 
2.8.1



[RFC 00/21] Renesas r8a7795/Salvator-X HDMI output prototype

2016-05-30 Thread Geert Uytterhoeven
Hi Uli,

On Mon, May 30, 2016 at 5:59 PM, Ulrich Hecht
 wrote:
> This is a prototype of HDMI output support for the Renesas r8a7795 SoC and
> Salvator-X board.  It is based on the renesas-devel-20160516-v4.6 tree and
> includes the bridge API conversion patches to the adv7511 and rcar-du
> drivers written by Archit Taneja.
>
> The obvious issue with this series is the awkward binding of the dw-hdmi
> bridge IP, which can be seen in the "drm: rcar-du: Add dw_hdmi driver
> startup" patch.  Any comments on how to implement this interface properly
> are much appreciated.
>
> Functionally, this series works as expected on both connectors, but EDID
> reading is currently broken.

JFTR, I don't think any of these patches should carry my SoB.
Adding them when importing your previous version into a topic branch
was a mistake on my side.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at 
linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


[Nouveau] [PATCH 1/9] drm/nouveau: Don't leak runtime pm ref on driver unload

2016-05-30 Thread Peter Wu
On Sun, May 29, 2016 at 05:50:06PM +0200, Lukas Wunner wrote:
> Hi Peter,
> 
> On Fri, May 27, 2016 at 03:07:33AM +0200, Peter Wu wrote:
> > On Tue, May 24, 2016 at 06:03:27PM +0200, Lukas Wunner wrote:
> > > nouveau_drm_load() calls pm_runtime_put() if nouveau_runtime_pm != 0,
> > > but nouveau_drm_unload() calls pm_runtime_get_sync() unconditionally.
> > > We therefore leak a runtime pm ref whenever nouveau is loaded with
> > > runpm=0 and then unloaded. The GPU will subsequently never runtime
> > > suspend even if nouveau is loaded again with runpm=1.
> > > 
> > > Fix by taking the runtime pm ref under the same condition that it was
> > > released on driver load.
> > > 
> > > Fixes: 5addcf0a5f0f ("nouveau: add runtime PM support (v0.9)")
> > > Cc: Dave Airlie 
> > > Reported-by: Karol Herbst 
> > > Tested-by: Karol Herbst 
> > > Signed-off-by: Lukas Wunner 
> > 
> > Looks good, I tested this scenario:
> > 
> > ru(){ cat /sys/bus/pci/devices/\:01:00.0/power/runtime_usage;}
> > ru # reports 1
> > modprobe nouveau runpm=0
> > ru # reports 2
> > rmmod nouveau
> > ru # reports 1
> > 
> > Without runpm=0 the count drops to 0 in the second step and stays 0 in
> > the third step. After applying patch 2/9, this correctly reports 1 as
> > expected (this is the same as manually setting power/control to on).
> 
> How exactly did you reach the situation where the root port didn't wake
> up when you tried to load nouveau again? (IRC conversation this week.)

Ensure that the pci/pm patches are applied, then:

 0. Unload nouveau (I have blacklisted it for testing).
 1. Enable rpm for the root port and children (control = auto).
 2. Verify in the kernel logs that the devices are sleeping:
pcieport :00:01.0: power state changed by ACPI to D3cold
 3. (Optional, to rule out issues with delays:) Disable rpm for the
Nvidia device (control = on).
 4. modprobe nouveau.

The above test with v4.6 + 4 pci/pm patches (8b71f565) gives:

50.245795 MXM: GUID detected in BIOS
50.245948nseval-0227 ns_evaluate   :  Execute method 
[\_SB.PCI0.GFX0._DSM] at AML address c9013b11 length 492
50.246016 ACPI Warning: \_SB.PCI0.GFX0._DSM: Argument #4 type mismatch - 
Found [Buffer], ACPI requires [Package] (20160108/nsarguments-95)
50.246044nseval-0227 ns_evaluate   :  Execute method 
[\_SB.PCI0.GFX0._DSM] at AML address c9013b11 length 492
50.246110nseval-0227 ns_evaluate   :  Execute method 
[\_SB.PCI0.PEG0.PEGP._DSM] at AML address c9018297 length 1F
50.246256 ACPI Warning: \_SB.PCI0.PEG0.PEGP._DSM: Argument #4 type mismatch 
- Found [Buffer], ACPI requires [Package] (20160108/nsarguments-95)
50.246289nseval-0227 ns_evaluate   :  Execute method 
[\_SB.PCI0.PEG0.PEGP._DSM] at AML address c9018297 length 1F
50.246443 ACPI Warning: \_SB.PCI0.PEG0.PEGP._DSM: Argument #4 type mismatch 
- Found [Buffer], ACPI requires [Package] (20160108/nsarguments-95)
50.246457nseval-0227 ns_evaluate   :  Execute method 
[\_SB.PCI0.PEG0.PEGP._DSM] at AML address c9018297 length 1F
50.246932 pci :01:00.0: optimus capabilities: enabled, status dynamic 
power, hda bios codec supported
50.247005 VGA switcheroo: detected Optimus DSM method \_SB_.PCI0.PEG0.PEGP 
handle
50.247084nseval-0227 ns_evaluate   :  Execute method 
[\_SB.PCI0.PEG0.PG00._ON] at AML address c901086e length 11D
50.390140 pcieport :00:01.0: power state changed by ACPI to D0
50.491893nseval-0227 ns_evaluate   :  Execute method 
[\_SB.PCI0.PEG0._DSW] at AML address c9010a2d length 1D
50.492285 pcieport :00:01.0: PME# disabled
50.492583 nouveau :01:00.0: unknown chipset ()
50.492687 nouveau: probe of :01:00.0 failed with error -12
50.501990nseval-0227 ns_evaluate   :  Execute method 
[\_SB.PCI0.PEG0._S0W] at AML address c9010a8e length 2
50.502403 pcieport :00:01.0: PME# enabled
50.502601nseval-0227 ns_evaluate   :  Execute method 
[\_SB.PCI0.PEG0._DSW] at AML address c9010a2d length 1D
50.513005nseval-0227 ns_evaluate   :  Execute method 
[\_SB.PCI0.PEG0.PG00._OFF] at AML address c9010994 length 6D
50.533258 pcieport :00:01.0: power state changed by ACPI to D3cold

(Note that this patch is not included.) When nouveau is operating
normally, I see that _PS0 is also called (which does not happen above).

If you think that mixing power resources with DSM causes this issue, I
also tried to apply my power resources work for nouveau but it gives the
same problem:

20.183306 MXM: GUID detected in BIOS
20.183606 ACPI Warning: \_SB.PCI0.GFX0._DSM: Argument #4 type mismatch - 
Found [Buffer], ACPI requires [Package] (20160108/nsarguments-95)
20.184158 ACPI Warning: \_SB.PCI0.PEG0.PEGP._DSM: 

[PATCH 2/3] drm/exynos: fimd: add HW trigger support

2016-05-30 Thread Javier Martinez Canillas
Hello Inki,

On 04/05/2016 04:27 AM, Inki Dae wrote:
> This patch adds HW trigger support on i80 mode.
> 
> Until now, Exynos DRM only supported SW trigger which was set
> SWTRGCMD bit of TRIGCON register by CPU to transfer scanout
> buffer to Display bus device or panel.
> 
> With this patch, the transmission to Display bus device or
> panel will be initiated by FIMD controller.
> 
> Signed-off-by: Inki Dae 
> ---

There is a regression for the Exynos5800 Peach Pi Chromebook display due
this patch. The display is blank and I noticed that it only happens when
HW start trigger is enabled, but works with SW trigger (as it was before).

So for example with the following diff on top of v4.7-rc1, display works
again. Do you have any hints about what could be the issue?

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 0444d7fc400d..8c62830e9514 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -171,7 +171,7 @@ static struct fimd_driver_data exynos5420_fimd_driver_data 
= {
.lcdblk_vt_shift = 24,
.lcdblk_bypass_shift = 15,
.lcdblk_mic_bypass_shift = 11,
-   .trg_type = I80_HW_TRG,
.has_shadowcon = 1,
.has_vidoutcon = 1,
.has_vtsel = 1,

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America


[Bug 95528] BioShock Infinite issues on Tonga/Hawaii

2016-05-30 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=95528

--- Comment #9 from Vedran Miletić  ---
Discussed on #radeon, couldn't reproduce on Tonga:

01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc.
[AMD/ATI] Tonga XT / Amethyst XT [Radeon R9 380X / R9 M295X] [1002:6938] (rev
f1)

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


[Intel-gfx] [PATCH 08/26] drm: Consolidate connector arrays in drm_atomic_state

2016-05-30 Thread Ville Syrjälä
On Mon, May 30, 2016 at 05:33:56PM +0200, Daniel Vetter wrote:
> On Mon, May 30, 2016 at 06:25:50PM +0300, Ville Syrjälä wrote:
> > On Mon, May 30, 2016 at 05:13:56PM +0200, Daniel Vetter wrote:
> > > On Mon, May 30, 2016 at 05:59:24PM +0300, Ville Syrjälä wrote:
> > > > On Sun, May 29, 2016 at 08:35:05PM +0200, Daniel Vetter wrote:
> > > > > It's kinda pointless to have 2 separate mallocs for these. And when we
> > > > > add more per-connector state in the future it's even more pointless.
> > > > > 
> > > > > Right now there's no such thing planned, but both Gustavo's per-crtc
> > > > > fence patches, and some nonblocking commit helpers I'm playing around
> > > > > with will add more per-crtc stuff. It makes sense to also consolidate
> > > > > connectors, just for consistency.
> > > > > 
> > > > > In the future we can use this to store a pointer to the preceeding
> > > > > state, making an atomic update entirely free-standing. This will be
> > > > > needed to be able to queue them up with a depth > 1.
> > > > > 
> > > > > Cc: Gustavo Padovan 
> > > > > Signed-off-by: Daniel Vetter 
> > > > > ---
> > > > >  drivers/gpu/drm/drm_atomic.c| 27 +--
> > > > >  drivers/gpu/drm/drm_atomic_helper.c |  2 +-
> > > > >  include/drm/drm_atomic.h| 10 +-
> > > > >  include/drm/drm_crtc.h  | 11 +++
> > > > >  4 files changed, 22 insertions(+), 28 deletions(-)
> > > > > 
> > > > > diff --git a/drivers/gpu/drm/drm_atomic.c 
> > > > > b/drivers/gpu/drm/drm_atomic.c
> > > > > index 3ff1ed7b33db..a6395e9654af 100644
> > > > > --- a/drivers/gpu/drm/drm_atomic.c
> > > > > +++ b/drivers/gpu/drm/drm_atomic.c
> > > > > @@ -44,7 +44,6 @@
> > > > >  void drm_atomic_state_default_release(struct drm_atomic_state *state)
> > > > >  {
> > > > >   kfree(state->connectors);
> > > > > - kfree(state->connector_states);
> > > > >   kfree(state->crtcs);
> > > > >   kfree(state->crtc_states);
> > > > >   kfree(state->planes);
> > > > > @@ -139,15 +138,15 @@ void drm_atomic_state_default_clear(struct 
> > > > > drm_atomic_state *state)
> > > > >   DRM_DEBUG_ATOMIC("Clearing atomic state %p\n", state);
> > > > >  
> > > > >   for (i = 0; i < state->num_connector; i++) {
> > > > > - struct drm_connector *connector = state->connectors[i];
> > > > > + struct drm_connector *connector = 
> > > > > state->connectors[i].ptr;
> > > > 
> > > > 'ptr' is not a very good name.
> > > 
> > > Suggestions for something better? I was lacking good inspiration ...
> > 
> > Maybe just 'connector' ?
> 
> state->connectors[i].connector is really long, and makes a lot of code
> look ugly. "obj" might be a bit better than "ptr" at least. Something
> else?

How often are you expecting to have to type this anyway? Using any
kind of generic name here will make life harder for cscope users.
Atomic is really bad in this regard, escecially with all the identically
named function pointers. It's seriosuly hard to navigate that maze
these days. Someone should do a bit of renaming of stuff to make
things more unique.

-- 
Ville Syrjälä
Intel OTC


[PATCH 5/5] arm/dts/imx6q-b850v3: Use GE B850v3 LVDS/DP++ Bridge

2016-05-30 Thread Peter Senna Tschudin
Configure the GE B850v3 to use the LVDS/DP++ bridge.

Signed-off-by: Peter Senna Tschudin 
---
 arch/arm/boot/dts/imx6q-b850v3.dts | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm/boot/dts/imx6q-b850v3.dts 
b/arch/arm/boot/dts/imx6q-b850v3.dts
index 88a70de..d366384 100644
--- a/arch/arm/boot/dts/imx6q-b850v3.dts
+++ b/arch/arm/boot/dts/imx6q-b850v3.dts
@@ -77,6 +77,13 @@
fsl,data-mapping = "spwg";
fsl,data-width = <24>;
status = "okay";
+
+   port at 4 {
+   reg = <4>;
+   lvds0_out: endpoint {
+   remote-endpoint = <_lvds_dp_bridge_in>;
+   };
+   };
};
 };

@@ -147,3 +154,27 @@
reg = <0x4a>;
};
 };
+
+_i2c2 {
+   status = "okay";
+   clock-frequency = <10>;
+
+   b850v3_lvds_dp_bridge {
+   compatible = "ge,b850v3_lvds_dp";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   reg = <0x73>;
+   interrupt-parent = <>;
+   interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
+
+   edid-reg = <0x72>;
+
+   port at 0 {
+   reg = <0>;
+   b850v3_lvds_dp_bridge_in: endpoint {
+   remote-endpoint = <_out>;
+   };
+   };
+   };
+};
-- 
2.5.5



[PATCH 4/5] drm/bridge: Add driver for GE B850v3 LVDS/DP++ Bridge

2016-05-30 Thread Peter Senna Tschudin
This driver creates a drm_bridge and a drm_connector for the LVDS to DP++
display bridge of the GE B850v3(imx6q-b850v3.dts). There are two physical
bridges on the video signal pipeline: a STDP4028(LVDS to DP) and a
STDP2690(DP to DP++). However the physical bridges are automatically
configured by the input video signal, and the driver has no access to
the video processing pipeline. The driver is only needed to read EDID
from the STDP2690 and to handle HPD events from the STDP4028. The driver
communicates with both bridges over i2c. The video signal pipeline is as
follows:

  Host -> LVDS|--(STDP4028)--|DP -> DP|--(STDP2690)--|DP++ -> Video output

Signed-off-by: Peter Senna Tschudin 
---
 MAINTAINERS|   8 +
 drivers/gpu/drm/bridge/Kconfig |   8 +
 drivers/gpu/drm/bridge/Makefile|   1 +
 drivers/gpu/drm/bridge/ge_b850v3_lvds_dp.c | 397 +
 4 files changed, 414 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ge_b850v3_lvds_dp.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 3273ffa..7bb5e89 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5009,6 +5009,14 @@ W:   https://linuxtv.org
 S: Maintained
 F: drivers/media/radio/radio-gemtek*

+GENERAL ELECTRIC B850V3 LVDS/DP++ BRIDGE
+M: Martin Donnelly 
+M: Peter Senna Tschudin 
+M: Martyn Welch 
+S: Maintained
+F: drivers/gpu/drm/bridge/ge_b850v3_dp2.c
+F: Documentation/devicetree/bindings/ge/b850v3_dp2_bridge.txt
+
 GENERIC GPIO I2C DRIVER
 M: Haavard Skinnemoen 
 S: Supported
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 8f7423f..e9c32fc 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -52,4 +52,12 @@ config DRM_PARADE_PS8622

 source "drivers/gpu/drm/bridge/analogix/Kconfig"

+config DRM_GE_B850V3_LVDS_DP
+   tristate "LVDS/DP bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   select DRM_PANEL
+   ---help---
+ Driver for GE B850v3 DP2 LVDS to DP+ Bridge
+
 endmenu
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 96b13b3..ba2e355 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -6,3 +6,4 @@ 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_ANALOGIX_DP) += analogix/
+obj-$(CONFIG_DRM_GE_B850V3_LVDS_DP) += ge_b850v3_lvds_dp.o
diff --git a/drivers/gpu/drm/bridge/ge_b850v3_lvds_dp.c 
b/drivers/gpu/drm/bridge/ge_b850v3_lvds_dp.c
new file mode 100644
index 000..37a4e7a
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ge_b850v3_lvds_dp.c
@@ -0,0 +1,397 @@
+/*
+ * Driver for GE B850v3 DP display bridge
+
+ * Copyright (c) 2016, Collabora Ltd.
+ * Copyright (c) 2016, General Electric Company
+
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+
+ * This program is distributed in the hope 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.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
+
+ * This driver creates a drm_bridge and a drm_connector for the LVDS to DP++
+ * display bridge of the GE B850v3. There are two physical bridges on the video
+ * signal pipeline: a STDP4028(LVDS to DP) and a STDP2690(DP to DP++). However
+ * the physical bridges are automatically configured by the input video signal,
+ * and the driver has no access to the video processing pipeline. The driver is
+ * only needed to read EDID from the STDP2690 and to handle HPD events from the
+ * STDP4028. The driver communicates with both bridges over i2c. The video
+ * signal pipeline is as follows:
+ *
+ *   Host -> LVDS|--(STDP4028)--|DP -> DP|--(STDP2690)--|DP++ -> Video output
+
+ *
+ */
+#include 
+#include 
+#include 
+#include 
+#include "drm_crtc.h"
+#include "drm_crtc_helper.h"
+#include "drm_edid.h"
+#include "drmP.h"
+
+#define EDID_EXT_BLOCK_CNT 0x7E
+
+#define STDP4028_IRQ_OUT_CONF_REG 0x02
+#define STDP4028_DPTX_IRQ_EN_REG 0x3C
+#define STDP4028_DPTX_IRQ_STS_REG 0x3D
+#define STDP4028_DPTX_STS_REG 0x3E
+
+#define STDP4028_DPTX_DP_IRQ_EN 0x1000
+
+#define STDP4028_DPTX_HOTPLUG_IRQ_EN 0x0400
+#define STDP4028_DPTX_LINK_CH_IRQ_EN 0x2000
+#define STDP4028_DPTX_IRQ_CONFIG \
+   (STDP4028_DPTX_LINK_CH_IRQ_EN | STDP4028_DPTX_HOTPLUG_IRQ_EN)
+
+#define STDP4028_DPTX_HOTPLUG_STS 0x0200
+#define STDP4028_DPTX_LINK_STS 0x1000
+#define STDP4028_CON_STATE_CONNECTED \
+   (STDP4028_DPTX_HOTPLUG_STS | STDP4028_DPTX_LINK_STS)
+
+#define 

[PATCH 3/5] Documentation/devicetree/bindings: Add b850v3_lvds_dp

2016-05-30 Thread Peter Senna Tschudin
Devicetree bindings documentation for the GE B850v3 LVDS/DP++
display bridge.

Signed-off-by: Peter Senna Tschudin 
---
 .../devicetree/bindings/ge/b850v3_lvds_dp.txt  | 38 ++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/ge/b850v3_lvds_dp.txt

diff --git a/Documentation/devicetree/bindings/ge/b850v3_lvds_dp.txt 
b/Documentation/devicetree/bindings/ge/b850v3_lvds_dp.txt
new file mode 100644
index 000..32e123a
--- /dev/null
+++ b/Documentation/devicetree/bindings/ge/b850v3_lvds_dp.txt
@@ -0,0 +1,38 @@
+Driver for GE B850v3 LVDS/DP++ display bridge
+
+Required properties:
+  - compatible : should be "ge,b850v3_lvds_dp".
+  - reg : should contain the address used to ack the interrupts.
+  - interrupt-parent : should link to the gpio used as interrupt
+source on the host.
+  - interrupts : one interrupt should be described here, as in
+<0 IRQ_TYPE_LEVEL_HIGH>.
+  - edid-reg : should contain the address used to read edid information
+  - port : should describe the vide signal connection between the host
+and the bridge.
+
+Example:
+
+_i2c2 {
+   status = "okay";
+   clock-frequency = <10>;
+
+   b850v3_dp_bridge {
+   compatible = "ge,b850v3_lvds_dp";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   reg = <0x73>;
+   interrupt-parent = <>;
+   interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
+
+   edid-reg = <0x72>;
+
+   port at 0 {
+   reg = <0>;
+   b850v3_dp_bridge_in: endpoint {
+   remote-endpoint = <_out>;
+   };
+   };
+   };
+};
-- 
2.5.5



[PATCH 2/5] arm/dts/imx6q-b850v3: Configure IPU assignment order

2016-05-30 Thread Peter Senna Tschudin
Configure the IPU assignment order to assign one IPU per external
display. A single IPU can drive multiple external displays but there are
resolution restrictions. After this patch the GPU is capalbe of driving two
Full-HD monitors.

Signed-off-by: Peter Senna Tschudin 
---
 arch/arm/boot/dts/imx6q-b850v3.dts | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/imx6q-b850v3.dts 
b/arch/arm/boot/dts/imx6q-b850v3.dts
index 167f744..88a70de 100644
--- a/arch/arm/boot/dts/imx6q-b850v3.dts
+++ b/arch/arm/boot/dts/imx6q-b850v3.dts
@@ -51,6 +51,11 @@
chosen {
stdout-path = 
};
+
+   display-subsystem {
+   compatible = "fsl,imx-display-subsystem";
+   ports = <_di0>, <_di0>, <_di1>, <_di1>;
+   };
 };

  {
-- 
2.5.5



[PATCH 1/5] drm/imx-ldb: Add support to drm-bridge

2016-05-30 Thread Peter Senna Tschudin
Add support to attach a drm_bridge to imx-ldb in addition to
existing support to attach a LVDS panel.

Signed-off-by: Peter Senna Tschudin 
---
 drivers/gpu/drm/imx/imx-ldb.c | 75 +++
 1 file changed, 54 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index a58eee5..7233a81 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -57,7 +57,11 @@ struct imx_ldb_channel {
struct imx_ldb *ldb;
struct drm_connector connector;
struct drm_encoder encoder;
+
+   /* Defines what is connected to the ldb, only one at a time */
struct drm_panel *panel;
+   struct drm_bridge *ext_bridge;
+
struct device_node *child;
int chno;
void *edid;
@@ -295,6 +299,10 @@ static void imx_ldb_encoder_mode_set(struct drm_encoder 
*encoder,
}
 }

+static void imx_ldb_encoder_enable(struct drm_encoder *encoder)
+{
+}
+
 static void imx_ldb_encoder_disable(struct drm_encoder *encoder)
 {
struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder);
@@ -373,6 +381,7 @@ static const struct drm_encoder_helper_funcs 
imx_ldb_encoder_helper_funcs = {
.prepare = imx_ldb_encoder_prepare,
.commit = imx_ldb_encoder_commit,
.mode_set = imx_ldb_encoder_mode_set,
+   .enable = imx_ldb_encoder_enable,
.disable = imx_ldb_encoder_disable,
 };

@@ -417,16 +426,28 @@ static int imx_ldb_register(struct drm_device *drm,
drm_encoder_init(drm, _ldb_ch->encoder, _ldb_encoder_funcs,
 DRM_MODE_ENCODER_LVDS, NULL);

-   drm_connector_helper_add(_ldb_ch->connector,
-   _ldb_connector_helper_funcs);
-   drm_connector_init(drm, _ldb_ch->connector,
-  _ldb_connector_funcs, DRM_MODE_CONNECTOR_LVDS);
-
-   if (imx_ldb_ch->panel)
+   if (imx_ldb_ch->panel) {
+   drm_connector_helper_add(_ldb_ch->connector,
+   _ldb_connector_helper_funcs);
+   drm_connector_init(drm, _ldb_ch->connector,
+   _ldb_connector_funcs,
+   DRM_MODE_CONNECTOR_LVDS);
drm_panel_attach(imx_ldb_ch->panel, _ldb_ch->connector);

-   drm_mode_connector_attach_encoder(_ldb_ch->connector,
-   _ldb_ch->encoder);
+   drm_mode_connector_attach_encoder(_ldb_ch->connector,
+   _ldb_ch->encoder);
+   }
+
+   if (imx_ldb_ch->ext_bridge) {
+   imx_ldb_ch->ext_bridge->encoder = _ldb_ch->encoder;
+
+   imx_ldb_ch->encoder.bridge = imx_ldb_ch->ext_bridge;
+   ret = drm_bridge_attach(drm, imx_ldb_ch->ext_bridge);
+   if (ret) {
+   DRM_ERROR("Failed to initialize bridge with drm\n");
+   return ret;
+   }
+   }

return 0;
 }
@@ -583,23 +604,35 @@ static int imx_ldb_bind(struct device *dev, struct device 
*master, void *data)
endpoint = of_get_child_by_name(port, "endpoint");
if (endpoint) {
remote = 
of_graph_get_remote_port_parent(endpoint);
-   if (remote)
-   channel->panel = 
of_drm_find_panel(remote);
-   else
-   return -EPROBE_DEFER;
-   if (!channel->panel) {
-   dev_err(dev, "panel not found: %s\n",
-   remote->full_name);
-   return -EPROBE_DEFER;
+   if (remote) {
+   /* Only one of these two will succeed */
+   channel->panel =
+   of_drm_find_panel(remote);
+
+   channel->ext_bridge =
+   of_drm_find_bridge(remote);
+
+   /*
+* If the bridge is compiled as a
+* module, it may take some time until
+* the bridge driver is available.
+* Defer until the bridge driver is
+* ready.
+*/
+   if (!channel->panel &&
+   !channel->ext_bridge)
+   return -EPROBE_DEFER;
}
}
}

-   edidp = of_get_property(child, "edid", >edid_len);
-   

[PATCH 0/5] Add driver for GE B850v3 LVDS/DP++ Bridge

2016-05-30 Thread Peter Senna Tschudin
The series adds a driver that creates a drm_bridge and a drm_connector for the
LVDS to DP++ display bridge of the GE B850v3. There are two physical bridges on
the video signal pipeline: a STDP4028(LVDS to DP) and a STDP2690(DP to DP++).
However the physical bridges are automatically configured by the input video
signal, and the driver has no access to the video processing pipeline. The
driver is only needed to read EDID from the STDP2690 and to handle HPD events
from the STDP4028. The driver communicates with both bridges over i2c. The
video signal pipeline is as follows:

  Host -> LVDS|--(STDP4028)--|DP -> DP|--(STDP2690)--|DP++ -> Video output

The patches from the series:
 [1/5] Change the imx-ldb driver to allow attaching a bridge and not only a LVDS
   panel.

 [2/5] Configure the mapping between IPUs and external displays on the dts file
   of the B850v3. Needed so the GPU can drive two Full-HD monitors.

 [3/5] Devicetree documentation for the GE B850v3 LVDS/DP++ Bridge

 [4/5] Add the driver, make changes to MAINTAINERS, Kconfig and Makefile

 [5/5] Make the changes to the B850v3 dts file to enalbe the GE B850v3
   LVDS/DP++ Bridge.

Peter Senna Tschudin (5):
  drm/imx-ldb: Add support to drm-bridge
  dts/imx6q-b850v3: Configure IPU assignment order
  Documentation/devicetree/bindings: b850v3_lvds_dp
  drm/bridge: Add driver for GE B850v3 LVDS/DP++ Bridge
  dts/imx6q-b850v3: Use GE B850v3 LVDS/DP++ Bridge

 .../devicetree/bindings/ge/b850v3_lvds_dp.txt  |  38 ++
 MAINTAINERS|   8 +
 arch/arm/boot/dts/imx6q-b850v3.dts |  36 ++
 drivers/gpu/drm/bridge/Kconfig |   8 +
 drivers/gpu/drm/bridge/Makefile|   1 +
 drivers/gpu/drm/bridge/ge_b850v3_lvds_dp.c | 397 +
 drivers/gpu/drm/imx/imx-ldb.c  |  75 ++--
 7 files changed, 542 insertions(+), 21 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ge/b850v3_lvds_dp.txt
 create mode 100644 drivers/gpu/drm/bridge/ge_b850v3_lvds_dp.c

-- 
2.5.5



[Bug 93748] [r600g]OpenCL driver causes ImageMagick to segfault

2016-05-30 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93748

--- Comment #6 from Jan Vesely  ---
based on the LLVM dump something is trying to do v2 load.

Do you know what noise type is used?
Guassian noise in that kernel uses sinpi and cospi which use v2float (float
load is the same as int).

can you try newer llvm version?
proper constant address space loads were implemented in r269481. it fixed
builtin functions that rely on tables, like sinpi/cospi.

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


[RFC v2 3/5] drm/mediatek: add *driver_data for different hardware settings

2016-05-30 Thread YT Shen
Hi Emil,

Thanks for your review.

On Fri, 2016-05-27 at 10:24 +0100, Emil Velikov wrote:
> On 27 May 2016 at 08:31, YT Shen  wrote:
> > Hi CK,
> >
> >
> > On Mon, 2016-05-23 at 17:43 +0800, CK Hu wrote:
> >> Hi, YT:
> >>
> >> One comment below.
> >>
> >> On Fri, 2016-05-20 at 23:05 +0800, yt.shen at mediatek.com wrote:
> >> > From: YT Shen 
> >> >
> >> > There are some hardware settings changed, between MT8173 & MT2701:
> >> > DISP_OVL address offset changed, color format definition changed.
> >> > DISP_RDMA fifo size changed.
> >> > DISP_COLOR offset changed.
> >> >
> >> > Signed-off-by: YT Shen 
> >> > ---
> >> > +
> >> > +static inline struct mtk_ddp_comp_driver_data *mtk_ovl_get_driver_data(
> >> > +   struct platform_device *pdev)
> >> > +{
> >> > +   const struct of_device_id *of_id =
> >> > +   of_match_device(mtk_disp_ovl_driver_dt_match, >dev);
> >> > +
> >> > +   return (struct mtk_ddp_comp_driver_data *)of_id->data;
> >> > +}
> >> > +
> >> > +static inline struct mtk_ddp_comp_driver_data *mtk_rdma_get_driver_data(
> >> > +   struct platform_device *pdev)
> >> > +{
> >> > +   const struct of_device_id *of_id =
> >> > +   of_match_device(mtk_disp_rdma_driver_dt_match, >dev);
> >> > +
> >> > +   return (struct mtk_ddp_comp_driver_data *)of_id->data;
> >> > +}
> >> > +
> >> > +static inline struct mtk_ddp_comp_driver_data 
> >> > *mtk_color_get_driver_data(
> >> > +   struct device_node *node)
> >> > +{
> >> > +   const struct of_device_id *of_id =
> >> > +   of_match_node(mtk_disp_color_driver_dt_match, node);
> >> > +
> >> > +   return (struct mtk_ddp_comp_driver_data *)of_id->data;
> >> > +}
> >> > +
> >>
> >> These three functions looks the same with different parameter:
> >> mtk_disp_ovl_driver_dt_match, mtk_disp_rdma_driver_dt_match, and
> >> mtk_disp_color_driver_dt_match. So merge them to prevent duplicated
> >> code.
> > OK, I'll do this in the next version.
> 
> Also preserve the const-ness of the data - don't cast it away on the
> return line.
> Note that the function return type (and some of the users of said
> functions) should be updated as well.
OK, I will check this part.

> 
> -Emil




[Intel-gfx] [PATCH 08/26] drm: Consolidate connector arrays in drm_atomic_state

2016-05-30 Thread Ville Syrjälä
On Mon, May 30, 2016 at 05:13:56PM +0200, Daniel Vetter wrote:
> On Mon, May 30, 2016 at 05:59:24PM +0300, Ville Syrjälä wrote:
> > On Sun, May 29, 2016 at 08:35:05PM +0200, Daniel Vetter wrote:
> > > It's kinda pointless to have 2 separate mallocs for these. And when we
> > > add more per-connector state in the future it's even more pointless.
> > > 
> > > Right now there's no such thing planned, but both Gustavo's per-crtc
> > > fence patches, and some nonblocking commit helpers I'm playing around
> > > with will add more per-crtc stuff. It makes sense to also consolidate
> > > connectors, just for consistency.
> > > 
> > > In the future we can use this to store a pointer to the preceeding
> > > state, making an atomic update entirely free-standing. This will be
> > > needed to be able to queue them up with a depth > 1.
> > > 
> > > Cc: Gustavo Padovan 
> > > Signed-off-by: Daniel Vetter 
> > > ---
> > >  drivers/gpu/drm/drm_atomic.c| 27 +--
> > >  drivers/gpu/drm/drm_atomic_helper.c |  2 +-
> > >  include/drm/drm_atomic.h| 10 +-
> > >  include/drm/drm_crtc.h  | 11 +++
> > >  4 files changed, 22 insertions(+), 28 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> > > index 3ff1ed7b33db..a6395e9654af 100644
> > > --- a/drivers/gpu/drm/drm_atomic.c
> > > +++ b/drivers/gpu/drm/drm_atomic.c
> > > @@ -44,7 +44,6 @@
> > >  void drm_atomic_state_default_release(struct drm_atomic_state *state)
> > >  {
> > >   kfree(state->connectors);
> > > - kfree(state->connector_states);
> > >   kfree(state->crtcs);
> > >   kfree(state->crtc_states);
> > >   kfree(state->planes);
> > > @@ -139,15 +138,15 @@ void drm_atomic_state_default_clear(struct 
> > > drm_atomic_state *state)
> > >   DRM_DEBUG_ATOMIC("Clearing atomic state %p\n", state);
> > >  
> > >   for (i = 0; i < state->num_connector; i++) {
> > > - struct drm_connector *connector = state->connectors[i];
> > > + struct drm_connector *connector = state->connectors[i].ptr;
> > 
> > 'ptr' is not a very good name.
> 
> Suggestions for something better? I was lacking good inspiration ...

Maybe just 'connector' ?

-- 
Ville Syrjälä
Intel OTC


[RFC v2 2/5] drm/mediatke: add support for Mediatek SoC MT2701

2016-05-30 Thread YT Shen
Hi Emil,
On Fri, 2016-05-27 at 10:35 +0100, Emil Velikov wrote:
> Hi YT Shen,
> 
> There's a typo in the commit summary - s/mediatke/mediatek/.
Ooops, even I type this word everyday, I still made a mistake...
> 
> On 20 May 2016 at 16:05,   wrote:
> > From: YT Shen 
> >
> > This patch add support for the Mediatek MT2701 DISP subsystem.
> > There is only one OVL engine in MT2701.
> >
> As is you introduce a broken driver only to fix it up with patches 3/5
> and 4/5. You really want to have this patch as 4/5, with the MT2701
> hunks from 3/5 merged in here.
OK, I will reorder the patch series in the next version.
2/5: add *driver_data for hardware specific settings
3/5: add shadow register support
4/5: add support for Mediatek SoC MT2701

> 
> Regards,
> Emil




[RFC v2 1/5] drm/mediatek: rename macros, add chip suffix

2016-05-30 Thread YT Shen
Hi Emil,

On Fri, 2016-05-27 at 10:30 +0100, Emil Velikov wrote:
> On 20 May 2016 at 16:05,   wrote:
> > From: YT Shen 
> >
> > Add MT8173 suffix for hardware related macros.
> >
> Why suffix ? Pretty much everyone else uses prefix.
No problem, I will use prefix in the future.


> 
> -Emil




[PATCH 4/4] drm/nouveau/acpi: fix lockup with PCIe runtime PM

2016-05-30 Thread Peter Wu
On Mon, May 30, 2016 at 04:09:09PM +0300, Mika Westerberg wrote:
...
> > > > > > +
> > > > > > +   if (!parent_pdev)
> > > > > > +   return false;
> > > > > > +
> > > > > > +   ad = ACPI_COMPANION(_pdev->dev);
> > > > > > +   if (!ad)
> > > > > > +   return false;
> > > > > > +
> > > > > > +   return ad->power.flags.power_resources;
> > > > > 
> > > > > Is this sufficient to tell if the parent device has _PR3? I thought it
> > > > > returns true if it has power resources in general, not necessarily 
> > > > > _PR3.
> > > > > 
> > > > > Otherwise this looks okay to me.
> > > > 
> > > > It is indeed set whenever there is any _PRx method. I wonder if it is
> > > > appropriate to access fields directly like this, perhaps this would be
> > > > more accurate (based on device_pm.c):
> > > > 
> > > > /* Check whether the _PR3 method is available. */
> > > > return adev->power.states[ACPI_STATE_D3_COLD].flags.valid;
> > > > 
> > > > I am also considering adding a check in case the pcieport driver does
> > > > not support D3cold via runtime PM, what do you think of this?
> > > > 
> > > > if (!parent_pdev)
> > > > return false;
> > > > /* If the PCIe port does not support D3cold via runtime PM, allow a
> > > >  * fallback to the Optimus DSM method to put the device in D3cold. 
> > > > */
> > > > if (parent_pdev->no_d3cold)
> > > > return false;
> > > > 
> > > > This is needed to avoid the regression reported in the cover letter, but
> > > > also allows pre-2015 systems to (still) have the D3cold possibility.
> > > 
> > > The _DSM method with 0 as index parameter should return a bit field
> > > telling which functions are supported. Sane BIOS disables that
> > > particular function if it detects Windows 8 and newer. Have you checked
> > > if that's the case?
> > > 
> > > Then you can call _DSM only if it is supported and otherwise expect the
> > > parent device's power resources to turn off power when runtime
> > > suspended.
> > 
> > The _DSM methods (for the Nvidia device) are often still included and
> > functions are reported as supported. I guess that vendors just check
> > whether it is working and do not bother removing legacy functions. The
> > Acer case below seems exceptional.
> > 
> > I suggested the no_d3cold check such that DSM can still be called even
> > though the runtime PM on the PCIe port does nothing.
> 
> Somehow it does not feel right to poke parent device's fields directly.
> 
> What if you just check if it has the method like:
> 
>   bool no_dsm = acpi_has_method(parent_adev->handle, "_PR3");
> 
> That should follow what Windows is doing.

Checking for _PR3 was the intention, but it seems that the ACPI core
does not really store it somewhere. Your check should be simple enough,
I'll use that in the next version.

Do you have any suggestions for the case where the pcieport driver
refuses to put the bridge in D3 (because the BIOS is too old)? In that
case the nouveau driver needs to fallback to the DSM method (but not
when runtime PM is deliberately disabled by writing control=on).
-- 
Kind regards,
Peter Wu
https://lekensteyn.nl


[RFC 08/21] drm: rcar-du: Add DPLL support

2016-05-30 Thread Dirk Behme
On 30.05.2016 18:00, Ulrich Hecht wrote:
> From: Koji Matsuoka 
>
> Signed-off-by: Koji Matsuoka 
> Signed-off-by: Geert Uytterhoeven 
> ---
>   drivers/gpu/drm/rcar-du/rcar_du_crtc.c  | 97 
> -
>   drivers/gpu/drm/rcar-du/rcar_du_crtc.h  |  8 +++
>   drivers/gpu/drm/rcar-du/rcar_du_drv.c   |  1 +
>   drivers/gpu/drm/rcar-du/rcar_du_drv.h   |  1 +
>   drivers/gpu/drm/rcar-du/rcar_du_plane.h |  7 ++-
>   drivers/gpu/drm/rcar-du/rcar_du_regs.h  | 19 +++
>   6 files changed, 131 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> index 0d8bdda..e10943b 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> @@ -30,6 +30,12 @@
>   #include "rcar_du_regs.h"
>   #include "rcar_du_vsp.h"
>
> +#define PRODUCT_REG  0xfff00044
> +#define PRODUCT_H3_BIT   (0x4f << 8)
> +#define PRODUCT_MASK (0x7f << 8)
> +#define CUT_ES1  (0x00)
> +#define CUT_ES1_MASK (0x00ff)


NACK for the hard coded register.

We've already discussed this in the thread

https://www.mail-archive.com/linux-renesas-soc at vger.kernel.org/msg04008.html

and found that this isn't ready this way:

https://www.mail-archive.com/linux-renesas-soc at vger.kernel.org/msg04079.html

Best regards

Dirk



>   static u32 rcar_du_crtc_read(struct rcar_du_crtc *rcrtc, u32 reg)
>   {
>   struct rcar_du_device *rcdu = rcrtc->group->dev;
> @@ -106,14 +112,74 @@ static void rcar_du_crtc_put(struct rcar_du_crtc *rcrtc)
>* Hardware Setup
>*/
>
> +static void rcar_du_dpll_divider(struct dpll_info *dpll, unsigned int extclk,
> +  unsigned int mode_clock)
> +{
> + unsigned long dpllclk;
> + unsigned long diff;
> + unsigned long n, m, fdpll;
> + bool match_flag = false;
> + bool clk_diff_set = true;
> +
> + for (n = 39; n < 120; n++) {
> + for (m = 0; m < 4; m++) {
> + for (fdpll = 1; fdpll < 32; fdpll++) {
> + /* 1/2 (FRQSEL=1) for duty rate 50% */
> + dpllclk = extclk * (n + 1) / (m + 1)
> +  / (fdpll + 1) / 2;
> + if (dpllclk >= 4)
> + continue;
> +
> + diff = abs((long)dpllclk - (long)mode_clock);
> + if (clk_diff_set ||
> + ((diff == 0) || (dpll->diff > diff))) {
> + dpll->diff = diff;
> + dpll->n = n;
> + dpll->m = m;
> + dpll->fdpll = fdpll;
> + dpll->dpllclk = dpllclk;
> +
> + if (clk_diff_set)
> + clk_diff_set = false;
> +
> + if (diff == 0) {
> + match_flag = true;
> + break;
> + }
> + }
> + }
> + if (match_flag)
> + break;
> + }
> + if (match_flag)
> + break;
> + }
> +}
> +
>   static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)
>   {
>   const struct drm_display_mode *mode = >crtc.state->adjusted_mode;
> + struct rcar_du_device *rcdu = rcrtc->group->dev;
>   unsigned long mode_clock = mode->clock * 1000;
>   unsigned long clk;
>   u32 value;
>   u32 escr;
>   u32 div;
> + u32 dpll_reg = 0;
> + struct dpll_info *dpll;
> + void __iomem *product_reg;
> + bool h3_es1_workaround = false;
> +
> + dpll = kzalloc(sizeof(*dpll), GFP_KERNEL);
> + if (dpll == NULL)
> + return;
> +
> + /* DU2 DPLL Clock Select bit workaround in R-Car H3(ES1.0) */
> + product_reg = ioremap(PRODUCT_REG, 0x04);
> + if (((readl(product_reg) & PRODUCT_MASK) == PRODUCT_H3_BIT)
> + && ((readl(product_reg) & CUT_ES1_MASK) == CUT_ES1))
> + h3_es1_workaround = true;
> + iounmap(product_reg);
>
>   /* Compute the clock divisor and select the internal or external dot
>* clock based on the requested frequency.
> @@ -130,6 +196,15 @@ static void rcar_du_crtc_set_display_timing(struct 
> rcar_du_crtc *rcrtc)
>   u32 extdiv;
>
>   extclk = clk_get_rate(rcrtc->extclock);
> +
> + if (rcdu->info->dpll_ch & (0x01 << rcrtc->index)) {
> + rcar_du_dpll_divider(dpll, extclk, mode_clock);
> + extclk = dpll->dpllclk;
> + dev_dbg(rcrtc->group->dev->dev,
> +  

[PATCH 2/2] drm: Resurrect atomic rmfb code

2016-05-30 Thread Daniel Vetter
This was somehow lost between v3 and the merged version in Maarten's
patch merged as:

commit f2d580b9a8149735cbc4b59c4a8df60173658140
Author: Maarten Lankhorst 
Date:   Wed May 4 14:38:26 2016 +0200

drm/core: Do not preserve framebuffer on rmfb, v4.

Actual code copied from Maarten's patch, but with the slight change to
just use dev->mode_config.funcs->atomic_commit to decide whether to
use the atomic path or not.

Cc: Maarten Lankhorst 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_atomic.c| 66 +
 drivers/gpu/drm/drm_crtc.c  |  6 
 drivers/gpu/drm/drm_crtc_internal.h |  1 +
 3 files changed, 73 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 50aa341ca9ff..a80e30b1a76d 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1563,6 +1563,72 @@ void drm_atomic_clean_old_fb(struct drm_device *dev,
 }
 EXPORT_SYMBOL(drm_atomic_clean_old_fb);

+int drm_atomic_remove_fb(struct drm_framebuffer *fb)
+{
+   struct drm_modeset_acquire_ctx ctx;
+   struct drm_device *dev = fb->dev;
+   struct drm_atomic_state *state;
+   struct drm_plane *plane;
+   int ret = 0;
+   unsigned plane_mask;
+
+   state = drm_atomic_state_alloc(dev);
+   if (!state)
+   return -ENOMEM;
+
+   drm_modeset_acquire_init(, 0);
+   state->acquire_ctx = 
+
+retry:
+   plane_mask = 0;
+   ret = drm_modeset_lock_all_ctx(dev, );
+   if (ret)
+   goto unlock;
+
+   drm_for_each_plane(plane, dev) {
+   struct drm_plane_state *plane_state;
+
+   if (plane->state->fb != fb)
+   continue;
+
+   plane_state = drm_atomic_get_plane_state(state, plane);
+   if (IS_ERR(plane_state)) {
+   ret = PTR_ERR(plane_state);
+   goto unlock;
+   }
+
+   drm_atomic_set_fb_for_plane(plane_state, NULL);
+   ret = drm_atomic_set_crtc_for_plane(plane_state, NULL);
+   if (ret)
+   goto unlock;
+
+   plane_mask |= BIT(drm_plane_index(plane));
+
+   plane->old_fb = plane->fb;
+   plane->fb = NULL;
+   }
+
+   if (plane_mask)
+   ret = drm_atomic_commit(state);
+
+unlock:
+   if (plane_mask)
+   drm_atomic_clean_old_fb(dev, plane_mask, ret);
+
+   if (ret == -EDEADLK) {
+   drm_modeset_backoff();
+   goto retry;
+   }
+
+   if (ret || !plane_mask)
+   drm_atomic_state_free(state);
+
+   drm_modeset_drop_locks();
+   drm_modeset_acquire_fini();
+
+   return ret;
+}
+
 int drm_mode_atomic_ioctl(struct drm_device *dev,
  void *data, struct drm_file *file_priv)
 {
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 3e52a6ecf6c0..ec29f462894a 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -600,6 +600,11 @@ void drm_framebuffer_remove(struct drm_framebuffer *fb)
 * in this manner.
 */
if (drm_framebuffer_read_refcount(fb) > 1) {
+   if (dev->mode_config.funcs->atomic_commit) {
+   drm_atomic_remove_fb(fb);
+   goto out;
+   }
+
drm_modeset_lock_all(dev);
/* remove from any CRTC */
drm_for_each_crtc(crtc, dev) {
@@ -621,6 +626,7 @@ void drm_framebuffer_remove(struct drm_framebuffer *fb)
drm_modeset_unlock_all(dev);
}

+out:
drm_framebuffer_unreference(fb);
 }
 EXPORT_SYMBOL(drm_framebuffer_remove);
diff --git a/drivers/gpu/drm/drm_crtc_internal.h 
b/drivers/gpu/drm/drm_crtc_internal.h
index 8186c0e05c42..b426d37bc916 100644
--- a/drivers/gpu/drm/drm_crtc_internal.h
+++ b/drivers/gpu/drm/drm_crtc_internal.h
@@ -125,4 +125,5 @@ int drm_atomic_get_property(struct drm_mode_object *obj,
struct drm_property *property, uint64_t *val);
 int drm_mode_atomic_ioctl(struct drm_device *dev,
  void *data, struct drm_file *file_priv);
+int drm_atomic_remove_fb(struct drm_framebuffer *fb);

-- 
2.8.1



[PATCH 1/2] drm: Replace fb_helper->atomic with mode_config->atomic_commit

2016-05-30 Thread Daniel Vetter
Drivers transitioning to atomic might not yet want to enable full
DRIVER_ATOMIC support when it's not entirely working. But using atomic
internally makes a lot more sense earlier.

Instead of spreading such flags to more places I figured it's simpler
to just check for mode_config->funcs->atomic_commit, and use atomic
paths if that is set. For the only driver currently transitioning
(i915) this does the right thing.

Cc: Maarten Lankhorst 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_fb_helper.c|  6 ++
 drivers/gpu/drm/i915/intel_fbdev.c |  2 --
 include/drm/drm_fb_helper.h| 11 ---
 3 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index c0e0a2e78d75..ba2fcb2a68ad 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -385,7 +385,7 @@ static int restore_fbdev_mode(struct drm_fb_helper 
*fb_helper)

drm_warn_on_modeset_not_all_locked(dev);

-   if (fb_helper->atomic)
+   if (dev->mode_config.funcs->atomic_commit)
return restore_fbdev_mode_atomic(fb_helper);

drm_for_each_plane(plane, dev) {
@@ -716,8 +716,6 @@ int drm_fb_helper_init(struct drm_device *dev,
i++;
}

-   fb_helper->atomic = !!drm_core_check_feature(dev, DRIVER_ATOMIC);
-
return 0;
 out_free:
drm_fb_helper_crtc_free(fb_helper);
@@ -1344,7 +1342,7 @@ int drm_fb_helper_pan_display(struct fb_var_screeninfo 
*var,
return -EBUSY;
}

-   if (fb_helper->atomic) {
+   if (dev->mode_config.funcs->atomic_commit) {
ret = pan_display_atomic(var, info);
goto unlock;
}
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c 
b/drivers/gpu/drm/i915/intel_fbdev.c
index 99e27530e264..272f17e0551f 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -724,8 +724,6 @@ int intel_fbdev_init(struct drm_device *dev)
return ret;
}

-   ifbdev->helper.atomic = true;
-
dev_priv->fbdev = ifbdev;
INIT_WORK(_priv->fbdev_suspend_work, intel_fbdev_suspend_worker);

diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 5b4aa35026a3..db8d4780eaa2 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -212,17 +212,6 @@ struct drm_fb_helper {
 * needs to be reprobe when fbdev is in control again.
 */
bool delayed_hotplug;
-
-   /**
-* @atomic:
-*
-* Use atomic updates for restore_fbdev_mode(), etc.  This defaults to
-* true if driver has DRIVER_ATOMIC feature flag, but drivers can
-* override it to true after drm_fb_helper_init() if they support atomic
-* modeset but do not yet advertise DRIVER_ATOMIC (note that fb-helper
-* does not require ASYNC commits).
-*/
-   bool atomic;
 };

 #ifdef CONFIG_DRM_FBDEV_EMULATION
-- 
2.8.1



[PATCH] drm: Improve kerneldoc for mode_fixup callbacks and encoder's ->atomic_check

2016-05-30 Thread Liu Ying
To match with the atomic context, this patch updates kerneldoc to clarify
that all mode_fixup callbacks and encoder's ->atomic_check callback are
called only when enabling a display mode on the relevant CRTC.

Suggested-by: Daniel Vetter 
Signed-off-by: Liu Ying 
---
 include/drm/drm_crtc.h   | 11 ++-
 include/drm/drm_modeset_helper_vtables.h | 29 -
 2 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index d1559cd..6e7ea36 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1571,11 +1571,12 @@ struct drm_bridge_funcs {
 *
 * NOTE:
 *
-* This function is called in the check phase of atomic modesets, which
-* can be aborted for any reason (including on userspace's request to
-* just check whether a configuration would be possible). Drivers MUST
-* NOT touch any persistent state (hardware or software) or data
-* structures except the passed in @state parameter.
+* This function is called in the check phase of atomic modesets only
+* when enabling a display mode on the relevant CRTC, which can be
+* aborted for any reason (including on userspace's request to just
+* check whether a configuration would be possible). Drivers MUST NOT
+* touch any persistent state (hardware or software) or data structures
+* except the passed in @state parameter.
 *
 * RETURNS:
 *
diff --git a/include/drm/drm_modeset_helper_vtables.h 
b/include/drm/drm_modeset_helper_vtables.h
index d4619dc..269adfb 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -119,11 +119,12 @@ struct drm_crtc_helper_funcs {
 *
 * NOTE:
 *
-* This function is called in the check phase of atomic modesets, which
-* can be aborted for any reason (including on userspace's request to
-* just check whether a configuration would be possible). Atomic drivers
-* MUST NOT touch any persistent state (hardware or software) or data
-* structures except the passed in adjusted_mode parameter.
+* This function is called in the check phase of atomic modesets only
+* when enabling a display mode, which can be aborted for any reason
+* (including on userspace's request to just check whether a
+* configuration would be possible). Atomic drivers MUST NOT touch any
+* persistent state (hardware or software) or data structures except the
+* passed in adjusted_mode parameter.
 *
 * This is in contrast to the legacy CRTC helpers where this was
 * allowed.
@@ -443,10 +444,11 @@ struct drm_encoder_helper_funcs {
 *
 * NOTE:
 *
-* This function is called in the check phase of atomic modesets, which
-* can be aborted for any reason (including on userspace's request to
-* just check whether a configuration would be possible). Atomic drivers
-* MUST NOT touch any persistent state (hardware or software) or data
+* This function is called in the check phase of atomic modesets only
+* when enabling a display mode on the relevant CRTC, which can be
+* aborted for any reason (including on userspace's request to just
+* check whether a configuration would be possible). Atomic drivers MUST
+* NOT touch any persistent state (hardware or software) or data
 * structures except the passed in adjusted_mode parameter.
 *
 * This is in contrast to the legacy CRTC helpers where this was
@@ -623,10 +625,11 @@ struct drm_encoder_helper_funcs {
 *
 * NOTE:
 *
-* This function is called in the check phase of an atomic update. The
-* driver is not allowed to change anything outside of the free-standing
-* state objects passed-in or assembled in the overall _atomic_state
-* update tracking structure.
+* This function is called in the check phase of an atomic update only
+* when enabling a display mode on the relevant CRTC. The driver is not
+* allowed to change anything outside of the free-standing state objects
+* passed-in or assembled in the overall _atomic_state update
+* tracking structure.
 *
 * RETURNS:
 *
-- 
2.7.4



[RFC 21/21] arm64: defconfig: add VIDEO_RENESAS_FCP

2016-05-30 Thread Ulrich Hecht
From: Kuninori Morimoto 

DRM_RCAR_VSP requests VIDEO_RENESAS_VSP1, and VIDEO_RENESAS_VSP1 requests
VIDEO_RENESAS_FCP. But VIDEO_RENESAS_FCP is not set on defconfig.
This patch adds it. Otherwise kernel goes to Oops.

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Geert Uytterhoeven 
---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index fc10983..bc9bfff 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -220,6 +220,7 @@ CONFIG_V4L_PLATFORM_DRIVERS=y
 CONFIG_SOC_CAMERA=y
 CONFIG_SOC_CAMERA_PLATFORM=y
 CONFIG_V4L_MEM2MEM_DRIVERS=y
+CONFIG_VIDEO_RENESAS_FCP=y
 CONFIG_VIDEO_RENESAS_VSP1=y
 CONFIG_DRM=y
 CONFIG_DRM_RCAR_DU=y
-- 
2.7.4



[RFC 20/21] arm64: dts: r8a7795: add HDMI support to DU

2016-05-30 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht 
Signed-off-by: Geert Uytterhoeven 
---
 arch/arm64/boot/dts/renesas/r8a7795.dtsi | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
index fcad91a..6e0737b 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -1555,12 +1555,25 @@
 < CPG_MOD 723>,
 < CPG_MOD 722>,
 < CPG_MOD 721>,
-< CPG_MOD 727>;
-   clock-names = "du.0", "du.1", "du.2", "du.3", "lvds.0";
+< CPG_MOD 727>,
+< CPG_MOD 729>,
+< CPG_MOD 728>,
+<_clk0>,
+<_clk>,
+<_clk>,
+<_clk1>;
+   clock-names = "du.0", "du.1", "du.2", "du.3", "lvds.0",
+ "isfr.0", "isfr.1", "dclkin.0",
+ "dclkin.1", "dclkin.2", "dclkin.3";
status = "disabled";

vsps = <   >;

+   hdmi = < >;
+   interlaced = <1>;
+   clock-iahb = <0>;
+   hdmi-num = <2>;
+
ports {
#address-cells = <1>;
#size-cells = <0>;
-- 
2.7.4



[RFC 19/21] arm64: configs: Enable R-Car DU related config

2016-05-30 Thread Ulrich Hecht
From: Koji Matsuoka 

Signed-off-by: Koji Matsuoka 
Signed-off-by: Geert Uytterhoeven 
---
 arch/arm64/configs/defconfig | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index aa47366..fc10983 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -212,6 +212,20 @@ CONFIG_REGULATOR_HI655X=y
 CONFIG_REGULATOR_QCOM_SMD_RPM=y
 CONFIG_REGULATOR_QCOM_SPMI=y
 CONFIG_REGULATOR_S2MPS11=y
+CONFIG_MEDIA_SUPPORT=y
+CONFIG_MEDIA_CAMERA_SUPPORT=y
+CONFIG_MEDIA_CONTROLLER=y
+CONFIG_VIDEO_V4L2_SUBDEV_API=y
+CONFIG_V4L_PLATFORM_DRIVERS=y
+CONFIG_SOC_CAMERA=y
+CONFIG_SOC_CAMERA_PLATFORM=y
+CONFIG_V4L_MEM2MEM_DRIVERS=y
+CONFIG_VIDEO_RENESAS_VSP1=y
+CONFIG_DRM=y
+CONFIG_DRM_RCAR_DU=y
+CONFIG_DRM_RCAR_HDMI=y
+CONFIG_DRM_RCAR_LVDS=y
+CONFIG_DRM_RCAR_VSP=y
 CONFIG_FB=y
 CONFIG_FB_ARMCLCD=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
-- 
2.7.4



[RFC 18/21] arm64: dts: salvator-x: Add DU pins, HDMI connectors and encoder

2016-05-30 Thread Ulrich Hecht
From: Koji Matsuoka 

Based on work by Koji Matsuoka.

Signed-off-by: Ulrich Hecht 
[geert: Re-add removed extal_clk]
[geert: Modify existing du node instead of moving it around]
[geert: Use generic pinctrl properties]
Signed-off-by: Geert Uytterhoeven 
---
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 107 +
 1 file changed, 107 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
index f8e4e33..c09ead3 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
@@ -169,17 +169,119 @@
};
};
};
+
+   hdmi0-encoder {
+   compatible = "rockchip,rcar-dw-hdmi";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   port at 0 {
+   reg = <0>;
+   rcar_dw_hdmi0_in: endpoint {
+   remote-endpoint = <_out_hdmi0>;
+   };
+   };
+   port at 1 {
+   reg = <1>;
+   rcar_dw_hdmi0_out: endpoint {
+   remote-endpoint = <_con>;
+   };
+   };
+   };
+   };
+
+   hdmi0-out {
+   compatible = "hdmi-connector";
+   type = "a";
+
+   port {
+   hdmi0_con: endpoint {
+   remote-endpoint = <_dw_hdmi0_out>;
+   };
+   };
+   };
+
+   hdmi1-encoder {
+   compatible = "rockchip,rcar-dw-hdmi";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   port at 0 {
+   reg = <0>;
+   rcar_dw_hdmi1_in: endpoint {
+   remote-endpoint = <_out_hdmi1>;
+   };
+   };
+   port at 1 {
+   reg = <1>;
+   rcar_dw_hdmi1_out: endpoint {
+   remote-endpoint = <_con>;
+   };
+   };
+   };
+   };
+
+   hdmi1-out {
+   compatible = "hdmi-connector";
+   type = "a";
+
+   port {
+   hdmi1_con: endpoint {
+   remote-endpoint = <_dw_hdmi1_out>;
+   };
+   };
+   };
+
+   programable_clk0: clock_out0 {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <14850>;
+   };
+
+   x21_clk: x21-clock {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <3300>;
+   };
+
+   x22_clk: x22-clock {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <3300>;
+   };
+
+   programable_clk1: clock_out1 {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <10800>;
+   };
 };

  {
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
status = "okay";

+   backlight = < 7 GPIO_ACTIVE_HIGH>;
+
ports {
port at 0 {
endpoint {
remote-endpoint = <_in>;
};
};
+   port at 1 {
+   endpoint {
+   remote-endpoint = <_dw_hdmi0_in>;
+   };
+   };
+   port at 2 {
+   endpoint {
+   remote-endpoint = <_dw_hdmi1_in>;
+   };
+   };
};
 };

@@ -256,6 +358,11 @@
groups = "usb2";
function = "usb2";
};
+
+   du_pins: du {
+   groups = "du_rgb888", "du_sync", "du_clk_out_0", "du_disp";
+   function = "du";
+   };
 };

  {
-- 
2.7.4



[RFC 17/21] arm64: dts: r8a7795: Add HDMI encoder support

2016-05-30 Thread Ulrich Hecht
Based on work by  Koji Matsuoka.

Signed-off-by: Ulrich Hecht 
Signed-off-by: Geert Uytterhoeven 
---
 arch/arm64/boot/dts/renesas/r8a7795.dtsi | 16 
 1 file changed, 16 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
index c9919d2..fcad91a 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -1587,5 +1587,21 @@
};
};
};
+
+   hdmi0: hdmi0 at fead {
+   compatible = "renesas,hdmi";
+   reg = <0 0xfead 0 0x1>;
+   interrupts = <0 389 IRQ_TYPE_LEVEL_HIGH>;
+   clocks = < CPG_MOD 729>;
+   power-domains = < R8A7795_PD_ALWAYS_ON>;
+   };
+
+   hdmi1: hdmi1 at feae {
+   compatible = "renesas,hdmi";
+   reg = <0 0xfeae 0 0x1>;
+   interrupts = <0 436 IRQ_TYPE_LEVEL_HIGH>;
+   clocks = < CPG_MOD 728>;
+   power-domains = < R8A7795_PD_ALWAYS_ON>;
+   };
};
 };
-- 
2.7.4



[RFC 16/21] pinctrl: sh-pfc: r8a7795: Add HDMI CEC support

2016-05-30 Thread Ulrich Hecht
Adds DU pinmux support to r8a7795 SoC.
Based on work by Takeshi Kihara.

Signed-off-by: Ulrich Hecht 
Signed-off-by: Geert Uytterhoeven 
---
 drivers/pinctrl/sh-pfc/pfc-r8a7795.c | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c 
b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
index 66cee18..515b88f 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
@@ -1721,6 +1721,21 @@ static const unsigned int du_disp_pins[] = {
 static const unsigned int du_disp_mux[] = {
DU_DISP_MARK,
 };
+/* - HDMI --- 
*/
+static const unsigned int hdmi0_cec_pins[] = {
+   /* HDMI0_CEC */
+   RCAR_GP_PIN(7, 2),
+};
+static const unsigned int hdmi0_cec_mux[] = {
+   HDMI0_CEC_MARK,
+};
+static const unsigned int hdmi1_cec_pins[] = {
+   /* HDMI0_CEC */
+   RCAR_GP_PIN(7, 3),
+};
+static const unsigned int hdmi1_cec_mux[] = {
+   HDMI1_CEC_MARK,
+};

 /* - HSCIF0 - 
*/
 static const unsigned int hscif0_data_pins[] = {
@@ -3421,6 +3436,8 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
SH_PFC_PIN_GROUP(du_oddf),
SH_PFC_PIN_GROUP(du_cde),
SH_PFC_PIN_GROUP(du_disp),
+   SH_PFC_PIN_GROUP(hdmi0_cec),
+   SH_PFC_PIN_GROUP(hdmi1_cec),
SH_PFC_PIN_GROUP(hscif0_data),
SH_PFC_PIN_GROUP(hscif0_clk),
SH_PFC_PIN_GROUP(hscif0_ctrl),
@@ -3660,6 +3677,14 @@ static const char * const du_groups[] = {
"du_disp",
 };

+static const char * const hdmi0_groups[] = {
+   "hdmi0_cec",
+};
+
+static const char * const hdmi1_groups[] = {
+   "hdmi1_cec",
+};
+
 static const char * const audio_clk_groups[] = {
"audio_clk_a_a",
"audio_clk_a_b",
@@ -4058,6 +4083,8 @@ static const struct sh_pfc_function pinmux_functions[] = {
SH_PFC_FUNCTION(canfd0),
SH_PFC_FUNCTION(canfd1),
SH_PFC_FUNCTION(du),
+   SH_PFC_FUNCTION(hdmi0),
+   SH_PFC_FUNCTION(hdmi1),
SH_PFC_FUNCTION(hscif0),
SH_PFC_FUNCTION(hscif1),
SH_PFC_FUNCTION(hscif2),
-- 
2.7.4



[RFC 15/21] pinctrl: sh-pfc: r8a7795: Add DU support

2016-05-30 Thread Ulrich Hecht
Adds DU pinmux support to r8a7795 SoC.
Based on work by Takeshi Kihara.

Signed-off-by: Ulrich Hecht 
Signed-off-by: Geert Uytterhoeven 
---
 drivers/pinctrl/sh-pfc/pfc-r8a7795.c | 86 
 1 file changed, 86 insertions(+)

diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c 
b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
index 44632b1..66cee18 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
@@ -1654,6 +1654,74 @@ static const unsigned int canfd1_data_mux[] = {
CANFD1_TX_MARK, CANFD1_RX_MARK,
 };

+/* - DU - 
*/
+static const unsigned int du_rgb888_pins[] = {
+   /* R[7:0] */
+   RCAR_GP_PIN(0, 15), RCAR_GP_PIN(0, 14), RCAR_GP_PIN(0, 13),
+   RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 11), RCAR_GP_PIN(0, 10),
+   RCAR_GP_PIN(0, 9),  RCAR_GP_PIN(3, 8),
+
+   /* G[7:0] */
+   RCAR_GP_PIN(1, 15), RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 13),
+   RCAR_GP_PIN(1, 12), RCAR_GP_PIN(1, 19), RCAR_GP_PIN(1, 18),
+   RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 16),
+
+   /* B[7:0] */
+   RCAR_GP_PIN(1, 7),  RCAR_GP_PIN(1, 6),  RCAR_GP_PIN(1, 5),
+   RCAR_GP_PIN(1, 4),  RCAR_GP_PIN(1, 3),  RCAR_GP_PIN(1, 2),
+   RCAR_GP_PIN(1, 1),  RCAR_GP_PIN(1, 0),
+};
+static const unsigned int du_rgb888_mux[] = {
+   DU_DR7_MARK, DU_DR6_MARK, DU_DR5_MARK, DU_DR4_MARK,
+   DU_DR3_MARK, DU_DR2_MARK, DU_DR1_MARK, DU_DR0_MARK,
+   DU_DG7_MARK, DU_DG6_MARK, DU_DG5_MARK, DU_DG4_MARK,
+   DU_DG3_MARK, DU_DG2_MARK, DU_DG1_MARK, DU_DG0_MARK,
+   DU_DB7_MARK, DU_DB6_MARK, DU_DB5_MARK, DU_DB4_MARK,
+   DU_DB3_MARK, DU_DB2_MARK, DU_DB1_MARK, DU_DB0_MARK,
+};
+static const unsigned int du_clk_out_0_pins[] = {
+   /* CLKOUT */
+   RCAR_GP_PIN(1, 27),
+};
+static const unsigned int du_clk_out_0_mux[] = {
+   DU_DOTCLKOUT0_MARK
+};
+static const unsigned int du_clk_out_1_pins[] = {
+   /* CLKOUT */
+   RCAR_GP_PIN(2, 3),
+};
+static const unsigned int du_clk_out_1_mux[] = {
+   DU_DOTCLKOUT1_MARK
+};
+static const unsigned int du_sync_pins[] = {
+   /* EXVSYNC/VSYNC, EXHSYNC/HSYNC */
+   RCAR_GP_PIN(2, 5), RCAR_GP_PIN(2, 4),
+};
+static const unsigned int du_sync_mux[] = {
+   DU_EXVSYNC_DU_VSYNC_MARK, DU_EXHSYNC_DU_HSYNC_MARK
+};
+static const unsigned int du_oddf_pins[] = {
+   /* EXDISP/EXODDF/EXCDE */
+   RCAR_GP_PIN(2, 2),
+};
+static const unsigned int du_oddf_mux[] = {
+   DU_EXODDF_DU_ODDF_DISP_CDE_MARK,
+};
+static const unsigned int du_cde_pins[] = {
+   /* CDE */
+   RCAR_GP_PIN(2, 0),
+};
+static const unsigned int du_cde_mux[] = {
+   DU_CDE_MARK,
+};
+static const unsigned int du_disp_pins[] = {
+   /* DISP */
+   RCAR_GP_PIN(2, 1),
+};
+static const unsigned int du_disp_mux[] = {
+   DU_DISP_MARK,
+};
+
 /* - HSCIF0 - 
*/
 static const unsigned int hscif0_data_pins[] = {
/* RX, TX */
@@ -3346,6 +3414,13 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
SH_PFC_PIN_GROUP(canfd0_data_a),
SH_PFC_PIN_GROUP(canfd0_data_b),
SH_PFC_PIN_GROUP(canfd1_data),
+   SH_PFC_PIN_GROUP(du_rgb888),
+   SH_PFC_PIN_GROUP(du_clk_out_0),
+   SH_PFC_PIN_GROUP(du_clk_out_1),
+   SH_PFC_PIN_GROUP(du_sync),
+   SH_PFC_PIN_GROUP(du_oddf),
+   SH_PFC_PIN_GROUP(du_cde),
+   SH_PFC_PIN_GROUP(du_disp),
SH_PFC_PIN_GROUP(hscif0_data),
SH_PFC_PIN_GROUP(hscif0_clk),
SH_PFC_PIN_GROUP(hscif0_ctrl),
@@ -3575,6 +3650,16 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
SH_PFC_PIN_GROUP(usb2),
 };

+static const char * const du_groups[] = {
+   "du_rgb888",
+   "du_clk_out_0",
+   "du_clk_out_1",
+   "du_sync",
+   "du_oddf",
+   "du_cde",
+   "du_disp",
+};
+
 static const char * const audio_clk_groups[] = {
"audio_clk_a_a",
"audio_clk_a_b",
@@ -3972,6 +4057,7 @@ static const struct sh_pfc_function pinmux_functions[] = {
SH_PFC_FUNCTION(can_clk),
SH_PFC_FUNCTION(canfd0),
SH_PFC_FUNCTION(canfd1),
+   SH_PFC_FUNCTION(du),
SH_PFC_FUNCTION(hscif0),
SH_PFC_FUNCTION(hscif1),
SH_PFC_FUNCTION(hscif2),
-- 
2.7.4



[RFC 14/21] v4l: vsp1: Change VSP1 LIF linebuffer FIFO

2016-05-30 Thread Ulrich Hecht
This patch changes to VSPD hardware recommended value.
Purpose is highest pixel clock without underruns.
In the default R-Car Linux BSP config this value is
wrong and therefore there are many underruns.

Signed-off-by: Takashi Saito 
Signed-off-by: Koji Matsuoka 
Signed-off-by: Ulrich Hecht 
Signed-off-by: Geert Uytterhoeven 
---
 drivers/media/platform/vsp1/vsp1_lif.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_lif.c 
b/drivers/media/platform/vsp1/vsp1_lif.c
index 60d26b6..b34e80f 100644
--- a/drivers/media/platform/vsp1/vsp1_lif.c
+++ b/drivers/media/platform/vsp1/vsp1_lif.c
@@ -126,9 +126,9 @@ static void lif_configure(struct vsp1_entity *entity,
 {
const struct v4l2_mbus_framefmt *format;
struct vsp1_lif *lif = to_lif(>subdev);
-   unsigned int hbth = 1300;
-   unsigned int obth = 400;
-   unsigned int lbth = 200;
+   unsigned int hbth = 0;
+   unsigned int obth = 3000;
+   unsigned int lbth = 0;

format = vsp1_entity_get_pad_format(>entity, lif->entity.config,
LIF_PAD_SOURCE);
-- 
2.7.4



[RFC 13/21] drm: rcar-du: Fix display max size to 4096x2160 size

2016-05-30 Thread Ulrich Hecht
From: Koji Matsuoka 

Signed-off-by: Koji Matsuoka 
Signed-off-by: Geert Uytterhoeven 
---
 drivers/gpu/drm/rcar-du/rcar_du_kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c 
b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index a8c59c3..d6d9acb 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -611,8 +611,8 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)

dev->mode_config.min_width = 0;
dev->mode_config.min_height = 0;
-   dev->mode_config.max_width = 4095;
-   dev->mode_config.max_height = 2047;
+   dev->mode_config.max_width = 4096;
+   dev->mode_config.max_height = 2160;
dev->mode_config.funcs = _du_mode_config_funcs;

rcdu->num_crtcs = rcdu->info->num_crtcs;
-- 
2.7.4



[RFC 12/21] drm: rcar-du: Add pixel format support

2016-05-30 Thread Ulrich Hecht
From: Koji Matsuoka 

This patch supports pixel format of RGB332, ARGB, XRGB,
BGR888, RGB888, BGRA, BGRX, YVYU and NV61.
VYUY format is not supported by H/W.

Signed-off-by: Koji Matsuoka 
Signed-off-by: Geert Uytterhoeven 
---
 drivers/gpu/drm/rcar-du/rcar_du_kms.c | 58 +--
 drivers/gpu/drm/rcar-du/rcar_du_kms.h |  1 +
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 49 +
 3 files changed, 106 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c 
b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index baac8c9..a8c59c3 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -95,6 +95,40 @@ static const struct rcar_du_format_info 
rcar_du_format_infos[] = {
.planes = 2,
.pnmr = PnMR_SPIM_TP_OFF | PnMR_DDDF_YC,
.edf = PnDDCR4_EDF_NONE,
+   }, {
+   .fourcc = DRM_FORMAT_NV61,
+   .bpp = 16,
+   .planes = 2,
+   .pnmr = PnMR_SPIM_TP_OFF | PnMR_DDDF_YC,
+   .edf = PnDDCR4_EDF_NONE,
+   },
+};
+
+static const struct rcar_du_format_info rcar_vsp_format_infos[] = {
+   {
+   .fourcc = DRM_FORMAT_RGB332,
+   .bpp = 8,
+   }, {
+   .fourcc = DRM_FORMAT_ARGB,
+   .bpp = 16,
+   }, {
+   .fourcc = DRM_FORMAT_XRGB,
+   .bpp = 16,
+   }, {
+   .fourcc = DRM_FORMAT_BGR888,
+   .bpp = 24,
+   }, {
+   .fourcc = DRM_FORMAT_RGB888,
+   .bpp = 24,
+   }, {
+   .fourcc = DRM_FORMAT_BGRA,
+   .bpp = 32,
+   }, {
+   .fourcc = DRM_FORMAT_BGRX,
+   .bpp = 32,
+   }, {
+   .fourcc = DRM_FORMAT_YVYU,
+   .bpp = 16,
},
/* The following formats are not supported on Gen2 and thus have no
 * associated .pnmr or .edf settings.
@@ -142,6 +176,18 @@ const struct rcar_du_format_info *rcar_du_format_info(u32 
fourcc)
return NULL;
 }

+const struct rcar_du_format_info *rcar_vsp_format_info(u32 fourcc)
+{
+   unsigned int i;
+
+   for (i = 0; i < ARRAY_SIZE(rcar_vsp_format_infos); ++i) {
+   if (rcar_vsp_format_infos[i].fourcc == fourcc)
+   return _vsp_format_infos[i];
+   }
+
+   return NULL;
+}
+
 /* 
-
  * Frame buffer
  */
@@ -178,6 +224,15 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file 
*file_priv,
unsigned int i;

format = rcar_du_format_info(mode_cmd->pixel_format);
+
+   if (rcar_du_has(rcdu, RCAR_DU_FEATURE_VSP1_SOURCE) &&
+   (format == NULL)) {
+   format = rcar_vsp_format_info(mode_cmd->pixel_format);
+   }
+
+   if (rcar_du_has(rcdu, RCAR_DU_FEATURE_VSP1_SOURCE) && (format != NULL))
+   goto done;
+
if (format == NULL) {
dev_dbg(dev->dev, "unsupported pixel format %08x\n",
mode_cmd->pixel_format);
@@ -210,7 +265,7 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file 
*file_priv,
return ERR_PTR(-EINVAL);
}
}
-
+done:
return drm_fb_cma_create(dev, file_priv, mode_cmd);
 }

@@ -278,7 +333,6 @@ static void rcar_du_atomic_work(struct work_struct *work)
 {
struct rcar_du_commit *commit =
container_of(work, struct rcar_du_commit, work);
-
rcar_du_atomic_complete(commit);
 }

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.h 
b/drivers/gpu/drm/rcar-du/rcar_du_kms.h
index 07951d5..10eb51a 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.h
@@ -30,6 +30,7 @@ struct rcar_du_format_info {
 };

 const struct rcar_du_format_info *rcar_du_format_info(u32 fourcc);
+const struct rcar_du_format_info *rcar_vsp_format_info(u32 fourcc);

 int rcar_du_modeset_init(struct rcar_du_device *rcdu);

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c 
b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
index 89176e6..94e9181 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
@@ -143,6 +143,28 @@ static const u32 formats_v4l2[] = {
V4L2_PIX_FMT_YVU444M,
 };

+static const u32 formats_xlate[][2] = {
+   { DRM_FORMAT_RGB332, V4L2_PIX_FMT_RGB332 },
+   { DRM_FORMAT_ARGB, V4L2_PIX_FMT_ARGB444 },
+   { DRM_FORMAT_XRGB, V4L2_PIX_FMT_XRGB444 },
+   { DRM_FORMAT_ARGB1555, V4L2_PIX_FMT_ARGB555 },
+   { DRM_FORMAT_XRGB1555, V4L2_PIX_FMT_XRGB555 },
+   { DRM_FORMAT_RGB565, V4L2_PIX_FMT_RGB565 },
+   { DRM_FORMAT_BGR888, V4L2_PIX_FMT_RGB24 },
+   { DRM_FORMAT_RGB888, V4L2_PIX_FMT_BGR24 },
+   { DRM_FORMAT_BGRA, V4L2_PIX_FMT_ARGB32 },

[RFC 11/21] drm: rcar-du: Fix VSP feed plane number

2016-05-30 Thread Ulrich Hecht
From: Koji Matsuoka 

VSP feeds plane1 and plane3 with R-Car Gen3.

Signed-off-by: Koji Matsuoka 
Signed-off-by: Geert Uytterhoeven 
---
 drivers/gpu/drm/rcar-du/rcar_du_plane.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c 
b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
index 8d5e59b..027c4cfb 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
@@ -489,7 +489,9 @@ static void rcar_du_plane_setup_format_gen2(struct 
rcar_du_group *rgrp,
rcar_du_plane_write(rgrp, index, PnDDCR2, ddcr2);

ddcr4 = state->format->edf | PnDDCR4_CODE;
-   if (state->source != RCAR_DU_PLANE_MEMORY)
+
+   if ((state->source != RCAR_DU_PLANE_MEMORY)
+   && (!rcar_du_has(rcdu, RCAR_DU_FEATURE_GEN3_REGS)))
ddcr4 |= PnDDCR4_VSPS;

rcar_du_plane_write(rgrp, index, PnDDCR4, ddcr4);
-- 
2.7.4



[RFC 10/21] drm: rcar-du: Fix VSP plane number per devices

2016-05-30 Thread Ulrich Hecht
From: Koji Matsuoka 

Signed-off-by: Koji Matsuoka 
Signed-off-by: Geert Uytterhoeven 
---
 drivers/gpu/drm/rcar-du/rcar_du_drv.c | 2 ++
 drivers/gpu/drm/rcar-du/rcar_du_drv.h | 3 ++-
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c 
b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index 3907461..26fd3ba 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -108,6 +108,7 @@ static const struct rcar_du_device_info 
rcar_du_r8a7791_info = {
},
},
.num_lvds = 1,
+   .vsp_num = 4,
 };

 static const struct rcar_du_device_info rcar_du_r8a7794_info = {
@@ -167,6 +168,7 @@ static const struct rcar_du_device_info 
rcar_du_r8a7795_info = {
},
.num_lvds = 1,
.dpll_ch =  BIT(1) | BIT(2),
+   .vsp_num = 5,
 };

 static const struct of_device_id rcar_du_of_table[] = {
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h 
b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
index 790829b..6413b7e 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
@@ -70,12 +70,13 @@ struct rcar_du_device_info {
struct rcar_du_output_routing routes[RCAR_DU_OUTPUT_MAX];
unsigned int num_lvds;
unsigned int dpll_ch;
+   unsigned int vsp_num;
 };

 #define RCAR_DU_MAX_CRTCS  4
 #define RCAR_DU_MAX_GROUPS DIV_ROUND_UP(RCAR_DU_MAX_CRTCS, 2)
 #define RCAR_DU_MAX_LVDS   2
-#define RCAR_DU_MAX_VSPS   4
+#define RCAR_DU_MAX_VSPS   5

 struct rcar_du_device {
struct device *dev;
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c 
b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
index 4927fb3..89176e6 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
@@ -349,7 +349,7 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp)
 /* The VSP2D (Gen3) has 5 RPFs, but the VSP1D (Gen2) is limited to
  * 4 RPFs.
  */
-   vsp->num_planes = rcdu->info->gen >= 3 ? 5 : 4;
+   vsp->num_planes = rcdu->info->vsp_num;

vsp->planes = devm_kcalloc(rcdu->dev, vsp->num_planes,
   sizeof(*vsp->planes), GFP_KERNEL);
-- 
2.7.4



[RFC 09/21] drm: rcar-du: Fix display registers for R-Car Gen3

2016-05-30 Thread Ulrich Hecht
From: Koji Matsuoka 

Signed-off-by: Koji Matsuoka 
Signed-off-by: Geert Uytterhoeven 
---
 drivers/gpu/drm/rcar-du/rcar_du_drv.c   | 3 ++-
 drivers/gpu/drm/rcar-du/rcar_du_group.c | 5 +
 drivers/gpu/drm/rcar-du/rcar_du_plane.c | 4 +++-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c 
b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index 5ed0d61..3907461 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -137,7 +137,8 @@ static const struct rcar_du_device_info 
rcar_du_r8a7795_info = {
.gen = 3,
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
  | RCAR_DU_FEATURE_EXT_CTRL_REGS
- | RCAR_DU_FEATURE_VSP1_SOURCE,
+ | RCAR_DU_FEATURE_VSP1_SOURCE
+ | RCAR_DU_FEATURE_GEN3_REGS,
.num_crtcs = 4,
.routes = {
/* R8A7795 has one RGB output, two HDMI outputs and one
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.c 
b/drivers/gpu/drm/rcar-du/rcar_du_group.c
index 33b2fc5..55dd3bd 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_group.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_group.c
@@ -101,6 +101,11 @@ static void rcar_du_group_setup(struct rcar_du_group *rgrp)
rcar_du_group_write(rgrp, DEFR5, DEFR5_CODE | DEFR5_DEFE5);

rcar_du_group_setup_pins(rgrp);
+   if (rcdu->info->gen == 3) {
+   rcar_du_group_write(rgrp, DEFR6, DEFR6_CODE |
+ DEFR6_ODPM22_DISP);
+   rcar_du_group_write(rgrp, DEFR10, DEFR10_CODE | DEFR10_DEFE10);
+   }

if (rcar_du_has(rgrp->dev, RCAR_DU_FEATURE_EXT_CTRL_REGS)) {
rcar_du_group_setup_defr8(rgrp);
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c 
b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
index 8460ae1..8d5e59b 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
@@ -458,6 +458,7 @@ static void rcar_du_plane_setup_format_gen2(struct 
rcar_du_group *rgrp,
unsigned int index,
const struct rcar_du_plane_state 
*state)
 {
+   struct rcar_du_device *rcdu = rgrp->dev;
u32 ddcr2 = PnDDCR2_CODE;
u32 ddcr4;

@@ -484,7 +485,8 @@ static void rcar_du_plane_setup_format_gen2(struct 
rcar_du_group *rgrp,
}
}

-   rcar_du_plane_write(rgrp, index, PnDDCR2, ddcr2);
+   if (!rcar_du_has(rcdu, RCAR_DU_FEATURE_GEN3_REGS))
+   rcar_du_plane_write(rgrp, index, PnDDCR2, ddcr2);

ddcr4 = state->format->edf | PnDDCR4_CODE;
if (state->source != RCAR_DU_PLANE_MEMORY)
-- 
2.7.4



[RFC 08/21] drm: rcar-du: Add DPLL support

2016-05-30 Thread Ulrich Hecht
From: Koji Matsuoka 

Signed-off-by: Koji Matsuoka 
Signed-off-by: Geert Uytterhoeven 
---
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c  | 97 -
 drivers/gpu/drm/rcar-du/rcar_du_crtc.h  |  8 +++
 drivers/gpu/drm/rcar-du/rcar_du_drv.c   |  1 +
 drivers/gpu/drm/rcar-du/rcar_du_drv.h   |  1 +
 drivers/gpu/drm/rcar-du/rcar_du_plane.h |  7 ++-
 drivers/gpu/drm/rcar-du/rcar_du_regs.h  | 19 +++
 6 files changed, 131 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c 
b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index 0d8bdda..e10943b 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -30,6 +30,12 @@
 #include "rcar_du_regs.h"
 #include "rcar_du_vsp.h"

+#define PRODUCT_REG0xfff00044
+#define PRODUCT_H3_BIT (0x4f << 8)
+#define PRODUCT_MASK   (0x7f << 8)
+#define CUT_ES1(0x00)
+#define CUT_ES1_MASK   (0x00ff)
+
 static u32 rcar_du_crtc_read(struct rcar_du_crtc *rcrtc, u32 reg)
 {
struct rcar_du_device *rcdu = rcrtc->group->dev;
@@ -106,14 +112,74 @@ static void rcar_du_crtc_put(struct rcar_du_crtc *rcrtc)
  * Hardware Setup
  */

+static void rcar_du_dpll_divider(struct dpll_info *dpll, unsigned int extclk,
+unsigned int mode_clock)
+{
+   unsigned long dpllclk;
+   unsigned long diff;
+   unsigned long n, m, fdpll;
+   bool match_flag = false;
+   bool clk_diff_set = true;
+
+   for (n = 39; n < 120; n++) {
+   for (m = 0; m < 4; m++) {
+   for (fdpll = 1; fdpll < 32; fdpll++) {
+   /* 1/2 (FRQSEL=1) for duty rate 50% */
+   dpllclk = extclk * (n + 1) / (m + 1)
+/ (fdpll + 1) / 2;
+   if (dpllclk >= 4)
+   continue;
+
+   diff = abs((long)dpllclk - (long)mode_clock);
+   if (clk_diff_set ||
+   ((diff == 0) || (dpll->diff > diff))) {
+   dpll->diff = diff;
+   dpll->n = n;
+   dpll->m = m;
+   dpll->fdpll = fdpll;
+   dpll->dpllclk = dpllclk;
+
+   if (clk_diff_set)
+   clk_diff_set = false;
+
+   if (diff == 0) {
+   match_flag = true;
+   break;
+   }
+   }
+   }
+   if (match_flag)
+   break;
+   }
+   if (match_flag)
+   break;
+   }
+}
+
 static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)
 {
const struct drm_display_mode *mode = >crtc.state->adjusted_mode;
+   struct rcar_du_device *rcdu = rcrtc->group->dev;
unsigned long mode_clock = mode->clock * 1000;
unsigned long clk;
u32 value;
u32 escr;
u32 div;
+   u32 dpll_reg = 0;
+   struct dpll_info *dpll;
+   void __iomem *product_reg;
+   bool h3_es1_workaround = false;
+
+   dpll = kzalloc(sizeof(*dpll), GFP_KERNEL);
+   if (dpll == NULL)
+   return;
+
+   /* DU2 DPLL Clock Select bit workaround in R-Car H3(ES1.0) */
+   product_reg = ioremap(PRODUCT_REG, 0x04);
+   if (((readl(product_reg) & PRODUCT_MASK) == PRODUCT_H3_BIT)
+   && ((readl(product_reg) & CUT_ES1_MASK) == CUT_ES1))
+   h3_es1_workaround = true;
+   iounmap(product_reg);

/* Compute the clock divisor and select the internal or external dot
 * clock based on the requested frequency.
@@ -130,6 +196,15 @@ static void rcar_du_crtc_set_display_timing(struct 
rcar_du_crtc *rcrtc)
u32 extdiv;

extclk = clk_get_rate(rcrtc->extclock);
+
+   if (rcdu->info->dpll_ch & (0x01 << rcrtc->index)) {
+   rcar_du_dpll_divider(dpll, extclk, mode_clock);
+   extclk = dpll->dpllclk;
+   dev_dbg(rcrtc->group->dev->dev,
+   "dpllclk:%d, fdpll:%d, n:%d, m:%d, diff:%d\n",
+dpll->dpllclk, dpll->fdpll, dpll->n, dpll->m,
+dpll->diff);
+   }
extdiv = DIV_ROUND_CLOSEST(extclk, mode_clock);
extdiv = clamp(extdiv, 1U, 64U) - 1;

@@ -140,7 +215,27 @@ static void rcar_du_crtc_set_display_timing(struct 
rcar_du_crtc *rcrtc)
  

[RFC 07/21] drm: rcar-du: Add dw_hdmi driver startup

2016-05-30 Thread Ulrich Hecht
From: Koji Matsuoka 

The HDMI driver in the R-Car Gen3 uses dw_hdmi driver.

Signed-off-by: Koji Matsuoka 
[geert: Select DRM_DW_HDMI on non-r8a7795 to fix shmobile_defconfig build]
Signed-off-by: Geert Uytterhoeven 
---
 drivers/gpu/drm/rcar-du/Kconfig   |   2 +
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c |   9 +-
 drivers/gpu/drm/rcar-du/rcar_du_encoder.h |   6 +-
 drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c | 225 +++---
 drivers/gpu/drm/rcar-du/rcar_du_kms.c |   6 +-
 5 files changed, 227 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/Kconfig b/drivers/gpu/drm/rcar-du/Kconfig
index 7fc3ca5..d7c7ffa 100644
--- a/drivers/gpu/drm/rcar-du/Kconfig
+++ b/drivers/gpu/drm/rcar-du/Kconfig
@@ -15,6 +15,8 @@ config DRM_RCAR_DU
 config DRM_RCAR_HDMI
bool "R-Car DU HDMI Encoder Support"
depends on DRM_RCAR_DU
+   depends on OF
+   select DRM_DW_HDMI
help
  Enable support for external HDMI encoders.

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c 
b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
index 1b16297..5d64893 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
@@ -1,7 +1,7 @@
 /*
  * rcar_du_encoder.c  --  R-Car Display Unit Encoder
  *
- * Copyright (C) 2013-2014 Renesas Electronics Corporation
+ * Copyright (C) 2013-2015 Renesas Electronics Corporation
  *
  * Contact: Laurent Pinchart (laurent.pinchart at ideasonboard.com)
  *
@@ -118,7 +118,8 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
 enum rcar_du_encoder_type type,
 enum rcar_du_output output,
 struct device_node *enc_node,
-struct device_node *con_node)
+struct device_node *con_node,
+const char *device_name)
 {
struct rcar_du_encoder *renc;
struct drm_encoder *encoder;
@@ -162,8 +163,12 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
break;
}

+   renc->device_name = device_name;
+
if (type == RCAR_DU_ENCODER_HDMI) {
ret = rcar_du_hdmienc_init(rcdu, renc, enc_node);
+   if (of_device_is_compatible(enc_node, "rockchip,rcar-dw-hdmi"))
+   goto done;
if (ret < 0)
goto done;
} else {
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.h 
b/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
index dde523a..51a4664 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
@@ -1,7 +1,7 @@
 /*
  * rcar_du_encoder.h  --  R-Car Display Unit Encoder
  *
- * Copyright (C) 2013-2014 Renesas Electronics Corporation
+ * Copyright (C) 2013-2015 Renesas Electronics Corporation
  *
  * Contact: Laurent Pinchart (laurent.pinchart at ideasonboard.com)
  *
@@ -33,6 +33,7 @@ struct rcar_du_encoder {
enum rcar_du_output output;
struct rcar_du_hdmienc *hdmi;
struct rcar_du_lvdsenc *lvds;
+   const char *device_name;
 };

 #define to_rcar_encoder(e) \
@@ -55,6 +56,7 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
 enum rcar_du_encoder_type type,
 enum rcar_du_output output,
 struct device_node *enc_node,
-struct device_node *con_node);
+struct device_node *con_node,
+const char *device_name);

 #endif /* __RCAR_DU_ENCODER_H__ */
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c 
b/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c
index 15d553a..b8b89a0 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c
@@ -1,7 +1,7 @@
 /*
  * R-Car Display Unit HDMI Encoder
  *
- * Copyright (C) 2014 Renesas Electronics Corporation
+ * Copyright (C) 2014-2015 Renesas Electronics Corporation
  *
  * Contact: Laurent Pinchart (laurent.pinchart at ideasonboard.com)
  *
@@ -13,10 +13,13 @@

 #include 

+#include 
 #include 
 #include 
 #include 

+#include 
+
 #include "rcar_du_drv.h"
 #include "rcar_du_encoder.h"
 #include "rcar_du_hdmienc.h"
@@ -24,7 +27,9 @@

 struct rcar_du_hdmienc {
struct rcar_du_encoder *renc;
+   struct device *dev;
bool enabled;
+   unsigned int index;
 };

 #define to_rcar_hdmienc(e) (to_rcar_encoder(e)->hdmi)
@@ -32,6 +37,10 @@ struct rcar_du_hdmienc {
 static void rcar_du_hdmienc_disable(struct drm_encoder *encoder)
 {
struct rcar_du_hdmienc *hdmienc = to_rcar_hdmienc(encoder);
+   const struct drm_bridge_funcs *bfuncs = encoder->bridge->funcs;
+
+   if ((bfuncs) && (bfuncs->post_disable))
+   bfuncs->post_disable(encoder->bridge);

if (hdmienc->renc->lvds)
rcar_du_lvdsenc_enable(hdmienc->renc->lvds, 

[RFC 06/21] drm: rcar-du: Add R8A7795 device support

2016-05-30 Thread Ulrich Hecht
From: Koji Matsuoka 

Signed-off-by: Koji Matsuoka 
Signed-off-by: Geert Uytterhoeven 
---
 drivers/gpu/drm/rcar-du/rcar_du_crtc.h |  4 +++-
 drivers/gpu/drm/rcar-du/rcar_du_drv.c  | 14 --
 drivers/gpu/drm/rcar-du/rcar_du_drv.h  |  2 ++
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h 
b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
index 6f08b7e..459e539 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
@@ -1,7 +1,7 @@
 /*
  * rcar_du_crtc.h  --  R-Car Display Unit CRTCs
  *
- * Copyright (C) 2013-2014 Renesas Electronics Corporation
+ * Copyright (C) 2013-2015 Renesas Electronics Corporation
  *
  * Contact: Laurent Pinchart (laurent.pinchart at ideasonboard.com)
  *
@@ -61,6 +61,8 @@ enum rcar_du_output {
RCAR_DU_OUTPUT_DPAD1,
RCAR_DU_OUTPUT_LVDS0,
RCAR_DU_OUTPUT_LVDS1,
+   RCAR_DU_OUTPUT_HDMI0,
+   RCAR_DU_OUTPUT_HDMI1,
RCAR_DU_OUTPUT_TCON,
RCAR_DU_OUTPUT_MAX,
 };
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c 
b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index fb9242d..0a93d2a 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -140,14 +140,24 @@ static const struct rcar_du_device_info 
rcar_du_r8a7795_info = {
  | RCAR_DU_FEATURE_VSP1_SOURCE,
.num_crtcs = 4,
.routes = {
-   /* R8A7795 has one RGB output, one LVDS output and two
-* (currently unsupported) HDMI outputs.
+   /* R8A7795 has one RGB output, two HDMI outputs and one
+* LVDS output.
 */
[RCAR_DU_OUTPUT_DPAD0] = {
.possible_crtcs = BIT(3),
.encoder_type = DRM_MODE_ENCODER_NONE,
.port = 0,
},
+   [RCAR_DU_OUTPUT_HDMI0] = {
+   .possible_crtcs = BIT(1),
+   .encoder_type = RCAR_DU_ENCODER_HDMI,
+   .port = 1,
+   },
+   [RCAR_DU_OUTPUT_HDMI1] = {
+   .possible_crtcs = BIT(2),
+   .encoder_type = RCAR_DU_ENCODER_HDMI,
+   .port = 2,
+   },
[RCAR_DU_OUTPUT_LVDS0] = {
.possible_crtcs = BIT(0),
.encoder_type = DRM_MODE_ENCODER_LVDS,
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h 
b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
index ed35467..d1d1d8d 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
@@ -20,6 +20,7 @@
 #include "rcar_du_crtc.h"
 #include "rcar_du_group.h"
 #include "rcar_du_vsp.h"
+#include "rcar_du_encoder.h"

 struct clk;
 struct device;
@@ -31,6 +32,7 @@ struct rcar_du_lvdsenc;
 #define RCAR_DU_FEATURE_CRTC_IRQ_CLOCK (1 << 0)/* Per-CRTC IRQ and 
clock */
 #define RCAR_DU_FEATURE_EXT_CTRL_REGS  (1 << 1)/* Has extended control 
registers */
 #define RCAR_DU_FEATURE_VSP1_SOURCE(1 << 2)/* Has inputs from VSP1 
*/
+#define RCAR_DU_FEATURE_GEN3_REGS  (1 << 3)/* Use Gen3 registers */

 #define RCAR_DU_QUIRK_ALIGN_128B   (1 << 0)/* Align pitches to 128 
bytes */
 #define RCAR_DU_QUIRK_LVDS_LANES   (1 << 1)/* LVDS lanes 1 and 3 
inverted */
-- 
2.7.4



[RFC 05/21] drm: bridge/dw_hdmi: Fix R-Car Gen3 device support

2016-05-30 Thread Ulrich Hecht
From: Koji Matsuoka 

Signed-off-by: Koji Matsuoka 
Signed-off-by: Geert Uytterhoeven 
---
 drivers/gpu/drm/bridge/dw-hdmi.c | 158 ++-
 include/drm/bridge/dw_hdmi.h |   9 +++
 2 files changed, 131 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
index 1cfff2f..55e73e8 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw-hdmi.c
@@ -1,6 +1,7 @@
 /*
  * DesignWare High-Definition Multimedia Interface (HDMI) driver
  *
+ * Copyright (C) 2015 Renesas Electronics Corporation
  * Copyright (C) 2013-2015 Mentor Graphics Inc.
  * Copyright (C) 2011-2013 Freescale Semiconductor, Inc.
  * Copyright (C) 2010, Guennadi Liakhovetski 
@@ -21,6 +22,7 @@
 #include 
 #include 

+#include 
 #include 
 #include 
 #include 
@@ -143,6 +145,7 @@ struct dw_hdmi {
struct device *dev;
struct clk *isfr_clk;
struct clk *iahb_clk;
+
struct dw_hdmi_i2c *i2c;

struct hdmi_data_info hdmi_data;
@@ -174,6 +177,11 @@ struct dw_hdmi {
unsigned int audio_cts;
unsigned int audio_n;
bool audio_enable;
+   int ratio;
+   bool interlaced;
+   bool isfr_use;
+   bool iahb_use;
+   int num;

void (*write)(struct dw_hdmi *hdmi, u8 val, int offset);
u8 (*read)(struct dw_hdmi *hdmi, int offset);
@@ -1008,6 +1016,7 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, 
unsigned char prep,
const struct dw_hdmi_mpll_config *mpll_config = pdata->mpll_cfg;
const struct dw_hdmi_curr_ctrl *curr_ctrl = pdata->cur_ctr;
const struct dw_hdmi_phy_config *phy_config = pdata->phy_config;
+   const struct dw_hdmi_multi_div *multi_div = pdata->multi_div;

if (prep)
return -EINVAL;
@@ -1043,6 +1052,13 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, 
unsigned char prep,
phy_config->mpixelclock)
break;

+   if (hdmi->dev_type == RCAR_HDMI) {
+   for (; multi_div->mpixelclock != (~0UL); multi_div++)
+   if (hdmi->hdmi_data.video_mode.mpixelclock <=
+   multi_div->mpixelclock)
+   break;
+   }
+
if (mpll_config->mpixelclock == ~0UL ||
curr_ctrl->mpixelclock == ~0UL ||
phy_config->mpixelclock == ~0UL) {
@@ -1051,6 +1067,13 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, 
unsigned char prep,
return -EINVAL;
}

+   if ((multi_div->mpixelclock == ~0UL) &&
+   (hdmi->dev_type == RCAR_HDMI)) {
+   dev_err(hdmi->dev, "Pixel clock %d - unsupported by HDMI\n",
+   hdmi->hdmi_data.video_mode.mpixelclock);
+   return -EINVAL;
+   }
+
/* Enable csc path */
if (cscon)
val = HDMI_MC_FLOWCTRL_FEED_THROUGH_OFF_CSC_IN_PATH;
@@ -1077,21 +1100,27 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, 
unsigned char prep,
hdmi_phy_test_clear(hdmi, 0);

hdmi_phy_i2c_write(hdmi, mpll_config->res[res_idx].cpce, 0x06);
-   hdmi_phy_i2c_write(hdmi, mpll_config->res[res_idx].gmp, 0x15);
+   if (hdmi->dev_type != RCAR_HDMI)
+   hdmi_phy_i2c_write(hdmi, mpll_config->res[res_idx].gmp, 0x15);

/* CURRCTRL */
hdmi_phy_i2c_write(hdmi, curr_ctrl->curr[res_idx], 0x10);

-   hdmi_phy_i2c_write(hdmi, 0x, 0x13);  /* PLLPHBYCTRL */
-   hdmi_phy_i2c_write(hdmi, 0x0006, 0x17);
-
-   hdmi_phy_i2c_write(hdmi, phy_config->term, 0x19);  /* TXTERM */
-   hdmi_phy_i2c_write(hdmi, phy_config->sym_ctr, 0x09); /* CKSYMTXCTRL */
-   hdmi_phy_i2c_write(hdmi, phy_config->vlev_ctr, 0x0E); /* VLEVCTRL */
+   if (hdmi->dev_type == RCAR_HDMI)
+   hdmi_phy_i2c_write(hdmi, multi_div->multi[res_idx], 0x11);

-   /* REMOVE CLK TERM */
-   hdmi_phy_i2c_write(hdmi, 0x8000, 0x05);  /* CKCALCTRL */
+   if (hdmi->dev_type != RCAR_HDMI) {
+   hdmi_phy_i2c_write(hdmi, 0x, 0x13);  /* PLLPHBYCTRL */
+   hdmi_phy_i2c_write(hdmi, 0x0006, 0x17);

+   hdmi_phy_i2c_write(hdmi, phy_config->term, 0x19);  /* TXTERM */
+   hdmi_phy_i2c_write(hdmi, phy_config->sym_ctr,
+0x09); /* CKSYMTXCTRL */
+   hdmi_phy_i2c_write(hdmi, phy_config->vlev_ctr,
+0x0E); /* VLEVCTRL */
+   /* REMOVE CLK TERM */
+   hdmi_phy_i2c_write(hdmi, 0x8000, 0x05);  /* CKCALCTRL */
+   }
dw_hdmi_phy_enable_powerdown(hdmi, false);

/* toggle TMDS enable */
@@ -1102,7 +1131,8 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, 
unsigned char prep,
dw_hdmi_phy_gen2_txpwron(hdmi, 1);
dw_hdmi_phy_gen2_pddq(hdmi, 0);

-   if 

[RFC 04/21] drm: bridge/dw_hdmi: add dw hdmi i2c bus adapter support

2016-05-30 Thread Ulrich Hecht
From: Vladimir Zapolskiy 

The change adds support of internal HDMI I2C master controller, this
subdevice is used by default, if "ddc-i2c-bus" DT property is omitted.

The main purpose of this functionality is to support reading EDID from
an HDMI monitor on boards, which don't have an I2C bus connected to
DDC pins.

Signed-off-by: Vladimir Zapolskiy 
Signed-off-by: Koji Matsuoka 
Signed-off-by: Geert Uytterhoeven 
---
 drivers/gpu/drm/bridge/dw-hdmi.c | 331 ++-
 1 file changed, 325 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
index c9d9412..1cfff2f 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw-hdmi.c
@@ -1,14 +1,15 @@
 /*
+ * DesignWare High-Definition Multimedia Interface (HDMI) driver
+ *
+ * Copyright (C) 2013-2015 Mentor Graphics Inc.
  * Copyright (C) 2011-2013 Freescale Semiconductor, Inc.
+ * Copyright (C) 2010, Guennadi Liakhovetski 
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * Designware High-Definition Multimedia Interface (HDMI) driver
- *
- * Copyright (C) 2010, Guennadi Liakhovetski 
  */
 #include 
 #include 
@@ -31,6 +32,26 @@
 #include "dw-hdmi.h"
 #include "dw-hdmi-audio.h"

+/* HDMI_IH_I2CM_STAT0 and HDMI_IH_MUTE_I2CM_STAT0 register bits */
+#define HDMI_IH_I2CM_STAT0_ERROR   BIT(0)
+#define HDMI_IH_I2CM_STAT0_DONEBIT(1)
+
+/* HDMI_I2CM_OPERATION register bits */
+#define HDMI_I2CM_OPERATION_READ   BIT(0)
+#define HDMI_I2CM_OPERATION_READ_EXT   BIT(1)
+#define HDMI_I2CM_OPERATION_WRITE  BIT(4)
+
+/* HDMI_I2CM_INT register bits */
+#define HDMI_I2CM_INT_DONE_MASKBIT(2)
+#define HDMI_I2CM_INT_DONE_POL BIT(3)
+
+/* HDMI_I2CM_CTLINT register bits */
+#define HDMI_I2CM_CTLINT_ARB_MASK  BIT(2)
+#define HDMI_I2CM_CTLINT_ARB_POL   BIT(3)
+#define HDMI_I2CM_CTLINT_NAC_MASK  BIT(6)
+#define HDMI_I2CM_CTLINT_NAC_POL   BIT(7)
+
+
 #define HDMI_EDID_LEN  512

 #define RGB0
@@ -101,6 +122,17 @@ struct hdmi_data_info {
struct hdmi_vmode video_mode;
 };

+struct dw_hdmi_i2c {
+   struct i2c_adapter  adap;
+
+   spinlock_t  lock;
+   struct completion   cmp;
+   u8  stat;
+
+   u8  slave_reg;
+   boolis_regaddr;
+};
+
 struct dw_hdmi {
struct drm_connector connector;
struct drm_encoder *encoder;
@@ -111,6 +143,7 @@ struct dw_hdmi {
struct device *dev;
struct clk *isfr_clk;
struct clk *iahb_clk;
+   struct dw_hdmi_i2c *i2c;

struct hdmi_data_info hdmi_data;
const struct dw_hdmi_plat_data *plat_data;
@@ -198,6 +231,242 @@ static void hdmi_mask_writeb(struct dw_hdmi *hdmi, u8 
data, unsigned int reg,
hdmi_modb(hdmi, data << shift, mask, reg);
 }

+static void dw_hdmi_i2c_init(struct dw_hdmi *hdmi)
+{
+   unsigned long flags;
+
+   spin_lock_irqsave(>i2c->lock, flags);
+
+   /* Set Fast Mode speed */
+   hdmi_writeb(hdmi, 0x0b, HDMI_I2CM_DIV);
+
+   /* Software reset */
+   hdmi_writeb(hdmi, 0x00, HDMI_I2CM_SOFTRSTZ);
+
+   /* Set done, not acknowledged and arbitration interrupt polarities */
+   hdmi_writeb(hdmi, HDMI_I2CM_INT_DONE_POL, HDMI_I2CM_INT);
+   hdmi_writeb(hdmi, HDMI_I2CM_CTLINT_NAC_POL | HDMI_I2CM_CTLINT_ARB_POL,
+   HDMI_I2CM_CTLINT);
+
+   /* Clear DONE and ERROR interrupts */
+   hdmi_writeb(hdmi, HDMI_IH_I2CM_STAT0_ERROR | HDMI_IH_I2CM_STAT0_DONE,
+   HDMI_IH_I2CM_STAT0);
+
+   /* Mute DONE and ERROR interrupts */
+   hdmi_writeb(hdmi, HDMI_IH_I2CM_STAT0_ERROR | HDMI_IH_I2CM_STAT0_DONE,
+   HDMI_IH_MUTE_I2CM_STAT0);
+
+   spin_unlock_irqrestore(>i2c->lock, flags);
+}
+
+static int dw_hdmi_i2c_read(struct dw_hdmi *hdmi,
+   unsigned char *buf, int length)
+{
+   int stat;
+   unsigned long flags;
+   struct dw_hdmi_i2c *i2c = hdmi->i2c;
+
+   spin_lock_irqsave(>lock, flags);
+
+   if (!i2c->is_regaddr) {
+   dev_dbg(hdmi->dev, "set read register address to 0\n");
+   i2c->slave_reg = 0x00;
+   i2c->is_regaddr = true;
+   }
+
+   while (length--) {
+   hdmi_writeb(hdmi, i2c->slave_reg++, HDMI_I2CM_ADDRESS);
+   hdmi_writeb(hdmi,
+   HDMI_I2CM_OPERATION_READ, HDMI_I2CM_OPERATION);
+   i2c->stat = 0;
+
+   spin_unlock_irqrestore(>lock, flags);
+
+   stat = 

[RFC 03/21] media: vsp1: Set format to RPF input source

2016-05-30 Thread Ulrich Hecht
From: Koji Matsuoka 

The output format of the RPF must be unified in RGB or YCbCr by
specification of the H/W. To unify the output format in RGB in
driver, if the input format is YCbCr, the output format must be
converted to RGB by CSC (Color Space Conversion).
The driver is missing the format setting of the RPF input source,
so it does not pass through the process to enable the CSC.
This patch adds format setting of the RPF input source.

Signed-off-by: Koji Matsuoka 
[geert: Rebased, s/fmtinfo/rpf->fmtinfo]
Signed-off-by: Geert Uytterhoeven 
---
 drivers/media/platform/vsp1/vsp1_drm.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/media/platform/vsp1/vsp1_drm.c 
b/drivers/media/platform/vsp1/vsp1_drm.c
index ff961b2..c5ee06b 100644
--- a/drivers/media/platform/vsp1/vsp1_drm.c
+++ b/drivers/media/platform/vsp1/vsp1_drm.c
@@ -383,6 +383,12 @@ static int vsp1_du_setup_rpf_pipe(struct vsp1_device *vsp1,

/* BRU sink, propagate the format from the RPF source. */
format.pad = bru_input;
+   format.format.code = rpf->fmtinfo->mbus;
+
+   ret = v4l2_subdev_call(>entity.subdev, pad, set_fmt, NULL,
+  );
+   if (ret < 0)
+   return ret;

ret = v4l2_subdev_call(>bru->entity.subdev, pad, set_fmt, NULL,
   );
-- 
2.7.4



[RFC 02/21] drm: i2c: adv7511: Convert to drm_bridge

2016-05-30 Thread Ulrich Hecht
From: Archit Taneja 

We don't want to use the old i2c slave encoder interface anymore.

Remove that and make the i2c driver create a drm_bridge entity instead.
Converting to bridges helps because the kms drivers don't need to
exract encoder slave ops from this driver and use it within their
own encoder/connector ops.

The driver now creates its own connector when a kms driver attaches
itself to the bridge. Therefore, kms drivers don't need to create
their own connectors anymore.

The old encoder slave ops are now used by the new bridge and connector
entities.

Signed-off-by: Archit Taneja 
Signed-off-by: Laurent Pinchart 
Signed-off-by: Geert Uytterhoeven 
---
 drivers/gpu/drm/i2c/adv7511.c | 224 --
 1 file changed, 150 insertions(+), 74 deletions(-)

diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c
index a02112b..a104b43 100644
--- a/drivers/gpu/drm/i2c/adv7511.c
+++ b/drivers/gpu/drm/i2c/adv7511.c
@@ -16,7 +16,8 @@
 #include 
 #include 
 #include 
-#include 
+#include 
+#include 

 #include "adv7511.h"

@@ -36,7 +37,8 @@ struct adv7511 {
bool edid_read;

wait_queue_head_t wq;
-   struct drm_encoder *encoder;
+   struct drm_bridge bridge;
+   struct drm_connector connector;

bool embedded_sync;
enum adv7511_sync_polarity vsync_polarity;
@@ -48,11 +50,6 @@ struct adv7511 {
struct gpio_desc *gpio_pd;
 };

-static struct adv7511 *encoder_to_adv7511(struct drm_encoder *encoder)
-{
-   return to_encoder_slave(encoder)->slave_priv;
-}
-
 /* ADI recommended values for proper operation. */
 static const struct reg_sequence adv7511_fixed_registers[] = {
{ 0x98, 0x03 },
@@ -446,8 +443,8 @@ static int adv7511_irq_process(struct adv7511 *adv7511)
regmap_write(adv7511->regmap, ADV7511_REG_INT(0), irq0);
regmap_write(adv7511->regmap, ADV7511_REG_INT(1), irq1);

-   if (irq0 & ADV7511_INT0_HPD && adv7511->encoder)
-   drm_helper_hpd_irq_event(adv7511->encoder->dev);
+   if (irq0 & ADV7511_INT0_HPD && adv7511->bridge.dev)
+   drm_helper_hpd_irq_event(adv7511->bridge.dev);

if (irq0 & ADV7511_INT0_EDID_READY || irq1 & ADV7511_INT1_DDC_ERROR) {
adv7511->edid_read = true;
@@ -563,13 +560,12 @@ static int adv7511_get_edid_block(void *data, u8 *buf, 
unsigned int block,
 }

 /* 
-
- * Encoder operations
+ * ADV75xx helpers
  */

-static int adv7511_get_modes(struct drm_encoder *encoder,
+static int adv7511_get_modes(struct adv7511 *adv7511,
 struct drm_connector *connector)
 {
-   struct adv7511 *adv7511 = encoder_to_adv7511(encoder);
struct edid *edid;
unsigned int count;

@@ -606,21 +602,9 @@ static int adv7511_get_modes(struct drm_encoder *encoder,
return count;
 }

-static void adv7511_encoder_dpms(struct drm_encoder *encoder, int mode)
-{
-   struct adv7511 *adv7511 = encoder_to_adv7511(encoder);
-
-   if (mode == DRM_MODE_DPMS_ON)
-   adv7511_power_on(adv7511);
-   else
-   adv7511_power_off(adv7511);
-}
-
 static enum drm_connector_status
-adv7511_encoder_detect(struct drm_encoder *encoder,
-  struct drm_connector *connector)
+adv7511_detect(struct adv7511 *adv7511, struct drm_connector *connector)
 {
-   struct adv7511 *adv7511 = encoder_to_adv7511(encoder);
enum drm_connector_status status;
unsigned int val;
bool hpd;
@@ -644,7 +628,7 @@ adv7511_encoder_detect(struct drm_encoder *encoder,
if (status == connector_status_connected && hpd && adv7511->powered) {
regcache_mark_dirty(adv7511->regmap);
adv7511_power_on(adv7511);
-   adv7511_get_modes(encoder, connector);
+   adv7511_get_modes(adv7511, connector);
if (adv7511->status == connector_status_connected)
status = connector_status_disconnected;
} else {
@@ -658,8 +642,8 @@ adv7511_encoder_detect(struct drm_encoder *encoder,
return status;
 }

-static int adv7511_encoder_mode_valid(struct drm_encoder *encoder,
- struct drm_display_mode *mode)
+static int adv7511_mode_valid(struct adv7511 *adv7511,
+ struct drm_display_mode *mode)
 {
if (mode->clock > 165000)
return MODE_CLOCK_HIGH;
@@ -667,11 +651,10 @@ static int adv7511_encoder_mode_valid(struct drm_encoder 
*encoder,
return MODE_OK;
 }

-static void adv7511_encoder_mode_set(struct drm_encoder *encoder,
-struct drm_display_mode *mode,
-struct drm_display_mode *adj_mode)
+static void adv7511_mode_set(struct adv7511 *adv7511,

[RFC 01/21] drm: rcar-du: Remove i2c slave encoder interface for hdmi encoder

2016-05-30 Thread Ulrich Hecht
From: Archit Taneja 

The hdmi output in rcar-du uses the i2c slave encoder interface to link
to the adv7511 encoder chip. The kms driver creates encoder and connector
entities that internally uses the drm_encoder_slave_funcs ops provided by
the slave encoder driver.

Change the driver such that it expects a bridge entity instead of a slave
encoder. The hdmi connector code isn't needed anymore as we expect the
adv7511 bridge driver to create/manage the connector.

Note that the kms driver still expects a connector node for hdmi to be
present in DT. This node has no connection to the connector created
by the bridge driver.

Compile tested only.

Signed-off-by: Archit Taneja 
Signed-off-by: Geert Uytterhoeven 
---
 drivers/gpu/drm/rcar-du/Makefile  |   3 +-
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c |   3 +-
 drivers/gpu/drm/rcar-du/rcar_du_encoder.h |   7 +-
 drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c | 117 --
 drivers/gpu/drm/rcar-du/rcar_du_hdmicon.h |  31 
 drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c |  67 +
 6 files changed, 22 insertions(+), 206 deletions(-)
 delete mode 100644 drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c
 delete mode 100644 drivers/gpu/drm/rcar-du/rcar_du_hdmicon.h

diff --git a/drivers/gpu/drm/rcar-du/Makefile b/drivers/gpu/drm/rcar-du/Makefile
index 827711e..2ade186 100644
--- a/drivers/gpu/drm/rcar-du/Makefile
+++ b/drivers/gpu/drm/rcar-du/Makefile
@@ -7,8 +7,7 @@ rcar-du-drm-y := rcar_du_crtc.o \
 rcar_du_plane.o \
 rcar_du_vgacon.o

-rcar-du-drm-$(CONFIG_DRM_RCAR_HDMI)+= rcar_du_hdmicon.o \
-  rcar_du_hdmienc.o
+rcar-du-drm-$(CONFIG_DRM_RCAR_HDMI)+= rcar_du_hdmienc.o
 rcar-du-drm-$(CONFIG_DRM_RCAR_LVDS)+= rcar_du_lvdsenc.o

 rcar-du-drm-$(CONFIG_DRM_RCAR_VSP) += rcar_du_vsp.o
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c 
b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
index 4e939e4..1b16297 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
@@ -19,7 +19,6 @@

 #include "rcar_du_drv.h"
 #include "rcar_du_encoder.h"
-#include "rcar_du_hdmicon.h"
 #include "rcar_du_hdmienc.h"
 #include "rcar_du_kms.h"
 #include "rcar_du_lvdscon.h"
@@ -186,7 +185,7 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
break;

case DRM_MODE_ENCODER_TMDS:
-   ret = rcar_du_hdmi_connector_init(rcdu, renc);
+   /* connector managed by the bridge driver */
break;

default:
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.h 
b/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
index 719b6f2a..dde523a 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
@@ -15,7 +15,6 @@
 #define __RCAR_DU_ENCODER_H__

 #include 
-#include 

 struct rcar_du_device;
 struct rcar_du_hdmienc;
@@ -30,16 +29,16 @@ enum rcar_du_encoder_type {
 };

 struct rcar_du_encoder {
-   struct drm_encoder_slave slave;
+   struct drm_encoder base;
enum rcar_du_output output;
struct rcar_du_hdmienc *hdmi;
struct rcar_du_lvdsenc *lvds;
 };

 #define to_rcar_encoder(e) \
-   container_of(e, struct rcar_du_encoder, slave.base)
+   container_of(e, struct rcar_du_encoder, base)

-#define rcar_encoder_to_drm_encoder(e) (&(e)->slave.base)
+#define rcar_encoder_to_drm_encoder(e) (&(e)->base)

 struct rcar_du_connector {
struct drm_connector connector;
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c 
b/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c
deleted file mode 100644
index 6c92714..000
--- a/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * R-Car Display Unit HDMI Connector
- *
- * Copyright (C) 2014 Renesas Electronics Corporation
- *
- * Contact: Laurent Pinchart (laurent.pinchart at ideasonboard.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "rcar_du_drv.h"
-#include "rcar_du_encoder.h"
-#include "rcar_du_hdmicon.h"
-#include "rcar_du_kms.h"
-
-#define to_slave_funcs(e)  (to_rcar_encoder(e)->slave.slave_funcs)
-
-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);
-   const struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder);
-
-   if (sfuncs->get_modes == NULL)
-   return 0;
-
-   return sfuncs->get_modes(encoder, connector);
-}
-
-static int rcar_du_hdmi_connector_mode_valid(struct 

[RFC 00/21] Renesas r8a7795/Salvator-X HDMI output prototype

2016-05-30 Thread Ulrich Hecht
Hi!

This is a prototype of HDMI output support for the Renesas r8a7795 SoC and
Salvator-X board.  It is based on the renesas-devel-20160516-v4.6 tree and
includes the bridge API conversion patches to the adv7511 and rcar-du
drivers written by Archit Taneja.

The obvious issue with this series is the awkward binding of the dw-hdmi
bridge IP, which can be seen in the "drm: rcar-du: Add dw_hdmi driver
startup" patch.  Any comments on how to implement this interface properly
are much appreciated.

Functionally, this series works as expected on both connectors, but EDID
reading is currently broken.

CU
Uli


Archit Taneja (2):
  drm: rcar-du: Remove i2c slave encoder interface for hdmi encoder
  drm: i2c: adv7511: Convert to drm_bridge

Koji Matsuoka (12):
  media: vsp1: Set format to RPF input source
  drm: bridge/dw_hdmi: Fix R-Car Gen3 device support
  drm: rcar-du: Add R8A7795 device support
  drm: rcar-du: Add dw_hdmi driver startup
  drm: rcar-du: Add DPLL support
  drm: rcar-du: Fix display registers for R-Car Gen3
  drm: rcar-du: Fix VSP plane number per devices
  drm: rcar-du: Fix VSP feed plane number
  drm: rcar-du: Add pixel format support
  drm: rcar-du: Fix display max size to 4096x2160 size
  arm64: dts: salvator-x: Add DU pins, HDMI connectors and encoder
  arm64: configs: Enable R-Car DU related config

Kuninori Morimoto (1):
  arm64: defconfig: add VIDEO_RENESAS_FCP

Ulrich Hecht (5):
  v4l: vsp1: Change VSP1 LIF linebuffer FIFO
  pinctrl: sh-pfc: r8a7795: Add DU support
  pinctrl: sh-pfc: r8a7795: Add HDMI CEC support
  arm64: dts: r8a7795: Add HDMI encoder support
  arm64: dts: r8a7795: add HDMI support to DU

Vladimir Zapolskiy (1):
  drm: bridge/dw_hdmi: add dw hdmi i2c bus adapter support

 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 107 +
 arch/arm64/boot/dts/renesas/r8a7795.dtsi   |  33 +-
 arch/arm64/configs/defconfig   |  15 +
 drivers/gpu/drm/bridge/dw-hdmi.c   | 489 +++--
 drivers/gpu/drm/i2c/adv7511.c  | 224 ++
 drivers/gpu/drm/rcar-du/Kconfig|   2 +
 drivers/gpu/drm/rcar-du/Makefile   |   3 +-
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c |  97 +++-
 drivers/gpu/drm/rcar-du/rcar_du_crtc.h |  12 +-
 drivers/gpu/drm/rcar-du/rcar_du_drv.c  |  20 +-
 drivers/gpu/drm/rcar-du/rcar_du_drv.h  |   6 +-
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c  |  12 +-
 drivers/gpu/drm/rcar-du/rcar_du_encoder.h  |  13 +-
 drivers/gpu/drm/rcar-du/rcar_du_group.c|   5 +
 drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c  | 117 -
 drivers/gpu/drm/rcar-du/rcar_du_hdmicon.h  |  31 --
 drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c  | 260 ---
 drivers/gpu/drm/rcar-du/rcar_du_kms.c  |  68 ++-
 drivers/gpu/drm/rcar-du/rcar_du_kms.h  |   1 +
 drivers/gpu/drm/rcar-du/rcar_du_plane.c|   8 +-
 drivers/gpu/drm/rcar-du/rcar_du_plane.h|   7 +-
 drivers/gpu/drm/rcar-du/rcar_du_regs.h |  19 +
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c  |  51 ++-
 drivers/media/platform/vsp1/vsp1_drm.c |   6 +
 drivers/media/platform/vsp1/vsp1_lif.c |   6 +-
 drivers/pinctrl/sh-pfc/pfc-r8a7795.c   | 113 +
 include/drm/bridge/dw_hdmi.h   |   9 +
 27 files changed, 1388 insertions(+), 346 deletions(-)
 delete mode 100644 drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c
 delete mode 100644 drivers/gpu/drm/rcar-du/rcar_du_hdmicon.h

-- 
2.7.4



[PATCH] drm/atomic-helper: Do not call ->mode_fixup for CRTC which will be disabled

2016-05-30 Thread Ying Liu
On Mon, May 30, 2016 at 4:46 PM, Daniel Vetter  wrote:
> On Fri, May 27, 2016 at 05:35:54PM +0800, Liu Ying wrote:
>> When a CRTC is going to be disabled, it's state may contain a display mode
>> with zeroed content.  This could be reproduced by HDMI cable hotplug out
>> operation with legacy fbdev support in dual display cases.  It would confuse
>> driver's CRTC callback ->mode_fixup and make the total state be rejected.
>> So, let's don't call the callback for the CRTC.
>>
>> Signed-off-by: Liu Ying 
>
> Indeed this matches behaviour for encoder/bridge mode_fixup functions.
> Patch merged to drm-misc.
>
> A doc patch for the kernel doc of all the mode_fixup (and the encoder's
> atomic_check) that this is only called when enabling a mode would be
> awesome.

I'll write one.

Regards,
Liu Ying

> -Daniel
>
>> ---
>>  drivers/gpu/drm/drm_atomic_helper.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
>> b/drivers/gpu/drm/drm_atomic_helper.c
>> index ddfa0d1..939df90 100644
>> --- a/drivers/gpu/drm/drm_atomic_helper.c
>> +++ b/drivers/gpu/drm/drm_atomic_helper.c
>> @@ -414,6 +414,9 @@ mode_fixup(struct drm_atomic_state *state)
>>   for_each_crtc_in_state(state, crtc, crtc_state, i) {
>>   const struct drm_crtc_helper_funcs *funcs;
>>
>> + if (!crtc_state->enable)
>> + continue;
>> +
>>   if (!crtc_state->mode_changed &&
>>   !crtc_state->connectors_changed)
>>   continue;
>> --
>> 2.7.4
>>
>> ___
>> dri-devel mailing list
>> dri-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch


[Intel-gfx] [PATCH 08/26] drm: Consolidate connector arrays in drm_atomic_state

2016-05-30 Thread Ville Syrjälä
On Sun, May 29, 2016 at 08:35:05PM +0200, Daniel Vetter wrote:
> It's kinda pointless to have 2 separate mallocs for these. And when we
> add more per-connector state in the future it's even more pointless.
> 
> Right now there's no such thing planned, but both Gustavo's per-crtc
> fence patches, and some nonblocking commit helpers I'm playing around
> with will add more per-crtc stuff. It makes sense to also consolidate
> connectors, just for consistency.
> 
> In the future we can use this to store a pointer to the preceeding
> state, making an atomic update entirely free-standing. This will be
> needed to be able to queue them up with a depth > 1.
> 
> Cc: Gustavo Padovan 
> Signed-off-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/drm_atomic.c| 27 +--
>  drivers/gpu/drm/drm_atomic_helper.c |  2 +-
>  include/drm/drm_atomic.h| 10 +-
>  include/drm/drm_crtc.h  | 11 +++
>  4 files changed, 22 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 3ff1ed7b33db..a6395e9654af 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -44,7 +44,6 @@
>  void drm_atomic_state_default_release(struct drm_atomic_state *state)
>  {
>   kfree(state->connectors);
> - kfree(state->connector_states);
>   kfree(state->crtcs);
>   kfree(state->crtc_states);
>   kfree(state->planes);
> @@ -139,15 +138,15 @@ void drm_atomic_state_default_clear(struct 
> drm_atomic_state *state)
>   DRM_DEBUG_ATOMIC("Clearing atomic state %p\n", state);
>  
>   for (i = 0; i < state->num_connector; i++) {
> - struct drm_connector *connector = state->connectors[i];
> + struct drm_connector *connector = state->connectors[i].ptr;

'ptr' is not a very good name.

-- 
Ville Syrjälä
Intel OTC


[Bug 93748] [r600g]OpenCL driver causes ImageMagick to segfault

2016-05-30 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93748

--- Comment #5 from nixscripter at gmail.com ---
Correction, make that MagickCore/accelerate-kernels-private.h, starting on line
798. (Argh...)

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


drivers/gpu/drm/i915/i915_reg.h:90:shift-overflow problem ?

2016-05-30 Thread Jani Nikula
On Mon, 30 May 2016, Chris Wilson  wrote:
> On Mon, May 30, 2016 at 11:32:59AM +0100, David Binderman wrote:
>> Hello there,
>> 
>> drivers/gpu/drm/i915/i915_reg.h:90:28: warning: result of ‘65535 <<
>> 20’ requires 37 bits to represent, but ‘int’ only has 32 bits
>> [-Wshift-overflow=]
>> 
>> Source code is
>> 
>> #define   BSM_MASK (0x << 20)
>> 
>> Maybe better code
>> 
>> #define   BSM_MASK (((unsigned long) 0x) << 20)
>
> #define BSM_MASK (~0u << 20)
>
> It should be a 32bit mask. The current (with the exception of undefined
> behaviour of shifting into the signbit, fortunately gcc does what we
> expect) code is functionally current as the mask will be truncated to
> 32bits.

In the patch I used BSM_MASK (0xFFF << 20). It does have the UB of
shifting into the sign bit, but then we have loads of e.g. (1 << 31) in
i915_reg.h which is no different.

The original code before e10fa551ae37b had ~((1<<20) - 1).

BR,
Jani.

-- 
Jani Nikula, Intel Open Source Technology Center


[Intel-gfx] [PATCH 08/26] drm: Consolidate connector arrays in drm_atomic_state

2016-05-30 Thread Daniel Vetter
On Mon, May 30, 2016 at 5:45 PM, Ville Syrjälä
 wrote:
>> state->connectors[i].connector is really long, and makes a lot of code
>> look ugly. "obj" might be a bit better than "ptr" at least. Something
>> else?
>
> How often are you expecting to have to type this anyway? Using any
> kind of generic name here will make life harder for cscope users.
> Atomic is really bad in this regard, escecially with all the identically
> named function pointers. It's seriosuly hard to navigate that maze
> these days. Someone should do a bit of renaming of stuff to make
> things more unique.

We have the same aliasing with legacy hooks shared between
encoder/bridge I just always search for the containing structure
since indeed there's no other way to find stuff. Plus big screens ;-)
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[Bug 93748] [r600g]OpenCL driver causes ImageMagick to segfault

2016-05-30 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93748

--- Comment #4 from nixscripter at gmail.com ---
Oh, and before I forget, The AddNoise kernel is in MagickCore/accelerate.c,
starting on line 499.

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


[Bug 93748] [r600g]OpenCL driver causes ImageMagick to segfault

2016-05-30 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93748

nixscripter at gmail.com changed:

   What|Removed |Added

 Attachment #121096|0   |1
is obsolete||

--- Comment #3 from nixscripter at gmail.com ---
Created attachment 124178
  --> https://bugs.freedesktop.org/attachment.cgi?id=124178=edit
AddNoise backtrace for IMv7 Git

In order to assist with this issue, I tried upgrading to the Git Version of
Imagemagick, available on GitHub:

https://github.com/ImageMagick/ImageMagick

ImageMagick master commit 5fb7d58 still fails with LLVM revision 264388 and
Mesa commit 511ce29. (I upgrade to the latest revisions every week or two, just
in case this issue could be fixed without me noticing.)

However, the traceback is now quite different, and the image does display --
for just a moment while they do some operation subsequently which makes it
segfault. Now it's in the AddNose kernel.

Hopefully the source version will make the issue easier to reproduce/debug.

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


[Intel-gfx] [PATCH 08/26] drm: Consolidate connector arrays in drm_atomic_state

2016-05-30 Thread Daniel Vetter
On Mon, May 30, 2016 at 06:25:50PM +0300, Ville Syrjälä wrote:
> On Mon, May 30, 2016 at 05:13:56PM +0200, Daniel Vetter wrote:
> > On Mon, May 30, 2016 at 05:59:24PM +0300, Ville Syrjälä wrote:
> > > On Sun, May 29, 2016 at 08:35:05PM +0200, Daniel Vetter wrote:
> > > > It's kinda pointless to have 2 separate mallocs for these. And when we
> > > > add more per-connector state in the future it's even more pointless.
> > > > 
> > > > Right now there's no such thing planned, but both Gustavo's per-crtc
> > > > fence patches, and some nonblocking commit helpers I'm playing around
> > > > with will add more per-crtc stuff. It makes sense to also consolidate
> > > > connectors, just for consistency.
> > > > 
> > > > In the future we can use this to store a pointer to the preceeding
> > > > state, making an atomic update entirely free-standing. This will be
> > > > needed to be able to queue them up with a depth > 1.
> > > > 
> > > > Cc: Gustavo Padovan 
> > > > Signed-off-by: Daniel Vetter 
> > > > ---
> > > >  drivers/gpu/drm/drm_atomic.c| 27 +--
> > > >  drivers/gpu/drm/drm_atomic_helper.c |  2 +-
> > > >  include/drm/drm_atomic.h| 10 +-
> > > >  include/drm/drm_crtc.h  | 11 +++
> > > >  4 files changed, 22 insertions(+), 28 deletions(-)
> > > > 
> > > > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> > > > index 3ff1ed7b33db..a6395e9654af 100644
> > > > --- a/drivers/gpu/drm/drm_atomic.c
> > > > +++ b/drivers/gpu/drm/drm_atomic.c
> > > > @@ -44,7 +44,6 @@
> > > >  void drm_atomic_state_default_release(struct drm_atomic_state *state)
> > > >  {
> > > > kfree(state->connectors);
> > > > -   kfree(state->connector_states);
> > > > kfree(state->crtcs);
> > > > kfree(state->crtc_states);
> > > > kfree(state->planes);
> > > > @@ -139,15 +138,15 @@ void drm_atomic_state_default_clear(struct 
> > > > drm_atomic_state *state)
> > > > DRM_DEBUG_ATOMIC("Clearing atomic state %p\n", state);
> > > >  
> > > > for (i = 0; i < state->num_connector; i++) {
> > > > -   struct drm_connector *connector = state->connectors[i];
> > > > +   struct drm_connector *connector = 
> > > > state->connectors[i].ptr;
> > > 
> > > 'ptr' is not a very good name.
> > 
> > Suggestions for something better? I was lacking good inspiration ...
> 
> Maybe just 'connector' ?

state->connectors[i].connector is really long, and makes a lot of code
look ugly. "obj" might be a bit better than "ptr" at least. Something
else?
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[PATCH 00/26] fb/drm: omapdss: Clean up the headers and separate the two stack

2016-05-30 Thread Tomi Valkeinen
Hi Peter, Tony,

On 30/05/16 14:42, Peter Ujfalusi wrote:
> Hi,
> 
> omapfb is deprecated. It will not receive new features, only bug fixes. On 
> the.
> other hand omapdrm is in active development and the fact that both
> implementation (omapfb and omapdrm) is using the same header file
> (video/omapdss.h) makes implementing new features or doing bigger clean ups in
> omapdrm harder and hared as the change should not break omapfb.
> 
> To overcome this issue we need to separate the two implementation. This is the
> aim of this series:
> Create platform_data header for omapdss,
> clean up the header usage and dependencies,
> new header file for omapfb stack (video/omapfb_dss.h)
> local omapdss.h header file for omapdrm.
> 
> To generate the set I have used:
> git format-patch -C20 --find-copies-harder

Yeah, you need to drop -C20 to get a bit saner "renames" in the patches =).

But otherwise, looks good.

One thing which is not strictly required, but I think should be added,
is cleaning up the omap-panel-data.h from the drm side. There are many
panels including the file, but not using it.

I don't think there's any sane way to split this series into different
subsystems. So I think we should merge this via drm tree.

Tony, can we get acks from you for the mach-omap2 patches? Do you think
there's anything there that could cause bigger conflicts?

 Tomi

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


[PATCH] virtio-gpu: fix output lookup

2016-05-30 Thread Daniel Vetter
On Mon, May 30, 2016 at 02:03:26PM +0200, Gerd Hoffmann wrote:
> Needed for multihead setups where we can have disabled
> outputs and therefore plane->crtc can be NULL.
> 
> Signed-off-by: Gerd Hoffmann 

See my reply in the other thread, but I think you have a more fundamental
issue here. I dropped two suggestions worth trying, both need your own
atomic_commit_tail (on top of my branch at least):
- set active_only to true in commit_planes()
- move commit_planes after commit_modeset_enables().

Cheers, Daniel
> ---
>  drivers/gpu/drm/virtio/virtgpu_plane.c | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c 
> b/drivers/gpu/drm/virtio/virtgpu_plane.c
> index 70b44a2..e50674b 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_plane.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
> @@ -63,11 +63,17 @@ static void virtio_gpu_plane_atomic_update(struct 
> drm_plane *plane,
>  {
>   struct drm_device *dev = plane->dev;
>   struct virtio_gpu_device *vgdev = dev->dev_private;
> - struct virtio_gpu_output *output = 
> drm_crtc_to_virtio_gpu_output(plane->crtc);
> + struct virtio_gpu_output *output = NULL;
>   struct virtio_gpu_framebuffer *vgfb;
>   struct virtio_gpu_object *bo;
>   uint32_t handle;
>  
> + if (plane->state->crtc)
> + output = drm_crtc_to_virtio_gpu_output(plane->state->crtc);
> + if (old_state->crtc)
> + output = drm_crtc_to_virtio_gpu_output(old_state->crtc);
> + WARN_ON(!output);
> +
>   if (plane->state->fb) {
>   vgfb = to_virtio_gpu_framebuffer(plane->state->fb);
>   bo = gem_to_virtio_gpu_obj(vgfb->obj);
> -- 
> 1.8.3.1
> 
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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


[Intel-gfx] [PATCH 08/26] drm: Consolidate connector arrays in drm_atomic_state

2016-05-30 Thread Daniel Vetter
On Mon, May 30, 2016 at 05:59:24PM +0300, Ville Syrjälä wrote:
> On Sun, May 29, 2016 at 08:35:05PM +0200, Daniel Vetter wrote:
> > It's kinda pointless to have 2 separate mallocs for these. And when we
> > add more per-connector state in the future it's even more pointless.
> > 
> > Right now there's no such thing planned, but both Gustavo's per-crtc
> > fence patches, and some nonblocking commit helpers I'm playing around
> > with will add more per-crtc stuff. It makes sense to also consolidate
> > connectors, just for consistency.
> > 
> > In the future we can use this to store a pointer to the preceeding
> > state, making an atomic update entirely free-standing. This will be
> > needed to be able to queue them up with a depth > 1.
> > 
> > Cc: Gustavo Padovan 
> > Signed-off-by: Daniel Vetter 
> > ---
> >  drivers/gpu/drm/drm_atomic.c| 27 +--
> >  drivers/gpu/drm/drm_atomic_helper.c |  2 +-
> >  include/drm/drm_atomic.h| 10 +-
> >  include/drm/drm_crtc.h  | 11 +++
> >  4 files changed, 22 insertions(+), 28 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> > index 3ff1ed7b33db..a6395e9654af 100644
> > --- a/drivers/gpu/drm/drm_atomic.c
> > +++ b/drivers/gpu/drm/drm_atomic.c
> > @@ -44,7 +44,6 @@
> >  void drm_atomic_state_default_release(struct drm_atomic_state *state)
> >  {
> > kfree(state->connectors);
> > -   kfree(state->connector_states);
> > kfree(state->crtcs);
> > kfree(state->crtc_states);
> > kfree(state->planes);
> > @@ -139,15 +138,15 @@ void drm_atomic_state_default_clear(struct 
> > drm_atomic_state *state)
> > DRM_DEBUG_ATOMIC("Clearing atomic state %p\n", state);
> >  
> > for (i = 0; i < state->num_connector; i++) {
> > -   struct drm_connector *connector = state->connectors[i];
> > +   struct drm_connector *connector = state->connectors[i].ptr;
> 
> 'ptr' is not a very good name.

Suggestions for something better? I was lacking good inspiration ...
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[Intel-gfx] [PATCH 15/26] drm/arc: Implement nonblocking commit correctly

2016-05-30 Thread Daniel Vetter
On Mon, May 30, 2016 at 11:36:06AM +0200, Maarten Lankhorst wrote:
> Op 30-05-16 om 11:24 schreef Daniel Vetter:
> > On Mon, May 30, 2016 at 10:15:14AM +0200, Maarten Lankhorst wrote:
> >> Op 29-05-16 om 20:35 schreef Daniel Vetter:
> >>> Committing with block it is not.
> >>>
> >>> Thanks to the fixed up vblank event handling we can just use the
> >>> helper support for nonblocking commits now.
> >>>
> >>> Cc: Carlos Palminha 
> >>> Cc: Alexey Brodkin 
> >>> Cc: linux-snps-arc at lists.infradead.org
> >>> Signed-off-by: Daniel Vetter 
> >> This breaks page flip on arc, it uses drm_atomic_helper_page_flip.
> > How exactly does this break page_flip? Note that the commit to implement
> > generic nonblocking commit in drm_atomic_helper_commit is _before_ this
> > patch in the series.
> > -Daniel
> 
> This is patch 15/16, I found this in patch 21/26:
> 
> @@ -1147,8 +1206,11 @@ int drm_atomic_helper_commit(struct drm_device *dev,
>  {
>   int ret;
>  
> - if (nonblock)
> - return -EBUSY;

Oh right, I mixed things up. Most of the prep work is for drm event
handling. We need to do that _before_ the non-blocking commit lands for
the drivers that just directly reuse drm_atomic_helper_commit, since the
nonblocking helpers will time out when drm events don't work.

But this one indeed should only happen after that commit. I'll reorder.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[Intel-gfx] [PATCH 12/26] drm/atomic-helper: Massage swap_state signature somewhat

2016-05-30 Thread Daniel Vetter
On Mon, May 30, 2016 at 03:08:39PM +0200, Maarten Lankhorst wrote:
> Op 29-05-16 om 20:35 schreef Daniel Vetter:
> > - dev is redundant, we have state->atomic
> > - add stall parameter, which must be set when swapping needs to stall
> >   for preceeding commits to stop looking at ->state pointers. Currently
> >   all drivers need this to be, just prep work for a glorious future.
> I have to disagree, if you want to stall it should be done in a separate 
> helper before swapping state.
> That function should also have the ability to fail, since we haven't called 
> swap_state yet. :)
> 
> Maybe with nonblock as parameter, so it could fail with -EBUSY if it would 
> stall, and -EINTR if interrupted?

This is not the stalling you're thinking of. The EBUSY check is in
drm_atomic_helper_setup_commit (and as such entirely optional).

And if you don't ever use the nonblocking helpers, no struct
drm_crtc_commit will ever show up in crtc->commit_list, which means this
here also doesn't do anything.

This stall here is just to make sure that the previous commit doesn't get
confused because we've ripped out crtc/plane/connector->state from
underneath it. And as soon as we add previous_state pointers to
drm_atomic_state and wire it up through all the hooks we can set
stall=false here, since then pipelining with a queue depth > 1 is
possible.
-Daniel


> > Signed-off-by: Daniel Vetter 
> > ---
> >  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 2 +-
> >  drivers/gpu/drm/drm_atomic_helper.c  | 8 
> >  drivers/gpu/drm/exynos/exynos_drm_drv.c  | 2 +-
> >  drivers/gpu/drm/i915/intel_display.c | 2 +-
> >  drivers/gpu/drm/mediatek/mtk_drm_drv.c   | 2 +-
> >  drivers/gpu/drm/msm/msm_atomic.c | 2 +-
> >  drivers/gpu/drm/omapdrm/omap_drv.c   | 2 +-
> >  drivers/gpu/drm/rcar-du/rcar_du_kms.c| 2 +-
> >  drivers/gpu/drm/rockchip/rockchip_drm_fb.c   | 2 +-
> >  drivers/gpu/drm/sti/sti_drv.c| 2 +-
> >  drivers/gpu/drm/tegra/drm.c  | 2 +-
> >  drivers/gpu/drm/vc4/vc4_kms.c| 2 +-
> >  include/drm/drm_atomic_helper.h  | 4 ++--
> >  13 files changed, 17 insertions(+), 17 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c 
> > b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> > index 6485fa5bee8b..9ecf16c7911d 100644
> > --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> > +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> > @@ -519,7 +519,7 @@ static int atmel_hlcdc_dc_atomic_commit(struct 
> > drm_device *dev,
> > }
> >  
> > /* Swap the state, this is the point of no return. */
> > -   drm_atomic_helper_swap_state(dev, state);
> > +   drm_atomic_helper_swap_state(state, true);
> >  
> > if (async)
> > queue_work(dc->wq, >work);
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
> > b/drivers/gpu/drm/drm_atomic_helper.c
> > index 5298eb668ca7..fecbb52cbb85 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -1160,7 +1160,7 @@ int drm_atomic_helper_commit(struct drm_device *dev,
> >  * the software side now.
> >  */
> >  
> > -   drm_atomic_helper_swap_state(dev, state);
> > +   drm_atomic_helper_swap_state(state, true);
> >  
> > /*
> >  * Everything below can be run asynchronously without the need to grab
> > @@ -1531,8 +1531,8 @@ EXPORT_SYMBOL(drm_atomic_helper_cleanup_planes);
> >  
> >  /**
> >   * drm_atomic_helper_swap_state - store atomic state into current sw state
> > - * @dev: DRM device
> >   * @state: atomic state
> > + * @stall: stall for proceeding commits
> >   *
> >   * This function stores the atomic state into the current state pointers 
> > in all
> >   * driver objects. It should be called after all failing steps have been 
> > done
> > @@ -1554,8 +1554,8 @@ EXPORT_SYMBOL(drm_atomic_helper_cleanup_planes);
> >   * 5. Call drm_atomic_helper_cleanup_planes() with @state, which since 
> > step 3
> >   * contains the old state. Also do any other cleanup required with that 
> > state.
> >   */
> > -void drm_atomic_helper_swap_state(struct drm_device *dev,
> > - struct drm_atomic_state *state)
> > +void drm_atomic_helper_swap_state(struct drm_atomic_state *state,
> > + bool stall)
> >  {
> > int i;
> > struct drm_connector *connector;
> > diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
> > b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> > index cabc5fd0246d..deba76982358 100644
> > --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> > +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> > @@ -299,7 +299,7 @@ int exynos_atomic_commit(struct drm_device *dev, struct 
> > drm_atomic_state *state,
> > priv->pending |= commit->crtcs;
> > spin_unlock(>lock);
> >  
> > -   drm_atomic_helper_swap_state(dev, state);
> > +   drm_atomic_helper_swap_state(state, true);
> >  
> > if (nonblock)
> > 

[Intel-gfx] [PATCH 06/26] drm/atomic: Add __drm_atomic_get_current_plane_state

2016-05-30 Thread Daniel Vetter
On Mon, May 30, 2016 at 01:42:40PM +0200, Maarten Lankhorst wrote:
> Op 29-05-16 om 20:35 schreef Daniel Vetter:
> > ... and use it in msm Again just want to encapsulate
> > drm_atomic_state internals a bit.
> >
> > The const threading is a bit awkward in vc4 since C sucks, but I still
> > think it's worth to enforce this. Eventually I want to make all the
> > obj->state pointers const too, but that's a lot more work ...
> >
> > Cc: Eric Anholt 
> > Cc: Rob Clark 
> > Signed-off-by: Daniel Vetter 
> > ---
> >  drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 10 +++--
> >  drivers/gpu/drm/vc4/vc4_crtc.c   | 11 +++---
> >  drivers/gpu/drm/vc4/vc4_drv.h|  2 +-
> >  drivers/gpu/drm/vc4/vc4_plane.c  |  5 +++--
> >  include/drm/drm_atomic.h | 36 
> > 
> >  5 files changed, 46 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c 
> > b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
> > index 88fe256c1931..6d4086ee0503 100644
> > --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
> > +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
> > @@ -383,19 +383,15 @@ static int mdp5_crtc_atomic_check(struct drm_crtc 
> > *crtc,
> >  */
> > hw_cfg = mdp5_cfg_get_hw_config(mdp5_kms->cfg);
> > drm_atomic_crtc_state_for_each_plane(plane, state) {
> > -   struct drm_plane_state *pstate;
> > +   const struct drm_plane_state *pstate;
> > if (cnt >= (hw_cfg->lm.nb_stages)) {
> > dev_err(dev->dev, "too many planes!\n");
> > return -EINVAL;
> > }
> >  
> > -   pstate = state->state->plane_states[drm_plane_index(plane)];
> > +   pstate = __drm_atomic_get_current_plane_state(state->state,
> > + plane);
> >  
> > -   /* plane might not have changed, in which case take
> > -* current state:
> > -*/
> > -   if (!pstate)
> > -   pstate = plane->state;
> > pstates[cnt].plane = plane;
> > pstates[cnt].state = to_mdp5_plane_state(pstate);
> >  
> > diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
> > index 904d0754ad78..703bda170105 100644
> > --- a/drivers/gpu/drm/vc4/vc4_crtc.c
> > +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
> > @@ -405,14 +405,9 @@ static int vc4_crtc_atomic_check(struct drm_crtc *crtc,
> > return -EINVAL;
> >  
> > drm_atomic_crtc_state_for_each_plane(plane, state) {
> > -   struct drm_plane_state *plane_state =
> > -   state->state->plane_states[drm_plane_index(plane)];
> > -
> > -   /* plane might not have changed, in which case take
> > -* current state:
> > -*/
> > -   if (!plane_state)
> > -   plane_state = plane->state;
> > +   const struct drm_plane_state *plane_state =
> > +   __drm_atomic_get_current_plane_state(state->state,
> > +plane);
> >  
> > dlist_count += vc4_plane_dlist_size(plane_state);
> > }
> > diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
> > index 37cac59401d7..c799baabc008 100644
> > --- a/drivers/gpu/drm/vc4/vc4_drv.h
> > +++ b/drivers/gpu/drm/vc4/vc4_drv.h
> > @@ -469,7 +469,7 @@ int vc4_kms_load(struct drm_device *dev);
> >  struct drm_plane *vc4_plane_init(struct drm_device *dev,
> >  enum drm_plane_type type);
> >  u32 vc4_plane_write_dlist(struct drm_plane *plane, u32 __iomem *dlist);
> > -u32 vc4_plane_dlist_size(struct drm_plane_state *state);
> > +u32 vc4_plane_dlist_size(const struct drm_plane_state *state);
> >  void vc4_plane_async_set_fb(struct drm_plane *plane,
> > struct drm_framebuffer *fb);
> >  
> > diff --git a/drivers/gpu/drm/vc4/vc4_plane.c 
> > b/drivers/gpu/drm/vc4/vc4_plane.c
> > index 4037b52fde31..5d2c3d9fd17a 100644
> > --- a/drivers/gpu/drm/vc4/vc4_plane.c
> > +++ b/drivers/gpu/drm/vc4/vc4_plane.c
> > @@ -690,9 +690,10 @@ u32 vc4_plane_write_dlist(struct drm_plane *plane, u32 
> > __iomem *dlist)
> > return vc4_state->dlist_count;
> >  }
> >  
> > -u32 vc4_plane_dlist_size(struct drm_plane_state *state)
> > +u32 vc4_plane_dlist_size(const struct drm_plane_state *state)
> >  {
> > -   struct vc4_plane_state *vc4_state = to_vc4_plane_state(state);
> > +   const struct vc4_plane_state *vc4_state =
> > +   container_of(state, typeof(*vc4_state), base);
> >  
> > return vc4_state->dlist_count;
> >  }
> > diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
> > index 92c84e9ab09a..4e97186293be 100644
> > --- a/include/drm/drm_atomic.h
> > +++ b/include/drm/drm_atomic.h
> > @@ -109,6 +109,42 @@ drm_atomic_get_existing_connector_state(struct 
> > drm_atomic_state *state,
> > return state->connector_states[index];

[Intel-gfx] [PATCH 01/26] drm/atomic-helper: use for_each_*_in_state more

2016-05-30 Thread Daniel Vetter
On Mon, May 30, 2016 at 02:17:06PM +0200, Maarten Lankhorst wrote:
> Op 29-05-16 om 20:34 schreef Daniel Vetter:
> > This avois leaking drm_atomic_state internals into the helpers. The
> > only place where this still happens after this patch is 
> > drm_atomic_helper_swap_state().
> > It's unavoidable there, and maybe a good indicator we should actually
> > move that function into drm_atomic.c.
> Would be a good idea, commit is part of atomic core and there's really only 
> one way to do swap_state.
> Drivers can swap any required internal state before or after the call.

Later on I'm adding some of the nonblocking stuff to swap_state, and I
think at least the nonblocking support should be part of the helpers.

I'm torn again about where to put it ;-)
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[Intel-gfx] [PATCH 04/26] drm/rcar-du: Use for_each_*_in_state

2016-05-30 Thread Daniel Vetter
On Mon, May 30, 2016 at 11:58:27AM +0200, Maarten Lankhorst wrote:
> Op 30-05-16 om 11:18 schreef Laurent Pinchart:
> > Hi Daniel,
> >
> > Thank you for the patch.
> >
> > This looks good to me as the resulting code is mostly similar. However, the 
> > for_each_*_in_state macros end with an for_each_if() that tests if the 
> > object's state is NULL, which isn't present in this code. I'm wondering 
> > whether that was an oversight on my side possibly leading to a crash when 
> > dereferencing a NULL state, or an unneeded check in the macros. Can 
> > atomic_state->*_states[i] be NULL if atomic_state->*[i] is not NULL ?
> Not in any normal case.

Yeah, the drm_atomic_get_*_state functions only ever fill in both of
neither. If this gets out of sync it's a bug ;-)
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[Bug 96278] Kernel Hung when starting X while detecting outputs

2016-05-30 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=96278

Bug ID: 96278
   Summary: Kernel Hung when starting X while detecting outputs
   Product: DRI
   Version: XOrg git
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: major
  Priority: medium
 Component: DRM/AMDgpu
  Assignee: dri-devel at lists.freedesktop.org
  Reporter: frederik.schwan at linux.com

Created attachment 124177
  --> https://bugs.freedesktop.org/attachment.cgi?id=124177=edit
bad dmesg

Hardware: Dell Precision Laptop 7710 with Intel HD P530 and AMD FirePro W7170M
(Amethyst XT)

Kernel: 4.6 and 4.7rc1
xf86-video-amdgpu: 1.1.0

Description:
When X is started, it accepts no connections ("waiting for X server to accept
connections") forever. 
There is another bugreport over here [1] that has the same problem with the
radeon driver. Dmesg is attached.


The stacktrace seems to be nearly the same:

schedule
rpm_resume
wake_atomic_t_function
__pm_runtime_resume
[amdgpu_connector_dp_detect/radeon_dvi_detect] (output detection)
drm_helper_hpd_irq_event
[amdgpu/radeon]_resume_kms
[amdgpu/radeon]_pmops_runtime_resume
pci_pm_runtime_resume
vga_switcheroo_set_dynamic_switch
vga_switcheroo_runtime_resume
...
...
...

[1]
http://unix.stackexchange.com/questions/269223/lightdm-fails-to-load-after-system-upgrade-in-arch-x64

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


[PATCH] Add virtio gpu driver.

2016-05-30 Thread Daniel Vetter
On Mon, May 30, 2016 at 03:50:36PM +0200, Gerd Hoffmann wrote:
>   Hi,
> 
> > - add a small core function to registerr HOT_X/HOT_Y for a (cursor) plane,
> >   e.g. drm_plane_register_hotspot(). That should allocate the properties
> >   (if they don't exist yet) and then attach those props to the cursor. We
> >   don't want those props everywhere, but only on drivers that support/need
> >   them, aka virtual hw.
> 
> Hmm, why is this special to virtual hw?
> 
> > if (crtc->cursor) {
> > -   ret = drm_mode_cursor_universal(crtc, req, file_priv);
> > +   if (drm_core_check_feature(DRIVER_ATOMIC))
> > +   ret = drm_mode_cursor_atomic(crtc, req, file_priv);
> > +   else
> > +   ret = drm_mode_cursor_universal(crtc, req, file_priv);
> > goto out;
> 
> >   drm_mode_cursor_atomic would simply be a fusing of
> >   drm_mode_cursor_universal + drm_atomic_helper_update_plane (dump all the
> >   intermediate variables and store directly in the plane state), with the
> >   addition of also storing hot_x/y into the plane state.
> 
> Hmm, that'll either make drm_mode_cursor_atomic a big cut+pasted
> function, or need quite some refactoring to move common code into
> functions callable from both drm_mode_cursor_atomic
> +drm_mode_cursor_universal ...
> 
> Why attach the hotspot to the plane?  Wouldn't it make more sense to
> make it a framebuffer property?

We don't have properties on the framebuffer. I guess you /could/ just add
it internally to struct drm_framebuffer, and not bother exposing to
userspace. I guess that would be a lot simpler, but it also means that
atomic userspace can't use hotspots before we add properties to fbs. And
doing that is a bit tricky since drm_framebuffer objects are meant to be
invariant - this assumption is deeply in-grained into the code all over
the place, everything just compares pointers when semantically it means to
compare the entire fb (including backing storage pointer/offsets and
everything).

So would be a bit more work to wire up for atomic userspace, but indeed a
lot less work to implement. I'm totally happy if you go with that tradeoff
;-)

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


  1   2   3   >