* [PATCH 1/3] drm/tegra: gem: Reshuffle declarations
@ 2018-02-07 17:45 Thierry Reding
[not found] ` <20180207174556.25401-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Thierry Reding @ 2018-02-07 17:45 UTC (permalink / raw)
To: Thierry Reding; +Cc: Marcel Ziswiler, linux-tegra, dri-devel
From: Thierry Reding <treding@nvidia.com>
Move declarations in the gem.h header file into the same order as the
corresponding definitions in gem.c.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/gpu/drm/tegra/gem.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/tegra/gem.h b/drivers/gpu/drm/tegra/gem.h
index 8eaf5e3f6630..7e1635a01c81 100644
--- a/drivers/gpu/drm/tegra/gem.h
+++ b/drivers/gpu/drm/tegra/gem.h
@@ -73,10 +73,10 @@ void tegra_bo_free_object(struct drm_gem_object *gem);
int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
struct drm_mode_create_dumb *args);
-int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma);
-
extern const struct vm_operations_struct tegra_bo_vm_ops;
+int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma);
+
struct dma_buf *tegra_gem_prime_export(struct drm_device *drm,
struct drm_gem_object *gem,
int flags);
--
2.15.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] drm/tegra: gem: Make __tegra_gem_mmap() available more widely
[not found] ` <20180207174556.25401-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2018-02-07 17:45 ` Thierry Reding
2018-02-07 17:45 ` [PATCH 3/3] drm/tegra: fb: Implement ->fb_mmap() callback Thierry Reding
1 sibling, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2018-02-07 17:45 UTC (permalink / raw)
To: Thierry Reding
Cc: Marcel Ziswiler, Stefan Agner,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
This function allows mapping a GEM object into a virtual memory address
space, which makes it useful outside of the GEM code.
While at it, rename the function so it doesn't clash with the function
that implements the DRM_TEGRA_GEM_MMAP IOCTL.
Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
drivers/gpu/drm/tegra/gem.c | 7 +++----
drivers/gpu/drm/tegra/gem.h | 1 +
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
index 0e390ae73559..4b80fe58d4f7 100644
--- a/drivers/gpu/drm/tegra/gem.c
+++ b/drivers/gpu/drm/tegra/gem.c
@@ -464,8 +464,7 @@ const struct vm_operations_struct tegra_bo_vm_ops = {
.close = drm_gem_vm_close,
};
-static int tegra_gem_mmap(struct drm_gem_object *gem,
- struct vm_area_struct *vma)
+int __tegra_gem_mmap(struct drm_gem_object *gem, struct vm_area_struct *vma)
{
struct tegra_bo *bo = to_tegra_bo(gem);
@@ -512,7 +511,7 @@ int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma)
gem = vma->vm_private_data;
- return tegra_gem_mmap(gem, vma);
+ return __tegra_gem_mmap(gem, vma);
}
static struct sg_table *
@@ -633,7 +632,7 @@ static int tegra_gem_prime_mmap(struct dma_buf *buf, struct vm_area_struct *vma)
if (err < 0)
return err;
- return tegra_gem_mmap(gem, vma);
+ return __tegra_gem_mmap(gem, vma);
}
static void *tegra_gem_prime_vmap(struct dma_buf *buf)
diff --git a/drivers/gpu/drm/tegra/gem.h b/drivers/gpu/drm/tegra/gem.h
index 7e1635a01c81..bb369c129fdd 100644
--- a/drivers/gpu/drm/tegra/gem.h
+++ b/drivers/gpu/drm/tegra/gem.h
@@ -75,6 +75,7 @@ int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
extern const struct vm_operations_struct tegra_bo_vm_ops;
+int __tegra_gem_mmap(struct drm_gem_object *gem, struct vm_area_struct *vma);
int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma);
struct dma_buf *tegra_gem_prime_export(struct drm_device *drm,
--
2.15.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] drm/tegra: fb: Implement ->fb_mmap() callback
[not found] ` <20180207174556.25401-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-02-07 17:45 ` [PATCH 2/3] drm/tegra: gem: Make __tegra_gem_mmap() available more widely Thierry Reding
@ 2018-02-07 17:45 ` Thierry Reding
2018-02-07 19:24 ` stefan
[not found] ` <20180207174556.25401-3-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
1 sibling, 2 replies; 5+ messages in thread
From: Thierry Reding @ 2018-02-07 17:45 UTC (permalink / raw)
To: Thierry Reding
Cc: Marcel Ziswiler, Stefan Agner,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
This fixes hangs with legacy applications that use the mmap() syscall on
the fbdev device to map framebuffer memory. The fbdev implementation for
mmap() creates a mapping that conflicts with DRM usage and causes a hang
when the memory is accessed through the mapping.
Reported-by: Marcel Ziswiler <marcel.ziswiler-2KBjVHiyJgBBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
drivers/gpu/drm/tegra/fb.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c
index 001cb77e2f59..0786159edef3 100644
--- a/drivers/gpu/drm/tegra/fb.c
+++ b/drivers/gpu/drm/tegra/fb.c
@@ -224,12 +224,28 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,
}
#ifdef CONFIG_DRM_FBDEV_EMULATION
+static int tegra_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
+{
+ struct drm_fb_helper *helper = info->par;
+ struct tegra_bo *bo;
+ int err;
+
+ bo = tegra_fb_get_plane(helper->fb, 0);
+
+ err = drm_gem_mmap_obj(&bo->gem, bo->gem.size, vma);
+ if (err < 0)
+ return err;
+
+ return __tegra_gem_mmap(&bo->gem, vma);
+}
+
static struct fb_ops tegra_fb_ops = {
.owner = THIS_MODULE,
DRM_FB_HELPER_DEFAULT_OPS,
.fb_fillrect = drm_fb_helper_sys_fillrect,
.fb_copyarea = drm_fb_helper_sys_copyarea,
.fb_imageblit = drm_fb_helper_sys_imageblit,
+ .fb_mmap = tegra_fb_mmap,
};
static int tegra_fbdev_probe(struct drm_fb_helper *helper,
--
2.15.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 3/3] drm/tegra: fb: Implement ->fb_mmap() callback
2018-02-07 17:45 ` [PATCH 3/3] drm/tegra: fb: Implement ->fb_mmap() callback Thierry Reding
@ 2018-02-07 19:24 ` stefan
[not found] ` <20180207174556.25401-3-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
1 sibling, 0 replies; 5+ messages in thread
From: stefan @ 2018-02-07 19:24 UTC (permalink / raw)
To: Thierry Reding; +Cc: Marcel Ziswiler, linux-tegra, dri-devel
On 07.02.2018 18:45, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
>
> This fixes hangs with legacy applications that use the mmap() syscall on
> the fbdev device to map framebuffer memory. The fbdev implementation for
> mmap() creates a mapping that conflicts with DRM usage and causes a hang
> when the memory is accessed through the mapping.
That helps using applications making use of mmap & fbdev on an Apalis
TK1!
Tested-by: Stefan Agner <stefan@agner.ch>
--
Stefan
>
> Reported-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
> drivers/gpu/drm/tegra/fb.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c
> index 001cb77e2f59..0786159edef3 100644
> --- a/drivers/gpu/drm/tegra/fb.c
> +++ b/drivers/gpu/drm/tegra/fb.c
> @@ -224,12 +224,28 @@ struct drm_framebuffer *tegra_fb_create(struct
> drm_device *drm,
> }
>
> #ifdef CONFIG_DRM_FBDEV_EMULATION
> +static int tegra_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
> +{
> + struct drm_fb_helper *helper = info->par;
> + struct tegra_bo *bo;
> + int err;
> +
> + bo = tegra_fb_get_plane(helper->fb, 0);
> +
> + err = drm_gem_mmap_obj(&bo->gem, bo->gem.size, vma);
> + if (err < 0)
> + return err;
> +
> + return __tegra_gem_mmap(&bo->gem, vma);
> +}
> +
> static struct fb_ops tegra_fb_ops = {
> .owner = THIS_MODULE,
> DRM_FB_HELPER_DEFAULT_OPS,
> .fb_fillrect = drm_fb_helper_sys_fillrect,
> .fb_copyarea = drm_fb_helper_sys_copyarea,
> .fb_imageblit = drm_fb_helper_sys_imageblit,
> + .fb_mmap = tegra_fb_mmap,
> };
>
> static int tegra_fbdev_probe(struct drm_fb_helper *helper,
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/3] drm/tegra: fb: Implement ->fb_mmap() callback
[not found] ` <20180207174556.25401-3-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2018-02-08 0:52 ` Marcel Ziswiler
0 siblings, 0 replies; 5+ messages in thread
From: Marcel Ziswiler @ 2018-02-08 0:52 UTC (permalink / raw)
To: thierry.reding-Re5JQEeQqe8AvxtiuMwx3w
Cc: stefan-XLVq0VzYD2Y, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
On Wed, 2018-02-07 at 18:45 +0100, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
>
> This fixes hangs with legacy applications that use the mmap() syscall
> on
> the fbdev device to map framebuffer memory. The fbdev implementation
> for
> mmap() creates a mapping that conflicts with DRM usage and causes a
> hang
> when the memory is accessed through the mapping.
With that legacy Qt4e applications run just fine now on Apalis TK1
running Linux kernel 4.14.18.
Thanks, Thierry!
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reported-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
> drivers/gpu/drm/tegra/fb.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c
> index 001cb77e2f59..0786159edef3 100644
> --- a/drivers/gpu/drm/tegra/fb.c
> +++ b/drivers/gpu/drm/tegra/fb.c
> @@ -224,12 +224,28 @@ struct drm_framebuffer *tegra_fb_create(struct
> drm_device *drm,
> }
>
> #ifdef CONFIG_DRM_FBDEV_EMULATION
> +static int tegra_fb_mmap(struct fb_info *info, struct vm_area_struct
> *vma)
> +{
> + struct drm_fb_helper *helper = info->par;
> + struct tegra_bo *bo;
> + int err;
> +
> + bo = tegra_fb_get_plane(helper->fb, 0);
> +
> + err = drm_gem_mmap_obj(&bo->gem, bo->gem.size, vma);
> + if (err < 0)
> + return err;
> +
> + return __tegra_gem_mmap(&bo->gem, vma);
> +}
> +
> static struct fb_ops tegra_fb_ops = {
> .owner = THIS_MODULE,
> DRM_FB_HELPER_DEFAULT_OPS,
> .fb_fillrect = drm_fb_helper_sys_fillrect,
> .fb_copyarea = drm_fb_helper_sys_copyarea,
> .fb_imageblit = drm_fb_helper_sys_imageblit,
> + .fb_mmap = tegra_fb_mmap,
> };
>
> static int tegra_fbdev_probe(struct drm_fb_helper *helper,
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-02-08 0:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-07 17:45 [PATCH 1/3] drm/tegra: gem: Reshuffle declarations Thierry Reding
[not found] ` <20180207174556.25401-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-02-07 17:45 ` [PATCH 2/3] drm/tegra: gem: Make __tegra_gem_mmap() available more widely Thierry Reding
2018-02-07 17:45 ` [PATCH 3/3] drm/tegra: fb: Implement ->fb_mmap() callback Thierry Reding
2018-02-07 19:24 ` stefan
[not found] ` <20180207174556.25401-3-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-02-08 0:52 ` Marcel Ziswiler
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.