Lines Matching full:state

45  * DOC: atomic state reset and initialization
48 * and correct atomic software state for all connectors, CRTCs and planes
50 * suspend. One way to solve this is to have a hardware state read-out
51 * infrastructure which reconstructs the full software state (e.g. the i915
54 * The simpler solution is to just reset the software state to everything off,
58 * On the upside the precise state tracking of atomic simplifies system suspend
66 * __drm_atomic_helper_crtc_state_reset - reset the CRTC state
67 * @crtc_state: atomic CRTC state, must not be NULL
71 * values. This is useful for drivers that subclass the CRTC state.
82 * __drm_atomic_helper_crtc_reset - reset state on CRTC
84 * @crtc_state: CRTC state to assign
87 * the &drm_crtc->state pointer of @crtc, usually required when
91 * This is useful for drivers that subclass the CRTC state.
103 crtc->state = crtc_state;
111 * Resets the atomic state for @crtc by freeing the state pointer (which might
112 * be NULL, e.g. at driver load time) and allocating a new empty state object.
117 kzalloc(sizeof(*crtc->state), GFP_KERNEL);
119 if (crtc->state)
120 crtc->funcs->atomic_destroy_state(crtc, crtc->state);
127 * __drm_atomic_helper_crtc_duplicate_state - copy atomic CRTC state
129 * @state: atomic CRTC state
131 * Copies atomic state from a CRTC's current state and resets inferred values.
132 * This is useful for drivers that subclass the CRTC state.
135 struct drm_crtc_state *state)
137 memcpy(state, crtc->state, sizeof(*state));
139 if (state->mode_blob)
140 drm_property_blob_get(state->mode_blob);
141 if (state->degamma_lut)
142 drm_property_blob_get(state->degamma_lut);
143 if (state->ctm)
144 drm_property_blob_get(state->ctm);
145 if (state->gamma_lut)
146 drm_property_blob_get(state->gamma_lut);
147 state->mode_changed = false;
148 state->active_changed = false;
149 state->planes_changed = false;
150 state->connectors_changed = false;
151 state->color_mgmt_changed = false;
152 state->zpos_changed = false;
153 state->commit = NULL;
154 state->event = NULL;
155 state->async_flip = false;
158 state->active = drm_atomic_crtc_effectively_active(state);
159 state->self_refresh_active = false;
164 * drm_atomic_helper_crtc_duplicate_state - default state duplicate hook
167 * Default CRTC state duplicate hook for drivers which don't have their own
168 * subclassed CRTC state structure.
173 struct drm_crtc_state *state;
175 if (WARN_ON(!crtc->state))
178 state = kmalloc(sizeof(*state), GFP_KERNEL);
179 if (state)
180 __drm_atomic_helper_crtc_duplicate_state(crtc, state);
182 return state;
187 * __drm_atomic_helper_crtc_destroy_state - release CRTC state
188 * @state: CRTC state object to release
190 * Releases all resources stored in the CRTC state without actually freeing
191 * the memory of the CRTC state. This is useful for drivers that subclass the
192 * CRTC state.
194 void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc_state *state)
196 if (state->commit) {
203 * state->event may be freed, so we can't directly look at
204 * state->event->base.completion.
206 if (state->event && state->commit->abort_completion)
207 drm_crtc_commit_put(state->commit);
209 kfree(state->commit->event);
210 state->commit->event = NULL;
212 drm_crtc_commit_put(state->commit);
215 drm_property_blob_put(state->mode_blob);
216 drm_property_blob_put(state->degamma_lut);
217 drm_property_blob_put(state->ctm);
218 drm_property_blob_put(state->gamma_lut);
223 * drm_atomic_helper_crtc_destroy_state - default state destroy hook
225 * @state: CRTC state object to release
227 * Default CRTC state destroy hook for drivers which don't have their own
228 * subclassed CRTC state structure.
231 struct drm_crtc_state *state)
233 __drm_atomic_helper_crtc_destroy_state(state);
234 kfree(state);
239 * __drm_atomic_helper_plane_state_reset - resets plane state to default values
240 * @plane_state: atomic plane state, must not be NULL
244 * values. This is useful for drivers that subclass the CRTC state.
297 * __drm_atomic_helper_plane_reset - reset state on plane
299 * @plane_state: plane state to assign
302 * the &drm_crtc->state pointer of @plane, usually required when
306 * This is useful for drivers that subclass the plane state.
314 plane->state = plane_state;
322 * Resets the atomic state for @plane by freeing the state pointer (which might
323 * be NULL, e.g. at driver load time) and allocating a new empty state object.
327 if (plane->state)
328 __drm_atomic_helper_plane_destroy_state(plane->state);
330 kfree(plane->state);
331 plane->state = kzalloc(sizeof(*plane->state), GFP_KERNEL);
332 if (plane->state)
333 __drm_atomic_helper_plane_reset(plane, plane->state);
338 * __drm_atomic_helper_plane_duplicate_state - copy atomic plane state
340 * @state: atomic plane state
342 * Copies atomic state from a plane's current state. This is useful for
343 * drivers that subclass the plane state.
346 struct drm_plane_state *state)
348 memcpy(state, plane->state, sizeof(*state));
350 if (state->fb)
351 drm_framebuffer_get(state->fb);
353 state->fence = NULL;
354 state->commit = NULL;
355 state->fb_damage_clips = NULL;
356 state->color_mgmt_changed = false;
361 * drm_atomic_helper_plane_duplicate_state - default state duplicate hook
364 * Default plane state duplicate hook for drivers which don't have their own
365 * subclassed plane state structure.
370 struct drm_plane_state *state;
372 if (WARN_ON(!plane->state))
375 state = kmalloc(sizeof(*state), GFP_KERNEL);
376 if (state)
377 __drm_atomic_helper_plane_duplicate_state(plane, state);
379 return state;
384 * __drm_atomic_helper_plane_destroy_state - release plane state
385 * @state: plane state object to release
387 * Releases all resources stored in the plane state without actually freeing
388 * the memory of the plane state. This is useful for drivers that subclass the
389 * plane state.
391 void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state)
393 if (state->fb)
394 drm_framebuffer_put(state->fb);
396 if (state->fence)
397 dma_fence_put(state->fence);
399 if (state->commit)
400 drm_crtc_commit_put(state->commit);
402 drm_property_blob_put(state->fb_damage_clips);
407 * drm_atomic_helper_plane_destroy_state - default state destroy hook
409 * @state: plane state object to release
411 * Default plane state destroy hook for drivers which don't have their own
412 * subclassed plane state structure.
415 struct drm_plane_state *state)
417 __drm_atomic_helper_plane_destroy_state(state);
418 kfree(state);
423 * __drm_atomic_helper_connector_state_reset - reset the connector state
424 * @conn_state: atomic connector state, must not be NULL
428 * values. This is useful for drivers that subclass the connector state.
439 * __drm_atomic_helper_connector_reset - reset state on connector
441 * @conn_state: connector state to assign
444 * the &drm_connector->state pointer of @connector, usually required when
448 * This is useful for drivers that subclass the connector state.
457 connector->state = conn_state;
465 * Resets the atomic state for @connector by freeing the state pointer (which
466 * might be NULL, e.g. at driver load time) and allocating a new empty state
474 if (connector->state)
475 __drm_atomic_helper_connector_destroy_state(connector->state);
477 kfree(connector->state);
491 struct drm_connector_state *state = connector->state;
493 state->tv.margins.left = cmdline->tv_margins.left;
494 state->tv.margins.right = cmdline->tv_margins.right;
495 state->tv.margins.top = cmdline->tv_margins.top;
496 state->tv.margins.bottom = cmdline->tv_margins.bottom;
510 struct drm_connector_state *state = connector->state;
518 state->tv.mode = val;
521 state->tv.mode = cmdline->tv_mode;
527 state->tv.select_subconnector = val;
533 state->tv.subconnector = val;
539 state->tv.brightness = val;
545 state->tv.contrast = val;
551 state->tv.flicker_reduction = val;
557 state->tv.overscan = val;
563 state->tv.saturation = val;
569 state->tv.hue = val;
576 * drm_atomic_helper_connector_tv_check - Validate an analog TV connector state
578 * @state: the DRM State object
580 * Checks the state object to see if the requested state is valid for an
587 struct drm_atomic_state *state)
590 drm_atomic_get_old_connector_state(state, connector);
592 drm_atomic_get_new_connector_state(state, connector);
600 crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
625 * __drm_atomic_helper_connector_duplicate_state - copy atomic connector state
627 * @state: atomic connector state
629 * Copies atomic state from a connector's current state. This is useful for
630 * drivers that subclass the connector state.
634 struct drm_connector_state *state)
636 memcpy(state, connector->state, sizeof(*state));
637 if (state->crtc)
639 state->commit = NULL;
641 if (state->hdr_output_metadata)
642 drm_property_blob_get(state->hdr_output_metadata);
645 state->writeback_job = NULL;
650 * drm_atomic_helper_connector_duplicate_state - default state duplicate hook
653 * Default connector state duplicate hook for drivers which don't have their own
654 * subclassed connector state structure.
659 struct drm_connector_state *state;
661 if (WARN_ON(!connector->state))
664 state = kmalloc(sizeof(*state), GFP_KERNEL);
665 if (state)
666 __drm_atomic_helper_connector_duplicate_state(connector, state);
668 return state;
673 * __drm_atomic_helper_connector_destroy_state - release connector state
674 * @state: connector state object to release
676 * Releases all resources stored in the connector state without actually
677 * freeing the memory of the connector state. This is useful for drivers that
678 * subclass the connector state.
681 __drm_atomic_helper_connector_destroy_state(struct drm_connector_state *state)
683 if (state->crtc)
684 drm_connector_put(state->connector);
686 if (state->commit)
687 drm_crtc_commit_put(state->commit);
689 if (state->writeback_job)
690 drm_writeback_cleanup_job(state->writeback_job);
692 drm_property_blob_put(state->hdr_output_metadata);
697 * drm_atomic_helper_connector_destroy_state - default state destroy hook
699 * @state: connector state object to release
701 * Default connector state destroy hook for drivers which don't have their own
702 * subclassed connector state structure.
705 struct drm_connector_state *state)
707 __drm_atomic_helper_connector_destroy_state(state);
708 kfree(state);
713 * __drm_atomic_helper_private_obj_duplicate_state - copy atomic private state
715 * @state: new private object state
717 * Copies atomic state from a private objects's current state and resets inferred values.
718 * This is useful for drivers that subclass the private state.
721 struct drm_private_state *state)
723 memcpy(state, obj->state, sizeof(*state));
728 * __drm_atomic_helper_bridge_duplicate_state() - Copy atomic bridge state
730 * @state: atomic bridge state
732 * Copies atomic state from a bridge's current state and resets inferred values.
733 * This is useful for drivers that subclass the bridge state.
736 struct drm_bridge_state *state)
739 &state->base);
740 state->bridge = bridge;
745 * drm_atomic_helper_bridge_duplicate_state() - Duplicate a bridge state object
748 * Allocates a new bridge state and initializes it with the current bridge
749 * state values. This helper is meant to be used as a bridge
751 * subclass the bridge state.
758 if (WARN_ON(!bridge->base.state))
770 * drm_atomic_helper_bridge_destroy_state() - Destroy a bridge state object
771 * @bridge: the bridge this state refers to
772 * @state: bridge state to destroy
774 * Destroys a bridge state previously created by
778 * that don't subclass the bridge state.
781 struct drm_bridge_state *state)
783 kfree(state);
788 * __drm_atomic_helper_bridge_reset() - Initialize a bridge state to its
790 * @bridge: the bridge this state refers to
791 * @state: bridge state to initialize
793 * Initializes the bridge state to default values. This is meant to be called
795 * the bridge state.
798 struct drm_bridge_state *state)
800 memset(state, 0, sizeof(*state));
801 state->bridge = bridge;
806 * drm_atomic_helper_bridge_reset() - Allocate and initialize a bridge state
808 * @bridge: the bridge this state refers to
810 * Allocates the bridge state and initializes it to default values. This helper
812 * bridges that don't subclass the bridge state.