drm/radeon: using libdrm_radeon for a new display server

2011-03-28 Thread Chia-I Wu
Hi list, I have a simple scenario that there are clients rendering to buffer objects using the CPU, and the display server compositing the buffers using OpenGL and doing page flips to present the final contents. It is like doing the following steps repeatedly 1) process A (the server) allocates

Re: drm/radeon: using libdrm_radeon for a new display server

2011-03-28 Thread Chia-I Wu
[Answer myself for some of the questions] On Mon, Mar 28, 2011 at 3:35 PM, Chia-I Wu olva...@gmail.com wrote: Hi list, I have a simple scenario that there are clients rendering to buffer objects using the CPU, and the display server compositing the buffers using OpenGL and doing page flips

drm/radeon: using libdrm_radeon for a new display server

2011-03-28 Thread Chia-I Wu
Hi list, I have a simple scenario that there are clients rendering to buffer objects using the CPU, and the display server compositing the buffers using OpenGL and doing page flips to present the final contents. It is like doing the following steps repeatedly 1) process A (the server) allocates

drm/radeon: using libdrm_radeon for a new display server

2011-03-28 Thread Chia-I Wu
[Answer myself for some of the questions] On Mon, Mar 28, 2011 at 3:35 PM, Chia-I Wu wrote: > Hi list, > > I have a simple scenario that there are clients rendering to buffer > objects using the CPU, and the display server compositing the buffers > using OpenGL and doing page f

drm/radeon: using libdrm_radeon for a new display server

2011-03-29 Thread Chia-I Wu
On Tue, Mar 29, 2011 at 12:59 AM, Marek Ol??k wrote: > On Mon, Mar 28, 2011 at 9:35 AM, Chia-I Wu wrote: >> >> Hi list, >> >> I have a simple scenario that there are clients rendering to buffer >> objects using the CPU, and the display server compositing the

[PATCH] drm/msm/a6xx: add a6xx_gpu_state_get

2018-12-20 Thread Chia-I Wu
It gets the generic states from the adreno core. This also adds a missing NULL check in msm_gpu_open. Signed-off-by: Chia-I Wu --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 44 +++ drivers/gpu/drm/msm/msm_debugfs.c | 2 +- 2 files changed, 45 insertions(+), 1

[PATCH] drm/msm/gpu: fix bo size for msm_rbmemptrs

2018-12-20 Thread Chia-I Wu
memptrs_bo is used to store msm_rbmemptrs. Size it correctly. Signed-off-by: Chia-I Wu --- drivers/gpu/drm/msm/msm_gpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index 11aac8337066..d23049eb29c4 100644

Re: [PATCH] drm/msm/gpu: fix bo size for msm_rbmemptrs

2018-12-20 Thread Chia-I Wu
Ah, thanks. I was on drm-next branch. I will switch to msm-next. On Thu, Dec 20, 2018 at 11:47 AM Jordan Crouse wrote: > On Thu, Dec 20, 2018 at 10:47:02AM -0800, Chia-I Wu wrote: > > memptrs_bo is used to store msm_rbmemptrs. Size it correctly. > > > > Signed-off-by:

Re: [PATCH 3/3] virtio-gpu api: VIRTIO_GPU_F_RESSOURCE_V2

2019-04-17 Thread Chia-I Wu
On Wed, Apr 17, 2019 at 2:57 AM Gerd Hoffmann wrote: > > On Fri, Apr 12, 2019 at 04:34:20PM -0700, Chia-I Wu wrote: > > Hi, > > > > I am still new to virgl, and missed the last round of discussion about > > resource_create_v2. > > > > From the discuss

Re: [PATCH 3/3] virtio-gpu api: VIRTIO_GPU_F_RESSOURCE_V2

2019-04-12 Thread Chia-I Wu
Hi, I am still new to virgl, and missed the last round of discussion about resource_create_v2. >From the discussion below, semantically resource_create_v2 creates a host resource object _without_ any storage; memory_create creates a host memory object which provides the storage. Is that

[PATCH] drm/virtio: allocate fences with GFP_KERNEL

2019-04-29 Thread Chia-I Wu
It was changed to GFP_ATOMIC in commit ec2f0577c (add & use virtio_gpu_queue_fenced_ctrl_buffer) because the allocation happened with a spinlock held. That was no longer true after commit 9fdd90c0f (add virtio_gpu_alloc_fence()). Signed-off-by: Chia-I Wu Cc: Gerd Hoffmann Cc: Gustavo Pad

[PATCH 3/3] drm/virtio: add trace events for commands

2019-04-29 Thread Chia-I Wu
Trace when commands are queued for both ctrlq and cursorq. Trace when responses are received for ctrlq. Signed-off-by: Chia-I Wu --- drivers/gpu/drm/virtio/Makefile | 2 +- drivers/gpu/drm/virtio/virtgpu_trace.h| 52 +++ drivers/gpu/drm/virtio

[PATCH 1/3] drm/virtio: set seqno for dma-fence

2019-04-29 Thread Chia-I Wu
off-by: Chia-I Wu --- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 - drivers/gpu/drm/virtio/virtgpu_fence.c | 17 ++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index 491dec071

Re: [PATCH] Revert "drm/virtio: drop prime import/export callbacks"

2019-04-19 Thread Chia-I Wu
On Fri, Apr 19, 2019 at 9:21 AM Emil Velikov wrote: > > On Fri, 19 Apr 2019 at 16:57, Marc-André Lureau > wrote: > > > > This patch does more harm than good, as it breaks both Xwayland and > > gnome-shell with X11. > > > > Xwayland requires DRI3 & DRI3 requires PRIME. > > > > X11 crash for

Re: [PATCH 1/3] drm/virtio: set seqno for dma-fence

2019-05-02 Thread Chia-I Wu
(Add missing CCs) On Mon, Apr 29, 2019 at 3:08 PM Chia-I Wu wrote: > > This is motivated by having meaningful ftrace events, but it also > fixes use cases where dma_fence_is_later is called, such as in > sync_file_merge. > > In other drivers, fence creation and cmdbuf s

Re: [PATCH] drm/virtio: Remove redundant return type

2019-05-03 Thread Chia-I Wu
Suggested-by: Emil Velikov Reviewed-by: Chia-I Wu > --- > > This patch was suggested in this email thread: > > [PATCH] drm/virtio: allocate fences with GFP_KERNEL > https://www.spinics.net/lists/dri-devel/msg208536.html > > drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +- > dri

Re: [PATCH v6 08/18] drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing

2019-07-04 Thread Chia-I Wu
On Thu, Jul 4, 2019 at 4:25 AM Gerd Hoffmann wrote: > > Hi, > > > > if (fence) > > > virtio_gpu_fence_emit(vgdev, hdr, fence); > > > + if (vbuf->objs) { > > > + virtio_gpu_array_add_fence(vbuf->objs, >f); > > > +

Re: [PATCH v6 06/18] drm/virtio: remove ttm calls from in virtio_gpu_object_{reserve, unreserve}

2019-07-04 Thread Chia-I Wu
On Thu, Jul 4, 2019 at 4:10 AM Gerd Hoffmann wrote: > > Hi, > > > > - r = ttm_bo_reserve(>tbo, true, false, NULL); > > > + r = reservation_object_lock_interruptible(bo->gem_base.resv, > > > NULL); > > Can you elaborate a bit about how TTM keeps the BOs alive in, for > > example,

Re: [PATCH v6 14/18] drm/virtio: rework virtio_gpu_transfer_from_host_ioctl fencing

2019-07-04 Thread Chia-I Wu
On Thu, Jul 4, 2019 at 4:48 AM Gerd Hoffmann wrote: > > On Wed, Jul 03, 2019 at 01:05:12PM -0700, Chia-I Wu wrote: > > On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > > > > > Switch to the virtio_gpu_array_* helper workflow. > > (just repeating

Re: [PATCH v6 15/18] drm/virtio: rework virtio_gpu_transfer_to_host_ioctl fencing

2019-07-04 Thread Chia-I Wu
On Thu, Jul 4, 2019 at 4:51 AM Gerd Hoffmann wrote: > > Hi, > > > > convert_to_hw_box(, >box); > > > if (!vgdev->has_virgl_3d) { > > > virtio_gpu_cmd_transfer_to_host_2d > > > - (vgdev, qobj, offset, > > > + (vgdev,

Re: [PATCH v6 08/18] drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing

2019-07-10 Thread Chia-I Wu
On Thu, Jul 4, 2019 at 11:46 AM Chia-I Wu wrote: > > On Thu, Jul 4, 2019 at 4:25 AM Gerd Hoffmann wrote: > > > > Hi, > > > > > > if (fence) > > > > virtio_gpu_fence_emit(vg

[PATCH] drm/virtio: kick vq outside of the vq lock

2019-07-10 Thread Chia-I Wu
virtio_gpu_dequeue_ctrl_func. If virtqueue_notify was called with the vq lock held, the worker thread would have to busy wait inside virtio_gpu_dequeue_ctrl_func. v2: fix scrambled commit message Signed-off-by: Chia-I Wu --- drivers/gpu/drm/virtio/virtgpu_vq.c | 19 +-- 1 file changed, 13

[PATCH] drm/virtio: kick vq outside of the vq lock

2019-07-10 Thread Chia-I Wu
virtio_gpu_dequeue_ctrl_func. If virtqueue_notify was called with the vq lock held, the worker thread would busy wait inside virtio_gpu_dequeue_ctrl_func. Signed-off-by: Chia-I Wu --- drivers/gpu/drm/virtio/virtgpu_vq.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers

Re: [PATCH v6 06/18] drm/virtio: remove ttm calls from in virtio_gpu_object_{reserve,unreserve}

2019-07-03 Thread Chia-I Wu
On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > Call reservation_object_* directly instead > of using ttm_bo_{reserve,unreserve}. > > v4: check for EINTR only. > v3: check for EINTR too. > > Signed-off-by: Gerd Hoffmann > Reviewed-by: Daniel Vetter > --- >

Re: [PATCH v6 08/18] drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing

2019-07-03 Thread Chia-I Wu
On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > Rework fencing workflow, starting with virtio_gpu_execbuffer_ioctl. > Stop using ttm helpers, use the virtio_gpu_array_* helpers (which work > on the reservation objects directly) instead. > > New workflow: > > (1) All gem objects needed by

Re: [PATCH v6 07/18] drm/virtio: add virtio_gpu_object_array & helpers

2019-07-03 Thread Chia-I Wu
per. > v5: some small optimizations (Chia-I Wu). > v4: make them virtio-private instead of generic helpers. > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_drv.h | 17 ++ > drivers/gpu/drm/virtio/virtgpu_gem.c | 83 > 2 fi

Re: [PATCH v6 07/18] drm/virtio: add virtio_gpu_object_array & helpers

2019-07-03 Thread Chia-I Wu
On Wed, Jul 3, 2019 at 11:31 AM Chia-I Wu wrote: > > On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > > > Some helper functions to manage an array of gem objects. > > > > v6: > > - add ticket to struct virtio_gpu_object_array. > > - add v

Re: [PATCH v6 14/18] drm/virtio: rework virtio_gpu_transfer_from_host_ioctl fencing

2019-07-03 Thread Chia-I Wu
On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > Switch to the virtio_gpu_array_* helper workflow. (just repeating my question on patch 6) Does this fix the obj refcount issue? When was the issue introduced? > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_drv.h

Re: [PATCH v6 15/18] drm/virtio: rework virtio_gpu_transfer_to_host_ioctl fencing

2019-07-03 Thread Chia-I Wu
On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > Switch to the virtio_gpu_array_* helper workflow. > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +- > drivers/gpu/drm/virtio/virtgpu_ioctl.c | 43 -- >

Re: [PATCH v4 02/12] drm/virtio: switch virtio_gpu_wait_ioctl() to gem helper.

2019-06-26 Thread Chia-I Wu
On Wed, Jun 19, 2019 at 11:07 PM Gerd Hoffmann wrote: > > Use drm_gem_reservation_object_wait() in virtio_gpu_wait_ioctl(). > This also makes the ioctl run lockless. The userspace has a BO cache to avoid freeing BOs immediately but to reuse them on next allocations. The BO cache checks if a BO

Re: [PATCH v4 11/12] drm/virtio: switch from ttm to gem shmem helpers

2019-06-26 Thread Chia-I Wu
. On Wed, Jun 19, 2019 at 11:08 PM Gerd Hoffmann wrote: > > virtio-gpu basically needs a sg_table for the bo, to tell the host where > the backing pages for the object are. So the gem shmem helpers are a > perfect fit. Some drm_gem_object_funcs need thin wrappers to update the > host state,

Re: [PATCH v4 09/12] drm/virtio: rework virtio_gpu_object_create fencing

2019-06-26 Thread Chia-I Wu
On Wed, Jun 19, 2019 at 11:07 PM Gerd Hoffmann wrote: > > Use gem reservation helpers and direct reservation_object_* calls > instead of ttm. > > v3: Due to using the gem reservation object it is initialized and ready > for use before calling ttm_bo_init, so we can also drop the tricky fence >

Re: [PATCH v4 07/12] drm/virtio: add virtio_gpu_object_array & helpers

2019-06-26 Thread Chia-I Wu
On Wed, Jun 19, 2019 at 11:08 PM Gerd Hoffmann wrote: > > Some helper functions to manage an array of gem objects. > > v4: make them virtio-private instead of generic helpers. > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_drv.h | 10 ++ >

Re: [PATCH v4 08/12] drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing

2019-06-26 Thread Chia-I Wu
On Wed, Jun 19, 2019 at 11:08 PM Gerd Hoffmann wrote: > > Use gem reservation helpers and direct reservation_object_* calls > instead of ttm. > > v3: Also attach the array of gem objects to the virtio command buffer, > so we can drop the object references in the completion callback. Needed >

Re: [PATCH v5 09/12] drm/virtio: rework virtio_gpu_object_create fencing

2019-07-01 Thread Chia-I Wu
On Mon, Jul 1, 2019 at 11:04 AM Gurchetan Singh wrote: > > > > On Fri, Jun 28, 2019 at 5:14 AM Gerd Hoffmann wrote: > > > > Use gem reservation helpers and direct reservation_object_* calls > > instead of ttm. > > > > v5: fix fencing (Chia-I Wu). >

Re: [PATCH v2] drm/virtio: add plane check

2019-08-26 Thread Chia-I Wu
On Thu, Aug 22, 2019 at 2:47 AM Gerd Hoffmann wrote: > > Use drm_atomic_helper_check_plane_state() > to sanity check the plane state. > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_plane.c | 17 - > 1 file changed, 16 insertions(+), 1 deletion(-) > >

Re: [PATCH v2] drm/virtio: make resource id workaround runtime switchable.

2019-08-26 Thread Chia-I Wu
On Thu, Aug 22, 2019 at 3:26 AM Gerd Hoffmann wrote: > > Also update the comment with a reference to the virglrenderer fix. > > Signed-off-by: Gerd Hoffmann Reviewed-by: Chia-I Wu > --- > drivers/gpu/drm/virtio/virtgpu_object.c | 44 ++--- > 1 file c

Re: [PATCH] drm/virtio: Use vmalloc for command buffer allocations.

2019-08-30 Thread Chia-I Wu
On Thu, Aug 29, 2019 at 2:24 PM David Riley wrote: > > Userspace requested command buffer allocations could be too large > to make as a contiguous allocation. Use vmalloc if necessary to > satisfy those allocations. > > Signed-off-by: David Riley > --- > drivers/gpu/drm/virtio/virtgpu_ioctl.c

Re: [PATCH] drm/virtio: Use vmalloc for command buffer allocations.

2019-08-30 Thread Chia-I Wu
On Fri, Aug 30, 2019 at 4:16 AM Gerd Hoffmann wrote: > > Hi, > > > > > - kfree(vbuf->data_buf); > > > > + kvfree(vbuf->data_buf); > > > > > > if (is_vmalloc_addr(vbuf->data_buf)) ... > > > > > > needed here I gues? > > > > > > > kvfree() handles vmalloc/kmalloc/kvmalloc internally by

Re: [PATCH] drm/virtio: add worker for object release

2019-09-03 Thread Chia-I Wu
worker is also the one which will free up slots in the command > queue. > > Reported-by: Chia-I Wu > Signed-off-by: Gerd Hoffmann Tested-by: Chia-I Wu Reviewed-by: Chia-I Wu > --- > drivers/gpu/drm/virtio/virtgpu_drv.h | 8 > drive

Re: [PATCH v9 00/18] drm/virtio: switch from ttm to gem shmem helpers.

2019-08-29 Thread Chia-I Wu
The series is Reviewed-by: Chia-I Wu However I ran into a deadlock with one GPU-heavy app. When I exits Unigine Valley benchmark with ctrl-c, the entire driver locks up probably 8 out of 10 times on my machine. When that happens, virtio_gpu_dequeue_ctrl_func does not return and is blocked

Re: [PATCH v8 00/18] drm/virtio: switch from ttm to gem shmem helpers.

2019-08-28 Thread Chia-I Wu
On Fri, Aug 23, 2019 at 2:55 AM Gerd Hoffmann wrote: > > ttm increasingly gets into the way while hacking on virtio-gpu memory > management. It also overkill for what virtio-gpu needs. Lets get rid > of it. > > v8: > - rebase to latest drm-misc-next, adapt to changes. Other than two (minor)

Re: [PATCH v8 07/18] drm/virtio: add virtio_gpu_object_array & helpers

2019-08-28 Thread Chia-I Wu
per. > v5: some small optimizations (Chia-I Wu). > v4: make them virtio-private instead of generic helpers. > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_drv.h | 17 + > drivers/gpu/drm/virtio/virtgpu_gem.c | 93 > 2 fi

Re: [PATCH v8 02/18] drm/virtio: switch virtio_gpu_wait_ioctl() to gem helper.

2019-08-28 Thread Chia-I Wu
On Fri, Aug 23, 2019 at 2:55 AM Gerd Hoffmann wrote: > > Use drm_gem_reservation_object_wait() in virtio_gpu_wait_ioctl(). > This also makes the ioctl run lockless. > > v5: handle lookup failure. > v2: use reservation_object_test_signaled_rcu for VIRTGPU_WAIT_NOWAIT. > > Signed-off-by: Gerd

Re: [PATCH v2] drm/virtio: add plane check

2019-08-27 Thread Chia-I Wu
On Mon, Aug 26, 2019 at 10:21 PM Gerd Hoffmann wrote: > > On Mon, Aug 26, 2019 at 03:34:56PM -0700, Chia-I Wu wrote: > > On Thu, Aug 22, 2019 at 2:47 AM Gerd Hoffmann wrote: > > > > > > Use drm_atomic_helper_check_plane_state() > > > to sanity check

Re: [PATCH 2/2] drm/virtio: notify virtqueues without holding spinlock

2019-08-27 Thread Chia-I Wu
k. This avoids triggering a vmexit while holding the lock and > thereby fixes a rather bad spinlock contention. > > Suggested-by: Chia-I Wu > Signed-off-by: Gerd Hoffmann Series is Reviewed-by: Chia-I Wu > --- > drivers/gpu/drm/virtio/virtgpu_vq.c | 25 +++--

Re: [PATCH] drm/virtio: fix command submission with objects but without fence.

2019-09-05 Thread Chia-I Wu
On Wed, Sep 4, 2019 at 10:23 PM Gerd Hoffmann wrote: > > On Wed, Sep 04, 2019 at 04:10:30PM -0700, Chia-I Wu wrote: > > On Wed, Sep 4, 2019 at 12:48 AM Gerd Hoffmann wrote: > > > > > > Only call virtio_gpu_array_add_fence if we actually have a fence. > > >

Re: [PATCH] drm/virtio: enable prime mmap support

2019-09-12 Thread Chia-I Wu
On Thu, Sep 12, 2019 at 4:46 AM Gerd Hoffmann wrote: > > Signed-off-by: Gerd Hoffmann Reviewed-by: Chia-I Wu > --- > drivers/gpu/drm/virtio/virtgpu_drv.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c > b/drivers/gpu/

Re: [PATCH] drm/virtio: Fix warning in virtio_gpu_queue_fenced_ctrl_buffer.

2019-09-12 Thread Chia-I Wu
On Thu, Sep 12, 2019 at 9:00 AM David Riley wrote: > > Fix warning introduced with commit e1218b8c0cc1 > ("drm/virtio: Use vmalloc for command buffer allocations.") > from drm-misc-next. > > Signed-off-by: David Riley Reviewed-by: Chia-I Wu > --- > drive

Re: [PATCH] drm/virtio: fix command submission with objects but without fence.

2019-09-04 Thread Chia-I Wu
On Wed, Sep 4, 2019 at 12:48 AM Gerd Hoffmann wrote: > > Only call virtio_gpu_array_add_fence if we actually have a fence. > > Fixes: da758d51968a ("drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing") > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_vq.c | 9 +

Re: [PATCH v6 11/18] drm/virtio: switch from ttm to gem shmem helpers

2019-07-17 Thread Chia-I Wu
On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > virtio-gpu basically needs a sg_table for the bo, to tell the host where > the backing pages for the object are. So the gem shmem helpers are a > perfect fit. Some drm_gem_object_funcs need thin wrappers to update the > host state, but

Re: [PATCH v3 08/12] drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing

2019-06-26 Thread Chia-I Wu
I tried my best to review this series. I am not really a kernel dev so please take that with a grain of salt. On Wed, Jun 19, 2019 at 11:01 PM Gerd Hoffmann wrote: > > Hi, > > > Also, I strongly recommend you do a very basic igt to exercise this, i.e. > > allocate some buffers, submit them in

Re: [PATCH v5 09/12] drm/virtio: rework virtio_gpu_object_create fencing

2019-06-30 Thread Chia-I Wu
On Fri, Jun 28, 2019 at 5:13 AM Gerd Hoffmann wrote: > > Use gem reservation helpers and direct reservation_object_* calls > instead of ttm. > > v5: fix fencing (Chia-I Wu). > v3: Due to using the gem reservation object it is initialized and ready > for use before calling t

Re: [PATCH v5 08/12] drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing

2019-06-30 Thread Chia-I Wu
On Fri, Jun 28, 2019 at 5:13 AM Gerd Hoffmann wrote: > > Use gem reservation helpers and direct reservation_object_* calls > instead of ttm. > > v5: fix fencing (Chia-I Wu). > v3: Also attach the array of gem objects to the virtio command buffer, > so we can drop

Re: [PATCH v5 08/12] drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing

2019-06-30 Thread Chia-I Wu
(pressed Send too early) On Sun, Jun 30, 2019 at 11:20 AM Chia-I Wu wrote: > > On Fri, Jun 28, 2019 at 5:13 AM Gerd Hoffmann wrote: > > > > Use gem reservation helpers and direct reservation_object_* calls > > instead of ttm. > > > > v5: fix fencing (Chia-

Re: [PATCH v4 11/12] drm/virtio: switch from ttm to gem shmem helpers

2019-06-30 Thread Chia-I Wu
On Fri, Jun 28, 2019 at 3:49 AM Gerd Hoffmann wrote: > > > > static inline struct virtio_gpu_object* > > > virtio_gpu_object_ref(struct virtio_gpu_object *bo) > > > The last users of these two helpers are removed with this patch. We > > can remove them. > > patch 12/12 does that. I meant

Re: [PATCH v4 08/12] drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing

2019-06-30 Thread Chia-I Wu
On Fri, Jun 28, 2019 at 3:34 AM Gerd Hoffmann wrote: > > Hi, > > > > --- a/drivers/gpu/drm/virtio/virtgpu_drv.h > > > +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h > > > @@ -120,9 +120,9 @@ struct virtio_gpu_vbuffer { > > > > > > char *resp_buf; > > > int resp_size; > > > - > > >

Re: [PATCH v4 02/12] drm/virtio: switch virtio_gpu_wait_ioctl() to gem helper.

2019-06-30 Thread Chia-I Wu
On Fri, Jun 28, 2019 at 3:05 AM Gerd Hoffmann wrote: > > On Wed, Jun 26, 2019 at 04:55:20PM -0700, Chia-I Wu wrote: > > On Wed, Jun 19, 2019 at 11:07 PM Gerd Hoffmann wrote: > > > > > > Use drm_gem_reservation_object_wait() in virtio_gpu_wait_ioctl(). > > >

Re: [PATCH v6 06/18] drm/virtio: remove ttm calls from in virtio_gpu_object_{reserve, unreserve}

2019-07-06 Thread Chia-I Wu
On Fri, Jul 5, 2019 at 1:53 AM Gerd Hoffmann wrote: > > On Thu, Jul 04, 2019 at 12:17:48PM -0700, Chia-I Wu wrote: > > On Thu, Jul 4, 2019 at 4:10 AM Gerd Hoffmann wrote: > > > > > > Hi, > > > > > > > > - r = ttm_bo

Re: [PATCH 4/4] udmabuf: implement begin_cpu_access/end_cpu_access hooks

2019-12-09 Thread Chia-I Wu
On Mon, Dec 2, 2019 at 5:36 PM Gurchetan Singh wrote: > > With the misc device, we should end up using the result of > get_arch_dma_ops(..) or dma-direct ops. > > This can allow us to have WC mappings in the guest after > synchronization. > > Signed-off-by: Gurchetan Singh > --- >

Re: [PATCH 4/4] udmabuf: implement begin_cpu_access/end_cpu_access hooks

2019-12-12 Thread Chia-I Wu
Hi, On Mon, Dec 9, 2019 at 2:44 PM Chia-I Wu wrote: > > On Mon, Dec 2, 2019 at 5:36 PM Gurchetan Singh > wrote: > > > > With the misc device, we should end up using the result of > > get_arch_dma_ops(..) or dma-direct ops. > > > > This can allow us

Re: [PATCH 1/3] drm/virtio: skip set_scanout if framebuffer didn't change

2019-12-11 Thread Chia-I Wu
On Wed, Dec 11, 2019 at 12:42 AM Gerd Hoffmann wrote: > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_plane.c | 31 ++ > 1 file changed, 17 insertions(+), 14 deletions(-) > > diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c >

Re: [PATCH 3/3] virtio-gpu: use damage info for display updates.

2019-12-11 Thread Chia-I Wu
On Wed, Dec 11, 2019 at 12:42 AM Gerd Hoffmann wrote: > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_plane.c | 41 +++--- > 1 file changed, 24 insertions(+), 17 deletions(-) > > diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c >

Re: [PATCH v2 0/3] drm/virtio: some optimitations.

2019-12-12 Thread Chia-I Wu
On Thu, Dec 12, 2019 at 4:53 AM Gerd Hoffmann wrote: > > v2: fix src rect handling (Chia-I Wu). > > Gerd Hoffmann (3): > drm/virtio: skip set_scanout if framebuffer didn't change > virtio-gpu: batch display update commands. > virtio-gpu: use damage info for di

Re: [PATCH v4 3/3] drm/udl: simplify gem object mapping.

2019-12-18 Thread Chia-I Wu
n, > .unpin = drm_gem_shmem_unpin, > .get_sg_table = drm_gem_shmem_get_sg_table, > - .vmap = udl_gem_object_vmap, > + .vmap = drm_gem_shmem_vmap, > .vunmap = drm_gem_shmem_vunmap, > - .mmap = udl_gem_object_mmap, > + .mmap = drm_gem_shm

Re: [PATCH 2/4] drm/virtio: factor out context create cmd

2020-02-12 Thread Chia-I Wu
On Tue, Feb 11, 2020 at 3:56 PM Gurchetan Singh wrote: > > We currently do it when open the DRM fd, let's delay it. First step, > remove the hyercall from initialization. > > Signed-off-by: Gurchetan Singh > --- > drivers/gpu/drm/virtio/virtgpu_drv.h | 2 ++ >

Re: [PATCH 3/4] drm/virtio: track whether or not a context has been initiated

2020-02-12 Thread Chia-I Wu
On Tue, Feb 11, 2020 at 3:56 PM Gurchetan Singh wrote: > > We only want create a new virglrenderer context after the first > 3D ioctl. > > Signed-off-by: Gurchetan Singh > --- > drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + > drivers/gpu/drm/virtio/virtgpu_ioctl.c | 5 + >

Re: [PATCH 0/2] drm/virtio: locking/reservation fixes

2020-02-12 Thread Chia-I Wu
The fixes look reasonable. Reviewed-by: Chia-I Wu On Tue, Feb 11, 2020 at 5:50 AM Gerd Hoffmann wrote: > > > > Gerd Hoffmann (2): > drm/virtio: fix virtio_gpu_execbuffer_ioctl locking > drm/virtio: fix virtio_gpu_cursor_plane_update(). > > drivers/gpu/drm/vir

Re: [PATCH v2] drm/virtio: rework batching

2020-02-12 Thread Chia-I Wu
On Wed, Feb 12, 2020 at 3:13 AM Gerd Hoffmann wrote: > > Drop the virtio_gpu_{disable,enable}_notify(). Add a new > virtio_gpu_notify() call instead, which must be called whenever > the driver wants make sure the host is notified needed. > > Drop notification from command submission. Add

Re: [PATCH v3 0/4] drm/virtio: rework batching

2020-02-13 Thread Chia-I Wu
Series is Reviewed-by: Chia-I Wu After the series, virtio_gpu_cmd_* may or may not call virtio_gpu_notify. It is error-prone and should be fixed, such that virtio_gpu_cmd_* never notifies, or such that different naming conventions are used for functions that notify and for those don't

[RFC PATCH 1/3] KVM: vmx: rewrite the comment in vmx_get_mt_mask

2020-02-13 Thread Chia-I Wu
Better reflect the structure of the code and metion why we could not always honor the guest. Signed-off-by: Chia-I Wu Cc: Gurchetan Singh Cc: Gerd Hoffmann --- arch/x86/kvm/vmx/vmx.c | 27 +-- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/arch/x86/kvm

[RFC PATCH 2/3] RFC: KVM: add KVM_MEM_DMA

2020-02-13 Thread Chia-I Wu
When the flag is set, it means the the userspace wants to do DMA with the memory and the guest will use an appropriate memory type to access the memory. The kernel should be prepared to honor the guest's memory type. Signed-off-by: Chia-I Wu Cc: Gurchetan Singh Cc: Gerd Hoffmann

[RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-13 Thread Chia-I Wu
Hi, Host GPU drivers like to give userspace WC mapping. When the userspace makes the mapping available to a guest, it also tells the guest to create a WC mapping. However, even when the guest kernel picks the correct memory type, it gets ignored because of VMX_EPT_IPAT_BIT on Intel. This

[RFC PATCH 3/3] RFC: KVM: x86: support KVM_CAP_DMA_MEM

2020-02-13 Thread Chia-I Wu
When a memslot has KVM_MEM_DMA set, we want VMX_EPT_IPAT_BIT cleared for the memslot. Before that is possible, simply call kvm_arch_register_noncoherent_dma for the memslot. SVM does not have the ignore-pat bit. Guest PAT is always honored. Signed-off-by: Chia-I Wu Cc: Gurchetan Singh Cc

Re: [PATCH 4/4 v6] drm/virtio: enqueue virtio_gpu_create_context after the first 3D ioctl

2020-02-24 Thread Chia-I Wu
On Mon, Feb 24, 2020 at 5:24 AM Emil Velikov wrote: > > On Mon, 24 Feb 2020 at 11:06, Gerd Hoffmann wrote: > > > > On Fri, Feb 21, 2020 at 04:54:02PM -0800, Gurchetan Singh wrote: > > > On Fri, Feb 21, 2020 at 3:06 PM Chia-I Wu wrote: > > > > > >

Re: [PATCH 2/2] [RFC] drm/virtgpu: modify uapi with stride/layer_stride fix

2020-02-28 Thread Chia-I Wu
On Wed, Oct 2, 2019 at 5:18 PM Gurchetan Singh wrote: > > On Wed, Oct 2, 2019 at 1:49 AM Gerd Hoffmann wrote: > > > > On Tue, Oct 01, 2019 at 06:49:35PM -0700, Gurchetan Singh wrote: > > > This doesn't really break userspace, since it always passes down > > > 0 for stride/layer_stride currently.

Re: [PATCH v5 1/3] drm/shmem: add support for per object caching flags.

2020-02-26 Thread Chia-I Wu
On Wed, Feb 26, 2020 at 10:25 AM Thomas Hellström (VMware) wrote: > > Hi, Gerd, > > While looking at this patchset I came across some stuff that seems > strange but that was merged in a previous patchset. > > (please refer to >

Re: [PATCH 2/4] drm/virtio: resource teardown tweaks

2020-02-05 Thread Chia-I Wu
On Wed, Feb 5, 2020 at 3:00 AM Gerd Hoffmann wrote: > > Add new virtio_gpu_cleanup_object() helper function for object cleanup. > Wire up callback function for resource unref, do cleanup from callback > when we know the host stopped using the resource. > > Signed-off-by: Gerd Hoffmann > --- >

Re: [PATCH 4/4] drm/virtio: move virtio_gpu_mem_entry initialization to new function

2020-02-05 Thread Chia-I Wu
On Wed, Feb 5, 2020 at 3:00 AM Gerd Hoffmann wrote: > > Introduce new virtio_gpu_object_shmem_init() helper function which will > create the virtio_gpu_mem_entry array, containing the backing storage > information for the host. For the most path this just moves code from >

[PATCH 00/11] drm/virtio: fixes and cleanups for vbuf queuing

2020-02-05 Thread Chia-I Wu
This series consists of fixes and cleanups for virtio_gpu_queue_fenced_ctrl_buffer, except for the last patch. The fixes are for corner cases that were overlooked. The cleanups make the last patch easier, but they should be good in themselves as well. The last patch changes the disable_notify

[PATCH 06/11] drm/virtio: set up virtqueue sgs before locking

2020-02-05 Thread Chia-I Wu
sgs setup does not need to be in the critical section. Signed-off-by: Chia-I Wu --- drivers/gpu/drm/virtio/virtgpu_vq.c | 66 +++-- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c

[PATCH 09/11] drm/virtio: avoid an infinite loop

2020-02-05 Thread Chia-I Wu
Make sure elemcnt does not exceed the maximum element count in virtio_gpu_queue_ctrl_sgs. We should improve our error handling or impose a size limit on execbuffer, which are TODOs. Signed-off-by: Chia-I Wu Cc: David Riley --- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm

[PATCH 07/11] drm/virtio: move locking into virtio_gpu_queue_ctrl_sgs

2020-02-05 Thread Chia-I Wu
Signed-off-by: Chia-I Wu --- drivers/gpu/drm/virtio/virtgpu_vq.c | 70 ++--- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c index 6ccb2a54dfb3c..299470aac281a 100644 --- a/drivers

[PATCH 10/11] drm/virtio: move virtqueue_notify into virtio_gpu_queue_ctrl_sgs

2020-02-05 Thread Chia-I Wu
It becomes clear that virtio_gpu_queue_fenced_ctrl_buffer should be responsible for setting up sgs and virtio_gpu_queue_ctrl_sgs should be responsible for queuing sgs. Signed-off-by: Chia-I Wu --- drivers/gpu/drm/virtio/virtgpu_vq.c | 22 ++ 1 file changed, 10 insertions

[PATCH 11/11] drm/virtio: rework virtio_gpu_enable_notify

2020-02-05 Thread Chia-I Wu
Call virtqueue_kick_prepare once in virtio_gpu_enable_notify, not whenever a command is added. This should be more efficient since the intention is to batch commands. Signed-off-by: Chia-I Wu --- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 - drivers/gpu/drm/virtio/virtgpu_vq.c | 28

[PATCH 03/11] drm/virtio: add virtio_gpu_vbuf_ctrl_hdr

2020-02-05 Thread Chia-I Wu
It is a helper to return the virtio_gpu_ctrl_hdr in a vbuf. Signed-off-by: Chia-I Wu --- drivers/gpu/drm/virtio/virtgpu_vq.c | 20 +++- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c index

[PATCH 05/11] drm/virtio: unlock object array on errors

2020-02-05 Thread Chia-I Wu
We don't propagate erros to the callers. We have to unlock object arrays on errors. Signed-off-by: Chia-I Wu --- drivers/gpu/drm/virtio/virtgpu_vq.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio

[PATCH 02/11] drm/virtio: remove incorrect ENOSPC check

2020-02-05 Thread Chia-I Wu
the incorrect and unnecessary error path. This also adds a WARN_ON(ret) until we properly handle errors. Signed-off-by: Chia-I Wu Cc: David Riley --- drivers/gpu/drm/virtio/virtgpu_vq.c | 19 ++- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/virtio

[PATCH 04/11] drm/virtio: no need to pass virtio_gpu_ctrl_hdr

2020-02-05 Thread Chia-I Wu
We can get it from vbuf. Signed-off-by: Chia-I Wu --- drivers/gpu/drm/virtio/virtgpu_vq.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c index 312fd8a039a1e..5815c7d50dc20

[PATCH 08/11] drm/virtio: move the check for vqs_ready earlier

2020-02-05 Thread Chia-I Wu
When vqs_ready is false, vq should be considered invalid and we should not check vq->num_free. After this change, a fenced command queued before the vqs are ready will have fence id 0 and will be considered done. Signed-off-by: Chia-I Wu --- drivers/gpu/drm/virtio/virtgpu_vq.c |

[PATCH 01/11] drm/virtio: fix a wait_event condition

2020-02-05 Thread Chia-I Wu
outcnt may be greater than 1 since commit e1218b8c0cc1 (drm/virtio: Use vmalloc for command buffer allocations.). Signed-off-by: Chia-I Wu Cc: David Riley --- drivers/gpu/drm/virtio/virtgpu_vq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio

Re: [PATCH] drm/virtio: ratelimit error logging

2020-02-05 Thread Chia-I Wu
On Wed, Feb 5, 2020 at 2:26 AM Gerd Hoffmann wrote: > > Avoid flooding the log in case we screw up badly. > > Signed-off-by: Gerd Hoffmann Reviewed-by: Chia-I Wu > --- > drivers/gpu/drm/virtio/virtgpu_vq.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >

[PATCH 2/2] drm/virtio: remove the global disable_notify state

2020-02-06 Thread Chia-I Wu
bar -> add bar to ctrlq and commit is caller-controlled virtio_gpu_{disable,enable}_notify is also replaced by virtio_gpu_commit_ctrl. Signed-off-by: Chia-I Wu --- drivers/gpu/drm/virtio/virtgpu_display.c | 9 ++- drivers/gpu/drm/virtio/virtgpu_drv.h

[PATCH 0/2] drm/virtio: rework command batching

2020-02-06 Thread Chia-I Wu
This series replaces the global disable_notify state by command-level bools to control vq kicks. When command batching is applied to more places, this prevents one process from affecting another process. ___ dri-devel mailing list

[PATCH 1/2] drm/virtio: remove the global pending_notify state

2020-02-06 Thread Chia-I Wu
Call virtqueue_kick_prepare once in virtio_gpu_enable_notify, not whenever a command is added. This should be more efficient since the intention is to batch commands. Signed-off-by: Chia-I Wu --- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 - drivers/gpu/drm/virtio/virtgpu_vq.c | 28

Re: [PATCH 4/4] drm/virtio: move virtio_gpu_mem_entry initialization to new function

2020-02-06 Thread Chia-I Wu
On Thu, Feb 6, 2020 at 12:55 AM Gerd Hoffmann wrote: > > Hi, > > > > virtio_gpu_cmd_resource_attach_backing(vgdev, obj->hw_res_handle, > > > - ents, nents, > > > + obj->ents, obj->nents, > > >

Re: [PATCH 09/11] drm/virtio: avoid an infinite loop

2020-02-06 Thread Chia-I Wu
On Thu, Feb 6, 2020 at 1:49 AM Gerd Hoffmann wrote: > > On Wed, Feb 05, 2020 at 10:19:53AM -0800, Chia-I Wu wrote: > > Make sure elemcnt does not exceed the maximum element count in > > virtio_gpu_queue_ctrl_sgs. We should improve our error handling or > > impose a

Re: [PATCH] drm/virtio: fix ring free check

2020-02-06 Thread Chia-I Wu
num_free < elemcnt) { > + indirect = virtio_has_feature(vgdev->vdev, > VIRTIO_RING_F_INDIRECT_DESC); > + vqcnt = indirect ? 1 : elemcnt; Is the feature dynamic and require the lock held? If not, the result can be cached and the fixup can happen before grabbing the lo

Re: [PATCH 2/4] drm/virtio: resource teardown tweaks

2020-02-06 Thread Chia-I Wu
On Wed, Feb 5, 2020 at 10:43 PM Gerd Hoffmann wrote: > > > > - > > > - drm_gem_shmem_free_object(obj); > > > + if (bo->created) { > > > + virtio_gpu_cmd_unref_resource(vgdev, bo); > > > + /* completion handler calls virtio_gpu_cleanup_object() */ > >

Re: [PATCH v2] drm/virtio: fix ring free check

2020-02-06 Thread Chia-I Wu
bool has_virgl_3d; > bool has_edid; > + bool has_indirect; has_indirect_desc? Either way, Reviewed-by: Chia-I Wu > > struct work_struct config_changed_work; > > diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c > b/drivers/gpu/drm/virtio/virtgp

  1   2   3   >