summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-10-16radeon: add some new SI pci idsAlex Deucher
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2012-10-14initialize width/height fields in drmModeCrtcRob Clark
If we have valid timings, we can at least set width/height to *something*, which is I think at least less confusing than always seeing width/height of zero. At least modeprint and modetest seem to expect width/height to mean something. Signed-off-by: Rob Clark <rob@ti.com>
2012-10-09update gitignoreRob Clark
Signed-off-by: Rob Clark <rob@ti.com>
2012-10-09omap: release lock also on error pathsVincent Penquerc'h
Signed-off-by: Rob Clark <rob@ti.com>
2012-10-08configure.ac: Allow forcible disabling of Cairo supportDaniel Stone
We don't want to build libdrm tests with Cairo support under Poky, since they're never used and also cause a build loop from libdrm -> cairo -> mesa-dri -> libdrm. To avoid variance in build results, introduce a --disable-cairo-tests switch. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-10-07intel: Silence a trivial compiler warningChris Wilson
intel_bufmgr_gem.c: In function 'drm_intel_bo_gem_export_to_prime': intel_bufmgr_gem.c:2477:6: warning: unused variable 'ret' [-Wunused-variable] Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-10-07intel: Correct the word decoding for gen2 3DSTATE_LOAD_STATE_IMMEDIATE_1Chris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-10-07intel: Fix "properly test for HAS_LLC"Chris Wilson
commit 92fd0ce4f659d7b0680543e9e5b96a3c7737a5f3 Author: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Fri Aug 31 11:16:53 2012 +0200 intel: properly test for HAS_LLC missed slightly and in effect had no effect on the outcome of checking whether the kernel/chipset supported LLC. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-10-06radeon: fix stencil miptree allocation of combined ZS buffers on EG and SIMarek Olšák
This allows texturing with depth-stencil buffers directly without the copy to CB. The separate miptree description for stencil is added, because the stencil mipmap offsets are not really depth offsets/4 (at least for the texture units). Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2012-10-06radeon: don't force stencil tile split to 0Marek Olšák
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2012-10-03radeon: don't take the stencil-specific codepath for buffers without stencilMarek Olšák
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2012-09-17libdrm: man page infrastructure and a few sample man pagesJesse Barnes
2012-09-14intel: Mark bo's exported to prime as not reusableKristian Høgsberg
It's the same situation as flink and we need take the same precautions. Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
2012-09-13intel: add support for ValleyViewJesse Barnes
Just some PCI ID stuff to enable the right features.
2012-09-08libkms: link against libdrmMarcin Slusarz
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
2012-09-06radeon: Sampling pitch for non-mipmaps seems padded to slice alignment on SI.Michel Dänzer
Another corner case that isn't well-explained yet. Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com>
2012-09-06radeon: Memory footprint of SI mipmap base level is padded to powers of two.Michel Dänzer
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com>
2012-09-05radeon: Fix layout of linear aligned mipmaps on SI.Michel Dänzer
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com>
2012-09-01intel: properly test for HAS_LLCDaniel Vetter
If the kernel supports the test, we need to check the param. Copy&pasta from the above checks that only look at the return value. Interesting how much one can get such a simple interface wrong. Issue created in commit 151cdcfe685ee280a4344dfc40e6087d74a5590f Author: Eugeni Dodonov <eugeni.dodonov@intel.com> Date: Tue Jan 17 15:20:19 2012 -0200 intel: query for LLC support Patch even claims to have fixed this in v2, but is actually unchanged from v1. Reported-by: Xiang, Haihao <haihao.xiang@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-08-24vmwgfx: No longer experimentalJakob Bornecrantz
And hasn't been in a long while. Reviewed-by: Zack Rusin <zackr@vmware.com> Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
2012-08-24configure: bump version for 2.4.39 releaseMarek Olšák
2012-08-24radeon: align r600 msaa buffers to a multiple of macrotile size * num samplesMarek Olšák
I am not sure whether this is needed, but better be safe than sorry.
2012-08-24radeon: fix allocation of MSAA surfaces on r600-r700Marek Olšák
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
2012-08-23omap: include omap_drm.h independentlyVíctor Manuel Jáquez Leal
omap_drm.h uses data type defined in stdint.h, but that header was not included. omap_drm.h includes drm.h as a local file when it is part of the compiler c flags. This two issues are fixed. New code can include omap_drm.h alone. Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com> Signed-off-by: Rob Clark <rob@ti.com>
2012-08-14radeon: add prime import/export supportDave Airlie
this adds radeon version of the prime import/export support. Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-08-12intel: Use VG_CLEAR on the context destroy ioctl as well.Kenneth Graunke
Otherwise pad appears uninitialized and valgrind grumbles. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net>
2012-08-12tests/modetest: Add a forgotten return, needed for opensuse buildserviceTobias Klausmann
Signed-off-by: Marek Olšák <maraeo@gmail.com>
2012-08-11configure: bump version for 2.4.38 releaseMarek Olšák
2012-08-11tests/modetest: fix distcheckMarek Olšák
2012-08-10intel: Add a function for the new register read ioctl.Eric Anholt
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
2012-08-10intel: Import updated i915_drm.h.Eric Anholt
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
2012-08-10Drop "-Wunsafe-loop-optimizations".Eric Anholt
It warns about totally sensible things done in intel_decode.c. I've never seen this warn do anything useful, and apparently I was the one to introduce it when I added the giant pile of warning flags back in 2008. Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
2012-08-09radeon: tweak TILE_SPLIT for MSAA surfacesMarek Olšák
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
2012-08-09radeon: force 2D tiling for MSAA surfacesMarek Olšák
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
2012-08-09radeon: optimize allocation for depth w/o stencil and stencil w/o depth on EGMarek Olšák
If we don't need stencil, don't allocate it. If we need only stencil (like PIPE_FORMAT_S8_UINT), don't allocate depth. v2: actually do it correctly Reviewed-by: Christian König <christian.koenig@amd.com>
2012-08-09radeon: simplify ZS buffer checking on r600Marek Olšák
Setting those flags has no effect anywhere else. Reviewed-by: Christian König <christian.koenig@amd.com>
2012-08-08intel: add more Haswell PCI IDsPaulo Zanoni
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
2012-08-08intel: Bail gracefully if we encounter an unknown Intel deviceChris Wilson
Otherwise we end up with X hitting a fail-loop as the embedded libGL stacks asserts whilst initialising. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-08-06radeon: add some new SI pci idsAlex Deucher
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2012-08-06radeon: add some missing evergreen pci idsAlex Deucher
Noticed by: Harald van Dijk <fdo@gigawatt.nl> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=53124 Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2012-08-02intel: Quiet valgrind warnings in context creation.Eric Anholt
2012-08-02intel: Remove two unused variablesDamien Lespiau
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2012-07-23modetest: fix uninitialized fourccRob Clark
If color format for CRTC layer is not specified on commandline, then c->fourcc is unintialized resulting in addfb call failing. Signed-off-by: Rob Clark <rob@ti.com>
2012-07-20modeset: Split buffer allocation to a separate fileLaurent Pinchart
As the modeset test application is often referred to as an example of the KMS API usage, move test pattern generation and buffer allocation to a separate file to keep it simple and clear. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2012-07-20modetest: Make frame buffer format configurable on the command lineLaurent Pinchart
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2012-07-20modetest: Move connector and plane parsing to separate functionsLaurent Pinchart
This will make it easier to add additional parameters to the connector and plane arguments. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2012-07-20modetest: Add test pattern support for missing RGB formatsLaurent Pinchart
Implement tiles and SMPTE test pattern generation for the RGB565, BGR888, RGB888, ARGB8888, BGRA8888 and BGRX8888 formats. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2012-07-20modetest: Add test pattern support for missing planar YUV formatsLaurent Pinchart
Implement tiles and SMPTE test pattern generation for the NV12, NV21, NV16 and NV61 formats. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2012-07-20modetest: Add test pattern support for missing packed YUV formatsLaurent Pinchart
Implement tiles and SMPTE test pattern generation for the UYVY, VYUY and YVYU formats. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2012-07-20modetest: Add SMPTE test patternLaurent Pinchart
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
id='n745' href='#n745'>745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347
/* drm_drv.h -- Generic driver template -*- linux-c -*-
 * Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com
 *
 * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
 * All Rights Reserved.
 *
 * 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 (including the next
 * paragraph) 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
 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS 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.
 *
 * Authors:
 *    Rickard E. (Rik) Faith <faith@valinux.com>
 *    Gareth Hughes <gareth@valinux.com>
 *
 * $FreeBSD: src/sys/dev/drm/drm_drv.h,v 1.12 2003/03/09 02:08:28 anholt Exp $
 */

/*
 * To use this template, you must at least define the following (samples
 * given for the MGA driver):
 *
 * #define DRIVER_AUTHOR	"VA Linux Systems, Inc."
 *
 * #define DRIVER_NAME		"mga"
 * #define DRIVER_DESC		"Matrox G200/G400"
 * #define DRIVER_DATE		"20001127"
 *
 * #define DRIVER_MAJOR		2
 * #define DRIVER_MINOR		0
 * #define DRIVER_PATCHLEVEL	2
 *
 * #define DRIVER_IOCTL_COUNT	DRM_ARRAY_SIZE( mga_ioctls )
 *
 * #define DRM(x)		mga_##x
 */

#ifndef __MUST_HAVE_AGP
#define __MUST_HAVE_AGP			0
#endif
#ifndef __HAVE_CTX_BITMAP
#define __HAVE_CTX_BITMAP		0
#endif
#ifndef __HAVE_DMA_IRQ
#define __HAVE_DMA_IRQ			0
#endif
#ifndef __HAVE_DMA_QUEUE
#define __HAVE_DMA_QUEUE		0
#endif
#ifndef __HAVE_MULTIPLE_DMA_QUEUES
#define __HAVE_MULTIPLE_DMA_QUEUES	0
#endif
#ifndef __HAVE_DMA_SCHEDULE
#define __HAVE_DMA_SCHEDULE		0
#endif
#ifndef __HAVE_DMA_FLUSH
#define __HAVE_DMA_FLUSH		0
#endif
#ifndef __HAVE_DMA_READY
#define __HAVE_DMA_READY		0
#endif
#ifndef __HAVE_DMA_QUIESCENT
#define __HAVE_DMA_QUIESCENT		0
#endif
#ifndef __HAVE_RELEASE
#define __HAVE_RELEASE			0
#endif
#ifndef __HAVE_COUNTERS
#define __HAVE_COUNTERS			0
#endif
#ifndef __HAVE_SG
#define __HAVE_SG			0
#endif
#ifndef __HAVE_KERNEL_CTX_SWITCH
#define __HAVE_KERNEL_CTX_SWITCH	0
#endif
#ifndef PCI_ANY_ID
#define PCI_ANY_ID	~0
#endif

#ifndef DRIVER_PREINIT
#define DRIVER_PREINIT()
#endif
#ifndef DRIVER_POSTINIT
#define DRIVER_POSTINIT()
#endif
#ifndef DRIVER_PRERELEASE
#define DRIVER_PRERELEASE()
#endif
#ifndef DRIVER_PRETAKEDOWN
#define DRIVER_PRETAKEDOWN()
#endif
#ifndef DRIVER_POSTCLEANUP
#define DRIVER_POSTCLEANUP()
#endif
#ifndef DRIVER_PRESETUP
#define DRIVER_PRESETUP()
#endif
#ifndef DRIVER_POSTSETUP
#define DRIVER_POSTSETUP()
#endif
#ifndef DRIVER_IOCTLS
#define DRIVER_IOCTLS
#endif
#ifndef DRIVER_FOPS
#endif

/*
 * The default number of instances (minor numbers) to initialize.
 */
#ifndef DRIVER_NUM_CARDS
#define DRIVER_NUM_CARDS 1
#endif

static int DRM(init)(device_t nbdev);
static void DRM(cleanup)(device_t nbdev);

#ifdef __FreeBSD__
#define DRIVER_SOFTC(unit) \
	((drm_device_t *) devclass_get_softc(DRM(devclass), unit))

#if __REALLY_HAVE_AGP
MODULE_DEPEND(DRIVER_NAME, agp, 1, 1, 1);
#endif
#if DRM_LINUX
MODULE_DEPEND(DRIVER_NAME, linux, 1, 1, 1);
#endif
#endif /* __FreeBSD__ */

#ifdef __NetBSD__
#define DRIVER_SOFTC(unit) \
	((drm_device_t *) device_lookup(&DRM(cd), unit))
#endif /* __NetBSD__ */

static drm_ioctl_desc_t		  DRM(ioctls)[] = {
	[DRM_IOCTL_NR(DRM_IOCTL_VERSION)]       = { DRM(version),     0, 0 },
	[DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)]    = { DRM(getunique),   0, 0 },
	[DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)]     = { DRM(getmagic),    0, 0 },
	[DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)]     = { DRM(irq_busid),   0, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_GET_MAP)]       = { DRM(getmap),      0, 0 },
	[DRM_IOCTL_NR(DRM_IOCTL_GET_CLIENT)]    = { DRM(getclient),   0, 0 },
	[DRM_IOCTL_NR(DRM_IOCTL_GET_STATS)]     = { DRM(getstats),    0, 0 },

	[DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)]    = { DRM(setunique),   1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_BLOCK)]         = { DRM(block),       1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)]       = { DRM(unblock),     1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)]    = { DRM(authmagic),   1, 1 },

	[DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)]       = { DRM(addmap),      1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_RM_MAP)]        = { DRM(rmmap),       1, 0 },

#if __HAVE_CTX_BITMAP
	[DRM_IOCTL_NR(DRM_IOCTL_SET_SAREA_CTX)] = { DRM(setsareactx), 1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX)] = { DRM(getsareactx), 1, 0 },
#endif

	[DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)]       = { DRM(addctx),      1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)]        = { DRM(rmctx),       1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)]       = { DRM(modctx),      1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)]       = { DRM(getctx),      1, 0 },
	[DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)]    = { DRM(switchctx),   1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)]       = { DRM(newctx),      1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)]       = { DRM(resctx),      1, 0 },

	[DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)]      = { DRM(adddraw),     1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)]       = { DRM(rmdraw),      1, 1 },

	[DRM_IOCTL_NR(DRM_IOCTL_LOCK)]	        = { DRM(lock),        1, 0 },
	[DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)]        = { DRM(unlock),      1, 0 },
	[DRM_IOCTL_NR(DRM_IOCTL_FINISH)]        = { DRM(finish),      1, 0 },

#if __HAVE_DMA
	[DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)]      = { DRM(addbufs),     1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)]     = { DRM(markbufs),    1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)]     = { DRM(infobufs),    1, 0 },
	[DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)]      = { DRM(mapbufs),     1, 0 },
	[DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)]     = { DRM(freebufs),    1, 0 },

	/* The DRM_IOCTL_DMA ioctl should be defined by the driver.
	 */
	[DRM_IOCTL_NR(DRM_IOCTL_CONTROL)]       = { DRM(control),     1, 1 },
#endif

#if __REALLY_HAVE_AGP
	[DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)]   = { DRM(agp_acquire), 1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)]   = { DRM(agp_release), 1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)]    = { DRM(agp_enable),  1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)]      = { DRM(agp_info),    1, 0 },
	[DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)]     = { DRM(agp_alloc),   1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)]      = { DRM(agp_free),    1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)]      = { DRM(agp_bind),    1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)]    = { DRM(agp_unbind),  1, 1 },
#endif

#if __HAVE_SG
	[DRM_IOCTL_NR(DRM_IOCTL_SG_ALLOC)]      = { DRM(sg_alloc),    1, 1 },
	[DRM_IOCTL_NR(DRM_IOCTL_SG_FREE)]       = { DRM(sg_free),     1, 1 },
#endif

#if __HAVE_VBL_IRQ
	[DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK)]   = { DRM(wait_vblank), 0, 0 },
#endif

	DRIVER_IOCTLS
};

#define DRIVER_IOCTL_COUNT	DRM_ARRAY_SIZE( DRM(ioctls) )

const char *DRM(find_description)(int vendor, int device);

#ifdef __FreeBSD__
static struct cdevsw DRM(cdevsw) = {
	.d_open =	DRM( open ),
	.d_close =	DRM( close ),
	.d_read =	DRM( read ),
	.d_ioctl =	DRM( ioctl ),
	.d_poll =	DRM( poll ),
	.d_mmap =	DRM( mmap ),
	.d_name =	DRIVER_NAME,
	.d_maj =	CDEV_MAJOR,
	.d_flags =	D_TTY | D_TRACKCLOSE,
#if __FreeBSD_version < 500000