summaryrefslogtreecommitdiff
path: root/linux-core/drm_crtc.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2007-04-12 08:45:40 +1000
committerDave Airlie <airlied@linux.ie>2007-04-12 08:45:40 +1000
commita81558d8b3ee17fbf46e32b10732e22fcd997858 (patch)
tree95ea4879c442e38a316d3aa92fd821b8e545d2cc /linux-core/drm_crtc.c
parent9d7160c43a7475b9d2ab06c5c353acb9456efa12 (diff)
add getfb ioctl
Diffstat (limited to 'linux-core/drm_crtc.c')
-rw-r--r--linux-core/drm_crtc.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c
index b349527d..d1f3c077 100644
--- a/linux-core/drm_crtc.c
+++ b/linux-core/drm_crtc.c
@@ -1058,3 +1058,33 @@ int drm_mode_rmfb(struct inode *inode, struct file *filp,
return 0;
}
+int drm_mode_getfb(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->head->dev;
+ struct drm_mode_fb_cmd __user *argp = (void __user *)arg;
+ struct drm_mode_fb_cmd r;
+ struct drm_framebuffer *fb;
+
+ if (copy_from_user(&r, argp, sizeof(r)))
+ return -EFAULT;
+
+ fb = idr_find(&dev->mode_config.crtc_idr, r.buffer_id);
+ if (!fb || (r.buffer_id != fb->id)) {
+ DRM_ERROR("invalid framebuffer id\n");
+ return -EINVAL;
+ }
+
+ r.height = fb->height;
+ r.width = fb->width;
+ r.depth = fb->depth;
+ r.bpp = fb->bits_per_pixel;
+ r.handle = fb->bo->base.hash.key;
+ r.pitch = fb->pitch;
+
+ if (copy_to_user(argp, &r, sizeof(r)))
+ return -EFAULT;
+
+ return 0;
+}