backend-drm: Make boolean fields actually bool

Continues what dd8219b3fb started, also in
the DRM backend.
dev
Emmanuel Gil Peyrot 5 years ago committed by Daniel Stone
parent b2f54d9f17
commit 1b3ad0993b
  1. 2
      libweston/backend-drm/drm-gbm.c
  2. 14
      libweston/backend-drm/drm-internal.h
  3. 32
      libweston/backend-drm/drm.c
  4. 12
      libweston/backend-drm/kms.c

@ -171,7 +171,7 @@ drm_output_init_cursor_egl(struct drm_output *output, struct drm_backend *b)
err: err:
weston_log("cursor buffers unavailable, using gl cursors\n"); weston_log("cursor buffers unavailable, using gl cursors\n");
b->cursors_are_broken = 1; b->cursors_are_broken = true;
drm_output_fini_cursor_egl(output); drm_output_fini_cursor_egl(output);
return -1; return -1;
} }

@ -261,7 +261,6 @@ struct drm_backend {
int min_height, max_height; int min_height, max_height;
struct wl_list plane_list; struct wl_list plane_list;
int sprites_are_broken;
void *repaint_data; void *repaint_data;
@ -270,7 +269,8 @@ struct drm_backend {
/* CRTC IDs not used by any enabled output. */ /* CRTC IDs not used by any enabled output. */
struct wl_array unused_crtcs; struct wl_array unused_crtcs;
int cursors_are_broken; bool sprites_are_broken;
bool cursors_are_broken;
bool universal_planes; bool universal_planes;
bool atomic_modeset; bool atomic_modeset;
@ -484,11 +484,11 @@ struct drm_output {
/* Holds the properties for the CRTC */ /* Holds the properties for the CRTC */
struct drm_property_info props_crtc[WDRM_CRTC__COUNT]; struct drm_property_info props_crtc[WDRM_CRTC__COUNT];
int page_flip_pending; bool page_flip_pending;
int atomic_complete_pending; bool atomic_complete_pending;
int destroy_pending; bool destroy_pending;
int disable_pending; bool disable_pending;
int dpms_off_pending; bool dpms_off_pending;
uint32_t gbm_cursor_handle[2]; uint32_t gbm_cursor_handle[2];
struct drm_fb *gbm_cursor_fb[2]; struct drm_fb *gbm_cursor_fb[2];

@ -291,19 +291,19 @@ drm_output_update_complete(struct drm_output *output, uint32_t flags,
output->state_last = NULL; output->state_last = NULL;
if (output->destroy_pending) { if (output->destroy_pending) {
output->destroy_pending = 0; output->destroy_pending = false;
output->disable_pending = 0; output->disable_pending = false;
output->dpms_off_pending = 0; output->dpms_off_pending = false;
drm_output_destroy(&output->base); drm_output_destroy(&output->base);
return; return;
} else if (output->disable_pending) { } else if (output->disable_pending) {
output->disable_pending = 0; output->disable_pending = false;
output->dpms_off_pending = 0; output->dpms_off_pending = false;
weston_output_disable(&output->base); weston_output_disable(&output->base);
return; return;
} else if (output->dpms_off_pending) { } else if (output->dpms_off_pending) {
struct drm_pending_state *pending = drm_pending_state_alloc(b); struct drm_pending_state *pending = drm_pending_state_alloc(b);
output->dpms_off_pending = 0; output->dpms_off_pending = false;
drm_output_get_disable_state(pending, output); drm_output_get_disable_state(pending, output);
drm_pending_state_apply_sync(pending); drm_pending_state_apply_sync(pending);
} else if (output->state_cur->dpms == WESTON_DPMS_OFF && } else if (output->state_cur->dpms == WESTON_DPMS_OFF &&
@ -1101,7 +1101,7 @@ drm_set_dpms(struct weston_output *output_base, enum dpms_enum level)
* a repaint cycle. */ * a repaint cycle. */
if (level == WESTON_DPMS_ON) { if (level == WESTON_DPMS_ON) {
if (output->dpms_off_pending) if (output->dpms_off_pending)
output->dpms_off_pending = 0; output->dpms_off_pending = false;
weston_output_schedule_repaint(output_base); weston_output_schedule_repaint(output_base);
return; return;
} }
@ -1109,7 +1109,7 @@ drm_set_dpms(struct weston_output *output_base, enum dpms_enum level)
/* If we've already got a request in the pipeline, then we need to /* If we've already got a request in the pipeline, then we need to
* park our DPMS request until that request has quiesced. */ * park our DPMS request until that request has quiesced. */
if (output->state_last) { if (output->state_last) {
output->dpms_off_pending = 1; output->dpms_off_pending = true;
return; return;
} }
@ -1738,7 +1738,7 @@ drm_output_enable(struct weston_output *base)
&output->cursor_plane->base, &output->cursor_plane->base,
NULL); NULL);
else else
b->cursors_are_broken = 1; b->cursors_are_broken = true;
weston_compositor_stack_plane(b->compositor, weston_compositor_stack_plane(b->compositor,
&output->scanout_plane->base, &output->scanout_plane->base,
@ -1798,7 +1798,7 @@ drm_output_destroy(struct weston_output *base)
assert(!output->virtual); assert(!output->virtual);
if (output->page_flip_pending || output->atomic_complete_pending) { if (output->page_flip_pending || output->atomic_complete_pending) {
output->destroy_pending = 1; output->destroy_pending = true;
weston_log("destroy output while page flip pending\n"); weston_log("destroy output while page flip pending\n");
return; return;
} }
@ -1827,7 +1827,7 @@ drm_output_disable(struct weston_output *base)
assert(!output->virtual); assert(!output->virtual);
if (output->page_flip_pending || output->atomic_complete_pending) { if (output->page_flip_pending || output->atomic_complete_pending) {
output->disable_pending = 1; output->disable_pending = true;
return -1; return -1;
} }
@ -1836,7 +1836,7 @@ drm_output_disable(struct weston_output *base)
if (output->base.enabled) if (output->base.enabled)
drm_output_deinit(&output->base); drm_output_deinit(&output->base);
output->disable_pending = 0; output->disable_pending = false;
return 0; return 0;
} }
@ -2156,8 +2156,8 @@ drm_output_create(struct weston_compositor *compositor, const char *name)
output->base.attach_head = drm_output_attach_head; output->base.attach_head = drm_output_attach_head;
output->base.detach_head = drm_output_detach_head; output->base.detach_head = drm_output_detach_head;
output->destroy_pending = 0; output->destroy_pending = false;
output->disable_pending = 0; output->disable_pending = false;
output->state_cur = drm_output_state_alloc(output, NULL); output->state_cur = drm_output_state_alloc(output, NULL);
@ -2662,12 +2662,12 @@ planes_binding(struct weston_keyboard *keyboard, const struct timespec *time,
switch (key) { switch (key) {
case KEY_C: case KEY_C:
b->cursors_are_broken ^= 1; b->cursors_are_broken ^= true;
break; break;
case KEY_V: case KEY_V:
/* We don't support overlay-plane usage with legacy KMS. */ /* We don't support overlay-plane usage with legacy KMS. */
if (b->atomic_modeset) if (b->atomic_modeset)
b->sprites_are_broken ^= 1; b->sprites_are_broken ^= true;
break; break;
default: default:
break; break;

@ -553,7 +553,7 @@ drm_output_assign_state(struct drm_output_state *state,
if (b->atomic_modeset && mode == DRM_STATE_APPLY_ASYNC) { if (b->atomic_modeset && mode == DRM_STATE_APPLY_ASYNC) {
drm_debug(b, "\t[CRTC:%u] setting pending flip\n", output->crtc_id); drm_debug(b, "\t[CRTC:%u] setting pending flip\n", output->crtc_id);
output->atomic_complete_pending = 1; output->atomic_complete_pending = true;
} }
if (b->atomic_modeset && if (b->atomic_modeset &&
@ -583,7 +583,7 @@ drm_output_assign_state(struct drm_output_state *state,
assert(plane->type != WDRM_PLANE_TYPE_OVERLAY); assert(plane->type != WDRM_PLANE_TYPE_OVERLAY);
if (plane->type == WDRM_PLANE_TYPE_PRIMARY) if (plane->type == WDRM_PLANE_TYPE_PRIMARY)
output->page_flip_pending = 1; output->page_flip_pending = true;
} }
} }
@ -635,7 +635,7 @@ drm_output_set_cursor(struct drm_output_state *output_state)
return; return;
err: err:
b->cursors_are_broken = 1; b->cursors_are_broken = true;
drmModeSetCursor(b->drm.fd, output->crtc_id, 0, 0, 0); drmModeSetCursor(b->drm.fd, output->crtc_id, 0, 0, 0);
} }
@ -1400,7 +1400,7 @@ page_flip_handler(int fd, unsigned int frame,
assert(!b->atomic_modeset); assert(!b->atomic_modeset);
assert(output->page_flip_pending); assert(output->page_flip_pending);
output->page_flip_pending = 0; output->page_flip_pending = false;
drm_output_update_complete(output, flags, sec, usec); drm_output_update_complete(output, flags, sec, usec);
} }
@ -1426,7 +1426,7 @@ atomic_flip_handler(int fd, unsigned int frame, unsigned int sec,
drm_debug(b, "[atomic][CRTC:%u] flip processing started\n", crtc_id); drm_debug(b, "[atomic][CRTC:%u] flip processing started\n", crtc_id);
assert(b->atomic_modeset); assert(b->atomic_modeset);
assert(output->atomic_complete_pending); assert(output->atomic_complete_pending);
output->atomic_complete_pending = 0; output->atomic_complete_pending = false;
drm_output_update_complete(output, flags, sec, usec); drm_output_update_complete(output, flags, sec, usec);
drm_debug(b, "[atomic][CRTC:%u] flip processing completed\n", crtc_id); drm_debug(b, "[atomic][CRTC:%u] flip processing completed\n", crtc_id);
@ -1514,7 +1514,7 @@ init_kms_caps(struct drm_backend *b)
* enabled. * enabled.
*/ */
if (!b->atomic_modeset || getenv("WESTON_FORCE_RENDERER")) if (!b->atomic_modeset || getenv("WESTON_FORCE_RENDERER"))
b->sprites_are_broken = 1; b->sprites_are_broken = true;
ret = drmSetClientCap(b->drm.fd, DRM_CLIENT_CAP_ASPECT_RATIO, 1); ret = drmSetClientCap(b->drm.fd, DRM_CLIENT_CAP_ASPECT_RATIO, 1);
b->aspect_ratio_supported = (ret == 0); b->aspect_ratio_supported = (ret == 0);

Loading…
Cancel
Save