Make sure we don't use others' prefixes

This commit is contained in:
emersion 2018-04-25 23:24:58 +01:00
parent f9f75a1362
commit 71ca45e2c0
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
33 changed files with 207 additions and 203 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);
}
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;

View file

@ -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;
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
}