mirror of
				https://gitlab.freedesktop.org/wayland/wayland.git
				synced 2025-11-03 09:01:42 -05:00 
			
		
		
		
	Update to use eglGetDRMDisplayMESA()
This commit is contained in:
		
							parent
							
								
									86e0989673
								
							
						
					
					
						commit
						f252d6a98e
					
				
					 7 changed files with 4 additions and 36 deletions
				
			
		| 
						 | 
					@ -30,7 +30,6 @@
 | 
				
			||||||
#include <time.h>
 | 
					#include <time.h>
 | 
				
			||||||
#include <cairo.h>
 | 
					#include <cairo.h>
 | 
				
			||||||
#include <glib.h>
 | 
					#include <glib.h>
 | 
				
			||||||
#include <cairo-drm.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define GL_GLEXT_PROTOTYPES
 | 
					#define GL_GLEXT_PROTOTYPES
 | 
				
			||||||
#define EGL_EGLEXT_PROTOTYPES
 | 
					#define EGL_EGLEXT_PROTOTYPES
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,7 +30,6 @@
 | 
				
			||||||
#include <math.h>
 | 
					#include <math.h>
 | 
				
			||||||
#include <time.h>
 | 
					#include <time.h>
 | 
				
			||||||
#include <cairo.h>
 | 
					#include <cairo.h>
 | 
				
			||||||
#include <cairo-drm.h>
 | 
					 | 
				
			||||||
#include <glib.h>
 | 
					#include <glib.h>
 | 
				
			||||||
#include <gdk-pixbuf/gdk-pixbuf.h>
 | 
					#include <gdk-pixbuf/gdk-pixbuf.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,7 +32,6 @@
 | 
				
			||||||
#include <ctype.h>
 | 
					#include <ctype.h>
 | 
				
			||||||
#include <cairo.h>
 | 
					#include <cairo.h>
 | 
				
			||||||
#include <glib.h>
 | 
					#include <glib.h>
 | 
				
			||||||
#include <cairo-drm.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <X11/keysym.h>
 | 
					#include <X11/keysym.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,7 +30,6 @@
 | 
				
			||||||
#include <math.h>
 | 
					#include <math.h>
 | 
				
			||||||
#include <time.h>
 | 
					#include <time.h>
 | 
				
			||||||
#include <cairo.h>
 | 
					#include <cairo.h>
 | 
				
			||||||
#include <cairo-drm.h>
 | 
					 | 
				
			||||||
#include <glib.h>
 | 
					#include <glib.h>
 | 
				
			||||||
#include <linux/input.h>
 | 
					#include <linux/input.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -820,7 +820,6 @@ init_xkb(struct display *d)
 | 
				
			||||||
struct display *
 | 
					struct display *
 | 
				
			||||||
display_create(int *argc, char **argv[], const GOptionEntry *option_entries)
 | 
					display_create(int *argc, char **argv[], const GOptionEntry *option_entries)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	PFNEGLGETTYPEDDISPLAYMESA get_typed_display_mesa;
 | 
					 | 
				
			||||||
	struct display *d;
 | 
						struct display *d;
 | 
				
			||||||
	EGLint major, minor, count;
 | 
						EGLint major, minor, count;
 | 
				
			||||||
	EGLConfig config;
 | 
						EGLConfig config;
 | 
				
			||||||
| 
						 | 
					@ -869,15 +868,7 @@ display_create(int *argc, char **argv[], const GOptionEntry *option_entries)
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	get_typed_display_mesa =
 | 
						d->dpy = eglGetDRMDisplayMESA(fd);
 | 
				
			||||||
		(PFNEGLGETTYPEDDISPLAYMESA) eglGetProcAddress("eglGetTypedDisplayMESA");
 | 
					 | 
				
			||||||
	if (get_typed_display_mesa == NULL) {
 | 
					 | 
				
			||||||
		fprintf(stderr, "eglGetDisplayMESA() not found\n");
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	d->dpy = get_typed_display_mesa(EGL_DRM_DISPLAY_TYPE_MESA,
 | 
					 | 
				
			||||||
					(void *) fd);
 | 
					 | 
				
			||||||
	if (!eglInitialize(d->dpy, &major, &minor)) {
 | 
						if (!eglInitialize(d->dpy, &major, &minor)) {
 | 
				
			||||||
		fprintf(stderr, "failed to initialize display\n");
 | 
							fprintf(stderr, "failed to initialize display\n");
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -305,7 +305,6 @@ init_egl(struct drm_compositor *ec, struct udev_device *device)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	EGLint major, minor, count;
 | 
						EGLint major, minor, count;
 | 
				
			||||||
	EGLConfig config;
 | 
						EGLConfig config;
 | 
				
			||||||
	PFNEGLGETTYPEDDISPLAYMESA get_typed_display_mesa;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	static const EGLint config_attribs[] = {
 | 
						static const EGLint config_attribs[] = {
 | 
				
			||||||
		EGL_SURFACE_TYPE,		0,
 | 
							EGL_SURFACE_TYPE,		0,
 | 
				
			||||||
| 
						 | 
					@ -314,13 +313,6 @@ init_egl(struct drm_compositor *ec, struct udev_device *device)
 | 
				
			||||||
		EGL_NONE
 | 
							EGL_NONE
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	get_typed_display_mesa =
 | 
					 | 
				
			||||||
		(PFNEGLGETTYPEDDISPLAYMESA) eglGetProcAddress("eglGetTypedDisplayMESA");
 | 
					 | 
				
			||||||
	if (get_typed_display_mesa == NULL) {
 | 
					 | 
				
			||||||
		fprintf(stderr, "eglGetTypedDisplayMESA() not found\n");
 | 
					 | 
				
			||||||
		return -1;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ec->base.base.device = strdup(udev_device_get_devnode(device));
 | 
						ec->base.base.device = strdup(udev_device_get_devnode(device));
 | 
				
			||||||
	ec->drm_fd = open(ec->base.base.device, O_RDWR);
 | 
						ec->drm_fd = open(ec->base.base.device, O_RDWR);
 | 
				
			||||||
	if (ec->drm_fd < 0) {
 | 
						if (ec->drm_fd < 0) {
 | 
				
			||||||
| 
						 | 
					@ -330,8 +322,7 @@ init_egl(struct drm_compositor *ec, struct udev_device *device)
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ec->base.display = get_typed_display_mesa(EGL_DRM_DISPLAY_TYPE_MESA,
 | 
						ec->base.display = eglGetDRMDisplayMESA(ec->drm_fd);
 | 
				
			||||||
						  (void *) ec->drm_fd);
 | 
					 | 
				
			||||||
	if (ec->base.display == NULL) {
 | 
						if (ec->base.display == NULL) {
 | 
				
			||||||
		fprintf(stderr, "failed to create display\n");
 | 
							fprintf(stderr, "failed to create display\n");
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -198,7 +198,6 @@ dri2_authenticate(struct x11_compositor *c)
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
x11_compositor_init_egl(struct x11_compositor *c)
 | 
					x11_compositor_init_egl(struct x11_compositor *c)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	PFNEGLGETTYPEDDISPLAYMESA get_typed_display_mesa;
 | 
					 | 
				
			||||||
	EGLint major, minor, count;
 | 
						EGLint major, minor, count;
 | 
				
			||||||
	EGLConfig config;
 | 
						EGLConfig config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -223,16 +222,7 @@ x11_compositor_init_egl(struct x11_compositor *c)
 | 
				
			||||||
	if (dri2_authenticate(c) < 0)
 | 
						if (dri2_authenticate(c) < 0)
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	get_typed_display_mesa =
 | 
						c->base.display = eglGetDRMDisplayMESA(c->drm_fd);
 | 
				
			||||||
		(PFNEGLGETTYPEDDISPLAYMESA)
 | 
					 | 
				
			||||||
		eglGetProcAddress("eglGetTypedDisplayMESA");
 | 
					 | 
				
			||||||
	if (get_typed_display_mesa == NULL) {
 | 
					 | 
				
			||||||
		fprintf(stderr, "eglGetTypedDisplayMESA() not found\n");
 | 
					 | 
				
			||||||
		return -1;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	c->base.display = get_typed_display_mesa(EGL_DRM_DISPLAY_TYPE_MESA,
 | 
					 | 
				
			||||||
						 (void *) c->drm_fd);
 | 
					 | 
				
			||||||
	if (c->base.display == NULL) {
 | 
						if (c->base.display == NULL) {
 | 
				
			||||||
		fprintf(stderr, "failed to create display\n");
 | 
							fprintf(stderr, "failed to create display\n");
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue