Rev 1630 | Rev 1987 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1630 | Rev 1964 | ||
---|---|---|---|
Line 7... | Line 7... | ||
7 | */ |
7 | */ |
Line 8... | Line 8... | ||
8 | 8 | ||
9 | /* |
9 | /* |
10 | * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. |
10 | * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. |
- | 11 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. |
|
11 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. |
12 | * Copyright (c) 2009-2010, Code Aurora Forum. |
12 | * All rights reserved. |
13 | * All rights reserved. |
13 | * |
14 | * |
14 | * Permission is hereby granted, free of charge, to any person obtaining a |
15 | * Permission is hereby granted, free of charge, to any person obtaining a |
15 | * copy of this software and associated documentation files (the "Software"), |
16 | * copy of this software and associated documentation files (the "Software"), |
Line 91... | Line 92... | ||
91 | #define DRM_UT_KMS 0x04 |
92 | #define DRM_UT_KMS 0x04 |
92 | #define DRM_UT_MODE 0x08 |
93 | #define DRM_UT_MODE 0x08 |
Line 93... | Line 94... | ||
93 | 94 | ||
Line -... | Line 95... | ||
- | 95 | #define KHZ2PICOS(a) (1000000000UL/(a)) |
|
- | 96 | ||
- | 97 | /* get_scanout_position() return flags */ |
|
- | 98 | #define DRM_SCANOUTPOS_VALID (1 << 0) |
|
- | 99 | #define DRM_SCANOUTPOS_INVBL (1 << 1) |
|
- | 100 | #define DRM_SCANOUTPOS_ACCURATE (1 << 2) |
|
94 | #define KHZ2PICOS(a) (1000000000UL/(a)) |
101 | |
95 | 102 | ||
96 | extern void drm_ut_debug_printk(unsigned int request_level, |
103 | extern void drm_ut_debug_printk(unsigned int request_level, |
97 | const char *prefix, |
104 | const char *prefix, |
Line 201... | Line 208... | ||
201 | #define DRIVER_DMA_QUEUE 0x200 |
208 | #define DRIVER_DMA_QUEUE 0x200 |
202 | #define DRIVER_FB_DMA 0x400 |
209 | #define DRIVER_FB_DMA 0x400 |
203 | #define DRIVER_IRQ_VBL2 0x800 |
210 | #define DRIVER_IRQ_VBL2 0x800 |
204 | #define DRIVER_GEM 0x1000 |
211 | #define DRIVER_GEM 0x1000 |
205 | #define DRIVER_MODESET 0x2000 |
212 | #define DRIVER_MODESET 0x2000 |
- | 213 | #define DRIVER_USE_PLATFORM_DEVICE 0x4000 |
|
Line 206... | Line 214... | ||
206 | 214 | ||
207 | /***********************************************************************/ |
215 | /***********************************************************************/ |
208 | /** \name Begin the DRM... */ |
216 | /** \name Begin the DRM... */ |
Line 360... | Line 368... | ||
360 | 368 | ||
361 | struct drm_ioctl_desc { |
369 | struct drm_ioctl_desc { |
362 | unsigned int cmd; |
370 | unsigned int cmd; |
363 | int flags; |
371 | int flags; |
- | 372 | drm_ioctl_t *func; |
|
364 | drm_ioctl_t *func; |
373 | unsigned int cmd_drv; |
Line 365... | Line 374... | ||
365 | }; |
374 | }; |
366 | 375 | ||
367 | /** |
376 | /** |
368 | * Creates a driver or general drm_ioctl_desc array entry for the given |
377 | * Creates a driver or general drm_ioctl_desc array entry for the given |
- | 378 | * ioctl, for use by drm_ioctl(). |
|
369 | * ioctl, for use by drm_ioctl(). |
379 | */ |
370 | */ |
380 | |
Line 371... | Line 381... | ||
371 | #define DRM_IOCTL_DEF(ioctl, _func, _flags) \ |
381 | #define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags) \ |
372 | [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags} |
382 | [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl} |
373 | 383 | ||
374 | struct drm_magic_entry { |
384 | struct drm_magic_entry { |
Line 460... | Line 470... | ||
460 | /* Event queued up for userspace to read */ |
470 | /* Event queued up for userspace to read */ |
461 | struct drm_pending_event { |
471 | struct drm_pending_event { |
462 | struct drm_event *event; |
472 | struct drm_event *event; |
463 | struct list_head link; |
473 | struct list_head link; |
464 | struct drm_file *file_priv; |
474 | struct drm_file *file_priv; |
- | 475 | pid_t pid; /* pid of requester, no guarantee it's valid by the time |
|
- | 476 | we deliver the event, for tracing only */ |
|
465 | void (*destroy)(struct drm_pending_event *event); |
477 | void (*destroy)(struct drm_pending_event *event); |
466 | }; |
478 | }; |
Line 467... | Line 479... | ||
467 | 479 | ||
468 | /** File private data */ |
480 | /** File private data */ |
Line 663... | Line 675... | ||
663 | struct drm_gem_object { |
675 | struct drm_gem_object { |
664 | /** Reference count of this object */ |
676 | /** Reference count of this object */ |
665 | struct kref refcount; |
677 | struct kref refcount; |
Line 666... | Line 678... | ||
666 | 678 | ||
667 | /** Handle count of this object. Each handle also holds a reference */ |
679 | /** Handle count of this object. Each handle also holds a reference */ |
Line 668... | Line 680... | ||
668 | struct kref handlecount; |
680 | atomic_t handle_count; /* number of handles on this object */ |
669 | 681 | ||
Line 670... | Line 682... | ||
670 | /** Related drm device */ |
682 | /** Related drm device */ |
Line 734... | Line 746... | ||
734 | struct drm_lock_data lock; /**< Information on hardware lock */ |
746 | struct drm_lock_data lock; /**< Information on hardware lock */ |
Line 735... | Line 747... | ||
735 | 747 | ||
736 | void *driver_priv; /**< Private structure for driver to use */ |
748 | void *driver_priv; /**< Private structure for driver to use */ |
Line -... | Line 749... | ||
- | 749 | }; |
|
- | 750 | ||
- | 751 | /* Size of ringbuffer for vblank timestamps. Just double-buffer |
|
- | 752 | * in initial implementation. |
|
- | 753 | */ |
|
- | 754 | #define DRM_VBLANKTIME_RBSIZE 2 |
|
- | 755 | ||
- | 756 | /* Flags and return codes for get_vblank_timestamp() driver function. */ |
|
- | 757 | #define DRM_CALLED_FROM_VBLIRQ 1 |
|
- | 758 | #define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0) |
|
- | 759 | #define DRM_VBLANKTIME_INVBL (1 << 1) |
|
- | 760 | ||
- | 761 | /* get_scanout_position() return flags */ |
|
- | 762 | #define DRM_SCANOUTPOS_VALID (1 << 0) |
|
- | 763 | #define DRM_SCANOUTPOS_INVBL (1 << 1) |
|
- | 764 | #define DRM_SCANOUTPOS_ACCURATE (1 << 2) |
|
- | 765 | ||
- | 766 | struct drm_bus { |
|
- | 767 | int bus_type; |
|
- | 768 | int (*get_irq)(struct drm_device *dev); |
|
- | 769 | const char *(*get_name)(struct drm_device *dev); |
|
- | 770 | int (*set_busid)(struct drm_device *dev, struct drm_master *master); |
|
- | 771 | int (*set_unique)(struct drm_device *dev, struct drm_master *master, |
|
- | 772 | struct drm_unique *unique); |
|
- | 773 | int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p); |
|
- | 774 | /* hooks that are for PCI */ |
|
- | 775 | int (*agp_init)(struct drm_device *dev); |
|
- | 776 | ||
737 | }; |
777 | }; |
738 | 778 | ||
739 | /** |
779 | /** |
740 | * DRM driver structure. This structure represent the common code for |
780 | * DRM driver structure. This structure represent the common code for |
741 | * a family of cards. There will one drm_device for each card present |
781 | * a family of cards. There will one drm_device for each card present |
Line 750... | Line 790... | ||
750 | void (*lastclose) (struct drm_device *); |
790 | void (*lastclose) (struct drm_device *); |
751 | int (*unload) (struct drm_device *); |
791 | int (*unload) (struct drm_device *); |
752 | int (*suspend) (struct drm_device *, pm_message_t state); |
792 | int (*suspend) (struct drm_device *, pm_message_t state); |
753 | int (*resume) (struct drm_device *); |
793 | int (*resume) (struct drm_device *); |
754 | int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); |
794 | int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); |
755 | void (*dma_ready) (struct drm_device *); |
- | |
756 | int (*dma_quiescent) (struct drm_device *); |
795 | int (*dma_quiescent) (struct drm_device *); |
757 | int (*context_ctor) (struct drm_device *dev, int context); |
- | |
758 | int (*context_dtor) (struct drm_device *dev, int context); |
796 | int (*context_dtor) (struct drm_device *dev, int context); |
759 | int (*kernel_context_switch) (struct drm_device *dev, int old, |
- | |
760 | int new); |
- | |
761 | void (*kernel_context_switch_unlock) (struct drm_device *dev); |
- | |
Line 762... | Line 797... | ||
762 | 797 | ||
763 | /** |
798 | /** |
764 | * get_vblank_counter - get raw hardware vblank counter |
799 | * get_vblank_counter - get raw hardware vblank counter |
765 | * @dev: DRM device |
800 | * @dev: DRM device |
Line 816... | Line 851... | ||
816 | * card is absolutely \b not AGP (return of 0), absolutely \b is AGP |
851 | * card is absolutely \b not AGP (return of 0), absolutely \b is AGP |
817 | * (return of 1), or may or may not be AGP (return of 2). |
852 | * (return of 1), or may or may not be AGP (return of 2). |
818 | */ |
853 | */ |
819 | int (*device_is_agp) (struct drm_device *dev); |
854 | int (*device_is_agp) (struct drm_device *dev); |
Line -... | Line 855... | ||
- | 855 | ||
- | 856 | /** |
|
- | 857 | * Called by vblank timestamping code. |
|
- | 858 | * |
|
- | 859 | * Return the current display scanout position from a crtc. |
|
- | 860 | * |
|
- | 861 | * \param dev DRM device. |
|
- | 862 | * \param crtc Id of the crtc to query. |
|
- | 863 | * \param *vpos Target location for current vertical scanout position. |
|
- | 864 | * \param *hpos Target location for current horizontal scanout position. |
|
- | 865 | * |
|
- | 866 | * Returns vpos as a positive number while in active scanout area. |
|
- | 867 | * Returns vpos as a negative number inside vblank, counting the number |
|
- | 868 | * of scanlines to go until end of vblank, e.g., -1 means "one scanline |
|
- | 869 | * until start of active scanout / end of vblank." |
|
- | 870 | * |
|
- | 871 | * \return Flags, or'ed together as follows: |
|
- | 872 | * |
|
- | 873 | * DRM_SCANOUTPOS_VALID = Query successful. |
|
- | 874 | * DRM_SCANOUTPOS_INVBL = Inside vblank. |
|
- | 875 | * DRM_SCANOUTPOS_ACCURATE = Returned position is accurate. A lack of |
|
- | 876 | * this flag means that returned position may be offset by a constant |
|
- | 877 | * but unknown small number of scanlines wrt. real scanout position. |
|
- | 878 | * |
|
- | 879 | */ |
|
- | 880 | int (*get_scanout_position) (struct drm_device *dev, int crtc, |
|
- | 881 | int *vpos, int *hpos); |
|
- | 882 | ||
- | 883 | /** |
|
- | 884 | * Called by \c drm_get_last_vbltimestamp. Should return a precise |
|
- | 885 | * timestamp when the most recent VBLANK interval ended or will end. |
|
- | 886 | * |
|
- | 887 | * Specifically, the timestamp in @vblank_time should correspond as |
|
- | 888 | * closely as possible to the time when the first video scanline of |
|
- | 889 | * the video frame after the end of VBLANK will start scanning out, |
|
- | 890 | * the time immmediately after end of the VBLANK interval. If the |
|
- | 891 | * @crtc is currently inside VBLANK, this will be a time in the future. |
|
- | 892 | * If the @crtc is currently scanning out a frame, this will be the |
|
- | 893 | * past start time of the current scanout. This is meant to adhere |
|
- | 894 | * to the OpenML OML_sync_control extension specification. |
|
- | 895 | * |
|
- | 896 | * \param dev dev DRM device handle. |
|
- | 897 | * \param crtc crtc for which timestamp should be returned. |
|
- | 898 | * \param *max_error Maximum allowable timestamp error in nanoseconds. |
|
- | 899 | * Implementation should strive to provide timestamp |
|
- | 900 | * with an error of at most *max_error nanoseconds. |
|
- | 901 | * Returns true upper bound on error for timestamp. |
|
- | 902 | * \param *vblank_time Target location for returned vblank timestamp. |
|
- | 903 | * \param flags 0 = Defaults, no special treatment needed. |
|
- | 904 | * \param DRM_CALLED_FROM_VBLIRQ = Function is called from vblank |
|
- | 905 | * irq handler. Some drivers need to apply some workarounds |
|
- | 906 | * for gpu-specific vblank irq quirks if flag is set. |
|
- | 907 | * |
|
- | 908 | * \returns |
|
- | 909 | * Zero if timestamping isn't supported in current display mode or a |
|
- | 910 | * negative number on failure. A positive status code on success, |
|
- | 911 | * which describes how the vblank_time timestamp was computed. |
|
- | 912 | */ |
|
- | 913 | int (*get_vblank_timestamp) (struct drm_device *dev, int crtc, |
|
- | 914 | int *max_error, |
|
- | 915 | struct timeval *vblank_time, |
|
- | 916 | unsigned flags); |
|
820 | 917 | ||
Line 821... | Line 918... | ||
821 | /* these have to be filled in */ |
918 | /* these have to be filled in */ |
822 | 919 | ||
823 | irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); |
920 | irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); |
Line 828... | Line 925... | ||
828 | struct drm_file * file_priv); |
925 | struct drm_file * file_priv); |
829 | void (*reclaim_buffers_locked) (struct drm_device *dev, |
926 | void (*reclaim_buffers_locked) (struct drm_device *dev, |
830 | struct drm_file *file_priv); |
927 | struct drm_file *file_priv); |
831 | void (*reclaim_buffers_idlelocked) (struct drm_device *dev, |
928 | void (*reclaim_buffers_idlelocked) (struct drm_device *dev, |
832 | struct drm_file *file_priv); |
929 | struct drm_file *file_priv); |
833 | resource_size_t (*get_map_ofs) (struct drm_local_map * map); |
- | |
834 | resource_size_t (*get_reg_ofs) (struct drm_device *dev); |
- | |
835 | void (*set_version) (struct drm_device *dev, |
930 | void (*set_version) (struct drm_device *dev, |
836 | struct drm_set_version *sv); |
931 | struct drm_set_version *sv); |
Line 837... | Line 932... | ||
837 | 932 | ||
838 | /* Master routines */ |
933 | /* Master routines */ |
Line 846... | Line 941... | ||
846 | int (*master_set)(struct drm_device *dev, struct drm_file *file_priv, |
941 | int (*master_set)(struct drm_device *dev, struct drm_file *file_priv, |
847 | bool from_open); |
942 | bool from_open); |
848 | void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv, |
943 | void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv, |
849 | bool from_release); |
944 | bool from_release); |
Line 850... | Line -... | ||
850 | - | ||
851 | int (*proc_init)(struct drm_minor *minor); |
- | |
852 | void (*proc_cleanup)(struct drm_minor *minor); |
945 | |
853 | int (*debugfs_init)(struct drm_minor *minor); |
946 | int (*debugfs_init)(struct drm_minor *minor); |
Line 854... | Line 947... | ||
854 | void (*debugfs_cleanup)(struct drm_minor *minor); |
947 | void (*debugfs_cleanup)(struct drm_minor *minor); |
855 | 948 | ||
Line 950... | Line 1043... | ||
950 | struct drm_master *master; /* currently active master for this node */ |
1043 | struct drm_master *master; /* currently active master for this node */ |
951 | struct list_head master_list; |
1044 | struct list_head master_list; |
952 | struct drm_mode_group mode_group; |
1045 | struct drm_mode_group mode_group; |
953 | }; |
1046 | }; |
Line -... | Line 1047... | ||
- | 1047 | ||
Line -... | Line 1048... | ||
- | 1048 | #endif |
|
- | 1049 | ||
- | 1050 | /* mode specified on the command line */ |
|
- | 1051 | struct drm_cmdline_mode { |
|
- | 1052 | bool specified; |
|
- | 1053 | bool refresh_specified; |
|
- | 1054 | bool bpp_specified; |
|
- | 1055 | int xres, yres; |
|
- | 1056 | int bpp; |
|
- | 1057 | int refresh; |
|
- | 1058 | bool rb; |
|
- | 1059 | bool interlace; |
|
- | 1060 | bool cvt; |
|
- | 1061 | bool margins; |
|
Line 954... | Line -... | ||
954 | - | ||
955 | - | ||
Line 956... | Line 1062... | ||
956 | 1062 | enum drm_connector_force force; |
|
957 | 1063 | }; |
|
958 | #endif |
1064 | |
959 | 1065 | ||
Line 1001... | Line 1107... | ||
1001 | /*@{ */ |
1107 | /*@{ */ |
1002 | struct list_head ctxlist; /**< Linked list of context handles */ |
1108 | struct list_head ctxlist; /**< Linked list of context handles */ |
1003 | int ctx_count; /**< Number of context handles */ |
1109 | int ctx_count; /**< Number of context handles */ |
1004 | struct mutex ctxlist_mutex; /**< For ctxlist */ |
1110 | struct mutex ctxlist_mutex; /**< For ctxlist */ |
Line 1005... | Line 1111... | ||
1005 | 1111 | ||
Line 1006... | Line 1112... | ||
1006 | // struct idr ctx_idr; |
1112 | struct idr ctx_idr; |
Line 1007... | Line 1113... | ||
1007 | 1113 | ||
Line 1022... | Line 1128... | ||
1022 | /*@{ */ |
1128 | /*@{ */ |
1023 | int irq_enabled; /**< True if irq handler is enabled */ |
1129 | int irq_enabled; /**< True if irq handler is enabled */ |
1024 | __volatile__ long context_flag; /**< Context swapping flag */ |
1130 | __volatile__ long context_flag; /**< Context swapping flag */ |
1025 | __volatile__ long interrupt_flag; /**< Interruption handler flag */ |
1131 | __volatile__ long interrupt_flag; /**< Interruption handler flag */ |
1026 | __volatile__ long dma_flag; /**< DMA dispatch flag */ |
1132 | __volatile__ long dma_flag; /**< DMA dispatch flag */ |
1027 | // struct timer_list timer; /**< Timer for delaying ctx switch */ |
- | |
1028 | // wait_queue_head_t context_wait; /**< Processes waiting on ctx switch */ |
1133 | // wait_queue_head_t context_wait; /**< Processes waiting on ctx switch */ |
1029 | int last_checked; /**< Last context checked for DMA */ |
1134 | int last_checked; /**< Last context checked for DMA */ |
1030 | int last_context; /**< Last current context */ |
1135 | int last_context; /**< Last current context */ |
1031 | unsigned long last_switch; /**< jiffies at last context switch */ |
1136 | unsigned long last_switch; /**< jiffies at last context switch */ |
1032 | /*@} */ |
1137 | /*@} */ |
Line 1043... | Line 1148... | ||
1043 | */ |
1148 | */ |
1044 | int vblank_disable_allowed; |
1149 | int vblank_disable_allowed; |
Line 1045... | Line 1150... | ||
1045 | 1150 | ||
1046 | // wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */ |
1151 | // wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */ |
- | 1152 | atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */ |
|
- | 1153 | struct timeval *_vblank_time; /**< timestamp of current vblank_count (drivers must alloc right number of fields) */ |
|
1047 | atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */ |
1154 | spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */ |
1048 | spinlock_t vbl_lock; |
1155 | spinlock_t vbl_lock; |
1049 | atomic_t *vblank_refcount; /* number of users of vblank interruptsper crtc */ |
1156 | atomic_t *vblank_refcount; /* number of users of vblank interruptsper crtc */ |
1050 | u32 *last_vblank; /* protected by dev->vbl_lock, used */ |
1157 | u32 *last_vblank; /* protected by dev->vbl_lock, used */ |
1051 | /* for wraparound handling */ |
1158 | /* for wraparound handling */ |
Line 1055... | Line 1162... | ||
1055 | u32 *last_vblank_wait; /* Last vblank seqno waited per CRTC */ |
1162 | u32 *last_vblank_wait; /* Last vblank seqno waited per CRTC */ |
1056 | // struct timer_list vblank_disable_timer; |
1163 | // struct timer_list vblank_disable_timer; |
Line 1057... | Line 1164... | ||
1057 | 1164 | ||
Line -... | Line 1165... | ||
- | 1165 | u32 max_vblank_count; /**< size of vblank counter register */ |
|
- | 1166 | ||
- | 1167 | /** |
|
- | 1168 | * List of events |
|
- | 1169 | */ |
|
- | 1170 | struct list_head vblank_event_list; |
|
1058 | u32 max_vblank_count; /**< size of vblank counter register */ |
1171 | spinlock_t event_lock; |
1059 | 1172 | ||
1060 | /*@} */ |
1173 | /*@} */ |
Line 1061... | Line 1174... | ||
1061 | // cycles_t ctx_start; |
1174 | // cycles_t ctx_start; |
1062 | // cycles_t lck_start; |
1175 | // cycles_t lck_start; |
1063 | 1176 | ||
Line 1064... | Line 1177... | ||
1064 | // struct fasync_struct *buf_async;/**< Processes waiting for SIGIO */ |
1177 | // struct fasync_struct *buf_async;/**< Processes waiting for SIGIO */ |
Line -... | Line 1178... | ||
- | 1178 | // wait_queue_head_t buf_readers; /**< Processes waiting to read */ |
|
1065 | // wait_queue_head_t buf_readers; /**< Processes waiting to read */ |
1179 | // wait_queue_head_t buf_writers; /**< Processes waiting to ctx switch */ |
1066 | // wait_queue_head_t buf_writers; /**< Processes waiting to ctx switch */ |
1180 | |
1067 | 1181 | // struct drm_agp_head *agp; /**< AGP data */ |
|
1068 | // struct drm_agp_head *agp; /**< AGP data */ |
- | |
1069 | 1182 | ||
1070 | struct pci_dev *pdev; /**< PCI device structure */ |
1183 | struct device *dev; /**< Device structure */ |
1071 | int pci_vendor; /**< PCI vendor id */ |
1184 | struct pci_dev *pdev; /**< PCI device structure */ |
1072 | int pci_device; /**< PCI device id */ |
1185 | int pci_vendor; /**< PCI vendor id */ |
1073 | // struct drm_sg_mem *sg; /**< Scatter gather memory */ |
1186 | int pci_device; /**< PCI device id */ |
1074 | int num_crtcs; /**< Number of CRTCs on this device */ |
1187 | unsigned int num_crtcs; /**< Number of CRTCs on this device */ |
Line 1082... | Line 1195... | ||
1082 | // struct drm_local_map *agp_buffer_map; |
1195 | // struct drm_local_map *agp_buffer_map; |
1083 | // unsigned int agp_buffer_token; |
1196 | // unsigned int agp_buffer_token; |
1084 | // struct drm_minor *control; /**< Control node for card */ |
1197 | // struct drm_minor *control; /**< Control node for card */ |
1085 | // struct drm_minor *primary; /**< render type primary screen head */ |
1198 | // struct drm_minor *primary; /**< render type primary screen head */ |
Line 1086... | Line -... | ||
1086 | - | ||
1087 | /** \name Drawable information */ |
- | |
1088 | /*@{ */ |
- | |
1089 | spinlock_t drw_lock; |
- | |
1090 | // struct idr drw_idr; |
- | |
1091 | /*@} */ |
- | |
1092 | 1199 | ||
Line 1093... | Line 1200... | ||
1093 | struct drm_mode_config mode_config; /**< Current mode config */ |
1200 | struct drm_mode_config mode_config; /**< Current mode config */ |
1094 | 1201 | ||
1095 | /** \name GEM information */ |
1202 | /** \name GEM information */ |
1096 | /*@{ */ |
1203 | /*@{ */ |
1097 | spinlock_t object_name_lock; |
- | |
1098 | // struct idr object_name_idr; |
- | |
1099 | atomic_t object_count; |
- | |
1100 | atomic_t object_memory; |
- | |
1101 | atomic_t pin_count; |
- | |
1102 | atomic_t pin_memory; |
- | |
1103 | atomic_t gtt_count; |
- | |
1104 | atomic_t gtt_memory; |
- | |
1105 | uint32_t gtt_total; |
- | |
1106 | uint32_t invalidate_domains; /* domains pending invalidation */ |
1204 | spinlock_t object_name_lock; |
1107 | uint32_t flush_domains; /* domains pending flush */ |
- | |
- | 1205 | struct idr object_name_idr; |
|
1108 | /*@} */ |
1206 | /*@} */ |
Line -... | Line 1207... | ||
- | 1207 | int switch_power_state; |
|
- | 1208 | }; |
|
- | 1209 | ||
- | 1210 | #define DRM_SWITCH_POWER_ON 0 |
|
- | 1211 | #define DRM_SWITCH_POWER_OFF 1 |
|
- | 1212 | #define DRM_SWITCH_POWER_CHANGING 2 |
|
- | 1213 | ||
- | 1214 | ||
- | 1215 | ||
- | 1216 | ||
- | 1217 | ||
- | 1218 | ||
- | 1219 | ||
1109 | 1220 | ||
1110 | }; |
1221 | |
1111 | 1222 | ||
1112 | static __inline__ int drm_device_is_agp(struct drm_device *dev) |
1223 | static __inline__ int drm_device_is_agp(struct drm_device *dev) |
Line 1189... | Line 1300... | ||
1189 | /******************************************************************/ |
1300 | /******************************************************************/ |
1190 | /** \name Internal function definitions */ |
1301 | /** \name Internal function definitions */ |
1191 | /*@{*/ |
1302 | /*@{*/ |
Line 1192... | Line 1303... | ||
1192 | 1303 | ||
1193 | /* Driver support (drm_drv.h) */ |
- | |
1194 | extern int drm_init(struct drm_driver *driver); |
- | |
1195 | extern void drm_exit(struct drm_driver *driver); |
1304 | /* Driver support (drm_drv.h) */ |
1196 | extern long drm_ioctl(struct file *filp, |
1305 | extern long drm_ioctl(struct file *filp, |
1197 | unsigned int cmd, unsigned long arg); |
1306 | unsigned int cmd, unsigned long arg); |
1198 | extern long drm_compat_ioctl(struct file *filp, |
1307 | extern long drm_compat_ioctl(struct file *filp, |
1199 | unsigned int cmd, unsigned long arg); |
1308 | unsigned int cmd, unsigned long arg); |
Line 1200... | Line 1309... | ||
1200 | extern int drm_lastclose(struct drm_device *dev); |
1309 | extern int drm_lastclose(struct drm_device *dev); |
- | 1310 | ||
1201 | 1311 | /* Device support (drm_fops.h) */ |
|
1202 | /* Device support (drm_fops.h) */ |
1312 | extern struct mutex drm_global_mutex; |
1203 | extern int drm_open(struct inode *inode, struct file *filp); |
1313 | extern int drm_open(struct inode *inode, struct file *filp); |
1204 | extern int drm_stub_open(struct inode *inode, struct file *filp); |
1314 | extern int drm_stub_open(struct inode *inode, struct file *filp); |
1205 | extern int drm_fasync(int fd, struct file *filp, int on); |
1315 | extern int drm_fasync(int fd, struct file *filp, int on); |
Line 1209... | Line 1319... | ||
1209 | 1319 | ||
1210 | /* Mapping support (drm_vm.h) */ |
1320 | /* Mapping support (drm_vm.h) */ |
1211 | extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); |
1321 | extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); |
1212 | extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma); |
1322 | extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma); |
1213 | extern void drm_vm_open_locked(struct vm_area_struct *vma); |
1323 | extern void drm_vm_open_locked(struct vm_area_struct *vma); |
1214 | extern resource_size_t drm_core_get_map_ofs(struct drm_local_map * map); |
- | |
1215 | extern resource_size_t drm_core_get_reg_ofs(struct drm_device *dev); |
1324 | extern void drm_vm_close_locked(struct vm_area_struct *vma); |
Line 1216... | Line 1325... | ||
1216 | extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); |
1325 | extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); |
1217 | 1326 | ||
1218 | /* Memory management support (drm_memory.h) */ |
1327 | /* Memory management support (drm_memory.h) */ |
1219 | #include "drm_memory.h" |
1328 | #include "drm_memory.h" |
1220 | extern void drm_mem_init(void); |
1329 | extern void drm_mem_init(void); |
1221 | extern int drm_mem_info(char *buf, char **start, off_t offset, |
1330 | extern int drm_mem_info(char *buf, char **start, off_t offset, |
Line 1222... | Line -... | ||
1222 | int request, int *eof, void *data); |
- | |
1223 | extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area); |
1331 | int request, int *eof, void *data); |
1224 | 1332 | extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area); |
|
1225 | extern DRM_AGP_MEM *drm_alloc_agp(struct drm_device *dev, int pages, u32 type); |
1333 | |
1226 | extern int drm_free_agp(DRM_AGP_MEM * handle, int pages); |
1334 | extern void drm_free_agp(DRM_AGP_MEM * handle, int pages); |
1227 | extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start); |
1335 | extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start); |
1228 | extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, |
1336 | extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, |
Line 1243... | Line 1351... | ||
1243 | struct drm_file *file_priv); |
1351 | struct drm_file *file_priv); |
1244 | extern int drm_getclient(struct drm_device *dev, void *data, |
1352 | extern int drm_getclient(struct drm_device *dev, void *data, |
1245 | struct drm_file *file_priv); |
1353 | struct drm_file *file_priv); |
1246 | extern int drm_getstats(struct drm_device *dev, void *data, |
1354 | extern int drm_getstats(struct drm_device *dev, void *data, |
1247 | struct drm_file *file_priv); |
1355 | struct drm_file *file_priv); |
- | 1356 | extern int drm_getcap(struct drm_device *dev, void *data, |
|
- | 1357 | struct drm_file *file_priv); |
|
1248 | extern int drm_setversion(struct drm_device *dev, void *data, |
1358 | extern int drm_setversion(struct drm_device *dev, void *data, |
1249 | struct drm_file *file_priv); |
1359 | struct drm_file *file_priv); |
1250 | extern int drm_noop(struct drm_device *dev, void *data, |
1360 | extern int drm_noop(struct drm_device *dev, void *data, |
1251 | struct drm_file *file_priv); |
1361 | struct drm_file *file_priv); |
Line 1273... | Line 1383... | ||
1273 | extern int drm_setsareactx(struct drm_device *dev, void *data, |
1383 | extern int drm_setsareactx(struct drm_device *dev, void *data, |
1274 | struct drm_file *file_priv); |
1384 | struct drm_file *file_priv); |
1275 | extern int drm_getsareactx(struct drm_device *dev, void *data, |
1385 | extern int drm_getsareactx(struct drm_device *dev, void *data, |
1276 | struct drm_file *file_priv); |
1386 | struct drm_file *file_priv); |
Line 1277... | Line -... | ||
1277 | - | ||
1278 | /* Drawable IOCTL support (drm_drawable.h) */ |
- | |
1279 | extern int drm_adddraw(struct drm_device *dev, void *data, |
- | |
1280 | struct drm_file *file_priv); |
- | |
1281 | extern int drm_rmdraw(struct drm_device *dev, void *data, |
- | |
1282 | struct drm_file *file_priv); |
- | |
1283 | extern int drm_update_drawable_info(struct drm_device *dev, void *data, |
- | |
1284 | struct drm_file *file_priv); |
- | |
1285 | extern struct drm_drawable_info *drm_get_drawable_info(struct drm_device *dev, |
- | |
1286 | drm_drawable_t id); |
- | |
1287 | extern void drm_drawable_free_all(struct drm_device *dev); |
- | |
1288 | 1387 | ||
1289 | /* Authentication IOCTL support (drm_auth.h) */ |
1388 | /* Authentication IOCTL support (drm_auth.h) */ |
1290 | extern int drm_getmagic(struct drm_device *dev, void *data, |
1389 | extern int drm_getmagic(struct drm_device *dev, void *data, |
1291 | struct drm_file *file_priv); |
1390 | struct drm_file *file_priv); |
1292 | extern int drm_authmagic(struct drm_device *dev, void *data, |
1391 | extern int drm_authmagic(struct drm_device *dev, void *data, |
Line 1298... | Line 1397... | ||
1298 | /* Locking IOCTL support (drm_lock.h) */ |
1397 | /* Locking IOCTL support (drm_lock.h) */ |
1299 | extern int drm_lock(struct drm_device *dev, void *data, |
1398 | extern int drm_lock(struct drm_device *dev, void *data, |
1300 | struct drm_file *file_priv); |
1399 | struct drm_file *file_priv); |
1301 | extern int drm_unlock(struct drm_device *dev, void *data, |
1400 | extern int drm_unlock(struct drm_device *dev, void *data, |
1302 | struct drm_file *file_priv); |
1401 | struct drm_file *file_priv); |
1303 | extern int drm_lock_take(struct drm_lock_data *lock_data, unsigned int context); |
- | |
1304 | extern int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context); |
1402 | extern int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context); |
1305 | extern void drm_idlelock_take(struct drm_lock_data *lock_data); |
1403 | extern void drm_idlelock_take(struct drm_lock_data *lock_data); |
1306 | extern void drm_idlelock_release(struct drm_lock_data *lock_data); |
1404 | extern void drm_idlelock_release(struct drm_lock_data *lock_data); |
Line 1307... | Line 1405... | ||
1307 | 1405 | ||
Line 1333... | Line 1431... | ||
1333 | extern int drm_freebufs(struct drm_device *dev, void *data, |
1431 | extern int drm_freebufs(struct drm_device *dev, void *data, |
1334 | struct drm_file *file_priv); |
1432 | struct drm_file *file_priv); |
1335 | extern int drm_mapbufs(struct drm_device *dev, void *data, |
1433 | extern int drm_mapbufs(struct drm_device *dev, void *data, |
1336 | struct drm_file *file_priv); |
1434 | struct drm_file *file_priv); |
1337 | extern int drm_order(unsigned long size); |
1435 | extern int drm_order(unsigned long size); |
1338 | extern resource_size_t drm_get_resource_start(struct drm_device *dev, |
- | |
1339 | unsigned int resource); |
- | |
1340 | extern resource_size_t drm_get_resource_len(struct drm_device *dev, |
- | |
1341 | unsigned int resource); |
- | |
Line 1342... | Line 1436... | ||
1342 | 1436 | ||
1343 | /* DMA support (drm_dma.h) */ |
1437 | /* DMA support (drm_dma.h) */ |
1344 | extern int drm_dma_setup(struct drm_device *dev); |
1438 | extern int drm_dma_setup(struct drm_device *dev); |
1345 | extern void drm_dma_takedown(struct drm_device *dev); |
1439 | extern void drm_dma_takedown(struct drm_device *dev); |
Line 1360... | Line 1454... | ||
1360 | extern int drm_vblank_init(struct drm_device *dev, int num_crtcs); |
1454 | extern int drm_vblank_init(struct drm_device *dev, int num_crtcs); |
1361 | extern int drm_wait_vblank(struct drm_device *dev, void *data, |
1455 | extern int drm_wait_vblank(struct drm_device *dev, void *data, |
1362 | struct drm_file *filp); |
1456 | struct drm_file *filp); |
1363 | extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); |
1457 | extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); |
1364 | extern u32 drm_vblank_count(struct drm_device *dev, int crtc); |
1458 | extern u32 drm_vblank_count(struct drm_device *dev, int crtc); |
- | 1459 | extern u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc, |
|
- | 1460 | struct timeval *vblanktime); |
|
1365 | extern void drm_handle_vblank(struct drm_device *dev, int crtc); |
1461 | extern bool drm_handle_vblank(struct drm_device *dev, int crtc); |
1366 | extern int drm_vblank_get(struct drm_device *dev, int crtc); |
1462 | extern int drm_vblank_get(struct drm_device *dev, int crtc); |
1367 | extern void drm_vblank_put(struct drm_device *dev, int crtc); |
1463 | extern void drm_vblank_put(struct drm_device *dev, int crtc); |
1368 | extern void drm_vblank_off(struct drm_device *dev, int crtc); |
1464 | extern void drm_vblank_off(struct drm_device *dev, int crtc); |
1369 | extern void drm_vblank_cleanup(struct drm_device *dev); |
1465 | extern void drm_vblank_cleanup(struct drm_device *dev); |
- | 1466 | extern u32 drm_get_last_vbltimestamp(struct drm_device *dev, int crtc, |
|
- | 1467 | struct timeval *tvblank, unsigned flags); |
|
- | 1468 | extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, |
|
- | 1469 | int crtc, int *max_error, |
|
- | 1470 | struct timeval *vblank_time, |
|
- | 1471 | unsigned flags, |
|
- | 1472 | struct drm_crtc *refcrtc); |
|
- | 1473 | extern void drm_calc_timestamping_constants(struct drm_crtc *crtc); |
|
- | 1474 | ||
- | 1475 | extern bool |
|
- | 1476 | drm_mode_parse_command_line_for_connector(const char *mode_option, |
|
- | 1477 | struct drm_connector *connector, |
|
- | 1478 | struct drm_cmdline_mode *mode); |
|
- | 1479 | ||
- | 1480 | extern struct drm_display_mode * |
|
- | 1481 | drm_mode_create_from_cmdline_mode(struct drm_device *dev, |
|
- | 1482 | struct drm_cmdline_mode *cmd); |
|
- | 1483 | ||
1370 | /* Modesetting support */ |
1484 | /* Modesetting support */ |
1371 | extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); |
1485 | extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); |
1372 | extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc); |
1486 | extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc); |
1373 | extern int drm_modeset_ctl(struct drm_device *dev, void *data, |
1487 | extern int drm_modeset_ctl(struct drm_device *dev, void *data, |
1374 | struct drm_file *file_priv); |
1488 | struct drm_file *file_priv); |
Line 1397... | Line 1511... | ||
1397 | extern int drm_agp_unbind_ioctl(struct drm_device *dev, void *data, |
1511 | extern int drm_agp_unbind_ioctl(struct drm_device *dev, void *data, |
1398 | struct drm_file *file_priv); |
1512 | struct drm_file *file_priv); |
1399 | extern int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request); |
1513 | extern int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request); |
1400 | extern int drm_agp_bind_ioctl(struct drm_device *dev, void *data, |
1514 | extern int drm_agp_bind_ioctl(struct drm_device *dev, void *data, |
1401 | struct drm_file *file_priv); |
1515 | struct drm_file *file_priv); |
1402 | extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size_t pages, u32 type); |
- | |
1403 | extern int drm_agp_free_memory(DRM_AGP_MEM * handle); |
- | |
1404 | extern int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start); |
- | |
1405 | extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle); |
- | |
1406 | extern void drm_agp_chipset_flush(struct drm_device *dev); |
- | |
Line 1407... | Line 1516... | ||
1407 | 1516 | ||
1408 | /* Stub support (drm_stub.h) */ |
1517 | /* Stub support (drm_stub.h) */ |
1409 | extern int drm_setmaster_ioctl(struct drm_device *dev, void *data, |
1518 | extern int drm_setmaster_ioctl(struct drm_device *dev, void *data, |
1410 | struct drm_file *file_priv); |
1519 | struct drm_file *file_priv); |
1411 | extern int drm_dropmaster_ioctl(struct drm_device *dev, void *data, |
1520 | extern int drm_dropmaster_ioctl(struct drm_device *dev, void *data, |
1412 | struct drm_file *file_priv); |
1521 | struct drm_file *file_priv); |
1413 | struct drm_master *drm_master_create(struct drm_minor *minor); |
1522 | struct drm_master *drm_master_create(struct drm_minor *minor); |
1414 | extern struct drm_master *drm_master_get(struct drm_master *master); |
1523 | extern struct drm_master *drm_master_get(struct drm_master *master); |
1415 | extern void drm_master_put(struct drm_master **master); |
- | |
1416 | extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, |
- | |
- | 1524 | extern void drm_master_put(struct drm_master **master); |
|
1417 | struct drm_driver *driver); |
1525 | |
1418 | extern void drm_put_dev(struct drm_device *dev); |
1526 | extern void drm_put_dev(struct drm_device *dev); |
1419 | extern int drm_put_minor(struct drm_minor **minor); |
1527 | extern int drm_put_minor(struct drm_minor **minor); |
Line -... | Line 1528... | ||
- | 1528 | extern unsigned int drm_debug; |
|
- | 1529 | ||
- | 1530 | extern unsigned int drm_vblank_offdelay; |
|
1420 | extern unsigned int drm_debug; |
1531 | extern unsigned int drm_timestamp_precision; |
1421 | 1532 | ||
1422 | extern struct class *drm_class; |
1533 | extern struct class *drm_class; |
Line 1423... | Line 1534... | ||
1423 | extern struct proc_dir_entry *drm_proc_root; |
1534 | extern struct proc_dir_entry *drm_proc_root; |
Line 1449... | Line 1560... | ||
1449 | extern int drm_queues_info(struct seq_file *m, void *data); |
1560 | extern int drm_queues_info(struct seq_file *m, void *data); |
1450 | extern int drm_bufs_info(struct seq_file *m, void *data); |
1561 | extern int drm_bufs_info(struct seq_file *m, void *data); |
1451 | extern int drm_vblank_info(struct seq_file *m, void *data); |
1562 | extern int drm_vblank_info(struct seq_file *m, void *data); |
1452 | extern int drm_clients_info(struct seq_file *m, void* data); |
1563 | extern int drm_clients_info(struct seq_file *m, void* data); |
1453 | extern int drm_gem_name_info(struct seq_file *m, void *data); |
1564 | extern int drm_gem_name_info(struct seq_file *m, void *data); |
1454 | extern int drm_gem_object_info(struct seq_file *m, void* data); |
- | |
Line 1455... | Line 1565... | ||
1455 | 1565 | ||
1456 | #if DRM_DEBUG_CODE |
1566 | #if DRM_DEBUG_CODE |
1457 | extern int drm_vma_info(struct seq_file *m, void *data); |
1567 | extern int drm_vma_info(struct seq_file *m, void *data); |
Line 1492... | Line 1602... | ||
1492 | { }; |
1602 | { }; |
Line 1493... | Line 1603... | ||
1493 | 1603 | ||
1494 | /* Graphics Execution Manager library functions (drm_gem.c) */ |
1604 | /* Graphics Execution Manager library functions (drm_gem.c) */ |
1495 | int drm_gem_init(struct drm_device *dev); |
1605 | int drm_gem_init(struct drm_device *dev); |
- | 1606 | void drm_gem_destroy(struct drm_device *dev); |
|
1496 | void drm_gem_destroy(struct drm_device *dev); |
1607 | void drm_gem_object_release(struct drm_gem_object *obj); |
1497 | void drm_gem_object_free(struct kref *kref); |
1608 | void drm_gem_object_free(struct kref *kref); |
1498 | struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, |
1609 | struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, |
- | 1610 | size_t size); |
|
- | 1611 | int drm_gem_object_init(struct drm_device *dev, |
|
1499 | size_t size); |
1612 | struct drm_gem_object *obj, size_t size); |
1500 | void drm_gem_object_handle_free(struct kref *kref); |
1613 | void drm_gem_object_handle_free(struct drm_gem_object *obj); |
1501 | void drm_gem_vm_open(struct vm_area_struct *vma); |
1614 | void drm_gem_vm_open(struct vm_area_struct *vma); |
1502 | void drm_gem_vm_close(struct vm_area_struct *vma); |
1615 | void drm_gem_vm_close(struct vm_area_struct *vma); |
Line 1503... | Line 1616... | ||
1503 | int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); |
1616 | int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); |