Subversion Repositories Kolibri OS

Rev

Rev 5078 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5078 Rev 6296
Line 1... Line 1...
1
/**************************************************************************
1
/**************************************************************************
2
 *
2
 *
3
 * Copyright © 2012 VMware, Inc., Palo Alto, CA., USA
3
 * Copyright © 2012-2015 VMware, Inc., Palo Alto, CA., USA
4
 * All Rights Reserved.
4
 * All Rights Reserved.
5
 *
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a
6
 * Permission is hereby granted, free of charge, to any person obtaining a
7
 * copy of this software and associated documentation files (the
7
 * copy of this software and associated documentation files (the
8
 * "Software"), to deal in the Software without restriction, including
8
 * "Software"), to deal in the Software without restriction, including
Line 29... Line 29...
29
 
29
 
30
/*
30
/*
31
 * If we set up the screen target otable, screen objects stop working.
31
 * If we set up the screen target otable, screen objects stop working.
Line 32... Line 32...
32
 */
32
 */
Line 33... Line 33...
33
 
33
 
34
#define VMW_OTABLE_SETUP_SUB ((VMWGFX_ENABLE_SCREEN_TARGET_OTABLE) ? 0 : 1)
34
#define VMW_OTABLE_SETUP_SUB ((VMWGFX_ENABLE_SCREEN_TARGET_OTABLE ? 0 : 1))
35
 
35
 
36
#ifdef CONFIG_64BIT
36
#ifdef CONFIG_64BIT
Line 65... Line 65...
65
 * struct vmw_otable - Guest Memory OBject table metadata
65
 * struct vmw_otable - Guest Memory OBject table metadata
66
 *
66
 *
67
 * @size:           Size of the table (page-aligned).
67
 * @size:           Size of the table (page-aligned).
68
 * @page_table:     Pointer to a struct vmw_mob holding the page table.
68
 * @page_table:     Pointer to a struct vmw_mob holding the page table.
69
 */
69
 */
70
struct vmw_otable {
70
static const struct vmw_otable pre_dx_tables[] = {
-
 
71
	{VMWGFX_NUM_MOB * SVGA3D_OTABLE_MOB_ENTRY_SIZE, NULL, true},
-
 
72
	{VMWGFX_NUM_GB_SURFACE * SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, NULL, true},
-
 
73
	{VMWGFX_NUM_GB_CONTEXT * SVGA3D_OTABLE_CONTEXT_ENTRY_SIZE, NULL, true},
-
 
74
	{VMWGFX_NUM_GB_SHADER * SVGA3D_OTABLE_SHADER_ENTRY_SIZE, NULL, true},
-
 
75
	{VMWGFX_NUM_GB_SCREEN_TARGET * SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE,
71
	unsigned long size;
76
	 NULL, VMWGFX_ENABLE_SCREEN_TARGET_OTABLE}
-
 
77
};
-
 
78
 
72
	struct vmw_mob *page_table;
79
static const struct vmw_otable dx_tables[] = {
-
 
80
	{VMWGFX_NUM_MOB * SVGA3D_OTABLE_MOB_ENTRY_SIZE, NULL, true},
-
 
81
	{VMWGFX_NUM_GB_SURFACE * SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, NULL, true},
-
 
82
	{VMWGFX_NUM_GB_CONTEXT * SVGA3D_OTABLE_CONTEXT_ENTRY_SIZE, NULL, true},
-
 
83
	{VMWGFX_NUM_GB_SHADER * SVGA3D_OTABLE_SHADER_ENTRY_SIZE, NULL, true},
-
 
84
	{VMWGFX_NUM_GB_SCREEN_TARGET * SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE,
-
 
85
	 NULL, VMWGFX_ENABLE_SCREEN_TARGET_OTABLE},
-
 
86
	{VMWGFX_NUM_DXCONTEXT * sizeof(SVGAOTableDXContextEntry), NULL, true},
73
};
87
};
Line 74... Line 88...
74
 
88
 
75
static int vmw_mob_pt_populate(struct vmw_private *dev_priv,
89
static int vmw_mob_pt_populate(struct vmw_private *dev_priv,
76
			       struct vmw_mob *mob);
90
			       struct vmw_mob *mob);
Line 90... Line 104...
90
 * This function returns -ENOMEM if it fails to reserve fifo space,
104
 * This function returns -ENOMEM if it fails to reserve fifo space,
91
 * and may block waiting for fifo space.
105
 * and may block waiting for fifo space.
92
 */
106
 */
93
static int vmw_setup_otable_base(struct vmw_private *dev_priv,
107
static int vmw_setup_otable_base(struct vmw_private *dev_priv,
94
				 SVGAOTableType type,
108
				 SVGAOTableType type,
-
 
109
				 struct ttm_buffer_object *otable_bo,
95
				 unsigned long offset,
110
				 unsigned long offset,
96
				 struct vmw_otable *otable)
111
				 struct vmw_otable *otable)
97
{
112
{
98
	struct {
113
	struct {
99
		SVGA3dCmdHeader header;
114
		SVGA3dCmdHeader header;
Line 104... Line 119...
104
	struct vmw_piter iter;
119
	struct vmw_piter iter;
105
	int ret;
120
	int ret;
Line 106... Line 121...
106
 
121
 
Line 107... Line 122...
107
	BUG_ON(otable->page_table != NULL);
122
	BUG_ON(otable->page_table != NULL);
108
 
123
 
109
	vsgt = vmw_bo_sg_table(dev_priv->otable_bo);
124
	vsgt = vmw_bo_sg_table(otable_bo);
Line 110... Line 125...
110
	vmw_piter_start(&iter, vsgt, offset >> PAGE_SHIFT);
125
	vmw_piter_start(&iter, vsgt, offset >> PAGE_SHIFT);
111
	WARN_ON(!vmw_piter_next(&iter));
126
	WARN_ON(!vmw_piter_next(&iter));
Line 140... Line 155...
140
 
155
 
141
	memset(cmd, 0, sizeof(*cmd));
156
	memset(cmd, 0, sizeof(*cmd));
142
	cmd->header.id = SVGA_3D_CMD_SET_OTABLE_BASE64;
157
	cmd->header.id = SVGA_3D_CMD_SET_OTABLE_BASE64;
143
	cmd->header.size = sizeof(cmd->body);
158
	cmd->header.size = sizeof(cmd->body);
144
	cmd->body.type = type;
159
	cmd->body.type = type;
145
	cmd->body.baseAddress = cpu_to_le64(mob->pt_root_page >> PAGE_SHIFT);
160
	cmd->body.baseAddress = mob->pt_root_page >> PAGE_SHIFT;
146
	cmd->body.sizeInBytes = otable->size;
161
	cmd->body.sizeInBytes = otable->size;
147
	cmd->body.validSizeInBytes = 0;
162
	cmd->body.validSizeInBytes = 0;
Line 148... Line 163...
148
	cmd->body.ptDepth = mob->pt_level;
163
	cmd->body.ptDepth = mob->pt_level;
Line 189... Line 204...
189
	bo = otable->page_table->pt_bo;
204
	bo = otable->page_table->pt_bo;
190
	cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd));
205
	cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd));
191
	if (unlikely(cmd == NULL)) {
206
	if (unlikely(cmd == NULL)) {
192
		DRM_ERROR("Failed reserving FIFO space for OTable "
207
		DRM_ERROR("Failed reserving FIFO space for OTable "
193
			  "takedown.\n");
208
			  "takedown.\n");
194
	} else {
209
		return;
-
 
210
	}
-
 
211
 
195
	memset(cmd, 0, sizeof(*cmd));
212
	memset(cmd, 0, sizeof(*cmd));
196
	cmd->header.id = SVGA_3D_CMD_SET_OTABLE_BASE;
213
	cmd->header.id = SVGA_3D_CMD_SET_OTABLE_BASE;
197
	cmd->header.size = sizeof(cmd->body);
214
	cmd->header.size = sizeof(cmd->body);
198
	cmd->body.type = type;
215
	cmd->body.type = type;
199
	cmd->body.baseAddress = 0;
216
	cmd->body.baseAddress = 0;
200
	cmd->body.sizeInBytes = 0;
217
	cmd->body.sizeInBytes = 0;
201
	cmd->body.validSizeInBytes = 0;
218
	cmd->body.validSizeInBytes = 0;
202
	cmd->body.ptDepth = SVGA3D_MOBFMT_INVALID;
219
	cmd->body.ptDepth = SVGA3D_MOBFMT_INVALID;
203
	vmw_fifo_commit(dev_priv, sizeof(*cmd));
220
	vmw_fifo_commit(dev_priv, sizeof(*cmd));
204
	}
-
 
Line 205... Line 221...
205
 
221
 
206
	if (bo) {
222
	if (bo) {
Line 207... Line 223...
207
		int ret;
223
		int ret;
Line 215... Line 231...
215
 
231
 
216
	vmw_mob_destroy(otable->page_table);
232
	vmw_mob_destroy(otable->page_table);
217
	otable->page_table = NULL;
233
	otable->page_table = NULL;
Line 218... Line 234...
218
}
234
}
219
 
235
 
220
/*
-
 
221
 * vmw_otables_setup - Set up guest backed memory object tables
-
 
222
 *
-
 
223
 * @dev_priv:       Pointer to a device private structure
-
 
224
 *
-
 
225
 * Takes care of the device guest backed surface
-
 
226
 * initialization, by setting up the guest backed memory object tables.
-
 
227
 * Returns 0 on success and various error codes on failure. A succesful return
-
 
228
 * means the object tables can be taken down using the vmw_otables_takedown
-
 
229
 * function.
236
 
230
 */
237
static int vmw_otable_batch_setup(struct vmw_private *dev_priv,
231
int vmw_otables_setup(struct vmw_private *dev_priv)
238
				  struct vmw_otable_batch *batch)
232
{
239
{
233
	unsigned long offset;
240
	unsigned long offset;
234
	unsigned long bo_size;
241
	unsigned long bo_size;
235
	struct vmw_otable *otables;
242
	struct vmw_otable *otables = batch->otables;
Line 236... Line -...
236
	SVGAOTableType i;
-
 
237
	int ret;
-
 
238
 
-
 
239
	otables = kzalloc(SVGA_OTABLE_DX9_MAX * sizeof(*otables),
-
 
240
			  GFP_KERNEL);
-
 
241
	if (unlikely(otables == NULL)) {
-
 
242
		DRM_ERROR("Failed to allocate space for otable "
-
 
243
			  "metadata.\n");
-
 
244
		return -ENOMEM;
-
 
245
	}
-
 
246
 
-
 
247
	otables[SVGA_OTABLE_MOB].size =
-
 
248
		VMWGFX_NUM_MOB * SVGA3D_OTABLE_MOB_ENTRY_SIZE;
-
 
249
	otables[SVGA_OTABLE_SURFACE].size =
-
 
250
		VMWGFX_NUM_GB_SURFACE * SVGA3D_OTABLE_SURFACE_ENTRY_SIZE;
-
 
251
	otables[SVGA_OTABLE_CONTEXT].size =
-
 
252
		VMWGFX_NUM_GB_CONTEXT * SVGA3D_OTABLE_CONTEXT_ENTRY_SIZE;
-
 
253
	otables[SVGA_OTABLE_SHADER].size =
-
 
254
		VMWGFX_NUM_GB_SHADER * SVGA3D_OTABLE_SHADER_ENTRY_SIZE;
-
 
255
	otables[SVGA_OTABLE_SCREEN_TARGET].size =
-
 
256
		VMWGFX_NUM_GB_SCREEN_TARGET *
243
	SVGAOTableType i;
257
		SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE;
244
	int ret;
-
 
245
 
-
 
246
	bo_size = 0;
-
 
247
	for (i = 0; i < batch->num_otables; ++i) {
258
 
248
		if (!otables[i].enabled)
259
	bo_size = 0;
249
			continue;
260
	for (i = 0; i < SVGA_OTABLE_DX9_MAX; ++i) {
250
 
261
		otables[i].size =
251
		otables[i].size =
Line 262... Line 252...
262
			(otables[i].size + PAGE_SIZE - 1) & PAGE_MASK;
252
			(otables[i].size + PAGE_SIZE - 1) & PAGE_MASK;
263
		bo_size += otables[i].size;
253
		bo_size += otables[i].size;
264
	}
254
	}
265
 
255
 
266
	ret = ttm_bo_create(&dev_priv->bdev, bo_size,
256
	ret = ttm_bo_create(&dev_priv->bdev, bo_size,
Line 267... Line 257...
267
			    ttm_bo_type_device,
257
			    ttm_bo_type_device,
268
			    &vmw_sys_ne_placement,
258
			    &vmw_sys_ne_placement,
Line 269... Line 259...
269
			    0, false, NULL,
259
			    0, false, NULL,
270
			    &dev_priv->otable_bo);
260
			    &batch->otable_bo);
271
 
261
 
272
	if (unlikely(ret != 0))
262
	if (unlikely(ret != 0))
273
		goto out_no_bo;
263
		goto out_no_bo;
274
 
264
 
275
	ret = ttm_bo_reserve(dev_priv->otable_bo, false, true, false, NULL);
265
	ret = ttm_bo_reserve(batch->otable_bo, false, true, false, NULL);
276
	BUG_ON(ret != 0);
266
	BUG_ON(ret != 0);
Line 277... Line 267...
277
	ret = vmw_bo_driver.ttm_tt_populate(dev_priv->otable_bo->ttm);
267
	ret = vmw_bo_driver.ttm_tt_populate(batch->otable_bo->ttm);
Line 278... Line 268...
278
	if (unlikely(ret != 0))
268
	if (unlikely(ret != 0))
279
		goto out_unreserve;
269
		goto out_unreserve;
-
 
270
	ret = vmw_bo_map_dma(batch->otable_bo);
-
 
271
	if (unlikely(ret != 0))
-
 
272
		goto out_unreserve;
280
	ret = vmw_bo_map_dma(dev_priv->otable_bo);
273
 
-
 
274
	ttm_bo_unreserve(batch->otable_bo);
281
	if (unlikely(ret != 0))
275
 
282
		goto out_unreserve;
276
	offset = 0;
283
 
277
	for (i = 0; i < batch->num_otables; ++i) {
284
	ttm_bo_unreserve(dev_priv->otable_bo);
278
		if (!batch->otables[i].enabled)
285
 
279
			continue;
Line 286... Line -...
286
	offset = 0;
-
 
287
	for (i = 0; i < SVGA_OTABLE_DX9_MAX - VMW_OTABLE_SETUP_SUB; ++i) {
280
 
Line 288... Line 281...
288
		ret = vmw_setup_otable_base(dev_priv, i, offset,
281
		ret = vmw_setup_otable_base(dev_priv, i, batch->otable_bo,
289
					    &otables[i]);
282
					    offset,
290
		if (unlikely(ret != 0))
283
					    &otables[i]);
291
			goto out_no_setup;
284
		if (unlikely(ret != 0))
-
 
285
			goto out_no_setup;
292
		offset += otables[i].size;
286
		offset += otables[i].size;
-
 
287
	}
-
 
288
 
Line 293... Line 289...
293
	}
289
	return 0;
294
 
290
 
295
	dev_priv->otables = otables;
-
 
296
	return 0;
291
out_unreserve:
297
 
292
	ttm_bo_unreserve(batch->otable_bo);
Line 298... Line -...
298
out_unreserve:
-
 
299
	ttm_bo_unreserve(dev_priv->otable_bo);
293
out_no_setup:
300
out_no_setup:
294
	for (i = 0; i < batch->num_otables; ++i) {
301
	for (i = 0; i < SVGA_OTABLE_DX9_MAX - VMW_OTABLE_SETUP_SUB; ++i)
295
		if (batch->otables[i].enabled)
302
		vmw_takedown_otable_base(dev_priv, i, &otables[i]);
296
			vmw_takedown_otable_base(dev_priv, i,
303
 
297
						 &batch->otables[i]);
-
 
298
	}
304
	ttm_bo_unref(&dev_priv->otable_bo);
299
 
-
 
300
	ttm_bo_unref(&batch->otable_bo);
-
 
301
out_no_bo:
-
 
302
	return ret;
305
out_no_bo:
303
}
306
	kfree(otables);
304
 
-
 
305
/*
-
 
306
 * vmw_otables_setup - Set up guest backed memory object tables
-
 
307
 *
-
 
308
 * @dev_priv:       Pointer to a device private structure
-
 
309
 *
-
 
310
 * Takes care of the device guest backed surface
-
 
311
 * initialization, by setting up the guest backed memory object tables.
-
 
312
 * Returns 0 on success and various error codes on failure. A successful return
-
 
313
 * means the object tables can be taken down using the vmw_otables_takedown
-
 
314
 * function.
-
 
315
 */
-
 
316
int vmw_otables_setup(struct vmw_private *dev_priv)
-
 
317
{
-
 
318
	struct vmw_otable **otables = &dev_priv->otable_batch.otables;
-
 
319
	int ret;
-
 
320
 
-
 
321
	if (dev_priv->has_dx) {
-
 
322
		*otables = kmalloc(sizeof(dx_tables), GFP_KERNEL);
-
 
323
		if (*otables == NULL)
-
 
324
			return -ENOMEM;
-
 
325
 
-
 
326
		memcpy(*otables, dx_tables, sizeof(dx_tables));
-
 
327
		dev_priv->otable_batch.num_otables = ARRAY_SIZE(dx_tables);
-
 
328
	} else {
-
 
329
		*otables = kmalloc(sizeof(pre_dx_tables), GFP_KERNEL);
-
 
330
		if (*otables == NULL)
-
 
331
			return -ENOMEM;
-
 
332
 
-
 
333
		memcpy(*otables, pre_dx_tables, sizeof(pre_dx_tables));
-
 
334
		dev_priv->otable_batch.num_otables = ARRAY_SIZE(pre_dx_tables);
-
 
335
	}
-
 
336
 
-
 
337
	ret = vmw_otable_batch_setup(dev_priv, &dev_priv->otable_batch);
307
	return ret;
338
	if (unlikely(ret != 0))
308
}
339
		goto out_setup;
309
 
340
 
310
 
341
	return 0;
Line 311... Line 342...
311
/*
342
 
-
 
343
out_setup:
312
 * vmw_otables_takedown - Take down guest backed memory object tables
344
	kfree(*otables);
313
 *
345
	return ret;
Line 314... Line 346...
314
 * @dev_priv:       Pointer to a device private structure
346
}
315
 *
347
 
Line 316... Line 348...
316
 * Take down the Guest Memory Object tables.
348
static void vmw_otable_batch_takedown(struct vmw_private *dev_priv,
317
 */
349
			       struct vmw_otable_batch *batch)
Line 318... Line 350...
318
void vmw_otables_takedown(struct vmw_private *dev_priv)
350
{
319
{
-
 
320
	SVGAOTableType i;
-
 
321
	struct ttm_buffer_object *bo = dev_priv->otable_bo;
351
	SVGAOTableType i;
Line -... Line 352...
-
 
352
	struct ttm_buffer_object *bo = batch->otable_bo;
-
 
353
	int ret;
-
 
354
 
-
 
355
	for (i = 0; i < batch->num_otables; ++i)
-
 
356
		if (batch->otables[i].enabled)
-
 
357
			vmw_takedown_otable_base(dev_priv, i,
-
 
358
						 &batch->otables[i]);
-
 
359
 
-
 
360
	ret = ttm_bo_reserve(bo, false, true, false, NULL);
-
 
361
	BUG_ON(ret != 0);
-
 
362
 
-
 
363
	vmw_fence_single_bo(bo, NULL);
Line 322... Line 364...
322
	int ret;
364
	ttm_bo_unreserve(bo);
323
 
365
 
324
	for (i = 0; i < SVGA_OTABLE_DX9_MAX - VMW_OTABLE_SETUP_SUB; ++i)
366
	ttm_bo_unref(&batch->otable_bo);
325
		vmw_takedown_otable_base(dev_priv, i,
367
}
Line 427... Line 469...
427
 *
469
 *
428
 * Assigns a value to a page table entry pointed to by *@addr and increments
470
 * Assigns a value to a page table entry pointed to by *@addr and increments
429
 * *@addr according to the page table entry size.
471
 * *@addr according to the page table entry size.
430
 */
472
 */
431
#if (VMW_PPN_SIZE == 8)
473
#if (VMW_PPN_SIZE == 8)
432
static void vmw_mob_assign_ppn(__le32 **addr, dma_addr_t val)
474
static void vmw_mob_assign_ppn(u32 **addr, dma_addr_t val)
433
{
475
{
434
	*((__le64 *) *addr) = cpu_to_le64(val >> PAGE_SHIFT);
476
	*((u64 *) *addr) = val >> PAGE_SHIFT;
435
	*addr += 2;
477
	*addr += 2;
436
}
478
}
437
#else
479
#else
438
static void vmw_mob_assign_ppn(__le32 **addr, dma_addr_t val)
480
static void vmw_mob_assign_ppn(u32 **addr, dma_addr_t val)
439
{
481
{
440
	*(*addr)++ = cpu_to_le32(val >> PAGE_SHIFT);
482
	*(*addr)++ = val >> PAGE_SHIFT;
441
}
483
}
442
#endif
484
#endif
Line 443... Line 485...
443
 
485
 
444
/*
486
/*
Line 457... Line 499...
457
				      struct vmw_piter *pt_iter)
499
				      struct vmw_piter *pt_iter)
458
{
500
{
459
	unsigned long pt_size = num_data_pages * VMW_PPN_SIZE;
501
	unsigned long pt_size = num_data_pages * VMW_PPN_SIZE;
460
	unsigned long num_pt_pages = DIV_ROUND_UP(pt_size, PAGE_SIZE);
502
	unsigned long num_pt_pages = DIV_ROUND_UP(pt_size, PAGE_SIZE);
461
	unsigned long pt_page;
503
	unsigned long pt_page;
462
	__le32 *addr, *save_addr;
504
	u32 *addr, *save_addr;
463
	unsigned long i;
505
	unsigned long i;
464
	struct page *page;
506
	struct page *page;
Line 465... Line -...
465
 
-
 
466
    save_addr = addr = AllocKernelSpace(4096);
-
 
467
 
507
 
468
	for (pt_page = 0; pt_page < num_pt_pages; ++pt_page) {
508
	for (pt_page = 0; pt_page < num_pt_pages; ++pt_page) {
Line 469... Line 509...
469
		page = vmw_piter_page(pt_iter);
509
		page = vmw_piter_page(pt_iter);
Line 470... Line 510...
470
 
510
 
471
        MapPage(save_addr,(addr_t)page, 3);
511
		save_addr = addr = kmap_atomic(page);
472
 
512
 
473
		for (i = 0; i < PAGE_SIZE / VMW_PPN_SIZE; ++i) {
513
		for (i = 0; i < PAGE_SIZE / VMW_PPN_SIZE; ++i) {
474
			vmw_mob_assign_ppn(&addr,
514
			vmw_mob_assign_ppn(&addr,
475
					   vmw_piter_dma_addr(data_iter));
515
					   vmw_piter_dma_addr(data_iter));
476
			if (unlikely(--num_data_pages == 0))
516
			if (unlikely(--num_data_pages == 0))
-
 
517
				break;
477
				break;
518
			WARN_ON(!vmw_piter_next(data_iter));
478
			WARN_ON(!vmw_piter_next(data_iter));
519
		}
479
		}
-
 
-
 
520
		kunmap_atomic(save_addr);
480
		vmw_piter_next(pt_iter);
521
		vmw_piter_next(pt_iter);
481
	}
522
	}
Line 482... Line 523...
482
    FreeKernelSpace(save_addr);
523
 
483
	return num_pt_pages;
524
	return num_pt_pages;
Line 573... Line 614...
573
	}
614
	}
574
	if (bo) {
615
	if (bo) {
575
		vmw_fence_single_bo(bo, NULL);
616
		vmw_fence_single_bo(bo, NULL);
576
		ttm_bo_unreserve(bo);
617
		ttm_bo_unreserve(bo);
577
	}
618
	}
578
	vmw_3d_resource_dec(dev_priv, false);
619
	vmw_fifo_resource_dec(dev_priv);
579
}
620
}
Line 580... Line 621...
580
 
621
 
581
/*
622
/*
582
 * vmw_mob_bind - Make a mob visible to the device after first
623
 * vmw_mob_bind - Make a mob visible to the device after first
Line 626... Line 667...
626
		vmw_mob_pt_setup(mob, data_iter, num_data_pages);
667
		vmw_mob_pt_setup(mob, data_iter, num_data_pages);
627
		pt_set_up = true;
668
		pt_set_up = true;
628
		mob->pt_level += VMW_MOBFMT_PTDEPTH_1 - SVGA3D_MOBFMT_PTDEPTH_1;
669
		mob->pt_level += VMW_MOBFMT_PTDEPTH_1 - SVGA3D_MOBFMT_PTDEPTH_1;
629
	}
670
	}
Line 630... Line 671...
630
 
671
 
Line 631... Line 672...
631
	(void) vmw_3d_resource_inc(dev_priv, false);
672
	vmw_fifo_resource_inc(dev_priv);
632
 
673
 
633
	cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd));
674
	cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd));
634
	if (unlikely(cmd == NULL)) {
675
	if (unlikely(cmd == NULL)) {
Line 639... Line 680...
639
 
680
 
640
	cmd->header.id = SVGA_3D_CMD_DEFINE_GB_MOB64;
681
	cmd->header.id = SVGA_3D_CMD_DEFINE_GB_MOB64;
641
	cmd->header.size = sizeof(cmd->body);
682
	cmd->header.size = sizeof(cmd->body);
642
	cmd->body.mobid = mob_id;
683
	cmd->body.mobid = mob_id;
643
	cmd->body.ptDepth = mob->pt_level;
684
	cmd->body.ptDepth = mob->pt_level;
644
	cmd->body.base = cpu_to_le64(mob->pt_root_page >> PAGE_SHIFT);
685
	cmd->body.base = mob->pt_root_page >> PAGE_SHIFT;
Line 645... Line 686...
645
	cmd->body.sizeInBytes = num_data_pages * PAGE_SIZE;
686
	cmd->body.sizeInBytes = num_data_pages * PAGE_SIZE;
Line 646... Line 687...
646
 
687
 
Line 647... Line 688...
647
	vmw_fifo_commit(dev_priv, sizeof(*cmd));
688
	vmw_fifo_commit(dev_priv, sizeof(*cmd));
648
 
689
 
649
	return 0;
690
	return 0;
650
 
691
 
Line 651... Line 692...
651
out_no_cmd_space:
692
out_no_cmd_space:
652
	vmw_3d_resource_dec(dev_priv, false);
693
	vmw_fifo_resource_dec(dev_priv);