Lines Matching full:state

58  * @state: atomic state
64 void drm_atomic_state_default_release(struct drm_atomic_state *state) in drm_atomic_state_default_release() argument
66 kfree(state->connectors); in drm_atomic_state_default_release()
67 kfree(state->crtcs); in drm_atomic_state_default_release()
68 kfree(state->planes); in drm_atomic_state_default_release()
69 kfree(state->private_objs); in drm_atomic_state_default_release()
74 * drm_atomic_state_init - init new atomic state
76 * @state: atomic state
78 * Default implementation for filling in a new atomic state.
83 drm_atomic_state_init(struct drm_device *dev, struct drm_atomic_state *state) in drm_atomic_state_init() argument
85 kref_init(&state->ref); in drm_atomic_state_init()
90 state->allow_modeset = true; in drm_atomic_state_init()
92 state->crtcs = kcalloc(dev->mode_config.num_crtc, in drm_atomic_state_init()
93 sizeof(*state->crtcs), GFP_KERNEL); in drm_atomic_state_init()
94 if (!state->crtcs) in drm_atomic_state_init()
96 state->planes = kcalloc(dev->mode_config.num_total_plane, in drm_atomic_state_init()
97 sizeof(*state->planes), GFP_KERNEL); in drm_atomic_state_init()
98 if (!state->planes) in drm_atomic_state_init()
101 state->dev = dev; in drm_atomic_state_init()
103 DRM_DEBUG_ATOMIC("Allocated atomic state %p\n", state); in drm_atomic_state_init()
107 drm_atomic_state_default_release(state); in drm_atomic_state_init()
113 * drm_atomic_state_alloc - allocate atomic state
116 * This allocates an empty atomic state to track updates.
124 struct drm_atomic_state *state; in drm_atomic_state_alloc() local
126 state = kzalloc(sizeof(*state), GFP_KERNEL); in drm_atomic_state_alloc()
127 if (!state) in drm_atomic_state_alloc()
129 if (drm_atomic_state_init(dev, state) < 0) { in drm_atomic_state_alloc()
130 kfree(state); in drm_atomic_state_alloc()
133 return state; in drm_atomic_state_alloc()
141 * drm_atomic_state_default_clear - clear base atomic state
142 * @state: atomic state
144 * Default implementation for clearing atomic state.
148 void drm_atomic_state_default_clear(struct drm_atomic_state *state) in drm_atomic_state_default_clear() argument
150 struct drm_device *dev = state->dev; in drm_atomic_state_default_clear()
154 DRM_DEBUG_ATOMIC("Clearing atomic state %p\n", state); in drm_atomic_state_default_clear()
156 for (i = 0; i < state->num_connector; i++) { in drm_atomic_state_default_clear()
157 struct drm_connector *connector = state->connectors[i].ptr; in drm_atomic_state_default_clear()
163 state->connectors[i].state); in drm_atomic_state_default_clear()
164 state->connectors[i].ptr = NULL; in drm_atomic_state_default_clear()
165 state->connectors[i].state = NULL; in drm_atomic_state_default_clear()
166 state->connectors[i].old_state = NULL; in drm_atomic_state_default_clear()
167 state->connectors[i].new_state = NULL; in drm_atomic_state_default_clear()
172 struct drm_crtc *crtc = state->crtcs[i].ptr; in drm_atomic_state_default_clear()
178 state->crtcs[i].state); in drm_atomic_state_default_clear()
180 state->crtcs[i].ptr = NULL; in drm_atomic_state_default_clear()
181 state->crtcs[i].state = NULL; in drm_atomic_state_default_clear()
182 state->crtcs[i].old_state = NULL; in drm_atomic_state_default_clear()
183 state->crtcs[i].new_state = NULL; in drm_atomic_state_default_clear()
185 if (state->crtcs[i].commit) { in drm_atomic_state_default_clear()
186 drm_crtc_commit_put(state->crtcs[i].commit); in drm_atomic_state_default_clear()
187 state->crtcs[i].commit = NULL; in drm_atomic_state_default_clear()
192 struct drm_plane *plane = state->planes[i].ptr; in drm_atomic_state_default_clear()
198 state->planes[i].state); in drm_atomic_state_default_clear()
199 state->planes[i].ptr = NULL; in drm_atomic_state_default_clear()
200 state->planes[i].state = NULL; in drm_atomic_state_default_clear()
201 state->planes[i].old_state = NULL; in drm_atomic_state_default_clear()
202 state->planes[i].new_state = NULL; in drm_atomic_state_default_clear()
205 for (i = 0; i < state->num_private_objs; i++) { in drm_atomic_state_default_clear()
206 struct drm_private_obj *obj = state->private_objs[i].ptr; in drm_atomic_state_default_clear()
209 state->private_objs[i].state); in drm_atomic_state_default_clear()
210 state->private_objs[i].ptr = NULL; in drm_atomic_state_default_clear()
211 state->private_objs[i].state = NULL; in drm_atomic_state_default_clear()
212 state->private_objs[i].old_state = NULL; in drm_atomic_state_default_clear()
213 state->private_objs[i].new_state = NULL; in drm_atomic_state_default_clear()
215 state->num_private_objs = 0; in drm_atomic_state_default_clear()
217 if (state->fake_commit) { in drm_atomic_state_default_clear()
218 drm_crtc_commit_put(state->fake_commit); in drm_atomic_state_default_clear()
219 state->fake_commit = NULL; in drm_atomic_state_default_clear()
225 * drm_atomic_state_clear - clear state object
226 * @state: atomic state
230 * configuration. Which means that all the state assembled in @state is no
231 * longer an atomic update to the current state, but to some arbitrary earlier
232 * state. Which could break assumptions the driver's
235 * Hence we must clear all cached state and completely start over, using this
238 void drm_atomic_state_clear(struct drm_atomic_state *state) in drm_atomic_state_clear() argument
240 struct drm_device *dev = state->dev; in drm_atomic_state_clear()
244 config->funcs->atomic_state_clear(state); in drm_atomic_state_clear()
246 drm_atomic_state_default_clear(state); in drm_atomic_state_clear()
251 * __drm_atomic_state_free - free all memory for an atomic state
252 * @ref: This atomic state to deallocate
254 * This frees all memory associated with an atomic state, including all the
255 * per-object state for planes, CRTCs and connectors.
259 struct drm_atomic_state *state = container_of(ref, typeof(*state), ref); in __drm_atomic_state_free() local
260 struct drm_mode_config *config = &state->dev->mode_config; in __drm_atomic_state_free()
262 drm_atomic_state_clear(state); in __drm_atomic_state_free()
264 DRM_DEBUG_ATOMIC("Freeing atomic state %p\n", state); in __drm_atomic_state_free()
267 config->funcs->atomic_state_free(state); in __drm_atomic_state_free()
269 drm_atomic_state_default_release(state); in __drm_atomic_state_free()
270 kfree(state); in __drm_atomic_state_free()
276 * drm_atomic_get_crtc_state - get CRTC state
277 * @state: global atomic state object
278 * @crtc: CRTC to get state object for
280 * This function returns the CRTC state for the given CRTC, allocating it if
281 * needed. It will also grab the relevant CRTC lock to make sure that the state
286 * Either the allocated state or the error code encoded into the pointer. When
291 drm_atomic_get_crtc_state(struct drm_atomic_state *state, in drm_atomic_get_crtc_state() argument
297 WARN_ON(!state->acquire_ctx); in drm_atomic_get_crtc_state()
299 crtc_state = drm_atomic_get_existing_crtc_state(state, crtc); in drm_atomic_get_crtc_state()
303 ret = drm_modeset_lock(&crtc->mutex, state->acquire_ctx); in drm_atomic_get_crtc_state()
311 state->crtcs[index].state = crtc_state; in drm_atomic_get_crtc_state()
312 state->crtcs[index].old_state = crtc->state; in drm_atomic_get_crtc_state()
313 state->crtcs[index].new_state = crtc_state; in drm_atomic_get_crtc_state()
314 state->crtcs[index].ptr = crtc; in drm_atomic_get_crtc_state()
315 crtc_state->state = state; in drm_atomic_get_crtc_state()
317 DRM_DEBUG_ATOMIC("Added [CRTC:%d:%s] %p state to %p\n", in drm_atomic_get_crtc_state()
318 crtc->base.id, crtc->name, crtc_state, state); in drm_atomic_get_crtc_state()
334 * TODO: Add generic modeset state checks once we support those. in drm_atomic_crtc_check()
343 /* The state->enable vs. state->mode_blob checks can be WARN_ON, in drm_atomic_crtc_check()
381 const struct drm_crtc_state *state) in drm_atomic_crtc_print_state() argument
383 struct drm_crtc *crtc = state->crtc; in drm_atomic_crtc_print_state()
386 drm_printf(p, "\tenable=%d\n", state->enable); in drm_atomic_crtc_print_state()
387 drm_printf(p, "\tactive=%d\n", state->active); in drm_atomic_crtc_print_state()
388 drm_printf(p, "\tself_refresh_active=%d\n", state->self_refresh_active); in drm_atomic_crtc_print_state()
389 drm_printf(p, "\tplanes_changed=%d\n", state->planes_changed); in drm_atomic_crtc_print_state()
390 drm_printf(p, "\tmode_changed=%d\n", state->mode_changed); in drm_atomic_crtc_print_state()
391 drm_printf(p, "\tactive_changed=%d\n", state->active_changed); in drm_atomic_crtc_print_state()
392 drm_printf(p, "\tconnectors_changed=%d\n", state->connectors_changed); in drm_atomic_crtc_print_state()
393 drm_printf(p, "\tcolor_mgmt_changed=%d\n", state->color_mgmt_changed); in drm_atomic_crtc_print_state()
394 drm_printf(p, "\tplane_mask=%x\n", state->plane_mask); in drm_atomic_crtc_print_state()
395 drm_printf(p, "\tconnector_mask=%x\n", state->connector_mask); in drm_atomic_crtc_print_state()
396 drm_printf(p, "\tencoder_mask=%x\n", state->encoder_mask); in drm_atomic_crtc_print_state()
397 drm_printf(p, "\tmode: " DRM_MODE_FMT "\n", DRM_MODE_ARG(&state->mode)); in drm_atomic_crtc_print_state()
400 crtc->funcs->atomic_print_state(p, state); in drm_atomic_crtc_print_state()
404 struct drm_connector_state *state) in drm_atomic_connector_check() argument
407 struct drm_writeback_job *writeback_job = state->writeback_job; in drm_atomic_connector_check()
410 state->max_bpc = info->bpc ? info->bpc : 8; in drm_atomic_connector_check()
412 state->max_bpc = min(state->max_bpc, state->max_requested_bpc); in drm_atomic_connector_check()
417 if (writeback_job->fb && !state->crtc) { in drm_atomic_connector_check()
423 if (state->crtc) in drm_atomic_connector_check()
424 crtc_state = drm_atomic_get_existing_crtc_state(state->state, in drm_atomic_connector_check()
425 state->crtc); in drm_atomic_connector_check()
430 state->crtc->base.id); in drm_atomic_connector_check()
442 state->writeback_job = NULL; in drm_atomic_connector_check()
449 * drm_atomic_get_plane_state - get plane state
450 * @state: global atomic state object
451 * @plane: plane to get state object for
453 * This function returns the plane state for the given plane, allocating it if
454 * needed. It will also grab the relevant plane lock to make sure that the state
459 * Either the allocated state or the error code encoded into the pointer. When
464 drm_atomic_get_plane_state(struct drm_atomic_state *state, in drm_atomic_get_plane_state() argument
470 WARN_ON(!state->acquire_ctx); in drm_atomic_get_plane_state()
477 plane_state = drm_atomic_get_existing_plane_state(state, plane); in drm_atomic_get_plane_state()
481 ret = drm_modeset_lock(&plane->mutex, state->acquire_ctx); in drm_atomic_get_plane_state()
489 state->planes[index].state = plane_state; in drm_atomic_get_plane_state()
490 state->planes[index].ptr = plane; in drm_atomic_get_plane_state()
491 state->planes[index].old_state = plane->state; in drm_atomic_get_plane_state()
492 state->planes[index].new_state = plane_state; in drm_atomic_get_plane_state()
493 plane_state->state = state; in drm_atomic_get_plane_state()
495 DRM_DEBUG_ATOMIC("Added [PLANE:%d:%s] %p state to %p\n", in drm_atomic_get_plane_state()
496 plane->base.id, plane->name, plane_state, state); in drm_atomic_get_plane_state()
501 crtc_state = drm_atomic_get_crtc_state(state, in drm_atomic_get_plane_state()
524 * full OFF state. in plane_switching_crtc()
530 * drm_atomic_plane_check - check plane state
531 * @old_plane_state: old plane state to check
532 * @new_plane_state: new plane state to check
534 * Provides core sanity checks for plane state.
561 /* if disabled, we don't care about the rest of the state: */ in drm_atomic_plane_check()
652 const struct drm_plane_state *state) in drm_atomic_plane_print_state() argument
654 struct drm_plane *plane = state->plane; in drm_atomic_plane_print_state()
655 struct drm_rect src = drm_plane_state_src(state); in drm_atomic_plane_print_state()
656 struct drm_rect dest = drm_plane_state_dest(state); in drm_atomic_plane_print_state()
659 drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)"); in drm_atomic_plane_print_state()
660 drm_printf(p, "\tfb=%u\n", state->fb ? state->fb->base.id : 0); in drm_atomic_plane_print_state()
661 if (state->fb) in drm_atomic_plane_print_state()
662 drm_framebuffer_print_info(p, 2, state->fb); in drm_atomic_plane_print_state()
665 drm_printf(p, "\trotation=%x\n", state->rotation); in drm_atomic_plane_print_state()
666 drm_printf(p, "\tnormalized-zpos=%x\n", state->normalized_zpos); in drm_atomic_plane_print_state()
668 drm_get_color_encoding_name(state->color_encoding)); in drm_atomic_plane_print_state()
670 drm_get_color_range_name(state->color_range)); in drm_atomic_plane_print_state()
673 plane->funcs->atomic_print_state(p, state); in drm_atomic_plane_print_state()
677 * DOC: handling driver private state
684 * objects. Drivers then need to do similar state tracking and commit ordering for
689 * driver private state objects using struct &drm_private_obj, with the
690 * associated state struct &drm_private_state.
692 * Similar to userspace-exposed objects, private state structures can be
695 * directly. Sequence of the actual hardware state commit is not handled,
700 * All private state structures contained in a &drm_atomic_state update can be
703 * Drivers are recommended to wrap these for each type of driver private state
707 * An earlier way to handle driver private state was by subclassing struct
710 * commit instead" of "duplicate state, check, then either commit or release
711 * duplicated state) it is deprecated in favour of using &drm_private_state.
718 * @state: initial private object state
723 * driver private object that needs its own atomic state.
728 struct drm_private_state *state, in drm_atomic_private_obj_init() argument
735 obj->state = state; in drm_atomic_private_obj_init()
751 obj->funcs->atomic_destroy_state(obj, obj->state); in drm_atomic_private_obj_fini()
757 * drm_atomic_get_private_obj_state - get private object state
758 * @state: global atomic state
759 * @obj: private object to get the state for
761 * This function returns the private object state for the given private object,
762 * allocating the state if needed. It will also grab the relevant private
763 * object lock to make sure that the state is consistent.
767 * Either the allocated state or the error code encoded into a pointer.
770 drm_atomic_get_private_obj_state(struct drm_atomic_state *state, in drm_atomic_get_private_obj_state() argument
778 for (i = 0; i < state->num_private_objs; i++) in drm_atomic_get_private_obj_state()
779 if (obj == state->private_objs[i].ptr) in drm_atomic_get_private_obj_state()
780 return state->private_objs[i].state; in drm_atomic_get_private_obj_state()
782 ret = drm_modeset_lock(&obj->lock, state->acquire_ctx); in drm_atomic_get_private_obj_state()
786 num_objs = state->num_private_objs + 1; in drm_atomic_get_private_obj_state()
787 size = sizeof(*state->private_objs) * num_objs; in drm_atomic_get_private_obj_state()
788 arr = krealloc(state->private_objs, size, GFP_KERNEL); in drm_atomic_get_private_obj_state()
792 state->private_objs = arr; in drm_atomic_get_private_obj_state()
793 index = state->num_private_objs; in drm_atomic_get_private_obj_state()
794 memset(&state->private_objs[index], 0, sizeof(*state->private_objs)); in drm_atomic_get_private_obj_state()
800 state->private_objs[index].state = obj_state; in drm_atomic_get_private_obj_state()
801 state->private_objs[index].old_state = obj->state; in drm_atomic_get_private_obj_state()
802 state->private_objs[index].new_state = obj_state; in drm_atomic_get_private_obj_state()
803 state->private_objs[index].ptr = obj; in drm_atomic_get_private_obj_state()
804 obj_state->state = state; in drm_atomic_get_private_obj_state()
806 state->num_private_objs = num_objs; in drm_atomic_get_private_obj_state()
808 DRM_DEBUG_ATOMIC("Added new private object %p state %p to %p\n", in drm_atomic_get_private_obj_state()
809 obj, obj_state, state); in drm_atomic_get_private_obj_state()
817 * @state: global atomic state object
820 * This function returns the old private object state for the given private_obj,
821 * or NULL if the private_obj is not part of the global atomic state.
824 drm_atomic_get_old_private_obj_state(struct drm_atomic_state *state, in drm_atomic_get_old_private_obj_state() argument
829 for (i = 0; i < state->num_private_objs; i++) in drm_atomic_get_old_private_obj_state()
830 if (obj == state->private_objs[i].ptr) in drm_atomic_get_old_private_obj_state()
831 return state->private_objs[i].old_state; in drm_atomic_get_old_private_obj_state()
839 * @state: global atomic state object
842 * This function returns the new private object state for the given private_obj,
843 * or NULL if the private_obj is not part of the global atomic state.
846 drm_atomic_get_new_private_obj_state(struct drm_atomic_state *state, in drm_atomic_get_new_private_obj_state() argument
851 for (i = 0; i < state->num_private_objs; i++) in drm_atomic_get_new_private_obj_state()
852 if (obj == state->private_objs[i].ptr) in drm_atomic_get_new_private_obj_state()
853 return state->private_objs[i].new_state; in drm_atomic_get_new_private_obj_state()
861 * @state: Atomic state
862 * @encoder: The encoder to fetch the connector state for
865 * as specified by the @state.
867 * If there is no connector in @state which previously had @encoder connected to
871 * state). This is especially true in enable hooks because the pipeline has
878 drm_atomic_get_old_connector_for_encoder(struct drm_atomic_state *state, in drm_atomic_get_old_connector_for_encoder() argument
885 for_each_old_connector_in_state(state, connector, conn_state, i) { in drm_atomic_get_old_connector_for_encoder()
896 * @state: Atomic state
897 * @encoder: The encoder to fetch the connector state for
900 * @encoder as specified by the @state.
902 * If there is no connector in @state which will have @encoder connected to it,
905 * attached to @encoder vs ones that do (and to inspect their state). This is
912 drm_atomic_get_new_connector_for_encoder(struct drm_atomic_state *state, in drm_atomic_get_new_connector_for_encoder() argument
919 for_each_new_connector_in_state(state, connector, conn_state, i) { in drm_atomic_get_new_connector_for_encoder()
929 * drm_atomic_get_connector_state - get connector state
930 * @state: global atomic state object
931 * @connector: connector to get state object for
933 * This function returns the connector state for the given connector,
935 * make sure that the state is consistent.
939 * Either the allocated state or the error code encoded into the pointer. When
944 drm_atomic_get_connector_state(struct drm_atomic_state *state, in drm_atomic_get_connector_state() argument
951 WARN_ON(!state->acquire_ctx); in drm_atomic_get_connector_state()
953 ret = drm_modeset_lock(&config->connection_mutex, state->acquire_ctx); in drm_atomic_get_connector_state()
959 if (index >= state->num_connector) { in drm_atomic_get_connector_state()
963 c = krealloc(state->connectors, alloc * sizeof(*state->connectors), GFP_KERNEL); in drm_atomic_get_connector_state()
967 state->connectors = c; in drm_atomic_get_connector_state()
968 memset(&state->connectors[state->num_connector], 0, in drm_atomic_get_connector_state()
969 sizeof(*state->connectors) * (alloc - state->num_connector)); in drm_atomic_get_connector_state()
971 state->num_connector = alloc; in drm_atomic_get_connector_state()
974 if (state->connectors[index].state) in drm_atomic_get_connector_state()
975 return state->connectors[index].state; in drm_atomic_get_connector_state()
982 state->connectors[index].state = connector_state; in drm_atomic_get_connector_state()
983 state->connectors[index].old_state = connector->state; in drm_atomic_get_connector_state()
984 state->connectors[index].new_state = connector_state; in drm_atomic_get_connector_state()
985 state->connectors[index].ptr = connector; in drm_atomic_get_connector_state()
986 connector_state->state = state; in drm_atomic_get_connector_state()
988 DRM_DEBUG_ATOMIC("Added [CONNECTOR:%d:%s] %p state to %p\n", in drm_atomic_get_connector_state()
990 connector_state, state); in drm_atomic_get_connector_state()
995 crtc_state = drm_atomic_get_crtc_state(state, in drm_atomic_get_connector_state()
1006 const struct drm_connector_state *state) in drm_atomic_connector_print_state() argument
1008 struct drm_connector *connector = state->connector; in drm_atomic_connector_print_state()
1011 drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)"); in drm_atomic_connector_print_state()
1012 drm_printf(p, "\tself_refresh_aware=%d\n", state->self_refresh_aware); in drm_atomic_connector_print_state()
1015 if (state->writeback_job && state->writeback_job->fb) in drm_atomic_connector_print_state()
1016 drm_printf(p, "\tfb=%d\n", state->writeback_job->fb->base.id); in drm_atomic_connector_print_state()
1019 connector->funcs->atomic_print_state(p, state); in drm_atomic_connector_print_state()
1023 * drm_atomic_get_bridge_state - get bridge state
1024 * @state: global atomic state object
1025 * @bridge: bridge to get state object for
1027 * This function returns the bridge state for the given bridge, allocating it
1029 * state is consistent.
1033 * Either the allocated state or the error code encoded into the pointer. When
1038 drm_atomic_get_bridge_state(struct drm_atomic_state *state, in drm_atomic_get_bridge_state() argument
1043 obj_state = drm_atomic_get_private_obj_state(state, &bridge->base); in drm_atomic_get_bridge_state()
1052 * drm_atomic_get_old_bridge_state - get old bridge state, if it exists
1053 * @state: global atomic state object
1056 * This function returns the old bridge state for the given bridge, or NULL if
1057 * the bridge is not part of the global atomic state.
1060 drm_atomic_get_old_bridge_state(struct drm_atomic_state *state, in drm_atomic_get_old_bridge_state() argument
1065 obj_state = drm_atomic_get_old_private_obj_state(state, &bridge->base); in drm_atomic_get_old_bridge_state()
1074 * drm_atomic_get_new_bridge_state - get new bridge state, if it exists
1075 * @state: global atomic state object
1078 * This function returns the new bridge state for the given bridge, or NULL if
1079 * the bridge is not part of the global atomic state.
1082 drm_atomic_get_new_bridge_state(struct drm_atomic_state *state, in drm_atomic_get_new_bridge_state() argument
1087 obj_state = drm_atomic_get_new_private_obj_state(state, &bridge->base); in drm_atomic_get_new_bridge_state()
1097 * @state: atomic state
1101 * bridge states to @state and make them available when
1112 drm_atomic_add_encoder_bridges(struct drm_atomic_state *state, in drm_atomic_add_encoder_bridges() argument
1122 encoder->base.id, encoder->name, state); in drm_atomic_add_encoder_bridges()
1125 /* Skip bridges that don't implement the atomic state hooks. */ in drm_atomic_add_encoder_bridges()
1129 bridge_state = drm_atomic_get_bridge_state(state, bridge); in drm_atomic_add_encoder_bridges()
1140 * @state: atomic state
1144 * currently using @crtc to the atomic configuration @state. Note that this
1156 drm_atomic_add_affected_connectors(struct drm_atomic_state *state, in drm_atomic_add_affected_connectors() argument
1159 struct drm_mode_config *config = &state->dev->mode_config; in drm_atomic_add_affected_connectors()
1166 crtc_state = drm_atomic_get_crtc_state(state, crtc); in drm_atomic_add_affected_connectors()
1170 ret = drm_modeset_lock(&config->connection_mutex, state->acquire_ctx); in drm_atomic_add_affected_connectors()
1175 crtc->base.id, crtc->name, state); in drm_atomic_add_affected_connectors()
1178 * Changed connectors are already in @state, so only need to look in drm_atomic_add_affected_connectors()
1181 drm_connector_list_iter_begin(state->dev, &conn_iter); in drm_atomic_add_affected_connectors()
1186 conn_state = drm_atomic_get_connector_state(state, connector); in drm_atomic_add_affected_connectors()
1200 * @state: atomic state
1204 * currently used by @crtc to the atomic configuration @state. This is useful
1209 * Since acquiring a plane state will always also acquire the w/w mutex of the
1219 drm_atomic_add_affected_planes(struct drm_atomic_state *state, in drm_atomic_add_affected_planes() argument
1223 drm_atomic_get_old_crtc_state(state, crtc); in drm_atomic_add_affected_planes()
1226 WARN_ON(!drm_atomic_get_new_crtc_state(state, crtc)); in drm_atomic_add_affected_planes()
1229 crtc->base.id, crtc->name, state); in drm_atomic_add_affected_planes()
1231 drm_for_each_plane_mask(plane, state->dev, old_crtc_state->plane_mask) { in drm_atomic_add_affected_planes()
1233 drm_atomic_get_plane_state(state, plane); in drm_atomic_add_affected_planes()
1244 * @state: atomic configuration to check
1253 int drm_atomic_check_only(struct drm_atomic_state *state) in drm_atomic_check_only() argument
1255 struct drm_device *dev = state->dev; in drm_atomic_check_only()
1267 DRM_DEBUG_ATOMIC("checking %p\n", state); in drm_atomic_check_only()
1269 for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { in drm_atomic_check_only()
1278 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_check_only()
1287 for_each_new_connector_in_state(state, conn, conn_state, i) { in drm_atomic_check_only()
1297 ret = config->funcs->atomic_check(state->dev, state); in drm_atomic_check_only()
1301 state, ret); in drm_atomic_check_only()
1306 if (!state->allow_modeset) { in drm_atomic_check_only()
1307 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in drm_atomic_check_only()
1322 * @state: atomic configuration to check
1328 * This function will take its own reference on @state.
1334 int drm_atomic_commit(struct drm_atomic_state *state) in drm_atomic_commit() argument
1336 struct drm_mode_config *config = &state->dev->mode_config; in drm_atomic_commit()
1339 ret = drm_atomic_check_only(state); in drm_atomic_commit()
1343 DRM_DEBUG_ATOMIC("committing %p\n", state); in drm_atomic_commit()
1345 return config->funcs->atomic_commit(state->dev, state, false); in drm_atomic_commit()
1351 * @state: atomic configuration to check
1357 * This function will take its own reference on @state.
1363 int drm_atomic_nonblocking_commit(struct drm_atomic_state *state) in drm_atomic_nonblocking_commit() argument
1365 struct drm_mode_config *config = &state->dev->mode_config; in drm_atomic_nonblocking_commit()
1368 ret = drm_atomic_check_only(state); in drm_atomic_nonblocking_commit()
1372 DRM_DEBUG_ATOMIC("committing %p nonblocking\n", state); in drm_atomic_nonblocking_commit()
1374 return config->funcs->atomic_commit(state->dev, state, true); in drm_atomic_nonblocking_commit()
1402 static int update_output_state(struct drm_atomic_state *state, in update_output_state() argument
1413 state->acquire_ctx); in update_output_state()
1418 ret = drm_atomic_add_affected_connectors(state, set->crtc); in update_output_state()
1422 for_each_new_connector_in_state(state, connector, new_conn_state, i) { in update_output_state()
1436 new_conn_state = drm_atomic_get_connector_state(state, in update_output_state()
1447 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in update_output_state()
1472 struct drm_atomic_state *state) in __drm_atomic_helper_set_config() argument
1480 crtc_state = drm_atomic_get_crtc_state(state, crtc); in __drm_atomic_helper_set_config()
1484 primary_state = drm_atomic_get_plane_state(state, crtc->primary); in __drm_atomic_helper_set_config()
1538 ret = update_output_state(state, set); in __drm_atomic_helper_set_config()
1546 void drm_atomic_print_state(const struct drm_atomic_state *state) in drm_atomic_print_state() argument
1548 struct drm_printer p = drm_info_printer(state->dev->dev); in drm_atomic_print_state()
1557 DRM_DEBUG_ATOMIC("checking %p\n", state); in drm_atomic_print_state()
1559 for_each_new_plane_in_state(state, plane, plane_state, i) in drm_atomic_print_state()
1562 for_each_new_crtc_in_state(state, crtc, crtc_state, i) in drm_atomic_print_state()
1565 for_each_new_connector_in_state(state, connector, connector_state, i) in drm_atomic_print_state()
1584 drm_atomic_plane_print_state(p, plane->state); in __drm_state_dump()
1592 drm_atomic_crtc_print_state(p, crtc->state); in __drm_state_dump()
1601 drm_atomic_connector_print_state(p, connector->state); in __drm_state_dump()
1608 * drm_state_dump - dump entire device atomic state
1610 * @p: where to print the state to
1612 * Just for debugging. Drivers might want an option to dump state
1642 {"state", drm_state_info, 0},