From 6f508c8875702ff865440cfff3929dd36083e8b2 Mon Sep 17 00:00:00 2001 From: Dmitry Osipenko Date: Tue, 30 May 2023 01:39:30 +0300 Subject: media: videobuf2: Don't assert held reservation lock for dma-buf mmapping Don't assert held dma-buf reservation lock on memory mapping of exported buffer. We're going to change dma-buf mmap() locking policy such that exporters will have to handle the lock. The previous locking policy caused deadlock problem for DRM drivers in a case of self-imported dma-bufs once these drivers are moved to use reservation lock universally. The problem is solved by moving the lock down to exporters. This patch prepares videobuf2 for the locking policy update. Reviewed-by: Emil Velikov Reviewed-by: Hans Verkuil Signed-off-by: Dmitry Osipenko Link: https://patchwork.freedesktop.org/patch/msgid/20230529223935.2672495-2-dmitry.osipenko@collabora.com --- drivers/media/common/videobuf2/videobuf2-dma-contig.c | 3 --- drivers/media/common/videobuf2/videobuf2-dma-sg.c | 3 --- drivers/media/common/videobuf2/videobuf2-vmalloc.c | 3 --- 3 files changed, 9 deletions(-) (limited to 'drivers/media') diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c index 205d3cac425c..2fa455d4a048 100644 --- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c +++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c @@ -11,7 +11,6 @@ */ #include -#include #include #include #include @@ -456,8 +455,6 @@ static int vb2_dc_dmabuf_ops_vmap(struct dma_buf *dbuf, struct iosys_map *map) static int vb2_dc_dmabuf_ops_mmap(struct dma_buf *dbuf, struct vm_area_struct *vma) { - dma_resv_assert_held(dbuf->resv); - return vb2_dc_mmap(dbuf->priv, vma); } diff --git a/drivers/media/common/videobuf2/videobuf2-dma-sg.c b/drivers/media/common/videobuf2/videobuf2-dma-sg.c index 183037fb1273..28f3fdfe23a2 100644 --- a/drivers/media/common/videobuf2/videobuf2-dma-sg.c +++ b/drivers/media/common/videobuf2/videobuf2-dma-sg.c @@ -10,7 +10,6 @@ * the Free Software Foundation. */ -#include #include #include #include @@ -498,8 +497,6 @@ static int vb2_dma_sg_dmabuf_ops_vmap(struct dma_buf *dbuf, static int vb2_dma_sg_dmabuf_ops_mmap(struct dma_buf *dbuf, struct vm_area_struct *vma) { - dma_resv_assert_held(dbuf->resv); - return vb2_dma_sg_mmap(dbuf->priv, vma); } diff --git a/drivers/media/common/videobuf2/videobuf2-vmalloc.c b/drivers/media/common/videobuf2/videobuf2-vmalloc.c index a6c6d2fcaaa4..7c635e292106 100644 --- a/drivers/media/common/videobuf2/videobuf2-vmalloc.c +++ b/drivers/media/common/videobuf2/videobuf2-vmalloc.c @@ -10,7 +10,6 @@ * the Free Software Foundation. */ -#include #include #include #include @@ -319,8 +318,6 @@ static int vb2_vmalloc_dmabuf_ops_vmap(struct dma_buf *dbuf, static int vb2_vmalloc_dmabuf_ops_mmap(struct dma_buf *dbuf, struct vm_area_struct *vma) { - dma_resv_assert_held(dbuf->resv); - return vb2_vmalloc_mmap(dbuf->priv, vma); } -- cgit v1.2.3 From 9c73576c78d591b78985a2a35c83b4ff786a3f70 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Sat, 15 Jul 2023 20:51:53 +0200 Subject: media: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct fbinfo.flags has been allocated to zero by kzalloc(). So do not set it. Flags should signal differences from the default values. After cleaning up all occurrences of FBINFO_DEFAULT, the token will be removed. v2: * fix commit message (Miguel) Signed-off-by: Thomas Zimmermann Acked-by: Sam Ravnborg Cc: Andy Walls Cc: Mauro Carvalho Chehab Cc: Hans Verkuil Link: https://patchwork.freedesktop.org/patch/msgid/20230715185343.7193-12-tzimmermann@suse.de --- drivers/media/pci/ivtv/ivtvfb.c | 1 - drivers/media/test-drivers/vivid/vivid-osd.c | 1 - 2 files changed, 2 deletions(-) (limited to 'drivers/media') diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c index 0aeb9daaee4c..23c8c094e791 100644 --- a/drivers/media/pci/ivtv/ivtvfb.c +++ b/drivers/media/pci/ivtv/ivtvfb.c @@ -1048,7 +1048,6 @@ static int ivtvfb_init_vidmode(struct ivtv *itv) /* Generate valid fb_info */ oi->ivtvfb_info.node = -1; - oi->ivtvfb_info.flags = FBINFO_FLAG_DEFAULT; oi->ivtvfb_info.par = itv; oi->ivtvfb_info.var = oi->ivtvfb_defined; oi->ivtvfb_info.fix = oi->ivtvfb_fix; diff --git a/drivers/media/test-drivers/vivid/vivid-osd.c b/drivers/media/test-drivers/vivid/vivid-osd.c index ec25edc679b3..051f1805a16d 100644 --- a/drivers/media/test-drivers/vivid/vivid-osd.c +++ b/drivers/media/test-drivers/vivid/vivid-osd.c @@ -310,7 +310,6 @@ static int vivid_fb_init_vidmode(struct vivid_dev *dev) /* Generate valid fb_info */ dev->fb_info.node = -1; - dev->fb_info.flags = FBINFO_FLAG_DEFAULT; dev->fb_info.par = dev; dev->fb_info.var = dev->fb_defined; dev->fb_info.fix = dev->fb_fix; -- cgit v1.2.3 From edf6efe34d9e5910fefdf8268e0708b8b5ea0eee Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Thu, 3 Aug 2023 20:35:26 +0200 Subject: media/vivid: Use fbdev I/O helpers Set struct fb_ops and with FB_DEFAULT_IOMEM_OPS, fbdev's initializer for I/O memory. Sets the callbacks to the cfb_ and fb_io_ functions. Select the correct modules with Kconfig's FB_IOMEM_HELPERS token. The macro and token set the currently selected values, so there is no functional change. v3: * use _IOMEM_ in commit message v2: * updated to use _IOMEM_ tokens Signed-off-by: Thomas Zimmermann Reviewed-by: Hans Verkuil Reviewed-by: Sam Ravnborg Acked-by: Helge Deller Cc: Hans Verkuil Cc: Mauro Carvalho Chehab Link: https://patchwork.freedesktop.org/patch/msgid/20230803184034.6456-2-tzimmermann@suse.de --- drivers/media/test-drivers/vivid/Kconfig | 4 +--- drivers/media/test-drivers/vivid/vivid-osd.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'drivers/media') diff --git a/drivers/media/test-drivers/vivid/Kconfig b/drivers/media/test-drivers/vivid/Kconfig index 318799d317ba..5b08a5ad291e 100644 --- a/drivers/media/test-drivers/vivid/Kconfig +++ b/drivers/media/test-drivers/vivid/Kconfig @@ -3,11 +3,9 @@ config VIDEO_VIVID tristate "Virtual Video Test Driver" depends on VIDEO_DEV && !SPARC32 && !SPARC64 && FB depends on HAS_DMA + select FB_IOMEM_HELPERS select FONT_SUPPORT select FONT_8x16 - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT select VIDEOBUF2_VMALLOC select VIDEOBUF2_DMA_CONTIG select VIDEO_V4L2_TPG diff --git a/drivers/media/test-drivers/vivid/vivid-osd.c b/drivers/media/test-drivers/vivid/vivid-osd.c index 051f1805a16d..5c931b94a7b5 100644 --- a/drivers/media/test-drivers/vivid/vivid-osd.c +++ b/drivers/media/test-drivers/vivid/vivid-osd.c @@ -246,12 +246,10 @@ static int vivid_fb_blank(int blank_mode, struct fb_info *info) static const struct fb_ops vivid_fb_ops = { .owner = THIS_MODULE, + FB_DEFAULT_IOMEM_OPS, .fb_check_var = vivid_fb_check_var, .fb_set_par = vivid_fb_set_par, .fb_setcolreg = vivid_fb_setcolreg, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, .fb_cursor = NULL, .fb_ioctl = vivid_fb_ioctl, .fb_pan_display = vivid_fb_pan_display, -- cgit v1.2.3