Re: Warnings in DRM code when removing/unbinding a driver

2019-12-19 Thread Gerd Hoffmann
Hi, > > Like I said, for most drivers > > > you can pretty much assume that their unload sequence has been broken > > > since forever. It's not often tested, and especially the hotunbind > > > from a device (as opposed to driver unload) stuff wasn't even possible > > > to get right until just

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

2019-12-18 Thread Gerd Hoffmann
Add map_cached bool to drm_gem_shmem_object, to request cached mappings on a per-object base. Check the flag before adding writecombine to pgprot bits. Signed-off-by: Gerd Hoffmann --- include/drm/drm_gem_shmem_helper.h | 5 + drivers/gpu/drm/drm_gem_shmem_helper.c | 12

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

2019-12-18 Thread Gerd Hoffmann
-by: Gerd Hoffmann --- drivers/gpu/drm/udl/udl_gem.c | 62 ++- 1 file changed, 3 insertions(+), 59 deletions(-) diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c index b6e26f98aa0a..7e3a88b25b6b 100644 --- a/drivers/gpu/drm/udl/udl_gem.c +++ b

[PATCH v4 2/3] drm/virtio: fix mmap page attributes

2019-12-18 Thread Gerd Hoffmann
virtio-gpu uses cached mappings, set drm_gem_shmem_object.map_cached accordingly. Reported-by: Gurchetan Singh Signed-off-by: Gerd Hoffmann virtio fixup --- drivers/gpu/drm/virtio/virtgpu_object.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b

[PATCH v4 0/3] drm/virtio: fix mmap page attributes

2019-12-18 Thread Gerd Hoffmann
v4: back to v2-ish design, but simplified a bit. v3: switch to drm_gem_object_funcs callback. v2: make shmem helper caching configurable. Gerd Hoffmann (3): drm/shmem: add support for per object caching flags. drm/virtio: fix mmap page attributes drm/udl: simplify gem object mapping

Re: [PATCH 0/9] *** virtgpu cleanups ***

2019-12-18 Thread Gerd Hoffmann
On Tue, Dec 17, 2019 at 04:59:20PM -0800, Gurchetan Singh wrote: > With so many new features on the horizon, perhaps it's > time to do a little "winter cleaning" beforehand. Enjoy! > > drm/virtio: static-ify virtio_gpu_framebuffer_init Doesn't apply cleanly. What kernel is this against? >

Re: [PATCH] udmabuf: fix dma-buf cpu access

2019-12-18 Thread Gerd Hoffmann
On Tue, Dec 17, 2019 at 03:02:28PM -0800, Gurchetan Singh wrote: > I'm just going to put Chia's review comment here since it sums > the issue rather nicely: > > "(1) Semantically, a dma-buf is in DMA domain. CPU access from the > importer must be surrounded by {begin,end}_cpu_access. This gives

Re: [PATCH] udmabuf: fix dma-buf cpu access

2019-12-16 Thread Gerd Hoffmann
On Fri, Dec 13, 2019 at 11:33:59AM -0800, Gurchetan Singh wrote: > I'm just going to put Chia's review comment here since it sums > the issue rather nicely: > > "(1) Semantically, a dma-buf is in DMA domain. CPU access from the > importer must be surrounded by {begin,end}_cpu_access. This gives

Re: [PATCH v2 1/2] drm/shmem: add support for per object caching attributes

2019-12-16 Thread Gerd Hoffmann
Hi, > > I suspect for imported dma-bufs we should leave the mmap() to the > > exporter instead of pulling the pages out of the sgt and map them > > ourself. > > Uh yes. If we still do that, then yes very much we shouldn't. Looking again. drm_gem_dumb_map_offset() throws an error in case

[PATCH v2 2/3] virtio-gpu: batch display update commands.

2019-12-12 Thread Gerd Hoffmann
. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h | 6 ++ drivers/gpu/drm/virtio/virtgpu_plane.c | 4 drivers/gpu/drm/virtio/virtgpu_vq.c| 23 +-- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio

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

2019-12-12 Thread Gerd Hoffmann
v2: remove shift by src_{x,y}, drm_atomic_helper_damage_merged() handles that for us (Chia-I Wu). 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

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

2019-12-12 Thread Gerd Hoffmann
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 display updates. drivers/gpu/drm/virtio/virtgpu_drv.h | 6 ++ drivers/gpu/drm/virtio

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

2019-12-12 Thread Gerd Hoffmann
v2: also check src rect (Chia-I Wu). Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_plane.c | 35 +++--- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index

Re: [PATCH v2 1/2] drm/shmem: add support for per object caching attributes

2019-12-11 Thread Gerd Hoffmann
Hi, > btw on why udl does this: Imported bo are usually rendered by real hw, and > reading it uncached/wc is the more defensive setting. It would be kinda > nice if dma-buf would expose this, but I fear dma-api maintainers would > murder us if we even just propose that ... so it's a mess right

Re: [PATCH v3 1/4] drm: add pgprot callback to drm_gem_object_funcs

2019-12-11 Thread Gerd Hoffmann
> > + /** > > +* @pgprot: > > +* > > +* Tweak pgprot as needed, typically used to set cache bits. > > +* > > +* This callback is optional. > > +* > > +* If unset drm_gem_pgprot_wc() will be used. > > +*/ > > + pgprot_t (*pgprot)(struct drm_gem_object *obj,

[PATCH v3 1/4] drm: add pgprot callback to drm_gem_object_funcs

2019-12-11 Thread Gerd Hoffmann
() and vmap() functions. The patch also adds two implementations for the callback, for cached and writecombine mappings, and the drm_gem_pgprot() function to update pgprot for a given object, using the new _gem_object_funcs.pgprot callback if available. Signed-off-by: Gerd Hoffmann --- include/drm

[PATCH v3 2/4] drm/shmem: add support for per object caching flags.

2019-12-11 Thread Gerd Hoffmann
Use drm_gem_pgprot_wc() as pgprot callback in drm_gem_shmem_funcs. Use drm_gem_pgprot() to update pgprot caching flags. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/drm_gem_shmem_helper.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm

[PATCH v3 3/4] drm/virtio: fix mmap page attributes

2019-12-11 Thread Gerd Hoffmann
virtio-gpu uses cached mappings, set virtio_gpu_gem_funcs.pgprot accordingly. Reported-by: Gurchetan Singh Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_object.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm

[PATCH v3 0/4] drm/virtio: fix mmap page attributes

2019-12-11 Thread Gerd Hoffmann
v3: switch to drm_gem_object_funcs callback. v2: make shmem helper caching configurable. Gerd Hoffmann (4): drm: add pgprot callback to drm_gem_object_funcs drm/shmem: add support for per object caching flags. drm/virtio: fix mmap page attributes drm/udl: simplify gem object mapping

[PATCH v3 4/4] drm/udl: simplify gem object mapping.

2019-12-11 Thread Gerd Hoffmann
With shmem helpers allowing to update pgprot caching flags via drm_gem_object_funcs.pgprot we can just use that and ditch our own implementations of mmap() and vmap(). Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/udl/udl_gem.c | 62 --- 1 file changed, 7

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

2019-12-11 Thread Gerd Hoffmann
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 b/drivers/gpu/drm/virtio/virtgpu_plane.c index 2e0d14e005db..1a0fbbb91ec7 100644

[PATCH 2/3] virtio-gpu: batch display update commands.

2019-12-11 Thread Gerd Hoffmann
. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h | 6 ++ drivers/gpu/drm/virtio/virtgpu_plane.c | 4 drivers/gpu/drm/virtio/virtgpu_vq.c| 23 +-- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio

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

2019-12-11 Thread Gerd Hoffmann
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 display updates. drivers/gpu/drm/virtio/virtgpu_drv.h | 6 ++ drivers/gpu/drm/virtio/virtgpu_plane.c | 76

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

2019-12-11 Thread Gerd Hoffmann
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 b/drivers/gpu/drm/virtio/virtgpu_plane.c index bc4bc4475a8c..a0f91658c2bc 100644

[PATCH v2 1/2] drm/shmem: add support for per object caching attributes

2019-12-11 Thread Gerd Hoffmann
override that later if needed. Signed-off-by: Gerd Hoffmann --- include/drm/drm_gem_shmem_helper.h | 12 drivers/gpu/drm/drm_gem_shmem_helper.c | 24 +--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/include/drm/drm_gem_shmem_helper.h b

[PATCH v2 2/2] drm/virtio: fix mmap page attributes

2019-12-11 Thread Gerd Hoffmann
virtio-gpu uses cached mappings, set shmem->caching accordingly. Reported-by: Gurchetan Singh Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_object.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/vir

[PATCH v2 0/2] drm/virtio: fix mmap page attributes

2019-12-11 Thread Gerd Hoffmann
v2: make shmem helper caching configurable. Gerd Hoffmann (2): drm/shmem: add support for per object caching attributes drm/virtio: fix mmap page attributes include/drm/drm_gem_shmem_helper.h | 12 drivers/gpu/drm/drm_gem_shmem_helper.c | 24

Re: [PATCH] drm/virtio: fix mmap page attributes

2019-12-11 Thread Gerd Hoffmann
Hi, > There's similar code in udl, [1] which still uses writecombine for > imported buffers. Virtio does not need this? virtio doesn't support dma-buf imports (yet). So no worries for now. Why pick writecombine for the imported buffer btw? It'll probably be correct for the majority of

[PATCH] drm/virtio: fix mmap page attributes

2019-12-10 Thread Gerd Hoffmann
virtio-gpu uses cached mappings. shmem helpers use writecombine though. So roll our own mmap function, wrapping drm_gem_shmem_mmap(), to tweak vm_page_prot accordingly. Reported-by: Gurchetan Singh Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_object.c | 18

Re: [Intel-gfx] [PATCH v3 1/2] drm: call drm_gem_object_funcs.mmap with fake offset

2019-12-06 Thread Gerd Hoffmann
On Fri, Dec 06, 2019 at 12:10:15PM +0100, Daniel Vetter wrote: > On Fri, Dec 6, 2019 at 11:22 AM Gerd Hoffmann wrote: > > > > > Guess you kicked CI? Just got CI mails, now reporting success, without > > > doing anything. So I'll go push v3 to misc-next. > > >

Re: [PATCH v3 1/2] drm: call drm_gem_object_funcs.mmap with fake offset

2019-12-06 Thread Gerd Hoffmann
On Fri, Dec 06, 2019 at 11:07:24AM +0100, Gerd Hoffmann wrote: > On Thu, Dec 05, 2019 at 11:15:23PM +0100, Daniel Vetter wrote: > > Looks like unrelated flukes, this happens occasionally. If you're paranoid > > hit the retest button on patchwork to double-check. > > -Daniel

Re: [PATCH] drm/qxl: remove unnecessary BUG_ON check for handle

2019-12-06 Thread Gerd Hoffmann
On Thu, Dec 05, 2019 at 05:42:31PM -0600, Aditya Pakki wrote: > In qxl_gem_object_create_with_handle(), handle's memory is not > allocated on the heap. Checking for failure of handle via BUG_ON > is unnecessary. This patch eliminates the check. The check makes sure the caller doesn't pass in

Re: [PATCH v3 1/2] drm: call drm_gem_object_funcs.mmap with fake offset

2019-12-06 Thread Gerd Hoffmann
On Thu, Dec 05, 2019 at 11:15:23PM +0100, Daniel Vetter wrote: > On Thu, Nov 28, 2019 at 12:39:30PM +0100, Gerd Hoffmann wrote: > > On Wed, Nov 27, 2019 at 10:25:22AM +0100, Gerd Hoffmann wrote: > > > The fake offset is going to stay, so change the

Re: [PATCH] drm/mgag200: Flag all G200 SE A machines as broken wrt

2019-12-06 Thread Gerd Hoffmann
D_MATROX, 0x522, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_SE_A > }, Acked-by: Gerd Hoffmann cheers, Gerd ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 0/7] drm/udl: Prepare damage handler for simple-pipe KMS

2019-12-05 Thread Gerd Hoffmann
o be more > readable. Patch 6 moves dma-buf begin/end calls into the damage handler, > so it will run during page-flip andmodeset operations. Nice cleanups. Acked-by: Gerd Hoffmann cheers, Gerd ___ dri-devel mailing list dri-devel@lists.freede

Re: [PATCH v3 0/7] drm/ast: Fix modesetting's framebuffer usage

2019-12-05 Thread Gerd Hoffmann
> The patchset has been tested by running the fbdev console, Gnome, > and Weston on an AST1100 chipset. Gnome's display has been suspended > multiple times to verify the bugfix. Disclaimer: Don't know the hardware. Can't spot any issues in the series, so Acked-by: Gerd Hoffmann cheers

Re: [PATCH] drm/mgag200: Debug-print unique revisions id on G200 SE

2019-12-05 Thread Gerd Hoffmann
{ > mdev->unique_rev_id = RREG32(0x1e24); > + DRM_DEBUG("G200 SE unique revision id is 0x%x\n", > + mdev->unique_rev_id); Maybe use DRM_INFO here? Temporarily for a few kernel revisions, until things are settle

Re: [PATCH 1/4] udmabuf: use cache_sgt_mapping option

2019-12-05 Thread Gerd Hoffmann
On Mon, Dec 02, 2019 at 05:36:24PM -0800, Gurchetan Singh wrote: > The GEM prime helpers do it, so should we. It's also possible to make > it optional later. All 4 pushed to drm-misc-next. thanks, Gerd ___ dri-devel mailing list

Re: [PATCH] drm/qxl: Complete exception handling in qxl_device_init()

2019-11-29 Thread Gerd Hoffmann
On Thu, Nov 07, 2019 at 06:18:14PM +0100, Markus Elfring wrote: > From: Markus Elfring > Date: Thu, 7 Nov 2019 18:05:08 +0100 > > A coccicheck run provided information like the following. > > drivers/gpu/drm/qxl/qxl_kms.c:295:1-7: ERROR: missing iounmap; > ioremap on line 178 and execution via

Re: [PATCH 2/5] udmabuf: allow userspace to set map attributes

2019-11-28 Thread Gerd Hoffmann
Hi, > diff --git a/include/uapi/linux/udmabuf.h b/include/uapi/linux/udmabuf.h > index 46b6532ed855..f90831f2bb0d 100644 > --- a/include/uapi/linux/udmabuf.h > +++ b/include/uapi/linux/udmabuf.h > @@ -6,6 +6,8 @@ > #include > > #define UDMABUF_FLAGS_CLOEXEC0x01 > +#define

Re: [PATCH v3 1/2] drm: call drm_gem_object_funcs.mmap with fake offset

2019-11-28 Thread Gerd Hoffmann
On Wed, Nov 27, 2019 at 10:25:22AM +0100, Gerd Hoffmann wrote: > The fake offset is going to stay, so change the calling convention for > drm_gem_object_funcs.mmap to include the fake offset. Update all users > accordingly. > > Note that this reverts 83b8a6f242ea ("drm/gem:

[PATCH v3 1/2] drm: call drm_gem_object_funcs.mmap with fake offset

2019-11-27 Thread Gerd Hoffmann
fake offset handling for drm_gem_object_funcs.mmap") Cc: Daniel Vetter Cc: Rob Herring Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel Vetter --- include/drm/drm_gem.h | 4 +--- drivers/gpu/drm/drm_gem.c | 3 --- drivers/gpu/drm/drm_gem_shmem_helper.c | 3 +++ drivers/gpu/drm/

[PATCH v3 2/2] drm: share address space for dma bufs

2019-11-27 Thread Gerd Hoffmann
driver's private dmabuf update. It is not needed any more now that we are doing this for everybody. Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel Vetter Reviewed-by: Alex Deucher Reviewed-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 4 +--- drivers/gpu/drm

[PATCH v3 0/2] drm: mmap fixups

2019-11-27 Thread Gerd Hoffmann
Tested on qemu, with bochs (vram helpers) and cirrus (shmem helpers). Cc'ing intel-gfx for CI coverage. v3: better fake-offset handling in drm_gem_prime_mmap() (Rob) Gerd Hoffmann (2): drm: call drm_gem_object_funcs.mmap with fake offset drm: share address space for dma bufs include/drm

[PATCH v2 1/2] drm: call drm_gem_object_funcs.mmap with fake offset

2019-11-21 Thread Gerd Hoffmann
s the fake offset to drm_gem_prime_mmap to make sure all paths leading to obj->funcs->mmap are consistent. Fixes: 83b8a6f242ea ("drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap") Cc: Daniel Vetter Cc: Rob Herring Signed-off-by: Gerd Hoffmann Reviewed-by: Danie

[PATCH v2 2/2] drm: share address space for dma bufs

2019-11-21 Thread Gerd Hoffmann
driver's private dmabuf update. It is not needed any more now that we are doing this for everybody. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 4 +--- drivers/gpu/drm/drm_prime.c | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff

[PATCH v2 0/2] drm: mmap fixups

2019-11-21 Thread Gerd Hoffmann
Tested on qemu, with bochs (vram helpers) and cirrus (shmem helpers). Cc'ing intel-gfx for CI coverage. Gerd Hoffmann (2): drm: call drm_gem_object_funcs.mmap with fake offset drm: share address space for dma bufs include/drm/drm_gem.h | 4 +--- drivers/gpu/drm/amd

Re: [Intel-gfx] [PATCH 2/2] drm: share address space for dma bufs

2019-11-21 Thread Gerd Hoffmann
On Thu, Nov 21, 2019 at 04:42:10PM +, Ruhl, Michael J wrote: > >-Original Message- > >From: Intel-gfx On Behalf Of Gerd > >Hoffmann > >Sent: Thursday, November 21, 2019 5:38 AM > >To: dri-devel@lists.freedesktop.org > >Cc: David Airlie ; intel-...@

[PATCH 0/2] drm: mmap fixups

2019-11-21 Thread Gerd Hoffmann
Tested on qemu, with bochs (vram helpers) and cirrus (shmem helpers). Cc'ing intel-gfx for CI coverage. Gerd Hoffmann (2): drm: call drm_gem_object_funcs.mmap with fake offset drm: share address space for dma bufs include/drm/drm_gem.h | 4 +--- drivers/gpu/drm/drm_gem.c

[PATCH 1/2] drm: call drm_gem_object_funcs.mmap with fake offset

2019-11-21 Thread Gerd Hoffmann
The fake offset is going to stay, so change the calling convention for drm_gem_object_funcs.mmap to include the fake offset. Update all users accordingly. Signed-off-by: Gerd Hoffmann --- include/drm/drm_gem.h | 4 +--- drivers/gpu/drm/drm_gem.c | 3 --- drivers

[PATCH 2/2] drm: share address space for dma bufs

2019-11-21 Thread Gerd Hoffmann
Use the shared address space of the drm device (see drm_open() in drm_file.c) for dma-bufs too. That removes a difference betweem drm device mmap vmas and dma-buf mmap vmas and fixes corner cases like unmaps not working properly. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/drm_prime.c | 4

Re: [PATCH v2] drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap

2019-11-21 Thread Gerd Hoffmann
On Thu, Nov 21, 2019 at 09:49:53AM +0100, Daniel Vetter wrote: > On Thu, Nov 21, 2019 at 09:02:59AM +0100, Gerd Hoffmann wrote: > > Hi, > > > > > > update-object-after-move works fine. > > > > > > > > try zap mappings with madvise(dontneed)

Re: [PATCH v2] drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap

2019-11-21 Thread Gerd Hoffmann
Hi, > Aside: the amdgpu isn't great because it's racy, userspace could have > guessed the fd and already started an mmap before we managed to update > stuff. Can't see that race. When I read the code correctly the fd is created and installed (using dma_buf_fd) only after dmabuf setup is

Re: [PATCH v2] drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap

2019-11-21 Thread Gerd Hoffmann
nting at the new place in vram? Hmm, only the drm device mapping is faulted in after moving it, the dma-buf mapping is not. Fixed by: -- cut here From 3a7f6c6dbf3b1e4b412c2b283b2ea4edff9f33b5 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 21 No

Re: [PATCH v2] drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap

2019-11-20 Thread Gerd Hoffmann
Hi, > Ah, we're not going to replace the mapping on the dma-buf file. Only > the file of the vma structure. Doing the former would indeed be pretty > bad from a security pov. Now where do I get a filp from? Can I just call drm_open? cheers, Gerd

Re: [PATCH v2] drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap

2019-11-20 Thread Gerd Hoffmann
Hi, > > > I think for ttm just consistently using the one per-device mapping for > > > everything, with all the fake offsets, is probably the quickest route. > > > > Hmm, not clear how to fit dmabufs into this. dmabufs already have their > > own file, inode and address space. I'm not sure you

Re: [PATCH v2] drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap

2019-11-20 Thread Gerd Hoffmann
Hi, > > Anything building on shmem helpers should be able to use > > obj->filp->f_mapping, right? So allocating an inode unconditionally > > doesn't look like a good plan. > > Not sure the shmem helpers forward the mmap to the underlying shmem file, > so not sure this is the greatest way

Re: [PATCH v2] drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap

2019-11-20 Thread Gerd Hoffmann
Hi, > > I can see now why you want a private address space for each object. > > Does that imply we need an anon_inode for each gem object? Or is > > there some more lightweight way to do this? > > I have no idea whether we can get a address_space struct without an inode > (and no disasters).

Re: [PATCH 14/15] sample/vfio-mdev/mbocs: Remove dma_buf_k(un)map support

2019-11-18 Thread Gerd Hoffmann
On Mon, Nov 18, 2019 at 11:35:35AM +0100, Daniel Vetter wrote: > No in-tree users left. > > Signed-off-by: Daniel Vetter > Cc: Kirti Wankhede > Cc: k...@vger.kernel.org > -- > Ack for merging this through drm trees very much appreciated. > -Daniel Acked-by: Gerd H

Re: [PATCH v2] drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap

2019-11-18 Thread Gerd Hoffmann
Hi, > > > > Is any move buffer good enough to trigger this, i.e. will SYSTEM -> VRAM > > > > work too? That'll be easier because all I need to do is map the buffer > > > > to a crtc to force pinning to vram, then check if the mappings are > > > > intact still ... > > > > > > I think that

Re: [PATCH v2] drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap

2019-11-15 Thread Gerd Hoffmann
On Fri, Nov 15, 2019 at 11:18:28AM +0100, Daniel Vetter wrote: > On Fri, Nov 15, 2019 at 10:37 AM Gerd Hoffmann wrote: > > > > > You need memory pressure, to force ttm to unmap the bo, not userspace. So > > > roughly > > > 1. create bo > > > 2. mma

Re: [PATCH v2] drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap

2019-11-15 Thread Gerd Hoffmann
> You need memory pressure, to force ttm to unmap the bo, not userspace. So > roughly > 1. create bo > 2. mmap it through drm fd, write some stuff > 3. export to dma-buf, mmap it, verify stuff is there > 4. create a pile more bo, mmap them write to them > 5. once you've thrashed all of vram

[PATCH] drm/ttm: fix mmap refcounting

2019-11-13 Thread Gerd Hoffmann
). For that to work properly the drm_gem_object_get() call in drm_gem_ttm_mmap() must be moved so it happens before calling obj->funcs->mmap(), otherwise the gem refcount would go down to zero. Fixes: 231927d939f0 ("drm/ttm: add drm_gem_ttm_mmap()") Signed-off-by: Gerd Hoffmann --- drivers/g

Re: [PATCH v2] drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap

2019-11-13 Thread Gerd Hoffmann
Hi, > > ... but after looking again I think we are all green here. Given that > > only self-import works we'll only see vram gem objects in the mmap code > > path, which should have everything set up correctly. Same goes for qxl. > > > > All other ttm drivers still use the old mmap code path,

Re: [PATCH v2] drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap

2019-11-12 Thread Gerd Hoffmann
Hi, > > > I guess ... but kinda awkward to leave this issue in here, it's really > > > surprising if you call the pte shootdown function, and it doesn't work as > > > advertised. > > > > I was mainly wondering how this worked for us and how to hit it not > > working to test fixing it. > > > >

Re: [PATCH v2] drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap

2019-11-12 Thread Gerd Hoffmann
Hi, > > > >> VRAM helpers use drm_gem_ttm_mmap(), which wraps ttm_bo_mmap_obj(). > > > >> These changes should be transparent. > > > > > > > > There's still the issue that for dma-buf mmap vs drm mmap you use > > > > different f_mapping, which means ttm's pte shootdown won't work > > > >

Re: [PATCH v2] drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap

2019-11-12 Thread Gerd Hoffmann
ack with an offset of > >>>>> 0, > >>>>> and leave it up to drm_gem_mmap_obj() to remove the fake offset. > >>>>> > >>>>> TTM still needs the fake offset, so we have to add it back until that's > >>>>

Re: [PATCH v2] drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap

2019-11-12 Thread Gerd Hoffmann
fset. > > > > > > > > To fix this, let's always call mmap() object callback with an offset of > > > > 0, > > > > and leave it up to drm_gem_mmap_obj() to remove the fake offset. > > > > > > > > TTM still needs the fake offset, so

Re: [PATCH v2 8/9] drm/ast: Add cursor plane

2019-11-07 Thread Gerd Hoffmann
* define plane format array in global scope > > Signed-off-by: Thomas Zimmermann > --- > drivers/gpu/drm/ast/ast_drv.h | 1 + > drivers/gpu/drm/ast/ast_mode.c | 155 - > 2 files changed, 155 insertions(+), 1 d

Re: [PATCH v2 6/9] drm/ast: Add primary plane

2019-11-07 Thread Gerd Hoffmann
he CRTC's > atomic helpers. > > v2: > * don't set plane call-back functions to NULL explicitly > * define plane format array in global scope > > Signed-off-by: Thomas Zimmermann Acked-by: Gerd Hoffmann ___ dr

Re: [PATCH 9/9] drm/ast: Enable atomic modesetting

2019-11-06 Thread Gerd Hoffmann
lines of code. > but I'd like to do that in a separate patch set. Ok? Yep, that totally makes sense, given that it'll probably become a patch series of its own (with driver cleanups included). So, for this patch: Acked-by: Gerd Hoffmann cheers, Gerd _

Re: [PATCH v2 3/4] drm/udl: Switch to SHMEM

2019-11-06 Thread Gerd Hoffmann
des its own > mmap function for GEM objects where it fixes up the mapping flags. > > v2: > - remove obsolete code in a separate patch That indeed makes the patch more readable as the context stays intact this way. > > Signed-off-by: Thomas Zimmermann Acked-by: Gerd Hoffmann

Re: [PATCH v2 4/4] drm/udl: Remove struct udl_gem_object and functions

2019-11-06 Thread Gerd Hoffmann
On Wed, Nov 06, 2019 at 11:47:22AM +0100, Thomas Zimmermann wrote: > Simply removes all the obsolete GEM code from udl. No functional > changes. > > Signed-off-by: Thomas Zimmermann Acked-by: Gerd Hoffmann > --- > drivers/gpu/drm/udl/Makefile | 2 +- > drivers/gpu

Re: [PATCH 3/3] drm/udl: Switch to SHMEM

2019-11-05 Thread Gerd Hoffmann
On Mon, Oct 28, 2019 at 09:45:49AM +0100, Thomas Zimmermann wrote: > Udl's GEM code and the generic SHMEM are almost identical. Replace > the former with SHMEM. The dmabuf support in udl is being removed > in favor of the generic GEM PRIME functions. > > The main difference is in the caching

Re: [PATCH 1/3] drm/udl: Remove flags field from struct udl_gem_object

2019-11-05 Thread Gerd Hoffmann
her > struct drm_gem_object.import_attach is NULL. Acked-by: Gerd Hoffmann > > Signed-off-by: Thomas Zimmermann > --- > drivers/gpu/drm/udl/udl_dmabuf.c | 1 - > drivers/gpu/drm/udl/udl_drv.h| 4 > drivers/gpu/drm/udl/udl_gem.c| 27 +++ >

Re: [PATCH 2/3] drm/udl: Allocate GEM object via struct drm_driver.gem_create_object

2019-11-05 Thread Gerd Hoffmann
mmap > function, which we set though the create-object function. Acked-by: Gerd Hoffmann > > Signed-off-by: Thomas Zimmermann > --- > drivers/gpu/drm/udl/udl_drv.c | 1 + > drivers/gpu/drm/udl/udl_drv.h | 2 ++ > drivers/gpu/drm/udl/udl_gem.c | 25 +--

Re: [PATCH 9/9] drm/ast: Enable atomic modesetting

2019-11-05 Thread Gerd Hoffmann
On Mon, Oct 28, 2019 at 04:49:28PM +0100, Thomas Zimmermann wrote: > This commit sets the remaining atomic-modesetting helpers and the flag > DRIVER_ATOMIC. Legacy cursor functions are removed in favor of the cursor > plane. For power management, atomic helpers replace the indvidual > operations

Re: [PATCH 8/9] drm/ast: Add cursor plane

2019-11-05 Thread Gerd Hoffmann
On Mon, Oct 28, 2019 at 04:49:27PM +0100, Thomas Zimmermann wrote: > The cursor plane uses an internal format of ARGB. To userspace, we > announce ARGB and do the transformation internally. Same comments as on patch 6/9 (primary plane ...) cheers, Gerd

Re: [PATCH 7/9] drm/ast: Add CRTC helpers for atomic modesetting

2019-11-05 Thread Gerd Hoffmann
-off-by: Thomas Zimmermann Acked-by: Gerd Hoffmann > --- > drivers/gpu/drm/ast/ast_mode.c | 105 - > 1 file changed, 104 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c > index

Re: [PATCH 6/9] drm/ast: Add primary plane

2019-11-05 Thread Gerd Hoffmann
> +static const struct drm_plane_funcs ast_primary_plane_funcs = { > + .update_plane = drm_atomic_helper_update_plane, > + .disable_plane = drm_atomic_helper_disable_plane, > + .destroy = drm_plane_cleanup, > + .reset = drm_atomic_helper_plane_reset, > + .set_property = NULL, >

Re: [PATCH 5/9] drm/ast: Split ast_set_vbios_mode_info()

2019-11-05 Thread Gerd Hoffmann
it the function into individual functions that do the > conversion, set the VBIOS mode information and format information. > This makes it compatible with support for primary planes and atomic > modesetting. Acked-by: Gerd Hoffmann > > Signed-off-by: Thomas Zimmermann > --- >

Re: [PATCH 4/9] drm/ast: Split ast_set_ext_reg() into color and threshold function

2019-11-05 Thread Gerd Hoffmann
> atomic modesetting. > > Signed-off-by: Thomas Zimmermann Acked-by: Gerd Hoffmann > --- > drivers/gpu/drm/ast/ast_mode.c | 15 ++- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/as

Re: [PATCH 3/9] drm/ast: Don't clear base address and offset with default values

2019-11-05 Thread Gerd Hoffmann
mermann Acked-by: Gerd Hoffmann > --- > drivers/gpu/drm/ast/ast_mode.c | 8 ++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c > index b13eaa2619ab..b3f82c2d274d 100644 > --- a/drivers/gp

Re: [PATCH 2/9] drm/ast: Check video-mode requirements against VRAM size

2019-11-05 Thread Gerd Hoffmann
On Mon, Oct 28, 2019 at 04:49:21PM +0100, Thomas Zimmermann wrote: > Each video mode's primary plane requires a minimum amount of video > memory. For double buffering, this is at most half the available > VRAM. Check this constraint. Acked-by: Gerd Hoffmann > > Signed-off-by: Th

Re: [PATCH 1/9] drm/ast: Remove last traces of struct ast_gem_object

2019-11-05 Thread Gerd Hoffmann
On Mon, Oct 28, 2019 at 04:49:20PM +0100, Thomas Zimmermann wrote: > The ast driver has switched to struct drm_vram_gem_object a while ago. > This patch removes a function and forward declaration that were forgotten > before. > > Signed-off-by: Thomas Zimmermann Acked-by

Re: [PATCH 3/5] drm/udl: Add GEM object functions for free(), vmap(), and vunmap()

2019-10-25 Thread Gerd Hoffmann
Hi, > > I had a flag to set this in the initial version of the shmem helper > > modeled after udl, but Thomas Hellstrom brought up a question and it was > > dropped. The issue was beyond my understanding: > > > > [PATCH v3 0/2] drm: Add shmem GEM library > >

Re: [PATCH v2] drm/gem: Fix mmap fake offset handling for drm_gem_object_funcs.mmap

2019-10-24 Thread Gerd Hoffmann
alled with the fake offset > + * removed. Add it back here until the rest of TTM works without it. > + */ > + vma->vm_pgoff += drm_vma_node_start(>base.vma_node); > + > ttm_bo_mmap_vma_setup(bo, vma); > return 0; > } Yes, that should keep ttm happ

Re: [PATCH] drm/prime: Fix mmap fake offset for drm_gem_object_funcs.mmap

2019-10-24 Thread Gerd Hoffmann
On Thu, Oct 24, 2019 at 02:32:14PM +0200, Daniel Vetter wrote: > On Thu, Oct 24, 2019 at 11:02:40AM +0200, Gerd Hoffmann wrote: > > On Wed, Oct 23, 2019 at 05:22:26PM -0500, Rob Herring wrote: > > > Commit c40069cb7bd6 ("drm: add mmap() to drm_gem_object_funcs") > &

Re: [PATCH] drm/prime: Fix mmap fake offset for drm_gem_object_funcs.mmap

2019-10-24 Thread Gerd Hoffmann
ove the fake offset handling from drivers. But that'll only work once all drivers switched away from custom fops->mmap handlers so we can handle the offset -> obj lookup in the drm core for everybody. So let's go this way for now. Acked-by: Gerd Hoffmann > However, for mmap() on dm

[PATCH v2 3/3] drm/virtio: factor out virtio_gpu_update_dumb_bo

2019-10-23 Thread Gerd Hoffmann
No functional change. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_plane.c | 36 +++--- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index 0b5a760bc293

[PATCH v2 1/3] drm/virtio: fix byteorder handling in virtio_gpu_cmd_transfer_{from, to}_host_3d functions

2019-10-23 Thread Gerd Hoffmann
Be consistent with the rest of the code base. No functional change. v2: - fix sparse warnings for virtio_gpu_cmd_transfer_to_host_2d call. - move convert_to_hw_box helper function. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h | 5 +++-- drivers/gpu/drm/virtio

[PATCH v2 0/3] drm/virtio: various cleanups

2019-10-23 Thread Gerd Hoffmann
Little patch series doing some cleanups in the virtio driver. Patches #1 + #2 have been on the list before as single patches, includes here again for patch dependency reasons. v2: - fix sparse errors. - drop merged patches (#1 + #2). please review, Gerd Gerd Hoffmann (3): drm/virtio: fix

[PATCH v2 2/3] drm/virtio: Simplify virtio_gpu_primary_plane_update workflow.

2019-10-23 Thread Gerd Hoffmann
Return early for the no framebuffer (or disabled output) case. Results in a simpler code flow for the remaining cases. No functional change. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_plane.c | 62 ++ 1 file changed, 33 insertions(+), 29 deletions

[PATCH 0/5] drm/virtio: various cleanups

2019-10-22 Thread Gerd Hoffmann
Little patch series doing some cleanups in the virtio driver. Patches #1 + #2 have been on the list before as single patches, includes here again for patch dependency reasons. please review, Gerd Gerd Hoffmann (5): drm/virtio: print a single line with device features drm/virtio: move

[PATCH 1/5] drm/virtio: print a single line with device features

2019-10-22 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_kms.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c b/drivers/gpu/drm/virtio/virtgpu_kms.c index 0b3cdb0d83b0..2f5773e43557 100644 --- a/drivers/gpu/drm/virtio

[PATCH 5/5] drm/virtio: factor out virtio_gpu_update_dumb_bo

2019-10-22 Thread Gerd Hoffmann
No functional change. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_plane.c | 36 +++--- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index 0b5a760bc293

[PATCH 4/5] drm/virtio: Simplify virtio_gpu_primary_plane_update workflow.

2019-10-22 Thread Gerd Hoffmann
Return early for the no framebuffer (or disabled output) case. Results in a simpler code flow for the remaining cases. No functional change. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_plane.c | 62 ++ 1 file changed, 33 insertions(+), 29 deletions

[PATCH 2/5] drm/virtio: move byteorder handling into virtio_gpu_cmd_transfer_to_host_2d function

2019-10-22 Thread Gerd Hoffmann
Be consistent with the rest of the code base. No functional change. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h | 4 ++-- drivers/gpu/drm/virtio/virtgpu_plane.c | 12 ++-- drivers/gpu/drm/virtio/virtgpu_vq.c| 12 ++-- 3 files changed, 14

[PATCH 3/5] drm/virtio: fix byteorder handling in virtio_gpu_cmd_transfer_{from,to}_host_3d functions

2019-10-22 Thread Gerd Hoffmann
Be consistent with the rest of the code base. No functional change. In theory this change is incompatible on bigendian machines, but in practice 3d acceleration is supported only on little endian machines, so the affected code paths never run on bigendian machines. Signed-off-by: Gerd Hoffmann

[PATCH] drm/virtio: move byteorder handling into virtio_gpu_cmd_transfer_to_host_2d function

2019-10-18 Thread Gerd Hoffmann
Be consistent with the rest of the code base. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h | 4 ++-- drivers/gpu/drm/virtio/virtgpu_plane.c | 12 ++-- drivers/gpu/drm/virtio/virtgpu_vq.c| 12 ++-- 3 files changed, 14 insertions(+), 14 deletions

<    1   2   3   4   5   6   7   8   9   10   >