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
|
#include <stdio.h>
#include <xf86drm.h>
#include <nouveau_drm.h>
#include "screen.h"
#include "fifo.h"
#include "object.h"
#include "nouveau_class.h"
struct drm_nouveau_notifierobj_alloc o_nvsyncnotify;
static int object_create(int handle, int num_class)
{
int ret;
struct drm_nouveau_grobj_alloc o_ctx;
o_ctx.channel = init.channel;
o_ctx.handle = handle;
o_ctx.class = num_class;
ret = drmCommandWrite(drm_fd, DRM_NOUVEAU_GROBJ_ALLOC, &o_ctx, sizeof(o_ctx));
if (ret) {
fprintf(stderr, "Failed to create object, handle 0x%08x, class 0x%08x\n", handle, num_class);
}
return ret;
}
static int notifier_obj_create(struct drm_nouveau_notifierobj_alloc *o_ctx, int handle, int count)
{
int ret;
o_ctx->channel = init.channel;
o_ctx->handle = handle;
o_ctx->count = count;
ret = drmCommandWriteRead(drm_fd, DRM_NOUVEAU_NOTIFIEROBJ_ALLOC, o_ctx, sizeof(*o_ctx));
if (ret) {
fprintf(stderr, "failed to create handle=0x%08x, class 0x%08x\n", handle, count);
}
return ret;
}
int object_list_create(int class_3d)
{
if (object_create(Nv3D, class_3d)!=0) {
return 1;
}
if (object_create(NvCtxSurf2D, NV30_CONTEXT_SURFACES_2D)!=0) {
return 1;
}
if (object_create(NvImageBlit, NV12_IMAGE_BLIT)!=0) {
return 1;
}
if (object_create(NvImagePattern, NV04_IMAGE_PATTERN)!=0) {
return 1;
}
if (object_create(NvRasterOp, NV03_CONTEXT_ROP)!=0) {
return 1;
}
if (object_create(NvClipRect, NV01_CONTEXT_CLIP_RECTANGLE)!=0) {
return 1;
}
if (notifier_obj_create(&o_nvsyncnotify, NvSyncNotify, 1)!=0) {
return 1;
}
return 0;
}
|