Lines Matching full:state
98 * @state: atomic state
104 void drm_atomic_state_default_release(struct drm_atomic_state *state) in drm_atomic_state_default_release() argument
106 kfree(state->connectors); in drm_atomic_state_default_release()
107 kfree(state->crtcs); in drm_atomic_state_default_release()
108 kfree(state->planes); in drm_atomic_state_default_release()
109 kfree(state->private_objs); in drm_atomic_state_default_release()
114 * drm_atomic_state_init - init new atomic state
116 * @state: atomic state
118 * Default implementation for filling in a new atomic state.
123 drm_atomic_state_init(struct drm_device *dev, struct drm_atomic_state *state) in drm_atomic_state_init() argument
125 kref_init(&state->ref); in drm_atomic_state_init()
130 state->allow_modeset = true; in drm_atomic_state_init()
132 state->crtcs = kcalloc(dev->mode_config.num_crtc, in drm_atomic_state_init()
133 sizeof(*state->crtcs), GFP_KERNEL); in drm_atomic_state_init()
134 if (!state->crtcs) in drm_atomic_state_init()
136 state->planes = kcalloc(dev->mode_config.num_total_plane, in drm_atomic_state_init()
137 sizeof(*state->planes), GFP_KERNEL); in drm_atomic_state_init()
138 if (!state->planes) in drm_atomic_state_init()
141 state->dev = dev; in drm_atomic_state_init()
143 DRM_DEBUG_ATOMIC("Allocated atomic state %p\n", state); in drm_atomic_state_init()
147 drm_atomic_state_default_release(state); in drm_atomic_state_init()
153 * drm_atomic_state_alloc - allocate atomic state
156 * This allocates an empty atomic state to track updates.
164 struct drm_atomic_state *state; in drm_atomic_state_alloc() local
166 state = kzalloc(sizeof(*state), GFP_KERNEL); in drm_atomic_state_alloc()
167 if (!state) in drm_atomic_state_alloc()
169 if (drm_atomic_state_init(dev, state) < 0) { in drm_atomic_state_alloc()
170 kfree(state); in drm_atomic_state_alloc()
173 return state; in drm_atomic_state_alloc()
181 * drm_atomic_state_default_clear - clear base atomic state
182 * @state: atomic state
184 * Default implementation for clearing atomic state.
188 void drm_atomic_state_default_clear(struct drm_atomic_state *state) in drm_atomic_state_default_clear() argument
190 struct drm_device *dev = state->dev; in drm_atomic_state_default_clear()
194 DRM_DEBUG_ATOMIC("Clearing atomic state %p\n", state); in drm_atomic_state_default_clear()
196 for (i = 0; i < state->num_connector; i++) { in drm_atomic_state_default_clear()
197 struct drm_connector *connector = state->connectors[i].ptr; in drm_atomic_state_default_clear()
203 state->connectors[i].state); in drm_atomic_state_default_clear()
204 state->connectors[i].ptr = NULL; in drm_atomic_state_default_clear()
205 state->connectors[i].state = NULL; in drm_atomic_state_default_clear()
206 state->connectors[i].old_state = NULL; in drm_atomic_state_default_clear()
207 state->connectors[i].new_state = NULL; in drm_atomic_state_default_clear()
212 struct drm_crtc *crtc = state->crtcs[i].ptr; in drm_atomic_state_default_clear()
218 state->crtcs[i].state); in drm_atomic_state_default_clear()
220 state->crtcs[i].ptr = NULL; in drm_atomic_state_default_clear()
221 state->crtcs[i].state = NULL; in drm_atomic_state_default_clear()
222 state->crtcs[i].old_state = NULL; in drm_atomic_state_default_clear()
223 state->crtcs[i].new_state = NULL; in drm_atomic_state_default_clear()
225 if (state->crtcs[i].commit) { in drm_atomic_state_default_clear()
226 drm_crtc_commit_put(state->crtcs[i].commit); in drm_atomic_state_default_clear()
227 state->crtcs[i].commit = NULL; in drm_atomic_state_default_clear()
232 struct drm_plane *plane = state->planes[i].ptr; in drm_atomic_state_default_clear()
238 state->planes[i].state); in drm_atomic_state_default_clear()
239 state->planes[i].ptr = NULL; in drm_atomic_state_default_clear()
240 state->planes[i].state = NULL; in drm_atomic_state_default_clear()
241 state->planes[i].old_state = NULL; in drm_atomic_state_default_clear()
242 state->planes[i].new_state = NULL; in drm_atomic_state_default_clear()
245 for (i = 0; i < state->num_private_objs; i++) { in drm_atomic_state_default_clear()
246 struct drm_private_obj *obj = state->private_objs[i].ptr; in drm_atomic_state_default_clear()
249 state->private_objs[i].state); in drm_atomic_state_default_clear()
250 state->private_objs[i].ptr = NULL; in drm_atomic_state_default_clear()
251 state->private_objs[i].state = NULL; in drm_atomic_state_default_clear()
252 state->private_objs[i].old_state = NULL; in drm_atomic_state_default_clear()
253 state->private_objs[i].new_state = NULL; in drm_atomic_state_default_clear()
255 state->num_private_objs = 0; in drm_atomic_state_default_clear()
257 if (state->fake_commit) { in drm_atomic_state_default_clear()
258 drm_crtc_commit_put(state->fake_commit); in drm_atomic_state_default_clear()
259 state->fake_commit = NULL; in drm_atomic_state_default_clear()
265 * drm_atomic_state_clear - clear state object
266 * @state: atomic state
270 * configuration. Which means that all the state assembled in @state is no
271 * longer an atomic update to the current state, but to some arbitrary earlier
272 * state. Which could break assumptions the driver's
275 * Hence we must clear all cached state and completely start over, using this
278 void drm_atomic_state_clear(struct drm_atomic_state *state) in drm_atomic_state_clear() argument
280 struct drm_device *dev = state->dev; in drm_atomic_state_clear()
284 config->funcs->atomic_state_clear(state); in drm_atomic_state_clear()
286 drm_atomic_state_default_clear(state); in drm_atomic_state_clear()
291 * __drm_atomic_state_free - free all memory for an atomic state
292 * @ref: This atomic state to deallocate
294 * This frees all memory associated with an atomic state, including all the
295 * per-object state for planes, CRTCs and connectors.
299 struct drm_atomic_state *state = container_of(ref, typeof(*state), ref); in __drm_atomic_state_free() local
300 struct drm_mode_config *config = &state->dev->mode_config; in __drm_atomic_state_free()
302 drm_atomic_state_clear(state); in __drm_atomic_state_free()
304 DRM_DEBUG_ATOMIC("Freeing atomic state %p\n", state); in __drm_atomic_state_free()
307 config->funcs->atomic_state_free(state); in __drm_atomic_state_free()
309 drm_atomic_state_default_release(state); in __drm_atomic_state_free()
310 kfree(state); in __drm_atomic_state_free()
316 * drm_atomic_get_crtc_state - get CRTC state
317 * @state: global atomic state object
318 * @crtc: CRTC to get state object for
320 * This function returns the CRTC state for the given CRTC, allocating it if
321 * needed. It will also grab the relevant CRTC lock to make sure that the state
324 * WARNING: Drivers may only add new CRTC states to a @state if
330 * Either the allocated state or the error code encoded into the pointer. When
335 drm_atomic_get_crtc_state(struct drm_atomic_state *state, in drm_atomic_get_crtc_state() argument
341 WARN_ON(!state->acquire_ctx); in drm_atomic_get_crtc_state()
343 crtc_state = drm_atomic_get_existing_crtc_state(state, crtc); in drm_atomic_get_crtc_state()
347 ret = drm_modeset_lock(&crtc->mutex, state->acquire_ctx); in drm_atomic_get_crtc_state()
355 state->crtcs[index].state = crtc_state; in drm_atomic_get_crtc_state()
356 state->crtcs[index].old_state = crtc->state; in drm_atomic_get_crtc_state()
357 state->crtcs[index].new_state = crtc_state; in drm_atomic_get_crtc_state()
358 state->crtcs[index].ptr = crtc; in drm_atomic_get_crtc_state()
359 crtc_state->state = state; in drm_atomic_get_crtc_state()
361 DRM_DEBUG_ATOMIC("Added [CRTC:%d:%s] %p state to %p\n", in drm_atomic_get_crtc_state()
362 crtc->base.id, crtc->name, crtc_state, state); in drm_atomic_get_crtc_state()
378 * TODO: Add generic modeset state checks once we support those. in drm_atomic_crtc_check()
387 /* The state->enable vs. state->mode_blob checks can be WARN_ON, in drm_atomic_crtc_check()
426 const struct drm_crtc_state *state) in drm_atomic_crtc_print_state() argument
428 struct drm_crtc *crtc = state->crtc; in drm_atomic_crtc_print_state()
431 drm_printf(p, "\tenable=%d\n", state->enable); in drm_atomic_crtc_print_state()
432 drm_printf(p, "\tactive=%d\n", state->active); in drm_atomic_crtc_print_state()
433 drm_printf(p, "\tself_refresh_active=%d\n", state->self_refresh_active); in drm_atomic_crtc_print_state()
434 drm_printf(p, "\tplanes_changed=%d\n", state->planes_changed); in drm_atomic_crtc_print_state()
435 drm_printf(p, "\tmode_changed=%d\n", state->mode_changed); in drm_atomic_crtc_print_state()
436 drm_printf(p, "\tactive_changed=%d\n", state->active_changed); in drm_atomic_crtc_print_state()
437 drm_printf(p, "\tconnectors_changed=%d\n", state->connectors_changed); in drm_atomic_crtc_print_state()
438 drm_printf(p, "\tcolor_mgmt_changed=%d\n", state->color_mgmt_changed); in drm_atomic_crtc_print_state()
439 drm_printf(p, "\tplane_mask=%x\n", state->plane_mask); in drm_atomic_crtc_print_state()
440 drm_printf(p, "\tconnector_mask=%x\n", state->connector_mask); in drm_atomic_crtc_print_state()
441 drm_printf(p, "\tencoder_mask=%x\n", state->encoder_mask); in drm_atomic_crtc_print_state()
442 drm_printf(p, "\tmode: " DRM_MODE_FMT "\n", DRM_MODE_ARG(&state->mode)); in drm_atomic_crtc_print_state()
445 crtc->funcs->atomic_print_state(p, state); in drm_atomic_crtc_print_state()
449 struct drm_connector_state *state) in drm_atomic_connector_check() argument
452 struct drm_writeback_job *writeback_job = state->writeback_job; in drm_atomic_connector_check()
455 state->max_bpc = info->bpc ? info->bpc : 8; in drm_atomic_connector_check()
457 state->max_bpc = min(state->max_bpc, state->max_requested_bpc); in drm_atomic_connector_check()
462 if (writeback_job->fb && !state->crtc) { in drm_atomic_connector_check()
468 if (state->crtc) in drm_atomic_connector_check()
469 crtc_state = drm_atomic_get_existing_crtc_state(state->state, in drm_atomic_connector_check()
470 state->crtc); in drm_atomic_connector_check()
475 state->crtc->base.id); in drm_atomic_connector_check()
487 state->writeback_job = NULL; in drm_atomic_connector_check()
494 * drm_atomic_get_plane_state - get plane state
495 * @state: global atomic state object
496 * @plane: plane to get state object for
498 * This function returns the plane state for the given plane, allocating it if
499 * needed. It will also grab the relevant plane lock to make sure that the state
504 * Either the allocated state or the error code encoded into the pointer. When
509 drm_atomic_get_plane_state(struct drm_atomic_state *state, in drm_atomic_get_plane_state() argument
515 WARN_ON(!state->acquire_ctx); in drm_atomic_get_plane_state()
522 plane_state = drm_atomic_get_existing_plane_state(state, plane); in drm_atomic_get_plane_state()
526 ret = drm_modeset_lock(&plane->mutex, state->acquire_ctx); in drm_atomic_get_plane_state()
534 state->planes[index].state = plane_state; in drm_atomic_get_plane_state()
535 state->planes[index].ptr = plane; in drm_atomic_get_plane_state()
536 state->planes[index].old_state = plane->state; in drm_atomic_get_plane_state()
537 state->planes[index].new_state = plane_state; in drm_atomic_get_plane_state()
538 plane_state->state = state; in drm_atomic_get_plane_state()
540 DRM_DEBUG_ATOMIC("Added [PLANE:%d:%s] %p state to %p\n", in drm_atomic_get_plane_state()
541 plane->base.id, plane->name, plane_state, state); in drm_atomic_get_plane_state()
546 crtc_state = drm_atomic_get_crtc_state(state, in drm_atomic_get_plane_state()
569 * full OFF state. in plane_switching_crtc()
575 * drm_atomic_plane_check - check plane state
576 * @old_plane_state: old plane state to check
577 * @new_plane_state: new plane state to check
579 * Provides core sanity checks for plane state.
606 /* if disabled, we don't care about the rest of the state: */ in drm_atomic_plane_check()
693 const struct drm_plane_state *state) in drm_atomic_plane_print_state() argument
695 struct drm_plane *plane = state->plane; in drm_atomic_plane_print_state()
696 struct drm_rect src = drm_plane_state_src(state); in drm_atomic_plane_print_state()
697 struct drm_rect dest = drm_plane_state_dest(state); in drm_atomic_plane_print_state()
700 drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)"); in drm_atomic_plane_print_state()
701 drm_printf(p, "\tfb=%u\n", state->fb ? state->fb->base.id : 0); in drm_atomic_plane_print_state()
702 if (state->fb) in drm_atomic_plane_print_state()
703 drm_framebuffer_print_info(p, 2, state->fb); in drm_atomic_plane_print_state()
706 drm_printf(p, "\trotation=%x\n", state->rotation); in drm_atomic_plane_print_state()
707 drm_printf(p, "\tnormalized-zpos=%x\n", state->normalized_zpos); in drm_atomic_plane_print_state()
709 drm_get_color_encoding_name(state->color_encoding)); in drm_atomic_plane_print_state()
711 drm_get_color_range_name(state->color_range)); in drm_atomic_plane_print_state()
714 plane->funcs->atomic_print_state(p, state); in drm_atomic_plane_print_state()
718 * DOC: handling driver private state
725 * objects. Drivers then need to do similar state tracking and commit ordering for
730 * driver private state objects using struct &drm_private_obj, with the
731 * associated state struct &drm_private_state.
733 * Similar to userspace-exposed objects, private state structures can be
736 * directly. Sequence of the actual hardware state commit is not handled,
741 * All private state structures contained in a &drm_atomic_state update can be
744 * Drivers are recommended to wrap these for each type of driver private state
748 * An earlier way to handle driver private state was by subclassing struct
751 * commit instead" of "duplicate state, check, then either commit or release
752 * duplicated state) it is deprecated in favour of using &drm_private_state.
759 * @state: initial private object state
764 * driver private object that needs its own atomic state.
769 struct drm_private_state *state, in drm_atomic_private_obj_init() argument
776 obj->state = state; in drm_atomic_private_obj_init()
792 obj->funcs->atomic_destroy_state(obj, obj->state); in drm_atomic_private_obj_fini()
798 * drm_atomic_get_private_obj_state - get private object state
799 * @state: global atomic state
800 * @obj: private object to get the state for
802 * This function returns the private object state for the given private object,
803 * allocating the state if needed. It will also grab the relevant private
804 * object lock to make sure that the state is consistent.
808 * Either the allocated state or the error code encoded into a pointer.
811 drm_atomic_get_private_obj_state(struct drm_atomic_state *state, in drm_atomic_get_private_obj_state() argument
819 for (i = 0; i < state->num_private_objs; i++) in drm_atomic_get_private_obj_state()
820 if (obj == state->private_objs[i].ptr) in drm_atomic_get_private_obj_state()
821 return state->private_objs[i].state; in drm_atomic_get_private_obj_state()
823 ret = drm_modeset_lock(&obj->lock, state->acquire_ctx); in drm_atomic_get_private_obj_state()
827 num_objs = state->num_private_objs + 1; in drm_atomic_get_private_obj_state()
828 size = sizeof(*state->private_objs) * num_objs; in drm_atomic_get_private_obj_state()
829 arr = krealloc(state->private_objs, size, GFP_KERNEL); in drm_atomic_get_private_obj_state()
833 state->private_objs = arr; in drm_atomic_get_private_obj_state()
834 index = state->num_private_objs; in drm_atomic_get_private_obj_state()
835 memset(&state->private_objs[index], 0, sizeof(*state->private_objs)); in drm_atomic_get_private_obj_state()
841 state->private_objs[index].state = obj_state; in drm_atomic_get_private_obj_state()
842 state->private_objs[index].old_state = obj->state; in drm_atomic_get_private_obj_state()
843 state->private_objs[index].new_state = obj_state; in drm_atomic_get_private_obj_state()
844 state->private_objs[index].ptr = obj; in drm_atomic_get_private_obj_state()
845 obj_state->state = state; in drm_atomic_get_private_obj_state()
847 state->num_private_objs = num_objs; in drm_atomic_get_private_obj_state()
849 DRM_DEBUG_ATOMIC("Added new private object %p state %p to %p\n", in drm_atomic_get_private_obj_state()
850 obj, obj_state, state); in drm_atomic_get_private_obj_state()
858 * @state: global atomic state object
861 * This function returns the old private object state for the given private_obj,
862 * or NULL if the private_obj is not part of the global atomic state.
865 drm_atomic_get_old_private_obj_state(struct drm_atomic_state *state, in drm_atomic_get_old_private_obj_state() argument
870 for (i = 0; i < state->num_private_objs; i++) in drm_atomic_get_old_private_obj_state()
871 if (obj == state->private_objs[i].ptr) in drm_atomic_get_old_private_obj_state()
872 return state->private_objs[i].old_state; in drm_atomic_get_old_private_obj_state()
880 * @state: global atomic state object
883 * This function returns the new private object state for the given private_obj,
884 * or NULL if the private_obj is not part of the global atomic state.
887 drm_atomic_get_new_private_obj_state(struct drm_atomic_state *state, in drm_atomic_get_new_private_obj_state() argument
892 for (i = 0; i < state->num_private_objs; i++) in drm_atomic_get_new_private_obj_state()
893 if (obj == state->private_objs[i].ptr) in drm_atomic_get_new_private_obj_state()
894 return state->private_objs[i].new_state; in drm_atomic_get_new_private_obj_state()
902 * @state: Atomic state
903 * @encoder: The encoder to fetch the connector state for
906 * as specified by the @state.
908 * If there is no connector in @state which previously had @encoder connected to
912 * state). This is especially true in enable hooks because the pipeline has
919 drm_atomic_get_old_connector_for_encoder(struct drm_atomic_state *state, in drm_atomic_get_old_connector_for_encoder() argument
926 for_each_old_connector_in_state(state, connector, conn_state, i) { in drm_atomic_get_old_connector_for_encoder()
937 * @state: Atomic state
938 * @encoder: The encoder to fetch the connector state for
941 * @encoder as specified by the @state.
943 * If there is no connector in @state which will have @encoder connected to it,
946 * attached to @encoder vs ones that do (and to inspect their state). This is
953 drm_atomic_get_new_connector_for_encoder(struct drm_atomic_state *state, in drm_atomic_get_new_connector_for_encoder() argument
960 for_each_new_connector_in_state(state, connector, conn_state, i) { in drm_atomic_get_new_connector_for_encoder()
970 * drm_atomic_get_connector_state - get connector state
971 * @state: global atomic state object
972 * @connector: connector to get state object for
974 * This function returns the connector state for the given connector,
976 * make sure that the state is consistent.
980 * Either the allocated state or the error code encoded into the pointer. When
985 drm_atomic_get_connector_state(struct drm_atomic_state *state, in drm_atomic_get_connector_state() argument
992 WARN_ON(!state->acquire_ctx); in drm_atomic_get_connector_state()
994 ret = drm_modeset_lock(&config->connection_mutex, state->acquire_ctx); in drm_atomic_get_connector_state()
1000 if (index >= state->num_connector) { in drm_atomic_get_connector_state()
1004 c = krealloc_array(state->connectors, alloc, in drm_atomic_get_connector_state()
1005 sizeof(*state->connectors), GFP_KERNEL); in drm_atomic_get_connector_state()
1009 state->connectors = c; in drm_atomic_get_connector_state()
1010 memset(&state->connectors[state->num_connector], 0, in drm_atomic_get_connector_state()
1011 sizeof(*state->connectors) * (alloc - state->num_connector)); in drm_atomic_get_connector_state()
1013 state->num_connector = alloc; in drm_atomic_get_connector_state()
1016 if (state->connectors[index].state) in drm_atomic_get_connector_state()
1017 return state->connectors[index].state; in drm_atomic_get_connector_state()
1024 state->connectors[index].state = connector_state; in drm_atomic_get_connector_state()
1025 state->connectors[index].old_state = connector->state; in drm_atomic_get_connector_state()
1026 state->connectors[index].new_state = connector_state; in drm_atomic_get_connector_state()
1027 state->connectors[index].ptr = connector; in drm_atomic_get_connector_state()
1028 connector_state->state = state; in drm_atomic_get_connector_state()
1030 DRM_DEBUG_ATOMIC("Added [CONNECTOR:%d:%s] %p state to %p\n", in drm_atomic_get_connector_state()
1032 connector_state, state); in drm_atomic_get_connector_state()
1037 crtc_state = drm_atomic_get_crtc_state(state, in drm_atomic_get_connector_state()
1048 const struct drm_connector_state *state) in drm_atomic_connector_print_state() argument
1050 struct drm_connector *connector = state->connector; in drm_atomic_connector_print_state()
1053 drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)"); in drm_atomic_connector_print_state()
1054 drm_printf(p, "\tself_refresh_aware=%d\n", state->self_refresh_aware); in drm_atomic_connector_print_state()
1057 if (state->writeback_job && state->writeback_job->fb) in drm_atomic_connector_print_state()
1058 drm_printf(p, "\tfb=%d\n", state->writeback_job->fb->base.id); in drm_atomic_connector_print_state()
1061 connector->funcs->atomic_print_state(p, state); in drm_atomic_connector_print_state()
1065 * drm_atomic_get_bridge_state - get bridge state
1066 * @state: global atomic state object
1067 * @bridge: bridge to get state object for
1069 * This function returns the bridge state for the given bridge, allocating it
1071 * state is consistent.
1075 * Either the allocated state or the error code encoded into the pointer. When
1080 drm_atomic_get_bridge_state(struct drm_atomic_state *state, in drm_atomic_get_bridge_state() argument
1085 obj_state = drm_atomic_get_private_obj_state(state, &bridge->base); in drm_atomic_get_bridge_state()
1094 * drm_atomic_get_old_bridge_state - get old bridge state, if it exists
1095 * @state: global atomic state object
1098 * This function returns the old bridge state for the given bridge, or NULL if
1099 * the bridge is not part of the global atomic state.
1102 drm_atomic_get_old_bridge_state(struct drm_atomic_state *state, in drm_atomic_get_old_bridge_state() argument
1107 obj_state = drm_atomic_get_old_private_obj_state(state, &bridge->base); in drm_atomic_get_old_bridge_state()
1116 * drm_atomic_get_new_bridge_state - get new bridge state, if it exists
1117 * @state: global atomic state object
1120 * This function returns the new bridge state for the given bridge, or NULL if
1121 * the bridge is not part of the global atomic state.
1124 drm_atomic_get_new_bridge_state(struct drm_atomic_state *state, in drm_atomic_get_new_bridge_state() argument
1129 obj_state = drm_atomic_get_new_private_obj_state(state, &bridge->base); in drm_atomic_get_new_bridge_state()
1139 * @state: atomic state
1143 * bridge states to @state and make them available when
1154 drm_atomic_add_encoder_bridges(struct drm_atomic_state *state, in drm_atomic_add_encoder_bridges() argument
1164 encoder->base.id, encoder->name, state); in drm_atomic_add_encoder_bridges()
1167 /* Skip bridges that don't implement the atomic state hooks. */ in drm_atomic_add_encoder_bridges()
1171 bridge_state = drm_atomic_get_bridge_state(state, bridge); in drm_atomic_add_encoder_bridges()
1182 * @state: atomic state
1186 * currently using @crtc to the atomic configuration @state. Note that this
1198 drm_atomic_add_affected_connectors(struct drm_atomic_state *state, in drm_atomic_add_affected_connectors() argument
1201 struct drm_mode_config *config = &state->dev->mode_config; in drm_atomic_add_affected_connectors()
1208 crtc_state = drm_atomic_get_crtc_state(state, crtc); in drm_atomic_add_affected_connectors()
1212 ret = drm_modeset_lock(&config->connection_mutex, state->acquire_ctx); in drm_atomic_add_affected_connectors()
1217 crtc->base.id, crtc->name, state); in drm_atomic_add_affected_connectors()
1220 * Changed connectors are already in @state, so only need to look in drm_atomic_add_affected_connectors()
1223 drm_connector_list_iter_begin(state->dev, &conn_iter); in drm_atomic_add_affected_connectors()
1228 conn_state = drm_atomic_get_connector_state(state, connector); in drm_atomic_add_affected_connectors()
1242 * @state: atomic state
1246 * currently used by @crtc to the atomic configuration @state. This is useful
1251 * Since acquiring a plane state will always also acquire the w/w mutex of the
1261 drm_atomic_add_affected_planes(struct drm_atomic_state *state, in drm_atomic_add_affected_planes() argument
1265 drm_atomic_get_old_crtc_state(state, crtc); in drm_atomic_add_affected_planes()
1268 WARN_ON(!drm_atomic_get_new_crtc_state(state, crtc)); in drm_atomic_add_affected_planes()
1271 crtc->base.id, crtc->name, state); in drm_atomic_add_affected_planes()
1273 drm_for_each_plane_mask(plane, state->dev, old_crtc_state->plane_mask) { in drm_atomic_add_affected_planes()
1275 drm_atomic_get_plane_state(state, plane); in drm_atomic_add_affected_planes()
1286 * @state: atomic configuration to check
1295 int drm_atomic_check_only(struct drm_atomic_state *state) in drm_atomic_check_only() argument
1297 struct drm_device *dev = state->dev; in drm_atomic_check_only()
1311 DRM_DEBUG_ATOMIC("checking %p\n", state); in drm_atomic_check_only()
1313 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) in drm_atomic_check_only()
1316 for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { in drm_atomic_check_only()
1325 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_check_only()
1334 for_each_new_connector_in_state(state, conn, conn_state, i) { in drm_atomic_check_only()
1344 ret = config->funcs->atomic_check(state->dev, state); in drm_atomic_check_only()
1348 state, ret); in drm_atomic_check_only()
1353 if (!state->allow_modeset) { in drm_atomic_check_only()
1354 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in drm_atomic_check_only()
1363 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) in drm_atomic_check_only()
1379 …WARN(!state->allow_modeset, "adding CRTC not allowed without modesets: requested 0x%x, affected 0x… in drm_atomic_check_only()
1389 * @state: atomic configuration to check
1395 * This function will take its own reference on @state.
1401 int drm_atomic_commit(struct drm_atomic_state *state) in drm_atomic_commit() argument
1403 struct drm_mode_config *config = &state->dev->mode_config; in drm_atomic_commit()
1406 ret = drm_atomic_check_only(state); in drm_atomic_commit()
1410 DRM_DEBUG_ATOMIC("committing %p\n", state); in drm_atomic_commit()
1412 return config->funcs->atomic_commit(state->dev, state, false); in drm_atomic_commit()
1418 * @state: atomic configuration to check
1424 * This function will take its own reference on @state.
1430 int drm_atomic_nonblocking_commit(struct drm_atomic_state *state) in drm_atomic_nonblocking_commit() argument
1432 struct drm_mode_config *config = &state->dev->mode_config; in drm_atomic_nonblocking_commit()
1435 ret = drm_atomic_check_only(state); in drm_atomic_nonblocking_commit()
1439 DRM_DEBUG_ATOMIC("committing %p nonblocking\n", state); in drm_atomic_nonblocking_commit()
1441 return config->funcs->atomic_commit(state->dev, state, true); in drm_atomic_nonblocking_commit()
1469 static int update_output_state(struct drm_atomic_state *state, in update_output_state() argument
1480 state->acquire_ctx); in update_output_state()
1485 ret = drm_atomic_add_affected_connectors(state, set->crtc); in update_output_state()
1489 for_each_new_connector_in_state(state, connector, new_conn_state, i) { in update_output_state()
1503 new_conn_state = drm_atomic_get_connector_state(state, in update_output_state()
1514 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in update_output_state()
1539 struct drm_atomic_state *state) in __drm_atomic_helper_set_config() argument
1547 crtc_state = drm_atomic_get_crtc_state(state, crtc); in __drm_atomic_helper_set_config()
1551 primary_state = drm_atomic_get_plane_state(state, crtc->primary); in __drm_atomic_helper_set_config()
1605 ret = update_output_state(state, set); in __drm_atomic_helper_set_config()
1614 * drm_atomic_print_new_state - prints drm atomic state
1615 * @state: atomic configuration to check
1618 * This functions prints the drm atomic state snapshot using the drm printer
1621 * Note that this function looks into the new state objects and hence its not
1624 void drm_atomic_print_new_state(const struct drm_atomic_state *state, in drm_atomic_print_new_state() argument
1640 DRM_DEBUG_ATOMIC("checking %p\n", state); in drm_atomic_print_new_state()
1642 for_each_new_plane_in_state(state, plane, plane_state, i) in drm_atomic_print_new_state()
1645 for_each_new_crtc_in_state(state, crtc, crtc_state, i) in drm_atomic_print_new_state()
1648 for_each_new_connector_in_state(state, connector, connector_state, i) in drm_atomic_print_new_state()
1668 drm_atomic_plane_print_state(p, plane->state); in __drm_state_dump()
1676 drm_atomic_crtc_print_state(p, crtc->state); in __drm_state_dump()
1685 drm_atomic_connector_print_state(p, connector->state); in __drm_state_dump()
1692 * drm_state_dump - dump entire device atomic state
1694 * @p: where to print the state to
1696 * Just for debugging. Drivers might want an option to dump state
1726 {"state", drm_state_info, 0},