Subversion Repositories Kolibri OS

Rev

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

Rev 5271 Rev 6938
Line 2326... Line 2326...
2326
	kfree(p->track);
2326
	kfree(p->track);
2327
	p->track = NULL;
2327
	p->track = NULL;
2328
	return 0;
2328
	return 0;
2329
}
2329
}
Line 2330... Line -...
2330
 
-
 
2331
#ifdef CONFIG_DRM_RADEON_UMS
-
 
2332
 
-
 
2333
/**
-
 
2334
 * cs_parser_fini() - clean parser states
-
 
2335
 * @parser:	parser structure holding parsing context.
-
 
2336
 * @error:	error number
-
 
2337
 *
-
 
2338
 * If error is set than unvalidate buffer, otherwise just free memory
-
 
2339
 * used by parsing context.
-
 
2340
 **/
-
 
2341
static void r600_cs_parser_fini(struct radeon_cs_parser *parser, int error)
-
 
2342
{
-
 
2343
	unsigned i;
-
 
2344
 
-
 
2345
	kfree(parser->relocs);
-
 
2346
	for (i = 0; i < parser->nchunks; i++)
-
 
2347
		drm_free_large(parser->chunks[i].kdata);
-
 
2348
	kfree(parser->chunks);
-
 
2349
	kfree(parser->chunks_array);
-
 
2350
}
-
 
2351
 
-
 
2352
static int r600_cs_parser_relocs_legacy(struct radeon_cs_parser *p)
-
 
2353
{
-
 
2354
	if (p->chunk_relocs == NULL) {
-
 
2355
		return 0;
-
 
2356
	}
-
 
2357
	p->relocs = kzalloc(sizeof(struct radeon_bo_list), GFP_KERNEL);
-
 
2358
	if (p->relocs == NULL) {
-
 
2359
		return -ENOMEM;
-
 
2360
	}
-
 
2361
	return 0;
-
 
2362
}
-
 
2363
 
-
 
2364
int r600_cs_legacy(struct drm_device *dev, void *data, struct drm_file *filp,
-
 
2365
			unsigned family, u32 *ib, int *l)
-
 
2366
{
-
 
2367
	struct radeon_cs_parser parser;
-
 
2368
	struct radeon_cs_chunk *ib_chunk;
-
 
2369
	struct r600_cs_track *track;
-
 
2370
	int r;
-
 
2371
 
-
 
2372
	/* initialize tracker */
-
 
2373
	track = kzalloc(sizeof(*track), GFP_KERNEL);
-
 
2374
	if (track == NULL)
-
 
2375
		return -ENOMEM;
-
 
2376
	r600_cs_track_init(track);
-
 
2377
	r600_cs_legacy_get_tiling_conf(dev, &track->npipes, &track->nbanks, &track->group_size);
-
 
2378
	/* initialize parser */
-
 
2379
	memset(&parser, 0, sizeof(struct radeon_cs_parser));
-
 
2380
	parser.filp = filp;
-
 
2381
	parser.dev = &dev->pdev->dev;
-
 
2382
	parser.rdev = NULL;
-
 
2383
	parser.family = family;
-
 
2384
	parser.track = track;
-
 
2385
	parser.ib.ptr = ib;
-
 
2386
	r = radeon_cs_parser_init(&parser, data);
-
 
2387
	if (r) {
-
 
2388
		DRM_ERROR("Failed to initialize parser !\n");
-
 
2389
		r600_cs_parser_fini(&parser, r);
-
 
2390
		return r;
-
 
2391
	}
-
 
2392
	r = r600_cs_parser_relocs_legacy(&parser);
-
 
2393
	if (r) {
-
 
2394
		DRM_ERROR("Failed to parse relocation !\n");
-
 
2395
		r600_cs_parser_fini(&parser, r);
-
 
2396
		return r;
-
 
2397
	}
-
 
2398
	/* Copy the packet into the IB, the parser will read from the
-
 
2399
	 * input memory (cached) and write to the IB (which can be
-
 
2400
	 * uncached). */
-
 
2401
	ib_chunk = parser.chunk_ib;
-
 
2402
	parser.ib.length_dw = ib_chunk->length_dw;
-
 
2403
	*l = parser.ib.length_dw;
-
 
2404
	if (copy_from_user(ib, ib_chunk->user_ptr, ib_chunk->length_dw * 4)) {
-
 
2405
		r = -EFAULT;
-
 
2406
		r600_cs_parser_fini(&parser, r);
-
 
2407
		return r;
-
 
2408
	}
-
 
2409
	r = r600_cs_parse(&parser);
-
 
2410
	if (r) {
-
 
2411
		DRM_ERROR("Invalid command stream !\n");
-
 
2412
		r600_cs_parser_fini(&parser, r);
-
 
2413
		return r;
-
 
2414
	}
-
 
2415
	r600_cs_parser_fini(&parser, r);
-
 
2416
	return r;
-
 
2417
}
-
 
2418
 
-
 
2419
void r600_cs_legacy_init(void)
-
 
2420
{
-
 
2421
	r600_nomm = 1;
-
 
2422
}
-
 
2423
 
-
 
2424
#endif
-
 
2425
 
2330
 
2426
/*
2331
/*
2427
 *  DMA
2332
 *  DMA
2428
 */
2333
 */
2429
/**
2334
/**