Rev 4075 | Rev 4111 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4075 | Rev 4080 | ||
---|---|---|---|
Line 632... | Line 632... | ||
632 | if (unlikely(ret != 0)) |
632 | if (unlikely(ret != 0)) |
633 | goto out_no_fifo; |
633 | goto out_no_fifo; |
634 | // vmw_fb_init(dev_priv); |
634 | // vmw_fb_init(dev_priv); |
635 | } |
635 | } |
Line -... | Line 636... | ||
- | 636 | ||
636 | 637 | LEAVE(); |
|
Line 637... | Line 638... | ||
637 | return 0; |
638 | return 0; |
638 | 639 | ||
639 | out_no_fifo: |
640 | out_no_fifo: |
Line 960... | Line 961... | ||
960 | 961 | ||
961 | if (dev_priv->enable_fb) |
962 | if (dev_priv->enable_fb) |
962 | vmw_fb_on(dev_priv); |
963 | vmw_fb_on(dev_priv); |
Line -... | Line 964... | ||
- | 964 | } |
|
- | 965 | ||
- | 966 | ||
- | 967 | static void vmw_remove(struct pci_dev *pdev) |
|
- | 968 | { |
|
- | 969 | struct drm_device *dev = pci_get_drvdata(pdev); |
|
- | 970 | ||
- | 971 | drm_put_dev(dev); |
|
- | 972 | } |
|
- | 973 | ||
- | 974 | static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val, |
|
- | 975 | void *ptr) |
|
- | 976 | { |
|
- | 977 | struct vmw_private *dev_priv = |
|
- | 978 | container_of(nb, struct vmw_private, pm_nb); |
|
- | 979 | struct vmw_master *vmaster = dev_priv->active_master; |
|
- | 980 | ||
- | 981 | switch (val) { |
|
- | 982 | case PM_HIBERNATION_PREPARE: |
|
- | 983 | case PM_SUSPEND_PREPARE: |
|
- | 984 | ttm_suspend_lock(&vmaster->lock); |
|
- | 985 | ||
- | 986 | /** |
|
- | 987 | * This empties VRAM and unbinds all GMR bindings. |
|
- | 988 | * Buffer contents is moved to swappable memory. |
|
- | 989 | */ |
|
- | 990 | vmw_execbuf_release_pinned_bo(dev_priv); |
|
- | 991 | vmw_resource_evict_all(dev_priv); |
|
- | 992 | ttm_bo_swapout_all(&dev_priv->bdev); |
|
- | 993 | ||
- | 994 | break; |
|
- | 995 | case PM_POST_HIBERNATION: |
|
- | 996 | case PM_POST_SUSPEND: |
|
- | 997 | case PM_POST_RESTORE: |
|
- | 998 | ttm_suspend_unlock(&vmaster->lock); |
|
- | 999 | ||
- | 1000 | break; |
|
- | 1001 | case PM_RESTORE_PREPARE: |
|
- | 1002 | break; |
|
- | 1003 | default: |
|
- | 1004 | break; |
|
- | 1005 | } |
|
- | 1006 | return 0; |
|
- | 1007 | } |
|
- | 1008 | ||
- | 1009 | /** |
|
- | 1010 | * These might not be needed with the virtual SVGA device. |
|
- | 1011 | */ |
|
- | 1012 | ||
- | 1013 | static int vmw_pci_suspend(struct pci_dev *pdev, pm_message_t state) |
|
- | 1014 | { |
|
- | 1015 | struct drm_device *dev = pci_get_drvdata(pdev); |
|
- | 1016 | struct vmw_private *dev_priv = vmw_priv(dev); |
|
- | 1017 | ||
- | 1018 | if (dev_priv->num_3d_resources != 0) { |
|
- | 1019 | DRM_INFO("Can't suspend or hibernate " |
|
- | 1020 | "while 3D resources are active.\n"); |
|
- | 1021 | return -EBUSY; |
|
- | 1022 | } |
|
- | 1023 | ||
- | 1024 | pci_save_state(pdev); |
|
- | 1025 | pci_disable_device(pdev); |
|
- | 1026 | pci_set_power_state(pdev, PCI_D3hot); |
|
- | 1027 | return 0; |
|
- | 1028 | } |
|
- | 1029 | ||
- | 1030 | static int vmw_pci_resume(struct pci_dev *pdev) |
|
- | 1031 | { |
|
- | 1032 | pci_set_power_state(pdev, PCI_D0); |
|
- | 1033 | pci_restore_state(pdev); |
|
- | 1034 | return pci_enable_device(pdev); |
|
- | 1035 | } |
|
- | 1036 | ||
- | 1037 | static int vmw_pm_suspend(struct device *kdev) |
|
- | 1038 | { |
|
- | 1039 | struct pci_dev *pdev = to_pci_dev(kdev); |
|
- | 1040 | struct pm_message dummy; |
|
- | 1041 | ||
- | 1042 | dummy.event = 0; |
|
- | 1043 | ||
- | 1044 | return vmw_pci_suspend(pdev, dummy); |
|
- | 1045 | } |
|
- | 1046 | ||
- | 1047 | static int vmw_pm_resume(struct device *kdev) |
|
- | 1048 | { |
|
- | 1049 | struct pci_dev *pdev = to_pci_dev(kdev); |
|
- | 1050 | ||
- | 1051 | return vmw_pci_resume(pdev); |
|
- | 1052 | } |
|
- | 1053 | ||
- | 1054 | static int vmw_pm_prepare(struct device *kdev) |
|
- | 1055 | { |
|
- | 1056 | struct pci_dev *pdev = to_pci_dev(kdev); |
|
- | 1057 | struct drm_device *dev = pci_get_drvdata(pdev); |
|
- | 1058 | struct vmw_private *dev_priv = vmw_priv(dev); |
|
- | 1059 | ||
- | 1060 | /** |
|
- | 1061 | * Release 3d reference held by fbdev and potentially |
|
- | 1062 | * stop fifo. |
|
- | 1063 | */ |
|
- | 1064 | dev_priv->suspended = true; |
|
- | 1065 | if (dev_priv->enable_fb) |
|
- | 1066 | vmw_3d_resource_dec(dev_priv, true); |
|
- | 1067 | ||
- | 1068 | if (dev_priv->num_3d_resources != 0) { |
|
- | 1069 | ||
- | 1070 | DRM_INFO("Can't suspend or hibernate " |
|
- | 1071 | "while 3D resources are active.\n"); |
|
- | 1072 | ||
- | 1073 | if (dev_priv->enable_fb) |
|
- | 1074 | vmw_3d_resource_inc(dev_priv, true); |
|
- | 1075 | dev_priv->suspended = false; |
|
- | 1076 | return -EBUSY; |
|
- | 1077 | } |
|
- | 1078 | ||
- | 1079 | return 0; |
|
963 | } |
1080 | } |
Line 1003... | Line 1120... | ||
1003 | // .major = VMWGFX_DRIVER_MAJOR, |
1120 | // .major = VMWGFX_DRIVER_MAJOR, |
1004 | // .minor = VMWGFX_DRIVER_MINOR, |
1121 | // .minor = VMWGFX_DRIVER_MINOR, |
1005 | // .patchlevel = VMWGFX_DRIVER_PATCHLEVEL |
1122 | // .patchlevel = VMWGFX_DRIVER_PATCHLEVEL |
1006 | }; |
1123 | }; |
Line -... | Line 1124... | ||
- | 1124 | ||
- | 1125 | ||
- | 1126 | int vmw_init(void) |
|
- | 1127 | { |
|
- | 1128 | static pci_dev_t device; |
|
- | 1129 | const struct pci_device_id *ent; |
|
- | 1130 | int err; |
|
- | 1131 | ||
- | 1132 | ENTER(); |
|
- | 1133 | ||
- | 1134 | ent = find_pci_device(&device, vmw_pci_id_list); |
|
- | 1135 | if( unlikely(ent == NULL) ) |
|
- | 1136 | { |
|
- | 1137 | dbgprintf("device not found\n"); |
|
- | 1138 | return -ENODEV; |
|
- | 1139 | }; |
|
- | 1140 | ||
- | 1141 | DRM_INFO("device %x:%x\n", device.pci_dev.vendor, |
|
- | 1142 | device.pci_dev.device); |
|
- | 1143 | drm_global_init(); |
|
- | 1144 | ||
- | 1145 | err = drm_get_dev(&device.pci_dev, ent); |
|
- | 1146 | LEAVE(); |
|
- | 1147 | ||
- | 1148 | return err; |
|
- | 1149 | } |
|
- | 1150 | ||
- | 1151 | ||
- | 1152 | ||
- | 1153 | //module_init(vmwgfx_init); |
|
- | 1154 | //module_exit(vmwgfx_exit); |
|
- | 1155 | ||
- | 1156 | MODULE_AUTHOR("VMware Inc. and others"); |
|
- | 1157 | MODULE_DESCRIPTION("Standalone drm driver for the VMware SVGA device"); |
|
- | 1158 | MODULE_LICENSE("GPL and additional rights"); |
|
1007 | 1159 | ||
1008 | int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent) |
1160 | int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent) |
1009 | { |
1161 | { |
1010 | static struct drm_device drm_dev; |
1162 | static struct drm_device drm_dev; |
Line 1064... | Line 1216... | ||
1064 | ret = vmw_driver_load(dev, ent->driver_data ); |
1216 | ret = vmw_driver_load(dev, ent->driver_data ); |
Line 1065... | Line 1217... | ||
1065 | 1217 | ||
1066 | if (ret) |
1218 | if (ret) |
Line 1067... | Line 1219... | ||
1067 | goto err_g4; |
1219 | goto err_g4; |
Line 1068... | Line 1220... | ||
1068 | 1220 | ||
1069 | // ret = init_display_kms(dev); |
1221 | ret = kms_init(dev); |
Line 1070... | Line 1222... | ||
1070 | 1222 | ||
Line 1081... | Line 1233... | ||
1081 | // pci_disable_device(pdev); |
1233 | // pci_disable_device(pdev); |
1082 | //err_g1: |
1234 | //err_g1: |
Line 1083... | Line 1235... | ||
1083 | 1235 | ||
1084 | return ret; |
1236 | return ret; |
1085 | } |
- | |
1086 | - | ||
1087 | int vmw_init(void) |
- | |
1088 | { |
- | |
1089 | static pci_dev_t device; |
- | |
1090 | const struct pci_device_id *ent; |
- | |
1091 | int err; |
- | |
1092 | - | ||
1093 | ent = find_pci_device(&device, vmw_pci_id_list); |
- | |
1094 | if( unlikely(ent == NULL) ) |
- | |
1095 | { |
- | |
1096 | dbgprintf("device not found\n"); |
- | |
1097 | return -ENODEV; |
- | |
1098 | }; |
- | |
1099 | - | ||
1100 | - | ||
1101 | DRM_INFO("device %x:%x\n", device.pci_dev.vendor, |
- | |
1102 | device.pci_dev.device); |
- | |
1103 | - | ||
1104 | drm_global_init(); |
- | |
1105 | - | ||
1106 | err = drm_get_dev(&device.pci_dev, ent); |
- | |
1107 | - | ||
1108 | return err; |
- | |
1109 | } |
- | |
1110 | - | ||
1111 | - | ||
1112 | - | ||
1113 | //module_init(vmwgfx_init); |
- | |
1114 | //module_exit(vmwgfx_exit); |
- | |
1115 | - | ||
1116 | MODULE_AUTHOR("VMware Inc. and others"); |
- | |
1117 | MODULE_DESCRIPTION("Standalone drm driver for the VMware SVGA device"); |
- | |
1118 | MODULE_LICENSE("GPL and additional rights");>>>>>>> |
- |