From: Thomas Zimmermann <tzimmermann@suse.de>
To: airlied@linux.ie, daniel@ffwll.ch, b.zolnierkie@samsung.com
Cc: linux-fbdev@vger.kernel.org,
Thomas Zimmermann <tzimmermann@suse.de>,
dri-devel@lists.freedesktop.org
Subject: [PATCH 04/11] drm/fbdevdrm: Add file operations
Date: Tue, 26 Mar 2019 09:17:37 +0000 [thread overview]
Message-ID: <20190326091744.11542-5-tzimmermann@suse.de> (raw)
In-Reply-To: <20190326091744.11542-1-tzimmermann@suse.de>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/fbdevdrm/fbdevdrm_drv.c | 29 ++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/fbdevdrm/fbdevdrm_drv.c b/drivers/gpu/drm/fbdevdrm/fbdevdrm_drv.c
index 5be902094dc6..4a6ba6c85c5c 100644
--- a/drivers/gpu/drm/fbdevdrm/fbdevdrm_drv.c
+++ b/drivers/gpu/drm/fbdevdrm/fbdevdrm_drv.c
@@ -11,6 +11,8 @@
*/
#include <drm/drm_drv.h>
+#include <drm/drm_file.h>
+#include <drm/drm_ioctl.h>
#include <drm/drm_print.h>
#include <linux/console.h> /* for console_{un/lock}() */
#include <linux/fb.h>
@@ -38,6 +40,30 @@
* DRM driver
*/
+static int driver_fops_mmap(struct file *filp, struct vm_area_struct *vma)
+{
+ struct drm_file *file_priv = filp->private_data;
+ struct fbdevdrm_device *fdev = file_priv->minor->dev->dev_private;
+
+ if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
+ return -EINVAL;
+
+ return ttm_bo_mmap(filp, vma, &fdev->ttm.bdev);
+}
+
+static const struct file_operations driver_fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .unlocked_ioctl = drm_ioctl,
+ .mmap = driver_fops_mmap,
+ .poll = drm_poll,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = drm_compat_ioctl,
+#endif
+ .read = drm_read
+};
+
static struct drm_driver fbdevdrm_drv = {
/* data fields */
.major = DRIVER_MAJOR,
@@ -45,7 +71,8 @@ static struct drm_driver fbdevdrm_drv = {
.patchlevel = DRIVER_PATCHLEVEL,
.name = DRIVER_NAME,
.desc = DRIVER_DESCRIPTION,
- .date = DRIVER_DATE
+ .date = DRIVER_DATE,
+ .fops = &driver_fops
};
/* Device list */
--
2.21.0
next prev parent reply other threads:[~2019-03-26 9:17 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-26 9:17 [RFC][PATCH 00/11] DRM driver for fbdev devices Thomas Zimmermann
2019-03-26 9:17 ` [PATCH 01/11] drm/fbdevdrm: Add driver skeleton Thomas Zimmermann
2019-03-26 9:17 ` [PATCH 02/11] drm/fbdevdrm: Add fbdevdrm device Thomas Zimmermann
2019-03-26 16:03 ` Adam Jackson
2019-03-27 7:55 ` Thomas Zimmermann
2019-03-27 8:03 ` Daniel Vetter
2019-03-26 9:17 ` [PATCH 03/11] drm/fbdevdrm: Add memory management Thomas Zimmermann
2019-03-26 9:17 ` Thomas Zimmermann [this message]
2019-03-26 9:17 ` [PATCH 05/11] drm/fbdevdrm: Add GEM and dumb interfaces Thomas Zimmermann
2019-03-26 9:17 ` [PATCH 06/11] drm/fbdevdrm: Add modesetting infrastructure Thomas Zimmermann
2019-03-26 9:17 ` [PATCH 07/11] drm/fbdevdrm: Add DRM <-> fbdev pixel-format conversion Thomas Zimmermann
2019-03-26 16:29 ` Ville Syrjälä
2019-03-27 8:28 ` Thomas Zimmermann
2019-03-27 10:00 ` Ville Syrjälä
2019-03-26 9:17 ` [PATCH 08/11] drm/fbdevdrm: Add mode conversion DRM <-> fbdev Thomas Zimmermann
2019-03-26 9:17 ` [PATCH 09/11] drm/fbdevdrm: Add primary plane Thomas Zimmermann
2019-03-26 13:33 ` Mathieu Malaterre
2019-03-26 13:57 ` Thomas Zimmermann
2019-03-27 9:37 ` Thomas Zimmermann
2019-04-02 7:08 ` Mathieu Malaterre
2019-03-26 9:17 ` [PATCH 10/11] drm/fbdevdrm: Add CRTC Thomas Zimmermann
2019-03-26 9:17 ` [PATCH 11/11] drm/fbdevdrm: Detect and validate display modes Thomas Zimmermann
2019-03-26 16:47 ` Ville Syrjälä
2019-03-26 18:20 ` Daniel Vetter
2019-03-27 8:31 ` Thomas Zimmermann
2019-03-26 14:53 ` [RFC][PATCH 00/11] DRM driver for fbdev devices Daniel Vetter
2019-03-27 9:10 ` Thomas Zimmermann
2019-03-27 9:41 ` Daniel Vetter
2019-03-27 9:55 ` Michel Dänzer
2019-03-27 10:58 ` Daniel Vetter
2019-03-27 14:46 ` Thomas Zimmermann
2019-03-27 17:05 ` Daniel Vetter
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=20190326091744.11542-5-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@linux.ie \
--cc=b.zolnierkie@samsung.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-fbdev@vger.kernel.org \
/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).