Lines Matching full:state
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()
149 state->dev = dev; in drm_atomic_state_init()
151 drm_dbg_atomic(dev, "Allocated atomic state %p\n", state); in drm_atomic_state_init()
155 drm_atomic_state_default_release(state); in drm_atomic_state_init()
161 * drm_atomic_state_alloc - allocate atomic state
164 * This allocates an empty atomic state to track updates.
172 struct drm_atomic_state *state; in drm_atomic_state_alloc() local
174 state = kzalloc(sizeof(*state), GFP_KERNEL); in drm_atomic_state_alloc()
175 if (!state) in drm_atomic_state_alloc()
177 if (drm_atomic_state_init(dev, state) < 0) { in drm_atomic_state_alloc()
178 kfree(state); in drm_atomic_state_alloc()
181 return state; in drm_atomic_state_alloc()
189 * drm_atomic_state_default_clear - clear base atomic state
190 * @state: atomic state
192 * Default implementation for clearing atomic state.
196 void drm_atomic_state_default_clear(struct drm_atomic_state *state) in drm_atomic_state_default_clear() argument
198 struct drm_device *dev = state->dev; in drm_atomic_state_default_clear()
202 drm_dbg_atomic(dev, "Clearing atomic state %p\n", state); in drm_atomic_state_default_clear()
204 for (i = 0; i < state->num_connector; i++) { in drm_atomic_state_default_clear()
205 struct drm_connector *connector = state->connectors[i].ptr; in drm_atomic_state_default_clear()
211 state->connectors[i].state); in drm_atomic_state_default_clear()
212 state->connectors[i].ptr = NULL; in drm_atomic_state_default_clear()
213 state->connectors[i].state = NULL; in drm_atomic_state_default_clear()
214 state->connectors[i].old_state = NULL; in drm_atomic_state_default_clear()
215 state->connectors[i].new_state = NULL; in drm_atomic_state_default_clear()
220 struct drm_crtc *crtc = state->crtcs[i].ptr; in drm_atomic_state_default_clear()
226 state->crtcs[i].state); in drm_atomic_state_default_clear()
228 state->crtcs[i].ptr = NULL; in drm_atomic_state_default_clear()
229 state->crtcs[i].state = NULL; in drm_atomic_state_default_clear()
230 state->crtcs[i].old_state = NULL; in drm_atomic_state_default_clear()
231 state->crtcs[i].new_state = NULL; in drm_atomic_state_default_clear()
233 if (state->crtcs[i].commit) { in drm_atomic_state_default_clear()
234 drm_crtc_commit_put(state->crtcs[i].commit); in drm_atomic_state_default_clear()
235 state->crtcs[i].commit = NULL; in drm_atomic_state_default_clear()
240 struct drm_plane *plane = state->planes[i].ptr; in drm_atomic_state_default_clear()
246 state->planes[i].state); in drm_atomic_state_default_clear()
247 state->planes[i].ptr = NULL; in drm_atomic_state_default_clear()
248 state->planes[i].state = NULL; in drm_atomic_state_default_clear()
249 state->planes[i].old_state = NULL; in drm_atomic_state_default_clear()
250 state->planes[i].new_state = NULL; in drm_atomic_state_default_clear()
253 for (i = 0; i < state->num_private_objs; i++) { in drm_atomic_state_default_clear()
254 struct drm_private_obj *obj = state->private_objs[i].ptr; in drm_atomic_state_default_clear()
257 state->private_objs[i].state); in drm_atomic_state_default_clear()
258 state->private_objs[i].ptr = NULL; in drm_atomic_state_default_clear()
259 state->private_objs[i].state = NULL; in drm_atomic_state_default_clear()
260 state->private_objs[i].old_state = NULL; in drm_atomic_state_default_clear()
261 state->private_objs[i].new_state = NULL; in drm_atomic_state_default_clear()
263 state->num_private_objs = 0; in drm_atomic_state_default_clear()
265 if (state->fake_commit) { in drm_atomic_state_default_clear()
266 drm_crtc_commit_put(state->fake_commit); in drm_atomic_state_default_clear()
267 state->fake_commit = NULL; in drm_atomic_state_default_clear()
273 * drm_atomic_state_clear - clear state object
274 * @state: atomic state
278 * configuration. Which means that all the state assembled in @state is no
279 * longer an atomic update to the current state, but to some arbitrary earlier
280 * state. Which could break assumptions the driver's
283 * Hence we must clear all cached state and completely start over, using this
286 void drm_atomic_state_clear(struct drm_atomic_state *state) in drm_atomic_state_clear() argument
288 struct drm_device *dev = state->dev; in drm_atomic_state_clear()
292 config->funcs->atomic_state_clear(state); in drm_atomic_state_clear()
294 drm_atomic_state_default_clear(state); in drm_atomic_state_clear()
299 * __drm_atomic_state_free - free all memory for an atomic state
300 * @ref: This atomic state to deallocate
302 * This frees all memory associated with an atomic state, including all the
303 * per-object state for planes, CRTCs and connectors.
307 struct drm_atomic_state *state = container_of(ref, typeof(*state), ref); in __drm_atomic_state_free() local
308 struct drm_device *dev = state->dev; in __drm_atomic_state_free()
311 drm_atomic_state_clear(state); in __drm_atomic_state_free()
313 drm_dbg_atomic(state->dev, "Freeing atomic state %p\n", state); in __drm_atomic_state_free()
316 config->funcs->atomic_state_free(state); in __drm_atomic_state_free()
318 drm_atomic_state_default_release(state); in __drm_atomic_state_free()
319 kfree(state); in __drm_atomic_state_free()
327 * drm_atomic_get_crtc_state - get CRTC state
328 * @state: global atomic state object
329 * @crtc: CRTC to get state object for
331 * This function returns the CRTC state for the given CRTC, allocating it if
332 * needed. It will also grab the relevant CRTC lock to make sure that the state
335 * WARNING: Drivers may only add new CRTC states to a @state if
341 * Either the allocated state or the error code encoded into the pointer. When
346 drm_atomic_get_crtc_state(struct drm_atomic_state *state, in drm_atomic_get_crtc_state() argument
352 WARN_ON(!state->acquire_ctx); in drm_atomic_get_crtc_state()
354 crtc_state = drm_atomic_get_existing_crtc_state(state, crtc); in drm_atomic_get_crtc_state()
358 ret = drm_modeset_lock(&crtc->mutex, state->acquire_ctx); in drm_atomic_get_crtc_state()
366 state->crtcs[index].state = crtc_state; in drm_atomic_get_crtc_state()
367 state->crtcs[index].old_state = crtc->state; in drm_atomic_get_crtc_state()
368 state->crtcs[index].new_state = crtc_state; in drm_atomic_get_crtc_state()
369 state->crtcs[index].ptr = crtc; in drm_atomic_get_crtc_state()
370 crtc_state->state = state; in drm_atomic_get_crtc_state()
372 drm_dbg_atomic(state->dev, "Added [CRTC:%d:%s] %p state to %p\n", in drm_atomic_get_crtc_state()
373 crtc->base.id, crtc->name, crtc_state, state); in drm_atomic_get_crtc_state()
389 * TODO: Add generic modeset state checks once we support those. in drm_atomic_crtc_check()
399 /* The state->enable vs. state->mode_blob checks can be WARN_ON, in drm_atomic_crtc_check()
441 const struct drm_crtc_state *state) in drm_atomic_crtc_print_state() argument
443 struct drm_crtc *crtc = state->crtc; in drm_atomic_crtc_print_state()
446 drm_printf(p, "\tenable=%d\n", state->enable); in drm_atomic_crtc_print_state()
447 drm_printf(p, "\tactive=%d\n", state->active); in drm_atomic_crtc_print_state()
448 drm_printf(p, "\tself_refresh_active=%d\n", state->self_refresh_active); in drm_atomic_crtc_print_state()
449 drm_printf(p, "\tplanes_changed=%d\n", state->planes_changed); in drm_atomic_crtc_print_state()
450 drm_printf(p, "\tmode_changed=%d\n", state->mode_changed); in drm_atomic_crtc_print_state()
451 drm_printf(p, "\tactive_changed=%d\n", state->active_changed); in drm_atomic_crtc_print_state()
452 drm_printf(p, "\tconnectors_changed=%d\n", state->connectors_changed); in drm_atomic_crtc_print_state()
453 drm_printf(p, "\tcolor_mgmt_changed=%d\n", state->color_mgmt_changed); in drm_atomic_crtc_print_state()
454 drm_printf(p, "\tplane_mask=%x\n", state->plane_mask); in drm_atomic_crtc_print_state()
455 drm_printf(p, "\tconnector_mask=%x\n", state->connector_mask); in drm_atomic_crtc_print_state()
456 drm_printf(p, "\tencoder_mask=%x\n", state->encoder_mask); in drm_atomic_crtc_print_state()
457 drm_printf(p, "\tmode: " DRM_MODE_FMT "\n", DRM_MODE_ARG(&state->mode)); in drm_atomic_crtc_print_state()
460 crtc->funcs->atomic_print_state(p, state); in drm_atomic_crtc_print_state()
464 struct drm_connector_state *state) in drm_atomic_connector_check() argument
467 struct drm_writeback_job *writeback_job = state->writeback_job; in drm_atomic_connector_check()
470 state->max_bpc = info->bpc ? info->bpc : 8; in drm_atomic_connector_check()
472 state->max_bpc = min(state->max_bpc, state->max_requested_bpc); in drm_atomic_connector_check()
477 if (writeback_job->fb && !state->crtc) { in drm_atomic_connector_check()
484 if (state->crtc) in drm_atomic_connector_check()
485 crtc_state = drm_atomic_get_existing_crtc_state(state->state, in drm_atomic_connector_check()
486 state->crtc); in drm_atomic_connector_check()
492 state->crtc->base.id); in drm_atomic_connector_check()
505 state->writeback_job = NULL; in drm_atomic_connector_check()
512 * drm_atomic_get_plane_state - get plane state
513 * @state: global atomic state object
514 * @plane: plane to get state object for
516 * This function returns the plane state for the given plane, allocating it if
517 * needed. It will also grab the relevant plane lock to make sure that the state
522 * Either the allocated state or the error code encoded into the pointer. When
527 drm_atomic_get_plane_state(struct drm_atomic_state *state, in drm_atomic_get_plane_state() argument
533 WARN_ON(!state->acquire_ctx); in drm_atomic_get_plane_state()
540 plane_state = drm_atomic_get_existing_plane_state(state, plane); in drm_atomic_get_plane_state()
544 ret = drm_modeset_lock(&plane->mutex, state->acquire_ctx); in drm_atomic_get_plane_state()
552 state->planes[index].state = plane_state; in drm_atomic_get_plane_state()
553 state->planes[index].ptr = plane; in drm_atomic_get_plane_state()
554 state->planes[index].old_state = plane->state; in drm_atomic_get_plane_state()
555 state->planes[index].new_state = plane_state; in drm_atomic_get_plane_state()
556 plane_state->state = state; in drm_atomic_get_plane_state()
558 drm_dbg_atomic(plane->dev, "Added [PLANE:%d:%s] %p state to %p\n", in drm_atomic_get_plane_state()
559 plane->base.id, plane->name, plane_state, state); in drm_atomic_get_plane_state()
564 crtc_state = drm_atomic_get_crtc_state(state, in drm_atomic_get_plane_state()
587 * full OFF state. in plane_switching_crtc()
593 * drm_atomic_plane_check - check plane state
594 * @old_plane_state: old plane state to check
595 * @new_plane_state: new plane state to check
597 * Provides core sanity checks for plane state.
624 /* if disabled, we don't care about the rest of the state: */ in drm_atomic_plane_check()
717 const struct drm_plane_state *state) in drm_atomic_plane_print_state() argument
719 struct drm_plane *plane = state->plane; in drm_atomic_plane_print_state()
720 struct drm_rect src = drm_plane_state_src(state); in drm_atomic_plane_print_state()
721 struct drm_rect dest = drm_plane_state_dest(state); in drm_atomic_plane_print_state()
724 drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)"); in drm_atomic_plane_print_state()
725 drm_printf(p, "\tfb=%u\n", state->fb ? state->fb->base.id : 0); in drm_atomic_plane_print_state()
726 if (state->fb) in drm_atomic_plane_print_state()
727 drm_framebuffer_print_info(p, 2, state->fb); in drm_atomic_plane_print_state()
730 drm_printf(p, "\trotation=%x\n", state->rotation); in drm_atomic_plane_print_state()
731 drm_printf(p, "\tnormalized-zpos=%x\n", state->normalized_zpos); in drm_atomic_plane_print_state()
733 drm_get_color_encoding_name(state->color_encoding)); in drm_atomic_plane_print_state()
735 drm_get_color_range_name(state->color_range)); in drm_atomic_plane_print_state()
736 drm_printf(p, "\tcolor_mgmt_changed=%d\n", state->color_mgmt_changed); in drm_atomic_plane_print_state()
739 plane->funcs->atomic_print_state(p, state); in drm_atomic_plane_print_state()
743 * DOC: handling driver private state
750 * objects. Drivers then need to do similar state tracking and commit ordering for
755 * driver private state objects using struct &drm_private_obj, with the
756 * associated state struct &drm_private_state.
758 * Similar to userspace-exposed objects, private state structures can be
761 * directly. Sequence of the actual hardware state commit is not handled,
766 * All private state structures contained in a &drm_atomic_state update can be
769 * Drivers are recommended to wrap these for each type of driver private state
773 * An earlier way to handle driver private state was by subclassing struct
776 * commit instead" of "duplicate state, check, then either commit or release
777 * duplicated state) it is deprecated in favour of using &drm_private_state.
784 * @state: initial private object state
789 * driver private object that needs its own atomic state.
794 struct drm_private_state *state, in drm_atomic_private_obj_init() argument
801 obj->state = state; in drm_atomic_private_obj_init()
805 state->obj = obj; in drm_atomic_private_obj_init()
819 obj->funcs->atomic_destroy_state(obj, obj->state); in drm_atomic_private_obj_fini()
825 * drm_atomic_get_private_obj_state - get private object state
826 * @state: global atomic state
827 * @obj: private object to get the state for
829 * This function returns the private object state for the given private object,
830 * allocating the state if needed. It will also grab the relevant private
831 * object lock to make sure that the state is consistent.
835 * Either the allocated state or the error code encoded into a pointer.
838 drm_atomic_get_private_obj_state(struct drm_atomic_state *state, in drm_atomic_get_private_obj_state() argument
846 for (i = 0; i < state->num_private_objs; i++) in drm_atomic_get_private_obj_state()
847 if (obj == state->private_objs[i].ptr) in drm_atomic_get_private_obj_state()
848 return state->private_objs[i].state; in drm_atomic_get_private_obj_state()
850 ret = drm_modeset_lock(&obj->lock, state->acquire_ctx); in drm_atomic_get_private_obj_state()
854 num_objs = state->num_private_objs + 1; in drm_atomic_get_private_obj_state()
855 size = sizeof(*state->private_objs) * num_objs; in drm_atomic_get_private_obj_state()
856 arr = krealloc(state->private_objs, size, GFP_KERNEL); in drm_atomic_get_private_obj_state()
860 state->private_objs = arr; in drm_atomic_get_private_obj_state()
861 index = state->num_private_objs; in drm_atomic_get_private_obj_state()
862 memset(&state->private_objs[index], 0, sizeof(*state->private_objs)); in drm_atomic_get_private_obj_state()
868 state->private_objs[index].state = obj_state; in drm_atomic_get_private_obj_state()
869 state->private_objs[index].old_state = obj->state; in drm_atomic_get_private_obj_state()
870 state->private_objs[index].new_state = obj_state; in drm_atomic_get_private_obj_state()
871 state->private_objs[index].ptr = obj; in drm_atomic_get_private_obj_state()
872 obj_state->state = state; in drm_atomic_get_private_obj_state()
874 state->num_private_objs = num_objs; in drm_atomic_get_private_obj_state()
876 drm_dbg_atomic(state->dev, in drm_atomic_get_private_obj_state()
877 "Added new private object %p state %p to %p\n", in drm_atomic_get_private_obj_state()
878 obj, obj_state, state); in drm_atomic_get_private_obj_state()
886 * @state: global atomic state object
889 * This function returns the old private object state for the given private_obj,
890 * or NULL if the private_obj is not part of the global atomic state.
893 drm_atomic_get_old_private_obj_state(const struct drm_atomic_state *state, in drm_atomic_get_old_private_obj_state() argument
898 for (i = 0; i < state->num_private_objs; i++) in drm_atomic_get_old_private_obj_state()
899 if (obj == state->private_objs[i].ptr) in drm_atomic_get_old_private_obj_state()
900 return state->private_objs[i].old_state; in drm_atomic_get_old_private_obj_state()
908 * @state: global atomic state object
911 * This function returns the new private object state for the given private_obj,
912 * or NULL if the private_obj is not part of the global atomic state.
915 drm_atomic_get_new_private_obj_state(const struct drm_atomic_state *state, in drm_atomic_get_new_private_obj_state() argument
920 for (i = 0; i < state->num_private_objs; i++) in drm_atomic_get_new_private_obj_state()
921 if (obj == state->private_objs[i].ptr) in drm_atomic_get_new_private_obj_state()
922 return state->private_objs[i].new_state; in drm_atomic_get_new_private_obj_state()
930 * @state: Atomic state
931 * @encoder: The encoder to fetch the connector state for
934 * as specified by the @state.
936 * If there is no connector in @state which previously had @encoder connected to
940 * state). This is especially true in enable hooks because the pipeline has
947 drm_atomic_get_old_connector_for_encoder(const struct drm_atomic_state *state, in drm_atomic_get_old_connector_for_encoder() argument
954 for_each_old_connector_in_state(state, connector, conn_state, i) { in drm_atomic_get_old_connector_for_encoder()
965 * @state: Atomic state
966 * @encoder: The encoder to fetch the connector state for
969 * @encoder as specified by the @state.
971 * If there is no connector in @state which will have @encoder connected to it,
974 * attached to @encoder vs ones that do (and to inspect their state). This is
981 drm_atomic_get_new_connector_for_encoder(const struct drm_atomic_state *state, in drm_atomic_get_new_connector_for_encoder() argument
988 for_each_new_connector_in_state(state, connector, conn_state, i) { in drm_atomic_get_new_connector_for_encoder()
999 * @state: Atomic state
1000 * @encoder: The encoder to fetch the crtc state for
1003 * as specified by the @state.
1009 drm_atomic_get_old_crtc_for_encoder(struct drm_atomic_state *state, in drm_atomic_get_old_crtc_for_encoder() argument
1015 connector = drm_atomic_get_old_connector_for_encoder(state, encoder); in drm_atomic_get_old_crtc_for_encoder()
1019 conn_state = drm_atomic_get_old_connector_state(state, connector); in drm_atomic_get_old_crtc_for_encoder()
1029 * @state: Atomic state
1030 * @encoder: The encoder to fetch the crtc state for
1033 * as specified by the @state.
1039 drm_atomic_get_new_crtc_for_encoder(struct drm_atomic_state *state, in drm_atomic_get_new_crtc_for_encoder() argument
1045 connector = drm_atomic_get_new_connector_for_encoder(state, encoder); in drm_atomic_get_new_crtc_for_encoder()
1049 conn_state = drm_atomic_get_new_connector_state(state, connector); in drm_atomic_get_new_crtc_for_encoder()
1058 * drm_atomic_get_connector_state - get connector state
1059 * @state: global atomic state object
1060 * @connector: connector to get state object for
1062 * This function returns the connector state for the given connector,
1064 * make sure that the state is consistent.
1068 * Either the allocated state or the error code encoded into the pointer. When
1073 drm_atomic_get_connector_state(struct drm_atomic_state *state, in drm_atomic_get_connector_state() argument
1080 WARN_ON(!state->acquire_ctx); in drm_atomic_get_connector_state()
1082 ret = drm_modeset_lock(&config->connection_mutex, state->acquire_ctx); in drm_atomic_get_connector_state()
1088 if (index >= state->num_connector) { in drm_atomic_get_connector_state()
1092 c = krealloc_array(state->connectors, alloc, in drm_atomic_get_connector_state()
1093 sizeof(*state->connectors), GFP_KERNEL); in drm_atomic_get_connector_state()
1097 state->connectors = c; in drm_atomic_get_connector_state()
1098 memset(&state->connectors[state->num_connector], 0, in drm_atomic_get_connector_state()
1099 sizeof(*state->connectors) * (alloc - state->num_connector)); in drm_atomic_get_connector_state()
1101 state->num_connector = alloc; in drm_atomic_get_connector_state()
1104 if (state->connectors[index].state) in drm_atomic_get_connector_state()
1105 return state->connectors[index].state; in drm_atomic_get_connector_state()
1112 state->connectors[index].state = connector_state; in drm_atomic_get_connector_state()
1113 state->connectors[index].old_state = connector->state; in drm_atomic_get_connector_state()
1114 state->connectors[index].new_state = connector_state; in drm_atomic_get_connector_state()
1115 state->connectors[index].ptr = connector; in drm_atomic_get_connector_state()
1116 connector_state->state = state; in drm_atomic_get_connector_state()
1118 drm_dbg_atomic(connector->dev, "Added [CONNECTOR:%d:%s] %p state to %p\n", in drm_atomic_get_connector_state()
1120 connector_state, state); in drm_atomic_get_connector_state()
1125 crtc_state = drm_atomic_get_crtc_state(state, in drm_atomic_get_connector_state()
1136 const struct drm_connector_state *state) in drm_atomic_connector_print_state() argument
1138 struct drm_connector *connector = state->connector; in drm_atomic_connector_print_state()
1141 drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)"); in drm_atomic_connector_print_state()
1142 drm_printf(p, "\tself_refresh_aware=%d\n", state->self_refresh_aware); in drm_atomic_connector_print_state()
1143 drm_printf(p, "\tmax_requested_bpc=%d\n", state->max_requested_bpc); in drm_atomic_connector_print_state()
1144 drm_printf(p, "\tcolorspace=%s\n", drm_get_colorspace_name(state->colorspace)); in drm_atomic_connector_print_state()
1147 if (state->writeback_job && state->writeback_job->fb) in drm_atomic_connector_print_state()
1148 drm_printf(p, "\tfb=%d\n", state->writeback_job->fb->base.id); in drm_atomic_connector_print_state()
1151 connector->funcs->atomic_print_state(p, state); in drm_atomic_connector_print_state()
1155 * drm_atomic_get_bridge_state - get bridge state
1156 * @state: global atomic state object
1157 * @bridge: bridge to get state object for
1159 * This function returns the bridge state for the given bridge, allocating it
1161 * state is consistent.
1165 * Either the allocated state or the error code encoded into the pointer. When
1170 drm_atomic_get_bridge_state(struct drm_atomic_state *state, in drm_atomic_get_bridge_state() argument
1175 obj_state = drm_atomic_get_private_obj_state(state, &bridge->base); in drm_atomic_get_bridge_state()
1184 * drm_atomic_get_old_bridge_state - get old bridge state, if it exists
1185 * @state: global atomic state object
1188 * This function returns the old bridge state for the given bridge, or NULL if
1189 * the bridge is not part of the global atomic state.
1192 drm_atomic_get_old_bridge_state(const struct drm_atomic_state *state, in drm_atomic_get_old_bridge_state() argument
1197 obj_state = drm_atomic_get_old_private_obj_state(state, &bridge->base); in drm_atomic_get_old_bridge_state()
1206 * drm_atomic_get_new_bridge_state - get new bridge state, if it exists
1207 * @state: global atomic state object
1210 * This function returns the new bridge state for the given bridge, or NULL if
1211 * the bridge is not part of the global atomic state.
1214 drm_atomic_get_new_bridge_state(const struct drm_atomic_state *state, in drm_atomic_get_new_bridge_state() argument
1219 obj_state = drm_atomic_get_new_private_obj_state(state, &bridge->base); in drm_atomic_get_new_bridge_state()
1229 * @state: atomic state
1233 * bridge states to @state and make them available when
1244 drm_atomic_add_encoder_bridges(struct drm_atomic_state *state, in drm_atomic_add_encoder_bridges() argument
1255 encoder->base.id, encoder->name, state); in drm_atomic_add_encoder_bridges()
1258 /* Skip bridges that don't implement the atomic state hooks. */ in drm_atomic_add_encoder_bridges()
1262 bridge_state = drm_atomic_get_bridge_state(state, bridge); in drm_atomic_add_encoder_bridges()
1273 * @state: atomic state
1277 * currently using @crtc to the atomic configuration @state. Note that this
1289 drm_atomic_add_affected_connectors(struct drm_atomic_state *state, in drm_atomic_add_affected_connectors() argument
1292 struct drm_mode_config *config = &state->dev->mode_config; in drm_atomic_add_affected_connectors()
1299 crtc_state = drm_atomic_get_crtc_state(state, crtc); in drm_atomic_add_affected_connectors()
1303 ret = drm_modeset_lock(&config->connection_mutex, state->acquire_ctx); in drm_atomic_add_affected_connectors()
1309 crtc->base.id, crtc->name, state); in drm_atomic_add_affected_connectors()
1312 * Changed connectors are already in @state, so only need to look in drm_atomic_add_affected_connectors()
1315 drm_connector_list_iter_begin(state->dev, &conn_iter); in drm_atomic_add_affected_connectors()
1320 conn_state = drm_atomic_get_connector_state(state, connector); in drm_atomic_add_affected_connectors()
1334 * @state: atomic state
1338 * currently used by @crtc to the atomic configuration @state. This is useful
1343 * Since acquiring a plane state will always also acquire the w/w mutex of the
1353 drm_atomic_add_affected_planes(struct drm_atomic_state *state, in drm_atomic_add_affected_planes() argument
1357 drm_atomic_get_old_crtc_state(state, crtc); in drm_atomic_add_affected_planes()
1360 WARN_ON(!drm_atomic_get_new_crtc_state(state, crtc)); in drm_atomic_add_affected_planes()
1364 crtc->base.id, crtc->name, state); in drm_atomic_add_affected_planes()
1366 drm_for_each_plane_mask(plane, state->dev, old_crtc_state->plane_mask) { in drm_atomic_add_affected_planes()
1368 drm_atomic_get_plane_state(state, plane); in drm_atomic_add_affected_planes()
1379 * @state: atomic configuration to check
1388 int drm_atomic_check_only(struct drm_atomic_state *state) in drm_atomic_check_only() argument
1390 struct drm_device *dev = state->dev; in drm_atomic_check_only()
1404 drm_dbg_atomic(dev, "checking %p\n", state); in drm_atomic_check_only()
1406 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in drm_atomic_check_only()
1411 for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { in drm_atomic_check_only()
1420 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_check_only()
1429 for_each_new_connector_in_state(state, conn, conn_state, i) { in drm_atomic_check_only()
1439 ret = config->funcs->atomic_check(state->dev, state); in drm_atomic_check_only()
1443 state, ret); in drm_atomic_check_only()
1448 if (!state->allow_modeset) { in drm_atomic_check_only()
1449 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in drm_atomic_check_only()
1458 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in drm_atomic_check_only()
1477 …WARN(!state->allow_modeset, "adding CRTC not allowed without modesets: requested 0x%x, affected 0x… in drm_atomic_check_only()
1487 * @state: atomic configuration to check
1493 * This function will take its own reference on @state.
1499 int drm_atomic_commit(struct drm_atomic_state *state) in drm_atomic_commit() argument
1501 struct drm_mode_config *config = &state->dev->mode_config; in drm_atomic_commit()
1502 struct drm_printer p = drm_info_printer(state->dev->dev); in drm_atomic_commit()
1506 drm_atomic_print_new_state(state, &p); in drm_atomic_commit()
1508 ret = drm_atomic_check_only(state); in drm_atomic_commit()
1512 drm_dbg_atomic(state->dev, "committing %p\n", state); in drm_atomic_commit()
1514 return config->funcs->atomic_commit(state->dev, state, false); in drm_atomic_commit()
1520 * @state: atomic configuration to check
1526 * This function will take its own reference on @state.
1532 int drm_atomic_nonblocking_commit(struct drm_atomic_state *state) in drm_atomic_nonblocking_commit() argument
1534 struct drm_mode_config *config = &state->dev->mode_config; in drm_atomic_nonblocking_commit()
1537 ret = drm_atomic_check_only(state); in drm_atomic_nonblocking_commit()
1541 drm_dbg_atomic(state->dev, "committing %p nonblocking\n", state); in drm_atomic_nonblocking_commit()
1543 return config->funcs->atomic_commit(state->dev, state, true); in drm_atomic_nonblocking_commit()
1571 static int update_output_state(struct drm_atomic_state *state, in update_output_state() argument
1582 state->acquire_ctx); in update_output_state()
1587 ret = drm_atomic_add_affected_connectors(state, set->crtc); in update_output_state()
1591 for_each_new_connector_in_state(state, connector, new_conn_state, i) { in update_output_state()
1605 new_conn_state = drm_atomic_get_connector_state(state, in update_output_state()
1616 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in update_output_state()
1641 struct drm_atomic_state *state) in __drm_atomic_helper_set_config() argument
1649 crtc_state = drm_atomic_get_crtc_state(state, crtc); in __drm_atomic_helper_set_config()
1653 primary_state = drm_atomic_get_plane_state(state, crtc->primary); in __drm_atomic_helper_set_config()
1707 ret = update_output_state(state, set); in __drm_atomic_helper_set_config()
1716 const struct drm_private_state *state) in drm_atomic_private_obj_print_state() argument
1718 struct drm_private_obj *obj = state->obj; in drm_atomic_private_obj_print_state()
1721 obj->funcs->atomic_print_state(p, state); in drm_atomic_private_obj_print_state()
1725 * drm_atomic_print_new_state - prints drm atomic state
1726 * @state: atomic configuration to check
1729 * This functions prints the drm atomic state snapshot using the drm printer
1732 * Note that this function looks into the new state objects and hence its not
1735 void drm_atomic_print_new_state(const struct drm_atomic_state *state, in drm_atomic_print_new_state() argument
1749 drm_err(state->dev, "invalid drm printer\n"); in drm_atomic_print_new_state()
1753 drm_dbg_atomic(state->dev, "checking %p\n", state); in drm_atomic_print_new_state()
1755 for_each_new_plane_in_state(state, plane, plane_state, i) in drm_atomic_print_new_state()
1758 for_each_new_crtc_in_state(state, crtc, crtc_state, i) in drm_atomic_print_new_state()
1761 for_each_new_connector_in_state(state, connector, connector_state, i) in drm_atomic_print_new_state()
1764 for_each_new_private_obj_in_state(state, obj, obj_state, i) in drm_atomic_print_new_state()
1785 drm_atomic_plane_print_state(p, plane->state); in __drm_state_dump()
1793 drm_atomic_crtc_print_state(p, crtc->state); in __drm_state_dump()
1802 drm_atomic_connector_print_state(p, connector->state); in __drm_state_dump()
1810 drm_atomic_private_obj_print_state(p, obj->state); in __drm_state_dump()
1817 * drm_state_dump - dump entire device atomic state
1819 * @p: where to print the state to
1821 * Just for debugging. Drivers might want an option to dump state
1851 {"state", drm_state_info, 0},