Subversion Repositories Kolibri OS

Rev

Rev 4080 | Rev 4569 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4080 Rev 4111
Line 39... Line 39...
39
#define VMW_FB_RESERVATION 0
39
#define VMW_FB_RESERVATION 0
Line 40... Line 40...
40
 
40
 
41
#define VMW_MIN_INITIAL_WIDTH 800
41
#define VMW_MIN_INITIAL_WIDTH 800
Line 42... Line -...
42
#define VMW_MIN_INITIAL_HEIGHT 600
-
 
43
 
-
 
44
struct drm_device *main_device;
-
 
45
 
-
 
46
struct drm_file *drm_file_handlers[256];
42
#define VMW_MIN_INITIAL_HEIGHT 600
47
 
43
 
48
#if 0
44
#if 0
49
/**
45
/**
Line 126... Line 122...
126
 
122
 
127
/**
123
/**
128
 * Ioctl definitions.
124
 * Ioctl definitions.
Line 129... Line 125...
129
 */
125
 */
130
 
126
 
131
static struct drm_ioctl_desc vmw_ioctls[] = {
127
static const struct drm_ioctl_desc vmw_ioctls[] = {
132
	VMW_IOCTL_DEF(VMW_GET_PARAM, vmw_getparam_ioctl,
128
	VMW_IOCTL_DEF(VMW_GET_PARAM, vmw_getparam_ioctl,
133
		      DRM_AUTH | DRM_UNLOCKED),
129
		      DRM_AUTH | DRM_UNLOCKED),
134
	VMW_IOCTL_DEF(VMW_ALLOC_DMABUF, vmw_dmabuf_alloc_ioctl,
130
	VMW_IOCTL_DEF(VMW_ALLOC_DMABUF, vmw_dmabuf_alloc_ioctl,
Line 614... Line 610...
614
			goto out_no_irq;
610
			goto out_no_irq;
615
		}
611
		}
616
	}
612
	}
Line 617... Line 613...
617
 
613
 
618
	dev_priv->fman = vmw_fence_manager_init(dev_priv);
614
	dev_priv->fman = vmw_fence_manager_init(dev_priv);
-
 
615
	if (unlikely(dev_priv->fman == NULL)) {
619
	if (unlikely(dev_priv->fman == NULL))
616
		ret = -ENOMEM;
-
 
617
		goto out_no_fman;
Line 620... Line 618...
620
		goto out_no_fman;
618
	}
621
 
619
 
Line 622... Line 620...
622
	vmw_kms_save_vga(dev_priv);
620
	vmw_kms_save_vga(dev_priv);
Line 632... Line 630...
632
       if (unlikely(ret != 0))
630
       if (unlikely(ret != 0))
633
           goto out_no_fifo;
631
           goto out_no_fifo;
634
//       vmw_fb_init(dev_priv);
632
//       vmw_fb_init(dev_priv);
635
    }
633
    }
Line -... Line 634...
-
 
634
 
-
 
635
    main_device = dev;
636
 
636
 
637
    LEAVE();
637
    LEAVE();
Line 638... Line 638...
638
	return 0;
638
	return 0;
639
 
639
 
Line 775... Line 775...
775
	 * Do extra checking on driver private ioctls.
775
	 * Do extra checking on driver private ioctls.
776
	 */
776
	 */
Line 777... Line 777...
777
 
777
 
778
	if ((nr >= DRM_COMMAND_BASE) && (nr < DRM_COMMAND_END)
778
	if ((nr >= DRM_COMMAND_BASE) && (nr < DRM_COMMAND_END)
779
	    && (nr < DRM_COMMAND_BASE + dev->driver->num_ioctls)) {
779
	    && (nr < DRM_COMMAND_BASE + dev->driver->num_ioctls)) {
780
		struct drm_ioctl_desc *ioctl =
780
		const struct drm_ioctl_desc *ioctl =
Line 781... Line 781...
781
		    &vmw_ioctls[nr - DRM_COMMAND_BASE];
781
		    &vmw_ioctls[nr - DRM_COMMAND_BASE];
782
 
782
 
783
		if (unlikely(ioctl->cmd_drv != cmd)) {
783
		if (unlikely(ioctl->cmd_drv != cmd)) {
Line 788... Line 788...
788
	}
788
	}
Line 789... Line 789...
789
 
789
 
790
	return drm_ioctl(filp, cmd, arg);
790
	return drm_ioctl(filp, cmd, arg);
Line 791... Line -...
791
}
-
 
792
 
-
 
793
static int vmw_firstopen(struct drm_device *dev)
-
 
794
{
-
 
795
	struct vmw_private *dev_priv = vmw_priv(dev);
-
 
796
	dev_priv->is_opened = true;
-
 
797
 
-
 
798
	return 0;
-
 
799
}
791
}
800
 
792
 
801
static void vmw_lastclose(struct drm_device *dev)
-
 
802
{
793
static void vmw_lastclose(struct drm_device *dev)
803
	struct vmw_private *dev_priv = vmw_priv(dev);
794
{
804
	struct drm_crtc *crtc;
795
	struct drm_crtc *crtc;
Line 805... Line -...
805
	struct drm_mode_set set;
-
 
806
	int ret;
-
 
807
 
-
 
808
	/**
-
 
809
	 * Do nothing on the lastclose call from drm_unload.
-
 
810
	 */
-
 
811
 
-
 
812
	if (!dev_priv->is_opened)
-
 
813
		return;
796
	struct drm_mode_set set;
814
 
797
	int ret;
815
	dev_priv->is_opened = false;
798
 
816
	set.x = 0;
799
	set.x = 0;
817
	set.y = 0;
800
	set.y = 0;
Line 1080... Line 1063...
1080
}
1063
}
Line 1081... Line 1064...
1081
 
1064
 
Line 1082... Line -...
1082
#endif
-
 
1083
 
-
 
1084
 
1065
#endif
1085
 
1066
 
1086
 
1067
 
1087
static struct drm_driver driver = {
1068
static struct drm_driver driver = {
1088
	.driver_features = DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED |
1069
	.driver_features = DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED |
1089
	DRIVER_MODESET,
1070
	DRIVER_MODESET,
1090
//   .load = vmw_driver_load,
1071
   .load = vmw_driver_load,
1091
//   .unload = vmw_driver_unload,
1072
//   .unload = vmw_driver_unload,
1092
//   .firstopen = vmw_firstopen,
1073
//   .firstopen = vmw_firstopen,
Line 1120... Line 1101...
1120
//   .major = VMWGFX_DRIVER_MAJOR,
1101
//   .major = VMWGFX_DRIVER_MAJOR,
1121
//   .minor = VMWGFX_DRIVER_MINOR,
1102
//   .minor = VMWGFX_DRIVER_MINOR,
1122
//   .patchlevel = VMWGFX_DRIVER_PATCHLEVEL
1103
//   .patchlevel = VMWGFX_DRIVER_PATCHLEVEL
1123
};
1104
};
Line -... Line 1105...
-
 
1105
 
-
 
1106
#if 0
-
 
1107
static struct pci_driver vmw_pci_driver = {
-
 
1108
	.name = VMWGFX_DRIVER_NAME,
-
 
1109
	.id_table = vmw_pci_id_list,
-
 
1110
	.probe = vmw_probe,
-
 
1111
	.remove = vmw_remove,
-
 
1112
	.driver = {
-
 
1113
		.pm = &vmw_pm_ops
-
 
1114
	}
-
 
1115
};
-
 
1116
 
-
 
1117
static int vmw_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
-
 
1118
{
-
 
1119
	return drm_get_pci_dev(pdev, ent, &driver);
-
 
1120
}
Line 1124... Line 1121...
1124
 
1121
#endif
1125
 
1122
 
1126
int vmw_init(void)
1123
int vmw_init(void)
1127
{
1124
{
Line 1136... Line 1133...
1136
    {
1133
    {
1137
        dbgprintf("device not found\n");
1134
        dbgprintf("device not found\n");
1138
        return -ENODEV;
1135
        return -ENODEV;
1139
    };
1136
    };
Line -... Line 1137...
-
 
1137
 
-
 
1138
    drm_core_init();
1140
 
1139
 
1141
    DRM_INFO("device %x:%x\n", device.pci_dev.vendor,
1140
    DRM_INFO("device %x:%x\n", device.pci_dev.vendor,
1142
                                device.pci_dev.device);
-
 
Line 1143... Line 1141...
1143
    drm_global_init();
1141
                                device.pci_dev.device);
1144
 
1142
 
Line 1145... Line 1143...
1145
    err = drm_get_dev(&device.pci_dev, ent);
1143
    err = drm_get_pci_dev(&device.pci_dev, ent, &driver);
1146
    LEAVE();
1144
    LEAVE();
Line 1147... Line -...
1147
 
-
 
1148
    return err;
-
 
1149
}
-
 
1150
 
-
 
1151
 
1145
 
1152
 
1146
    return err;
1153
//module_init(vmwgfx_init);
1147
}
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");
-
 
1159
 
-
 
1160
int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent)
-
 
1161
{
-
 
1162
    static struct drm_device drm_dev;
-
 
1163
    static struct drm_file   drm_file;
-
 
1164
 
-
 
1165
    struct drm_device *dev;
-
 
1166
    struct drm_file   *priv;
-
 
1167
 
-
 
1168
    int ret;
-
 
1169
 
-
 
1170
    dev  = &drm_dev;
-
 
1171
    priv = &drm_file;
-
 
1172
 
-
 
1173
    drm_file_handlers[0] = priv;
-
 
1174
 
-
 
1175
 //   ret = pci_enable_device(pdev);
-
 
1176
 //   if (ret)
-
 
1177
 //       goto err_g1;
-
 
1178
 
-
 
1179
    pci_set_master(pdev);
-
 
1180
 
-
 
1181
 //   if ((ret = drm_fill_in_dev(dev, pdev, ent, driver))) {
-
 
1182
 //       printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
-
 
1183
 //       goto err_g2;
-
 
1184
 //   }
-
 
1185
 
-
 
1186
    dev->pdev = pdev;
-
 
1187
    dev->pci_device = pdev->device;
-
 
1188
    dev->pci_vendor = pdev->vendor;
-
 
1189
 
-
 
1190
    INIT_LIST_HEAD(&dev->filelist);
-
 
1191
    INIT_LIST_HEAD(&dev->ctxlist);
-
 
1192
    INIT_LIST_HEAD(&dev->vmalist);
-
 
1193
    INIT_LIST_HEAD(&dev->maplist);
-
 
1194
 
-
 
1195
    spin_lock_init(&dev->count_lock);
-
 
1196
    mutex_init(&dev->struct_mutex);
-
 
1197
    mutex_init(&dev->ctxlist_mutex);
-
 
1198
 
-
 
1199
    INIT_LIST_HEAD(&priv->lhead);
-
 
1200
    INIT_LIST_HEAD(&priv->fbs);
-
 
1201
    INIT_LIST_HEAD(&priv->event_list);
-
 
1202
    init_waitqueue_head(&priv->event_wait);
-
 
1203
    priv->event_space = 4096; /* set aside 4k for event buffer */
-
 
1204
 
-
 
1205
    idr_init(&priv->object_idr);
-
 
1206
    spin_lock_init(&priv->table_lock);
-
 
1207
 
-
 
1208
    dev->driver = &driver;
-
 
1209
 
-
 
1210
    if (dev->driver->open) {
-
 
1211
        ret = dev->driver->open(dev, priv);
-
 
1212
        if (ret < 0)
-
 
1213
            goto err_g4;
-
 
1214
    }
-
 
1215
 
-
 
1216
    ret = vmw_driver_load(dev, ent->driver_data );
-
 
1217
 
-
 
1218
    if (ret)
-
 
1219
        goto err_g4;
-
 
1220
 
-
 
1221
    ret = kms_init(dev);
-
 
1222
 
-
 
1223
    if (ret)
-
 
1224
        goto err_g4;
-
 
1225
 
-
 
1226
    return 0;
-
 
1227
 
-
 
1228
err_g4:
-
 
1229
//err_g3:
-
 
1230
//    if (drm_core_check_feature(dev, DRIVER_MODESET))
-
 
1231
//        drm_put_minor(&dev->control);
-
 
1232
//err_g2:
-