From: Rob Clark <rob.clark@linaro.org>
To: dri-devel@lists.freedesktop.org, linux-omap@vger.kernel.org
Cc: patches@linaro.org, Greg KH <greg@kroah.com>,
Tomi Valkeinen <tomi.valkeinen@ti.com>,
Andy Gross <andy.gross@ti.com>, Rob Clark <rob@ti.com>
Subject: [PATCH 03/10] staging: drm/omap: call omap_gem_roll() in non-atomic ctx
Date: Mon, 5 Mar 2012 10:48:33 -0600 [thread overview]
Message-ID: <1330966120-28582-4-git-send-email-rob.clark@linaro.org> (raw)
In-Reply-To: <1330966120-28582-1-git-send-email-rob.clark@linaro.org>
From: Rob Clark <rob@ti.com>
If fbcon calls us from atomic context, push the work off to the
workqueue to avoid calling into the gem/dmm code in an atomic
context.
Signed-off-by: Rob Clark <rob@ti.com>
---
drivers/staging/omapdrm/omap_fbdev.c | 26 ++++++++++++++++++++++----
drivers/staging/omapdrm/omap_gem.c | 14 ++------------
2 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/drivers/staging/omapdrm/omap_fbdev.c b/drivers/staging/omapdrm/omap_fbdev.c
index 96940bb..11acd4c 100644
--- a/drivers/staging/omapdrm/omap_fbdev.c
+++ b/drivers/staging/omapdrm/omap_fbdev.c
@@ -37,6 +37,9 @@ struct omap_fbdev {
struct drm_framebuffer *fb;
struct drm_gem_object *bo;
bool ywrap_enabled;
+
+ /* for deferred dmm roll when getting called in atomic ctx */
+ struct work_struct work;
};
static void omap_fbdev_flush(struct fb_info *fbi, int x, int y, int w, int h);
@@ -75,12 +78,22 @@ static void omap_fbdev_imageblit(struct fb_info *fbi,
image->width, image->height);
}
+static void pan_worker(struct work_struct *work)
+{
+ struct omap_fbdev *fbdev = container_of(work, struct omap_fbdev, work);
+ struct fb_info *fbi = fbdev->base.fbdev;
+ int npages;
+
+ /* DMM roll shifts in 4K pages: */
+ npages = fbi->fix.line_length >> PAGE_SHIFT;
+ omap_gem_roll(fbdev->bo, fbi->var.yoffset * npages);
+}
+
static int omap_fbdev_pan_display(struct fb_var_screeninfo *var,
struct fb_info *fbi)
{
struct drm_fb_helper *helper = get_fb(fbi);
struct omap_fbdev *fbdev = to_omap_fbdev(helper);
- int npages;
if (!helper)
goto fallback;
@@ -88,9 +101,12 @@ static int omap_fbdev_pan_display(struct fb_var_screeninfo *var,
if (!fbdev->ywrap_enabled)
goto fallback;
- /* DMM roll shifts in 4K pages: */
- npages = fbi->fix.line_length >> PAGE_SHIFT;
- omap_gem_roll(fbdev->bo, var->yoffset * npages);
+ if (drm_can_sleep()) {
+ pan_worker(&fbdev->work);
+ } else {
+ struct omap_drm_private *priv = helper->dev->dev_private;
+ queue_work(priv->wq, &fbdev->work);
+ }
return 0;
@@ -336,6 +352,8 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev)
goto fail;
}
+ INIT_WORK(&fbdev->work, pan_worker);
+
helper = &fbdev->base;
helper->funcs = &omap_fb_helper_funcs;
diff --git a/drivers/staging/omapdrm/omap_gem.c b/drivers/staging/omapdrm/omap_gem.c
index b7d6f88..bd35520 100644
--- a/drivers/staging/omapdrm/omap_gem.c
+++ b/drivers/staging/omapdrm/omap_gem.c
@@ -566,6 +566,8 @@ fail:
/* Set scrolling position. This allows us to implement fast scrolling
* for console.
+ *
+ * Call only from non-atomic contexts.
*/
int omap_gem_roll(struct drm_gem_object *obj, uint32_t roll)
{
@@ -580,18 +582,6 @@ int omap_gem_roll(struct drm_gem_object *obj, uint32_t roll)
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 */
--
1.7.5.4
next prev parent reply other threads:[~2012-03-05 16:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-05 16:48 [PATCH 00/10] omapdrm patches for 3.4 Rob Clark
2012-03-05 16:48 ` [PATCH 01/10] staging: drm/omap: get supported color formats from ovl Rob Clark
2012-03-05 16:48 ` [PATCH 02/10] staging: drm/omap: add a workqueue Rob Clark
2012-03-05 16:48 ` Rob Clark [this message]
2012-03-05 16:48 ` [PATCH 04/10] staging: drm/omap: some minor fb cleanups Rob Clark
2012-03-05 16:48 ` [PATCH 05/10] staging: drm/omap: defer unpin until scanout completes Rob Clark
2012-03-05 16:48 ` [PATCH 06/10] staging: drm/omap: debugfs for object and fb tracking Rob Clark
2012-03-05 16:48 ` [PATCH 07/10] staging: drm/omap: Disable DMM debugfs for OMAP3 Rob Clark
2012-03-05 16:48 ` [PATCH 08/10] staging: drm/omap: Validate debugfs device Rob Clark
2012-03-05 16:48 ` [PATCH 09/10] staging: drm/omap: Get DMM resources from hwmod Rob Clark
2012-03-05 16:48 ` [PATCH 10/10] staging: drm/omap: mmap of tiled buffers with stride >4kb Rob Clark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1330966120-28582-4-git-send-email-rob.clark@linaro.org \
--to=rob.clark@linaro.org \
--cc=andy.gross@ti.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=greg@kroah.com \
--cc=linux-omap@vger.kernel.org \
--cc=patches@linaro.org \
--cc=rob@ti.com \
--cc=tomi.valkeinen@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).