drm/omap: add ywrap module param
PATCH 1/3 drm/omap: add ywrap module param
From: Rob Clark <[email protected]>
Can be set at boot or module load time to prevent YWRAP scrolling from being enabled.
--- drivers/staging/omapdrm/omap_fbdev.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-)
drivers/staging/omapdrm/omap_fbdev.c +10 -5
@@ -22,6 +22,10 @@#include "drm_crtc.h" #include "drm_fb_helper.h" +MODULE_PARM_DESC (ywrap,"Enable ywrap scrolling (omap44xx and later, default 'y')" ); +static bool ywrap_enabled = true; +module_param_named (ywrap, ywrap_enabled, bool,0644 ); +/* * fbdev funcs, to implement legacy fbdev interface on top of drm driver */
@@ -32,6 +36,7 @@ struct omap_fbdev {struct drm_fb_helper base;struct drm_framebuffer *fb;struct drm_gem_object *bo; +bool ywrap_enabled; };static void omap_fbdev_flush (struct fb_info *fbi,int x,int y,int w,int h);
@@ -75,14 +80,12 @@ static int omap_fbdev_pan_display(struct fb_var_screeninfo *var, {struct drm_fb_helper *helper =get_fb (fbi);struct omap_fbdev *fbdev =to_omap_fbdev (helper); -struct omap_drm_private *priv;int npages;if (!helper) goto fallback; - priv = helper->dev->dev_private; -if (!priv->has_dmm) +if (!fbdev->ywrap_enabled) goto fallback;/* DMM roll shifts in 4K pages: */
@@ -152,7 +155,8 @@ static int omap_fbdev_create(struct drm_fb_helper *helper, mode_cmd.width * ((mode_cmd.bpp +7 ) /8 ), mode_cmd.width, mode_cmd.bpp); -if (priv->has_dmm) { + fbdev->ywrap_enabled = priv->has_dmm && ywrap_enabled; +if (fbdev->ywrap_enabled) {/* need to align pitch to page size if using DMM scrolling */ mode_cmd.pitch =ALIGN (mode_cmd.pitch,PAGE_SIZE ); }
@@ -218,12 +222,13 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,/* if we have DMM, then we can use it for scrolling by just * shuffling pages around in DMM rather than doing sw blit. */ -if (priv->has_dmm) { +if (fbdev->ywrap_enabled) {DRM_INFO ("Enabling DMM ywrap scrolling\n" ); fbi->flags |=FBINFO_HWACCEL_YWRAP |FBINFO_READS_FAST ; fbi->fix.ywrapstep =1 ; } +DBG ("par=%p, %dx%d" , fbi->par, fbi->var.xres, fbi->var.yres);DBG ("allocated %dx%d fb" , fbdev->fb->width, fbdev->fb->height);
Signature · 1 line
1.7.5.4
PATCH 2/3 drm/omap: avoid aquiring mutex in atomic context
From: Rob Clark <[email protected]>
omap_gem_roll() could be called by fbcon in atomic context. Avoid aquiring mutex, or calling tiler_pin() (which itself is not safe for atomic context) in these cases.
--- drivers/staging/omapdrm/omap_gem.c | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-)
drivers/staging/omapdrm/omap_gem.c +14 -2
@@ -538,10 +538,22 @@ int omap_gem_roll(struct drm_gem_object *obj, uint32_t roll)return -EINVAL ; } -mutex_lock (&obj->dev->struct_mutex); - omap_obj->roll = roll; +if (in_atomic ()) { +/* this can get called from fbcon in atomic context.. so +* just ignore it and wait for next time called from +* interruptible context to update the PAT.. the result +* may be that user sees wrap-around instead of scrolling +* momentarily on the screen. If we wanted to be fancier +* we could perhaps schedule some workqueue work at this +* point. +*/ +return 0 ; + } + +mutex_lock (&obj->dev->struct_mutex); +/* if we aren't mapped yet, we don't need to do anything */ if (omap_obj->block) {struct page **pages;
Signature · 1 line
1.7.5.4
Re: [PATCH 2/3] drm/omap: avoid aquiring mutex in atomic context
Quoted 16 lines · Rob Clark
From: Rob Clark <[email protected]>
omap_gem_roll()could be called by fbcon in atomic context. Avoid aquiring mutex, or callingtiler_pin()(which itself is not safe for atomic context) in these cases.Signed-off-by Rob Clark <[email protected]>---
drivers/staging/omapdrm/omap_gem.c | 16 ++++++++++++++--1 files changed, 14 insertions(+), 2 deletions(-)drivers/staging/omapdrm/omap_gem.c +0
-0
drivers/staging/omapdrm/omap_gem.c int omap_gem_roll(struct drm_gem_object *obj, uint32_t roll) · line 543
Quoted 8 lines
drivers/staging/omapdrm/omap_gem.c +1
-2@@ -538,10 +538,22 @@ int omap_gem_roll(struct drm_gem_object *obj, uint32_t roll) return -EINVAL; } - mutex_lock(&obj->dev->struct_mutex); - omap_obj->roll = roll; + if (in_atomic()) {
ugg, this isn't even sufficient if you have any debug printks that can be enabled within struct_mutex critical section..
updated patch coming
BR,
-R
Quoted 19 lines
drivers/staging/omapdrm/omap_gem.c +13
-1+ /* this can get called from fbcon in atomic context.. so + * just ignore it and wait for next time called from + * interruptible context to update the PAT.. the result + * may be that user sees wrap-around instead of scrolling + * momentarily on the screen. If we wanted to be fancier + * we could perhaps schedule some workqueue work at this + * point. + */ + return 0; + } + + mutex_lock(&obj->dev->struct_mutex); + /* if we aren't mapped yet, we don't need to do anything */ if (omap_obj->block) { struct page **pages; --1.7.5.4
PATCH 1/1 drm/omap: avoid aquiring mutex in atomic context (v2)
From: Rob Clark <[email protected]>
omap_gem_roll() could be called by fbcon in atomic context or when struct_mutext is held. Avoid aquiring mutex (deadlock), or calling tiler_pin() (which itself is not safe for atomic context) in these cases.
--- drivers/staging/omapdrm/omap_gem.c | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-)
drivers/staging/omapdrm/omap_gem.c +14 -2
@@ -538,10 +538,22 @@ int omap_gem_roll(struct drm_gem_object *obj, uint32_t roll)return -EINVAL ; } -mutex_lock (&obj->dev->struct_mutex); - omap_obj->roll = roll; +if (in_atomic () ||mutex_is_locked (&obj->dev->struct_mutex)) { +/* this can get called from fbcon in atomic context.. so +* just ignore it and wait for next time called from +* interruptible context to update the PAT.. the result +* may be that user sees wrap-around instead of scrolling +* momentarily on the screen. If we wanted to be fancier +* we could perhaps schedule some workqueue work at this +* point. +*/ +return 0 ; + } + +mutex_lock (&obj->dev->struct_mutex); +/* if we aren't mapped yet, we don't need to do anything */ if (omap_obj->block) {struct page **pages;
Signature · 1 line
1.7.5.4
Re: [PATCH] drm/omap: avoid aquiring mutex in atomic context (v2)
Quoted 9 lines · Rob Clark
drivers/staging/omapdrm/omap_gem.c +0
-2@@ -538,10 +538,22 @@ int omap_gem_roll(struct drm_gem_object *obj, uint32_t roll) return -EINVAL; } - mutex_lock(&obj->dev->struct_mutex); - omap_obj->roll = roll;
drivers/staging/omapdrm/omap_gem.c int omap_gem_roll(struct drm_gem_object *obj, uint32_t roll) · line 551
Quoted 10 lines
drivers/staging/omapdrm/omap_gem.c +9
-0+ if (in_atomic() || mutex_is_locked(&obj->dev->struct_mutex)) { + /* this can get called from fbcon in atomic context.. so +* just ignore it and wait for next time called from +* interruptible context to update the PAT.. the result +* may be that user sees wrap-around instead of scrolling +* momentarily on the screen. If we wanted to be fancier +* we could perhaps schedule some workqueue work at this +* point. +*/
Multi-line comments are supposed to be of the form:
/*
* Foo.
*/
drivers/staging/omapdrm/omap_gem.c int omap_gem_roll(struct drm_gem_object *obj, uint32_t roll)
Quoted 9 lines
drivers/staging/omapdrm/omap_gem.c +5
-1+ return 0; + } + + mutex_lock(&obj->dev->struct_mutex); + /* if we aren't mapped yet, we don't need to do anything */ if (omap_obj->block) { struct page **pages; --
Cheers.
Signature · 5 lines
Felipe Contreras _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/3 drm/omap: add debugfs support
In reply to Rob ClarkFrom: Andy Gross <[email protected]>
Right now just a tiler_map file to dump a 2d map of which areas in tiler/dmm have pinned buffers (or reservations). In the future more could be added.
--- drivers/staging/omapdrm/Makefile | 1 + drivers/staging/omapdrm/omap_debugfs.c | 42 +++++++++ drivers/staging/omapdrm/omap_dmm_tiler.c | 149 ++++++++++++++++++++++++++++++ drivers/staging/omapdrm/omap_dmm_tiler.h | 4 + drivers/staging/omapdrm/omap_drv.c | 4 + drivers/staging/omapdrm/omap_drv.h | 5 + 6 files changed, 205 insertions(+), 0 deletions(-) create mode 100644 drivers/staging/omapdrm/omap_debugfs.c
drivers/staging/omapdrm/Makefile +1 -0
@@ -5,6 +5,7 @@ ccflags-y := -Iinclude/drm -Werror omapdrm-y := omap_drv.o \ + omap_debugfs.o \ omap_crtc.o \ omap_encoder.o \ omap_connector.o \
drivers/staging/omapdrm/omap_debugfs.c new file +42 -0
42 lines not on this page · raw message
drivers/staging/omapdrm/omap_dmm_tiler.c +149 -0
152 lines not on this page · raw message
drivers/staging/omapdrm/omap_dmm_tiler.h +4 -0
@@ -76,6 +76,10 @@ struct tiler_block {int omap_dmm_init (struct drm_device *dev);int omap_dmm_remove (void ); +#ifdef CONFIG_DEBUG_FS +int tiler_map_show (struct seq_file *s,void *arg); +#endif +/* pin/unpin */ int tiler_pin (struct tiler_block *block,struct page **pages,uint32_t npages,uint32_t roll,bool wait);
drivers/staging/omapdrm/omap_drv.c +4 -0
@@ -726,6 +726,10 @@ static struct drm_driver omap_drm_driver = { .irq_uninstall = dev_irq_uninstall, .irq_handler = dev_irq_handler, .reclaim_buffers = drm_core_reclaim_buffers, +#ifdef CONFIG_DEBUG_FS + .debugfs_init = omap_debugfs_init, + .debugfs_cleanup = omap_debugfs_cleanup, +#endif .gem_init_object = omap_gem_init_object, .gem_free_object = omap_gem_free_object, .gem_vm_ops = &omap_gem_vm_ops,
drivers/staging/omapdrm/omap_drv.h +5 -0
@@ -51,6 +51,11 @@ struct omap_drm_private {bool has_dmm; }; +#ifdef CONFIG_DEBUG_FS +int omap_debugfs_init (struct drm_minor *minor); +void omap_debugfs_cleanup (struct drm_minor *minor); +#endif +struct drm_fb_helper *omap_fbdev_init (struct drm_device *dev);void omap_fbdev_free (struct drm_device *dev);
Signature · 1 line
1.7.5.4