From: "Noralf Trønnes" <noralf@tronnes.org>
To: dri-devel@lists.freedesktop.org
Cc: daniel.vetter@ffwll.ch, intel-gfx@lists.freedesktop.org,
laurent.pinchart@ideasonboard.com
Subject: [RFC v3 08/12] drm/framebuffer: Add drm_mode_can_dirtyfb()
Date: Thu, 22 Feb 2018 21:06:49 +0100 [thread overview]
Message-ID: <20180222200653.19453-9-noralf@tronnes.org> (raw)
In-Reply-To: <20180222200653.19453-1-noralf@tronnes.org>
Add a function so the generic fbdev client can check if the framebuffer
does flushing. This is needed to set up deferred I/O.
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
drivers/gpu/drm/drm_framebuffer.c | 31 +++++++++++++++++++++++++++++++
include/drm/drm_framebuffer.h | 2 ++
2 files changed, 33 insertions(+)
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index ad8f7d308656..a659cff45844 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -600,6 +600,37 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
return drm_mode_dirtyfb(dev, data, file_priv, true);
}
+/**
+ * drm_mode_can_dirtyfb - check if the FB does flushing
+ * @dev: drm device
+ * @fb_id: Framebuffer id
+ * @file_priv: drm file
+ *
+ * Returns:
+ * True if the framebuffer does flushing, false otherwise.
+ */
+bool drm_mode_can_dirtyfb(struct drm_device *dev, u32 fb_id,
+ struct drm_file *file_priv)
+{
+ struct drm_framebuffer *fb;
+ bool ret = false;
+
+ if (!drm_core_check_feature(dev, DRIVER_MODESET))
+ return false;
+
+ fb = drm_framebuffer_lookup(dev, file_priv, fb_id);
+ if (!fb)
+ return false;
+
+ if (fb->funcs->dirty)
+ ret = true;
+
+ drm_framebuffer_put(fb);
+
+ return ret;
+}
+EXPORT_SYMBOL(drm_mode_can_dirtyfb);
+
/**
* drm_fb_release - remove and free the FBs on this file
* @priv: drm file for the ioctl
diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h
index c50502c656e5..05d170f4e215 100644
--- a/include/drm/drm_framebuffer.h
+++ b/include/drm/drm_framebuffer.h
@@ -216,6 +216,8 @@ struct drm_framebuffer *drm_framebuffer_lookup(struct drm_device *dev,
void drm_framebuffer_remove(struct drm_framebuffer *fb);
void drm_framebuffer_cleanup(struct drm_framebuffer *fb);
void drm_framebuffer_unregister_private(struct drm_framebuffer *fb);
+bool drm_mode_can_dirtyfb(struct drm_device *dev, u32 fb_id,
+ struct drm_file *file_priv);
/**
* drm_framebuffer_get - acquire a framebuffer reference
--
2.15.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-02-22 20:06 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-22 20:06 [RFC v3 00/12] drm: Add generic fbdev emulation Noralf Trønnes
2018-02-22 20:06 ` [RFC v3 01/12] drm: provide management functions for drm_file Noralf Trønnes
2018-02-22 20:06 ` [RFC v3 02/12] drm/file: Don't set master on in-kernel clients Noralf Trønnes
2018-03-06 8:28 ` Daniel Vetter
2018-02-22 20:06 ` [RFC v3 03/12] drm: Make ioctls available for in-kernel clients part 1 Noralf Trønnes
2018-02-22 20:06 ` [RFC v3 04/12] drm: Make ioctls available for in-kernel clients part 2 Noralf Trønnes
2018-03-06 8:41 ` Daniel Vetter
2018-02-22 20:06 ` [RFC v3 05/12] drm: Add _ioctl suffix to some functions Noralf Trønnes
2018-02-22 20:06 ` [RFC v3 06/12] drm: Add DRM device iterator Noralf Trønnes
2018-02-22 20:06 ` [RFC v3 07/12] drm/modes: Add drm_umode_equal() Noralf Trønnes
2018-03-06 8:42 ` Daniel Vetter
2018-02-22 20:06 ` Noralf Trønnes [this message]
2018-03-06 8:45 ` [RFC v3 08/12] drm/framebuffer: Add drm_mode_can_dirtyfb() Daniel Vetter
2018-02-22 20:06 ` [RFC v3 09/12] drm: Add API for in-kernel clients Noralf Trønnes
2018-03-06 8:56 ` Daniel Vetter
2018-03-08 17:12 ` Noralf Trønnes
2018-03-12 16:51 ` Daniel Vetter
2018-03-12 20:21 ` Noralf Trønnes
2018-03-13 15:11 ` Daniel Vetter
2018-02-22 20:06 ` [RFC v3 10/12] drm/client: Add fbdev emulation client Noralf Trønnes
2018-03-06 9:06 ` Daniel Vetter
2018-02-22 20:06 ` [RFC v3 11/12] drm/client: Add bootsplash client Noralf Trønnes
2018-03-06 9:12 ` Daniel Vetter
2018-03-06 15:21 ` Max Staudt
2018-02-22 20:06 ` [RFC v3 12/12] drm/client: Add VT console client Noralf Trønnes
2018-02-22 21:03 ` ✗ Fi.CI.BAT: failure for drm: Add generic fbdev emulation (rev3) Patchwork
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=20180222200653.19453-9-noralf@tronnes.org \
--to=noralf@tronnes.org \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=laurent.pinchart@ideasonboard.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