mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	Compare commits
	
		
			17 commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
							 | 
						9b42c1901d | ||
| 
							 | 
						7a52788929 | ||
| 
							 | 
						d4009183a1 | ||
| 
							 | 
						d092e40dec | ||
| 
							 | 
						bb5180ce9e | ||
| 
							 | 
						73aa61686f | ||
| 
							 | 
						9079380498 | ||
| 
							 | 
						3118ca5c3e | ||
| 
							 | 
						c1938f79c3 | ||
| 
							 | 
						aa904ccf06 | ||
| 
							 | 
						52e1ad01e3 | ||
| 
							 | 
						30c0602457 | ||
| 
							 | 
						b7205866c0 | ||
| 
							 | 
						f935404e68 | ||
| 
							 | 
						5aa8c192a5 | ||
| 
							 | 
						68dea55970 | ||
| 
							 | 
						f3fe6b9a43 | 
					 14 changed files with 121 additions and 129 deletions
				
			
		| 
						 | 
					@ -104,6 +104,7 @@ void init_device_tablet_pad(struct wlr_libinput_input_device *dev) {
 | 
				
			||||||
	struct udev_device *udev = libinput_device_get_udev_device(handle);
 | 
						struct udev_device *udev = libinput_device_get_udev_device(handle);
 | 
				
			||||||
	char **dst = wl_array_add(&wlr_tablet_pad->paths, sizeof(char *));
 | 
						char **dst = wl_array_add(&wlr_tablet_pad->paths, sizeof(char *));
 | 
				
			||||||
	*dst = strdup(udev_device_get_syspath(udev));
 | 
						*dst = strdup(udev_device_get_syspath(udev));
 | 
				
			||||||
 | 
						udev_device_unref(udev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int groups = libinput_device_tablet_pad_get_num_mode_groups(handle);
 | 
						int groups = libinput_device_tablet_pad_get_num_mode_groups(handle);
 | 
				
			||||||
	for (int i = 0; i < groups; ++i) {
 | 
						for (int i = 0; i < groups; ++i) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,6 +37,7 @@ void init_device_tablet(struct wlr_libinput_input_device *dev) {
 | 
				
			||||||
	struct udev_device *udev = libinput_device_get_udev_device(dev->handle);
 | 
						struct udev_device *udev = libinput_device_get_udev_device(dev->handle);
 | 
				
			||||||
	char **dst = wl_array_add(&wlr_tablet->paths, sizeof(char *));
 | 
						char **dst = wl_array_add(&wlr_tablet->paths, sizeof(char *));
 | 
				
			||||||
	*dst = strdup(udev_device_get_syspath(udev));
 | 
						*dst = strdup(udev_device_get_syspath(udev));
 | 
				
			||||||
 | 
						udev_device_unref(udev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_list_init(&dev->tablet_tools);
 | 
						wl_list_init(&dev->tablet_tools);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,8 +62,6 @@ struct wlr_drm_lease_connector_v1 {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_output *output;
 | 
						struct wlr_output *output;
 | 
				
			||||||
	struct wlr_drm_lease_device_v1 *device;
 | 
						struct wlr_drm_lease_device_v1 *device;
 | 
				
			||||||
	/** NULL if no client is currently leasing this connector */
 | 
					 | 
				
			||||||
	struct wlr_drm_lease_v1 *active_lease;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wl_list link; // wlr_drm_lease_device_v1.connectors
 | 
						struct wl_list link; // wlr_drm_lease_device_v1.connectors
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -93,9 +91,6 @@ struct wlr_drm_lease_v1 {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_drm_lease_device_v1 *device;
 | 
						struct wlr_drm_lease_device_v1 *device;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_drm_lease_connector_v1 **connectors;
 | 
					 | 
				
			||||||
	size_t n_connectors;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct wl_list link; // wlr_drm_lease_device_v1.leases
 | 
						struct wl_list link; // wlr_drm_lease_device_v1.leases
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void *data;
 | 
						void *data;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
project(
 | 
					project(
 | 
				
			||||||
	'wlroots',
 | 
						'wlroots',
 | 
				
			||||||
	'c',
 | 
						'c',
 | 
				
			||||||
	version: '0.19.0',
 | 
						version: '0.19.1',
 | 
				
			||||||
	license: 'MIT',
 | 
						license: 'MIT',
 | 
				
			||||||
	meson_version: '>=1.3',
 | 
						meson_version: '>=1.3',
 | 
				
			||||||
	default_options: [
 | 
						default_options: [
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										20
									
								
								render/egl.c
									
										
									
									
									
								
							
							
						
						
									
										20
									
								
								render/egl.c
									
										
									
									
									
								
							| 
						 | 
					@ -260,7 +260,8 @@ static struct wlr_egl *egl_create(void) {
 | 
				
			||||||
	return egl;
 | 
						return egl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool egl_init_display(struct wlr_egl *egl, EGLDisplay display) {
 | 
					static bool egl_init_display(struct wlr_egl *egl, EGLDisplay display,
 | 
				
			||||||
 | 
							bool allow_software) {
 | 
				
			||||||
	egl->display = display;
 | 
						egl->display = display;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EGLint major, minor;
 | 
						EGLint major, minor;
 | 
				
			||||||
| 
						 | 
					@ -326,9 +327,8 @@ static bool egl_init_display(struct wlr_egl *egl, EGLDisplay display) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// The only way a non-DRM device is selected is when the user
 | 
							// The only way a non-DRM device is selected is when the user
 | 
				
			||||||
		// explicitly picks software rendering
 | 
							// explicitly picks software rendering
 | 
				
			||||||
		if (check_egl_ext(device_exts_str, "EGL_MESA_device_software") &&
 | 
							if (check_egl_ext(device_exts_str, "EGL_MESA_device_software")) {
 | 
				
			||||||
				egl->exts.EXT_device_drm) {
 | 
								if (allow_software || env_parse_bool("WLR_RENDERER_ALLOW_SOFTWARE")) {
 | 
				
			||||||
			if (env_parse_bool("WLR_RENDERER_ALLOW_SOFTWARE")) {
 | 
					 | 
				
			||||||
				wlr_log(WLR_INFO, "Using software rendering");
 | 
									wlr_log(WLR_INFO, "Using software rendering");
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				wlr_log(WLR_ERROR, "Software rendering detected, please use "
 | 
									wlr_log(WLR_ERROR, "Software rendering detected, please use "
 | 
				
			||||||
| 
						 | 
					@ -382,7 +382,7 @@ static bool egl_init_display(struct wlr_egl *egl, EGLDisplay display) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool egl_init(struct wlr_egl *egl, EGLenum platform,
 | 
					static bool egl_init(struct wlr_egl *egl, EGLenum platform,
 | 
				
			||||||
		void *remote_display) {
 | 
							void *remote_display, bool allow_software) {
 | 
				
			||||||
	EGLint display_attribs[3] = {0};
 | 
						EGLint display_attribs[3] = {0};
 | 
				
			||||||
	size_t display_attribs_len = 0;
 | 
						size_t display_attribs_len = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -401,7 +401,7 @@ static bool egl_init(struct wlr_egl *egl, EGLenum platform,
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!egl_init_display(egl, display)) {
 | 
						if (!egl_init_display(egl, display, allow_software)) {
 | 
				
			||||||
		if (egl->exts.KHR_display_reference) {
 | 
							if (egl->exts.KHR_display_reference) {
 | 
				
			||||||
			eglTerminate(display);
 | 
								eglTerminate(display);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -556,6 +556,8 @@ static int open_render_node(int drm_fd) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_egl *wlr_egl_create_with_drm_fd(int drm_fd) {
 | 
					struct wlr_egl *wlr_egl_create_with_drm_fd(int drm_fd) {
 | 
				
			||||||
 | 
						bool allow_software = drm_fd < 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_egl *egl = egl_create();
 | 
						struct wlr_egl *egl = egl_create();
 | 
				
			||||||
	if (egl == NULL) {
 | 
						if (egl == NULL) {
 | 
				
			||||||
		wlr_log(WLR_ERROR, "Failed to create EGL context");
 | 
							wlr_log(WLR_ERROR, "Failed to create EGL context");
 | 
				
			||||||
| 
						 | 
					@ -569,7 +571,7 @@ struct wlr_egl *wlr_egl_create_with_drm_fd(int drm_fd) {
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		EGLDeviceEXT egl_device = get_egl_device_from_drm_fd(egl, drm_fd);
 | 
							EGLDeviceEXT egl_device = get_egl_device_from_drm_fd(egl, drm_fd);
 | 
				
			||||||
		if (egl_device != EGL_NO_DEVICE_EXT) {
 | 
							if (egl_device != EGL_NO_DEVICE_EXT) {
 | 
				
			||||||
			if (egl_init(egl, EGL_PLATFORM_DEVICE_EXT, egl_device)) {
 | 
								if (egl_init(egl, EGL_PLATFORM_DEVICE_EXT, egl_device, allow_software)) {
 | 
				
			||||||
				wlr_log(WLR_DEBUG, "Using EGL_PLATFORM_DEVICE_EXT");
 | 
									wlr_log(WLR_DEBUG, "Using EGL_PLATFORM_DEVICE_EXT");
 | 
				
			||||||
				return egl;
 | 
									return egl;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					@ -594,7 +596,7 @@ struct wlr_egl *wlr_egl_create_with_drm_fd(int drm_fd) {
 | 
				
			||||||
			goto error;
 | 
								goto error;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (egl_init(egl, EGL_PLATFORM_GBM_KHR, egl->gbm_device)) {
 | 
							if (egl_init(egl, EGL_PLATFORM_GBM_KHR, egl->gbm_device, allow_software)) {
 | 
				
			||||||
			wlr_log(WLR_DEBUG, "Using EGL_PLATFORM_GBM_KHR");
 | 
								wlr_log(WLR_DEBUG, "Using EGL_PLATFORM_GBM_KHR");
 | 
				
			||||||
			return egl;
 | 
								return egl;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -633,7 +635,7 @@ struct wlr_egl *wlr_egl_create_with_context(EGLDisplay display,
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!egl_init_display(egl, display)) {
 | 
						if (!egl_init_display(egl, display, true)) {
 | 
				
			||||||
		free(egl);
 | 
							free(egl);
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,8 +21,8 @@ void wlr_render_pass_add_texture(struct wlr_render_pass *render_pass,
 | 
				
			||||||
	if (!wlr_fbox_empty(&options->src_box)) {
 | 
						if (!wlr_fbox_empty(&options->src_box)) {
 | 
				
			||||||
		const struct wlr_fbox *box = &options->src_box;
 | 
							const struct wlr_fbox *box = &options->src_box;
 | 
				
			||||||
		assert(box->x >= 0 && box->y >= 0 &&
 | 
							assert(box->x >= 0 && box->y >= 0 &&
 | 
				
			||||||
			box->x + box->width <= options->texture->width &&
 | 
							(uint32_t)(box->x + box->width) <= options->texture->width &&
 | 
				
			||||||
			box->y + box->height <= options->texture->height);
 | 
							(uint32_t)(box->y + box->height) <= options->texture->height);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	render_pass->impl->add_texture(render_pass, options);
 | 
						render_pass->impl->add_texture(render_pass, options);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -66,16 +66,35 @@ static struct wlr_vk_descriptor_pool *alloc_ds(
 | 
				
			||||||
		struct wl_list *pool_list, size_t *last_pool_size) {
 | 
							struct wl_list *pool_list, size_t *last_pool_size) {
 | 
				
			||||||
	VkResult res;
 | 
						VkResult res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool found = false;
 | 
						VkDescriptorSetAllocateInfo ds_info = {
 | 
				
			||||||
 | 
							.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
 | 
				
			||||||
 | 
							.descriptorSetCount = 1,
 | 
				
			||||||
 | 
							.pSetLayouts = layout,
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_vk_descriptor_pool *pool;
 | 
						struct wlr_vk_descriptor_pool *pool;
 | 
				
			||||||
	wl_list_for_each(pool, pool_list, link) {
 | 
						wl_list_for_each(pool, pool_list, link) {
 | 
				
			||||||
		if (pool->free > 0) {
 | 
							if (pool->free > 0) {
 | 
				
			||||||
			found = true;
 | 
								ds_info.descriptorPool = pool->pool;
 | 
				
			||||||
			break;
 | 
								res = vkAllocateDescriptorSets(renderer->dev->dev, &ds_info, ds);
 | 
				
			||||||
 | 
								switch (res) {
 | 
				
			||||||
 | 
								case VK_ERROR_FRAGMENTED_POOL:
 | 
				
			||||||
 | 
								case VK_ERROR_OUT_OF_POOL_MEMORY:
 | 
				
			||||||
 | 
									// Descriptor sets with more than one descriptor can cause us
 | 
				
			||||||
 | 
									// to run out of pool memory early or lead to fragmentation
 | 
				
			||||||
 | 
									// that makes the pool unable to service our allocation
 | 
				
			||||||
 | 
									// request. Try the next pool or allocate a new one.
 | 
				
			||||||
 | 
									continue;
 | 
				
			||||||
 | 
								case VK_SUCCESS:
 | 
				
			||||||
 | 
									--pool->free;
 | 
				
			||||||
 | 
									return pool;
 | 
				
			||||||
 | 
								default:
 | 
				
			||||||
 | 
									wlr_vk_error("vkAllocateDescriptorSets", res);
 | 
				
			||||||
 | 
									return NULL;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!found) { // create new pool
 | 
					 | 
				
			||||||
	pool = calloc(1, sizeof(*pool));
 | 
						pool = calloc(1, sizeof(*pool));
 | 
				
			||||||
	if (!pool) {
 | 
						if (!pool) {
 | 
				
			||||||
		wlr_log_errno(WLR_ERROR, "allocation failed");
 | 
							wlr_log_errno(WLR_ERROR, "allocation failed");
 | 
				
			||||||
| 
						 | 
					@ -111,14 +130,8 @@ static struct wlr_vk_descriptor_pool *alloc_ds(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	*last_pool_size = count;
 | 
						*last_pool_size = count;
 | 
				
			||||||
	wl_list_insert(pool_list, &pool->link);
 | 
						wl_list_insert(pool_list, &pool->link);
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	VkDescriptorSetAllocateInfo ds_info = {
 | 
						ds_info.descriptorPool = pool->pool;
 | 
				
			||||||
		.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
 | 
					 | 
				
			||||||
		.descriptorSetCount = 1,
 | 
					 | 
				
			||||||
		.pSetLayouts = layout,
 | 
					 | 
				
			||||||
		.descriptorPool = pool->pool,
 | 
					 | 
				
			||||||
	};
 | 
					 | 
				
			||||||
	res = vkAllocateDescriptorSets(renderer->dev->dev, &ds_info, ds);
 | 
						res = vkAllocateDescriptorSets(renderer->dev->dev, &ds_info, ds);
 | 
				
			||||||
	if (res != VK_SUCCESS) {
 | 
						if (res != VK_SUCCESS) {
 | 
				
			||||||
		wlr_vk_error("vkAllocateDescriptorSets", res);
 | 
							wlr_vk_error("vkAllocateDescriptorSets", res);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -283,7 +283,8 @@ static void output_cursor_source_copy_frame(struct wlr_ext_image_capture_source_
 | 
				
			||||||
	struct timespec now;
 | 
						struct timespec now;
 | 
				
			||||||
	clock_gettime(CLOCK_MONOTONIC, &now);
 | 
						clock_gettime(CLOCK_MONOTONIC, &now);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_ext_image_copy_capture_frame_v1_ready(frame, WL_OUTPUT_TRANSFORM_NORMAL, &now);
 | 
						wlr_ext_image_copy_capture_frame_v1_ready(frame,
 | 
				
			||||||
 | 
								cursor_source->output->transform, &now);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct wlr_ext_image_capture_source_v1_interface output_cursor_source_impl = {
 | 
					static const struct wlr_ext_image_capture_source_v1_interface output_cursor_source_impl = {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -288,18 +288,10 @@ static struct wlr_buffer *render_cursor_buffer(struct wlr_output_cursor *cursor)
 | 
				
			||||||
static bool output_cursor_attempt_hardware(struct wlr_output_cursor *cursor) {
 | 
					static bool output_cursor_attempt_hardware(struct wlr_output_cursor *cursor) {
 | 
				
			||||||
	struct wlr_output *output = cursor->output;
 | 
						struct wlr_output *output = cursor->output;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!output->impl->set_cursor ||
 | 
						if (!output->impl->set_cursor || output->software_cursor_locks > 0) {
 | 
				
			||||||
			output->software_cursor_locks > 0) {
 | 
					 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_output_cursor *hwcur = output->hardware_cursor;
 | 
					 | 
				
			||||||
	if (hwcur != NULL && hwcur != cursor) {
 | 
					 | 
				
			||||||
		return false;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	output->hardware_cursor = NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct wlr_texture *texture = cursor->texture;
 | 
						struct wlr_texture *texture = cursor->texture;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// If the cursor was hidden or was a software cursor, the hardware
 | 
						// If the cursor was hidden or was a software cursor, the hardware
 | 
				
			||||||
| 
						 | 
					@ -424,12 +416,15 @@ bool output_cursor_set_texture(struct wlr_output_cursor *cursor,
 | 
				
			||||||
		wl_list_init(&cursor->renderer_destroy.link);
 | 
							wl_list_init(&cursor->renderer_destroy.link);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (output->hardware_cursor == NULL || output->hardware_cursor == cursor) {
 | 
				
			||||||
		if (output_cursor_attempt_hardware(cursor)) {
 | 
							if (output_cursor_attempt_hardware(cursor)) {
 | 
				
			||||||
			return true;
 | 
								return true;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		wlr_log(WLR_DEBUG, "Falling back to software cursor on output '%s'", output->name);
 | 
							wlr_log(WLR_DEBUG, "Falling back to software cursor on output '%s'", output->name);
 | 
				
			||||||
		output_disable_hardware_cursor(output);
 | 
							output_disable_hardware_cursor(output);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	output_cursor_damage_whole(cursor);
 | 
						output_cursor_damage_whole(cursor);
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -96,9 +96,12 @@ static void scene_buffer_unmark_client_buffer(struct wlr_scene_buffer *scene_buf
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	assert(buffer->n_ignore_locks > 0);
 | 
						// If the buffer was a single-pixel buffer where we cached its color
 | 
				
			||||||
 | 
						// then it won't have been marked as damage-allowed.
 | 
				
			||||||
 | 
						if (buffer->n_ignore_locks > 0) {
 | 
				
			||||||
		buffer->n_ignore_locks--;
 | 
							buffer->n_ignore_locks--;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int min(int a, int b) {
 | 
					static int min(int a, int b) {
 | 
				
			||||||
	return a < b ? a : b;
 | 
						return a < b ? a : b;
 | 
				
			||||||
| 
						 | 
					@ -165,7 +168,21 @@ static void surface_reconfigure(struct wlr_scene_surface *scene_surface) {
 | 
				
			||||||
	scene_buffer_unmark_client_buffer(scene_buffer);
 | 
						scene_buffer_unmark_client_buffer(scene_buffer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (surface->buffer) {
 | 
						if (surface->buffer) {
 | 
				
			||||||
 | 
							// If we've cached the buffer's single-pixel buffer color
 | 
				
			||||||
 | 
							// then any in-place updates to the texture wouldn't be
 | 
				
			||||||
 | 
							// reflected in rendering. So only allow in-place texture
 | 
				
			||||||
 | 
							// updates if it's not a single pixel buffer.  Note that we
 | 
				
			||||||
 | 
							// can't use the cached scene_buffer->is_single_pixel_buffer
 | 
				
			||||||
 | 
							// because that's only set later on.
 | 
				
			||||||
 | 
							bool is_single_pixel_buffer = false;
 | 
				
			||||||
 | 
							if (surface->buffer->source != NULL) {
 | 
				
			||||||
 | 
								struct wlr_single_pixel_buffer_v1 *spb =
 | 
				
			||||||
 | 
									wlr_single_pixel_buffer_v1_try_from_buffer(surface->buffer->source);
 | 
				
			||||||
 | 
								is_single_pixel_buffer = spb != NULL;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if (!is_single_pixel_buffer) {
 | 
				
			||||||
			client_buffer_mark_next_can_damage(surface->buffer);
 | 
								client_buffer_mark_next_can_damage(surface->buffer);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		struct wlr_linux_drm_syncobj_surface_v1_state *syncobj_surface_state =
 | 
							struct wlr_linux_drm_syncobj_surface_v1_state *syncobj_surface_state =
 | 
				
			||||||
			wlr_linux_drm_syncobj_v1_get_surface_state(surface);
 | 
								wlr_linux_drm_syncobj_v1_get_surface_state(surface);
 | 
				
			||||||
| 
						 | 
					@ -186,7 +203,8 @@ static void surface_reconfigure(struct wlr_scene_surface *scene_surface) {
 | 
				
			||||||
			&surface->buffer->base, &options);
 | 
								&surface->buffer->base, &options);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (syncobj_surface_state != NULL &&
 | 
							if (syncobj_surface_state != NULL &&
 | 
				
			||||||
				(surface->current.committed & WLR_SURFACE_STATE_BUFFER)) {
 | 
									(surface->current.committed & WLR_SURFACE_STATE_BUFFER) &&
 | 
				
			||||||
 | 
									surface->buffer->source != NULL) {
 | 
				
			||||||
			wlr_linux_drm_syncobj_v1_state_signal_release_with_buffer(syncobj_surface_state,
 | 
								wlr_linux_drm_syncobj_v1_state_signal_release_with_buffer(syncobj_surface_state,
 | 
				
			||||||
				surface->buffer->source);
 | 
									surface->buffer->source);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -530,10 +530,6 @@ static void cursor_output_cursor_update(struct wlr_cursor_output_cursor *output_
 | 
				
			||||||
	struct wlr_cursor *cur = output_cursor->cursor;
 | 
						struct wlr_cursor *cur = output_cursor->cursor;
 | 
				
			||||||
	struct wlr_output *output = output_cursor->output_cursor->output;
 | 
						struct wlr_output *output = output_cursor->output_cursor->output;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!output->enabled) {
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	cursor_output_cursor_reset_image(output_cursor);
 | 
						cursor_output_cursor_reset_image(output_cursor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (cur->state->buffer != NULL) {
 | 
						if (cur->state->buffer != NULL) {
 | 
				
			||||||
| 
						 | 
					@ -589,10 +585,11 @@ static void cursor_output_cursor_update(struct wlr_cursor_output_cursor *output_
 | 
				
			||||||
			&src_box, dst_width, dst_height, surface->current.transform,
 | 
								&src_box, dst_width, dst_height, surface->current.transform,
 | 
				
			||||||
			hotspot_x, hotspot_y, wait_timeline, wait_point);
 | 
								hotspot_x, hotspot_y, wait_timeline, wait_point);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (syncobj_surface_state != NULL && surface->buffer != NULL &&
 | 
							if (syncobj_surface_state != NULL &&
 | 
				
			||||||
 | 
									surface->buffer != NULL && surface->buffer->source != NULL &&
 | 
				
			||||||
				(surface->current.committed & WLR_SURFACE_STATE_BUFFER)) {
 | 
									(surface->current.committed & WLR_SURFACE_STATE_BUFFER)) {
 | 
				
			||||||
			wlr_linux_drm_syncobj_v1_state_signal_release_with_buffer(syncobj_surface_state,
 | 
								wlr_linux_drm_syncobj_v1_state_signal_release_with_buffer(syncobj_surface_state,
 | 
				
			||||||
				&surface->buffer->base);
 | 
									surface->buffer->source);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (output_cursor->output_cursor->visible) {
 | 
							if (output_cursor->output_cursor->visible) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -68,10 +68,6 @@ static void drm_lease_connector_v1_destroy(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_log(WLR_DEBUG, "Destroying connector %s", connector->output->name);
 | 
						wlr_log(WLR_DEBUG, "Destroying connector %s", connector->output->name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (connector->active_lease) {
 | 
					 | 
				
			||||||
		wlr_drm_lease_terminate(connector->active_lease->drm_lease);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct wl_resource *resource, *tmp;
 | 
						struct wl_resource *resource, *tmp;
 | 
				
			||||||
	wl_resource_for_each_safe(resource, tmp, &connector->resources) {
 | 
						wl_resource_for_each_safe(resource, tmp, &connector->resources) {
 | 
				
			||||||
		wp_drm_lease_connector_v1_send_withdrawn(resource);
 | 
							wp_drm_lease_connector_v1_send_withdrawn(resource);
 | 
				
			||||||
| 
						 | 
					@ -140,14 +136,9 @@ static void lease_handle_destroy(struct wl_listener *listener, void *data) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_list_remove(&lease->destroy.link);
 | 
						wl_list_remove(&lease->destroy.link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (size_t i = 0; i < lease->n_connectors; ++i) {
 | 
					 | 
				
			||||||
		lease->connectors[i]->active_lease = NULL;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	wl_list_remove(&lease->link);
 | 
						wl_list_remove(&lease->link);
 | 
				
			||||||
	wl_resource_set_user_data(lease->resource, NULL);
 | 
						wl_resource_set_user_data(lease->resource, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	free(lease->connectors);
 | 
					 | 
				
			||||||
	free(lease);
 | 
						free(lease);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -180,20 +171,6 @@ struct wlr_drm_lease_v1 *wlr_drm_lease_request_v1_grant(
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	lease->connectors = calloc(request->n_connectors, sizeof(*lease->connectors));
 | 
					 | 
				
			||||||
	if (!lease->connectors) {
 | 
					 | 
				
			||||||
		wlr_log(WLR_ERROR, "Failed to allocate lease connectors list");
 | 
					 | 
				
			||||||
		close(fd);
 | 
					 | 
				
			||||||
		wp_drm_lease_v1_send_finished(lease->resource);
 | 
					 | 
				
			||||||
		free(lease);
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	lease->n_connectors = request->n_connectors;
 | 
					 | 
				
			||||||
	for (size_t i = 0; i < request->n_connectors; ++i) {
 | 
					 | 
				
			||||||
		lease->connectors[i] = request->connectors[i];
 | 
					 | 
				
			||||||
		lease->connectors[i]->active_lease = lease;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	lease->destroy.notify = lease_handle_destroy;
 | 
						lease->destroy.notify = lease_handle_destroy;
 | 
				
			||||||
	wl_signal_add(&lease->drm_lease->events.destroy, &lease->destroy);
 | 
						wl_signal_add(&lease->drm_lease->events.destroy, &lease->destroy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -338,16 +315,6 @@ static void drm_lease_request_v1_handle_submit(
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (size_t i = 0; i < request->n_connectors; ++i) {
 | 
					 | 
				
			||||||
		struct wlr_drm_lease_connector_v1 *conn = request->connectors[i];
 | 
					 | 
				
			||||||
		if (conn->active_lease) {
 | 
					 | 
				
			||||||
			wlr_log(WLR_ERROR, "Failed to create lease, connector %s has "
 | 
					 | 
				
			||||||
					"already been leased", conn->output->name);
 | 
					 | 
				
			||||||
			wp_drm_lease_v1_send_finished(lease_resource);
 | 
					 | 
				
			||||||
			return;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	request->lease_resource = lease_resource;
 | 
						request->lease_resource = lease_resource;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_signal_emit_mutable(&request->device->manager->events.request,
 | 
						wl_signal_emit_mutable(&request->device->manager->events.request,
 | 
				
			||||||
| 
						 | 
					@ -440,10 +407,6 @@ static struct wp_drm_lease_connector_v1_interface lease_connector_impl = {
 | 
				
			||||||
static void drm_lease_connector_v1_send_to_client(
 | 
					static void drm_lease_connector_v1_send_to_client(
 | 
				
			||||||
		struct wlr_drm_lease_connector_v1 *connector,
 | 
							struct wlr_drm_lease_connector_v1 *connector,
 | 
				
			||||||
		struct wl_resource *resource) {
 | 
							struct wl_resource *resource) {
 | 
				
			||||||
	if (connector->active_lease) {
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct wl_client *client = wl_resource_get_client(resource);
 | 
						struct wl_client *client = wl_resource_get_client(resource);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uint32_t version = wl_resource_get_version(resource);
 | 
						uint32_t version = wl_resource_get_version(resource);
 | 
				
			||||||
| 
						 | 
					@ -490,10 +453,12 @@ static void lease_device_bind(struct wl_client *wl_client, void *data,
 | 
				
			||||||
	if (!device) {
 | 
						if (!device) {
 | 
				
			||||||
		wlr_log(WLR_DEBUG, "Failed to bind lease device, "
 | 
							wlr_log(WLR_DEBUG, "Failed to bind lease device, "
 | 
				
			||||||
				"the wlr_drm_lease_device_v1 has been destroyed");
 | 
									"the wlr_drm_lease_device_v1 has been destroyed");
 | 
				
			||||||
 | 
							wl_list_init(wl_resource_get_link(device_resource));
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_resource_set_user_data(device_resource, device);
 | 
						wl_resource_set_user_data(device_resource, device);
 | 
				
			||||||
 | 
						wl_list_insert(&device->resources, wl_resource_get_link(device_resource));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int fd = wlr_drm_backend_get_non_master_fd(device->backend);
 | 
						int fd = wlr_drm_backend_get_non_master_fd(device->backend);
 | 
				
			||||||
	if (fd < 0) {
 | 
						if (fd < 0) {
 | 
				
			||||||
| 
						 | 
					@ -505,8 +470,6 @@ static void lease_device_bind(struct wl_client *wl_client, void *data,
 | 
				
			||||||
	wp_drm_lease_device_v1_send_drm_fd(device_resource, fd);
 | 
						wp_drm_lease_device_v1_send_drm_fd(device_resource, fd);
 | 
				
			||||||
	close(fd);
 | 
						close(fd);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_list_insert(&device->resources, wl_resource_get_link(device_resource));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct wlr_drm_lease_connector_v1 *connector;
 | 
						struct wlr_drm_lease_connector_v1 *connector;
 | 
				
			||||||
	wl_list_for_each(connector, &device->connectors, link) {
 | 
						wl_list_for_each(connector, &device->connectors, link) {
 | 
				
			||||||
		drm_lease_connector_v1_send_to_client(connector, device_resource);
 | 
							drm_lease_connector_v1_send_to_client(connector, device_resource);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -64,6 +64,7 @@ static void manager_create_transient_seat(struct wl_client *client,
 | 
				
			||||||
	wl_resource_set_implementation(seat->resource, &transient_seat_impl,
 | 
						wl_resource_set_implementation(seat->resource, &transient_seat_impl,
 | 
				
			||||||
			seat, transient_seat_handle_resource_destroy);
 | 
								seat, transient_seat_handle_resource_destroy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						wl_list_init(&seat->seat_destroy.link);
 | 
				
			||||||
	wl_signal_emit_mutable(&manager->events.create_seat, seat);
 | 
						wl_signal_emit_mutable(&manager->events.create_seat, seat);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,7 +67,12 @@ bool wlr_box_intersection(struct wlr_box *dest, const struct wlr_box *box_a,
 | 
				
			||||||
	dest->width = x2 - x1;
 | 
						dest->width = x2 - x1;
 | 
				
			||||||
	dest->height = y2 - y1;
 | 
						dest->height = y2 - y1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return !wlr_box_empty(dest);
 | 
						if (wlr_box_empty(dest)) {
 | 
				
			||||||
 | 
							*dest = (struct wlr_box){0};
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_box_contains_point(const struct wlr_box *box, double x, double y) {
 | 
					bool wlr_box_contains_point(const struct wlr_box *box, double x, double y) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue