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.
296 * __drm_atomic_helper_plane_reset - reset state on plane
298 * @plane_state: plane state to assign
301 * the &drm_crtc->state pointer of @plane, usually required when
305 * This is useful for drivers that subclass the plane state.
313 plane->state = plane_state; in __drm_atomic_helper_plane_reset()
321 * Resets the atomic state for @plane by freeing the state pointer (which might
322 * be NULL, e.g. at driver load time) and allocating a new empty state object.
326 if (plane->state) in drm_atomic_helper_plane_reset()
327 __drm_atomic_helper_plane_destroy_state(plane->state); in drm_atomic_helper_plane_reset()
329 kfree(plane->state); in drm_atomic_helper_plane_reset()
330 plane->state = kzalloc(sizeof(*plane->state), GFP_KERNEL); in drm_atomic_helper_plane_reset()
331 if (plane->state) in drm_atomic_helper_plane_reset()
332 __drm_atomic_helper_plane_reset(plane, plane->state); in drm_atomic_helper_plane_reset()
337 * __drm_atomic_helper_plane_duplicate_state - copy atomic plane state
339 * @state: atomic plane state
341 * Copies atomic state from a plane's current state. This is useful for
342 * drivers that subclass the plane state.
345 struct drm_plane_state *state) in __drm_atomic_helper_plane_duplicate_state() argument
347 memcpy(state, plane->state, sizeof(*state)); in __drm_atomic_helper_plane_duplicate_state()
349 if (state->fb) in __drm_atomic_helper_plane_duplicate_state()
350 drm_framebuffer_get(state->fb); in __drm_atomic_helper_plane_duplicate_state()
352 state->fence = NULL; in __drm_atomic_helper_plane_duplicate_state()
353 state->commit = NULL; in __drm_atomic_helper_plane_duplicate_state()
354 state->fb_damage_clips = NULL; in __drm_atomic_helper_plane_duplicate_state()
355 state->color_mgmt_changed = false; in __drm_atomic_helper_plane_duplicate_state()
360 * drm_atomic_helper_plane_duplicate_state - default state duplicate hook
363 * Default plane state duplicate hook for drivers which don't have their own
364 * subclassed plane state structure.
369 struct drm_plane_state *state; in drm_atomic_helper_plane_duplicate_state() local
371 if (WARN_ON(!plane->state)) in drm_atomic_helper_plane_duplicate_state()
374 state = kmalloc(sizeof(*state), GFP_KERNEL); in drm_atomic_helper_plane_duplicate_state()
375 if (state) in drm_atomic_helper_plane_duplicate_state()
376 __drm_atomic_helper_plane_duplicate_state(plane, state); in drm_atomic_helper_plane_duplicate_state()
378 return state; in drm_atomic_helper_plane_duplicate_state()
383 * __drm_atomic_helper_plane_destroy_state - release plane state
384 * @state: plane state object to release
386 * Releases all resources stored in the plane state without actually freeing
387 * the memory of the plane state. This is useful for drivers that subclass the
388 * plane state.
390 void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state) in __drm_atomic_helper_plane_destroy_state() argument
392 if (state->fb) in __drm_atomic_helper_plane_destroy_state()
393 drm_framebuffer_put(state->fb); in __drm_atomic_helper_plane_destroy_state()
395 if (state->fence) in __drm_atomic_helper_plane_destroy_state()
396 dma_fence_put(state->fence); in __drm_atomic_helper_plane_destroy_state()
398 if (state->commit) in __drm_atomic_helper_plane_destroy_state()
399 drm_crtc_commit_put(state->commit); in __drm_atomic_helper_plane_destroy_state()
401 drm_property_blob_put(state->fb_damage_clips); in __drm_atomic_helper_plane_destroy_state()
406 * drm_atomic_helper_plane_destroy_state - default state destroy hook
408 * @state: plane state object to release
410 * Default plane state destroy hook for drivers which don't have their own
411 * subclassed plane state structure.
414 struct drm_plane_state *state) in drm_atomic_helper_plane_destroy_state() argument
416 __drm_atomic_helper_plane_destroy_state(state); in drm_atomic_helper_plane_destroy_state()
417 kfree(state); in drm_atomic_helper_plane_destroy_state()
422 * __drm_atomic_helper_connector_state_reset - reset the connector state
423 * @conn_state: atomic connector state, must not be NULL
427 * values. This is useful for drivers that subclass the connector state.
438 * __drm_atomic_helper_connector_reset - reset state on connector
440 * @conn_state: connector state to assign
443 * the &drm_connector->state pointer of @connector, usually required when
447 * This is useful for drivers that subclass the connector state.
456 connector->state = conn_state; in __drm_atomic_helper_connector_reset()
464 * Resets the atomic state for @connector by freeing the state pointer (which
465 * might be NULL, e.g. at driver load time) and allocating a new empty state
473 if (connector->state) in drm_atomic_helper_connector_reset()
474 __drm_atomic_helper_connector_destroy_state(connector->state); in drm_atomic_helper_connector_reset()
476 kfree(connector->state); in drm_atomic_helper_connector_reset()
490 struct drm_connector_state *state = connector->state; in drm_atomic_helper_connector_tv_margins_reset() local
492 state->tv.margins.left = cmdline->tv_margins.left; in drm_atomic_helper_connector_tv_margins_reset()
493 state->tv.margins.right = cmdline->tv_margins.right; in drm_atomic_helper_connector_tv_margins_reset()
494 state->tv.margins.top = cmdline->tv_margins.top; in drm_atomic_helper_connector_tv_margins_reset()
495 state->tv.margins.bottom = cmdline->tv_margins.bottom; in drm_atomic_helper_connector_tv_margins_reset()
509 struct drm_connector_state *state = connector->state; in drm_atomic_helper_connector_tv_reset() local
517 state->tv.mode = val; in drm_atomic_helper_connector_tv_reset()
520 state->tv.mode = cmdline->tv_mode; in drm_atomic_helper_connector_tv_reset()
526 state->tv.select_subconnector = val; in drm_atomic_helper_connector_tv_reset()
532 state->tv.subconnector = val; in drm_atomic_helper_connector_tv_reset()
538 state->tv.brightness = val; in drm_atomic_helper_connector_tv_reset()
544 state->tv.contrast = val; in drm_atomic_helper_connector_tv_reset()
550 state->tv.flicker_reduction = val; in drm_atomic_helper_connector_tv_reset()
556 state->tv.overscan = val; in drm_atomic_helper_connector_tv_reset()
562 state->tv.saturation = val; in drm_atomic_helper_connector_tv_reset()
568 state->tv.hue = val; in drm_atomic_helper_connector_tv_reset()
575 * drm_atomic_helper_connector_tv_check - Validate an analog TV connector state
577 * @state: the DRM State object
579 * Checks the state object to see if the requested state is valid for an
586 struct drm_atomic_state *state) in drm_atomic_helper_connector_tv_check() argument
589 drm_atomic_get_old_connector_state(state, connector); in drm_atomic_helper_connector_tv_check()
591 drm_atomic_get_new_connector_state(state, connector); in drm_atomic_helper_connector_tv_check()
599 crtc_state = drm_atomic_get_new_crtc_state(state, crtc); in drm_atomic_helper_connector_tv_check()
624 * __drm_atomic_helper_connector_duplicate_state - copy atomic connector state
626 * @state: atomic connector state
628 * Copies atomic state from a connector's current state. This is useful for
629 * drivers that subclass the connector state.
633 struct drm_connector_state *state) in __drm_atomic_helper_connector_duplicate_state() argument
635 memcpy(state, connector->state, sizeof(*state)); in __drm_atomic_helper_connector_duplicate_state()
636 if (state->crtc) in __drm_atomic_helper_connector_duplicate_state()
638 state->commit = NULL; in __drm_atomic_helper_connector_duplicate_state()
640 if (state->hdr_output_metadata) in __drm_atomic_helper_connector_duplicate_state()
641 drm_property_blob_get(state->hdr_output_metadata); in __drm_atomic_helper_connector_duplicate_state()
644 state->writeback_job = NULL; in __drm_atomic_helper_connector_duplicate_state()
649 * drm_atomic_helper_connector_duplicate_state - default state duplicate hook
652 * Default connector state duplicate hook for drivers which don't have their own
653 * subclassed connector state structure.
658 struct drm_connector_state *state; in drm_atomic_helper_connector_duplicate_state() local
660 if (WARN_ON(!connector->state)) in drm_atomic_helper_connector_duplicate_state()
663 state = kmalloc(sizeof(*state), GFP_KERNEL); in drm_atomic_helper_connector_duplicate_state()
664 if (state) in drm_atomic_helper_connector_duplicate_state()
665 __drm_atomic_helper_connector_duplicate_state(connector, state); in drm_atomic_helper_connector_duplicate_state()
667 return state; in drm_atomic_helper_connector_duplicate_state()
672 * __drm_atomic_helper_connector_destroy_state - release connector state
673 * @state: connector state object to release
675 * Releases all resources stored in the connector state without actually
676 * freeing the memory of the connector state. This is useful for drivers that
677 * subclass the connector state.
680 __drm_atomic_helper_connector_destroy_state(struct drm_connector_state *state) in __drm_atomic_helper_connector_destroy_state() argument
682 if (state->crtc) in __drm_atomic_helper_connector_destroy_state()
683 drm_connector_put(state->connector); in __drm_atomic_helper_connector_destroy_state()
685 if (state->commit) in __drm_atomic_helper_connector_destroy_state()
686 drm_crtc_commit_put(state->commit); in __drm_atomic_helper_connector_destroy_state()
688 if (state->writeback_job) in __drm_atomic_helper_connector_destroy_state()
689 drm_writeback_cleanup_job(state->writeback_job); in __drm_atomic_helper_connector_destroy_state()
691 drm_property_blob_put(state->hdr_output_metadata); in __drm_atomic_helper_connector_destroy_state()
696 * drm_atomic_helper_connector_destroy_state - default state destroy hook
698 * @state: connector state object to release
700 * Default connector state destroy hook for drivers which don't have their own
701 * subclassed connector state structure.
704 struct drm_connector_state *state) in drm_atomic_helper_connector_destroy_state() argument
706 __drm_atomic_helper_connector_destroy_state(state); in drm_atomic_helper_connector_destroy_state()
707 kfree(state); in drm_atomic_helper_connector_destroy_state()
712 * __drm_atomic_helper_private_obj_duplicate_state - copy atomic private state
714 * @state: new private object state
716 * Copies atomic state from a private objects's current state and resets inferred values.
717 * This is useful for drivers that subclass the private state.
720 struct drm_private_state *state) in __drm_atomic_helper_private_obj_duplicate_state() argument
722 memcpy(state, obj->state, sizeof(*state)); in __drm_atomic_helper_private_obj_duplicate_state()
727 * __drm_atomic_helper_bridge_duplicate_state() - Copy atomic bridge state
729 * @state: atomic bridge state
731 * Copies atomic state from a bridge's current state and resets inferred values.
732 * This is useful for drivers that subclass the bridge state.
735 struct drm_bridge_state *state) in __drm_atomic_helper_bridge_duplicate_state() argument
738 &state->base); in __drm_atomic_helper_bridge_duplicate_state()
739 state->bridge = bridge; in __drm_atomic_helper_bridge_duplicate_state()
744 * drm_atomic_helper_bridge_duplicate_state() - Duplicate a bridge state object
747 * Allocates a new bridge state and initializes it with the current bridge
748 * state values. This helper is meant to be used as a bridge
750 * subclass the bridge state.
757 if (WARN_ON(!bridge->base.state)) in drm_atomic_helper_bridge_duplicate_state()
769 * drm_atomic_helper_bridge_destroy_state() - Destroy a bridge state object
770 * @bridge: the bridge this state refers to
771 * @state: bridge state to destroy
773 * Destroys a bridge state previously created by
777 * that don't subclass the bridge state.
780 struct drm_bridge_state *state) in drm_atomic_helper_bridge_destroy_state() argument
782 kfree(state); in drm_atomic_helper_bridge_destroy_state()
787 * __drm_atomic_helper_bridge_reset() - Initialize a bridge state to its
789 * @bridge: the bridge this state refers to
790 * @state: bridge state to initialize
792 * Initializes the bridge state to default values. This is meant to be called
794 * the bridge state.
797 struct drm_bridge_state *state) in __drm_atomic_helper_bridge_reset() argument
799 memset(state, 0, sizeof(*state)); in __drm_atomic_helper_bridge_reset()
800 state->bridge = bridge; in __drm_atomic_helper_bridge_reset()
805 * drm_atomic_helper_bridge_reset() - Allocate and initialize a bridge state
807 * @bridge: the bridge this state refers to
809 * Allocates the bridge state and initializes it to default values. This helper
811 * bridges that don't subclass the bridge state.