mirror of
				https://gitlab.freedesktop.org/wayland/wayland.git
				synced 2025-11-03 09:01:42 -05:00 
			
		
		
		
	Make clients at least compile for now
This commit is contained in:
		
							parent
							
								
									f0d65bb50a
								
							
						
					
					
						commit
						f88ae45e41
					
				
					 6 changed files with 41 additions and 26 deletions
				
			
		| 
						 | 
					@ -9,11 +9,11 @@ clean :
 | 
				
			||||||
	rm -f $(egl_clients) $(cairo_clients) *.o
 | 
						rm -f $(egl_clients) $(cairo_clients) *.o
 | 
				
			||||||
 | 
					
 | 
				
			||||||
flower : flower.o wayland-glib.o
 | 
					flower : flower.o wayland-glib.o
 | 
				
			||||||
gears : gears.o window.o wayland-glib.o cairo-util.o
 | 
					gears : gears.o window.o wayland-glib.o
 | 
				
			||||||
screenshot : screenshot.o wayland-glib.o
 | 
					screenshot : screenshot.o wayland-glib.o
 | 
				
			||||||
terminal : terminal.o window.o wayland-glib.o cairo-util.o
 | 
					terminal : terminal.o window.o wayland-glib.o
 | 
				
			||||||
image : image.o window.o wayland-glib.o cairo-util.o
 | 
					image : image.o window.o wayland-glib.o
 | 
				
			||||||
view : view.o window.o wayland-glib.o cairo-util.o
 | 
					view : view.o window.o wayland-glib.o
 | 
				
			||||||
 | 
					
 | 
				
			||||||
terminal : LDLIBS += -lutil
 | 
					terminal : LDLIBS += -lutil
 | 
				
			||||||
image : CFLAGS += $(GDK_PIXBUF_CFLAGS)
 | 
					image : CFLAGS += $(GDK_PIXBUF_CFLAGS)
 | 
				
			||||||
| 
						 | 
					@ -22,6 +22,6 @@ view : CFLAGS += $(POPPLER_CFLAGS)
 | 
				
			||||||
view : LDLIBS += $(POPPLER_LIBS)
 | 
					view : LDLIBS += $(POPPLER_LIBS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$(egl_clients) : CFLAGS += $(EGL_CLIENT_CFLAGS)
 | 
					$(egl_clients) : CFLAGS += $(EGL_CLIENT_CFLAGS)
 | 
				
			||||||
$(egl_clients) : LDLIBS += -L.. -lwayland $(EGL_CLIENT_LIBS) -lrt
 | 
					$(egl_clients) : LDLIBS += -L.. -lwayland $(EGL_CLIENT_LIBS) -lrt -lm
 | 
				
			||||||
$(cairo_clients) : CFLAGS += $(CAIRO_CLIENT_CFLAGS)
 | 
					$(cairo_clients) : CFLAGS += $(CAIRO_CLIENT_CFLAGS)
 | 
				
			||||||
$(cairo_clients) : LDLIBS += -L..  -lwayland $(CAIRO_CLIENT_LIBS) -lrt
 | 
					$(cairo_clients) : LDLIBS += -L..  -lwayland $(CAIRO_CLIENT_LIBS) -lrt -lm
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -249,11 +249,11 @@ static void
 | 
				
			||||||
resize_window(struct gears *gears)
 | 
					resize_window(struct gears *gears)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	EGLint attribs[] = {
 | 
						EGLint attribs[] = {
 | 
				
			||||||
		EGL_IMAGE_WIDTH_INTEL,	0,
 | 
							EGL_WIDTH,		0,
 | 
				
			||||||
		EGL_IMAGE_HEIGHT_INTEL,	0,
 | 
							EGL_HEIGHT,		0,
 | 
				
			||||||
		EGL_IMAGE_FORMAT_INTEL,	EGL_FORMAT_RGBA_8888_KHR,
 | 
							EGL_IMAGE_FORMAT_MESA,	EGL_IMAGE_FORMAT_ARGB8888_MESA,
 | 
				
			||||||
		EGL_IMAGE_USE_INTEL,	EGL_IMAGE_USE_SHARE_INTEL |
 | 
							EGL_IMAGE_USE_MESA,	EGL_IMAGE_USE_SHARE_MESA |
 | 
				
			||||||
					EGL_IMAGE_USE_SCANOUT_INTEL,
 | 
										EGL_IMAGE_USE_SCANOUT_MESA,
 | 
				
			||||||
		EGL_NONE
 | 
							EGL_NONE
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -275,9 +275,7 @@ resize_window(struct gears *gears)
 | 
				
			||||||
		eglDestroyImageKHR(gears->display, gears->image);
 | 
							eglDestroyImageKHR(gears->display, gears->image);
 | 
				
			||||||
	attribs[1] = gears->rectangle.width;
 | 
						attribs[1] = gears->rectangle.width;
 | 
				
			||||||
	attribs[3] = gears->rectangle.height;
 | 
						attribs[3] = gears->rectangle.height;
 | 
				
			||||||
	gears->image = eglCreateImageKHR(gears->display, gears->context,
 | 
						gears->image = eglCreateDRMImageMESA(gears->display, attribs);
 | 
				
			||||||
					 EGL_SYSTEM_IMAGE_INTEL,
 | 
					 | 
				
			||||||
					 NULL, attribs);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	glBindRenderbuffer(GL_RENDERBUFFER_EXT, gears->color_rbo);
 | 
						glBindRenderbuffer(GL_RENDERBUFFER_EXT, gears->color_rbo);
 | 
				
			||||||
	glEGLImageTargetRenderbufferStorageOES(GL_RENDERBUFFER, gears->image);
 | 
						glEGLImageTargetRenderbufferStorageOES(GL_RENDERBUFFER, gears->image);
 | 
				
			||||||
| 
						 | 
					@ -341,10 +339,10 @@ handle_frame(void *data,
 | 
				
			||||||
	     uint32_t frame, uint32_t timestamp)
 | 
						     uint32_t frame, uint32_t timestamp)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  	struct gears *gears = data;
 | 
					  	struct gears *gears = data;
 | 
				
			||||||
	EGLint name, handle, stride;
 | 
						EGLint name, stride;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	eglShareImageINTEL(gears->display, gears->context,
 | 
						eglExportDRMImageMESA(gears->display,
 | 
				
			||||||
			   gears->image, 0, &name, &handle, &stride);
 | 
								   gears->image, &name, NULL, &stride);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	window_copy(gears->window, &gears->rectangle, name, stride);
 | 
						window_copy(gears->window, &gears->rectangle, name, stride);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -361,29 +359,46 @@ static const struct wl_compositor_listener compositor_listener = {
 | 
				
			||||||
static struct gears *
 | 
					static struct gears *
 | 
				
			||||||
gears_create(struct display *display, int drm_fd)
 | 
					gears_create(struct display *display, int drm_fd)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						PFNEGLGETTYPEDDISPLAYMESA get_typed_display_mesa;
 | 
				
			||||||
	const int x = 200, y = 200, width = 450, height = 500;
 | 
						const int x = 200, y = 200, width = 450, height = 500;
 | 
				
			||||||
	EGLint major, minor;
 | 
						EGLint major, minor, count;
 | 
				
			||||||
	EGLDisplayTypeDRMMESA drm_display;
 | 
						EGLConfig config;
 | 
				
			||||||
	struct gears *gears;
 | 
						struct gears *gears;
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						static const EGLint config_attribs[] = {
 | 
				
			||||||
 | 
							EGL_SURFACE_TYPE,		0,
 | 
				
			||||||
 | 
							EGL_NO_SURFACE_CAPABLE_MESA,	EGL_OPENGL_BIT,
 | 
				
			||||||
 | 
							EGL_RENDERABLE_TYPE,		EGL_OPENGL_BIT,
 | 
				
			||||||
 | 
							EGL_NONE
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						get_typed_display_mesa =
 | 
				
			||||||
 | 
							(PFNEGLGETTYPEDDISPLAYMESA) eglGetProcAddress("eglGetTypedDisplayMESA");
 | 
				
			||||||
 | 
						if (get_typed_display_mesa == NULL)
 | 
				
			||||||
 | 
							die("eglGetDisplayMESA() not found\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	gears = malloc(sizeof *gears);
 | 
						gears = malloc(sizeof *gears);
 | 
				
			||||||
	memset(gears, 0, sizeof *gears);
 | 
						memset(gears, 0, sizeof *gears);
 | 
				
			||||||
	gears->d = display;
 | 
						gears->d = display;
 | 
				
			||||||
	gears->window = window_create(display, "Wayland Gears",
 | 
						gears->window = window_create(display, "Wayland Gears",
 | 
				
			||||||
				      x, y, width, height);
 | 
									      x, y, width, height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	drm_display.type = EGL_DISPLAY_TYPE_DRM_MESA;
 | 
						gears->display = get_typed_display_mesa(EGL_DRM_DISPLAY_TYPE_MESA,
 | 
				
			||||||
	drm_display.device = NULL;
 | 
											(void *) drm_fd);
 | 
				
			||||||
	drm_display.fd = drm_fd;
 | 
					 | 
				
			||||||
	gears->display = eglGetDisplay((EGLNativeDisplayType) &drm_display);
 | 
					 | 
				
			||||||
	if (gears->display == NULL)
 | 
						if (gears->display == NULL)
 | 
				
			||||||
		die("failed to create egl display\n");
 | 
							die("failed to create egl display\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!eglInitialize(gears->display, &major, &minor))
 | 
						if (!eglInitialize(gears->display, &major, &minor))
 | 
				
			||||||
		die("failed to initialize display\n");
 | 
							die("failed to initialize display\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	gears->context = eglCreateContext(gears->display, NULL, NULL, NULL);
 | 
						if (!eglChooseConfig(gears->display, config_attribs, &config, 1, &count) ||
 | 
				
			||||||
 | 
						    count == 0)
 | 
				
			||||||
 | 
							die("eglChooseConfig() failed\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						eglBindAPI(EGL_OPENGL_API);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						gears->context = eglCreateContext(gears->display, config, EGL_NO_CONTEXT, NULL);
 | 
				
			||||||
	if (gears->context == NULL)
 | 
						if (gears->context == NULL)
 | 
				
			||||||
		die("failed to create context\n");
 | 
							die("failed to create context\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,7 +36,7 @@
 | 
				
			||||||
#include "wayland-util.h"
 | 
					#include "wayland-util.h"
 | 
				
			||||||
#include "wayland-client.h"
 | 
					#include "wayland-client.h"
 | 
				
			||||||
#include "wayland-glib.h"
 | 
					#include "wayland-glib.h"
 | 
				
			||||||
#include "cairo-util.h"
 | 
					#include "../cairo-util.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "window.h"
 | 
					#include "window.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -157,7 +157,7 @@ window_draw_decorations(struct window *window)
 | 
				
			||||||
	rounded_rect(cr, -1, -1, width + 1, height + 1, radius);
 | 
						rounded_rect(cr, -1, -1, width + 1, height + 1, radius);
 | 
				
			||||||
	cairo_fill(cr);
 | 
						cairo_fill(cr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define SLOW_BUT_PWETTY
 | 
					#define SLOW_BUT_PWETTY_not_right_now
 | 
				
			||||||
#ifdef SLOW_BUT_PWETTY
 | 
					#ifdef SLOW_BUT_PWETTY
 | 
				
			||||||
	/* FIXME: Aw, pretty drop shadows now have to fallback to sw.
 | 
						/* FIXME: Aw, pretty drop shadows now have to fallback to sw.
 | 
				
			||||||
	 * Ideally we should have convolution filters in cairo, but we
 | 
						 * Ideally we should have convolution filters in cairo, but we
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue