Rev 4525 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4525 | Rev 4526 | ||
---|---|---|---|
Line 4... | Line 4... | ||
4 | 4 | ||
5 | #include "render.h" |
5 | #include "render.h" |
6 | #include |
6 | #include |
Line -... | Line 7... | ||
- | 7 | #include |
|
- | 8 | ||
- | 9 | #define WIN_STATE_MINIMIZED 0x02 |
|
7 | #include |
10 | #define WIN_STATE_ROLLED 0x04 |
8 | 11 | ||
9 | static int drm_ioctl(int fd, unsigned long request, void *arg) |
12 | static int drm_ioctl(int fd, unsigned long request, void *arg) |
Line 10... | Line 13... | ||
10 | { |
13 | { |
Line 25... | Line 28... | ||
25 | char proc_info[1024]; |
28 | char proc_info[1024]; |
26 | struct drm_i915_mask_update update; |
29 | struct drm_i915_mask_update update; |
Line 27... | Line 30... | ||
27 | 30 | ||
28 | EGLContext context; |
31 | EGLContext context; |
29 | EGLSurface draw, read; |
32 | EGLSurface draw, read; |
30 | int winx, winy, winw, winh; |
- | |
- | 33 | uint32_t winx, winy, winw, winh; |
|
31 | 34 | uint8_t state; |
|
32 | float xscale, yscale; |
35 | float xscale, yscale; |
33 | float *vertices = render->vertices; |
36 | float *vertices = render->vertices; |
34 | float *texcoords = render->tc_src; |
37 | float *texcoords = render->tc_src; |
Line 41... | Line 44... | ||
41 | 44 | ||
42 | winx = *(uint32_t*)(proc_info+34); |
45 | winx = *(uint32_t*)(proc_info+34); |
43 | winy = *(uint32_t*)(proc_info+38); |
46 | winy = *(uint32_t*)(proc_info+38); |
44 | winw = *(uint32_t*)(proc_info+42)+1; |
47 | winw = *(uint32_t*)(proc_info+42)+1; |
- | 48 | winh = *(uint32_t*)(proc_info+46)+1; |
|
- | 49 | state = *(uint8_t*)(proc_info+70); |
|
- | 50 | ||
- | 51 | if(state & (WIN_STATE_MINIMIZED|WIN_STATE_ROLLED)) |
|
Line 45... | Line 52... | ||
45 | winh = *(uint32_t*)(proc_info+46)+1; |
52 | return; |
46 | 53 | ||
47 | context = eglGetCurrentContext(); |
54 | context = eglGetCurrentContext(); |
Line 62... | Line 69... | ||
62 | update.bo_map = (int)render->mask_buffer; |
69 | update.bo_map = (int)render->mask_buffer; |
Line 63... | Line 70... | ||
63 | 70 | ||
64 | if(drm_ioctl(render->fd, 45, &update)) |
71 | if(drm_ioctl(render->fd, 45, &update)) |
Line 65... | Line -... | ||
65 | return; |
- | |
66 | 72 | return; |
|
67 | 73 | ||
68 | if (!eglMakeCurrent(render->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, render->context)) |
74 | if (!eglMakeCurrent(render->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, render->context)) |
69 | { |
75 | { |
70 | printf("failed to make window current"); |
76 | printf("failed to make window current"); |
Line 71... | Line -... | ||
71 | goto err1; |
- | |
72 | }; |
77 | goto err1; |
73 | 78 | }; |
|
74 | - | ||
75 | glActiveTexture(GL_TEXTURE0); |
- | |
76 | glBindTexture(GL_TEXTURE_2D, render->tx_buffers[render->back_buffer]); |
- | |
77 | glTexParameteri(GL_TEXTURE_2D, |
- | |
78 | GL_TEXTURE_MIN_FILTER, |
- | |
79 | GL_NEAREST); |
- | |
80 | glTexParameteri(GL_TEXTURE_2D, |
- | |
Line 81... | Line 79... | ||
81 | GL_TEXTURE_MAG_FILTER, |
79 | |
82 | GL_NEAREST); |
80 | glActiveTexture(GL_TEXTURE0); |
Line 83... | Line 81... | ||
83 | 81 | glBindTexture(GL_TEXTURE_2D, render->tx_buffers[render->back_buffer]); |
|
Line 99... | Line 97... | ||
99 | vertices[1] = t1 = 2*(winy+render->dy)*yscale - 1.0; |
97 | vertices[1] = t1 = 2*(winy+render->dy)*yscale - 1.0; |
100 | vertices[2*2+1] = t5 = 2*b*yscale - 1.0; |
98 | vertices[2*2+1] = t5 = 2*b*yscale - 1.0; |
101 | vertices[1*2+1] = t1; |
99 | vertices[1*2+1] = t1; |
102 | vertices[3*2+1] = t5; |
100 | vertices[3*2+1] = t5; |
Line 103... | Line -... | ||
103 | - | ||
104 | texcoords[0] = 0.0; |
- | |
105 | texcoords[1] = 0.0; |
- | |
106 | texcoords[1*2] = 1.0; |
- | |
107 | texcoords[1*2+1]= 0.0; |
- | |
108 | texcoords[2*2] = 1.0; |
- | |
109 | texcoords[2*2+1]= 1.0; |
- | |
110 | texcoords[3*2] = 0.0; |
- | |
111 | texcoords[3*2+1]= 1.0; |
- | |
112 | 101 | ||
113 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); |
102 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); |
114 | glFlush(); |
- | |
115 | - | ||
116 | // glDisableVertexAttribArray(0); |
- | |
117 | // glDisableVertexAttribArray(1); |
- | |
118 | // glDisable(GL_TEXTURE_2D); |
- | |
119 | // glUseProgram(0); |
- | |
Line 120... | Line 103... | ||
120 | 103 | // glFlush(); |
|
121 | 104 | ||
122 | err1: |
105 | err1: |