diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c index fb3ab098..acc56e65 100644 --- a/backend/drm/atomic.c +++ b/backend/drm/atomic.c @@ -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); } - if (!drm_get_prop(drm->fd, crtc->id, crtc->props.gamma_lut_size, + if (!get_drm_prop(drm->fd, crtc->id, crtc->props.gamma_lut_size, &gamma_lut_size)) { wlr_log(L_ERROR, "Unable to get gamma lut size"); return 0; diff --git a/backend/drm/backend.c b/backend/drm/backend.c index 5dc8a119..80402f61 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -17,7 +17,7 @@ static bool wlr_drm_backend_start(struct wlr_backend *backend) { struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend; - drm_scan_connectors(drm); + scan_drm_connectors(drm); 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; - drm_restore_outputs(drm); + restore_drm_outputs(drm); struct wlr_drm_connector *conn, *next; 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->drm_invalidated.link); - drm_resources_finish(drm); - drm_renderer_finish(&drm->renderer); + finish_drm_resources(drm); + finish_drm_renderer(&drm->renderer); wlr_session_close_file(drm->session, drm->fd); wl_event_source_remove(drm->drm_event); free(drm); @@ -71,14 +71,14 @@ static void session_signal(struct wl_listener *listener, void *data) { if (session->active) { wlr_log(L_INFO, "DRM fd resumed"); - drm_scan_connectors(drm); + scan_drm_connectors(drm); struct wlr_drm_connector *conn; wl_list_for_each(conn, &drm->outputs, link){ if (conn->output.enabled) { wlr_output_set_mode(&conn->output, conn->output.current_mode); } else { - drm_connector_enable(&conn->output, false); + enable_drm_connector(&conn->output, false); } if (!conn->crtc) { @@ -104,7 +104,7 @@ static void drm_invalidated(struct wl_listener *listener, void *data) { wlr_log(L_DEBUG, "%s invalidated", name); free(name); - drm_scan_connectors(drm); + scan_drm_connectors(drm); } 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); drm->drm_event = wl_event_loop_add_fd(event_loop, drm->fd, - WL_EVENT_READABLE, drm_event, NULL); + WL_EVENT_READABLE, handle_drm_event, NULL); if (!drm->drm_event) { wlr_log(L_ERROR, "Failed to create DRM event source"); goto error_fd; @@ -153,15 +153,15 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display, drm->session_signal.notify = session_signal; wl_signal_add(&session->session_signal, &drm->session_signal); - if (!drm_check_features(drm)) { + if (!check_drm_features(drm)) { goto error_event; } - if (!drm_resources_init(drm)) { + if (!init_drm_resources(drm)) { goto error_event; } - if (!drm_renderer_init(drm, &drm->renderer)) { + if (!init_drm_renderer(drm, &drm->renderer)) { wlr_log(L_ERROR, "Failed to initialize renderer"); goto error_event; } diff --git a/backend/drm/drm.c b/backend/drm/drm.c index e059df80..dc512151 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -26,7 +26,7 @@ #include "backend/drm/util.h" #include "util/signal.h" -bool drm_check_features(struct wlr_drm_backend *drm) { +bool check_drm_features(struct wlr_drm_backend *drm) { if (drmSetClientCap(drm->fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1)) { wlr_log(L_ERROR, "DRM universal planes unsupported"); return false; @@ -87,8 +87,8 @@ static bool init_planes(struct wlr_drm_backend *drm) { p->possible_crtcs = plane->possible_crtcs; uint64_t type; - if (!drm_get_plane_props(drm->fd, p->id, &p->props) || - !drm_get_prop(drm->fd, p->id, p->props.type, &type)) { + if (!get_drm_plane_props(drm->fd, p->id, &p->props) || + !get_drm_prop(drm->fd, p->id, p->props.type, &type)) { drmModeFreePlane(plane); goto error_planes; } @@ -122,7 +122,7 @@ error_res: return false; } -bool drm_resources_init(struct wlr_drm_backend *drm) { +bool init_drm_resources(struct wlr_drm_backend *drm) { drmModeRes *res = drmModeGetResources(drm->fd); if (!res) { wlr_log_errno(L_ERROR, "Failed to get DRM resources"); @@ -142,7 +142,7 @@ bool drm_resources_init(struct wlr_drm_backend *drm) { struct wlr_drm_crtc *crtc = &drm->crtcs[i]; crtc->id = res->crtcs[i]; crtc->legacy_crtc = drmModeGetCrtc(drm->fd, crtc->id); - drm_get_crtc_props(drm->fd, crtc->id, &crtc->props); + get_drm_crtc_props(drm->fd, crtc->id, &crtc->props); } if (!init_planes(drm)) { @@ -160,7 +160,7 @@ error_res: return false; } -void drm_resources_finish(struct wlr_drm_backend *drm) { +void finish_drm_resources(struct wlr_drm_backend *drm) { if (!drm) { return; } @@ -190,7 +190,7 @@ void drm_resources_finish(struct wlr_drm_backend *drm) { static bool drm_connector_make_current(struct wlr_output *output, int *buffer_age) { struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; - return drm_surface_make_current(&conn->crtc->primary->surf, buffer_age); + return make_drm_surface_current(&conn->crtc->primary->surf, buffer_age); } static bool drm_connector_swap_buffers(struct wlr_output *output, @@ -207,9 +207,9 @@ static bool drm_connector_swap_buffers(struct wlr_output *output, } struct wlr_drm_plane *plane = crtc->primary; - struct gbm_bo *bo = drm_surface_swap_buffers(&plane->surf, damage); + struct gbm_bo *bo = swap_drm_surface_buffers(&plane->surf, damage); if (drm->parent) { - bo = drm_surface_mgpu_copy(&plane->mgpu_surf, bo); + bo = copy_drm_surface_mgpu(&plane->mgpu_surf, bo); } uint32_t fb_id = get_fb_for_bo(bo); @@ -265,7 +265,7 @@ static void drm_connector_start_renderer(struct wlr_drm_connector *conn) { } struct wlr_drm_plane *plane = crtc->primary; - struct gbm_bo *bo = drm_surface_get_front( + struct gbm_bo *bo = get_drm_surface_front( drm->parent ? &plane->mgpu_surf : &plane->surf); uint32_t fb_id = get_fb_for_bo(bo); @@ -279,7 +279,7 @@ static void drm_connector_start_renderer(struct wlr_drm_connector *conn) { } } -void drm_connector_enable(struct wlr_output *output, bool enable) { +void enable_drm_connector(struct wlr_output *output, bool enable) { struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; if (conn->state != WLR_DRM_CONN_CONNECTED) { return; @@ -340,9 +340,9 @@ static void realloc_planes(struct wlr_drm_backend *drm, const uint32_t *crtc_in, if (*old != new) { changed_outputs[crtc_res[i]] = true; if (*old) { - drm_surface_finish(&(*old)->surf); + finish_drm_surface(&(*old)->surf); } - drm_surface_finish(&new->surf); + finish_drm_surface(&new->surf); *old = new; } } @@ -515,7 +515,7 @@ static bool drm_connector_set_mode(struct wlr_output *output, continue; } - if (!drm_plane_surfaces_init(crtc->primary, drm, + if (!init_drm_plane_surfaces(crtc->primary, drm, mode->width, mode->height, GBM_FORMAT_XRGB8888)) { wlr_log(L_ERROR, "Failed to initialize renderer for plane"); goto error_conn; @@ -572,7 +572,7 @@ static bool drm_connector_set_cursor(struct wlr_output *output, return false; } - if (!drm_surface_init(&plane->surf, renderer, w, h, + if (!init_drm_surface(&plane->surf, renderer, w, h, GBM_FORMAT_ARGB8888, 0)) { wlr_log(L_ERROR, "Cannot allocate cursor resources"); return false; @@ -631,7 +631,7 @@ static bool drm_connector_set_cursor(struct wlr_output *output, return false; } - drm_surface_make_current(&plane->surf, NULL); + make_drm_surface_current(&plane->surf, NULL); struct wlr_renderer *rend = plane->surf.renderer->wlr_rend; @@ -650,7 +650,7 @@ static bool drm_connector_set_cursor(struct wlr_output *output, wlr_renderer_read_pixels(rend, WL_SHM_FORMAT_ARGB8888, bo_stride, plane->surf.width, plane->surf.height, 0, 0, 0, 0, bo_data); - drm_surface_swap_buffers(&plane->surf, NULL); + swap_drm_surface_buffers(&plane->surf, NULL); wlr_texture_destroy(texture); gbm_bo_unmap(plane->cursor_bo, bo_data); @@ -714,7 +714,7 @@ static void drm_connector_destroy(struct wlr_output *output) { } static const struct wlr_output_impl output_impl = { - .enable = drm_connector_enable, + .enable = enable_drm_connector, .set_mode = drm_connector_set_mode, .transform = drm_connector_transform, .set_cursor = drm_connector_set_cursor, @@ -746,7 +746,7 @@ static const int32_t subpixel_map[] = { [DRM_MODE_SUBPIXEL_NONE] = WL_OUTPUT_SUBPIXEL_NONE, }; -void drm_scan_connectors(struct wlr_drm_backend *drm) { +void scan_drm_connectors(struct wlr_drm_backend *drm) { wlr_log(L_INFO, "Scanning DRM connectors"); drmModeRes *res = drmModeGetResources(drm->fd); @@ -836,10 +836,10 @@ void drm_scan_connectors(struct wlr_drm_backend *drm) { wlr_conn->output.phys_width, wlr_conn->output.phys_height); wlr_conn->output.subpixel = subpixel_map[drm_conn->subpixel]; - drm_get_connector_props(drm->fd, wlr_conn->id, &wlr_conn->props); + get_drm_connector_props(drm->fd, wlr_conn->id, &wlr_conn->props); size_t edid_len = 0; - uint8_t *edid = drm_get_prop_blob(drm->fd, + uint8_t *edid = get_drm_prop_blob(drm->fd, wlr_conn->id, wlr_conn->props.edid, &edid_len); parse_edid(&wlr_conn->output, edid_len, edid); free(edid); @@ -913,9 +913,9 @@ static void page_flip_handler(int fd, unsigned seq, return; } - drm_surface_post(&conn->crtc->primary->surf); + post_drm_surface(&conn->crtc->primary->surf); if (drm->parent) { - drm_surface_post(&conn->crtc->primary->mgpu_surf); + post_drm_surface(&conn->crtc->primary->mgpu_surf); } if (drm->session->active) { @@ -923,7 +923,7 @@ static void page_flip_handler(int fd, unsigned seq, } } -int drm_event(int fd, uint32_t mask, void *data) { +int handle_drm_event(int fd, uint32_t mask, void *data) { drmEventContext event = { .version = DRM_EVENT_CONTEXT_VERSION, .page_flip_handler = page_flip_handler, @@ -933,7 +933,7 @@ int drm_event(int fd, uint32_t mask, void *data) { return 1; } -void drm_restore_outputs(struct wlr_drm_backend *drm) { +void restore_drm_outputs(struct wlr_drm_backend *drm) { uint64_t to_close = (1 << wl_list_length(&drm->outputs)) - 1; struct wlr_drm_connector *conn; @@ -946,7 +946,7 @@ void drm_restore_outputs(struct wlr_drm_backend *drm) { time_t timeout = time(NULL) + 5; while (to_close && time(NULL) < timeout) { - drm_event(drm->fd, 0, NULL); + handle_drm_event(drm->fd, 0, NULL); size_t i = 0; struct wlr_drm_connector *conn; wl_list_for_each(conn, &drm->outputs, link) { @@ -987,8 +987,8 @@ static void drm_connector_cleanup(struct wlr_drm_connector *conn) { continue; } - drm_surface_finish(&crtc->planes[i]->surf); - drm_surface_finish(&crtc->planes[i]->mgpu_surf); + finish_drm_surface(&crtc->planes[i]->surf); + finish_drm_surface(&crtc->planes[i]->mgpu_surf); if (crtc->planes[i]->id == 0) { free(crtc->planes[i]); crtc->planes[i] = NULL; diff --git a/backend/drm/properties.c b/backend/drm/properties.c index c424989a..c16d4b3a 100644 --- a/backend/drm/properties.c +++ b/backend/drm/properties.c @@ -87,22 +87,22 @@ static bool scan_properties(int fd, uint32_t id, uint32_t type, uint32_t *result return true; } -bool drm_get_connector_props(int fd, uint32_t id, union wlr_drm_connector_props *out) { +bool get_drm_connector_props(int fd, uint32_t id, union wlr_drm_connector_props *out) { return scan_properties(fd, id, DRM_MODE_OBJECT_CONNECTOR, out->props, connector_info, sizeof(connector_info) / sizeof(connector_info[0])); } -bool drm_get_crtc_props(int fd, uint32_t id, union wlr_drm_crtc_props *out) { +bool get_drm_crtc_props(int fd, uint32_t id, union wlr_drm_crtc_props *out) { return scan_properties(fd, id, DRM_MODE_OBJECT_CRTC, out->props, crtc_info, sizeof(crtc_info) / sizeof(crtc_info[0])); } -bool drm_get_plane_props(int fd, uint32_t id, union wlr_drm_plane_props *out) { +bool get_drm_plane_props(int fd, uint32_t id, union wlr_drm_plane_props *out) { return scan_properties(fd, id, DRM_MODE_OBJECT_PLANE, out->props, plane_info, sizeof(plane_info) / sizeof(plane_info[0])); } -bool drm_get_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret) { +bool get_drm_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret) { drmModeObjectProperties *props = drmModeObjectGetProperties(fd, obj, DRM_MODE_OBJECT_ANY); if (!props) { return false; @@ -122,9 +122,9 @@ bool drm_get_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret) { return found; } -void *drm_get_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len) { +void *get_drm_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len) { uint64_t blob_id; - if (!drm_get_prop(fd, obj, prop, &blob_id)) { + if (!get_drm_prop(fd, obj, prop, &blob_id)) { return NULL; } diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c index d86dc629..7e2b5174 100644 --- a/backend/drm/renderer.c +++ b/backend/drm/renderer.c @@ -18,7 +18,7 @@ #define DRM_FORMAT_MOD_LINEAR 0 #endif -bool drm_renderer_init(struct wlr_drm_backend *drm, +bool init_drm_renderer(struct wlr_drm_backend *drm, struct wlr_drm_renderer *renderer) { renderer->gbm = gbm_create_device(drm->fd); if (!renderer->gbm) { @@ -47,7 +47,7 @@ error_gbm: return false; } -void drm_renderer_finish(struct wlr_drm_renderer *renderer) { +void finish_drm_renderer(struct wlr_drm_renderer *renderer) { if (!renderer) { return; } @@ -57,7 +57,7 @@ void drm_renderer_finish(struct wlr_drm_renderer *renderer) { gbm_device_destroy(renderer->gbm); } -bool drm_surface_init(struct wlr_drm_surface *surf, +bool init_drm_surface(struct wlr_drm_surface *surf, struct wlr_drm_renderer *renderer, uint32_t width, uint32_t height, uint32_t format, uint32_t flags) { if (surf->width == width && surf->height == height) { @@ -103,7 +103,7 @@ error_zero: return false; } -void drm_surface_finish(struct wlr_drm_surface *surf) { +void finish_drm_surface(struct wlr_drm_surface *surf) { if (!surf || !surf->renderer) { return; } @@ -123,12 +123,12 @@ void drm_surface_finish(struct wlr_drm_surface *surf) { memset(surf, 0, sizeof(*surf)); } -bool drm_surface_make_current(struct wlr_drm_surface *surf, +bool make_drm_surface_current(struct wlr_drm_surface *surf, int *buffer_damage) { return wlr_egl_make_current(&surf->renderer->egl, surf->egl, buffer_damage); } -struct gbm_bo *drm_surface_swap_buffers(struct wlr_drm_surface *surf, +struct gbm_bo *swap_drm_surface_buffers(struct wlr_drm_surface *surf, pixman_region32_t *damage) { if (surf->front) { gbm_surface_release_buffer(surf->gbm, surf->front); @@ -141,20 +141,20 @@ struct gbm_bo *drm_surface_swap_buffers(struct wlr_drm_surface *surf, return surf->back; } -struct gbm_bo *drm_surface_get_front(struct wlr_drm_surface *surf) { +struct gbm_bo *get_drm_surface_front(struct wlr_drm_surface *surf) { if (surf->front) { return surf->front; } - drm_surface_make_current(surf, NULL); + make_drm_surface_current(surf, NULL); struct wlr_renderer *renderer = surf->renderer->wlr_rend; wlr_renderer_begin(renderer, surf->width, surf->height); wlr_renderer_clear(renderer, (float[]){ 0.0, 0.0, 0.0, 1.0 }); wlr_renderer_end(renderer); - return drm_surface_swap_buffers(surf, NULL); + return swap_drm_surface_buffers(surf, NULL); } -void drm_surface_post(struct wlr_drm_surface *surf) { +void post_drm_surface(struct wlr_drm_surface *surf) { if (surf->front) { gbm_surface_release_buffer(surf->gbm, surf->front); surf->front = NULL; @@ -208,9 +208,9 @@ static struct wlr_texture *get_tex_for_bo(struct wlr_drm_renderer *renderer, return tex->tex; } -struct gbm_bo *drm_surface_mgpu_copy(struct wlr_drm_surface *dest, +struct gbm_bo *copy_drm_surface_mgpu(struct wlr_drm_surface *dest, struct gbm_bo *src) { - drm_surface_make_current(dest, NULL); + make_drm_surface_current(dest, NULL); struct wlr_texture *tex = get_tex_for_bo(dest->renderer, src); assert(tex); @@ -224,25 +224,25 @@ struct gbm_bo *drm_surface_mgpu_copy(struct wlr_drm_surface *dest, wlr_render_texture_with_matrix(renderer, tex, mat, 1.0f); wlr_renderer_end(renderer); - return drm_surface_swap_buffers(dest, NULL); + return swap_drm_surface_buffers(dest, NULL); } -bool drm_plane_surfaces_init(struct wlr_drm_plane *plane, +bool init_drm_plane_surfaces(struct wlr_drm_plane *plane, struct wlr_drm_backend *drm, int32_t width, uint32_t height, uint32_t format) { if (!drm->parent) { - return drm_surface_init(&plane->surf, &drm->renderer, width, height, + return init_drm_surface(&plane->surf, &drm->renderer, width, height, format, GBM_BO_USE_SCANOUT); } - if (!drm_surface_init(&plane->surf, &drm->parent->renderer, + if (!init_drm_surface(&plane->surf, &drm->parent->renderer, width, height, format, GBM_BO_USE_LINEAR)) { return false; } - if (!drm_surface_init(&plane->mgpu_surf, &drm->renderer, + if (!init_drm_surface(&plane->mgpu_surf, &drm->renderer, width, height, format, GBM_BO_USE_SCANOUT)) { - drm_surface_finish(&plane->surf); + finish_drm_surface(&plane->surf); return false; } diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index 72da03da..625cabb8 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -32,7 +32,7 @@ static int wlr_libinput_readable(int fd, uint32_t mask, void *_backend) { } struct libinput_event *event; while ((event = libinput_get_event(backend->libinput_context))) { - libinput_handle_event(backend, event); + handle_libinput_event(backend, event); libinput_event_destroy(event); } return 0; diff --git a/backend/libinput/events.c b/backend/libinput/events.c index a136d1e6..f0accdd8 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -86,7 +86,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, if (!wlr_dev) { goto fail; } - wlr_dev->keyboard = libinput_keyboard_create(libinput_dev); + wlr_dev->keyboard = create_libinput_keyboard(libinput_dev); if (!wlr_dev->keyboard) { free(wlr_dev); goto fail; @@ -99,7 +99,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, if (!wlr_dev) { goto fail; } - wlr_dev->pointer = libinput_pointer_create(libinput_dev); + wlr_dev->pointer = create_libinput_pointer(libinput_dev); if (!wlr_dev->pointer) { free(wlr_dev); goto fail; @@ -112,7 +112,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, if (!wlr_dev) { goto fail; } - wlr_dev->touch = libinput_touch_create(libinput_dev); + wlr_dev->touch = create_libinput_touch(libinput_dev); if (!wlr_dev->touch) { free(wlr_dev); goto fail; @@ -125,7 +125,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, if (!wlr_dev) { goto fail; } - wlr_dev->tablet_tool = libinput_tablet_tool_create(libinput_dev); + wlr_dev->tablet_tool = create_libinput_tablet_tool(libinput_dev); if (!wlr_dev->tablet_tool) { free(wlr_dev); goto fail; @@ -138,7 +138,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, if (!wlr_dev) { goto fail; } - wlr_dev->tablet_pad = libinput_tablet_pad_create(libinput_dev); + wlr_dev->tablet_pad = create_libinput_tablet_pad(libinput_dev); if (!wlr_dev->tablet_pad) { free(wlr_dev); goto fail; @@ -192,7 +192,7 @@ static void handle_device_removed(struct wlr_libinput_backend *backend, free(wlr_devices); } -void libinput_handle_event(struct wlr_libinput_backend *backend, +void handle_libinput_event(struct wlr_libinput_backend *backend, struct libinput_event *event) { assert(backend && event); struct libinput_device *libinput_dev = libinput_event_get_device(event); diff --git a/backend/libinput/keyboard.c b/backend/libinput/keyboard.c index 32cedd98..ae2f0f23 100644 --- a/backend/libinput/keyboard.c +++ b/backend/libinput/keyboard.c @@ -28,7 +28,7 @@ struct wlr_keyboard_impl impl = { .led_update = wlr_libinput_keyboard_set_leds }; -struct wlr_keyboard *libinput_keyboard_create( +struct wlr_keyboard *create_libinput_keyboard( struct libinput_device *libinput_dev) { assert(libinput_dev); struct wlr_libinput_keyboard *wlr_libinput_kb; diff --git a/backend/libinput/pointer.c b/backend/libinput/pointer.c index 219de189..9a39b66b 100644 --- a/backend/libinput/pointer.c +++ b/backend/libinput/pointer.c @@ -8,7 +8,7 @@ #include "backend/libinput.h" #include "util/signal.h" -struct wlr_pointer *libinput_pointer_create( +struct wlr_pointer *create_libinput_pointer( struct libinput_device *libinput_dev) { assert(libinput_dev); struct wlr_pointer *wlr_pointer = calloc(1, sizeof(struct wlr_pointer)); diff --git a/backend/libinput/tablet_pad.c b/backend/libinput/tablet_pad.c index d98f40c0..aa8b26d9 100644 --- a/backend/libinput/tablet_pad.c +++ b/backend/libinput/tablet_pad.c @@ -8,7 +8,7 @@ #include "backend/libinput.h" #include "util/signal.h" -struct wlr_tablet_pad *libinput_tablet_pad_create( +struct wlr_tablet_pad *create_libinput_tablet_pad( struct libinput_device *libinput_dev) { assert(libinput_dev); struct wlr_tablet_pad *wlr_tablet_pad = calloc(1, sizeof(struct wlr_tablet_pad)); diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c index 50cea65a..b0bcfff5 100644 --- a/backend/libinput/tablet_tool.c +++ b/backend/libinput/tablet_tool.c @@ -8,7 +8,7 @@ #include "backend/libinput.h" #include "util/signal.h" -struct wlr_tablet_tool *libinput_tablet_tool_create( +struct wlr_tablet_tool *create_libinput_tablet_tool( struct libinput_device *libinput_dev) { assert(libinput_dev); struct wlr_tablet_tool *wlr_tablet_tool = calloc(1, sizeof(struct wlr_tablet_tool)); diff --git a/backend/libinput/touch.c b/backend/libinput/touch.c index c61ca3d3..d79b2a97 100644 --- a/backend/libinput/touch.c +++ b/backend/libinput/touch.c @@ -8,7 +8,7 @@ #include "backend/libinput.h" #include "util/signal.h" -struct wlr_touch *libinput_touch_create( +struct wlr_touch *create_libinput_touch( struct libinput_device *libinput_dev) { assert(libinput_dev); struct wlr_touch *wlr_touch = calloc(1, sizeof(struct wlr_touch)); diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index 35aaef49..8796b784 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -43,7 +43,7 @@ static bool wlr_wl_backend_start(struct wlr_backend *_backend) { struct wlr_wl_backend *backend = (struct wlr_wl_backend *)_backend; wlr_log(L_INFO, "Initializating wayland backend"); - wl_registry_poll(backend); + poll_wl_registry(backend); if (!backend->compositor || !backend->shell) { wlr_log_errno(L_ERROR, "Could not obtain retrieve required globals"); return false; @@ -126,7 +126,7 @@ bool wlr_backend_is_wl(struct wlr_backend *b) { return b->impl == &backend_impl; } -struct wlr_wl_backend_output *wl_output_for_surface( +struct wlr_wl_backend_output *get_wl_output_for_surface( struct wlr_wl_backend *backend, struct wl_surface *surface) { struct wlr_wl_backend_output *output; wl_list_for_each(output, &backend->outputs, link) { @@ -137,7 +137,7 @@ struct wlr_wl_backend_output *wl_output_for_surface( return NULL; } -void wl_output_layout_get_box(struct wlr_wl_backend *backend, +void get_wl_output_layout_box(struct wlr_wl_backend *backend, struct wlr_box *box) { int min_x = INT_MAX, min_y = INT_MAX; int max_x = INT_MIN, max_y = INT_MIN; diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 270056ab..f9e77a67 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -84,7 +84,7 @@ static bool wlr_wl_output_set_cursor(struct wlr_output *_output, if (!update_pixels) { // Update hotspot without changing cursor image - wl_output_update_cursor(output); + update_wl_output_cursor(output); return true; } if (!buf) { @@ -95,7 +95,7 @@ static bool wlr_wl_output_set_cursor(struct wlr_output *_output, output->cursor.surface = NULL; output->cursor.buf_size = 0; } - wl_output_update_cursor(output); + update_wl_output_cursor(output); 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_commit(output->cursor.surface); - wl_output_update_cursor(output); + update_wl_output_cursor(output); return true; } @@ -192,7 +192,7 @@ static void wlr_wl_output_destroy(struct wlr_output *wlr_output) { free(output); } -void wl_output_update_cursor(struct wlr_wl_backend_output *output) { +void update_wl_output_cursor(struct wlr_wl_backend_output *output) { if (output->backend->pointer && output->enter_serial) { wl_pointer_set_cursor(output->backend->pointer, output->enter_serial, output->cursor.surface, output->cursor.hotspot_x, diff --git a/backend/wayland/registry.c b/backend/wayland/registry.c index ce972161..0046df55 100644 --- a/backend/wayland/registry.c +++ b/backend/wayland/registry.c @@ -48,7 +48,7 @@ static const struct wl_registry_listener registry_listener = { .global_remove = registry_global_remove }; -void wl_registry_poll(struct wlr_wl_backend *backend) { +void poll_wl_registry(struct wlr_wl_backend *backend) { wl_registry_add_listener(backend->registry, ®istry_listener, backend); wl_display_dispatch(backend->remote_display); wl_display_roundtrip(backend->remote_display); diff --git a/backend/wayland/wl_seat.c b/backend/wayland/wl_seat.c index d951494b..e580afd3 100644 --- a/backend/wayland/wl_seat.c +++ b/backend/wayland/wl_seat.c @@ -21,7 +21,7 @@ static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer, assert(dev && dev->pointer); struct wlr_wl_pointer *wlr_wl_pointer = (struct wlr_wl_pointer *)dev->pointer; struct wlr_wl_backend_output *output = - wl_output_for_surface(wlr_wl_dev->backend, surface); + get_wl_output_for_surface(wlr_wl_dev->backend, surface); if (!output) { // GNOME sends a pointer enter when the surface is being destroyed 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->current_output = output; output->enter_serial = serial; - wl_output_update_cursor(output); + update_wl_output_cursor(output); } 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; struct wlr_box layout_box; - wl_output_layout_get_box(wlr_wl_pointer->current_output->backend, + get_wl_output_layout_box(wlr_wl_pointer->current_output->backend, &layout_box); double ox = wlr_output->lx / (double)layout_box.width; diff --git a/backend/x11/backend.c b/backend/x11/backend.c index b4b0f154..8b5fc195 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -22,7 +22,7 @@ #include "backend/x11.h" #include "util/signal.h" -struct wlr_x11_output *x11_output_from_window_id(struct wlr_x11_backend *x11, +struct wlr_x11_output *get_x11_output_from_window_id(struct wlr_x11_backend *x11, xcb_window_t window) { struct wlr_x11_output *output; wl_list_for_each(output, &x11->outputs, link) { @@ -33,7 +33,7 @@ struct wlr_x11_output *x11_output_from_window_id(struct wlr_x11_backend *x11, return NULL; } -void x11_output_layout_get_box(struct wlr_x11_backend *backend, +void get_x11_output_layout_box(struct wlr_x11_backend *backend, struct wlr_box *box) { int min_x = INT_MAX, min_y = INT_MAX; int max_x = INT_MIN, max_y = INT_MIN; @@ -67,13 +67,13 @@ void x11_output_layout_get_box(struct wlr_x11_backend *backend, static void handle_x11_event(struct wlr_x11_backend *x11, xcb_generic_event_t *event) { - x11_handle_input_event(x11, event); + handle_x11_input_event(x11, event); switch (event->response_type & XCB_EVENT_RESPONSE_TYPE_MASK) { case XCB_EXPOSE: { xcb_expose_event_t *ev = (xcb_expose_event_t *)event; struct wlr_x11_output *output = - x11_output_from_window_id(x11, ev->window); + get_x11_output_from_window_id(x11, ev->window); if (output != NULL) { wlr_output_update_needs_swap(&output->wlr_output); } @@ -83,9 +83,9 @@ static void handle_x11_event(struct wlr_x11_backend *x11, xcb_configure_notify_event_t *ev = (xcb_configure_notify_event_t *)event; struct wlr_x11_output *output = - x11_output_from_window_id(x11, ev->window); + get_x11_output_from_window_id(x11, ev->window); if (output != NULL) { - x11_output_handle_configure_notify(output, ev); + handle_x11_configure_notify(output, ev); } break; } @@ -93,7 +93,7 @@ static void handle_x11_event(struct wlr_x11_backend *x11, xcb_client_message_event_t *ev = (xcb_client_message_event_t *)event; if (ev->data.data32[0] == x11->atoms.wm_delete_window) { struct wlr_x11_output *output = - x11_output_from_window_id(x11, ev->window); + get_x11_output_from_window_id(x11, ev->window); if (output != NULL) { wlr_output_destroy(&output->wlr_output); } diff --git a/backend/x11/input_device.c b/backend/x11/input_device.c index 4433568d..5de5b4c2 100644 --- a/backend/x11/input_device.c +++ b/backend/x11/input_device.c @@ -40,7 +40,7 @@ static void x11_handle_pointer_position(struct wlr_x11_output *output, box.y /= wlr_output->scale; struct wlr_box layout_box; - x11_output_layout_get_box(x11, &layout_box); + get_x11_output_layout_box(x11, &layout_box); double ox = wlr_output->lx / (double)layout_box.width; double oy = wlr_output->ly / (double)layout_box.height; @@ -56,7 +56,7 @@ static void x11_handle_pointer_position(struct wlr_x11_output *output, x11->time = time; } -void x11_handle_input_event(struct wlr_x11_backend *x11, +void handle_x11_input_event(struct wlr_x11_backend *x11, xcb_generic_event_t *event) { switch (event->response_type & XCB_EVENT_RESPONSE_TYPE_MASK) { case XCB_KEY_PRESS: @@ -116,7 +116,7 @@ void x11_handle_input_event(struct wlr_x11_backend *x11, xcb_motion_notify_event_t *ev = (xcb_motion_notify_event_t *)event; struct wlr_x11_output *output = - x11_output_from_window_id(x11, ev->event); + get_x11_output_from_window_id(x11, ev->event); if (output != NULL) { x11_handle_pointer_position(output, ev->event_x, ev->event_y, ev->time); } @@ -138,7 +138,7 @@ void x11_handle_input_event(struct wlr_x11_backend *x11, const struct wlr_input_device_impl input_device_impl = { 0 }; -void x11_update_pointer_position(struct wlr_x11_output *output, +void update_x11_pointer_position(struct wlr_x11_output *output, xcb_timestamp_t time) { struct wlr_x11_backend *x11 = output->x11; diff --git a/backend/x11/output.c b/backend/x11/output.c index 77b4fb07..1f61c5e9 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -164,13 +164,13 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) { return wlr_output; } -void x11_output_handle_configure_notify(struct wlr_x11_output *output, +void handle_x11_configure_notify(struct wlr_x11_output *output, xcb_configure_notify_event_t *ev) { wlr_output_update_custom_mode(&output->wlr_output, ev->width, ev->height, output->wlr_output.refresh); // Move the pointer to its new location - x11_update_pointer_position(output, output->x11->time); + update_x11_pointer_position(output, output->x11->time); } bool wlr_output_is_x11(struct wlr_output *wlr_output) { diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h index 22bd1933..5d6ff231 100644 --- a/include/backend/drm/drm.h +++ b/include/backend/drm/drm.h @@ -136,12 +136,12 @@ struct wlr_drm_connector { struct wl_list link; }; -bool drm_check_features(struct wlr_drm_backend *drm); -bool drm_resources_init(struct wlr_drm_backend *drm); -void drm_resources_finish(struct wlr_drm_backend *drm); -void drm_restore_outputs(struct wlr_drm_backend *drm); -void drm_scan_connectors(struct wlr_drm_backend *state); -int drm_event(int fd, uint32_t mask, void *data); -void drm_connector_enable(struct wlr_output *output, bool enable); +bool check_drm_features(struct wlr_drm_backend *drm); +bool init_drm_resources(struct wlr_drm_backend *drm); +void finish_drm_resources(struct wlr_drm_backend *drm); +void restore_drm_outputs(struct wlr_drm_backend *drm); +void scan_drm_connectors(struct wlr_drm_backend *state); +int handle_drm_event(int fd, uint32_t mask, void *data); +void enable_drm_connector(struct wlr_output *output, bool enable); #endif diff --git a/include/backend/drm/properties.h b/include/backend/drm/properties.h index 85a61903..1b3b2241 100644 --- a/include/backend/drm/properties.h +++ b/include/backend/drm/properties.h @@ -59,12 +59,12 @@ union wlr_drm_plane_props { uint32_t props[12]; }; -bool drm_get_connector_props(int fd, uint32_t id, +bool get_drm_connector_props(int fd, uint32_t id, union wlr_drm_connector_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 get_drm_crtc_props(int fd, uint32_t id, union wlr_drm_crtc_props *out); +bool get_drm_plane_props(int fd, uint32_t id, union wlr_drm_plane_props *out); -bool drm_get_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret); -void *drm_get_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len); +bool get_drm_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret); +void *get_drm_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len); #endif diff --git a/include/backend/drm/renderer.h b/include/backend/drm/renderer.h index 1624a5ec..5e15f3d5 100644 --- a/include/backend/drm/renderer.h +++ b/include/backend/drm/renderer.h @@ -31,25 +31,25 @@ struct wlr_drm_surface { struct gbm_bo *back; }; -bool drm_renderer_init(struct wlr_drm_backend *drm, +bool init_drm_renderer(struct wlr_drm_backend *drm, struct wlr_drm_renderer *renderer); -void drm_renderer_finish(struct wlr_drm_renderer *renderer); +void finish_drm_renderer(struct wlr_drm_renderer *renderer); -bool drm_surface_init(struct wlr_drm_surface *surf, +bool init_drm_surface(struct wlr_drm_surface *surf, struct wlr_drm_renderer *renderer, uint32_t width, uint32_t height, uint32_t format, uint32_t flags); -bool drm_plane_surfaces_init(struct wlr_drm_plane *plane, +bool init_drm_plane_surfaces(struct wlr_drm_plane *plane, struct wlr_drm_backend *drm, int32_t width, uint32_t height, uint32_t format); -void drm_surface_finish(struct wlr_drm_surface *surf); -bool drm_surface_make_current(struct wlr_drm_surface *surf, int *buffer_age); -struct gbm_bo *drm_surface_swap_buffers(struct wlr_drm_surface *surf, +void finish_drm_surface(struct wlr_drm_surface *surf); +bool make_drm_surface_current(struct wlr_drm_surface *surf, int *buffer_age); +struct gbm_bo *swap_drm_surface_buffers(struct wlr_drm_surface *surf, pixman_region32_t *damage); -struct gbm_bo *drm_surface_get_front(struct wlr_drm_surface *surf); -void drm_surface_post(struct wlr_drm_surface *surf); -struct gbm_bo *drm_surface_mgpu_copy(struct wlr_drm_surface *dest, +struct gbm_bo *get_drm_surface_front(struct wlr_drm_surface *surf); +void post_drm_surface(struct wlr_drm_surface *surf); +struct gbm_bo *copy_drm_surface_mgpu(struct wlr_drm_surface *dest, struct gbm_bo *src); #endif diff --git a/include/backend/drm/util.h b/include/backend/drm/util.h index 25da858f..0b55182b 100644 --- a/include/backend/drm/util.h +++ b/include/backend/drm/util.h @@ -9,7 +9,8 @@ // Calculates a more accurate refresh rate (mHz) than what mode itself provides int32_t calculate_refresh_rate(drmModeModeInfo *mode); // Populates the make/model/phys_{width,height} of output from the edid data -void parse_edid(struct wlr_output *restrict output, size_t len, const uint8_t *data); +void parse_edid(struct wlr_output *restrict output, size_t len, + const uint8_t *data); // Returns the string representation of a DRM output type const char *conn_get_name(uint32_t type_id); // Returns the DRM framebuffer id for a gbm_bo @@ -36,4 +37,5 @@ enum { size_t match_obj(size_t num_objs, const uint32_t objs[static restrict num_objs], size_t num_res, const uint32_t res[static restrict num_res], uint32_t out[static restrict num_res]); + #endif diff --git a/include/backend/libinput.h b/include/backend/libinput.h index 1e66a9ec..f0928133 100644 --- a/include/backend/libinput.h +++ b/include/backend/libinput.h @@ -31,19 +31,19 @@ struct wlr_libinput_input_device { uint32_t usec_to_msec(uint64_t usec); -void libinput_handle_event(struct wlr_libinput_backend *state, +void handle_libinput_event(struct wlr_libinput_backend *state, struct libinput_event *event); struct wlr_input_device *get_appropriate_device( enum wlr_input_device_type desired_type, struct libinput_device *device); -struct wlr_keyboard *libinput_keyboard_create( +struct wlr_keyboard *create_libinput_keyboard( struct libinput_device *device); void handle_keyboard_key(struct libinput_event *event, struct libinput_device *device); -struct wlr_pointer *libinput_pointer_create( +struct wlr_pointer *create_libinput_pointer( struct libinput_device *device); void handle_pointer_motion(struct libinput_event *event, struct libinput_device *device); @@ -54,7 +54,7 @@ void handle_pointer_button(struct libinput_event *event, void handle_pointer_axis(struct libinput_event *event, struct libinput_device *device); -struct wlr_touch *libinput_touch_create( +struct wlr_touch *create_libinput_touch( struct libinput_device *device); void handle_touch_down(struct libinput_event *event, struct libinput_device *device); @@ -65,7 +65,7 @@ void handle_touch_motion(struct libinput_event *event, void handle_touch_cancel(struct libinput_event *event, struct libinput_device *device); -struct wlr_tablet_tool *libinput_tablet_tool_create( +struct wlr_tablet_tool *create_libinput_tablet_tool( struct libinput_device *device); void handle_tablet_tool_axis(struct libinput_event *event, 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, struct libinput_device *device); -struct wlr_tablet_pad *libinput_tablet_pad_create( +struct wlr_tablet_pad *create_libinput_tablet_pad( struct libinput_device *device); void handle_tablet_pad_button(struct libinput_event *event, struct libinput_device *device); diff --git a/include/backend/wayland.h b/include/backend/wayland.h index 15e9f595..d1af954c 100644 --- a/include/backend/wayland.h +++ b/include/backend/wayland.h @@ -74,11 +74,11 @@ struct wlr_wl_pointer { struct wl_listener output_destroy_listener; }; -void wl_registry_poll(struct wlr_wl_backend *backend); -void wl_output_update_cursor(struct wlr_wl_backend_output *output); -struct wlr_wl_backend_output *wl_output_for_surface( +void poll_wl_registry(struct wlr_wl_backend *backend); +void update_wl_output_cursor(struct wlr_wl_backend_output *output); +struct wlr_wl_backend_output *get_wl_output_for_surface( struct wlr_wl_backend *backend, struct wl_surface *surface); -void wl_output_layout_get_box(struct wlr_wl_backend *backend, +void get_wl_output_layout_box(struct wlr_wl_backend *backend, struct wlr_box *box); extern const struct wl_seat_listener seat_listener; diff --git a/include/backend/x11.h b/include/backend/x11.h index aa946912..6ab1cec6 100644 --- a/include/backend/x11.h +++ b/include/backend/x11.h @@ -72,19 +72,19 @@ struct wlr_x11_backend { struct wl_listener display_destroy; }; -struct wlr_x11_output *x11_output_from_window_id(struct wlr_x11_backend *x11, +struct wlr_x11_output *get_x11_output_from_window_id(struct wlr_x11_backend *x11, xcb_window_t window); -void x11_output_layout_get_box(struct wlr_x11_backend *backend, +void get_x11_output_layout_box(struct wlr_x11_backend *backend, struct wlr_box *box); -const struct wlr_input_device_impl input_device_impl; +extern const struct wlr_input_device_impl input_device_impl; -void x11_handle_input_event(struct wlr_x11_backend *x11, +void handle_x11_input_event(struct wlr_x11_backend *x11, xcb_generic_event_t *event); -void x11_update_pointer_position(struct wlr_x11_output *output, +void update_x11_pointer_position(struct wlr_x11_output *output, xcb_timestamp_t time); -void x11_output_handle_configure_notify(struct wlr_x11_output *output, +void handle_x11_configure_notify(struct wlr_x11_output *output, xcb_configure_notify_event_t *event); #endif diff --git a/include/render/gles2.h b/include/render/gles2.h index 792f1b40..99beff29 100644 --- a/include/render/gles2.h +++ b/include/render/gles2.h @@ -18,7 +18,7 @@ extern PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES; -struct gles2_pixel_format { +struct wlr_gles2_pixel_format { uint32_t wl_format; GLint gl_format, gl_type; int depth, bpp; @@ -68,15 +68,16 @@ struct wlr_gles2_texture { }; }; -const struct gles2_pixel_format *gles2_format_from_wl(enum wl_shm_format fmt); -const enum wl_shm_format *gles2_formats(size_t *len); +const struct wlr_gles2_pixel_format *get_gles2_format_from_wl( + enum wl_shm_format fmt); +const enum wl_shm_format *get_gles2_formats(size_t *len); -struct wlr_gles2_texture *gles2_get_texture_in_context( +struct wlr_gles2_texture *get_gles2_texture_in_context( struct wlr_texture *wlr_texture); -void gles2_push_marker(const char *file, const char *func); -void gles2_pop_marker(void); -#define GLES2_DEBUG_PUSH gles2_push_marker(wlr_strip_path(__FILE__), __func__) -#define GLES2_DEBUG_POP gles2_pop_marker() +void push_gles2_marker(const char *file, const char *func); +void pop_gles2_marker(void); +#define PUSH_GLES2_DEBUG push_gles2_marker(wlr_strip_path(__FILE__), __func__) +#define POP_GLES2_DEBUG pop_gles2_marker() #endif diff --git a/include/xwayland/selection.h b/include/xwayland/selection.h index bb3a894d..fc910e46 100644 --- a/include/xwayland/selection.h +++ b/include/xwayland/selection.h @@ -60,8 +60,8 @@ void xwm_handle_selection_notify(struct wlr_xwm *xwm, xcb_selection_notify_event_t *event); int xwm_handle_xfixes_selection_notify(struct wlr_xwm *xwm, xcb_xfixes_selection_notify_event_t *event); -bool wlr_data_source_is_xwayland_data_source(struct wlr_data_source *wlr_source); -bool wlr_primary_selection_source_is_xwayland_primary_selection_source( +bool data_source_is_xwayland(struct wlr_data_source *wlr_source); +bool primary_selection_source_is_xwayland( struct wlr_primary_selection_source *wlr_source); void xwm_seat_handle_start_drag(struct wlr_xwm *xwm, struct wlr_drag *drag); diff --git a/render/gles2/pixel_format.c b/render/gles2/pixel_format.c index 89ba762f..6f42e72e 100644 --- a/render/gles2/pixel_format.c +++ b/render/gles2/pixel_format.c @@ -6,7 +6,7 @@ * The wayland formats are little endian while the GL formats are big endian, * so WL_SHM_FORMAT_ARGB8888 is actually compatible with GL_BGRA_EXT. */ -static const struct gles2_pixel_format formats[] = { +static const struct wlr_gles2_pixel_format formats[] = { { .wl_format = WL_SHM_FORMAT_ARGB8888, .depth = 32, @@ -50,7 +50,8 @@ static const enum wl_shm_format wl_formats[] = { // TODO: more pixel formats -const struct gles2_pixel_format *gles2_format_from_wl(enum wl_shm_format fmt) { +const struct wlr_gles2_pixel_format *get_gles2_format_from_wl( + enum wl_shm_format fmt) { for (size_t i = 0; i < sizeof(formats) / sizeof(*formats); ++i) { if (formats[i].wl_format == fmt) { return &formats[i]; @@ -59,7 +60,7 @@ const struct gles2_pixel_format *gles2_format_from_wl(enum wl_shm_format fmt) { return NULL; } -const enum wl_shm_format *gles2_formats(size_t *len) { +const enum wl_shm_format *get_gles2_formats(size_t *len) { *len = sizeof(wl_formats) / sizeof(wl_formats[0]); return wl_formats; } diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index 97401010..c10493c4 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -34,7 +34,7 @@ static void gles2_begin(struct wlr_renderer *wlr_renderer, uint32_t width, struct wlr_gles2_renderer *renderer = gles2_get_renderer_in_context(wlr_renderer); - GLES2_DEBUG_PUSH; + PUSH_GLES2_DEBUG; glViewport(0, 0, width, height); renderer->viewport_width = width; @@ -47,7 +47,7 @@ static void gles2_begin(struct wlr_renderer *wlr_renderer, uint32_t width, // XXX: maybe we should save output projection and remove some of the need // for users to sling matricies themselves - GLES2_DEBUG_POP; + POP_GLES2_DEBUG; } static void gles2_end(struct wlr_renderer *wlr_renderer) { @@ -59,10 +59,10 @@ static void gles2_clear(struct wlr_renderer *wlr_renderer, const float color[static 4]) { gles2_get_renderer_in_context(wlr_renderer); - GLES2_DEBUG_PUSH; + PUSH_GLES2_DEBUG; glClearColor(color[0], color[1], color[2], color[3]); glClear(GL_COLOR_BUFFER_BIT); - GLES2_DEBUG_POP; + POP_GLES2_DEBUG; } static void gles2_scissor(struct wlr_renderer *wlr_renderer, @@ -70,7 +70,7 @@ static void gles2_scissor(struct wlr_renderer *wlr_renderer, struct wlr_gles2_renderer *renderer = gles2_get_renderer_in_context(wlr_renderer); - GLES2_DEBUG_PUSH; + PUSH_GLES2_DEBUG; if (box != NULL) { struct wlr_box gl_box; wlr_box_transform(box, WL_OUTPUT_TRANSFORM_FLIPPED_180, @@ -81,7 +81,7 @@ static void gles2_scissor(struct wlr_renderer *wlr_renderer, } else { glDisable(GL_SCISSOR_TEST); } - GLES2_DEBUG_POP; + POP_GLES2_DEBUG; } static void draw_quad() { @@ -116,7 +116,7 @@ static bool gles2_render_texture_with_matrix(struct wlr_renderer *wlr_renderer, struct wlr_gles2_renderer *renderer = gles2_get_renderer_in_context(wlr_renderer); struct wlr_gles2_texture *texture = - gles2_get_texture_in_context(wlr_texture); + get_gles2_texture_in_context(wlr_texture); GLuint prog = 0; GLenum target = 0; @@ -139,7 +139,7 @@ static bool gles2_render_texture_with_matrix(struct wlr_renderer *wlr_renderer, float transposition[9]; wlr_matrix_transpose(transposition, matrix); - GLES2_DEBUG_PUSH; + PUSH_GLES2_DEBUG; GLuint tex_id = texture->type == WLR_GLES2_TEXTURE_GLTEX ? texture->gl_tex : texture->image_tex; @@ -157,7 +157,7 @@ static bool gles2_render_texture_with_matrix(struct wlr_renderer *wlr_renderer, draw_quad(); - GLES2_DEBUG_POP; + POP_GLES2_DEBUG; return true; } @@ -172,12 +172,12 @@ static void gles2_render_quad_with_matrix(struct wlr_renderer *wlr_renderer, float transposition[9]; wlr_matrix_transpose(transposition, matrix); - GLES2_DEBUG_PUSH; + PUSH_GLES2_DEBUG; glUseProgram(renderer->shaders.quad); glUniformMatrix3fv(0, 1, GL_FALSE, transposition); glUniform4f(1, color[0], color[1], color[2], color[3]); draw_quad(); - GLES2_DEBUG_POP; + POP_GLES2_DEBUG; } static void gles2_render_ellipse_with_matrix(struct wlr_renderer *wlr_renderer, @@ -190,17 +190,17 @@ static void gles2_render_ellipse_with_matrix(struct wlr_renderer *wlr_renderer, float transposition[9]; wlr_matrix_transpose(transposition, matrix); - GLES2_DEBUG_PUSH; + PUSH_GLES2_DEBUG; glUseProgram(renderer->shaders.ellipse); glUniformMatrix3fv(0, 1, GL_FALSE, transposition); glUniform4f(1, color[0], color[1], color[2], color[3]); draw_quad(); - GLES2_DEBUG_POP; + POP_GLES2_DEBUG; } static const enum wl_shm_format *gles2_renderer_formats( struct wlr_renderer *wlr_renderer, size_t *len) { - return gles2_formats(len); + return get_gles2_formats(len); } static bool gles2_resource_is_wl_drm_buffer(struct wlr_renderer *wlr_renderer, @@ -254,13 +254,13 @@ static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer, uint32_t dst_y, void *data) { gles2_get_renderer_in_context(wlr_renderer); - const struct gles2_pixel_format *fmt = gles2_format_from_wl(wl_fmt); + const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt); if (fmt == NULL) { wlr_log(L_ERROR, "Cannot read pixels: unsupported pixel format"); return false; } - GLES2_DEBUG_PUSH; + PUSH_GLES2_DEBUG; // Make sure any pending drawing is finished before we try to read it glFinish(); @@ -273,14 +273,14 @@ static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer, fmt->gl_type, p + i * stride + dst_x * fmt->bpp / 8); } - GLES2_DEBUG_POP; + POP_GLES2_DEBUG; return true; } static bool gles2_format_supported(struct wlr_renderer *wlr_renderer, enum wl_shm_format wl_fmt) { - return gles2_format_from_wl(wl_fmt) != NULL; + return get_gles2_format_from_wl(wl_fmt) != NULL; } static struct wlr_texture *gles2_texture_from_pixels( @@ -309,13 +309,13 @@ static void gles2_destroy(struct wlr_renderer *wlr_renderer) { wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL); - GLES2_DEBUG_PUSH; + PUSH_GLES2_DEBUG; glDeleteProgram(renderer->shaders.quad); glDeleteProgram(renderer->shaders.ellipse); glDeleteProgram(renderer->shaders.tex_rgba); glDeleteProgram(renderer->shaders.tex_rgbx); glDeleteProgram(renderer->shaders.tex_ext); - GLES2_DEBUG_POP; + POP_GLES2_DEBUG; if (glDebugMessageCallbackKHR) { glDisable(GL_DEBUG_OUTPUT_KHR); @@ -347,7 +347,7 @@ static const struct wlr_renderer_impl renderer_impl = { .texture_from_dmabuf = gles2_texture_from_dmabuf, }; -void gles2_push_marker(const char *file, const char *func) { +void push_gles2_marker(const char *file, const char *func) { if (!glPushDebugGroupKHR) { return; } @@ -358,7 +358,7 @@ void gles2_push_marker(const char *file, const char *func) { glPushDebugGroupKHR(GL_DEBUG_SOURCE_APPLICATION_KHR, 1, -1, str); } -void gles2_pop_marker(void) { +void pop_gles2_marker(void) { if (glPopDebugGroupKHR) { glPopDebugGroupKHR(); } @@ -385,7 +385,7 @@ static void gles2_log(GLenum src, GLenum type, GLuint id, GLenum severity, } static GLuint compile_shader(GLuint type, const GLchar *src) { - GLES2_DEBUG_PUSH; + PUSH_GLES2_DEBUG; GLuint shader = glCreateShader(type); glShaderSource(shader, 1, &src, NULL); @@ -398,12 +398,12 @@ static GLuint compile_shader(GLuint type, const GLchar *src) { shader = 0; } - GLES2_DEBUG_POP; + POP_GLES2_DEBUG; return shader; } static GLuint link_program(const GLchar *vert_src, const GLchar *frag_src) { - GLES2_DEBUG_PUSH; + PUSH_GLES2_DEBUG; GLuint vert = compile_shader(GL_VERTEX_SHADER, vert_src); if (!vert) { @@ -433,11 +433,11 @@ static GLuint link_program(const GLchar *vert_src, const GLchar *frag_src) { goto error; } - GLES2_DEBUG_POP; + POP_GLES2_DEBUG; return prog; error: - GLES2_DEBUG_POP; + POP_GLES2_DEBUG; return 0; } @@ -481,7 +481,7 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) { GL_DONT_CARE, 0, NULL, GL_FALSE); } - GLES2_DEBUG_PUSH; + PUSH_GLES2_DEBUG; renderer->shaders.quad = link_program(quad_vertex_src, quad_fragment_src); if (!renderer->shaders.quad) { @@ -510,7 +510,7 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) { } } - GLES2_DEBUG_POP; + POP_GLES2_DEBUG; return &renderer->wlr_renderer; @@ -521,7 +521,7 @@ error: glDeleteProgram(renderer->shaders.tex_rgbx); glDeleteProgram(renderer->shaders.tex_ext); - GLES2_DEBUG_POP; + POP_GLES2_DEBUG; if (glDebugMessageCallbackKHR) { glDisable(GL_DEBUG_OUTPUT_KHR); diff --git a/render/gles2/texture.c b/render/gles2/texture.c index 45425fbf..37424802 100644 --- a/render/gles2/texture.c +++ b/render/gles2/texture.c @@ -22,7 +22,7 @@ static struct wlr_gles2_texture *gles2_get_texture( return (struct wlr_gles2_texture *)wlr_texture; } -struct wlr_gles2_texture *gles2_get_texture_in_context( +struct wlr_gles2_texture *get_gles2_texture_in_context( struct wlr_texture *wlr_texture) { struct wlr_gles2_texture *texture = gles2_get_texture(wlr_texture); assert(wlr_egl_is_current(texture->egl)); @@ -41,21 +41,21 @@ static bool gles2_texture_write_pixels(struct wlr_texture *wlr_texture, uint32_t height, uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y, const void *data) { struct wlr_gles2_texture *texture = - gles2_get_texture_in_context(wlr_texture); + get_gles2_texture_in_context(wlr_texture); if (texture->type != WLR_GLES2_TEXTURE_GLTEX) { wlr_log(L_ERROR, "Cannot write pixels to immutable texture"); return false; } - const struct gles2_pixel_format *fmt = gles2_format_from_wl(wl_fmt); + const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt); if (fmt == NULL) { wlr_log(L_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt); return false; } // TODO: what if the unpack subimage extension isn't supported? - GLES2_DEBUG_PUSH; + PUSH_GLES2_DEBUG; glBindTexture(GL_TEXTURE_2D, texture->gl_tex); @@ -70,7 +70,7 @@ static bool gles2_texture_write_pixels(struct wlr_texture *wlr_texture, glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0); glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, 0); - GLES2_DEBUG_POP; + POP_GLES2_DEBUG; return true; } @@ -83,7 +83,7 @@ static void gles2_texture_destroy(struct wlr_texture *wlr_texture) { wlr_egl_make_current(texture->egl, EGL_NO_SURFACE, NULL); - GLES2_DEBUG_PUSH; + PUSH_GLES2_DEBUG; if (texture->image_tex) { glDeleteTextures(1, &texture->image_tex); @@ -94,7 +94,7 @@ static void gles2_texture_destroy(struct wlr_texture *wlr_texture) { glDeleteTextures(1, &texture->gl_tex); } - GLES2_DEBUG_POP; + POP_GLES2_DEBUG; free(texture); } @@ -110,7 +110,7 @@ struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl, uint32_t height, const void *data) { assert(wlr_egl_is_current(egl)); - const struct gles2_pixel_format *fmt = gles2_format_from_wl(wl_fmt); + const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt); if (fmt == NULL) { wlr_log(L_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt); return NULL; @@ -129,7 +129,7 @@ struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl, texture->type = WLR_GLES2_TEXTURE_GLTEX; texture->has_alpha = fmt->has_alpha; - GLES2_DEBUG_PUSH; + PUSH_GLES2_DEBUG; glGenTextures(1, &texture->gl_tex); glBindTexture(GL_TEXTURE_2D, texture->gl_tex); @@ -139,7 +139,7 @@ struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl, fmt->gl_format, fmt->gl_type, data); glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0); - GLES2_DEBUG_POP; + POP_GLES2_DEBUG; return &texture->wlr_texture; } @@ -188,13 +188,13 @@ struct wlr_texture *wlr_gles2_texture_from_wl_drm(struct wlr_egl *egl, return NULL; } - GLES2_DEBUG_PUSH; + PUSH_GLES2_DEBUG; glGenTextures(1, &texture->image_tex); glBindTexture(target, texture->image_tex); glEGLImageTargetTexture2DOES(target, texture->image); - GLES2_DEBUG_POP; + POP_GLES2_DEBUG; return &texture->wlr_texture; } @@ -233,12 +233,12 @@ struct wlr_texture *wlr_gles2_texture_from_dmabuf(struct wlr_egl *egl, return NULL; } - GLES2_DEBUG_PUSH; + PUSH_GLES2_DEBUG; glGenTextures(1, &texture->image_tex); glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture->image_tex); glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, texture->image); - GLES2_DEBUG_POP; + POP_GLES2_DEBUG; return &texture->wlr_texture; } diff --git a/xwayland/selection/incoming.c b/xwayland/selection/incoming.c index ab06f40d..e983cf9f 100644 --- a/xwayland/selection/incoming.c +++ b/xwayland/selection/incoming.c @@ -182,14 +182,14 @@ struct x11_data_source { static const struct wlr_data_source_impl data_source_impl; -bool wlr_data_source_is_xwayland_data_source( +bool data_source_is_xwayland( struct wlr_data_source *wlr_source) { return wlr_source->impl == &data_source_impl; } static struct x11_data_source *data_source_from_wlr_data_source( struct wlr_data_source *wlr_source) { - assert(wlr_data_source_is_xwayland_data_source(wlr_source)); + assert(data_source_is_xwayland(wlr_source)); return (struct x11_data_source *)wlr_source; } @@ -225,7 +225,7 @@ struct x11_primary_selection_source { static void primary_selection_source_cancel( struct wlr_primary_selection_source *wlr_source); -bool wlr_primary_selection_source_is_xwayland_primary_selection_source( +bool primary_selection_source_is_xwayland( struct wlr_primary_selection_source *wlr_source) { return wlr_source->cancel == primary_selection_source_cancel; } diff --git a/xwayland/selection/selection.c b/xwayland/selection/selection.c index 39c47c45..6b57f7c3 100644 --- a/xwayland/selection/selection.c +++ b/xwayland/selection/selection.c @@ -223,13 +223,13 @@ void xwm_selection_finish(struct wlr_xwm *xwm) { } if (xwm->seat) { if (xwm->seat->selection_source && - wlr_data_source_is_xwayland_data_source( + data_source_is_xwayland( xwm->seat->selection_source)) { wlr_seat_set_selection(xwm->seat, NULL, wl_display_next_serial(xwm->xwayland->wl_display)); } if (xwm->seat->primary_selection_source && - wlr_primary_selection_source_is_xwayland_primary_selection_source( + primary_selection_source_is_xwayland( xwm->seat->primary_selection_source)) { wlr_seat_set_primary_selection(xwm->seat, NULL, wl_display_next_serial(xwm->xwayland->wl_display)); @@ -262,7 +262,7 @@ static void seat_handle_selection(struct wl_listener *listener, wl_container_of(listener, xwm, seat_selection); struct wlr_data_source *source = seat->selection_source; - if (source != NULL && wlr_data_source_is_xwayland_data_source(source)) { + if (source != NULL && data_source_is_xwayland(source)) { return; } @@ -277,7 +277,7 @@ static void seat_handle_primary_selection(struct wl_listener *listener, struct wlr_primary_selection_source *source = seat->primary_selection_source; if (source != NULL && - wlr_primary_selection_source_is_xwayland_primary_selection_source( + primary_selection_source_is_xwayland( source)) { return; }