Lines Matching full:state

44  * DOC: atomic state reset and initialization
47 * and correct atomic software state for all connectors, CRTCs and planes
49 * suspend. One way to solve this is to have a hardware state read-out
50 * infrastructure which reconstructs the full software state (e.g. the i915
53 * The simpler solution is to just reset the software state to everything off,
57 * On the upside the precise state tracking of atomic simplifies system suspend
65 * __drm_atomic_helper_crtc_state_reset - reset the CRTC state
66 * @crtc_state: atomic CRTC state, must not be NULL
70 * values. This is useful for drivers that subclass the CRTC state.
81 * __drm_atomic_helper_crtc_reset - reset state on CRTC
83 * @crtc_state: CRTC state to assign
86 * the &drm_crtc->state pointer of @crtc, usually required when
90 * This is useful for drivers that subclass the CRTC state.
102 crtc->state = crtc_state; in __drm_atomic_helper_crtc_reset()
110 * Resets the atomic state for @crtc by freeing the state pointer (which might
111 * be NULL, e.g. at driver load time) and allocating a new empty state object.
116 kzalloc(sizeof(*crtc->state), GFP_KERNEL); in drm_atomic_helper_crtc_reset()
118 if (crtc->state) in drm_atomic_helper_crtc_reset()
119 crtc->funcs->atomic_destroy_state(crtc, crtc->state); in drm_atomic_helper_crtc_reset()
126 * __drm_atomic_helper_crtc_duplicate_state - copy atomic CRTC state
128 * @state: atomic CRTC state
130 * Copies atomic state from a CRTC's current state and resets inferred values.
131 * This is useful for drivers that subclass the CRTC state.
134 struct drm_crtc_state *state) in __drm_atomic_helper_crtc_duplicate_state() argument
136 memcpy(state, crtc->state, sizeof(*state)); in __drm_atomic_helper_crtc_duplicate_state()
138 if (state->mode_blob) in __drm_atomic_helper_crtc_duplicate_state()
139 drm_property_blob_get(state->mode_blob); in __drm_atomic_helper_crtc_duplicate_state()
140 if (state->degamma_lut) in __drm_atomic_helper_crtc_duplicate_state()
141 drm_property_blob_get(state->degamma_lut); in __drm_atomic_helper_crtc_duplicate_state()
142 if (state->ctm) in __drm_atomic_helper_crtc_duplicate_state()
143 drm_property_blob_get(state->ctm); in __drm_atomic_helper_crtc_duplicate_state()
144 if (state->gamma_lut) in __drm_atomic_helper_crtc_duplicate_state()
145 drm_property_blob_get(state->gamma_lut); in __drm_atomic_helper_crtc_duplicate_state()
146 state->mode_changed = false; in __drm_atomic_helper_crtc_duplicate_state()
147 state->active_changed = false; in __drm_atomic_helper_crtc_duplicate_state()
148 state->planes_changed = false; in __drm_atomic_helper_crtc_duplicate_state()
149 state->connectors_changed = false; in __drm_atomic_helper_crtc_duplicate_state()
150 state->color_mgmt_changed = false; in __drm_atomic_helper_crtc_duplicate_state()
151 state->zpos_changed = false; in __drm_atomic_helper_crtc_duplicate_state()
152 state->commit = NULL; in __drm_atomic_helper_crtc_duplicate_state()
153 state->event = NULL; in __drm_atomic_helper_crtc_duplicate_state()
154 state->async_flip = false; in __drm_atomic_helper_crtc_duplicate_state()
157 state->active = drm_atomic_crtc_effectively_active(state); in __drm_atomic_helper_crtc_duplicate_state()
158 state->self_refresh_active = false; in __drm_atomic_helper_crtc_duplicate_state()
163 * drm_atomic_helper_crtc_duplicate_state - default state duplicate hook
166 * Default CRTC state duplicate hook for drivers which don't have their own
167 * subclassed CRTC state structure.
172 struct drm_crtc_state *state; in drm_atomic_helper_crtc_duplicate_state() local
174 if (WARN_ON(!crtc->state)) in drm_atomic_helper_crtc_duplicate_state()
177 state = kmalloc(sizeof(*state), GFP_KERNEL); in drm_atomic_helper_crtc_duplicate_state()
178 if (state) in drm_atomic_helper_crtc_duplicate_state()
179 __drm_atomic_helper_crtc_duplicate_state(crtc, state); in drm_atomic_helper_crtc_duplicate_state()
181 return state; in drm_atomic_helper_crtc_duplicate_state()
186 * __drm_atomic_helper_crtc_destroy_state - release CRTC state
187 * @state: CRTC state object to release
189 * Releases all resources stored in the CRTC state without actually freeing
190 * the memory of the CRTC state. This is useful for drivers that subclass the
191 * CRTC state.
193 void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc_state *state) in __drm_atomic_helper_crtc_destroy_state() argument
195 if (state->commit) { in __drm_atomic_helper_crtc_destroy_state()
202 * state->event may be freed, so we can't directly look at in __drm_atomic_helper_crtc_destroy_state()
203 * state->event->base.completion. in __drm_atomic_helper_crtc_destroy_state()
205 if (state->event && state->commit->abort_completion) in __drm_atomic_helper_crtc_destroy_state()
206 drm_crtc_commit_put(state->commit); in __drm_atomic_helper_crtc_destroy_state()
208 kfree(state->commit->event); in __drm_atomic_helper_crtc_destroy_state()
209 state->commit->event = NULL; in __drm_atomic_helper_crtc_destroy_state()
211 drm_crtc_commit_put(state->commit); in __drm_atomic_helper_crtc_destroy_state()
214 drm_property_blob_put(state->mode_blob); in __drm_atomic_helper_crtc_destroy_state()
215 drm_property_blob_put(state->degamma_lut); in __drm_atomic_helper_crtc_destroy_state()
216 drm_property_blob_put(state->ctm); in __drm_atomic_helper_crtc_destroy_state()
217 drm_property_blob_put(state->gamma_lut); in __drm_atomic_helper_crtc_destroy_state()
222 * drm_atomic_helper_crtc_destroy_state - default state destroy hook
224 * @state: CRTC state object to release
226 * Default CRTC state destroy hook for drivers which don't have their own
227 * subclassed CRTC state structure.
230 struct drm_crtc_state *state) in drm_atomic_helper_crtc_destroy_state() argument
232 __drm_atomic_helper_crtc_destroy_state(state); in drm_atomic_helper_crtc_destroy_state()
233 kfree(state); in drm_atomic_helper_crtc_destroy_state()
238 * __drm_atomic_helper_plane_state_reset - resets plane state to default values
239 * @plane_state: atomic plane state, must not be NULL
243 * values. This is useful for drivers that subclass the CRTC state.
282 * __drm_atomic_helper_plane_reset - reset state on plane
284 * @plane_state: plane state to assign
287 * the &drm_crtc->state pointer of @plane, usually required when
291 * This is useful for drivers that subclass the plane state.
299 plane->state = plane_state; in __drm_atomic_helper_plane_reset()
307 * Resets the atomic state for @plane by freeing the state pointer (which might
308 * be NULL, e.g. at driver load time) and allocating a new empty state object.
312 if (plane->state) in drm_atomic_helper_plane_reset()
313 __drm_atomic_helper_plane_destroy_state(plane->state); in drm_atomic_helper_plane_reset()
315 kfree(plane->state); in drm_atomic_helper_plane_reset()
316 plane->state = kzalloc(sizeof(*plane->state), GFP_KERNEL); in drm_atomic_helper_plane_reset()
317 if (plane->state) in drm_atomic_helper_plane_reset()
318 __drm_atomic_helper_plane_reset(plane, plane->state); in drm_atomic_helper_plane_reset()
323 * __drm_atomic_helper_plane_duplicate_state - copy atomic plane state
325 * @state: atomic plane state
327 * Copies atomic state from a plane's current state. This is useful for
328 * drivers that subclass the plane state.
331 struct drm_plane_state *state) in __drm_atomic_helper_plane_duplicate_state() argument
333 memcpy(state, plane->state, sizeof(*state)); in __drm_atomic_helper_plane_duplicate_state()
335 if (state->fb) in __drm_atomic_helper_plane_duplicate_state()
336 drm_framebuffer_get(state->fb); in __drm_atomic_helper_plane_duplicate_state()
338 state->fence = NULL; in __drm_atomic_helper_plane_duplicate_state()
339 state->commit = NULL; in __drm_atomic_helper_plane_duplicate_state()
340 state->fb_damage_clips = NULL; in __drm_atomic_helper_plane_duplicate_state()
345 * drm_atomic_helper_plane_duplicate_state - default state duplicate hook
348 * Default plane state duplicate hook for drivers which don't have their own
349 * subclassed plane state structure.
354 struct drm_plane_state *state; in drm_atomic_helper_plane_duplicate_state() local
356 if (WARN_ON(!plane->state)) in drm_atomic_helper_plane_duplicate_state()
359 state = kmalloc(sizeof(*state), GFP_KERNEL); in drm_atomic_helper_plane_duplicate_state()
360 if (state) in drm_atomic_helper_plane_duplicate_state()
361 __drm_atomic_helper_plane_duplicate_state(plane, state); in drm_atomic_helper_plane_duplicate_state()
363 return state; in drm_atomic_helper_plane_duplicate_state()
368 * __drm_atomic_helper_plane_destroy_state - release plane state
369 * @state: plane state object to release
371 * Releases all resources stored in the plane state without actually freeing
372 * the memory of the plane state. This is useful for drivers that subclass the
373 * plane state.
375 void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state) in __drm_atomic_helper_plane_destroy_state() argument
377 if (state->fb) in __drm_atomic_helper_plane_destroy_state()
378 drm_framebuffer_put(state->fb); in __drm_atomic_helper_plane_destroy_state()
380 if (state->fence) in __drm_atomic_helper_plane_destroy_state()
381 dma_fence_put(state->fence); in __drm_atomic_helper_plane_destroy_state()
383 if (state->commit) in __drm_atomic_helper_plane_destroy_state()
384 drm_crtc_commit_put(state->commit); in __drm_atomic_helper_plane_destroy_state()
386 drm_property_blob_put(state->fb_damage_clips); in __drm_atomic_helper_plane_destroy_state()
391 * drm_atomic_helper_plane_destroy_state - default state destroy hook
393 * @state: plane state object to release
395 * Default plane state destroy hook for drivers which don't have their own
396 * subclassed plane state structure.
399 struct drm_plane_state *state) in drm_atomic_helper_plane_destroy_state() argument
401 __drm_atomic_helper_plane_destroy_state(state); in drm_atomic_helper_plane_destroy_state()
402 kfree(state); in drm_atomic_helper_plane_destroy_state()
407 * __drm_atomic_helper_connector_state_reset - reset the connector state
408 * @conn_state: atomic connector state, must not be NULL
412 * values. This is useful for drivers that subclass the connector state.
423 * __drm_atomic_helper_connector_reset - reset state on connector
425 * @conn_state: connector state to assign
428 * the &drm_connector->state pointer of @connector, usually required when
432 * This is useful for drivers that subclass the connector state.
441 connector->state = conn_state; in __drm_atomic_helper_connector_reset()
449 * Resets the atomic state for @connector by freeing the state pointer (which
450 * might be NULL, e.g. at driver load time) and allocating a new empty state
458 if (connector->state) in drm_atomic_helper_connector_reset()
459 __drm_atomic_helper_connector_destroy_state(connector->state); in drm_atomic_helper_connector_reset()
461 kfree(connector->state); in drm_atomic_helper_connector_reset()
475 struct drm_connector_state *state = connector->state; in drm_atomic_helper_connector_tv_margins_reset() local
477 state->tv.margins.left = cmdline->tv_margins.left; in drm_atomic_helper_connector_tv_margins_reset()
478 state->tv.margins.right = cmdline->tv_margins.right; in drm_atomic_helper_connector_tv_margins_reset()
479 state->tv.margins.top = cmdline->tv_margins.top; in drm_atomic_helper_connector_tv_margins_reset()
480 state->tv.margins.bottom = cmdline->tv_margins.bottom; in drm_atomic_helper_connector_tv_margins_reset()
494 struct drm_connector_state *state = connector->state; in drm_atomic_helper_connector_tv_reset() local
502 state->tv.mode = val; in drm_atomic_helper_connector_tv_reset()
505 state->tv.mode = cmdline->tv_mode; in drm_atomic_helper_connector_tv_reset()
511 state->tv.select_subconnector = val; in drm_atomic_helper_connector_tv_reset()
517 state->tv.subconnector = val; in drm_atomic_helper_connector_tv_reset()
523 state->tv.brightness = val; in drm_atomic_helper_connector_tv_reset()
529 state->tv.contrast = val; in drm_atomic_helper_connector_tv_reset()
535 state->tv.flicker_reduction = val; in drm_atomic_helper_connector_tv_reset()
541 state->tv.overscan = val; in drm_atomic_helper_connector_tv_reset()
547 state->tv.saturation = val; in drm_atomic_helper_connector_tv_reset()
553 state->tv.hue = val; in drm_atomic_helper_connector_tv_reset()
560 * drm_atomic_helper_connector_tv_check - Validate an analog TV connector state
562 * @state: the DRM State object
564 * Checks the state object to see if the requested state is valid for an
571 struct drm_atomic_state *state) in drm_atomic_helper_connector_tv_check() argument
574 drm_atomic_get_old_connector_state(state, connector); in drm_atomic_helper_connector_tv_check()
576 drm_atomic_get_new_connector_state(state, connector); in drm_atomic_helper_connector_tv_check()
584 crtc_state = drm_atomic_get_new_crtc_state(state, crtc); in drm_atomic_helper_connector_tv_check()
609 * __drm_atomic_helper_connector_duplicate_state - copy atomic connector state
611 * @state: atomic connector state
613 * Copies atomic state from a connector's current state. This is useful for
614 * drivers that subclass the connector state.
618 struct drm_connector_state *state) in __drm_atomic_helper_connector_duplicate_state() argument
620 memcpy(state, connector->state, sizeof(*state)); in __drm_atomic_helper_connector_duplicate_state()
621 if (state->crtc) in __drm_atomic_helper_connector_duplicate_state()
623 state->commit = NULL; in __drm_atomic_helper_connector_duplicate_state()
625 if (state->hdr_output_metadata) in __drm_atomic_helper_connector_duplicate_state()
626 drm_property_blob_get(state->hdr_output_metadata); in __drm_atomic_helper_connector_duplicate_state()
629 state->writeback_job = NULL; in __drm_atomic_helper_connector_duplicate_state()
634 * drm_atomic_helper_connector_duplicate_state - default state duplicate hook
637 * Default connector state duplicate hook for drivers which don't have their own
638 * subclassed connector state structure.
643 struct drm_connector_state *state; in drm_atomic_helper_connector_duplicate_state() local
645 if (WARN_ON(!connector->state)) in drm_atomic_helper_connector_duplicate_state()
648 state = kmalloc(sizeof(*state), GFP_KERNEL); in drm_atomic_helper_connector_duplicate_state()
649 if (state) in drm_atomic_helper_connector_duplicate_state()
650 __drm_atomic_helper_connector_duplicate_state(connector, state); in drm_atomic_helper_connector_duplicate_state()
652 return state; in drm_atomic_helper_connector_duplicate_state()
657 * __drm_atomic_helper_connector_destroy_state - release connector state
658 * @state: connector state object to release
660 * Releases all resources stored in the connector state without actually
661 * freeing the memory of the connector state. This is useful for drivers that
662 * subclass the connector state.
665 __drm_atomic_helper_connector_destroy_state(struct drm_connector_state *state) in __drm_atomic_helper_connector_destroy_state() argument
667 if (state->crtc) in __drm_atomic_helper_connector_destroy_state()
668 drm_connector_put(state->connector); in __drm_atomic_helper_connector_destroy_state()
670 if (state->commit) in __drm_atomic_helper_connector_destroy_state()
671 drm_crtc_commit_put(state->commit); in __drm_atomic_helper_connector_destroy_state()
673 if (state->writeback_job) in __drm_atomic_helper_connector_destroy_state()
674 drm_writeback_cleanup_job(state->writeback_job); in __drm_atomic_helper_connector_destroy_state()
676 drm_property_blob_put(state->hdr_output_metadata); in __drm_atomic_helper_connector_destroy_state()
681 * drm_atomic_helper_connector_destroy_state - default state destroy hook
683 * @state: connector state object to release
685 * Default connector state destroy hook for drivers which don't have their own
686 * subclassed connector state structure.
689 struct drm_connector_state *state) in drm_atomic_helper_connector_destroy_state() argument
691 __drm_atomic_helper_connector_destroy_state(state); in drm_atomic_helper_connector_destroy_state()
692 kfree(state); in drm_atomic_helper_connector_destroy_state()
697 * __drm_atomic_helper_private_obj_duplicate_state - copy atomic private state
699 * @state: new private object state
701 * Copies atomic state from a private objects's current state and resets inferred values.
702 * This is useful for drivers that subclass the private state.
705 struct drm_private_state *state) in __drm_atomic_helper_private_obj_duplicate_state() argument
707 memcpy(state, obj->state, sizeof(*state)); in __drm_atomic_helper_private_obj_duplicate_state()
712 * __drm_atomic_helper_bridge_duplicate_state() - Copy atomic bridge state
714 * @state: atomic bridge state
716 * Copies atomic state from a bridge's current state and resets inferred values.
717 * This is useful for drivers that subclass the bridge state.
720 struct drm_bridge_state *state) in __drm_atomic_helper_bridge_duplicate_state() argument
723 &state->base); in __drm_atomic_helper_bridge_duplicate_state()
724 state->bridge = bridge; in __drm_atomic_helper_bridge_duplicate_state()
729 * drm_atomic_helper_bridge_duplicate_state() - Duplicate a bridge state object
732 * Allocates a new bridge state and initializes it with the current bridge
733 * state values. This helper is meant to be used as a bridge
735 * subclass the bridge state.
742 if (WARN_ON(!bridge->base.state)) in drm_atomic_helper_bridge_duplicate_state()
754 * drm_atomic_helper_bridge_destroy_state() - Destroy a bridge state object
755 * @bridge: the bridge this state refers to
756 * @state: bridge state to destroy
758 * Destroys a bridge state previously created by
762 * that don't subclass the bridge state.
765 struct drm_bridge_state *state) in drm_atomic_helper_bridge_destroy_state() argument
767 kfree(state); in drm_atomic_helper_bridge_destroy_state()
772 * __drm_atomic_helper_bridge_reset() - Initialize a bridge state to its
774 * @bridge: the bridge this state refers to
775 * @state: bridge state to initialize
777 * Initializes the bridge state to default values. This is meant to be called
779 * the bridge state.
782 struct drm_bridge_state *state) in __drm_atomic_helper_bridge_reset() argument
784 memset(state, 0, sizeof(*state)); in __drm_atomic_helper_bridge_reset()
785 state->bridge = bridge; in __drm_atomic_helper_bridge_reset()
790 * drm_atomic_helper_bridge_reset() - Allocate and initialize a bridge state
792 * @bridge: the bridge this state refers to
794 * Allocates the bridge state and initializes it to default values. This helper
796 * bridges that don't subclass the bridge state.