Re: [PATCH RFC] drm/bridge: panel: Add device_link between panel and master drm device

2018-02-20 Thread Lukas Wunner
On Wed, Feb 21, 2018 at 12:21:50AM +0200, Jyri Sarha wrote:
> @@ -94,6 +114,8 @@ static void panel_bridge_detach(struct drm_bridge *bridge)
>   struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
>  
>   drm_panel_detach(panel_bridge->panel);
> +
> + device_link_del(panel_bridge->link);

No, you've set the DL_FLAG_AUTOREMOVE flag, so you'll end up removing
the link twice, which oopses.

It's either DL_FLAG_AUTOREMOVE or device_link_del(), not both.


> +static int panel_bridge_link_to_master(struct panel_bridge *panel_bridge)
> +{
> + struct device *mdev = panel_bridge->bridge.dev->dev;
> + struct device *pdev = panel_bridge->panel->dev;
> + u32 flags = DL_FLAG_AUTOREMOVE;
> +
> + panel_bridge->link = device_link_add(mdev, pdev, flags);
> + if (!panel_bridge->link) {
> + dev_err(pdev, "failed to link panel %s to %s\n",
> + dev_name(pdev), dev_name(mdev));

You're printing two instances of pdev's name in the log message,
one should be sufficient.

Also, you've mixed up the order: mdev is the consumer, pdev the
supplier.

(Bikeshed:  The DL_FLAG_AUTOREMOVE would still fit within 80 chars
on the line with device_link_add() and the flags variable wouldn't
have to be declared then.  Your call.)

Thanks,

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


Re: [PATCH] drm/tve200: fix kernel-doc documentation comment include

2018-02-20 Thread Jani Nikula
On Wed, 21 Feb 2018, Linus Walleij  wrote:
> On Tue, Feb 20, 2018 at 3:20 PM, Jani Nikula  wrote:
>
>> The DOC: line acts as an identifier for the :doc: include. Fixes:
>>
>> ./drivers/gpu/drm/tve200/tve200_drv.c:1: warning: no structured comments 
>> found
>>
>> Cc: Linus Walleij 
>> Signed-off-by: Jani Nikula 
>
> Whoa, good catch!
>
> Reviewed-by: Linus Walleij 

Pushed to drm-misc-fixes, thanks for the review.

BR,
Jani.

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


Re: [PATCH RFC] drm/bridge: panel: Add module_get/but calls to attached panel driver

2018-02-20 Thread Lukas Wunner
[+cc Rafael]

On Tue, Feb 20, 2018 at 05:04:00PM +0200, Jyri Sarha wrote:
> On 20/02/18 14:03, Thierry Reding wrote:
> > On Tue, Feb 20, 2018 at 01:28:48PM +0200, Jyri Sarha wrote:
> >> On 20/02/18 12:34, Thierry Reding wrote:
>  On Mon, Feb 19, 2018 at 10:06:22PM +0200, Jyri Sarha wrote:
> > Currently there is no way for a master drm driver to protect against an
> > attached panel driver from being unloaded while it is in use. The
> > least we can do is to indicate the usage by incrementing the module
> > reference count.
[...]
> >>> I disagree. module_get() is only going to protect you from unloading a
> >>> module that's in use, but there are other ways to unbind a driver from
> >>> the device and cause subsequent mayhem.
> >>>
> >>> struct device_link was "recently" introduced to fix that issue.
> >>
> >> Unfortunately I do not have time to do full fix for the issue, but in
> >> any case I think this patch is a step to the right direction. The module
> >> reference count should anyway be increased at least to know that the
> >> driver code remains in memory, even if the device is not there any more.
> > 
> > I think device links are actually a lot easier to use and give you a
> > full solution for this. Essentially the only thing you need to do is add
> > a call to device_link_add() in the correct place.
> > 
> > That said, it seems to me like drm_panel_bridge_add() is not a good
> > place to add this, because the panel/bridge does not follow a typical
> > consumer/supplier model. It is rather a helper construct with a well-
> > defined lifetime.
> > 
> > What you do want to protect is the panel (the "parent" of the panel/
> > bridge) from going away unexpectedly. I think the best way to achieve
> > that is to make the link in drm_panel_attach() with something like
> > this:
> > 
> > u32 flags = DL_FLAG_PM_RUNTIME | DL_FLAG_AUTOREMOVE;
> > struct device *consumer = connector->dev->dev;
> > 
> > link = device_link_add(consumer, panel->dev, flags);
> > if (!link) {
> > dev_err(panel->dev, "failed to link panel %s to %s\n",
> > dev_name(panel->dev), dev_name(consumer));
> > return -EINVAL;
> > }
> > 
> > Ideally I think we'd link the panel to the connector rather than the
> > top-level DRM device, but we don't have a struct device * for that, so
> > this is probably as good as it gets for now.
> 
> Thanks for the hint. Adding the link indeed unbinds the master drm
> device when the panel is unloaded without any complaints.
> 
> The annoying thing is that the master drm device does not probe again
> and bind when the supplier device becomes available again. However,
> forcing a manual bind brings the whole device back without a problem.
> 
> Is there any trivial way to fix this?

How about the below, would this work for you?

Or is the device link added in the consumer's driver, hence is gone when
the consumer is unbound?  If so, it should be added somewhere else,
or it shouldn't be removed on consumer unbind.

@Thierry:  Thanks for shifting the discussion in the right direction,
it's good to see device links getting more adoption, instead of
proliferating yet more kludges.  However I don't understand why you say
we don't have a struct device for the connector, drm_sysfs_connector_add()
does create one.

-- >8 --
Subject: [PATCH] driver core: Ensure consumers are probed when supplier is
 bound

When a device link supplier is unbound (either manually or because one
of its own suppliers was unbound), its consumers are unbound as well.

However when that supplier is subsequently rebound, its consumers should
likewise be given a chance to rebind.  Achieve that by putting them on
the deferred probe list in device_links_driver_bound().  The sole caller
of that function, driver_bound(), triggers deferred probing afterwards.

Reported-by: Jyri Sarha 
Cc: Thierry Reding 
Cc: Rafael J. Wysocki 
Signed-off-by: Lukas Wunner 
---
 drivers/base/base.h | 1 +
 drivers/base/core.c | 4 +++-
 drivers/base/dd.c   | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/base/base.h b/drivers/base/base.h
index d800de6..39370eb 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -114,6 +114,7 @@ extern void device_release_driver_internal(struct device 
*dev,
 
 extern void driver_detach(struct device_driver *drv);
 extern int driver_probe_device(struct device_driver *drv, struct device *dev);
+extern void driver_deferred_probe_add(struct device *dev);
 extern void driver_deferred_probe_del(struct device *dev);
 static inline int driver_match_device(struct device_driver *drv,
  struct device *dev)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 920af22..2869d21 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -402,7 +402,8 @@ int device_links_check_suppliers(struct 

Update: Vulkan modifiers extension VK_EXT_image_drm_format_modifier

2018-02-20 Thread Chad Versace
As many of you know, I've been writing a Vulkan extension for DRM format
modifiers, named VK_EXT_image_drm_format_modifier.

The extension is very close to completion. I've submitted a branch to
Khronos for review. It's receiving active review inside Khronos from
some non-Mesa closed-source window-system-integration people, and Mesa
people too (namely jekstrand).

You should take a look at the spec if you care about modifiers and Vulkan.
I try to keep up-to-date urls to everything related to this extension at
.

There remain only two unresolved issues from my perspective:

- The exact definition of members of the array
  VkImageDrmFormatModifierExplicitCreateInfoEXT::pPlaneLayouts.
  Should the extension re-use VkSubresourceLayout as the array
  members? Or should it define a new struct with less fields than
  VkSubresourceLayout?

- If an image has a modifier that requires an extra plane (such as
  a color-compression plane), should the extension allow such an
  image to be disjoint? Specifically, if a modifier requires an
  extra plane, should the extension allow the modifier's
  drmFormatModifierTilingFeatures to contain
  VK_FORMAT_FEATURE_DISJOINT_KHR?

  I've tentatively concluded "no": images with extra planes must be
  non-disjoint. Though we could lift this restriction in a future
  extension.

Branches

I maintain a public branch of the Vulkan spec, branch
1.0-VK_EXT_image_drm_format_modifier, which is synchronized with the
Khronos-internal branch of the same name. I like cgit; other people like
Github; so I keep a mirror at both.

cgit: 
http://git.kiwitree.net/cgit/~chadv/vulkan-spec/log?h=1.0-VK_EXT_image_drm_format_modifier
github: 
https://github.com/chadversary/vulkan-spec/commits/1.0-VK_EXT_image_drm_format_modifier
khronos-internal: 
https://gitlab.khronos.org/vulkan/vulkan/merge_requests/2555


Prebuilt Specs
==
I maintain a public build of the branch. The built headers and HTML
specification are synchronized with the git branch thanks to the magic
of shell scripts.

vulkan.h: 
http://git.kiwitree.net/cgit/~chadv/vulkan-spec/tree/src/vulkan/vulkan.h?h=1.0-VK_EXT_image_drm_format_modifier
spec appendix: 
http://kiwitree.net/~chadv/vulkan/1.0-VK_EXT_image_drm_format_modifier/html/vkspec.html#VK_EXT_image_drm_format_modifier
full spec: 
http://kiwitree.net/~chadv/vulkan/1.0-VK_EXT_image_drm_format_modifier/html/vkspec.html


Where to start reading
==
Here's a short reading guide for people unfamiliar with the extension:

- Don't start with the specification. You'll quickly get lost.

- First, read the VK_EXT_external_memory_dma_buf and
  VK_EXT_queue_family_foreign extensions. They're small extensions.
  They're intended to be used with VK_EXT_image_drm_format_modifier.
  Despite that intent, the the three extensions are independent from
  the Vulkan specification's perspective.

- Read the appendix chapter for VK_EXT_image_drm_format_modifier.
  I've written an "introduction to modifiers" section in the
  appendix. If you're already intimately understand modifiers, then
  you can briefly scan this section, skipping over the boring stuff.

- Read the issue section in the appendix.

- Now for the tofu. Study the new structs and functions. Find them
  under `#define VK_EXT_image_drm_format_modifier` in vulkan.h.
  Also, study the new enums values. Find them by grepping 'DRM.*EXT'
  in vulkan.h.

- Finally, go read the specification text for the new structs,
  functions, and enums.


How to send feedback

I honestly don't know. You _could_ comment on the merge request
in the Khronos-internal Gitlab. But you probably (and rightfully so)
want to keep the discussion public.

You could provide general feedback by replying to this thread.

You could leave comments on my Github branch. I don't like Github, but
I can't think of a better solution, other than...

I could send my specification patches to mesa-dev. If people want that,
say so.

So... yeah. I don't know how you should provide feedback. Just do it,
and we'll iron out any problems as they arise.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/pl111: Remove reverse dependency on DRM_DUMB_VGA_DAC

2018-02-20 Thread Linus Walleij
On Tue, Feb 20, 2018 at 11:29 AM, Thierry Reding
 wrote:

> From: Thierry Reding 
>
> DRM_DUMB_VGA_DAC is a user-visible symbol. Selecting it can cause unmet
> direct dependencies such as this (on i386, randconfig):
>
> warning: (DRM_PL111) selects DRM_DUMB_VGA_DAC which has unmet direct 
> dependencies (HAS_IOMEM && DRM && DRM_BRIDGE && OF)
>
> This is because DRM_DUMB_VGA_DAC depends on OF while DRM_PL111 does not.
> It does indirectly depend on OF via the ARM and ARM64 dependencies, but
> since it can also be enabled under COMPILE_TEST, randconfig can find a
> case where DRM_PL111 is selected without pulling in OF and not meeting
> the dependency for DRM_DUMB_VGA_DAC.
>
> Since select is "heavy handed", DRM_DUMB_VGA_DAC is going to be enabled
> regardless of the above warning and causes the following build error:
>
> ../drivers/gpu/drm/bridge/dumb-vga-dac.c: In function 
> 'dumb_vga_probe':
> ../drivers/gpu/drm/bridge/dumb-vga-dac.c:207:13: error: 'struct 
> drm_bridge' has no member named 'of_node'
>   vga->bridge.of_node = pdev->dev.of_node;
>
> See Documentation/kbuild/kconfig-language.txt, "reverse dependencies".
>
> Fixes: 49f81d80ab84 ("drm/pl111: Support handling bridge timings")
> Reported-by: Randy Dunlap 
> Cc: Laurent Pinchart 
> Cc: Archit Taneja 
> Cc: Eric Anholt 
> Signed-off-by: Thierry Reding 

OK sorry about that, I just get to let the platforms that need the bridge
select it explicitly.
Reviewed-by: Linus Walleij 

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


Re: [PATCH] drm/tve200: fix kernel-doc documentation comment include

2018-02-20 Thread Linus Walleij
On Tue, Feb 20, 2018 at 3:20 PM, Jani Nikula  wrote:

> The DOC: line acts as an identifier for the :doc: include. Fixes:
>
> ./drivers/gpu/drm/tve200/tve200_drv.c:1: warning: no structured comments found
>
> Cc: Linus Walleij 
> Signed-off-by: Jani Nikula 

Whoa, good catch!

Reviewed-by: Linus Walleij 

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


Re: [Mesa-dev] Allocator Nouveau driver, Mesa EXT_external_objects, and DRM metadata import interfaces

2018-02-20 Thread Chad Versace
On Thu 21 Dec 2017, Daniel Vetter wrote:
> On Thu, Dec 21, 2017 at 12:22 AM, Kristian Kristensen  
> wrote:
>> On Wed, Dec 20, 2017 at 12:41 PM, Miguel Angel Vico  
>> wrote:
>>> On Wed, 20 Dec 2017 11:54:10 -0800 Kristian Høgsberg  
>>> wrote:
 I'd like to see concrete examples of actual display controllers
 supporting more format layouts than what can be specified with a 64
 bit modifier.
>>>
>>> The main problem is our tiling and other metadata parameters can't
>>> generally fit in a modifier, so we find passing a blob of metadata a
>>> more suitable mechanism.
>>
>> I understand that you may have n knobs with a total of more than a total of
>> 56 bits that configure your tiling/swizzling for color buffers. What I don't
>> buy is that you need all those combinations when passing buffers around
>> between codecs, cameras and display controllers. Even if you're sharing
>> between the same 3D drivers in different processes, I expect just locking
>> down, say, 64 different combinations (you can add more over time) and
>> assigning each a modifier would be sufficient. I doubt you'd extract
>> meaningful performance gains from going all the way to a blob.

I agree with Kristian above. In my opinion, choosing to encode in
modifiers a precise description of every possible tiling/compression
layout is not technically incorrect, but I believe it misses the point.
The intention behind modifiers is not to exhaustively describe all
possibilites.

I summarized this opinion in VK_EXT_image_drm_format_modifier,
where I wrote an "introdution to modifiers" section. Here's an excerpt:

One goal of modifiers in the Linux ecosystem is to enumerate for each
vendor a reasonably sized set of tiling formats that are appropriate for
images shared across processes, APIs, and/or devices, where each
participating component may possibly be from different vendors.
A non-goal is to enumerate all tiling formats supported by all vendors.
Some tiling formats used internally by vendors are inappropriate for
sharing; no modifiers should be assigned to such tiling formats.

> Tegra just redesigned it's modifier space from an ungodly amount of
> bits to just a few layouts. Not even just the ones in used, but simply
> limiting to the ones that make sense (there's dependencies apparently)
> Also note that the modifier alone doesn't need to describe the layout
> precisely, it only makes sense together with a specific pixel format
> and size. E.g. a bunch of the i915 layouts change layout depending
> upon bpp.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 105005] No image after downtime (RX460)

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105005

--- Comment #11 from Dmitry  ---
The kernel update didn't fix the problem, I thought. But now I know what the
bug is about. This happens when you enable vertical sync in the settings of
xfce.

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


[Bug 105021] suspend / rx550 / extremely slow after 2nd thaw

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105021

--- Comment #27 from arne_woer...@yahoo.com ---
Created attachment 137493
  --> https://bugs.freedesktop.org/attachment.cgi?id=137493=edit
journalctl -r|tac of a resume failure with polaris12_uvd.bin from 20180119-2

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


[Bug 105021] suspend / rx550 / extremely slow after 2nd thaw

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105021

--- Comment #26 from arne_woer...@yahoo.com ---
Created attachment 137492
  --> https://bugs.freedesktop.org/attachment.cgi?id=137492=edit
dmesg of boot/suspend/resume with polaris12_uvd.bin from 20180104

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


[Bug 102820] [bisected][DC] commit ebbf7337e2daacacef3e01114e6be68a2a4f11b4 prevents X11 from starting

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=102820

--- Comment #22 from Harry Wentland  ---
Thanks for fixing and testing the patch. I'll get it reviewed and merged.

It looks like the dc_log=1 didn't take. I'd expect a lot more spam from DC if
it took. It should be fine in any 4.15 RC but there might still be a bugfix for
it that didn't make it into 4.15. I don't remember. amd-staging-drm-next should
be good with the log option.

Either way, looks like the VBIOS info isn't what we expect on some boards.

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


[Bug 103277] [bisected] Systems hangs on resume from S3 sleep due to "Match actual state during S3 resume" commit

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103277

--- Comment #17 from Alex Deucher  ---
amd-staging-drm-next is still based on 4.15-rc4 which still has the regression
mentioned in comment 14.  Can you try 4.15 final or my drm-next-4.17-wip
branch?

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


[PATCH] virtio-gpu: fix ioctl and expose the fixed status to userspace.

2018-02-20 Thread Dave Airlie
From: Dave Airlie 

This exposes to mesa that it can use the fixed ioctl for querying
later cap sets, cap set 1 is forever frozen in time.

Signed-off-by: Dave Airlie 
---
 drivers/gpu/drm/virtio/virtgpu_ioctl.c | 17 +++--
 include/uapi/drm/virtgpu_drm.h |  1 +
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c 
b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index 5720a0d4ac0a..677ac16c8a6d 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -197,6 +197,9 @@ static int virtio_gpu_getparam_ioctl(struct drm_device 
*dev, void *data,
case VIRTGPU_PARAM_3D_FEATURES:
value = vgdev->has_virgl_3d == true ? 1 : 0;
break;
+   case VIRTGPU_PARAM_CAPSET_QUERY_FIX:
+   value = 1;
+   break;
default:
return -EINVAL;
}
@@ -472,7 +475,7 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
 {
struct virtio_gpu_device *vgdev = dev->dev_private;
struct drm_virtgpu_get_caps *args = data;
-   int size;
+   unsigned size, host_caps_size;
int i;
int found_valid = -1;
int ret;
@@ -481,6 +484,10 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device 
*dev,
if (vgdev->num_capsets == 0)
return -ENOSYS;
 
+   /* don't allow userspace to pass 0 */
+   if (args->size == 0)
+   return -EINVAL;
+
spin_lock(>display_info_lock);
for (i = 0; i < vgdev->num_capsets; i++) {
if (vgdev->capsets[i].id == args->cap_set_id) {
@@ -496,11 +503,9 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device 
*dev,
return -EINVAL;
}
 
-   size = vgdev->capsets[found_valid].max_size;
-   if (args->size > size) {
-   spin_unlock(>display_info_lock);
-   return -EINVAL;
-   }
+   host_caps_size = vgdev->capsets[found_valid].max_size;
+   /* only copy to user the minimum of the host caps size or the guest 
caps size */
+   size = min(args->size, host_caps_size);
 
list_for_each_entry(cache_ent, >cap_cache, head) {
if (cache_ent->id == args->cap_set_id &&
diff --git a/include/uapi/drm/virtgpu_drm.h b/include/uapi/drm/virtgpu_drm.h
index 91a31ffed828..9a781f0611df 100644
--- a/include/uapi/drm/virtgpu_drm.h
+++ b/include/uapi/drm/virtgpu_drm.h
@@ -63,6 +63,7 @@ struct drm_virtgpu_execbuffer {
 };
 
 #define VIRTGPU_PARAM_3D_FEATURES 1 /* do we have 3D features in the hw */
+#define VIRTGPU_PARAM_CAPSET_QUERY_FIX 2 /* do we have the capset fix */
 
 struct drm_virtgpu_getparam {
__u64 param;
-- 
2.14.3

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


Re: [PATCH 1/5] drm/docs: Discourage adding more to kms-properties.csv

2018-02-20 Thread Laurent Pinchart
Hi Daniel,

Thank you for the patch.

On Tuesday, 20 February 2018 00:53:52 EET Daniel Vetter wrote:
> Motivated by patch review.
> 
> The table is really hard to read in source form, hard to edit, and
> we've moved away to more focused sections about specific features and
> how they're exposed in properties.
> 
> Those sections can then more easily enumerate options, link to helper
> functions and other parts of the docs. All things that get ugly real
> fast in the docs.
> 
> Cc: Maxime Ripard 
> Cc: Laurent Pinchart 
> Signed-off-by: Daniel Vetter 

Acked-by: Laurent Pinchart 

> ---
>  Documentation/gpu/drm-kms.rst | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/gpu/drm-kms.rst b/Documentation/gpu/drm-kms.rst
> index 2dcf5b42015d..56a3780e39b8 100644
> --- a/Documentation/gpu/drm-kms.rst
> +++ b/Documentation/gpu/drm-kms.rst
> @@ -547,8 +547,9 @@ Explicit Fencing Properties
>  Existing KMS Properties
>  ---
> 
> -The following table gives description of drm properties exposed by
> -various modules/drivers.
> +The following table gives description of drm properties exposed by various
> +modules/drivers. Because this table is very unwieldy, do not add any new
> +properties here. Instead document them in a section above.
> 
>  .. csv-table::
> :header-rows: 1

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 1/4] locking/ww_mutex: add ww_mutex_is_owned_by function v3

2018-02-20 Thread Daniel Vetter
On Tue, Feb 20, 2018 at 04:21:58PM +0100, Peter Zijlstra wrote:
> On Tue, Feb 20, 2018 at 04:05:49PM +0100, Christian König wrote:
> > Am 20.02.2018 um 15:54 schrieb Peter Zijlstra:
> > > On Tue, Feb 20, 2018 at 03:34:07PM +0100, Christian König wrote:
> > > > > OK, but neither case would in fact need the !ctx case right? That's 
> > > > > just
> > > > > there for completeness sake?
> > > > Unfortunately not. TTM uses trylock to lock BOs which are about to be
> > > > evicted to make room for all the BOs locked with a ctx.
> > > > 
> > > > I need to be able to distinct between the BOs which are trylocked and 
> > > > those
> > > > which are locked with a ctx.
> > > > 
> > > > Writing this I actually noticed the current version is buggy, cause even
> > > > when we check the mutex owner we still need to make sure that the ctx 
> > > > in the
> > > > lock is NULL.
> > > Hurm... I can't remember why trylocks behave like that, and it seems
> > > rather unfortunate / inconsistent.
> > 
> > Actually for me that is rather fortunate, cause I need to distinct between
> > the locks acquired through trylock and lock.
> 
> I suppose that would always be possible using:
> ww_mutex_trylock(.ctx=NULL), and it could be that there simply weren't
> any immediate uses for a !NULL trylock and it was thus not implemented.
> 
> But that is all very long ago..

I think we simple never had a use-case for interleaving ww_mutex_lock(ctx)
and ww_mutex_trylock(ctx). Nesting multiple trylocks in ctx-locks happens
plenty, but not further:

The common use-case for that is locking a bunch of buffers you need (for
command submission or whatever), and then trylocking other buffers to make
space for the buffers you need to move into VRAM. I guess if only
trylocking buffers doesn't succeed in freeing up enough VRAM then we could
go into blocking ww_mutex_locks which need the ctx (and which would need
all the trylock-acquired buffers to be annotated with the ctx too). TTM
currently tries to be far enough away from that corner case (using a
defensive "never use more than 50% of all memory for gfx" approach) that
it doesn't seem to need that.

Once we get there it should indeed be simply to add a ctx parameter to
ww_mutex_trylock to fix this case. The TTM side rework is definitely going
to be the much bigger issue here ...
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 103277] [bisected] Systems hangs on resume from S3 sleep due to "Match actual state during S3 resume" commit

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103277

--- Comment #16 from dwagner  ---
I noticed in the git log of amd-staging-drm-next that multiple patches
were committed that might be related to S3 resumes, so I retried whether
a kernel compiled from the current amd-staging-drm-next head is able to
resume from S3.

Unluckily, the symptoms are unchanged: System crashes upon every S3 resume
attempt - so I'm back to the kernel from last October that resumes fine.

With relevant security issues having been addressed in the kernel
between Oct 17 and now this situation becomes unbearable for me.

Patches that were included in the kernel I tried today:

> commit f8c80313f7a6a8f66b74b118b0e3e5112718e2e5 (HEAD, 
> origin/amd-staging-drm-next)
> Author: Alex Deucher 
> Date:   Thu Feb 15 08:40:30 2018 -0500
>   Revert "drm/radeon/pm: autoswitch power state when in balanced mode"
>   This reverts commit 1c331f75aa6ccbf64ebcc5a019183e617c9d818a.
>   Breaks resume on some systems.

> commit 734b7ebc0e16b0fb4d2937cc3716c505d7e2c319
> Author: Hersen Wu 
> Date:   Tue Jan 30 11:46:16 2018 -0500
> 
>   drm/amd/display: VGA black screen from s3 when attached to hook
>[Description] For MST, DC already notify MST sink for MST mode, DC stll
>check DP SINK DPCD register to see if MST enabled. DP RX firmware may
>not handle this properly.

> commit adf1c840a6741f1b53ecd6e466e160c725a80641
> Author: Yongqiang Sun 
> Date:   Fri Feb 2 17:35:00 2018 -0500
>   drm/amd/display: Keep eDP stream enabled during boot.
>   
>   This path fixed specific eDP panel cold boot black screen
>   due to unnecessary enable link.
>   Change:
>   In case of boot up with eDP, if OS is going to set mode
>   on eDP, keep eDP light up, do not disable and reset corresponding
>   HW.
>   This change may affect dce asics and S3/S4 Resume with multi-monitor.

> commit 8dd8b6bb22fb2470af4e8743f19eabba8127d566
> Author: Charlene Liu 
> Date:   Wed Jan 24 13:18:57 2018 -0500
> 
>  drm/amd/display: resume from S3 bypass power down HW block.

> commit 8d0de6a585e2186734748be2a1043eb3456ed8ed
> Author: Mikita Lipski 
> Date:   Sat Feb 3 15:19:20 2018 -0500
>   drm/amdgpu: Unify the dm resume calls into one
>  
>   amdgpu_dm_display_resume is now called from dm_resume to
>   unify DAL resume call into a single function call
>   
>   There is no more need to separately call 2 resume functions
>   for DM.
>   
>   Initially they were separated to resume display state after
>   cursor is pinned. But because there is no longer any corruption
>   with the cursor - the calls can be merged into one function hook.

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


Re: [PATCH] drm/todo: i915 could use device_link_add

2018-02-20 Thread Daniel Vetter
On Tue, Feb 20, 2018 at 04:17:19PM +0200, Imre Deak wrote:
> On Tue, Feb 20, 2018 at 02:20:17PM +0100, Daniel Vetter wrote:
> > Noticed while reading some unrelated patches. Unfortunately Imre's
> > patch to add our early/late hooks predated the device_link
> > infrastructure by 2 years.
> > 
> > Cc: Imre Deak 
> > Cc: Takashi Iwai 
> > Signed-off-by: Daniel Vetter 
> 
> Yep, good idea to convert over:
> Acked-by: Imre Deak 

Pushed to dinq.
-Daniel

> 
> > ---
> >  Documentation/gpu/todo.rst | 7 +++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
> > index 1a0a413eeced..f4d0b3476d9c 100644
> > --- a/Documentation/gpu/todo.rst
> > +++ b/Documentation/gpu/todo.rst
> > @@ -450,5 +450,12 @@ See drivers/gpu/drm/amd/display/TODO for tasks.
> >  
> >  Contact: Harry Wentland, Alex Deucher
> >  
> > +i915
> > +
> > +
> > +- Our early/late pm callbacks could be removed in favour of using
> > +  device_link_add to model the dependency between i915 and snd_had. See
> > +  https://dri.freedesktop.org/docs/drm/driver-api/device_link.html
> > +
> >  Outside DRM
> >  ===
> > -- 
> > 2.15.1
> > 

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


Re: [PATCH] fix double ;;s in code

2018-02-20 Thread Andrew Morton
On Tue, 20 Feb 2018 10:03:56 +0200 Jani Nikula  
wrote:

> On Mon, 19 Feb 2018, Pavel Machek  wrote:
> > On Mon 2018-02-19 16:41:35, Daniel Vetter wrote:
> >> Yeah, pls split this into one patch per area, with a suitable patch
> >> subject prefix. Look at git log of each file to get a feeling for what's
> >> the standard in each area.
> >
> > Yeah I can spend hour spliting it, and then people will ignore it
> > anyway.
> >
> > If you care about one of the files being modified, please fix the
> > bug, ";;" is a clear bug.
> >
> > If you don't care ... well I don't care either.
> 
> Look, if this causes just one conflict down the line because it touches
> the kernel all over the place, then IMO it already wasn't worth
> it. Merge conflicts are inevitable, but there's no reason to make life
> harder just to cater for a cleanup patch. It's not that important.
> 
> Had it been split up, the drm parts would've been merged already.

I just stage patches like this behind linux-next.  So if your stuff in
in -next, you'll never notice a thing.

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


Re: [PATCH RFC] drm/bridge: panel: Add device_link between panel and master drm device

2018-02-20 Thread Daniel Vetter
On Wed, Feb 21, 2018 at 12:21:50AM +0200, Jyri Sarha wrote:
> Currently the master drm driver is not protected against the attached
> panel driver from becoming unavailable. Adding a device_link with
> DL_FLAG_AUTOREMOVE flag unbinds the master drm device (the consumer)
> when the panel device (the supplier) becomes unavailable.
> 
> Signed-off-by: Jyri Sarha 
> Suggested-by: Thierry Reding 
> cc: e...@anholt.net
> cc: laurent.pinch...@ideasonboard.com
> ---
> It still annoys me that the unbound master drm device does not probe
> again if the panel device becomes available again. If there is no
> remedy to this, may be we should consider applying the module get/put
> patch[1] too.
> 
> Hmmm... there was an obvious reasons not to add module gets and puts
> to drm_panel_attach/detach(), but is there any such reasons for not to
> add and remove the device link there?

Yeah that might be the better place for this. At least conceptually it's
when we're creating the dependency link.

> The bridge side look more complicated as there is no public
> drm_bridge_detach(), and I am not sure if the drm_bridge_remove() should
> remove the device link. I guess it should, if the link is there.

drm_bridge_remove is meant to be called when unloading the driver, which
is too late. We probably need a drm_bridge_detach (which the master
drm_device driver would need to call). Since bridges are linked through
drm_encoder/bridge already, the drm core could make that call (would avoid
having to audit all the drivers I think).

But imo we can postpone fixing the bridge side of things to a later time.

> [1] https://lists.freedesktop.org/archives/dri-devel/2018-February/166350.html

Afaiui the device_link will make sure that the main driver gets unbound
before the panel driver. Since a module unload implies a driver unbind I
think we're safe with this, and don't need any additional protection.

Wrt reprobing the main drm_driver when you rebind/reload the panel driver:
I guess poke it through the sysfs reprobe thing, or just reload the main
driver too, that should work. It's still driver reloading we're talking
about, as long as you can't make the kernel go boom I think it's all
perfectly fine.
-Daniel

> 
>  drivers/gpu/drm/bridge/panel.c | 22 ++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
> index 6d99d4a..d71ddd8 100644
> --- a/drivers/gpu/drm/bridge/panel.c
> +++ b/drivers/gpu/drm/bridge/panel.c
> @@ -22,6 +22,7 @@ struct panel_bridge {
>   struct drm_connector connector;
>   struct drm_panel *panel;
>   u32 connector_type;
> + struct device_link *link;   /* link to master drm dev */
>  };
>  
>  static inline struct panel_bridge *
> @@ -57,6 +58,22 @@ static const struct drm_connector_funcs 
> panel_bridge_connector_funcs = {
>   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>  };
>  
> +static int panel_bridge_link_to_master(struct panel_bridge *panel_bridge)
> +{
> + struct device *mdev = panel_bridge->bridge.dev->dev;
> + struct device *pdev = panel_bridge->panel->dev;
> + u32 flags = DL_FLAG_AUTOREMOVE;
> +
> + panel_bridge->link = device_link_add(mdev, pdev, flags);
> + if (!panel_bridge->link) {
> + dev_err(pdev, "failed to link panel %s to %s\n",
> + dev_name(pdev), dev_name(mdev));
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
> +
>  static int panel_bridge_attach(struct drm_bridge *bridge)
>  {
>   struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
> @@ -82,6 +99,9 @@ static int panel_bridge_attach(struct drm_bridge *bridge)
>   drm_mode_connector_attach_encoder(_bridge->connector,
> bridge->encoder);
>  
> + if (panel_bridge_link_to_master(panel_bridge))
> + return -EINVAL;
> +
>   ret = drm_panel_attach(panel_bridge->panel, _bridge->connector);
>   if (ret < 0)
>   return ret;
> @@ -94,6 +114,8 @@ static void panel_bridge_detach(struct drm_bridge *bridge)
>   struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
>  
>   drm_panel_detach(panel_bridge->panel);
> +
> + device_link_del(panel_bridge->link);
>  }
>  
>  static void panel_bridge_pre_enable(struct drm_bridge *bridge)
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. 
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 

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


[Bug 102820] [bisected][DC] commit ebbf7337e2daacacef3e01114e6be68a2a4f11b4 prevents X11 from starting

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=102820

--- Comment #21 from dwagner  ---
Created attachment 137487
  --> https://bugs.freedesktop.org/attachment.cgi?id=137487=edit
dmesg output after Harry's recent patch for the "6G" check was applied

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


[Bug 102820] [bisected][DC] commit ebbf7337e2daacacef3e01114e6be68a2a4f11b4 prevents X11 from starting

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=102820

--- Comment #20 from dwagner  ---
(In reply to Harry Wentland from comment #19)
> Created attachment 137476 [details] [review]
> drm/amd/display: Default HDMI6G support to true. Log VBIOS table error.
> 
> Can you see if this helps? Our Windows driver definitely checks the HDMI6G
> flag from VBIOS but it will default to allow 6G on HDMI if the VBIOS check
> fails.
> 
> This patch is porting the same behavior in the hopes that it will help with
> your issue.
I had to change "ctx->logger" into "enc110->base.ctx->logger" to make your
patch
compile (applied on today's head of amd-staging-drm-next).

Yes, that patch changes the behaviour for the better: HDMI 2.0 modes -
especially 4k@60Hz work fine with this patch applied on my system. Tried
multiple reboots, result was consistent.

> If this patch works a dmesg log with the amdgpu.dc_log=1 option on the
> kernel would help us understand the root cause a bit better.
I did enable amdgpu.dc_log=1 on the kernel command line - but there is no
"Failed to get encoder_cap_info from VBIOS..." message visible in dmesg, which
makes me wonder what makes the new code path differ from the old one.
(Attaching dmesg output below.)

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


[PATCH v4 14/16] ARM: dts: r8a7794: Convert to new DU DT bindings

2018-02-20 Thread Laurent Pinchart
The DU DT bindings have been updated to drop the reg-names property.
Update the r8a7792 device tree accordingly.

Signed-off-by: Laurent Pinchart 
---
 arch/arm/boot/dts/r8a7794.dtsi | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi
index 106b4e1649ff..7d9da744a01d 100644
--- a/arch/arm/boot/dts/r8a7794.dtsi
+++ b/arch/arm/boot/dts/r8a7794.dtsi
@@ -999,7 +999,6 @@
du: display@feb0 {
compatible = "renesas,du-r8a7794";
reg = <0 0xfeb0 0 0x4>;
-   reg-names = "du";
interrupts = ,
 ;
clocks = < CPG_MOD 724>, < CPG_MOD 723>;
-- 
Regards,

Laurent Pinchart

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


[PATCH v4 09/16] drm: rcar-du: Convert LVDS encoder code to bridge driver

2018-02-20 Thread Laurent Pinchart
The LVDS encoders used to be described in DT as part of the DU. They now
have their own DT node, linked to the DU using the OF graph bindings.
This allows moving internal LVDS encoder support to a separate driver
modelled as a DRM bridge. Backward compatibility is retained as legacy
DT is patched live to move to the new bindings.

Signed-off-by: Laurent Pinchart 
---
Changes since v1:

- Update the SPDX headers to use GPL-2.0 instead of GPL-2.0-only
- Update to the -lvds compatible string format
---
 drivers/gpu/drm/rcar-du/Kconfig   |   4 +-
 drivers/gpu/drm/rcar-du/Makefile  |   3 +-
 drivers/gpu/drm/rcar-du/rcar_du_drv.c |  21 +-
 drivers/gpu/drm/rcar-du/rcar_du_drv.h |   5 -
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 175 +-
 drivers/gpu/drm/rcar-du/rcar_du_encoder.h |  12 -
 drivers/gpu/drm/rcar-du/rcar_du_kms.c |  14 +-
 drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c |  93 --
 drivers/gpu/drm/rcar-du/rcar_du_lvdscon.h |  24 --
 drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c | 238 --
 drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.h |  64 
 drivers/gpu/drm/rcar-du/rcar_lvds.c   | 524 ++
 12 files changed, 561 insertions(+), 616 deletions(-)
 delete mode 100644 drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c
 delete mode 100644 drivers/gpu/drm/rcar-du/rcar_du_lvdscon.h
 delete mode 100644 drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c
 delete mode 100644 drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.h
 create mode 100644 drivers/gpu/drm/rcar-du/rcar_lvds.c

diff --git a/drivers/gpu/drm/rcar-du/Kconfig b/drivers/gpu/drm/rcar-du/Kconfig
index 3f83352a7313..edde8d4b87a3 100644
--- a/drivers/gpu/drm/rcar-du/Kconfig
+++ b/drivers/gpu/drm/rcar-du/Kconfig
@@ -19,8 +19,8 @@ config DRM_RCAR_DW_HDMI
  Enable support for R-Car Gen3 internal HDMI encoder.
 
 config DRM_RCAR_LVDS
-   bool "R-Car DU LVDS Encoder Support"
-   depends on DRM_RCAR_DU
+   tristate "R-Car DU LVDS Encoder Support"
+   depends on DRM && DRM_BRIDGE && OF
select DRM_PANEL
select OF_FLATTREE
select OF_OVERLAY
diff --git a/drivers/gpu/drm/rcar-du/Makefile b/drivers/gpu/drm/rcar-du/Makefile
index 86b337b4be5d..3e58ed93d5b1 100644
--- a/drivers/gpu/drm/rcar-du/Makefile
+++ b/drivers/gpu/drm/rcar-du/Makefile
@@ -4,10 +4,8 @@ rcar-du-drm-y := rcar_du_crtc.o \
 rcar_du_encoder.o \
 rcar_du_group.o \
 rcar_du_kms.o \
-rcar_du_lvdscon.o \
 rcar_du_plane.o
 
-rcar-du-drm-$(CONFIG_DRM_RCAR_LVDS)+= rcar_du_lvdsenc.o
 rcar-du-drm-$(CONFIG_DRM_RCAR_LVDS)+= rcar_du_of.o \
   rcar_du_of_lvds_r8a7790.dtb.o \
   rcar_du_of_lvds_r8a7791.dtb.o \
@@ -18,3 +16,4 @@ rcar-du-drm-$(CONFIG_DRM_RCAR_VSP)+= rcar_du_vsp.o
 
 obj-$(CONFIG_DRM_RCAR_DU)  += rcar-du-drm.o
 obj-$(CONFIG_DRM_RCAR_DW_HDMI) += rcar_dw_hdmi.o
+obj-$(CONFIG_DRM_RCAR_LVDS)+= rcar_lvds.o
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c 
b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index 6e02c762a557..06a3fbdd728a 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -29,6 +29,7 @@
 
 #include "rcar_du_drv.h"
 #include "rcar_du_kms.h"
+#include "rcar_du_of.h"
 #include "rcar_du_regs.h"
 
 /* 
-
@@ -74,7 +75,6 @@ static const struct rcar_du_device_info rzg1_du_r8a7745_info 
= {
.port = 1,
},
},
-   .num_lvds = 0,
 };
 
 static const struct rcar_du_device_info rcar_du_r8a7779_info = {
@@ -95,14 +95,13 @@ static const struct rcar_du_device_info 
rcar_du_r8a7779_info = {
.port = 1,
},
},
-   .num_lvds = 0,
 };
 
 static const struct rcar_du_device_info rcar_du_r8a7790_info = {
.gen = 2,
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
  | RCAR_DU_FEATURE_EXT_CTRL_REGS,
-   .quirks = RCAR_DU_QUIRK_ALIGN_128B | RCAR_DU_QUIRK_LVDS_LANES,
+   .quirks = RCAR_DU_QUIRK_ALIGN_128B,
.num_crtcs = 3,
.routes = {
/*
@@ -164,7 +163,6 @@ static const struct rcar_du_device_info 
rcar_du_r8a7792_info = {
.port = 1,
},
},
-   .num_lvds = 0,
 };
 
 static const struct rcar_du_device_info rcar_du_r8a7794_info = {
@@ -186,7 +184,6 @@ static const struct rcar_du_device_info 
rcar_du_r8a7794_info = {
.port = 1,
},
},
-   .num_lvds = 0,
 };
 
 static const struct rcar_du_device_info rcar_du_r8a7795_info = {
@@ -434,7 +431,19 @@ static struct platform_driver rcar_du_platform_driver = {
},
 };
 
-module_platform_driver(rcar_du_platform_driver);
+static int __init rcar_du_init(void)
+{
+   

[PATCH v4 07/16] i2c: demux: Use changeset helpers for clarity

2018-02-20 Thread Laurent Pinchart
From: Pantelis Antoniou 

The changeset helpers are easier to use, use them instead of
using the static property.

Signed-off-by: Pantelis Antoniou 
Acked-by: Wolfram Sang 
["okay" -> "ok"]
Signed-off-by: Laurent Pinchart 
---
 drivers/i2c/muxes/i2c-demux-pinctrl.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c 
b/drivers/i2c/muxes/i2c-demux-pinctrl.c
index 33ce032cb701..0f0046831492 100644
--- a/drivers/i2c/muxes/i2c-demux-pinctrl.c
+++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c
@@ -220,10 +220,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device 
*pdev)
 
priv = devm_kzalloc(>dev, sizeof(*priv)
   + num_chan * sizeof(struct i2c_demux_pinctrl_chan), 
GFP_KERNEL);
-
-   props = devm_kcalloc(>dev, num_chan, sizeof(*props), GFP_KERNEL);
-
-   if (!priv || !props)
+   if (!priv)
return -ENOMEM;
 
err = of_property_read_string(np, "i2c-bus-name", >bus_name);
@@ -241,12 +238,9 @@ static int i2c_demux_pinctrl_probe(struct platform_device 
*pdev)
}
priv->chan[i].parent_np = adap_np;
 
-   props[i].name = devm_kstrdup(>dev, "status", GFP_KERNEL);
-   props[i].value = devm_kstrdup(>dev, "ok", GFP_KERNEL);
-   props[i].length = 3;
-
of_changeset_init(>chan[i].chgset);
-   of_changeset_update_property(>chan[i].chgset, adap_np, 
[i]);
+   of_changeset_update_property_string(>chan[i].chgset,
+   adap_np, "status", "ok");
}
 
priv->num_chan = num_chan;
-- 
Regards,

Laurent Pinchart

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


[PATCH v4 12/16] ARM: dts: r8a7792: Convert to new DU DT bindings

2018-02-20 Thread Laurent Pinchart
The DU DT bindings have been updated to drop the reg-names property.
Update the r8a7792 device tree accordingly.

Signed-off-by: Laurent Pinchart 
---
 arch/arm/boot/dts/r8a7792.dtsi | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/boot/dts/r8a7792.dtsi b/arch/arm/boot/dts/r8a7792.dtsi
index 3be15a158bad..c4a36a18f505 100644
--- a/arch/arm/boot/dts/r8a7792.dtsi
+++ b/arch/arm/boot/dts/r8a7792.dtsi
@@ -691,7 +691,6 @@
du: display@feb0 {
compatible = "renesas,du-r8a7792";
reg = <0 0xfeb0 0 0x4>;
-   reg-names = "du";
interrupts = ,
 ;
clocks = < CPG_MOD 724>,
-- 
Regards,

Laurent Pinchart

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


[PATCH v4 13/16] ARM: dts: r8a7793: Convert to new LVDS DT bindings

2018-02-20 Thread Laurent Pinchart
The internal LVDS encoder now has DT bindings separate from the DU. Port
the device tree over to the new model.

Signed-off-by: Laurent Pinchart 
---
Changes since v3:

- Added power-domains and resets properties to LVDS nodes

Changes since v2:

- Fixed LVDS compatible string

Changes since v1:

- Remove the DU reg-names property
---
 arch/arm/boot/dts/r8a7793-gose.dts | 10 +++---
 arch/arm/boot/dts/r8a7793.dtsi | 37 +++--
 2 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7793-gose.dts 
b/arch/arm/boot/dts/r8a7793-gose.dts
index 51b3ffac8efa..c6121f9b72a8 100644
--- a/arch/arm/boot/dts/r8a7793-gose.dts
+++ b/arch/arm/boot/dts/r8a7793-gose.dts
@@ -303,10 +303,9 @@
pinctrl-names = "default";
status = "okay";
 
-   clocks = < CPG_MOD 724>, < CPG_MOD 723>, < CPG_MOD 726>,
+   clocks = < CPG_MOD 724>, < CPG_MOD 723>,
 <_clk>, <_clk>;
-   clock-names = "du.0", "du.1", "lvds.0",
- "dclkin.0", "dclkin.1";
+   clock-names = "du.0", "du.1", "dclkin.0", "dclkin.1";
 
ports {
port@0 {
@@ -314,6 +313,11 @@
remote-endpoint = <_in>;
};
};
+   };
+};
+
+ {
+   ports {
port@1 {
lvds_connector: endpoint {
};
diff --git a/arch/arm/boot/dts/r8a7793.dtsi b/arch/arm/boot/dts/r8a7793.dtsi
index 039b22517526..d3dc3e4a694b 100644
--- a/arch/arm/boot/dts/r8a7793.dtsi
+++ b/arch/arm/boot/dts/r8a7793.dtsi
@@ -976,15 +976,12 @@
 
du: display@feb0 {
compatible = "renesas,du-r8a7793";
-   reg = <0 0xfeb0 0 0x4>,
- <0 0xfeb9 0 0x1c>;
-   reg-names = "du", "lvds.0";
+   reg = <0 0xfeb0 0 0x4>;
interrupts = ,
 ;
clocks = < CPG_MOD 724>,
-< CPG_MOD 723>,
-< CPG_MOD 726>;
-   clock-names = "du.0", "du.1", "lvds.0";
+< CPG_MOD 723>;
+   clock-names = "du.0", "du.1";
status = "disabled";
 
ports {
@@ -999,6 +996,34 @@
port@1 {
reg = <1>;
du_out_lvds0: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
+   };
+   };
+
+   lvds0: lvds@feb9 {
+   compatible = "renesas,r8a7793-lvds";
+   reg = <0 0xfeb9 0 0x1c>;
+   clocks = < CPG_MOD 726>;
+   power-domains = < R8A7793_PD_ALWAYS_ON>;
+   resets = < 726>;
+
+   status = "disabled";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   lvds0_in: endpoint {
+   remote-endpoint = <_out_lvds0>;
+   };
+   };
+   port@1 {
+   reg = <1>;
+   lvds0_out: endpoint {
};
};
};
-- 
Regards,

Laurent Pinchart

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


[PATCH v4 05/16] of: changeset: Add of_changeset_node_move method

2018-02-20 Thread Laurent Pinchart
From: Pantelis Antoniou 

Adds a changeset helper for moving a subtree to a different place
in the running tree. This is useful in advances cases of dynamic
device tree construction.

Signed-off-by: Pantelis Antoniou 
Signed-off-by: Laurent Pinchart 
---
 drivers/of/dynamic.c | 66 
 include/linux/of.h   |  9 +++
 2 files changed, 75 insertions(+)

diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 85e722ed8631..27d9057ef360 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -1132,3 +1132,69 @@ int __of_changeset_add_update_property_string_list(
return ret;
 }
 EXPORT_SYMBOL_GPL(__of_changeset_add_update_property_string_list);
+
+static struct device_node *
+__of_changeset_node_move_one(struct of_changeset *ocs,
+   struct device_node *np, struct device_node *new_parent)
+{
+   struct device_node *np2;
+   const char *unitname;
+   int err;
+
+   err = of_changeset_detach_node(ocs, np);
+   if (err)
+   return ERR_PTR(err);
+
+   unitname = strrchr(np->full_name, '/');
+   if (!unitname)
+   unitname = np->full_name;
+
+   np2 = __of_node_dup(np, "%s/%s",
+   new_parent->full_name, unitname);
+   if (!np2)
+   return ERR_PTR(-ENOMEM);
+   np2->parent = new_parent;
+
+   err = of_changeset_attach_node(ocs, np2);
+   if (err)
+   return ERR_PTR(err);
+
+   return np2;
+}
+
+/**
+ * of_changeset_node_move_to - Moves a subtree to a new place in
+ * the tree
+ *
+ * @ocs:   changeset pointer
+ * @np:device node pointer to be moved
+ * @to:device node of the new parent
+ *
+ * Moves a subtree to a new place in the tree.
+ * Note that a move is a safe operation because the phandles
+ * remain valid.
+ *
+ * Returns zero on success, a negative error value otherwise.
+ */
+int of_changeset_node_move(struct of_changeset *ocs,
+   struct device_node *np, struct device_node *new_parent)
+{
+   struct device_node *npc, *nppc;
+
+   /* move the root first */
+   nppc = __of_changeset_node_move_one(ocs, np, new_parent);
+   if (IS_ERR(nppc))
+   return PTR_ERR(nppc);
+
+   /* move the subtrees next */
+   for_each_child_of_node(np, npc) {
+   nppc = __of_changeset_node_move_one(ocs, npc, nppc);
+   if (IS_ERR(nppc)) {
+   of_node_put(npc);
+   return PTR_ERR(nppc);
+   }
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(of_changeset_node_move);
diff --git a/include/linux/of.h b/include/linux/of.h
index 7aef555f9bc2..76197bc75346 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -1328,6 +1328,9 @@ int __of_changeset_add_update_property_string_list(
struct of_changeset *ocs, struct device_node *np,
const char *name, const char **strs, int count, bool update);
 
+int of_changeset_node_move(struct of_changeset *ocs,
+   struct device_node *np, struct device_node *new_parent);
+
 #else /* CONFIG_OF_DYNAMIC */
 static inline int of_reconfig_notifier_register(struct notifier_block *nb)
 {
@@ -1390,6 +1393,12 @@ static inline int 
__of_changeset_add_update_property_string_list(
return -EINVAL;
 }
 
+static inline int of_changeset_node_move(struct of_changeset *ocs,
+   struct device_node *np, struct device_node *new_parent)
+{
+   return -EINVAL;
+}
+
 #endif /* CONFIG_OF_DYNAMIC */
 
 /**
-- 
Regards,

Laurent Pinchart

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


[PATCH v4 16/16] arm64: dts: renesas: r8a7796: Convert to new LVDS DT bindings

2018-02-20 Thread Laurent Pinchart
The internal LVDS encoder now has DT bindings separate from the DU. Port
the device tree over to the new model.

Signed-off-by: Laurent Pinchart 
---
Changes since v3:

- Added power-domains and resets properties to LVDS nodes
- Dropped bogus changes from the rcar-du driver

Changes since v2:

- Fixed LVDS compatible string

Changes since v1:

- Remove the DU reg-names property
---
 arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts |  3 +-
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts |  3 +-
 arch/arm64/boot/dts/renesas/r8a7796.dtsi   | 36 ++
 3 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts 
b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts
index daee1f1a3f68..21bd679062f3 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts
@@ -33,10 +33,9 @@
clocks = < CPG_MOD 724>,
 < CPG_MOD 723>,
 < CPG_MOD 722>,
-< CPG_MOD 727>,
 < 1>,
 < 3>,
 < 2>;
-   clock-names = "du.0", "du.1", "du.2", "lvds.0",
+   clock-names = "du.0", "du.1", "du.2",
  "dclkin.0", "dclkin.1", "dclkin.2";
 };
diff --git a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
index 2ba992946c50..9524fcb6bc5c 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
@@ -32,11 +32,10 @@
clocks = < CPG_MOD 724>,
 < CPG_MOD 723>,
 < CPG_MOD 722>,
-< CPG_MOD 727>,
 < 1>,
 <_clk>,
 < 2>;
-   clock-names = "du.0", "du.1", "du.2", "lvds.0",
+   clock-names = "du.0", "du.1", "du.2",
  "dclkin.0", "dclkin.1", "dclkin.2";
 };
 
diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index c5192d513d7d..c1506c5e27b1 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -1924,17 +1924,14 @@
 
du: display@feb0 {
compatible = "renesas,du-r8a7796";
-   reg = <0 0xfeb0 0 0x7>,
- <0 0xfeb9 0 0x14>;
-   reg-names = "du", "lvds.0";
+   reg = <0 0xfeb0 0 0x7>;
interrupts = ,
 ,
 ;
clocks = < CPG_MOD 724>,
 < CPG_MOD 723>,
-< CPG_MOD 722>,
-< CPG_MOD 727>;
-   clock-names = "du.0", "du.1", "du.2", "lvds.0";
+< CPG_MOD 722>;
+   clock-names = "du.0", "du.1", "du.2";
status = "disabled";
 
vsps = <  >;
@@ -1957,6 +1954,33 @@
port@2 {
reg = <2>;
du_out_lvds0: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
+   };
+   };
+
+   lvds0: lvds@feb9 {
+   compatible = "renesas,r8a7796-lvds";
+   reg = <0 0xfeb9 0 0x14>;
+   clocks = < CPG_MOD 727>;
+   power-domains = < R8A7796_PD_ALWAYS_ON>;
+   resets = < 727>;
+   status = "disabled";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   lvds0_in: endpoint {
+   remote-endpoint = 
<_out_lvds0>;
+   };
+   };
+   port@1 {
+   reg = <1>;
+   lvds0_out: endpoint {
};
};
};
-- 
Regards,

Laurent Pinchart

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


[PATCH v4 11/16] ARM: dts: r8a7791: Convert to new LVDS DT bindings

2018-02-20 Thread Laurent Pinchart
The internal LVDS encoder now has DT bindings separate from the DU. Port
the device tree over to the new model.

Signed-off-by: Laurent Pinchart 
---
Changes since v3:

- Added power-domains and resets properties to LVDS nodes

Changes since v2:

- Fixed LVDS compatible string

Changes since v1:

- Remove the DU reg-names property
---
 arch/arm/boot/dts/r8a7791-koelsch.dts | 10 --
 arch/arm/boot/dts/r8a7791-porter.dts  | 16 +---
 arch/arm/boot/dts/r8a7791.dtsi| 36 +--
 3 files changed, 51 insertions(+), 11 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts 
b/arch/arm/boot/dts/r8a7791-koelsch.dts
index a50924d12b6f..c42ff25e3aa3 100644
--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
@@ -337,8 +337,7 @@
 
clocks = < CPG_MOD 724>, < CPG_MOD 723>, < CPG_MOD 726>,
 <_clk>, <_clk>;
-   clock-names = "du.0", "du.1", "lvds.0",
- "dclkin.0", "dclkin.1";
+   clock-names = "du.0", "du.1", "dclkin.0", "dclkin.1";
 
ports {
port@0 {
@@ -346,6 +345,13 @@
remote-endpoint = <_in>;
};
};
+   };
+};
+
+ {
+   status = "okay";
+
+   ports {
port@1 {
lvds_connector: endpoint {
};
diff --git a/arch/arm/boot/dts/r8a7791-porter.dts 
b/arch/arm/boot/dts/r8a7791-porter.dts
index 9a02d03b23c2..e6d02839d636 100644
--- a/arch/arm/boot/dts/r8a7791-porter.dts
+++ b/arch/arm/boot/dts/r8a7791-porter.dts
@@ -419,10 +419,9 @@
pinctrl-names = "default";
status = "okay";
 
-   clocks = < CPG_MOD 724>, < CPG_MOD 723>, < CPG_MOD 726>,
+   clocks = < CPG_MOD 724>, < CPG_MOD 723>,
 <_clk>, <_clk>;
-   clock-names = "du.0", "du.1", "lvds.0",
- "dclkin.0", "dclkin.1";
+   clock-names = "du.0", "du.1", "dclkin.0", "dclkin.1";
 
ports {
port@0 {
@@ -433,6 +432,17 @@
};
 };
 
+ {
+   status = "okay";
+
+   ports {
+   port@1 {
+   lvds_connector: endpoint {
+   };
+   };
+   };
+};
+
 _sound {
pinctrl-0 = <_pins _clk_pins>;
pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 008a260f86a5..8660f8a329c7 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -1103,15 +1103,12 @@
 
du: display@feb0 {
compatible = "renesas,du-r8a7791";
-   reg = <0 0xfeb0 0 0x4>,
- <0 0xfeb9 0 0x1c>;
-   reg-names = "du", "lvds.0";
+   reg = <0 0xfeb0 0 0x4>;
interrupts = ,
 ;
clocks = < CPG_MOD 724>,
-< CPG_MOD 723>,
-< CPG_MOD 726>;
-   clock-names = "du.0", "du.1", "lvds.0";
+< CPG_MOD 723>;
+   clock-names = "du.0", "du.1";
status = "disabled";
 
ports {
@@ -1126,6 +1123,33 @@
port@1 {
reg = <1>;
du_out_lvds0: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
+   };
+   };
+
+   lvds0: lvds@feb9 {
+   compatible = "renesas,r8a7791-lvds";
+   reg = <0 0xfeb9 0 0x1c>;
+   clocks = < CPG_MOD 726>;
+   power-domains = < R8A7791_PD_ALWAYS_ON>;
+   resets = < 726>;
+   status = "disabled";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   lvds0_in: endpoint {
+   remote-endpoint = <_out_lvds0>;
+   };
+   };
+   port@1 {
+   reg = <1>;
+   lvds0_out: endpoint {
};
};
};
-- 
Regards,

Laurent Pinchart

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


[PATCH v4 03/16] of: dynamic: Add __of_node_dupv()

2018-02-20 Thread Laurent Pinchart
From: Pantelis Antoniou 

Add an __of_node_dupv() private method and make __of_node_dup() use it.
This is required for the subsequent changeset accessors which will
make use of it.

Signed-off-by: Pantelis Antoniou 
Signed-off-by: Laurent Pinchart 
---
 drivers/of/dynamic.c | 29 +++--
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 7bb33d22b4e2..4ffd04925fdf 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -382,8 +382,9 @@ struct property *__of_prop_dup(const struct property *prop, 
gfp_t allocflags)
 }
 
 /**
- * __of_node_dup() - Duplicate or create an empty device node dynamically.
- * @fmt: Format string (plus vargs) for new full name of the device node
+ * __of_node_dupv() - Duplicate or create an empty device node dynamically.
+ * @fmt: Format string for new full name of the device node
+ * @vargs: va_list containing the arugments for the node full name
  *
  * Create an device tree node, either by duplicating an empty node or by 
allocating
  * an empty one suitable for further modification.  The node data are
@@ -391,17 +392,15 @@ struct property *__of_prop_dup(const struct property 
*prop, gfp_t allocflags)
  * OF_DETACHED bits set. Returns the newly allocated node or NULL on out of
  * memory error.
  */
-struct device_node *__of_node_dup(const struct device_node *np, const char 
*fmt, ...)
+struct device_node *__of_node_dupv(const struct device_node *np,
+   const char *fmt, va_list vargs)
 {
-   va_list vargs;
struct device_node *node;
 
node = kzalloc(sizeof(*node), GFP_KERNEL);
if (!node)
return NULL;
-   va_start(vargs, fmt);
node->full_name = kvasprintf(GFP_KERNEL, fmt, vargs);
-   va_end(vargs);
if (!node->full_name) {
kfree(node);
return NULL;
@@ -433,6 +432,24 @@ struct device_node *__of_node_dup(const struct device_node 
*np, const char *fmt,
return NULL;
 }
 
+/**
+ * __of_node_dup() - Duplicate or create an empty device node dynamically.
+ * @fmt: Format string (plus vargs) for new full name of the device node
+ *
+ * See: __of_node_dupv()
+ */
+struct device_node *__of_node_dup(const struct device_node *np,
+   const char *fmt, ...)
+{
+   va_list vargs;
+   struct device_node *node;
+
+   va_start(vargs, fmt);
+   node = __of_node_dupv(np, fmt, vargs);
+   va_end(vargs);
+   return node;
+}
+
 static void __of_changeset_entry_destroy(struct of_changeset_entry *ce)
 {
of_node_put(ce->np);
-- 
Regards,

Laurent Pinchart

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


[PATCH v4 10/16] ARM: dts: r8a7790: Convert to new LVDS DT bindings

2018-02-20 Thread Laurent Pinchart
The internal LVDS encoder now has DT bindings separate from the DU. Port
the device tree over to the new model.

Signed-off-by: Laurent Pinchart 
---
Changes since v3:

- Added power-domains and resets properties to LVDS nodes

Changes since v2:

- Fixed LVDS compatible string

Changes since v1:

- Remove the DU reg-names property
---
 arch/arm/boot/dts/r8a7790-lager.dts | 22 ++---
 arch/arm/boot/dts/r8a7790.dtsi  | 64 +
 2 files changed, 74 insertions(+), 12 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7790-lager.dts 
b/arch/arm/boot/dts/r8a7790-lager.dts
index 169da676c4ba..b51ee84309bf 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -316,10 +316,8 @@
status = "okay";
 
clocks = < CPG_MOD 724>, < CPG_MOD 723>, < CPG_MOD 722>,
-< CPG_MOD 726>, < CPG_MOD 725>,
 <_clk>, <_clk>;
-   clock-names = "du.0", "du.1", "du.2", "lvds.0", "lvds.1",
- "dclkin.0", "dclkin.1";
+   clock-names = "du.0", "du.1", "du.2", "dclkin.0", "dclkin.1";
 
ports {
port@0 {
@@ -327,12 +325,26 @@
remote-endpoint = <_in>;
};
};
+   };
+};
+
+ {
+   status = "okay";
+
+   ports {
port@1 {
endpoint {
remote-endpoint = <_in>;
};
};
-   port@2 {
+   };
+};
+
+ {
+   status = "okay";
+
+   ports {
+   port@1 {
lvds_connector: endpoint {
};
};
@@ -688,7 +700,7 @@
port@0 {
reg = <0>;
adv7511_in: endpoint {
-   remote-endpoint = <_out_lvds0>;
+   remote-endpoint = <_out>;
};
};
 
diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index ed9a68538a55..e688dd831e4e 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -1068,17 +1068,13 @@
 
du: display@feb0 {
compatible = "renesas,du-r8a7790";
-   reg = <0 0xfeb0 0 0x7>,
- <0 0xfeb9 0 0x1c>,
- <0 0xfeb94000 0 0x1c>;
-   reg-names = "du", "lvds.0", "lvds.1";
+   reg = <0 0xfeb0 0 0x7>;
interrupts = ,
 ,
 ;
clocks = < CPG_MOD 724>, < CPG_MOD 723>,
-< CPG_MOD 722>, < CPG_MOD 726>,
-< CPG_MOD 725>;
-   clock-names = "du.0", "du.1", "du.2", "lvds.0", "lvds.1";
+< CPG_MOD 722>;
+   clock-names = "du.0", "du.1", "du.2";
status = "disabled";
 
ports {
@@ -1093,11 +1089,65 @@
port@1 {
reg = <1>;
du_out_lvds0: endpoint {
+   remote-endpoint = <_in>;
};
};
port@2 {
reg = <2>;
du_out_lvds1: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
+   };
+   };
+
+   lvds0: lvds@feb9 {
+   compatible = "renesas,r8a7790-lvds";
+   reg = <0 0xfeb9 0 0x1c>;
+   clocks = < CPG_MOD 726>;
+   power-domains = < R8A7790_PD_ALWAYS_ON>;
+   resets = < 726>;
+   status = "disabled";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   lvds0_in: endpoint {
+   remote-endpoint = <_out_lvds0>;
+   };
+   };
+   port@1 {
+   reg = <1>;
+   lvds0_out: endpoint {
+   };
+   };
+   };
+   };
+
+   lvds1: lvds@feb94000 {
+   compatible = "renesas,r8a7790-lvds";
+   reg = <0 0xfeb94000 0 0x1c>;
+   clocks = < CPG_MOD 725>;
+   power-domains = < R8A7790_PD_ALWAYS_ON>;
+   resets = < 725>;
+   status = "disabled";
+
+   ports {
+   #address-cells = <1>;
+

[PATCH v4 15/16] arm64: dts: renesas: r8a7795: Convert to new LVDS DT bindings

2018-02-20 Thread Laurent Pinchart
The internal LVDS encoder now has DT bindings separate from the DU. Port
the device tree over to the new model.

Signed-off-by: Laurent Pinchart 
---
Changes since v3:

- Added power-domains and resets properties to LVDS nodes

Changes since v2:

- Fixed LVDS compatible string

Changes since v1:

- Remove the DU reg-names property
---
 .../boot/dts/renesas/r8a7795-es1-salvator-x.dts|  3 +-
 arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts |  3 +-
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts |  3 +-
 .../arm64/boot/dts/renesas/r8a7795-salvator-xs.dts |  3 +-
 arch/arm64/boot/dts/renesas/r8a7795.dtsi   | 36 ++
 5 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts
index 4af9504489ee..c0faef1be32d 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts
@@ -43,12 +43,11 @@
 < CPG_MOD 723>,
 < CPG_MOD 722>,
 < CPG_MOD 721>,
-< CPG_MOD 727>,
 < 1>,
 <_clk>,
 <_clk>,
 < 2>;
-   clock-names = "du.0", "du.1", "du.2", "du.3", "lvds.0",
+   clock-names = "du.0", "du.1", "du.2", "du.3",
  "dclkin.0", "dclkin.1", "dclkin.2", "dclkin.3";
 };
 
diff --git a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
index 0afe777973de..f0d6528c05eb 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
@@ -44,11 +44,10 @@
 < CPG_MOD 723>,
 < CPG_MOD 722>,
 < CPG_MOD 721>,
-< CPG_MOD 727>,
 < 1>,
 < 3>,
 < 4>,
 < 2>;
-   clock-names = "du.0", "du.1", "du.2", "du.3", "lvds.0",
+   clock-names = "du.0", "du.1", "du.2", "du.3",
  "dclkin.0", "dclkin.1", "dclkin.2", "dclkin.3";
 };
diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
index cd9587ef90f4..eb2a9f3e4f28 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
@@ -43,12 +43,11 @@
 < CPG_MOD 723>,
 < CPG_MOD 722>,
 < CPG_MOD 721>,
-< CPG_MOD 727>,
 < 1>,
 <_clk>,
 <_clk>,
 < 2>;
-   clock-names = "du.0", "du.1", "du.2", "du.3", "lvds.0",
+   clock-names = "du.0", "du.1", "du.2", "du.3",
  "dclkin.0", "dclkin.1", "dclkin.2", "dclkin.3";
 };
 
diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts
index 15617e30356a..db3afa438543 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts
@@ -43,12 +43,11 @@
 < CPG_MOD 723>,
 < CPG_MOD 722>,
 < CPG_MOD 721>,
-< CPG_MOD 727>,
 < 1>,
 <_clk>,
 <_clk>,
 < 2>;
-   clock-names = "du.0", "du.1", "du.2", "du.3", "lvds.0",
+   clock-names = "du.0", "du.1", "du.2", "du.3",
  "dclkin.0", "dclkin.1", "dclkin.2", "dclkin.3";
 };
 
diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
index d12df6f2ff09..86ac1e4d3b5e 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -2273,9 +2273,7 @@
 
du: display@feb0 {
compatible = "renesas,du-r8a7795";
-   reg = <0 0xfeb0 0 0x8>,
- <0 0xfeb9 0 0x14>;
-   reg-names = "du", "lvds.0";
+   reg = <0 0xfeb0 0 0x8>;
interrupts = ,
 ,
 ,
@@ -2283,9 +2281,8 @@
clocks = < CPG_MOD 724>,
 < 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 721>;
+   clock-names = "du.0", "du.1", "du.2", "du.3";
vsps = < 0  0  0  1>;
status = "disabled";
 
@@ -2313,6 +2310,33 @@
port@3 {
reg = <3>;
  

[PATCH v4 04/16] of: changesets: Introduce changeset helper methods

2018-02-20 Thread Laurent Pinchart
From: Pantelis Antoniou 

Changesets are very powerful, but the lack of a helper API
makes using them cumbersome. Introduce a simple copy based
API that makes things considerably easier.

To wit, adding a property using the raw API.

struct property *prop;
prop = kzalloc(sizeof(*prop)), GFP_KERNEL);
prop->name = kstrdup("compatible");
prop->value = kstrdup("foo,bar");
prop->length = strlen(prop->value) + 1;
of_changeset_add_property(ocs, np, prop);

while using the helper API

of_changeset_add_property_string(ocs, np, "compatible",
"foo,bar");

Signed-off-by: Pantelis Antoniou 
[Fixed memory leak in __of_changeset_add_update_property_copy()]
Signed-off-by: Laurent Pinchart 
---
 drivers/of/dynamic.c | 222 ++
 include/linux/of.h   | 328 +++
 2 files changed, 550 insertions(+)

diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 4ffd04925fdf..85e722ed8631 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -910,3 +910,225 @@ int of_changeset_action(struct of_changeset *ocs, 
unsigned long action,
return 0;
 }
 EXPORT_SYMBOL_GPL(of_changeset_action);
+
+/* changeset helpers */
+
+/**
+ * of_changeset_create_device_node - Create an empty device node
+ *
+ * @ocs:   changeset pointer
+ * @parent:parent device node
+ * @fmt:   format string for the node's full_name
+ * @args:  argument list for the format string
+ *
+ * Create an empty device node, marking it as detached and allocated.
+ *
+ * Returns a device node on success, an error encoded pointer otherwise
+ */
+struct device_node *of_changeset_create_device_nodev(
+   struct of_changeset *ocs, struct device_node *parent,
+   const char *fmt, va_list vargs)
+{
+   struct device_node *node;
+
+   node = __of_node_dupv(NULL, fmt, vargs);
+   if (!node)
+   return ERR_PTR(-ENOMEM);
+
+   node->parent = parent;
+   return node;
+}
+EXPORT_SYMBOL_GPL(of_changeset_create_device_nodev);
+
+/**
+ * of_changeset_create_device_node - Create an empty device node
+ *
+ * @ocs:   changeset pointer
+ * @parent:parent device node
+ * @fmt:   Format string for the node's full_name
+ * ... Arguments
+ *
+ * Create an empty device node, marking it as detached and allocated.
+ *
+ * Returns a device node on success, an error encoded pointer otherwise
+ */
+__printf(3, 4) struct device_node *
+of_changeset_create_device_node(struct of_changeset *ocs,
+   struct device_node *parent, const char *fmt, ...)
+{
+   va_list vargs;
+   struct device_node *node;
+
+   va_start(vargs, fmt);
+   node = of_changeset_create_device_nodev(ocs, parent, fmt, vargs);
+   va_end(vargs);
+   return node;
+}
+EXPORT_SYMBOL_GPL(of_changeset_create_device_node);
+
+/**
+ * __of_changeset_add_property_copy - Create/update a new property copying
+ *name & value
+ *
+ * @ocs:   changeset pointer
+ * @np:device node pointer
+ * @name:  name of the property
+ * @value: pointer to the value data
+ * @length:length of the value in bytes
+ * @update:True on update operation
+ *
+ * Adds/updates a property to the changeset by making copies of the name & 
value
+ * entries. The @update parameter controls whether an add or update takes 
place.
+ *
+ * Returns zero on success, a negative error value otherwise.
+ */
+int __of_changeset_add_update_property_copy(struct of_changeset *ocs,
+   struct device_node *np, const char *name, const void *value,
+   int length, bool update)
+{
+   struct property *prop;
+   int ret = -ENOMEM;
+
+   prop = kzalloc(sizeof(*prop), GFP_KERNEL);
+   if (!prop)
+   return -ENOMEM;
+
+   prop->name = kstrdup(name, GFP_KERNEL);
+   if (!prop->name)
+   goto out_err;
+
+   /*
+* NOTE: There is no check for zero length value.
+* In case of a boolean property, this will allocate a value
+* of zero bytes. We do this to work around the use
+* of of_get_property() calls on boolean values.
+*/
+   prop->value = kmemdup(value, length, GFP_KERNEL);
+   if (!prop->value)
+   goto out_err;
+
+   of_property_set_flag(prop, OF_DYNAMIC);
+
+   prop->length = length;
+
+   if (!update)
+   ret = of_changeset_add_property(ocs, np, prop);
+   else
+   ret = of_changeset_update_property(ocs, np, prop);
+
+   if (!ret)
+   return 0;
+
+out_err:
+   kfree(prop->value);
+   kfree(prop->name);
+   kfree(prop);
+   return ret;
+}
+EXPORT_SYMBOL_GPL(__of_changeset_add_update_property_copy);
+
+/**
+ * of_changeset_add_property_stringf 

[PATCH v4 08/16] drm: rcar-du: Fix legacy DT to create LVDS encoder nodes

2018-02-20 Thread Laurent Pinchart
The internal LVDS encoders now have their own DT bindings. Before
switching the driver infrastructure to those new bindings, implement
backward-compatibility through live DT patching.

Patching is disabled and will be enabled along with support for the new
DT bindings in the DU driver.

Signed-off-by: Laurent Pinchart 
---
Changes since v3:

- Use the OF changeset API
- Use of_graph_get_endpoint_by_regs()
- Replace hardcoded constants by sizeof()

Changes since v2:

- Update the SPDX headers to use C-style comments in header files
- Removed the manually created __local_fixups__ node
- Perform manual fixups on live DT instead of overlay

Changes since v1:

- Select OF_FLATTREE
- Compile LVDS DT bindings patch code when DRM_RCAR_LVDS is selected
- Update the SPDX headers to use GPL-2.0 instead of GPL-2.0-only
- Turn __dtb_rcar_du_of_lvds_(begin|end) from u8 to char
- Pass void begin and end pointers to rcar_du_of_get_overlay()
- Use of_get_parent() instead of accessing the parent pointer directly
- Find the LVDS endpoints nodes based on the LVDS node instead of the
  root of the overlay
- Update to the -lvds compatible string format
---
 drivers/gpu/drm/rcar-du/Kconfig|   2 +
 drivers/gpu/drm/rcar-du/Makefile   |   7 +-
 drivers/gpu/drm/rcar-du/rcar_du_of.c   | 307 +
 drivers/gpu/drm/rcar-du/rcar_du_of.h   |  20 ++
 .../gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dts|  81 ++
 .../gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dts|  55 
 .../gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dts|  55 
 .../gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dts|  55 
 .../gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dts|  55 
 9 files changed, 636 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/rcar-du/rcar_du_of.c
 create mode 100644 drivers/gpu/drm/rcar-du/rcar_du_of.h
 create mode 100644 drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dts
 create mode 100644 drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dts
 create mode 100644 drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dts
 create mode 100644 drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dts
 create mode 100644 drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dts

diff --git a/drivers/gpu/drm/rcar-du/Kconfig b/drivers/gpu/drm/rcar-du/Kconfig
index 5d0b4b7119af..3f83352a7313 100644
--- a/drivers/gpu/drm/rcar-du/Kconfig
+++ b/drivers/gpu/drm/rcar-du/Kconfig
@@ -22,6 +22,8 @@ config DRM_RCAR_LVDS
bool "R-Car DU LVDS Encoder Support"
depends on DRM_RCAR_DU
select DRM_PANEL
+   select OF_FLATTREE
+   select OF_OVERLAY
help
  Enable support for the R-Car Display Unit embedded LVDS encoders.
 
diff --git a/drivers/gpu/drm/rcar-du/Makefile b/drivers/gpu/drm/rcar-du/Makefile
index 0cf5c11030e8..86b337b4be5d 100644
--- a/drivers/gpu/drm/rcar-du/Makefile
+++ b/drivers/gpu/drm/rcar-du/Makefile
@@ -8,7 +8,12 @@ rcar-du-drm-y := rcar_du_crtc.o \
 rcar_du_plane.o
 
 rcar-du-drm-$(CONFIG_DRM_RCAR_LVDS)+= rcar_du_lvdsenc.o
-
+rcar-du-drm-$(CONFIG_DRM_RCAR_LVDS)+= rcar_du_of.o \
+  rcar_du_of_lvds_r8a7790.dtb.o \
+  rcar_du_of_lvds_r8a7791.dtb.o \
+  rcar_du_of_lvds_r8a7793.dtb.o \
+  rcar_du_of_lvds_r8a7795.dtb.o \
+  rcar_du_of_lvds_r8a7796.dtb.o
 rcar-du-drm-$(CONFIG_DRM_RCAR_VSP) += rcar_du_vsp.o
 
 obj-$(CONFIG_DRM_RCAR_DU)  += rcar-du-drm.o
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_of.c 
b/drivers/gpu/drm/rcar-du/rcar_du_of.c
new file mode 100644
index ..12fae8814309
--- /dev/null
+++ b/drivers/gpu/drm/rcar-du/rcar_du_of.c
@@ -0,0 +1,307 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * rcar_du_of.c - Legacy DT bindings compatibility
+ *
+ * Copyright (C) 2018 Laurent Pinchart 
+ *
+ * Based on work from Jyri Sarha 
+ * Copyright (C) 2015 Texas Instruments
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "rcar_du_crtc.h"
+#include "rcar_du_drv.h"
+
+/* 
-
+ * Generic Overlay Handling
+ */
+
+struct rcar_du_of_overlay {
+   const char *compatible;
+   void *begin;
+   void *end;
+};
+
+#define RCAR_DU_OF_DTB(type, soc)  \
+   extern char __dtb_rcar_du_of_##type##_##soc##_begin[];  \
+   extern char __dtb_rcar_du_of_##type##_##soc##_end[]
+
+#define RCAR_DU_OF_OVERLAY(type, soc)  \
+   {   \
+   .compatible = "renesas,du-" #soc,   \
+   .begin = 

[PATCH v4 00/16] R-Car DU: Convert LVDS code to bridge driver

2018-02-20 Thread Laurent Pinchart
Hello,

This patch series addresses a design mistake that dates back from the initial
DU support. Support for the LVDS encoders, which are IP cores separate from
the DU, was bundled in the DU driver. Worse, both the DU and LVDS were
described through a single DT node.

To fix the, patches 01/16 and 02/16 define new DT bindings for the LVDS
encoders, and deprecate their description inside the DU bindings. To retain
backward compatibility with existing DT, patches 03/16 to 08/16 then patch the
device tree at runtime to convert the legacy bindings to the new ones.

With the DT side addressed, patch 09/16 converts the LVDS support code to a
separate bridge driver. Patches 11/16 to 16/16 then update all the device tree
sources to the new DU and LVDS encoders bindings.

I decided to go for live DT patching in patch 08/16 because implementing
support for both the legacy and new bindings in the driver would have been
very intrusive, and prevented further cleanups. This version relies more
heavily on overlays to avoid touching the internals of the OF core compared to
v2, even if manual fixes to the device tree are still needed.

Compared to v3, this series uses the OF changeset API to update properties
instead of accessing the internals of the property structure. This removes the
local implementation of functions to look up nodes by path and update
properties. In order to do this, I pulled in Pantelis' patch series titled
"[PATCH v2 0/5] of: dynamic: Changesets helpers & fixes" at Rob's request, and
rebased it while taking two small review comments into account.

Rob, I'd like this series to be merged in v4.17. As the changeset helpers are
now a dependency, I'd need you to merge them early (ideally on top of
v4.16-rc1) and provide a stable branch, or get your ack to merge them through
Dave's tree if they don't conflict with what you have and will queue for
v4.17.

This version also drops the small fix to the Porter board device tree that has
been queued for v4.17 already.

Compared to v2, the biggest change is in patch 03/16. Following Rob's and
Frank's reviews it was clear that modifying the unflattened DT structure of
the overlay before applying it wasn't popular. I have thus decided to use one
overlay source per SoC to move as much of the DT changes to the overlay as
possible, and only perform manual modifications (that are still needed as some
of the information is board-specific) on the system DT after applying the
overlay. As a result the overlay is parsed and applied without being modified.

Compared to v1, this series update the r8a7792 and r8a7794 device tree sources
and incorporate review feedback as described by the changelogs of individual
patches.


Laurent Pinchart (11):
  dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
  dt-bindings: display: renesas: Deprecate LVDS support in the DU
bindings
  drm: rcar-du: Fix legacy DT to create LVDS encoder nodes
  drm: rcar-du: Convert LVDS encoder code to bridge driver
  ARM: dts: r8a7790: Convert to new LVDS DT bindings
  ARM: dts: r8a7791: Convert to new LVDS DT bindings
  ARM: dts: r8a7792: Convert to new DU DT bindings
  ARM: dts: r8a7793: Convert to new LVDS DT bindings
  ARM: dts: r8a7794: Convert to new DU DT bindings
  arm64: dts: renesas: r8a7795: Convert to new LVDS DT bindings
  arm64: dts: renesas: r8a7796: Convert to new LVDS DT bindings

Pantelis Antoniou (5):
  of: dynamic: Add __of_node_dupv()
  of: changesets: Introduce changeset helper methods
  of: changeset: Add of_changeset_node_move method
  of: unittest: changeset helpers
  i2c: demux: Use changeset helpers for clarity

 .../bindings/display/bridge/renesas,lvds.txt   |  56 +++
 .../devicetree/bindings/display/renesas,du.txt |  31 +-
 MAINTAINERS|   1 +
 arch/arm/boot/dts/r8a7790-lager.dts|  22 +-
 arch/arm/boot/dts/r8a7790.dtsi |  64 ++-
 arch/arm/boot/dts/r8a7791-koelsch.dts  |  10 +-
 arch/arm/boot/dts/r8a7791-porter.dts   |  16 +-
 arch/arm/boot/dts/r8a7791.dtsi |  36 +-
 arch/arm/boot/dts/r8a7792.dtsi |   1 -
 arch/arm/boot/dts/r8a7793-gose.dts |  10 +-
 arch/arm/boot/dts/r8a7793.dtsi |  37 +-
 arch/arm/boot/dts/r8a7794.dtsi |   1 -
 .../boot/dts/renesas/r8a7795-es1-salvator-x.dts|   3 +-
 arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts |   3 +-
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts |   3 +-
 .../arm64/boot/dts/renesas/r8a7795-salvator-xs.dts |   3 +-
 arch/arm64/boot/dts/renesas/r8a7795.dtsi   |  36 +-
 arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts |   3 +-
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts |   3 +-
 arch/arm64/boot/dts/renesas/r8a7796.dtsi   |  36 +-
 drivers/gpu/drm/rcar-du/Kconfig|   6 +-
 drivers/gpu/drm/rcar-du/Makefile   |  10 +-
 

[PATCH v4 02/16] dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings

2018-02-20 Thread Laurent Pinchart
The internal LVDS encoders now have their own DT bindings, representing
them as part of the DU is deprecated.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Rob Herring 
---
Changes since v1:

- Remove the LVDS reg range from the example
- Remove the reg-names property
---
 .../devicetree/bindings/display/renesas,du.txt | 31 --
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/renesas,du.txt 
b/Documentation/devicetree/bindings/display/renesas,du.txt
index cd48aba3bc8c..e79cf9b0ad38 100644
--- a/Documentation/devicetree/bindings/display/renesas,du.txt
+++ b/Documentation/devicetree/bindings/display/renesas,du.txt
@@ -14,12 +14,7 @@ Required Properties:
 - "renesas,du-r8a7795" for R8A7795 (R-Car H3) compatible DU
 - "renesas,du-r8a7796" for R8A7796 (R-Car M3-W) compatible DU
 
-  - reg: A list of base address and length of each memory resource, one for
-each entry in the reg-names property.
-  - reg-names: Name of the memory resources. The DU requires one memory
-resource for the DU core (named "du") and one memory resource for each
-LVDS encoder (named "lvds.x" with "x" being the LVDS controller numerical
-index).
+  - reg: the memory-mapped I/O registers base address and length
 
   - interrupt-parent: phandle of the parent interrupt controller.
   - interrupts: Interrupt specifiers for the DU interrupts.
@@ -29,14 +24,13 @@ Required Properties:
   - clock-names: Name of the clocks. This property is model-dependent.
 - R8A7779 uses a single functional clock. The clock doesn't need to be
   named.
-- All other DU instances use one functional clock per channel and one
-  clock per LVDS encoder (if available). The functional clocks must be
-  named "du.x" with "x" being the channel numerical index. The LVDS clocks
-  must be named "lvds.x" with "x" being the LVDS encoder numerical index.
-- In addition to the functional and encoder clocks, all DU versions also
-  support externally supplied pixel clocks. Those clocks are optional.
-  When supplied they must be named "dclkin.x" with "x" being the input
-  clock numerical index.
+- All other DU instances use one functional clock per channel The
+  functional clocks must be named "du.x" with "x" being the channel
+  numerical index.
+- In addition to the functional clocks, all DU versions also support
+  externally supplied pixel clocks. Those clocks are optional. When
+  supplied they must be named "dclkin.x" with "x" being the input clock
+  numerical index.
 
   - vsps: A list of phandle and channel index tuples to the VSPs that handle
 the memory interfaces for the DU channels. The phandle identifies the VSP
@@ -69,9 +63,7 @@ Example: R8A7795 (R-Car H3) ES2.0 DU
 
du: display@feb0 {
compatible = "renesas,du-r8a7795";
-   reg = <0 0xfeb0 0 0x8>,
- <0 0xfeb9 0 0x14>;
-   reg-names = "du", "lvds.0";
+   reg = <0 0xfeb0 0 0x8>;
interrupts = ,
 ,
 ,
@@ -79,9 +71,8 @@ Example: R8A7795 (R-Car H3) ES2.0 DU
clocks = < CPG_MOD 724>,
 < 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 721>;
+   clock-names = "du.0", "du.1", "du.2", "du.3";
vsps = < 0>, < 0>, < 0>, < 1>;
 
ports {
-- 
Regards,

Laurent Pinchart

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


[PATCH v4 06/16] of: unittest: changeset helpers

2018-02-20 Thread Laurent Pinchart
From: Pantelis Antoniou 

Add a unitest specific for the new changeset helpers.

Signed-off-by: Pantelis Antoniou 
Signed-off-by: Laurent Pinchart 
---
 drivers/of/unittest.c | 54 +++
 1 file changed, 54 insertions(+)

diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 7a9abaae874d..1b21d2c549a8 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -609,6 +609,59 @@ static void __init of_unittest_changeset(void)
 #endif
 }
 
+static void __init of_unittest_changeset_helper(void)
+{
+#ifdef CONFIG_OF_DYNAMIC
+   struct device_node *n1, *n2, *n21, *parent, *np;
+   struct of_changeset chgset;
+
+   of_changeset_init();
+
+   parent = of_find_node_by_path("/testcase-data/changeset");
+
+   unittest(parent, "testcase setup failure\n");
+   n1 = of_changeset_create_device_node(,
+   parent, "/testcase-data/changeset/n1");
+   unittest(n1, "testcase setup failure\n");
+   n2 = of_changeset_create_device_node(,
+   parent, "/testcase-data/changeset/n2");
+   unittest(n2, "testcase setup failure\n");
+   n21 = of_changeset_create_device_node(, n2, "%s/%s",
+   "/testcase-data/changeset/n2", "n21");
+   unittest(n21, "testcase setup failure\n");
+
+   unittest(!of_changeset_add_property_string(, parent,
+   "prop-add", "foo"), "fail add prop\n");
+
+   unittest(!of_changeset_attach_node(, n1), "fail n1 attach\n");
+   unittest(!of_changeset_attach_node(, n2), "fail n2 attach\n");
+   unittest(!of_changeset_attach_node(, n21), "fail n21 attach\n");
+
+   unittest(!of_changeset_apply(), "apply failed\n");
+
+   /* Make sure node names are constructed correctly */
+   np = of_find_node_by_path("/testcase-data/changeset/n1");
+   unittest(np, "'%s' not added\n", n1->full_name);
+   of_node_put(np);
+
+   /* Make sure node names are constructed correctly */
+   np = of_find_node_by_path("/testcase-data/changeset/n2");
+   unittest(np, "'%s' not added\n", n2->full_name);
+   of_node_put(np);
+
+   np = of_find_node_by_path("/testcase-data/changeset/n2/n21");
+   unittest(np, "'%s' not added\n", n21->full_name);
+   of_node_put(np);
+
+   unittest(!of_changeset_revert(), "revert failed\n");
+
+   of_changeset_destroy();
+
+   of_node_put(parent);
+#endif
+}
+
+
 static void __init of_unittest_parse_interrupts(void)
 {
struct device_node *np;
@@ -2363,6 +2416,7 @@ static int __init of_unittest(void)
of_unittest_property_string();
of_unittest_property_copy();
of_unittest_changeset();
+   of_unittest_changeset_helper();
of_unittest_parse_interrupts();
of_unittest_parse_interrupts_extended();
of_unittest_match_node();
-- 
Regards,

Laurent Pinchart

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


[PATCH v4 01/16] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings

2018-02-20 Thread Laurent Pinchart
The Renesas R-Car Gen2 and Gen3 SoCs have internal LVDS encoders. Add
corresponding device tree bindings.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Rob Herring 
---
Changes since v1:

- Move the SoC name before the IP name in compatible strings
- Rename parallel input to parallel RGB input
- Fixed "renesas,r8a7743-lvds" description
- Document the resets property
- Fixed typo
---
 .../bindings/display/bridge/renesas,lvds.txt   | 56 ++
 MAINTAINERS|  1 +
 2 files changed, 57 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt

diff --git a/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt 
b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
new file mode 100644
index ..2b19ce51ec07
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
@@ -0,0 +1,56 @@
+Renesas R-Car LVDS Encoder
+==
+
+These DT bindings describe the LVDS encoder embedded in the Renesas R-Car
+Gen2, R-Car Gen3 and RZ/G SoCs.
+
+Required properties:
+
+- compatible : Shall contain one of
+  - "renesas,r8a7743-lvds" for R8A7743 (RZ/G1M) compatible LVDS encoders
+  - "renesas,r8a7790-lvds" for R8A7790 (R-Car H2) compatible LVDS encoders
+  - "renesas,r8a7791-lvds" for R8A7791 (R-Car M2-W) compatible LVDS encoders
+  - "renesas,r8a7793-lvds" for R8A7791 (R-Car M2-N) compatible LVDS encoders
+  - "renesas,r8a7795-lvds" for R8A7795 (R-Car H3) compatible LVDS encoders
+  - "renesas,r8a7796-lvds" for R8A7796 (R-Car M3-W) compatible LVDS encoders
+
+- reg: Base address and length for the memory-mapped registers
+- clocks: A phandle + clock-specifier pair for the functional clock
+- resets: A phandle + reset specifier for the module reset
+
+Required nodes:
+
+The LVDS encoder has two video ports. Their connections are modelled using the
+OF graph bindings specified in Documentation/devicetree/bindings/graph.txt.
+
+- Video port 0 corresponds to the parallel RGB input
+- Video port 1 corresponds to the LVDS output
+
+Each port shall have a single endpoint.
+
+
+Example:
+
+   lvds0: lvds@feb9 {
+   compatible = "renesas,r8a7790-lvds";
+   reg = <0 0xfeb9 0 0x1c>;
+   clocks = < CPG_MOD 726>;
+   resets = < 726>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   lvds0_in: endpoint {
+   remote-endpoint = <_out_lvds0>;
+   };
+   };
+   port@1 {
+   reg = <1>;
+   lvds0_out: endpoint {
+   };
+   };
+   };
+   };
diff --git a/MAINTAINERS b/MAINTAINERS
index 2afba909724c..13c8ec11135a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4744,6 +4744,7 @@ F:drivers/gpu/drm/rcar-du/
 F: drivers/gpu/drm/shmobile/
 F: include/linux/platform_data/shmob_drm.h
 F: Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.txt
+F: Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
 F: Documentation/devicetree/bindings/display/renesas,du.txt
 
 DRM DRIVERS FOR ROCKCHIP
-- 
Regards,

Laurent Pinchart

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


[PATCH RFC] drm/bridge: panel: Add device_link between panel and master drm device

2018-02-20 Thread Jyri Sarha
Currently the master drm driver is not protected against the attached
panel driver from becoming unavailable. Adding a device_link with
DL_FLAG_AUTOREMOVE flag unbinds the master drm device (the consumer)
when the panel device (the supplier) becomes unavailable.

Signed-off-by: Jyri Sarha 
Suggested-by: Thierry Reding 
cc: e...@anholt.net
cc: laurent.pinch...@ideasonboard.com
---
It still annoys me that the unbound master drm device does not probe
again if the panel device becomes available again. If there is no
remedy to this, may be we should consider applying the module get/put
patch[1] too.

Hmmm... there was an obvious reasons not to add module gets and puts
to drm_panel_attach/detach(), but is there any such reasons for not to
add and remove the device link there?

The bridge side look more complicated as there is no public
drm_bridge_detach(), and I am not sure if the drm_bridge_remove() should
remove the device link. I guess it should, if the link is there.

[1] https://lists.freedesktop.org/archives/dri-devel/2018-February/166350.html

 drivers/gpu/drm/bridge/panel.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
index 6d99d4a..d71ddd8 100644
--- a/drivers/gpu/drm/bridge/panel.c
+++ b/drivers/gpu/drm/bridge/panel.c
@@ -22,6 +22,7 @@ struct panel_bridge {
struct drm_connector connector;
struct drm_panel *panel;
u32 connector_type;
+   struct device_link *link;   /* link to master drm dev */
 };
 
 static inline struct panel_bridge *
@@ -57,6 +58,22 @@ static const struct drm_connector_funcs 
panel_bridge_connector_funcs = {
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
+static int panel_bridge_link_to_master(struct panel_bridge *panel_bridge)
+{
+   struct device *mdev = panel_bridge->bridge.dev->dev;
+   struct device *pdev = panel_bridge->panel->dev;
+   u32 flags = DL_FLAG_AUTOREMOVE;
+
+   panel_bridge->link = device_link_add(mdev, pdev, flags);
+   if (!panel_bridge->link) {
+   dev_err(pdev, "failed to link panel %s to %s\n",
+   dev_name(pdev), dev_name(mdev));
+   return -EINVAL;
+   }
+
+   return 0;
+}
+
 static int panel_bridge_attach(struct drm_bridge *bridge)
 {
struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
@@ -82,6 +99,9 @@ static int panel_bridge_attach(struct drm_bridge *bridge)
drm_mode_connector_attach_encoder(_bridge->connector,
  bridge->encoder);
 
+   if (panel_bridge_link_to_master(panel_bridge))
+   return -EINVAL;
+
ret = drm_panel_attach(panel_bridge->panel, _bridge->connector);
if (ret < 0)
return ret;
@@ -94,6 +114,8 @@ static void panel_bridge_detach(struct drm_bridge *bridge)
struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
 
drm_panel_detach(panel_bridge->panel);
+
+   device_link_del(panel_bridge->link);
 }
 
 static void panel_bridge_pre_enable(struct drm_bridge *bridge)
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. 
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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


Re: [PATCH 5/7] vga_switcheroo: Use device link for HDA controller

2018-02-20 Thread Bjorn Helgaas
On Sun, Feb 18, 2018 at 09:38:32AM +0100, Lukas Wunner wrote:
> Back in 2013, runtime PM for GPUs with integrated HDA controller was
> introduced with commits 0d69704ae348 ("gpu/vga_switcheroo: add driver
> control power feature. (v3)") and 246efa4a072f ("snd/hda: add runtime
> suspend/resume on optimus support (v4)").
> 
> Briefly, the idea was that the HDA controller is forced on and off in
> unison with the GPU.
> 
> The original code is mostly still in place even though it was never a
> 100% perfect solution:  E.g. on access to the HDA controller, the GPU
> is powered up via vga_switcheroo_runtime_resume_hdmi_audio() but there
> are no provisions to keep it resumed until access to the HDA controller
> has ceased:  The GPU autosuspends after 5 seconds, rendering the HDA
> controller inaccessible.
> 
> Additionally, a kludge is required when hda_intel.c probes:  It has to
> check whether the GPU is powered down (check_hdmi_disabled()) and defer
> probing if so.
> 
> However in the meantime (in v4.10) the driver core has gained a feature
> called device links which promises to solve such issues in a clean way:
> It allows us to declare a dependency from the HDA controller (consumer)
> to the GPU (supplier).  The PM core then automagically ensures that the
> GPU is runtime resumed as long as the HDA controller's ->probe hook is
> executed and whenever the HDA controller is accessed.
> 
> By default, the HDA controller has a dependency on its parent, a PCIe
> Root Port.  Adding a device link creates another dependency on its
> sibling:
> 
> PCIe Root Port
>  ^  ^
>  |  |
>  |  |
> HDA  ===>  GPU
> 
> The device link is not only used for runtime PM, it also guarantees that
> on system sleep, the HDA controller suspends before the GPU and resumes
> after the GPU, and on system shutdown the HDA controller's ->shutdown
> hook is executed before the one of the GPU.  It is a complete solution.
> 
> Using this functionality is as simple as calling device_link_add(),
> which results in a dmesg entry like this:
> 
> pci :01:00.1: Linked as a consumer to :01:00.0
> 
> The code for the GPU-governed audio power management can thus be removed
> (except where it's still needed for legacy manual power control).
> 
> The device link is added in a PCI quirk rather than in hda_intel.c.
> It is therefore legal for the GPU to runtime suspend to D3cold even if
> the HDA controller is not bound to a driver or if CONFIG_SND_HDA_INTEL
> is not enabled, for accesses to the HDA controller will cause the GPU to
> wake up regardless if they're occurring outside of hda_intel.c (think
> config space readout via sysfs).

I guess this GPU wakeup happens *if* the path accessing the HDA
controller calls pm_runtime_get_sync() or similar, right?  We do have
that in the sysfs config accessors via pci_config_pm_runtime_get(),
but not in the sysfs mmap paths.  I think that's a latent PCI core
defect independent of this series.

We also don't have that in PCI core config accessors.  That maybe
doesn't matter because the core probably shouldn't be touching devices
after enumeration (although there might be holes there for things like
ASPM where a sysfs file can cause reconfiguration of several devices).

> Contrary to the previous implementation, the HDA controller's power
> state is now self-governed, rather than GPU-governed, whereas the GPU's
> power state is no longer fully self-governed.  (The HDA controller needs
> to runtime suspend before the GPU can.)
> 
> It is thus crucial that runtime PM is always activated on the HDA
> controller even if CONFIG_SND_HDA_POWER_SAVE_DEFAULT is set to 0 (which
> is the default), lest the GPU stays awake.  This is achieved by setting
> the auto_runtime_pm flag on every codec and the AZX_DCAPS_PM_RUNTIME
> flag on the HDA controller.
> 
> A side effect is that power consumption might be reduced if the GPU is
> in use but the HDA controller is not, because the HDA controller is now
> allowed to go to D3hot.  Before, it was forced to stay in D0 as long as
> the GPU was in use.  (There is no reduction in power consumption on my
> Nvidia GK107, but there might be on other chips.)
> 
> The code paths for legacy manual power control are adjusted such that
> runtime PM is disabled during power off, thereby preventing the PM core
> from resuming the HDA controller.
> 
> Note that the device link is not only added on vga_switcheroo capable
> systems, but for *any* GPU with integrated HDA controller.  The idea is
> that the HDA controller streams audio via connectors located on the GPU,
> so the GPU needs to be on for the HDA controller to do anything useful.
> 
> This commit implicitly fixes an unbalanced runtime PM ref upon unbind of
> hda_intel.c:  On ->probe, a runtime PM ref was previously released under
> the condition 

[Bug 105179] DiRT Rally: wrong frames appear during camera transition

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105179

Gregor Münch  changed:

   What|Removed |Added

 QA Contact|mesa-dev@lists.freedesktop. |dri-devel@lists.freedesktop
   |org |.org
   Assignee|mesa-dev@lists.freedesktop. |dri-devel@lists.freedesktop
   |org |.org
  Component|Mesa core   |Drivers/Gallium/radeonsi

--- Comment #2 from Gregor Münch  ---
(In reply to Ilia Mirkin from comment #1)
> In any case, those ills are in no way related to radeonsi or any other
> driver.

Thx for your explanation! Sorry for the noise, reassigning to radeon than.

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


Re: [PATCH 1/3] drm/edid: quirk Oculus Rift headsets as non-desktop

2018-02-20 Thread Keith Packard
Philipp Zabel  writes:

> Should these be backported to older kernels as well, to avoid burning
> the fbdev console into VR headset OLED displays?

I don't think so; it's a bunch of code to backport, and the matching
code for the X desktop hasn't even landed upstream yet. Wayland doesn't
even have a proposed specification for this stuff yet.

-- 
-keith


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


[Bug 105177] amdgpu wrong colors with rx460 connected via hdmi

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105177

--- Comment #5 from Alex Deucher  ---
Also please attach your xorg log.

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


[Bug 105177] amdgpu wrong colors with rx460 connected via hdmi

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105177

--- Comment #4 from Alex Deucher  ---
Can you attach a picture?

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


[Bug 105083] Random blinking display

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105083

--- Comment #9 from Öyvind Saether  ---
I get random blue color screen flickering perhaps once every few minutes on
each monitor with redshift and a RX 580 and a 3x4k 60Hz setup with kernel
4.15.3 and amdgpu.dc=1. My initial response was that amdgpu.dc is broken so I
reverted back to 4.14.x and used that until I found this bug and realized it's
the redshift that's badly handled / problematic with the amdgpu.dc code.

This isn't really a redshift bug, just the way it behaves with this new code
since I've used redshift since forever on numerous configurations and this is a
new problem.

The random blue flickering with redshift seems to randomly appear on one of the
monitors, not all or two at once. All do not blink the same time. I can't
really see any pattern either. Every few minutes one of the monitors will blink
blue. Sometimes none of them blink blue for a long time.

Everything seems fine so far without redshift apart from the blue color
spectrum now violently smashing my eyes. My eyes, my eyes! I'll test if
redshift is OK with transition = 0 later, it could be a workaround if it is the
gradual adjustment of gamma/color that causes the flickering.

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


Re: [PATCH 1/7] PCI: Restore BARs on runtime resume despite being unbound

2018-02-20 Thread Bjorn Helgaas
On Sun, Feb 18, 2018 at 09:38:32AM +0100, Lukas Wunner wrote:
> PCI devices not bound to a driver are supposed to stay in D0 during
> runtime suspend.

Doesn't "runtime suspend" mean an individual device is suspended while
the rest of the system remains active?

If so, maybe it would be more direct to say "PCI devices not bound to
a driver cannot be runtime suspended"?

(It's a separate question not relevant to this patch, but I'm not
convinced that "PCI devices without a driver cannot be suspended"
should be accepted as a rule.  If it is a rule, we should be able to
deduce it from the specs.)

> But they may have a parent which is bound and can be
> transitioned to D3cold at runtime.  Once the parent goes to D3cold, the
> unbound child may go to D3cold as well.  When the child comes out of
> D3cold, its BARs are uninitialized and thus inaccessible when a driver
> tries to probe.
> 
> One example are recent hybrid graphics laptops which cut power to the
> discrete GPU when the root port above it goes to ACPI power state D3.
> Users may provoke this by unbinding the GPU driver and allowing runtime
> PM on the GPU via sysfs:  The PM core will then treat the GPU as
> "suspended", which in turn allows the root port to runtime suspend,
> causing the power resources listed in its _PR3 object to be powered off.
> The GPU's BARs will be uninitialized when a driver later probes it.
> 
> Another example are hybrid graphics laptops where the GPU itself (rather
> than the root port) is capable of runtime suspending to D3cold.  If the
> GPU's integrated HDA controller is not bound and the GPU's driver
> decides to runtime suspend to D3cold, the HDA controller's BARs will be
> uninitialized when a driver later probes it.
> 
> Fix by restoring the BARs on runtime resume if the device is not bound.
> This is sufficient to fix the above-mentioned use cases.  Other use
> cases might require a full-blown pci_save_state() / pci_restore_state()
> or execution of fixups.  We can add that once use cases materialize,
> let's not inflate the code unnecessarily.

Why would we not do a full-blown restore?  With this patch, I think
some configuration done during enumeration, e.g., ASPM and MPS, will
be lost.  "lspci -vv" of the HDA before and after the suspend may show
different things, which seems counter-intuitive.

I wouldn't think of a full-blown restore as "inflating the code"; I
would think of it as "having fewer special cases", i.e., we always use
the same restore path instead of having the main one plus a special
one for unbound devices.

> Cc: Bjorn Helgaas 
> Cc: Rafael J. Wysocki 
> Signed-off-by: Lukas Wunner 
> ---
>  drivers/pci/pci-driver.c | 8 ++--
>  drivers/pci/pci.c| 2 +-
>  drivers/pci/pci.h| 1 +
>  3 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
> index 3bed6beda051..51b11cbd48f6 100644
> --- a/drivers/pci/pci-driver.c
> +++ b/drivers/pci/pci-driver.c
> @@ -1277,10 +1277,14 @@ static int pci_pm_runtime_resume(struct device *dev)
>  
>   /*
>* If pci_dev->driver is not set (unbound), the device should
> -  * always remain in D0 regardless of the runtime PM status
> +  * always remain in D0 regardless of the runtime PM status.
> +  * But if its parent can go to D3cold, this device may have
> +  * been in D3cold as well and require restoration of its BARs.
>*/
> - if (!pci_dev->driver)
> + if (!pci_dev->driver) {
> + pci_restore_bars(pci_dev);

If we do decide not to do a full-blown restore, how do we decide
whether to use pci_restore_bars() or pci_restore_config_space()?

I'm not sure why we have both.  The pci_restore_bars() path looks a
little smarter in that it is more careful when updating 64-bit BARs
that can't be updated atomically.

>   return 0;
> + }
>  
>   if (!pm || !pm->runtime_resume)
>   return -ENOSYS;
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index f6a4dd10d9b0..f694650235f2 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -563,7 +563,7 @@ int pci_wait_for_pending(struct pci_dev *dev, int pos, 
> u16 mask)
>   * Restore the BAR values for a given device, so as to make it
>   * accessible by its driver.
>   */
> -static void pci_restore_bars(struct pci_dev *dev)
> +void pci_restore_bars(struct pci_dev *dev)
>  {
>   int i;
>  
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index fcd81911b127..29dc15bbe3bf 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -83,6 +83,7 @@ void pci_allocate_cap_save_buffers(struct pci_dev *dev);
>  void pci_free_cap_save_buffers(struct pci_dev *dev);
>  bool pci_bridge_d3_possible(struct pci_dev *dev);
>  void pci_bridge_d3_update(struct pci_dev *dev);
> +void pci_restore_bars(struct pci_dev *dev);
>  
>  static inline void pci_wakeup_event(struct pci_dev *dev)
>  {
> -- 
> 

[Bug 105177] amdgpu wrong colors with rx460 connected via hdmi

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105177

--- Comment #2 from Reimar Imhof  ---
Created attachment 137479
  --> https://bugs.freedesktop.org/attachment.cgi?id=137479=edit
dmesg kernel 4.15.4; connected via hdmi; amdgpu.dc=1

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


[Bug 105177] amdgpu wrong colors with rx460 connected via hdmi

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105177

--- Comment #3 from Reimar Imhof  ---
Created attachment 137480
  --> https://bugs.freedesktop.org/attachment.cgi?id=137480=edit
dmesg kernel 4.15.4; connected via dvi; amdgpu.dc=1

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


[Bug 105177] amdgpu wrong colors with rx460 connected via hdmi

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105177

--- Comment #1 from Reimar Imhof  ---
Created attachment 137478
  --> https://bugs.freedesktop.org/attachment.cgi?id=137478=edit
dmesg kernel 4.15.4; connected via hdmi; amdgpu.dc=0

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


[Bug 105021] suspend / rx550 / extremely slow after 2nd thaw

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105021

--- Comment #25 from Alex Deucher  ---
Please attach your full dmesg output from boot.

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


[Bug 105177] amdgpu wrong colors with rx460 connected via hdmi

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105177

Bug ID: 105177
   Summary: amdgpu wrong colors with rx460 connected via hdmi
   Product: DRI
   Version: XOrg git
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: DRM/AMDgpu
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: tuxu...@quantentunnel.de

When monitor is connected via hdmi I get wrong colors. This appears during boot
before the gui (x.org) gets started (frame buffer boot animation). Wrong colors
(sort of violet instead of black) also appear on frame buffer text console and
with x.org gui.
This bug appears with and without "amdgpu.dc=1" kernel parameter.
While running x.org I've turned the monitor off and on again. This gives
correct colors but the screen resolution goes to 1024x768. So it's no work
around.

The bug does not occur if the monitor is connected via dvi.

System:
Kernel 4.15.4
openSuse 42.3

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


[Bug 105042] [LLVM Regression] Shadow of Mordor stucks at intro video

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105042

Gregor Münch  changed:

   What|Removed |Added

 CC||m.c.sear...@gmail.com
 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Gregor Münch  ---
Probably fixed by:
https://github.com/llvm-mirror/llvm/commit/04c7451aa8dfdee17307231fecd29b6d5e989e4b

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


[Bug 104285] Euro Truck Simulator 2 and American Truck Simulator artifacts (Mesa 17.3, AMD R9 280X)

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=104285

--- Comment #7 from Gregor Münch  ---
This might be a dup of:
https://bugs.freedesktop.org/show_bug.cgi?id=104190

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


Re: linux-next: manual merge of the drm tree with Linus' tree

2018-02-20 Thread Rodrigo Vivi
On Mon, Feb 19, 2018 at 10:10:50AM +1100, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the drm tree got a conflict in:
> 
>   drivers/gpu/drm/i915/intel_breadcrumbs.c
> 
> between commit:
> 
>   117172c8f9d4 ("drm/i915/breadcrumbs: Ignore unsubmitted signalers")
> 
> from Linus' tree and commit:
> 
>   b7a3f33bd5ab ("drm/i915/breadcrumbs: Drop request reference for the 
> signaler thread")
> 
> from the drm tree.
> 
> These are basically identical for the conflicting section except that
> the former added a line:
> 
>   GEM_BUG_ON(!i915_gem_request_completed(request));
> 
> which I left in.
> 
> I fixed it up (see above) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.

For this and for the PMU one, I'm really sorry. I believe I should had
mentioned this to Dave when sending pull request for drm-intel-fixes.

I didn't mentioned because for what fixes is concerned this shouldn't
be a problem, but I totally forgot about linux-next. Please accept my
apologies.

Do you use any rerere on linux-next? I wonder if drm-rerere could be used
somehow here to simplify this process of propagating conflicts resolutions
like this.

Thanks,
Rodrigo.

> 
> -- 
> Cheers,
> Stephen Rothwell



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

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


[Bug 105021] suspend / rx550 / extremely slow after 2nd thaw

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105021

--- Comment #24 from arne_woer...@yahoo.com ---
with
kernel 4.15.4-2-MANJARO
and
mesa 17.3.5-0
and
linux-firmware 20180119.2a713be-2
the bug is still there...
-arne

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


Re: [RFC 1/3] drm/msm/mdp5: Add global state as a private atomic object

2018-02-20 Thread Rob Clark
On Thu, Dec 21, 2017 at 4:56 AM, Daniel Vetter  wrote:
> On Thu, Dec 21, 2017 at 11:44:23AM +0530, Archit Taneja wrote:
>> Global shared resources (hwpipes, hwmixers and SMP) for MDP5 are
>> implemented as a part of atomic state by subclassing drm_atomic_state.
>>
>> The preferred approach is to use the drm_private_obj infrastructure
>> available in the atomic core.
>>
>> mdp5_global_state is introduced as a drm atomic private object. The two
>> funcs mdp5_get_global_state() and mdp5_get_existing_global_state() are
>> the two variants that will be used to access mdp5_global_state.
>>
>> This will replace the existing mdp5_state struct (which subclasses
>> drm_atomic_state) and the funcs around it. These will be removed later
>> once we mdp5_global_state is put to use everywhere.
>>
>> Signed-off-by: Archit Taneja 
>> ---
>>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 86 
>> +
>>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h | 27 +++
>>  2 files changed, 113 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c 
>> b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
>> index f7c0698fec40..dfc4d81124d5 100644
>> --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
>> +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
>> @@ -106,6 +106,86 @@ static void mdp5_swap_state(struct msm_kms *kms, struct 
>> drm_atomic_state *state)
>>   swap(to_kms_state(state)->state, mdp5_kms->state);
>>  }
>>
>> +/* Global/shared object state funcs */
>> +
>> +/*
>> + * This is a helper that returns the private state currently in operation.
>> + * Note that this would return the "old_state" if called in the atomic check
>> + * path, and the "new_state" after the atomic swap has been done.
>> + */
>> +struct mdp5_global_state *
>> +mdp5_get_existing_global_state(struct mdp5_kms *mdp5_kms)
>> +{
>> + return to_mdp5_global_state(mdp5_kms->glob_base.state);
>
> This doesn't match the existing state stuff for everything else. Here you
> look at the global state, but not at the one hanging off drm_atomic_state.
>
> Maybe we should add a drm_atomic_get_existing_private_obj_state function
> to make this easier?
>
> I'm also not 100% sure on what semantics you want precisely.
>

This is used for read-only access to current state, a couple places in
atomic update post-swap (where
drm_atomic_get_existing_private_obj_state() would work, but also for
things like debugfs, where it wouldn't)..

Probably should const'ify the return value to make it clear that this
is read-only.

>
>> +}
>> +
>> +/*
>> + * This acquires the modeset lock set aside for global state, creates
>> + * a new duplicated private object state.
>> + */
>> +struct mdp5_global_state *mdp5_get_global_state(struct drm_atomic_state *s)
>> +{
>> + struct msm_drm_private *priv = s->dev->dev_private;
>> + struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(priv->kms));
>> + struct drm_private_state *priv_state;
>> + int ret;
>> +
>> + ret = drm_modeset_lock(_kms->glob_state_lock, s->acquire_ctx);
>> + if (ret)
>> + return ERR_PTR(ret);
>> +
>> + priv_state = drm_atomic_get_private_obj_state(s, _kms->glob_base);
>> + if (IS_ERR(priv_state))
>> + return ERR_CAST(priv_state);
>> +
>> + return to_mdp5_global_state(priv_state);
>> +}
>> +
>> +static struct drm_private_state *
>> +mdp5_global_duplicate_state(struct drm_private_obj *obj)
>> +{
>> + struct mdp5_global_state *state;
>> +
>> + state = kmemdup(obj->state, sizeof(*state), GFP_KERNEL);
>> + if (!state)
>> + return NULL;
>> +
>> + __drm_atomic_helper_private_obj_duplicate_state(obj, >base);
>> +
>> + return >base;
>> +}
>> +
>> +static void mdp5_global_destroy_state(struct drm_private_obj *obj,
>> +   struct drm_private_state *state)
>> +{
>> + struct mdp5_global_state *mdp5_state = to_mdp5_global_state(state);
>> +
>> + kfree(mdp5_state);
>> +}
>> +
>> +static const struct drm_private_state_funcs mdp5_global_state_funcs = {
>> + .atomic_duplicate_state = mdp5_global_duplicate_state,
>> + .atomic_destroy_state = mdp5_global_destroy_state,
>> +};
>> +
>> +static int mdp5_global_obj_init(struct mdp5_kms *mdp5_kms)
>> +{
>> + struct mdp5_global_state *state;
>> +
>> + state = kzalloc(sizeof(*state), GFP_KERNEL);
>> + if (!state)
>> + return -ENOMEM;
>> +
>> + drm_modeset_lock_init(_kms->glob_state_lock);
>
> I thought a bit the last few days about how to integrate modeset locking
> into driver private state objects. I think the simplest solution would be
> if we just add a drm_modeset_lock to drm_private_obj, and push the locking
> (both here and in the mst helper) into the core private obj code.

I like the idea of adding a modeset lock to private objs.. I've got a
WIP patch to do this.

BR,
-R

> Per-object locking might be a bit overkill (it's definitely overkill for
> mst), but it's 

[Bug 100919] [DC] "Out of range" on a display connected to a DVI-D output of RX460 card via DVI-D<=>HDMI-A cable

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=100919

--- Comment #13 from Harry Wentland  ---
Are you able to test amd-staging-drm-next
(https://cgit.freedesktop.org/~agd5f/linux/log/?h=amd-staging-drm-next)? The
issue should be fixed there and you wouldn't have to fiddle with patches.

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


Re: [PATCH] locking/ww_mutex: add ww_mutex_is_owned_by function v4

2018-02-20 Thread kbuild test robot
Hi Christian,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.16-rc2 next-20180220]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Christian-K-nig/locking-ww_mutex-add-ww_mutex_is_owned_by-function-v4/20180221-021317
config: microblaze-mmu_defconfig (attached as .config)
compiler: microblaze-linux-gcc (GCC) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=microblaze 

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

   In file included from kernel/locking/mutex.c:21:0:
   include/linux/ww_mutex.h: In function 'ww_mutex_is_owned_by':
   include/linux/ww_mutex.h:380:0: error: unterminated argument list invoking 
macro "likely"
#endif

   include/linux/ww_mutex.h:377:3: error: 'likely' undeclared (first use in 
this function)
  likely(READ_ONCE(lock->ctx) == NULL;
  ^~
   include/linux/ww_mutex.h:377:3: note: each undeclared identifier is reported 
only once for each function it appears in
   In file included from include/linux/thread_info.h:13:0,
from include/asm-generic/preempt.h:5,
from ./arch/microblaze/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:81,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
   include/linux/restart_block.h:11:1: error: expected ';' before 'struct'
struct timespec;
^~
   include/linux/restart_block.h:12:1: warning: ISO C90 forbids mixed 
declarations and code [-Wdeclaration-after-statement]
struct compat_timespec;
^~
   In file included from include/linux/thread_info.h:38:0,
from include/asm-generic/preempt.h:5,
from ./arch/microblaze/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:81,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
>> arch/microblaze/include/asm/thread_info.h:90:35: error: invalid storage 
>> class for function 'current_thread_info'
static inline struct thread_info *current_thread_info(void)
  ^~~
   In file included from include/asm-generic/preempt.h:5:0,
from ./arch/microblaze/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:81,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
   include/linux/thread_info.h:57:20: error: invalid storage class for function 
'set_ti_thread_flag'
static inline void set_ti_thread_flag(struct thread_info *ti, int flag)
   ^~
   include/linux/thread_info.h:62:20: error: invalid storage class for function 
'clear_ti_thread_flag'
static inline void clear_ti_thread_flag(struct thread_info *ti, int flag)
   ^~~~
   include/linux/thread_info.h:67:19: error: invalid storage class for function 
'test_and_set_ti_thread_flag'
static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int 
flag)
  ^~~
   include/linux/thread_info.h:72:19: error: invalid storage class for function 
'test_and_clear_ti_thread_flag'
static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int 
flag)
  ^
   include/linux/thread_info.h:77:19: error: invalid storage class for function 
'test_ti_thread_flag'
static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
  ^~~
   include/linux/thread_info.h:96:19: error: invalid storage class for function 
'arch_within_stack_frames'
static inline int arch_within_stack_frames(const void * const stack,
  ^~~~
   include/linux/thread_info.h:115:20: error: invalid storage class for 
function 'check_object_size'
static inline void check_object_size(const void *ptr, unsigned long n,
   ^
   include/linux/thread_info.h:125:20: error: invalid storage class for 
function 'copy_overflow'
static inline void copy_overflow(int size, unsigned long count)
   ^
   include/linux/thre

[PATCH v3 0/2] Parfait changes

2018-02-20 Thread Joe Moriarty
The following patch(s) are bugs found by the static compiler
'Parfait'.  Care was taken to make sure false positive results
were removed from this patchset.

Parfait Overview


https://labs.oracle.com/pls/apex/f?p=labs:49:P49_PROJECT_ID:13

v1:
Initial release

v2:
- Split original v1 patch into 4 separate patches per request
from Jani Nikula
- Fixed system hang during boot up on test machine.

v3:
- Made changes requested by Daniel Vetter.

Joe Moriarty (2):
  drm: NULL pointer dereference [null-pointer-deref] (CWE 476) problem
  drm: NULL pointer dereference [null-pointer-deref] (CWE 476) problem

 drivers/gpu/drm/drm_drv.c| 2 +-
 drivers/gpu/drm/drm_vblank.c | 9 +
 2 files changed, 10 insertions(+), 1 deletion(-)

-- 
2.15.0

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


[PATCH v3 2/2] drm: NULL pointer dereference [null-pointer-deref] (CWE 476) problem

2018-02-20 Thread Joe Moriarty
The Parfait (version 2.1.0) static code analysis tool found the
following NULL pointer dereference problem.

- drivers/gpu/drm/drm_drv.c
Any calls to drm_minor_get_slot() could result in the return of a NULL
pointer when an invalid DRM device type is encountered.  The
return of NULL was removed with BUG() from drm_minor_get_slot().

Signed-off-by: Joe Moriarty 
Reviewed-by: Steven Sistare 
---
 drivers/gpu/drm/drm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 9acc1e157813..a1b9338736e3 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -99,7 +99,7 @@ static struct drm_minor **drm_minor_get_slot(struct 
drm_device *dev,
case DRM_MINOR_CONTROL:
return >control;
default:
-   return NULL;
+   BUG();
}
 }
 
-- 
2.15.0

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


[PATCH v3 1/2] drm: NULL pointer dereference [null-pointer-deref] (CWE 476) problem

2018-02-20 Thread Joe Moriarty
The Parfait (version 2.1.0) static code analysis tool found the
following NULL pointer derefernce problem.

- drivers/gpu/drm/drm_vblank.c
Null pointer checks were added to return values from calls to
drm_crtc_from_index().  There is a possibility, however minute, that
crtc->index may not be found when trying to find the struct crtc
from it's assigned index given in drm_crtc_init_with_planes().
3 return checks for NULL where added with a call to
WARN_ON(!crtc).

Signed-off-by: Joe Moriarty 
Reviewed-by: Steven Sistare 
---
 drivers/gpu/drm/drm_vblank.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 32d9bcf5be7f..03b431eb47ae 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -120,6 +120,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, 
unsigned int pipe)
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
 
+   if (WARN_ON(!crtc))
+   return 0;
+
if (crtc->funcs->get_vblank_counter)
return crtc->funcs->get_vblank_counter(crtc);
}
@@ -318,6 +321,9 @@ static void __disable_vblank(struct drm_device *dev, 
unsigned int pipe)
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
 
+   if (WARN_ON(!crtc))
+   return;
+
if (crtc->funcs->disable_vblank) {
crtc->funcs->disable_vblank(crtc);
return;
@@ -918,6 +924,9 @@ static int __enable_vblank(struct drm_device *dev, unsigned 
int pipe)
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
 
+   if (WARN_ON(!crtc))
+   return 0;
+
if (crtc->funcs->enable_vblank)
return crtc->funcs->enable_vblank(crtc);
}
-- 
2.15.0

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


Re: [PATCHv2 4/8] dt-bindings: panel: common: document orientation property

2018-02-20 Thread Rob Herring
On Mon, Feb 19, 2018 at 5:06 AM, Sebastian Reichel
 wrote:
> Hi,
>
> On Sun, Feb 18, 2018 at 05:24:24PM -0600, Rob Herring wrote:
>> On Thu, Feb 08, 2018 at 07:30:31PM +0100, Sebastian Reichel wrote:
>> > Introduce new "orientation" property for describing in which
>> > orientation a panel has been mounted to the device. This can
>> > be used by the operating system to automatically rotate the
>> > display correctly.
>> >
>> > Signed-off-by: Sebastian Reichel 
>> > ---
>> >  .../devicetree/bindings/display/panel/panel-common.txt | 12 
>> > 
>> >  include/dt-bindings/display/common.h   | 14 
>> > ++
>> >  2 files changed, 26 insertions(+)
>> >  create mode 100644 include/dt-bindings/display/common.h
>> >
>> > diff --git 
>> > a/Documentation/devicetree/bindings/display/panel/panel-common.txt 
>> > b/Documentation/devicetree/bindings/display/panel/panel-common.txt
>> > index 557fa765adcb..c646b8908458 100644
>> > --- a/Documentation/devicetree/bindings/display/panel/panel-common.txt
>> > +++ b/Documentation/devicetree/bindings/display/panel/panel-common.txt
>> > @@ -18,6 +18,18 @@ Descriptive Properties
>> >physical area where images are displayed. These properties are 
>> > expressed in
>> >millimeters and rounded to the closest unit.
>> >
>> > +- orientation: The orientation property specifies the panel orientation
>> > +  in relation to the device's casing. The following values are possible:
>> > +
>> > +   * 0 = The top side of the panel matches the top side of the device's
>> > + casing.
>> > +   * 1 = The top side of the panel matches the bottom side of the device's
>> > + casing. In other words the panel is mounted upside-down.
>> > +   * 2 = The left side of the panel matches the top side of the device's
>> > + casing.
>> > +   * 3 = The right side of the panel matches the top side of the device's
>> > + casing.
>>
>> The rotation property in panel.txt already handles this, right?
>
> Yes, looks like it can be used. I guess panel.txt and
> panel-common.txt should be merged, though?

Yes, please. Actually, I'd like to merge simple-panel.txt too because
that is really kernel driver, not a type of panel. But there's a lot
of references to it to fix.

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


[Bug 102820] [bisected][DC] commit ebbf7337e2daacacef3e01114e6be68a2a4f11b4 prevents X11 from starting

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=102820

--- Comment #19 from Harry Wentland  ---
Created attachment 137476
  --> https://bugs.freedesktop.org/attachment.cgi?id=137476=edit
drm/amd/display: Default HDMI6G support to true. Log VBIOS table error.

Can you see if this helps? Our Windows driver definitely checks the HDMI6G flag
from VBIOS but it will default to allow 6G on HDMI if the VBIOS check fails.

This patch is porting the same behavior in the hopes that it will help with
your issue.

If this patch works a dmesg log with the amdgpu.dc_log=1 option on the kernel
would help us understand the root cause a bit better.

If it doesn't work it's back to the drawing board for me.

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


Re: [PATCH] locking/ww_mutex: add ww_mutex_is_owned_by function v4

2018-02-20 Thread kbuild test robot
Hi Christian,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.16-rc2 next-20180220]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Christian-K-nig/locking-ww_mutex-add-ww_mutex_is_owned_by-function-v4/20180221-021317
config: i386-tinyconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

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

   In file included from kernel/locking/mutex.c:21:0:
   include/linux/ww_mutex.h: In function 'ww_mutex_is_owned_by':
>> include/linux/ww_mutex.h:380:0: error: unterminated argument list invoking 
>> macro "likely"
#endif

>> include/linux/ww_mutex.h:377:3: error: 'likely' undeclared (first use in 
>> this function)
  likely(READ_ONCE(lock->ctx) == NULL;
  ^~
   include/linux/ww_mutex.h:377:3: note: each undeclared identifier is reported 
only once for each function it appears in
   In file included from include/linux/thread_info.h:13:0,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:81,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
>> include/linux/restart_block.h:11:1: error: expected ';' before 'struct'
struct timespec;
^~
>> include/linux/restart_block.h:12:1: warning: ISO C90 forbids mixed 
>> declarations and code [-Wdeclaration-after-statement]
struct compat_timespec;
^~
   In file included from include/linux/thread_info.h:38:0,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:81,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
>> arch/x86/include/asm/thread_info.h:170:19: error: invalid storage class for 
>> function 'arch_within_stack_frames'
static inline int arch_within_stack_frames(const void * const stack,
  ^~~~
   In file included from arch/x86/include/asm/preempt.h:7:0,
from include/linux/preempt.h:81,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
>> include/linux/thread_info.h:57:20: error: invalid storage class for function 
>> 'set_ti_thread_flag'
static inline void set_ti_thread_flag(struct thread_info *ti, int flag)
   ^~
>> include/linux/thread_info.h:62:20: error: invalid storage class for function 
>> 'clear_ti_thread_flag'
static inline void clear_ti_thread_flag(struct thread_info *ti, int flag)
   ^~~~
>> include/linux/thread_info.h:67:19: error: invalid storage class for function 
>> 'test_and_set_ti_thread_flag'
static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int 
flag)
  ^~~
>> include/linux/thread_info.h:72:19: error: invalid storage class for function 
>> 'test_and_clear_ti_thread_flag'
static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int 
flag)
  ^
>> include/linux/thread_info.h:77:19: error: invalid storage class for function 
>> 'test_ti_thread_flag'
static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
  ^~~
>> include/linux/thread_info.h:115:20: error: invalid storage class for 
>> function 'check_object_size'
static inline void check_object_size(const void *ptr, unsigned long n,
   ^
>> include/linux/thread_info.h:125:20: error: invalid storage class for 
>> function 'copy_overflow'
static inline void copy_overflow(int size, unsigned long count)
   ^
>> include/linux/thread_info.h:131:1: error: invalid storage class for function 
>> 'check_copy_size'
check_copy_size(const void *addr, size_t bytes, bool is_source)
^~~
   In file included from include/asm-generic/percpu.h:7:0,
from arch/x86/include/asm/percpu.h:543,
from arch/x86/include/asm/current.h:6,
from include/linux/mutex.h:14,
from kernel/

[Bug 75064] HDMI passthrough of TrueHD/DTS-HD audio fails at modes lower than 60hz

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75064

--- Comment #27 from Dominique Dumont  ---
Created attachment 137472
  --> https://bugs.freedesktop.org/attachment.cgi?id=137472=edit
kernel 4.15.rc8 log with drm.debug=0xe and non-working dts-hd

Hello

Unfortunately, DTS_HD still does not owrk with kernel 4.1.5.rc8. 

I've attached a complete kernel log done with drm.debug=0xe

While playing (silently) a DTS_HD file with kodi, the kernel logged a lot of
lines like:
 [drm:radeon_crtc_page_flip_target [radeon]] flip-ioctl() cur_rbo =
26ca5fac, new_rbo = 696c7c9c

Is this log enough to progress or do you need more logs with other debug
parameters ?

All the best

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


Re: [PATCH 1/3] drm/edid: quirk Oculus Rift headsets as non-desktop

2018-02-20 Thread Philipp Zabel
On Tue, Feb 20, 2018 at 12:56 PM, Jani Nikula
 wrote:
> On Mon, 19 Feb 2018, Philipp Zabel  wrote:
>> This uses the EDID info from Oculus Rift DK1 (OVR-0001), DK2 (OVR-0003),
>> and CV1 (OVR-0004) to mark them as non-desktop.
>
> Not that I know anything about this stuff, but should this series be cc:
> stable?

I guess it could be:

Cc:  # 4.15.x

Older kernels didn't receive the prerequisite patches
0d4cf21b ("drm: add connector info/property for non-desktop displays [v2]"),
b5f053882ff1 ("drm/fb: add support for not enabling fbcon on
non-desktop displays [v2]"),
and acb1d8eee508 ("drm/edid: quirk HTC vive headset as non-desktop. [v2]").

Should these be backported to older kernels as well, to avoid burning
the fbdev console into VR headset OLED displays? Note that DRM leases
landed in v4.15 as well, so anybody trying to actually use these on
Linux will likely not run an older kernel.

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


Re: [PATCH v2 4/4] drm: NULL pointer dereference [null-pointer-deref] (CWE 476) problem

2018-02-20 Thread Joe Moriarty

On 2/19/2018 8:32 AM, Daniel Vetter wrote:

On Mon, Feb 12, 2018 at 02:51:44PM -0500, Joe Moriarty wrote:

The Parfait (version 2.1.0) static code analysis tool found the
following NULL pointer derefernce problem.

- drivers/gpu/drm/drm_vblank.c
Null pointer checks were added to return values from calls to
drm_crtc_from_index().  There is a possibility, however minute, that
crtc->index may not be found when trying to find the struct crtc
from it's assigned index given in drm_crtc_init_with_planes().
3 return checks for NULL where added.

Signed-off-by: Joe Moriarty 
Reviewed-by: Steven Sistare 


These are all drivers bugs, we'd need at least a WARN_ON when the crtc
doesn't exist. Otherwise this would just silently paper over a fairly
serious kernel bug (which doesn't improve things really).

Something like

if (WARN_ON(!crtc))
return NULL;

is what I'd go with.

-Daniel

I will make the requested changes and resubmit the patch.  Thanks for 
reviewing the patches.


Joe


---
  drivers/gpu/drm/drm_vblank.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 32d9bcf5be7f..a3a1bce87468 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -120,7 +120,7 @@ static u32 __get_vblank_counter(struct drm_device *dev, 
unsigned int pipe)
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
  
-		if (crtc->funcs->get_vblank_counter)

+   if (crtc && crtc->funcs->get_vblank_counter)
return crtc->funcs->get_vblank_counter(crtc);
}
  
@@ -318,7 +318,7 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)

if (drm_core_check_feature(dev, DRIVER_MODESET)) {
struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
  
-		if (crtc->funcs->disable_vblank) {

+   if (crtc && crtc->funcs->disable_vblank) {
crtc->funcs->disable_vblank(crtc);
return;
}
@@ -918,7 +918,7 @@ static int __enable_vblank(struct drm_device *dev, unsigned 
int pipe)
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
  
-		if (crtc->funcs->enable_vblank)

+   if (crtc && crtc->funcs->enable_vblank)
return crtc->funcs->enable_vblank(crtc);
}
  
--

2.15.0

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




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


Re: [PATCH v2 1/4] drm: NULL pointer dereference [null-pointer-deref] (CWE 476) problem

2018-02-20 Thread Joe Moriarty

On 2/19/2018 6:57 AM, Daniel Vetter wrote:

On Mon, Feb 12, 2018 at 02:51:41PM -0500, Joe Moriarty wrote:

The Parfait (version 2.1.0) static code analysis tool found the
following NULL pointer dereference problem.

- drivers/gpu/drm/drm_drv.c
Any calls to drm_minor_get_slot() could result in the return of a NULL
pointer when an invalid DRM device type is encountered.  2 helper
functions where added for pointer manipulation (drm_minor_get_slot()
and drm_minor_set_minor()) along with checks for valid pointers for
struct drm_device variables throughout this module.

Signed-off-by: Joe Moriarty 
Reviewed-by: Steven Sistare 


We do not ask for an invalid minor (userspace can't do that, it would be a
kernel bug). BUG_ON for the invalid case instead of all these changes
acceptable to shut up your checker?
-Daniel


Daniel,

I did the following and the static checker liked it:

default:
-   return NULL;
+   BUG();
}

I will make the change in the patch and resubmit.

Joe


---
  drivers/gpu/drm/drm_drv.c | 38 ++
  1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 9acc1e157813..dee6a4470e2c 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -99,10 +99,36 @@ static struct drm_minor **drm_minor_get_slot(struct 
drm_device *dev,
case DRM_MINOR_CONTROL:
return >control;
default:
+   DRM_ERROR("Error in %s: Invalid dev, type = %d\n",
+ __func__, type);
return NULL;
}
  }
  
+static inline int drm_minor_set_minor(struct drm_device *dev,

+ unsigned int type,
+ struct drm_minor *minor)
+{
+   struct drm_minor **slot = drm_minor_get_slot(dev, type);
+   int retval = -ENODEV;
+
+   if (slot) {
+   retval = 0;
+   *slot = minor;
+   }
+   return retval;
+}
+
+static inline struct drm_minor *drm_minor_get_minor(struct drm_device *dev,
+   unsigned int type)
+{
+   struct drm_minor **slot = drm_minor_get_slot(dev, type);
+
+   if (slot)
+   return *slot;
+   return NULL;
+}
+
  static int drm_minor_alloc(struct drm_device *dev, unsigned int type)
  {
struct drm_minor *minor;
@@ -137,8 +163,9 @@ static int drm_minor_alloc(struct drm_device *dev, unsigned 
int type)
goto err_index;
}
  
-	*drm_minor_get_slot(dev, type) = minor;

-   return 0;
+   r = drm_minor_set_minor(dev, type, minor);
+   if (r == 0)
+   return r;
  
  err_index:

spin_lock_irqsave(_minor_lock, flags);
@@ -155,6 +182,9 @@ static void drm_minor_free(struct drm_device *dev, unsigned 
int type)
unsigned long flags;
  
  	slot = drm_minor_get_slot(dev, type);

+   if (!slot)
+   return;
+
minor = *slot;
if (!minor)
return;
@@ -177,7 +207,7 @@ static int drm_minor_register(struct drm_device *dev, 
unsigned int type)
  
  	DRM_DEBUG("\n");
  
-	minor = *drm_minor_get_slot(dev, type);

+   minor = drm_minor_get_minor(dev, type);
if (!minor)
return 0;
  
@@ -209,7 +239,7 @@ static void drm_minor_unregister(struct drm_device *dev, unsigned int type)

struct drm_minor *minor;
unsigned long flags;
  
-	minor = *drm_minor_get_slot(dev, type);

+   minor = drm_minor_get_minor(dev, type);
if (!minor || !device_is_registered(minor->kdev))
return;
  
--

2.15.0

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




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


[PATCH libdrm 2/2] intel: allocate buffer with the requested size when reuse is disabled

2018-02-20 Thread James Xiong
From: "Xiong, James" 

Previously a bucket size was used for buffer allocation whether
bo_reuse is false or true. This patch returns NULL in function
drm_intel_gem_bo_bucket_for_size() when bo_reuse is false, the
original requested size is used instead.

Signed-off-by: Xiong, James 
---
 intel/intel_bufmgr_gem.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 5b2d0d0..122530f 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -402,6 +402,9 @@ drm_intel_gem_bo_bucket_for_size(drm_intel_bufmgr_gem 
*bufmgr_gem,
 {
int i;
 
+   if (!bufmgr_gem->bo_reuse)
+   return NULL;
+
for (i = 0; i < bufmgr_gem->num_buckets - 1; i++) {
if (size >= bufmgr_gem->cache_bucket[i].size &&
size < bufmgr_gem->cache_bucket[i+1].size) {
@@ -1392,7 +1395,7 @@ drm_intel_gem_bo_unreference_final(drm_intel_bo *bo, 
time_t time)
 
bucket = drm_intel_gem_bo_bucket_for_size(bufmgr_gem, bo->size);
/* Put the buffer into our internal cache for reuse if we can. */
-   if (bufmgr_gem->bo_reuse && bo_gem->reusable && bucket != NULL &&
+   if (bo_gem->reusable && bucket != NULL &&
drm_intel_gem_bo_madvise_internal(bufmgr_gem, bo_gem,
  I915_MADV_DONTNEED)) {
bo_gem->free_time = time;
-- 
2.7.4

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


[PATCH libdrm 1/2] intel: align reuse buffer's size on page size instead

2018-02-20 Thread James Xiong
From: "Xiong, James" 

With gem_reuse enabled, when a buffer size is different than
the sizes of buckets, it is aligned to the next bucket's size,
which means about 25% more memory than the requested is allocated
in the worst senario. For example:

Orignal sizeActual
32KB+1Byte  40KB
.
.
.
8MB+1Byte   10MB
.
.
.
96MB+1Byte  112MB

This is very memory expensive and make the reuse feature less
favorable than it deserves to be.

This commit aligns the reuse buffer size on page size instead,
the buffer whose size falls between bucket[n] and bucket[n+1] is
put in bucket[n] when it's done; And when searching for a cached
buffer for reuse, it goes through the cached buffers list in the
bucket until a cached buffer, whose size is larger than or equal
to the requested size, is found.

Signed-off-by: Xiong, James 
---
 intel/intel_bufmgr_gem.c | 180 +--
 libdrm_lists.h   |   6 ++
 2 files changed, 101 insertions(+), 85 deletions(-)

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 386da30..5b2d0d0 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -402,11 +402,10 @@ drm_intel_gem_bo_bucket_for_size(drm_intel_bufmgr_gem 
*bufmgr_gem,
 {
int i;
 
-   for (i = 0; i < bufmgr_gem->num_buckets; i++) {
-   struct drm_intel_gem_bo_bucket *bucket =
-   _gem->cache_bucket[i];
-   if (bucket->size >= size) {
-   return bucket;
+   for (i = 0; i < bufmgr_gem->num_buckets - 1; i++) {
+   if (size >= bufmgr_gem->cache_bucket[i].size &&
+   size < bufmgr_gem->cache_bucket[i+1].size) {
+   return _gem->cache_bucket[i];
}
}
 
@@ -685,25 +684,95 @@ drm_intel_gem_bo_madvise(drm_intel_bo *bo, int madv)
 madv);
 }
 
-/* drop the oldest entries that have been purged by the kernel */
+/* drop the entries that are older than the given time */
 static void
 drm_intel_gem_bo_cache_purge_bucket(drm_intel_bufmgr_gem *bufmgr_gem,
-   struct drm_intel_gem_bo_bucket *bucket)
+   struct drm_intel_gem_bo_bucket *bucket,
+   time_t time)
 {
-   while (!DRMLISTEMPTY(>head)) {
-   drm_intel_bo_gem *bo_gem;
-
-   bo_gem = DRMLISTENTRY(drm_intel_bo_gem,
- bucket->head.next, head);
-   if (drm_intel_gem_bo_madvise_internal
-   (bufmgr_gem, bo_gem, I915_MADV_DONTNEED))
-   break;
-
-   DRMLISTDEL(_gem->head);
-   drm_intel_gem_bo_free(_gem->bo);
+   drm_intel_bo_gem *bo_gem, *temp;
+   DRMLISTFOREACHENTRYSAFE(bo_gem, temp, >head, head) {
+   if (bo_gem->free_time >= time) {
+   drm_intel_gem_bo_madvise_internal
+   (bufmgr_gem, bo_gem, I915_MADV_DONTNEED);
+   DRMLISTDEL(_gem->head);
+   drm_intel_gem_bo_free(_gem->bo);
+   }
}
 }
 
+static drm_intel_bo_gem *
+drm_intel_gem_bo_cached_for_size(drm_intel_bufmgr_gem *bufmgr_gem,
+ unsigned long size,
+ uint32_t tiling_mode,
+ unsigned long stride,
+ unsigned long alignment,
+ bool for_render)
+{
+   struct drm_intel_gem_bo_bucket *bucket =
+   drm_intel_gem_bo_bucket_for_size(bufmgr_gem, size);
+
+   if(bucket != NULL) {
+   drm_intel_bo_gem *bo_gem, *temp_bo_gem;
+retry:
+   bo_gem = NULL;
+   if (for_render) {
+   /* Allocate new render-target BOs from the tail (MRU)
+* of the list, as it will likely be hot in the GPU
+* cache and in the aperture for us.
+*/
+   DRMLISTFOREACHENTRYREVERSE(temp_bo_gem, >head, 
head) {
+   if (temp_bo_gem->bo.size >= size) {
+   bo_gem = temp_bo_gem;
+   DRMLISTDEL(_gem->head);
+   bo_gem->bo.align = alignment;
+   break;
+   }
+   }
+   } else {
+   assert(alignment == 0);
+   /* For non-render-target BOs (where we're probably
+* going to map it first thing in order to fill it
+* with data), check if the last BO in the cache is
+* unbusy, and only reuse in that case. Otherwise,
+* allocating a new buffer is probably faster 

[PATCH libdrm 0/2] improve reuse implementation

2018-02-20 Thread James Xiong
From: "Xiong, James" 

This series 1) align the reuse buffer size to page size instead. The
goal is to reduce memory penalty (up to 25% when reuse is enabled )
while maintain similar performance. A potential overhead is: since a
bucket now contains cached buffers with difference sizes, we need go
through the list to search for a suitable buffer for reuse. However
since the buckets get cleaned up regularly and the older cached buffer
are removed, the list should not be long and the performance impact
should be minor.

2) fix a bug that a bucket size instead of the requested size was ALWAYS
used for buffer allocation even when bo_reused is disabled.

Xiong, James (2):
  intel: align reuse buffer's size on page size instead
  intel: allocate buffer with the requested size when reuse is disabled

 intel/intel_bufmgr_gem.c | 185 +--
 libdrm_lists.h   |   6 ++
 2 files changed, 105 insertions(+), 86 deletions(-)

-- 
2.7.4

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


Re: [PATCH v2 0/5] virgl: fence fd support

2018-02-20 Thread Rob Herring
On Fri, Feb 16, 2018 at 9:12 AM, Gustavo Padovan  wrote:
> From: Gustavo Padovan 
>
> Hi,
>
> So I finally got around to finish this work! :)
> Here are the updated patchset with fixes for Rob Herring incorporated.
> This follow pretty much the same semantics of other drivers that
> implemented explicit fence support. It extends the execbuf ioctl to have
> an fence_fd argument that when entering the kernel carries the in-fence
> and when returning carries back the out-fence.
>
> The mesa patch can be found at
>
> https://gitlab.collabora.com/padovan/mesa
>
> Please review!
>
> Regards,
>
> Gustavo
>
> Gustavo Padovan (5):
>   drm/virtio: add virtio_gpu_alloc_fence()
>   drm/virtio: add uapi for in and out explicit fences
>   drm/virtio: add in-fences support for explicit synchronization
>   drm/virtio: add out-fences support for explicit synchronization
>   drm/virtio: bump driver version after explicit synchronization
> addition
>
>  drivers/gpu/drm/virtio/virtgpu_drv.h   |  21 +++---
>  drivers/gpu/drm/virtio/virtgpu_fence.c |  41 
>  drivers/gpu/drm/virtio/virtgpu_ioctl.c | 115 
> +++--
>  drivers/gpu/drm/virtio/virtgpu_plane.c |  46 +++--
>  drivers/gpu/drm/virtio/virtgpu_vq.c|  16 ++---
>  include/uapi/drm/virtgpu_drm.h |  13 +++-
>  6 files changed, 197 insertions(+), 55 deletions(-)

I tested this on Android. Without the 16ms sleep in the vsync callback
to fake the timing, I get some errors about invalid fences after the
splash screen and when the UI comes up.

BTW, I'm testing on a version of drm_hwcomposer with sw_sync and GL
compositing removed.

At least with that one line hack/fix:

Tested-by: Rob Herring 

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


RE: [PATCH v5 1/5] drm: xlnx: Xilinx DRM KMS module

2018-02-20 Thread hyun.kwon


> -Original Message-
> From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of Daniel
> Vetter
> Sent: Monday, February 19, 2018 1:43 AM
> To: Hyun Kwon 
> Cc: dri-devel@lists.freedesktop.org; devicet...@vger.kernel.org; Daniel
> Vetter ; Rob Herring ;
> Michal Simek ; Laurent Pinchart
> 
> Subject: Re: [PATCH v5 1/5] drm: xlnx: Xilinx DRM KMS module
> 
> On Tue, Feb 06, 2018 at 05:36:36PM -0800, Hyun Kwon wrote:
> > Xilinx has various platforms for display, where users can create
> > using multiple IPs in the programmable FPGA fabric, or where
> > some hardened piepline is available on the chip. Furthermore,
> > hardened pipeline can also interact with soft logics in FPGA.
> >
> > The Xilinx DRM KMS module is to integrate multiple subdevices and
> > to represent the entire pipeline as a single DRM device. The module
> > includes helper (ex, framebuffer and gem helpers) and
> > glue logic (ex, crtc interface) functions.
> >
> > Signed-off-by: Hyun Kwon 
> > Acked-by: Daniel Vetter 
> 
> Looks all ready for merging. Did you apply for commit rights to drm-misc
> already so you could push this right away?

Yes, I've created the request, and am waiting for the response there:
https://bugs.freedesktop.org/show_bug.cgi?id=105017

Thanks,
-hyun

> -Daniel
> 
> > ---
> > v5
> > - Redefine xlnx_pipeline_init()
> > v4
> > - Fix a bug in of graph binding handling
> > - Remove vblank callbacks from xlnx_crtc
> > - Remove the dt binding. This module becomes more like a library.
> > - Rephrase the commit message
> > v3
> > - Add Laurent as a maintainer
> > - Fix multiple-reference on gem objects
> > v2
> > - Change the SPDX identifier format
> > - Merge patches(crtc, gem, fb) into single one
> > v2 of xlnx_drv
> > - Rename kms to display in xlnx_drv
> > - Replace some xlnx specific fb helper with common helpers in xlnx_drv
> > - Don't set the commit tail callback in xlnx_drv
> > - Support 'ports' graph binding in xlnx_drv
> > v2 of xlnx_fb
> > - Remove wrappers in xlnx_fb
> > - Replace some functions with drm core helpers in xlnx_fb
> > ---
> > ---
> >  MAINTAINERS  |   9 +
> >  drivers/gpu/drm/Kconfig  |   2 +
> >  drivers/gpu/drm/Makefile |   1 +
> >  drivers/gpu/drm/xlnx/Kconfig |  12 +
> >  drivers/gpu/drm/xlnx/Makefile|   2 +
> >  drivers/gpu/drm/xlnx/xlnx_crtc.c | 177 ++
> >  drivers/gpu/drm/xlnx/xlnx_crtc.h |  70 ++
> >  drivers/gpu/drm/xlnx/xlnx_drv.c  | 501
> +++
> >  drivers/gpu/drm/xlnx/xlnx_drv.h  |  33 +++
> >  drivers/gpu/drm/xlnx/xlnx_fb.c   | 298 +++
> >  drivers/gpu/drm/xlnx/xlnx_fb.h   |  33 +++
> >  drivers/gpu/drm/xlnx/xlnx_gem.c  |  47 
> >  drivers/gpu/drm/xlnx/xlnx_gem.h  |  26 ++
> >  13 files changed, 1211 insertions(+)
> >  create mode 100644 drivers/gpu/drm/xlnx/Kconfig
> >  create mode 100644 drivers/gpu/drm/xlnx/Makefile
> >  create mode 100644 drivers/gpu/drm/xlnx/xlnx_crtc.c
> >  create mode 100644 drivers/gpu/drm/xlnx/xlnx_crtc.h
> >  create mode 100644 drivers/gpu/drm/xlnx/xlnx_drv.c
> >  create mode 100644 drivers/gpu/drm/xlnx/xlnx_drv.h
> >  create mode 100644 drivers/gpu/drm/xlnx/xlnx_fb.c
> >  create mode 100644 drivers/gpu/drm/xlnx/xlnx_fb.h
> >  create mode 100644 drivers/gpu/drm/xlnx/xlnx_gem.c
> >  create mode 100644 drivers/gpu/drm/xlnx/xlnx_gem.h
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 5bc088f..07c0e73 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -4789,6 +4789,15 @@ F:   drivers/gpu/drm/etnaviv/
> >  F: include/uapi/drm/etnaviv_drm.h
> >  F: Documentation/devicetree/bindings/display/etnaviv/
> >
> > +DRM DRIVERS FOR XILINX
> > +M: Hyun Kwon 
> > +M: Laurent Pinchart 
> > +L: dri-devel@lists.freedesktop.org
> > +S: Maintained
> > +F: drivers/gpu/drm/xlnx/
> > +F: Documentation/devicetree/bindings/display/xlnx/
> > +T: git git://anongit.freedesktop.org/drm/drm-misc
> > +
> >  DRM DRIVERS FOR ZTE ZX
> >  M: Shawn Guo 
> >  L: dri-devel@lists.freedesktop.org
> > diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> > index deeefa7..5a3ec66 100644
> > --- a/drivers/gpu/drm/Kconfig
> > +++ b/drivers/gpu/drm/Kconfig
> > @@ -289,6 +289,8 @@ source "drivers/gpu/drm/pl111/Kconfig"
> >
> >  source "drivers/gpu/drm/tve200/Kconfig"
> >
> > +source "drivers/gpu/drm/xlnx/Kconfig"
> > +
> >  # Keep legacy drivers last
> >
> >  menuconfig DRM_LEGACY
> > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> > index 50093ff..f93557e 100644
> > --- a/drivers/gpu/drm/Makefile
> > +++ b/drivers/gpu/drm/Makefile
> > @@ -103,3 +103,4 @@ obj-$(CONFIG_DRM_MXSFB) += mxsfb/
> >  obj-$(CONFIG_DRM_TINYDRM) += tinydrm/
> >  obj-$(CONFIG_DRM_PL111) += pl111/
> >  

Re: [PATCH] fix double ;;s in code

2018-02-20 Thread Joe Perches
On Tue, 2018-02-20 at 17:19 +1100, Michael Ellerman wrote:
> Daniel Vetter  writes:
> > On Sun, Feb 18, 2018 at 11:00:56AM +0100, Christophe LEROY wrote:
> > > Le 17/02/2018 à 22:19, Pavel Machek a écrit :
> > > > 
> > > > Fix double ;;'s in code.
> > > > 
> > > > Signed-off-by: Pavel Machek 
> > > 
> > > A summary of the files modified on top of the patch would help understand
> > > the impact.
> > > 
> > > A maybe there should be one patch by area, eg one for each arch specific
> > > modif and one for drivers/ and one for block/ ?
> > 
> > Yeah, pls split this into one patch per area, with a suitable patch
> > subject prefix. Look at git log of each file to get a feeling for what's
> > the standard in each area.
> 
> This part is actually pretty annoying.
> 
> I hacked up a script (below) which seems to do a reasonable job in most
> cases.

Here was another suggestion from awhile ago
https://lkml.org/lkml/2010/11/16/245

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


Re: [PATCH] drm/tve200: fix kernel-doc documentation comment include

2018-02-20 Thread Daniel Vetter
On Tue, Feb 20, 2018 at 04:20:08PM +0200, Jani Nikula wrote:
> The DOC: line acts as an identifier for the :doc: include. Fixes:
> 
> ./drivers/gpu/drm/tve200/tve200_drv.c:1: warning: no structured comments found
> 
> Cc: Linus Walleij 
> Signed-off-by: Jani Nikula 

Reviewed-by: Daniel Vetter 

> ---
>  Documentation/gpu/tve200.rst | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/gpu/tve200.rst b/Documentation/gpu/tve200.rst
> index 69b17b324e12..152ea9398f7e 100644
> --- a/Documentation/gpu/tve200.rst
> +++ b/Documentation/gpu/tve200.rst
> @@ -3,4 +3,4 @@
>  ==
>  
>  .. kernel-doc:: drivers/gpu/drm/tve200/tve200_drv.c
> -   :doc: Faraday TV Encoder 200
> +   :doc: Faraday TV Encoder TVE200 DRM Driver
> -- 
> 2.11.0
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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


Re: [PATCH] fix double ;;s in code

2018-02-20 Thread Alex Deucher
On Tue, Feb 20, 2018 at 3:03 AM, Jani Nikula
 wrote:
> On Mon, 19 Feb 2018, Pavel Machek  wrote:
>> On Mon 2018-02-19 16:41:35, Daniel Vetter wrote:
>>> Yeah, pls split this into one patch per area, with a suitable patch
>>> subject prefix. Look at git log of each file to get a feeling for what's
>>> the standard in each area.
>>
>> Yeah I can spend hour spliting it, and then people will ignore it
>> anyway.
>>
>> If you care about one of the files being modified, please fix the
>> bug, ";;" is a clear bug.
>>
>> If you don't care ... well I don't care either.
>
> Look, if this causes just one conflict down the line because it touches
> the kernel all over the place, then IMO it already wasn't worth
> it. Merge conflicts are inevitable, but there's no reason to make life
> harder just to cater for a cleanup patch. It's not that important.
>
> Had it been split up, the drm parts would've been merged already.

FWIW, the amdgpu and scheduler changes have already been fixed for -next.

Alex

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


Re: [PATCH] locking/ww_mutex: add ww_mutex_is_owned_by function v4

2018-02-20 Thread Daniel Vetter
On Tue, Feb 20, 2018 at 03:49:46PM +0100, Christian König wrote:
> amdgpu needs to verify if userspace sends us valid addresses and the simplest
> way of doing this is to check if the buffer object is locked with the ticket
> of the current submission.
> 
> Clean up the access to the ww_mutex internals by providing a function
> for this and extend the check to the thread owning the underlying mutex.
> 
> v2: split amdgpu changes into separate patch as suggested by Alex
> v3: change logic as suggested by Daniel
> v4: fix test in case ctx is NULL
> 
> Signed-off-by: Christian König 
> ---
>  include/linux/ww_mutex.h | 19 +++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h
> index 39fda195bf78..fea4acc0bcbc 100644
> --- a/include/linux/ww_mutex.h
> +++ b/include/linux/ww_mutex.h
> @@ -358,4 +358,23 @@ static inline bool ww_mutex_is_locked(struct ww_mutex 
> *lock)
>   return mutex_is_locked(>base);
>  }
>  
> +/**
> + * ww_mutex_is_owned_by - is the w/w mutex locked by this task in that 
> context
> + * @lock: the mutex to be queried
> + * @ctx: the w/w acquire context to test
> + *
> + * If @ctx is not NULL test if the mutex is owned by this context.
> + * If @ctx is NULL test if the mutex is owned by the current thread and not
> + * locked in any context.

Ok I think with the increased guarantees this needs a better kerneldoc, I
think we need to at least add " and not locked in any context, i.e.
acquired using either ww_mutex_trylock() or ww_mutex_lock() without
supplying a _acquire_ctx."

I think with that we have a nice 1:1 mapping between the context you
supply to the ww_mutex_lock function and to this one. That means generic
code which takes a ctx (but can handle NULL) should dtrt no matter what.

With the kerneldoc augmented:

Reviewed-by: Daniel Vetter 

I'll probably regret this r-b too, but hey to err is human :-)

Cheers, Daniel

> + */
> +static inline bool ww_mutex_is_owned_by(struct ww_mutex *lock,
> + struct ww_acquire_ctx *ctx)
> +{
> + if (ctx)
> + return likely(READ_ONCE(lock->ctx) == ctx);
> +
> + return likely(__mutex_owner(>base) == current) &&
> + likely(READ_ONCE(lock->ctx) == NULL;
> +}
> +
>  #endif
> -- 
> 2.14.1
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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


RE: [PATCH v2 1/1] drm: add kernel doc for exported gem dmabuf_ops

2018-02-20 Thread Li, Samuel
OK, I can do that.

Regards,
Samuel Li


> -Original Message-
> From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of Daniel
> Vetter
> Sent: Tuesday, February 20, 2018 11:23 AM
> To: Li, Samuel 
> Cc: Daniel Vetter ; Koenig, Christian
> ; amd-...@lists.freedesktop.org; dri-
> de...@lists.freedesktop.org
> Subject: Re: [PATCH v2 1/1] drm: add kernel doc for exported gem
> dmabuf_ops
> 
> On Tue, Feb 20, 2018 at 03:46:51PM +, Li, Samuel wrote:
> > > ./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or
> > > member 'attach' not described in 'drm_gem_unmap_dma_buf'
> > > ./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or
> > > member 'sgt' not described in 'drm_gem_unmap_dma_buf'
> > > ./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or
> > > member 'dir' not described in 'drm_gem_unmap_dma_buf'
> > ...
> >
> > Actually I tested. Those parameters are left out on purpose since they are
> empty functions so far.
> 
> Can you pls add dummy explanations? I know it's somewhat silly, but when
> there's lots of warnings it's much harder to spot new ones. Docs are
> sometimes just plain boring rote work :-/
> 
> Thanks, Daniel
> 
> >
> > Regards,
> > Samuel Li
> >
> > > -Original Message-
> > > From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of
> > > Daniel Vetter
> > > Sent: Tuesday, February 20, 2018 10:13 AM
> > > To: Li, Samuel 
> > > Cc: Daniel Vetter ; Koenig, Christian
> > > ; amd-...@lists.freedesktop.org; dri-
> > > de...@lists.freedesktop.org
> > > Subject: Re: [PATCH v2 1/1] drm: add kernel doc for exported gem
> > > dmabuf_ops
> > >
> > > On Tue, Jan 30, 2018 at 04:01:23PM +, Li, Samuel wrote:
> > > >
> > > > Alex helped push this into drm-tip,
> > > > https://cgit.freedesktop.org/drm/drm-
> > > tip/commit/drivers/gpu/drm?id=f7a
> > > > 71b0cf9e36c1b0edbfe89ce028a01164b864d
> > > >
> > > > Thanks,
> > > > Samuel Li
> > > >
> > > >
> > > > > -Original Message-
> > > > > From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of
> > > > > Daniel Vetter
> > > > > Sent: Tuesday, January 30, 2018 4:33 AM
> > > > > To: Koenig, Christian 
> > > > > Cc: Li, Samuel ;
> > > > > amd-...@lists.freedesktop.org;
> > > > > dri- de...@lists.freedesktop.org
> > > > > Subject: Re: [PATCH v2 1/1] drm: add kernel doc for exported gem
> > > > > dmabuf_ops
> > > > >
> > > > > On Fri, Jan 19, 2018 at 09:51:20AM +0100, Christian König wrote:
> > > > > > Am 18.01.2018 um 22:44 schrieb Samuel Li:
> > > > > > > Signed-off-by: Samuel Li 
> > > > > > > Reviewed-by: Daniel Vetter 
> > > > >
> > > > > Thanks for updating the docs.
> > > > > >
> > > > > > Reviewed-by: Christian König 
> > > > >
> > > > > I'm assuming you'll als push this one.
> > >
> > > I just noticed that fairly obviously this wasn't tested when writing:
> > >
> > > ./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or
> > > member 'attach' not described in 'drm_gem_unmap_dma_buf'
> > > ./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or
> > > member 'sgt' not described in 'drm_gem_unmap_dma_buf'
> > > ./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or
> > > member 'dir' not described in 'drm_gem_unmap_dma_buf'
> > > ./drivers/gpu/drm/drm_prime.c:438: warning: Function parameter or
> > > member 'dma_buf' not described in 'drm_gem_dmabuf_kmap_atomic'
> > > ./drivers/gpu/drm/drm_prime.c:438: warning: Function parameter or
> > > member 'page_num' not described in 'drm_gem_dmabuf_kmap_atomic'
> > > ./drivers/gpu/drm/drm_prime.c:450: warning: Function parameter or
> > > member 'dma_buf' not described in
> 'drm_gem_dmabuf_kunmap_atomic'
> > > ./drivers/gpu/drm/drm_prime.c:450: warning: Function parameter or
> > > member 'page_num' not described in
> 'drm_gem_dmabuf_kunmap_atomic'
> > > ./drivers/gpu/drm/drm_prime.c:450: warning: Function parameter or
> > > member 'addr' not described in 'drm_gem_dmabuf_kunmap_atomic'
> > > ./drivers/gpu/drm/drm_prime.c:461: warning: Function parameter or
> > > member 'dma_buf' not described in 'drm_gem_dmabuf_kmap'
> > > ./drivers/gpu/drm/drm_prime.c:461: warning: Function parameter or
> > > member 'page_num' not described in 'drm_gem_dmabuf_kmap'
> > > ./drivers/gpu/drm/drm_prime.c:473: warning: Function parameter or
> > > member 'dma_buf' not described in 'drm_gem_dmabuf_kunmap'
> > > ./drivers/gpu/drm/drm_prime.c:473: warning: Function parameter or
> > > member 'page_num' not described in 'drm_gem_dmabuf_kunmap'
> > > ./drivers/gpu/drm/drm_prime.c:473: warning: Function parameter or
> > > member 'addr' not described in 'drm_gem_dmabuf_kunmap'
> > >
> > > Samuel, can you pls build docs using
> > >
> > > $ make htmldocs
> > >
> > > and fix up the fallout and 

[Bug 105083] Random blinking display

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105083

--- Comment #8 from Harry Wentland  ---
Thanks for the video. It helps us understand what you're seeing.

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


Re: [PATCH v2 1/1] drm: add kernel doc for exported gem dmabuf_ops

2018-02-20 Thread Daniel Vetter
On Tue, Feb 20, 2018 at 03:46:51PM +, Li, Samuel wrote:
> > ./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or
> > member 'attach' not described in 'drm_gem_unmap_dma_buf'
> > ./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or
> > member 'sgt' not described in 'drm_gem_unmap_dma_buf'
> > ./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or
> > member 'dir' not described in 'drm_gem_unmap_dma_buf'
> ...
> 
> Actually I tested. Those parameters are left out on purpose since they are 
> empty functions so far.

Can you pls add dummy explanations? I know it's somewhat silly, but when
there's lots of warnings it's much harder to spot new ones. Docs are
sometimes just plain boring rote work :-/

Thanks, Daniel

> 
> Regards,
> Samuel Li
> 
> > -Original Message-
> > From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of Daniel
> > Vetter
> > Sent: Tuesday, February 20, 2018 10:13 AM
> > To: Li, Samuel 
> > Cc: Daniel Vetter ; Koenig, Christian
> > ; amd-...@lists.freedesktop.org; dri-
> > de...@lists.freedesktop.org
> > Subject: Re: [PATCH v2 1/1] drm: add kernel doc for exported gem
> > dmabuf_ops
> > 
> > On Tue, Jan 30, 2018 at 04:01:23PM +, Li, Samuel wrote:
> > >
> > > Alex helped push this into drm-tip,
> > > https://cgit.freedesktop.org/drm/drm-
> > tip/commit/drivers/gpu/drm?id=f7a
> > > 71b0cf9e36c1b0edbfe89ce028a01164b864d
> > >
> > > Thanks,
> > > Samuel Li
> > >
> > >
> > > > -Original Message-
> > > > From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of
> > > > Daniel Vetter
> > > > Sent: Tuesday, January 30, 2018 4:33 AM
> > > > To: Koenig, Christian 
> > > > Cc: Li, Samuel ; amd-...@lists.freedesktop.org;
> > > > dri- de...@lists.freedesktop.org
> > > > Subject: Re: [PATCH v2 1/1] drm: add kernel doc for exported gem
> > > > dmabuf_ops
> > > >
> > > > On Fri, Jan 19, 2018 at 09:51:20AM +0100, Christian König wrote:
> > > > > Am 18.01.2018 um 22:44 schrieb Samuel Li:
> > > > > > Signed-off-by: Samuel Li 
> > > > > > Reviewed-by: Daniel Vetter 
> > > >
> > > > Thanks for updating the docs.
> > > > >
> > > > > Reviewed-by: Christian König 
> > > >
> > > > I'm assuming you'll als push this one.
> > 
> > I just noticed that fairly obviously this wasn't tested when writing:
> > 
> > ./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or
> > member 'attach' not described in 'drm_gem_unmap_dma_buf'
> > ./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or
> > member 'sgt' not described in 'drm_gem_unmap_dma_buf'
> > ./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or
> > member 'dir' not described in 'drm_gem_unmap_dma_buf'
> > ./drivers/gpu/drm/drm_prime.c:438: warning: Function parameter or
> > member 'dma_buf' not described in 'drm_gem_dmabuf_kmap_atomic'
> > ./drivers/gpu/drm/drm_prime.c:438: warning: Function parameter or
> > member 'page_num' not described in 'drm_gem_dmabuf_kmap_atomic'
> > ./drivers/gpu/drm/drm_prime.c:450: warning: Function parameter or
> > member 'dma_buf' not described in 'drm_gem_dmabuf_kunmap_atomic'
> > ./drivers/gpu/drm/drm_prime.c:450: warning: Function parameter or
> > member 'page_num' not described in 'drm_gem_dmabuf_kunmap_atomic'
> > ./drivers/gpu/drm/drm_prime.c:450: warning: Function parameter or
> > member 'addr' not described in 'drm_gem_dmabuf_kunmap_atomic'
> > ./drivers/gpu/drm/drm_prime.c:461: warning: Function parameter or
> > member 'dma_buf' not described in 'drm_gem_dmabuf_kmap'
> > ./drivers/gpu/drm/drm_prime.c:461: warning: Function parameter or
> > member 'page_num' not described in 'drm_gem_dmabuf_kmap'
> > ./drivers/gpu/drm/drm_prime.c:473: warning: Function parameter or
> > member 'dma_buf' not described in 'drm_gem_dmabuf_kunmap'
> > ./drivers/gpu/drm/drm_prime.c:473: warning: Function parameter or
> > member 'page_num' not described in 'drm_gem_dmabuf_kunmap'
> > ./drivers/gpu/drm/drm_prime.c:473: warning: Function parameter or
> > member 'addr' not described in 'drm_gem_dmabuf_kunmap'
> > 
> > Samuel, can you pls build docs using
> > 
> > $ make htmldocs
> > 
> > and fix up the fallout and submit a patch?
> > 
> > Thanks, Daniel
> > 
> > > > -Daniel
> > > >
> > > > >
> > > > > > ---
> > > > > >   drivers/gpu/drm/drm_prime.c | 88
> > > > +
> > > > > >   1 file changed, 88 insertions(+)
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/drm_prime.c
> > > > > > b/drivers/gpu/drm/drm_prime.c index ca09ce7..e82a976 100644
> > > > > > --- a/drivers/gpu/drm/drm_prime.c
> > > > > > +++ b/drivers/gpu/drm/drm_prime.c
> > > > > > @@ -73,6 +73,9 @@
> > > > > >* Drivers should detect this situation and return back the gem 
> > > > > > object
> > > > > >* from the dma-buf private.  Prime will do this 

Re: [PATCH] drm/doc: nerved -> nerfed in drm_ioctl.c

2018-02-20 Thread Harry Wentland
On 2018-02-19 10:27 AM, Daniel Vetter wrote:
> On Thu, Feb 15, 2018 at 03:33:17PM -0500, Alex Deucher wrote:
>> On Thu, Feb 15, 2018 at 2:56 PM, Harry Wentland  
>> wrote:
>>> On 2018-02-15 11:40 AM, Daniel Stone wrote:
 Hi Harry,

 On 15 February 2018 at 16:28, Harry Wentland  
 wrote:
> This threw me for a loop when I read the docs. I imagine this is the
> intended definition:
> http://www.dictionary.com/browse/nerf

 Yeah. I'm quite sure it was intended to be 'nerfed', but replacing it
 with something more clear (and especially more accessible to
 non-native speakers) would be great if you could do that instead
 please. :)
>>>
>>> Good point.
>>>
>>> danvet, I'm not sure exactly what nerfed really means in this context? Does 
>>> it mean 'dropped', 'deprecated', 'no longer supported'?
>>>
>>
>> I think in this context, it means broken.
> 
> For slang, urban dictionary helps:
> 
> https://www.urbandictionary.com/define.php?term=nerf

I was tempted to post the urban dictionary link but wasn't sure how well it
would go over in a kernel commit. :)

> 
> i.e. I meant "removed to make it harmless". So dropped/no longer supported
> is accurate I think. And 'deprecated' for the intent to remove it in the
> future.

Thanks for clarifying.

Harry

> -Daniel
> 
>>
>> Alex
>>
>>> I also see a reference to drm version 1.4 but I only see version 1.3 in 
>>> libdrm?
>>>
>>> Harry
>>>

 Cheers,
 Daniel

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


Re: [PATCH] drm/nouveau: Replace the iturbt_709 prop with the standarad COLOR_ENCODNIG prop

2018-02-20 Thread kbuild test robot
Hi Ville,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm/drm-next]
[also build test ERROR on v4.16-rc2 next-20180220]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Ville-Syrjala/drm-nouveau-Replace-the-iturbt_709-prop-with-the-standarad-COLOR_ENCODNIG-prop/20180220-230332
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: x86_64-allyesdebian (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/nouveau/dispnv04/overlay.c:56:26: error: field 
>> 'color_encoding' has incomplete type
 enum drm_color_encoding color_encoding;
 ^~
   drivers/gpu/drm/nouveau/dispnv04/overlay.c: In function 'nv10_update_plane':
>> drivers/gpu/drm/nouveau/dispnv04/overlay.c:168:34: error: 
>> 'DRM_COLOR_YCBCR_BT709' undeclared (first use in this function)
 if (nv_plane->color_encoding == DRM_COLOR_YCBCR_BT709)
 ^
   drivers/gpu/drm/nouveau/dispnv04/overlay.c:168:34: note: each undeclared 
identifier is reported only once for each function it appears in
   drivers/gpu/drm/nouveau/dispnv04/overlay.c: In function 'nv10_set_params':
   drivers/gpu/drm/nouveau/dispnv04/overlay.c:231:32: error: 
'DRM_COLOR_YCBCR_BT709' undeclared (first use in this function)
  if (plane->color_encoding == DRM_COLOR_YCBCR_BT709)
   ^
   drivers/gpu/drm/nouveau/dispnv04/overlay.c: In function 'nv_set_property':
>> drivers/gpu/drm/nouveau/dispnv04/overlay.c:260:38: error: 'struct drm_plane' 
>> has no member named 'color_encoding_property'; did you mean 
>> 'rotation_property'?
 else if (property == nv_plane->base.color_encoding_property)
 ^~~
 rotation_property
   drivers/gpu/drm/nouveau/dispnv04/overlay.c: In function 'nv10_overlay_init':
>> drivers/gpu/drm/nouveau/dispnv04/overlay.c:342:26: error: 
>> 'DRM_COLOR_YCBCR_BT601' undeclared (first use in this function)
 plane->color_encoding = DRM_COLOR_YCBCR_BT601;
 ^
>> drivers/gpu/drm/nouveau/dispnv04/overlay.c:343:2: error: implicit 
>> declaration of function 'drm_plane_create_color_properties'; did you mean 
>> 'drm_plane_create_zpos_property'? [-Werror=implicit-function-declaration]
 drm_plane_create_color_properties(>base,
 ^
 drm_plane_create_zpos_property
   In file included from include/linux/kernel.h:11:0,
from include/linux/list.h:9,
from include/linux/agp_backend.h:33,
from include/drm/drmP.h:35,
from drivers/gpu/drm/nouveau/dispnv04/overlay.c:26:
>> drivers/gpu/drm/nouveau/dispnv04/overlay.c:345:12: error: 
>> 'DRM_COLOR_YCBCR_BT709' undeclared (first use in this function); did you 
>> mean 'DRM_COLOR_YCBCR_BT601'?
   BIT(DRM_COLOR_YCBCR_BT709),
   ^
   include/linux/bitops.h:7:28: note: in definition of macro 'BIT'
#define BIT(nr)   (1UL << (nr))
   ^~
>> drivers/gpu/drm/nouveau/dispnv04/overlay.c:346:12: error: 
>> 'DRM_COLOR_YCBCR_LIMITED_RANGE' undeclared (first use in this function); did 
>> you mean 'DRM_COLOR_YCBCR_BT709'?
   BIT(DRM_COLOR_YCBCR_LIMITED_RANGE),
   ^
   include/linux/bitops.h:7:28: note: in definition of macro 'BIT'
#define BIT(nr)   (1UL << (nr))
   ^~
   cc1: some warnings being treated as errors

vim +/color_encoding +56 drivers/gpu/drm/nouveau/dispnv04/overlay.c

  > 26  #include 
27  #include 
28  #include 
29  
30  #include "nouveau_drv.h"
31  
32  #include "nouveau_bo.h"
33  #include "nouveau_connector.h"
34  #include "nouveau_display.h"
35  #include "nvreg.h"
36  #include "disp.h"
37  
38  struct nouveau_plane {
39  struct drm_plane base;
40  bool flip;
41  struct nouveau_bo *cur;
42  
43  struct {
44  struct drm_property *colorkey;
45  struct drm_property *contrast;
46  struct drm_property *brightness;
47  struct drm_property *hue;
48  struct drm_property *saturation;
49  } props;
50  
51  int colorkey;
52  int contrast;
53  int brightness;
54  int h

Re: [PATCH v19 00/10] Add backlight helper functions

2018-02-20 Thread Sean Paul
On Wed, Jan 24, 2018 at 11:32 AM, Meghana Madhyastha
 wrote:
> Move drm helper functions from tinydrm-helpers to linux/backlight for
> ease of use by callers in other drivers.
>

It was a long time coming, but this has finally been applied to
-misc-next. Thanks for sticking with it!

Sean

> Changes in v19:
> -Changed to devm version of of_find_backlight in omapdrm (patch 10)
> -removed assigning pdev->dev to variable dev in omapdrm (patch 10)
>
> Meghana Madhyastha (10):
>   video: backlight: Add helpers to enable and disable backlight
>   drm/tinydrm: Convert tinydrm_enable/disable_backlight to
> backlight_enable/disable
>   video: backlight: Add of_find_backlight helper in backlight.c
>   drm/tinydrm: Replace tinydrm_of_find_backlight with of_find_backlight
>   video: backlight: Add devres versions of of_find_backlight
>   drm/tinydrm: Call devres version of of_find_backlight
>   drm/panel: Use backlight_enable/disable helpers
>   drm/omapdrm: Use backlight_enable/disable helpers
>   drm/panel: Use of_find_backlight helper
>   drm/omapdrm: Use of_find_backlight helper
>
>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c| 36 ++
>  drivers/gpu/drm/panel/panel-innolux-p079zca.c   | 30 ++--
>  drivers/gpu/drm/panel/panel-jdi-lt070me05000.c  |  6 +-
>  drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c | 38 ++
>  drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 37 ++
>  drivers/gpu/drm/tinydrm/Kconfig |  2 -
>  drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c  | 95 
> -
>  drivers/gpu/drm/tinydrm/mi0283qt.c  |  3 +-
>  drivers/gpu/drm/tinydrm/mipi-dbi.c  |  4 +-
>  drivers/gpu/drm/tinydrm/st7735r.c   |  3 +-
>  drivers/video/backlight/backlight.c | 73 +++
>  include/drm/tinydrm/tinydrm-helpers.h   |  4 --
>  include/linux/backlight.h   | 58 +++
>  13 files changed, 165 insertions(+), 224 deletions(-)
>
> --
> 2.11.0
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/nouveau: Replace the iturbt_709 prop with the standarad COLOR_ENCODNIG prop

2018-02-20 Thread kbuild test robot
Hi Ville,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm/drm-next]
[also build test ERROR on v4.16-rc2 next-20180220]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Ville-Syrjala/drm-nouveau-Replace-the-iturbt_709-prop-with-the-standarad-COLOR_ENCODNIG-prop/20180220-230332
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: i386-randconfig-a1-201807 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/gpu/drm/nouveau/dispnv04/overlay.c:56:26: error: field 
'color_encoding' has incomplete type
 enum drm_color_encoding color_encoding;
 ^
   drivers/gpu/drm/nouveau/dispnv04/overlay.c: In function 'nv10_update_plane':
   drivers/gpu/drm/nouveau/dispnv04/overlay.c:168:34: error: 
'DRM_COLOR_YCBCR_BT709' undeclared (first use in this function)
 if (nv_plane->color_encoding == DRM_COLOR_YCBCR_BT709)
 ^
   drivers/gpu/drm/nouveau/dispnv04/overlay.c:168:34: note: each undeclared 
identifier is reported only once for each function it appears in
   drivers/gpu/drm/nouveau/dispnv04/overlay.c: In function 'nv10_set_params':
   drivers/gpu/drm/nouveau/dispnv04/overlay.c:231:32: error: 
'DRM_COLOR_YCBCR_BT709' undeclared (first use in this function)
  if (plane->color_encoding == DRM_COLOR_YCBCR_BT709)
   ^
   drivers/gpu/drm/nouveau/dispnv04/overlay.c: In function 'nv_set_property':
>> drivers/gpu/drm/nouveau/dispnv04/overlay.c:260:37: error: 'struct drm_plane' 
>> has no member named 'color_encoding_property'
 else if (property == nv_plane->base.color_encoding_property)
^
   drivers/gpu/drm/nouveau/dispnv04/overlay.c: In function 'nv10_overlay_init':
   drivers/gpu/drm/nouveau/dispnv04/overlay.c:342:26: error: 
'DRM_COLOR_YCBCR_BT601' undeclared (first use in this function)
 plane->color_encoding = DRM_COLOR_YCBCR_BT601;
 ^
>> drivers/gpu/drm/nouveau/dispnv04/overlay.c:343:2: error: implicit 
>> declaration of function 'drm_plane_create_color_properties' 
>> [-Werror=implicit-function-declaration]
 drm_plane_create_color_properties(>base,
 ^
   In file included from include/linux/kernel.h:11:0,
from include/linux/list.h:9,
from include/linux/agp_backend.h:33,
from include/drm/drmP.h:35,
from drivers/gpu/drm/nouveau/dispnv04/overlay.c:26:
   drivers/gpu/drm/nouveau/dispnv04/overlay.c:345:12: error: 
'DRM_COLOR_YCBCR_BT709' undeclared (first use in this function)
   BIT(DRM_COLOR_YCBCR_BT709),
   ^
   include/linux/bitops.h:7:28: note: in definition of macro 'BIT'
#define BIT(nr)   (1UL << (nr))
   ^
>> drivers/gpu/drm/nouveau/dispnv04/overlay.c:346:12: error: 
>> 'DRM_COLOR_YCBCR_LIMITED_RANGE' undeclared (first use in this function)
   BIT(DRM_COLOR_YCBCR_LIMITED_RANGE),
   ^
   include/linux/bitops.h:7:28: note: in definition of macro 'BIT'
#define BIT(nr)   (1UL << (nr))
   ^
   cc1: some warnings being treated as errors

vim +260 drivers/gpu/drm/nouveau/dispnv04/overlay.c

   111  
   112  static int
   113  nv10_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
   114struct drm_framebuffer *fb, int crtc_x, int crtc_y,
   115unsigned int crtc_w, unsigned int crtc_h,
   116uint32_t src_x, uint32_t src_y,
   117uint32_t src_w, uint32_t src_h,
   118struct drm_modeset_acquire_ctx *ctx)
   119  {
   120  struct nouveau_drm *drm = nouveau_drm(plane->dev);
   121  struct nvif_object *dev = >client.device.object;
   122  struct nouveau_plane *nv_plane =
   123  container_of(plane, struct nouveau_plane, base);
   124  struct nouveau_framebuffer *nv_fb = nouveau_framebuffer(fb);
   125  struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
   126  struct nouveau_bo *cur = nv_plane->cur;
   127  bool flip = nv_plane->flip;
   128  int soff = NV_PCRTC0_SIZE * nv_crtc->index;
   129  int soff2 = NV_PCRTC0_SIZE * !nv_crtc->index;
   130  unsigned shift = drm->client.device.info.chipset >= 0x30 ? 1 : 
3;
   131  unsigned format = 0;
   132  int ret;
   133  
   134  /* Source parameters given in 16.16 fixed point, ignore 
fractional. */
   135  src_x >>= 16;
   136  src_y >>= 16;
   137  src_w &g

[Bug 104391] DC R9 285 HDMI audio regression since drm/amd/display: try to find matching audio inst for enc inst first

2018-02-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=104391

--- Comment #1 from Andy Furniss  ---
Bump!

Still broken on latest drm-next-4.17-wip.
Tried booting with both screens on, no better.

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


Re: [PATCH v2 3/8] drm/atomic: Include color encoding/range in plane state dump

2018-02-20 Thread Harry Wentland
On 2018-02-19 03:28 PM, Ville Syrjala wrote:
> From: Ville Syrjälä 
> 
> Include color_enconding and color_range in the plane state dump.
> 
> v2: Add kerneldoc (danvet)
> 
> Cc: Harry Wentland 
> Cc: Daniel Vetter 
> Cc: Daniel Stone 
> Cc: Russell King - ARM Linux 
> Cc: Ilia Mirkin 
> Cc: Hans Verkuil 
> Cc: Uma Shankar 
> Cc: Shashank Sharma 
> Cc: Jyri Sarha 
> Signed-off-by: Ville Syrjälä 

Latest patches for 1-3 are
Acked-by: Harry Wentland 

Harry

> ---
>  drivers/gpu/drm/drm_atomic.c|  4 
>  drivers/gpu/drm/drm_color_mgmt.c| 30 ++
>  drivers/gpu/drm/drm_crtc_internal.h |  2 ++
>  3 files changed, 36 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 452a0b0bafbc..9552052ed31a 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -952,6 +952,10 @@ static void drm_atomic_plane_print_state(struct 
> drm_printer *p,
>   drm_printf(p, "\tcrtc-pos=" DRM_RECT_FMT "\n", DRM_RECT_ARG());
>   drm_printf(p, "\tsrc-pos=" DRM_RECT_FP_FMT "\n", DRM_RECT_FP_ARG());
>   drm_printf(p, "\trotation=%x\n", state->rotation);
> + drm_printf(p, "\tcolor-encoding=%s\n",
> +drm_get_color_encoding_name(state->color_encoding));
> + drm_printf(p, "\tcolor-range=%s\n",
> +drm_get_color_range_name(state->color_range));
>  
>   if (plane->funcs->atomic_print_state)
>   plane->funcs->atomic_print_state(p, state);
> diff --git a/drivers/gpu/drm/drm_color_mgmt.c 
> b/drivers/gpu/drm/drm_color_mgmt.c
> index 7b0f1c2d9190..a11a838741c2 100644
> --- a/drivers/gpu/drm/drm_color_mgmt.c
> +++ b/drivers/gpu/drm/drm_color_mgmt.c
> @@ -367,6 +367,36 @@ static const char * const color_range_name[] = {
>  };
>  
>  /**
> + * drm_get_color_encoding_name - return a string for color encoding
> + * @encoding: color encoding to compute name of
> + *
> + * In contrast to the other drm_get_*_name functions this one here returns a
> + * const pointer and hence is threadsafe.
> + */
> +const char *drm_get_color_encoding_name(enum drm_color_encoding encoding)
> +{
> + if (WARN_ON(encoding >= ARRAY_SIZE(color_encoding_name)))
> + return "unknown";
> +
> + return color_encoding_name[encoding];
> +}
> +
> +/**
> + * drm_get_color_range_name - return a string for color range
> + * @range: color range to compute name of
> + *
> + * In contrast to the other drm_get_*_name functions this one here returns a
> + * const pointer and hence is threadsafe.
> + */
> +const char *drm_get_color_range_name(enum drm_color_range range)
> +{
> + if (WARN_ON(range >= ARRAY_SIZE(color_range_name)))
> + return "unknown";
> +
> + return color_range_name[range];
> +}
> +
> +/**
>   * drm_plane_create_color_properties - color encoding related plane 
> properties
>   * @plane: plane object
>   * @supported_encodings: bitfield indicating supported color encodings
> diff --git a/drivers/gpu/drm/drm_crtc_internal.h 
> b/drivers/gpu/drm/drm_crtc_internal.h
> index af00f42ba269..8ca2ffef6231 100644
> --- a/drivers/gpu/drm/drm_crtc_internal.h
> +++ b/drivers/gpu/drm/drm_crtc_internal.h
> @@ -71,6 +71,8 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
>   void *data, struct drm_file *file_priv);
>  
>  /* drm_color_mgmt.c */
> +const char *drm_get_color_encoding_name(enum drm_color_encoding encoding);
> +const char *drm_get_color_range_name(enum drm_color_range range);
>  
>  /* IOCTLs */
>  int drm_mode_gamma_get_ioctl(struct drm_device *dev,
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


RE: [PATCH v2 1/1] drm: add kernel doc for exported gem dmabuf_ops

2018-02-20 Thread Li, Samuel
> ./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or
> member 'attach' not described in 'drm_gem_unmap_dma_buf'
> ./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or
> member 'sgt' not described in 'drm_gem_unmap_dma_buf'
> ./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or
> member 'dir' not described in 'drm_gem_unmap_dma_buf'
...

Actually I tested. Those parameters are left out on purpose since they are 
empty functions so far.

Regards,
Samuel Li

> -Original Message-
> From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of Daniel
> Vetter
> Sent: Tuesday, February 20, 2018 10:13 AM
> To: Li, Samuel 
> Cc: Daniel Vetter ; Koenig, Christian
> ; amd-...@lists.freedesktop.org; dri-
> de...@lists.freedesktop.org
> Subject: Re: [PATCH v2 1/1] drm: add kernel doc for exported gem
> dmabuf_ops
> 
> On Tue, Jan 30, 2018 at 04:01:23PM +, Li, Samuel wrote:
> >
> > Alex helped push this into drm-tip,
> > https://cgit.freedesktop.org/drm/drm-
> tip/commit/drivers/gpu/drm?id=f7a
> > 71b0cf9e36c1b0edbfe89ce028a01164b864d
> >
> > Thanks,
> > Samuel Li
> >
> >
> > > -Original Message-
> > > From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of
> > > Daniel Vetter
> > > Sent: Tuesday, January 30, 2018 4:33 AM
> > > To: Koenig, Christian 
> > > Cc: Li, Samuel ; amd-...@lists.freedesktop.org;
> > > dri- de...@lists.freedesktop.org
> > > Subject: Re: [PATCH v2 1/1] drm: add kernel doc for exported gem
> > > dmabuf_ops
> > >
> > > On Fri, Jan 19, 2018 at 09:51:20AM +0100, Christian König wrote:
> > > > Am 18.01.2018 um 22:44 schrieb Samuel Li:
> > > > > Signed-off-by: Samuel Li 
> > > > > Reviewed-by: Daniel Vetter 
> > >
> > > Thanks for updating the docs.
> > > >
> > > > Reviewed-by: Christian König 
> > >
> > > I'm assuming you'll als push this one.
> 
> I just noticed that fairly obviously this wasn't tested when writing:
> 
> ./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or
> member 'attach' not described in 'drm_gem_unmap_dma_buf'
> ./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or
> member 'sgt' not described in 'drm_gem_unmap_dma_buf'
> ./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or
> member 'dir' not described in 'drm_gem_unmap_dma_buf'
> ./drivers/gpu/drm/drm_prime.c:438: warning: Function parameter or
> member 'dma_buf' not described in 'drm_gem_dmabuf_kmap_atomic'
> ./drivers/gpu/drm/drm_prime.c:438: warning: Function parameter or
> member 'page_num' not described in 'drm_gem_dmabuf_kmap_atomic'
> ./drivers/gpu/drm/drm_prime.c:450: warning: Function parameter or
> member 'dma_buf' not described in 'drm_gem_dmabuf_kunmap_atomic'
> ./drivers/gpu/drm/drm_prime.c:450: warning: Function parameter or
> member 'page_num' not described in 'drm_gem_dmabuf_kunmap_atomic'
> ./drivers/gpu/drm/drm_prime.c:450: warning: Function parameter or
> member 'addr' not described in 'drm_gem_dmabuf_kunmap_atomic'
> ./drivers/gpu/drm/drm_prime.c:461: warning: Function parameter or
> member 'dma_buf' not described in 'drm_gem_dmabuf_kmap'
> ./drivers/gpu/drm/drm_prime.c:461: warning: Function parameter or
> member 'page_num' not described in 'drm_gem_dmabuf_kmap'
> ./drivers/gpu/drm/drm_prime.c:473: warning: Function parameter or
> member 'dma_buf' not described in 'drm_gem_dmabuf_kunmap'
> ./drivers/gpu/drm/drm_prime.c:473: warning: Function parameter or
> member 'page_num' not described in 'drm_gem_dmabuf_kunmap'
> ./drivers/gpu/drm/drm_prime.c:473: warning: Function parameter or
> member 'addr' not described in 'drm_gem_dmabuf_kunmap'
> 
> Samuel, can you pls build docs using
> 
> $ make htmldocs
> 
> and fix up the fallout and submit a patch?
> 
> Thanks, Daniel
> 
> > > -Daniel
> > >
> > > >
> > > > > ---
> > > > >   drivers/gpu/drm/drm_prime.c | 88
> > > +
> > > > >   1 file changed, 88 insertions(+)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/drm_prime.c
> > > > > b/drivers/gpu/drm/drm_prime.c index ca09ce7..e82a976 100644
> > > > > --- a/drivers/gpu/drm/drm_prime.c
> > > > > +++ b/drivers/gpu/drm/drm_prime.c
> > > > > @@ -73,6 +73,9 @@
> > > > >* Drivers should detect this situation and return back the gem 
> > > > > object
> > > > >* from the dma-buf private.  Prime will do this automatically
> > > > > for drivers
> > > that
> > > > >* use the drm_gem_prime_{import,export} helpers.
> > > > > + *
> > > > > + * GEM struct _buf_ops symbols are now exported. They can
> > > > > + be resued by
> > > > > + * drivers which implement GEM interface.
> > > > >*/
> > > > >   struct drm_prime_member {
> > > > > @@ -180,6 +183,18 @@ static int
> > > > > drm_prime_lookup_buf_handle(struct
> > > drm_prime_file_private *prime_fpri
> > > > >   return -ENOENT;
> > > > 

Re: [RFC PATCH v2 1/6] dt-bindings: add bindings for USB physical connector

2018-02-20 Thread Rob Herring
On Tue, Feb 20, 2018 at 2:10 AM, Andrzej Hajda  wrote:
> On 19.02.2018 15:28, Rob Herring wrote:
>> On Thu, Feb 15, 2018 at 11:39:15AM +0100, Andrzej Hajda wrote:
>>> These bindings allow to describe most known standard USB connectors
>>> and it should be possible to extend it if necessary.
>>> USB connectors, beside USB can be used to route other protocols,
>>> for example UART, Audio, MHL. In such case every device passing data
>>> through the connector should have appropriate graph bindings.
>>>
>>> Signed-off-by: Andrzej Hajda 
>>> ---
>>> v3:
>>> - removed MHL port (samsung connector will have separate bindings),
>>> - added 2nd example for USB-C,
>>> - improved formatting
>>> v2:
>>> - moved connector type(A,B,C) to compatible string (Rob),
>>> - renamed size property to type (Rob),
>>> - changed type description to be less confusing (Laurent),
>>> - removed vendor specific compatibles (implied by graph port number),
>>> - added requirement of connector being a child of IC (Rob),
>>> - removed max-mode (subtly suggested by Rob, it should be detected anyway
>>>   by USB Controller in runtime, downside is that device is not able to
>>>   report its real capabilities, maybe better would be to make it 
>>> optional(?)),
>>> - assigned port numbers to data buses (Rob).
>>>
>>> Regards
>>> Andrzej
>>>
>>> Signed-off-by: Andrzej Hajda 
>>>
>>> dt-bindings: add bindings for USB physical connector v3
>>> ---
>>>  .../bindings/connector/usb-connector.txt   | 74 
>>> ++
>>>  1 file changed, 74 insertions(+)
>>>  create mode 100644 
>>> Documentation/devicetree/bindings/connector/usb-connector.txt
>>>
>>> diff --git a/Documentation/devicetree/bindings/connector/usb-connector.txt 
>>> b/Documentation/devicetree/bindings/connector/usb-connector.txt
>>> new file mode 100644
>>> index ..1efda92639da
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/connector/usb-connector.txt
>>> @@ -0,0 +1,74 @@
>>> +USB Connector
>>> +=
>>> +
>>> +USB connector node represents physical USB connector. It should be
>>> +a child of USB interface controller.
>>> +
>>> +Required properties:
>>> +- compatible: describes type of the connector, must be one of:
>>> +"usb-a-connector",
>>> +"usb-b-connector",
>>> +"usb-c-connector".
>>> +
>>> +Optional properties:
>>> +- label: symbolic name for the connector,
>>> +- type: size of the connector, should be specified in case of USB-A, USB-B
>>> +  non-standard (large) connector sizes: "mini", "micro".
>> The smaller connectors are standard too. Perhaps "non-fullsize connector
>> sizes".
>
> The word "standard" is used in specs, but your description looks better,
> maybe even shorter version would work: "non-fullsize connectors:".

Sure.

>> We're missing a micro-AB connector, but I think those are actually
>> pretty rare. Most phones are micro-B connectors, but do both host and
>> device.
>>
>>> +
>>> +Required nodes:
>>> +- any data bus to the connector should be modeled using the OF graph 
>>> bindings
>>> +  specified in bindings/graph.txt, unless the bus is between parent node 
>>> and
>>> +  the connector. Since single connector can have multpile data buses every 
>>> bus
>>> +  has assigned OF graph port number as follows:
>>> +0: High Speed (HS), present in all connectors,
>>> +1: Super Speed (SS), present in SS capable connectors,
>> This should also say endpoint 0 is USB-SS, endpoint 1 (and higher?) is
>> Alternate Mode. And show in the example.
>
> What if there is SS mux before, which muxes USB-SS and DP lines. In my
> case the mux is located in USB-PHY (it is 2nd example below).
> In such case there is only one graph connection to SS port and this
> connection will handle both USB-SS and AltMode traffic.

Ah yes, good point.

> Anyway from USB-C connector's point of view, there is no distinction
> which lines are USB-SS, which are AltMode. In fact platform decides in
> real time about muxing of SS and AltMode signals, as it depends on
> cable/plug orientations. Maybe instead of mapping endpoint numbers to
> SS/AltMode, we should map them to SS1/SS2 lines if necessary(???).
>
> To be sure of your intentions. Do you want to model simple SS muxes as a
> part of USB-C connector?

That was, but you are right. That should be part of whatever device
does the muxing.

Given you need a uC just to manage the USB-C connector, I'd guess
there isn't any simple case like just a GPIO to control a mux.

>
>>> +2: Sideband use (SBU), present in USB-C.
>>> +
>>> +Examples
>>> +
>>> +
>>> +1. Micro-USB connector with HS lines routed via controller (MUIC):
>>> +
>>> +muic-max77843@66 {
>>> +...
>>> +usb_con: connector {
>>> +compatible = "usb-b-connector";
>>> +label = "micro-USB";
>>> +type = "micro";
>>> +};
>>> +};
>>> +
>>> +2. USB-C connector attached to CC controller (s2mm005), HS lines 

Re: [PATCH 1/4] locking/ww_mutex: add ww_mutex_is_owned_by function v3

2018-02-20 Thread Peter Zijlstra
On Tue, Feb 20, 2018 at 04:05:49PM +0100, Christian König wrote:
> Am 20.02.2018 um 15:54 schrieb Peter Zijlstra:
> > On Tue, Feb 20, 2018 at 03:34:07PM +0100, Christian König wrote:
> > > > OK, but neither case would in fact need the !ctx case right? That's just
> > > > there for completeness sake?
> > > Unfortunately not. TTM uses trylock to lock BOs which are about to be
> > > evicted to make room for all the BOs locked with a ctx.
> > > 
> > > I need to be able to distinct between the BOs which are trylocked and 
> > > those
> > > which are locked with a ctx.
> > > 
> > > Writing this I actually noticed the current version is buggy, cause even
> > > when we check the mutex owner we still need to make sure that the ctx in 
> > > the
> > > lock is NULL.
> > Hurm... I can't remember why trylocks behave like that, and it seems
> > rather unfortunate / inconsistent.
> 
> Actually for me that is rather fortunate, cause I need to distinct between
> the locks acquired through trylock and lock.

I suppose that would always be possible using:
ww_mutex_trylock(.ctx=NULL), and it could be that there simply weren't
any immediate uses for a !NULL trylock and it was thus not implemented.

But that is all very long ago..

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


[radeon-alex:amd-staging-drm-next 85/454] sound/soc/amd/raven/acp3x.h:28:9: error: implicit declaration of function 'readl'; did you mean 'vread'?

2018-02-20 Thread kbuild test robot
Hi Maruthi,

FYI, the error/warning still remains.

tree:   git://people.freedesktop.org/~agd5f/linux.git amd-staging-drm-next
head:   2d50a98412776a138c305968e0d04b924d27d5a8
commit: 4ab7d004f9ff2e877caa267887360e1804b4edcf [85/454] ASoC: AMD: enable 
ACP3x drivers build
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 4ab7d004f9ff2e877caa267887360e1804b4edcf
# save the attached .config to linux build tree
make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   In file included from sound/soc/amd/raven/acp3x-pcm-dma.c:26:0:
   sound/soc/amd/raven/acp3x.h: In function 'rv_readl':
>> sound/soc/amd/raven/acp3x.h:28:9: error: implicit declaration of function 
>> 'readl'; did you mean 'vread'? [-Werror=implicit-function-declaration]
 return readl(base_addr - ACP3x_PHY_BASE_ADDRESS);
^
vread
   sound/soc/amd/raven/acp3x.h: In function 'rv_writel':
>> sound/soc/amd/raven/acp3x.h:33:2: error: implicit declaration of function 
>> 'writel'; did you mean 'vwrite'? [-Werror=implicit-function-declaration]
 writel(val, base_addr - ACP3x_PHY_BASE_ADDRESS);
 ^~
 vwrite
   sound/soc/amd/raven/acp3x-pcm-dma.c: In function 'acp3x_audio_probe':
   sound/soc/amd/raven/acp3x-pcm-dma.c:638:22: error: implicit declaration of 
function 'devm_ioremap'; did you mean 'devm_kmemdup'? 
[-Werror=implicit-function-declaration]
 adata->acp3x_base = devm_ioremap(>dev, res->start,
 ^~~~
 devm_kmemdup
   sound/soc/amd/raven/acp3x-pcm-dma.c:638:20: warning: assignment makes 
pointer from integer without a cast [-Wint-conversion]
 adata->acp3x_base = devm_ioremap(>dev, res->start,
   ^
   cc1: some warnings being treated as errors

vim +28 sound/soc/amd/raven/acp3x.h

56521728 Maruthi Srinivas Bayyavarapu 2017-03-27  25  
56521728 Maruthi Srinivas Bayyavarapu 2017-03-27  26  static inline u32 
rv_readl(void __iomem *base_addr)
56521728 Maruthi Srinivas Bayyavarapu 2017-03-27  27  {
56521728 Maruthi Srinivas Bayyavarapu 2017-03-27 @28return readl(base_addr 
- ACP3x_PHY_BASE_ADDRESS);
56521728 Maruthi Srinivas Bayyavarapu 2017-03-27  29  }
56521728 Maruthi Srinivas Bayyavarapu 2017-03-27  30  
56521728 Maruthi Srinivas Bayyavarapu 2017-03-27  31  static inline void 
rv_writel(u32 val, void __iomem *base_addr)
56521728 Maruthi Srinivas Bayyavarapu 2017-03-27  32  {
56521728 Maruthi Srinivas Bayyavarapu 2017-03-27 @33writel(val, base_addr - 
ACP3x_PHY_BASE_ADDRESS);

:: The code at line 28 was first introduced by commit
:: 5652172846eb1a9cc251e5b9341e70c15357b02a ASoC: AMD: add ACP3.0 PCI driver

:: TO: Maruthi Srinivas Bayyavarapu 
:: CC: Alex Deucher 

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


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


Re: [PATCH v2 1/1] drm: add kernel doc for exported gem dmabuf_ops

2018-02-20 Thread Daniel Vetter
On Tue, Jan 30, 2018 at 04:01:23PM +, Li, Samuel wrote:
> 
> Alex helped push this into drm-tip,
> https://cgit.freedesktop.org/drm/drm-tip/commit/drivers/gpu/drm?id=f7a71b0cf9e36c1b0edbfe89ce028a01164b864d
> 
> Thanks,
> Samuel Li
> 
> 
> > -Original Message-
> > From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of Daniel
> > Vetter
> > Sent: Tuesday, January 30, 2018 4:33 AM
> > To: Koenig, Christian 
> > Cc: Li, Samuel ; amd-...@lists.freedesktop.org; dri-
> > de...@lists.freedesktop.org
> > Subject: Re: [PATCH v2 1/1] drm: add kernel doc for exported gem
> > dmabuf_ops
> > 
> > On Fri, Jan 19, 2018 at 09:51:20AM +0100, Christian König wrote:
> > > Am 18.01.2018 um 22:44 schrieb Samuel Li:
> > > > Signed-off-by: Samuel Li 
> > > > Reviewed-by: Daniel Vetter 
> > 
> > Thanks for updating the docs.
> > >
> > > Reviewed-by: Christian König 
> > 
> > I'm assuming you'll als push this one.

I just noticed that fairly obviously this wasn't tested when writing:

./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or member 
'attach' not described in 'drm_gem_unmap_dma_buf' 
./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or member 'sgt' 
not described in 'drm_gem_unmap_dma_buf'
./drivers/gpu/drm/drm_prime.c:342: warning: Function parameter or member 'dir' 
not described in 'drm_gem_unmap_dma_buf'
./drivers/gpu/drm/drm_prime.c:438: warning: Function parameter or member 
'dma_buf' not described in 'drm_gem_dmabuf_kmap_atomic'
./drivers/gpu/drm/drm_prime.c:438: warning: Function parameter or member 
'page_num' not described in 'drm_gem_dmabuf_kmap_atomic'
./drivers/gpu/drm/drm_prime.c:450: warning: Function parameter or member 
'dma_buf' not described in 'drm_gem_dmabuf_kunmap_atomic'
./drivers/gpu/drm/drm_prime.c:450: warning: Function parameter or member 
'page_num' not described in 'drm_gem_dmabuf_kunmap_atomic'
./drivers/gpu/drm/drm_prime.c:450: warning: Function parameter or member 'addr' 
not described in 'drm_gem_dmabuf_kunmap_atomic'
./drivers/gpu/drm/drm_prime.c:461: warning: Function parameter or member 
'dma_buf' not described in 'drm_gem_dmabuf_kmap'
./drivers/gpu/drm/drm_prime.c:461: warning: Function parameter or member 
'page_num' not described in 'drm_gem_dmabuf_kmap'
./drivers/gpu/drm/drm_prime.c:473: warning: Function parameter or member 
'dma_buf' not described in 'drm_gem_dmabuf_kunmap'
./drivers/gpu/drm/drm_prime.c:473: warning: Function parameter or member 
'page_num' not described in 'drm_gem_dmabuf_kunmap'
./drivers/gpu/drm/drm_prime.c:473: warning: Function parameter or member 'addr' 
not described in 'drm_gem_dmabuf_kunmap'

Samuel, can you pls build docs using

$ make htmldocs

and fix up the fallout and submit a patch?

Thanks, Daniel

> > -Daniel
> > 
> > >
> > > > ---
> > > >   drivers/gpu/drm/drm_prime.c | 88
> > +
> > > >   1 file changed, 88 insertions(+)
> > > >
> > > > diff --git a/drivers/gpu/drm/drm_prime.c
> > > > b/drivers/gpu/drm/drm_prime.c index ca09ce7..e82a976 100644
> > > > --- a/drivers/gpu/drm/drm_prime.c
> > > > +++ b/drivers/gpu/drm/drm_prime.c
> > > > @@ -73,6 +73,9 @@
> > > >* Drivers should detect this situation and return back the gem object
> > > >* from the dma-buf private.  Prime will do this automatically for 
> > > > drivers
> > that
> > > >* use the drm_gem_prime_{import,export} helpers.
> > > > + *
> > > > + * GEM struct _buf_ops symbols are now exported. They can be
> > > > + resued by
> > > > + * drivers which implement GEM interface.
> > > >*/
> > > >   struct drm_prime_member {
> > > > @@ -180,6 +183,18 @@ static int drm_prime_lookup_buf_handle(struct
> > drm_prime_file_private *prime_fpri
> > > > return -ENOENT;
> > > >   }
> > > > +/**
> > > > + * drm_gem_map_attach - dma_buf attach implementation for GEM
> > > > + * @dma_buf: buffer to attach device to
> > > > + * @target_dev: not used
> > > > + * @attach: buffer attachment data
> > > > + *
> > > > + * Allocates _prime_attachment and calls
> > > > +_driver.gem_prime_pin for
> > > > + * device specific attachment. This can be used as the
> > > > +_buf_ops.attach
> > > > + * callback.
> > > > + *
> > > > + * Returns 0 on success, negative error code on failure.
> > > > + */
> > > >   int drm_gem_map_attach(struct dma_buf *dma_buf, struct device
> > *target_dev,
> > > >struct dma_buf_attachment *attach)
> > > >   {
> > > > @@ -201,6 +216,14 @@ int drm_gem_map_attach(struct dma_buf
> > *dma_buf, struct device *target_dev,
> > > >   }
> > > >   EXPORT_SYMBOL(drm_gem_map_attach);
> > > > +/**
> > > > + * drm_gem_map_detach - dma_buf detach implementation for GEM
> > > > + * @dma_buf: buffer to detach from
> > > > + * @attach: attachment to be detached
> > > > + *
> > > > + * Cleans up _buf_attachment. This can be used as the
> > > > 

Re: [PATCH libdrm] configure.ac: pthread-stubs not present on OpenBSD

2018-02-20 Thread Eric Engestrom
On Tuesday, 2018-02-20 15:02:26 +, Emil Velikov wrote:
> On 20 February 2018 at 10:21, Eric Engestrom  
> wrote:
> > On Tuesday, 2018-02-20 17:09:14 +1100, Jonathan Gray wrote:
> >> pthread-stubs is no longer required on OpenBSD and has been removed.
> >> libpthread parts involved moved to libc.
> >
> > Great news!
> > Reviewed-by: Eric Engestrom 
> >
> > Note that meson needs the same change:
> > 8<
> > diff --git a/meson.build b/meson.build
> > index d600a906948c0e680885..bd00cdc2cae9f0749180 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -35,8 +35,7 @@ with_install_tests = get_option('install-test-programs')
> >
> >  config = configuration_data()
> >
> > -# TODO: openbsd is guess, the others are correct
> > -if ['freebsd', 'dragonfly', 'netbsd', 
> > 'openbsd'].contains(host_machine.system())
> > +if ['freebsd', 'dragonfly', 'netbsd'].contains(host_machine.system())
> >dep_pthread_stubs = dependency('pthread-stubs', version : '>= 0.4')
> >  else
> >dep_pthread_stubs = []
> > >8
> >
> > Do you have commit access, or do you want me to push this for you?
> > No need to send a v2, I'll add the meson bit when I push it, or you can
> > add it if you push it yourself.
> >
> Both patches from Jon + the meson amendment are
> Reviewed-by: Emil Velikov 

... and pushed both, thanks :)

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


Re: [PATCH v3 1/8] drm/blend: Add a generic alpha property

2018-02-20 Thread Stefan Schake
On Fri, Feb 16, 2018 at 7:20 PM, Ville Syrjälä
 wrote:
> On Fri, Feb 16, 2018 at 06:39:29PM +0100, Maxime Ripard wrote:
>> Some drivers duplicate the logic to create a property to store a per-plane
>> alpha.
>>
>> This is especially useful if we ever want to support extra protocols for
>> Wayland like:
>> https://lists.freedesktop.org/archives/wayland-devel/2017-August/034741.html
>>
>> Let's create a helper in order to move that to the core.
>>
>> Cc: Laurent Pinchart 
>> Reviewed-by: Boris Brezillon 
>> Signed-off-by: Maxime Ripard 
>> ---
>>  Documentation/gpu/kms-properties.csv |  2 +-
>>  drivers/gpu/drm/drm_atomic.c |  4 -
>>  drivers/gpu/drm/drm_atomic_helper.c  |  4 -
>>  drivers/gpu/drm/drm_blend.c  | 32 +-
>>  include/drm/drm_blend.h  |  1 +-
>>  include/drm/drm_plane.h  |  6 +-
>>  6 files changed, 48 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/gpu/kms-properties.csv 
>> b/Documentation/gpu/kms-properties.csv
>> index 927b65e14219..25ad3503d663 100644
>> --- a/Documentation/gpu/kms-properties.csv
>> +++ b/Documentation/gpu/kms-properties.csv
>> @@ -99,5 +99,5 @@ radeon,DVI-I,“coherent”,RANGE,"Min=0, Max=1",Connector,TBD
>>  ,,"""underscan vborder""",RANGE,"Min=0, Max=128",Connector,TBD
>>  ,Audio,“audio”,ENUM,"{ ""off"", ""on"", ""auto"" }",Connector,TBD
>>  ,FMT Dithering,“dither”,ENUM,"{ ""off"", ""on"" }",Connector,TBD
>> -rcar-du,Generic,"""alpha""",RANGE,"Min=0, Max=255",Plane,TBD
>> +,,"""alpha""",RANGE,"Min=0, Max=Driver dependant",Plane,Opacity of the 
>> plane from transparent (0) to fully opaque (MAX). If this property is set to 
>> a value different than max, and that the pixel will define an alpha 
>> component, the property will have precendance and the pixel value will be 
>> ignored.
>
> Those semantics don't seem particularly good to me. I think we would want the
> per-pixel alpha and global alpha both to be effecive at the same time. You can
> always decide to ignore the per-pixel alpha by using a pixel format without
> alpha.
>
> Also, where's the userspace that wants this feature?

drm_hwcomposer uses an 8-bit per-plane alpha property, and from what I
can tell the semantics are that both pixel and plane alpha apply
simultaneously if present.
Here is what I think was the kernel-side for this:

https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/306122

I've added Sean Paul, he might be able to give a more definitive answer.

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


Re: [PATCH] locking/ww_mutex: add ww_mutex_is_owned_by function v4

2018-02-20 Thread Eric Engestrom
On Tuesday, 2018-02-20 15:49:46 +0100, Christian König wrote:
> amdgpu needs to verify if userspace sends us valid addresses and the simplest
> way of doing this is to check if the buffer object is locked with the ticket
> of the current submission.
> 
> Clean up the access to the ww_mutex internals by providing a function
> for this and extend the check to the thread owning the underlying mutex.
> 
> v2: split amdgpu changes into separate patch as suggested by Alex
> v3: change logic as suggested by Daniel
> v4: fix test in case ctx is NULL
> 
> Signed-off-by: Christian König 
> ---
>  include/linux/ww_mutex.h | 19 +++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h
> index 39fda195bf78..fea4acc0bcbc 100644
> --- a/include/linux/ww_mutex.h
> +++ b/include/linux/ww_mutex.h
> @@ -358,4 +358,23 @@ static inline bool ww_mutex_is_locked(struct ww_mutex 
> *lock)
>   return mutex_is_locked(>base);
>  }
>  
> +/**
> + * ww_mutex_is_owned_by - is the w/w mutex locked by this task in that 
> context
> + * @lock: the mutex to be queried
> + * @ctx: the w/w acquire context to test
> + *
> + * If @ctx is not NULL test if the mutex is owned by this context.
> + * If @ctx is NULL test if the mutex is owned by the current thread and not
> + * locked in any context.
> + */
> +static inline bool ww_mutex_is_owned_by(struct ww_mutex *lock,
> + struct ww_acquire_ctx *ctx)
> +{
> + if (ctx)
> + return likely(READ_ONCE(lock->ctx) == ctx);
> +
> + return likely(__mutex_owner(>base) == current) &&
> + likely(READ_ONCE(lock->ctx) == NULL;
typo:)

> +}
> +
>  #endif
> -- 
> 2.14.1
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [RFC PULL] Add Display Support for Qualcomm SDM845

2018-02-20 Thread Rob Clark
On Wed, Feb 14, 2018 at 2:08 PM, Rob Clark  wrote:
> On Wed, Feb 14, 2018 at 1:17 PM, jsanka  wrote:
>> On 2/13/2018 12:00 PM, Rob Clark wrote:
>>>
>>>   - It looks like, as was the case with mdp4/mdp5 (and really most other
>>> hw)
>>> there are still unequal capabilities for planes (ie. some can do YUV,
>>> scaling, etc).
>>>
>>> But drm-hwc (or weston) isn't going to know about that, so I think
>>> we'll
>>> need to add support for dynamically assigning dpu_plane::pipe, similar
>>> to what mdp5 does w/ plane<->hwpipe.  (Which I actually added
>>> specifically
>>> for drm-hwc ;-))
>>
>> We are working on plane virtualization focused primarily to support 4K /
>> wider displays which cannot
>> be catered by one hwpipe. The plan is to gang up two *fixed* hwpipes of
>> similar capabilities (in terms of formats,
>> sub hw blocks like scalar, post processing ) and expose them as a single
>> plane so that user space
>> compositor ( drm-hwc or weston) need not worry about max pixel width
>> supported by the planes. But mapping
>> planes <-> hwpipe dynamically may need more than just virtualization. Kernel
>> need to keep track of hwpipes
>> especially when dealing with multiple displays. And it get complicated when
>> planes start moving around CRTC's
>> for different sized buffers.
>
> Hmm, a fixed mapping of hw pipe to plane might be an ok stepping
> stone.  I'm not sure it is a terribly good final solution, esp. when
> it comes to external displays, since you may never need 4k+ scanout,
> depending on what the user plugs in, so you end up wasting a lot of hw
> pipes.
>
> Keeping track of the hwpipes as part of the driver global atomic state
> isn't actually *that* hard.  Have a look at what mdp5 does.  We still
> need to move mdp5 to drm_private_obj instead of subclassing
> drm_atomic_state (see Archit's RFC, "drm/msm/mdp5: Add global state as
> a private atomic object"), but other than that detail, I think
> something along those lines is a better approach.
>

One additional point that I thought about, while implementing
writeback on mdp5.. I think with a cmd-mode panel (and dp psr?) we
could re-use idle hwpipes (ie. while not pushing an update out to the
panel) with a different crtc (LM) and writeback connector to flatten
all the layers to a single buffer while the screen is static, without
having to remove the drm planes from the crtc.  I think that would be
a lot less confusing than figuring out somehow that removing a plane
from a crtc shouldn't be flushed out to the panel.

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


Re: [PATCH 1/4] locking/ww_mutex: add ww_mutex_is_owned_by function v3

2018-02-20 Thread Christian König

Am 20.02.2018 um 15:54 schrieb Peter Zijlstra:

On Tue, Feb 20, 2018 at 03:34:07PM +0100, Christian König wrote:

OK, but neither case would in fact need the !ctx case right? That's just
there for completeness sake?

Unfortunately not. TTM uses trylock to lock BOs which are about to be
evicted to make room for all the BOs locked with a ctx.

I need to be able to distinct between the BOs which are trylocked and those
which are locked with a ctx.

Writing this I actually noticed the current version is buggy, cause even
when we check the mutex owner we still need to make sure that the ctx in the
lock is NULL.

Hurm... I can't remember why trylocks behave like that, and it seems
rather unfortunate / inconsistent.


Actually for me that is rather fortunate, cause I need to distinct 
between the locks acquired through trylock and lock.


In other words when the amdgpu does it's checking if userspace sends 
nonsense to the kernel it should only get a green signal when the lock 
was intentionally locked using the context.


If the lock was just taken because TTM trylocked it because TTM had to 
evict the BO to make room then the check should fail and we need to tell 
userspace that it did something wrong.


Regards,
Christian.


Chris, Maarten, do either one of you remember?

I'm thinking that if we do acquire the trylock, the thing should join
the ctx such that a subsequent contending mutex_lock() can ww right.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCH RFC] drm/bridge: panel: Add module_get/but calls to attached panel driver

2018-02-20 Thread Jyri Sarha
On 20/02/18 14:03, Thierry Reding wrote:
> On Tue, Feb 20, 2018 at 01:28:48PM +0200, Jyri Sarha wrote:
>> On 20/02/18 12:34, Thierry Reding wrote:
>>> On Mon, Feb 19, 2018 at 11:59:23PM +0100, Daniel Vetter wrote:
 On Mon, Feb 19, 2018 at 10:06:22PM +0200, Jyri Sarha wrote:
> Currently there is no way for a master drm driver to protect against an
> attached panel driver from being unloaded while it is in use. The
> least we can do is to indicate the usage by incrementing the module
> reference count.
>
> Signed-off-by: Jyri Sarha 
> cc: e...@anholt.net
> cc: laurent.pinch...@ideasonboard.com
> ---
> I do not see any module_get/put code in drm core. Is there is a reason
> for that?
>
> There is two more alternative places for adding the module_get/put
> code. One is puting it directly to drm_panel_attach() and
> drm_panel_detach(). However, if the same module implements both the
> master drm driver and the panel (like tilcdc does with its
> tilcdc_panel.c), then attaching the panel will lock the module in for
> no good reason. Still, this solution should work with drm bridges as I
> do not see any reason why anybody would implement bridge drivers in
> the same module with the master drm driver.
>
> The other place to put the code would in the master drm driver. But
> for handling the situation with bridges would need the device pointer
> in struct drm_bridge.

 I think this looks like a reasonable place to do this. Looking at the code
 we seem to have a similar issue with the bridge driver itself. I think
 we need to wire through the module owner stuff and add a try_modeul_get to
 of_drm_find_bridge (and any other helper used to find bridge instances).
>>>
>>> I disagree. module_get() is only going to protect you from unloading a
>>> module that's in use, but there are other ways to unbind a driver from
>>> the device and cause subsequent mayhem.
>>>
>>
>> Yes. This is not a full fix for the issue. But AFAIK at the moment there
>> is no infrastructure to tear down the whole drm device grace fully when
>> a bridge driver or panel is removed. So this should be considered as a
>> partial remedy protecting user from accidentally crashing the drm driver
>> by unloading the wrong module first. That is why I wrote "least we can do".
>>
>>> struct device_link was "recently" introduced to fix that issue.
>>>
>>
>> Unfortunately I do not have time to do full fix for the issue, but in
>> any case I think this patch is a step to the right direction. The module
>> reference count should anyway be increased at least to know that the
>> driver code remains in memory, even if the device is not there any more.
>>
>> Then again the display panels or bridges are hardly ever hot pluggable
>> devices, so they do not normally vanish just like that, unless someone
>> is being nasty and forcibly unbinding them. But yes, I know that is a
>> bad excuse for broken behaviour.
> 
> I think device links are actually a lot easier to use and give you a
> full solution for this. Essentially the only thing you need to do is add
> a call to device_link_add() in the correct place.
> 
> That said, it seems to me like drm_panel_bridge_add() is not a good
> place to add this, because the panel/bridge does not follow a typical
> consumer/supplier model. It is rather a helper construct with a well-
> defined lifetime.
> 
> What you do want to protect is the panel (the "parent" of the panel/
> bridge) from going away unexpectedly. I think the best way to achieve
> that is to make the link in drm_panel_attach() with something like
> this:
> 
>   u32 flags = DL_FLAG_PM_RUNTIME | DL_FLAG_AUTOREMOVE;
>   struct device *consumer = connector->dev->dev;
> 
>   link = device_link_add(consumer, panel->dev, flags);
>   if (!link) {
>   dev_err(panel->dev, "failed to link panel %s to %s\n",
>   dev_name(panel->dev), dev_name(consumer));
>   return -EINVAL;
>   }
> 
> Ideally I think we'd link the panel to the connector rather than the
> top-level DRM device, but we don't have a struct device * for that, so
> this is probably as good as it gets for now.
> 

Thanks for the hint. Adding the link indeed unbinds the master drm
device when the panel is unloaded without any complaints.

The annoying thing is that the master drm device does not probe again
and bind when the supplier device becomes available again. However,
forcing a manual bind brings the whole device back without a problem.

Is there any trivial way to fix this?

Best regards,
Jyri

> You might get away without the DL_FLAG_PM_RUNTIME because DRM should
> handle that properly already.

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
___
dri-devel mailing list

Re: [PATCH libdrm] configure.ac: pthread-stubs not present on OpenBSD

2018-02-20 Thread Emil Velikov
On 20 February 2018 at 10:21, Eric Engestrom  wrote:
> On Tuesday, 2018-02-20 17:09:14 +1100, Jonathan Gray wrote:
>> pthread-stubs is no longer required on OpenBSD and has been removed.
>> libpthread parts involved moved to libc.
>
> Great news!
> Reviewed-by: Eric Engestrom 
>
> Note that meson needs the same change:
> 8<
> diff --git a/meson.build b/meson.build
> index d600a906948c0e680885..bd00cdc2cae9f0749180 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -35,8 +35,7 @@ with_install_tests = get_option('install-test-programs')
>
>  config = configuration_data()
>
> -# TODO: openbsd is guess, the others are correct
> -if ['freebsd', 'dragonfly', 'netbsd', 
> 'openbsd'].contains(host_machine.system())
> +if ['freebsd', 'dragonfly', 'netbsd'].contains(host_machine.system())
>dep_pthread_stubs = dependency('pthread-stubs', version : '>= 0.4')
>  else
>dep_pthread_stubs = []
> >8
>
> Do you have commit access, or do you want me to push this for you?
> No need to send a v2, I'll add the meson bit when I push it, or you can
> add it if you push it yourself.
>
Both patches from Jon + the meson amendment are
Reviewed-by: Emil Velikov 

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


Re: [PATCH 1/4] locking/ww_mutex: add ww_mutex_is_owned_by function v3

2018-02-20 Thread Peter Zijlstra
On Tue, Feb 20, 2018 at 03:34:07PM +0100, Christian König wrote:
> > OK, but neither case would in fact need the !ctx case right? That's just
> > there for completeness sake?
> 
> Unfortunately not. TTM uses trylock to lock BOs which are about to be
> evicted to make room for all the BOs locked with a ctx.
> 
> I need to be able to distinct between the BOs which are trylocked and those
> which are locked with a ctx.
> 
> Writing this I actually noticed the current version is buggy, cause even
> when we check the mutex owner we still need to make sure that the ctx in the
> lock is NULL.

Hurm... I can't remember why trylocks behave like that, and it seems
rather unfortunate / inconsistent.

Chris, Maarten, do either one of you remember?

I'm thinking that if we do acquire the trylock, the thing should join
the ctx such that a subsequent contending mutex_lock() can ww right.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/msm/dpu: Remove unused code and move the header

2018-02-20 Thread Rob Clark
On Thu, Feb 15, 2018 at 3:45 PM, Jordan Crouse  wrote:
> Remove unused code from dpu_io_util.c.  The functions are only
> used inside of the msm driver so remove the EXPORT_SYMBOL
> tags and move the header dpu_io_util.h from include/linux.
>
> Signed-off-by: Jordan Crouse 

Thanks,

Reviewed-by: Rob Clark 

> ---
>  drivers/gpu/drm/msm/dp/dp_parser.h |   2 +-
>  drivers/gpu/drm/msm/dpu_io_util.c  | 154 
> ++---
>  .../linux => drivers/gpu/drm/msm}/dpu_io_util.h|  10 --
>  drivers/gpu/drm/msm/dpu_power_handle.c |   1 -
>  drivers/gpu/drm/msm/dpu_power_handle.h |   2 +-
>  drivers/gpu/drm/msm/dpu_rsc_priv.h |   1 -
>  drivers/gpu/drm/msm/msm_drv.h  |   1 -
>  7 files changed, 14 insertions(+), 157 deletions(-)
>  rename {include/linux => drivers/gpu/drm/msm}/dpu_io_util.h (86%)
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h 
> b/drivers/gpu/drm/msm/dp/dp_parser.h
> index a9cfd03fa5ed..703acb010c8b 100644
> --- a/drivers/gpu/drm/msm/dp/dp_parser.h
> +++ b/drivers/gpu/drm/msm/dp/dp_parser.h
> @@ -15,7 +15,7 @@
>  #ifndef _DP_PARSER_H_
>  #define _DP_PARSER_H_
>
> -#include 
> +#include "dpu_io_util.h"
>
>  #define DP_LABEL "MDSS DP DISPLAY"
>  #define AUX_CFG_LEN10
> diff --git a/drivers/gpu/drm/msm/dpu_io_util.c 
> b/drivers/gpu/drm/msm/dpu_io_util.c
> index a18bc992c136..f39ae38e4cfa 100644
> --- a/drivers/gpu/drm/msm/dpu_io_util.c
> +++ b/drivers/gpu/drm/msm/dpu_io_util.c
> @@ -16,9 +16,9 @@
>  #include 
>  #include 
>  #include 
> -#include 
>
> -#define MAX_I2C_CMDS  16
> +#include "dpu_io_util.h"
> +
>  void dss_reg_w(struct dss_io_data *io, u32 offset, u32 value, u32 debug)
>  {
> u32 in_val;
> @@ -42,8 +42,7 @@ void dss_reg_w(struct dss_io_data *io, u32 offset, u32 
> value, u32 debug)
> (u32)(unsigned long)(io->base + offset),
> value, in_val);
> }
> -} /* dss_reg_w */
> -EXPORT_SYMBOL(dss_reg_w);
> +}
>
>  u32 dss_reg_r(struct dss_io_data *io, u32 offset, u32 debug)
>  {
> @@ -67,30 +66,7 @@ u32 dss_reg_r(struct dss_io_data *io, u32 offset, u32 
> debug)
> (u32)(unsigned long)(io->base + offset), value);
>
> return value;
> -} /* dss_reg_r */
> -EXPORT_SYMBOL(dss_reg_r);
> -
> -void dss_reg_dump(void __iomem *base, u32 length, const char *prefix,
> -   u32 debug)
> -{
> -   if (debug)
> -   print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_OFFSET, 32, 4,
> -   (void *)base, length, false);
> -} /* dss_reg_dump */
> -EXPORT_SYMBOL(dss_reg_dump);
> -
> -static struct resource *msm_dss_get_res_byname(struct platform_device *pdev,
> -   unsigned int type, const char *name)
> -{
> -   struct resource *res = NULL;
> -
> -   res = platform_get_resource_byname(pdev, type, name);
> -   if (!res)
> -   DEV_ERR("%s: '%s' resource not found\n", __func__, name);
> -
> -   return res;
> -} /* msm_dss_get_res_byname */
> -EXPORT_SYMBOL(msm_dss_get_res_byname);
> +}
>
>  int msm_dss_ioremap_byname(struct platform_device *pdev,
> struct dss_io_data *io_data, const char *name)
> @@ -103,7 +79,7 @@ int msm_dss_ioremap_byname(struct platform_device *pdev,
> return -EINVAL;
> }
>
> -   res = msm_dss_get_res_byname(pdev, IORESOURCE_MEM, name);
> +   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name);
> if (!res) {
> DEV_ERR("%pS->%s: '%s' msm_dss_get_res_byname failed\n",
> __builtin_return_address(0), __func__, name);
> @@ -119,8 +95,7 @@ int msm_dss_ioremap_byname(struct platform_device *pdev,
> }
>
> return 0;
> -} /* msm_dss_ioremap_byname */
> -EXPORT_SYMBOL(msm_dss_ioremap_byname);
> +}
>
>  void msm_dss_iounmap(struct dss_io_data *io_data)
>  {
> @@ -135,8 +110,7 @@ void msm_dss_iounmap(struct dss_io_data *io_data)
> io_data->base = NULL;
> }
> io_data->len = 0;
> -} /* msm_dss_iounmap */
> -EXPORT_SYMBOL(msm_dss_iounmap);
> +}
>
>  int msm_dss_config_vreg(struct device *dev, struct dss_vreg *in_vreg,
> int num_vreg, int config)
> @@ -211,8 +185,7 @@ if (type == DSS_REG_LDO)
> goto vreg_unconfig;
> }
> return rc;
> -} /* msm_dss_config_vreg */
> -EXPORT_SYMBOL(msm_dss_config_vreg);
> +}
>
>  int msm_dss_enable_vreg(struct dss_vreg *in_vreg, int num_vreg, int enable)
>  {
> @@ -283,48 +256,7 @@ int msm_dss_enable_vreg(struct dss_vreg *in_vreg, int 
> num_vreg, int enable)
> }
>
> return rc;
> -} /* msm_dss_enable_vreg */
> -EXPORT_SYMBOL(msm_dss_enable_vreg);
> -
> -int msm_dss_enable_gpio(struct dss_gpio *in_gpio, int num_gpio, int enable)
> -{
> -   int i = 0, rc = 0;
> -
> -   if (enable) {
> -   for (i = 0; i < num_gpio; i++) {
> - 

  1   2   >