Remove wlr_ prefix from local symbols

This commit is contained in:
emersion 2018-04-21 11:42:18 +01:00
parent 097561d6bf
commit b0d99f5c67
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
26 changed files with 163 additions and 199 deletions

View File

@ -237,7 +237,7 @@ static uint32_t atomic_crtc_get_gamma_size(struct wlr_drm_backend *drm,
return legacy_iface.crtc_get_gamma_size(drm, crtc); return legacy_iface.crtc_get_gamma_size(drm, crtc);
} }
if (!wlr_drm_get_prop(drm->fd, crtc->id, crtc->props.gamma_lut_size, if (!drm_get_prop(drm->fd, crtc->id, crtc->props.gamma_lut_size,
&gamma_lut_size)) { &gamma_lut_size)) {
wlr_log(L_ERROR, "Unable to get gamma lut size"); wlr_log(L_ERROR, "Unable to get gamma lut size");
return 0; return 0;

View File

@ -17,7 +17,7 @@
static bool wlr_drm_backend_start(struct wlr_backend *backend) { static bool wlr_drm_backend_start(struct wlr_backend *backend) {
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend; struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
wlr_drm_scan_connectors(drm); drm_scan_connectors(drm);
return true; return true;
} }
@ -28,7 +28,7 @@ static void wlr_drm_backend_destroy(struct wlr_backend *backend) {
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend; struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
wlr_drm_restore_outputs(drm); drm_restore_outputs(drm);
struct wlr_drm_connector *conn, *next; struct wlr_drm_connector *conn, *next;
wl_list_for_each_safe(conn, next, &drm->outputs, link) { wl_list_for_each_safe(conn, next, &drm->outputs, link) {
@ -41,8 +41,8 @@ static void wlr_drm_backend_destroy(struct wlr_backend *backend) {
wl_list_remove(&drm->session_signal.link); wl_list_remove(&drm->session_signal.link);
wl_list_remove(&drm->drm_invalidated.link); wl_list_remove(&drm->drm_invalidated.link);
wlr_drm_resources_free(drm); drm_resources_finish(drm);
wlr_drm_renderer_finish(&drm->renderer); drm_renderer_finish(&drm->renderer);
wlr_session_close_file(drm->session, drm->fd); wlr_session_close_file(drm->session, drm->fd);
wl_event_source_remove(drm->drm_event); wl_event_source_remove(drm->drm_event);
free(drm); free(drm);
@ -71,14 +71,14 @@ static void session_signal(struct wl_listener *listener, void *data) {
if (session->active) { if (session->active) {
wlr_log(L_INFO, "DRM fd resumed"); wlr_log(L_INFO, "DRM fd resumed");
wlr_drm_scan_connectors(drm); drm_scan_connectors(drm);
struct wlr_drm_connector *conn; struct wlr_drm_connector *conn;
wl_list_for_each(conn, &drm->outputs, link){ wl_list_for_each(conn, &drm->outputs, link){
if (conn->output.enabled) { if (conn->output.enabled) {
wlr_output_set_mode(&conn->output, conn->output.current_mode); wlr_output_set_mode(&conn->output, conn->output.current_mode);
} else { } else {
wlr_drm_connector_enable(&conn->output, false); drm_connector_enable(&conn->output, false);
} }
if (!conn->crtc) { if (!conn->crtc) {
@ -104,7 +104,7 @@ static void drm_invalidated(struct wl_listener *listener, void *data) {
wlr_log(L_DEBUG, "%s invalidated", name); wlr_log(L_DEBUG, "%s invalidated", name);
free(name); free(name);
wlr_drm_scan_connectors(drm); drm_scan_connectors(drm);
} }
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
@ -144,7 +144,7 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
struct wl_event_loop *event_loop = wl_display_get_event_loop(display); struct wl_event_loop *event_loop = wl_display_get_event_loop(display);
drm->drm_event = wl_event_loop_add_fd(event_loop, drm->fd, drm->drm_event = wl_event_loop_add_fd(event_loop, drm->fd,
WL_EVENT_READABLE, wlr_drm_event, NULL); WL_EVENT_READABLE, drm_event, NULL);
if (!drm->drm_event) { if (!drm->drm_event) {
wlr_log(L_ERROR, "Failed to create DRM event source"); wlr_log(L_ERROR, "Failed to create DRM event source");
goto error_fd; goto error_fd;
@ -153,15 +153,15 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
drm->session_signal.notify = session_signal; drm->session_signal.notify = session_signal;
wl_signal_add(&session->session_signal, &drm->session_signal); wl_signal_add(&session->session_signal, &drm->session_signal);
if (!wlr_drm_check_features(drm)) { if (!drm_check_features(drm)) {
goto error_event; goto error_event;
} }
if (!wlr_drm_resources_init(drm)) { if (!drm_resources_init(drm)) {
goto error_event; goto error_event;
} }
if (!wlr_drm_renderer_init(drm, &drm->renderer)) { if (!drm_renderer_init(drm, &drm->renderer)) {
wlr_log(L_ERROR, "Failed to initialize renderer"); wlr_log(L_ERROR, "Failed to initialize renderer");
goto error_event; goto error_event;
} }

View File

@ -26,7 +26,7 @@
#include "backend/drm/util.h" #include "backend/drm/util.h"
#include "util/signal.h" #include "util/signal.h"
bool wlr_drm_check_features(struct wlr_drm_backend *drm) { bool drm_check_features(struct wlr_drm_backend *drm) {
if (drmSetClientCap(drm->fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1)) { if (drmSetClientCap(drm->fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1)) {
wlr_log(L_ERROR, "DRM universal planes unsupported"); wlr_log(L_ERROR, "DRM universal planes unsupported");
return false; return false;
@ -87,8 +87,8 @@ static bool init_planes(struct wlr_drm_backend *drm) {
p->possible_crtcs = plane->possible_crtcs; p->possible_crtcs = plane->possible_crtcs;
uint64_t type; uint64_t type;
if (!wlr_drm_get_plane_props(drm->fd, p->id, &p->props) || if (!drm_get_plane_props(drm->fd, p->id, &p->props) ||
!wlr_drm_get_prop(drm->fd, p->id, p->props.type, &type)) { !drm_get_prop(drm->fd, p->id, p->props.type, &type)) {
drmModeFreePlane(plane); drmModeFreePlane(plane);
goto error_planes; goto error_planes;
} }
@ -122,7 +122,7 @@ error_res:
return false; return false;
} }
bool wlr_drm_resources_init(struct wlr_drm_backend *drm) { bool drm_resources_init(struct wlr_drm_backend *drm) {
drmModeRes *res = drmModeGetResources(drm->fd); drmModeRes *res = drmModeGetResources(drm->fd);
if (!res) { if (!res) {
wlr_log_errno(L_ERROR, "Failed to get DRM resources"); wlr_log_errno(L_ERROR, "Failed to get DRM resources");
@ -142,7 +142,7 @@ bool wlr_drm_resources_init(struct wlr_drm_backend *drm) {
struct wlr_drm_crtc *crtc = &drm->crtcs[i]; struct wlr_drm_crtc *crtc = &drm->crtcs[i];
crtc->id = res->crtcs[i]; crtc->id = res->crtcs[i];
crtc->legacy_crtc = drmModeGetCrtc(drm->fd, crtc->id); crtc->legacy_crtc = drmModeGetCrtc(drm->fd, crtc->id);
wlr_drm_get_crtc_props(drm->fd, crtc->id, &crtc->props); drm_get_crtc_props(drm->fd, crtc->id, &crtc->props);
} }
if (!init_planes(drm)) { if (!init_planes(drm)) {
@ -160,7 +160,7 @@ error_res:
return false; return false;
} }
void wlr_drm_resources_free(struct wlr_drm_backend *drm) { void drm_resources_finish(struct wlr_drm_backend *drm) {
if (!drm) { if (!drm) {
return; return;
} }
@ -187,13 +187,13 @@ void wlr_drm_resources_free(struct wlr_drm_backend *drm) {
free(drm->planes); free(drm->planes);
} }
static bool wlr_drm_connector_make_current(struct wlr_output *output, static bool drm_connector_make_current(struct wlr_output *output,
int *buffer_age) { int *buffer_age) {
struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
return wlr_drm_surface_make_current(&conn->crtc->primary->surf, buffer_age); return drm_surface_make_current(&conn->crtc->primary->surf, buffer_age);
} }
static bool wlr_drm_connector_swap_buffers(struct wlr_output *output, static bool drm_connector_swap_buffers(struct wlr_output *output,
pixman_region32_t *damage) { pixman_region32_t *damage) {
struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend; struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
@ -207,9 +207,9 @@ static bool wlr_drm_connector_swap_buffers(struct wlr_output *output,
} }
struct wlr_drm_plane *plane = crtc->primary; struct wlr_drm_plane *plane = crtc->primary;
struct gbm_bo *bo = wlr_drm_surface_swap_buffers(&plane->surf, damage); struct gbm_bo *bo = drm_surface_swap_buffers(&plane->surf, damage);
if (drm->parent) { if (drm->parent) {
bo = wlr_drm_surface_mgpu_copy(&plane->mgpu_surf, bo); bo = drm_surface_mgpu_copy(&plane->mgpu_surf, bo);
} }
uint32_t fb_id = get_fb_for_bo(bo); uint32_t fb_id = get_fb_for_bo(bo);
@ -227,7 +227,7 @@ static bool wlr_drm_connector_swap_buffers(struct wlr_output *output,
return true; return true;
} }
static void wlr_drm_connector_set_gamma(struct wlr_output *output, static void drm_connector_set_gamma(struct wlr_output *output,
uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b) { uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b) {
struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend; struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
@ -242,7 +242,7 @@ static void wlr_drm_connector_set_gamma(struct wlr_output *output,
} }
static uint32_t wlr_drm_connector_get_gamma_size(struct wlr_output *output) { static uint32_t drm_connector_get_gamma_size(struct wlr_output *output) {
struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend; struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
@ -253,7 +253,7 @@ static uint32_t wlr_drm_connector_get_gamma_size(struct wlr_output *output) {
return 0; return 0;
} }
void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn) { static void drm_connector_start_renderer(struct wlr_drm_connector *conn) {
if (conn->state != WLR_DRM_CONN_CONNECTED) { if (conn->state != WLR_DRM_CONN_CONNECTED) {
return; return;
} }
@ -265,7 +265,7 @@ void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn) {
} }
struct wlr_drm_plane *plane = crtc->primary; struct wlr_drm_plane *plane = crtc->primary;
struct gbm_bo *bo = wlr_drm_surface_get_front( struct gbm_bo *bo = drm_surface_get_front(
drm->parent ? &plane->mgpu_surf : &plane->surf); drm->parent ? &plane->mgpu_surf : &plane->surf);
uint32_t fb_id = get_fb_for_bo(bo); uint32_t fb_id = get_fb_for_bo(bo);
@ -279,7 +279,7 @@ void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn) {
} }
} }
void wlr_drm_connector_enable(struct wlr_output *output, bool enable) { void drm_connector_enable(struct wlr_output *output, bool enable) {
struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
if (conn->state != WLR_DRM_CONN_CONNECTED) { if (conn->state != WLR_DRM_CONN_CONNECTED) {
return; return;
@ -292,7 +292,7 @@ void wlr_drm_connector_enable(struct wlr_output *output, bool enable) {
} }
if (enable) { if (enable) {
wlr_drm_connector_start_renderer(conn); drm_connector_start_renderer(conn);
} }
wlr_output_update_enabled(&conn->output, enable); wlr_output_update_enabled(&conn->output, enable);
@ -340,9 +340,9 @@ static void realloc_planes(struct wlr_drm_backend *drm, const uint32_t *crtc_in,
if (*old != new) { if (*old != new) {
changed_outputs[crtc_res[i]] = true; changed_outputs[crtc_res[i]] = true;
if (*old) { if (*old) {
wlr_drm_surface_finish(&(*old)->surf); drm_surface_finish(&(*old)->surf);
} }
wlr_drm_surface_finish(&new->surf); drm_surface_finish(&new->surf);
*old = new; *old = new;
} }
} }
@ -461,7 +461,9 @@ error_conn:
return 0; return 0;
} }
static bool wlr_drm_connector_set_mode(struct wlr_output *output, static void drm_connector_cleanup(struct wlr_drm_connector *conn);
static bool drm_connector_set_mode(struct wlr_output *output,
struct wlr_output_mode *mode) { struct wlr_output_mode *mode) {
struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend; struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
@ -513,28 +515,28 @@ static bool wlr_drm_connector_set_mode(struct wlr_output *output,
continue; continue;
} }
if (!wlr_drm_plane_surfaces_init(crtc->primary, drm, if (!drm_plane_surfaces_init(crtc->primary, drm,
mode->width, mode->height, GBM_FORMAT_XRGB8888)) { mode->width, mode->height, GBM_FORMAT_XRGB8888)) {
wlr_log(L_ERROR, "Failed to initialize renderer for plane"); wlr_log(L_ERROR, "Failed to initialize renderer for plane");
goto error_conn; goto error_conn;
} }
wlr_drm_connector_start_renderer(conn); drm_connector_start_renderer(conn);
} }
return true; return true;
error_conn: error_conn:
wlr_drm_connector_cleanup(conn); drm_connector_cleanup(conn);
return false; return false;
} }
static void wlr_drm_connector_transform(struct wlr_output *output, static void drm_connector_transform(struct wlr_output *output,
enum wl_output_transform transform) { enum wl_output_transform transform) {
output->transform = transform; output->transform = transform;
} }
static bool wlr_drm_connector_set_cursor(struct wlr_output *output, static bool drm_connector_set_cursor(struct wlr_output *output,
const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height, const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height,
int32_t hotspot_x, int32_t hotspot_y, bool update_pixels) { int32_t hotspot_x, int32_t hotspot_y, bool update_pixels) {
struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
@ -570,7 +572,7 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
return false; return false;
} }
if (!wlr_drm_surface_init(&plane->surf, renderer, w, h, if (!drm_surface_init(&plane->surf, renderer, w, h,
GBM_FORMAT_ARGB8888, 0)) { GBM_FORMAT_ARGB8888, 0)) {
wlr_log(L_ERROR, "Cannot allocate cursor resources"); wlr_log(L_ERROR, "Cannot allocate cursor resources");
return false; return false;
@ -629,7 +631,7 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
return false; return false;
} }
wlr_drm_surface_make_current(&plane->surf, NULL); drm_surface_make_current(&plane->surf, NULL);
struct wlr_renderer *rend = plane->surf.renderer->wlr_rend; struct wlr_renderer *rend = plane->surf.renderer->wlr_rend;
@ -648,7 +650,7 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
wlr_renderer_read_pixels(rend, WL_SHM_FORMAT_ARGB8888, bo_stride, wlr_renderer_read_pixels(rend, WL_SHM_FORMAT_ARGB8888, bo_stride,
plane->surf.width, plane->surf.height, 0, 0, 0, 0, bo_data); plane->surf.width, plane->surf.height, 0, 0, 0, 0, bo_data);
wlr_drm_surface_swap_buffers(&plane->surf, NULL); drm_surface_swap_buffers(&plane->surf, NULL);
wlr_texture_destroy(texture); wlr_texture_destroy(texture);
gbm_bo_unmap(plane->cursor_bo, bo_data); gbm_bo_unmap(plane->cursor_bo, bo_data);
@ -666,7 +668,7 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
return ok; return ok;
} }
static bool wlr_drm_connector_move_cursor(struct wlr_output *output, static bool drm_connector_move_cursor(struct wlr_output *output,
int x, int y) { int x, int y) {
struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend; struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
@ -703,25 +705,25 @@ static bool wlr_drm_connector_move_cursor(struct wlr_output *output,
return ok; return ok;
} }
static void wlr_drm_connector_destroy(struct wlr_output *output) { static void drm_connector_destroy(struct wlr_output *output) {
struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
wlr_drm_connector_cleanup(conn); drm_connector_cleanup(conn);
wl_event_source_remove(conn->retry_pageflip); wl_event_source_remove(conn->retry_pageflip);
wl_list_remove(&conn->link); wl_list_remove(&conn->link);
free(conn); free(conn);
} }
static struct wlr_output_impl output_impl = { static const struct wlr_output_impl output_impl = {
.enable = wlr_drm_connector_enable, .enable = drm_connector_enable,
.set_mode = wlr_drm_connector_set_mode, .set_mode = drm_connector_set_mode,
.transform = wlr_drm_connector_transform, .transform = drm_connector_transform,
.set_cursor = wlr_drm_connector_set_cursor, .set_cursor = drm_connector_set_cursor,
.move_cursor = wlr_drm_connector_move_cursor, .move_cursor = drm_connector_move_cursor,
.destroy = wlr_drm_connector_destroy, .destroy = drm_connector_destroy,
.make_current = wlr_drm_connector_make_current, .make_current = drm_connector_make_current,
.swap_buffers = wlr_drm_connector_swap_buffers, .swap_buffers = drm_connector_swap_buffers,
.set_gamma = wlr_drm_connector_set_gamma, .set_gamma = drm_connector_set_gamma,
.get_gamma_size = wlr_drm_connector_get_gamma_size, .get_gamma_size = drm_connector_get_gamma_size,
}; };
bool wlr_output_is_drm(struct wlr_output *output) { bool wlr_output_is_drm(struct wlr_output *output) {
@ -731,7 +733,7 @@ bool wlr_output_is_drm(struct wlr_output *output) {
static int retry_pageflip(void *data) { static int retry_pageflip(void *data) {
struct wlr_drm_connector *conn = data; struct wlr_drm_connector *conn = data;
wlr_log(L_INFO, "%s: Retrying pageflip", conn->output.name); wlr_log(L_INFO, "%s: Retrying pageflip", conn->output.name);
wlr_drm_connector_start_renderer(conn); drm_connector_start_renderer(conn);
return 0; return 0;
} }
@ -744,7 +746,7 @@ static const int32_t subpixel_map[] = {
[DRM_MODE_SUBPIXEL_NONE] = WL_OUTPUT_SUBPIXEL_NONE, [DRM_MODE_SUBPIXEL_NONE] = WL_OUTPUT_SUBPIXEL_NONE,
}; };
void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) { void drm_scan_connectors(struct wlr_drm_backend *drm) {
wlr_log(L_INFO, "Scanning DRM connectors"); wlr_log(L_INFO, "Scanning DRM connectors");
drmModeRes *res = drmModeGetResources(drm->fd); drmModeRes *res = drmModeGetResources(drm->fd);
@ -834,10 +836,10 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) {
wlr_conn->output.phys_width, wlr_conn->output.phys_height); wlr_conn->output.phys_width, wlr_conn->output.phys_height);
wlr_conn->output.subpixel = subpixel_map[drm_conn->subpixel]; wlr_conn->output.subpixel = subpixel_map[drm_conn->subpixel];
wlr_drm_get_connector_props(drm->fd, wlr_conn->id, &wlr_conn->props); drm_get_connector_props(drm->fd, wlr_conn->id, &wlr_conn->props);
size_t edid_len = 0; size_t edid_len = 0;
uint8_t *edid = wlr_drm_get_prop_blob(drm->fd, uint8_t *edid = drm_get_prop_blob(drm->fd,
wlr_conn->id, wlr_conn->props.edid, &edid_len); wlr_conn->id, wlr_conn->props.edid, &edid_len);
parse_edid(&wlr_conn->output, edid_len, edid); parse_edid(&wlr_conn->output, edid_len, edid);
free(edid); free(edid);
@ -874,7 +876,7 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) {
wlr_log(L_INFO, "'%s' disconnected", wlr_conn->output.name); wlr_log(L_INFO, "'%s' disconnected", wlr_conn->output.name);
wlr_output_update_enabled(&wlr_conn->output, false); wlr_output_update_enabled(&wlr_conn->output, false);
wlr_drm_connector_cleanup(wlr_conn); drm_connector_cleanup(wlr_conn);
} }
drmModeFreeEncoder(curr_enc); drmModeFreeEncoder(curr_enc);
@ -892,7 +894,7 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) {
} }
wlr_log(L_INFO, "'%s' disappeared", conn->output.name); wlr_log(L_INFO, "'%s' disappeared", conn->output.name);
wlr_drm_connector_cleanup(conn); drm_connector_cleanup(conn);
drmModeFreeCrtc(conn->old_crtc); drmModeFreeCrtc(conn->old_crtc);
wl_event_source_remove(conn->retry_pageflip); wl_event_source_remove(conn->retry_pageflip);
@ -911,9 +913,9 @@ static void page_flip_handler(int fd, unsigned seq,
return; return;
} }
wlr_drm_surface_post(&conn->crtc->primary->surf); drm_surface_post(&conn->crtc->primary->surf);
if (drm->parent) { if (drm->parent) {
wlr_drm_surface_post(&conn->crtc->primary->mgpu_surf); drm_surface_post(&conn->crtc->primary->mgpu_surf);
} }
if (drm->session->active) { if (drm->session->active) {
@ -921,7 +923,7 @@ static void page_flip_handler(int fd, unsigned seq,
} }
} }
int wlr_drm_event(int fd, uint32_t mask, void *data) { int drm_event(int fd, uint32_t mask, void *data) {
drmEventContext event = { drmEventContext event = {
.version = DRM_EVENT_CONTEXT_VERSION, .version = DRM_EVENT_CONTEXT_VERSION,
.page_flip_handler = page_flip_handler, .page_flip_handler = page_flip_handler,
@ -931,7 +933,7 @@ int wlr_drm_event(int fd, uint32_t mask, void *data) {
return 1; return 1;
} }
void wlr_drm_restore_outputs(struct wlr_drm_backend *drm) { void drm_restore_outputs(struct wlr_drm_backend *drm) {
uint64_t to_close = (1 << wl_list_length(&drm->outputs)) - 1; uint64_t to_close = (1 << wl_list_length(&drm->outputs)) - 1;
struct wlr_drm_connector *conn; struct wlr_drm_connector *conn;
@ -944,7 +946,7 @@ void wlr_drm_restore_outputs(struct wlr_drm_backend *drm) {
time_t timeout = time(NULL) + 5; time_t timeout = time(NULL) + 5;
while (to_close && time(NULL) < timeout) { while (to_close && time(NULL) < timeout) {
wlr_drm_event(drm->fd, 0, NULL); drm_event(drm->fd, 0, NULL);
size_t i = 0; size_t i = 0;
struct wlr_drm_connector *conn; struct wlr_drm_connector *conn;
wl_list_for_each(conn, &drm->outputs, link) { wl_list_for_each(conn, &drm->outputs, link) {
@ -971,7 +973,7 @@ void wlr_drm_restore_outputs(struct wlr_drm_backend *drm) {
} }
} }
void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn) { static void drm_connector_cleanup(struct wlr_drm_connector *conn) {
if (!conn) { if (!conn) {
return; return;
} }
@ -985,8 +987,8 @@ void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn) {
continue; continue;
} }
wlr_drm_surface_finish(&crtc->planes[i]->surf); drm_surface_finish(&crtc->planes[i]->surf);
wlr_drm_surface_finish(&crtc->planes[i]->mgpu_surf); drm_surface_finish(&crtc->planes[i]->mgpu_surf);
if (crtc->planes[i]->id == 0) { if (crtc->planes[i]->id == 0) {
free(crtc->planes[i]); free(crtc->planes[i]);
crtc->planes[i] = NULL; crtc->planes[i] = NULL;

View File

@ -87,22 +87,22 @@ static bool scan_properties(int fd, uint32_t id, uint32_t type, uint32_t *result
return true; return true;
} }
bool wlr_drm_get_connector_props(int fd, uint32_t id, union wlr_drm_connector_props *out) { bool drm_get_connector_props(int fd, uint32_t id, union wlr_drm_connector_props *out) {
return scan_properties(fd, id, DRM_MODE_OBJECT_CONNECTOR, out->props, return scan_properties(fd, id, DRM_MODE_OBJECT_CONNECTOR, out->props,
connector_info, sizeof(connector_info) / sizeof(connector_info[0])); connector_info, sizeof(connector_info) / sizeof(connector_info[0]));
} }
bool wlr_drm_get_crtc_props(int fd, uint32_t id, union wlr_drm_crtc_props *out) { bool drm_get_crtc_props(int fd, uint32_t id, union wlr_drm_crtc_props *out) {
return scan_properties(fd, id, DRM_MODE_OBJECT_CRTC, out->props, return scan_properties(fd, id, DRM_MODE_OBJECT_CRTC, out->props,
crtc_info, sizeof(crtc_info) / sizeof(crtc_info[0])); crtc_info, sizeof(crtc_info) / sizeof(crtc_info[0]));
} }
bool wlr_drm_get_plane_props(int fd, uint32_t id, union wlr_drm_plane_props *out) { bool drm_get_plane_props(int fd, uint32_t id, union wlr_drm_plane_props *out) {
return scan_properties(fd, id, DRM_MODE_OBJECT_PLANE, out->props, return scan_properties(fd, id, DRM_MODE_OBJECT_PLANE, out->props,
plane_info, sizeof(plane_info) / sizeof(plane_info[0])); plane_info, sizeof(plane_info) / sizeof(plane_info[0]));
} }
bool wlr_drm_get_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret) { bool drm_get_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret) {
drmModeObjectProperties *props = drmModeObjectGetProperties(fd, obj, DRM_MODE_OBJECT_ANY); drmModeObjectProperties *props = drmModeObjectGetProperties(fd, obj, DRM_MODE_OBJECT_ANY);
if (!props) { if (!props) {
return false; return false;
@ -122,9 +122,9 @@ bool wlr_drm_get_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret) {
return found; return found;
} }
void *wlr_drm_get_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len) { void *drm_get_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len) {
uint64_t blob_id; uint64_t blob_id;
if (!wlr_drm_get_prop(fd, obj, prop, &blob_id)) { if (!drm_get_prop(fd, obj, prop, &blob_id)) {
return NULL; return NULL;
} }

View File

@ -18,7 +18,7 @@
#define DRM_FORMAT_MOD_LINEAR 0 #define DRM_FORMAT_MOD_LINEAR 0
#endif #endif
bool wlr_drm_renderer_init(struct wlr_drm_backend *drm, bool drm_renderer_init(struct wlr_drm_backend *drm,
struct wlr_drm_renderer *renderer) { struct wlr_drm_renderer *renderer) {
renderer->gbm = gbm_create_device(drm->fd); renderer->gbm = gbm_create_device(drm->fd);
if (!renderer->gbm) { if (!renderer->gbm) {
@ -47,7 +47,7 @@ error_gbm:
return false; return false;
} }
void wlr_drm_renderer_finish(struct wlr_drm_renderer *renderer) { void drm_renderer_finish(struct wlr_drm_renderer *renderer) {
if (!renderer) { if (!renderer) {
return; return;
} }
@ -57,7 +57,7 @@ void wlr_drm_renderer_finish(struct wlr_drm_renderer *renderer) {
gbm_device_destroy(renderer->gbm); gbm_device_destroy(renderer->gbm);
} }
bool wlr_drm_surface_init(struct wlr_drm_surface *surf, bool drm_surface_init(struct wlr_drm_surface *surf,
struct wlr_drm_renderer *renderer, uint32_t width, uint32_t height, struct wlr_drm_renderer *renderer, uint32_t width, uint32_t height,
uint32_t format, uint32_t flags) { uint32_t format, uint32_t flags) {
if (surf->width == width && surf->height == height) { if (surf->width == width && surf->height == height) {
@ -103,7 +103,7 @@ error_zero:
return false; return false;
} }
void wlr_drm_surface_finish(struct wlr_drm_surface *surf) { void drm_surface_finish(struct wlr_drm_surface *surf) {
if (!surf || !surf->renderer) { if (!surf || !surf->renderer) {
return; return;
} }
@ -123,12 +123,12 @@ void wlr_drm_surface_finish(struct wlr_drm_surface *surf) {
memset(surf, 0, sizeof(*surf)); memset(surf, 0, sizeof(*surf));
} }
bool wlr_drm_surface_make_current(struct wlr_drm_surface *surf, bool drm_surface_make_current(struct wlr_drm_surface *surf,
int *buffer_damage) { int *buffer_damage) {
return wlr_egl_make_current(&surf->renderer->egl, surf->egl, buffer_damage); return wlr_egl_make_current(&surf->renderer->egl, surf->egl, buffer_damage);
} }
struct gbm_bo *wlr_drm_surface_swap_buffers(struct wlr_drm_surface *surf, struct gbm_bo *drm_surface_swap_buffers(struct wlr_drm_surface *surf,
pixman_region32_t *damage) { pixman_region32_t *damage) {
if (surf->front) { if (surf->front) {
gbm_surface_release_buffer(surf->gbm, surf->front); gbm_surface_release_buffer(surf->gbm, surf->front);
@ -141,20 +141,20 @@ struct gbm_bo *wlr_drm_surface_swap_buffers(struct wlr_drm_surface *surf,
return surf->back; return surf->back;
} }
struct gbm_bo *wlr_drm_surface_get_front(struct wlr_drm_surface *surf) { struct gbm_bo *drm_surface_get_front(struct wlr_drm_surface *surf) {
if (surf->front) { if (surf->front) {
return surf->front; return surf->front;
} }
wlr_drm_surface_make_current(surf, NULL); drm_surface_make_current(surf, NULL);
struct wlr_renderer *renderer = surf->renderer->wlr_rend; struct wlr_renderer *renderer = surf->renderer->wlr_rend;
wlr_renderer_begin(renderer, surf->width, surf->height); wlr_renderer_begin(renderer, surf->width, surf->height);
wlr_renderer_clear(renderer, (float[]){ 0.0, 0.0, 0.0, 1.0 }); wlr_renderer_clear(renderer, (float[]){ 0.0, 0.0, 0.0, 1.0 });
wlr_renderer_end(renderer); wlr_renderer_end(renderer);
return wlr_drm_surface_swap_buffers(surf, NULL); return drm_surface_swap_buffers(surf, NULL);
} }
void wlr_drm_surface_post(struct wlr_drm_surface *surf) { void drm_surface_post(struct wlr_drm_surface *surf) {
if (surf->front) { if (surf->front) {
gbm_surface_release_buffer(surf->gbm, surf->front); gbm_surface_release_buffer(surf->gbm, surf->front);
surf->front = NULL; surf->front = NULL;
@ -208,9 +208,9 @@ static struct wlr_texture *get_tex_for_bo(struct wlr_drm_renderer *renderer,
return tex->tex; return tex->tex;
} }
struct gbm_bo *wlr_drm_surface_mgpu_copy(struct wlr_drm_surface *dest, struct gbm_bo *drm_surface_mgpu_copy(struct wlr_drm_surface *dest,
struct gbm_bo *src) { struct gbm_bo *src) {
wlr_drm_surface_make_current(dest, NULL); drm_surface_make_current(dest, NULL);
struct wlr_texture *tex = get_tex_for_bo(dest->renderer, src); struct wlr_texture *tex = get_tex_for_bo(dest->renderer, src);
assert(tex); assert(tex);
@ -224,25 +224,25 @@ struct gbm_bo *wlr_drm_surface_mgpu_copy(struct wlr_drm_surface *dest,
wlr_render_texture_with_matrix(renderer, tex, mat, 1.0f); wlr_render_texture_with_matrix(renderer, tex, mat, 1.0f);
wlr_renderer_end(renderer); wlr_renderer_end(renderer);
return wlr_drm_surface_swap_buffers(dest, NULL); return drm_surface_swap_buffers(dest, NULL);
} }
bool wlr_drm_plane_surfaces_init(struct wlr_drm_plane *plane, bool drm_plane_surfaces_init(struct wlr_drm_plane *plane,
struct wlr_drm_backend *drm, int32_t width, uint32_t height, struct wlr_drm_backend *drm, int32_t width, uint32_t height,
uint32_t format) { uint32_t format) {
if (!drm->parent) { if (!drm->parent) {
return wlr_drm_surface_init(&plane->surf, &drm->renderer, width, height, return drm_surface_init(&plane->surf, &drm->renderer, width, height,
format, GBM_BO_USE_SCANOUT); format, GBM_BO_USE_SCANOUT);
} }
if (!wlr_drm_surface_init(&plane->surf, &drm->parent->renderer, if (!drm_surface_init(&plane->surf, &drm->parent->renderer,
width, height, format, GBM_BO_USE_LINEAR)) { width, height, format, GBM_BO_USE_LINEAR)) {
return false; return false;
} }
if (!wlr_drm_surface_init(&plane->mgpu_surf, &drm->renderer, if (!drm_surface_init(&plane->mgpu_surf, &drm->renderer,
width, height, format, GBM_BO_USE_SCANOUT)) { width, height, format, GBM_BO_USE_SCANOUT)) {
wlr_drm_surface_finish(&plane->surf); drm_surface_finish(&plane->surf);
return false; return false;
} }

View File

@ -32,7 +32,7 @@ static int wlr_libinput_readable(int fd, uint32_t mask, void *_backend) {
} }
struct libinput_event *event; struct libinput_event *event;
while ((event = libinput_get_event(backend->libinput_context))) { while ((event = libinput_get_event(backend->libinput_context))) {
wlr_libinput_event(backend, event); libinput_handle_event(backend, event);
libinput_event_destroy(event); libinput_event_destroy(event);
} }
return 0; return 0;

View File

@ -86,7 +86,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
if (!wlr_dev) { if (!wlr_dev) {
goto fail; goto fail;
} }
wlr_dev->keyboard = wlr_libinput_keyboard_create(libinput_dev); wlr_dev->keyboard = libinput_keyboard_create(libinput_dev);
if (!wlr_dev->keyboard) { if (!wlr_dev->keyboard) {
free(wlr_dev); free(wlr_dev);
goto fail; goto fail;
@ -99,7 +99,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
if (!wlr_dev) { if (!wlr_dev) {
goto fail; goto fail;
} }
wlr_dev->pointer = wlr_libinput_pointer_create(libinput_dev); wlr_dev->pointer = libinput_pointer_create(libinput_dev);
if (!wlr_dev->pointer) { if (!wlr_dev->pointer) {
free(wlr_dev); free(wlr_dev);
goto fail; goto fail;
@ -112,7 +112,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
if (!wlr_dev) { if (!wlr_dev) {
goto fail; goto fail;
} }
wlr_dev->touch = wlr_libinput_touch_create(libinput_dev); wlr_dev->touch = libinput_touch_create(libinput_dev);
if (!wlr_dev->touch) { if (!wlr_dev->touch) {
free(wlr_dev); free(wlr_dev);
goto fail; goto fail;
@ -125,7 +125,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
if (!wlr_dev) { if (!wlr_dev) {
goto fail; goto fail;
} }
wlr_dev->tablet_tool = wlr_libinput_tablet_tool_create(libinput_dev); wlr_dev->tablet_tool = libinput_tablet_tool_create(libinput_dev);
if (!wlr_dev->tablet_tool) { if (!wlr_dev->tablet_tool) {
free(wlr_dev); free(wlr_dev);
goto fail; goto fail;
@ -138,7 +138,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
if (!wlr_dev) { if (!wlr_dev) {
goto fail; goto fail;
} }
wlr_dev->tablet_pad = wlr_libinput_tablet_pad_create(libinput_dev); wlr_dev->tablet_pad = libinput_tablet_pad_create(libinput_dev);
if (!wlr_dev->tablet_pad) { if (!wlr_dev->tablet_pad) {
free(wlr_dev); free(wlr_dev);
goto fail; goto fail;
@ -192,7 +192,7 @@ static void handle_device_removed(struct wlr_libinput_backend *backend,
free(wlr_devices); free(wlr_devices);
} }
void wlr_libinput_event(struct wlr_libinput_backend *backend, void libinput_handle_event(struct wlr_libinput_backend *backend,
struct libinput_event *event) { struct libinput_event *event) {
assert(backend && event); assert(backend && event);
struct libinput_device *libinput_dev = libinput_event_get_device(event); struct libinput_device *libinput_dev = libinput_event_get_device(event);

View File

@ -28,7 +28,7 @@ struct wlr_keyboard_impl impl = {
.led_update = wlr_libinput_keyboard_set_leds .led_update = wlr_libinput_keyboard_set_leds
}; };
struct wlr_keyboard *wlr_libinput_keyboard_create( struct wlr_keyboard *libinput_keyboard_create(
struct libinput_device *libinput_dev) { struct libinput_device *libinput_dev) {
assert(libinput_dev); assert(libinput_dev);
struct wlr_libinput_keyboard *wlr_libinput_kb; struct wlr_libinput_keyboard *wlr_libinput_kb;

View File

@ -8,7 +8,7 @@
#include "backend/libinput.h" #include "backend/libinput.h"
#include "util/signal.h" #include "util/signal.h"
struct wlr_pointer *wlr_libinput_pointer_create( struct wlr_pointer *libinput_pointer_create(
struct libinput_device *libinput_dev) { struct libinput_device *libinput_dev) {
assert(libinput_dev); assert(libinput_dev);
struct wlr_pointer *wlr_pointer = calloc(1, sizeof(struct wlr_pointer)); struct wlr_pointer *wlr_pointer = calloc(1, sizeof(struct wlr_pointer));

View File

@ -8,7 +8,7 @@
#include "backend/libinput.h" #include "backend/libinput.h"
#include "util/signal.h" #include "util/signal.h"
struct wlr_tablet_pad *wlr_libinput_tablet_pad_create( struct wlr_tablet_pad *libinput_tablet_pad_create(
struct libinput_device *libinput_dev) { struct libinput_device *libinput_dev) {
assert(libinput_dev); assert(libinput_dev);
struct wlr_tablet_pad *wlr_tablet_pad = calloc(1, sizeof(struct wlr_tablet_pad)); struct wlr_tablet_pad *wlr_tablet_pad = calloc(1, sizeof(struct wlr_tablet_pad));

View File

@ -8,7 +8,7 @@
#include "backend/libinput.h" #include "backend/libinput.h"
#include "util/signal.h" #include "util/signal.h"
struct wlr_tablet_tool *wlr_libinput_tablet_tool_create( struct wlr_tablet_tool *libinput_tablet_tool_create(
struct libinput_device *libinput_dev) { struct libinput_device *libinput_dev) {
assert(libinput_dev); assert(libinput_dev);
struct wlr_tablet_tool *wlr_tablet_tool = calloc(1, sizeof(struct wlr_tablet_tool)); struct wlr_tablet_tool *wlr_tablet_tool = calloc(1, sizeof(struct wlr_tablet_tool));

View File

@ -8,7 +8,7 @@
#include "backend/libinput.h" #include "backend/libinput.h"
#include "util/signal.h" #include "util/signal.h"
struct wlr_touch *wlr_libinput_touch_create( struct wlr_touch *libinput_touch_create(
struct libinput_device *libinput_dev) { struct libinput_device *libinput_dev) {
assert(libinput_dev); assert(libinput_dev);
struct wlr_touch *wlr_touch = calloc(1, sizeof(struct wlr_touch)); struct wlr_touch *wlr_touch = calloc(1, sizeof(struct wlr_touch));

View File

@ -1,10 +1,10 @@
#include <assert.h> #include <assert.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <wlr/backend/drm.h>
#include <wlr/backend/interface.h> #include <wlr/backend/interface.h>
#include <wlr/backend/session.h> #include <wlr/backend/session.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "backend/drm/drm.h"
#include "backend/multi.h" #include "backend/multi.h"
#include "util/signal.h" #include "util/signal.h"

View File

@ -43,7 +43,7 @@ static bool wlr_wl_backend_start(struct wlr_backend *_backend) {
struct wlr_wl_backend *backend = (struct wlr_wl_backend *)_backend; struct wlr_wl_backend *backend = (struct wlr_wl_backend *)_backend;
wlr_log(L_INFO, "Initializating wayland backend"); wlr_log(L_INFO, "Initializating wayland backend");
wlr_wl_registry_poll(backend); wl_registry_poll(backend);
if (!backend->compositor || !backend->shell) { if (!backend->compositor || !backend->shell) {
wlr_log_errno(L_ERROR, "Could not obtain retrieve required globals"); wlr_log_errno(L_ERROR, "Could not obtain retrieve required globals");
return false; return false;
@ -126,7 +126,7 @@ bool wlr_backend_is_wl(struct wlr_backend *b) {
return b->impl == &backend_impl; return b->impl == &backend_impl;
} }
struct wlr_wl_backend_output *wlr_wl_output_for_surface( struct wlr_wl_backend_output *wl_output_for_surface(
struct wlr_wl_backend *backend, struct wl_surface *surface) { struct wlr_wl_backend *backend, struct wl_surface *surface) {
struct wlr_wl_backend_output *output; struct wlr_wl_backend_output *output;
wl_list_for_each(output, &backend->outputs, link) { wl_list_for_each(output, &backend->outputs, link) {
@ -137,7 +137,7 @@ struct wlr_wl_backend_output *wlr_wl_output_for_surface(
return NULL; return NULL;
} }
void wlr_wl_output_layout_get_box(struct wlr_wl_backend *backend, void wl_output_layout_get_box(struct wlr_wl_backend *backend,
struct wlr_box *box) { struct wlr_box *box) {
int min_x = INT_MAX, min_y = INT_MAX; int min_x = INT_MAX, min_y = INT_MAX;
int max_x = INT_MIN, max_y = INT_MIN; int max_x = INT_MIN, max_y = INT_MIN;

View File

@ -84,7 +84,7 @@ static bool wlr_wl_output_set_cursor(struct wlr_output *_output,
if (!update_pixels) { if (!update_pixels) {
// Update hotspot without changing cursor image // Update hotspot without changing cursor image
wlr_wl_output_update_cursor(output); wl_output_update_cursor(output);
return true; return true;
} }
if (!buf) { if (!buf) {
@ -95,7 +95,7 @@ static bool wlr_wl_output_set_cursor(struct wlr_output *_output,
output->cursor.surface = NULL; output->cursor.surface = NULL;
output->cursor.buf_size = 0; output->cursor.buf_size = 0;
} }
wlr_wl_output_update_cursor(output); wl_output_update_cursor(output);
return true; return true;
} }
@ -153,7 +153,7 @@ static bool wlr_wl_output_set_cursor(struct wlr_output *_output,
wl_surface_damage(output->cursor.surface, 0, 0, width, height); wl_surface_damage(output->cursor.surface, 0, 0, width, height);
wl_surface_commit(output->cursor.surface); wl_surface_commit(output->cursor.surface);
wlr_wl_output_update_cursor(output); wl_output_update_cursor(output);
return true; return true;
} }
@ -192,7 +192,7 @@ static void wlr_wl_output_destroy(struct wlr_output *wlr_output) {
free(output); free(output);
} }
void wlr_wl_output_update_cursor(struct wlr_wl_backend_output *output) { void wl_output_update_cursor(struct wlr_wl_backend_output *output) {
if (output->backend->pointer && output->enter_serial) { if (output->backend->pointer && output->enter_serial) {
wl_pointer_set_cursor(output->backend->pointer, output->enter_serial, wl_pointer_set_cursor(output->backend->pointer, output->enter_serial,
output->cursor.surface, output->cursor.hotspot_x, output->cursor.surface, output->cursor.hotspot_x,
@ -200,7 +200,7 @@ void wlr_wl_output_update_cursor(struct wlr_wl_backend_output *output) {
} }
} }
bool wlr_wl_output_move_cursor(struct wlr_output *_output, int x, int y) { bool wl_output_move_cursor(struct wlr_output *_output, int x, int y) {
// TODO: only return true if x == current x and y == current y // TODO: only return true if x == current x and y == current y
return true; return true;
} }
@ -212,7 +212,7 @@ static struct wlr_output_impl output_impl = {
.make_current = wlr_wl_output_make_current, .make_current = wlr_wl_output_make_current,
.swap_buffers = wlr_wl_output_swap_buffers, .swap_buffers = wlr_wl_output_swap_buffers,
.set_cursor = wlr_wl_output_set_cursor, .set_cursor = wlr_wl_output_set_cursor,
.move_cursor = wlr_wl_output_move_cursor, .move_cursor = wl_output_move_cursor,
}; };
bool wlr_output_is_wl(struct wlr_output *wlr_output) { bool wlr_output_is_wl(struct wlr_output *wlr_output) {

View File

@ -48,7 +48,7 @@ static const struct wl_registry_listener registry_listener = {
.global_remove = registry_global_remove .global_remove = registry_global_remove
}; };
void wlr_wl_registry_poll(struct wlr_wl_backend *backend) { void wl_registry_poll(struct wlr_wl_backend *backend) {
wl_registry_add_listener(backend->registry, &registry_listener, backend); wl_registry_add_listener(backend->registry, &registry_listener, backend);
wl_display_dispatch(backend->remote_display); wl_display_dispatch(backend->remote_display);
wl_display_roundtrip(backend->remote_display); wl_display_roundtrip(backend->remote_display);

View File

@ -21,7 +21,7 @@ static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer,
assert(dev && dev->pointer); assert(dev && dev->pointer);
struct wlr_wl_pointer *wlr_wl_pointer = (struct wlr_wl_pointer *)dev->pointer; struct wlr_wl_pointer *wlr_wl_pointer = (struct wlr_wl_pointer *)dev->pointer;
struct wlr_wl_backend_output *output = struct wlr_wl_backend_output *output =
wlr_wl_output_for_surface(wlr_wl_dev->backend, surface); wl_output_for_surface(wlr_wl_dev->backend, surface);
if (!output) { if (!output) {
// GNOME sends a pointer enter when the surface is being destroyed // GNOME sends a pointer enter when the surface is being destroyed
return; return;
@ -33,7 +33,7 @@ static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer,
&wlr_wl_pointer->output_destroy_listener); &wlr_wl_pointer->output_destroy_listener);
wlr_wl_pointer->current_output = output; wlr_wl_pointer->current_output = output;
output->enter_serial = serial; output->enter_serial = serial;
wlr_wl_output_update_cursor(output); wl_output_update_cursor(output);
} }
static void pointer_handle_leave(void *data, struct wl_pointer *wl_pointer, static void pointer_handle_leave(void *data, struct wl_pointer *wl_pointer,
@ -70,7 +70,7 @@ static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer,
box.y /= wlr_output->scale; box.y /= wlr_output->scale;
struct wlr_box layout_box; struct wlr_box layout_box;
wlr_wl_output_layout_get_box(wlr_wl_pointer->current_output->backend, wl_output_layout_get_box(wlr_wl_pointer->current_output->backend,
&layout_box); &layout_box);
double ox = wlr_output->lx / (double)layout_box.width; double ox = wlr_output->lx / (double)layout_box.width;

View File

@ -136,17 +136,12 @@ struct wlr_drm_connector {
struct wl_list link; struct wl_list link;
}; };
bool wlr_drm_check_features(struct wlr_drm_backend *drm); bool drm_check_features(struct wlr_drm_backend *drm);
bool wlr_drm_resources_init(struct wlr_drm_backend *drm); bool drm_resources_init(struct wlr_drm_backend *drm);
void wlr_drm_resources_free(struct wlr_drm_backend *drm); void drm_resources_finish(struct wlr_drm_backend *drm);
void wlr_drm_restore_outputs(struct wlr_drm_backend *drm); void drm_restore_outputs(struct wlr_drm_backend *drm);
void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn); void drm_scan_connectors(struct wlr_drm_backend *state);
void wlr_drm_scan_connectors(struct wlr_drm_backend *state); int drm_event(int fd, uint32_t mask, void *data);
int wlr_drm_event(int fd, uint32_t mask, void *data); void drm_connector_enable(struct wlr_output *output, bool enable);
void wlr_drm_connector_enable(struct wlr_output *output, bool enable);
void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn);
struct wlr_session *wlr_drm_backend_get_session(struct wlr_backend *backend);
#endif #endif

View File

@ -59,11 +59,12 @@ union wlr_drm_plane_props {
uint32_t props[12]; uint32_t props[12];
}; };
bool wlr_drm_get_connector_props(int fd, uint32_t id, union wlr_drm_connector_props *out); bool drm_get_connector_props(int fd, uint32_t id,
bool wlr_drm_get_crtc_props(int fd, uint32_t id, union wlr_drm_crtc_props *out); union wlr_drm_connector_props *out);
bool wlr_drm_get_plane_props(int fd, uint32_t id, union wlr_drm_plane_props *out); bool drm_get_crtc_props(int fd, uint32_t id, union wlr_drm_crtc_props *out);
bool drm_get_plane_props(int fd, uint32_t id, union wlr_drm_plane_props *out);
bool wlr_drm_get_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret); bool drm_get_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret);
void *wlr_drm_get_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len); void *drm_get_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len);
#endif #endif

View File

@ -31,25 +31,25 @@ struct wlr_drm_surface {
struct gbm_bo *back; struct gbm_bo *back;
}; };
bool wlr_drm_renderer_init(struct wlr_drm_backend *drm, bool drm_renderer_init(struct wlr_drm_backend *drm,
struct wlr_drm_renderer *renderer); struct wlr_drm_renderer *renderer);
void wlr_drm_renderer_finish(struct wlr_drm_renderer *renderer); void drm_renderer_finish(struct wlr_drm_renderer *renderer);
bool wlr_drm_surface_init(struct wlr_drm_surface *surf, bool drm_surface_init(struct wlr_drm_surface *surf,
struct wlr_drm_renderer *renderer, uint32_t width, uint32_t height, struct wlr_drm_renderer *renderer, uint32_t width, uint32_t height,
uint32_t format, uint32_t flags); uint32_t format, uint32_t flags);
bool wlr_drm_plane_surfaces_init(struct wlr_drm_plane *plane, bool drm_plane_surfaces_init(struct wlr_drm_plane *plane,
struct wlr_drm_backend *drm, int32_t width, uint32_t height, struct wlr_drm_backend *drm, int32_t width, uint32_t height,
uint32_t format); uint32_t format);
void wlr_drm_surface_finish(struct wlr_drm_surface *surf); void drm_surface_finish(struct wlr_drm_surface *surf);
bool wlr_drm_surface_make_current(struct wlr_drm_surface *surf, int *buffer_age); bool drm_surface_make_current(struct wlr_drm_surface *surf, int *buffer_age);
struct gbm_bo *wlr_drm_surface_swap_buffers(struct wlr_drm_surface *surf, struct gbm_bo *drm_surface_swap_buffers(struct wlr_drm_surface *surf,
pixman_region32_t *damage); pixman_region32_t *damage);
struct gbm_bo *wlr_drm_surface_get_front(struct wlr_drm_surface *surf); struct gbm_bo *drm_surface_get_front(struct wlr_drm_surface *surf);
void wlr_drm_surface_post(struct wlr_drm_surface *surf); void drm_surface_post(struct wlr_drm_surface *surf);
struct gbm_bo *wlr_drm_surface_mgpu_copy(struct wlr_drm_surface *dest, struct gbm_bo *drm_surface_mgpu_copy(struct wlr_drm_surface *dest,
struct gbm_bo *src); struct gbm_bo *src);
#endif #endif

View File

@ -31,19 +31,19 @@ struct wlr_libinput_input_device {
uint32_t usec_to_msec(uint64_t usec); uint32_t usec_to_msec(uint64_t usec);
void wlr_libinput_event(struct wlr_libinput_backend *state, void libinput_handle_event(struct wlr_libinput_backend *state,
struct libinput_event *event); struct libinput_event *event);
struct wlr_input_device *get_appropriate_device( struct wlr_input_device *get_appropriate_device(
enum wlr_input_device_type desired_type, enum wlr_input_device_type desired_type,
struct libinput_device *device); struct libinput_device *device);
struct wlr_keyboard *wlr_libinput_keyboard_create( struct wlr_keyboard *libinput_keyboard_create(
struct libinput_device *device); struct libinput_device *device);
void handle_keyboard_key(struct libinput_event *event, void handle_keyboard_key(struct libinput_event *event,
struct libinput_device *device); struct libinput_device *device);
struct wlr_pointer *wlr_libinput_pointer_create( struct wlr_pointer *libinput_pointer_create(
struct libinput_device *device); struct libinput_device *device);
void handle_pointer_motion(struct libinput_event *event, void handle_pointer_motion(struct libinput_event *event,
struct libinput_device *device); struct libinput_device *device);
@ -54,7 +54,7 @@ void handle_pointer_button(struct libinput_event *event,
void handle_pointer_axis(struct libinput_event *event, void handle_pointer_axis(struct libinput_event *event,
struct libinput_device *device); struct libinput_device *device);
struct wlr_touch *wlr_libinput_touch_create( struct wlr_touch *libinput_touch_create(
struct libinput_device *device); struct libinput_device *device);
void handle_touch_down(struct libinput_event *event, void handle_touch_down(struct libinput_event *event,
struct libinput_device *device); struct libinput_device *device);
@ -65,7 +65,7 @@ void handle_touch_motion(struct libinput_event *event,
void handle_touch_cancel(struct libinput_event *event, void handle_touch_cancel(struct libinput_event *event,
struct libinput_device *device); struct libinput_device *device);
struct wlr_tablet_tool *wlr_libinput_tablet_tool_create( struct wlr_tablet_tool *libinput_tablet_tool_create(
struct libinput_device *device); struct libinput_device *device);
void handle_tablet_tool_axis(struct libinput_event *event, void handle_tablet_tool_axis(struct libinput_event *event,
struct libinput_device *device); struct libinput_device *device);
@ -76,7 +76,7 @@ void handle_tablet_tool_tip(struct libinput_event *event,
void handle_tablet_tool_button(struct libinput_event *event, void handle_tablet_tool_button(struct libinput_event *event,
struct libinput_device *device); struct libinput_device *device);
struct wlr_tablet_pad *wlr_libinput_tablet_pad_create( struct wlr_tablet_pad *libinput_tablet_pad_create(
struct libinput_device *device); struct libinput_device *device);
void handle_tablet_pad_button(struct libinput_event *event, void handle_tablet_pad_button(struct libinput_event *event,
struct libinput_device *device); struct libinput_device *device);

View File

@ -74,11 +74,11 @@ struct wlr_wl_pointer {
struct wl_listener output_destroy_listener; struct wl_listener output_destroy_listener;
}; };
void wlr_wl_registry_poll(struct wlr_wl_backend *backend); void wl_registry_poll(struct wlr_wl_backend *backend);
void wlr_wl_output_update_cursor(struct wlr_wl_backend_output *output); void wl_output_update_cursor(struct wlr_wl_backend_output *output);
struct wlr_wl_backend_output *wlr_wl_output_for_surface( struct wlr_wl_backend_output *wl_output_for_surface(
struct wlr_wl_backend *backend, struct wl_surface *surface); struct wlr_wl_backend *backend, struct wl_surface *surface);
void wlr_wl_output_layout_get_box(struct wlr_wl_backend *backend, void wl_output_layout_get_box(struct wlr_wl_backend *backend,
struct wlr_box *box); struct wlr_box *box);
extern const struct wl_seat_listener seat_listener; extern const struct wl_seat_listener seat_listener;

View File

@ -19,4 +19,6 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
bool wlr_backend_is_drm(struct wlr_backend *backend); bool wlr_backend_is_drm(struct wlr_backend *backend);
bool wlr_output_is_drm(struct wlr_output *output); bool wlr_output_is_drm(struct wlr_output *output);
struct wlr_session *wlr_drm_backend_get_session(struct wlr_backend *backend);
#endif #endif

View File

@ -603,7 +603,7 @@ static void wlr_surface_state_destroy(struct wlr_surface_state *state) {
free(state); free(state);
} }
void wlr_subsurface_destroy(struct wlr_subsurface *subsurface) { static void subsurface_destroy(struct wlr_subsurface *subsurface) {
wlr_signal_emit_safe(&subsurface->events.destroy, subsurface); wlr_signal_emit_safe(&subsurface->events.destroy, subsurface);
wl_list_remove(&subsurface->surface_destroy.link); wl_list_remove(&subsurface->surface_destroy.link);
@ -696,11 +696,11 @@ static void subsurface_resource_destroy(struct wl_resource *resource) {
struct wlr_subsurface *subsurface = subsurface_from_resource(resource); struct wlr_subsurface *subsurface = subsurface_from_resource(resource);
if (subsurface) { if (subsurface) {
wlr_subsurface_destroy(subsurface); subsurface_destroy(subsurface);
} }
} }
static void subsurface_destroy(struct wl_client *client, static void subsurface_handle_destroy(struct wl_client *client,
struct wl_resource *resource) { struct wl_resource *resource) {
wl_resource_destroy(resource); wl_resource_destroy(resource);
} }
@ -802,7 +802,7 @@ static void subsurface_set_desync(struct wl_client *client,
} }
static const struct wl_subsurface_interface subsurface_implementation = { static const struct wl_subsurface_interface subsurface_implementation = {
.destroy = subsurface_destroy, .destroy = subsurface_handle_destroy,
.set_position = subsurface_set_position, .set_position = subsurface_set_position,
.place_above = subsurface_place_above, .place_above = subsurface_place_above,
.place_below = subsurface_place_below, .place_below = subsurface_place_below,
@ -824,7 +824,7 @@ static void subsurface_handle_surface_destroy(struct wl_listener *listener,
void *data) { void *data) {
struct wlr_subsurface *subsurface = struct wlr_subsurface *subsurface =
wl_container_of(listener, subsurface, surface_destroy); wl_container_of(listener, subsurface, surface_destroy);
wlr_subsurface_destroy(subsurface); subsurface_destroy(subsurface);
} }
void wlr_surface_make_subsurface(struct wlr_surface *surface, void wlr_surface_make_subsurface(struct wlr_surface *surface,

View File

@ -18,7 +18,8 @@ static const char *verbosity_colors[] = {
[L_DEBUG ] = "\x1B[1;30m", [L_DEBUG ] = "\x1B[1;30m",
}; };
void wlr_log_stderr(log_importance_t verbosity, const char *fmt, va_list args) { static void log_stderr(log_importance_t verbosity, const char *fmt,
va_list args) {
if (verbosity > log_importance) { if (verbosity > log_importance) {
return; return;
} }
@ -46,7 +47,7 @@ void wlr_log_stderr(log_importance_t verbosity, const char *fmt, va_list args) {
fprintf(stderr, "\n"); fprintf(stderr, "\n");
} }
static log_callback_t log_callback = wlr_log_stderr; static log_callback_t log_callback = log_stderr;
void wlr_log_init(log_importance_t verbosity, log_callback_t callback) { void wlr_log_init(log_importance_t verbosity, log_callback_t callback) {
if (verbosity < L_LAST) { if (verbosity < L_LAST) {

View File

@ -4,43 +4,6 @@ WLROOTS_0_0_0 {
_wlr_log; _wlr_log;
_wlr_vlog; _wlr_vlog;
local: local:
wlr_drm_backend_get_session;
wlr_drm_check_features;
wlr_drm_connector_cleanup;
wlr_drm_connector_start_renderer;
wlr_drm_event;
wlr_drm_get_connector_props;
wlr_drm_get_crtc_props;
wlr_drm_get_plane_props;
wlr_drm_get_prop_blob;
wlr_drm_get_prop;
wlr_drm_plane_surfaces_init;
wlr_drm_renderer_finish;
wlr_drm_renderer_init;
wlr_drm_resources_free;
wlr_drm_resources_init;
wlr_drm_restore_outputs;
wlr_drm_scan_connectors;
wlr_drm_surface_finish;
wlr_drm_surface_get_front;
wlr_drm_surface_init;
wlr_drm_surface_make_current;
wlr_drm_surface_mgpu_copy;
wlr_drm_surface_post;
wlr_drm_surface_swap_buffers;
wlr_libinput_event;
wlr_libinput_keyboard_create;
wlr_libinput_pointer_create;
wlr_libinput_tablet_pad_create;
wlr_libinput_tablet_tool_create;
wlr_libinput_touch_create;
wlr_log_stderr;
wlr_signal_emit_safe; wlr_signal_emit_safe;
wlr_subsurface_destroy;
wlr_wl_output_for_surface;
wlr_wl_output_layout_get_box;
wlr_wl_output_move_cursor;
wlr_wl_output_update_cursor;
wlr_wl_registry_poll;
*; *;
}; };