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
|
#include <stdio.h>
#include <stdint.h>
#include <nouveau_drm.h>
#include "nouveau_class.h"
#include <nouveau_notifier.h>
#include <nouveau_grobj.h>
#include "screen.h"
#include "fifo.h"
#include "object.h"
struct nouveau_notifier *notifier = NULL;
struct nouveau_grobj *grobj[6]={
NULL, NULL, NULL,
NULL, NULL, NULL
};
int object_list_create(int class_3d)
{
if (nouveau_grobj_alloc(chan, Nv3D, class_3d, &grobj[NvSub3D])) {
object_list_close();
return 1;
}
if (nouveau_grobj_alloc(chan, NvCtxSurf2D, NV10_CONTEXT_SURFACES_2D, &grobj[NvSubCtxSurf2D])) {
object_list_close();
return 1;
}
if (nouveau_grobj_alloc(chan, NvImageBlit, NV12_IMAGE_BLIT, &grobj[NvSubImageBlit])) {
object_list_close();
return 1;
}
if (nouveau_grobj_alloc(chan, NvImagePattern, NV04_IMAGE_PATTERN, &grobj[NvSubImagePattern])) {
object_list_close();
return 1;
}
if (nouveau_grobj_alloc(chan, NvRasterOp, NV03_CONTEXT_ROP, &grobj[NvSubRasterOp])) {
object_list_close();
return 1;
}
if (nouveau_grobj_alloc(chan, NvClipRect, NV01_CONTEXT_CLIP_RECTANGLE, &grobj[NvSubClipRect])) {
object_list_close();
return 1;
}
if (nouveau_notifier_alloc(chan, NvSyncNotify, 1, ¬ifier)!=0) {
object_list_close();
return 1;
}
return 0;
}
void object_list_close(void)
{
int i;
for (i=0; i<6; i++) {
if (grobj[i]) {
nouveau_grobj_free(&grobj[i]);
grobj[i] = NULL;
}
}
if (notifier) {
nouveau_notifier_free(¬ifier);
notifier = NULL;
}
}
|