summaryrefslogtreecommitdiff
path: root/cayman_test.c
blob: 754f881d8a9aaa614b71e64c3df04332e158010e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include "radeondemo.h"

int cayman_run_test1(struct radeon *radeon)
{
	struct r600_accel_object test1 = {0};
	int size, i;

	test1.pitch = 1408;
	test1.width = 1366;
	test1.height = 768;
	test1.bpp = 32;
	test1.domain = RADEON_GEM_DOMAIN_VRAM;
	test1.tiling_flags = 0;

	size = test1.pitch*test1.height*(test1.bpp / 8);
	test1.bo = radeon_bo_open(radeon->bufmgr, 0, size, 4096, RADEON_GEM_DOMAIN_VRAM, 0);
	if (!test1.bo)
		return -1;

	radeon_bo_map(test1.bo, 1);
	{
		uint32_t *data = test1.bo->ptr;
		data[0] = 0xdeadbeef;
	}
	radeon_bo_unmap(test1.bo);		

	do_solid_fill_prepare(radeon, &test1, 0xffff0000);
	evergreen_solid(radeon, 0, 0, test1.width, test1.height);
	evergreen_finish_op(radeon, 8);

	radeon_cs_flush_indirect(radeon);

	radeon_bo_map(test1.bo, 0);

	{
		uint32_t *data = test1.bo->ptr;
		for (i = 0; i < 32; i++) {
			fprintf(stderr,"%08x ", data[i]);
		}
		fprintf(stderr,"\n");

//		fprintf(stderr,"bo1 %08x %08x\n", data[0], data[1]);
	}
	radeon_bo_unmap(test1.bo);
}

int cayman_run_test2(struct radeon *radeon)
{
	struct r600_accel_object test1 = {0};
	int size, i;

	test1.pitch = 1408;
	test1.width = 1366;
	test1.height = 768;
	test1.bpp = 32;
	test1.domain = RADEON_GEM_DOMAIN_GTT;
	test1.tiling_flags = 0;

	size = test1.pitch*test1.height*(test1.bpp / 8);
	test1.bo = radeon_bo_open(radeon->bufmgr, 0, size, 4096, RADEON_GEM_DOMAIN_GTT, 0);
	if (!test1.bo)
		return -1;

	radeon_bo_map(test1.bo, 1);
	{
		uint32_t *data = test1.bo->ptr;
		data[0] = 0xdeadbeef;
	}
	radeon_bo_unmap(test1.bo);		

	do_solid_fill_prepare(radeon, &test1, 0xffff0000);
	evergreen_solid(radeon, 0, 0, test1.width, test1.height);
	evergreen_finish_op(radeon, 8);

	radeon_cs_flush_indirect(radeon);

	radeon_bo_map(test1.bo, 0);

	{
		uint32_t *data = test1.bo->ptr;
		for (i = 0; i < 32; i++) {
			fprintf(stderr,"%08x ", data[i]);
		}
		fprintf(stderr,"\n");

//		fprintf(stderr,"bo1 %08x %08x\n", data[0], data[1]);
	}
	radeon_bo_unmap(test1.bo);
}