Rev 2161 | Rev 3031 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2161 | Rev 2967 | ||
---|---|---|---|
Line 34... | Line 34... | ||
34 | 34 | ||
35 | #ifndef _DRM_P_H_ |
35 | #ifndef _DRM_P_H_ |
Line 36... | Line 36... | ||
36 | #define _DRM_P_H_ |
36 | #define _DRM_P_H_ |
37 | - | ||
38 | #ifdef __KERNEL__ |
- | |
39 | #ifdef __alpha__ |
- | |
40 | /* add include of current.h so that "current" is defined |
- | |
- | 37 | ||
41 | * before static inline funcs in wait.h. Doing this so we |
38 | #ifdef __KERNEL__ |
42 | * can build the DRM (part of PI DRI). 4/21/2000 S + B */ |
- | |
- | 39 | ||
43 | #include |
40 | #include |
44 | #endif /* __alpha__ */ |
41 | |
45 | #include |
42 | #include |
46 | #include |
43 | #include |
47 | #include |
44 | #include |
- | 45 | #include |
|
Line 48... | Line 46... | ||
48 | #include |
46 | #include |
49 | #include |
47 | #include |
50 | 48 | ||
51 | //#include |
49 | //#include |
52 | //#include |
50 | //#include |
53 | //#include |
51 | //#include |
54 | //#include |
52 | //#include |
55 | //#include |
53 | //#include |
56 | #include |
54 | #include |
57 | //#include |
55 | #include |
58 | //#include |
56 | //#include |
59 | //#include |
57 | //#include |
Line 120... | Line 118... | ||
120 | #define DRM_DEBUG_KMS(fmt, args...) \ |
118 | #define DRM_DEBUG_KMS(fmt, args...) \ |
121 | do { \ |
119 | do { \ |
122 | printk("[" DRM_NAME ":%s] " fmt , __func__ , ##args); \ |
120 | printk("[" DRM_NAME ":%s] " fmt , __func__ , ##args); \ |
123 | } while(0) |
121 | } while(0) |
Line 124... | Line 122... | ||
124 | 122 | ||
125 | #define dev_err(dev, format, arg...) \ |
- | |
126 | printk("Error %s " format, __func__ , ## arg) |
- | |
127 | 123 | #define DRM_DEBUG_DRIVER(fmt, args...) \ |
|
128 | #define dev_warn(dev, format, arg...) \ |
124 | do { \ |
129 | printk("Warning %s " format, __func__ , ## arg) |
- | |
130 | - | ||
131 | #define dev_info(dev, format, arg...) \ |
125 | printk("[" DRM_NAME ":%s] " fmt , __func__ , ##args); \ |
132 | printk("Info %s " format , __func__, ## arg) |
- | |
Line -... | Line 126... | ||
- | 126 | } while (0) |
|
- | 127 | ||
- | 128 | #define DRM_LOG_KMS(fmt, args...) \ |
|
- | 129 | do { \ |
|
Line 133... | Line 130... | ||
133 | 130 | printk("[" DRM_NAME "]" fmt, ##args); \ |
|
134 | 131 | } while (0) |
|
Line 135... | Line 132... | ||
135 | 132 | ||
Line 158... | Line 155... | ||
158 | #define DRIVER_DMA_QUEUE 0x200 |
155 | #define DRIVER_DMA_QUEUE 0x200 |
159 | #define DRIVER_FB_DMA 0x400 |
156 | #define DRIVER_FB_DMA 0x400 |
160 | #define DRIVER_IRQ_VBL2 0x800 |
157 | #define DRIVER_IRQ_VBL2 0x800 |
161 | #define DRIVER_GEM 0x1000 |
158 | #define DRIVER_GEM 0x1000 |
162 | #define DRIVER_MODESET 0x2000 |
159 | #define DRIVER_MODESET 0x2000 |
- | 160 | ||
- | 161 | #define DRIVER_BUS_PCI 0x1 |
|
163 | #define DRIVER_USE_PLATFORM_DEVICE 0x4000 |
162 | #define DRIVER_BUS_PLATFORM 0x2 |
- | 163 | #define DRIVER_BUS_USB 0x3 |
|
Line 164... | Line 164... | ||
164 | 164 | ||
165 | /***********************************************************************/ |
165 | /***********************************************************************/ |
166 | /** \name Begin the DRM... */ |
166 | /** \name Begin the DRM... */ |
Line 394... | Line 394... | ||
394 | int low_mark; /**< Low water mark */ |
394 | int low_mark; /**< Low water mark */ |
395 | int high_mark; /**< High water mark */ |
395 | int high_mark; /**< High water mark */ |
396 | atomic_t wfh; /**< If waiting for high mark */ |
396 | atomic_t wfh; /**< If waiting for high mark */ |
397 | spinlock_t lock; |
397 | spinlock_t lock; |
398 | }; |
398 | }; |
- | 399 | #endif |
|
Line 399... | Line 400... | ||
399 | 400 | ||
400 | typedef struct drm_dma_handle { |
401 | typedef struct drm_dma_handle { |
401 | dma_addr_t busaddr; |
402 | dma_addr_t busaddr; |
402 | void *vaddr; |
403 | void *vaddr; |
403 | size_t size; |
404 | size_t size; |
Line -... | Line 405... | ||
- | 405 | } drm_dma_handle_t; |
|
404 | } drm_dma_handle_t; |
406 | |
405 | 407 | #if 0 |
|
406 | /** |
408 | /** |
407 | * Buffer entry. There is one of this for each buffer size order. |
409 | * Buffer entry. There is one of this for each buffer size order. |
408 | */ |
410 | */ |
Line 552... | Line 554... | ||
552 | struct drm_sigdata { |
554 | struct drm_sigdata { |
553 | int context; |
555 | int context; |
554 | struct drm_hw_lock *lock; |
556 | struct drm_hw_lock *lock; |
555 | }; |
557 | }; |
Line -... | Line 558... | ||
- | 558 | ||
- | 559 | #endif |
|
Line 556... | Line 560... | ||
556 | 560 | ||
557 | 561 | ||
558 | /** |
562 | /** |
559 | * Kernel side of a mapping |
563 | * Kernel side of a mapping |
Line 568... | Line 572... | ||
568 | int mtrr; /**< MTRR slot used */ |
572 | int mtrr; /**< MTRR slot used */ |
569 | }; |
573 | }; |
Line 570... | Line 574... | ||
570 | 574 | ||
Line -... | Line 575... | ||
- | 575 | typedef struct drm_local_map drm_local_map_t; |
|
571 | typedef struct drm_local_map drm_local_map_t; |
576 | |
572 | 577 | #if 0 |
|
573 | /** |
578 | /** |
574 | * Mappings list |
579 | * Mappings list |
575 | */ |
580 | */ |
Line 636... | Line 641... | ||
636 | 641 | ||
637 | /** File representing the shmem storage */ |
642 | /** File representing the shmem storage */ |
Line 638... | Line 643... | ||
638 | struct file *filp; |
643 | struct file *filp; |
639 | - | ||
Line 640... | Line 644... | ||
640 | /* Mapping info for this object */ |
644 | |
641 | // struct drm_map_list map_list; |
645 | /* Mapping info for this object */ |
642 | 646 | ||
643 | /** |
647 | /** |
Line 671... | Line 675... | ||
671 | uint32_t pending_write_domain; |
675 | uint32_t pending_write_domain; |
Line 672... | Line 676... | ||
672 | 676 | ||
673 | void *driver_private; |
677 | void *driver_private; |
Line 674... | Line -... | ||
674 | }; |
- | |
675 | - | ||
676 | #if 0 |
678 | }; |
Line 677... | Line 679... | ||
677 | 679 | ||
678 | #include "drm_crtc.h" |
680 | #include "drm_crtc.h" |
Line 691... | Line 693... | ||
691 | 693 | ||
Line 692... | Line 694... | ||
692 | int blocked; /**< Blocked due to VC switch? */ |
694 | int blocked; /**< Blocked due to VC switch? */ |
693 | 695 | ||
694 | /** \name Authentication */ |
696 | /** \name Authentication */ |
695 | /*@{ */ |
697 | /*@{ */ |
696 | struct drm_open_hash magiclist; |
698 | // struct drm_open_hash magiclist; |
Line 697... | Line 699... | ||
697 | struct list_head magicfree; |
699 | // struct list_head magicfree; |
Line 698... | Line 700... | ||
698 | /*@} */ |
700 | /*@} */ |
699 | 701 | ||
Line -... | Line 702... | ||
- | 702 | // struct drm_lock_data lock; /**< Information on hardware lock */ |
|
- | 703 | ||
700 | struct drm_lock_data lock; /**< Information on hardware lock */ |
704 | void *driver_priv; /**< Private structure for driver to use */ |
701 | 705 | }; |
|
702 | void *driver_priv; /**< Private structure for driver to use */ |
706 | |
703 | }; |
707 | #if 0 |
Line 839... | Line 843... | ||
839 | * timestamp when the most recent VBLANK interval ended or will end. |
843 | * timestamp when the most recent VBLANK interval ended or will end. |
840 | * |
844 | * |
841 | * Specifically, the timestamp in @vblank_time should correspond as |
845 | * Specifically, the timestamp in @vblank_time should correspond as |
842 | * closely as possible to the time when the first video scanline of |
846 | * closely as possible to the time when the first video scanline of |
843 | * the video frame after the end of VBLANK will start scanning out, |
847 | * the video frame after the end of VBLANK will start scanning out, |
844 | * the time immmediately after end of the VBLANK interval. If the |
848 | * the time immediately after end of the VBLANK interval. If the |
845 | * @crtc is currently inside VBLANK, this will be a time in the future. |
849 | * @crtc is currently inside VBLANK, this will be a time in the future. |
846 | * If the @crtc is currently scanning out a frame, this will be the |
850 | * If the @crtc is currently scanning out a frame, this will be the |
847 | * past start time of the current scanout. This is meant to adhere |
851 | * past start time of the current scanout. This is meant to adhere |
848 | * to the OpenML OML_sync_control extension specification. |
852 | * to the OpenML OML_sync_control extension specification. |
849 | * |
853 | * |
Line 906... | Line 910... | ||
906 | * |
910 | * |
907 | * Returns 0 on success. |
911 | * Returns 0 on success. |
908 | */ |
912 | */ |
909 | int (*gem_init_object) (struct drm_gem_object *obj); |
913 | int (*gem_init_object) (struct drm_gem_object *obj); |
910 | void (*gem_free_object) (struct drm_gem_object *obj); |
914 | void (*gem_free_object) (struct drm_gem_object *obj); |
- | 915 | int (*gem_open_object) (struct drm_gem_object *, struct drm_file *); |
|
- | 916 | void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); |
|
Line 911... | Line 917... | ||
911 | 917 | ||
912 | /* vga arb irq handler */ |
918 | /* vga arb irq handler */ |
Line -... | Line 919... | ||
- | 919 | void (*vgaarb_irq)(struct drm_device *dev, bool state); |
|
- | 920 | ||
- | 921 | /* dumb alloc support */ |
|
- | 922 | int (*dumb_create)(struct drm_file *file_priv, |
|
- | 923 | struct drm_device *dev, |
|
- | 924 | struct drm_mode_create_dumb *args); |
|
- | 925 | int (*dumb_map_offset)(struct drm_file *file_priv, |
|
- | 926 | struct drm_device *dev, uint32_t handle, |
|
- | 927 | uint64_t *offset); |
|
- | 928 | int (*dumb_destroy)(struct drm_file *file_priv, |
|
- | 929 | struct drm_device *dev, |
|
913 | void (*vgaarb_irq)(struct drm_device *dev, bool state); |
930 | uint32_t handle); |
914 | 931 | ||
Line 915... | Line 932... | ||
915 | /* Driver private ops for this object */ |
932 | /* Driver private ops for this object */ |
916 | struct vm_operations_struct *gem_vm_ops; |
933 | struct vm_operations_struct *gem_vm_ops; |
Line 924... | Line 941... | ||
924 | 941 | ||
925 | u32 driver_features; |
942 | u32 driver_features; |
926 | int dev_priv_size; |
943 | int dev_priv_size; |
927 | struct drm_ioctl_desc *ioctls; |
944 | struct drm_ioctl_desc *ioctls; |
928 | int num_ioctls; |
945 | int num_ioctls; |
- | 946 | const struct file_operations *fops; |
|
929 | struct file_operations fops; |
947 | union { |
- | 948 | struct pci_driver *pci; |
|
- | 949 | struct platform_device *platform_device; |
|
- | 950 | struct usb_driver *usb; |
|
- | 951 | } kdriver; |
|
- | 952 | struct drm_bus *bus; |
|
930 | struct pci_driver pci_driver; |
953 | |
931 | /* List of devices hanging off this driver */ |
954 | /* List of devices hanging off this driver */ |
932 | struct list_head device_list; |
955 | struct list_head device_list; |
Line -... | Line 956... | ||
- | 956 | }; |
|
- | 957 | ||
933 | }; |
958 | #endif |
934 | 959 | ||
935 | #define DRM_MINOR_UNASSIGNED 0 |
960 | #define DRM_MINOR_UNASSIGNED 0 |
936 | #define DRM_MINOR_LEGACY 1 |
961 | #define DRM_MINOR_LEGACY 1 |
Line 942... | Line 967... | ||
942 | * debugfs node list. This structure represents a debugfs file to |
967 | * debugfs node list. This structure represents a debugfs file to |
943 | * be created by the drm core |
968 | * be created by the drm core |
944 | */ |
969 | */ |
945 | struct drm_debugfs_list { |
970 | struct drm_debugfs_list { |
946 | const char *name; /** file name */ |
971 | const char *name; /** file name */ |
947 | int (*show)(struct seq_file*, void*); /** show callback */ |
972 | // int (*show)(struct seq_file*, void*); /** show callback */ |
948 | u32 driver_features; /**< Required driver features for this entry */ |
973 | u32 driver_features; /**< Required driver features for this entry */ |
949 | }; |
974 | }; |
Line 950... | Line 975... | ||
950 | 975 | ||
951 | /** |
976 | /** |
Line 962... | Line 987... | ||
962 | * Info file list entry. This structure represents a debugfs or proc file to |
987 | * Info file list entry. This structure represents a debugfs or proc file to |
963 | * be created by the drm core |
988 | * be created by the drm core |
964 | */ |
989 | */ |
965 | struct drm_info_list { |
990 | struct drm_info_list { |
966 | const char *name; /** file name */ |
991 | const char *name; /** file name */ |
967 | int (*show)(struct seq_file*, void*); /** show callback */ |
992 | // int (*show)(struct seq_file*, void*); /** show callback */ |
968 | u32 driver_features; /**< Required driver features for this entry */ |
993 | u32 driver_features; /**< Required driver features for this entry */ |
969 | void *data; |
994 | void *data; |
970 | }; |
995 | }; |
Line 971... | Line 996... | ||
971 | 996 | ||
Line 983... | Line 1008... | ||
983 | * DRM minor structure. This structure represents a drm minor number. |
1008 | * DRM minor structure. This structure represents a drm minor number. |
984 | */ |
1009 | */ |
985 | struct drm_minor { |
1010 | struct drm_minor { |
986 | int index; /**< Minor device number */ |
1011 | int index; /**< Minor device number */ |
987 | int type; /**< Control or render */ |
1012 | int type; /**< Control or render */ |
988 | dev_t device; /**< Device number for mknod */ |
1013 | // dev_t device; /**< Device number for mknod */ |
989 | struct device kdev; /**< Linux device */ |
1014 | // struct device kdev; /**< Linux device */ |
990 | struct drm_device *dev; |
1015 | struct drm_device *dev; |
Line 991... | Line 1016... | ||
991 | 1016 | ||
992 | struct proc_dir_entry *proc_root; /**< proc directory entry */ |
1017 | // struct proc_dir_entry *proc_root; /**< proc directory entry */ |
993 | struct drm_info_node proc_nodes; |
1018 | // struct drm_info_node proc_nodes; |
994 | struct dentry *debugfs_root; |
1019 | // struct dentry *debugfs_root; |
Line 995... | Line 1020... | ||
995 | struct drm_info_node debugfs_nodes; |
1020 | // struct drm_info_node debugfs_nodes; |
996 | 1021 | ||
997 | struct drm_master *master; /* currently active master for this node */ |
1022 | struct drm_master *master; /* currently active master for this node */ |
998 | struct list_head master_list; |
1023 | // struct list_head master_list; |
Line 999... | Line -... | ||
999 | struct drm_mode_group mode_group; |
- | |
1000 | }; |
- | |
1001 | 1024 | // struct drm_mode_group mode_group; |
|
1002 | #endif |
1025 | }; |
1003 | 1026 | ||
1004 | /* mode specified on the command line */ |
1027 | /* mode specified on the command line */ |
1005 | struct drm_cmdline_mode { |
1028 | struct drm_cmdline_mode { |
Line 1147... | Line 1170... | ||
1147 | 1170 | ||
1148 | // struct drm_driver *driver; |
1171 | // struct drm_driver *driver; |
1149 | // struct drm_local_map *agp_buffer_map; |
1172 | // struct drm_local_map *agp_buffer_map; |
1150 | // unsigned int agp_buffer_token; |
1173 | // unsigned int agp_buffer_token; |
1151 | // struct drm_minor *control; /**< Control node for card */ |
1174 | // struct drm_minor *control; /**< Control node for card */ |
Line 1152... | Line 1175... | ||
1152 | // struct drm_minor *primary; /**< render type primary screen head */ |
1175 | struct drm_minor *primary; /**< render type primary screen head */ |
Line 1153... | Line 1176... | ||
1153 | 1176 | ||
1154 | struct drm_mode_config mode_config; /**< Current mode config */ |
1177 | struct drm_mode_config mode_config; /**< Current mode config */ |
Line 1164... | Line 1187... | ||
1164 | #define DRM_SWITCH_POWER_ON 0 |
1187 | #define DRM_SWITCH_POWER_ON 0 |
1165 | #define DRM_SWITCH_POWER_OFF 1 |
1188 | #define DRM_SWITCH_POWER_OFF 1 |
1166 | #define DRM_SWITCH_POWER_CHANGING 2 |
1189 | #define DRM_SWITCH_POWER_CHANGING 2 |
Line 1167... | Line -... | ||
1167 | - | ||
1168 | - | ||
1169 | - | ||
1170 | - | ||
1171 | - | ||
1172 | - | ||
1173 | - | ||
1174 | - | ||
1175 | - | ||
1176 | - | ||
1177 | static __inline__ int drm_device_is_agp(struct drm_device *dev) |
- | |
1178 | { |
- | |
1179 | return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP); |
- | |
1180 | } |
- | |
1181 | - | ||
1182 | static __inline__ int drm_device_is_pcie(struct drm_device *dev) |
- | |
1183 | { |
- | |
1184 | return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); |
- | |
1185 | } |
- | |
1186 | - | ||
1187 | - | ||
1188 | 1190 | ||
1189 | #if 0 |
1191 | |
1190 | static inline int drm_dev_to_irq(struct drm_device *dev) |
1192 | static inline int drm_dev_to_irq(struct drm_device *dev) |
1191 | { |
1193 | { |
Line 1192... | Line -... | ||
1192 | return dev->pdev->irq; |
- | |
1193 | } |
- | |
1194 | - | ||
1195 | static __inline__ int drm_core_check_feature(struct drm_device *dev, |
- | |
1196 | int feature) |
1194 | return dev->pdev->irq; |
Line 1197... | Line 1195... | ||
1197 | { |
1195 | } |
1198 | return ((dev->driver->driver_features & feature) ? 1 : 0); |
1196 | |
1199 | } |
1197 | #if 0 |
1200 | 1198 | ||
Line 1342... | Line 1340... | ||
1342 | /* Authentication IOCTL support (drm_auth.h) */ |
1340 | /* Authentication IOCTL support (drm_auth.h) */ |
1343 | extern int drm_getmagic(struct drm_device *dev, void *data, |
1341 | extern int drm_getmagic(struct drm_device *dev, void *data, |
1344 | struct drm_file *file_priv); |
1342 | struct drm_file *file_priv); |
1345 | extern int drm_authmagic(struct drm_device *dev, void *data, |
1343 | extern int drm_authmagic(struct drm_device *dev, void *data, |
1346 | struct drm_file *file_priv); |
1344 | struct drm_file *file_priv); |
- | 1345 | extern int drm_remove_magic(struct drm_master *master, drm_magic_t magic); |
|
Line 1347... | Line 1346... | ||
1347 | 1346 | ||
1348 | /* Cache management (drm_cache.c) */ |
1347 | /* Cache management (drm_cache.c) */ |
Line 1349... | Line 1348... | ||
1349 | void drm_clflush_pages(struct page *pages[], unsigned long num_pages); |
1348 | void drm_clflush_pages(struct page *pages[], unsigned long num_pages); |
Line 1553... | Line 1552... | ||
1553 | { return 0; }; |
1552 | { return 0; }; |
Line 1554... | Line 1553... | ||
1554 | 1553 | ||
1555 | static inline void drm_sysfs_connector_remove(struct drm_connector *connector) |
1554 | static inline void drm_sysfs_connector_remove(struct drm_connector *connector) |
Line -... | Line 1555... | ||
- | 1555 | { }; |
|
- | 1556 | ||
1556 | { }; |
1557 | #endif |
1557 | 1558 | ||
1558 | /* Graphics Execution Manager library functions (drm_gem.c) */ |
1559 | /* Graphics Execution Manager library functions (drm_gem.c) */ |
1559 | int drm_gem_init(struct drm_device *dev); |
1560 | int drm_gem_init(struct drm_device *dev); |
1560 | void drm_gem_destroy(struct drm_device *dev); |
1561 | void drm_gem_destroy(struct drm_device *dev); |
1561 | void drm_gem_object_release(struct drm_gem_object *obj); |
1562 | void drm_gem_object_release(struct drm_gem_object *obj); |
1562 | void drm_gem_object_free(struct kref *kref); |
1563 | void drm_gem_object_free(struct kref *kref); |
1563 | struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, |
1564 | struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, |
1564 | size_t size); |
1565 | size_t size); |
- | 1566 | int drm_gem_object_init(struct drm_device *dev, |
|
- | 1567 | struct drm_gem_object *obj, size_t size); |
|
1565 | int drm_gem_object_init(struct drm_device *dev, |
1568 | int drm_gem_private_object_init(struct drm_device *dev, |
1566 | struct drm_gem_object *obj, size_t size); |
1569 | struct drm_gem_object *obj, size_t size); |
1567 | void drm_gem_object_handle_free(struct drm_gem_object *obj); |
1570 | void drm_gem_object_handle_free(struct drm_gem_object *obj); |
1568 | void drm_gem_vm_open(struct vm_area_struct *vma); |
1571 | void drm_gem_vm_open(struct vm_area_struct *vma); |
Line -... | Line 1572... | ||
- | 1572 | void drm_gem_vm_close(struct vm_area_struct *vma); |
|
1569 | void drm_gem_vm_close(struct vm_area_struct *vma); |
1573 | int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); |
1570 | int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); |
1574 | |
1571 | 1575 | ||
1572 | static inline void |
1576 | static inline void |
1573 | drm_gem_object_reference(struct drm_gem_object *obj) |
1577 | drm_gem_object_reference(struct drm_gem_object *obj) |
Line 1574... | Line 1578... | ||
1574 | { |
1578 | { |
1575 | kref_get(&obj->refcount); |
1579 | kref_get(&obj->refcount); |
1576 | } |
1580 | } |
1577 | 1581 | ||
- | 1582 | static inline void |
|
1578 | static inline void |
1583 | drm_gem_object_unreference(struct drm_gem_object *obj) |
Line -... | Line 1584... | ||
- | 1584 | { |
|
- | 1585 | if (obj != NULL) |
|
- | 1586 | kref_put(&obj->refcount, drm_gem_object_free); |
|
- | 1587 | } |
|
- | 1588 | ||
- | 1589 | #if 0 |
|
- | 1590 | static inline void |
|
1579 | drm_gem_object_unreference(struct drm_gem_object *obj) |
1591 | drm_gem_object_unreference_unlocked(struct drm_gem_object *obj) |
- | 1592 | { |
|
- | 1593 | if (obj != NULL) { |
|
1580 | { |
1594 | struct drm_device *dev = obj->dev; |
Line 1581... | Line 1595... | ||
1581 | if (obj == NULL) |
1595 | mutex_lock(&dev->struct_mutex); |
1582 | return; |
1596 | kref_put(&obj->refcount, drm_gem_object_free); |
1583 | 1597 | mutex_unlock(&dev->struct_mutex); |
|
Line 1607... | Line 1621... | ||
1607 | /* |
1621 | /* |
1608 | * Must bump handle count first as this may be the last |
1622 | * Must bump handle count first as this may be the last |
1609 | * ref, in which case the object would disappear before we |
1623 | * ref, in which case the object would disappear before we |
1610 | * checked for a name |
1624 | * checked for a name |
1611 | */ |
1625 | */ |
- | 1626 | if (atomic_dec_and_test(&obj->handle_count)) |
|
1612 | kref_put(&obj->handlecount, drm_gem_object_handle_free); |
1627 | drm_gem_object_handle_free(obj); |
1613 | drm_gem_object_unreference(obj); |
1628 | drm_gem_object_unreference(obj); |
1614 | } |
1629 | } |
Line -... | Line 1630... | ||
- | 1630 | ||
- | 1631 | static inline void |
|
- | 1632 | drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj) |
|
- | 1633 | { |
|
- | 1634 | if (obj == NULL) |
|
- | 1635 | return; |
|
- | 1636 | ||
- | 1637 | if (atomic_read(&obj->handle_count) == 0) |
|
- | 1638 | return; |
|
- | 1639 | ||
- | 1640 | /* |
|
- | 1641 | * Must bump handle count first as this may be the last |
|
- | 1642 | * ref, in which case the object would disappear before we |
|
- | 1643 | * checked for a name |
|
- | 1644 | */ |
|
- | 1645 | ||
- | 1646 | if (atomic_dec_and_test(&obj->handle_count)) |
|
- | 1647 | drm_gem_object_handle_free(obj); |
|
- | 1648 | drm_gem_object_unreference_unlocked(obj); |
|
- | 1649 | } |
|
- | 1650 | ||
1615 | 1651 | ||
1616 | struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev, |
1652 | struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev, |
1617 | struct drm_file *filp, |
1653 | struct drm_file *filp, |
1618 | u32 handle); |
1654 | u32 handle); |
1619 | int drm_gem_close_ioctl(struct drm_device *dev, void *data, |
1655 | int drm_gem_close_ioctl(struct drm_device *dev, void *data, |
Line 1661... | Line 1697... | ||
1661 | if (!is_vmalloc_addr(ptr)) |
1697 | if (!is_vmalloc_addr(ptr)) |
1662 | return kfree(ptr); |
1698 | return kfree(ptr); |
Line 1663... | Line 1699... | ||
1663 | 1699 | ||
1664 | vfree(ptr); |
1700 | vfree(ptr); |
1665 | } |
- | |
Line 1666... | Line 1701... | ||
1666 | /*@}*/ |
1701 | } |
Line -... | Line 1702... | ||
- | 1702 | ||
- | 1703 | #endif |
|
- | 1704 | ||
- | 1705 | ||
Line -... | Line 1706... | ||
- | 1706 | static __inline__ int drm_device_is_agp(struct drm_device *dev) |
|
- | 1707 | { |
|
- | 1708 | return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP); |
|
- | 1709 | } |
|
1667 | 1710 | ||
1668 | #endif |
1711 | static __inline__ int drm_device_is_pcie(struct drm_device *dev) |