summaryrefslogtreecommitdiff
path: root/main.c
blob: b024bb1e4bbfce32e482c2af5dc85176022e5e18 (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
90
91
#include <stdio.h>
#include <stdint.h>
#include <nouveau_class.h>
#include <nouveau_notifier.h>
#include <nouveau_device.h>

#include "screen.h"
#include "fifo.h"
#include "object.h"

#include "context_surface_2d.h"
#include "imageblit.h"
#include "image_pattern.h"
#include "raster_op.h"
#include "clip_rectangle.h"
#include "tcl_init.h"
#include "tcl_triangle.h"

#define NV30TCL_CHIPSET_3X_MASK 0x00000003
#define NV34TCL_CHIPSET_3X_MASK 0x00000010
#define NV35TCL_CHIPSET_3X_MASK 0x000001e0

int main(int argc, char **argv)
{
	unsigned int rankine_class = 0;

	if (screen_open(1680, 1050, 32)!=0) {
		return -1;
	}
	printf("opened drm device\n");

	switch (dev->chipset & 0xf0) {
	case 0x30:
		if (NV30TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
			rankine_class = NV30TCL;
		else
		if (NV34TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
			rankine_class = NV34TCL;
		else
		if (NV35TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
			rankine_class = NV35TCL;
		break;
	default:
		break;
	}

	if (rankine_class == 0) {
		printf("Unsupported chipset NV%02x\n", dev->chipset & 0xff);
		screen_close();
		return -1;
	}

	if (fifo_open()!=0) {
		screen_close();
		return -1;
	}
	printf("opened channel\n");

	if (object_list_create(rankine_class)!=0) {
		fifo_close();
		screen_close();
		return -1;
	}
	printf("created objects\n");

	context_surface_2d_init();
	image_pattern_init();
	clip_rectangle_init();
	raster_op_init();
	imageblit_init();

	imageblit_copy(viewport_x,viewport_y,
		viewport_x+(viewport_w>>2),viewport_y+(viewport_h>>2),
		viewport_w>>2, viewport_h>>2
	);

	/* mandatory, or we get PFIFO_CACHE_ERROR */
	tcl_init();
	tcl_clear();

	/*tcl_triangle_fixed();*/	/* does not work */
	/*tcl_triangle_vtxattr();*/
	/*tcl_triangle_tx0();*/

	printf("coincoin\n");

	object_list_close();
	fifo_close();
	screen_close();
	return 0;
}