backend-drm: attach device to pending state

The commits happen per device instead of per backend. The pending state is
therefore per device as well. Allow to retrieve the device from the pending
state.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
dev
Michael Tretter 3 years ago committed by Daniel Stone
parent 615a37dc88
commit c4685d9463
  1. 4
      libweston/backend-drm/drm-internal.h
  2. 9
      libweston/backend-drm/drm.c
  3. 14
      libweston/backend-drm/kms.c
  4. 6
      libweston/backend-drm/state-helpers.c

@ -388,7 +388,7 @@ struct drm_edid {
* output state will complete and be retired separately.
*/
struct drm_pending_state {
struct drm_backend *backend;
struct drm_device *device;
struct wl_list output_list;
};
@ -760,7 +760,7 @@ drm_can_scanout_dmabuf(struct weston_compositor *ec,
#endif
struct drm_pending_state *
drm_pending_state_alloc(struct drm_backend *backend);
drm_pending_state_alloc(struct drm_device *device);
void
drm_pending_state_free(struct drm_pending_state *pending_state);
struct drm_output_state *

@ -272,6 +272,7 @@ drm_output_update_complete(struct drm_output *output, uint32_t flags,
unsigned int sec, unsigned int usec)
{
struct drm_backend *b = to_drm_backend(output->base.compositor);
struct drm_device *device = b->drm;
struct drm_plane_state *ps;
struct timespec ts;
@ -297,7 +298,7 @@ drm_output_update_complete(struct drm_output *output, uint32_t flags,
weston_output_disable(&output->base);
return;
} 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(device);
output->dpms_off_pending = false;
drm_output_get_disable_state(pending, output);
drm_pending_state_apply_sync(pending);
@ -588,7 +589,7 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
assert(!output->page_flip_pending);
assert(!output->state_last);
pending_state = drm_pending_state_alloc(backend);
pending_state = drm_pending_state_alloc(device);
drm_output_state_duplicate(output->state_cur, pending_state,
DRM_OUTPUT_STATE_PRESERVE_PLANES);
@ -624,7 +625,7 @@ drm_repaint_begin(struct weston_compositor *compositor)
struct drm_device *device = b->drm;
struct drm_pending_state *pending_state;
pending_state = drm_pending_state_alloc(b);
pending_state = drm_pending_state_alloc(device);
device->repaint_data = pending_state;
if (weston_log_scope_is_enabled(b->debug)) {
@ -1101,7 +1102,7 @@ drm_set_dpms(struct weston_output *output_base, enum dpms_enum level)
return;
}
pending_state = drm_pending_state_alloc(b);
pending_state = drm_pending_state_alloc(device);
drm_output_get_disable_state(pending_state, output);
ret = drm_pending_state_apply_sync(pending_state);
if (ret != 0)

@ -1065,8 +1065,8 @@ static int
drm_pending_state_apply_atomic(struct drm_pending_state *pending_state,
enum drm_state_apply_mode mode)
{
struct drm_backend *b = pending_state->backend;
struct drm_device *device = b->drm;
struct drm_device *device = pending_state->device;
struct drm_backend *b = device->backend;
struct drm_output_state *output_state, *tmp;
struct drm_plane *plane;
drmModeAtomicReq *req = drmModeAtomicAlloc();
@ -1235,8 +1235,7 @@ out:
int
drm_pending_state_test(struct drm_pending_state *pending_state)
{
struct drm_backend *b = pending_state->backend;
struct drm_device *device = b->drm;
struct drm_device *device = pending_state->device;
if (device->atomic_modeset)
return drm_pending_state_apply_atomic(pending_state,
@ -1257,8 +1256,8 @@ drm_pending_state_test(struct drm_pending_state *pending_state)
int
drm_pending_state_apply(struct drm_pending_state *pending_state)
{
struct drm_backend *b = pending_state->backend;
struct drm_device *device = b->drm;
struct drm_device *device = pending_state->device;
struct drm_backend *b = device->backend;
struct drm_output_state *output_state, *tmp;
struct drm_crtc *crtc;
@ -1325,8 +1324,7 @@ drm_pending_state_apply(struct drm_pending_state *pending_state)
int
drm_pending_state_apply_sync(struct drm_pending_state *pending_state)
{
struct drm_backend *backend = pending_state->backend;
struct drm_device *device = backend->drm;
struct drm_device *device = pending_state->device;
struct drm_output_state *output_state, *tmp;
struct drm_crtc *crtc;

@ -438,11 +438,11 @@ drm_output_state_free(struct drm_output_state *state)
* Allocate a new, empty, 'pending state' structure to be used across a
* repaint cycle or similar.
*
* @param backend DRM backend
* @param device DRM device
* @returns Newly-allocated pending state structure
*/
struct drm_pending_state *
drm_pending_state_alloc(struct drm_backend *backend)
drm_pending_state_alloc(struct drm_device *device)
{
struct drm_pending_state *ret;
@ -450,7 +450,7 @@ drm_pending_state_alloc(struct drm_backend *backend)
if (!ret)
return NULL;
ret->backend = backend;
ret->device = device;
wl_list_init(&ret->output_list);
return ret;

Loading…
Cancel
Save