Added kernel side ioctls of drm modesettings
From ee2bb161b7cb70b935ab626a7877bde40fedbb96 Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz <[EMAIL PROTECTED]>
Date: Tue, 20 Mar 2007 20:13:40 +0100
Subject: [PATCH] Added kernel side ioctls of drm modesettings
---
linux-core/Makefile.kernel | 2 -
linux-core/drmP.h | 1
linux-core/drm_drv.c | 14 +++++
linux-core/drm_mode.c | 131 ++++++++++++++++++++++++++++++++++++++++++++
linux-core/drm_mode.h | 61 ++++++++++++++++++++
5 files changed, 208 insertions(+), 1 deletions(-)
diff --git a/linux-core/Makefile.kernel b/linux-core/Makefile.kernel
index 81a9433..f42675a 100644
--- a/linux-core/Makefile.kernel
+++ b/linux-core/Makefile.kernel
@@ -13,7 +13,7 @@ drm-objs := drm_auth.o drm_bufs.o drm
drm_sysfs.o drm_pci.o drm_agpsupport.o drm_scatter.o \
drm_memory_debug.o ati_pcigart.o drm_sman.o \
drm_hashtab.o drm_mm.o drm_object.o drm_compat.o \
- drm_fence.o drm_ttm.o drm_bo.o drm_bo_move.o
+ drm_fence.o drm_ttm.o drm_bo.o drm_bo_move.o drm_mode.o
tdfx-objs := tdfx_drv.o
r128-objs := r128_drv.o r128_cce.o r128_state.o r128_irq.o
mga-objs := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 648e29b..37ce929 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -82,6 +82,7 @@ #define __OS_HAS_MTRR (defined(CONFIG_MT
#include "drm_os_linux.h"
#include "drm_hashtab.h"
+#include "drm_mode.h"
/* If you want the memory alloc debug functionality, change define below */
/* #define DEBUG_MEMORY */
diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c
index b95f796..2a4a24f 100644
--- a/linux-core/drm_drv.c
+++ b/linux-core/drm_drv.c
@@ -123,6 +123,20 @@ #endif
DRM_AUTH },
[DRM_IOCTL_NR(DRM_IOCTL_UPDATE_DRAW)] = {drm_update_drawable_info,
DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+
+ /* Drm modesetting */
+ [DRM_IOCTL_NR(DRM_IOCTL_MODE_GETRESOURCES)] = {drm_mode_getresources,
0},
+ [DRM_IOCTL_NR(DRM_IOCTL_MODE_GETFRAMEBUFFER)] = {drm_mode_getfb, 0},
+ [DRM_IOCTL_NR(DRM_IOCTL_MODE_SETFRAMEBUFFER)] = {drm_mode_setfb, 0},
+ [DRM_IOCTL_NR(DRM_IOCTL_MODE_GETCRTC)] = {drm_mode_getcrtc, 0},
+ [DRM_IOCTL_NR(DRM_IOCTL_MODE_SETCRTC)] = {drm_mode_setcrtc, 0},
+ [DRM_IOCTL_NR(DRM_IOCTL_MODE_GETCRTCGAMMA)] = {drm_mode_getcrtcgamma,
0},
+ [DRM_IOCTL_NR(DRM_IOCTL_MODE_SETCRTCGAMMA)] = {drm_mode_setcrtcgamma,
0},
+ [DRM_IOCTL_NR(DRM_IOCTL_MODE_GETOUTPUT)] = {drm_mode_getcrtc, 0},
+ [DRM_IOCTL_NR(DRM_IOCTL_MODE_NEWMODE)] = {drm_mode_newmode, 0},
+ [DRM_IOCTL_NR(DRM_IOCTL_MODE_DESMODE)] = {drm_mode_desmode, 0},
+ [DRM_IOCTL_NR(DRM_IOCTL_MODE_ADDMODE)] = {drm_mode_addmode, 0},
+ [DRM_IOCTL_NR(DRM_IOCTL_MODE_DELMODE)] = {drm_mode_delmode, 0},
};
#define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls )
diff --git a/linux-core/drm_mode.c b/linux-core/drm_mode.c
new file mode 100644
index 0000000..09c3183
--- /dev/null
+++ b/linux-core/drm_mode.c
@@ -0,0 +1,131 @@
+/*
+ * \file drm_mode.c
+ * DRM modesetting interface, kernel side.
+ *
+ * \author Jakob Bornecrantz <[EMAIL PROTECTED]>
+ *
+ * \par Acknowledgements:
+ * Feb 2007, Dave Airlie <[EMAIL PROTECTED]>
+ */
+
+/*
+ * Copyright (c) <year> <copyright holders>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include "drmP.h"
+
+int drm_mode_getresources(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
+{
+ // TODO impl
+ return 0;
+}
+
+/*
+ * FrameBuffer
+ */
+int drm_mode_getfb(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
+{
+ // TODO impl
+ return 0;
+}
+
+int drm_mode_setfb(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg)
+{
+ // TODO impl
+ return 0;
+}
+
+/*
+ * Crtc
+ */
+
+int drm_mode_getcrtc(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg)
+{
+ // TODO impl
+ return 0;
+}
+
+int drm_mode_setcrtc(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg)
+{
+ // TODO impl
+ return 0;
+}
+
+int drm_mode_getcrtcgamma(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg)
+{
+ // TODO impl
+ return 0;
+}
+
+int drm_mode_setcrtcgamma(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg)
+{
+ // TODO impl
+ return 0;
+}
+
+/*
+ * Output
+ */
+
+int drm_mode_getoutput(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg)
+{
+ // TODO impl
+ return 0;
+}
+
+int drm_mode_newmode(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg)
+{
+ // TODO impl
+ return 0;
+}
+
+int drm_mode_desmode(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg)
+{
+ // TODO impl
+ return 0;
+}
+
+
+int drm_mode_addmode(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg)
+{
+ // TODO impl
+ return 0;
+}
+
+int drm_mode_delmode(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg)
+{
+ // TODO impl
+ return 0;
+}
+
diff --git a/linux-core/drm_mode.h b/linux-core/drm_mode.h
new file mode 100644
index 0000000..b2f4c66
--- /dev/null
+++ b/linux-core/drm_mode.h
@@ -0,0 +1,61 @@
+/*
+ * \file drm_mode.h
+ * Header for DRM modesetting interface, kernel side.
+ *
+ * \author Jakob Bornecrantz <[EMAIL PROTECTED]>
+ *
+ * \par Acknowledgements:
+ * Feb 2007, Dave Airlie <[EMAIL PROTECTED]>
+ */
+
+/*
+ * Copyright (c) <year> <copyright holders>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+
+extern int drm_mode_getresources(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int drm_mode_getfb(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int drm_mode_setfb(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg);
+
+extern int drm_mode_getcrtc(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg);
+extern int drm_mode_setcrtc(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg);
+extern int drm_mode_getcrtcgamma(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg);
+extern int drm_mode_setcrtcgamma(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg);
+
+extern int drm_mode_getoutput(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg);
+
+extern int drm_mode_newmode(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg);
+extern int drm_mode_desmode(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg);
+extern int drm_mode_addmode(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg);
+extern int drm_mode_delmode(struct inode *inode, struct file *flip,
+ unsigned int cmd, unsigned long arg);
--
1.4.1
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel