[Bug 111281] When the s admin try to create different types of question in various difficulty level by single upload mode database error occurred

2019-08-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=111281

dhrisya  changed:

   What|Removed |Added

 CC||dhrisyasb...@gmail.com
 Status|NEW |ASSIGNED

-- 
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: Threaded submission & semaphore sharing

2019-08-01 Thread Lionel Landwerlin

On 02/08/2019 08:21, Koenig, Christian wrote:



Am 02.08.2019 07:17 schrieb Lionel Landwerlin 
:


On 02/08/2019 08:08, Koenig, Christian wrote:

Hi Lionel,

Well that looks more like your test case is buggy.

According to the code the ctx1 queue always waits for sem1 and
ctx2 queue always waits for sem2.


That's supposed to be the same underlying syncobj because it's
exported from one VkDevice as opaque FD from sem1 and imported
into sem2.


Well than that's still buggy and won't synchronize at all.

When ctx1 waits for a semaphore and then signals the same semaphore 
there is no guarantee that ctx2 will run in between jobs.


It's perfectly valid in this case to first run all jobs from ctx1 and 
then all jobs from ctx2.



That's not really how I see the semaphores working.

The spec describe VkSemaphore as an interface to an internal payload 
opaque to the application.



When ctx1 waits on the semaphore, it waits on the payload put there by 
the previous iteration.


Then it proceeds to signal it by replacing the internal payload.


ctx2 then waits on that and replaces the payload again with the new 
internal synchronization object.



The internal payload is a dma fence in our case and signaling just 
replaces a dma fence by another or puts one where there was none before.


So we should have created a dependecy link between all the submissions 
and then should be executed in the order of QueueSubmit() calls.



-Lionel




It only prevents running both at the same time and as far as I can see 
that still works even with threaded submission.


You need at least two semaphores for a tandem submission.

Regards,
Christian.



This way there can't be any Synchronisation between the two.

Regards,
Christian.

Am 02.08.2019 06:55 schrieb Lionel Landwerlin

:
Hey Christian,

The problem boils down to the fact that we don't immediately
create dma fences when calling vkQueueSubmit().
This is delayed to a thread.

From a single application thread, you can QueueSubmit() to 2
queues from 2 different devices.
Each QueueSubmit to one queue has a dependency on the previous
QueueSubmit on the other queue through an exported/imported
semaphore.

From the API point of view the state of the semaphore should
be changed after each QueueSubmit().
The problem is that it's not because of the thread and because
you might have those 2 submission threads tied to different
VkDevice/VkInstance or even different applications
(synchronizing themselves outside the vulkan API).

Hope that makes sense.
It's not really easy to explain by mail, the best explanation
is probably reading the test :

https://gitlab.freedesktop.org/mesa/crucible/blob/master/src/tests/func/sync/semaphore-fd.c#L788

Like David mentioned you're not running into that issue right
now, because you only dispatch to the thread under specific
conditions.
But I could build a case to force that and likely run into the
same issue.

-Lionel

On 02/08/2019 07:33, Koenig, Christian wrote:

Hi Lionel,

Well could you describe once more what the problem is?

Cause I don't fully understand why a rather normal tandem
submission with two semaphores should fail in any way.

Regards,
Christian.

Am 02.08.2019 06:28 schrieb Lionel Landwerlin

:
There aren't CTS tests covering the issue I was mentioning.
But we could add them.

I don't have all the details regarding your implementation
but even with
the "semaphore thread", I could see it running into the
same issues.
What if a mix of binary & timeline semaphores are handed
to vkQueueSubmit()?

For example with queueA & queueB from 2 different VkDevice :
 vkQueueSubmit(queueA, signal semA);
 vkQueueSubmit(queueA, wait on [semA, timelineSemB]);
with
timelineSemB triggering a wait before signal.
 vkQueueSubmit(queueB, signal semA);


-Lionel

On 02/08/2019 06:18, Zhou, David(ChunMing) wrote:
> Hi Lionel,
>
> By the Queue thread is a heavy thread, which is always
resident in driver during application running, our guys
don't like that. So we switch to Semaphore Thread, only
when waitBeforeSignal of timeline happens, we spawn a
thread to handle that wait. So we don't have your this issue.
> By the way, I already pass all your CTS cases for now. I

Re: [Intel-gfx] [linux-next] mm/i915: i915_gemfs_init() NULL dereference

2019-08-01 Thread Sergey Senozhatsky
On (08/01/19 18:30), Chris Wilson wrote:
> Quoting Sergey Senozhatsky (2019-07-31 17:48:29)
> > @@ -36,19 +38,35 @@ int i915_gemfs_init(struct drm_i915_private *i915)
[..]
> > +   if (!fc->ops->parse_monolithic)
> > +   goto err;
> > +
> > +   err = fc->ops->parse_monolithic(fc, options);
> > +   if (err)
> > +   goto err;
> > +
> > +   if (!fc->ops->reconfigure)
> 
> It would be odd for fs_context_for_reconfigure() to allow creation of a
> context if that context couldn't perform a reconfigre, nevertheless that
> seems to be the case.

Well, I kept those checks just because fs/ code does the same.

E.g. fs/super.c

reconfigure_super()
{
if (fc->ops->reconfigure)
fc->ops->reconfigure(fc)
}

do_emergency_remount_callback()
{
fc = fs_context_for_reconfigure();
reconfigure_super(fc);
}

> > +   goto err;
> > +
> > +   err = fc->ops->reconfigure(fc);
> > +   if (err)
> > +   goto err;
> 
> Only thing that stands out is that we should put_fs_context() here as
> well.

Oh... Indeed, somehow I forgot to put_fs_context().

> I guess it's better than poking at the SB_INFO directly ourselves.
> I think though we shouldn't bail if we can't change the thp setting, and
> just accept whatever with a warning.

OK.

> Looks like the API is already available in dinq, so we can apply this
> ahead of the next merge window.

OK, will cook a formal patch then. Thanks!

-ss


[PATCH v4 05/17] drm/amdgpu: use embedded gem object

2019-08-01 Thread Gerd Hoffmann
Drop drm_gem_object from amdgpu_bo, use the
ttm_buffer_object.base instead.

Build tested only.

Signed-off-by: Gerd Hoffmann 
Reviewed-by: Christian König 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h  |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c |  8 
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c  | 10 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c |  2 +-
 6 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h
index b8ba6e27c61f..2f17150e26e1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h
@@ -31,7 +31,7 @@
  */
 
 #define AMDGPU_GEM_DOMAIN_MAX  0x3
-#define gem_to_amdgpu_bo(gobj) container_of((gobj), struct amdgpu_bo, gem_base)
+#define gem_to_amdgpu_bo(gobj) container_of((gobj), struct amdgpu_bo, tbo.base)
 
 void amdgpu_gem_object_free(struct drm_gem_object *obj);
 int amdgpu_gem_object_open(struct drm_gem_object *obj,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
index d60593cc436e..645a189d365c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
@@ -94,7 +94,6 @@ struct amdgpu_bo {
/* per VM structure for page tables and with virtual addresses */
struct amdgpu_vm_bo_base*vm_bo;
/* Constant after initialization */
-   struct drm_gem_object   gem_base;
struct amdgpu_bo*parent;
struct amdgpu_bo*shadow;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
index 02cd845e77b3..4ee452fe0526 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
@@ -393,7 +393,7 @@ amdgpu_gem_prime_import_sg_table(struct drm_device *dev,
bo->prime_shared_count = 1;
 
ww_mutex_unlock(>lock);
-   return >gem_base;
+   return >tbo.base;
 
 error:
ww_mutex_unlock(>lock);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 939f8305511b..9ff0501cf1e0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -85,7 +85,7 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, 
unsigned long size,
}
return r;
}
-   *obj = >gem_base;
+   *obj = >tbo.base;
 
return 0;
 }
@@ -689,7 +689,7 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data,
struct drm_amdgpu_gem_create_in info;
void __user *out = u64_to_user_ptr(args->value);
 
-   info.bo_size = robj->gem_base.size;
+   info.bo_size = robj->tbo.base.size;
info.alignment = robj->tbo.mem.page_alignment << PAGE_SHIFT;
info.domains = robj->preferred_domains;
info.domain_flags = robj->flags;
@@ -819,8 +819,8 @@ static int amdgpu_debugfs_gem_bo_info(int id, void *ptr, 
void *data)
if (pin_count)
seq_printf(m, " pin count %d", pin_count);
 
-   dma_buf = READ_ONCE(bo->gem_base.dma_buf);
-   attachment = READ_ONCE(bo->gem_base.import_attach);
+   dma_buf = READ_ONCE(bo->tbo.base.dma_buf);
+   attachment = READ_ONCE(bo->tbo.base.import_attach);
 
if (attachment)
seq_printf(m, " imported from %p", dma_buf);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 19ec775b7aa8..8d649d8a7302 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -85,9 +85,9 @@ static void amdgpu_bo_destroy(struct ttm_buffer_object *tbo)
 
amdgpu_bo_kunmap(bo);
 
-   if (bo->gem_base.import_attach)
-   drm_prime_gem_destroy(>gem_base, bo->tbo.sg);
-   drm_gem_object_release(>gem_base);
+   if (bo->tbo.base.import_attach)
+   drm_prime_gem_destroy(>tbo.base, bo->tbo.sg);
+   drm_gem_object_release(>tbo.base);
/* in case amdgpu_device_recover_vram got NULL of bo->parent */
if (!list_empty(>shadow_list)) {
mutex_lock(>shadow_list_lock);
@@ -454,7 +454,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
bo = kzalloc(sizeof(struct amdgpu_bo), GFP_KERNEL);
if (bo == NULL)
return -ENOMEM;
-   drm_gem_private_object_init(adev->ddev, >gem_base, size);
+   drm_gem_private_object_init(adev->ddev, >tbo.base, size);
INIT_LIST_HEAD(>shadow_list);
bo->vm_bo = NULL;
bo->preferred_domains = bp->preferred_domain ? bp->preferred_domain :
@@ -509,7 +509,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
if 

[PATCH v4 08/17] drm/ttm: use gem vma_node

2019-08-01 Thread Gerd Hoffmann
Drop vma_node from ttm_buffer_object, use the gem struct
(base.vma_node) instead.

Signed-off-by: Gerd Hoffmann 
Reviewed-by: Christian König 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 2 +-
 drivers/gpu/drm/qxl/qxl_object.h   | 2 +-
 drivers/gpu/drm/radeon/radeon_object.h | 2 +-
 drivers/gpu/drm/virtio/virtgpu_drv.h   | 2 +-
 include/drm/ttm/ttm_bo_api.h   | 4 
 drivers/gpu/drm/drm_gem_vram_helper.c  | 2 +-
 drivers/gpu/drm/nouveau/nouveau_display.c  | 2 +-
 drivers/gpu/drm/nouveau/nouveau_gem.c  | 2 +-
 drivers/gpu/drm/ttm/ttm_bo.c   | 8 
 drivers/gpu/drm/ttm/ttm_bo_util.c  | 2 +-
 drivers/gpu/drm/ttm/ttm_bo_vm.c| 9 +
 drivers/gpu/drm/virtio/virtgpu_prime.c | 3 ---
 drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 4 ++--
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c| 4 ++--
 14 files changed, 21 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
index 645a189d365c..113fb2feb437 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
@@ -191,7 +191,7 @@ static inline unsigned amdgpu_bo_gpu_page_alignment(struct 
amdgpu_bo *bo)
  */
 static inline u64 amdgpu_bo_mmap_offset(struct amdgpu_bo *bo)
 {
-   return drm_vma_node_offset_addr(>tbo.vma_node);
+   return drm_vma_node_offset_addr(>tbo.base.vma_node);
 }
 
 /**
diff --git a/drivers/gpu/drm/qxl/qxl_object.h b/drivers/gpu/drm/qxl/qxl_object.h
index b812d4ae9d0d..8ae54ba7857c 100644
--- a/drivers/gpu/drm/qxl/qxl_object.h
+++ b/drivers/gpu/drm/qxl/qxl_object.h
@@ -60,7 +60,7 @@ static inline unsigned long qxl_bo_size(struct qxl_bo *bo)
 
 static inline u64 qxl_bo_mmap_offset(struct qxl_bo *bo)
 {
-   return drm_vma_node_offset_addr(>tbo.vma_node);
+   return drm_vma_node_offset_addr(>tbo.base.vma_node);
 }
 
 static inline int qxl_bo_wait(struct qxl_bo *bo, u32 *mem_type,
diff --git a/drivers/gpu/drm/radeon/radeon_object.h 
b/drivers/gpu/drm/radeon/radeon_object.h
index 9ffd8215d38a..e5554bf9140e 100644
--- a/drivers/gpu/drm/radeon/radeon_object.h
+++ b/drivers/gpu/drm/radeon/radeon_object.h
@@ -116,7 +116,7 @@ static inline unsigned radeon_bo_gpu_page_alignment(struct 
radeon_bo *bo)
  */
 static inline u64 radeon_bo_mmap_offset(struct radeon_bo *bo)
 {
-   return drm_vma_node_offset_addr(>tbo.vma_node);
+   return drm_vma_node_offset_addr(>tbo.base.vma_node);
 }
 
 extern int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type,
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h 
b/drivers/gpu/drm/virtio/virtgpu_drv.h
index f4ecea6054ba..e28829661724 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -396,7 +396,7 @@ static inline void virtio_gpu_object_unref(struct 
virtio_gpu_object **bo)
 
 static inline u64 virtio_gpu_object_mmap_offset(struct virtio_gpu_object *bo)
 {
-   return drm_vma_node_offset_addr(>tbo.vma_node);
+   return drm_vma_node_offset_addr(>tbo.base.vma_node);
 }
 
 static inline int virtio_gpu_object_reserve(struct virtio_gpu_object *bo,
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index fa050f0328ab..7ffc50a3303d 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -152,7 +152,6 @@ struct ttm_tt;
  * @ddestroy: List head for the delayed destroy list.
  * @swap: List head for swap LRU list.
  * @moving: Fence set when BO is moving
- * @vma_node: Address space manager node.
  * @offset: The current GPU offset, which can have different meanings
  * depending on the memory type. For SYSTEM type memory, it should be 0.
  * @cur_placement: Hint of current placement.
@@ -219,9 +218,6 @@ struct ttm_buffer_object {
 */
 
struct dma_fence *moving;
-
-   struct drm_vma_offset_node vma_node;
-
unsigned priority;
 
/**
diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c 
b/drivers/gpu/drm/drm_gem_vram_helper.c
index fc13920b3cb4..fd751078bae1 100644
--- a/drivers/gpu/drm/drm_gem_vram_helper.c
+++ b/drivers/gpu/drm/drm_gem_vram_helper.c
@@ -168,7 +168,7 @@ EXPORT_SYMBOL(drm_gem_vram_put);
  */
 u64 drm_gem_vram_mmap_offset(struct drm_gem_vram_object *gbo)
 {
-   return drm_vma_node_offset_addr(>bo.vma_node);
+   return drm_vma_node_offset_addr(>bo.base.vma_node);
 }
 EXPORT_SYMBOL(drm_gem_vram_mmap_offset);
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c 
b/drivers/gpu/drm/nouveau/nouveau_display.c
index fc8f5bb73ca8..98afc50162e9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -675,7 +675,7 @@ nouveau_display_dumb_map_offset(struct drm_file *file_priv,
gem = drm_gem_object_lookup(file_priv, handle);
if (gem) {
struct nouveau_bo *bo = nouveau_gem_object(gem);
-   *poffset = drm_vma_node_offset_addr(>bo.vma_node);
+   *poffset = 

[PATCH v4 04/17] drm/radeon: use embedded gem object

2019-08-01 Thread Gerd Hoffmann
Drop drm_gem_object from radeon_bo, use the
ttm_buffer_object.base instead.

Build tested only.

Signed-off-by: Gerd Hoffmann 
Reviewed-by: Christian König 
---
 drivers/gpu/drm/radeon/radeon.h |  3 +--
 drivers/gpu/drm/radeon/radeon_cs.c  |  2 +-
 drivers/gpu/drm/radeon/radeon_display.c |  4 ++--
 drivers/gpu/drm/radeon/radeon_gem.c |  2 +-
 drivers/gpu/drm/radeon/radeon_object.c  | 16 
 drivers/gpu/drm/radeon/radeon_prime.c   |  2 +-
 drivers/gpu/drm/radeon/radeon_ttm.c |  2 +-
 7 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 32808e50be12..3f7701321d21 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -505,7 +505,6 @@ struct radeon_bo {
struct list_headva;
/* Constant after initialization */
struct radeon_device*rdev;
-   struct drm_gem_object   gem_base;
 
struct ttm_bo_kmap_obj  dma_buf_vmap;
pid_t   pid;
@@ -513,7 +512,7 @@ struct radeon_bo {
struct radeon_mn*mn;
struct list_headmn_list;
 };
-#define gem_to_radeon_bo(gobj) container_of((gobj), struct radeon_bo, gem_base)
+#define gem_to_radeon_bo(gobj) container_of((gobj), struct radeon_bo, tbo.base)
 
 int radeon_gem_debugfs_init(struct radeon_device *rdev);
 
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c 
b/drivers/gpu/drm/radeon/radeon_cs.c
index cef0e697a2ea..d206654b31ad 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -443,7 +443,7 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser 
*parser, int error, bo
if (bo == NULL)
continue;
 
-   drm_gem_object_put_unlocked(>gem_base);
+   drm_gem_object_put_unlocked(>tbo.base);
}
}
kfree(parser->track);
diff --git a/drivers/gpu/drm/radeon/radeon_display.c 
b/drivers/gpu/drm/radeon/radeon_display.c
index bd52f15e6330..ea6b752dd3a4 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -275,7 +275,7 @@ static void radeon_unpin_work_func(struct work_struct 
*__work)
} else
DRM_ERROR("failed to reserve buffer after flip\n");
 
-   drm_gem_object_put_unlocked(>old_rbo->gem_base);
+   drm_gem_object_put_unlocked(>old_rbo->tbo.base);
kfree(work);
 }
 
@@ -607,7 +607,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc 
*crtc,
radeon_bo_unreserve(new_rbo);
 
 cleanup:
-   drm_gem_object_put_unlocked(>old_rbo->gem_base);
+   drm_gem_object_put_unlocked(>old_rbo->tbo.base);
dma_fence_put(work->fence);
kfree(work);
return r;
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c 
b/drivers/gpu/drm/radeon/radeon_gem.c
index d8bc5d2dfd61..7238007f5aa4 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -83,7 +83,7 @@ int radeon_gem_object_create(struct radeon_device *rdev, 
unsigned long size,
}
return r;
}
-   *obj = >gem_base;
+   *obj = >tbo.base;
robj->pid = task_pid_nr(current);
 
mutex_lock(>gem.mutex);
diff --git a/drivers/gpu/drm/radeon/radeon_object.c 
b/drivers/gpu/drm/radeon/radeon_object.c
index 7a2bad843f8a..66a21332ed4f 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -85,9 +85,9 @@ static void radeon_ttm_bo_destroy(struct ttm_buffer_object 
*tbo)
mutex_unlock(>rdev->gem.mutex);
radeon_bo_clear_surface_reg(bo);
WARN_ON_ONCE(!list_empty(>va));
-   if (bo->gem_base.import_attach)
-   drm_prime_gem_destroy(>gem_base, bo->tbo.sg);
-   drm_gem_object_release(>gem_base);
+   if (bo->tbo.base.import_attach)
+   drm_prime_gem_destroy(>tbo.base, bo->tbo.sg);
+   drm_gem_object_release(>tbo.base);
kfree(bo);
 }
 
@@ -209,7 +209,7 @@ int radeon_bo_create(struct radeon_device *rdev,
bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL);
if (bo == NULL)
return -ENOMEM;
-   drm_gem_private_object_init(rdev->ddev, >gem_base, size);
+   drm_gem_private_object_init(rdev->ddev, >tbo.base, size);
bo->rdev = rdev;
bo->surface_reg = -1;
INIT_LIST_HEAD(>list);
@@ -262,7 +262,7 @@ int radeon_bo_create(struct radeon_device *rdev,
r = ttm_bo_init(>mman.bdev, >tbo, size, type,
>placement, page_align, !kernel, acc_size,
sg, resv, _ttm_bo_destroy);
-   bo->gem_base.resv = bo->tbo.resv;
+   bo->tbo.base.resv = bo->tbo.resv;
up_read(>pm.mclk_lock);
if (unlikely(r != 0)) {
return r;
@@ -443,13 +443,13 @@ void 

[PATCH v4 16/17] drm/virtio: switch driver from bo->resv to bo->base.resv

2019-08-01 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann 
Acked-by: Christian König 
---
 drivers/gpu/drm/virtio/virtgpu_ioctl.c | 4 ++--
 drivers/gpu/drm/virtio/virtgpu_plane.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c 
b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index d379d2e7e3ef..3c430dd65f67 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -396,7 +396,7 @@ static int virtio_gpu_transfer_from_host_ioctl(struct 
drm_device *dev,
(vgdev, qobj->hw_res_handle,
 vfpriv->ctx_id, offset, args->level,
 , fence);
-   reservation_object_add_excl_fence(qobj->tbo.resv,
+   reservation_object_add_excl_fence(qobj->tbo.base.resv,
  >f);
 
dma_fence_put(>f);
@@ -450,7 +450,7 @@ static int virtio_gpu_transfer_to_host_ioctl(struct 
drm_device *dev, void *data,
(vgdev, qobj,
 vfpriv ? vfpriv->ctx_id : 0, offset,
 args->level, , fence);
-   reservation_object_add_excl_fence(qobj->tbo.resv,
+   reservation_object_add_excl_fence(qobj->tbo.base.resv,
  >f);
dma_fence_put(>f);
}
diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c 
b/drivers/gpu/drm/virtio/virtgpu_plane.c
index f96c8296307e..3dc08f991a8d 100644
--- a/drivers/gpu/drm/virtio/virtgpu_plane.c
+++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
@@ -212,7 +212,7 @@ static void virtio_gpu_cursor_plane_update(struct drm_plane 
*plane,
 0, 0, vgfb->fence);
ret = virtio_gpu_object_reserve(bo, false);
if (!ret) {
-   reservation_object_add_excl_fence(bo->tbo.resv,
+   reservation_object_add_excl_fence(bo->tbo.base.resv,
  >fence->f);
dma_fence_put(>fence->f);
vgfb->fence = NULL;
-- 
2.18.1

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

[PATCH v4 10/17] drm/ttm: switch ttm core from bo->resv to bo->base.resv

2019-08-01 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann 
Reviewed-by: Christian König 
---
 include/drm/ttm/ttm_bo_driver.h| 12 ++--
 drivers/gpu/drm/ttm/ttm_bo.c   | 96 +-
 drivers/gpu/drm/ttm/ttm_bo_util.c  | 16 ++---
 drivers/gpu/drm/ttm/ttm_bo_vm.c|  6 +-
 drivers/gpu/drm/ttm/ttm_execbuf_util.c | 20 +++---
 drivers/gpu/drm/ttm/ttm_tt.c   |  2 +-
 6 files changed, 76 insertions(+), 76 deletions(-)

diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index c9b8ba492f24..5b54e3254d13 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -654,14 +654,14 @@ static inline int __ttm_bo_reserve(struct 
ttm_buffer_object *bo,
if (WARN_ON(ticket))
return -EBUSY;
 
-   success = reservation_object_trylock(bo->resv);
+   success = reservation_object_trylock(bo->base.resv);
return success ? 0 : -EBUSY;
}
 
if (interruptible)
-   ret = reservation_object_lock_interruptible(bo->resv, ticket);
+   ret = reservation_object_lock_interruptible(bo->base.resv, 
ticket);
else
-   ret = reservation_object_lock(bo->resv, ticket);
+   ret = reservation_object_lock(bo->base.resv, ticket);
if (ret == -EINTR)
return -ERESTARTSYS;
return ret;
@@ -745,10 +745,10 @@ static inline int ttm_bo_reserve_slowpath(struct 
ttm_buffer_object *bo,
WARN_ON(!kref_read(>kref));
 
if (interruptible)
-   ret = ww_mutex_lock_slow_interruptible(>resv->lock,
+   ret = ww_mutex_lock_slow_interruptible(>base.resv->lock,
   ticket);
else
-   ww_mutex_lock_slow(>resv->lock, ticket);
+   ww_mutex_lock_slow(>base.resv->lock, ticket);
 
if (likely(ret == 0))
ttm_bo_del_sub_from_lru(bo);
@@ -773,7 +773,7 @@ static inline void ttm_bo_unreserve(struct 
ttm_buffer_object *bo)
else
ttm_bo_move_to_lru_tail(bo, NULL);
spin_unlock(>bdev->glob->lru_lock);
-   reservation_object_unlock(bo->resv);
+   reservation_object_unlock(bo->base.resv);
 }
 
 /*
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index cd3a179a7e25..4d43a241e7eb 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -173,7 +173,7 @@ static void ttm_bo_add_mem_to_lru(struct ttm_buffer_object 
*bo,
struct ttm_bo_device *bdev = bo->bdev;
struct ttm_mem_type_manager *man;
 
-   reservation_object_assert_held(bo->resv);
+   reservation_object_assert_held(bo->base.resv);
 
if (!list_empty(>lru))
return;
@@ -244,7 +244,7 @@ static void ttm_bo_bulk_move_set_pos(struct 
ttm_lru_bulk_move_pos *pos,
 void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo,
 struct ttm_lru_bulk_move *bulk)
 {
-   reservation_object_assert_held(bo->resv);
+   reservation_object_assert_held(bo->base.resv);
 
ttm_bo_del_from_lru(bo);
ttm_bo_add_to_lru(bo);
@@ -277,8 +277,8 @@ void ttm_bo_bulk_move_lru_tail(struct ttm_lru_bulk_move 
*bulk)
if (!pos->first)
continue;
 
-   reservation_object_assert_held(pos->first->resv);
-   reservation_object_assert_held(pos->last->resv);
+   reservation_object_assert_held(pos->first->base.resv);
+   reservation_object_assert_held(pos->last->base.resv);
 
man = >first->bdev->man[TTM_PL_TT];
list_bulk_move_tail(>lru[i], >first->lru,
@@ -292,8 +292,8 @@ void ttm_bo_bulk_move_lru_tail(struct ttm_lru_bulk_move 
*bulk)
if (!pos->first)
continue;
 
-   reservation_object_assert_held(pos->first->resv);
-   reservation_object_assert_held(pos->last->resv);
+   reservation_object_assert_held(pos->first->base.resv);
+   reservation_object_assert_held(pos->last->base.resv);
 
man = >first->bdev->man[TTM_PL_VRAM];
list_bulk_move_tail(>lru[i], >first->lru,
@@ -307,8 +307,8 @@ void ttm_bo_bulk_move_lru_tail(struct ttm_lru_bulk_move 
*bulk)
if (!pos->first)
continue;
 
-   reservation_object_assert_held(pos->first->resv);
-   reservation_object_assert_held(pos->last->resv);
+   reservation_object_assert_held(pos->first->base.resv);
+   reservation_object_assert_held(pos->last->base.resv);
 
lru = >first->bdev->glob->swap_lru[i];
list_bulk_move_tail(lru, >first->swap, >last->swap);
@@ -439,12 +439,12 @@ static int ttm_bo_individualize_resv(struct 
ttm_buffer_object *bo)
 {
int r;
 
-   if (bo->resv == >base._resv)
+   if (bo->base.resv == 

[PATCH v4 07/17] drm/ttm: use gem reservation object

2019-08-01 Thread Gerd Hoffmann
Drop ttm_resv from ttm_buffer_object, use the gem reservation object
(base._resv) instead.

Signed-off-by: Gerd Hoffmann 
Reviewed-by: Christian König 
---
 include/drm/ttm/ttm_bo_api.h  |  1 -
 drivers/gpu/drm/ttm/ttm_bo.c  | 39 ++-
 drivers/gpu/drm/ttm/ttm_bo_util.c |  2 +-
 3 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 082550cac92c..fa050f0328ab 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -235,7 +235,6 @@ struct ttm_buffer_object {
struct sg_table *sg;
 
struct reservation_object *resv;
-   struct reservation_object ttm_resv;
struct mutex wu_mutex;
 };
 
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 58c403eda04e..36738f1a486d 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -160,7 +160,8 @@ static void ttm_bo_release_list(struct kref *list_kref)
ttm_tt_destroy(bo->ttm);
atomic_dec(>bdev->glob->bo_count);
dma_fence_put(bo->moving);
-   reservation_object_fini(>ttm_resv);
+   if (!ttm_bo_uses_embedded_gem_object(bo))
+   reservation_object_fini(>base._resv);
mutex_destroy(>wu_mutex);
bo->destroy(bo);
ttm_mem_global_free(bdev->glob->mem_glob, acc_size);
@@ -438,14 +439,14 @@ static int ttm_bo_individualize_resv(struct 
ttm_buffer_object *bo)
 {
int r;
 
-   if (bo->resv == >ttm_resv)
+   if (bo->resv == >base._resv)
return 0;
 
-   BUG_ON(!reservation_object_trylock(>ttm_resv));
+   BUG_ON(!reservation_object_trylock(>base._resv));
 
-   r = reservation_object_copy_fences(>ttm_resv, bo->resv);
+   r = reservation_object_copy_fences(>base._resv, bo->resv);
if (r)
-   reservation_object_unlock(>ttm_resv);
+   reservation_object_unlock(>base._resv);
 
return r;
 }
@@ -456,8 +457,8 @@ static void ttm_bo_flush_all_fences(struct 
ttm_buffer_object *bo)
struct dma_fence *fence;
int i;
 
-   fobj = reservation_object_get_list(>ttm_resv);
-   fence = reservation_object_get_excl(>ttm_resv);
+   fobj = reservation_object_get_list(>base._resv);
+   fence = reservation_object_get_excl(>base._resv);
if (fence && !fence->ops->signaled)
dma_fence_enable_sw_signaling(fence);
 
@@ -490,11 +491,11 @@ static void ttm_bo_cleanup_refs_or_queue(struct 
ttm_buffer_object *bo)
spin_lock(>lru_lock);
ret = reservation_object_trylock(bo->resv) ? 0 : -EBUSY;
if (!ret) {
-   if (reservation_object_test_signaled_rcu(>ttm_resv, true)) {
+   if (reservation_object_test_signaled_rcu(>base._resv, 
true)) {
ttm_bo_del_from_lru(bo);
spin_unlock(>lru_lock);
-   if (bo->resv != >ttm_resv)
-   reservation_object_unlock(>ttm_resv);
+   if (bo->resv != >base._resv)
+   reservation_object_unlock(>base._resv);
 
ttm_bo_cleanup_memtype_use(bo);
reservation_object_unlock(bo->resv);
@@ -515,8 +516,8 @@ static void ttm_bo_cleanup_refs_or_queue(struct 
ttm_buffer_object *bo)
 
reservation_object_unlock(bo->resv);
}
-   if (bo->resv != >ttm_resv)
-   reservation_object_unlock(>ttm_resv);
+   if (bo->resv != >base._resv)
+   reservation_object_unlock(>base._resv);
 
 error:
kref_get(>list_kref);
@@ -551,7 +552,7 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo,
if (unlikely(list_empty(>ddestroy)))
resv = bo->resv;
else
-   resv = >ttm_resv;
+   resv = >base._resv;
 
if (reservation_object_test_signaled_rcu(resv, true))
ret = 0;
@@ -631,7 +632,7 @@ static bool ttm_bo_delayed_delete(struct ttm_bo_device 
*bdev, bool remove_all)
kref_get(>list_kref);
list_move_tail(>ddestroy, );
 
-   if (remove_all || bo->resv != >ttm_resv) {
+   if (remove_all || bo->resv != >base._resv) {
spin_unlock(>lru_lock);
reservation_object_lock(bo->resv, NULL);
 
@@ -1332,9 +1333,15 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
bo->resv = resv;
reservation_object_assert_held(bo->resv);
} else {
-   bo->resv = >ttm_resv;
+   bo->resv = >base._resv;
+   }
+   if (!ttm_bo_uses_embedded_gem_object(bo)) {
+   /*
+* bo.gem is not initialized, so we have to setup the
+* struct elements we want use regardless.
+*/
+   reservation_object_init(>base._resv);
}
-   

[PATCH v4 00/17] drm/ttm: make ttm bo a gem bo subclass

2019-08-01 Thread Gerd Hoffmann
v4:
 - rebase to latest drm-misc-next, adapt to vram helper changes.
v3:
 - comment updates
 - rebased on daniels resv series
   (https://patchwork.freedesktop.org/series/62735/)
v2:
 - build fixes.
 - also drop ttm_buffer_object->resv

Gerd Hoffmann (17):
  drm/ttm: add gem base object
  drm/vram: use embedded gem object
  drm/qxl: use embedded gem object
  drm/radeon: use embedded gem object
  drm/amdgpu: use embedded gem object
  drm/nouveau: use embedded gem object
  drm/ttm: use gem reservation object
  drm/ttm: use gem vma_node
  drm/ttm: set both resv and base.resv pointers
  drm/ttm: switch ttm core from bo->resv to bo->base.resv
  drm/radeon: switch driver from bo->resv to bo->base.resv
  drm/vmwgfx: switch driver from bo->resv to bo->base.resv
  drm/amdgpu: switch driver from bo->resv to bo->base.resv
  drm/nouveau: switch driver from bo->resv to bo->base.resv
  drm/qxl: switch driver from bo->resv to bo->base.resv
  drm/virtio: switch driver from bo->resv to bo->base.resv
  drm/ttm: drop ttm_buffer_object->resv

 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h   |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h|   3 +-
 drivers/gpu/drm/nouveau/nouveau_bo.h  |   5 -
 drivers/gpu/drm/nouveau/nouveau_gem.h |   2 +-
 drivers/gpu/drm/qxl/qxl_drv.h |   6 +-
 drivers/gpu/drm/qxl/qxl_object.h  |   6 +-
 drivers/gpu/drm/radeon/radeon.h   |   3 +-
 drivers/gpu/drm/radeon/radeon_object.h|   2 +-
 drivers/gpu/drm/virtio/virtgpu_drv.h  |   2 +-
 include/drm/drm_gem_vram_helper.h |   3 +-
 include/drm/ttm/ttm_bo_api.h  |  29 +++-
 include/drm/ttm/ttm_bo_driver.h   |  12 +-
 .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c  |   8 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c|   6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c   |   4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c   |  14 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c   |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c|   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c|  30 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c   |   8 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c   |   4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c|  30 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c   |   2 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   2 +-
 drivers/gpu/drm/ast/ast_main.c|   2 +-
 drivers/gpu/drm/drm_gem_vram_helper.c |  20 +--
 drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c   |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/wndw.c   |   2 +-
 drivers/gpu/drm/nouveau/nouveau_abi16.c   |   4 +-
 drivers/gpu/drm/nouveau/nouveau_bo.c  |   9 +-
 drivers/gpu/drm/nouveau/nouveau_display.c |  10 +-
 drivers/gpu/drm/nouveau/nouveau_fence.c   |   2 +-
 drivers/gpu/drm/nouveau/nouveau_gem.c |  19 +--
 drivers/gpu/drm/nouveau/nouveau_prime.c   |   4 +-
 drivers/gpu/drm/qxl/qxl_cmd.c |   4 +-
 drivers/gpu/drm/qxl/qxl_debugfs.c |   4 +-
 drivers/gpu/drm/qxl/qxl_display.c |   8 +-
 drivers/gpu/drm/qxl/qxl_gem.c |   2 +-
 drivers/gpu/drm/qxl/qxl_object.c  |  20 +--
 drivers/gpu/drm/qxl/qxl_release.c |   8 +-
 drivers/gpu/drm/qxl/qxl_ttm.c |   4 +-
 drivers/gpu/drm/radeon/radeon_benchmark.c |   4 +-
 drivers/gpu/drm/radeon/radeon_cs.c|   4 +-
 drivers/gpu/drm/radeon/radeon_display.c   |   6 +-
 drivers/gpu/drm/radeon/radeon_gem.c   |   8 +-
 drivers/gpu/drm/radeon/radeon_mn.c|   2 +-
 drivers/gpu/drm/radeon/radeon_object.c|  23 ++-
 drivers/gpu/drm/radeon/radeon_prime.c |   2 +-
 drivers/gpu/drm/radeon/radeon_test.c  |   8 +-
 drivers/gpu/drm/radeon/radeon_ttm.c   |   4 +-
 drivers/gpu/drm/radeon/radeon_uvd.c   |   2 +-
 drivers/gpu/drm/radeon/radeon_vm.c|   6 +-
 drivers/gpu/drm/ttm/ttm_bo.c  | 135 +-
 drivers/gpu/drm/ttm/ttm_bo_util.c |  18 +--
 drivers/gpu/drm/ttm/ttm_bo_vm.c   |  15 +-
 drivers/gpu/drm/ttm/ttm_execbuf_util.c|  20 +--
 drivers/gpu/drm/ttm/ttm_tt.c  |   2 +-
 drivers/gpu/drm/vboxvideo/vbox_main.c |   2 +-
 drivers/gpu/drm/virtio/virtgpu_ioctl.c|   4 +-
 drivers/gpu/drm/virtio/virtgpu_plane.c|   2 +-
 drivers/gpu/drm/virtio/virtgpu_prime.c|   3 -
 drivers/gpu/drm/vmwgfx/vmwgfx_blit.c  |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_bo.c|  12 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c   |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c  |   6 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c   |   4 +-
 67 files changed, 312 insertions(+), 301 deletions(-)

-- 
2.18.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org

[PATCH v4 11/17] drm/radeon: switch driver from bo->resv to bo->base.resv

2019-08-01 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann 
Reviewed-by: Christian König 
---
 drivers/gpu/drm/radeon/radeon_benchmark.c | 4 ++--
 drivers/gpu/drm/radeon/radeon_cs.c| 2 +-
 drivers/gpu/drm/radeon/radeon_display.c   | 2 +-
 drivers/gpu/drm/radeon/radeon_gem.c   | 6 +++---
 drivers/gpu/drm/radeon/radeon_mn.c| 2 +-
 drivers/gpu/drm/radeon/radeon_object.c| 9 -
 drivers/gpu/drm/radeon/radeon_test.c  | 8 
 drivers/gpu/drm/radeon/radeon_ttm.c   | 2 +-
 drivers/gpu/drm/radeon/radeon_uvd.c   | 2 +-
 drivers/gpu/drm/radeon/radeon_vm.c| 6 +++---
 10 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_benchmark.c 
b/drivers/gpu/drm/radeon/radeon_benchmark.c
index 7ce5064a59f6..1ea50ce16312 100644
--- a/drivers/gpu/drm/radeon/radeon_benchmark.c
+++ b/drivers/gpu/drm/radeon/radeon_benchmark.c
@@ -122,7 +122,7 @@ static void radeon_benchmark_move(struct radeon_device 
*rdev, unsigned size,
if (rdev->asic->copy.dma) {
time = radeon_benchmark_do_move(rdev, size, saddr, daddr,
RADEON_BENCHMARK_COPY_DMA, n,
-   dobj->tbo.resv);
+   dobj->tbo.base.resv);
if (time < 0)
goto out_cleanup;
if (time > 0)
@@ -133,7 +133,7 @@ static void radeon_benchmark_move(struct radeon_device 
*rdev, unsigned size,
if (rdev->asic->copy.blit) {
time = radeon_benchmark_do_move(rdev, size, saddr, daddr,
RADEON_BENCHMARK_COPY_BLIT, n,
-   dobj->tbo.resv);
+   dobj->tbo.base.resv);
if (time < 0)
goto out_cleanup;
if (time > 0)
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c 
b/drivers/gpu/drm/radeon/radeon_cs.c
index d206654b31ad..7e5254a34e84 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -257,7 +257,7 @@ static int radeon_cs_sync_rings(struct radeon_cs_parser *p)
list_for_each_entry(reloc, >validated, tv.head) {
struct reservation_object *resv;
 
-   resv = reloc->robj->tbo.resv;
+   resv = reloc->robj->tbo.base.resv;
r = radeon_sync_resv(p->rdev, >ib.sync, resv,
 reloc->tv.num_shared);
if (r)
diff --git a/drivers/gpu/drm/radeon/radeon_display.c 
b/drivers/gpu/drm/radeon/radeon_display.c
index ea6b752dd3a4..7bf73230ac0b 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -533,7 +533,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc 
*crtc,
DRM_ERROR("failed to pin new rbo buffer before flip\n");
goto cleanup;
}
-   work->fence = 
dma_fence_get(reservation_object_get_excl(new_rbo->tbo.resv));
+   work->fence = 
dma_fence_get(reservation_object_get_excl(new_rbo->tbo.base.resv));
radeon_bo_get_tiling_flags(new_rbo, _flags, NULL);
radeon_bo_unreserve(new_rbo);
 
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c 
b/drivers/gpu/drm/radeon/radeon_gem.c
index 7238007f5aa4..03873f21a734 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -114,7 +114,7 @@ static int radeon_gem_set_domain(struct drm_gem_object 
*gobj,
}
if (domain == RADEON_GEM_DOMAIN_CPU) {
/* Asking for cpu access wait for object idle */
-   r = reservation_object_wait_timeout_rcu(robj->tbo.resv, true, 
true, 30 * HZ);
+   r = reservation_object_wait_timeout_rcu(robj->tbo.base.resv, 
true, true, 30 * HZ);
if (!r)
r = -EBUSY;
 
@@ -449,7 +449,7 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void 
*data,
}
robj = gem_to_radeon_bo(gobj);
 
-   r = reservation_object_test_signaled_rcu(robj->tbo.resv, true);
+   r = reservation_object_test_signaled_rcu(robj->tbo.base.resv, true);
if (r == 0)
r = -EBUSY;
else
@@ -478,7 +478,7 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void 
*data,
}
robj = gem_to_radeon_bo(gobj);
 
-   ret = reservation_object_wait_timeout_rcu(robj->tbo.resv, true, true, 
30 * HZ);
+   ret = reservation_object_wait_timeout_rcu(robj->tbo.base.resv, true, 
true, 30 * HZ);
if (ret == 0)
r = -EBUSY;
else if (ret < 0)
diff --git a/drivers/gpu/drm/radeon/radeon_mn.c 
b/drivers/gpu/drm/radeon/radeon_mn.c
index 8c3871ed23a9..0d64ace0e6c1 100644
--- a/drivers/gpu/drm/radeon/radeon_mn.c
+++ b/drivers/gpu/drm/radeon/radeon_mn.c
@@ -163,7 +163,7 @@ static int radeon_mn_invalidate_range_start(struct 
mmu_notifier *mn,

[PATCH v4 13/17] drm/amdgpu: switch driver from bo->resv to bo->base.resv

2019-08-01 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann 
Reviewed-by: Christian König 
---
 .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c  |  8 ++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c|  6 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c   |  6 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c| 22 +++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c   |  6 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c   |  4 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c| 30 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c   |  2 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 +-
 13 files changed, 46 insertions(+), 48 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 1d3ee9c42f7e..fe062b76ec91 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -218,7 +218,7 @@ void amdgpu_amdkfd_unreserve_memory_limit(struct amdgpu_bo 
*bo)
 static int amdgpu_amdkfd_remove_eviction_fence(struct amdgpu_bo *bo,
struct amdgpu_amdkfd_fence *ef)
 {
-   struct reservation_object *resv = bo->tbo.resv;
+   struct reservation_object *resv = bo->tbo.base.resv;
struct reservation_object_list *old, *new;
unsigned int i, j, k;
 
@@ -812,7 +812,7 @@ static int process_sync_pds_resv(struct amdkfd_process_info 
*process_info,
struct amdgpu_bo *pd = peer_vm->root.base.bo;
 
ret = amdgpu_sync_resv(NULL,
-   sync, pd->tbo.resv,
+   sync, pd->tbo.base.resv,
AMDGPU_FENCE_OWNER_KFD, false);
if (ret)
return ret;
@@ -887,7 +887,7 @@ static int init_kfd_vm(struct amdgpu_vm *vm, void 
**process_info,
  AMDGPU_FENCE_OWNER_KFD, false);
if (ret)
goto wait_pd_fail;
-   ret = reservation_object_reserve_shared(vm->root.base.bo->tbo.resv, 1);
+   ret = 
reservation_object_reserve_shared(vm->root.base.bo->tbo.base.resv, 1);
if (ret)
goto reserve_shared_fail;
amdgpu_bo_fence(vm->root.base.bo,
@@ -2132,7 +2132,7 @@ int amdgpu_amdkfd_add_gws_to_process(void *info, void 
*gws, struct kgd_mem **mem
 * Add process eviction fence to bo so they can
 * evict each other.
 */
-   ret = reservation_object_reserve_shared(gws_bo->tbo.resv, 1);
+   ret = reservation_object_reserve_shared(gws_bo->tbo.base.resv, 1);
if (ret)
goto reserve_shared_fail;
amdgpu_bo_fence(gws_bo, _info->eviction_fence->base, true);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index e069de8b54e6..2a972d104fec 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -402,7 +402,7 @@ static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
struct ttm_operation_ctx ctx = {
.interruptible = true,
.no_wait_gpu = false,
-   .resv = bo->tbo.resv,
+   .resv = bo->tbo.base.resv,
.flags = 0
};
uint32_t domain;
@@ -730,7 +730,7 @@ static int amdgpu_cs_sync_rings(struct amdgpu_cs_parser *p)
 
list_for_each_entry(e, >validated, tv.head) {
struct amdgpu_bo *bo = ttm_to_amdgpu_bo(e->tv.bo);
-   struct reservation_object *resv = bo->tbo.resv;
+   struct reservation_object *resv = bo->tbo.base.resv;
 
r = amdgpu_sync_resv(p->adev, >job->sync, resv, p->filp,
 amdgpu_bo_explicit_sync(bo));
@@ -1729,7 +1729,7 @@ int amdgpu_cs_find_mapping(struct amdgpu_cs_parser 
*parser,
*map = mapping;
 
/* Double check that the BO is reserved by this CS */
-   if (READ_ONCE((*bo)->tbo.resv->lock.ctx) != >ticket)
+   if (READ_ONCE((*bo)->tbo.base.resv->lock.ctx) != >ticket)
return -EINVAL;
 
if (!((*bo)->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS)) {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 535650967b1a..b5d020e15c35 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -204,7 +204,7 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc 
*crtc,
goto unpin;
}
 
-   r = reservation_object_get_fences_rcu(new_abo->tbo.resv, >excl,
+   r = reservation_object_get_fences_rcu(new_abo->tbo.base.resv, 
>excl,
  >shared_count,
 

[PATCH v4 09/17] drm/ttm: set both resv and base.resv pointers

2019-08-01 Thread Gerd Hoffmann
Initialize both ttm_buffer_object->resv and ttm_buffer_object->base.resv
pointers.  This allows to move users from the former to the latter.  When
all users are moved we can drop ttm_buffer_object->resv.

Signed-off-by: Gerd Hoffmann 
Reviewed-by: Christian König 
---
 drivers/gpu/drm/ttm/ttm_bo.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 2ff09d2bfddb..cd3a179a7e25 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1331,9 +1331,11 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
bo->sg = sg;
if (resv) {
bo->resv = resv;
+   bo->base.resv = resv;
reservation_object_assert_held(bo->resv);
} else {
bo->resv = >base._resv;
+   bo->base.resv = >base._resv;
}
if (!ttm_bo_uses_embedded_gem_object(bo)) {
/*
-- 
2.18.1

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

[PATCH v4 06/17] drm/nouveau: use embedded gem object

2019-08-01 Thread Gerd Hoffmann
Drop drm_gem_object from nouveau_bo, use the
ttm_buffer_object.base instead.

Build tested only.

Signed-off-by: Gerd Hoffmann 
Acked-by: Christian König 
---
 drivers/gpu/drm/nouveau/nouveau_bo.h  |  5 -
 drivers/gpu/drm/nouveau/nouveau_gem.h |  2 +-
 drivers/gpu/drm/nouveau/nouveau_abi16.c   |  4 ++--
 drivers/gpu/drm/nouveau/nouveau_bo.c  |  6 +++---
 drivers/gpu/drm/nouveau/nouveau_display.c |  8 
 drivers/gpu/drm/nouveau/nouveau_gem.c | 15 ---
 drivers/gpu/drm/nouveau/nouveau_prime.c   |  4 ++--
 7 files changed, 20 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.h 
b/drivers/gpu/drm/nouveau/nouveau_bo.h
index 383ac36d5869..d675efe8e7f9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.h
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.h
@@ -35,11 +35,6 @@ struct nouveau_bo {
 
struct nouveau_drm_tile *tile;
 
-   /* Only valid if allocated via nouveau_gem_new() and iff you hold a
-* gem reference to it! For debugging, use gem.filp != NULL to test
-* whether it is valid. */
-   struct drm_gem_object gem;
-
/* protect by the ttm reservation lock */
int pin_refcnt;
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.h 
b/drivers/gpu/drm/nouveau/nouveau_gem.h
index d67e2f9ec59c..40ba0f1ba5aa 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.h
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.h
@@ -10,7 +10,7 @@
 static inline struct nouveau_bo *
 nouveau_gem_object(struct drm_gem_object *gem)
 {
-   return gem ? container_of(gem, struct nouveau_bo, gem) : NULL;
+   return gem ? container_of(gem, struct nouveau_bo, bo.base) : NULL;
 }
 
 /* nouveau_gem.c */
diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c 
b/drivers/gpu/drm/nouveau/nouveau_abi16.c
index 0c585dc5f5c3..e2bae1424502 100644
--- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
+++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
@@ -139,7 +139,7 @@ nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16,
if (chan->ntfy) {
nouveau_vma_del(>ntfy_vma);
nouveau_bo_unpin(chan->ntfy);
-   drm_gem_object_put_unlocked(>ntfy->gem);
+   drm_gem_object_put_unlocked(>ntfy->bo.base);
}
 
if (chan->heap.block_size)
@@ -339,7 +339,7 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS)
goto done;
}
 
-   ret = drm_gem_handle_create(file_priv, >ntfy->gem,
+   ret = drm_gem_handle_create(file_priv, >ntfy->bo.base,
>notifier_handle);
if (ret)
goto done;
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c 
b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 6f1217b3e6b9..abbbabd12241 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -136,7 +136,7 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo)
struct drm_device *dev = drm->dev;
struct nouveau_bo *nvbo = nouveau_bo(bo);
 
-   if (unlikely(nvbo->gem.filp))
+   if (unlikely(nvbo->bo.base.filp))
DRM_ERROR("bo %p still attached to GEM object\n", bo);
WARN_ON(nvbo->pin_refcnt > 0);
nv10_bo_put_tile_region(dev, nvbo->tile, NULL);
@@ -299,7 +299,7 @@ nouveau_bo_new(struct nouveau_cli *cli, u64 size, int align,
  type, >placement,
  align >> PAGE_SHIFT, false, acc_size, sg,
  robj, nouveau_bo_del_ttm);
-   nvbo->gem.resv = nvbo->bo.resv;
+   nvbo->bo.base.resv = nvbo->bo.resv;
 
if (ret) {
/* ttm will call nouveau_bo_del_ttm if it fails.. */
@@ -1402,7 +1402,7 @@ nouveau_bo_verify_access(struct ttm_buffer_object *bo, 
struct file *filp)
 {
struct nouveau_bo *nvbo = nouveau_bo(bo);
 
-   return drm_vma_node_verify_access(>gem.vma_node,
+   return drm_vma_node_verify_access(>bo.base.vma_node,
  filp->private_data);
 }
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c 
b/drivers/gpu/drm/nouveau/nouveau_display.c
index 832da8e0020d..fc8f5bb73ca8 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -201,7 +201,7 @@ nouveau_user_framebuffer_destroy(struct drm_framebuffer 
*drm_fb)
struct nouveau_framebuffer *fb = nouveau_framebuffer(drm_fb);
 
if (fb->nvbo)
-   drm_gem_object_put_unlocked(>nvbo->gem);
+   drm_gem_object_put_unlocked(>nvbo->bo.base);
 
drm_framebuffer_cleanup(drm_fb);
kfree(fb);
@@ -214,7 +214,7 @@ nouveau_user_framebuffer_create_handle(struct 
drm_framebuffer *drm_fb,
 {
struct nouveau_framebuffer *fb = nouveau_framebuffer(drm_fb);
 
-   return drm_gem_handle_create(file_priv, >nvbo->gem, handle);
+   return drm_gem_handle_create(file_priv, >nvbo->bo.base, handle);
 }
 
 static const struct drm_framebuffer_funcs nouveau_framebuffer_funcs = {
@@ -660,8 +660,8 

[PATCH v4 15/17] drm/qxl: switch driver from bo->resv to bo->base.resv

2019-08-01 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann 
Acked-by: Christian König 
---
 drivers/gpu/drm/qxl/qxl_debugfs.c | 2 +-
 drivers/gpu/drm/qxl/qxl_release.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_debugfs.c 
b/drivers/gpu/drm/qxl/qxl_debugfs.c
index bdb5ac0987ab..94439212a5c5 100644
--- a/drivers/gpu/drm/qxl/qxl_debugfs.c
+++ b/drivers/gpu/drm/qxl/qxl_debugfs.c
@@ -61,7 +61,7 @@ qxl_debugfs_buffers_info(struct seq_file *m, void *data)
int rel;
 
rcu_read_lock();
-   fobj = rcu_dereference(bo->tbo.resv->fence);
+   fobj = rcu_dereference(bo->tbo.base.resv->fence);
rel = fobj ? fobj->shared_count : 0;
rcu_read_unlock();
 
diff --git a/drivers/gpu/drm/qxl/qxl_release.c 
b/drivers/gpu/drm/qxl/qxl_release.c
index 0022e31ba910..df55b83e0a55 100644
--- a/drivers/gpu/drm/qxl/qxl_release.c
+++ b/drivers/gpu/drm/qxl/qxl_release.c
@@ -238,7 +238,7 @@ static int qxl_release_validate_bo(struct qxl_bo *bo)
return ret;
}
 
-   ret = reservation_object_reserve_shared(bo->tbo.resv, 1);
+   ret = reservation_object_reserve_shared(bo->tbo.base.resv, 1);
if (ret)
return ret;
 
@@ -458,9 +458,9 @@ void qxl_release_fence_buffer_objects(struct qxl_release 
*release)
list_for_each_entry(entry, >bos, head) {
bo = entry->bo;
 
-   reservation_object_add_shared_fence(bo->resv, >base);
+   reservation_object_add_shared_fence(bo->base.resv, 
>base);
ttm_bo_add_to_lru(bo);
-   reservation_object_unlock(bo->resv);
+   reservation_object_unlock(bo->base.resv);
}
spin_unlock(>lru_lock);
ww_acquire_fini(>ticket);
-- 
2.18.1



[PATCH v4 01/17] drm/ttm: add gem base object

2019-08-01 Thread Gerd Hoffmann
Add drm_gem_object struct to ttm_buffer_object, so ttm objects are a gdm
object superclass.  Add a function to check whenever a given bo actually
uses the embedded drm_gem_object.

Signed-off-by: Gerd Hoffmann 
Reviewed-by: Christian König 
---
 include/drm/ttm/ttm_bo_api.h | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 49d9cdfc58f2..082550cac92c 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -31,6 +31,7 @@
 #ifndef _TTM_BO_API_H_
 #define _TTM_BO_API_H_
 
+#include 
 #include 
 #include 
 #include 
@@ -127,6 +128,7 @@ struct ttm_tt;
 /**
  * struct ttm_buffer_object
  *
+ * @base: drm_gem_object superclass data.
  * @bdev: Pointer to the buffer object device structure.
  * @type: The bo type.
  * @destroy: Destruction function. If NULL, kfree is used.
@@ -169,6 +171,8 @@ struct ttm_tt;
  */
 
 struct ttm_buffer_object {
+   struct drm_gem_object base;
+
/**
 * Members constant at init.
 */
@@ -768,4 +772,23 @@ int ttm_bo_swapout(struct ttm_bo_global *glob,
struct ttm_operation_ctx *ctx);
 void ttm_bo_swapout_all(struct ttm_bo_device *bdev);
 int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo);
+
+/**
+ * ttm_bo_uses_embedded_gem_object - check if the given bo uses the
+ * embedded drm_gem_object.
+ *
+ * Most ttm drivers are using gem too, so the embedded
+ * ttm_buffer_object.base will be initialized by the driver (before
+ * calling ttm_bo_init).  It is also possible to use ttm without gem
+ * though (vmwgfx does that).
+ *
+ * This helper will figure whenever a given ttm bo is a gem object too
+ * or not.
+ *
+ * @bo: The bo to check.
+ */
+static inline bool ttm_bo_uses_embedded_gem_object(struct ttm_buffer_object 
*bo)
+{
+   return bo->base.dev != NULL;
+}
 #endif
-- 
2.18.1

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

[PATCH v4 02/17] drm/vram: use embedded gem object

2019-08-01 Thread Gerd Hoffmann
Drop drm_gem_object from drm_gem_vram_object, use the
ttm_buffer_object.base instead.

Signed-off-by: Gerd Hoffmann 
Reviewed-by: Christian König 
Acked-by: Thomas Zimmermann 
---
 include/drm/drm_gem_vram_helper.h   |  3 +--
 drivers/gpu/drm/ast/ast_main.c  |  2 +-
 drivers/gpu/drm/drm_gem_vram_helper.c   | 18 +-
 drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c |  2 +-
 drivers/gpu/drm/vboxvideo/vbox_main.c   |  2 +-
 5 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/include/drm/drm_gem_vram_helper.h 
b/include/drm/drm_gem_vram_helper.h
index b41d932eb53a..ac217d768456 100644
--- a/include/drm/drm_gem_vram_helper.h
+++ b/include/drm/drm_gem_vram_helper.h
@@ -36,7 +36,6 @@ struct vm_area_struct;
  * video memory becomes scarce.
  */
 struct drm_gem_vram_object {
-   struct drm_gem_object gem;
struct ttm_buffer_object bo;
struct ttm_bo_kmap_obj kmap;
 
@@ -68,7 +67,7 @@ static inline struct drm_gem_vram_object *drm_gem_vram_of_bo(
 static inline struct drm_gem_vram_object *drm_gem_vram_of_gem(
struct drm_gem_object *gem)
 {
-   return container_of(gem, struct drm_gem_vram_object, gem);
+   return container_of(gem, struct drm_gem_vram_object, bo.base);
 }
 
 struct drm_gem_vram_object *drm_gem_vram_create(struct drm_device *dev,
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
index 0a1bb9c05195..dab77b2bc8ac 100644
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -554,6 +554,6 @@ int ast_gem_create(struct drm_device *dev,
DRM_ERROR("failed to allocate GEM object\n");
return ret;
}
-   *obj = >gem;
+   *obj = >bo.base;
return 0;
 }
diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c 
b/drivers/gpu/drm/drm_gem_vram_helper.c
index e0fbfb6570cf..fc13920b3cb4 100644
--- a/drivers/gpu/drm/drm_gem_vram_helper.c
+++ b/drivers/gpu/drm/drm_gem_vram_helper.c
@@ -26,7 +26,7 @@ static void drm_gem_vram_cleanup(struct drm_gem_vram_object 
*gbo)
 * TTM buffer object in 'bo' has already been cleaned
 * up; only release the GEM object.
 */
-   drm_gem_object_release(>gem);
+   drm_gem_object_release(>bo.base);
 }
 
 static void drm_gem_vram_destroy(struct drm_gem_vram_object *gbo)
@@ -82,10 +82,10 @@ static int drm_gem_vram_init(struct drm_device *dev,
int ret;
size_t acc_size;
 
-   if (!gbo->gem.funcs)
-   gbo->gem.funcs = _gem_vram_object_funcs;
+   if (!gbo->bo.base.funcs)
+   gbo->bo.base.funcs = _gem_vram_object_funcs;
 
-   ret = drm_gem_object_init(dev, >gem, size);
+   ret = drm_gem_object_init(dev, >bo.base, size);
if (ret)
return ret;
 
@@ -103,7 +103,7 @@ static int drm_gem_vram_init(struct drm_device *dev,
return 0;
 
 err_drm_gem_object_release:
-   drm_gem_object_release(>gem);
+   drm_gem_object_release(>bo.base);
return ret;
 }
 
@@ -383,11 +383,11 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file,
if (IS_ERR(gbo))
return PTR_ERR(gbo);
 
-   ret = drm_gem_handle_create(file, >gem, );
+   ret = drm_gem_handle_create(file, >bo.base, );
if (ret)
goto err_drm_gem_object_put_unlocked;
 
-   drm_gem_object_put_unlocked(>gem);
+   drm_gem_object_put_unlocked(>bo.base);
 
args->pitch = pitch;
args->size = size;
@@ -396,7 +396,7 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file,
return 0;
 
 err_drm_gem_object_put_unlocked:
-   drm_gem_object_put_unlocked(>gem);
+   drm_gem_object_put_unlocked(>bo.base);
return ret;
 }
 EXPORT_SYMBOL(drm_gem_vram_fill_create_dumb);
@@ -446,7 +446,7 @@ int drm_gem_vram_bo_driver_verify_access(struct 
ttm_buffer_object *bo,
 {
struct drm_gem_vram_object *gbo = drm_gem_vram_of_bo(bo);
 
-   return drm_vma_node_verify_access(>gem.vma_node,
+   return drm_vma_node_verify_access(>bo.base.vma_node,
  filp->private_data);
 }
 EXPORT_SYMBOL(drm_gem_vram_bo_driver_verify_access);
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c 
b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
index cfc2faabda14..9f6e473e6295 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
@@ -66,7 +66,7 @@ int hibmc_gem_create(struct drm_device *dev, u32 size, bool 
iskernel,
DRM_ERROR("failed to allocate GEM object: %d\n", ret);
return ret;
}
-   *obj = >gem;
+   *obj = >bo.base;
return 0;
 }
 
diff --git a/drivers/gpu/drm/vboxvideo/vbox_main.c 
b/drivers/gpu/drm/vboxvideo/vbox_main.c
index 18693e2bf72a..02fa8277ff1e 100644
--- a/drivers/gpu/drm/vboxvideo/vbox_main.c
+++ b/drivers/gpu/drm/vboxvideo/vbox_main.c
@@ -292,7 +292,7 @@ int vbox_gem_create(struct vbox_private *vbox,

[PATCH v4 03/17] drm/qxl: use embedded gem object

2019-08-01 Thread Gerd Hoffmann
Drop drm_gem_object from qxl_bo, use the
ttm_buffer_object.base instead.

Signed-off-by: Gerd Hoffmann 
Acked-by: Christian König 
---
 drivers/gpu/drm/qxl/qxl_drv.h |  6 +++---
 drivers/gpu/drm/qxl/qxl_object.h  |  4 ++--
 drivers/gpu/drm/qxl/qxl_cmd.c |  4 ++--
 drivers/gpu/drm/qxl/qxl_debugfs.c |  2 +-
 drivers/gpu/drm/qxl/qxl_display.c |  8 
 drivers/gpu/drm/qxl/qxl_gem.c |  2 +-
 drivers/gpu/drm/qxl/qxl_object.c  | 20 ++--
 drivers/gpu/drm/qxl/qxl_release.c |  2 +-
 drivers/gpu/drm/qxl/qxl_ttm.c |  4 ++--
 9 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h
index ae82e5fab09c..9e034c5fa87d 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.h
+++ b/drivers/gpu/drm/qxl/qxl_drv.h
@@ -71,12 +71,13 @@ extern int qxl_max_ioctls;
QXL_INTERRUPT_CLIENT_MONITORS_CONFIG)
 
 struct qxl_bo {
+   struct ttm_buffer_objecttbo;
+
/* Protected by gem.mutex */
struct list_headlist;
/* Protected by tbo.reserved */
struct ttm_placeplacements[3];
struct ttm_placementplacement;
-   struct ttm_buffer_objecttbo;
struct ttm_bo_kmap_obj  kmap;
unsigned int pin_count;
void*kptr;
@@ -84,7 +85,6 @@ struct qxl_bo {
int type;
 
/* Constant after initialization */
-   struct drm_gem_object   gem_base;
unsigned int is_primary:1; /* is this now a primary surface */
unsigned int is_dumb:1;
struct qxl_bo *shadow;
@@ -93,7 +93,7 @@ struct qxl_bo {
uint32_t surface_id;
struct qxl_release *surf_create;
 };
-#define gem_to_qxl_bo(gobj) container_of((gobj), struct qxl_bo, gem_base)
+#define gem_to_qxl_bo(gobj) container_of((gobj), struct qxl_bo, tbo.base)
 #define to_qxl_bo(tobj) container_of((tobj), struct qxl_bo, tbo)
 
 struct qxl_gem {
diff --git a/drivers/gpu/drm/qxl/qxl_object.h b/drivers/gpu/drm/qxl/qxl_object.h
index 255b914e2a7b..b812d4ae9d0d 100644
--- a/drivers/gpu/drm/qxl/qxl_object.h
+++ b/drivers/gpu/drm/qxl/qxl_object.h
@@ -34,7 +34,7 @@ static inline int qxl_bo_reserve(struct qxl_bo *bo, bool 
no_wait)
r = ttm_bo_reserve(>tbo, true, no_wait, NULL);
if (unlikely(r != 0)) {
if (r != -ERESTARTSYS) {
-   struct drm_device *ddev = bo->gem_base.dev;
+   struct drm_device *ddev = bo->tbo.base.dev;
 
dev_err(ddev->dev, "%p reserve failed\n", bo);
}
@@ -71,7 +71,7 @@ static inline int qxl_bo_wait(struct qxl_bo *bo, u32 
*mem_type,
r = ttm_bo_reserve(>tbo, true, no_wait, NULL);
if (unlikely(r != 0)) {
if (r != -ERESTARTSYS) {
-   struct drm_device *ddev = bo->gem_base.dev;
+   struct drm_device *ddev = bo->tbo.base.dev;
 
dev_err(ddev->dev, "%p reserve failed for wait\n",
bo);
diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c
index ac1081f55b51..ef09dc6bc635 100644
--- a/drivers/gpu/drm/qxl/qxl_cmd.c
+++ b/drivers/gpu/drm/qxl/qxl_cmd.c
@@ -377,7 +377,7 @@ void qxl_io_destroy_primary(struct qxl_device *qdev)
 {
wait_for_io_cmd(qdev, 0, QXL_IO_DESTROY_PRIMARY_ASYNC);
qdev->primary_bo->is_primary = false;
-   drm_gem_object_put_unlocked(>primary_bo->gem_base);
+   drm_gem_object_put_unlocked(>primary_bo->tbo.base);
qdev->primary_bo = NULL;
 }
 
@@ -404,7 +404,7 @@ void qxl_io_create_primary(struct qxl_device *qdev, struct 
qxl_bo *bo)
wait_for_io_cmd(qdev, 0, QXL_IO_CREATE_PRIMARY_ASYNC);
qdev->primary_bo = bo;
qdev->primary_bo->is_primary = true;
-   drm_gem_object_get(>primary_bo->gem_base);
+   drm_gem_object_get(>primary_bo->tbo.base);
 }
 
 void qxl_io_memslot_add(struct qxl_device *qdev, uint8_t id)
diff --git a/drivers/gpu/drm/qxl/qxl_debugfs.c 
b/drivers/gpu/drm/qxl/qxl_debugfs.c
index a85ec100b0cc..bdb5ac0987ab 100644
--- a/drivers/gpu/drm/qxl/qxl_debugfs.c
+++ b/drivers/gpu/drm/qxl/qxl_debugfs.c
@@ -66,7 +66,7 @@ qxl_debugfs_buffers_info(struct seq_file *m, void *data)
rcu_read_unlock();
 
seq_printf(m, "size %ld, pc %d, num releases %d\n",
-  (unsigned long)bo->gem_base.size,
+  (unsigned long)bo->tbo.base.size,
   bo->pin_count, rel);
}
return 0;
diff --git a/drivers/gpu/drm/qxl/qxl_display.c 
b/drivers/gpu/drm/qxl/qxl_display.c
index 023fb5a69af1..16d73b22f3f5 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -797,7 +797,7 @@ static int qxl_plane_prepare_fb(struct drm_plane *plane,
qdev->dumb_shadow_bo->surf.height != surf.height) {

[PATCH v4 14/17] drm/nouveau: switch driver from bo->resv to bo->base.resv

2019-08-01 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann 
Reviewed-by: Christian König 
---
 drivers/gpu/drm/nouveau/dispnv50/wndw.c | 2 +-
 drivers/gpu/drm/nouveau/nouveau_bo.c| 5 ++---
 drivers/gpu/drm/nouveau/nouveau_fence.c | 2 +-
 drivers/gpu/drm/nouveau/nouveau_gem.c   | 2 +-
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndw.c 
b/drivers/gpu/drm/nouveau/dispnv50/wndw.c
index 283ff690350e..89f8e76a2d7d 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/wndw.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/wndw.c
@@ -457,7 +457,7 @@ nv50_wndw_prepare_fb(struct drm_plane *plane, struct 
drm_plane_state *state)
asyw->image.handle[0] = ctxdma->object.handle;
}
 
-   asyw->state.fence = reservation_object_get_excl_rcu(fb->nvbo->bo.resv);
+   asyw->state.fence = 
reservation_object_get_excl_rcu(fb->nvbo->bo.base.resv);
asyw->image.offset[0] = fb->nvbo->bo.offset;
 
if (wndw->func->prepare) {
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c 
b/drivers/gpu/drm/nouveau/nouveau_bo.c
index abbbabd12241..99e391be9370 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -299,7 +299,6 @@ nouveau_bo_new(struct nouveau_cli *cli, u64 size, int align,
  type, >placement,
  align >> PAGE_SHIFT, false, acc_size, sg,
  robj, nouveau_bo_del_ttm);
-   nvbo->bo.base.resv = nvbo->bo.resv;
 
if (ret) {
/* ttm will call nouveau_bo_del_ttm if it fails.. */
@@ -1325,7 +1324,7 @@ nouveau_bo_vm_cleanup(struct ttm_buffer_object *bo,
 {
struct nouveau_drm *drm = nouveau_bdev(bo->bdev);
struct drm_device *dev = drm->dev;
-   struct dma_fence *fence = reservation_object_get_excl(bo->resv);
+   struct dma_fence *fence = reservation_object_get_excl(bo->base.resv);
 
nv10_bo_put_tile_region(dev, *old_tile, fence);
*old_tile = new_tile;
@@ -1656,7 +1655,7 @@ nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm)
 void
 nouveau_bo_fence(struct nouveau_bo *nvbo, struct nouveau_fence *fence, bool 
exclusive)
 {
-   struct reservation_object *resv = nvbo->bo.resv;
+   struct reservation_object *resv = nvbo->bo.base.resv;
 
if (exclusive)
reservation_object_add_excl_fence(resv, >base);
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c 
b/drivers/gpu/drm/nouveau/nouveau_fence.c
index d4964f3397a1..e5f249ab216a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fence.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
@@ -335,7 +335,7 @@ nouveau_fence_sync(struct nouveau_bo *nvbo, struct 
nouveau_channel *chan, bool e
 {
struct nouveau_fence_chan *fctx = chan->fence;
struct dma_fence *fence;
-   struct reservation_object *resv = nvbo->bo.resv;
+   struct reservation_object *resv = nvbo->bo.base.resv;
struct reservation_object_list *fobj;
struct nouveau_fence *f;
int ret = 0, i;
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c 
b/drivers/gpu/drm/nouveau/nouveau_gem.c
index b1e4852810ed..c7368aa0bdec 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -887,7 +887,7 @@ nouveau_gem_ioctl_cpu_prep(struct drm_device *dev, void 
*data,
return -ENOENT;
nvbo = nouveau_gem_object(gem);
 
-   lret = reservation_object_wait_timeout_rcu(nvbo->bo.resv, write, true,
+   lret = reservation_object_wait_timeout_rcu(nvbo->bo.base.resv, write, 
true,
   no_wait ? 0 : 30 * HZ);
if (!lret)
ret = -EBUSY;
-- 
2.18.1

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

[PATCH v4 17/17] drm/ttm: drop ttm_buffer_object->resv

2019-08-01 Thread Gerd Hoffmann
All users moved to ttm_buffer_object->base.resv

Signed-off-by: Gerd Hoffmann 
Reviewed-by: Christian König 
---
 include/drm/ttm/ttm_bo_api.h | 1 -
 drivers/gpu/drm/ttm/ttm_bo.c | 2 --
 2 files changed, 3 deletions(-)

diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 7ffc50a3303d..65ef5376de59 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -230,7 +230,6 @@ struct ttm_buffer_object {
 
struct sg_table *sg;
 
-   struct reservation_object *resv;
struct mutex wu_mutex;
 };
 
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 4d43a241e7eb..6eeb0759c449 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1330,11 +1330,9 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
bo->acc_size = acc_size;
bo->sg = sg;
if (resv) {
-   bo->resv = resv;
bo->base.resv = resv;
reservation_object_assert_held(bo->base.resv);
} else {
-   bo->resv = >base._resv;
bo->base.resv = >base._resv;
}
if (!ttm_bo_uses_embedded_gem_object(bo)) {
-- 
2.18.1

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

[PATCH v4 12/17] drm/vmwgfx: switch driver from bo->resv to bo->base.resv

2019-08-01 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_blit.c | 4 ++--
 drivers/gpu/drm/vmwgfx/vmwgfx_bo.c   | 8 
 drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c  | 4 ++--
 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 6 +++---
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_blit.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_blit.c
index fc6673cde289..917eeb793585 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_blit.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_blit.c
@@ -459,9 +459,9 @@ int vmw_bo_cpu_blit(struct ttm_buffer_object *dst,
 
/* Buffer objects need to be either pinned or reserved: */
if (!(dst->mem.placement & TTM_PL_FLAG_NO_EVICT))
-   lockdep_assert_held(>resv->lock.base);
+   lockdep_assert_held(>base.resv->lock.base);
if (!(src->mem.placement & TTM_PL_FLAG_NO_EVICT))
-   lockdep_assert_held(>resv->lock.base);
+   lockdep_assert_held(>base.resv->lock.base);
 
if (dst->ttm->state == tt_unpopulated) {
ret = dst->ttm->bdev->driver->ttm_tt_populate(dst->ttm, );
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
index 0d9478d2e700..4a38ab0733c4 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
@@ -342,7 +342,7 @@ void vmw_bo_pin_reserved(struct vmw_buffer_object *vbo, 
bool pin)
uint32_t old_mem_type = bo->mem.mem_type;
int ret;
 
-   lockdep_assert_held(>resv->lock.base);
+   lockdep_assert_held(>base.resv->lock.base);
 
if (pin) {
if (vbo->pin_count++ > 0)
@@ -690,7 +690,7 @@ static int vmw_user_bo_synccpu_grab(struct 
vmw_user_buffer_object *user_bo,
long lret;
 
lret = reservation_object_wait_timeout_rcu
-   (bo->resv, true, true,
+   (bo->base.resv, true, true,
 nonblock ? 0 : MAX_SCHEDULE_TIMEOUT);
if (!lret)
return -EBUSY;
@@ -1007,10 +1007,10 @@ void vmw_bo_fence_single(struct ttm_buffer_object *bo,
 
if (fence == NULL) {
vmw_execbuf_fence_commands(NULL, dev_priv, , NULL);
-   reservation_object_add_excl_fence(bo->resv, >base);
+   reservation_object_add_excl_fence(bo->base.resv, >base);
dma_fence_put(>base);
} else
-   reservation_object_add_excl_fence(bo->resv, >base);
+   reservation_object_add_excl_fence(bo->base.resv, >base);
 }
 
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
index b4f6e1217c9d..e142714f132c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
@@ -169,7 +169,7 @@ static int vmw_cotable_unscrub(struct vmw_resource *res)
} *cmd;
 
WARN_ON_ONCE(bo->mem.mem_type != VMW_PL_MOB);
-   lockdep_assert_held(>resv->lock.base);
+   lockdep_assert_held(>base.resv->lock.base);
 
cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
if (!cmd)
@@ -311,7 +311,7 @@ static int vmw_cotable_unbind(struct vmw_resource *res,
return 0;
 
WARN_ON_ONCE(bo->mem.mem_type != VMW_PL_MOB);
-   lockdep_assert_held(>resv->lock.base);
+   lockdep_assert_held(>base.resv->lock.base);
 
mutex_lock(_priv->binding_mutex);
if (!vcotbl->scrubbed)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
index 1d38a8b2f2ec..ccd7f758bf8c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
@@ -402,14 +402,14 @@ void vmw_resource_unreserve(struct vmw_resource *res,
 
if (switch_backup && new_backup != res->backup) {
if (res->backup) {
-   lockdep_assert_held(>backup->base.resv->lock.base);
+   
lockdep_assert_held(>backup->base.base.resv->lock.base);
list_del_init(>mob_head);
vmw_bo_unreference(>backup);
}
 
if (new_backup) {
res->backup = vmw_bo_reference(new_backup);
-   lockdep_assert_held(_backup->base.resv->lock.base);
+   
lockdep_assert_held(_backup->base.base.resv->lock.base);
list_add_tail(>mob_head, _backup->res_list);
} else {
res->backup = NULL;
@@ -691,7 +691,7 @@ void vmw_resource_unbind_list(struct vmw_buffer_object *vbo)
.num_shared = 0
};
 
-   lockdep_assert_held(>base.resv->lock.base);
+   lockdep_assert_held(>base.base.resv->lock.base);
list_for_each_entry_safe(res, next, >res_list, mob_head) {
if (!res->func->unbind)
continue;
-- 
2.18.1



Re: Threaded submission & semaphore sharing

2019-08-01 Thread Koenig, Christian


Am 02.08.2019 07:17 schrieb Lionel Landwerlin :
On 02/08/2019 08:08, Koenig, Christian wrote:
Hi Lionel,

Well that looks more like your test case is buggy.

According to the code the ctx1 queue always waits for sem1 and ctx2 queue 
always waits for sem2.


That's supposed to be the same underlying syncobj because it's exported from 
one VkDevice as opaque FD from sem1 and imported into sem2.

Well than that's still buggy and won't synchronize at all.

When ctx1 waits for a semaphore and then signals the same semaphore there is no 
guarantee that ctx2 will run in between jobs.

It's perfectly valid in this case to first run all jobs from ctx1 and then all 
jobs from ctx2.

It only prevents running both at the same time and as far as I can see that 
still works even with threaded submission.

You need at least two semaphores for a tandem submission.

Regards,
Christian.


This way there can't be any Synchronisation between the two.

Regards,
Christian.

Am 02.08.2019 06:55 schrieb Lionel Landwerlin 
:
Hey Christian,

The problem boils down to the fact that we don't immediately create dma fences 
when calling vkQueueSubmit().
This is delayed to a thread.

From a single application thread, you can QueueSubmit() to 2 queues from 2 
different devices.
Each QueueSubmit to one queue has a dependency on the previous QueueSubmit on 
the other queue through an exported/imported semaphore.

From the API point of view the state of the semaphore should be changed after 
each QueueSubmit().
The problem is that it's not because of the thread and because you might have 
those 2 submission threads tied to different VkDevice/VkInstance or even 
different applications (synchronizing themselves outside the vulkan API).

Hope that makes sense.
It's not really easy to explain by mail, the best explanation is probably 
reading the test : 
https://gitlab.freedesktop.org/mesa/crucible/blob/master/src/tests/func/sync/semaphore-fd.c#L788

Like David mentioned you're not running into that issue right now, because you 
only dispatch to the thread under specific conditions.
But I could build a case to force that and likely run into the same issue.

-Lionel

On 02/08/2019 07:33, Koenig, Christian wrote:
Hi Lionel,

Well could you describe once more what the problem is?

Cause I don't fully understand why a rather normal tandem submission with two 
semaphores should fail in any way.

Regards,
Christian.

Am 02.08.2019 06:28 schrieb Lionel Landwerlin 
:
There aren't CTS tests covering the issue I was mentioning.
But we could add them.

I don't have all the details regarding your implementation but even with
the "semaphore thread", I could see it running into the same issues.
What if a mix of binary & timeline semaphores are handed to vkQueueSubmit()?

For example with queueA & queueB from 2 different VkDevice :
 vkQueueSubmit(queueA, signal semA);
 vkQueueSubmit(queueA, wait on [semA, timelineSemB]); with
timelineSemB triggering a wait before signal.
 vkQueueSubmit(queueB, signal semA);


-Lionel

On 02/08/2019 06:18, Zhou, David(ChunMing) wrote:
> Hi Lionel,
>
> By the Queue thread is a heavy thread, which is always resident in driver 
> during application running, our guys don't like that. So we switch to 
> Semaphore Thread, only when waitBeforeSignal of timeline happens, we spawn a 
> thread to handle that wait. So we don't have your this issue.
> By the way, I already pass all your CTS cases for now. I suggest you to 
> switch to Semaphore Thread instead of Queue Thread as well. It works very 
> well.
>
> -David
>
> -Original Message-
> From: Lionel Landwerlin 
> 
> Sent: Friday, August 2, 2019 4:52 AM
> To: dri-devel 
> ; 
> Koenig, Christian 
> ; Zhou, 
> David(ChunMing) ; Jason 
> Ekstrand 
> Subject: Threaded submission & semaphore sharing
>
> Hi Christian, David,
>
> Sorry to report this so late in the process, but I think we found an issue 
> not directly related to syncobj timelines themselves but with a side effect 
> of the threaded submissions.
>
> Essentially we're failing a test in crucible :
> func.sync.semaphore-fd.opaque-fd
> This test create a single binary semaphore, shares it between 2 
> VkDevice/VkQueue.
> Then in a loop it proceeds to submit workload alternating between the 2 
> VkQueue with one submit depending on the other.
> It does so by waiting on the VkSemaphore signaled in the previous iteration 
> and resignaling it.
>
> The problem for us is that once things are dispatched to the submission 
> thread, the ordering of the submission is lost.
> Because we have 2 devices and they both have their own submission thread.
>
> Jason suggested that we reestablish the ordering by having 
> semaphores/syncobjs carry an additional uint64_t payload.
> 

Re: Threaded submission & semaphore sharing

2019-08-01 Thread Lionel Landwerlin

On 02/08/2019 08:08, Koenig, Christian wrote:

Hi Lionel,

Well that looks more like your test case is buggy.

According to the code the ctx1 queue always waits for sem1 and ctx2 
queue always waits for sem2.



That's supposed to be the same underlying syncobj because it's exported 
from one VkDevice as opaque FD from sem1 and imported into sem2.





This way there can't be any Synchronisation between the two.

Regards,
Christian.

Am 02.08.2019 06:55 schrieb Lionel Landwerlin 
:

Hey Christian,

The problem boils down to the fact that we don't immediately create 
dma fences when calling vkQueueSubmit().

This is delayed to a thread.

From a single application thread, you can QueueSubmit() to 2 queues 
from 2 different devices.
Each QueueSubmit to one queue has a dependency on the previous 
QueueSubmit on the other queue through an exported/imported semaphore.


From the API point of view the state of the semaphore should be 
changed after each QueueSubmit().
The problem is that it's not because of the thread and because you 
might have those 2 submission threads tied to different 
VkDevice/VkInstance or even different applications (synchronizing 
themselves outside the vulkan API).


Hope that makes sense.
It's not really easy to explain by mail, the best explanation is 
probably reading the test : 
https://gitlab.freedesktop.org/mesa/crucible/blob/master/src/tests/func/sync/semaphore-fd.c#L788


Like David mentioned you're not running into that issue right now, 
because you only dispatch to the thread under specific conditions.

But I could build a case to force that and likely run into the same issue.

-Lionel

On 02/08/2019 07:33, Koenig, Christian wrote:

Hi Lionel,

Well could you describe once more what the problem is?

Cause I don't fully understand why a rather normal tandem submission 
with two semaphores should fail in any way.


Regards,
Christian.

Am 02.08.2019 06:28 schrieb Lionel Landwerlin 
:

There aren't CTS tests covering the issue I was mentioning.
But we could add them.

I don't have all the details regarding your implementation but even with
the "semaphore thread", I could see it running into the same issues.
What if a mix of binary & timeline semaphores are handed to 
vkQueueSubmit()?


For example with queueA & queueB from 2 different VkDevice :
 vkQueueSubmit(queueA, signal semA);
 vkQueueSubmit(queueA, wait on [semA, timelineSemB]); with
timelineSemB triggering a wait before signal.
 vkQueueSubmit(queueB, signal semA);


-Lionel

On 02/08/2019 06:18, Zhou, David(ChunMing) wrote:
> Hi Lionel,
>
> By the Queue thread is a heavy thread, which is always resident in 
driver during application running, our guys don't like that. So we 
switch to Semaphore Thread, only when waitBeforeSignal of timeline 
happens, we spawn a thread to handle that wait. So we don't have your 
this issue.
> By the way, I already pass all your CTS cases for now. I suggest 
you to switch to Semaphore Thread instead of Queue Thread as well. It 
works very well.

>
> -David
>
> -Original Message-
> From: Lionel Landwerlin 
> Sent: Friday, August 2, 2019 4:52 AM
> To: dri-devel ; Koenig, Christian 
; Zhou, David(ChunMing) 
; Jason Ekstrand 

> Subject: Threaded submission & semaphore sharing
>
> Hi Christian, David,
>
> Sorry to report this so late in the process, but I think we found 
an issue not directly related to syncobj timelines themselves but 
with a side effect of the threaded submissions.

>
> Essentially we're failing a test in crucible :
> func.sync.semaphore-fd.opaque-fd
> This test create a single binary semaphore, shares it between 2 
VkDevice/VkQueue.
> Then in a loop it proceeds to submit workload alternating between 
the 2 VkQueue with one submit depending on the other.
> It does so by waiting on the VkSemaphore signaled in the previous 
iteration and resignaling it.

>
> The problem for us is that once things are dispatched to the 
submission thread, the ordering of the submission is lost.
> Because we have 2 devices and they both have their own submission 
thread.

>
> Jason suggested that we reestablish the ordering by having 
semaphores/syncobjs carry an additional uint64_t payload.
> This 64bit integer would represent be an identifier that submission 
threads will WAIT_FOR_AVAILABLE on.

>
> The scenario would look like this :
>       - vkQueueSubmit(queueA, signal on semA);
>           - in the caller thread, this would increment the syncobj 
additional u64 payload and return it to userspace.
>           - at some point the submission thread of queueA submits 
the workload and signal the syncobj of semA with value returned in 
the caller thread of vkQueueSubmit().

>       - vkQueueSubmit(queueB, wait on semA);
>           - in the caller thread, this would read the syncobj 
additional

> u64 payload
>           - at some point the submission thread of queueB will try 
to submit the work, but first it will WAIT_FOR_AVAILABLE the u64 
value returned in the step above

Re: Threaded submission & semaphore sharing

2019-08-01 Thread Koenig, Christian
Hi Lionel,

Well that looks more like your test case is buggy.

According to the code the ctx1 queue always waits for sem1 and ctx2 queue 
always waits for sem2.

This way there can't be any Synchronisation between the two.

Regards,
Christian.

Am 02.08.2019 06:55 schrieb Lionel Landwerlin :
Hey Christian,

The problem boils down to the fact that we don't immediately create dma fences 
when calling vkQueueSubmit().
This is delayed to a thread.

>From a single application thread, you can QueueSubmit() to 2 queues from 2 
>different devices.
Each QueueSubmit to one queue has a dependency on the previous QueueSubmit on 
the other queue through an exported/imported semaphore.

>From the API point of view the state of the semaphore should be changed after 
>each QueueSubmit().
The problem is that it's not because of the thread and because you might have 
those 2 submission threads tied to different VkDevice/VkInstance or even 
different applications (synchronizing themselves outside the vulkan API).

Hope that makes sense.
It's not really easy to explain by mail, the best explanation is probably 
reading the test : 
https://gitlab.freedesktop.org/mesa/crucible/blob/master/src/tests/func/sync/semaphore-fd.c#L788

Like David mentioned you're not running into that issue right now, because you 
only dispatch to the thread under specific conditions.
But I could build a case to force that and likely run into the same issue.

-Lionel

On 02/08/2019 07:33, Koenig, Christian wrote:
Hi Lionel,

Well could you describe once more what the problem is?

Cause I don't fully understand why a rather normal tandem submission with two 
semaphores should fail in any way.

Regards,
Christian.

Am 02.08.2019 06:28 schrieb Lionel Landwerlin 
:
There aren't CTS tests covering the issue I was mentioning.
But we could add them.

I don't have all the details regarding your implementation but even with
the "semaphore thread", I could see it running into the same issues.
What if a mix of binary & timeline semaphores are handed to vkQueueSubmit()?

For example with queueA & queueB from 2 different VkDevice :
 vkQueueSubmit(queueA, signal semA);
 vkQueueSubmit(queueA, wait on [semA, timelineSemB]); with
timelineSemB triggering a wait before signal.
 vkQueueSubmit(queueB, signal semA);


-Lionel

On 02/08/2019 06:18, Zhou, David(ChunMing) wrote:
> Hi Lionel,
>
> By the Queue thread is a heavy thread, which is always resident in driver 
> during application running, our guys don't like that. So we switch to 
> Semaphore Thread, only when waitBeforeSignal of timeline happens, we spawn a 
> thread to handle that wait. So we don't have your this issue.
> By the way, I already pass all your CTS cases for now. I suggest you to 
> switch to Semaphore Thread instead of Queue Thread as well. It works very 
> well.
>
> -David
>
> -Original Message-
> From: Lionel Landwerlin 
> 
> Sent: Friday, August 2, 2019 4:52 AM
> To: dri-devel 
> ; 
> Koenig, Christian 
> ; Zhou, 
> David(ChunMing) ; Jason 
> Ekstrand 
> Subject: Threaded submission & semaphore sharing
>
> Hi Christian, David,
>
> Sorry to report this so late in the process, but I think we found an issue 
> not directly related to syncobj timelines themselves but with a side effect 
> of the threaded submissions.
>
> Essentially we're failing a test in crucible :
> func.sync.semaphore-fd.opaque-fd
> This test create a single binary semaphore, shares it between 2 
> VkDevice/VkQueue.
> Then in a loop it proceeds to submit workload alternating between the 2 
> VkQueue with one submit depending on the other.
> It does so by waiting on the VkSemaphore signaled in the previous iteration 
> and resignaling it.
>
> The problem for us is that once things are dispatched to the submission 
> thread, the ordering of the submission is lost.
> Because we have 2 devices and they both have their own submission thread.
>
> Jason suggested that we reestablish the ordering by having 
> semaphores/syncobjs carry an additional uint64_t payload.
> This 64bit integer would represent be an identifier that submission threads 
> will WAIT_FOR_AVAILABLE on.
>
> The scenario would look like this :
>   - vkQueueSubmit(queueA, signal on semA);
>   - in the caller thread, this would increment the syncobj additional 
> u64 payload and return it to userspace.
>   - at some point the submission thread of queueA submits the 
> workload and signal the syncobj of semA with value returned in the caller 
> thread of vkQueueSubmit().
>   - vkQueueSubmit(queueB, wait on semA);
>   - in the caller thread, this would read the syncobj additional
> u64 payload
>   - at some point the submission thread of queueB will try to submit 
> the work, but first it will 

Re: Threaded submission & semaphore sharing

2019-08-01 Thread Lionel Landwerlin

Hey Christian,

The problem boils down to the fact that we don't immediately create dma 
fences when calling vkQueueSubmit().

This is delayed to a thread.

From a single application thread, you can QueueSubmit() to 2 queues 
from 2 different devices.
Each QueueSubmit to one queue has a dependency on the previous 
QueueSubmit on the other queue through an exported/imported semaphore.


From the API point of view the state of the semaphore should be changed 
after each QueueSubmit().
The problem is that it's not because of the thread and because you might 
have those 2 submission threads tied to different VkDevice/VkInstance or 
even different applications (synchronizing themselves outside the vulkan 
API).


Hope that makes sense.
It's not really easy to explain by mail, the best explanation is 
probably reading the test : 
https://gitlab.freedesktop.org/mesa/crucible/blob/master/src/tests/func/sync/semaphore-fd.c#L788


Like David mentioned you're not running into that issue right now, 
because you only dispatch to the thread under specific conditions.

But I could build a case to force that and likely run into the same issue.

-Lionel

On 02/08/2019 07:33, Koenig, Christian wrote:

Hi Lionel,

Well could you describe once more what the problem is?

Cause I don't fully understand why a rather normal tandem submission 
with two semaphores should fail in any way.


Regards,
Christian.

Am 02.08.2019 06:28 schrieb Lionel Landwerlin 
:

There aren't CTS tests covering the issue I was mentioning.
But we could add them.

I don't have all the details regarding your implementation but even with
the "semaphore thread", I could see it running into the same issues.
What if a mix of binary & timeline semaphores are handed to 
vkQueueSubmit()?


For example with queueA & queueB from 2 different VkDevice :
 vkQueueSubmit(queueA, signal semA);
 vkQueueSubmit(queueA, wait on [semA, timelineSemB]); with
timelineSemB triggering a wait before signal.
 vkQueueSubmit(queueB, signal semA);


-Lionel

On 02/08/2019 06:18, Zhou, David(ChunMing) wrote:
> Hi Lionel,
>
> By the Queue thread is a heavy thread, which is always resident in 
driver during application running, our guys don't like that. So we 
switch to Semaphore Thread, only when waitBeforeSignal of timeline 
happens, we spawn a thread to handle that wait. So we don't have your 
this issue.
> By the way, I already pass all your CTS cases for now. I suggest you 
to switch to Semaphore Thread instead of Queue Thread as well. It 
works very well.

>
> -David
>
> -Original Message-
> From: Lionel Landwerlin 
> Sent: Friday, August 2, 2019 4:52 AM
> To: dri-devel ; Koenig, Christian 
; Zhou, David(ChunMing) 
; Jason Ekstrand 

> Subject: Threaded submission & semaphore sharing
>
> Hi Christian, David,
>
> Sorry to report this so late in the process, but I think we found an 
issue not directly related to syncobj timelines themselves but with a 
side effect of the threaded submissions.

>
> Essentially we're failing a test in crucible :
> func.sync.semaphore-fd.opaque-fd
> This test create a single binary semaphore, shares it between 2 
VkDevice/VkQueue.
> Then in a loop it proceeds to submit workload alternating between 
the 2 VkQueue with one submit depending on the other.
> It does so by waiting on the VkSemaphore signaled in the previous 
iteration and resignaling it.

>
> The problem for us is that once things are dispatched to the 
submission thread, the ordering of the submission is lost.
> Because we have 2 devices and they both have their own submission 
thread.

>
> Jason suggested that we reestablish the ordering by having 
semaphores/syncobjs carry an additional uint64_t payload.
> This 64bit integer would represent be an identifier that submission 
threads will WAIT_FOR_AVAILABLE on.

>
> The scenario would look like this :
>       - vkQueueSubmit(queueA, signal on semA);
>           - in the caller thread, this would increment the syncobj 
additional u64 payload and return it to userspace.
>           - at some point the submission thread of queueA submits 
the workload and signal the syncobj of semA with value returned in the 
caller thread of vkQueueSubmit().

>       - vkQueueSubmit(queueB, wait on semA);
>           - in the caller thread, this would read the syncobj additional
> u64 payload
>           - at some point the submission thread of queueB will try 
to submit the work, but first it will WAIT_FOR_AVAILABLE the u64 value 
returned in the step above

>
> Because we want the binary semaphores to be shared across processes 
and would like this to remain a single FD, the simplest location to 
store this additional u64 payload would be the DRM syncobj.

> It would need an additional ioctl to read & increment the value.
>
> What do you think?
>
> -Lionel




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

Re: Threaded submission & semaphore sharing

2019-08-01 Thread Koenig, Christian
Hi Lionel,

Well could you describe once more what the problem is?

Cause I don't fully understand why a rather normal tandem submission with two 
semaphores should fail in any way.

Regards,
Christian.

Am 02.08.2019 06:28 schrieb Lionel Landwerlin :
There aren't CTS tests covering the issue I was mentioning.
But we could add them.

I don't have all the details regarding your implementation but even with
the "semaphore thread", I could see it running into the same issues.
What if a mix of binary & timeline semaphores are handed to vkQueueSubmit()?

For example with queueA & queueB from 2 different VkDevice :
 vkQueueSubmit(queueA, signal semA);
 vkQueueSubmit(queueA, wait on [semA, timelineSemB]); with
timelineSemB triggering a wait before signal.
 vkQueueSubmit(queueB, signal semA);


-Lionel

On 02/08/2019 06:18, Zhou, David(ChunMing) wrote:
> Hi Lionel,
>
> By the Queue thread is a heavy thread, which is always resident in driver 
> during application running, our guys don't like that. So we switch to 
> Semaphore Thread, only when waitBeforeSignal of timeline happens, we spawn a 
> thread to handle that wait. So we don't have your this issue.
> By the way, I already pass all your CTS cases for now. I suggest you to 
> switch to Semaphore Thread instead of Queue Thread as well. It works very 
> well.
>
> -David
>
> -Original Message-
> From: Lionel Landwerlin 
> Sent: Friday, August 2, 2019 4:52 AM
> To: dri-devel ; Koenig, Christian 
> ; Zhou, David(ChunMing) ; 
> Jason Ekstrand 
> Subject: Threaded submission & semaphore sharing
>
> Hi Christian, David,
>
> Sorry to report this so late in the process, but I think we found an issue 
> not directly related to syncobj timelines themselves but with a side effect 
> of the threaded submissions.
>
> Essentially we're failing a test in crucible :
> func.sync.semaphore-fd.opaque-fd
> This test create a single binary semaphore, shares it between 2 
> VkDevice/VkQueue.
> Then in a loop it proceeds to submit workload alternating between the 2 
> VkQueue with one submit depending on the other.
> It does so by waiting on the VkSemaphore signaled in the previous iteration 
> and resignaling it.
>
> The problem for us is that once things are dispatched to the submission 
> thread, the ordering of the submission is lost.
> Because we have 2 devices and they both have their own submission thread.
>
> Jason suggested that we reestablish the ordering by having 
> semaphores/syncobjs carry an additional uint64_t payload.
> This 64bit integer would represent be an identifier that submission threads 
> will WAIT_FOR_AVAILABLE on.
>
> The scenario would look like this :
>   - vkQueueSubmit(queueA, signal on semA);
>   - in the caller thread, this would increment the syncobj additional 
> u64 payload and return it to userspace.
>   - at some point the submission thread of queueA submits the 
> workload and signal the syncobj of semA with value returned in the caller 
> thread of vkQueueSubmit().
>   - vkQueueSubmit(queueB, wait on semA);
>   - in the caller thread, this would read the syncobj additional
> u64 payload
>   - at some point the submission thread of queueB will try to submit 
> the work, but first it will WAIT_FOR_AVAILABLE the u64 value returned in the 
> step above
>
> Because we want the binary semaphores to be shared across processes and would 
> like this to remain a single FD, the simplest location to store this 
> additional u64 payload would be the DRM syncobj.
> It would need an additional ioctl to read & increment the value.
>
> What do you think?
>
> -Lionel


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

Re: Threaded submission & semaphore sharing

2019-08-01 Thread Lionel Landwerlin

There aren't CTS tests covering the issue I was mentioning.
But we could add them.

I don't have all the details regarding your implementation but even with 
the "semaphore thread", I could see it running into the same issues.

What if a mix of binary & timeline semaphores are handed to vkQueueSubmit()?

For example with queueA & queueB from 2 different VkDevice :
    vkQueueSubmit(queueA, signal semA);
    vkQueueSubmit(queueA, wait on [semA, timelineSemB]); with 
timelineSemB triggering a wait before signal.

    vkQueueSubmit(queueB, signal semA);


-Lionel

On 02/08/2019 06:18, Zhou, David(ChunMing) wrote:

Hi Lionel,

By the Queue thread is a heavy thread, which is always resident in driver 
during application running, our guys don't like that. So we switch to Semaphore 
Thread, only when waitBeforeSignal of timeline happens, we spawn a thread to 
handle that wait. So we don't have your this issue.
By the way, I already pass all your CTS cases for now. I suggest you to switch 
to Semaphore Thread instead of Queue Thread as well. It works very well.

-David

-Original Message-
From: Lionel Landwerlin 
Sent: Friday, August 2, 2019 4:52 AM
To: dri-devel ; Koenig, Christian 
; Zhou, David(ChunMing) ; Jason Ekstrand 

Subject: Threaded submission & semaphore sharing

Hi Christian, David,

Sorry to report this so late in the process, but I think we found an issue not 
directly related to syncobj timelines themselves but with a side effect of the 
threaded submissions.

Essentially we're failing a test in crucible :
func.sync.semaphore-fd.opaque-fd
This test create a single binary semaphore, shares it between 2 
VkDevice/VkQueue.
Then in a loop it proceeds to submit workload alternating between the 2 VkQueue 
with one submit depending on the other.
It does so by waiting on the VkSemaphore signaled in the previous iteration and 
resignaling it.

The problem for us is that once things are dispatched to the submission thread, 
the ordering of the submission is lost.
Because we have 2 devices and they both have their own submission thread.

Jason suggested that we reestablish the ordering by having semaphores/syncobjs 
carry an additional uint64_t payload.
This 64bit integer would represent be an identifier that submission threads 
will WAIT_FOR_AVAILABLE on.

The scenario would look like this :
      - vkQueueSubmit(queueA, signal on semA);
          - in the caller thread, this would increment the syncobj additional 
u64 payload and return it to userspace.
          - at some point the submission thread of queueA submits the workload 
and signal the syncobj of semA with value returned in the caller thread of 
vkQueueSubmit().
      - vkQueueSubmit(queueB, wait on semA);
          - in the caller thread, this would read the syncobj additional
u64 payload
          - at some point the submission thread of queueB will try to submit 
the work, but first it will WAIT_FOR_AVAILABLE the u64 value returned in the 
step above

Because we want the binary semaphores to be shared across processes and would 
like this to remain a single FD, the simplest location to store this additional 
u64 payload would be the DRM syncobj.
It would need an additional ioctl to read & increment the value.

What do you think?

-Lionel



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

[Bug 111282] When the s admin try to create different types of question in various difficulty level by bulk mode multiple answer accepted in single choice and t/f.And in multiple choice single answe

2019-08-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=111282

dhrisya  changed:

   What|Removed |Added

URL||http://westkutt-testnew.tar
   ||getentrance.com/login

-- 
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 111282] When the s admin try to create different types of question in various difficulty level by bulk mode multiple answer accepted in single choice and t/f.And in multiple choice single answe

2019-08-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=111282

dhrisya  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

-- 
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 111282] When the s admin try to create different types of question in various difficulty level by bulk mode multiple answer accepted in single choice and t/f.And in multiple choice single answe

2019-08-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=111282

Bug ID: 111282
   Summary: When the s admin try to create different types of
question in various  difficulty level by bulk mode
multiple answer accepted in single choice and t/f.And
in multiple choice single answer also accepted.
   Product: DRI
   Version: unspecified
  Hardware: All
OS: Windows (All)
Status: NEW
  Severity: major
  Priority: medium
 Component: General
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: dhrisyasb...@gmail.com

Test step: 
 1.Launch mozilla firefox   
2.type URL:http://westkutt-testnew.targetentrance.com/login 
3.Login with the Email: sad...@oqbs.com and password:admin   
click on sign in
Click on question bank
Click on Bulk upload
 Select File type
Click on T/F
Enter Question Title
Select Subject
Select Chapter
Select difficulty level
Enter options
Enter explanation
click on save file
Select File Input
Click on approve
Click on publish
Click on upload

-- 
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 111281] When the s admin try to create different types of question in various difficulty level by single upload mode database error occurred

2019-08-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=111281

Bug ID: 111281
   Summary: When the s admin try to create different types of
question in various  difficulty level by single upload
mode database error occurred
   Product: DRI
   Version: unspecified
  Hardware: Other
OS: All
Status: NEW
  Severity: critical
  Priority: medium
 Component: General
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: dhrisyasb...@gmail.com

Test step:

1.Launch mozilla firefox
2.type URL:http://westkutt-testnew.targetentrance.com/login 
3.Login with the Email: sad...@oqbs.com and password:admin   
click on sign in
Click on question bank
click on add New Questions
Click on Single choice MCQs
Enter Question Title
Enter description
Select Subject
Select Chapter
Select difficulty level
Enter options
Enter explanation
Click on publish
Click on approve
Click on preview
Click on submit

-- 
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: Threaded submission & semaphore sharing

2019-08-01 Thread Zhou, David(ChunMing)
Hi Lionel,

By the Queue thread is a heavy thread, which is always resident in driver 
during application running, our guys don't like that. So we switch to Semaphore 
Thread, only when waitBeforeSignal of timeline happens, we spawn a thread to 
handle that wait. So we don't have your this issue.
By the way, I already pass all your CTS cases for now. I suggest you to switch 
to Semaphore Thread instead of Queue Thread as well. It works very well.

-David

-Original Message-
From: Lionel Landwerlin  
Sent: Friday, August 2, 2019 4:52 AM
To: dri-devel ; Koenig, Christian 
; Zhou, David(ChunMing) ; Jason 
Ekstrand 
Subject: Threaded submission & semaphore sharing

Hi Christian, David,

Sorry to report this so late in the process, but I think we found an issue not 
directly related to syncobj timelines themselves but with a side effect of the 
threaded submissions.

Essentially we're failing a test in crucible : 
func.sync.semaphore-fd.opaque-fd
This test create a single binary semaphore, shares it between 2 
VkDevice/VkQueue.
Then in a loop it proceeds to submit workload alternating between the 2 VkQueue 
with one submit depending on the other.
It does so by waiting on the VkSemaphore signaled in the previous iteration and 
resignaling it.

The problem for us is that once things are dispatched to the submission thread, 
the ordering of the submission is lost.
Because we have 2 devices and they both have their own submission thread.

Jason suggested that we reestablish the ordering by having semaphores/syncobjs 
carry an additional uint64_t payload.
This 64bit integer would represent be an identifier that submission threads 
will WAIT_FOR_AVAILABLE on.

The scenario would look like this :
     - vkQueueSubmit(queueA, signal on semA);
         - in the caller thread, this would increment the syncobj additional 
u64 payload and return it to userspace.
         - at some point the submission thread of queueA submits the workload 
and signal the syncobj of semA with value returned in the caller thread of 
vkQueueSubmit().
     - vkQueueSubmit(queueB, wait on semA);
         - in the caller thread, this would read the syncobj additional
u64 payload
         - at some point the submission thread of queueB will try to submit the 
work, but first it will WAIT_FOR_AVAILABLE the u64 value returned in the step 
above

Because we want the binary semaphores to be shared across processes and would 
like this to remain a single FD, the simplest location to store this additional 
u64 payload would be the DRM syncobj.
It would need an additional ioctl to read & increment the value.

What do you think?

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

drm fixes for 5.3-rc3

2019-08-01 Thread Dave Airlie
Hi Linus,

Thanks to Daniel for handling the email the last couple of weeks, flus
and break-ins combined to derail me. Surprised nothing materialised
today to take me out again.

I've also tried embedding the summary into the signed pull request,
since all the cool kids seemed to be doing it, it's a bit messy in my
workflow as I do most of my stuff remotely including signing, but I
usually edit the summary locally.

Otherwise, just more amdgpu navi fixes, msm fixes and a single nouveau
regression fix.

Thanks,
Dave.

drm-fixes-2019-08-02:
drm pull fixes for 5.3-rc3

amdgpu:
navi10 temperature and pstate fixes
vcn dynamic power management fix
CS ioctl error handling fix
debugfs info leak fix
amdkfd VegaM fix.

msm:
dma sync call fix
mdp5 dsi command mode fix
fall-through fixes
disabled GPU fix

nouveau:
regression fix for displayport MST support.
The following changes since commit 609488bc979f99f805f34e9a32c1e3b71179d10b:

  Linux 5.3-rc2 (2019-07-28 12:47:02 -0700)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm tags/drm-fixes-2019-08-02

for you to fetch changes up to f8981e0309e9004c6e86d218049045700c79d740:

  Merge tag 'msm-fixes-2019_08_01' of
https://gitlab.freedesktop.org/drm/msm into drm-fixes (2019-08-02
10:17:25 +1000)


drm pull fixes for 5.3-rc3

amdgpu:
navi10 temperature and pstate fixes
vcn dynamic power management fix
CS ioctl error handling fix
debugfs info leak fix
amdkfd VegaM fix.

msm:
dma sync call fix
mdp5 dsi command mode fix
fall-through fixes
disabled GPU fix

nouveau:
regression fix for displayport MST support.


Alex Deucher (1):
  drm/amdgpu/powerplay: use proper revision id for navi

Brian Masney (1):
  drm/msm: add support for per-CRTC max_vblank_count on mdp5

Christian König (1):
  drm/amdgpu: fix error handling in amdgpu_cs_process_fence_dep

Dave Airlie (2):
  Merge tag 'drm-fixes-5.3-2019-07-31' of
git://people.freedesktop.org/~agd5f/linux into drm-fixes
  Merge tag 'msm-fixes-2019_08_01' of
https://gitlab.freedesktop.org/drm/msm into drm-fixes

Evan Quan (7):
  drm/amd/powerplay: fix null pointer dereference around dpm state relates
  drm/amd/powerplay: enable SW SMU reset functionality
  drm/amd/powerplay: add new sensor type for VCN powergate status
  drm/amd/powerplay: support VCN powergate status retrieval on Raven
  drm/amd/powerplay: support VCN powergate status retrieval for SW SMU
  drm/amd/powerplay: correct Navi10 VCN powergate control (v2)
  drm/amd/powerplay: correct UVD/VCE/VCN power status retrieval

Jeffrey Hugo (1):
  drm: msm: Fix add_gpu_components

Jordan Crouse (1):
  drm/msm: Annotate intentional switch statement fall throughs

Kent Russell (1):
  drm/amdkfd: Fix byte align on VegaM

Kevin Wang (2):
  drm/amd/powerplay: add callback function of get_thermal_temperature_range
  drm/amd/powerplay: fix temperature granularity error in smu11

Lyude Paul (1):
  drm/nouveau: Only release VCPI slots on mode changes

Rob Clark (1):
  drm/msm: Use the correct dma_sync calls in msm_gem

Wang Xiayang (1):
  drm/amdgpu: fix a potential information leaking bug

 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c  |  3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c| 26 
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c| 74 +++
 drivers/gpu/drm/amd/include/kgd_pp_interface.h|  1 +
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c| 23 ---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c |  9 +++
 drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h|  1 -
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c| 48 +--
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 36 ++-
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c| 34 ---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c |  2 +
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c |  1 +
 drivers/gpu/drm/msm/adreno/adreno_gpu.c   |  1 +
 drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 16 -
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c  |  2 +-
 drivers/gpu/drm/msm/msm_drv.c |  3 +-
 drivers/gpu/drm/msm/msm_gem.c | 47 --
 drivers/gpu/drm/nouveau/dispnv50/disp.c   |  2 +-
 19 files changed, 215 insertions(+), 116 deletions(-)


[Bug 204181] NULL pointer dereference regression in amdgpu

2019-08-01 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=204181

--- Comment #26 from Sergey Kondakov (virtuous...@gmail.com) ---
Created attachment 284083
  --> https://bugzilla.kernel.org/attachment.cgi?id=284083=edit
dmesg_2019-08-02-amdgpu_fail_on_patched_5.2.5

(In reply to Nicholas Kazlauskas from comment #24)
> This should be fixed with the series linked below:
> 
> https://patchwork.freedesktop.org/series/64505/
> 
> But it still needs review and backporting to older kernels.

Celebration might have been premature. Hours later I've got another freeze with
different error in amdgpu. Only this time, mouse cursor was movable over frozen
frame right until I tried switching VT. Here's trace:
BUG: unable to handle page fault for address: 00080184
#PF: supervisor read access in kernel mode
#PF: error_code(0x) - not-present page
PGD 0 P4D 0 
Oops:  [#1] PREEMPT SMP NOPTI
CPU: 2 PID: 21044 Comm: kworker/u16:0 Tainted: GW IO 
5.2.5-1396.g79b6a9c-HSF #1 openSUSE Tumbleweed (unreleased)
Hardware name: Gigabyte Technology Co., Ltd. GA-990XA-UD3/GA-990XA-UD3, BIOS
F14e 09/09/2014
Workqueue: events_unbound commit_work
RIP: 0010:amdgpu_dm_atomic_commit_tail+0x2e6/0xd60 [amdgpu]
Code: ff 48 89 de 48 8b b8 40 43 01 00 e8 94 3b 09 00 49 8b 54 24 08 48 89 9d
30 fe ff ff 8b 82 00 09 00 00 85 c0 0f 85 fb fd ff ff <80> bb 80 01 00 00 01 0f
86 a0 00 00 00 48 b9 00 00 00 00 01 00 00
RSP: 0018:98198b837c30 EFLAGS: 00010202
RAX: 0023 RBX: 00080004 RCX: 8aca7b146f18
RDX: 8acc2a2d9000 RSI: c0994f00 RDI: 0002
RBP: 98198b837e10 R08: 0001 R09: 0001
R10:  R11:  R12: 8aca97bf3540
R13: 8acc114b1000 R14: 8acc035da000 R15: 0006
FS:  () GS:8acc2e00() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 00080184 CR3: 0003747c2000 CR4: 000406e0
Call Trace:
 ? mark_held_locks+0x2d/0x80
 ? _raw_spin_unlock_irq+0x3a/0x50
 ? finish_task_switch+0xa2/0x300
 ? __lock_acquire+0x3c3/0x7c0
 ? find_held_lock+0x32/0x90
 ? find_held_lock+0x32/0x90
 ? sched_clock+0x5/0x10
 ? mark_held_locks+0x2d/0x80
 ? preempt_count_sub+0x98/0xe0
 ? _raw_spin_unlock_irq+0x3a/0x50
 ? wait_for_completion_timeout+0xe9/0x110
 ? commit_tail+0x3c/0x70
 commit_tail+0x3c/0x70
 process_one_work+0x271/0x5f0
 worker_thread+0x4a/0x3d0
 ? process_one_work+0x5f0/0x5f0
 kthread+0x118/0x140
 ? kthread_create_worker_on_cpu+0x70/0x70
 ret_from_fork+0x27/0x50
Modules linked in: r8169 binfmt_misc af_packet ts_bm xt_pkttype xt_string
nf_nat_ftp nf_conntrack_ftp xt_tcpudp ip6t_rpfilter ip6t_REJECT ipt_REJECT
xt_conntrack ebtable_nat ip6table_nat ip6table_mangle ip6table_raw
ip6table_security iptable_nat nf_nat iptable_mangle iptable_raw
iptable_security nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip_set nfnetlink
ebtable_filter ebtables scsi_transport_iscsi ip6table_filter ip6_tables
iptable_filter ip_tables x_tables bpfilter snd_seq_dummy snd_seq_oss
snd_seq_midi_event snd_seq snd_pcm_oss zram snd_mixer_oss bnep it87 hwmon_vid
msr joydev amd64_edac_mod edac_mce_amd btusb btrtl btbcm rc_avermedia btintel
kvm_amd tuner_simple tuner_types bluetooth snd_usb_audio tuner kvm tda7432
snd_usbmidi_lib snd_rawmidi irqbypass tvaudio msp3400 snd_seq_device ath9k bttv
ath9k_common ath9k_hw tea575x tveeprom ath videobuf_dma_sg videobuf_core
rc_core v4l2_common pcspkr wmi_bmof videodev mxm_wmi mac80211 fam15h_power
k10temp sp5100_tco
 media amdgpu i2c_piix4 snd_hda_codec_realtek snd_hda_codec_generic
snd_hda_codec_hdmi ledtrig_audio snd_hda_intel cfg80211 snd_hda_codec
snd_hda_core realtek gpu_sched libphy snd_hwdep ttm rfkill snd_pcm mac_hid
hid_generic usbhid uas usb_storage ohci_pci serio_raw sd_mod ohci_hcd ehci_pci
ehci_hcd xhci_pci xhci_hcd wmi exfat(O) l2tp_ppp l2tp_netlink l2tp_core
ip6_udp_tunnel udp_tunnel pppox ppp_generic slhc vhba(O) uinput sg nbd
dm_multipath scsi_dh_rdac scsi_dh_emc scsi_dh_alua ecryptfs [last unloaded:
r8169]
CR2: 00080184
---[ end trace 7da703104c8acbc9 ]---
RIP: 0010:amdgpu_dm_atomic_commit_tail+0x2e6/0xd60 [amdgpu]
Code: ff 48 89 de 48 8b b8 40 43 01 00 e8 94 3b 09 00 49 8b 54 24 08 48 89 9d
30 fe ff ff 8b 82 00 09 00 00 85 c0 0f 85 fb fd ff ff <80> bb 80 01 00 00 01 0f
86 a0 00 00 00 48 b9 00 00 00 00 01 00 00
RSP: 0018:98198b837c30 EFLAGS: 00010202
RAX: 0023 RBX: 00080004 RCX: 8aca7b146f18
RDX: 8acc2a2d9000 RSI: c0994f00 RDI: 0002
RBP: 98198b837e10 R08: 0001 R09: 0001
R10:  R11:  R12: 8aca97bf3540
R13: 8acc114b1000 R14: 8acc035da000 R15: 0006
FS:  () GS:8acc2e00() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 00080184 CR3: 0003747c2000 CR4: 000406e0

How ironic for it to manifest again during discussion video on 

Re: [PATCH][drm-next] drm/amd/powerplay: fix off-by-one upper bounds limit checks

2019-08-01 Thread Wang, Kevin(Yang)


From: Alex Deucher 
Sent: Friday, August 2, 2019 2:53 AM
To: Colin King 
Cc: Wang, Kevin(Yang) ; Rex Zhu ; Quan, 
Evan ; Deucher, Alexander ; 
Koenig, Christian ; Zhou, David(ChunMing) 
; David Airlie ; Daniel Vetter 
; amd-gfx list ; Maling list - 
DRI developers ; 
kernel-janit...@vger.kernel.org ; LKML 

Subject: Re: [PATCH][drm-next] drm/amd/powerplay: fix off-by-one upper bounds 
limit checks

On Thu, Aug 1, 2019 at 7:15 AM Colin King  wrote:
>
> From: Colin Ian King 
>
> There are two occurrances of off-by-one upper bound checking of indexes
> causing potential out-of-bounds array reads. Fix these.
>
> Addresses-Coverity: ("Out-of-bounds read")
> Fixes: cb33363d0e85 ("drm/amd/powerplay: add smu feature name support")
> Fixes: 6b294793e384 ("drm/amd/powerplay: add smu message name support")
> Signed-off-by: Colin Ian King 

Applied.  thanks!

Alex

> ---
>  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
> b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> index d029a99e600e..b64113740eb5 100644
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> @@ -38,7 +38,7 @@ static const char* __smu_message_names[] = {
>
>  const char *smu_get_message_name(struct smu_context *smu, enum 
> smu_message_type type)
>  {
> -   if (type < 0 || type > SMU_MSG_MAX_COUNT)
> +   if (type < 0 || type >= SMU_MSG_MAX_COUNT)
> return "unknown smu message";
> return __smu_message_names[type];
>  }
> @@ -51,7 +51,7 @@ static const char* __smu_feature_names[] = {
>
>  const char *smu_get_feature_name(struct smu_context *smu, enum 
> smu_feature_mask feature)
>  {
> -   if (feature < 0 || feature > SMU_FEATURE_COUNT)
> +   if (feature < 0 || feature >= SMU_FEATURE_COUNT)
> return "unknown smu feature";
> return __smu_feature_names[feature];
>  }
[kevin]:
thanks correct it.
Reviewed-by: Kevin Wang 
BR
Kevin
> --
> 2.20.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH][drm-next] drm/amd/powerplay: fix a few spelling mistakes

2019-08-01 Thread Wang, Kevin(Yang)



From: amd-gfx  on behalf of Colin King 

Sent: Thursday, August 1, 2019 4:39 PM
To: Rex Zhu ; Quan, Evan ; Deucher, 
Alexander ; Koenig, Christian 
; Zhou, David(ChunMing) ; David 
Airlie ; Daniel Vetter ; 
amd-...@lists.freedesktop.org ; 
dri-devel@lists.freedesktop.org 
Cc: kernel-janit...@vger.kernel.org ; 
linux-ker...@vger.kernel.org 
Subject: [PATCH][drm-next] drm/amd/powerplay: fix a few spelling mistakes

From: Colin Ian King 

There are a few spelling mistakes "unknow" -> "unknown" and
"enabeld" -> "enabled". Fix these.

Signed-off-by: Colin Ian King 
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 13b2c8a60232..d029a99e600e 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -39,7 +39,7 @@ static const char* __smu_message_names[] = {
 const char *smu_get_message_name(struct smu_context *smu, enum 
smu_message_type type)
 {
 if (type < 0 || type > SMU_MSG_MAX_COUNT)
-   return "unknow smu message";
+   return "unknown smu message";
 return __smu_message_names[type];
 }

@@ -52,7 +52,7 @@ static const char* __smu_feature_names[] = {
 const char *smu_get_feature_name(struct smu_context *smu, enum 
smu_feature_mask feature)
 {
 if (feature < 0 || feature > SMU_FEATURE_COUNT)
-   return "unknow smu feature";
+   return "unknown smu feature";
 return __smu_feature_names[feature];
 }

@@ -79,7 +79,7 @@ size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, 
char *buf)
count++,
smu_get_feature_name(smu, i),
feature_index,
-  !!smu_feature_is_enabled(smu, i) ? "enabeld" : 
"disabled");
+  !!smu_feature_is_enabled(smu, i) ? "enabled" : 
"disabled");
 }

[kevin]:
thanks correct it.
Reviewed-by: Kevin Wang 

BR
Kevin

 failed:
--
2.20.1

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

[Bug 107020] Dolphin freezes only with OpenGL

2019-08-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107020

--- Comment #3 from John  ---
Nope, AmdGpu driver Issue at the time. Using Nvidia, no issues now.

-- 
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 -next] drm/vgem: Fix wrong pointer passed to PTR_ERR()

2019-08-01 Thread Wei Yongjun
PTR_ERR should access the value just tested by IS_ERR, otherwise
the wrong error code will be returned.

Fixes: 7e9e5ead55be ("drm/vgem: fix cache synchronization on arm/arm64")
Signed-off-by: Wei Yongjun 
---
 drivers/gpu/drm/vgem/vgem_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
index b98689fb0d5d..ef52546f48c4 100644
--- a/drivers/gpu/drm/vgem/vgem_drv.c
+++ b/drivers/gpu/drm/vgem/vgem_drv.c
@@ -304,10 +304,10 @@ static struct page **pin_and_sync(struct 
drm_vgem_gem_object *bo)
if (IS_ERR(sgt)) {
dev_err(dev->dev,
"failed to allocate sgt: %ld\n",
-   PTR_ERR(bo->table));
+   PTR_ERR(sgt));
drm_gem_put_pages(>base, pages, false, false);
mutex_unlock(>pages_lock);
-   return ERR_CAST(bo->table);
+   return ERR_CAST(sgt);
}
 
/*





[Bug 106056] weird artifacts in top right corner when rendering with firefox or unigine heaven

2019-08-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106056

Timothy Arceri  changed:

   What|Removed |Added

 Resolution|--- |WORKSFORME
 Status|NEW |RESOLVED

--- Comment #2 from Timothy Arceri  ---
These seem to render correctly for me. Feel free to reopen if you still think
there is an issue, but for now I'm going to assume this was fixed at some point
and close.

-- 
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 v5 0/3] mm/gup: add make_dirty arg to put_user_pages_dirty_lock()

2019-08-01 Thread john . hubbard
From: John Hubbard 

Changes since v4:

* Christophe Hellwig's review applied: deleted siw_free_plist() and
  __qib_release_user_pages(), now that put_user_pages_dirty_lock() does
  what those routines were doing.

* Applied Bjorn's ACK for net/xdp, and Christophe's Reviewed-by for patch
  #1.

Changes since v3:

* Fixed an unused variable warning in siw_mem.c

Changes since v2:

* Critical bug fix: remove a stray "break;" from the new routine.

Changes since v1:

* Instead of providing __put_user_pages(), add an argument to
  put_user_pages_dirty_lock(), and delete put_user_pages_dirty().
  This is based on the following points:

1. Lots of call sites become simpler if a bool is passed
into put_user_page*(), instead of making the call site
choose which put_user_page*() variant to call.

2. Christoph Hellwig's observation that set_page_dirty_lock()
is usually correct, and set_page_dirty() is usually a
bug, or at least questionable, within a put_user_page*()
calling chain.

* Added the Infiniband driver back to the patch series, because it is
  a caller of put_user_pages_dirty_lock().

Unchanged parts from the v1 cover letter (except for the diffstat):

Notes about the remaining patches to come:

There are about 50+ patches in my tree [2], and I'll be sending out the
remaining ones in a few more groups:

* The block/bio related changes (Jerome mostly wrote those, but I've
  had to move stuff around extensively, and add a little code)

* mm/ changes

* other subsystem patches

* an RFC that shows the current state of the tracking patch set. That
  can only be applied after all call sites are converted, but it's
  good to get an early look at it.

This is part a tree-wide conversion, as described in commit fc1d8e7cca2d
("mm: introduce put_user_page*(), placeholder versions").



John Hubbard (3):
  mm/gup: add make_dirty arg to put_user_pages_dirty_lock()
  drivers/gpu/drm/via: convert put_page() to put_user_page*()
  net/xdp: convert put_page() to put_user_page*()

 drivers/gpu/drm/via/via_dmablit.c  |  10 +-
 drivers/infiniband/core/umem.c |   5 +-
 drivers/infiniband/hw/hfi1/user_pages.c|   5 +-
 drivers/infiniband/hw/qib/qib_user_pages.c |  13 +--
 drivers/infiniband/hw/usnic/usnic_uiom.c   |   5 +-
 drivers/infiniband/sw/siw/siw_mem.c|  18 +---
 include/linux/mm.h |   5 +-
 mm/gup.c   | 115 +
 net/xdp/xdp_umem.c |   9 +-
 9 files changed, 63 insertions(+), 122 deletions(-)

-- 
2.22.0



[PATCH v5 2/3] drivers/gpu/drm/via: convert put_page() to put_user_page*()

2019-08-01 Thread john . hubbard
From: John Hubbard 

For pages that were retained via get_user_pages*(), release those pages
via the new put_user_page*() routines, instead of via put_page() or
release_pages().

This is part a tree-wide conversion, as described in commit fc1d8e7cca2d
("mm: introduce put_user_page*(), placeholder versions").

Also reverse the order of a comparison, in order to placate
checkpatch.pl.

Cc: David Airlie 
Cc: Daniel Vetter 
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: John Hubbard 
---
 drivers/gpu/drm/via/via_dmablit.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/via/via_dmablit.c 
b/drivers/gpu/drm/via/via_dmablit.c
index 062067438f1d..b5b5bf0ba65e 100644
--- a/drivers/gpu/drm/via/via_dmablit.c
+++ b/drivers/gpu/drm/via/via_dmablit.c
@@ -171,7 +171,6 @@ via_map_blit_for_device(struct pci_dev *pdev,
 static void
 via_free_sg_info(struct pci_dev *pdev, drm_via_sg_info_t *vsg)
 {
-   struct page *page;
int i;
 
switch (vsg->state) {
@@ -186,13 +185,8 @@ via_free_sg_info(struct pci_dev *pdev, drm_via_sg_info_t 
*vsg)
kfree(vsg->desc_pages);
/* fall through */
case dr_via_pages_locked:
-   for (i = 0; i < vsg->num_pages; ++i) {
-   if (NULL != (page = vsg->pages[i])) {
-   if (!PageReserved(page) && (DMA_FROM_DEVICE == 
vsg->direction))
-   SetPageDirty(page);
-   put_page(page);
-   }
-   }
+   put_user_pages_dirty_lock(vsg->pages, vsg->num_pages,
+ (vsg->direction == DMA_FROM_DEVICE));
/* fall through */
case dr_via_pages_alloc:
vfree(vsg->pages);
-- 
2.22.0



[PATCH v5 1/3] mm/gup: add make_dirty arg to put_user_pages_dirty_lock()

2019-08-01 Thread john . hubbard
From: John Hubbard 

Provide more capable variation of put_user_pages_dirty_lock(),
and delete put_user_pages_dirty(). This is based on the
following:

1. Lots of call sites become simpler if a bool is passed
into put_user_page*(), instead of making the call site
choose which put_user_page*() variant to call.

2. Christoph Hellwig's observation that set_page_dirty_lock()
is usually correct, and set_page_dirty() is usually a
bug, or at least questionable, within a put_user_page*()
calling chain.

This leads to the following API choices:

* put_user_pages_dirty_lock(page, npages, make_dirty)

* There is no put_user_pages_dirty(). You have to
  hand code that, in the rare case that it's
  required.

Reviewed-by: Christoph Hellwig 
Cc: Matthew Wilcox 
Cc: Jan Kara 
Cc: Ira Weiny 
Cc: Jason Gunthorpe 
Signed-off-by: John Hubbard 
---
 drivers/infiniband/core/umem.c |   5 +-
 drivers/infiniband/hw/hfi1/user_pages.c|   5 +-
 drivers/infiniband/hw/qib/qib_user_pages.c |  13 +--
 drivers/infiniband/hw/usnic/usnic_uiom.c   |   5 +-
 drivers/infiniband/sw/siw/siw_mem.c|  18 +---
 include/linux/mm.h |   5 +-
 mm/gup.c   | 115 +
 7 files changed, 60 insertions(+), 106 deletions(-)

diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index 08da840ed7ee..965cf9dea71a 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -54,10 +54,7 @@ static void __ib_umem_release(struct ib_device *dev, struct 
ib_umem *umem, int d
 
for_each_sg_page(umem->sg_head.sgl, _iter, umem->sg_nents, 0) {
page = sg_page_iter_page(_iter);
-   if (umem->writable && dirty)
-   put_user_pages_dirty_lock(, 1);
-   else
-   put_user_page(page);
+   put_user_pages_dirty_lock(, 1, umem->writable && dirty);
}
 
sg_free_table(>sg_head);
diff --git a/drivers/infiniband/hw/hfi1/user_pages.c 
b/drivers/infiniband/hw/hfi1/user_pages.c
index b89a9b9aef7a..469acb961fbd 100644
--- a/drivers/infiniband/hw/hfi1/user_pages.c
+++ b/drivers/infiniband/hw/hfi1/user_pages.c
@@ -118,10 +118,7 @@ int hfi1_acquire_user_pages(struct mm_struct *mm, unsigned 
long vaddr, size_t np
 void hfi1_release_user_pages(struct mm_struct *mm, struct page **p,
 size_t npages, bool dirty)
 {
-   if (dirty)
-   put_user_pages_dirty_lock(p, npages);
-   else
-   put_user_pages(p, npages);
+   put_user_pages_dirty_lock(p, npages, dirty);
 
if (mm) { /* during close after signal, mm can be NULL */
atomic64_sub(npages, >pinned_vm);
diff --git a/drivers/infiniband/hw/qib/qib_user_pages.c 
b/drivers/infiniband/hw/qib/qib_user_pages.c
index bfbfbb7e0ff4..26c1fb8d45cc 100644
--- a/drivers/infiniband/hw/qib/qib_user_pages.c
+++ b/drivers/infiniband/hw/qib/qib_user_pages.c
@@ -37,15 +37,6 @@
 
 #include "qib.h"
 
-static void __qib_release_user_pages(struct page **p, size_t num_pages,
-int dirty)
-{
-   if (dirty)
-   put_user_pages_dirty_lock(p, num_pages);
-   else
-   put_user_pages(p, num_pages);
-}
-
 /**
  * qib_map_page - a safety wrapper around pci_map_page()
  *
@@ -124,7 +115,7 @@ int qib_get_user_pages(unsigned long start_page, size_t 
num_pages,
 
return 0;
 bail_release:
-   __qib_release_user_pages(p, got, 0);
+   put_user_pages_dirty_lock(p, got, false);
 bail:
atomic64_sub(num_pages, >mm->pinned_vm);
return ret;
@@ -132,7 +123,7 @@ int qib_get_user_pages(unsigned long start_page, size_t 
num_pages,
 
 void qib_release_user_pages(struct page **p, size_t num_pages)
 {
-   __qib_release_user_pages(p, num_pages, 1);
+   put_user_pages_dirty_lock(p, num_pages, true);
 
/* during close after signal, mm can be NULL */
if (current->mm)
diff --git a/drivers/infiniband/hw/usnic/usnic_uiom.c 
b/drivers/infiniband/hw/usnic/usnic_uiom.c
index 0b0237d41613..62e6ffa9ad78 100644
--- a/drivers/infiniband/hw/usnic/usnic_uiom.c
+++ b/drivers/infiniband/hw/usnic/usnic_uiom.c
@@ -75,10 +75,7 @@ static void usnic_uiom_put_pages(struct list_head 
*chunk_list, int dirty)
for_each_sg(chunk->page_list, sg, chunk->nents, i) {
page = sg_page(sg);
pa = sg_phys(sg);
-   if (dirty)
-   put_user_pages_dirty_lock(, 1);
-   else
-   put_user_page(page);
+   put_user_pages_dirty_lock(, 1, dirty);
usnic_dbg("pa: %pa\n", );
}
kfree(chunk);
diff --git a/drivers/infiniband/sw/siw/siw_mem.c 
b/drivers/infiniband/sw/siw/siw_mem.c
index 67171c82b0c4..2284966e4499 100644
--- 

[PATCH v5 3/3] net/xdp: convert put_page() to put_user_page*()

2019-08-01 Thread john . hubbard
From: John Hubbard 

For pages that were retained via get_user_pages*(), release those pages
via the new put_user_page*() routines, instead of via put_page() or
release_pages().

This is part a tree-wide conversion, as described in commit fc1d8e7cca2d
("mm: introduce put_user_page*(), placeholder versions").

Acked-by: Björn Töpel 
Cc: Magnus Karlsson 
Cc: David S. Miller 
Cc: net...@vger.kernel.org
Signed-off-by: John Hubbard 
---
 net/xdp/xdp_umem.c | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c
index 83de74ca729a..17c4b3d3dc34 100644
--- a/net/xdp/xdp_umem.c
+++ b/net/xdp/xdp_umem.c
@@ -166,14 +166,7 @@ void xdp_umem_clear_dev(struct xdp_umem *umem)
 
 static void xdp_umem_unpin_pages(struct xdp_umem *umem)
 {
-   unsigned int i;
-
-   for (i = 0; i < umem->npgs; i++) {
-   struct page *page = umem->pgs[i];
-
-   set_page_dirty_lock(page);
-   put_page(page);
-   }
+   put_user_pages_dirty_lock(umem->pgs, umem->npgs, true);
 
kfree(umem->pgs);
umem->pgs = NULL;
-- 
2.22.0



Re: [Nouveau] [PATCH] drm/nouveau: Only release VCPI slots on mode changes

2019-08-01 Thread Ben Skeggs
On Fri, 2 Aug 2019 at 08:02, Lyude Paul  wrote:
>
> Looks like a regression got introduced into nv50_mstc_atomic_check()
> that somehow didn't get found until now. If userspace changes
> crtc_state->active to false but leaves the CRTC enabled, we end up
> calling drm_dp_atomic_find_vcpi_slots() using the PBN calculated in
> asyh->dp.pbn. However, if the display is inactive we end up calculating
> a PBN of 0, which inadvertently causes us to have an allocation of 0.
> From there, if userspace then disables the CRTC afterwards we end up
> accidentally attempting to free the VCPI twice:
>
> WARNING: CPU: 0 PID: 1484 at drivers/gpu/drm/drm_dp_mst_topology.c:3336
> drm_dp_atomic_release_vcpi_slots+0x87/0xb0 [drm_kms_helper]
> RIP: 0010:drm_dp_atomic_release_vcpi_slots+0x87/0xb0 [drm_kms_helper]
> Call Trace:
>  drm_atomic_helper_check_modeset+0x3f3/0xa60 [drm_kms_helper]
>  ? drm_atomic_check_only+0x43/0x780 [drm]
>  drm_atomic_helper_check+0x15/0x90 [drm_kms_helper]
>  nv50_disp_atomic_check+0x83/0x1d0 [nouveau]
>  drm_atomic_check_only+0x54d/0x780 [drm]
>  ? drm_atomic_set_crtc_for_connector+0xec/0x100 [drm]
>  drm_atomic_commit+0x13/0x50 [drm]
>  drm_atomic_helper_set_config+0x81/0x90 [drm_kms_helper]
>  drm_mode_setcrtc+0x194/0x6a0 [drm]
>  ? vprintk_emit+0x16a/0x230
>  ? drm_ioctl+0x163/0x390 [drm]
>  ? drm_mode_getcrtc+0x180/0x180 [drm]
>  drm_ioctl_kernel+0xaa/0xf0 [drm]
>  drm_ioctl+0x208/0x390 [drm]
>  ? drm_mode_getcrtc+0x180/0x180 [drm]
>  nouveau_drm_ioctl+0x63/0xb0 [nouveau]
>  do_vfs_ioctl+0x405/0x660
>  ? recalc_sigpending+0x17/0x50
>  ? _copy_from_user+0x37/0x60
>  ksys_ioctl+0x5e/0x90
>  ? exit_to_usermode_loop+0x92/0xe0
>  __x64_sys_ioctl+0x16/0x20
>  do_syscall_64+0x59/0x190
>  entry_SYSCALL_64_after_hwframe+0x44/0xa9
> WARNING: CPU: 0 PID: 1484 at drivers/gpu/drm/drm_dp_mst_topology.c:3336
> drm_dp_atomic_release_vcpi_slots+0x87/0xb0 [drm_kms_helper]
> ---[ end trace 4c395c0c51b1f88d ]---
> [drm:drm_dp_atomic_release_vcpi_slots [drm_kms_helper]] *ERROR* no VCPI for
> [MST PORT:e288eb7d] found in mst state 8e642070
>
> So, fix this by doing what we probably should have done from the start: only
> call drm_dp_atomic_find_vcpi_slots() when crtc_state->mode_changed is set, so
> that VCPI allocations remain for as long as the CRTC is enabled.
>
> Signed-off-by: Lyude Paul 
> Fixes: 232c9eec417a ("drm/nouveau: Use atomic VCPI helpers for MST")
> Cc: Lyude Paul 
> Cc: Ben Skeggs 
> Cc: Daniel Vetter 
> Cc: David Airlie 
> Cc: Jerry Zuo 
> Cc: Harry Wentland 
> Cc: Juston Li 
> Cc: Karol Herbst 
> Cc: Laurent Pinchart 
> Cc: Ilia Mirkin 
> Cc:  # v5.1+
Acked-by: Ben Skeggs 

> ---
>  drivers/gpu/drm/nouveau/dispnv50/disp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c 
> b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> index 8497768f1b41..126703816794 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
> +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> @@ -780,7 +780,7 @@ nv50_msto_atomic_check(struct drm_encoder *encoder,
> drm_dp_calc_pbn_mode(crtc_state->adjusted_mode.clock,
>  connector->display_info.bpc * 3);
>
> -   if (drm_atomic_crtc_needs_modeset(crtc_state)) {
> +   if (crtc_state->mode_changed) {
> slots = drm_dp_atomic_find_vcpi_slots(state, >mgr,
>   mstc->port,
>   asyh->dp.pbn);
> --
> 2.21.0
>
> ___
> Nouveau mailing list
> nouv...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Bug 100802] [regression] mostly blank graphics on Faeria

2019-08-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=100802

Timothy Arceri  changed:

   What|Removed |Added

 Status|NEEDINFO|RESOLVED
 Resolution|--- |WORKSFORME

--- Comment #8 from Timothy Arceri  ---
No reply so assuming regression was fixed and closing.

-- 
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 107020] Dolphin freezes only with OpenGL

2019-08-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107020

--- Comment #2 from Timothy Arceri  ---
Is this still an issues?

-- 
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] drm/nouveau: Only release VCPI slots on mode changes

2019-08-01 Thread Lyude Paul
Looks like a regression got introduced into nv50_mstc_atomic_check()
that somehow didn't get found until now. If userspace changes
crtc_state->active to false but leaves the CRTC enabled, we end up
calling drm_dp_atomic_find_vcpi_slots() using the PBN calculated in
asyh->dp.pbn. However, if the display is inactive we end up calculating
a PBN of 0, which inadvertently causes us to have an allocation of 0.
From there, if userspace then disables the CRTC afterwards we end up
accidentally attempting to free the VCPI twice:

WARNING: CPU: 0 PID: 1484 at drivers/gpu/drm/drm_dp_mst_topology.c:3336
drm_dp_atomic_release_vcpi_slots+0x87/0xb0 [drm_kms_helper]
RIP: 0010:drm_dp_atomic_release_vcpi_slots+0x87/0xb0 [drm_kms_helper]
Call Trace:
 drm_atomic_helper_check_modeset+0x3f3/0xa60 [drm_kms_helper]
 ? drm_atomic_check_only+0x43/0x780 [drm]
 drm_atomic_helper_check+0x15/0x90 [drm_kms_helper]
 nv50_disp_atomic_check+0x83/0x1d0 [nouveau]
 drm_atomic_check_only+0x54d/0x780 [drm]
 ? drm_atomic_set_crtc_for_connector+0xec/0x100 [drm]
 drm_atomic_commit+0x13/0x50 [drm]
 drm_atomic_helper_set_config+0x81/0x90 [drm_kms_helper]
 drm_mode_setcrtc+0x194/0x6a0 [drm]
 ? vprintk_emit+0x16a/0x230
 ? drm_ioctl+0x163/0x390 [drm]
 ? drm_mode_getcrtc+0x180/0x180 [drm]
 drm_ioctl_kernel+0xaa/0xf0 [drm]
 drm_ioctl+0x208/0x390 [drm]
 ? drm_mode_getcrtc+0x180/0x180 [drm]
 nouveau_drm_ioctl+0x63/0xb0 [nouveau]
 do_vfs_ioctl+0x405/0x660
 ? recalc_sigpending+0x17/0x50
 ? _copy_from_user+0x37/0x60
 ksys_ioctl+0x5e/0x90
 ? exit_to_usermode_loop+0x92/0xe0
 __x64_sys_ioctl+0x16/0x20
 do_syscall_64+0x59/0x190
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
WARNING: CPU: 0 PID: 1484 at drivers/gpu/drm/drm_dp_mst_topology.c:3336
drm_dp_atomic_release_vcpi_slots+0x87/0xb0 [drm_kms_helper]
---[ end trace 4c395c0c51b1f88d ]---
[drm:drm_dp_atomic_release_vcpi_slots [drm_kms_helper]] *ERROR* no VCPI for
[MST PORT:e288eb7d] found in mst state 8e642070

So, fix this by doing what we probably should have done from the start: only
call drm_dp_atomic_find_vcpi_slots() when crtc_state->mode_changed is set, so
that VCPI allocations remain for as long as the CRTC is enabled.

Signed-off-by: Lyude Paul 
Fixes: 232c9eec417a ("drm/nouveau: Use atomic VCPI helpers for MST")
Cc: Lyude Paul 
Cc: Ben Skeggs 
Cc: Daniel Vetter 
Cc: David Airlie 
Cc: Jerry Zuo 
Cc: Harry Wentland 
Cc: Juston Li 
Cc: Karol Herbst 
Cc: Laurent Pinchart 
Cc: Ilia Mirkin 
Cc:  # v5.1+
---
 drivers/gpu/drm/nouveau/dispnv50/disp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c 
b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index 8497768f1b41..126703816794 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -780,7 +780,7 @@ nv50_msto_atomic_check(struct drm_encoder *encoder,
drm_dp_calc_pbn_mode(crtc_state->adjusted_mode.clock,
 connector->display_info.bpc * 3);
 
-   if (drm_atomic_crtc_needs_modeset(crtc_state)) {
+   if (crtc_state->mode_changed) {
slots = drm_dp_atomic_find_vcpi_slots(state, >mgr,
  mstc->port,
  asyh->dp.pbn);
-- 
2.21.0

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

Re: [PATCH v9 04/18] kunit: test: add kunit_stream a std::stream like logger

2019-08-01 Thread Brendan Higgins
On Thu, Aug 1, 2019 at 2:14 PM Stephen Boyd  wrote:
>
> Quoting Brendan Higgins (2019-08-01 11:59:57)
> > On Thu, Aug 1, 2019 at 11:55 AM Brendan Higgins
> >  wrote:
> > >
> > > On Fri, Jul 26, 2019 at 1:31 AM Petr Mladek  wrote:
> > >
> > > > To be honest I do not fully understand KUnit design. I am not
> > > > completely sure how the tested code is isolated from the running
> > > > system. Namely, I do not know if the tested code shares
> > > > the same locks with the system running the test.
> > >
> > > No worries, I don't expect printk to be the hang up in those cases. It
> > > sounds like KUnit has a long way to evolve before printk is going to
> > > be a limitation.
> >
> > So Stephen, what do you think?
> >
> > Do you want me to go forward with the new kunit_assert API wrapping
> > the string_stream as I have it now? Would you prefer to punt this to a
> > later patch? Or would you prefer something else?
> >
>
> I like the struct based approach. If anything, it can be adjusted to
> make the code throw some records into a spinlock later on and delay the
> formatting of the assertion if need be.

That's a fair point.

> Can you resend with that
> approach? I don't think I'll have any more comments after that.

Cool, will do.

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

Re: [PATCH v9 04/18] kunit: test: add kunit_stream a std::stream like logger

2019-08-01 Thread Stephen Boyd
Quoting Brendan Higgins (2019-08-01 11:59:57)
> On Thu, Aug 1, 2019 at 11:55 AM Brendan Higgins
>  wrote:
> >
> > On Fri, Jul 26, 2019 at 1:31 AM Petr Mladek  wrote:
> >
> > > To be honest I do not fully understand KUnit design. I am not
> > > completely sure how the tested code is isolated from the running
> > > system. Namely, I do not know if the tested code shares
> > > the same locks with the system running the test.
> >
> > No worries, I don't expect printk to be the hang up in those cases. It
> > sounds like KUnit has a long way to evolve before printk is going to
> > be a limitation.
> 
> So Stephen, what do you think?
> 
> Do you want me to go forward with the new kunit_assert API wrapping
> the string_stream as I have it now? Would you prefer to punt this to a
> later patch? Or would you prefer something else?
> 

I like the struct based approach. If anything, it can be adjusted to
make the code throw some records into a spinlock later on and delay the
formatting of the assertion if need be. Can you resend with that
approach? I don't think I'll have any more comments after that.



Threaded submission & semaphore sharing

2019-08-01 Thread Lionel Landwerlin

Hi Christian, David,

Sorry to report this so late in the process, but I think we found an 
issue not directly related to syncobj timelines themselves but with a 
side effect of the threaded submissions.


Essentially we're failing a test in crucible : 
func.sync.semaphore-fd.opaque-fd
This test create a single binary semaphore, shares it between 2 
VkDevice/VkQueue.
Then in a loop it proceeds to submit workload alternating between the 2 
VkQueue with one submit depending on the other.
It does so by waiting on the VkSemaphore signaled in the previous 
iteration and resignaling it.


The problem for us is that once things are dispatched to the submission 
thread, the ordering of the submission is lost.

Because we have 2 devices and they both have their own submission thread.

Jason suggested that we reestablish the ordering by having 
semaphores/syncobjs carry an additional uint64_t payload.
This 64bit integer would represent be an identifier that submission 
threads will WAIT_FOR_AVAILABLE on.


The scenario would look like this :
    - vkQueueSubmit(queueA, signal on semA);
        - in the caller thread, this would increment the syncobj 
additional u64 payload and return it to userspace.
        - at some point the submission thread of queueA submits the 
workload and signal the syncobj of semA with value returned in the 
caller thread of vkQueueSubmit().

    - vkQueueSubmit(queueB, wait on semA);
        - in the caller thread, this would read the syncobj additional 
u64 payload
        - at some point the submission thread of queueB will try to 
submit the work, but first it will WAIT_FOR_AVAILABLE the u64 value 
returned in the step above


Because we want the binary semaphores to be shared across processes and 
would like this to remain a single FD, the simplest location to store 
this additional u64 payload would be the DRM syncobj.

It would need an additional ioctl to read & increment the value.

What do you think?

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

[PULL] drm-intel-next

2019-08-01 Thread Rodrigo Vivi
Hi Dave and Daniel,

Here goes the first pull request targeting 5.4.

It mostly comes with a lot of platform enabling patches and reworks
and simplification around locking mechanisms, ppgtt allocation, engines
and intel_gt in general.

There were 2 silent backmerges that should be transparent for you.

drm-intel-next-2019-07-30:
- More changes on simplifying locking mechanisms (Chris)
- Selftests fixes and improvements (Chris)
- More work around engine tracking for better handling (Chris, Tvrtko)
- HDCP debug and info improvements (Ram, Ashuman)
- Add DSI properties (Vandita)
- Rework on sdvo support for better debuggability before fixing bugs (Ville)
- Display PLLs fixes and improvements, specially targeting Ice Lake (Imre, 
Matt, Ville)
- Perf fixes and improvements (Lionel)
- Enumerate scratch buffers (Lionel)
- Add infra to hold off preemption on a request (Lionel)
- Ice Lake color space fixes (Uma)
- Type-C fixes and improvements (Lucas)
- Fix and improvements around workarounds (Chris, John, Tvrtko)
- GuC related fixes and improvements (Chris, Daniele, Michal, Tvrtko)
- Fix on VLV/CHV display power domain (Ville)
- Improvements around Watermark (Ville)
- Favor intel_ types on intel_atomic functions (Ville)
- Don’t pass stack garbage to pcode (Ville)
- Improve display tracepoints (Steven)
- Don’t overestimate 4:2:0 link symbol clock (Ville)
- Add support for 4th pipe and transcoder (Lucas)
- Introduce initial support for Tiger Lake platform (Daniele, Lucas, Mahesh, 
Jose, Imre, Mika, Vandita, Rodrigo, Michel)
- PPGTT allocation simplification (Chris)
- Standardize function names and suffixes to make clean, symmetric and let 
checkpatch happy (Janusz)
- Skip SINK_COUNT read on CH7511 (Ville)
- Fix on kernel documentation (Chris, Michal)
- Add modular FIA (Anusha, Lucas)
- Fix EHL display (Matt, Vivek)
- Enable hotplug retry (Imre, Jose)
- Disable preemption under GVT (Chris)
- OA; Reconfigure context on the fly (Chris)
- Fixes and improvements around engine reset. (Chris)
- Small clean up on display pipe fault mask (Ville)
- Make sure cdclk is high enough for DP audio on VLV/CHV (Ville)
- Drop some wmb() and improve pwrite flush (Chris)
- Fix critical PSR regression (DK)
- Remove unused variables (YueHaibing)
- Use dev_get_drvdata for simplification (Chunhong)
- Use upstream version of header tests (Jani)

drm-intel-next-2019-07-08:
- Signal fence completion from i915_request_wait (Chris)
- Fixes and improvements around rings pin/unpin (Chris)
- Display uncore prep patches (Daniele)
- Execlists preemption improvements (Chris)
- Selftests fixes and improvements (Chris)
- More Elkhartlake enabling work (Vandita, Jose, Matt, Vivek)
- Defer address space cleanup to an RCU worker (Chris)
- Implicit dev_priv removal and GT compartmentalization and other related 
follow-ups (Tvrtko, Chris)
- Prevent dereference of engine before NULL check in error capture (Chris)
- GuC related fixes (Daniele, Robert)
- Many changes on active tracking, timelines and locking mechanisms (Chris)
- Disable SAMPLER_STATE prefetching on Gen11 (HW W/a) (Kenneth)
- I915_perf fixes (Lionel)
- Add Ice Lake PCI ID (Mika)
- eDP backlight fix (Lee)
- Fix various gen2 tracepoints (Ville)
- Some irq vfunc clean-up and improvements (Ville)
- Move OA files to separated folder (Michal)
- Display self contained headers clean-up (Jani)
- Preparation for 4th pile (Lucas)
- Move atomic commit, watermark and other places to use more intel_crtc_state 
(Maarten)
- Many Ice Lake Type C and Thunderbolt fixes (Imre)
- Fix some Ice Lake hw w/a whitelist regs (Lionel)
- Fix memleak in runtime wakeref tracking (Mika)
- Remove unused Private PPAT manager (Michal)
- Don't check PPGTT presence on PPGTT-only platforms (Michal)
- Fix ICL DSI suspend/resume (Chris)
- Fix ICL Bandwidth issues (Ville)
- Add N & CTS values for 10/12 bit deep color (Aditya)
- Moving more GT related stuff under gt folder (Chris)
- Forcewake related fixes (Chris)
- Show support for accurate sw PMU busyness tracking (Chris)
- Handle gtt double alloc failures (Chris)
- Upgrade to new GuC version (Michal)
- Improve w/a debug dumps and pull engine w/a initialization into a common 
(Chris)
- Look for instdone on all engines at hangcheck (Tvrtko)
- Engine lookup simplification  (Chris)
- Many plane color formats fixes and improvements (Ville)
- Fix some compilation issues (YueHaibing)
- GTT page directory clean up and improvements (Mika)

Thanks,
Rodrigo.

The following changes since commit 5f9e832c137075045d15cd6899ab0505cfb2ca4b:

  Linus 5.3-rc1 (2019-07-21 14:05:38 -0700)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm-intel tags/drm-intel-next-2019-07-30

for you to fetch changes up to e0e712fe42ef67bdf45fc348767d1d0a4eeba77f:

  drm/i915: Update DRIVER_DATE to 20190730 (2019-07-30 11:50:24 -0700)


- More changes on simplifying locking mechanisms (Chris)
- Selftests fixes and improvements 

[RESEND PULL] msm-fixes

2019-08-01 Thread Sean Paul
Hi Team,
Sorry I pulled the trigger a bit early on the last email. This one is the same
tag, but cc's the appropriate lists/people.

Since I handed drm-misc back to Maarten this week, I'll send msm fixes from the
msm tree. Not too heavy, but fixes some important regressions in 5.3.

Thanks,

Sean

The following changes since commit 4d5308e7852741318e4d40fb8d43d9311b3984ae:

  Merge tag 'drm-fixes-5.3-2019-07-24' of 
git://people.freedesktop.org/~agd5f/linux into drm-fixes (2019-07-26 14:10:26 
+1000)

are available in the Git repository at:

  https://gitlab.freedesktop.org/drm/msm.git tags/msm-fixes-2019_08_01

for you to fetch changes up to 9ca7ad6c7706edeae331c1632d0c63897418ebad:

  drm: msm: Fix add_gpu_components (2019-08-01 12:52:21 -0400)


- Fix the dma_sync calls applied last week (Rob)
- Fix mdp5 dsi command mode (Brian)
- Squash fall through warnings (Jordan)
- Don't add disabled gpu nodes to the of device list (Jeffrey)

Cc: Jeffrey Hugo 
Cc: Jordan Crouse 
Cc: Brian Masney 
Cc: Rob Clark 


Brian Masney (1):
  drm/msm: add support for per-CRTC max_vblank_count on mdp5

Jeffrey Hugo (1):
  drm: msm: Fix add_gpu_components

Jordan Crouse (1):
  drm/msm: Annotate intentional switch statement fall throughs

Rob Clark (1):
  drm/msm: Use the correct dma_sync calls in msm_gem

 drivers/gpu/drm/msm/adreno/a5xx_gpu.c |  2 ++
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c |  1 +
 drivers/gpu/drm/msm/adreno/adreno_gpu.c   |  1 +
 drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 16 ++-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c  |  2 +-
 drivers/gpu/drm/msm/msm_drv.c |  3 +-
 drivers/gpu/drm/msm/msm_gem.c | 47 +++
 7 files changed, 64 insertions(+), 8 deletions(-)
-- 
Sean Paul, Software Engineer, Google / Chromium OS
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 2/4] drm/tiny/ili9341: Move driver to drm/panel

2019-08-01 Thread David Lechner

On 8/1/19 8:52 AM, Noralf Trønnes wrote:

Move the driver to drm/panel and take advantage of the new panel support
in drm_mipi_dbi. Change the file name to match the naming standard in
drm/panel. The DRM driver name is kept since it is ABI.

Add missing MAINTAINERS entry.

Cc: David Lechner 
Signed-off-by: Noralf Trønnes 
---


Reviewed-by: David Lechner 

Although, I will say that the way the diff came out, it makes it a bit
hard to follow the patch, so more more details in the commit message about
the specific changes could be helpful.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH][drm-next] drm/amd/powerplay: fix a few spelling mistakes

2019-08-01 Thread Joe Perches
On Thu, 2019-08-01 at 15:02 -0400, Alex Deucher wrote:
> Applied.  thanks!
> 
> Alex
> 
> On Thu, Aug 1, 2019 at 4:39 AM Colin King  wrote:
> > From: Colin Ian King 
> > 
> > There are a few spelling mistakes "unknow" -> "unknown" and
> > "enabeld" -> "enabled". Fix these.
[]
> > diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
> > b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
[]
> > @@ -39,7 +39,7 @@ static const char* __smu_message_names[] = {
> >  const char *smu_get_message_name(struct smu_context *smu, enum 
> > smu_message_type type)
> >  {
> > if (type < 0 || type > SMU_MSG_MAX_COUNT)

This looks like an off-by-one test against
SMU_MSG_MAX_COUNT where type
should be >=

> > -   return "unknow smu message";
> > +   return "unknown smu message";
> > return __smu_message_names[type];
[]
> > @@ -52,7 +52,7 @@ static const char* __smu_feature_names[] = {
> >  const char *smu_get_feature_name(struct smu_context *smu, enum 
> > smu_feature_mask feature)
> >  {
> > if (feature < 0 || feature > SMU_FEATURE_COUNT)

here too

> > -   return "unknow smu feature";
> > +   return "unknown smu feature";
> > return __smu_feature_names[feature];

Perhaps instead it should be against ARRAY_SIZE(__smu_)

Also, the  __SMU_DUMMY_MAP macro is unnecessarily complex.

It might be better to have some direct
index and name struct like

struct enum_name {
int val;
const char *name;
};

And walk that.

Perhaps add a macro like

#define enum_map(e)
{.val = e, .name = #e}


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

Re: [PATCH 3/4] drm/tiny/mi0283qt: Move driver to panel-ilitek-ili9341

2019-08-01 Thread David Lechner

On 8/1/19 8:52 AM, Noralf Trønnes wrote:

The MI0283QT panels use a ILI9341 controller so it makes sense to merge
it with the other ili9341 code.

The DRM driver name is ABI, so that is retained.

Cc: David Lechner 
Signed-off-by: Noralf Trønnes 
---


...


@@ -216,6 +339,10 @@ static int ili9341_probe(struct spi_device *spi)
return PTR_ERR(dc);
}
  
+	ili->regulator = devm_regulator_get(dev, "power");

+   if (IS_ERR(ili->regulator))
+   return PTR_ERR(ili->regulator);
+
ili->backlight = devm_of_find_backlight(dev);
if (IS_ERR(ili->backlight))
return PTR_ERR(ili->backlight);
@@ -230,7 +357,12 @@ static int ili9341_probe(struct spi_device *spi)
ili->panel.dev = dev;
ili->panel.funcs = ili->conf->funcs;
  


Should probably add a comment here that this is for backwards
compatibility of the driver name so that no one is tempted to
to add more driver structs when adding new panels.


-   return drm_mipi_dbi_panel_register(>panel, >dbidev, 
_drm_driver,
+   if (ili->conf == _data)
+   driver = _drm_driver;
+   else
+   driver = _drm_driver;
+
+   return drm_mipi_dbi_panel_register(>panel, >dbidev, driver,
   ili->conf->mode, rotation);
  }
  

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

Re: [PATCH][drm-next] drm/amdgpu: fix unsigned variable instance compared to less than zero

2019-08-01 Thread Alex Deucher
On Thu, Aug 1, 2019 at 7:01 AM Colin King  wrote:
>
> From: Colin Ian King 
>
> Currenly the error check on variable instance is always false because
> it is a uint32_t type and this is never less than zero. Fix this by
> making it an int type.
>
> Addresses-Coverity: ("Unsigned compared against 0")
> Fixes: 7d0e6329dfdc ("drm/amdgpu: update more sdma instances irq support")
> Signed-off-by: Colin Ian King 

Applied.  thanks!

Alex

> ---
>  drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c 
> b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> index a33bd867287e..92257f2bf171 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> @@ -1962,7 +1962,8 @@ static int sdma_v4_0_process_trap_irq(struct 
> amdgpu_device *adev,
>  static int sdma_v4_0_process_ras_data_cb(struct amdgpu_device *adev,
> struct amdgpu_iv_entry *entry)
>  {
> -   uint32_t instance, err_source;
> +   uint32_t err_source;
> +   int instance;
>
> instance = sdma_v4_0_irq_id_to_seq(entry->client_id);
> if (instance < 0)
> --
> 2.20.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [4/4] drm/panel/ili9341: Support DPI panels

2019-08-01 Thread David Lechner

On 8/1/19 8:52 AM, Noralf Trønnes wrote:

Add support for panels that use the DPI interface.
ILI9341 has onboard RAM so the assumption made here is that all such
panels support pixel upload over DBI.

The presence/absense of the Device Tree 'port' node decides which
interface is used for pixel transfer.

Signed-off-by: Noralf Trønnes 
---
  drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 56 
  1 file changed, 45 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c 
b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
index f6082fa2a389..7cbfd739c7fd 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
@@ -11,6 +11,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  #include 
@@ -53,11 +54,13 @@
  struct ili9341_config {
const struct drm_panel_funcs *funcs;
const struct drm_display_mode *mode;
+   bool no_dpi;


Can we invert this to use positive logic? i.e. use_dpi instead of
no_dpi.


  };
  
  struct ili9341 {

struct mipi_dbi_dev dbidev; /* This must be the first entry */
struct drm_panel panel;
+   bool use_dpi;
struct regulator *regulator;
struct backlight_device *backlight;
const struct ili9341_config *conf;
@@ -174,6 +177,7 @@ static const struct drm_display_mode yx240qv29_mode = {
  static const struct ili9341_config yx240qv29_data = {
.funcs = _funcs,
.mode = _mode,
+   .no_dpi = true,
  };
  
  static int mi0283qt_prepare(struct drm_panel *panel)

@@ -291,6 +295,7 @@ static const struct drm_display_mode mi0283qt_mode = {
  static const struct ili9341_config mi0283qt_data = {
.funcs = _drm_funcs,
.mode = _mode,
+   .no_dpi = true,
  };
  
  /* Legacy, DRM driver name is ABI */

@@ -303,6 +308,7 @@ static int ili9341_probe(struct spi_device *spi)
const struct spi_device_id *spi_id;
struct device *dev = >dev;
struct drm_driver *driver;
+   struct device_node *port;
struct mipi_dbi *dbi;
struct gpio_desc *dc;
struct ili9341 *ili;
@@ -357,21 +363,44 @@ static int ili9341_probe(struct spi_device *spi)
ili->panel.dev = dev;
ili->panel.funcs = ili->conf->funcs;
  
-	if (ili->conf == _data)

-   driver = _drm_driver;
-   else
-   driver = _drm_driver;
  
-	return drm_mipi_dbi_panel_register(>panel, >dbidev, driver,

-  ili->conf->mode, rotation);
+   port = of_get_child_by_name(dev->of_node, "port");
+   if (port) {
+   of_node_put(port);
+   ili->use_dpi = true;
+   }
+
+   if (ili->conf->no_dpi)
+   ili->use_dpi = false;


then this can just be ili->use_dpi = ili->conf->use_dpi.


+
+   if (ili->use_dpi) {
+   ret = drm_panel_add(>panel);
+   } else {
+   if (ili->conf == _data)
+   driver = _drm_driver;
+   else
+   driver = _drm_driver;
+
+   ret = drm_mipi_dbi_panel_register(>panel, >dbidev, 
driver,
+ ili->conf->mode, rotation);
+   }
+
+   return ret;
  }
  
  static int ili9341_remove(struct spi_device *spi)

  {
struct ili9341 *ili = spi_get_drvdata(spi);
  
-	drm_dev_unplug(>dbidev.drm);

-   drm_atomic_helper_shutdown(>dbidev.drm);
+   if (ili->use_dpi) {
+   drm_panel_remove(>panel);
+   drm_panel_disable(>panel);
+   drm_panel_unprepare(>panel);
+   kfree(ili);
+   } else {
+   drm_dev_unplug(>dbidev.drm);
+   drm_atomic_helper_shutdown(>dbidev.drm);
+   }
  
  	return 0;

  }
@@ -380,21 +409,26 @@ static void ili9341_shutdown(struct spi_device *spi)
  {
struct ili9341 *ili = spi_get_drvdata(spi);
  
-	drm_atomic_helper_shutdown(>dbidev.drm);

+   if (!ili->use_dpi)
+   drm_atomic_helper_shutdown(>dbidev.drm);
  }
  
  static int __maybe_unused ili9341_pm_suspend(struct device *dev)

  {
struct ili9341 *ili = dev_get_drvdata(dev);
  
-	return drm_mode_config_helper_suspend(>dbidev.drm);

+   if (!ili->use_dpi)
+   return drm_mode_config_helper_suspend(>dbidev.drm);
+
+   return 0;
  }
  
  static int __maybe_unused ili9341_pm_resume(struct device *dev)

  {
struct ili9341 *ili = dev_get_drvdata(dev);
  
-	drm_mode_config_helper_resume(>dbidev.drm);

+   if (!ili->use_dpi)
+   drm_mode_config_helper_resume(>dbidev.drm);
  
  	return 0;

  }



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

Re: [PATCH][drm-next] drm/amd/powerplay: fix a few spelling mistakes

2019-08-01 Thread Alex Deucher
Applied.  thanks!

Alex

On Thu, Aug 1, 2019 at 4:39 AM Colin King  wrote:
>
> From: Colin Ian King 
>
> There are a few spelling mistakes "unknow" -> "unknown" and
> "enabeld" -> "enabled". Fix these.
>
> Signed-off-by: Colin Ian King 
> ---
>  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
> b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> index 13b2c8a60232..d029a99e600e 100644
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> @@ -39,7 +39,7 @@ static const char* __smu_message_names[] = {
>  const char *smu_get_message_name(struct smu_context *smu, enum 
> smu_message_type type)
>  {
> if (type < 0 || type > SMU_MSG_MAX_COUNT)
> -   return "unknow smu message";
> +   return "unknown smu message";
> return __smu_message_names[type];
>  }
>
> @@ -52,7 +52,7 @@ static const char* __smu_feature_names[] = {
>  const char *smu_get_feature_name(struct smu_context *smu, enum 
> smu_feature_mask feature)
>  {
> if (feature < 0 || feature > SMU_FEATURE_COUNT)
> -   return "unknow smu feature";
> +   return "unknown smu feature";
> return __smu_feature_names[feature];
>  }
>
> @@ -79,7 +79,7 @@ size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, 
> char *buf)
>count++,
>smu_get_feature_name(smu, i),
>feature_index,
> -  !!smu_feature_is_enabled(smu, i) ? "enabeld" : 
> "disabled");
> +  !!smu_feature_is_enabled(smu, i) ? "enabled" : 
> "disabled");
> }
>
>  failed:
> --
> 2.20.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v9 04/18] kunit: test: add kunit_stream a std::stream like logger

2019-08-01 Thread Brendan Higgins
On Thu, Aug 1, 2019 at 11:55 AM Brendan Higgins
 wrote:
>
> On Fri, Jul 26, 2019 at 1:31 AM Petr Mladek  wrote:
> >
> > On Thu 2019-07-25 13:21:12, Brendan Higgins wrote:
> > > On Wed, Jul 24, 2019 at 12:31 AM Petr Mladek  wrote:
> > > >
> > > > On Mon 2019-07-22 16:54:10, Stephen Boyd wrote:
> > > > > Quoting Brendan Higgins (2019-07-22 15:30:49)
> > > > > > On Mon, Jul 22, 2019 at 1:03 PM Stephen Boyd  
> > > > > > wrote:
> > > > > > >
> > > > > > >
> > > > > > > What's the calling context of the assertions and expectations? I 
> > > > > > > still
> > > > > > > don't like the fact that string stream needs to allocate buffers 
> > > > > > > and
> > > > > > > throw them into a list somewhere because the calling context 
> > > > > > > matters
> > > > > > > there.
> > > > > >
> > > > > > The calling context is the same as before, which is anywhere.
> > > > >
> > > > > Ok. That's concerning then.
> > > > >
> > > > > >
> > > > > > > I'd prefer we just wrote directly to the console/log via printk
> > > > > > > instead. That way things are simple because we use the existing
> > > > > > > buffering path of printk, but maybe there's some benefit to the 
> > > > > > > string
> > > > > > > stream that I don't see? Right now it looks like it builds a 
> > > > > > > string and
> > > > > > > then dumps it to printk so I'm sort of lost what the benefit is 
> > > > > > > over
> > > > > > > just writing directly with printk.
> > > > > >
> > > > > > It's just buffering it so the whole string gets printed 
> > > > > > uninterrupted.
> > > > > > If we were to print out piecemeal to printk, couldn't we have 
> > > > > > another
> > > > > > call to printk come in causing it to garble the KUnit message we are
> > > > > > in the middle of printing?
> > > > >
> > > > > Yes, printing piecemeal by calling printk many times could lead to
> > > > > interleaving of messages if something else comes in such as an 
> > > > > interrupt
> > > > > printing something. Printk has some support to hold "records" but I'm
> > > > > not sure how that would work here because KERN_CONT talks about only
> > > > > being used early on in boot code. I haven't looked at printk in detail
> > > > > though so maybe I'm all wrong and KERN_CONT just works?
> > > >
> > > > KERN_CONT does not guarantee that the message will get printed
> > > > together. The pieces get interleaved with messages printed in
> > > > parallel.
> > > >
> > > > Note that KERN_CONT was originally really meant to be used only during
> > > > boot. It was later used more widely and ended in the best effort 
> > > > category.
> > > >
> > > > There were several attempts to make it more reliable. But it was
> > > > always either too complicated or error prone or both.
> > > >
> > > > You need to use your own buffering if you rely want perfect output.
> > > > The question is if it is really worth the complexity. Also note that
> > > > any buffering reduces the chance that the messages will reach
> > > > the console.
> > >
> > > Seems like that settles it then. Thanks!
> > >
> > > > BTW: There is a work in progress on a lockless printk ring buffer.
> > > > It will make printk() more secure regarding deadlocks. But it might
> > > > make transparent handling of continuous lines even more tricky.
> > > >
> > > > I guess that local buffering, before calling printk(), will be
> > > > even more important then. Well, it might really force us to create
> > > > an API for it.
> > >
> > > Cool! Can you CC me on that discussion?
> >
> > Adding John Oggness into CC.
> >
> > John, please CC Brendan Higgins on the patchsets eventually switching
> > printk() into the lockless buffer. The test framework is going to
> > do its own buffering to keep the related messages together.
> >
> > The lockless ringbuffer might make handling of related (partial)
> > lines worse or better. It might justify KUnit's extra buffering
> > or it might allow to get rid of it.
>
> Thanks for CC'ing me on the printk ringbuffer thread. It looks like it
> actually probably won't affect my needs for KUnit logging. The biggest
> reason I need some sort of buffering system is to be able to compose
> messages piece meal into a single message that will be printed out to
> the user as a single message with no messages from other printk
> callers printed out in the middle of mine.
>
> The prb does look interesting; however, it appears that to get the
> semantics that I need, I would have to put my entire message in a
> single data block and would consequently need to know the size of my
> message a priori, which is problematic. Consequently, it seems as
> though I will probably need to compose my entire message using my own
> buffering system.
>
> > > > Note that stroring the messages into the printk log is basically safe 
> > > > in any
> > > > context. It uses temporary per-CPU buffers for recursive messages and
> > > > in NMI. The only problem is panic() when some CPU gets stuck with the
> > > > lock taken. This will get solved by the 

Re: [PATCH] gpu: drm: radeon: Fix a possible null-pointer dereference in radeon_connector_set_property()

2019-08-01 Thread Alex Deucher
On Mon, Jul 29, 2019 at 11:08 AM Jia-Ju Bai  wrote:
>
> In radeon_connector_set_property(), there is an if statement on line 743
> to check whether connector->encoder is NULL:
> if (connector->encoder)
>
> When connector->encoder is NULL, it is used on line 755:
> if (connector->encoder->crtc)
>
> Thus, a possible null-pointer dereference may occur.
>
> To fix this bug, connector->encoder is checked before being used.
>
> This bug is found by a static analysis tool STCheck written by us.

I believe we always have an encoder for every connector, but never
hurts to be safe.  Thanks.  Applied.

Alex

>
> Signed-off-by: Jia-Ju Bai 
> ---
>  drivers/gpu/drm/radeon/radeon_connectors.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
> b/drivers/gpu/drm/radeon/radeon_connectors.c
> index c60d1a44d22a..b684cd719612 100644
> --- a/drivers/gpu/drm/radeon/radeon_connectors.c
> +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
> @@ -752,7 +752,7 @@ static int radeon_connector_set_property(struct 
> drm_connector *connector, struct
>
> radeon_encoder->output_csc = val;
>
> -   if (connector->encoder->crtc) {
> +   if (connector->encoder && connector->encoder->crtc) {
> struct drm_crtc *crtc  = connector->encoder->crtc;
> struct radeon_crtc *radeon_crtc = 
> to_radeon_crtc(crtc);
>
> --
> 2.17.0
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v9 04/18] kunit: test: add kunit_stream a std::stream like logger

2019-08-01 Thread Brendan Higgins
On Fri, Jul 26, 2019 at 1:31 AM Petr Mladek  wrote:
>
> On Thu 2019-07-25 13:21:12, Brendan Higgins wrote:
> > On Wed, Jul 24, 2019 at 12:31 AM Petr Mladek  wrote:
> > >
> > > On Mon 2019-07-22 16:54:10, Stephen Boyd wrote:
> > > > Quoting Brendan Higgins (2019-07-22 15:30:49)
> > > > > On Mon, Jul 22, 2019 at 1:03 PM Stephen Boyd  wrote:
> > > > > >
> > > > > >
> > > > > > What's the calling context of the assertions and expectations? I 
> > > > > > still
> > > > > > don't like the fact that string stream needs to allocate buffers and
> > > > > > throw them into a list somewhere because the calling context matters
> > > > > > there.
> > > > >
> > > > > The calling context is the same as before, which is anywhere.
> > > >
> > > > Ok. That's concerning then.
> > > >
> > > > >
> > > > > > I'd prefer we just wrote directly to the console/log via printk
> > > > > > instead. That way things are simple because we use the existing
> > > > > > buffering path of printk, but maybe there's some benefit to the 
> > > > > > string
> > > > > > stream that I don't see? Right now it looks like it builds a string 
> > > > > > and
> > > > > > then dumps it to printk so I'm sort of lost what the benefit is over
> > > > > > just writing directly with printk.
> > > > >
> > > > > It's just buffering it so the whole string gets printed uninterrupted.
> > > > > If we were to print out piecemeal to printk, couldn't we have another
> > > > > call to printk come in causing it to garble the KUnit message we are
> > > > > in the middle of printing?
> > > >
> > > > Yes, printing piecemeal by calling printk many times could lead to
> > > > interleaving of messages if something else comes in such as an interrupt
> > > > printing something. Printk has some support to hold "records" but I'm
> > > > not sure how that would work here because KERN_CONT talks about only
> > > > being used early on in boot code. I haven't looked at printk in detail
> > > > though so maybe I'm all wrong and KERN_CONT just works?
> > >
> > > KERN_CONT does not guarantee that the message will get printed
> > > together. The pieces get interleaved with messages printed in
> > > parallel.
> > >
> > > Note that KERN_CONT was originally really meant to be used only during
> > > boot. It was later used more widely and ended in the best effort category.
> > >
> > > There were several attempts to make it more reliable. But it was
> > > always either too complicated or error prone or both.
> > >
> > > You need to use your own buffering if you rely want perfect output.
> > > The question is if it is really worth the complexity. Also note that
> > > any buffering reduces the chance that the messages will reach
> > > the console.
> >
> > Seems like that settles it then. Thanks!
> >
> > > BTW: There is a work in progress on a lockless printk ring buffer.
> > > It will make printk() more secure regarding deadlocks. But it might
> > > make transparent handling of continuous lines even more tricky.
> > >
> > > I guess that local buffering, before calling printk(), will be
> > > even more important then. Well, it might really force us to create
> > > an API for it.
> >
> > Cool! Can you CC me on that discussion?
>
> Adding John Oggness into CC.
>
> John, please CC Brendan Higgins on the patchsets eventually switching
> printk() into the lockless buffer. The test framework is going to
> do its own buffering to keep the related messages together.
>
> The lockless ringbuffer might make handling of related (partial)
> lines worse or better. It might justify KUnit's extra buffering
> or it might allow to get rid of it.

Thanks for CC'ing me on the printk ringbuffer thread. It looks like it
actually probably won't affect my needs for KUnit logging. The biggest
reason I need some sort of buffering system is to be able to compose
messages piece meal into a single message that will be printed out to
the user as a single message with no messages from other printk
callers printed out in the middle of mine.

The prb does look interesting; however, it appears that to get the
semantics that I need, I would have to put my entire message in a
single data block and would consequently need to know the size of my
message a priori, which is problematic. Consequently, it seems as
though I will probably need to compose my entire message using my own
buffering system.

> > > Note that stroring the messages into the printk log is basically safe in 
> > > any
> > > context. It uses temporary per-CPU buffers for recursive messages and
> > > in NMI. The only problem is panic() when some CPU gets stuck with the
> > > lock taken. This will get solved by the lockless ringbuffer. Also
> > > the temporary buffers will not be necessary any longer.
> >
> > Sure, I think Stephen's concern is all the supporting code that is
> > involved. Not printk specifically. It just means a lot more of KUnit
> > has to be IRQ safe.
>
> I see.
>
> BTW: I wonder if KUnit could reuse the existing seq_buf implementation
> for 

Re: [PATCH][drm-next] drm/amd/powerplay: fix off-by-one upper bounds limit checks

2019-08-01 Thread Alex Deucher
On Thu, Aug 1, 2019 at 7:15 AM Colin King  wrote:
>
> From: Colin Ian King 
>
> There are two occurrances of off-by-one upper bound checking of indexes
> causing potential out-of-bounds array reads. Fix these.
>
> Addresses-Coverity: ("Out-of-bounds read")
> Fixes: cb33363d0e85 ("drm/amd/powerplay: add smu feature name support")
> Fixes: 6b294793e384 ("drm/amd/powerplay: add smu message name support")
> Signed-off-by: Colin Ian King 

Applied.  thanks!

Alex

> ---
>  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
> b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> index d029a99e600e..b64113740eb5 100644
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> @@ -38,7 +38,7 @@ static const char* __smu_message_names[] = {
>
>  const char *smu_get_message_name(struct smu_context *smu, enum 
> smu_message_type type)
>  {
> -   if (type < 0 || type > SMU_MSG_MAX_COUNT)
> +   if (type < 0 || type >= SMU_MSG_MAX_COUNT)
> return "unknown smu message";
> return __smu_message_names[type];
>  }
> @@ -51,7 +51,7 @@ static const char* __smu_feature_names[] = {
>
>  const char *smu_get_feature_name(struct smu_context *smu, enum 
> smu_feature_mask feature)
>  {
> -   if (feature < 0 || feature > SMU_FEATURE_COUNT)
> +   if (feature < 0 || feature >= SMU_FEATURE_COUNT)
> return "unknown smu feature";
> return __smu_feature_names[feature];
>  }
> --
> 2.20.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Bug 110413] GPU crash and failed reset leading to deadlock on Polaris 22 XL [Radeon RX Vega M GL]

2019-08-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=110413

Utku Helvacı (tuxutku)  changed:

   What|Removed |Added

 CC||proje@outlook.com

--- Comment #11 from Utku Helvacı (tuxutku)  ---
Created attachment 144926
  --> https://bugs.freedesktop.org/attachment.cgi?id=144926=edit
journalctl -b0 output on kernel 5.3.0-rc2 from ubuntu mainline repository, with
a system with rx 540 gpu

kernel 5.3.0-rc1 was just fine and was just fixed a long lasted regression on
rx 540 gpu, updating to 5.3.0-rc2 causes gpu to be disabled after launching a
single application with it, gpu works fine until application is closed, then
DRI_PRIME=1 doesn't work

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

Re: [Intel-gfx] [RFC][PATCH 0/2] drm: PATH prop for all connectors?

2019-08-01 Thread Li, Sun peng (Leo)


On 2019-08-01 5:51 a.m., Pekka Paalanen wrote:
> On Tue, 16 Jul 2019 14:59:58 +
> "Li, Sun peng (Leo)"  wrote:
> 
>> On 2019-07-11 3:29 a.m., Pekka Paalanen wrote:
>>> Wait, one can write udev rules for connectors and stuff?
>>> How? What can they do?  
>>
>> I was using it to generate user-friendly device names for the mst aux
>> implementation:
>> https://patchwork.freedesktop.org/patch/315900/?series=63237=2
> 
> Hi,
> 
> what is that device node used for?
> 
> Are the "by-path" symlinks to help a display server associate the
> right device node with the right DRM KMS connector resource?

I intended it to be something more descriptive than the
'/dev/drm_dp_aux0, drm_dp_aux1, drm_dp_aux2, ...'  names, to help users
identify the connector they're addressing in the mst topology. I guess
it could also be used for the purpose you mention as well.

Of course, we'd need more reliable and persistent PATH props first. The
patch was dropped until this happens.

Leo

> 
> The patch commit message did not explain what the names are
> actually used for.
> 
> 
> Thanks,
> pq
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [Intel-gfx] [linux-next] mm/i915: i915_gemfs_init() NULL dereference

2019-08-01 Thread Chris Wilson
Quoting Sergey Senozhatsky (2019-07-31 17:48:29)
> @@ -36,19 +38,35 @@ int i915_gemfs_init(struct drm_i915_private *i915)
> struct super_block *sb = gemfs->mnt_sb;
> /* FIXME: Disabled until we get W/A for read BW issue. */
> char options[] = "huge=never";
> -   int flags = 0;
> int err;
>  
> -   err = sb->s_op->remount_fs(sb, , options);
> -   if (err) {
> -   kern_unmount(gemfs);
> -   return err;
> -   }
> +   fc = fs_context_for_reconfigure(sb->s_root, 0, 0);
> +   if (IS_ERR(fc))
> +   goto err;
> +
> +   if (!fc->ops->parse_monolithic)
> +   goto err;
> +
> +   err = fc->ops->parse_monolithic(fc, options);
> +   if (err)
> +   goto err;
> +
> +   if (!fc->ops->reconfigure)

It would be odd for fs_context_for_reconfigure() to allow creation of a
context if that context couldn't perform a reconfigre, nevertheless that
seems to be the case.

> +   goto err;
> +
> +   err = fc->ops->reconfigure(fc);
> +   if (err)
> +   goto err;

Only thing that stands out is that we should put_fs_context() here as
well. I guess it's better than poking at the SB_INFO directly ourselves.

I think though we shouldn't bail if we can't change the thp setting, and
just accept whatever with a warning.

Looks like the API is already available in dinq, so we can apply this
ahead of the next merge window.
-Chris
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v19 02/15] arm64: Introduce prctl() options to control the tagged user addresses ABI

2019-08-01 Thread Dave Hansen
On 8/1/19 5:38 AM, Kevin Brodsky wrote:
> This patch series only changes what is allowed or not at the syscall
> interface. It does not change the address space size. On arm64, TBI (Top
> Byte Ignore) has always been enabled for userspace, so it has never been
> possible to use the upper 8 bits of user pointers for addressing.

Oh, so does the address space that's available already chop that out?

> If other architectures were to support a similar functionality, then I
> agree that a common and more generic interface (if needed) would be
> helpful, but as it stands this is an arm64-specific prctl, and on arm64
> the address tag is defined by the architecture as bits [63:56].

It should then be an arch_prctl(), no?
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH] drm/radeon: Provide ddc symlink in connector sysfs directory

2019-08-01 Thread Andrzej Pietrasiewicz
Use the ddc pointer provided by the generic connector.

Signed-off-by: Andrzej Pietrasiewicz 
---
This is the same patch as in the series:

https://www.spinics.net/lists/dri-devel/msg220128.html

but this time without a bug.

radeon_add_legacy_connector() uses a local ddc variable, but it has
not been declared in the previous version of this patch.

Compile tested.

 drivers/gpu/drm/radeon/radeon_connectors.c | 143 +++--
 1 file changed, 107 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
b/drivers/gpu/drm/radeon/radeon_connectors.c
index c60d1a44d22a..62d37eddf99c 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -1870,6 +1870,7 @@ radeon_add_atom_connector(struct drm_device *dev,
struct radeon_connector_atom_dig *radeon_dig_connector;
struct drm_encoder *encoder;
struct radeon_encoder *radeon_encoder;
+   struct i2c_adapter *ddc = NULL;
uint32_t subpixel_order = SubPixelNone;
bool shared_ddc = false;
bool is_dp_bridge = false;
@@ -1947,17 +1948,21 @@ radeon_add_atom_connector(struct drm_device *dev,
radeon_connector->con_priv = radeon_dig_connector;
if (i2c_bus->valid) {
radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, 
i2c_bus);
-   if (radeon_connector->ddc_bus)
+   if (radeon_connector->ddc_bus) {
has_aux = true;
-   else
+   ddc = _connector->ddc_bus->adapter;
+   } else {
DRM_ERROR("DP: Failed to assign ddc bus! Check 
dmesg for i2c errors.\n");
+   }
}
switch (connector_type) {
case DRM_MODE_CONNECTOR_VGA:
case DRM_MODE_CONNECTOR_DVIA:
default:
-   drm_connector_init(dev, _connector->base,
-  _dp_connector_funcs, 
connector_type);
+   drm_connector_init_with_ddc(dev, 
_connector->base,
+   _dp_connector_funcs,
+   connector_type,
+   ddc);
drm_connector_helper_add(_connector->base,
 
_dp_connector_helper_funcs);
connector->interlace_allowed = true;
@@ -1979,8 +1984,10 @@ radeon_add_atom_connector(struct drm_device *dev,
case DRM_MODE_CONNECTOR_HDMIA:
case DRM_MODE_CONNECTOR_HDMIB:
case DRM_MODE_CONNECTOR_DisplayPort:
-   drm_connector_init(dev, _connector->base,
-  _dp_connector_funcs, 
connector_type);
+   drm_connector_init_with_ddc(dev, 
_connector->base,
+   _dp_connector_funcs,
+   connector_type,
+   ddc);
drm_connector_helper_add(_connector->base,
 
_dp_connector_helper_funcs);
drm_object_attach_property(_connector->base.base,
@@ -2027,8 +2034,10 @@ radeon_add_atom_connector(struct drm_device *dev,
break;
case DRM_MODE_CONNECTOR_LVDS:
case DRM_MODE_CONNECTOR_eDP:
-   drm_connector_init(dev, _connector->base,
-  _lvds_bridge_connector_funcs, 
connector_type);
+   drm_connector_init_with_ddc(dev, 
_connector->base,
+   
_lvds_bridge_connector_funcs,
+   connector_type,
+   ddc);
drm_connector_helper_add(_connector->base,
 
_dp_connector_helper_funcs);
drm_object_attach_property(_connector->base.base,
@@ -2042,13 +2051,18 @@ radeon_add_atom_connector(struct drm_device *dev,
} else {
switch (connector_type) {
case DRM_MODE_CONNECTOR_VGA:
-   drm_connector_init(dev, _connector->base, 
_vga_connector_funcs, connector_type);
-   drm_connector_helper_add(_connector->base, 
_vga_connector_helper_funcs);
if (i2c_bus->valid) {
radeon_connector->ddc_bus = 
radeon_i2c_lookup(rdev, i2c_bus);
if (!radeon_connector->ddc_bus)
DRM_ERROR("VGA: Failed to assign ddc 
bus! 

Re: [PATCH] drm/vgem: fix cache synchronization on arm/arm64

2019-08-01 Thread Rob Clark
On Thu, Aug 1, 2019 at 8:34 AM Chris Wilson  wrote:
>
> Quoting Rob Clark (2019-08-01 16:18:45)
> > On Thu, Aug 1, 2019 at 5:40 AM Chris Wilson  
> > wrote:
> > >
> > > Quoting Sean Paul (2019-07-31 20:23:31)
> > > > On Fri, Jul 19, 2019 at 11:21:53AM +0200, Daniel Vetter wrote:
> > > > > On Wed, Jul 17, 2019 at 02:15:37PM -0700, Rob Clark wrote:
> > > > > > From: Rob Clark 
> > > > > >
> > > > > > drm_cflush_pages() is no-op on arm/arm64.  But instead we can use
> > > > > > dma_sync API.
> > > > > >
> > > > > > Fixes failures w/ vgem_test.
> > > > > >
> > > > > > Signed-off-by: Rob Clark 
> > > > > > ---
> > > > > > An alternative approach to the series[1] I sent yesterday
> > > > > >
> > > > > > On the plus side, it keeps the WC buffers and avoids any drm core
> > > > > > changes.  On the minus side, I don't think it will work (at least
> > > > > > on arm64) prior to v5.0[2], so the fix can't be backported very
> > > > > > far.
> > > > >
> > > > > Yeah seems a lot more reasonable.
> > > > >
> > > > > Acked-by: Daniel Vetter 
> > > >
> > > > Applied to drm-misc-fixes, thanks!
> > >
> > > But it didn't actually fix the failures in CI.
> >
> > Hmm, that is unfortunate, I'd assumed that silence meant latest
> > version was working in CI..
>
> Ah, takes a intel-gfx@ for CI to pick up patches atm.
>
> > dma_sync_sg_* doesn't work on x86?  It would be kinda unfortunate to
> > have vgem only work on x86 *or* arm..  maybe bringing back
> > drm_cflush_pages() could make it work in both cases
>
> I think it stems from the expectation that vgem provides "device
> coherency" for CPU access. From the testing perspective, it's nice to
> emulate HW interactions; but maybe that is just beyond the general
> capabilities and we cannot simply use vgem as we do currently. That
> would leave a hole for mocking prime in CI that needs filling :(

yeah, being a "fake" device makes things a bit rough..  (I wonder if
there is some way to do a VM w/ both virgl and i915/gvt to get some
more "real" testing?)

OTOH, I kinda want to make drm_cache work on arm64, since dma-mapping
is already problematic, which would make this patch unnecessary.  (I'm
still not entirely sure what to do about 32b arm..)

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

Re: [PATCH v19 00/15] arm64: untag user pointers passed to the kernel

2019-08-01 Thread Dave Hansen
On 8/1/19 5:48 AM, Andrey Konovalov wrote:
> On Thu, Aug 1, 2019 at 2:11 PM Kevin Brodsky  wrote:
>> On 31/07/2019 17:50, Dave Hansen wrote:
>>> On 7/23/19 10:58 AM, Andrey Konovalov wrote:
 The mmap and mremap (only new_addr) syscalls do not currently accept
 tagged addresses. Architectures may interpret the tag as a background
 colour for the corresponding vma.
>>> What the heck is a "background colour"? :)
>> Good point, this is some jargon that we started using for MTE, the idea 
>> being that
>> the kernel could set a tag value (specified during mmap()) as "background 
>> colour" for
>> anonymous pages allocated in that range.
>>
>> Anyway, this patch series is not about MTE. Andrey, for v20 (if any), I 
>> think it's
>> best to drop this last sentence to avoid any confusion.
> Sure, thanks!

OK, but what does that mean for tagged addresses getting passed to
mmap/mremap?  That sentence read to me like "architectures might allow
tags for ...something...".  So do we accept tagged addresses into those
syscalls?

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

Re: [PATCH] drm/vgem: fix cache synchronization on arm/arm64

2019-08-01 Thread Chris Wilson
Quoting Rob Clark (2019-08-01 16:18:45)
> On Thu, Aug 1, 2019 at 5:40 AM Chris Wilson  wrote:
> >
> > Quoting Sean Paul (2019-07-31 20:23:31)
> > > On Fri, Jul 19, 2019 at 11:21:53AM +0200, Daniel Vetter wrote:
> > > > On Wed, Jul 17, 2019 at 02:15:37PM -0700, Rob Clark wrote:
> > > > > From: Rob Clark 
> > > > >
> > > > > drm_cflush_pages() is no-op on arm/arm64.  But instead we can use
> > > > > dma_sync API.
> > > > >
> > > > > Fixes failures w/ vgem_test.
> > > > >
> > > > > Signed-off-by: Rob Clark 
> > > > > ---
> > > > > An alternative approach to the series[1] I sent yesterday
> > > > >
> > > > > On the plus side, it keeps the WC buffers and avoids any drm core
> > > > > changes.  On the minus side, I don't think it will work (at least
> > > > > on arm64) prior to v5.0[2], so the fix can't be backported very
> > > > > far.
> > > >
> > > > Yeah seems a lot more reasonable.
> > > >
> > > > Acked-by: Daniel Vetter 
> > >
> > > Applied to drm-misc-fixes, thanks!
> >
> > But it didn't actually fix the failures in CI.
> 
> Hmm, that is unfortunate, I'd assumed that silence meant latest
> version was working in CI..

Ah, takes a intel-gfx@ for CI to pick up patches atm.
 
> dma_sync_sg_* doesn't work on x86?  It would be kinda unfortunate to
> have vgem only work on x86 *or* arm..  maybe bringing back
> drm_cflush_pages() could make it work in both cases

I think it stems from the expectation that vgem provides "device
coherency" for CPU access. From the testing perspective, it's nice to
emulate HW interactions; but maybe that is just beyond the general
capabilities and we cannot simply use vgem as we do currently. That
would leave a hole for mocking prime in CI that needs filling :(
-Chris
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH] drm/vgem: fix cache synchronization on arm/arm64

2019-08-01 Thread Rob Clark
On Thu, Aug 1, 2019 at 5:40 AM Chris Wilson  wrote:
>
> Quoting Sean Paul (2019-07-31 20:23:31)
> > On Fri, Jul 19, 2019 at 11:21:53AM +0200, Daniel Vetter wrote:
> > > On Wed, Jul 17, 2019 at 02:15:37PM -0700, Rob Clark wrote:
> > > > From: Rob Clark 
> > > >
> > > > drm_cflush_pages() is no-op on arm/arm64.  But instead we can use
> > > > dma_sync API.
> > > >
> > > > Fixes failures w/ vgem_test.
> > > >
> > > > Signed-off-by: Rob Clark 
> > > > ---
> > > > An alternative approach to the series[1] I sent yesterday
> > > >
> > > > On the plus side, it keeps the WC buffers and avoids any drm core
> > > > changes.  On the minus side, I don't think it will work (at least
> > > > on arm64) prior to v5.0[2], so the fix can't be backported very
> > > > far.
> > >
> > > Yeah seems a lot more reasonable.
> > >
> > > Acked-by: Daniel Vetter 
> >
> > Applied to drm-misc-fixes, thanks!
>
> But it didn't actually fix the failures in CI.

Hmm, that is unfortunate, I'd assumed that silence meant latest
version was working in CI..

dma_sync_sg_* doesn't work on x86?  It would be kinda unfortunate to
have vgem only work on x86 *or* arm..  maybe bringing back
drm_cflush_pages() could make it work in both cases

BR,
-R


Re: [PATCH] drm: rcar_lvds: Fix dual link mode operations

2019-08-01 Thread Laurent Pinchart
Hello Jacopo,

Thank you for the patch.

On Tue, Jul 23, 2019 at 06:57:00PM +0200, Jacopo Mondi wrote:
> The R-Car LVDS encoder units support dual-link operations by splitting
> the pixel output between the primary encoder and the companion one.

s/the companion one/its companion/

> 
> In order for the primary encoder to succesfully control the companion's
> operations this should not fail at probe time and register itself its
> associated drm bridge so that the primary one can find it.

This is hard to parse.

> Currently the companion encoder fails at probe time, causing the
> registration of the primary to fail preventing the whole DU unit to be
> registered correctly.
> 
> Fixes: fa440d870358 ("drm: rcar-du: lvds: Add support for dual-link mode")
> Reported-by: Fabrizio Castro 
> Signed-off-by: Jacopo Mondi 
> 
> ---
> The "Fixes" tag refers to a patch currently part of the
> renesas-drivers-2019-07-09-v5.2 branch of Geert's renesas-drivers tree.
> 
>  drivers/gpu/drm/rcar-du/rcar_lvds.c | 31 +
>  1 file changed, 23 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c 
> b/drivers/gpu/drm/rcar-du/rcar_lvds.c
> index bada7ee98544..8b015ba95895 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_lvds.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c
> @@ -767,14 +767,29 @@ static int rcar_lvds_parse_dt(struct rcar_lvds *lvds)
>   of_node_put(remote_input);
>   of_node_put(remote);
> 
> - /*
> -  * On D3/E3 the LVDS encoder provides a clock to the DU, which can be
> -  * used for the DPAD output even when the LVDS output is not connected.
> -  * Don't fail probe in that case as the DU will need the bridge to
> -  * control the clock.
> -  */
> - if (lvds->info->quirks & RCAR_LVDS_QUIRK_EXT_PLL)
> - return ret == -ENODEV ? 0 : ret;
> + switch (ret) {
> + case -ENODEV:
> + /*
> +  * On D3/E3 the LVDS encoder provides a clock to the DU, which
> +  * can be used for the DPAD output even when the LVDS output is
> +  * not connected. Don't fail probe in that case as the DU will
> +  * need the bridge to control the clock.
> +  */
> + if (lvds->info->quirks & RCAR_LVDS_QUIRK_EXT_PLL)
> + ret = 0;
> + break;
> + case -ENXIO:
> + /*
> +  * When the LVDS output is used in dual link mode, the
> +  * companion encoder fails at
> +  * 'rcar_lvds_parse_dt_companion()'. Don't fail probe in
> +  * that case as the master encoder will need the companion's
> +  * bridge to control its operations.
> +  */
> + if (lvds->info->quirks & RCAR_LVDS_QUIRK_DUAL_LINK)
> + ret = 0;

As -ENXIO can only be returned by rcar_lvds_parse_dt_companion(), and
rcar_lvds_parse_dt_companion() is only called when the
RCAR_LVDS_QUIRK_DUAL_LINK flag is set, this essentially means that you
always zero the error returned from rcar_lvds_parse_dt_companion(). This
is both complicated and too drastic as the second -ENXIO error case
shouldn't be ignored. It would be better and simpler to return 0 from
rcar_lvds_parse_dt_companion() when the renesas,companion property can't
be found.

> + break;
> + }
> 
>   return ret;
>  }

-- 
Regards,

Laurent Pinchart


Re: [PATCH 2/2] drm: gm12u320: Use DRM_DEV_ERROR everywhere

2019-08-01 Thread Sam Ravnborg
On Tue, Jul 30, 2019 at 03:38:57PM +0200, Hans de Goede wrote:
> Previously the driver was using a mix of DRM_ERROR and dev_err, be
> consisent and use DRM_DEV_ERROR everywhere instead.
> 
> Cc: Sam Ravnborg 
> Suggested-by: Sam Ravnborg 
> Signed-off-by: Hans de Goede 

Reviewed-by: Sam Ravnborg 

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

Re: [PATCH 1/2] drm: gm12u320: Some minor cleanups

2019-08-01 Thread Sam Ravnborg
Hi Hans.

On Tue, Jul 30, 2019 at 03:38:56PM +0200, Hans de Goede wrote:
> 3 small cleanups:
> 
> 1) Drop unused DRIVER_PATCHLEVEL
> 2) We do not set mode_config.preferred_depth, so instead of passing the
>unset mode_config.preferred_depth to drm_fbdev_generic_setup
>simply pass 0
> 3) Use __maybe_unused instead of #ifdef CONFIG_PM around the suspend /
>resume functions
> 
> Cc: Sam Ravnborg 
> Suggested-by: Sam Ravnborg 
If you add:
Suggested-by: Noralf Trønnes 
And adjust to the new location.

Then this is:
Reviewed-by: Sam Ravnborg 

> Signed-off-by: Hans de Goede 

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

Re: [PATCH] drm/komeda: Adds error event print functionality

2019-08-01 Thread Mihail Atanassov
Hi Lowry,

On Thursday, 1 August 2019 12:37:15 BST Lowry Li (Arm Technology China) wrote:
> From: "Lowry Li (Arm Technology China)" 
> 
> Adds to print the event message when error happens and the same event
> will not be printed until next vsync.
> 
> Changes since v1:
> 1. Handling the event print by CONFIG_KOMEDA_ERROR_PRINT;
> 2. Changing the max string size to 256.
> 
> Signed-off-by: Lowry Li (Arm Technology China) 
> ---
>  drivers/gpu/drm/arm/display/Kconfig   |   6 +
>  drivers/gpu/drm/arm/display/komeda/Makefile   |   2 +
>  drivers/gpu/drm/arm/display/komeda/komeda_dev.h   |  15 +++
>  drivers/gpu/drm/arm/display/komeda/komeda_event.c | 141
> ++ drivers/gpu/drm/arm/display/komeda/komeda_kms.c   | 
>  4 +
>  5 files changed, 168 insertions(+)
>  create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_event.c
> 
> diff --git a/drivers/gpu/drm/arm/display/Kconfig
> b/drivers/gpu/drm/arm/display/Kconfig index cec0639..e87ff86 100644
> --- a/drivers/gpu/drm/arm/display/Kconfig
> +++ b/drivers/gpu/drm/arm/display/Kconfig
> @@ -12,3 +12,9 @@ config DRM_KOMEDA
> Processor driver. It supports the D71 variants of the hardware.
> 
> If compiled as a module it will be called komeda.
> +
> +config DRM_KOMEDA_ERROR_PRINT
> + bool "Enable komeda error print"
> + depends on DRM_KOMEDA
> + help
> +   Choose this option to enable error printing.
> diff --git a/drivers/gpu/drm/arm/display/komeda/Makefile
> b/drivers/gpu/drm/arm/display/komeda/Makefile index 5c3900c..f095a1c 100644
> --- a/drivers/gpu/drm/arm/display/komeda/Makefile
> +++ b/drivers/gpu/drm/arm/display/komeda/Makefile
> @@ -22,4 +22,6 @@ komeda-y += \
>   d71/d71_dev.o \
>   d71/d71_component.o
> 
> +komeda-$(CONFIG_DRM_KOMEDA_ERROR_PRINT) += komeda_event.o
> +
>  obj-$(CONFIG_DRM_KOMEDA) += komeda.o
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h index d1c86b6..e28e7e6
> 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> @@ -40,6 +40,17 @@
>  #define KOMEDA_ERR_TTNG  BIT_ULL(30)
>  #define KOMEDA_ERR_TTF   BIT_ULL(31)
> 
> +#define KOMEDA_ERR_EVENTS\
> + (KOMEDA_EVENT_URUN  | KOMEDA_EVENT_IBSY | KOMEDA_EVENT_OVR |
\
> + KOMEDA_ERR_TETO | KOMEDA_ERR_TEMR   | 
KOMEDA_ERR_TITR |\
> + KOMEDA_ERR_CPE  | KOMEDA_ERR_CFGE   | 
KOMEDA_ERR_AXIE |\
> + KOMEDA_ERR_ACE0 | KOMEDA_ERR_ACE1   | 
KOMEDA_ERR_ACE2 |\
> + KOMEDA_ERR_ACE3 | KOMEDA_ERR_DRIFTTO| 
KOMEDA_ERR_FRAMETO |\
> + KOMEDA_ERR_ZME  | KOMEDA_ERR_MERR   | 
KOMEDA_ERR_TCF |\
> + KOMEDA_ERR_TTNG | KOMEDA_ERR_TTF)
> +
> +#define KOMEDA_WARN_EVENTS   KOMEDA_ERR_CSCE
> +
>  /* malidp device id */
>  enum {
>   MALI_D71 = 0,
> @@ -207,4 +218,8 @@ struct komeda_dev {
> 
>  struct komeda_dev *dev_to_mdev(struct device *dev);
> 
> +#ifdef CONFIG_DRM_KOMEDA_ERROR_PRINT
> +void komeda_print_events(struct komeda_events *evts);
> +#endif
> +
>  #endif /*_KOMEDA_DEV_H_*/
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> b/drivers/gpu/drm/arm/display/komeda/komeda_event.c new file mode 100644
> index 000..57b60cd
> --- /dev/null
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> @@ -0,0 +1,141 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * (C) COPYRIGHT 2019 ARM Limited. All rights reserved.
> + * Author: James.Qian.Wang 
> + *
> + */
> +#include 
> +
> +#include "komeda_dev.h"
> +
> +struct komeda_str {
> + char *str;
> + u32 sz;
> + u32 len;
> +};
> +
> +/* return 0 on success,  < 0 on no space.
> + */
> +static int komeda_sprintf(struct komeda_str *str, const char *fmt, ...)
The lack of '\0'-termination in the truncation case is quite disconcerting, 
especially since vsnprintf does it. This would be quite surprising to the 
casual passer-by.
> +{
> + va_list args;
> + int num, free_sz;
> + int err;
> +
> + free_sz = str->sz - str->len;
That's off by 1, you need to account for the null byte.
> + if (free_sz <= 0)
> + return -ENOSPC;
> +
> + va_start(args, fmt);
> +
> + num = vsnprintf(str->str + str->len, free_sz, fmt, args);
> +
> + va_end(args);
> +
> + if (num <= free_sz) {
Strictly less than. To quote from the doc of vsnprintf: 
""" [...] If the return is greater than or equal to @size, the resulting 
string is truncated. """
> + str->len += num;
> + err = 0;
> + } else {
> + str->len = str->sz;
Off by 1 here, too.
> + err = -ENOSPC;
That error code isn't used anywhere, so there's no value to having it in the 
current version of this patch. Either check the error code somewhere 
downstream and handle it, or change that to an actionable message for the 
person reading the kernel log. As it stands 

Re: [PATCH 1/3] drm: msm: a6xx: Mark expected switch fall-through

2019-08-01 Thread Sean Paul
On Fri, Jul 26, 2019 at 01:27:46PM +0200, Anders Roxell wrote:
> When fall-through warnings was enabled by default the following warning
> was starting to show up:
> 
> ../drivers/gpu/drm/msm/adreno/a6xx_gpu.c: In function ‘a6xx_submit’:
> ../drivers/gpu/drm/msm/adreno/a6xx_gpu.c:116:7: warning: this statement may 
> fall
>  through [-Wimplicit-fallthrough=]
> if (priv->lastctx == ctx)
>^
> ../drivers/gpu/drm/msm/adreno/a6xx_gpu.c:118:3: note: here
>case MSM_SUBMIT_CMD_BUF:
>^~~~
> 
> Rework so that the compiler doesn't warn about fall-through.
> 
> Fixes: d93512ef0f0e ("Makefile: Globally enable fall-through warning")
> Signed-off-by: Anders Roxell 

Hi Anders,
Thank you for your patches. Jordan had previously sent the same fixes in
"drm/msm: Annotate intentional switch statement fall throughs" one day earlier
than yours, so I'll pick up that patch.

Thanks again!

Sean

> ---
>  drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c 
> b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> index be39cf01e51e..644a6ee53f05 100644
> --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> @@ -115,6 +115,7 @@ static void a6xx_submit(struct msm_gpu *gpu, struct 
> msm_gem_submit *submit,
>   case MSM_SUBMIT_CMD_CTX_RESTORE_BUF:
>   if (priv->lastctx == ctx)
>   break;
> + /* Fall through */
>   case MSM_SUBMIT_CMD_BUF:
>   OUT_PKT7(ring, CP_INDIRECT_BUFFER_PFE, 3);
>   OUT_RING(ring, lower_32_bits(submit->cmd[i].iova));
> -- 
> 2.20.1
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS


[Bug 104602] [apitrace] Graphical artifacts in Civilization VI on RX Vega

2019-08-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=104602

--- Comment #21 from Jason Playne  ---
(In reply to Connor Abbott from comment #20)
> I wanted to make sure that improving the NIR path to reach parity with TGSI
> in local variable handling wouldn't break things, so I investigated this a
> bit more. It seems this is triggered by the fact that on Vega the TGSI path
> always uses scratch, even for smaller local arrays. This bloats the scratch
> space used by the VS in question. There are three back-to-back draw calls
> with this VS (used to build up the map), each using scratch, and it seems
> that radeonsi doesn't properly wait for each call to be done before starting
> the next and reuses the same scratch buffer, resulting in the threads from
> one draw call overwriting the scratch of the previous call. Hacking
> si_update_spi_tmpring_size() to always allocate a new scratch buffer "fixes"
> the black triangles.

Thanks heaps for looking into the issue Conner. Looking at the explanation on
what was happening makes it sound simple - I am sure the debugging effort was
far greater!

<3

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

[Bug 104602] [apitrace] Graphical artifacts in Civilization VI on RX Vega

2019-08-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=104602

--- Comment #20 from Connor Abbott  ---
I wanted to make sure that improving the NIR path to reach parity with TGSI in
local variable handling wouldn't break things, so I investigated this a bit
more. It seems this is triggered by the fact that on Vega the TGSI path always
uses scratch, even for smaller local arrays. This bloats the scratch space used
by the VS in question. There are three back-to-back draw calls with this VS
(used to build up the map), each using scratch, and it seems that radeonsi
doesn't properly wait for each call to be done before starting the next and
reuses the same scratch buffer, resulting in the threads from one draw call
overwriting the scratch of the previous call. Hacking
si_update_spi_tmpring_size() to always allocate a new scratch buffer "fixes"
the black triangles.

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

Re: [PATCH] drm/syncobj: remove boring message

2019-08-01 Thread Koenig, Christian
Am 01.08.19 um 15:45 schrieb Lionel Landwerlin:
> Just had a few exchanges with Chris about this.
> Chris suggests that if we're about to add a point to the timeline in 
> an unordered fashion, actually better not add it at all.
>
> What's your take on this?

That is a clear NAK. See not adding a point at all means we lose some 
synchronization and that is not something we can do here.

In other words syncing to much if userspace does something nasty is ok 
and defensive programmed, but not syncing at all could have unforeseen 
consequences.

Another idea would be to add the fence, but also set an error flag and 
deny any further signaling on that syncobj.

Regards,
Christian.

> I'm fine with this, but rather than add another variant of add_point() 
> maybe we change change the existing.
>
> Thanks,
>
> -Lionel
>
> On 29/07/2019 11:20, Chunming Zhou wrote:
>> It is normal that binary syncobj replaces the underlying fence.
>>
>> Signed-off-by: Chunming Zhou 
>> ---
>>   drivers/gpu/drm/drm_syncobj.c | 3 ---
>>   1 file changed, 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_syncobj.c 
>> b/drivers/gpu/drm/drm_syncobj.c
>> index 929f7c64f9a2..bc7ec1679e4d 100644
>> --- a/drivers/gpu/drm/drm_syncobj.c
>> +++ b/drivers/gpu/drm/drm_syncobj.c
>> @@ -151,9 +151,6 @@ void drm_syncobj_add_point(struct drm_syncobj 
>> *syncobj,
>>   spin_lock(>lock);
>>     prev = drm_syncobj_fence_get(syncobj);
>> -    /* You are adding an unorder point to timeline, which could 
>> cause payload returned from query_ioctl is 0! */
>> -    if (prev && prev->seqno >= point)
>> -    DRM_ERROR("You are adding an unorder point to timeline!\n");
>>   dma_fence_chain_init(chain, prev, fence, point);
>>   rcu_assign_pointer(syncobj->fence, >base);
>
>

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

[PATCH 4/4] drm/panel/ili9341: Support DPI panels

2019-08-01 Thread Noralf Trønnes
Add support for panels that use the DPI interface.
ILI9341 has onboard RAM so the assumption made here is that all such
panels support pixel upload over DBI.

The presence/absense of the Device Tree 'port' node decides which
interface is used for pixel transfer.

Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 56 
 1 file changed, 45 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c 
b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
index f6082fa2a389..7cbfd739c7fd 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -53,11 +54,13 @@
 struct ili9341_config {
const struct drm_panel_funcs *funcs;
const struct drm_display_mode *mode;
+   bool no_dpi;
 };
 
 struct ili9341 {
struct mipi_dbi_dev dbidev; /* This must be the first entry */
struct drm_panel panel;
+   bool use_dpi;
struct regulator *regulator;
struct backlight_device *backlight;
const struct ili9341_config *conf;
@@ -174,6 +177,7 @@ static const struct drm_display_mode yx240qv29_mode = {
 static const struct ili9341_config yx240qv29_data = {
.funcs = _funcs,
.mode = _mode,
+   .no_dpi = true,
 };
 
 static int mi0283qt_prepare(struct drm_panel *panel)
@@ -291,6 +295,7 @@ static const struct drm_display_mode mi0283qt_mode = {
 static const struct ili9341_config mi0283qt_data = {
.funcs = _drm_funcs,
.mode = _mode,
+   .no_dpi = true,
 };
 
 /* Legacy, DRM driver name is ABI */
@@ -303,6 +308,7 @@ static int ili9341_probe(struct spi_device *spi)
const struct spi_device_id *spi_id;
struct device *dev = >dev;
struct drm_driver *driver;
+   struct device_node *port;
struct mipi_dbi *dbi;
struct gpio_desc *dc;
struct ili9341 *ili;
@@ -357,21 +363,44 @@ static int ili9341_probe(struct spi_device *spi)
ili->panel.dev = dev;
ili->panel.funcs = ili->conf->funcs;
 
-   if (ili->conf == _data)
-   driver = _drm_driver;
-   else
-   driver = _drm_driver;
 
-   return drm_mipi_dbi_panel_register(>panel, >dbidev, driver,
-  ili->conf->mode, rotation);
+   port = of_get_child_by_name(dev->of_node, "port");
+   if (port) {
+   of_node_put(port);
+   ili->use_dpi = true;
+   }
+
+   if (ili->conf->no_dpi)
+   ili->use_dpi = false;
+
+   if (ili->use_dpi) {
+   ret = drm_panel_add(>panel);
+   } else {
+   if (ili->conf == _data)
+   driver = _drm_driver;
+   else
+   driver = _drm_driver;
+
+   ret = drm_mipi_dbi_panel_register(>panel, >dbidev, 
driver,
+ ili->conf->mode, rotation);
+   }
+
+   return ret;
 }
 
 static int ili9341_remove(struct spi_device *spi)
 {
struct ili9341 *ili = spi_get_drvdata(spi);
 
-   drm_dev_unplug(>dbidev.drm);
-   drm_atomic_helper_shutdown(>dbidev.drm);
+   if (ili->use_dpi) {
+   drm_panel_remove(>panel);
+   drm_panel_disable(>panel);
+   drm_panel_unprepare(>panel);
+   kfree(ili);
+   } else {
+   drm_dev_unplug(>dbidev.drm);
+   drm_atomic_helper_shutdown(>dbidev.drm);
+   }
 
return 0;
 }
@@ -380,21 +409,26 @@ static void ili9341_shutdown(struct spi_device *spi)
 {
struct ili9341 *ili = spi_get_drvdata(spi);
 
-   drm_atomic_helper_shutdown(>dbidev.drm);
+   if (!ili->use_dpi)
+   drm_atomic_helper_shutdown(>dbidev.drm);
 }
 
 static int __maybe_unused ili9341_pm_suspend(struct device *dev)
 {
struct ili9341 *ili = dev_get_drvdata(dev);
 
-   return drm_mode_config_helper_suspend(>dbidev.drm);
+   if (!ili->use_dpi)
+   return drm_mode_config_helper_suspend(>dbidev.drm);
+
+   return 0;
 }
 
 static int __maybe_unused ili9341_pm_resume(struct device *dev)
 {
struct ili9341 *ili = dev_get_drvdata(dev);
 
-   drm_mode_config_helper_resume(>dbidev.drm);
+   if (!ili->use_dpi)
+   drm_mode_config_helper_resume(>dbidev.drm);
 
return 0;
 }
-- 
2.20.1

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

[PATCH 3/4] drm/tiny/mi0283qt: Move driver to panel-ilitek-ili9341

2019-08-01 Thread Noralf Trønnes
The MI0283QT panels use a ILI9341 controller so it makes sense to merge
it with the other ili9341 code.

The DRM driver name is ABI, so that is retained.

Cc: David Lechner 
Signed-off-by: Noralf Trønnes 
---
 MAINTAINERS  |   9 +-
 drivers/gpu/drm/panel/Kconfig|   1 +
 drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 161 +-
 drivers/gpu/drm/tiny/Kconfig |  11 -
 drivers/gpu/drm/tiny/Makefile|   1 -
 drivers/gpu/drm/tiny/mi0283qt.c  | 294 ---
 6 files changed, 161 insertions(+), 316 deletions(-)
 delete mode 100644 drivers/gpu/drm/tiny/mi0283qt.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 66b3893a100f..cd7b8bdb3780 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5110,10 +5110,12 @@ F:  
Documentation/devicetree/bindings/display/ilitek,ili9225.txt
 
 DRM DRIVER FOR ILITEK ILI9341 PANELS
 M: David Lechner 
+M: Noralf Trønnes 
 T: git git://anongit.freedesktop.org/drm/drm-misc
 S: Maintained
 F: drivers/gpu/drm/panel/panel-ilitek-ili9341.c
 F: Documentation/devicetree/bindings/display/ilitek,ili9341.txt
+F: Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt
 
 DRM DRIVER FOR HX8357D PANELS
 M: Eric Anholt 
@@ -5137,13 +5139,6 @@ M:   Dave Airlie 
 S: Odd Fixes
 F: drivers/gpu/drm/mgag200/
 
-DRM DRIVER FOR MI0283QT
-M: Noralf Trønnes 
-T: git git://anongit.freedesktop.org/drm/drm-misc
-S: Maintained
-F: drivers/gpu/drm/tiny/mi0283qt.c
-F: Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt
-
 DRM DRIVER FOR MSM ADRENO GPU
 M: Rob Clark 
 M: Sean Paul 
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index a24953ec2d40..fbb5a723eeb5 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -65,6 +65,7 @@ config DRM_PANEL_ILITEK_ILI9341
help
  DRM driver for the following Ilitek ILI9341 panels:
  * YX240QV29-T 2.4" 240x320 TFT (Adafruit 2.4")
+ * Multi-Inno MI0283QT
 
  If M is selected the module will be called panel-ilitek-ili9341.
 
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c 
b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
index f8df737018d3..f6082fa2a389 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
@@ -3,8 +3,6 @@
  * DRM driver for Ilitek ILI9341 panels
  *
  * Copyright 2018 David Lechner 
- *
- * Based on mi0283qt.c:
  * Copyright 2016 Noralf Trønnes
  */
 
@@ -13,7 +11,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 
 #include 
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #define ILI9341_FRMCTR10xb1
@@ -57,6 +58,7 @@ struct ili9341_config {
 struct ili9341 {
struct mipi_dbi_dev dbidev; /* This must be the first entry */
struct drm_panel panel;
+   struct regulator *regulator;
struct backlight_device *backlight;
const struct ili9341_config *conf;
 };
@@ -174,12 +176,133 @@ static const struct ili9341_config yx240qv29_data = {
.mode = _mode,
 };
 
+static int mi0283qt_prepare(struct drm_panel *panel)
+{
+   struct ili9341 *ili = panel_to_ili9341(panel);
+   struct mipi_dbi_dev *dbidev = >dbidev;
+   struct mipi_dbi *dbi = >dbi;
+   u8 addr_mode;
+   int ret;
+
+   if (ili->regulator)
+   regulator_enable(ili->regulator);
+
+   ret = mipi_dbi_poweron_conditional_reset(dbidev);
+   if (ret < 0) {
+   if (ili->regulator)
+   regulator_disable(ili->regulator);
+   return ret;
+   }
+   if (ret == 1)
+   goto out_enable;
+
+   mipi_dbi_command(dbi, MIPI_DCS_SET_DISPLAY_OFF);
+
+   mipi_dbi_command(dbi, ILI9341_PWCTRLB, 0x00, 0x83, 0x30);
+   mipi_dbi_command(dbi, ILI9341_PWRSEQ, 0x64, 0x03, 0x12, 0x81);
+   mipi_dbi_command(dbi, ILI9341_DTCTRLA, 0x85, 0x01, 0x79);
+   mipi_dbi_command(dbi, ILI9341_PWCTRLA, 0x39, 0x2c, 0x00, 0x34, 0x02);
+   mipi_dbi_command(dbi, ILI9341_PUMPCTRL, 0x20);
+   mipi_dbi_command(dbi, ILI9341_DTCTRLB, 0x00, 0x00);
+
+   /* Power Control */
+   mipi_dbi_command(dbi, ILI9341_PWCTRL1, 0x26);
+   mipi_dbi_command(dbi, ILI9341_PWCTRL2, 0x11);
+   /* VCOM */
+   mipi_dbi_command(dbi, ILI9341_VMCTRL1, 0x35, 0x3e);
+   mipi_dbi_command(dbi, ILI9341_VMCTRL2, 0xbe);
+
+   /* Memory Access Control */
+   mipi_dbi_command(dbi, MIPI_DCS_SET_PIXEL_FORMAT, 
MIPI_DCS_PIXEL_FMT_16BIT);
+
+   /* Frame Rate */
+   mipi_dbi_command(dbi, ILI9341_FRMCTR1, 0x00, 0x1b);
+
+   /* Gamma */
+   mipi_dbi_command(dbi, ILI9341_EN3GAM, 0x08);
+   mipi_dbi_command(dbi, MIPI_DCS_SET_GAMMA_CURVE, 0x01);
+   mipi_dbi_command(dbi, ILI9341_PGAMCTRL,
+0x1f, 0x1a, 0x18, 0x0a, 0x0f, 0x06, 0x45, 0x87,
+   

[PATCH 2/4] drm/tiny/ili9341: Move driver to drm/panel

2019-08-01 Thread Noralf Trønnes
Move the driver to drm/panel and take advantage of the new panel support
in drm_mipi_dbi. Change the file name to match the naming standard in
drm/panel. The DRM driver name is kept since it is ABI.

Add missing MAINTAINERS entry.

Cc: David Lechner 
Signed-off-by: Noralf Trønnes 
---
 MAINTAINERS   |   7 +
 drivers/gpu/drm/panel/Kconfig |  12 ++
 drivers/gpu/drm/panel/Makefile|   1 +
 .../panel-ilitek-ili9341.c}   | 174 ++
 drivers/gpu/drm/tiny/Kconfig  |  13 --
 drivers/gpu/drm/tiny/Makefile |   1 -
 6 files changed, 113 insertions(+), 95 deletions(-)
 rename drivers/gpu/drm/{tiny/ili9341.c => panel/panel-ilitek-ili9341.c} (66%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 6fe3462a1f7a..66b3893a100f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5108,6 +5108,13 @@ S:   Maintained
 F: drivers/gpu/drm/tiny/ili9225.c
 F: Documentation/devicetree/bindings/display/ilitek,ili9225.txt
 
+DRM DRIVER FOR ILITEK ILI9341 PANELS
+M: David Lechner 
+T: git git://anongit.freedesktop.org/drm/drm-misc
+S: Maintained
+F: drivers/gpu/drm/panel/panel-ilitek-ili9341.c
+F: Documentation/devicetree/bindings/display/ilitek,ili9341.txt
+
 DRM DRIVER FOR HX8357D PANELS
 M: Eric Anholt 
 T: git git://anongit.freedesktop.org/drm/drm-misc
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index eaecd40cc32e..a24953ec2d40 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -56,6 +56,18 @@ config DRM_PANEL_ILITEK_IL9322
  Say Y here if you want to enable support for Ilitek IL9322
  QVGA (320x240) RGB, YUV and ITU-T BT.656 panels.
 
+config DRM_PANEL_ILITEK_ILI9341
+   tristate "Ilitek ILI9341 display panels"
+   depends on SPI
+   depends on BACKLIGHT_CLASS_DEVICE
+   select DRM_KMS_CMA_HELPER
+   select DRM_MIPI_DBI
+   help
+ DRM driver for the following Ilitek ILI9341 panels:
+ * YX240QV29-T 2.4" 240x320 TFT (Adafruit 2.4")
+
+ If M is selected the module will be called panel-ilitek-ili9341.
+
 config DRM_PANEL_ILITEK_ILI9881C
tristate "Ilitek ILI9881C-based panels"
depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 62dae45f8f74..ba4a303c1a66 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -4,6 +4,7 @@ obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
 obj-$(CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D) += 
panel-feiyang-fy07024di26a30d.o
 obj-$(CONFIG_DRM_PANEL_ILITEK_IL9322) += panel-ilitek-ili9322.o
+obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9341) += panel-ilitek-ili9341.o
 obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9881C) += panel-ilitek-ili9881c.o
 obj-$(CONFIG_DRM_PANEL_INNOLUX_P079ZCA) += panel-innolux-p079zca.o
 obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
diff --git a/drivers/gpu/drm/tiny/ili9341.c 
b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
similarity index 66%
rename from drivers/gpu/drm/tiny/ili9341.c
rename to drivers/gpu/drm/panel/panel-ilitek-ili9341.c
index 33b51dc7faa8..f8df737018d3 100644
--- a/drivers/gpu/drm/tiny/ili9341.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
@@ -12,17 +12,17 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
-#include 
 #include 
-#include 
 #include 
-#include 
-#include 
+#include 
 
 #define ILI9341_FRMCTR10xb1
 #define ILI9341_DISCTRL0xb6
@@ -49,23 +49,48 @@
 #define ILI9341_MADCTL_MX  BIT(6)
 #define ILI9341_MADCTL_MY  BIT(7)
 
-static void yx240qv29_enable(struct drm_simple_display_pipe *pipe,
-struct drm_crtc_state *crtc_state,
-struct drm_plane_state *plane_state)
+struct ili9341_config {
+   const struct drm_panel_funcs *funcs;
+   const struct drm_display_mode *mode;
+};
+
+struct ili9341 {
+   struct mipi_dbi_dev dbidev; /* This must be the first entry */
+   struct drm_panel panel;
+   struct backlight_device *backlight;
+   const struct ili9341_config *conf;
+};
+
+static inline struct ili9341 *panel_to_ili9341(struct drm_panel *panel)
 {
-   struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(pipe->crtc.dev);
+   return container_of(panel, struct ili9341, panel);
+}
+
+static int ili9341_enable(struct drm_panel *panel)
+{
+   struct ili9341 *ili = panel_to_ili9341(panel);
+
+   return backlight_enable(ili->backlight);
+}
+
+static int ili9341_disable(struct drm_panel *panel)
+{
+   struct ili9341 *ili = panel_to_ili9341(panel);
+
+   return backlight_disable(ili->backlight);
+}
+
+static int yx240qv29_prepare(struct drm_panel *panel)
+{
+   struct ili9341 *ili = panel_to_ili9341(panel);
+   struct mipi_dbi_dev *dbidev = >dbidev;

[PATCH 1/4] drm/mipi-dbi: Support command mode panel drivers

2019-08-01 Thread Noralf Trønnes
This adds a function that registers a DRM driver for use with MIPI DBI
panels in command mode. That is, framebuffer upload over DBI.

Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/drm_mipi_dbi.c | 92 ++
 include/drm/drm_mipi_dbi.h | 34 +
 2 files changed, 126 insertions(+)

diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
index 1961f713aaab..797a20e3a017 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -17,11 +17,13 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -597,6 +599,96 @@ void mipi_dbi_release(struct drm_device *drm)
 }
 EXPORT_SYMBOL(mipi_dbi_release);
 
+static void drm_mipi_dbi_panel_pipe_enable(struct drm_simple_display_pipe 
*pipe,
+  struct drm_crtc_state *crtc_state,
+  struct drm_plane_state *plane_state)
+{
+   struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(pipe->crtc.dev);
+   struct drm_panel *panel = dbidev->panel;
+   int ret, idx;
+
+   if (!drm_dev_enter(pipe->crtc.dev, ))
+   return;
+
+   DRM_DEBUG_KMS("\n");
+
+   ret = drm_panel_prepare(panel);
+   if (ret)
+   goto out_exit;
+
+   mipi_dbi_enable_flush(dbidev, crtc_state, plane_state);
+
+   drm_panel_enable(panel);
+out_exit:
+   drm_dev_exit(idx);
+}
+
+static void drm_mipi_dbi_panel_pipe_disable(struct drm_simple_display_pipe 
*pipe)
+{
+   struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(pipe->crtc.dev);
+   struct drm_panel *panel = dbidev->panel;
+
+   if (!dbidev->enabled)
+   return;
+
+   DRM_DEBUG_KMS("\n");
+
+   dbidev->enabled = false;
+   drm_panel_disable(panel);
+   drm_panel_unprepare(panel);
+}
+
+static const struct drm_simple_display_pipe_funcs drm_mipi_dbi_pipe_funcs = {
+   .enable = drm_mipi_dbi_panel_pipe_enable,
+   .disable = drm_mipi_dbi_panel_pipe_disable,
+   .update = mipi_dbi_pipe_update,
+   .prepare_fb = drm_gem_fb_simple_display_pipe_prepare_fb,
+};
+
+/**
+ * drm_mipi_dbi_panel_register - Register a MIPI DBI DRM driver
+ * @panel: DRM Panel
+ * @dbidev: MIPI DBI device structure to initialize
+ * @mode: Display mode
+ *
+ * This function registeres a DRM driver with @panel attached.
+ *
+ * Returns:
+ * Zero on success, negative error code on failure.
+ */
+int drm_mipi_dbi_panel_register(struct drm_panel *panel, struct mipi_dbi_dev 
*dbidev,
+   struct drm_driver *driver, const struct 
drm_display_mode *mode,
+   u32 rotation)
+{
+   struct device *dev = panel->dev;
+   struct drm_device *drm;
+   int ret;
+
+   dbidev->panel = panel;
+
+   drm = >drm;
+   ret = devm_drm_dev_init(dev, drm, driver);
+   if (ret) {
+   kfree(dbidev);
+   return ret;
+   }
+
+   drm_mode_config_init(drm);
+
+   ret = mipi_dbi_dev_init(dbidev, _mipi_dbi_pipe_funcs, mode, 
rotation);
+
+   drm_mode_config_reset(drm);
+
+   ret = drm_dev_register(drm, 0);
+   if (ret)
+   return ret;
+
+   drm_fbdev_generic_setup(drm, 16);
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_mipi_dbi_panel_register);
+
 /**
  * mipi_dbi_hw_reset - Hardware reset of controller
  * @dbi: MIPI DBI structure
diff --git a/include/drm/drm_mipi_dbi.h b/include/drm/drm_mipi_dbi.h
index 67c66f5ee591..f41ee0d31871 100644
--- a/include/drm/drm_mipi_dbi.h
+++ b/include/drm/drm_mipi_dbi.h
@@ -12,6 +12,7 @@
 #include 
 #include 
 
+struct drm_panel;
 struct drm_rect;
 struct spi_device;
 struct gpio_desc;
@@ -123,6 +124,11 @@ struct mipi_dbi_dev {
 * @dbi: MIPI DBI interface
 */
struct mipi_dbi dbi;
+
+   /**
+* @panel: Attached DRM panel. See drm_mipi_dbi_panel_register().
+*/
+   struct drm_panel *panel;
 };
 
 static inline struct mipi_dbi_dev *drm_to_mipi_dbi_dev(struct drm_device *drm)
@@ -140,6 +146,34 @@ int mipi_dbi_dev_init_with_formats(struct mipi_dbi_dev 
*dbidev,
 int mipi_dbi_dev_init(struct mipi_dbi_dev *dbidev,
  const struct drm_simple_display_pipe_funcs *funcs,
  const struct drm_display_mode *mode, unsigned int 
rotation);
+
+/**
+ * DEFINE_DRM_MIPI_DBI_PANEL_DRIVER - Define a DRM driver structure
+ * @_name: Name
+ * @_desc: Description
+ * @_date: Date
+ *
+ * This macro defines a _driver for MIPI DBI panel drivers.
+ */
+#define DEFINE_DRM_MIPI_DBI_PANEL_DRIVER(_name, _desc, _date) \
+   DEFINE_DRM_GEM_CMA_FOPS(_name ## _fops); \
+   static struct drm_driver _name ## _drm_driver = { \
+   .driver_features= DRIVER_GEM | DRIVER_MODESET | 
DRIVER_ATOMIC, \
+   .fops   = & _name ## _fops, \
+   .release= 

[PATCH 0/4] drm/mipi-dbi: Support panel drivers

2019-08-01 Thread Noralf Trønnes
This series adds drm_panel support to drm_mipi_dbi. This avoids having 2
drivers for the same controller, one per interface DPI/DBI. Some display
controllers like the ILI9341 support both interfaces and some
displays/panels make both these interfaces available.

Some info about why MIPI DBI is special:
MIPI DSI (Display Serial Interface) and MIPI DPI (Display Pixel
Interface) needs specialiced hardware and thus they have interface
drivers for this. MIPI DBI (Display Bus Interface) on the other hand
reuses existing busses like SPI/8080/6800 and in the case of SPI just
reuses the exising SPI subsystem. All the panels I have seen that have
onboard RAM and can receive pixels over DBI needs to initialize the
controller as well. This means that both the panel driver and the
interface driver needs access to the same bus device.

Changes since RFC[1]:
- Instead of starting with Josef's driver[2], I've started with moving
  the existing ili9341 driver into drm/panel and then move over mi0283qt
  as well since it has a ili9341 controller. Josef can then add support
  for his panel to this driver. His panel can support both interface
  modes.
- Emil mentioned that the DRM driver name is ABI so I've honoured that.
- The DRM driver structure is now defined in the driver using a macro
  instead of doing it in drm_mipi_dbi. This is necessary for file open to
  take a ref on the driver module.

Another thing:
Looking at drm_panel.c I couldn't find anything that pins the panel
driver module while the panel is attached to the connector. Shouldn't
struct drm_panel_funcs have a module owner field?

Noralf.

[1] https://patchwork.freedesktop.org/series/64398/
[2] https://patchwork.freedesktop.org/patch/316528/

Noralf Trønnes (4):
  drm/mipi-dbi: Support command mode panel drivers
  drm/tiny/ili9341: Move driver to drm/panel
  drm/tiny/mi0283qt: Move driver to panel-ilitek-ili9341
  drm/panel/ili9341: Support DPI panels

 MAINTAINERS  |  16 +-
 drivers/gpu/drm/drm_mipi_dbi.c   |  92 
 drivers/gpu/drm/panel/Kconfig|  13 +
 drivers/gpu/drm/panel/Makefile   |   1 +
 drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 469 +++
 drivers/gpu/drm/tiny/Kconfig |  24 -
 drivers/gpu/drm/tiny/Makefile|   2 -
 drivers/gpu/drm/tiny/ili9341.c   | 268 ---
 drivers/gpu/drm/tiny/mi0283qt.c  | 294 
 include/drm/drm_mipi_dbi.h   |  34 ++
 10 files changed, 618 insertions(+), 595 deletions(-)
 create mode 100644 drivers/gpu/drm/panel/panel-ilitek-ili9341.c
 delete mode 100644 drivers/gpu/drm/tiny/ili9341.c
 delete mode 100644 drivers/gpu/drm/tiny/mi0283qt.c

-- 
2.20.1

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

Re: [PATCH] drm/komeda: Adds error event print functionality

2019-08-01 Thread Liviu Dudau
On Thu, Aug 01, 2019 at 11:37:15AM +, Lowry Li (Arm Technology China) wrote:
> From: "Lowry Li (Arm Technology China)" 
> 
> Adds to print the event message when error happens and the same event
> will not be printed until next vsync.
> 
> Changes since v1:
> 1. Handling the event print by CONFIG_KOMEDA_ERROR_PRINT;
> 2. Changing the max string size to 256.
> 
> Signed-off-by: Lowry Li (Arm Technology China) 

Reviewed-by: Liviu Dudau 

Best regards,
Liviu

> ---
>  drivers/gpu/drm/arm/display/Kconfig   |   6 +
>  drivers/gpu/drm/arm/display/komeda/Makefile   |   2 +
>  drivers/gpu/drm/arm/display/komeda/komeda_dev.h   |  15 +++
>  drivers/gpu/drm/arm/display/komeda/komeda_event.c | 141 
> ++
>  drivers/gpu/drm/arm/display/komeda/komeda_kms.c   |   4 +
>  5 files changed, 168 insertions(+)
>  create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_event.c
> 
> diff --git a/drivers/gpu/drm/arm/display/Kconfig 
> b/drivers/gpu/drm/arm/display/Kconfig
> index cec0639..e87ff86 100644
> --- a/drivers/gpu/drm/arm/display/Kconfig
> +++ b/drivers/gpu/drm/arm/display/Kconfig
> @@ -12,3 +12,9 @@ config DRM_KOMEDA
> Processor driver. It supports the D71 variants of the hardware.
>  
> If compiled as a module it will be called komeda.
> +
> +config DRM_KOMEDA_ERROR_PRINT
> + bool "Enable komeda error print"
> + depends on DRM_KOMEDA
> + help
> +   Choose this option to enable error printing.
> diff --git a/drivers/gpu/drm/arm/display/komeda/Makefile 
> b/drivers/gpu/drm/arm/display/komeda/Makefile
> index 5c3900c..f095a1c 100644
> --- a/drivers/gpu/drm/arm/display/komeda/Makefile
> +++ b/drivers/gpu/drm/arm/display/komeda/Makefile
> @@ -22,4 +22,6 @@ komeda-y += \
>   d71/d71_dev.o \
>   d71/d71_component.o
>  
> +komeda-$(CONFIG_DRM_KOMEDA_ERROR_PRINT) += komeda_event.o
> +
>  obj-$(CONFIG_DRM_KOMEDA) += komeda.o
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h 
> b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> index d1c86b6..e28e7e6 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> @@ -40,6 +40,17 @@
>  #define KOMEDA_ERR_TTNG  BIT_ULL(30)
>  #define KOMEDA_ERR_TTF   BIT_ULL(31)
>  
> +#define KOMEDA_ERR_EVENTS\
> + (KOMEDA_EVENT_URUN  | KOMEDA_EVENT_IBSY | KOMEDA_EVENT_OVR |\
> + KOMEDA_ERR_TETO | KOMEDA_ERR_TEMR   | KOMEDA_ERR_TITR |\
> + KOMEDA_ERR_CPE  | KOMEDA_ERR_CFGE   | KOMEDA_ERR_AXIE |\
> + KOMEDA_ERR_ACE0 | KOMEDA_ERR_ACE1   | KOMEDA_ERR_ACE2 |\
> + KOMEDA_ERR_ACE3 | KOMEDA_ERR_DRIFTTO| KOMEDA_ERR_FRAMETO |\
> + KOMEDA_ERR_ZME  | KOMEDA_ERR_MERR   | KOMEDA_ERR_TCF |\
> + KOMEDA_ERR_TTNG | KOMEDA_ERR_TTF)
> +
> +#define KOMEDA_WARN_EVENTS   KOMEDA_ERR_CSCE
> +
>  /* malidp device id */
>  enum {
>   MALI_D71 = 0,
> @@ -207,4 +218,8 @@ struct komeda_dev {
>  
>  struct komeda_dev *dev_to_mdev(struct device *dev);
>  
> +#ifdef CONFIG_DRM_KOMEDA_ERROR_PRINT
> +void komeda_print_events(struct komeda_events *evts);
> +#endif
> +
>  #endif /*_KOMEDA_DEV_H_*/
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c 
> b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> new file mode 100644
> index 000..57b60cd
> --- /dev/null
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> @@ -0,0 +1,141 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * (C) COPYRIGHT 2019 ARM Limited. All rights reserved.
> + * Author: James.Qian.Wang 
> + *
> + */
> +#include 
> +
> +#include "komeda_dev.h"
> +
> +struct komeda_str {
> + char *str;
> + u32 sz;
> + u32 len;
> +};
> +
> +/* return 0 on success,  < 0 on no space.
> + */
> +static int komeda_sprintf(struct komeda_str *str, const char *fmt, ...)
> +{
> + va_list args;
> + int num, free_sz;
> + int err;
> +
> + free_sz = str->sz - str->len;
> + if (free_sz <= 0)
> + return -ENOSPC;
> +
> + va_start(args, fmt);
> +
> + num = vsnprintf(str->str + str->len, free_sz, fmt, args);
> +
> + va_end(args);
> +
> + if (num <= free_sz) {
> + str->len += num;
> + err = 0;
> + } else {
> + str->len = str->sz;
> + err = -ENOSPC;
> + }
> +
> + return err;
> +}
> +
> +static void evt_sprintf(struct komeda_str *str, u64 evt, const char *msg)
> +{
> + if (evt)
> + komeda_sprintf(str, msg);
> +}
> +
> +static void evt_str(struct komeda_str *str, u64 events)
> +{
> + if (events == 0ULL) {
> + evt_sprintf(str, 1, "None");
> + return;
> + }
> +
> + evt_sprintf(str, events & KOMEDA_EVENT_VSYNC, "VSYNC|");
> + evt_sprintf(str, events & KOMEDA_EVENT_FLIP, "FLIP|");
> + evt_sprintf(str, events & KOMEDA_EVENT_EOW, "EOW|");
> + evt_sprintf(str, events & KOMEDA_EVENT_MODE, 

Re: [PATCH] drm/syncobj: remove boring message

2019-08-01 Thread Lionel Landwerlin

Just had a few exchanges with Chris about this.
Chris suggests that if we're about to add a point to the timeline in an 
unordered fashion, actually better not add it at all.


What's your take on this?
I'm fine with this, but rather than add another variant of add_point() 
maybe we change change the existing.


Thanks,

-Lionel

On 29/07/2019 11:20, Chunming Zhou wrote:

It is normal that binary syncobj replaces the underlying fence.

Signed-off-by: Chunming Zhou 
---
  drivers/gpu/drm/drm_syncobj.c | 3 ---
  1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index 929f7c64f9a2..bc7ec1679e4d 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -151,9 +151,6 @@ void drm_syncobj_add_point(struct drm_syncobj *syncobj,
spin_lock(>lock);
  
  	prev = drm_syncobj_fence_get(syncobj);

-   /* You are adding an unorder point to timeline, which could cause 
payload returned from query_ioctl is 0! */
-   if (prev && prev->seqno >= point)
-   DRM_ERROR("You are adding an unorder point to timeline!\n");
dma_fence_chain_init(chain, prev, fence, point);
rcu_assign_pointer(syncobj->fence, >base);
  



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

Re: [LKP] [drm/mgag200] 90f479ae51: vm-scalability.median -18.8% regression

2019-08-01 Thread Michel Dänzer
On 2019-08-01 8:19 a.m., Rong Chen wrote:
> Hi,
> 
> On 7/31/19 6:21 PM, Michel Dänzer wrote:
>> On 2019-07-31 11:25 a.m., Huang, Ying wrote:
>>> Hi, Daniel,
>>>
>>> Daniel Vetter  writes:
>>>
 On Tue, Jul 30, 2019 at 10:27 PM Dave Airlie  wrote:
> On Wed, 31 Jul 2019 at 05:00, Daniel Vetter  wrote:
>> On Tue, Jul 30, 2019 at 8:50 PM Thomas Zimmermann
>>  wrote:
>>> Hi
>>>
>>> Am 30.07.19 um 20:12 schrieb Daniel Vetter:
 On Tue, Jul 30, 2019 at 7:50 PM Thomas Zimmermann
  wrote:
> Am 29.07.19 um 11:51 schrieb kernel test robot:
>> Greeting,
>>
>> FYI, we noticed a -18.8% regression of vm-scalability.median
>> due to commit:>
>>
>> commit: 90f479ae51afa45efab97afdde9b94b9660dd3e4
>> ("drm/mgag200: Replace struct mga_fbdev with generic
>> framebuffer emulation")
>> https://kernel.googlesource.com/pub/scm/linux/kernel/git/next/linux-next.git
>> master
> Daniel, Noralf, we may have to revert this patch.
>
> I expected some change in display performance, but not in VM.
> Since it's
> a server chipset, probably no one cares much about display
> performance.
> So that seemed like a good trade-off for re-using shared code.
>
> Part of the patch set is that the generic fb emulation now maps
> and
> unmaps the fbdev BO when updating the screen. I guess that's
> the cause
> of the performance regression. And it should be visible with other
> drivers as well if they use a shadow FB for fbdev emulation.
 For fbcon we should need to do any maps/unamps at all, this is
 for the
 fbdev mmap support only. If the testcase mentioned here tests fbdev
 mmap handling it's pretty badly misnamed :-) And as long as you
 don't
 have an fbdev mmap there shouldn't be any impact at all.
>>> The ast and mgag200 have only a few MiB of VRAM, so we have to
>>> get the
>>> fbdev BO out if it's not being displayed. If not being mapped, it
>>> can be
>>> evicted and make room for X, etc.
>>>
>>> To make this work, the BO's memory is mapped and unmapped in
>>> drm_fb_helper_dirty_work() before being updated from the shadow
>>> FB. [1]
>>> That fbdev mapping is established on each screen update, more or
>>> less.
>>>  From my (yet unverified) understanding, this causes the performance
>>> regression in the VM code.
>>>
>>> The original code in mgag200 used to kmap the fbdev BO while it's
>>> being
>>> displayed; [2] and the drawing code only mapped it when necessary
>>> (i.e.,
>>> not being display). [3]
>> Hm yeah, this vmap/vunmap is going to be pretty bad. We indeed should
>> cache this.
>>
>>> I think this could be added for VRAM helpers as well, but it's
>>> still a
>>> workaround and non-VRAM drivers might also run into such a
>>> performance
>>> regression if they use the fbdev's shadow fb.
>> Yeah agreed, fbdev emulation should try to cache the vmap.
>>
>>> Noralf mentioned that there are plans for other DRM clients
>>> besides the
>>> console. They would as well run into similar problems.
>>>
> The thing is that we'd need another generic fbdev emulation for
> ast and
> mgag200 that handles this issue properly.
 Yeah I dont think we want to jump the gun here.  If you can try to
 repro locally and profile where we're wasting cpu time I hope that
 should sched a light what's going wrong here.
>>> I don't have much time ATM and I'm not even officially at work until
>>> late Aug. I'd send you the revert and investigate later. I agree
>>> that
>>> using generic fbdev emulation would be preferable.
>> Still not sure that's the right thing to do really. Yes it's a
>> regression, but vm testcases shouldn run a single line of fbcon or
>> drm
>> code. So why this is impacted so heavily by a silly drm change is
>> very
>> confusing to me. We might be papering over a deeper and much more
>> serious issue ...
> It's a regression, the right thing is to revert first and then work
> out the right thing to do.
 Sure, but I have no idea whether the testcase is doing something
 reasonable. If it's accidentally testing vm scalability of fbdev and
 there's no one else doing something this pointless, then it's not a
 real bug. Plus I think we're shooting the messenger here.

> It's likely the test runs on the console and printfs stuff out
> while running.
 But why did we not regress the world if a few prints on the console
 have such a huge impact? We didn't get an entire stream of mails about
 breaking stuff ...
>>> The regression seems not related to the commit.  But we have retested
>>> and confirmed 

Re: [PATCH v2 0/6] Unmappable DRM client buffers for fbdev emulation

2019-08-01 Thread Gerd Hoffmann
On Thu, Aug 01, 2019 at 01:38:18PM +0200, Daniel Vetter wrote:
> On Thu, Aug 1, 2019 at 9:04 AM Gerd Hoffmann  wrote:
> >
> >   Hi,
> >
> > > and removes a large amount of framebuffer code from these drivers. For
> > > bochs, a problem was reported where the driver could not display the 
> > > console
> > > because it was pinned in system memory. [1] The patch set fixes this bug
> > > by converting bochs to use the shadow fb.
> >
> > So, bochs in 5.3-rcX is broken, and patches 1+2+3+5 of this series unbreak
> > it.  Series already landed in drm-misc-next, but that doesn't help bochs
> > in 5.3.
> >
> > What is the usual way to handle this?
> > Just cherry-pick the four patches into drm-misc-fixes and push?
> 
> Best would be to put the patches into -fixes from the start.

Sure, but that ship is sailed in this case.

> Cherry pick works too, if it's not too invasive.

All 4 patches are clean cherry-picks, so I did that.

thanks,
  Gerd

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

[PATCH] Revert "drm/vgem: fix cache synchronization on arm/arm64"

2019-08-01 Thread Chris Wilson
commit 7e9e5ead55be ("drm/vgem: fix cache synchronization on arm/arm64")
broke all of the !llc i915-vgem coherency tests in CI, and left the HW
very, very unhappy (which is even more scary).

Fixes: 7e9e5ead55be ("drm/vgem: fix cache synchronization on arm/arm64")
Signed-off-by: Chris Wilson 
Cc: Daniel Vetter 
Cc: Rob Clark 
Cc: Sean Paul 
---
 drivers/gpu/drm/vgem/vgem_drv.c | 130 
 1 file changed, 47 insertions(+), 83 deletions(-)

diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
index b98689fb0d5d..5bd60ded3d81 100644
--- a/drivers/gpu/drm/vgem/vgem_drv.c
+++ b/drivers/gpu/drm/vgem/vgem_drv.c
@@ -54,16 +54,10 @@ static struct vgem_device {
struct platform_device *platform;
 } *vgem_device;
 
-static void sync_and_unpin(struct drm_vgem_gem_object *bo);
-static struct page **pin_and_sync(struct drm_vgem_gem_object *bo);
-
 static void vgem_gem_free_object(struct drm_gem_object *obj)
 {
struct drm_vgem_gem_object *vgem_obj = to_vgem_bo(obj);
 
-   if (!obj->import_attach)
-   sync_and_unpin(vgem_obj);
-
kvfree(vgem_obj->pages);
mutex_destroy(_obj->pages_lock);
 
@@ -91,15 +85,40 @@ static vm_fault_t vgem_gem_fault(struct vm_fault *vmf)
return VM_FAULT_SIGBUS;
 
mutex_lock(>pages_lock);
-   if (!obj->pages)
-   pin_and_sync(obj);
if (obj->pages) {
get_page(obj->pages[page_offset]);
vmf->page = obj->pages[page_offset];
ret = 0;
}
mutex_unlock(>pages_lock);
+   if (ret) {
+   struct page *page;
+
+   page = shmem_read_mapping_page(
+   file_inode(obj->base.filp)->i_mapping,
+   page_offset);
+   if (!IS_ERR(page)) {
+   vmf->page = page;
+   ret = 0;
+   } else switch (PTR_ERR(page)) {
+   case -ENOSPC:
+   case -ENOMEM:
+   ret = VM_FAULT_OOM;
+   break;
+   case -EBUSY:
+   ret = VM_FAULT_RETRY;
+   break;
+   case -EFAULT:
+   case -EINVAL:
+   ret = VM_FAULT_SIGBUS;
+   break;
+   default:
+   WARN_ON(PTR_ERR(page));
+   ret = VM_FAULT_SIGBUS;
+   break;
+   }
 
+   }
return ret;
 }
 
@@ -265,93 +284,32 @@ static const struct file_operations vgem_driver_fops = {
.release= drm_release,
 };
 
-/* Called under pages_lock, except in free path (where it can't race): */
-static void sync_and_unpin(struct drm_vgem_gem_object *bo)
-{
-   struct drm_device *dev = bo->base.dev;
-
-   if (bo->table) {
-   dma_sync_sg_for_cpu(dev->dev, bo->table->sgl,
-   bo->table->nents, DMA_BIDIRECTIONAL);
-   sg_free_table(bo->table);
-   kfree(bo->table);
-   bo->table = NULL;
-   }
-
-   if (bo->pages) {
-   drm_gem_put_pages(>base, bo->pages, true, true);
-   bo->pages = NULL;
-   }
-}
-
-static struct page **pin_and_sync(struct drm_vgem_gem_object *bo)
-{
-   struct drm_device *dev = bo->base.dev;
-   int npages = bo->base.size >> PAGE_SHIFT;
-   struct page **pages;
-   struct sg_table *sgt;
-
-   WARN_ON(!mutex_is_locked(>pages_lock));
-
-   pages = drm_gem_get_pages(>base);
-   if (IS_ERR(pages)) {
-   bo->pages_pin_count--;
-   mutex_unlock(>pages_lock);
-   return pages;
-   }
-
-   sgt = drm_prime_pages_to_sg(pages, npages);
-   if (IS_ERR(sgt)) {
-   dev_err(dev->dev,
-   "failed to allocate sgt: %ld\n",
-   PTR_ERR(bo->table));
-   drm_gem_put_pages(>base, pages, false, false);
-   mutex_unlock(>pages_lock);
-   return ERR_CAST(bo->table);
-   }
-
-   /*
-* Flush the object from the CPU cache so that importers
-* can rely on coherent indirect access via the exported
-* dma-address.
-*/
-   dma_sync_sg_for_device(dev->dev, sgt->sgl,
-   sgt->nents, DMA_BIDIRECTIONAL);
-
-   bo->pages = pages;
-   bo->table = sgt;
-
-   return pages;
-}
-
 static struct page **vgem_pin_pages(struct drm_vgem_gem_object *bo)
 {
-   struct page **pages;
-
mutex_lock(>pages_lock);
-   if (bo->pages_pin_count++ == 0 && !bo->pages) {
-   pages = pin_and_sync(bo);
-   } else {
-   WARN_ON(!bo->pages);
-   pages = bo->pages;
+   if 

Re: [PATCH] drm/vgem: fix cache synchronization on arm/arm64

2019-08-01 Thread Chris Wilson
Quoting Sean Paul (2019-07-31 20:23:31)
> On Fri, Jul 19, 2019 at 11:21:53AM +0200, Daniel Vetter wrote:
> > On Wed, Jul 17, 2019 at 02:15:37PM -0700, Rob Clark wrote:
> > > From: Rob Clark 
> > > 
> > > drm_cflush_pages() is no-op on arm/arm64.  But instead we can use
> > > dma_sync API.
> > > 
> > > Fixes failures w/ vgem_test.
> > > 
> > > Signed-off-by: Rob Clark 
> > > ---
> > > An alternative approach to the series[1] I sent yesterday
> > > 
> > > On the plus side, it keeps the WC buffers and avoids any drm core
> > > changes.  On the minus side, I don't think it will work (at least
> > > on arm64) prior to v5.0[2], so the fix can't be backported very
> > > far.
> > 
> > Yeah seems a lot more reasonable.
> > 
> > Acked-by: Daniel Vetter 
> 
> Applied to drm-misc-fixes, thanks!

But it didn't actually fix the failures in CI.
-Chris
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 02/13] drm/radeon: Eliminate possible use of an uninitialized variable

2019-08-01 Thread Neil Armstrong
Hi Andrzej,

I had to revert the previous patch, so you should re-spin it entirely :


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

drivers/gpu/drm/radeon/radeon_connectors.c: In function 
'radeon_add_legacy_connector':
drivers/gpu/drm/radeon/radeon_connectors.c:2433:5: error: 'ddc' undeclared 
(first use in this function)
 ddc = _connector->ddc_bus->adapter;
 ^~~
drivers/gpu/drm/radeon/radeon_connectors.c:2433:5: note: each undeclared 
identifier is reported only once for each function it appears in

Caused by commit

  bed7a2182de6 ("drm/radeon: Provide ddc symlink in connector sysfs directory")

I have used the drm-misc tree from next-20190731 for today.
==

Neil

On 31/07/2019 18:58, Andrzej Pietrasiewicz wrote:
> ddc local variable is passed to drm_connector_init_with_ddc() and should
> be NULL if no ddc is available.
> 
> Signed-off-by: Andrzej Pietrasiewicz 
> ---
>  drivers/gpu/drm/radeon/radeon_connectors.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
> b/drivers/gpu/drm/radeon/radeon_connectors.c
> index b3ad8d890801..d11131d03ed6 100644
> --- a/drivers/gpu/drm/radeon/radeon_connectors.c
> +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
> @@ -1870,7 +1870,7 @@ radeon_add_atom_connector(struct drm_device *dev,
>   struct radeon_connector_atom_dig *radeon_dig_connector;
>   struct drm_encoder *encoder;
>   struct radeon_encoder *radeon_encoder;
> - struct i2c_adapter *ddc;
> + struct i2c_adapter *ddc = NULL;
>   uint32_t subpixel_order = SubPixelNone;
>   bool shared_ddc = false;
>   bool is_dp_bridge = false;
> 

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

Re: [PATCH 2/2] drm: bridge: adv7511: Add support for ADV7535

2019-08-01 Thread Togorean, Bogdan
Hi Laurent,

Thnk you for your review.

On Wed, 2019-07-31 at 12:14 +0300, Laurent Pinchart wrote:
> [External]
> 
> Hi Bogdan,
> 
> Thank you for the patch.
> 
> On Tue, Jul 30, 2019 at 04:17:36PM +0300, Bogdan Togorean wrote:
> > ADV7535 is a DSI to HDMI bridge chip like ADV7533 but it allows
> > 1080p@60Hz. v1p2 is fixed to 1.8V on ADV7535 but on ADV7533 can be
> > 1.2V
> > or 1.8V and is configurable in a register.
> > 
> > Signed-off-by: Bogdan Togorean 
> > ---
> >  drivers/gpu/drm/bridge/adv7511/adv7511.h |  2 ++
> >  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 31 +++-
> > 
> >  2 files changed, 25 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h
> > b/drivers/gpu/drm/bridge/adv7511/adv7511.h
> > index 52b2adfdc877..702432615ec8 100644
> > --- a/drivers/gpu/drm/bridge/adv7511/adv7511.h
> > +++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h
> > @@ -91,6 +91,7 @@
> >  #define ADV7511_REG_ARC_CTRL   0xdf
> >  #define ADV7511_REG_CEC_I2C_ADDR   0xe1
> >  #define ADV7511_REG_CEC_CTRL   0xe2
> > +#define ADV7511_REG_SUPPLY_SELECT  0xe4
> >  #define ADV7511_REG_CHIP_ID_HIGH   0xf5
> >  #define ADV7511_REG_CHIP_ID_LOW0xf6
> >  
> > @@ -320,6 +321,7 @@ struct adv7511_video_config {
> >  enum adv7511_type {
> > ADV7511,
> > ADV7533,
> > +   ADV7535,
> >  };
> >  
> >  #define ADV7511_MAX_ADDRS 3
> > diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> > b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> > index f6d2681f6927..941072decb73 100644
> > --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> > +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> > @@ -367,7 +367,7 @@ static void adv7511_power_on(struct adv7511
> > *adv7511)
> >  */
> > regcache_sync(adv7511->regmap);
> >  
> > -   if (adv7511->type == ADV7533)
> > +   if (adv7511->type == ADV7533 || adv7511->type == ADV7535)
> > adv7533_dsi_power_on(adv7511);
> > adv7511->powered = true;
> >  }
> > @@ -387,7 +387,7 @@ static void __adv7511_power_off(struct adv7511
> > *adv7511)
> >  static void adv7511_power_off(struct adv7511 *adv7511)
> >  {
> > __adv7511_power_off(adv7511);
> > -   if (adv7511->type == ADV7533)
> > +   if (adv7511->type == ADV7533 || adv7511->type == ADV7535)
> > adv7533_dsi_power_off(adv7511);
> > adv7511->powered = false;
> >  }
> > @@ -761,7 +761,7 @@ static void adv7511_mode_set(struct adv7511
> > *adv7511,
> > regmap_update_bits(adv7511->regmap, 0x17,
> > 0x60, (vsync_polarity << 6) | (hsync_polarity << 5));
> >  
> > -   if (adv7511->type == ADV7533)
> > +   if (adv7511->type == ADV7533 || adv7511->type == ADV7535)
> > adv7533_mode_set(adv7511, adj_mode);
> >  
> > drm_mode_copy(>curr_mode, adj_mode);
> > @@ -874,7 +874,7 @@ static int adv7511_bridge_attach(struct
> > drm_bridge *bridge)
> >  _connector_helper_funcs);
> > drm_connector_attach_encoder(>connector, bridge->encoder);
> >  
> > -   if (adv->type == ADV7533)
> > +   if (adv->type == ADV7533 || adv->type == ADV7535)
> > ret = adv7533_attach_dsi(adv);
> >  
> > if (adv->i2c_main->irq)
> > @@ -952,7 +952,7 @@ static bool
> > adv7511_cec_register_volatile(struct device *dev, unsigned int reg)
> > struct i2c_client *i2c = to_i2c_client(dev);
> > struct adv7511 *adv7511 = i2c_get_clientdata(i2c);
> >  
> > -   if (adv7511->type == ADV7533)
> > +   if (adv7511->type == ADV7533 || adv7511->type == ADV7535)
> > reg -= ADV7533_REG_CEC_OFFSET;
> >  
> > switch (reg) {
> > @@ -994,7 +994,7 @@ static int adv7511_init_cec_regmap(struct
> > adv7511 *adv)
> > goto err;
> > }
> >  
> > -   if (adv->type == ADV7533) {
> > +   if (adv->type == ADV7533 || adv->type == ADV7535) {
> > ret = adv7533_patch_cec_registers(adv);
> > if (ret)
> > goto err;
> > @@ -1094,8 +1094,9 @@ static int adv7511_probe(struct i2c_client
> > *i2c, const struct i2c_device_id *id)
> > struct adv7511_link_config link_config;
> > struct adv7511 *adv7511;
> > struct device *dev = >dev;
> > +   struct regulator *reg_v1p2;
> > unsigned int val;
> > -   int ret;
> > +   int ret, reg_v1p2_uV;
> >  
> > if (!dev->of_node)
> > return -EINVAL;
> > @@ -1163,6 +1164,18 @@ static int adv7511_probe(struct i2c_client
> > *i2c, const struct i2c_device_id *id)
> > if (ret)
> > goto uninit_regulators;
> >  
> > +   if (adv7511->type == ADV7533) {
> > +   ret = match_string(adv7533_supply_names, adv7511-
> > >num_supplies,
> 
> Although they're equivalent, I would use
> ARRAY_SIZE(adv7533_supply_names) instead of adv7511->num_supplies to
> make the code easier to read (otherwise one has to check where
> num_supplies is set to validate this function call).
> 
Ack. Will modify it in V2
> > + 

Re: [PATCH] Revert "drm/radeon: Provide ddc symlink in connector sysfs directory"

2019-08-01 Thread Neil Armstrong
On 01/08/2019 14:01, Daniel Vetter wrote:
> On Thu, Aug 1, 2019 at 1:53 PM Neil Armstrong  wrote:
>>
>> This reverts commit bed7a2182de6833f5d0f990a656bffb1c6000c70.
>>
>> It causes the following build error:
>> ../drm/radeon/radeon_connectors.c: In function 'radeon_add_legacy_connector':
>> ../drm/radeon/radeon_connectors.c:2433:5: error: 'ddc' undeclared (first use 
>> in this function)
>>  ddc = _connector->ddc_bus->adapter;
>>  ^~~
>>
>> Suggested-by: Daniel Vetter 
>> Signed-off-by: Neil Armstrong 
> 
> Also ddc isn't initialized to NULL in the other function, so doesn't
> work too well there either.
> 
> Acked-by: Daniel Vetter 

Applied,

Thanks
Neil

> 
> Let's try again once the tree is back in shape.
> -Daniel
>> ---
>>  drivers/gpu/drm/radeon/radeon_connectors.c | 142 ++---
>>  1 file changed, 36 insertions(+), 106 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
>> b/drivers/gpu/drm/radeon/radeon_connectors.c
>> index b3ad8d890801..c60d1a44d22a 100644
>> --- a/drivers/gpu/drm/radeon/radeon_connectors.c
>> +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
>> @@ -1870,7 +1870,6 @@ radeon_add_atom_connector(struct drm_device *dev,
>> struct radeon_connector_atom_dig *radeon_dig_connector;
>> struct drm_encoder *encoder;
>> struct radeon_encoder *radeon_encoder;
>> -   struct i2c_adapter *ddc;
>> uint32_t subpixel_order = SubPixelNone;
>> bool shared_ddc = false;
>> bool is_dp_bridge = false;
>> @@ -1948,21 +1947,17 @@ radeon_add_atom_connector(struct drm_device *dev,
>> radeon_connector->con_priv = radeon_dig_connector;
>> if (i2c_bus->valid) {
>> radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, 
>> i2c_bus);
>> -   if (radeon_connector->ddc_bus) {
>> +   if (radeon_connector->ddc_bus)
>> has_aux = true;
>> -   ddc = _connector->ddc_bus->adapter;
>> -   } else {
>> +   else
>> DRM_ERROR("DP: Failed to assign ddc bus! 
>> Check dmesg for i2c errors.\n");
>> -   }
>> }
>> switch (connector_type) {
>> case DRM_MODE_CONNECTOR_VGA:
>> case DRM_MODE_CONNECTOR_DVIA:
>> default:
>> -   drm_connector_init_with_ddc(dev, 
>> _connector->base,
>> -   
>> _dp_connector_funcs,
>> -   connector_type,
>> -   ddc);
>> +   drm_connector_init(dev, _connector->base,
>> +  _dp_connector_funcs, 
>> connector_type);
>> drm_connector_helper_add(_connector->base,
>>  
>> _dp_connector_helper_funcs);
>> connector->interlace_allowed = true;
>> @@ -1984,10 +1979,8 @@ radeon_add_atom_connector(struct drm_device *dev,
>> case DRM_MODE_CONNECTOR_HDMIA:
>> case DRM_MODE_CONNECTOR_HDMIB:
>> case DRM_MODE_CONNECTOR_DisplayPort:
>> -   drm_connector_init_with_ddc(dev, 
>> _connector->base,
>> -   
>> _dp_connector_funcs,
>> -   connector_type,
>> -   ddc);
>> +   drm_connector_init(dev, _connector->base,
>> +  _dp_connector_funcs, 
>> connector_type);
>> drm_connector_helper_add(_connector->base,
>>  
>> _dp_connector_helper_funcs);
>> 
>> drm_object_attach_property(_connector->base.base,
>> @@ -2034,10 +2027,8 @@ radeon_add_atom_connector(struct drm_device *dev,
>> break;
>> case DRM_MODE_CONNECTOR_LVDS:
>> case DRM_MODE_CONNECTOR_eDP:
>> -   drm_connector_init_with_ddc(dev, 
>> _connector->base,
>> -   
>> _lvds_bridge_connector_funcs,
>> -   connector_type,
>> -   ddc);
>> +   drm_connector_init(dev, _connector->base,
>> +  
>> _lvds_bridge_connector_funcs, connector_type);
>> drm_connector_helper_add(_connector->base,
>>  
>> _dp_connector_helper_funcs);
>> 
>> drm_object_attach_property(_connector->base.base,
>> @@ -2051,18 +2042,13 @@ 

Re: [PATCH] Revert "drm/radeon: Provide ddc symlink in connector sysfs directory"

2019-08-01 Thread Daniel Vetter
On Thu, Aug 1, 2019 at 1:53 PM Neil Armstrong  wrote:
>
> This reverts commit bed7a2182de6833f5d0f990a656bffb1c6000c70.
>
> It causes the following build error:
> ../drm/radeon/radeon_connectors.c: In function 'radeon_add_legacy_connector':
> ../drm/radeon/radeon_connectors.c:2433:5: error: 'ddc' undeclared (first use 
> in this function)
>  ddc = _connector->ddc_bus->adapter;
>  ^~~
>
> Suggested-by: Daniel Vetter 
> Signed-off-by: Neil Armstrong 

Also ddc isn't initialized to NULL in the other function, so doesn't
work too well there either.

Acked-by: Daniel Vetter 

Let's try again once the tree is back in shape.
-Daniel
> ---
>  drivers/gpu/drm/radeon/radeon_connectors.c | 142 ++---
>  1 file changed, 36 insertions(+), 106 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
> b/drivers/gpu/drm/radeon/radeon_connectors.c
> index b3ad8d890801..c60d1a44d22a 100644
> --- a/drivers/gpu/drm/radeon/radeon_connectors.c
> +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
> @@ -1870,7 +1870,6 @@ radeon_add_atom_connector(struct drm_device *dev,
> struct radeon_connector_atom_dig *radeon_dig_connector;
> struct drm_encoder *encoder;
> struct radeon_encoder *radeon_encoder;
> -   struct i2c_adapter *ddc;
> uint32_t subpixel_order = SubPixelNone;
> bool shared_ddc = false;
> bool is_dp_bridge = false;
> @@ -1948,21 +1947,17 @@ radeon_add_atom_connector(struct drm_device *dev,
> radeon_connector->con_priv = radeon_dig_connector;
> if (i2c_bus->valid) {
> radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, 
> i2c_bus);
> -   if (radeon_connector->ddc_bus) {
> +   if (radeon_connector->ddc_bus)
> has_aux = true;
> -   ddc = _connector->ddc_bus->adapter;
> -   } else {
> +   else
> DRM_ERROR("DP: Failed to assign ddc bus! 
> Check dmesg for i2c errors.\n");
> -   }
> }
> switch (connector_type) {
> case DRM_MODE_CONNECTOR_VGA:
> case DRM_MODE_CONNECTOR_DVIA:
> default:
> -   drm_connector_init_with_ddc(dev, 
> _connector->base,
> -   
> _dp_connector_funcs,
> -   connector_type,
> -   ddc);
> +   drm_connector_init(dev, _connector->base,
> +  _dp_connector_funcs, 
> connector_type);
> drm_connector_helper_add(_connector->base,
>  
> _dp_connector_helper_funcs);
> connector->interlace_allowed = true;
> @@ -1984,10 +1979,8 @@ radeon_add_atom_connector(struct drm_device *dev,
> case DRM_MODE_CONNECTOR_HDMIA:
> case DRM_MODE_CONNECTOR_HDMIB:
> case DRM_MODE_CONNECTOR_DisplayPort:
> -   drm_connector_init_with_ddc(dev, 
> _connector->base,
> -   
> _dp_connector_funcs,
> -   connector_type,
> -   ddc);
> +   drm_connector_init(dev, _connector->base,
> +  _dp_connector_funcs, 
> connector_type);
> drm_connector_helper_add(_connector->base,
>  
> _dp_connector_helper_funcs);
> 
> drm_object_attach_property(_connector->base.base,
> @@ -2034,10 +2027,8 @@ radeon_add_atom_connector(struct drm_device *dev,
> break;
> case DRM_MODE_CONNECTOR_LVDS:
> case DRM_MODE_CONNECTOR_eDP:
> -   drm_connector_init_with_ddc(dev, 
> _connector->base,
> -   
> _lvds_bridge_connector_funcs,
> -   connector_type,
> -   ddc);
> +   drm_connector_init(dev, _connector->base,
> +  
> _lvds_bridge_connector_funcs, connector_type);
> drm_connector_helper_add(_connector->base,
>  
> _dp_connector_helper_funcs);
> 
> drm_object_attach_property(_connector->base.base,
> @@ -2051,18 +2042,13 @@ radeon_add_atom_connector(struct drm_device *dev,
> } else {
> switch (connector_type) {
> case DRM_MODE_CONNECTOR_VGA:
> +   

Re: [LKP] [drm/mgag200] 90f479ae51: vm-scalability.median -18.8% regression

2019-08-01 Thread Thomas Zimmermann
Hi

Am 01.08.19 um 13:25 schrieb Feng Tang:
> Hi Thomas,
> 
> On Thu, Aug 01, 2019 at 11:59:28AM +0200, Thomas Zimmermann wrote:
>> Hi
>>
>> Am 01.08.19 um 10:37 schrieb Feng Tang:
>>> On Thu, Aug 01, 2019 at 02:19:53PM +0800, Rong Chen wrote:
>
> commit: 90f479ae51afa45efab97afdde9b94b9660dd3e4 ("drm/mgag200: 
> Replace struct mga_fbdev with generic framebuffer emulation")
> https://kernel.googlesource.com/pub/scm/linux/kernel/git/next/linux-next.git
>  master
 Daniel, Noralf, we may have to revert this patch.

 I expected some change in display performance, but not in VM. 
 Since it's
 a server chipset, probably no one cares much about display 
 performance.
 So that seemed like a good trade-off for re-using shared code.

 Part of the patch set is that the generic fb emulation now maps and
 unmaps the fbdev BO when updating the screen. I guess that's the 
 cause
 of the performance regression. And it should be visible with other
 drivers as well if they use a shadow FB for fbdev emulation.
>>> For fbcon we should need to do any maps/unamps at all, this is for 
>>> the
>>> fbdev mmap support only. If the testcase mentioned here tests fbdev
>>> mmap handling it's pretty badly misnamed :-) And as long as you 
>>> don't
>>> have an fbdev mmap there shouldn't be any impact at all.
>> The ast and mgag200 have only a few MiB of VRAM, so we have to get 
>> the
>> fbdev BO out if it's not being displayed. If not being mapped, it 
>> can be
>> evicted and make room for X, etc.
>>
>> To make this work, the BO's memory is mapped and unmapped in
>> drm_fb_helper_dirty_work() before being updated from the shadow FB. 
>> [1]
>> That fbdev mapping is established on each screen update, more or 
>> less.
>> From my (yet unverified) understanding, this causes the performance
>> regression in the VM code.
>>
>> The original code in mgag200 used to kmap the fbdev BO while it's 
>> being
>> displayed; [2] and the drawing code only mapped it when necessary 
>> (i.e.,
>> not being display). [3]
> Hm yeah, this vmap/vunmap is going to be pretty bad. We indeed should
> cache this.
>
>> I think this could be added for VRAM helpers as well, but it's still 
>> a
>> workaround and non-VRAM drivers might also run into such a 
>> performance
>> regression if they use the fbdev's shadow fb.
> Yeah agreed, fbdev emulation should try to cache the vmap.
>
>> Noralf mentioned that there are plans for other DRM clients besides 
>> the
>> console. They would as well run into similar problems.
>>
 The thing is that we'd need another generic fbdev emulation for 
 ast and
 mgag200 that handles this issue properly.
>>> Yeah I dont think we want to jump the gun here.  If you can try to
>>> repro locally and profile where we're wasting cpu time I hope that
>>> should sched a light what's going wrong here.
>> I don't have much time ATM and I'm not even officially at work until
>> late Aug. I'd send you the revert and investigate later. I agree that
>> using generic fbdev emulation would be preferable.
> Still not sure that's the right thing to do really. Yes it's a
> regression, but vm testcases shouldn run a single line of fbcon or drm
> code. So why this is impacted so heavily by a silly drm change is very
> confusing to me. We might be papering over a deeper and much more
> serious issue ...
 It's a regression, the right thing is to revert first and then work
 out the right thing to do.
>>> Sure, but I have no idea whether the testcase is doing something
>>> reasonable. If it's accidentally testing vm scalability of fbdev and
>>> there's no one else doing something this pointless, then it's not a
>>> real bug. Plus I think we're shooting the messenger here.
>>>
 It's likely the test runs on the console and printfs stuff out while 
 running.
>>> But why did we not regress the world if a few prints on the console
>>> have such a huge impact? We didn't get an entire stream of mails about
>>> breaking stuff ...
>> The regression seems not related to the commit.  But we have retested
>> and confirmed the regression.  Hard to understand what happens.
> Does the regressed test cause any output on console while it's
> measuring? If so, it's probably accidentally measuring fbcon/DRM code in
> addition to the workload it's trying to 

[PATCH 2/3] drm/ast: Map fbdev framebuffer while it's being displayed

2019-08-01 Thread Thomas Zimmermann
The generic fbdev emulation will map and unmap the framebuffer's memory
if required. As consoles are most often updated while being on screen,
we map the fbdev buffer while it's being displayed. This avoids frequent
map/unmap operations in the fbdev code. The original fbdev code in ast
used the same trick to improve performance.

Signed-off-by: Thomas Zimmermann 
Cc: Thomas Zimmermann 
Cc: Noralf Trønnes 
Cc: Dave Airlie 
Cc: Greg Kroah-Hartman 
Cc: Thomas Gleixner 
Cc: Sam Ravnborg 
Cc: Gerd Hoffmann 
Cc: Oleksandr Andrushchenko 
Cc: CK Hu 
Cc: Daniel Vetter 
Cc: Alex Deucher 
Cc: "Christian König" 
Cc: YueHaibing 
Cc: Sam Bobroff 
Cc: Huang Rui 
Cc: "Y.C. Chen" 
Cc: Rong Chen 
Cc: Feng Tang 
Cc: Huang Ying 
---
 drivers/gpu/drm/ast/ast_mode.c | 20 
 1 file changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index c792362024a5..35ba25262f54 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -529,13 +529,20 @@ static int ast_crtc_do_set_base(struct drm_crtc *crtc,
struct drm_framebuffer *fb,
int x, int y, int atomic)
 {
+   struct drm_fb_helper *fb_helper = crtc->dev->fb_helper;
struct drm_gem_vram_object *gbo;
int ret;
s64 gpu_addr;
+   void *base;
 
if (!atomic && fb) {
gbo = drm_gem_vram_of_gem(fb->obj[0]);
drm_gem_vram_unpin(gbo);
+
+   // Unmap fbdev FB if it's not being displayed
+   // any longer.
+   if (fb == fb_helper->buffer->fb)
+   drm_gem_vram_kunmap(gbo);
}
 
gbo = drm_gem_vram_of_gem(crtc->primary->fb->obj[0]);
@@ -552,6 +559,15 @@ static int ast_crtc_do_set_base(struct drm_crtc *crtc,
ast_set_offset_reg(crtc);
ast_set_start_address_crt1(crtc, (u32)gpu_addr);
 
+   // Map fbdev FB while it's being displayed. This
+   // avoids frequent mapping and unmapping withing the
+   // fbdev code.
+   if (crtc->primary->fb == fb_helper->buffer->fb) {
+   base = drm_gem_vram_kmap(gbo, true, NULL);
+   if (IS_ERR(base))
+   DRM_ERROR("failed to kmap fbcon\n");
+   }
+
return 0;
 
 err_drm_gem_vram_unpin:
@@ -605,10 +621,14 @@ static void ast_crtc_disable(struct drm_crtc *crtc)
DRM_DEBUG_KMS("\n");
ast_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
if (crtc->primary->fb) {
+   struct drm_fb_helper *fb_helper = crtc->dev->fb_helper;
struct drm_framebuffer *fb = crtc->primary->fb;
struct drm_gem_vram_object *gbo =
drm_gem_vram_of_gem(fb->obj[0]);
 
+   // Unmap if it's the fbdev FB.
+   if (fb == fb_helper->buffer->fb)
+   drm_gem_vram_kunmap(gbo);
drm_gem_vram_unpin(gbo);
}
crtc->primary->fb = NULL;
-- 
2.22.0

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

[PATCH 0/3] drm/vram-helper: Fix performance regression in fbdev

2019-08-01 Thread Thomas Zimmermann
Generic fbdev emulation maps and unmaps the console BO for updating it's
content from the shadow buffer. Drivers using VRAM helpers may see reduced
performance as the mapping operations can create significant overhead.
A report of this problem is at [1].

This patch set fixes the problem by adding a ref counter to the GEM
VRAM buffers' kmap operation, and keeping the fbdev's console buffer
mapped while the console is being displayed. These changes avoids the
frequent mappings in the fbdev code. The drivers, ast and mgag200,
maps the console's buffer when it becomes visible and the fbdev code
reuses this mapping. The original fbdev code in ast and mgag200 used
the same optimization.

[1] https://lists.freedesktop.org/archives/dri-devel/2019-July/228663.html

Thomas Zimmermann (3):
  drm/vram-helpers: Add kmap ref-counting to GEM VRAM objects
  drm/ast: Map fbdev framebuffer while it's being displayed
  drm/mgag200: Map fbdev framebuffer while it's being displayed

 drivers/gpu/drm/ast/ast_mode.c | 20 +++
 drivers/gpu/drm/drm_gem_vram_helper.c  | 74 +++---
 drivers/gpu/drm/mgag200/mgag200_mode.c | 21 
 include/drm/drm_gem_vram_helper.h  | 13 +
 4 files changed, 110 insertions(+), 18 deletions(-)

--
2.22.0

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

[PATCH 1/3] drm/vram-helpers: Add kmap ref-counting to GEM VRAM objects

2019-08-01 Thread Thomas Zimmermann
The kmap and kunmap operations of GEM VRAM buffers can now be called
in interleaving pairs. The first call to drm_gem_vram_kmap() maps the
buffer's memory to kernel address space and the final call to
drm_gem_vram_kunmap() unmaps the memory. Intermediate calls to these
functions increment or decrement a reference counter.

This change allows for keeping buffer memory mapped for longer and
minimizes the amount of changes to TLB, page tables, etc. The latter
is required to work around a performance regression where the fbdev
code frequently mapped and unmapped VAM buffers.

Signed-off-by: Thomas Zimmermann 
Fixes: cf1ca9aeb930 ("drm/fb-helper: Map DRM client buffer only when required")
Cc: Noralf Trønnes 
Cc: Maarten Lankhorst 
Cc: Maxime Ripard 
Cc: Sean Paul 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Rong Chen 
Cc: Feng Tang 
Cc: Huang Ying 
---
 drivers/gpu/drm/drm_gem_vram_helper.c | 74 ---
 include/drm/drm_gem_vram_helper.h | 13 +
 2 files changed, 69 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c 
b/drivers/gpu/drm/drm_gem_vram_helper.c
index e0fbfb6570cf..db4b8bf16724 100644
--- a/drivers/gpu/drm/drm_gem_vram_helper.c
+++ b/drivers/gpu/drm/drm_gem_vram_helper.c
@@ -26,7 +26,11 @@ static void drm_gem_vram_cleanup(struct drm_gem_vram_object 
*gbo)
 * TTM buffer object in 'bo' has already been cleaned
 * up; only release the GEM object.
 */
+
+   WARN_ON(gbo->kmap_use_count);
+
drm_gem_object_release(>gem);
+   mutex_destroy(>kmap_lock);
 }
 
 static void drm_gem_vram_destroy(struct drm_gem_vram_object *gbo)
@@ -100,6 +104,8 @@ static int drm_gem_vram_init(struct drm_device *dev,
if (ret)
goto err_drm_gem_object_release;
 
+   mutex_init(>kmap_lock);
+
return 0;
 
 err_drm_gem_object_release:
@@ -283,6 +289,34 @@ int drm_gem_vram_unpin(struct drm_gem_vram_object *gbo)
 }
 EXPORT_SYMBOL(drm_gem_vram_unpin);
 
+static void *drm_gem_vram_kmap_locked(struct drm_gem_vram_object *gbo,
+ bool map, bool *is_iomem)
+{
+   int ret;
+   struct ttm_bo_kmap_obj *kmap = >kmap;
+
+   if (gbo->kmap_use_count > 0)
+   goto out;
+
+   if (kmap->virtual || !map)
+   goto out;
+
+   ret = ttm_bo_kmap(>bo, 0, gbo->bo.num_pages, kmap);
+   if (ret)
+   return ERR_PTR(ret);
+
+out:
+   if (!kmap->virtual) {
+   if (is_iomem)
+   *is_iomem = false;
+   return NULL; /* not mapped; don't increment ref */
+   }
+   ++gbo->kmap_use_count;
+   if (is_iomem)
+   return ttm_kmap_obj_virtual(kmap, is_iomem);
+   return kmap->virtual;
+}
+
 /**
  * drm_gem_vram_kmap() - Maps a GEM VRAM object into kernel address space
  * @gbo:   the GEM VRAM object
@@ -304,40 +338,44 @@ void *drm_gem_vram_kmap(struct drm_gem_vram_object *gbo, 
bool map,
bool *is_iomem)
 {
int ret;
-   struct ttm_bo_kmap_obj *kmap = >kmap;
-
-   if (kmap->virtual || !map)
-   goto out;
+   void *virtual;
 
-   ret = ttm_bo_kmap(>bo, 0, gbo->bo.num_pages, kmap);
+   ret = mutex_lock_interruptible(>kmap_lock);
if (ret)
return ERR_PTR(ret);
+   virtual = drm_gem_vram_kmap_locked(gbo, map, is_iomem);
+   mutex_unlock(>kmap_lock);
 
-out:
-   if (!is_iomem)
-   return kmap->virtual;
-   if (!kmap->virtual) {
-   *is_iomem = false;
-   return NULL;
-   }
-   return ttm_kmap_obj_virtual(kmap, is_iomem);
+   return virtual;
 }
 EXPORT_SYMBOL(drm_gem_vram_kmap);
 
-/**
- * drm_gem_vram_kunmap() - Unmaps a GEM VRAM object
- * @gbo:   the GEM VRAM object
- */
-void drm_gem_vram_kunmap(struct drm_gem_vram_object *gbo)
+static void drm_gem_vram_kunmap_locked(struct drm_gem_vram_object *gbo)
 {
struct ttm_bo_kmap_obj *kmap = >kmap;
 
+   if (WARN_ON_ONCE(!gbo->kmap_use_count))
+   return;
+   if (--gbo->kmap_use_count > 0)
+   return;
+
if (!kmap->virtual)
return;
 
ttm_bo_kunmap(kmap);
kmap->virtual = NULL;
 }
+
+/**
+ * drm_gem_vram_kunmap() - Unmaps a GEM VRAM object
+ * @gbo:   the GEM VRAM object
+ */
+void drm_gem_vram_kunmap(struct drm_gem_vram_object *gbo)
+{
+   mutex_lock(>kmap_lock);
+   drm_gem_vram_kunmap_locked(gbo);
+   mutex_unlock(>kmap_lock);
+}
 EXPORT_SYMBOL(drm_gem_vram_kunmap);
 
 /**
diff --git a/include/drm/drm_gem_vram_helper.h 
b/include/drm/drm_gem_vram_helper.h
index b41d932eb53a..47f7e01d2805 100644
--- a/include/drm/drm_gem_vram_helper.h
+++ b/include/drm/drm_gem_vram_helper.h
@@ -40,6 +40,19 @@ struct drm_gem_vram_object {
struct ttm_buffer_object bo;
struct ttm_bo_kmap_obj kmap;
 
+   /**
+* @kmap_lock: Protects the kmap address and use count
+*/
+   

[PATCH 3/3] drm/mgag200: Map fbdev framebuffer while it's being displayed

2019-08-01 Thread Thomas Zimmermann
The generic fbdev emulation will map and unmap the framebuffer's memory
if required. As consoles are most often updated while being on screen,
we map the fbdev buffer while it's being displayed. This avoids frequent
map/unmap operations in the fbdev code. The original fbdev code in mgag200
used the same trick to improve performance.

Signed-off-by: Thomas Zimmermann 
Fixes: 90f479ae51af ("drm/mgag200: Replace struct mga_fbdev with generic 
framebuffer emulation")
Cc: Thomas Zimmermann 
Cc: Noralf Trønnes 
Cc: Dave Airlie 
Cc: Greg Kroah-Hartman 
Cc: Thomas Gleixner 
Cc: Gerd Hoffmann 
Cc: Alex Deucher 
Cc: "Christian König" 
Cc: Sam Ravnborg 
Cc: Daniel Vetter 
Cc: Huang Rui 
Cc: Bartlomiej Zolnierkiewicz 
Cc: "Michał Mirosław" 
Cc: Armijn Hemel 
Cc: Rong Chen 
Cc: Feng Tang 
Cc: Huang Ying 
---
 drivers/gpu/drm/mgag200/mgag200_mode.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c 
b/drivers/gpu/drm/mgag200/mgag200_mode.c
index 822f2a13748f..a6391144feb5 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -860,13 +860,20 @@ static int mga_crtc_do_set_base(struct drm_crtc *crtc,
struct drm_framebuffer *fb,
int x, int y, int atomic)
 {
+   struct drm_fb_helper *fb_helper = crtc->dev->fb_helper;
struct drm_gem_vram_object *gbo;
int ret;
s64 gpu_addr;
+   void *base;
 
if (!atomic && fb) {
gbo = drm_gem_vram_of_gem(fb->obj[0]);
drm_gem_vram_unpin(gbo);
+
+   // Unmap fbdev FB if it's not being displayed
+   // any longer.
+   if (fb == fb_helper->buffer->fb)
+   drm_gem_vram_kunmap(gbo);
}
 
gbo = drm_gem_vram_of_gem(crtc->primary->fb->obj[0]);
@@ -882,6 +889,15 @@ static int mga_crtc_do_set_base(struct drm_crtc *crtc,
 
mga_set_start_address(crtc, (u32)gpu_addr);
 
+   // Map fbdev FB while it's being displayed. This
+   // avoids frequent mapping and unmapping withing the
+   // fbdev code.
+   if (crtc->primary->fb == fb_helper->buffer->fb) {
+   base = drm_gem_vram_kmap(gbo, true, NULL);
+   if (IS_ERR(base))
+   DRM_ERROR("failed to kmap fbcon\n");
+   }
+
return 0;
 
 err_drm_gem_vram_unpin:
@@ -1403,9 +1419,14 @@ static void mga_crtc_disable(struct drm_crtc *crtc)
DRM_DEBUG_KMS("\n");
mga_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
if (crtc->primary->fb) {
+   struct drm_fb_helper *fb_helper = crtc->dev->fb_helper;
struct drm_framebuffer *fb = crtc->primary->fb;
struct drm_gem_vram_object *gbo =
drm_gem_vram_of_gem(fb->obj[0]);
+
+   // Unmap if it's the fbdev FB.
+   if (fb == fb_helper->buffer->fb)
+   drm_gem_vram_kunmap(gbo);
drm_gem_vram_unpin(gbo);
}
crtc->primary->fb = NULL;
-- 
2.22.0

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

[PATCH] Revert "drm/radeon: Provide ddc symlink in connector sysfs directory"

2019-08-01 Thread Neil Armstrong
This reverts commit bed7a2182de6833f5d0f990a656bffb1c6000c70.

It causes the following build error:
../drm/radeon/radeon_connectors.c: In function 'radeon_add_legacy_connector':
../drm/radeon/radeon_connectors.c:2433:5: error: 'ddc' undeclared (first use in 
this function)
 ddc = _connector->ddc_bus->adapter;
 ^~~

Suggested-by: Daniel Vetter 
Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/radeon/radeon_connectors.c | 142 ++---
 1 file changed, 36 insertions(+), 106 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
b/drivers/gpu/drm/radeon/radeon_connectors.c
index b3ad8d890801..c60d1a44d22a 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -1870,7 +1870,6 @@ radeon_add_atom_connector(struct drm_device *dev,
struct radeon_connector_atom_dig *radeon_dig_connector;
struct drm_encoder *encoder;
struct radeon_encoder *radeon_encoder;
-   struct i2c_adapter *ddc;
uint32_t subpixel_order = SubPixelNone;
bool shared_ddc = false;
bool is_dp_bridge = false;
@@ -1948,21 +1947,17 @@ radeon_add_atom_connector(struct drm_device *dev,
radeon_connector->con_priv = radeon_dig_connector;
if (i2c_bus->valid) {
radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, 
i2c_bus);
-   if (radeon_connector->ddc_bus) {
+   if (radeon_connector->ddc_bus)
has_aux = true;
-   ddc = _connector->ddc_bus->adapter;
-   } else {
+   else
DRM_ERROR("DP: Failed to assign ddc bus! Check 
dmesg for i2c errors.\n");
-   }
}
switch (connector_type) {
case DRM_MODE_CONNECTOR_VGA:
case DRM_MODE_CONNECTOR_DVIA:
default:
-   drm_connector_init_with_ddc(dev, 
_connector->base,
-   _dp_connector_funcs,
-   connector_type,
-   ddc);
+   drm_connector_init(dev, _connector->base,
+  _dp_connector_funcs, 
connector_type);
drm_connector_helper_add(_connector->base,
 
_dp_connector_helper_funcs);
connector->interlace_allowed = true;
@@ -1984,10 +1979,8 @@ radeon_add_atom_connector(struct drm_device *dev,
case DRM_MODE_CONNECTOR_HDMIA:
case DRM_MODE_CONNECTOR_HDMIB:
case DRM_MODE_CONNECTOR_DisplayPort:
-   drm_connector_init_with_ddc(dev, 
_connector->base,
-   _dp_connector_funcs,
-   connector_type,
-   ddc);
+   drm_connector_init(dev, _connector->base,
+  _dp_connector_funcs, 
connector_type);
drm_connector_helper_add(_connector->base,
 
_dp_connector_helper_funcs);
drm_object_attach_property(_connector->base.base,
@@ -2034,10 +2027,8 @@ radeon_add_atom_connector(struct drm_device *dev,
break;
case DRM_MODE_CONNECTOR_LVDS:
case DRM_MODE_CONNECTOR_eDP:
-   drm_connector_init_with_ddc(dev, 
_connector->base,
-   
_lvds_bridge_connector_funcs,
-   connector_type,
-   ddc);
+   drm_connector_init(dev, _connector->base,
+  _lvds_bridge_connector_funcs, 
connector_type);
drm_connector_helper_add(_connector->base,
 
_dp_connector_helper_funcs);
drm_object_attach_property(_connector->base.base,
@@ -2051,18 +2042,13 @@ radeon_add_atom_connector(struct drm_device *dev,
} else {
switch (connector_type) {
case DRM_MODE_CONNECTOR_VGA:
+   drm_connector_init(dev, _connector->base, 
_vga_connector_funcs, connector_type);
+   drm_connector_helper_add(_connector->base, 
_vga_connector_helper_funcs);
if (i2c_bus->valid) {
radeon_connector->ddc_bus = 
radeon_i2c_lookup(rdev, i2c_bus);
if (!radeon_connector->ddc_bus)
DRM_ERROR("VGA: Failed to assign 

  1   2   >