Lines Matching +full:- +full:state

4  * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
59 * drm_crtc_commit_wait - Waits for a commit to complete
77 ret = wait_for_completion_timeout(&commit->hw_done, timeout); in drm_crtc_commit_wait()
79 drm_err(commit->crtc->dev, "hw_done timed out\n"); in drm_crtc_commit_wait()
80 return -ETIMEDOUT; in drm_crtc_commit_wait()
87 ret = wait_for_completion_timeout(&commit->flip_done, timeout); in drm_crtc_commit_wait()
89 drm_err(commit->crtc->dev, "flip_done timed out\n"); in drm_crtc_commit_wait()
90 return -ETIMEDOUT; in drm_crtc_commit_wait()
98 * drm_atomic_state_default_release -
100 * @state: atomic state
106 void drm_atomic_state_default_release(struct drm_atomic_state *state) in drm_atomic_state_default_release() argument
108 kfree(state->connectors); in drm_atomic_state_default_release()
109 kfree(state->crtcs); in drm_atomic_state_default_release()
110 kfree(state->planes); in drm_atomic_state_default_release()
111 kfree(state->private_objs); in drm_atomic_state_default_release()
116 * drm_atomic_state_init - init new atomic state
118 * @state: atomic state
120 * Default implementation for filling in a new atomic state.
125 drm_atomic_state_init(struct drm_device *dev, struct drm_atomic_state *state) in drm_atomic_state_init() argument
127 kref_init(&state->ref); in drm_atomic_state_init()
132 state->allow_modeset = true; in drm_atomic_state_init()
134 state->crtcs = kcalloc(dev->mode_config.num_crtc, in drm_atomic_state_init()
135 sizeof(*state->crtcs), GFP_KERNEL); in drm_atomic_state_init()
136 if (!state->crtcs) in drm_atomic_state_init()
138 state->planes = kcalloc(dev->mode_config.num_total_plane, in drm_atomic_state_init()
139 sizeof(*state->planes), GFP_KERNEL); in drm_atomic_state_init()
140 if (!state->planes) in drm_atomic_state_init()
143 state->dev = dev; in drm_atomic_state_init()
145 drm_dbg_atomic(dev, "Allocated atomic state %p\n", state); in drm_atomic_state_init()
149 drm_atomic_state_default_release(state); in drm_atomic_state_init()
150 return -ENOMEM; in drm_atomic_state_init()
155 * drm_atomic_state_alloc - allocate atomic state
158 * This allocates an empty atomic state to track updates.
163 struct drm_mode_config *config = &dev->mode_config; in drm_atomic_state_alloc()
165 if (!config->funcs->atomic_state_alloc) { in drm_atomic_state_alloc()
166 struct drm_atomic_state *state; in drm_atomic_state_alloc() local
168 state = kzalloc(sizeof(*state), GFP_KERNEL); in drm_atomic_state_alloc()
169 if (!state) in drm_atomic_state_alloc()
171 if (drm_atomic_state_init(dev, state) < 0) { in drm_atomic_state_alloc()
172 kfree(state); in drm_atomic_state_alloc()
175 return state; in drm_atomic_state_alloc()
178 return config->funcs->atomic_state_alloc(dev); in drm_atomic_state_alloc()
183 * drm_atomic_state_default_clear - clear base atomic state
184 * @state: atomic state
186 * Default implementation for clearing atomic state.
190 void drm_atomic_state_default_clear(struct drm_atomic_state *state) in drm_atomic_state_default_clear() argument
192 struct drm_device *dev = state->dev; in drm_atomic_state_default_clear()
193 struct drm_mode_config *config = &dev->mode_config; in drm_atomic_state_default_clear()
196 drm_dbg_atomic(dev, "Clearing atomic state %p\n", state); in drm_atomic_state_default_clear()
198 for (i = 0; i < state->num_connector; i++) { in drm_atomic_state_default_clear()
199 struct drm_connector *connector = state->connectors[i].ptr; in drm_atomic_state_default_clear()
204 connector->funcs->atomic_destroy_state(connector, in drm_atomic_state_default_clear()
205 state->connectors[i].state); in drm_atomic_state_default_clear()
206 state->connectors[i].ptr = NULL; in drm_atomic_state_default_clear()
207 state->connectors[i].state = NULL; in drm_atomic_state_default_clear()
208 state->connectors[i].old_state = NULL; in drm_atomic_state_default_clear()
209 state->connectors[i].new_state = NULL; in drm_atomic_state_default_clear()
213 for (i = 0; i < config->num_crtc; i++) { in drm_atomic_state_default_clear()
214 struct drm_crtc *crtc = state->crtcs[i].ptr; in drm_atomic_state_default_clear()
219 crtc->funcs->atomic_destroy_state(crtc, in drm_atomic_state_default_clear()
220 state->crtcs[i].state); in drm_atomic_state_default_clear()
222 state->crtcs[i].ptr = NULL; in drm_atomic_state_default_clear()
223 state->crtcs[i].state = NULL; in drm_atomic_state_default_clear()
224 state->crtcs[i].old_state = NULL; in drm_atomic_state_default_clear()
225 state->crtcs[i].new_state = NULL; in drm_atomic_state_default_clear()
227 if (state->crtcs[i].commit) { in drm_atomic_state_default_clear()
228 drm_crtc_commit_put(state->crtcs[i].commit); in drm_atomic_state_default_clear()
229 state->crtcs[i].commit = NULL; in drm_atomic_state_default_clear()
233 for (i = 0; i < config->num_total_plane; i++) { in drm_atomic_state_default_clear()
234 struct drm_plane *plane = state->planes[i].ptr; in drm_atomic_state_default_clear()
239 plane->funcs->atomic_destroy_state(plane, in drm_atomic_state_default_clear()
240 state->planes[i].state); in drm_atomic_state_default_clear()
241 state->planes[i].ptr = NULL; in drm_atomic_state_default_clear()
242 state->planes[i].state = NULL; in drm_atomic_state_default_clear()
243 state->planes[i].old_state = NULL; in drm_atomic_state_default_clear()
244 state->planes[i].new_state = NULL; in drm_atomic_state_default_clear()
247 for (i = 0; i < state->num_private_objs; i++) { in drm_atomic_state_default_clear()
248 struct drm_private_obj *obj = state->private_objs[i].ptr; in drm_atomic_state_default_clear()
250 obj->funcs->atomic_destroy_state(obj, in drm_atomic_state_default_clear()
251 state->private_objs[i].state); in drm_atomic_state_default_clear()
252 state->private_objs[i].ptr = NULL; in drm_atomic_state_default_clear()
253 state->private_objs[i].state = NULL; in drm_atomic_state_default_clear()
254 state->private_objs[i].old_state = NULL; in drm_atomic_state_default_clear()
255 state->private_objs[i].new_state = NULL; in drm_atomic_state_default_clear()
257 state->num_private_objs = 0; in drm_atomic_state_default_clear()
259 if (state->fake_commit) { in drm_atomic_state_default_clear()
260 drm_crtc_commit_put(state->fake_commit); in drm_atomic_state_default_clear()
261 state->fake_commit = NULL; in drm_atomic_state_default_clear()
267 * drm_atomic_state_clear - clear state object
268 * @state: atomic state
272 * configuration. Which means that all the state assembled in @state is no
273 * longer an atomic update to the current state, but to some arbitrary earlier
274 * state. Which could break assumptions the driver's
277 * Hence we must clear all cached state and completely start over, using this
280 void drm_atomic_state_clear(struct drm_atomic_state *state) in drm_atomic_state_clear() argument
282 struct drm_device *dev = state->dev; in drm_atomic_state_clear()
283 struct drm_mode_config *config = &dev->mode_config; in drm_atomic_state_clear()
285 if (config->funcs->atomic_state_clear) in drm_atomic_state_clear()
286 config->funcs->atomic_state_clear(state); in drm_atomic_state_clear()
288 drm_atomic_state_default_clear(state); in drm_atomic_state_clear()
293 * __drm_atomic_state_free - free all memory for an atomic state
294 * @ref: This atomic state to deallocate
296 * This frees all memory associated with an atomic state, including all the
297 * per-object state for planes, CRTCs and connectors.
301 struct drm_atomic_state *state = container_of(ref, typeof(*state), ref); in __drm_atomic_state_free() local
302 struct drm_mode_config *config = &state->dev->mode_config; in __drm_atomic_state_free()
304 drm_atomic_state_clear(state); in __drm_atomic_state_free()
306 drm_dbg_atomic(state->dev, "Freeing atomic state %p\n", state); in __drm_atomic_state_free()
308 if (config->funcs->atomic_state_free) { in __drm_atomic_state_free()
309 config->funcs->atomic_state_free(state); in __drm_atomic_state_free()
311 drm_atomic_state_default_release(state); in __drm_atomic_state_free()
312 kfree(state); in __drm_atomic_state_free()
318 * drm_atomic_get_crtc_state - get CRTC state
319 * @state: global atomic state object
320 * @crtc: CRTC to get state object for
322 * This function returns the CRTC state for the given CRTC, allocating it if
323 * needed. It will also grab the relevant CRTC lock to make sure that the state
326 * WARNING: Drivers may only add new CRTC states to a @state if
327 * drm_atomic_state.allow_modeset is set, or if it's a driver-internal commit
332 * Either the allocated state or the error code encoded into the pointer. When
337 drm_atomic_get_crtc_state(struct drm_atomic_state *state, in drm_atomic_get_crtc_state() argument
343 WARN_ON(!state->acquire_ctx); in drm_atomic_get_crtc_state()
345 crtc_state = drm_atomic_get_existing_crtc_state(state, crtc); in drm_atomic_get_crtc_state()
349 ret = drm_modeset_lock(&crtc->mutex, state->acquire_ctx); in drm_atomic_get_crtc_state()
353 crtc_state = crtc->funcs->atomic_duplicate_state(crtc); in drm_atomic_get_crtc_state()
355 return ERR_PTR(-ENOMEM); in drm_atomic_get_crtc_state()
357 state->crtcs[index].state = crtc_state; in drm_atomic_get_crtc_state()
358 state->crtcs[index].old_state = crtc->state; in drm_atomic_get_crtc_state()
359 state->crtcs[index].new_state = crtc_state; in drm_atomic_get_crtc_state()
360 state->crtcs[index].ptr = crtc; in drm_atomic_get_crtc_state()
361 crtc_state->state = state; in drm_atomic_get_crtc_state()
363 drm_dbg_atomic(state->dev, "Added [CRTC:%d:%s] %p state to %p\n", in drm_atomic_get_crtc_state()
364 crtc->base.id, crtc->name, crtc_state, state); in drm_atomic_get_crtc_state()
373 struct drm_crtc *crtc = new_crtc_state->crtc; in drm_atomic_crtc_check()
378 * should be checked in driver's crtc->atomic_check() vfunc. in drm_atomic_crtc_check()
380 * TODO: Add generic modeset state checks once we support those. in drm_atomic_crtc_check()
383 if (new_crtc_state->active && !new_crtc_state->enable) { in drm_atomic_crtc_check()
384 drm_dbg_atomic(crtc->dev, in drm_atomic_crtc_check()
386 crtc->base.id, crtc->name); in drm_atomic_crtc_check()
387 return -EINVAL; in drm_atomic_crtc_check()
390 /* The state->enable vs. state->mode_blob checks can be WARN_ON, in drm_atomic_crtc_check()
391 * as this is a kernel-internal detail that userspace should never in drm_atomic_crtc_check()
394 if (drm_core_check_feature(crtc->dev, DRIVER_ATOMIC) && in drm_atomic_crtc_check()
395 WARN_ON(new_crtc_state->enable && !new_crtc_state->mode_blob)) { in drm_atomic_crtc_check()
396 drm_dbg_atomic(crtc->dev, in drm_atomic_crtc_check()
398 crtc->base.id, crtc->name); in drm_atomic_crtc_check()
399 return -EINVAL; in drm_atomic_crtc_check()
402 if (drm_core_check_feature(crtc->dev, DRIVER_ATOMIC) && in drm_atomic_crtc_check()
403 WARN_ON(!new_crtc_state->enable && new_crtc_state->mode_blob)) { in drm_atomic_crtc_check()
404 drm_dbg_atomic(crtc->dev, in drm_atomic_crtc_check()
406 crtc->base.id, crtc->name); in drm_atomic_crtc_check()
407 return -EINVAL; in drm_atomic_crtc_check()
420 if (new_crtc_state->event && in drm_atomic_crtc_check()
421 !new_crtc_state->active && !old_crtc_state->active) { in drm_atomic_crtc_check()
422 drm_dbg_atomic(crtc->dev, in drm_atomic_crtc_check()
424 crtc->base.id, crtc->name); in drm_atomic_crtc_check()
425 return -EINVAL; in drm_atomic_crtc_check()
432 const struct drm_crtc_state *state) in drm_atomic_crtc_print_state() argument
434 struct drm_crtc *crtc = state->crtc; in drm_atomic_crtc_print_state()
436 drm_printf(p, "crtc[%u]: %s\n", crtc->base.id, crtc->name); in drm_atomic_crtc_print_state()
437 drm_printf(p, "\tenable=%d\n", state->enable); in drm_atomic_crtc_print_state()
438 drm_printf(p, "\tactive=%d\n", state->active); in drm_atomic_crtc_print_state()
439 drm_printf(p, "\tself_refresh_active=%d\n", state->self_refresh_active); in drm_atomic_crtc_print_state()
440 drm_printf(p, "\tplanes_changed=%d\n", state->planes_changed); in drm_atomic_crtc_print_state()
441 drm_printf(p, "\tmode_changed=%d\n", state->mode_changed); in drm_atomic_crtc_print_state()
442 drm_printf(p, "\tactive_changed=%d\n", state->active_changed); in drm_atomic_crtc_print_state()
443 drm_printf(p, "\tconnectors_changed=%d\n", state->connectors_changed); in drm_atomic_crtc_print_state()
444 drm_printf(p, "\tcolor_mgmt_changed=%d\n", state->color_mgmt_changed); in drm_atomic_crtc_print_state()
445 drm_printf(p, "\tplane_mask=%x\n", state->plane_mask); in drm_atomic_crtc_print_state()
446 drm_printf(p, "\tconnector_mask=%x\n", state->connector_mask); in drm_atomic_crtc_print_state()
447 drm_printf(p, "\tencoder_mask=%x\n", state->encoder_mask); in drm_atomic_crtc_print_state()
448 drm_printf(p, "\tmode: " DRM_MODE_FMT "\n", DRM_MODE_ARG(&state->mode)); in drm_atomic_crtc_print_state()
450 if (crtc->funcs->atomic_print_state) in drm_atomic_crtc_print_state()
451 crtc->funcs->atomic_print_state(p, state); in drm_atomic_crtc_print_state()
455 struct drm_connector_state *state) in drm_atomic_connector_check() argument
458 struct drm_writeback_job *writeback_job = state->writeback_job; in drm_atomic_connector_check()
459 const struct drm_display_info *info = &connector->display_info; in drm_atomic_connector_check()
461 state->max_bpc = info->bpc ? info->bpc : 8; in drm_atomic_connector_check()
462 if (connector->max_bpc_property) in drm_atomic_connector_check()
463 state->max_bpc = min(state->max_bpc, state->max_requested_bpc); in drm_atomic_connector_check()
465 if ((connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK) || !writeback_job) in drm_atomic_connector_check()
468 if (writeback_job->fb && !state->crtc) { in drm_atomic_connector_check()
469 drm_dbg_atomic(connector->dev, in drm_atomic_connector_check()
471 connector->base.id, connector->name); in drm_atomic_connector_check()
472 return -EINVAL; in drm_atomic_connector_check()
475 if (state->crtc) in drm_atomic_connector_check()
476 crtc_state = drm_atomic_get_existing_crtc_state(state->state, in drm_atomic_connector_check()
477 state->crtc); in drm_atomic_connector_check()
479 if (writeback_job->fb && !crtc_state->active) { in drm_atomic_connector_check()
480 drm_dbg_atomic(connector->dev, in drm_atomic_connector_check()
482 connector->base.id, connector->name, in drm_atomic_connector_check()
483 state->crtc->base.id); in drm_atomic_connector_check()
484 return -EINVAL; in drm_atomic_connector_check()
487 if (!writeback_job->fb) { in drm_atomic_connector_check()
488 if (writeback_job->out_fence) { in drm_atomic_connector_check()
489 drm_dbg_atomic(connector->dev, in drm_atomic_connector_check()
490 "[CONNECTOR:%d:%s] requesting out-fence without framebuffer\n", in drm_atomic_connector_check()
491 connector->base.id, connector->name); in drm_atomic_connector_check()
492 return -EINVAL; in drm_atomic_connector_check()
496 state->writeback_job = NULL; in drm_atomic_connector_check()
503 * drm_atomic_get_plane_state - get plane state
504 * @state: global atomic state object
505 * @plane: plane to get state object for
507 * This function returns the plane state for the given plane, allocating it if
508 * needed. It will also grab the relevant plane lock to make sure that the state
513 * Either the allocated state or the error code encoded into the pointer. When
518 drm_atomic_get_plane_state(struct drm_atomic_state *state, in drm_atomic_get_plane_state() argument
524 WARN_ON(!state->acquire_ctx); in drm_atomic_get_plane_state()
527 WARN_ON(plane->fb); in drm_atomic_get_plane_state()
528 WARN_ON(plane->old_fb); in drm_atomic_get_plane_state()
529 WARN_ON(plane->crtc); in drm_atomic_get_plane_state()
531 plane_state = drm_atomic_get_existing_plane_state(state, plane); in drm_atomic_get_plane_state()
535 ret = drm_modeset_lock(&plane->mutex, state->acquire_ctx); in drm_atomic_get_plane_state()
539 plane_state = plane->funcs->atomic_duplicate_state(plane); in drm_atomic_get_plane_state()
541 return ERR_PTR(-ENOMEM); in drm_atomic_get_plane_state()
543 state->planes[index].state = plane_state; in drm_atomic_get_plane_state()
544 state->planes[index].ptr = plane; in drm_atomic_get_plane_state()
545 state->planes[index].old_state = plane->state; in drm_atomic_get_plane_state()
546 state->planes[index].new_state = plane_state; in drm_atomic_get_plane_state()
547 plane_state->state = state; in drm_atomic_get_plane_state()
549 drm_dbg_atomic(plane->dev, "Added [PLANE:%d:%s] %p state to %p\n", in drm_atomic_get_plane_state()
550 plane->base.id, plane->name, plane_state, state); in drm_atomic_get_plane_state()
552 if (plane_state->crtc) { in drm_atomic_get_plane_state()
555 crtc_state = drm_atomic_get_crtc_state(state, in drm_atomic_get_plane_state()
556 plane_state->crtc); in drm_atomic_get_plane_state()
569 if (!old_plane_state->crtc || !new_plane_state->crtc) in plane_switching_crtc()
572 if (old_plane_state->crtc == new_plane_state->crtc) in plane_switching_crtc()
578 * full OFF state. in plane_switching_crtc()
584 * drm_atomic_plane_check - check plane state
585 * @old_plane_state: old plane state to check
586 * @new_plane_state: new plane state to check
588 * Provides core sanity checks for plane state.
596 struct drm_plane *plane = new_plane_state->plane; in drm_atomic_plane_check()
597 struct drm_crtc *crtc = new_plane_state->crtc; in drm_atomic_plane_check()
598 const struct drm_framebuffer *fb = new_plane_state->fb; in drm_atomic_plane_check()
606 drm_dbg_atomic(plane->dev, "[PLANE:%d:%s] CRTC set but no FB\n", in drm_atomic_plane_check()
607 plane->base.id, plane->name); in drm_atomic_plane_check()
608 return -EINVAL; in drm_atomic_plane_check()
610 drm_dbg_atomic(plane->dev, "[PLANE:%d:%s] FB set but no CRTC\n", in drm_atomic_plane_check()
611 plane->base.id, plane->name); in drm_atomic_plane_check()
612 return -EINVAL; in drm_atomic_plane_check()
615 /* if disabled, we don't care about the rest of the state: */ in drm_atomic_plane_check()
620 if (!(plane->possible_crtcs & drm_crtc_mask(crtc))) { in drm_atomic_plane_check()
621 drm_dbg_atomic(plane->dev, in drm_atomic_plane_check()
623 crtc->base.id, crtc->name, in drm_atomic_plane_check()
624 plane->base.id, plane->name); in drm_atomic_plane_check()
625 return -EINVAL; in drm_atomic_plane_check()
629 ret = drm_plane_check_pixel_format(plane, fb->format->format, in drm_atomic_plane_check()
630 fb->modifier); in drm_atomic_plane_check()
632 drm_dbg_atomic(plane->dev, in drm_atomic_plane_check()
634 plane->base.id, plane->name, in drm_atomic_plane_check()
635 &fb->format->format, fb->modifier); in drm_atomic_plane_check()
640 if (new_plane_state->crtc_w > INT_MAX || in drm_atomic_plane_check()
641 new_plane_state->crtc_x > INT_MAX - (int32_t) new_plane_state->crtc_w || in drm_atomic_plane_check()
642 new_plane_state->crtc_h > INT_MAX || in drm_atomic_plane_check()
643 new_plane_state->crtc_y > INT_MAX - (int32_t) new_plane_state->crtc_h) { in drm_atomic_plane_check()
644 drm_dbg_atomic(plane->dev, in drm_atomic_plane_check()
646 plane->base.id, plane->name, in drm_atomic_plane_check()
647 new_plane_state->crtc_w, new_plane_state->crtc_h, in drm_atomic_plane_check()
648 new_plane_state->crtc_x, new_plane_state->crtc_y); in drm_atomic_plane_check()
649 return -ERANGE; in drm_atomic_plane_check()
652 fb_width = fb->width << 16; in drm_atomic_plane_check()
653 fb_height = fb->height << 16; in drm_atomic_plane_check()
656 if (new_plane_state->src_w > fb_width || in drm_atomic_plane_check()
657 new_plane_state->src_x > fb_width - new_plane_state->src_w || in drm_atomic_plane_check()
658 new_plane_state->src_h > fb_height || in drm_atomic_plane_check()
659 new_plane_state->src_y > fb_height - new_plane_state->src_h) { in drm_atomic_plane_check()
660 drm_dbg_atomic(plane->dev, in drm_atomic_plane_check()
663 plane->base.id, plane->name, in drm_atomic_plane_check()
664 new_plane_state->src_w >> 16, in drm_atomic_plane_check()
665 ((new_plane_state->src_w & 0xffff) * 15625) >> 10, in drm_atomic_plane_check()
666 new_plane_state->src_h >> 16, in drm_atomic_plane_check()
667 ((new_plane_state->src_h & 0xffff) * 15625) >> 10, in drm_atomic_plane_check()
668 new_plane_state->src_x >> 16, in drm_atomic_plane_check()
669 ((new_plane_state->src_x & 0xffff) * 15625) >> 10, in drm_atomic_plane_check()
670 new_plane_state->src_y >> 16, in drm_atomic_plane_check()
671 ((new_plane_state->src_y & 0xffff) * 15625) >> 10, in drm_atomic_plane_check()
672 fb->width, fb->height); in drm_atomic_plane_check()
673 return -ENOSPC; in drm_atomic_plane_check()
681 if (clips->x1 >= clips->x2 || in drm_atomic_plane_check()
682 clips->y1 >= clips->y2 || in drm_atomic_plane_check()
683 clips->x1 < 0 || in drm_atomic_plane_check()
684 clips->y1 < 0 || in drm_atomic_plane_check()
685 clips->x2 > fb_width || in drm_atomic_plane_check()
686 clips->y2 > fb_height) { in drm_atomic_plane_check()
687 drm_dbg_atomic(plane->dev, in drm_atomic_plane_check()
689 plane->base.id, plane->name, clips->x1, in drm_atomic_plane_check()
690 clips->y1, clips->x2, clips->y2); in drm_atomic_plane_check()
691 return -EINVAL; in drm_atomic_plane_check()
694 num_clips--; in drm_atomic_plane_check()
698 drm_dbg_atomic(plane->dev, in drm_atomic_plane_check()
700 plane->base.id, plane->name); in drm_atomic_plane_check()
701 return -EINVAL; in drm_atomic_plane_check()
708 const struct drm_plane_state *state) in drm_atomic_plane_print_state() argument
710 struct drm_plane *plane = state->plane; in drm_atomic_plane_print_state()
711 struct drm_rect src = drm_plane_state_src(state); in drm_atomic_plane_print_state()
712 struct drm_rect dest = drm_plane_state_dest(state); in drm_atomic_plane_print_state()
714 drm_printf(p, "plane[%u]: %s\n", plane->base.id, plane->name); in drm_atomic_plane_print_state()
715 drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)"); in drm_atomic_plane_print_state()
716 drm_printf(p, "\tfb=%u\n", state->fb ? state->fb->base.id : 0); in drm_atomic_plane_print_state()
717 if (state->fb) in drm_atomic_plane_print_state()
718 drm_framebuffer_print_info(p, 2, state->fb); in drm_atomic_plane_print_state()
719 drm_printf(p, "\tcrtc-pos=" DRM_RECT_FMT "\n", DRM_RECT_ARG(&dest)); in drm_atomic_plane_print_state()
720 drm_printf(p, "\tsrc-pos=" DRM_RECT_FP_FMT "\n", DRM_RECT_FP_ARG(&src)); in drm_atomic_plane_print_state()
721 drm_printf(p, "\trotation=%x\n", state->rotation); in drm_atomic_plane_print_state()
722 drm_printf(p, "\tnormalized-zpos=%x\n", state->normalized_zpos); in drm_atomic_plane_print_state()
723 drm_printf(p, "\tcolor-encoding=%s\n", in drm_atomic_plane_print_state()
724 drm_get_color_encoding_name(state->color_encoding)); in drm_atomic_plane_print_state()
725 drm_printf(p, "\tcolor-range=%s\n", in drm_atomic_plane_print_state()
726 drm_get_color_range_name(state->color_range)); in drm_atomic_plane_print_state()
728 if (plane->funcs->atomic_print_state) in drm_atomic_plane_print_state()
729 plane->funcs->atomic_print_state(p, state); in drm_atomic_plane_print_state()
733 * DOC: handling driver private state
740 * objects. Drivers then need to do similar state tracking and commit ordering for
745 * driver private state objects using struct &drm_private_obj, with the
746 * associated state struct &drm_private_state.
748 * Similar to userspace-exposed objects, private state structures can be
751 * directly. Sequence of the actual hardware state commit is not handled,
756 * All private state structures contained in a &drm_atomic_state update can be
759 * Drivers are recommended to wrap these for each type of driver private state
763 * An earlier way to handle driver private state was by subclassing struct
764 * &drm_atomic_state. But since that encourages non-standard ways to implement
766 * commit instead" of "duplicate state, check, then either commit or release
767 * duplicated state) it is deprecated in favour of using &drm_private_state.
771 * drm_atomic_private_obj_init - initialize private object
774 * @state: initial private object state
779 * driver private object that needs its own atomic state.
784 struct drm_private_state *state, in drm_atomic_private_obj_init() argument
789 drm_modeset_lock_init(&obj->lock); in drm_atomic_private_obj_init()
791 obj->state = state; in drm_atomic_private_obj_init()
792 obj->funcs = funcs; in drm_atomic_private_obj_init()
793 list_add_tail(&obj->head, &dev->mode_config.privobj_list); in drm_atomic_private_obj_init()
795 state->obj = obj; in drm_atomic_private_obj_init()
800 * drm_atomic_private_obj_fini - finalize private object
808 list_del(&obj->head); in drm_atomic_private_obj_fini()
809 obj->funcs->atomic_destroy_state(obj, obj->state); in drm_atomic_private_obj_fini()
810 drm_modeset_lock_fini(&obj->lock); in drm_atomic_private_obj_fini()
815 * drm_atomic_get_private_obj_state - get private object state
816 * @state: global atomic state
817 * @obj: private object to get the state for
819 * This function returns the private object state for the given private object,
820 * allocating the state if needed. It will also grab the relevant private
821 * object lock to make sure that the state is consistent.
825 * Either the allocated state or the error code encoded into a pointer.
828 drm_atomic_get_private_obj_state(struct drm_atomic_state *state, in drm_atomic_get_private_obj_state() argument
836 for (i = 0; i < state->num_private_objs; i++) in drm_atomic_get_private_obj_state()
837 if (obj == state->private_objs[i].ptr) in drm_atomic_get_private_obj_state()
838 return state->private_objs[i].state; in drm_atomic_get_private_obj_state()
840 ret = drm_modeset_lock(&obj->lock, state->acquire_ctx); in drm_atomic_get_private_obj_state()
844 num_objs = state->num_private_objs + 1; in drm_atomic_get_private_obj_state()
845 size = sizeof(*state->private_objs) * num_objs; in drm_atomic_get_private_obj_state()
846 arr = krealloc(state->private_objs, size, GFP_KERNEL); in drm_atomic_get_private_obj_state()
848 return ERR_PTR(-ENOMEM); in drm_atomic_get_private_obj_state()
850 state->private_objs = arr; in drm_atomic_get_private_obj_state()
851 index = state->num_private_objs; in drm_atomic_get_private_obj_state()
852 memset(&state->private_objs[index], 0, sizeof(*state->private_objs)); in drm_atomic_get_private_obj_state()
854 obj_state = obj->funcs->atomic_duplicate_state(obj); in drm_atomic_get_private_obj_state()
856 return ERR_PTR(-ENOMEM); in drm_atomic_get_private_obj_state()
858 state->private_objs[index].state = obj_state; in drm_atomic_get_private_obj_state()
859 state->private_objs[index].old_state = obj->state; in drm_atomic_get_private_obj_state()
860 state->private_objs[index].new_state = obj_state; in drm_atomic_get_private_obj_state()
861 state->private_objs[index].ptr = obj; in drm_atomic_get_private_obj_state()
862 obj_state->state = state; in drm_atomic_get_private_obj_state()
864 state->num_private_objs = num_objs; in drm_atomic_get_private_obj_state()
866 drm_dbg_atomic(state->dev, in drm_atomic_get_private_obj_state()
867 "Added new private object %p state %p to %p\n", in drm_atomic_get_private_obj_state()
868 obj, obj_state, state); in drm_atomic_get_private_obj_state()
876 * @state: global atomic state object
879 * This function returns the old private object state for the given private_obj,
880 * or NULL if the private_obj is not part of the global atomic state.
883 drm_atomic_get_old_private_obj_state(struct drm_atomic_state *state, in drm_atomic_get_old_private_obj_state() argument
888 for (i = 0; i < state->num_private_objs; i++) in drm_atomic_get_old_private_obj_state()
889 if (obj == state->private_objs[i].ptr) in drm_atomic_get_old_private_obj_state()
890 return state->private_objs[i].old_state; in drm_atomic_get_old_private_obj_state()
898 * @state: global atomic state object
901 * This function returns the new private object state for the given private_obj,
902 * or NULL if the private_obj is not part of the global atomic state.
905 drm_atomic_get_new_private_obj_state(struct drm_atomic_state *state, in drm_atomic_get_new_private_obj_state() argument
910 for (i = 0; i < state->num_private_objs; i++) in drm_atomic_get_new_private_obj_state()
911 if (obj == state->private_objs[i].ptr) in drm_atomic_get_new_private_obj_state()
912 return state->private_objs[i].new_state; in drm_atomic_get_new_private_obj_state()
919 * drm_atomic_get_old_connector_for_encoder - Get old connector for an encoder
920 * @state: Atomic state
921 * @encoder: The encoder to fetch the connector state for
924 * as specified by the @state.
926 * If there is no connector in @state which previously had @encoder connected to
930 * state). This is especially true in enable hooks because the pipeline has
937 drm_atomic_get_old_connector_for_encoder(struct drm_atomic_state *state, in drm_atomic_get_old_connector_for_encoder() argument
944 for_each_old_connector_in_state(state, connector, conn_state, i) { in drm_atomic_get_old_connector_for_encoder()
945 if (conn_state->best_encoder == encoder) in drm_atomic_get_old_connector_for_encoder()
954 * drm_atomic_get_new_connector_for_encoder - Get new connector for an encoder
955 * @state: Atomic state
956 * @encoder: The encoder to fetch the connector state for
959 * @encoder as specified by the @state.
961 * If there is no connector in @state which will have @encoder connected to it,
964 * attached to @encoder vs ones that do (and to inspect their state). This is
971 drm_atomic_get_new_connector_for_encoder(struct drm_atomic_state *state, in drm_atomic_get_new_connector_for_encoder() argument
978 for_each_new_connector_in_state(state, connector, conn_state, i) { in drm_atomic_get_new_connector_for_encoder()
979 if (conn_state->best_encoder == encoder) in drm_atomic_get_new_connector_for_encoder()
988 * drm_atomic_get_connector_state - get connector state
989 * @state: global atomic state object
990 * @connector: connector to get state object for
992 * This function returns the connector state for the given connector,
994 * make sure that the state is consistent.
998 * Either the allocated state or the error code encoded into the pointer. When
1003 drm_atomic_get_connector_state(struct drm_atomic_state *state, in drm_atomic_get_connector_state() argument
1007 struct drm_mode_config *config = &connector->dev->mode_config; in drm_atomic_get_connector_state()
1010 WARN_ON(!state->acquire_ctx); in drm_atomic_get_connector_state()
1012 ret = drm_modeset_lock(&config->connection_mutex, state->acquire_ctx); in drm_atomic_get_connector_state()
1018 if (index >= state->num_connector) { in drm_atomic_get_connector_state()
1020 int alloc = max(index + 1, config->num_connector); in drm_atomic_get_connector_state()
1022 c = krealloc_array(state->connectors, alloc, in drm_atomic_get_connector_state()
1023 sizeof(*state->connectors), GFP_KERNEL); in drm_atomic_get_connector_state()
1025 return ERR_PTR(-ENOMEM); in drm_atomic_get_connector_state()
1027 state->connectors = c; in drm_atomic_get_connector_state()
1028 memset(&state->connectors[state->num_connector], 0, in drm_atomic_get_connector_state()
1029 sizeof(*state->connectors) * (alloc - state->num_connector)); in drm_atomic_get_connector_state()
1031 state->num_connector = alloc; in drm_atomic_get_connector_state()
1034 if (state->connectors[index].state) in drm_atomic_get_connector_state()
1035 return state->connectors[index].state; in drm_atomic_get_connector_state()
1037 connector_state = connector->funcs->atomic_duplicate_state(connector); in drm_atomic_get_connector_state()
1039 return ERR_PTR(-ENOMEM); in drm_atomic_get_connector_state()
1042 state->connectors[index].state = connector_state; in drm_atomic_get_connector_state()
1043 state->connectors[index].old_state = connector->state; in drm_atomic_get_connector_state()
1044 state->connectors[index].new_state = connector_state; in drm_atomic_get_connector_state()
1045 state->connectors[index].ptr = connector; in drm_atomic_get_connector_state()
1046 connector_state->state = state; in drm_atomic_get_connector_state()
1048 drm_dbg_atomic(connector->dev, "Added [CONNECTOR:%d:%s] %p state to %p\n", in drm_atomic_get_connector_state()
1049 connector->base.id, connector->name, in drm_atomic_get_connector_state()
1050 connector_state, state); in drm_atomic_get_connector_state()
1052 if (connector_state->crtc) { in drm_atomic_get_connector_state()
1055 crtc_state = drm_atomic_get_crtc_state(state, in drm_atomic_get_connector_state()
1056 connector_state->crtc); in drm_atomic_get_connector_state()
1066 const struct drm_connector_state *state) in drm_atomic_connector_print_state() argument
1068 struct drm_connector *connector = state->connector; in drm_atomic_connector_print_state()
1070 drm_printf(p, "connector[%u]: %s\n", connector->base.id, connector->name); in drm_atomic_connector_print_state()
1071 drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)"); in drm_atomic_connector_print_state()
1072 drm_printf(p, "\tself_refresh_aware=%d\n", state->self_refresh_aware); in drm_atomic_connector_print_state()
1074 if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK) in drm_atomic_connector_print_state()
1075 if (state->writeback_job && state->writeback_job->fb) in drm_atomic_connector_print_state()
1076 drm_printf(p, "\tfb=%d\n", state->writeback_job->fb->base.id); in drm_atomic_connector_print_state()
1078 if (connector->funcs->atomic_print_state) in drm_atomic_connector_print_state()
1079 connector->funcs->atomic_print_state(p, state); in drm_atomic_connector_print_state()
1083 * drm_atomic_get_bridge_state - get bridge state
1084 * @state: global atomic state object
1085 * @bridge: bridge to get state object for
1087 * This function returns the bridge state for the given bridge, allocating it
1089 * state is consistent.
1093 * Either the allocated state or the error code encoded into the pointer. When
1098 drm_atomic_get_bridge_state(struct drm_atomic_state *state, in drm_atomic_get_bridge_state() argument
1103 obj_state = drm_atomic_get_private_obj_state(state, &bridge->base); in drm_atomic_get_bridge_state()
1112 * drm_atomic_get_old_bridge_state - get old bridge state, if it exists
1113 * @state: global atomic state object
1116 * This function returns the old bridge state for the given bridge, or NULL if
1117 * the bridge is not part of the global atomic state.
1120 drm_atomic_get_old_bridge_state(struct drm_atomic_state *state, in drm_atomic_get_old_bridge_state() argument
1125 obj_state = drm_atomic_get_old_private_obj_state(state, &bridge->base); in drm_atomic_get_old_bridge_state()
1134 * drm_atomic_get_new_bridge_state - get new bridge state, if it exists
1135 * @state: global atomic state object
1138 * This function returns the new bridge state for the given bridge, or NULL if
1139 * the bridge is not part of the global atomic state.
1142 drm_atomic_get_new_bridge_state(struct drm_atomic_state *state, in drm_atomic_get_new_bridge_state() argument
1147 obj_state = drm_atomic_get_new_private_obj_state(state, &bridge->base); in drm_atomic_get_new_bridge_state()
1156 * drm_atomic_add_encoder_bridges - add bridges attached to an encoder
1157 * @state: atomic state
1161 * bridge states to @state and make them available when
1167 * 0 on success or can fail with -EDEADLK or -ENOMEM. When the error is EDEADLK
1172 drm_atomic_add_encoder_bridges(struct drm_atomic_state *state, in drm_atomic_add_encoder_bridges() argument
1181 drm_dbg_atomic(encoder->dev, in drm_atomic_add_encoder_bridges()
1183 encoder->base.id, encoder->name, state); in drm_atomic_add_encoder_bridges()
1186 /* Skip bridges that don't implement the atomic state hooks. */ in drm_atomic_add_encoder_bridges()
1187 if (!bridge->funcs->atomic_duplicate_state) in drm_atomic_add_encoder_bridges()
1190 bridge_state = drm_atomic_get_bridge_state(state, bridge); in drm_atomic_add_encoder_bridges()
1200 * drm_atomic_add_affected_connectors - add connectors for CRTC
1201 * @state: atomic state
1205 * currently using @crtc to the atomic configuration @state. Note that this
1212 * 0 on success or can fail with -EDEADLK or -ENOMEM. When the error is EDEADLK
1217 drm_atomic_add_affected_connectors(struct drm_atomic_state *state, in drm_atomic_add_affected_connectors() argument
1220 struct drm_mode_config *config = &state->dev->mode_config; in drm_atomic_add_affected_connectors()
1227 crtc_state = drm_atomic_get_crtc_state(state, crtc); in drm_atomic_add_affected_connectors()
1231 ret = drm_modeset_lock(&config->connection_mutex, state->acquire_ctx); in drm_atomic_add_affected_connectors()
1235 drm_dbg_atomic(crtc->dev, in drm_atomic_add_affected_connectors()
1237 crtc->base.id, crtc->name, state); in drm_atomic_add_affected_connectors()
1240 * Changed connectors are already in @state, so only need to look in drm_atomic_add_affected_connectors()
1243 drm_connector_list_iter_begin(state->dev, &conn_iter); in drm_atomic_add_affected_connectors()
1245 if (!(crtc_state->connector_mask & drm_connector_mask(connector))) in drm_atomic_add_affected_connectors()
1248 conn_state = drm_atomic_get_connector_state(state, connector); in drm_atomic_add_affected_connectors()
1261 * drm_atomic_add_affected_planes - add planes for CRTC
1262 * @state: atomic state
1266 * currently used by @crtc to the atomic configuration @state. This is useful
1268 * @crtc, e.g. when changing the mode. It's also useful when re-enabling a CRTC
1269 * to avoid special code to force-enable all planes.
1271 * Since acquiring a plane state will always also acquire the w/w mutex of the
1276 * 0 on success or can fail with -EDEADLK or -ENOMEM. When the error is EDEADLK
1281 drm_atomic_add_affected_planes(struct drm_atomic_state *state, in drm_atomic_add_affected_planes() argument
1285 drm_atomic_get_old_crtc_state(state, crtc); in drm_atomic_add_affected_planes()
1288 WARN_ON(!drm_atomic_get_new_crtc_state(state, crtc)); in drm_atomic_add_affected_planes()
1290 drm_dbg_atomic(crtc->dev, in drm_atomic_add_affected_planes()
1292 crtc->base.id, crtc->name, state); in drm_atomic_add_affected_planes()
1294 drm_for_each_plane_mask(plane, state->dev, old_crtc_state->plane_mask) { in drm_atomic_add_affected_planes()
1296 drm_atomic_get_plane_state(state, plane); in drm_atomic_add_affected_planes()
1306 * drm_atomic_check_only - check whether a given config would work
1307 * @state: atomic configuration to check
1309 * Note that this function can return -EDEADLK if the driver needed to acquire
1316 int drm_atomic_check_only(struct drm_atomic_state *state) in drm_atomic_check_only() argument
1318 struct drm_device *dev = state->dev; in drm_atomic_check_only()
1319 struct drm_mode_config *config = &dev->mode_config; in drm_atomic_check_only()
1332 drm_dbg_atomic(dev, "checking %p\n", state); in drm_atomic_check_only()
1334 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in drm_atomic_check_only()
1335 if (new_crtc_state->enable) in drm_atomic_check_only()
1339 for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { in drm_atomic_check_only()
1343 plane->base.id, plane->name); in drm_atomic_check_only()
1348 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_check_only()
1352 crtc->base.id, crtc->name); in drm_atomic_check_only()
1357 for_each_new_connector_in_state(state, conn, conn_state, i) { in drm_atomic_check_only()
1361 conn->base.id, conn->name); in drm_atomic_check_only()
1366 if (config->funcs->atomic_check) { in drm_atomic_check_only()
1367 ret = config->funcs->atomic_check(state->dev, state); in drm_atomic_check_only()
1371 state, ret); in drm_atomic_check_only()
1376 if (!state->allow_modeset) { in drm_atomic_check_only()
1377 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in drm_atomic_check_only()
1380 crtc->base.id, crtc->name); in drm_atomic_check_only()
1381 return -EINVAL; in drm_atomic_check_only()
1386 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in drm_atomic_check_only()
1387 if (new_crtc_state->enable) in drm_atomic_check_only()
1405 …WARN(!state->allow_modeset, "adding CRTC not allowed without modesets: requested 0x%x, affected 0x… in drm_atomic_check_only()
1414 * drm_atomic_commit - commit configuration atomically
1415 * @state: atomic configuration to check
1417 * Note that this function can return -EDEADLK if the driver needed to acquire
1421 * This function will take its own reference on @state.
1427 int drm_atomic_commit(struct drm_atomic_state *state) in drm_atomic_commit() argument
1429 struct drm_mode_config *config = &state->dev->mode_config; in drm_atomic_commit()
1430 struct drm_printer p = drm_info_printer(state->dev->dev); in drm_atomic_commit()
1434 drm_atomic_print_new_state(state, &p); in drm_atomic_commit()
1436 ret = drm_atomic_check_only(state); in drm_atomic_commit()
1440 drm_dbg_atomic(state->dev, "committing %p\n", state); in drm_atomic_commit()
1442 return config->funcs->atomic_commit(state->dev, state, false); in drm_atomic_commit()
1447 * drm_atomic_nonblocking_commit - atomic nonblocking commit
1448 * @state: atomic configuration to check
1450 * Note that this function can return -EDEADLK if the driver needed to acquire
1454 * This function will take its own reference on @state.
1460 int drm_atomic_nonblocking_commit(struct drm_atomic_state *state) in drm_atomic_nonblocking_commit() argument
1462 struct drm_mode_config *config = &state->dev->mode_config; in drm_atomic_nonblocking_commit()
1465 ret = drm_atomic_check_only(state); in drm_atomic_nonblocking_commit()
1469 drm_dbg_atomic(state->dev, "committing %p nonblocking\n", state); in drm_atomic_nonblocking_commit()
1471 return config->funcs->atomic_commit(state->dev, state, true); in drm_atomic_nonblocking_commit()
1475 /* just used from drm-client and atomic-helper: */
1486 plane_state->crtc_x = 0; in __drm_atomic_helper_disable_plane()
1487 plane_state->crtc_y = 0; in __drm_atomic_helper_disable_plane()
1488 plane_state->crtc_w = 0; in __drm_atomic_helper_disable_plane()
1489 plane_state->crtc_h = 0; in __drm_atomic_helper_disable_plane()
1490 plane_state->src_x = 0; in __drm_atomic_helper_disable_plane()
1491 plane_state->src_y = 0; in __drm_atomic_helper_disable_plane()
1492 plane_state->src_w = 0; in __drm_atomic_helper_disable_plane()
1493 plane_state->src_h = 0; in __drm_atomic_helper_disable_plane()
1499 static int update_output_state(struct drm_atomic_state *state, in update_output_state() argument
1502 struct drm_device *dev = set->crtc->dev; in update_output_state()
1509 ret = drm_modeset_lock(&dev->mode_config.connection_mutex, in update_output_state()
1510 state->acquire_ctx); in update_output_state()
1515 ret = drm_atomic_add_affected_connectors(state, set->crtc); in update_output_state()
1519 for_each_new_connector_in_state(state, connector, new_conn_state, i) { in update_output_state()
1520 if (new_conn_state->crtc == set->crtc) { in update_output_state()
1526 /* Make sure legacy setCrtc always re-trains */ in update_output_state()
1527 new_conn_state->link_status = DRM_LINK_STATUS_GOOD; in update_output_state()
1531 /* Then set all connectors from set->connectors on the target crtc */ in update_output_state()
1532 for (i = 0; i < set->num_connectors; i++) { in update_output_state()
1533 new_conn_state = drm_atomic_get_connector_state(state, in update_output_state()
1534 set->connectors[i]); in update_output_state()
1539 set->crtc); in update_output_state()
1544 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in update_output_state()
1546 * Don't update ->enable for the CRTC in the set_config request, in update_output_state()
1551 if (crtc == set->crtc) in update_output_state()
1554 if (!new_crtc_state->connector_mask) { in update_output_state()
1560 new_crtc_state->active = false; in update_output_state()
1567 /* just used from drm-client and atomic-helper: */
1569 struct drm_atomic_state *state) in __drm_atomic_helper_set_config() argument
1573 struct drm_crtc *crtc = set->crtc; in __drm_atomic_helper_set_config()
1577 crtc_state = drm_atomic_get_crtc_state(state, crtc); in __drm_atomic_helper_set_config()
1581 primary_state = drm_atomic_get_plane_state(state, crtc->primary); in __drm_atomic_helper_set_config()
1585 if (!set->mode) { in __drm_atomic_helper_set_config()
1586 WARN_ON(set->fb); in __drm_atomic_helper_set_config()
1587 WARN_ON(set->num_connectors); in __drm_atomic_helper_set_config()
1593 crtc_state->active = false; in __drm_atomic_helper_set_config()
1604 WARN_ON(!set->fb); in __drm_atomic_helper_set_config()
1605 WARN_ON(!set->num_connectors); in __drm_atomic_helper_set_config()
1607 ret = drm_atomic_set_mode_for_crtc(crtc_state, set->mode); in __drm_atomic_helper_set_config()
1611 crtc_state->active = true; in __drm_atomic_helper_set_config()
1617 drm_mode_get_hv_timing(set->mode, &hdisplay, &vdisplay); in __drm_atomic_helper_set_config()
1619 drm_atomic_set_fb_for_plane(primary_state, set->fb); in __drm_atomic_helper_set_config()
1620 primary_state->crtc_x = 0; in __drm_atomic_helper_set_config()
1621 primary_state->crtc_y = 0; in __drm_atomic_helper_set_config()
1622 primary_state->crtc_w = hdisplay; in __drm_atomic_helper_set_config()
1623 primary_state->crtc_h = vdisplay; in __drm_atomic_helper_set_config()
1624 primary_state->src_x = set->x << 16; in __drm_atomic_helper_set_config()
1625 primary_state->src_y = set->y << 16; in __drm_atomic_helper_set_config()
1626 if (drm_rotation_90_or_270(primary_state->rotation)) { in __drm_atomic_helper_set_config()
1627 primary_state->src_w = vdisplay << 16; in __drm_atomic_helper_set_config()
1628 primary_state->src_h = hdisplay << 16; in __drm_atomic_helper_set_config()
1630 primary_state->src_w = hdisplay << 16; in __drm_atomic_helper_set_config()
1631 primary_state->src_h = vdisplay << 16; in __drm_atomic_helper_set_config()
1635 ret = update_output_state(state, set); in __drm_atomic_helper_set_config()
1644 const struct drm_private_state *state) in drm_atomic_private_obj_print_state() argument
1646 struct drm_private_obj *obj = state->obj; in drm_atomic_private_obj_print_state()
1648 if (obj->funcs->atomic_print_state) in drm_atomic_private_obj_print_state()
1649 obj->funcs->atomic_print_state(p, state); in drm_atomic_private_obj_print_state()
1653 * drm_atomic_print_new_state - prints drm atomic state
1654 * @state: atomic configuration to check
1657 * This functions prints the drm atomic state snapshot using the drm printer
1660 * Note that this function looks into the new state objects and hence its not
1663 void drm_atomic_print_new_state(const struct drm_atomic_state *state, in drm_atomic_print_new_state() argument
1677 drm_err(state->dev, "invalid drm printer\n"); in drm_atomic_print_new_state()
1681 drm_dbg_atomic(state->dev, "checking %p\n", state); in drm_atomic_print_new_state()
1683 for_each_new_plane_in_state(state, plane, plane_state, i) in drm_atomic_print_new_state()
1686 for_each_new_crtc_in_state(state, crtc, crtc_state, i) in drm_atomic_print_new_state()
1689 for_each_new_connector_in_state(state, connector, connector_state, i) in drm_atomic_print_new_state()
1692 for_each_new_private_obj_in_state(state, obj, obj_state, i) in drm_atomic_print_new_state()
1700 struct drm_mode_config *config = &dev->mode_config; in __drm_state_dump()
1709 list_for_each_entry(plane, &config->plane_list, head) { in __drm_state_dump()
1711 drm_modeset_lock(&plane->mutex, NULL); in __drm_state_dump()
1712 drm_atomic_plane_print_state(p, plane->state); in __drm_state_dump()
1714 drm_modeset_unlock(&plane->mutex); in __drm_state_dump()
1717 list_for_each_entry(crtc, &config->crtc_list, head) { in __drm_state_dump()
1719 drm_modeset_lock(&crtc->mutex, NULL); in __drm_state_dump()
1720 drm_atomic_crtc_print_state(p, crtc->state); in __drm_state_dump()
1722 drm_modeset_unlock(&crtc->mutex); in __drm_state_dump()
1727 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); in __drm_state_dump()
1729 drm_atomic_connector_print_state(p, connector->state); in __drm_state_dump()
1731 drm_modeset_unlock(&dev->mode_config.connection_mutex); in __drm_state_dump()
1736 * drm_state_dump - dump entire device atomic state
1738 * @p: where to print the state to
1740 * Just for debugging. Drivers might want an option to dump state
1746 * not be enabled by default - if you are debugging errors you might
1759 struct drm_info_node *node = (struct drm_info_node *) m->private; in drm_state_info()
1760 struct drm_device *dev = node->minor->dev; in drm_state_info()
1770 {"state", drm_state_info, 0},
1777 minor->debugfs_root, minor); in drm_atomic_debugfs_init()