Merge pull request #53 from nyorain/drm_buffer

Implement drm (egl) buffer attaching
This commit is contained in:
Drew DeVault 2017-08-10 22:20:21 -04:00 committed by GitHub
commit 6569c2b626
33 changed files with 427 additions and 74 deletions

View file

@ -133,6 +133,7 @@ bool wlr_output_set_cursor(struct wlr_output *output,
return true;
}
/*
wlr_log(L_INFO, "Falling back to software cursor");
output->cursor.is_sw = true;
@ -149,8 +150,9 @@ bool wlr_output_set_cursor(struct wlr_output *output,
wlr_texture_upload_pixels(output->cursor.texture, WL_SHM_FORMAT_ARGB8888,
stride, width, height, buf);
*/
return true;
return false;
}
bool wlr_output_move_cursor(struct wlr_output *output, int x, int y) {

View file

@ -2,6 +2,7 @@
#include <stdlib.h>
#include <wayland-server.h>
#include <wlr/util/log.h>
#include <wlr/egl.h>
#include <wlr/render/interface.h>
#include <wlr/types/wlr_surface.h>
@ -123,8 +124,13 @@ void wlr_surface_flush_damage(struct wlr_surface *surface) {
}
struct wl_shm_buffer *buffer = wl_shm_buffer_get(surface->current.buffer);
if (!buffer) {
wlr_log(L_INFO, "Unknown buffer handle attached");
return;
if (wlr_renderer_buffer_is_drm(surface->renderer, surface->pending.buffer)) {
wlr_texture_upload_drm(surface->texture, surface->pending.buffer);
goto release;
} else {
wlr_log(L_INFO, "Unknown buffer handle attached");
return;
}
}
pixman_region32_t damage = surface->current.surface_damage;
if (!pixman_region32_not_empty(&damage)) {
@ -182,23 +188,23 @@ const struct wl_surface_interface surface_interface = {
static void destroy_surface(struct wl_resource *resource) {
struct wlr_surface *surface = wl_resource_get_user_data(resource);
wl_signal_emit(&surface->signals.destroy, surface);
wlr_texture_destroy(surface->texture);
wlr_texture_destroy(surface->texture);
struct wlr_frame_callback *cb, *next;
wl_list_for_each_safe(cb, next, &surface->frame_callback_list, link) {
wl_resource_destroy(cb->resource);
}
free(surface);
}
struct wlr_surface *wlr_surface_create(struct wl_resource *res,
struct wlr_renderer *renderer) {
struct wlr_surface *surface = calloc(1, sizeof(struct wlr_surface));
surface->renderer = renderer;
surface->texture = wlr_render_texture_init(renderer);
surface->resource = res;
wl_signal_init(&surface->signals.commit);
wl_signal_init(&surface->signals.destroy);
wl_list_init(&surface->frame_callback_list);
wl_resource_set_implementation(res, &surface_interface,
surface, destroy_surface);