Deleted Added
full compact
drm_drv.c (242467) drm_drv.c (247835)
1/*-
2 * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
3 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation

--- 15 unchanged lines hidden (view full) ---

24 *
25 * Authors:
26 * Rickard E. (Rik) Faith <faith@valinux.com>
27 * Gareth Hughes <gareth@valinux.com>
28 *
29 */
30
31#include <sys/cdefs.h>
1/*-
2 * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
3 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation

--- 15 unchanged lines hidden (view full) ---

24 *
25 * Authors:
26 * Rickard E. (Rik) Faith <faith@valinux.com>
27 * Gareth Hughes <gareth@valinux.com>
28 *
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/dev/drm2/drm_drv.c 242467 2012-11-02 05:26:33Z glebius $");
32__FBSDID("$FreeBSD: head/sys/dev/drm2/drm_drv.c 247835 2013-03-05 09:49:34Z kib $");
33
34/** @file drm_drv.c
35 * The catch-all file for DRM device support, including module setup/teardown,
36 * open/close, and ioctl dispatch.
37 */
38
39#include <sys/limits.h>
40#include <sys/sysent.h>

--- 12 unchanged lines hidden (view full) ---

53
54unsigned int drm_vblank_offdelay = 5000; /* Default to 5000 msecs. */
55unsigned int drm_timestamp_precision = 20; /* Default to 20 usecs. */
56
57static int drm_load(struct drm_device *dev);
58static void drm_unload(struct drm_device *dev);
59static drm_pci_id_list_t *drm_find_description(int vendor, int device,
60 drm_pci_id_list_t *idlist);
33
34/** @file drm_drv.c
35 * The catch-all file for DRM device support, including module setup/teardown,
36 * open/close, and ioctl dispatch.
37 */
38
39#include <sys/limits.h>
40#include <sys/sysent.h>

--- 12 unchanged lines hidden (view full) ---

53
54unsigned int drm_vblank_offdelay = 5000; /* Default to 5000 msecs. */
55unsigned int drm_timestamp_precision = 20; /* Default to 20 usecs. */
56
57static int drm_load(struct drm_device *dev);
58static void drm_unload(struct drm_device *dev);
59static drm_pci_id_list_t *drm_find_description(int vendor, int device,
60 drm_pci_id_list_t *idlist);
61static int drm_mmap_single(struct cdev *kdev, vm_ooffset_t *offset,
62 vm_size_t size, struct vm_object **obj_res, int nprot);
61
62static int
63drm_modevent(module_t mod, int type, void *data)
64{
65
66 switch (type) {
67 case MOD_LOAD:
68 TUNABLE_INT_FETCH("drm.debug", &drm_debug_flag);

--- 113 unchanged lines hidden (view full) ---

182
183static struct cdevsw drm_cdevsw = {
184 .d_version = D_VERSION,
185 .d_open = drm_open,
186 .d_read = drm_read,
187 .d_ioctl = drm_ioctl,
188 .d_poll = drm_poll,
189 .d_mmap = drm_mmap,
63
64static int
65drm_modevent(module_t mod, int type, void *data)
66{
67
68 switch (type) {
69 case MOD_LOAD:
70 TUNABLE_INT_FETCH("drm.debug", &drm_debug_flag);

--- 113 unchanged lines hidden (view full) ---

184
185static struct cdevsw drm_cdevsw = {
186 .d_version = D_VERSION,
187 .d_open = drm_open,
188 .d_read = drm_read,
189 .d_ioctl = drm_ioctl,
190 .d_poll = drm_poll,
191 .d_mmap = drm_mmap,
190 .d_mmap_single = drm_gem_mmap_single,
192 .d_mmap_single = drm_mmap_single,
191 .d_name = "drm",
192 .d_flags = D_TRACKCLOSE
193};
194
195static int drm_msi = 1; /* Enable by default. */
196TUNABLE_INT("hw.drm.msi", &drm_msi);
197SYSCTL_NODE(_hw, OID_AUTO, drm, CTLFLAG_RW, NULL, "DRM device");
198SYSCTL_INT(_hw_drm, OID_AUTO, msi, CTLFLAG_RDTUN, &drm_msi, 1,

--- 751 unchanged lines hidden (view full) ---

950 oid = SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(top), OID_AUTO,
951 "modesetting", CTLFLAG_RD, &dev->modesetting, 0, NULL);
952 if (oid == NULL)
953 return (ENOMEM);
954
955 return (0);
956}
957
193 .d_name = "drm",
194 .d_flags = D_TRACKCLOSE
195};
196
197static int drm_msi = 1; /* Enable by default. */
198TUNABLE_INT("hw.drm.msi", &drm_msi);
199SYSCTL_NODE(_hw, OID_AUTO, drm, CTLFLAG_RW, NULL, "DRM device");
200SYSCTL_INT(_hw_drm, OID_AUTO, msi, CTLFLAG_RDTUN, &drm_msi, 1,

--- 751 unchanged lines hidden (view full) ---

952 oid = SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(top), OID_AUTO,
953 "modesetting", CTLFLAG_RD, &dev->modesetting, 0, NULL);
954 if (oid == NULL)
955 return (ENOMEM);
956
957 return (0);
958}
959
960static int
961drm_mmap_single(struct cdev *kdev, vm_ooffset_t *offset, vm_size_t size,
962 struct vm_object **obj_res, int nprot)
963{
964 struct drm_device *dev;
965
966 dev = drm_get_device_from_kdev(kdev);
967 if ((dev->driver->driver_features & DRIVER_GEM) != 0) {
968 return (drm_gem_mmap_single(dev, offset, size, obj_res, nprot));
969 } else if (dev->drm_ttm_bo != NULL) {
970 return (ttm_bo_mmap_single(dev->drm_ttm_bo, offset, size,
971 obj_res, nprot));
972 } else {
973 return (ENODEV);
974 }
975}
976
958#if DRM_LINUX
959
960#include <sys/sysproto.h>
961
962MODULE_DEPEND(DRIVER_NAME, linux, 1, 1, 1);
963
964#define LINUX_IOCTL_DRM_MIN 0x6400
965#define LINUX_IOCTL_DRM_MAX 0x64ff

--- 40 unchanged lines hidden ---
977#if DRM_LINUX
978
979#include <sys/sysproto.h>
980
981MODULE_DEPEND(DRIVER_NAME, linux, 1, 1, 1);
982
983#define LINUX_IOCTL_DRM_MIN 0x6400
984#define LINUX_IOCTL_DRM_MAX 0x64ff

--- 40 unchanged lines hidden ---