[Bug 196635] amdgpu clinfo hangs with SI

2017-08-15 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=196635

--- Comment #9 from Janpieter Sollie (janpieter.sol...@dommel.be) ---
I just browsed through a few howtos:
It won't be easy to point to the problem: in 4.10, it hit a triple fault and
then crashed with dpm enabled. do you want a bisection from that one(see
194899) to the current status or do I need to do something else?

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


linux-next: build failure after merge of the akpm-current tree

2017-08-15 Thread Stephen Rothwell
Hi all,

After merging the akpm-current tree, today's linux-next build (x86_64
allmodconfig) failed like this:

drivers/gpu/drm/i915/i915_gem_execbuffer.c: In function 'get_fence_array':
drivers/gpu/drm/i915/i915_gem_execbuffer.c:2163:20: error: 'GFP_TEMPORARY' 
undeclared (first use in this function)
 __GFP_NOWARN | GFP_TEMPORARY);
^

Caused by commit

  4d6fc0a48c52 ("mm: treewide: remove GFP_TEMPORARY allocation flag")

interacting with commit

  cf6e7bac6357 ("drm/i915: Add support for drm syncobjs")

from the drm-intel tree.

I applied the following merge fix patch (and I suspect - given the
comments in the former commit message - that this could be applied to
the drm-intel tree right now without any problems):

From: Stephen Rothwell 
Date: Wed, 16 Aug 2017 14:41:24 +1000
Subject: [PATCH] drm/i915: fix up for mm: treewide: remove GFP_TEMPORARY 
allocation flag

Signed-off-by: Stephen Rothwell 
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c 
b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 8fbdefe0216e..15ab3e6792f9 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -2160,7 +2160,7 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args,
return ERR_PTR(-EFAULT);
 
fences = kvmalloc_array(args->num_cliprects, sizeof(*fences),
-   __GFP_NOWARN | GFP_TEMPORARY);
+   __GFP_NOWARN | GFP_KERNEL);
if (!fences)
return ERR_PTR(-ENOMEM);
 
-- 
2.13.2

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


[PATCH 6/7] drm/syncobj: Add a callback mechanism for replace_fence (v2)

2017-08-15 Thread Jason Ekstrand
It is useful in certain circumstances to know when the fence is replaced
in a syncobj.  Specifically, it may be useful to know when the fence
goes from NULL to something valid.  This does make syncobj_replace_fence
a little more expensive because it has to take a lock but, in the common
case where there is no callback list, it spends a very short amount of
time inside the lock.

v2:
 - Don't lock in drm_syncobj_fence_get.  We only really need to lock
   around fence_replace to make the callback work.

Signed-off-by: Jason Ekstrand 
---
 drivers/gpu/drm/drm_syncobj.c | 60 +--
 include/drm/drm_syncobj.h | 39 
 2 files changed, 97 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index 755af5f..24a5286 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -80,6 +80,46 @@ struct drm_syncobj *drm_syncobj_find(struct drm_file 
*file_private,
 }
 EXPORT_SYMBOL(drm_syncobj_find);
 
+static void drm_syncobj_add_callback_locked(struct drm_syncobj *syncobj,
+   struct drm_syncobj_cb *cb,
+   drm_syncobj_func_t func)
+{
+   cb->func = func;
+   list_add_tail(>node, >cb_list);
+}
+
+/**
+ * drm_syncobj_add_callback - adds a callback to syncobj::cb_list
+ * @syncobj: Sync object to which to add the callback
+ * @cb: Callback to add
+ * @func: Func to use when initializing the drm_syncobj_cb struct
+ *
+ * This adds a callback to be called next time the fence is replaced
+ */
+void drm_syncobj_add_callback(struct drm_syncobj *syncobj,
+ struct drm_syncobj_cb *cb,
+ drm_syncobj_func_t func)
+{
+   spin_lock(>lock);
+   drm_syncobj_add_callback_locked(syncobj, cb, func);
+   spin_unlock(>lock);
+}
+EXPORT_SYMBOL(drm_syncobj_add_callback);
+
+/**
+ * drm_syncobj_add_callback - removes a callback to syncobj::cb_list
+ * @syncobj: Sync object from which to remove the callback
+ * @cb: Callback to remove
+ */
+void drm_syncobj_remove_callback(struct drm_syncobj *syncobj,
+struct drm_syncobj_cb *cb)
+{
+   spin_lock(>lock);
+   list_del_init(>node);
+   spin_unlock(>lock);
+}
+EXPORT_SYMBOL(drm_syncobj_remove_callback);
+
 /**
  * drm_syncobj_replace_fence - replace fence in a sync object.
  * @syncobj: Sync object to replace fence in
@@ -91,10 +131,24 @@ void drm_syncobj_replace_fence(struct drm_syncobj *syncobj,
   struct dma_fence *fence)
 {
struct dma_fence *old_fence;
+   struct drm_syncobj_cb *cur, *tmp;
 
if (fence)
dma_fence_get(fence);
-   old_fence = xchg(>fence, fence);
+
+   spin_lock(>lock);
+
+   old_fence = syncobj->fence;
+   syncobj->fence = fence;
+
+   if (fence != old_fence) {
+   list_for_each_entry_safe(cur, tmp, >cb_list, node) {
+   list_del_init(>node);
+   cur->func(syncobj, cur);
+   }
+   }
+
+   spin_unlock(>lock);
 
dma_fence_put(old_fence);
 }
@@ -130,7 +184,7 @@ void drm_syncobj_free(struct kref *kref)
struct drm_syncobj *syncobj = container_of(kref,
   struct drm_syncobj,
   refcount);
-   dma_fence_put(syncobj->fence);
+   drm_syncobj_replace_fence(syncobj, NULL);
kfree(syncobj);
 }
 EXPORT_SYMBOL(drm_syncobj_free);
@@ -146,6 +200,8 @@ static int drm_syncobj_create(struct drm_file *file_private,
return -ENOMEM;
 
kref_init(>refcount);
+   INIT_LIST_HEAD(>cb_list);
+   spin_lock_init(>lock);
 
idr_preload(GFP_KERNEL);
spin_lock(_private->syncobj_table_lock);
diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h
index ce94d14..aef7c10 100644
--- a/include/drm/drm_syncobj.h
+++ b/include/drm/drm_syncobj.h
@@ -28,6 +28,8 @@
 
 #include "linux/dma-fence.h"
 
+struct drm_syncobj_cb;
+
 /**
  * struct drm_syncobj - sync object.
  *
@@ -43,15 +45,47 @@ struct drm_syncobj {
/**
 * @fence:
 * NULL or a pointer to the fence bound to this object.
+*
+* This field should not be used directly.  Use drm_syncobj_fence_get
+* and drm_syncobj_replace_fence instead.
 */
struct dma_fence *fence;
/**
+* @list:
+* List of callbacks to call when the fence gets replaced
+*/
+   struct list_head cb_list;
+   /**
+* @lock:
+* locks cb_list and write-locks fence.
+*/
+   spinlock_t lock;
+   /**
 * @file:
 * a file backing for this syncobj.
 */
struct file *file;
 };
 
+typedef void (*drm_syncobj_func_t)(struct drm_syncobj *syncobj,
+ 

[PATCH 7/7] drm/syncobj: Allow wait for submit and signal behavior (v5)

2017-08-15 Thread Jason Ekstrand
Vulkan VkFence semantics require that the application be able to perform
a CPU wait on work which may not yet have been submitted.  This is
perfectly safe because the CPU wait has a timeout which will get
triggered eventually if no work is ever submitted.  This behavior is
advantageous for multi-threaded workloads because, so long as all of the
threads agree on what fences to use up-front, you don't have the extra
cross-thread synchronization cost of thread A telling thread B that it
has submitted its dependent work and thread B is now free to wait.

Within a single process, this can be implemented in the userspace driver
by doing exactly the same kind of tracking the app would have to do
using posix condition variables or similar.  However, in order for this
to work cross-process (as is required by VK_KHR_external_fence), we need
to handle this in the kernel.

This commit adds a WAIT_FOR_SUBMIT flag to DRM_IOCTL_SYNCOBJ_WAIT which
instructs the IOCTL to wait for the syncobj to have a non-null fence and
then wait on the fence.  Combined with DRM_IOCTL_SYNCOBJ_RESET, you can
easily get the Vulkan behavior.

v2:
 - Fix a bug in the invalid syncobj error path
 - Unify the wait-all and wait-any cases
v3:
 - Unify the timeout == 0 case a bit with the timeout > 0 case
 - Use wait_event_interruptible_timeout
v4:
 - Use proxy fence
v5:
 - Revert to a combination of v2 and v3
 - Don't use proxy fences
 - Don't use wait_event_interruptible_timeout because it just adds an
   extra layer of callbacks

Signed-off-by: Jason Ekstrand 
Cc: Dave Airlie 
Cc: Chris Wilson 
Cc: Christian König 
---
 drivers/gpu/drm/drm_syncobj.c | 252 ++
 include/uapi/drm/drm.h|   1 +
 2 files changed, 208 insertions(+), 45 deletions(-)

diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index 24a5286..7dfdb98 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -51,6 +51,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "drm_internal.h"
 #include 
@@ -88,6 +89,35 @@ static void drm_syncobj_add_callback_locked(struct 
drm_syncobj *syncobj,
list_add_tail(>node, >cb_list);
 }
 
+static int drm_syncobj_fence_get_or_add_callback(struct drm_syncobj *syncobj,
+struct dma_fence **fence,
+struct drm_syncobj_cb *cb,
+drm_syncobj_func_t func)
+{
+   int ret;
+
+   *fence = drm_syncobj_fence_get(syncobj);
+   if (*fence)
+   return 1;
+
+   spin_lock(>lock);
+   /* We've already tried once to get a fence and failed.  Now that we
+* have the lock, try one more time just to be sure we don't add a
+* callback when a fence has already been set.
+*/
+   if (syncobj->fence) {
+   *fence = dma_fence_get(syncobj->fence);
+   ret = 1;
+   } else {
+   *fence = NULL;
+   drm_syncobj_add_callback_locked(syncobj, cb, func);
+   ret = 0;
+   }
+   spin_unlock(>lock);
+
+   return ret;
+}
+
 /**
  * drm_syncobj_add_callback - adds a callback to syncobj::cb_list
  * @syncobj: Sync object to which to add the callback
@@ -509,6 +539,160 @@ drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, 
void *data,
>handle);
 }
 
+struct syncobj_wait_entry {
+   struct task_struct *task;
+   struct dma_fence *fence;
+   struct dma_fence_cb fence_cb;
+   struct drm_syncobj_cb syncobj_cb;
+};
+
+static void syncobj_wait_fence_func(struct dma_fence *fence,
+   struct dma_fence_cb *cb)
+{
+   struct syncobj_wait_entry *wait =
+   container_of(cb, struct syncobj_wait_entry, fence_cb);
+
+   wake_up_process(wait->task);
+}
+
+static void syncobj_wait_syncobj_func(struct drm_syncobj *syncobj,
+ struct drm_syncobj_cb *cb)
+{
+   struct syncobj_wait_entry *wait =
+   container_of(cb, struct syncobj_wait_entry, syncobj_cb);
+
+   /* This happens inside the syncobj lock */
+   wait->fence = dma_fence_get(syncobj->fence);
+   wake_up_process(wait->task);
+}
+
+static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj 
**syncobjs,
+ uint32_t count,
+ uint32_t flags,
+ signed long timeout,
+ uint32_t *idx)
+{
+   struct syncobj_wait_entry *entries;
+   struct dma_fence *fence;
+   signed long ret;
+   uint32_t signaled_count, i;
+
+   entries = kcalloc(count, sizeof(*entries), GFP_KERNEL);
+   if (!entries)
+

[PATCH 4/7] drm/syncobj: add sync obj wait interface. (v8)

2017-08-15 Thread Jason Ekstrand
From: Dave Airlie 

This interface will allow sync object to be used to back
Vulkan fences. This API is pretty much the vulkan fence waiting
API, and I've ported the code from amdgpu.

v2: accept relative timeout, pass remaining time back
to userspace.
v3: return to absolute timeouts.
v4: absolute zero = poll,
rewrite any/all code to have same operation for arrays
return -EINVAL for 0 fences.
v4.1: fixup fences allocation check, use u64_to_user_ptr
v5: move to sec/nsec, and use timespec64 for calcs.
v6: use -ETIME and drop the out status flag. (-ETIME
is suggested by ickle, I can feel a shed painting)
v7: talked to Daniel/Arnd, use ktime and ns everywhere.
v8: be more careful in the timeout calculations
use uint32_t for counter variables so we don't overflow
graciously handle -ENOINT being returned from dma_fence_wait_timeout

Signed-off-by: Dave Airlie 
Reviewed-by: Jason Ekstrand 
Acked-by: Christian König 
---
 drivers/gpu/drm/drm_internal.h |   2 +
 drivers/gpu/drm/drm_ioctl.c|   2 +
 drivers/gpu/drm/drm_syncobj.c  | 142 +
 include/uapi/drm/drm.h |  12 
 4 files changed, 158 insertions(+)

diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
index 4e906b8..534e5ac 100644
--- a/drivers/gpu/drm/drm_internal.h
+++ b/drivers/gpu/drm/drm_internal.h
@@ -167,3 +167,5 @@ int drm_syncobj_handle_to_fd_ioctl(struct drm_device *dev, 
void *data,
   struct drm_file *file_private);
 int drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data,
   struct drm_file *file_private);
+int drm_syncobj_wait_ioctl(struct drm_device *dev, void *data,
+  struct drm_file *file_private);
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 8bfeb32..2ab0ff90 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -657,6 +657,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
  DRM_UNLOCKED|DRM_RENDER_ALLOW),
DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, 
drm_syncobj_fd_to_handle_ioctl,
  DRM_UNLOCKED|DRM_RENDER_ALLOW),
+   DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_WAIT, drm_syncobj_wait_ioctl,
+ DRM_UNLOCKED|DRM_RENDER_ALLOW),
 };
 
 #define DRM_CORE_IOCTL_COUNT   ARRAY_SIZE( drm_ioctls )
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index eea38d8..4e8563c 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -1,5 +1,7 @@
 /*
  * Copyright 2017 Red Hat
+ * Parts ported from amdgpu (fence wait code).
+ * Copyright 2016 Advanced Micro Devices, Inc.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -31,6 +33,9 @@
  * that contain an optional fence. The fence can be updated with a new
  * fence, or be NULL.
  *
+ * syncobj's can be waited upon, where it will wait for the underlying
+ * fence.
+ *
  * syncobj's can be export to fd's and back, these fd's are opaque and
  * have no other use case, except passing the syncobj between processes.
  *
@@ -447,3 +452,140 @@ drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, 
void *data,
return drm_syncobj_fd_to_handle(file_private, args->fd,
>handle);
 }
+
+/**
+ * drm_timeout_abs_to_jiffies - calculate jiffies timeout from absolute value
+ *
+ * @timeout_nsec: timeout nsec component in ns, 0 for poll
+ *
+ * Calculate the timeout in jiffies from an absolute time in sec/nsec.
+ */
+static signed long drm_timeout_abs_to_jiffies(int64_t timeout_nsec)
+{
+   ktime_t abs_timeout, now;
+   u64 timeout_ns, timeout_jiffies64;
+
+   /* make 0 timeout means poll - absolute 0 doesn't seem valid */
+   if (timeout_nsec == 0)
+   return 0;
+
+   abs_timeout = ns_to_ktime(timeout_nsec);
+   now = ktime_get();
+
+   if (!ktime_after(abs_timeout, now))
+   return 0;
+
+   timeout_ns = ktime_to_ns(ktime_sub(abs_timeout, now));
+
+   timeout_jiffies64 = nsecs_to_jiffies64(timeout_ns);
+   /*  clamp timeout to avoid infinite timeout */
+   if (timeout_jiffies64 >= MAX_SCHEDULE_TIMEOUT - 1)
+   return MAX_SCHEDULE_TIMEOUT - 1;
+
+   return timeout_jiffies64 + 1;
+}
+
+static int drm_syncobj_wait_fences(struct drm_device *dev,
+  struct drm_file *file_private,
+  struct drm_syncobj_wait *wait,
+  struct dma_fence **fences)
+{
+   signed long timeout = drm_timeout_abs_to_jiffies(wait->timeout_nsec);
+   signed long ret = 0;
+   uint32_t first = ~0;
+
+   if (wait->flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL) {
+ 

[PATCH 1/7] drm/syncobj: Rename fence_get to find_fence

2017-08-15 Thread Jason Ekstrand
The function has far more in common with drm_syncobj_find than with
any in the get/put functions.

Signed-off-by: Jason Ekstrand 
Acked-by: Christian König  (v1)
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c |  2 +-
 drivers/gpu/drm/drm_syncobj.c  | 10 +-
 include/drm/drm_syncobj.h  |  6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 3378951..dcfb056 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -1038,7 +1038,7 @@ static int amdgpu_syncobj_lookup_and_add_to_sync(struct 
amdgpu_cs_parser *p,
 {
int r;
struct dma_fence *fence;
-   r = drm_syncobj_fence_get(p->filp, handle, );
+   r = drm_syncobj_find_fence(p->filp, handle, );
if (r)
return r;
 
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index a5b38a8..0412b0b 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -95,9 +95,9 @@ void drm_syncobj_replace_fence(struct drm_syncobj *syncobj,
 }
 EXPORT_SYMBOL(drm_syncobj_replace_fence);
 
-int drm_syncobj_fence_get(struct drm_file *file_private,
- u32 handle,
- struct dma_fence **fence)
+int drm_syncobj_find_fence(struct drm_file *file_private,
+  u32 handle,
+  struct dma_fence **fence)
 {
struct drm_syncobj *syncobj = drm_syncobj_find(file_private, handle);
int ret = 0;
@@ -112,7 +112,7 @@ int drm_syncobj_fence_get(struct drm_file *file_private,
drm_syncobj_put(syncobj);
return ret;
 }
-EXPORT_SYMBOL(drm_syncobj_fence_get);
+EXPORT_SYMBOL(drm_syncobj_find_fence);
 
 /**
  * drm_syncobj_free - free a sync object.
@@ -307,7 +307,7 @@ int drm_syncobj_export_sync_file(struct drm_file 
*file_private,
if (fd < 0)
return fd;
 
-   ret = drm_syncobj_fence_get(file_private, handle, );
+   ret = drm_syncobj_find_fence(file_private, handle, );
if (ret)
goto err_put_fd;
 
diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h
index 89976da..7d4ad77 100644
--- a/include/drm/drm_syncobj.h
+++ b/include/drm/drm_syncobj.h
@@ -81,9 +81,9 @@ struct drm_syncobj *drm_syncobj_find(struct drm_file 
*file_private,
 u32 handle);
 void drm_syncobj_replace_fence(struct drm_syncobj *syncobj,
   struct dma_fence *fence);
-int drm_syncobj_fence_get(struct drm_file *file_private,
- u32 handle,
- struct dma_fence **fence);
+int drm_syncobj_find_fence(struct drm_file *file_private,
+  u32 handle,
+  struct dma_fence **fence);
 void drm_syncobj_free(struct kref *kref);
 
 #endif
-- 
2.5.0.400.gff86faf

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


RE: [PATCH v13 2/7] drm: Introduce RGB 64-bit 16:16:16:16 float format

2017-08-15 Thread Zhang, Tina


> -Original Message-
> From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of Daniel Vetter
> Sent: Tuesday, August 15, 2017 10:50 PM
> To: Zhang, Tina 
> Cc: intel-...@lists.freedesktop.org; intel-gvt-...@lists.freedesktop.org; dri-
> de...@lists.freedesktop.org; ville.syrj...@linux.intel.com;
> zhen...@linux.intel.com; Lv, Zhiyuan ; Wang, Zhi A
> ; alex.william...@redhat.com; kra...@redhat.com;
> ch...@chris-wilson.co.uk; dan...@ffwll.ch; kwankh...@nvidia.com; Tian, Kevin
> ; Chen, Xiaoguang 
> Subject: Re: [PATCH v13 2/7] drm: Introduce RGB 64-bit 16:16:16:16 float
> format
> 
> On Tue, Jul 25, 2017 at 05:28:15PM +0800, Tina Zhang wrote:
> > The RGB 64-bit 16:16:16:16 float pixel format is needed by windows
> > guest VM. This patch is to introduce the format to drm.
> >
> > v1:
> > Suggested by Ville to submit this patch to dri-devel.
> >
> > Signed-off-by: Xiaoguang Chen 
> > Signed-off-by: Tina Zhang 
> > ---
> >  include/uapi/drm/drm_fourcc.h | 4 
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/include/uapi/drm/drm_fourcc.h
> > b/include/uapi/drm/drm_fourcc.h index 7586c46..3e002e3 100644
> > --- a/include/uapi/drm/drm_fourcc.h
> > +++ b/include/uapi/drm/drm_fourcc.h
> > @@ -113,6 +113,10 @@ extern "C" {
> >
> >  #define DRM_FORMAT_AYUVfourcc_code('A', 'Y', 'U', 'V') /* 
> > [31:0]
> A:Y:Cb:Cr 8:8:8:8 little endian */
> >
> > +/* 64 bpp RGB */
> > +#define DRM_FORMAT_XRGB161616  fourcc_code('X', 'R', '4', '8') /*
> > +[63:0] x:R:G:B 16:16:16:16 little endian */ #define
> > +DRM_FORMAT_XBGR161616  fourcc_code('X', 'B', '4', '8') /* [63:0]
> > +x:B:G:R 16:16:16:16 little endian */
> 
> I think the comment should go a bit more into detail what the float format is
> supposed to look like. And I think we should have a F or _FLOAT suffix to the
> defined name, since the same layout could also work for integers (and some hw
> somewhere probably has that. Maybe also put that F into the last slot of the
> fourcc.
Thanks. I prefer to add F and also put F into the last slot of the fourcc. 
I'm not sure about the code rule. Does it make sense?
#define DRM_FORMAT_XRGB161616F fourcc_code('X', 'R', '3', 'F')
Where '3' stands for the three fields (R, G, B) without Alpha.

BR,
Tina
> -Daniel
> > +
> >  /*
> >   * 2 plane RGB + A
> >   * index 0 = RGB plane, same format as the corresponding non _A8
> > format has
> > --
> > 2.7.4
> >
> 
> --
> 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 libdrm 1/1] drmsltest: Check expected neighbours

2017-08-15 Thread Emil Velikov
Hi Jan,

On 14 August 2017 at 03:44, Jan Vesely  wrote:
> On Fri, 2017-07-28 at 10:23 -0400, Jan Vesely wrote:
>> Fixes: 7d8c9464081634f053e16e5eac9655a12fae1dc4
>> Signed-off-by: Jan Vesely 
>
> ping.
> Emil, should I just drop this patch?
> another alternative is to remove the list implementation entirely,
> since nobody noticed when it got broken.
>
libdrm stuff has been under my radar for a bit.
I'll try to take a look tomorrow/the day after.

I've been travelling over the last few days and I'm still in the
middle of it :-\

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


[Bug 97220] miss detect monitor. dell UP3214Q

2017-08-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=97220

--- Comment #6 from kenneth johansson  ---
I have no idea what a tiled display is.

If I use the Intel display port I get or more correctly used to get two
displays that I could then combine with xrandr into one larger. Now the kernel
driver presents just the combined one directly no need to manually do anything.

-- 
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: drm/mtrr: possible deadlock

2017-08-15 Thread Dou Liyang

Hi Dmitry,

At 08/15/2017 03:18 PM, Dmitry Vyukov wrote:

Hello,

I am getting the following deadlock report while booting linux-next on
91dfed74eabcdae9378131546c446442c29bf769 in qemu. Config is attached.


WARNING: possible recursive locking detected
4.13.0-rc4-next-20170811 #2 Not tainted

swapper/0/1 is trying to acquire lock:
 (cpu_hotplug_lock.rw_sem){}, at: []
stop_machine+0x1c/0x40 kernel/stop_machine.c:596

but task is already holding lock:
 (cpu_hotplug_lock.rw_sem){}, at: []
get_online_cpus include/linux/cpu.h:126 [inline]
 (cpu_hotplug_lock.rw_sem){}, at: []
mtrr_add_page+0x1bd/0xe80 arch/x86/kernel/cpu/mtrr/main.c:328



I guess you may want this.

https://lkml.org/lkml/2017/8/14/7

and the solution by Thomas

https://lkml.org/lkml/2017/8/14/64

Thanks,
dou.


other info that might help us debug this:
 Possible unsafe locking scenario:

   CPU0
   
  lock(cpu_hotplug_lock.rw_sem);
  lock(cpu_hotplug_lock.rw_sem);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

5 locks held by swapper/0/1:
 #0:  (>mutex){}, at: [] device_lock
include/linux/device.h:1081 [inline]
 #0:  (>mutex){}, at: []
__driver_attach+0xd3/0x1c0 drivers/base/dd.c:788
 #1:  (>mutex){}, at: [] device_lock
include/linux/device.h:1081 [inline]
 #1:  (>mutex){}, at: []
__driver_attach+0xe6/0x1c0 drivers/base/dd.c:789
 #2:  (drm_global_mutex){+.+.}, at: []
drm_dev_register+0x4d/0x660 drivers/gpu/drm/drm_drv.c:780
 #3:  (cpu_hotplug_lock.rw_sem){}, at: []
get_online_cpus include/linux/cpu.h:126 [inline]
 #3:  (cpu_hotplug_lock.rw_sem){}, at: []
mtrr_add_page+0x1bd/0xe80 arch/x86/kernel/cpu/mtrr/main.c:328
 #4:  (mtrr_mutex){+.+.}, at: []
mtrr_add_page+0x1cb/0xe80 arch/x86/kernel/cpu/mtrr/main.c:331

stack backtrace:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.13.0-rc4-next-20170811 #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:16 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:52
 print_deadlock_bug kernel/locking/lockdep.c:1797 [inline]
 check_deadlock kernel/locking/lockdep.c:1844 [inline]
 validate_chain kernel/locking/lockdep.c:2453 [inline]
 __lock_acquire+0xed5/0x3bc0 kernel/locking/lockdep.c:3498
 lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:4002
 percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:35 [inline]
 percpu_down_read include/linux/percpu-rwsem.h:58 [inline]
 cpus_read_lock+0x42/0x90 kernel/cpu.c:218
 stop_machine+0x1c/0x40 kernel/stop_machine.c:596
 set_mtrr arch/x86/kernel/cpu/mtrr/main.c:237 [inline]
 mtrr_add_page+0x6b7/0xe80 arch/x86/kernel/cpu/mtrr/main.c:373
 mtrr_add+0x97/0xb0 arch/x86/kernel/cpu/mtrr/main.c:448
 arch_phys_wc_add+0x55/0x90 arch/x86/kernel/cpu/mtrr/main.c:562
 cirrus_mm_init+0x43f/0x6a0 drivers/gpu/drm/cirrus/cirrus_ttm.c:274
 cirrus_driver_load+0xcd/0x250 drivers/gpu/drm/cirrus/cirrus_main.c:182
 drm_dev_register+0x34f/0x660 drivers/gpu/drm/drm_drv.c:801
 drm_get_pci_dev+0x1ee/0x600 drivers/gpu/drm/drm_pci.c:262
 cirrus_pci_probe+0x198/0x210 drivers/gpu/drm/cirrus/cirrus_drv.c:75
 local_pci_probe+0xdc/0x190 drivers/pci/pci-driver.c:307
 __pci_device_probe drivers/pci/pci-driver.c:361 [inline]
 pci_device_probe+0x5a3/0x6a0 drivers/pci/pci-driver.c:426
 really_probe drivers/base/dd.c:413 [inline]
 driver_probe_device+0x63c/0xa20 drivers/base/dd.c:557
 __driver_attach+0x181/0x1c0 drivers/base/dd.c:791
 bus_for_each_dev+0x154/0x1e0 drivers/base/bus.c:313
 driver_attach+0x3d/0x50 drivers/base/dd.c:810
 bus_add_driver+0x48f/0x660 drivers/base/bus.c:669
 driver_register+0x1bf/0x3c0 drivers/base/driver.c:168
 __pci_register_driver+0x1d2/0x2c0 drivers/pci/pci-driver.c:1313
 cirrus_init+0x52/0x5e drivers/gpu/drm/cirrus/cirrus_drv.c:168
 do_one_initcall+0x9e/0x330 init/main.c:824
 do_initcall_level init/main.c:890 [inline]
 do_initcalls init/main.c:898 [inline]
 do_basic_setup init/main.c:916 [inline]
 kernel_init_freeable+0x46e/0x526 init/main.c:1066
 kernel_init+0x13/0x172 init/main.c:991
 ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431





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


[RESEND PATCH] drm/hisilicon: Ensure LDI regs are properly configured.

2017-08-15 Thread Peter Griffin
This patch fixes the following soft lockup:
  BUG: soft lockup - CPU#0 stuck for 23s! [weston:307]

On weston idle-timeout the IP is powered down and reset
asserted. On weston resume we get a massive vblank
IRQ storm due to the LDI registers having lost some state.

This state loss is caused by ade_crtc_atomic_begin() not
calling ade_ldi_set_mode(). With this patch applied
resuming from Weston idle-timeout works well.

Signed-off-by: Peter Griffin 
Tested-by: John Stultz 
Cc: sta...@vger.kernel.org
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
index c96c228..72c6357 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
@@ -519,9 +519,12 @@ static void ade_crtc_atomic_begin(struct drm_crtc *crtc,
 {
struct ade_crtc *acrtc = to_ade_crtc(crtc);
struct ade_hw_ctx *ctx = acrtc->ctx;
+   struct drm_display_mode *mode = >state->mode;
+   struct drm_display_mode *adj_mode = >state->adjusted_mode;
 
if (!ctx->power_on)
(void)ade_power_up(ctx);
+   ade_ldi_set_mode(acrtc, mode, adj_mode);
 }
 
 static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
-- 
2.7.4

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


Re: dix/dispatch.c:4049: AttachOffloadGPU: Assertion `new->current_master == pScreen' failed.

2017-08-15 Thread Paul Menzel

Dear Michel,


On 2017-08-15 03:19, Michel Dänzer wrote:

On 15/08/17 02:48 AM, Paul Menzel wrote:

On 08/14/17 03:15, Michel Dänzer wrote:

On 11/08/17 01:02 AM, Paul Menzel wrote:

On 08/10/17 15:14, Paul Menzel wrote:


Xorg:
/dev/shm/bee-root/xorg-server/xorg-server-1.19.3-0/source/dix/dispatch.c:4049:

AttachOffloadGPU: Assertion `new->current_master == pScreen' 
failed.

```

The USB keyboard does not work, and the system has to be controlled
remotely over SSH. Plugging in the DisplayPort cable into the 
internal
Intel graphics ports the Linux messages can be seen, but nothing 
else
works. Stopping GDM does not bring back the TTY screen. The 
keyboard
still does work. Plugging the USB cable out and back in doesn’t fix 
it

either.

Trying to disable the internal Intel graphics card, did not fix the
problem either.


Blacklisting the module *i915* works around the problem.

Please tell me if you want me to create a bug report for this issue,
and, if yes, what part in the graphics stack this problem belongs 
to.


It's hard to be sure without seeing a backtrace of the assertion
failure, but I'd say start at
https://bugs.freedesktop.org/enter_bug.cgi?product=xorg=Server/Ext/RandR.



Do you know why the stack trace is not present in the X server log?


Because your xserver build doesn't have
https://cgit.freedesktop.org/xorg/xserver/commit/?id=27a6b9f7c84c914d0f5909ec1069d72f5035bc04
(it's only in Git master yet).


With this patch the stack trace is indeed in the log.

```
[…]
Xorg: 
/dev/shm/bee-root/xorg-server/xorg-server-1.19.3-1/source/dix/dispatch.c:4049: 
AttachOffloadGPU: Assertion `new->current_master == pScreen' failed.

(EE)
(EE) Backtrace:
(EE) 0: /usr/libexec/Xorg (xorg_backtrace+0x41) [0x580461]
(EE) 1: /usr/libexec/Xorg (0x40+0x183e09) [0x583e09]
(EE) 2: /lib/libpthread.so.0 (0x7f6f957d3000+0x11a50) [0x7f6f957e4a50]
(EE) 3: /lib/libc.so.6 (gsignal+0x104) [0x7f6f954682f4]
(EE) 4: /lib/libc.so.6 (abort+0x16a) [0x7f6f9546975a]
(EE) 5: /lib/libc.so.6 (0x7f6f95435000+0x2c027) [0x7f6f95461027]
(EE) 6: /lib/libc.so.6 (0x7f6f95435000+0x2c0d2) [0x7f6f954610d2]
(EE) 7: /usr/libexec/Xorg (AttachOffloadGPU+0x6e) [0x4357fe]
(EE) 8: /usr/libexec/Xorg (0x40+0xa8b76) [0x4a8b76]
(EE) 9: /usr/libexec/Xorg (InitOutput+0x5b3) [0x4775b3]
(EE) 10: /usr/libexec/Xorg (0x40+0x38cb6) [0x438cb6]
(EE) 11: /lib/libc.so.6 (__libc_start_main+0xf0) [0x7f6f95455520]
(EE) 12: /usr/libexec/Xorg (_start+0x2a) [0x42421a]
(EE)
(EE)
Fatal server error:
(EE) Caught signal 6 (Aborted). Server aborting
(EE)
(EE)
[…]
```


I was able to get a stack trace as root and with GDB. Issue #10
(dix/dispatch.c:4049: AttachOffloadGPU: Assertion `new->current_master
== pScreen' failed.) tracks this problem now, and the stack traces are
attached there.


Thanks, though it looks like it might actually be a downstream issue.


I don’t have my login credentials handy right now, so I attach the X 
server

here, and go looking for the credentials.


Kind regards,

Paul[388062.443] 
X.Org X Server 1.19.3
Release Date: 2017-03-15
[388062.443] X Protocol Version 11, Revision 0
[388062.443] Build Operating System: Linux 4.9.38.mx64.164 x86_64 
[388062.443] Current Operating System: Linux curie.molgen.mpg.de 
4.12.5.mx64.169 #1 SMP Tue Aug 8 11:22:02 CEST 2017 x86_64
[388062.443] Kernel command line: init=/bin/systemd 
BOOT_IMAGE=/boot/bzImage-4.12.5.mx64.169 crashkernel=256M root=LABEL=root ro 
console=ttyS1,115200n8 console=tty0
[388062.443] Build Date: 15 August 2017  05:40:26AM
[388062.443]  
[388062.443] Current version of pixman: 0.34.0
[388062.443]Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
[388062.443] Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[388062.443] (==) Log file: "/var/log/Xorg.5.log", Time: Tue Aug 15 05:44:59 
2017
[388062.444] (==) Using config file: "/etc/X11/xorg.conf"
[388062.444] (==) Using config directory: "/etc/X11/xorg.conf.d"
[388062.444] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[388062.444] (==) No Layout section.  Using the first Screen section.
[388062.444] (==) No screen section available. Using defaults.
[388062.444] (**) |-->Screen "Default Screen Section" (0)
[388062.444] (**) |   |-->Monitor ""
[388062.444] (==) No monitor specified for screen "Default Screen Section".
Using a default monitor configuration.
[388062.444] (==) Automatically adding devices
[388062.444] (==) Automatically enabling devices
[388062.444] (==) Automatically adding GPU devices
[388062.444] (==) Max clients allowed: 256, resource mask: 0x1f
[388062.444] (==) FontPath set to:
/usr/share/fonts/X11/misc/,
/usr/share/fonts/X11/TTF/,
/usr/share/fonts/X11/OTF/,
/usr/share/fonts/X11/Type1/,
/usr/share/fonts/X11/100dpi/,

[PATCH v6 3/5] drm/vc4: Set up the DSI host at pdev probe time, not component bind.

2017-08-15 Thread Eric Anholt
We need the following things to happen in sequence:

DSI host creation
DSI device creation in the panel driver (needs DSI host)
DSI device attach from panel to host.
DSI drm_panel_add()
DSI encoder creation
DSI encoder's DRM panel/bridge attach

Unless we allow device creation while the host isn't up yet, we need
to break the -EPROBE_DEFER deadlock between the panel driver looking
up the host and the host driver looking up the panel.  We can do so by
moving the DSI host creation outside of the component bind loop, and
the panel/bridge lookup/attach into the component bind process.

Signed-off-by: Eric Anholt 
---
 drivers/gpu/drm/vc4/vc4_dsi.c | 97 +--
 1 file changed, 57 insertions(+), 40 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
index 2516cd3a1d87..ec1d646b3151 100644
--- a/drivers/gpu/drm/vc4/vc4_dsi.c
+++ b/drivers/gpu/drm/vc4/vc4_dsi.c
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -504,7 +505,6 @@ struct vc4_dsi {
struct mipi_dsi_host dsi_host;
struct drm_encoder *encoder;
struct drm_bridge *bridge;
-   bool is_panel_bridge;
 
void __iomem *regs;
 
@@ -1289,7 +1289,6 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *host,
   struct mipi_dsi_device *device)
 {
struct vc4_dsi *dsi = host_to_dsi(host);
-   int ret = 0;
 
dsi->lanes = device->lanes;
dsi->channel = device->channel;
@@ -1324,34 +1323,12 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host 
*host,
return 0;
}
 
-   dsi->bridge = of_drm_find_bridge(device->dev.of_node);
-   if (!dsi->bridge) {
-   struct drm_panel *panel =
-   of_drm_find_panel(device->dev.of_node);
-
-   dsi->bridge = drm_panel_bridge_add(panel,
-  DRM_MODE_CONNECTOR_DSI);
-   if (IS_ERR(dsi->bridge)) {
-   ret = PTR_ERR(dsi->bridge);
-   dsi->bridge = NULL;
-   return ret;
-   }
-   dsi->is_panel_bridge = true;
-   }
-
-   return drm_bridge_attach(dsi->encoder, dsi->bridge, NULL);
+   return 0;
 }
 
 static int vc4_dsi_host_detach(struct mipi_dsi_host *host,
   struct mipi_dsi_device *device)
 {
-   struct vc4_dsi *dsi = host_to_dsi(host);
-
-   if (dsi->is_panel_bridge) {
-   drm_panel_bridge_remove(dsi->bridge);
-   dsi->bridge = NULL;
-   }
-
return 0;
 }
 
@@ -1493,16 +1470,13 @@ static int vc4_dsi_bind(struct device *dev, struct 
device *master, void *data)
struct platform_device *pdev = to_platform_device(dev);
struct drm_device *drm = dev_get_drvdata(master);
struct vc4_dev *vc4 = to_vc4_dev(drm);
-   struct vc4_dsi *dsi;
+   struct vc4_dsi *dsi = dev_get_drvdata(dev);
struct vc4_dsi_encoder *vc4_dsi_encoder;
+   struct drm_panel *panel;
const struct of_device_id *match;
dma_cap_mask_t dma_mask;
int ret;
 
-   dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL);
-   if (!dsi)
-   return -ENOMEM;
-
match = of_match_device(vc4_dsi_dt_match, dev);
if (!match)
return -ENODEV;
@@ -1517,7 +1491,6 @@ static int vc4_dsi_bind(struct device *dev, struct device 
*master, void *data)
vc4_dsi_encoder->dsi = dsi;
dsi->encoder = _dsi_encoder->base.base;
 
-   dsi->pdev = pdev;
dsi->regs = vc4_ioremap_regs(pdev, 0);
if (IS_ERR(dsi->regs))
return PTR_ERR(dsi->regs);
@@ -1598,6 +1571,18 @@ static int vc4_dsi_bind(struct device *dev, struct 
device *master, void *data)
return ret;
}
 
+   ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
+ , >bridge);
+   if (ret)
+   return ret;
+
+   if (panel) {
+   dsi->bridge = devm_drm_panel_bridge_add(dev, panel,
+   DRM_MODE_CONNECTOR_DSI);
+   if (IS_ERR(dsi->bridge))
+   return PTR_ERR(dsi->bridge);
+   }
+
/* The esc clock rate is supposed to always be 100Mhz. */
ret = clk_set_rate(dsi->escape_clock, 100 * 100);
if (ret) {
@@ -1616,12 +1601,11 @@ static int vc4_dsi_bind(struct device *dev, struct 
device *master, void *data)
 DRM_MODE_ENCODER_DSI, NULL);
drm_encoder_helper_add(dsi->encoder, _dsi_encoder_helper_funcs);
 
-   dsi->dsi_host.ops = _dsi_host_ops;
-   dsi->dsi_host.dev = dev;
-
-   mipi_dsi_host_register(>dsi_host);
-
-   dev_set_drvdata(dev, dsi);
+   ret = drm_bridge_attach(dsi->encoder, dsi->bridge, NULL);
+   if (ret) {
+   

[PATCH v6 4/5] dt-bindings: Document the Raspberry Pi Touchscreen nodes.

2017-08-15 Thread Eric Anholt
This doesn't yet cover input, but the driver does get the display
working when the firmware is disabled from talking to our I2C lines.

Signed-off-by: Eric Anholt 
Acked-by: Rob Herring 
---
 .../panel/raspberrypi,7inch-touchscreen.txt| 49 ++
 1 file changed, 49 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/raspberrypi,7inch-touchscreen.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/raspberrypi,7inch-touchscreen.txt
 
b/Documentation/devicetree/bindings/display/panel/raspberrypi,7inch-touchscreen.txt
new file mode 100644
index ..e9e19c059260
--- /dev/null
+++ 
b/Documentation/devicetree/bindings/display/panel/raspberrypi,7inch-touchscreen.txt
@@ -0,0 +1,49 @@
+This binding covers the official 7" (800x480) Raspberry Pi touchscreen
+panel.
+
+This DSI panel contains:
+
+- TC358762 DSI->DPI bridge
+- Atmel microcontroller on I2C for power sequencing the DSI bridge and
+  controlling backlight
+- Touchscreen controller on I2C for touch input
+
+and this binding covers the DSI display parts but not its touch input.
+
+Required properties:
+- compatible:  Must be "raspberrypi,7inch-touchscreen-panel"
+- reg: Must be "45"
+- port:See panel-common.txt
+
+Example:
+
+dsi1: dsi@7e70 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   <...>
+
+   port {
+   dsi_out_port: endpoint {
+   remote-endpoint = <_dsi_port>;
+   };
+   };
+};
+
+i2c_dsi: i2c {
+   compatible = "i2c-gpio";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   gpios = < 28 0
+ 29 0>;
+
+   lcd@45 {
+   compatible = "raspberrypi,7inch-touchscreen-panel";
+   reg = <0x45>;
+
+   port {
+   panel_dsi_port: endpoint {
+   remote-endpoint = <_out_port>;
+   };
+   };
+   };
+};
-- 
2.14.1

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


[PATCH v6 2/5] drm/vc4: Avoid using vrefresh==0 mode in DSI htotal math.

2017-08-15 Thread Eric Anholt
The incoming mode might have a missing vrefresh field if it came from
drmModeSetCrtc(), which the kernel is supposed to calculate using
drm_mode_vrefresh().  We could either use that or the adjusted_mode's
original vrefresh value.

However, we can maintain a more exact vrefresh value (not just the
integer approximation), by scaling by the ratio of our clocks.

v2: Use math suggested by Andrzej Hajda instead.
v3: Simplify math now that adjusted_mode->clock isn't padded.

Signed-off-by: Eric Anholt 
---
 drivers/gpu/drm/vc4/vc4_dsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
index eb787eed8abe..2516cd3a1d87 100644
--- a/drivers/gpu/drm/vc4/vc4_dsi.c
+++ b/drivers/gpu/drm/vc4/vc4_dsi.c
@@ -862,7 +862,8 @@ static bool vc4_dsi_encoder_mode_fixup(struct drm_encoder 
*encoder,
adjusted_mode->clock = pixel_clock_hz / 1000;
 
/* Given the new pixel clock, adjust HFP to keep vrefresh the same. */
-   adjusted_mode->htotal = pixel_clock_hz / (mode->vrefresh * 
mode->vtotal);
+   adjusted_mode->htotal = (adjusted_mode->clock * mode->htotal /
+mode->clock);
adjusted_mode->hsync_end += adjusted_mode->htotal - mode->htotal;
adjusted_mode->hsync_start += adjusted_mode->htotal - mode->htotal;
 
-- 
2.14.1

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


[PATCH v6 5/5] drm/panel: Add support for the Raspberry Pi 7" Touchscreen.

2017-08-15 Thread Eric Anholt
This driver communicates with the Atmel microcontroller for sequencing
the poweron of the TC358762 DSI-DPI bridge and controlling the
backlight PWM.

v2: Set the same default orientation as the closed source firmware
used, which is the best for viewing angle.
v3: Rewrite as an i2c client driver after bridge driver rejection.
v4: Finish probe without the DSI host, using the new delayed
registration, and attach to the host during mipi_dsi_driver probe.
v5: Rework to drop the "probe without DSI host" mode again, now that
vc4 will create the host early on.

Signed-off-by: Eric Anholt 
---
 drivers/gpu/drm/panel/Kconfig  |   8 +
 drivers/gpu/drm/panel/Makefile |   1 +
 .../gpu/drm/panel/panel-raspberrypi-touchscreen.c  | 517 +
 3 files changed, 526 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index d84a031fae24..d6f1969b8a3b 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -73,6 +73,14 @@ config DRM_PANEL_PANASONIC_VVX10F034N00
  WUXGA (1920x1200) Novatek NT1397-based DSI panel as found in some
  Xperia Z2 tablets
 
+config DRM_PANEL_RASPBERRYPI_TOUCHSCREEN
+   tristate "Raspberry Pi 7-inch touchscreen panel"
+   depends on DRM_MIPI_DSI
+   help
+ Say Y here if you want to enable support for the Raspberry
+ Pi 7" Touchscreen.  To compile this driver as a module,
+ choose M here.
+
 config DRM_PANEL_SAMSUNG_S6E3HA2
tristate "Samsung S6E3HA2 DSI video mode panel"
depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 9f6610d08b00..bd17fac21c7b 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -4,6 +4,7 @@ obj-$(CONFIG_DRM_PANEL_INNOLUX_P079ZCA) += 
panel-innolux-p079zca.o
 obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
 obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
 obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += 
panel-panasonic-vvx10f034n00.o
+obj-$(CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN) += 
panel-raspberrypi-touchscreen.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0) += panel-samsung-s6e8aa0.o
diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c 
b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
new file mode 100644
index ..4237a0cbcdcc
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
@@ -0,0 +1,517 @@
+/*
+ * Copyright © 2016-2017 Broadcom
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Portions of this file (derived from panel-simple.c) are:
+ *
+ * Copyright (C) 2013, NVIDIA Corporation.  All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * Raspberry Pi 7" touchscreen panel driver.
+ *
+ * The 7" touchscreen consists of a DPI LCD panel, a Toshiba
+ * TC358762XBG DSI-DPI bridge, and an I2C-connected Atmel ATTINY88-MUR
+ * controlling power management, the LCD PWM, and initial register
+ * setup of the Tohsiba.
+ *
+ * This driver controls the TC358762 and ATTINY88, presenting a DSI
+ * device with a drm_panel.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define RPI_DSI_DRIVER_NAME "rpi-ts-dsi"
+
+/* I2C registers of the Atmel microcontroller. */
+enum REG_ADDR {
+   REG_ID = 0x80,
+   REG_PORTA, /* BIT(2) for horizontal 

[PATCH v6 1/5] drm/vc4: Move the DSI clock divider workaround closer to the clock call.

2017-08-15 Thread Eric Anholt
We want the adjusted_mode->clock to be the actual clock we're
expecting to program, so that consumers see the right values for clock
and vrefresh.

Signed-off-by: Eric Anholt 
---
 drivers/gpu/drm/vc4/vc4_dsi.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
index d1e0dc908048..eb787eed8abe 100644
--- a/drivers/gpu/drm/vc4/vc4_dsi.c
+++ b/drivers/gpu/drm/vc4/vc4_dsi.c
@@ -859,11 +859,7 @@ static bool vc4_dsi_encoder_mode_fixup(struct drm_encoder 
*encoder,
pll_clock = parent_rate / divider;
pixel_clock_hz = pll_clock / dsi->divider;
 
-   /* Round up the clk_set_rate() request slightly, since
-* PLLD_DSI1 is an integer divider and its rate selection will
-* never round up.
-*/
-   adjusted_mode->clock = pixel_clock_hz / 1000 + 1;
+   adjusted_mode->clock = pixel_clock_hz / 1000;
 
/* Given the new pixel clock, adjust HFP to keep vrefresh the same. */
adjusted_mode->htotal = pixel_clock_hz / (mode->vrefresh * 
mode->vtotal);
@@ -900,7 +896,11 @@ static void vc4_dsi_encoder_enable(struct drm_encoder 
*encoder)
vc4_dsi_dump_regs(dsi);
}
 
-   phy_clock = pixel_clock_hz * dsi->divider;
+   /* Round up the clk_set_rate() request slightly, since
+* PLLD_DSI1 is an integer divider and its rate selection will
+* never round up.
+*/
+   phy_clock = (pixel_clock_hz + 1000) * dsi->divider;
ret = clk_set_rate(dsi->pll_phy_clock, phy_clock);
if (ret) {
dev_err(>pdev->dev,
-- 
2.14.1

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


[PATCH 3/3] drm: rcar-du: Clip planes to screen boundaries

2017-08-15 Thread Laurent Pinchart
Unlike the KMS API, the hardware doesn't support planes exceeding the
screen boundaries. Clip plane coordinates to support the use case.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/rcar-du/rcar_du_plane.c | 66 +
 drivers/gpu/drm/rcar-du/rcar_du_plane.h |  4 ++
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c   | 21 +++
 3 files changed, 67 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c 
b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
index 714e02960635..7944790bac25 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "rcar_du_drv.h"
 #include "rcar_du_group.h"
@@ -329,11 +330,39 @@ static void rcar_du_plane_write(struct rcar_du_group 
*rgrp,
  data);
 }
 
+void rcar_du_plane_clip(const struct drm_plane_state *state,
+   struct drm_rect *src, struct drm_rect *dst)
+{
+   const struct drm_display_mode *mode;
+
+   /*
+* The hardware requires all planes to be fully contained in the output
+* rectangle. Crop the destination rectangle to fit in the CRTC.
+*/
+   mode = >crtc->state->adjusted_mode;
+
+   dst->x1 = max(0, state->crtc_x);
+   dst->y1 = max(0, state->crtc_y);
+   dst->x2 = min_t(unsigned int, mode->hdisplay,
+   state->crtc_x + state->crtc_w);
+   dst->y2 = min_t(unsigned int, mode->vdisplay,
+   state->crtc_y + state->crtc_h);
+
+   /*
+* Offset the left and top source coordinates by the same displacement
+* we have applied to the destination rectangle. Copy the width and
+* height as the hardware can't scale.
+*/
+   src->x1 = (state->src_x >> 16) + (dst->x1 - state->crtc_x);
+   src->y1 = (state->src_y >> 16) + (dst->y1 - state->crtc_y);
+   src->x2 = src->x1 + (dst->x2 - dst->x1);
+   src->y2 = src->y1 + (dst->y2 - dst->y1);
+}
+
 static void rcar_du_plane_setup_scanout(struct rcar_du_group *rgrp,
-   const struct rcar_du_plane_state *state)
+   const struct rcar_du_plane_state *state,
+   const struct drm_rect *src)
 {
-   unsigned int src_x = state->state.src_x >> 16;
-   unsigned int src_y = state->state.src_y >> 16;
unsigned int index = state->hwindex;
unsigned int pitch;
bool interlaced;
@@ -357,7 +386,7 @@ static void rcar_du_plane_setup_scanout(struct 
rcar_du_group *rgrp,
dma[i] = gem->paddr + fb->offsets[i];
}
} else {
-   pitch = state->state.src_w >> 16;
+   pitch = drm_rect_width(>state.src);
dma[0] = 0;
dma[1] = 0;
}
@@ -383,8 +412,8 @@ static void rcar_du_plane_setup_scanout(struct 
rcar_du_group *rgrp,
 * require a halved Y position value, in both progressive and interlaced
 * modes.
 */
-   rcar_du_plane_write(rgrp, index, PnSPXR, src_x);
-   rcar_du_plane_write(rgrp, index, PnSPYR, src_y *
+   rcar_du_plane_write(rgrp, index, PnSPXR, src->x1);
+   rcar_du_plane_write(rgrp, index, PnSPYR, src->y1 *
(!interlaced && state->format->bpp == 32 ? 2 : 1));
 
rcar_du_plane_write(rgrp, index, PnDSA0R, dma[0]);
@@ -394,8 +423,8 @@ static void rcar_du_plane_setup_scanout(struct 
rcar_du_group *rgrp,
 
rcar_du_plane_write(rgrp, index, PnMWR, pitch);
 
-   rcar_du_plane_write(rgrp, index, PnSPXR, src_x);
-   rcar_du_plane_write(rgrp, index, PnSPYR, src_y *
+   rcar_du_plane_write(rgrp, index, PnSPXR, src->x1);
+   rcar_du_plane_write(rgrp, index, PnSPYR, src->y1 *
(state->format->bpp == 16 ? 2 : 1) / 2);
 
rcar_du_plane_write(rgrp, index, PnDSA0R, dma[1]);
@@ -518,7 +547,8 @@ static void rcar_du_plane_setup_format_gen3(struct 
rcar_du_group *rgrp,
 
 static void rcar_du_plane_setup_format(struct rcar_du_group *rgrp,
   unsigned int index,
-  const struct rcar_du_plane_state *state)
+  const struct rcar_du_plane_state *state,
+  const struct drm_rect *dst)
 {
struct rcar_du_device *rcdu = rgrp->dev;
 
@@ -528,10 +558,10 @@ static void rcar_du_plane_setup_format(struct 
rcar_du_group *rgrp,
rcar_du_plane_setup_format_gen3(rgrp, index, state);
 
/* Destination position and size */
-   rcar_du_plane_write(rgrp, index, PnDSXR, state->state.crtc_w);
-   rcar_du_plane_write(rgrp, index, PnDSYR, state->state.crtc_h);
-   rcar_du_plane_write(rgrp, index, PnDPXR, 

[PATCH 2/3] drm: rcar-du: Reject planes located fully off-screen

2017-08-15 Thread Laurent Pinchart
There is no point in accepting fully off-screen planes as they won't be
displayed. Reject them in the atomic check.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/rcar-du/rcar_du_plane.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c 
b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
index 4f076c364f25..714e02960635 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
@@ -569,6 +569,8 @@ int __rcar_du_plane_atomic_check(struct drm_plane *plane,
 struct drm_plane_state *state,
 const struct rcar_du_format_info **format)
 {
+   const struct drm_display_mode *mode;
+   struct drm_crtc_state *crtc_state;
struct drm_device *dev = plane->dev;
 
if (!state->fb || !state->crtc) {
@@ -582,6 +584,20 @@ int __rcar_du_plane_atomic_check(struct drm_plane *plane,
return -EINVAL;
}
 
+   crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc);
+   if (IS_ERR(crtc_state))
+   return PTR_ERR(crtc_state);
+
+   mode = _state->adjusted_mode;
+   if (state->crtc_x >= mode->hdisplay ||
+   state->crtc_y >= mode->vdisplay ||
+   state->crtc_x + (int)state->crtc_w <= 0 ||
+   state->crtc_y + (int)state->crtc_h <= 0) {
+   dev_dbg(dev->dev, "%s: plane can't be fully off-screen\n",
+   __func__);
+   return -EINVAL;
+   }
+
*format = rcar_du_format_info(state->fb->format->format);
if (*format == NULL) {
dev_dbg(dev->dev, "%s: unsupported format %08x\n", __func__,
-- 
Regards,

Laurent Pinchart

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


[PATCH 1/3] drm: rcar-du: Share plane atomic check code between Gen2 and Gen3

2017-08-15 Thread Laurent Pinchart
The plane atomic check implementation is identical on Gen2 (DU planes)
and Gen3 (VSP planes), but two separate functions exist as they operate
on different data structures. Refactor the code to share the
implementation.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/rcar-du/rcar_du_plane.c | 27 +--
 drivers/gpu/drm/rcar-du/rcar_du_plane.h |  4 
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c   | 22 +-
 3 files changed, 22 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c 
b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
index 61833cc1c699..4f076c364f25 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
@@ -565,27 +565,26 @@ void __rcar_du_plane_setup(struct rcar_du_group *rgrp,
}
 }
 
-static int rcar_du_plane_atomic_check(struct drm_plane *plane,
- struct drm_plane_state *state)
+int __rcar_du_plane_atomic_check(struct drm_plane *plane,
+struct drm_plane_state *state,
+const struct rcar_du_format_info **format)
 {
-   struct rcar_du_plane_state *rstate = to_rcar_plane_state(state);
-   struct rcar_du_plane *rplane = to_rcar_plane(plane);
-   struct rcar_du_device *rcdu = rplane->group->dev;
+   struct drm_device *dev = plane->dev;
 
if (!state->fb || !state->crtc) {
-   rstate->format = NULL;
+   *format = NULL;
return 0;
}
 
if (state->src_w >> 16 != state->crtc_w ||
state->src_h >> 16 != state->crtc_h) {
-   dev_dbg(rcdu->dev, "%s: scaling not supported\n", __func__);
+   dev_dbg(dev->dev, "%s: scaling not supported\n", __func__);
return -EINVAL;
}
 
-   rstate->format = rcar_du_format_info(state->fb->format->format);
-   if (rstate->format == NULL) {
-   dev_dbg(rcdu->dev, "%s: unsupported format %08x\n", __func__,
+   *format = rcar_du_format_info(state->fb->format->format);
+   if (*format == NULL) {
+   dev_dbg(dev->dev, "%s: unsupported format %08x\n", __func__,
state->fb->format->format);
return -EINVAL;
}
@@ -593,6 +592,14 @@ static int rcar_du_plane_atomic_check(struct drm_plane 
*plane,
return 0;
 }
 
+static int rcar_du_plane_atomic_check(struct drm_plane *plane,
+ struct drm_plane_state *state)
+{
+   struct rcar_du_plane_state *rstate = to_rcar_plane_state(state);
+
+   return __rcar_du_plane_atomic_check(plane, state, >format);
+}
+
 static void rcar_du_plane_atomic_update(struct drm_plane *plane,
struct drm_plane_state *old_state)
 {
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.h 
b/drivers/gpu/drm/rcar-du/rcar_du_plane.h
index f62e09f195de..890321b4665d 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.h
@@ -73,6 +73,10 @@ to_rcar_plane_state(struct drm_plane_state *state)
 int rcar_du_atomic_check_planes(struct drm_device *dev,
struct drm_atomic_state *state);
 
+int __rcar_du_plane_atomic_check(struct drm_plane *plane,
+struct drm_plane_state *state,
+const struct rcar_du_format_info **format);
+
 int rcar_du_planes_init(struct rcar_du_group *rgrp);
 
 void __rcar_du_plane_setup(struct rcar_du_group *rgrp,
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c 
b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
index 2c96147bc444..dd66dcb8da23 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
@@ -268,28 +268,8 @@ static int rcar_du_vsp_plane_atomic_check(struct drm_plane 
*plane,
  struct drm_plane_state *state)
 {
struct rcar_du_vsp_plane_state *rstate = to_rcar_vsp_plane_state(state);
-   struct rcar_du_vsp_plane *rplane = to_rcar_vsp_plane(plane);
-   struct rcar_du_device *rcdu = rplane->vsp->dev;
-
-   if (!state->fb || !state->crtc) {
-   rstate->format = NULL;
-   return 0;
-   }
 
-   if (state->src_w >> 16 != state->crtc_w ||
-   state->src_h >> 16 != state->crtc_h) {
-   dev_dbg(rcdu->dev, "%s: scaling not supported\n", __func__);
-   return -EINVAL;
-   }
-
-   rstate->format = rcar_du_format_info(state->fb->format->format);
-   if (rstate->format == NULL) {
-   dev_dbg(rcdu->dev, "%s: unsupported format %08x\n", __func__,
-   state->fb->format->format);
-   return -EINVAL;
-   }
-
-   return 0;
+   return __rcar_du_plane_atomic_check(plane, state, >format);
 }
 
 static void rcar_du_vsp_plane_atomic_update(struct drm_plane 

[PATCH 0/3] R-Car DU: Clip planes to screen boundaries

2017-08-15 Thread Laurent Pinchart
Hello,

This patch series fixes support for planes that cross the screen boundaries.
The KMS API supports such a configuration, but the DU and VSP hardware
doesn't. This leads to different kind of dispay artifacts or hangs.

The series starts with a bit of refactoring to share existing code and make it
easier to share new code (1/3). Patch 2/3 then reject planes that are fully
off-screen as they don't work properly and we have currently no use case for
them. Finally, patch 3/3 clips planes to screen boundaries to fix the main
issue.

The patches are based on top of Dave's latest master branch.

Laurent Pinchart (3):
  drm: rcar-du: Share plane atomic check code between Gen2 and Gen3
  drm: rcar-du: Reject planes located fully off-screen
  drm: rcar-du: Clip planes to screen boundaries

 drivers/gpu/drm/rcar-du/rcar_du_plane.c | 109 
 drivers/gpu/drm/rcar-du/rcar_du_plane.h |   8 +++
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c   |  43 -
 3 files changed, 105 insertions(+), 55 deletions(-)

-- 
Regards,

Laurent Pinchart

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


[Bug 102203] Using hardware video encoding with amdgpu/vaapi crashes system immediately

2017-08-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=102203

Andy Furniss  changed:

   What|Removed |Added

 CC||adf.li...@gmail.com

--- Comment #3 from Andy Furniss  ---
Does it help if you set the env

VAAPI_DISABLE_INTERLACE=1

and modify the -vf to look like

-vf 'scale=1920:1072,format=nv12|vaapi,hwupload'

Without those I don't crash on R9 285, but the result would be junk - so worth
using!

1072 is a strange height to use though it doesn't hurt my setup.

-- 
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 97220] miss detect monitor. dell UP3214Q

2017-08-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=97220

--- Comment #5 from Harry Wentland  ---
I believe this is a tiled display. Correct me if I'm wrong. This means that
besides MST support (where we still have to iron out some bugs) this display
also requires tiled display support which we currently don't have.

-- 
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 97220] miss detect monitor. dell UP3214Q

2017-08-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=97220

--- Comment #4 from kenneth johansson  ---
So I tried latest 
git://people.freedesktop.org/~agd5f/linux
branch amd-staging-4.12

still not working. 

aug 15 23:17:39 brix kernel: [drm] Atomic commit: SET crtc id 0:
[99ef99e9c000]
aug 15 23:17:39 brix kernel: [drm] dc_commit_context: 1 streams
aug 15 23:17:39 brix kernel: [drm] core_stream 0xecc4d400: src: 0, 0, 1920,
2160; dst: 0, 0, 1920, 2160, colorSpace
aug 15 23:17:39 brix kernel: [drm] pix_clk_khz: 277250, h_total: 2080,
v_total: , pixelencoder:1, displ
aug 15 23:17:39 brix kernel: [drm] sink name: DELL UP3214Q, serial:
808857680
aug 15 23:17:39 brix kernel: [drm] link: 2
aug 15 23:17:39 brix kernel: [drm] dce_get_required_clocks_state: clocks
unsupported
aug 15 23:17:39 brix kernel: [ cut here ]
aug 15 23:17:39 brix kernel: WARNING: CPU: 2 PID: 2269 at
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.
aug 15 23:17:39 brix kernel: Modules linked in: xt_CHECKSUM iptable_mangle
ipt_MASQUERADE nf_nat_masquerade_ipv4 ip
aug 15 23:17:39 brix kernel:  crypto_simd glue_helper serdev cryptd btqca
snd_seq_device btintel snd_timer bluetoot
aug 15 23:17:39 brix kernel: CPU: 2 PID: 2269 Comm: gnome-shell Not tainted
4.12.0+ #1
aug 15 23:17:39 brix kernel: Hardware name: MSI MS-7976/Z170A GAMING M7
(MS-7976), BIOS 1.I0 04/25/2017
aug 15 23:17:39 brix kernel: task: 99eff420dc00 task.stack:
a9bc87484000
aug 15 23:17:39 brix kernel: RIP: 0010:decide_link_settings+0xc4/0x170 [amdgpu]
aug 15 23:17:39 brix kernel: RSP: 0018:a9bc874877c8 EFLAGS: 00010293
aug 15 23:17:39 brix kernel: RAX: 00658830 RBX: 99efecc4d400 RCX:
99ef99bfec00
aug 15 23:17:39 brix kernel: RDX: 99ef98d8e800 RSI:  RDI:

aug 15 23:17:39 brix kernel: RBP: a9bc874877d8 R08: 0001f160 R09:
c03b0352
aug 15 23:17:39 brix kernel: R10: d5edef67c3c0 R11: 0001 R12:
a9bc874877ec
aug 15 23:17:39 brix kernel: R13: 99ef98d6a800 R14: 99eff414 R15:
99eff4140158
aug 15 23:17:39 brix kernel: FS:  7f4fd59d4ac0()
GS:99f02ec8() knlGS:
aug 15 23:17:39 brix kernel: CS:  0010 DS:  ES:  CR0: 80050033
aug 15 23:17:39 brix kernel: CR2: 7fff7300dfd8 CR3: 000bde63d000 CR4:
003406e0
aug 15 23:17:39 brix kernel: DR0:  DR1:  DR2:

aug 15 23:17:39 brix kernel: DR3:  DR6: fffe0ff0 DR7:
0400
aug 15 23:17:39 brix kernel: Call Trace:
aug 15 23:17:39 brix kernel:  enable_link_dp+0x4e/0x260 [amdgpu]
aug 15 23:17:39 brix kernel:  core_link_enable_stream+0x419/0x470 [amdgpu]
aug 15 23:17:39 brix kernel:  apply_single_controller_ctx_to_hw+0x2d1/0x3b0
[amdgpu]
aug 15 23:17:39 brix kernel:  dce110_apply_ctx_to_hw+0x37f/0x700 [amdgpu]
aug 15 23:17:39 brix kernel:  ? amdgpu_cgs_read_register+0x14/0x20 [amdgpu]
aug 15 23:17:39 brix kernel:  ? generic_reg_get+0x2d/0x60 [amdgpu]
aug 15 23:17:39 brix kernel:  dc_commit_context_no_check+0xdc/0x2b0 [amdgpu]
aug 15 23:17:39 brix kernel:  dc_commit_context+0xc5/0xd0 [amdgpu]
aug 15 23:17:39 brix kernel:  amdgpu_dm_atomic_commit_tail+0x246/0xa40 [amdgpu]
aug 15 23:17:39 brix kernel:  ? amdgpu_bo_pin_restricted+0xa0/0x2f0 [amdgpu]
aug 15 23:17:39 brix kernel:  ? amdgpu_bo_ref+0x1e/0x30 [amdgpu]
aug 15 23:17:39 brix kernel:  ? dm_plane_helper_prepare_fb+0xd2/0x210 [amdgpu]
aug 15 23:17:39 brix kernel:  commit_tail+0x3f/0x70 [drm_kms_helper]
aug 15 23:17:39 brix kernel:  drm_atomic_helper_commit+0xa4/0xf0
[drm_kms_helper]
aug 15 23:17:39 brix kernel:  amdgpu_dm_atomic_commit+0x90/0xa0 [amdgpu]
aug 15 23:17:39 brix kernel:  drm_atomic_commit+0x4b/0x50 [drm]
aug 15 23:17:39 brix kernel:  drm_atomic_helper_set_config+0x70/0xa0
[drm_kms_helper]
aug 15 23:17:39 brix kernel:  __drm_mode_set_config_internal+0x65/0x110 [drm]
aug 15 23:17:39 brix kernel:  drm_mode_setcrtc+0x479/0x630 [drm]
aug 15 23:17:39 brix kernel:  drm_ioctl+0x213/0x4d0 [drm]
aug 15 23:17:39 brix kernel:  ? drm_mode_getcrtc+0x180/0x180 [drm]
aug 15 23:17:39 brix kernel:  amdgpu_drm_ioctl+0x4f/0x90 [amdgpu]
aug 15 23:17:39 brix kernel:  do_vfs_ioctl+0xa5/0x600
aug 15 23:17:39 brix kernel:  SyS_ioctl+0x79/0x90
aug 15 23:17:39 brix kernel:  entry_SYSCALL_64_fastpath+0x1e/0xa9
aug 15 23:17:39 brix kernel: RIP: 0033:0x7f4fd2b884d7
aug 15 23:17:39 brix kernel: RSP: 002b:7ffd416104d8 EFLAGS: 0246
ORIG_RAX: 0010
aug 15 23:17:39 brix kernel: RAX: ffda RBX: 55f642afa090 RCX:
7f4fd2b884d7
aug 15 23:17:39 brix kernel: RDX: 7ffd41610510 RSI: c06864a2 RDI:
0008
aug 15 23:17:39 brix kernel: RBP: 55f642a8dad0 R08:  R09:
55f6448b1fe0
aug 15 23:17:39 brix kernel: R10: 7f4fac004370 R11: 0246 R12:

aug 15 23:17:39 brix kernel: R13: 0003 

Re: [PATCH 2/4] drm/tve200: Add new driver for TVE200

2017-08-15 Thread Daniel Vetter
On Tue, Aug 15, 2017 at 10:02 PM, Linus Walleij
 wrote:
> On Mon, Aug 14, 2017 at 4:20 PM, Daniel Vetter  wrote:
>
>> Wrt merging/maintaining: Want to include it in the drm-misc pile? We'll
>> happily throw commit rights at every driver submission (and honestly
>> expect that, since it helps tremendously with balance maintainer loads for
>> the oddball trivial patch).
>
> Yeah I'm game for it :)
>
> I need to reiterate the patch addressing yours and Eric's comments first.
>
> I *really* want to experience your development workflow first hand after
> seeing your talks, so it'll be exciting. Just tell me how to proceed with
> this and/or point me to the right docs and I'll get going with it.

You need an fd.o account with acess to drm-misc.

https://www.freedesktop.org/wiki/AccountRequests/

Meanwhile enjoy the docs:

https://01.org/linuxgraphics/gfx-docs/maintainer-tools/drm-misc.html
https://01.org/linuxgraphics/gfx-docs/maintainer-tools/dim.html

(we have patches in flight to make it into a neat sphinx-style book
like the kerneldocs now are)

Then grab dim (our script)
https://cgit.freedesktop.org/drm-intel/tree/dim?h=maintainer-tools

Adjust dimrc to your taste and run dim setup (that will also grab a
checkout of all the maintainer-tools so that it autoupdates). There's
a bunch of howtos all around, and once fully installed there's also
bash completion and stuff like that.

If you hit a snag, best way to get help is over #dri-devel on
freenode. That's also where we tend to organize/coordinate review and
stuff. Also if anything is uncool with the tools pls pipe up, we
constantly try to make them better.

Cheers, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH libdrm] tests/amdgpu: add uvd encode unit tests

2017-08-15 Thread Boyuan Zhang
Signed-off-by: Boyuan Zhang 
Acked-by: Alex Deucher 
---
 tests/amdgpu/Makefile.am |   1 +
 tests/amdgpu/amdgpu_test.c   |   6 +
 tests/amdgpu/amdgpu_test.h   |  15 ++
 tests/amdgpu/frame.h |   2 +-
 tests/amdgpu/uvd_enc_tests.c | 500 
 tests/amdgpu/uve_ib.h| 527 +++
 6 files changed, 1050 insertions(+), 1 deletion(-)
 create mode 100644 tests/amdgpu/uvd_enc_tests.c
 create mode 100644 tests/amdgpu/uve_ib.h

diff --git a/tests/amdgpu/Makefile.am b/tests/amdgpu/Makefile.am
index 9e08578..13b3dc8 100644
--- a/tests/amdgpu/Makefile.am
+++ b/tests/amdgpu/Makefile.am
@@ -27,4 +27,5 @@ amdgpu_test_SOURCES = \
vce_tests.c \
vce_ib.h \
frame.h \
+   uvd_enc_tests.c \
vcn_tests.c
diff --git a/tests/amdgpu/amdgpu_test.c b/tests/amdgpu/amdgpu_test.c
index 1d44b09..cd6b826 100644
--- a/tests/amdgpu/amdgpu_test.c
+++ b/tests/amdgpu/amdgpu_test.c
@@ -91,6 +91,12 @@ static CU_SuiteInfo suites[] = {
.pCleanupFunc = suite_vcn_tests_clean,
.pTests = vcn_tests,
},
+   {
+   .pName = "UVD ENC Tests",
+   .pInitFunc = suite_uvd_enc_tests_init,
+   .pCleanupFunc = suite_uvd_enc_tests_clean,
+   .pTests = uvd_enc_tests,
+   },
CU_SUITE_INFO_NULL,
 };
 
diff --git a/tests/amdgpu/amdgpu_test.h b/tests/amdgpu/amdgpu_test.h
index c75a07a..d0b61ba 100644
--- a/tests/amdgpu/amdgpu_test.h
+++ b/tests/amdgpu/amdgpu_test.h
@@ -120,6 +120,21 @@ int suite_vcn_tests_clean();
 extern CU_TestInfo vcn_tests[];
 
 /**
+ * Initialize uvd enc test suite
+ */
+int suite_uvd_enc_tests_init();
+
+/**
+ * Deinitialize uvd enc test suite
+ */
+int suite_uvd_enc_tests_clean();
+
+/**
+ * Tests in uvd enc test suite
+ */
+extern CU_TestInfo uvd_enc_tests[];
+
+/**
  * Helper functions
  */
 static inline amdgpu_bo_handle gpu_mem_alloc(
diff --git a/tests/amdgpu/frame.h b/tests/amdgpu/frame.h
index 4c946c2..335401c 100644
--- a/tests/amdgpu/frame.h
+++ b/tests/amdgpu/frame.h
@@ -24,7 +24,7 @@
 #ifndef _frame_h_
 #define _frame_h_
 
-const uint8_t frame[] = {
+static const uint8_t frame[] = {
0xeb, 0xeb, 0xeb, 0xeb, 0xeb, 0xeb, 0xeb, 0xeb, 0xeb, 0xeb, 0xeb, 0xeb, 
0xeb, 0xeb, 0xeb, 0xeb,
0xeb, 0xeb, 0xeb, 0xeb, 0xeb, 0xeb, 0xd2, 0xd2, 0xd2, 0xd2, 0xd2, 0xd2, 
0xd2, 0xd2, 0xd2, 0xd2,
0xd2, 0xd2, 0xd2, 0xd2, 0xd2, 0xd2, 0xd2, 0xd2, 0xd2, 0xd2, 0xd2, 0xd2, 
0xd2, 0xaa, 0xaa, 0xaa,
diff --git a/tests/amdgpu/uvd_enc_tests.c b/tests/amdgpu/uvd_enc_tests.c
new file mode 100644
index 000..6c19f7b
--- /dev/null
+++ b/tests/amdgpu/uvd_enc_tests.c
@@ -0,0 +1,500 @@
+/*
+ * Copyright 2017 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+#include 
+
+#include "CUnit/Basic.h"
+
+#include "util_math.h"
+
+#include "amdgpu_test.h"
+#include "amdgpu_drm.h"
+#include "amdgpu_internal.h"
+#include "frame.h"
+#include "uve_ib.h"
+
+#define IB_SIZE4096
+#define MAX_RESOURCES  16
+
+struct amdgpu_uvd_enc_bo {
+   amdgpu_bo_handle handle;
+   amdgpu_va_handle va_handle;
+   uint64_t addr;
+   uint64_t size;
+   uint8_t *ptr;
+};
+
+struct amdgpu_uvd_enc {
+   unsigned width;
+   unsigned height;
+   struct amdgpu_uvd_enc_bo session;
+   struct amdgpu_uvd_enc_bo vbuf;
+   struct amdgpu_uvd_enc_bo bs;
+   struct amdgpu_uvd_enc_bo fb;
+   struct amdgpu_uvd_enc_bo cpb;
+};
+
+static amdgpu_device_handle device_handle;
+static uint32_t major_version;
+static uint32_t minor_version;
+static uint32_t family_id;
+
+static amdgpu_context_handle context_handle;
+static amdgpu_bo_handle ib_handle;
+static amdgpu_va_handle ib_va_handle;
+static uint64_t ib_mc_address;
+static uint32_t *ib_cpu;
+
+static struct 

[Bug 96783] Intel 945 GM is very slow on rendering with 4.5 kernel

2017-08-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=96783

Chris Wilson  changed:

   What|Removed |Added

 Resolution|NOTOURBUG   |---
   Assignee|intel-gfx-bugs@lists.freede |dri-devel@lists.freedesktop
   |sktop.org   |.org
 QA Contact|intel-gfx-bugs@lists.freede |dri-devel@lists.freedesktop
   |sktop.org   |.org
  Component|DRM/Intel   |Drivers/DRI/i915
Product|DRI |Mesa
 Status|CLOSED  |REOPENED

--- Comment #12 from Chris Wilson  ---
The beauty of having a unified bug tracker is that if you think there is no
kernel aspect to the bug, you can just reassign it to the mesa component. And
vice versa.

-- 
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 2/2] drm/tegra: gem: Implement mmap() for PRIME buffers

2017-08-15 Thread Chris Wilson
Quoting Thierry Reding (2017-08-15 14:42:40)
> From: Thierry Reding 
> 
> The mapping of PRIME buffers can reuse much of the GEM mapping code, so
> extract the common bits into a new tegra_gem_mmap() helper.
> 
> Signed-off-by: Thierry Reding 
> ---
>  drivers/gpu/drm/tegra/gem.c | 48 
> +++--
>  1 file changed, 33 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
> index 7a39a355678a..88b0250ec6d0 100644
> --- a/drivers/gpu/drm/tegra/gem.c
> +++ b/drivers/gpu/drm/tegra/gem.c
> @@ -481,30 +481,27 @@ const struct vm_operations_struct tegra_bo_vm_ops = {
> .close = drm_gem_vm_close,
>  };
>  
> -int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma)
> +int tegra_gem_mmap(struct drm_gem_object *gem, struct vm_area_struct *vma)

Now static.

>  {
> -   struct drm_gem_object *gem;
> -   struct tegra_bo *bo;
> -   int ret;
> -
> -   ret = drm_gem_mmap(file, vma);
> -   if (ret)
> -   return ret;
> -
> -   gem = vma->vm_private_data;
> -   bo = to_tegra_bo(gem);
> +   struct tegra_bo *bo = to_tegra_bo(gem);
>  
> if (!bo->pages) {
> unsigned long vm_pgoff = vma->vm_pgoff;
> +   int err;
>  
> +   /*
> +* Clear the VM_PFNMAP flag that was set by drm_gem_mmap(),
> +* and set the vm_pgoff (used as a fake buffer offset by DRM)
> +* to 0 as we want to map the whole buffer.
> +*/
> vma->vm_flags &= ~VM_PFNMAP;
> vma->vm_pgoff = 0;
>  
> -   ret = dma_mmap_wc(gem->dev->dev, vma, bo->vaddr, bo->paddr,
> +   err = dma_mmap_wc(gem->dev->dev, vma, bo->vaddr, bo->paddr,
>   gem->size);
> -   if (ret) {
> +   if (err < 0) {
> drm_gem_vm_close(vma);
> -   return ret;
> +   return err;
> }
>  
> vma->vm_pgoff = vm_pgoff;
> @@ -520,6 +517,20 @@ int tegra_drm_mmap(struct file *file, struct 
> vm_area_struct *vma)
> return 0;
>  }
>  
> +int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma)
> +{
> +   struct drm_gem_object *gem;
> +   int err;
> +
> +   err = drm_gem_mmap(file, vma);
> +   if (err < 0)
> +   return err;
> +
> +   gem = vma->vm_private_data;
> +
> +   return tegra_gem_mmap(gem, vma);

Ok, simple mechanical code motion.

> +}
> +
>  static struct sg_table *
>  tegra_gem_prime_map_dma_buf(struct dma_buf_attachment *attach,
> enum dma_data_direction dir)
> @@ -603,7 +614,14 @@ static void tegra_gem_prime_kunmap(struct dma_buf *buf, 
> unsigned long page,
>  
>  static int tegra_gem_prime_mmap(struct dma_buf *buf, struct vm_area_struct 
> *vma)
>  {
> -   return -EINVAL;
> +   struct drm_gem_object *gem = buf->priv;
> +   int err;
> +
> +   err = drm_gem_mmap_obj(gem, gem->size, vma);
> +   if (err < 0)
> +   return err;
> +
> +   return tegra_gem_mmap(gem, vma);
>  }
>  

Lgtm, with the one sparse fixup
Reviewed-by: Chris Wilson 

So !bo->pages you have a WC pointer into dma space, but for bo->pages
you have physical ram that you create a new WC mapping into. Are all
users of bo->pages cache coherent (you are happy that the cache is on
physical tags and would be flushed by the WC access), or do you need the
dma_buf_begin_cpu_access to ensure that memory is cache coherent?
-Chris
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH libdrm] drm: Pull new modifier uapi into drm_fourcc and drm_mode

2017-08-15 Thread Daniel Vetter
On Mon, Aug 14, 2017 at 04:22:51PM -0700, Jason Ekstrand wrote:
> Cc: Daniel Stone 

pls read libdrm.git/include/drm/README.
-Daniel

> ---
>  include/drm/drm_fourcc.h | 31 ++
>  include/drm/drm_mode.h   | 50 
> 
>  2 files changed, 81 insertions(+)
> 
> diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
> index 7586c46..3ad838d 100644
> --- a/include/drm/drm_fourcc.h
> +++ b/include/drm/drm_fourcc.h
> @@ -185,6 +185,8 @@ extern "C" {
>  #define DRM_FORMAT_MOD_VENDOR_BROADCOM 0x07
>  /* add more to the end as needed */
>  
> +#define DRM_FORMAT_RESERVED((1ULL << 56) - 1)
> +
>  #define fourcc_mod_code(vendor, val) \
>   __u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | (val & 
> 0x00ffULL))
>  
> @@ -197,6 +199,15 @@ extern "C" {
>   */
>  
>  /*
> + * Invalid Modifier
> + *
> + * This modifier can be used as a sentinel to terminate the format modifiers
> + * list, or to initialize a variable with an invalid modifier. It might also 
> be
> + * used to report an error back to userspace for certain APIs.
> + */
> +#define DRM_FORMAT_MOD_INVALID   fourcc_mod_code(NONE, 
> DRM_FORMAT_RESERVED)
> +
> +/*
>   * Linear Layout
>   *
>   * Just plain linear layout. Note that this is different from no specifying 
> any
> @@ -253,6 +264,26 @@ extern "C" {
>  #define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3)
>  
>  /*
> + * Intel color control surface (CCS) for render compression
> + *
> + * The framebuffer format must be one of the 8:8:8:8 RGB formats.
> + * The main surface will be plane index 0 and must be Y/Yf-tiled,
> + * the CCS will be plane index 1.
> + *
> + * Each CCS tile matches a 1024x512 pixel area of the main surface.
> + * To match certain aspects of the 3D hardware the CCS is
> + * considered to be made up of normal 128Bx32 Y tiles, Thus
> + * the CCS pitch must be specified in multiples of 128 bytes.
> + *
> + * In reality the CCS tile appears to be a 64Bx64 Y tile, composed
> + * of QWORD (8 bytes) chunks instead of OWORD (16 bytes) chunks.
> + * But that fact is not relevant unless the memory is accessed
> + * directly.
> + */
> +#define I915_FORMAT_MOD_Y_TILED_CCS  fourcc_mod_code(INTEL, 4)
> +#define I915_FORMAT_MOD_Yf_TILED_CCS fourcc_mod_code(INTEL, 5)
> +
> +/*
>   * Tiled, NV12MT, grouped in 64 (pixels) x 32 (lines) -sized macroblocks
>   *
>   * Macroblocks are laid in a Z-shape, and each pixel data is following the
> diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
> index 70571af..0807797 100644
> --- a/include/drm/drm_mode.h
> +++ b/include/drm/drm_mode.h
> @@ -657,6 +657,56 @@ struct drm_mode_atomic {
>   __u64 user_data;
>  };
>  
> +struct drm_format_modifier_blob {
> +#define FORMAT_BLOB_CURRENT 1
> + /* Version of this blob format */
> + __u32 version;
> +
> + /* Flags */
> + __u32 flags;
> +
> + /* Number of fourcc formats supported */
> + __u32 count_formats;
> +
> + /* Where in this blob the formats exist (in bytes) */
> + __u32 formats_offset;
> +
> + /* Number of drm_format_modifiers */
> + __u32 count_modifiers;
> +
> + /* Where in this blob the modifiers exist (in bytes) */
> + __u32 modifiers_offset;
> +
> + /* u32 formats[] */
> + /* struct drm_format_modifier modifiers[] */
> +};
> +
> +struct drm_format_modifier {
> + /* Bitmask of formats in get_plane format list this info applies to. The
> +  * offset allows a sliding window of which 64 formats (bits).
> +  *
> +  * Some examples:
> +  * In today's world with < 65 formats, and formats 0, and 2 are
> +  * supported
> +  * 0x0005
> +  *^-offset = 0, formats = 5
> +  *
> +  * If the number formats grew to 128, and formats 98-102 are
> +  * supported with the modifier:
> +  *
> +  * 0x003c 
> +  *^
> +  *|__offset = 64, formats = 0x3c
> +  *
> +  */
> + __u64 formats;
> + __u32 offset;
> + __u32 pad;
> +
> + /* The modifier that applies to the >get_plane format list bitmask. */
> + __u64 modifier;
> +};
> +
>  /**
>   * Create a new 'blob' data property, copying length bytes from data pointer,
>   * and returning new blob ID.
> -- 
> 2.5.0.400.gff86faf
> 
> ___
> 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


[PATCH] drm: Try to document legacy DPMS uapi a bit better

2017-08-15 Thread Daniel Vetter
Laurent asked for this.

Cc: Laurent Pinchart 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_connector.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index ba9f36cef68c..b458eb488128 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -720,6 +720,25 @@ DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name,
  * callback. For atomic drivers the remapping to the "ACTIVE" property is
  * implemented in the DRM core.  This is the only standard connector
  * property that userspace can change.
+ *
+ * WARNING:
+ *
+ * For userspace also running on legacy drivers the "DPMS" semantics are a
+ * lot more complicated. First, userspace cannot rely on the "DPMS" value
+ * returned by the GETCONNECTOR actually reflecting reality, because many
+ * drivers fail to update it. For atomic drivers this is taken care of in
+ * drm_atomic_helper_update_legacy_modeset_state().
+ *
+ * The second issue is that the DPMS state is only relevant when the
+ * connector is connected to a CRTC. In atomic the DRM core enforces that
+ * "ACTIVE" is off in such a case, no such checks exists for "DPMS".
+ * Finally, when enabling an output using the legacy SETCONFIG ioctl then
+ * "DPMS" is forced to ON. But see above, that might not be reflected in
+ * the software value.
+ *
+ * Summarizing: Only set "DPMS" when the connector is known to be enabled,
+ * assume that a successful SETCONFIG call also set "DPMS" to on, and never
+ * read back the value of "DPMS" because it can be incorrect.
  * PATH:
  * Connector path property to identify how this sink is physically
  * connected. Used by DP MST. This should be set by calling
-- 
2.13.3

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


Re: [PATCH libdrm] drm: Pull new modifier uapi into drm_fourcc and drm_mode

2017-08-15 Thread Daniel Stone
On 15 August 2017 at 00:22, Jason Ekstrand  wrote:
>  /*
> + * Invalid Modifier
> + *
> + * This modifier can be used as a sentinel to terminate the format modifiers
> + * list, or to initialize a variable with an invalid modifier. It might also 
> be
> + * used to report an error back to userspace for certain APIs.
> + */
> +#define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED)

Overjoyed to not have to type this out all the time.

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


[Bug 99553] Tracker bug for runnning OpenCL applications on Clover

2017-08-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99553

Senad  changed:

   What|Removed |Added

 Depends on||102233


Referenced Bugs:

https://bugs.freedesktop.org/show_bug.cgi?id=102233
[Bug 102233] OpenCL segmentation fault on AMD Radeon (Kaveri+R7) with memtestCL
-- 
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] gpu: host1x: Support sub-devices recursively

2017-08-15 Thread Thierry Reding
From: Thierry Reding 

The display architecture in Tegra186 changes slightly compared to
earlier Tegra generations, which requires that we recursively scan
host1x sub-devices from device tree.

Signed-off-by: Thierry Reding 
---
 drivers/gpu/host1x/bus.c | 26 +-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
index 7ece0e9058c6..998139c964f4 100644
--- a/drivers/gpu/host1x/bus.c
+++ b/drivers/gpu/host1x/bus.c
@@ -44,9 +44,14 @@ struct host1x_subdev {
  * @np: device node
  */
 static int host1x_subdev_add(struct host1x_device *device,
+struct host1x_driver *driver,
 struct device_node *np)
 {
struct host1x_subdev *subdev;
+   struct device_node *child;
+   int err;
+
+   dev_info(>dev, "adding subdevice %s\n", np->full_name);
 
subdev = kzalloc(sizeof(*subdev), GFP_KERNEL);
if (!subdev)
@@ -59,6 +64,19 @@ static int host1x_subdev_add(struct host1x_device *device,
list_add_tail(>list, >subdevs);
mutex_unlock(>subdevs_lock);
 
+   /* recursively add children */
+   for_each_child_of_node(np, child) {
+   if (of_match_node(driver->subdevs, child) &&
+   of_device_is_available(child)) {
+   err = host1x_subdev_add(device, driver, child);
+   if (err < 0) {
+   /* XXX cleanup? */
+   of_node_put(child);
+   return err;
+   }
+   }
+   }
+
return 0;
 }
 
@@ -87,7 +105,7 @@ static int host1x_device_parse_dt(struct host1x_device 
*device,
for_each_child_of_node(device->dev.parent->of_node, np) {
if (of_match_node(driver->subdevs, np) &&
of_device_is_available(np)) {
-   err = host1x_subdev_add(device, np);
+   err = host1x_subdev_add(device, driver, np);
if (err < 0) {
of_node_put(np);
return err;
@@ -104,6 +122,8 @@ static void host1x_subdev_register(struct host1x_device 
*device,
 {
int err;
 
+   dev_info(>dev, "registering subdevice %s\n", 
subdev->np->full_name);
+
/*
 * Move the subdevice to the list of active (registered) subdevices
 * and associate it with a client. At the same time, associate the
@@ -124,6 +144,10 @@ static void host1x_subdev_register(struct host1x_device 
*device,
dev_err(>dev, "failed to add: %d\n", err);
else
device->registered = true;
+   } else {
+   dev_info(>dev, "remaining subdevices:\n");
+   list_for_each_entry(subdev, >subdevs, list)
+   dev_info(>dev, "  %s\n", subdev->np->full_name);
}
 }
 
-- 
2.13.3

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


[PATCH 2/2] drm/tegra: gem: Implement mmap() for PRIME buffers

2017-08-15 Thread Thierry Reding
From: Thierry Reding 

The mapping of PRIME buffers can reuse much of the GEM mapping code, so
extract the common bits into a new tegra_gem_mmap() helper.

Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/tegra/gem.c | 48 +++--
 1 file changed, 33 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
index 7a39a355678a..88b0250ec6d0 100644
--- a/drivers/gpu/drm/tegra/gem.c
+++ b/drivers/gpu/drm/tegra/gem.c
@@ -481,30 +481,27 @@ const struct vm_operations_struct tegra_bo_vm_ops = {
.close = drm_gem_vm_close,
 };
 
-int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma)
+int tegra_gem_mmap(struct drm_gem_object *gem, struct vm_area_struct *vma)
 {
-   struct drm_gem_object *gem;
-   struct tegra_bo *bo;
-   int ret;
-
-   ret = drm_gem_mmap(file, vma);
-   if (ret)
-   return ret;
-
-   gem = vma->vm_private_data;
-   bo = to_tegra_bo(gem);
+   struct tegra_bo *bo = to_tegra_bo(gem);
 
if (!bo->pages) {
unsigned long vm_pgoff = vma->vm_pgoff;
+   int err;
 
+   /*
+* Clear the VM_PFNMAP flag that was set by drm_gem_mmap(),
+* and set the vm_pgoff (used as a fake buffer offset by DRM)
+* to 0 as we want to map the whole buffer.
+*/
vma->vm_flags &= ~VM_PFNMAP;
vma->vm_pgoff = 0;
 
-   ret = dma_mmap_wc(gem->dev->dev, vma, bo->vaddr, bo->paddr,
+   err = dma_mmap_wc(gem->dev->dev, vma, bo->vaddr, bo->paddr,
  gem->size);
-   if (ret) {
+   if (err < 0) {
drm_gem_vm_close(vma);
-   return ret;
+   return err;
}
 
vma->vm_pgoff = vm_pgoff;
@@ -520,6 +517,20 @@ int tegra_drm_mmap(struct file *file, struct 
vm_area_struct *vma)
return 0;
 }
 
+int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma)
+{
+   struct drm_gem_object *gem;
+   int err;
+
+   err = drm_gem_mmap(file, vma);
+   if (err < 0)
+   return err;
+
+   gem = vma->vm_private_data;
+
+   return tegra_gem_mmap(gem, vma);
+}
+
 static struct sg_table *
 tegra_gem_prime_map_dma_buf(struct dma_buf_attachment *attach,
enum dma_data_direction dir)
@@ -603,7 +614,14 @@ static void tegra_gem_prime_kunmap(struct dma_buf *buf, 
unsigned long page,
 
 static int tegra_gem_prime_mmap(struct dma_buf *buf, struct vm_area_struct 
*vma)
 {
-   return -EINVAL;
+   struct drm_gem_object *gem = buf->priv;
+   int err;
+
+   err = drm_gem_mmap_obj(gem, gem->size, vma);
+   if (err < 0)
+   return err;
+
+   return tegra_gem_mmap(gem, vma);
 }
 
 static void *tegra_gem_prime_vmap(struct dma_buf *buf)
-- 
2.13.3

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


[PATCH 1/2] drm/tegra: Support render node

2017-08-15 Thread Thierry Reding
From: Thierry Reding 

None of the driver-specific IOCTLs are privileged, so mark them as such
and advertise that the driver supports render nodes.

Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/tegra/drm.c | 44 +---
 1 file changed, 29 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index a75fbf6c219e..d5c8b15f5fa4 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -991,20 +991,34 @@ static int tegra_gem_get_flags(struct drm_device *drm, 
void *data,
 
 static const struct drm_ioctl_desc tegra_drm_ioctls[] = {
 #ifdef CONFIG_DRM_TEGRA_STAGING
-   DRM_IOCTL_DEF_DRV(TEGRA_GEM_CREATE, tegra_gem_create, 0),
-   DRM_IOCTL_DEF_DRV(TEGRA_GEM_MMAP, tegra_gem_mmap, 0),
-   DRM_IOCTL_DEF_DRV(TEGRA_SYNCPT_READ, tegra_syncpt_read, 0),
-   DRM_IOCTL_DEF_DRV(TEGRA_SYNCPT_INCR, tegra_syncpt_incr, 0),
-   DRM_IOCTL_DEF_DRV(TEGRA_SYNCPT_WAIT, tegra_syncpt_wait, 0),
-   DRM_IOCTL_DEF_DRV(TEGRA_OPEN_CHANNEL, tegra_open_channel, 0),
-   DRM_IOCTL_DEF_DRV(TEGRA_CLOSE_CHANNEL, tegra_close_channel, 0),
-   DRM_IOCTL_DEF_DRV(TEGRA_GET_SYNCPT, tegra_get_syncpt, 0),
-   DRM_IOCTL_DEF_DRV(TEGRA_SUBMIT, tegra_submit, 0),
-   DRM_IOCTL_DEF_DRV(TEGRA_GET_SYNCPT_BASE, tegra_get_syncpt_base, 0),
-   DRM_IOCTL_DEF_DRV(TEGRA_GEM_SET_TILING, tegra_gem_set_tiling, 0),
-   DRM_IOCTL_DEF_DRV(TEGRA_GEM_GET_TILING, tegra_gem_get_tiling, 0),
-   DRM_IOCTL_DEF_DRV(TEGRA_GEM_SET_FLAGS, tegra_gem_set_flags, 0),
-   DRM_IOCTL_DEF_DRV(TEGRA_GEM_GET_FLAGS, tegra_gem_get_flags, 0),
+   DRM_IOCTL_DEF_DRV(TEGRA_GEM_CREATE, tegra_gem_create,
+ DRM_UNLOCKED | DRM_RENDER_ALLOW),
+   DRM_IOCTL_DEF_DRV(TEGRA_GEM_MMAP, tegra_gem_mmap,
+ DRM_UNLOCKED | DRM_RENDER_ALLOW),
+   DRM_IOCTL_DEF_DRV(TEGRA_SYNCPT_READ, tegra_syncpt_read,
+ DRM_UNLOCKED | DRM_RENDER_ALLOW),
+   DRM_IOCTL_DEF_DRV(TEGRA_SYNCPT_INCR, tegra_syncpt_incr,
+ DRM_UNLOCKED | DRM_RENDER_ALLOW),
+   DRM_IOCTL_DEF_DRV(TEGRA_SYNCPT_WAIT, tegra_syncpt_wait,
+ DRM_UNLOCKED | DRM_RENDER_ALLOW),
+   DRM_IOCTL_DEF_DRV(TEGRA_OPEN_CHANNEL, tegra_open_channel,
+ DRM_UNLOCKED | DRM_RENDER_ALLOW),
+   DRM_IOCTL_DEF_DRV(TEGRA_CLOSE_CHANNEL, tegra_close_channel,
+ DRM_UNLOCKED | DRM_RENDER_ALLOW),
+   DRM_IOCTL_DEF_DRV(TEGRA_GET_SYNCPT, tegra_get_syncpt,
+ DRM_UNLOCKED | DRM_RENDER_ALLOW),
+   DRM_IOCTL_DEF_DRV(TEGRA_SUBMIT, tegra_submit,
+ DRM_UNLOCKED | DRM_RENDER_ALLOW),
+   DRM_IOCTL_DEF_DRV(TEGRA_GET_SYNCPT_BASE, tegra_get_syncpt_base,
+ DRM_UNLOCKED | DRM_RENDER_ALLOW),
+   DRM_IOCTL_DEF_DRV(TEGRA_GEM_SET_TILING, tegra_gem_set_tiling,
+ DRM_UNLOCKED | DRM_RENDER_ALLOW),
+   DRM_IOCTL_DEF_DRV(TEGRA_GEM_GET_TILING, tegra_gem_get_tiling,
+ DRM_UNLOCKED | DRM_RENDER_ALLOW),
+   DRM_IOCTL_DEF_DRV(TEGRA_GEM_SET_FLAGS, tegra_gem_set_flags,
+ DRM_UNLOCKED | DRM_RENDER_ALLOW),
+   DRM_IOCTL_DEF_DRV(TEGRA_GEM_GET_FLAGS, tegra_gem_get_flags,
+ DRM_UNLOCKED | DRM_RENDER_ALLOW),
 #endif
 };
 
@@ -1093,7 +1107,7 @@ static int tegra_debugfs_init(struct drm_minor *minor)
 
 static struct drm_driver tegra_drm_driver = {
.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
-  DRIVER_ATOMIC,
+  DRIVER_ATOMIC | DRIVER_RENDER,
.load = tegra_drm_load,
.unload = tegra_drm_unload,
.open = tegra_drm_open,
-- 
2.13.3

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


[PATCH 09/10] drm/tegra: dpaux: Trace register accesses

2017-08-15 Thread Thierry Reding
From: Thierry Reding 

Add tracepoint events for DPAUX controller register accesses.

Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/tegra/dpaux.c | 8 +++-
 drivers/gpu/drm/tegra/trace.h | 7 +++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c
index 793cb4ad99c4..d476ab5006bb 100644
--- a/drivers/gpu/drm/tegra/dpaux.c
+++ b/drivers/gpu/drm/tegra/dpaux.c
@@ -25,6 +25,7 @@
 
 #include "dpaux.h"
 #include "drm.h"
+#include "trace.h"
 
 static DEFINE_MUTEX(dpaux_lock);
 static LIST_HEAD(dpaux_list);
@@ -67,12 +68,17 @@ static inline struct tegra_dpaux *work_to_dpaux(struct 
work_struct *work)
 static inline u32 tegra_dpaux_readl(struct tegra_dpaux *dpaux,
unsigned int offset)
 {
-   return readl(dpaux->regs + (offset << 2));
+   u32 value = readl(dpaux->regs + (offset << 2));
+
+   trace_dpaux_readl(dpaux->dev, offset, value);
+
+   return value;
 }
 
 static inline void tegra_dpaux_writel(struct tegra_dpaux *dpaux,
  u32 value, unsigned int offset)
 {
+   trace_dpaux_writel(dpaux->dev, offset, value);
writel(value, dpaux->regs + (offset << 2));
 }
 
diff --git a/drivers/gpu/drm/tegra/trace.h b/drivers/gpu/drm/tegra/trace.h
index dd0176ff81eb..e497a0258ee4 100644
--- a/drivers/gpu/drm/tegra/trace.h
+++ b/drivers/gpu/drm/tegra/trace.h
@@ -45,6 +45,13 @@ DEFINE_EVENT(register_access, dsi_readl,
TP_PROTO(struct device *dev, unsigned int offset, u32 value),
TP_ARGS(dev, offset, value));
 
+DEFINE_EVENT(register_access, dpaux_writel,
+   TP_PROTO(struct device *dev, unsigned int offset, u32 value),
+   TP_ARGS(dev, offset, value));
+DEFINE_EVENT(register_access, dpaux_readl,
+   TP_PROTO(struct device *dev, unsigned int offset, u32 value),
+   TP_ARGS(dev, offset, value));
+
 #endif /* DRM_TEGRA_TRACE_H */
 
 /* This part must be outside protection */
-- 
2.13.3

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


[Bug 99553] Tracker bug for runnning OpenCL applications on Clover

2017-08-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99553

Vedran Miletić  changed:

   What|Removed |Added

 Depends on||101415


Referenced Bugs:

https://bugs.freedesktop.org/show_bug.cgi?id=101415
[Bug 101415] Error running clBLAS clblas-client:  unsupported call to function
mem_fence
-- 
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 03/10] drm/tegra: dsi: Use unsigned int for register offsets

2017-08-15 Thread Thierry Reding
From: Thierry Reding 

Register offsets are usually fairly small numbers, so an unsigned int is
more than enough to represent them.

Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/tegra/dsi.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index e4b5aedfdbd4..37a921cb676c 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -105,15 +105,15 @@ static struct tegra_dsi_state *tegra_dsi_get_state(struct 
tegra_dsi *dsi)
return to_dsi_state(dsi->output.connector.state);
 }
 
-static inline u32 tegra_dsi_readl(struct tegra_dsi *dsi, unsigned long reg)
+static inline u32 tegra_dsi_readl(struct tegra_dsi *dsi, unsigned int offset)
 {
-   return readl(dsi->regs + (reg << 2));
+   return readl(dsi->regs + (offset << 2));
 }
 
 static inline void tegra_dsi_writel(struct tegra_dsi *dsi, u32 value,
-   unsigned long reg)
+   unsigned int offset)
 {
-   writel(value, dsi->regs + (reg << 2));
+   writel(value, dsi->regs + (offset << 2));
 }
 
 static int tegra_dsi_show_regs(struct seq_file *s, void *data)
-- 
2.13.3

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


[PATCH 07/10] drm/tegra: hdmi: Trace register accesses

2017-08-15 Thread Thierry Reding
From: Thierry Reding 

Add tracepoint events for HDMI controller register accesses.

Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/tegra/hdmi.c  | 8 +++-
 drivers/gpu/drm/tegra/trace.h | 7 +++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index aa7525619f3e..5b9d83b71943 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -24,6 +24,7 @@
 #include "hdmi.h"
 #include "drm.h"
 #include "dc.h"
+#include "trace.h"
 
 #define HDMI_ELD_BUFFER_SIZE 96
 
@@ -102,12 +103,17 @@ enum {
 static inline u32 tegra_hdmi_readl(struct tegra_hdmi *hdmi,
   unsigned int offset)
 {
-   return readl(hdmi->regs + (offset << 2));
+   u32 value = readl(hdmi->regs + (offset << 2));
+
+   trace_hdmi_readl(hdmi->dev, offset, value);
+
+   return value;
 }
 
 static inline void tegra_hdmi_writel(struct tegra_hdmi *hdmi, u32 value,
 unsigned int offset)
 {
+   trace_hdmi_writel(hdmi->dev, offset, value);
writel(value, hdmi->regs + (offset << 2));
 }
 
diff --git a/drivers/gpu/drm/tegra/trace.h b/drivers/gpu/drm/tegra/trace.h
index b32d90c967e8..e5c2e431c101 100644
--- a/drivers/gpu/drm/tegra/trace.h
+++ b/drivers/gpu/drm/tegra/trace.h
@@ -31,6 +31,13 @@ DEFINE_EVENT(register_access, dc_readl,
TP_PROTO(struct device *dev, unsigned int offset, u32 value),
TP_ARGS(dev, offset, value));
 
+DEFINE_EVENT(register_access, hdmi_writel,
+   TP_PROTO(struct device *dev, unsigned int offset, u32 value),
+   TP_ARGS(dev, offset, value));
+DEFINE_EVENT(register_access, hdmi_readl,
+   TP_PROTO(struct device *dev, unsigned int offset, u32 value),
+   TP_ARGS(dev, offset, value));
+
 #endif /* DRM_TEGRA_TRACE_H */
 
 /* This part must be outside protection */
-- 
2.13.3

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


[Bug 99553] Tracker bug for runnning OpenCL applications on Clover

2017-08-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99553

Vedran Miletić  changed:

   What|Removed |Added

 Depends on||102179


Referenced Bugs:

https://bugs.freedesktop.org/show_bug.cgi?id=102179
[Bug 102179] clEnqueueReadBuffer VM_PAGE FAULT
-- 
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 2/2] drm: rcar-du: Don't set connector DPMS property

2017-08-15 Thread Laurent Pinchart
Since commit 4a97a3da420b ("drm: Don't update property values for atomic
drivers") atomic drivers must not update property values as properties
are read from the state instead. To catch remaining users, the
drm_object_property_set_value() function now throws a warning when
called by atomic drivers on non-immutable properties, and we hit that
warning when creating connectors.

The easy fix is to just remove the drm_object_property_set_value() as it
is used here to set the initial value of the connector's DPMS property
to OFF. The DPMS property applies on top of the connector's state crtc
pointer (initialized to NULL) that is the main connector on/off control,
and should thus default to ON.

Fixes: 4a97a3da420b ("drm: Don't update property values for atomic drivers")
Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c | 4 
 1 file changed, 4 deletions(-)

This patch fixes a regression in drm-next and should be merged in v4.14-rc1.

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c 
b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c
index b373ad48ef5f..e96f2df0c305 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c
@@ -79,10 +79,6 @@ int rcar_du_lvds_connector_init(struct rcar_du_device *rcdu,
 
drm_connector_helper_add(connector, _helper_funcs);
 
-   connector->dpms = DRM_MODE_DPMS_OFF;
-   drm_object_property_set_value(>base,
-   rcdu->ddev->mode_config.dpms_property, DRM_MODE_DPMS_OFF);
-
ret = drm_mode_connector_attach_encoder(connector, encoder);
if (ret < 0)
return ret;
-- 
Regards,

Laurent Pinchart

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


[PATCH 1/2] drm/fsl-dcu: Don't set connector DPMS property

2017-08-15 Thread Laurent Pinchart
Since commit 4a97a3da420b ("drm: Don't update property values for atomic
drivers") atomic drivers must not update property values as properties
are read from the state instead. To catch remaining users, the
drm_object_property_set_value() function now throws a warning when
called by atomic drivers on non-immutable properties, and we hit that
warning when creating connectors.

The easy fix is to just remove the drm_object_property_set_value() as it
is used here to set the initial value of the connector's DPMS property
to OFF. The DPMS property applies on top of the connector's state crtc
pointer (initialized to NULL) that is the main connector on/off control,
and should thus default to ON.

Fixes: 4a97a3da420b ("drm: Don't update property values for atomic drivers")
Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 4 
 1 file changed, 4 deletions(-)

This patch fixes a regression in drm-next and should be merged in v4.14-rc1.

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c 
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
index edd7d8127d19..59eef5df71e0 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
@@ -122,10 +122,6 @@ static int fsl_dcu_attach_panel(struct fsl_dcu_drm_device 
*fsl_dev,
if (ret < 0)
goto err_sysfs;
 
-   drm_object_property_set_value(>base,
- mode_config->dpms_property,
- DRM_MODE_DPMS_OFF);
-
ret = drm_panel_attach(panel, connector);
if (ret) {
dev_err(fsl_dev->dev, "failed to attach panel\n");
-- 
Regards,

Laurent Pinchart

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


Re: [PATCH] dma-buf/dma-fence: Signal all callbacks from dma_fence_release()

2017-08-15 Thread Christian König

Am 15.08.2017 um 13:23 schrieb Chris Wilson:

Quoting Christian König (2017-08-13 14:04:29)

Am 11.08.2017 um 19:01 schrieb Chris Wilson:

This is an illegal scenario, to free the fence whilst there are pending
callbacks. Currently, we emit a WARN and then cast aside the callbacks
leaving them dangling. Alternatively, we could set an error on the fence
and then signal fence so that any dependency chains from the fence can
be tidied up, and if they care they can check for the error.

The question is whether or not the cure is worse than the disease
(premature fence signaling is never pretty).

Signed-off-by: Chris Wilson 

Not sure if -EDEADLK is the best error code, but in general the approach
sounds like the least evil to me.

EDEADLK felt appropriate since that was the situation that I expect might
arise, well livelock.

-ENXIO? That seems a reasonable alternative.
-ENODEV?
The classic -ENOTTY?


No strong opinion either. For now I think we should just stick with 
-EDEADLK.


We would need something like -EHUMAN, because in this particular case 
the human who wrote the code has messed up the reference counting.


Christian.


-Chris



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


[radeon-alex:amd-staging-drm-next 772/843] drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3387:1-6: ERROR: reference preceded by free on line 3384 (fwd)

2017-08-15 Thread Julia Lawall
This looks like another variant of the code I just commented on, with the
same problems.  Note also the comments about iterator index variables,
although the code is not shown.  I haven't checked those issues.

julia

-- Forwarded message --
Date: Tue, 15 Aug 2017 17:33:08 +0800
From: kbuild test robot 
To: kbu...@01.org
Cc: Julia Lawall 
Subject: [radeon-alex:amd-staging-drm-next 772/843]
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3387:1-6: ERROR:
 reference preceded by free on line 3384

CC: kbuild-...@01.org
CC: dri-devel@lists.freedesktop.org
TO: Harry Wentland 
CC: Alex Deucher 
CC: Tony Cheng 

tree:   git://people.freedesktop.org/~agd5f/linux.git amd-staging-drm-next
head:   aec1199c9095951449e3932fac49ddeb9e99884a
commit: 83b1852f69c8d142d274f932b5a72bac2bf50953 [772/843] drm/amd/display: 
Merge amdgpu_dm_types and amdgpu_dm
:: branch date: 11 hours ago
:: commit date: 13 hours ago

>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3387:1-6: ERROR: 
>> reference preceded by free on line 3384
--
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4641:31-35: 
>> ERROR: invalid reference to the index variable of the iterator on line 4628
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4365:31-35: 
ERROR: invalid reference to the index variable of the iterator on line 4283

git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git remote update radeon-alex
git checkout 83b1852f69c8d142d274f932b5a72bac2bf50953
vim +3387 drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c

83b1852f6 Harry Wentland 2017-08-10  3338
83b1852f6 Harry Wentland 2017-08-10  3339  int amdgpu_dm_crtc_init(struct 
amdgpu_display_manager *dm,
83b1852f6 Harry Wentland 2017-08-10  3340   struct 
drm_plane *plane,
83b1852f6 Harry Wentland 2017-08-10  3341   uint32_t 
crtc_index)
83b1852f6 Harry Wentland 2017-08-10  3342  {
83b1852f6 Harry Wentland 2017-08-10  3343   struct amdgpu_crtc *acrtc = 
NULL;
83b1852f6 Harry Wentland 2017-08-10  3344   struct amdgpu_plane 
*cursor_plane;
83b1852f6 Harry Wentland 2017-08-10  3345
83b1852f6 Harry Wentland 2017-08-10  3346   int res = -ENOMEM;
83b1852f6 Harry Wentland 2017-08-10  3347
83b1852f6 Harry Wentland 2017-08-10  3348   cursor_plane = 
kzalloc(sizeof(*cursor_plane), GFP_KERNEL);
83b1852f6 Harry Wentland 2017-08-10  3349   if (!cursor_plane)
83b1852f6 Harry Wentland 2017-08-10  3350   goto fail;
83b1852f6 Harry Wentland 2017-08-10  3351
83b1852f6 Harry Wentland 2017-08-10  3352   cursor_plane->base.type = 
DRM_PLANE_TYPE_CURSOR;
83b1852f6 Harry Wentland 2017-08-10  3353   res = amdgpu_dm_plane_init(dm, 
cursor_plane, 0);
83b1852f6 Harry Wentland 2017-08-10  3354
83b1852f6 Harry Wentland 2017-08-10  3355   acrtc = kzalloc(sizeof(struct 
amdgpu_crtc), GFP_KERNEL);
83b1852f6 Harry Wentland 2017-08-10  3356   if (!acrtc)
83b1852f6 Harry Wentland 2017-08-10  3357   goto fail;
83b1852f6 Harry Wentland 2017-08-10  3358
83b1852f6 Harry Wentland 2017-08-10  3359   res = drm_crtc_init_with_planes(
83b1852f6 Harry Wentland 2017-08-10  3360   dm->ddev,
83b1852f6 Harry Wentland 2017-08-10  3361   >base,
83b1852f6 Harry Wentland 2017-08-10  3362   plane,
83b1852f6 Harry Wentland 2017-08-10  3363   
_plane->base,
83b1852f6 Harry Wentland 2017-08-10  3364   
_dm_crtc_funcs, NULL);
83b1852f6 Harry Wentland 2017-08-10  3365
83b1852f6 Harry Wentland 2017-08-10  3366   if (res)
83b1852f6 Harry Wentland 2017-08-10  3367   goto fail;
83b1852f6 Harry Wentland 2017-08-10  3368
83b1852f6 Harry Wentland 2017-08-10  3369   
drm_crtc_helper_add(>base, _dm_crtc_helper_funcs);
83b1852f6 Harry Wentland 2017-08-10  3370
83b1852f6 Harry Wentland 2017-08-10  3371   acrtc->max_cursor_width = 
dm->adev->dm.dc->caps.max_cursor_size;
83b1852f6 Harry Wentland 2017-08-10  3372   acrtc->max_cursor_height = 
dm->adev->dm.dc->caps.max_cursor_size;
83b1852f6 Harry Wentland 2017-08-10  3373
83b1852f6 Harry Wentland 2017-08-10  3374   acrtc->crtc_id = crtc_index;
83b1852f6 Harry Wentland 2017-08-10  3375   acrtc->base.enabled = false;
83b1852f6 Harry Wentland 2017-08-10  3376
83b1852f6 Harry Wentland 2017-08-10  3377   
dm->adev->mode_info.crtcs[crtc_index] = acrtc;
83b1852f6 Harry Wentland 2017-08-10  3378   
drm_mode_crtc_set_gamma_size(>base, 256);
83b1852f6 Harry Wentland 2017-08-10  3379
83b1852f6 Harry Wentland 2017-08-10  3380   return 0;
83b1852f6 Harry Wentland 2017-08-10  3381
83b1852f6 Harry Wentland 2017-08-10  3382  fail:
83b1852f6 Harry Wentland 2017-08-10  3383   if (acrtc)
83b1852f6 Harry Wentland 2017-08-10 @3384   

[radeon-alex:amd-staging-drm-next 773/843] drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3388:8-15: ERROR: acrtc is NULL but dereferenced. (fwd)

2017-08-15 Thread Julia Lawall
The NULL comment is referring to the path to line 3388 via line 3360.  But
if the value is not NULL, there will be an update of previously freed
memory.

julia

-- Forwarded message --
Date: Tue, 15 Aug 2017 18:58:51 +0800
From: kbuild test robot 
To: kbu...@01.org
Cc: Julia Lawall 
Subject: [radeon-alex:amd-staging-drm-next 773/843]
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3388:8-15:
ERROR: acrtc is NULL but dereferenced.

CC: kbuild-...@01.org
CC: dri-devel@lists.freedesktop.org
TO: Harry Wentland 
CC: Alex Deucher 
CC: Tony Cheng 

tree:   git://people.freedesktop.org/~agd5f/linux.git amd-staging-drm-next
head:   aec1199c9095951449e3932fac49ddeb9e99884a
commit: 6d597da6c6c4b58a79887039db8fe5b221ccef3f [773/843] drm/amd/display: Fix 
ckeckpatch problems in amdgpu_dm
:: branch date: 12 hours ago
:: commit date: 14 hours ago

>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3388:8-15: 
>> ERROR: acrtc is NULL but dereferenced.

git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git remote update radeon-alex
git checkout 6d597da6c6c4b58a79887039db8fe5b221ccef3f
vim +3388 drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c

83b1852f6 Harry Wentland 2017-08-10  3341
83b1852f6 Harry Wentland 2017-08-10  3342  int amdgpu_dm_crtc_init(struct 
amdgpu_display_manager *dm,
83b1852f6 Harry Wentland 2017-08-10  3343   struct 
drm_plane *plane,
83b1852f6 Harry Wentland 2017-08-10  3344   uint32_t 
crtc_index)
83b1852f6 Harry Wentland 2017-08-10  3345  {
83b1852f6 Harry Wentland 2017-08-10  3346   struct amdgpu_crtc *acrtc = 
NULL;
83b1852f6 Harry Wentland 2017-08-10  3347   struct amdgpu_plane 
*cursor_plane;
83b1852f6 Harry Wentland 2017-08-10  3348
83b1852f6 Harry Wentland 2017-08-10  3349   int res = -ENOMEM;
83b1852f6 Harry Wentland 2017-08-10  3350
83b1852f6 Harry Wentland 2017-08-10  3351   cursor_plane = 
kzalloc(sizeof(*cursor_plane), GFP_KERNEL);
83b1852f6 Harry Wentland 2017-08-10  3352   if (!cursor_plane)
83b1852f6 Harry Wentland 2017-08-10  3353   goto fail;
83b1852f6 Harry Wentland 2017-08-10  3354
83b1852f6 Harry Wentland 2017-08-10  3355   cursor_plane->base.type = 
DRM_PLANE_TYPE_CURSOR;
83b1852f6 Harry Wentland 2017-08-10  3356   res = amdgpu_dm_plane_init(dm, 
cursor_plane, 0);
83b1852f6 Harry Wentland 2017-08-10  3357
83b1852f6 Harry Wentland 2017-08-10  3358   acrtc = kzalloc(sizeof(struct 
amdgpu_crtc), GFP_KERNEL);
83b1852f6 Harry Wentland 2017-08-10  3359   if (!acrtc)
83b1852f6 Harry Wentland 2017-08-10  3360   goto fail;
83b1852f6 Harry Wentland 2017-08-10  3361
83b1852f6 Harry Wentland 2017-08-10  3362   res = drm_crtc_init_with_planes(
83b1852f6 Harry Wentland 2017-08-10  3363   dm->ddev,
83b1852f6 Harry Wentland 2017-08-10  3364   >base,
83b1852f6 Harry Wentland 2017-08-10  3365   plane,
83b1852f6 Harry Wentland 2017-08-10  3366   
_plane->base,
83b1852f6 Harry Wentland 2017-08-10  3367   
_dm_crtc_funcs, NULL);
83b1852f6 Harry Wentland 2017-08-10  3368
83b1852f6 Harry Wentland 2017-08-10  3369   if (res)
83b1852f6 Harry Wentland 2017-08-10  3370   goto fail;
83b1852f6 Harry Wentland 2017-08-10  3371
83b1852f6 Harry Wentland 2017-08-10  3372   
drm_crtc_helper_add(>base, _dm_crtc_helper_funcs);
83b1852f6 Harry Wentland 2017-08-10  3373
83b1852f6 Harry Wentland 2017-08-10  3374   acrtc->max_cursor_width = 
dm->adev->dm.dc->caps.max_cursor_size;
83b1852f6 Harry Wentland 2017-08-10  3375   acrtc->max_cursor_height = 
dm->adev->dm.dc->caps.max_cursor_size;
83b1852f6 Harry Wentland 2017-08-10  3376
83b1852f6 Harry Wentland 2017-08-10  3377   acrtc->crtc_id = crtc_index;
83b1852f6 Harry Wentland 2017-08-10  3378   acrtc->base.enabled = false;
83b1852f6 Harry Wentland 2017-08-10  3379
83b1852f6 Harry Wentland 2017-08-10  3380   
dm->adev->mode_info.crtcs[crtc_index] = acrtc;
83b1852f6 Harry Wentland 2017-08-10  3381   
drm_mode_crtc_set_gamma_size(>base, 256);
83b1852f6 Harry Wentland 2017-08-10  3382
83b1852f6 Harry Wentland 2017-08-10  3383   return 0;
83b1852f6 Harry Wentland 2017-08-10  3384
83b1852f6 Harry Wentland 2017-08-10  3385  fail:
83b1852f6 Harry Wentland 2017-08-10  3386   kfree(acrtc);
83b1852f6 Harry Wentland 2017-08-10  3387   kfree(cursor_plane);
83b1852f6 Harry Wentland 2017-08-10 @3388   acrtc->crtc_id = -1;
83b1852f6 Harry Wentland 2017-08-10  3389   return res;
83b1852f6 Harry Wentland 2017-08-10  3390  }
83b1852f6 Harry Wentland 2017-08-10  3391

:: The code at line 3388 was first introduced by commit
:: 83b1852f69c8d142d274f932b5a72bac2bf50953 drm/amd/display: Merge 
amdgpu_dm_types and 

Re: [PATCH] dma-buf/dma-fence: Signal all callbacks from dma_fence_release()

2017-08-15 Thread Chris Wilson
Quoting Christian König (2017-08-13 14:04:29)
> Am 11.08.2017 um 19:01 schrieb Chris Wilson:
> > This is an illegal scenario, to free the fence whilst there are pending
> > callbacks. Currently, we emit a WARN and then cast aside the callbacks
> > leaving them dangling. Alternatively, we could set an error on the fence
> > and then signal fence so that any dependency chains from the fence can
> > be tidied up, and if they care they can check for the error.
> >
> > The question is whether or not the cure is worse than the disease
> > (premature fence signaling is never pretty).
> >
> > Signed-off-by: Chris Wilson 
> 
> Not sure if -EDEADLK is the best error code, but in general the approach 
> sounds like the least evil to me.

EDEADLK felt appropriate since that was the situation that I expect might
arise, well livelock.

-ENXIO? That seems a reasonable alternative.
-ENODEV?
The classic -ENOTTY?
-Chris
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Intel-gfx] [PATCH] drm/atomic: If the atomic check fails, return its value first

2017-08-15 Thread Maarten Lankhorst
Op 15-08-17 om 12:02 schreef Daniel Vetter:
> On Tue, Aug 15, 2017 at 11:57:06AM +0200, Maarten Lankhorst wrote:
>> The last part of drm_atomic_check_only is testing whether we need to
>> fail with -EINVAL when modeset is not allowed, but forgets to return
>> the value when atomic_check() fails first.
>>
>> This results in -EDEADLK being replaced by -EINVAL, and the sanity
>> check in drm_modeset_drop_locks kicks in:
>>
>> [  308.531734] [ cut here ]
>> [  308.531791] WARNING: CPU: 0 PID: 1886 at 
>> drivers/gpu/drm/drm_modeset_lock.c:217 drm_modeset_drop_locks+0x33/0xc0 [drm]
>> [  308.531828] Modules linked in:
>> [  308.532050] CPU: 0 PID: 1886 Comm: kms_atomic Tainted: G U  W 
>> 4.13.0-rc5-patser+ #5225
>> [  308.532082] Hardware name: NUC5i7RYB, BIOS 
>> RYBDWi35.86A.0246.2015.0309.1355 03/09/2015
>> [  308.532124] task: 8800cd9dae00 task.stack: 8800ca3b8000
>> [  308.532168] RIP: 0010:drm_modeset_drop_locks+0x33/0xc0 [drm]
>> [  308.532189] RSP: 0018:8800ca3bf980 EFLAGS: 00010282
>> [  308.532211] RAX: dc00 RBX: 8800ca3bfaf8 RCX: 
>> 13a171e6
>> [  308.532235] RDX: 110019477f69 RSI: a8ba4fa0 RDI: 
>> 8800ca3bfb48
>> [  308.532258] RBP: 8800ca3bf998 R08:  R09: 
>> 0003
>> [  308.532281] R10: 79dbe066 R11: f760b34b R12: 
>> 0001
>> [  308.532304] R13: dc00 R14: ffea R15: 
>> 880096889680
>> [  308.532328] FS:  7ff00959cec0() GS:8800d4e0() 
>> knlGS:
>> [  308.532359] CS:  0010 DS:  ES:  CR0: 80050033
>> [  308.532380] CR2: 0008 CR3: ca2e3000 CR4: 
>> 003406f0
>> [  308.532402] Call Trace:
>> [  308.532440]  drm_mode_atomic_ioctl+0x19fa/0x1c00 [drm]
>> [  308.532488]  ? drm_atomic_set_property+0x1220/0x1220 [drm]
>> [  308.532565]  ? avc_has_extended_perms+0xc39/0xff0
>> [  308.532593]  ? lock_downgrade+0x610/0x610
>> [  308.532640]  ? drm_atomic_set_property+0x1220/0x1220 [drm]
>> [  308.532680]  drm_ioctl_kernel+0x154/0x1a0 [drm]
>> [  308.532755]  drm_ioctl+0x624/0x8f0 [drm]
>> [  308.532858]  ? drm_atomic_set_property+0x1220/0x1220 [drm]
>> [  308.532976]  ? drm_getunique+0x210/0x210 [drm]
>> [  308.533061]  do_vfs_ioctl+0xd92/0xe40
>> [  308.533121]  ? ioctl_preallocate+0x1b0/0x1b0
>> [  308.533160]  ? selinux_capable+0x20/0x20
>> [  308.533191]  ? do_fcntl+0x1b1/0xbf0
>> [  308.533219]  ? kasan_slab_free+0xa2/0xb0
>> [  308.533249]  ? f_getown+0x4b/0xa0
>> [  308.533278]  ? putname+0xcf/0xe0
>> [  308.533309]  ? security_file_ioctl+0x57/0x90
>> [  308.533342]  SyS_ioctl+0x4e/0x80
>> [  308.533374]  entry_SYSCALL_64_fastpath+0x18/0xad
>> [  308.533405] RIP: 0033:0x7ff00779e4d7
>> [  308.533431] RSP: 002b:7fff66a043d8 EFLAGS: 0246 ORIG_RAX: 
>> 0010
>> [  308.533481] RAX: ffda RBX: 00e7c7ca5910 RCX: 
>> 7ff00779e4d7
>> [  308.533560] RDX: 7fff66a04430 RSI: c03864bc RDI: 
>> 0003
>> [  308.533608] RBP: 7ff007a5fb00 R08: 00e7c7ca4620 R09: 
>> 00e7c7ca5e60
>> [  308.533647] R10: 0001 R11: 0246 R12: 
>> 0070
>> [  308.533685] R13:  R14:  R15: 
>> 00e7c7ca5930
>> [  308.533770] Code: ff df 55 48 89 e5 41 55 41 54 53 48 89 fb 48 83 c7
>> 50 48 89 fa 48 c1 ea 03 80 3c 02 00 74 05 e8 94 d4 16 e7 48 83 7b 50 00
>> 74 02 <0f> ff 4c 8d 6b 58 48 b8 00 00 00 00 00 fc ff df 4c 89 ea 48 c1
>> [  308.534086] ---[ end trace 77f11e53b1df44ad ]---
>>
>> Solve this by adding the missing return.
>>
>> Signed-off-by: Maarten Lankhorst 
>> Testcase: kms_atomic
> I think we want this in drm-misc-fixes with Cc: sta...@vger.kernel.org,
> because we could end up with a EDEADLCK, and getting past that would
> perhaps have changed the modeset to a fast-set or something like that.
>
> Maybe add a few lines to explain that to the commit message, to make it
> clear it's not just a debug check fix, but a real bugfix.
>
> With that:
>
> Reviewed-by: Daniel Vetter 
>
>
>> ---
>>  drivers/gpu/drm/drm_atomic.c | 5 -
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
>> index 20fec92a..471551d2d8f3 100644
>> --- a/drivers/gpu/drm/drm_atomic.c
>> +++ b/drivers/gpu/drm/drm_atomic.c
>> @@ -1631,6 +1631,9 @@ int drm_atomic_check_only(struct drm_atomic_state 
>> *state)
>>  if (config->funcs->atomic_check)
>>  ret = config->funcs->atomic_check(state->dev, state);
>>  
>> +if (ret)
>> +return ret;
>> +
>>  if (!state->allow_modeset) {
>>  for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
>>  if (drm_atomic_crtc_needs_modeset(crtc_state)) {
>> @@ -1641,7 +1644,7 @@ int drm_atomic_check_only(struct drm_atomic_state 
>> *state)
>> 

Re: [Intel-gfx] [PATCH] drm/atomic: If the atomic check fails, return its value first

2017-08-15 Thread Daniel Vetter
On Tue, Aug 15, 2017 at 11:57:06AM +0200, Maarten Lankhorst wrote:
> The last part of drm_atomic_check_only is testing whether we need to
> fail with -EINVAL when modeset is not allowed, but forgets to return
> the value when atomic_check() fails first.
> 
> This results in -EDEADLK being replaced by -EINVAL, and the sanity
> check in drm_modeset_drop_locks kicks in:
> 
> [  308.531734] [ cut here ]
> [  308.531791] WARNING: CPU: 0 PID: 1886 at 
> drivers/gpu/drm/drm_modeset_lock.c:217 drm_modeset_drop_locks+0x33/0xc0 [drm]
> [  308.531828] Modules linked in:
> [  308.532050] CPU: 0 PID: 1886 Comm: kms_atomic Tainted: G U  W 
> 4.13.0-rc5-patser+ #5225
> [  308.532082] Hardware name: NUC5i7RYB, BIOS 
> RYBDWi35.86A.0246.2015.0309.1355 03/09/2015
> [  308.532124] task: 8800cd9dae00 task.stack: 8800ca3b8000
> [  308.532168] RIP: 0010:drm_modeset_drop_locks+0x33/0xc0 [drm]
> [  308.532189] RSP: 0018:8800ca3bf980 EFLAGS: 00010282
> [  308.532211] RAX: dc00 RBX: 8800ca3bfaf8 RCX: 
> 13a171e6
> [  308.532235] RDX: 110019477f69 RSI: a8ba4fa0 RDI: 
> 8800ca3bfb48
> [  308.532258] RBP: 8800ca3bf998 R08:  R09: 
> 0003
> [  308.532281] R10: 79dbe066 R11: f760b34b R12: 
> 0001
> [  308.532304] R13: dc00 R14: ffea R15: 
> 880096889680
> [  308.532328] FS:  7ff00959cec0() GS:8800d4e0() 
> knlGS:
> [  308.532359] CS:  0010 DS:  ES:  CR0: 80050033
> [  308.532380] CR2: 0008 CR3: ca2e3000 CR4: 
> 003406f0
> [  308.532402] Call Trace:
> [  308.532440]  drm_mode_atomic_ioctl+0x19fa/0x1c00 [drm]
> [  308.532488]  ? drm_atomic_set_property+0x1220/0x1220 [drm]
> [  308.532565]  ? avc_has_extended_perms+0xc39/0xff0
> [  308.532593]  ? lock_downgrade+0x610/0x610
> [  308.532640]  ? drm_atomic_set_property+0x1220/0x1220 [drm]
> [  308.532680]  drm_ioctl_kernel+0x154/0x1a0 [drm]
> [  308.532755]  drm_ioctl+0x624/0x8f0 [drm]
> [  308.532858]  ? drm_atomic_set_property+0x1220/0x1220 [drm]
> [  308.532976]  ? drm_getunique+0x210/0x210 [drm]
> [  308.533061]  do_vfs_ioctl+0xd92/0xe40
> [  308.533121]  ? ioctl_preallocate+0x1b0/0x1b0
> [  308.533160]  ? selinux_capable+0x20/0x20
> [  308.533191]  ? do_fcntl+0x1b1/0xbf0
> [  308.533219]  ? kasan_slab_free+0xa2/0xb0
> [  308.533249]  ? f_getown+0x4b/0xa0
> [  308.533278]  ? putname+0xcf/0xe0
> [  308.533309]  ? security_file_ioctl+0x57/0x90
> [  308.533342]  SyS_ioctl+0x4e/0x80
> [  308.533374]  entry_SYSCALL_64_fastpath+0x18/0xad
> [  308.533405] RIP: 0033:0x7ff00779e4d7
> [  308.533431] RSP: 002b:7fff66a043d8 EFLAGS: 0246 ORIG_RAX: 
> 0010
> [  308.533481] RAX: ffda RBX: 00e7c7ca5910 RCX: 
> 7ff00779e4d7
> [  308.533560] RDX: 7fff66a04430 RSI: c03864bc RDI: 
> 0003
> [  308.533608] RBP: 7ff007a5fb00 R08: 00e7c7ca4620 R09: 
> 00e7c7ca5e60
> [  308.533647] R10: 0001 R11: 0246 R12: 
> 0070
> [  308.533685] R13:  R14:  R15: 
> 00e7c7ca5930
> [  308.533770] Code: ff df 55 48 89 e5 41 55 41 54 53 48 89 fb 48 83 c7
> 50 48 89 fa 48 c1 ea 03 80 3c 02 00 74 05 e8 94 d4 16 e7 48 83 7b 50 00
> 74 02 <0f> ff 4c 8d 6b 58 48 b8 00 00 00 00 00 fc ff df 4c 89 ea 48 c1
> [  308.534086] ---[ end trace 77f11e53b1df44ad ]---
> 
> Solve this by adding the missing return.
> 
> Signed-off-by: Maarten Lankhorst 
> Testcase: kms_atomic
I think we want this in drm-misc-fixes with Cc: sta...@vger.kernel.org,
because we could end up with a EDEADLCK, and getting past that would
perhaps have changed the modeset to a fast-set or something like that.

Maybe add a few lines to explain that to the commit message, to make it
clear it's not just a debug check fix, but a real bugfix.

With that:

Reviewed-by: Daniel Vetter 


> ---
>  drivers/gpu/drm/drm_atomic.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 20fec92a..471551d2d8f3 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1631,6 +1631,9 @@ int drm_atomic_check_only(struct drm_atomic_state 
> *state)
>   if (config->funcs->atomic_check)
>   ret = config->funcs->atomic_check(state->dev, state);
>  
> + if (ret)
> + return ret;
> +
>   if (!state->allow_modeset) {
>   for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
>   if (drm_atomic_crtc_needs_modeset(crtc_state)) {
> @@ -1641,7 +1644,7 @@ int drm_atomic_check_only(struct drm_atomic_state 
> *state)
>   }
>   }
>  
> - return ret;
> + return 0;
>  }
>  EXPORT_SYMBOL(drm_atomic_check_only);
>  
> -- 
> 2.11.0
> 
> 

[PATCH] drm/atomic: If the atomic check fails, return its value first

2017-08-15 Thread Maarten Lankhorst
The last part of drm_atomic_check_only is testing whether we need to
fail with -EINVAL when modeset is not allowed, but forgets to return
the value when atomic_check() fails first.

This results in -EDEADLK being replaced by -EINVAL, and the sanity
check in drm_modeset_drop_locks kicks in:

[  308.531734] [ cut here ]
[  308.531791] WARNING: CPU: 0 PID: 1886 at 
drivers/gpu/drm/drm_modeset_lock.c:217 drm_modeset_drop_locks+0x33/0xc0 [drm]
[  308.531828] Modules linked in:
[  308.532050] CPU: 0 PID: 1886 Comm: kms_atomic Tainted: G U  W 
4.13.0-rc5-patser+ #5225
[  308.532082] Hardware name: NUC5i7RYB, BIOS RYBDWi35.86A.0246.2015.0309.1355 
03/09/2015
[  308.532124] task: 8800cd9dae00 task.stack: 8800ca3b8000
[  308.532168] RIP: 0010:drm_modeset_drop_locks+0x33/0xc0 [drm]
[  308.532189] RSP: 0018:8800ca3bf980 EFLAGS: 00010282
[  308.532211] RAX: dc00 RBX: 8800ca3bfaf8 RCX: 13a171e6
[  308.532235] RDX: 110019477f69 RSI: a8ba4fa0 RDI: 8800ca3bfb48
[  308.532258] RBP: 8800ca3bf998 R08:  R09: 0003
[  308.532281] R10: 79dbe066 R11: f760b34b R12: 0001
[  308.532304] R13: dc00 R14: ffea R15: 880096889680
[  308.532328] FS:  7ff00959cec0() GS:8800d4e0() 
knlGS:
[  308.532359] CS:  0010 DS:  ES:  CR0: 80050033
[  308.532380] CR2: 0008 CR3: ca2e3000 CR4: 003406f0
[  308.532402] Call Trace:
[  308.532440]  drm_mode_atomic_ioctl+0x19fa/0x1c00 [drm]
[  308.532488]  ? drm_atomic_set_property+0x1220/0x1220 [drm]
[  308.532565]  ? avc_has_extended_perms+0xc39/0xff0
[  308.532593]  ? lock_downgrade+0x610/0x610
[  308.532640]  ? drm_atomic_set_property+0x1220/0x1220 [drm]
[  308.532680]  drm_ioctl_kernel+0x154/0x1a0 [drm]
[  308.532755]  drm_ioctl+0x624/0x8f0 [drm]
[  308.532858]  ? drm_atomic_set_property+0x1220/0x1220 [drm]
[  308.532976]  ? drm_getunique+0x210/0x210 [drm]
[  308.533061]  do_vfs_ioctl+0xd92/0xe40
[  308.533121]  ? ioctl_preallocate+0x1b0/0x1b0
[  308.533160]  ? selinux_capable+0x20/0x20
[  308.533191]  ? do_fcntl+0x1b1/0xbf0
[  308.533219]  ? kasan_slab_free+0xa2/0xb0
[  308.533249]  ? f_getown+0x4b/0xa0
[  308.533278]  ? putname+0xcf/0xe0
[  308.533309]  ? security_file_ioctl+0x57/0x90
[  308.533342]  SyS_ioctl+0x4e/0x80
[  308.533374]  entry_SYSCALL_64_fastpath+0x18/0xad
[  308.533405] RIP: 0033:0x7ff00779e4d7
[  308.533431] RSP: 002b:7fff66a043d8 EFLAGS: 0246 ORIG_RAX: 
0010
[  308.533481] RAX: ffda RBX: 00e7c7ca5910 RCX: 7ff00779e4d7
[  308.533560] RDX: 7fff66a04430 RSI: c03864bc RDI: 0003
[  308.533608] RBP: 7ff007a5fb00 R08: 00e7c7ca4620 R09: 00e7c7ca5e60
[  308.533647] R10: 0001 R11: 0246 R12: 0070
[  308.533685] R13:  R14:  R15: 00e7c7ca5930
[  308.533770] Code: ff df 55 48 89 e5 41 55 41 54 53 48 89 fb 48 83 c7
50 48 89 fa 48 c1 ea 03 80 3c 02 00 74 05 e8 94 d4 16 e7 48 83 7b 50 00
74 02 <0f> ff 4c 8d 6b 58 48 b8 00 00 00 00 00 fc ff df 4c 89 ea 48 c1
[  308.534086] ---[ end trace 77f11e53b1df44ad ]---

Solve this by adding the missing return.

Signed-off-by: Maarten Lankhorst 
Testcase: kms_atomic
---
 drivers/gpu/drm/drm_atomic.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 20fec92a..471551d2d8f3 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1631,6 +1631,9 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
if (config->funcs->atomic_check)
ret = config->funcs->atomic_check(state->dev, state);
 
+   if (ret)
+   return ret;
+
if (!state->allow_modeset) {
for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
if (drm_atomic_crtc_needs_modeset(crtc_state)) {
@@ -1641,7 +1644,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
}
}
 
-   return ret;
+   return 0;
 }
 EXPORT_SYMBOL(drm_atomic_check_only);
 
-- 
2.11.0

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


Re: [PATCH v5 3/3] drm/rockchip: Add support for Rockchip Soc LVDS

2017-08-15 Thread Wadim Egorov


Am 15.08.2017 um 05:49 schrieb Sandy Huang:
> This adds support for Rockchip soc lvds found on rk3288
> Based on the patches from Mark yao and Heiko Stuebner
>
> Signed-off-by: Sandy Huang 
> Signed-off-by: Mark Yao 
> Signed-off-by: Heiko Stuebner 
> ---
>  drivers/gpu/drm/rockchip/Kconfig|   9 +
>  drivers/gpu/drm/rockchip/Makefile   |   1 +
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c |   2 +
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.h |   1 +
>  drivers/gpu/drm/rockchip/rockchip_lvds.c| 599 
> 
>  drivers/gpu/drm/rockchip/rockchip_lvds.h| 109 +
>  6 files changed, 721 insertions(+)
>  create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.c
>  create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.h
>
I have tested this with an ETM0700G0DH6 7.0" LCD panel on the
phyCORE-RK3288.

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


[PATCH] drm/nouveau: Fix merge commit

2017-08-15 Thread Maarten Lankhorst
The most recent merge commit in airlied/drm-next has problems with
confusing old_crtc_state and new_crtc_state. Use the
for_each_oldnew_crtc_in_state macros to clean up the confusion,
and explicitly look at the correct state instead of looking at
asyh->state.

With these fixes it becomes more obvious what the code is trying to do,
which will hopefully prevent future confusion.

Cc: Dave Airlie 
Signed-off-by: Maarten Lankhorst 
---
 drivers/gpu/drm/nouveau/nv50_display.c | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nv50_display.c 
b/drivers/gpu/drm/nouveau/nv50_display.c
index 2efcfb18024d..f7b4326a4641 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -3897,7 +3897,7 @@ static void
 nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
 {
struct drm_device *dev = state->dev;
-   struct drm_crtc_state *new_crtc_state;
+   struct drm_crtc_state *new_crtc_state, *old_crtc_state;
struct drm_crtc *crtc;
struct drm_plane_state *new_plane_state;
struct drm_plane *plane;
@@ -3918,13 +3918,13 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state 
*state)
mutex_lock(>mutex);
 
/* Disable head(s). */
-   for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
+   for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, 
new_crtc_state, i) {
struct nv50_head_atom *asyh = nv50_head_atom(new_crtc_state);
struct nv50_head *head = nv50_head(crtc);
 
NV_ATOMIC(drm, "%s: clr %04x (set %04x)\n", crtc->name,
  asyh->clr.mask, asyh->set.mask);
-   if (new_crtc_state->active && !asyh->state.active)
+   if (old_crtc_state->active && !new_crtc_state->active)
drm_crtc_vblank_off(crtc);
 
if (asyh->clr.mask) {
@@ -4000,7 +4000,7 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state 
*state)
}
 
/* Update head(s). */
-   for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
+   for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, 
new_crtc_state, i) {
struct nv50_head_atom *asyh = nv50_head_atom(new_crtc_state);
struct nv50_head *head = nv50_head(crtc);
 
@@ -4012,10 +4012,10 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state 
*state)
interlock_core = 1;
}
 
-   if (asyh->state.active) {
-   if (!new_crtc_state->active)
+   if (new_crtc_state->active) {
+   if (!old_crtc_state->active)
drm_crtc_vblank_on(crtc);
-   if (asyh->state.event)
+   if (new_crtc_state->event)
drm_crtc_vblank_get(crtc);
}
}
@@ -4064,13 +4064,14 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state 
*state)
if (new_crtc_state->event) {
unsigned long flags;
/* Get correct count/ts if racing with vblank irq */
-   if (crtc->state->active)
+   if (new_crtc_state->active)
drm_crtc_accurate_vblank_count(crtc);
spin_lock_irqsave(>dev->event_lock, flags);
drm_crtc_send_vblank_event(crtc, new_crtc_state->event);
spin_unlock_irqrestore(>dev->event_lock, flags);
+
new_crtc_state->event = NULL;
-   if (crtc->state->active)
+   if (new_crtc_state->active)
drm_crtc_vblank_put(crtc);
}
}
-- 
2.11.0

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