Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 555186
Collapse All | Expand All

(-)a/src/egl/eglut/eglut.c (-2 / +7 lines)
Lines 76-83 _eglutNow(void) Link Here
76
static void
76
static void
77
_eglutDestroyWindow(struct eglut_window *win)
77
_eglutDestroyWindow(struct eglut_window *win)
78
{
78
{
79
   if (_eglut->surface_type != EGL_PBUFFER_BIT &&
79
80
       _eglut->surface_type != EGL_SCREEN_BIT_MESA)
80
   if (_eglut->surface_type == EGL_WINDOW_BIT ||
81
       _eglut->surface_type == EGL_PIXMAP_BIT)
81
      eglDestroySurface(_eglut->dpy, win->surface);
82
      eglDestroySurface(_eglut->dpy, win->surface);
82
83
83
   _eglutNativeFiniWindow(win);
84
   _eglutNativeFiniWindow(win);
Lines 175-181 _eglutCreateWindow(const char *title, int x, int y, int w, int h) Link Here
175
            win->config, win->native.u.pixmap, NULL);
176
            win->config, win->native.u.pixmap, NULL);
176
      break;
177
      break;
177
   case EGL_PBUFFER_BIT:
178
   case EGL_PBUFFER_BIT:
179
#ifdef EGL_MESA_screen_surface
178
   case EGL_SCREEN_BIT_MESA:
180
   case EGL_SCREEN_BIT_MESA:
181
#endif
179
      win->surface = win->native.u.surface;
182
      win->surface = win->native.u.surface;
180
      break;
183
      break;
181
   default:
184
   default:
Lines 289-296 eglutDestroyWindow(int win) Link Here
289
   if (window->index != win)
292
   if (window->index != win)
290
      return;
293
      return;
291
294
295
#ifdef EGL_MESA_screen_surface
292
   /* XXX it causes some bug in st/egl KMS backend */
296
   /* XXX it causes some bug in st/egl KMS backend */
293
   if ( _eglut->surface_type != EGL_SCREEN_BIT_MESA)
297
   if ( _eglut->surface_type != EGL_SCREEN_BIT_MESA)
298
#endif
294
      eglMakeCurrent(_eglut->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
299
      eglMakeCurrent(_eglut->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
295
300
296
   _eglutDestroyWindow(_eglut->current);
301
   _eglutDestroyWindow(_eglut->current);
(-)a/src/egl/eglut/eglut_screen.c (+14 lines)
Lines 35-60 Link Here
35
35
36
#define MAX_MODES 100
36
#define MAX_MODES 100
37
37
38
#ifdef EGL_MESA_screen_surface
38
static EGLScreenMESA kms_screen;
39
static EGLScreenMESA kms_screen;
39
static EGLModeMESA kms_mode;
40
static EGLModeMESA kms_mode;
40
static EGLint kms_width, kms_height;
41
static EGLint kms_width, kms_height;
42
#endif
41
43
42
void
44
void
43
_eglutNativeInitDisplay(void)
45
_eglutNativeInitDisplay(void)
44
{
46
{
47
#ifdef EGL_MESA_screen_surface
45
   _eglut->native_dpy = EGL_DEFAULT_DISPLAY;
48
   _eglut->native_dpy = EGL_DEFAULT_DISPLAY;
46
   _eglut->surface_type = EGL_SCREEN_BIT_MESA;
49
   _eglut->surface_type = EGL_SCREEN_BIT_MESA;
50
#endif
47
}
51
}
48
52
49
void
53
void
50
_eglutNativeFiniDisplay(void)
54
_eglutNativeFiniDisplay(void)
51
{
55
{
56
#ifdef EGL_MESA_screen_surface
52
   kms_screen = 0;
57
   kms_screen = 0;
53
   kms_mode = 0;
58
   kms_mode = 0;
54
   kms_width = 0;
59
   kms_width = 0;
55
   kms_height = 0;
60
   kms_height = 0;
61
#endif
56
}
62
}
57
63
64
#ifdef EGL_MESA_screen_surface
58
static void
65
static void
59
init_kms(void)
66
init_kms(void)
60
{
67
{
Lines 94-112 init_kms(void) Link Here
94
   kms_width = width;
101
   kms_width = width;
95
   kms_height = height;
102
   kms_height = height;
96
}
103
}
104
#endif
97
105
98
void
106
void
99
_eglutNativeInitWindow(struct eglut_window *win, const char *title,
107
_eglutNativeInitWindow(struct eglut_window *win, const char *title,
100
                       int x, int y, int w, int h)
108
                       int x, int y, int w, int h)
101
{
109
{
110
#ifdef EGL_MESA_screen_surface
102
   EGLint surf_attribs[16];
111
   EGLint surf_attribs[16];
103
   EGLint i;
112
   EGLint i;
113
#endif
104
   const char *exts;
114
   const char *exts;
105
115
106
   exts = eglQueryString(_eglut->dpy, EGL_EXTENSIONS);
116
   exts = eglQueryString(_eglut->dpy, EGL_EXTENSIONS);
107
   if (!exts || !strstr(exts, "EGL_MESA_screen_surface"))
117
   if (!exts || !strstr(exts, "EGL_MESA_screen_surface"))
108
      _eglutFatal("EGL_MESA_screen_surface is not supported\n");
118
      _eglutFatal("EGL_MESA_screen_surface is not supported\n");
109
119
120
#ifdef EGL_MESA_screen_surface
110
   init_kms();
121
   init_kms();
111
122
112
   i = 0;
123
   i = 0;
Lines 128-141 _eglutNativeInitWindow(struct eglut_window *win, const char *title, Link Here
128
139
129
   win->native.width = kms_width;
140
   win->native.width = kms_width;
130
   win->native.height = kms_height;
141
   win->native.height = kms_height;
142
#endif
131
}
143
}
132
144
133
void
145
void
134
_eglutNativeFiniWindow(struct eglut_window *win)
146
_eglutNativeFiniWindow(struct eglut_window *win)
135
{
147
{
148
#ifdef EGL_MESA_screen_surface
136
   eglShowScreenSurfaceMESA(_eglut->dpy,
149
   eglShowScreenSurfaceMESA(_eglut->dpy,
137
         kms_screen, EGL_NO_SURFACE, 0);
150
         kms_screen, EGL_NO_SURFACE, 0);
138
   eglDestroySurface(_eglut->dpy, win->native.u.surface);
151
   eglDestroySurface(_eglut->dpy, win->native.u.surface);
152
#endif
139
}
153
}
140
154
141
void
155
void
(-)a/src/egl/opengl/demo1.c (+2 lines)
Lines 18-23 Link Here
18
static void
18
static void
19
TestScreens(EGLDisplay dpy)
19
TestScreens(EGLDisplay dpy)
20
{
20
{
21
#ifdef EGL_MESA_screen_surface
21
#define MAX 8
22
#define MAX 8
22
   EGLScreenMESA screens[MAX];
23
   EGLScreenMESA screens[MAX];
23
   EGLint numScreens;
24
   EGLint numScreens;
Lines 28-33 TestScreens(EGLDisplay dpy) Link Here
28
   for (i = 0; i < numScreens; i++) {
29
   for (i = 0; i < numScreens; i++) {
29
      printf(" Screen %d handle: %d\n", i, (int) screens[i]);
30
      printf(" Screen %d handle: %d\n", i, (int) screens[i]);
30
   }
31
   }
32
#endif
31
}
33
}
32
34
33
/**
35
/**
(-)a/src/egl/opengl/demo2.c (-1 / +6 lines)
Lines 16-21 Link Here
16
16
17
/*#define FRONTBUFFER*/
17
/*#define FRONTBUFFER*/
18
18
19
#ifdef EGL_MESA_screen_surface
19
static void _subset_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2,
20
static void _subset_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2,
20
                          GLfloat r, GLfloat g, GLfloat b)
21
                          GLfloat r, GLfloat g, GLfloat b)
21
{
22
{
Lines 95-106 TestScreens(EGLDisplay dpy) Link Here
95
      printf(" Screen %d handle: %d\n", i, (int) screens[i]);
96
      printf(" Screen %d handle: %d\n", i, (int) screens[i]);
96
   }
97
   }
97
}
98
}
98
99
#endif
99
100
100
int
101
int
101
main(int argc, char *argv[])
102
main(int argc, char *argv[])
102
{
103
{
103
   int maj, min;
104
   int maj, min;
105
#ifdef EGL_MESA_screen_surface
104
   EGLContext ctx;
106
   EGLContext ctx;
105
   EGLSurface pbuffer, screen_surf;
107
   EGLSurface pbuffer, screen_surf;
106
   EGLConfig configs[10];
108
   EGLConfig configs[10];
Lines 115-120 main(int argc, char *argv[]) Link Here
115
   EGLModeMESA mode;
117
   EGLModeMESA mode;
116
   EGLScreenMESA screen;
118
   EGLScreenMESA screen;
117
   EGLint count;
119
   EGLint count;
120
#endif
118
121
119
   EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
122
   EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
120
   assert(d);
123
   assert(d);
Lines 132-137 main(int argc, char *argv[]) Link Here
132
      exit(1);
135
      exit(1);
133
   }
136
   }
134
137
138
#ifdef EGL_MESA_screen_surface
135
   eglGetConfigs(d, configs, 10, &numConfigs);
139
   eglGetConfigs(d, configs, 10, &numConfigs);
136
   printf("Got %d EGL configs:\n", numConfigs);
140
   printf("Got %d EGL configs:\n", numConfigs);
137
   for (i = 0; i < numConfigs; i++) {
141
   for (i = 0; i < numConfigs; i++) {
Lines 211-216 main(int argc, char *argv[]) Link Here
211
   eglDestroySurface(d, pbuffer);
215
   eglDestroySurface(d, pbuffer);
212
   eglDestroyContext(d, ctx);
216
   eglDestroyContext(d, ctx);
213
   eglTerminate(d);
217
   eglTerminate(d);
218
#endif
214
219
215
   return 0;
220
   return 0;
216
}
221
}
(-)a/src/egl/opengl/demo3.c (-1 / +6 lines)
Lines 46-52 GLubyte OpenGL_bits[] = { Link Here
46
   0x3e, 0x00, 0x00, 0xf8, 0x0c, 0x00, 
46
   0x3e, 0x00, 0x00, 0xf8, 0x0c, 0x00, 
47
};
47
};
48
48
49
49
#ifdef EGL_MESA_screen_surface
50
static void Init(void)
50
static void Init(void)
51
{
51
{
52
52
Lines 551-561 write_ppm(const char *filename, const GLubyte *buffer, int width, int height) Link Here
551
      fclose(f);
551
      fclose(f);
552
   }
552
   }
553
}
553
}
554
#endif
554
555
555
int
556
int
556
main(int argc, char *argv[])
557
main(int argc, char *argv[])
557
{
558
{
558
   int maj, min;
559
   int maj, min;
560
#ifdef EGL_MESA_screen_surface
559
   EGLContext ctx;
561
   EGLContext ctx;
560
   EGLSurface screen_surf;
562
   EGLSurface screen_surf;
561
   EGLConfig configs[10];
563
   EGLConfig configs[10];
Lines 566-571 main(int argc, char *argv[]) Link Here
566
   const GLubyte *bitmap;
568
   const GLubyte *bitmap;
567
   EGLint screenAttribs[32];
569
   EGLint screenAttribs[32];
568
   EGLint i;
570
   EGLint i;
571
#endif
569
572
570
   EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
573
   EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
571
   assert(d);
574
   assert(d);
Lines 583-588 main(int argc, char *argv[]) Link Here
583
      exit(1);
586
      exit(1);
584
   }
587
   }
585
588
589
#ifdef EGL_MESA_screen_surface
586
   eglGetConfigs(d, configs, 10, &numConfigs);
590
   eglGetConfigs(d, configs, 10, &numConfigs);
587
   eglGetScreensMESA(d, &screen, 1, &count);
591
   eglGetScreensMESA(d, &screen, 1, &count);
588
   eglGetModesMESA(d, screen, &mode, 1, &count);
592
   eglGetModesMESA(d, screen, &mode, 1, &count);
Lines 642-647 main(int argc, char *argv[]) Link Here
642
   eglDestroySurface(d, screen_surf);
646
   eglDestroySurface(d, screen_surf);
643
   eglDestroyContext(d, ctx);
647
   eglDestroyContext(d, ctx);
644
   eglTerminate(d);
648
   eglTerminate(d);
649
#endif
645
650
646
   return 0;
651
   return 0;
647
}
652
}
(-)a/src/egl/opengl/eglscreen.c (-2 / +5 lines)
Lines 44-62 int Link Here
44
main(int argc, char *argv[])
44
main(int argc, char *argv[])
45
{
45
{
46
	int maj, min;
46
	int maj, min;
47
#ifdef EGL_MESA_screen_surface
47
	EGLSurface screen_surf;
48
	EGLSurface screen_surf;
48
	EGLConfig configs[MAX_CONFIGS];
49
	EGLConfig configs[MAX_CONFIGS];
49
	EGLint numConfigs, i;
50
	EGLint numConfigs, i;
50
	EGLBoolean b;
51
	EGLBoolean b;
51
	EGLDisplay d;
52
	EGLint screenAttribs[10];
52
	EGLint screenAttribs[10];
53
	EGLModeMESA mode[MAX_MODES];
53
	EGLModeMESA mode[MAX_MODES];
54
	EGLScreenMESA screen;
54
	EGLScreenMESA screen;
55
	EGLint count;
55
	EGLint count;
56
	EGLint chosenMode = 0;
56
	EGLint chosenMode = 0;
57
	EGLint width = 0, height = 0;
57
	EGLint width = 0, height = 0;
58
#endif
58
59
59
	d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
60
	EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
60
	assert(d);
61
	assert(d);
61
62
62
	if (!eglInitialize(d, &maj, &min)) {
63
	if (!eglInitialize(d, &maj, &min)) {
Lines 67-72 main(int argc, char *argv[]) Link Here
67
	printf("eglscreen: EGL version = %d.%d\n", maj, min);
68
	printf("eglscreen: EGL version = %d.%d\n", maj, min);
68
	printf("eglscreen: EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
69
	printf("eglscreen: EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
69
70
71
#ifdef EGL_MESA_screen_surface
70
	/* XXX use ChooseConfig */
72
	/* XXX use ChooseConfig */
71
	eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
73
	eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
72
	eglGetScreensMESA(d, &screen, 1, &count);
74
	eglGetScreensMESA(d, &screen, 1, &count);
Lines 115-120 main(int argc, char *argv[]) Link Here
115
117
116
	eglDestroySurface(d, screen_surf);
118
	eglDestroySurface(d, screen_surf);
117
	eglTerminate(d);
119
	eglTerminate(d);
120
#endif
118
121
119
	return 0;
122
	return 0;
120
}
123
}

Return to bug 555186