Lines Matching full:state

40  * DOC: atomic state reset and initialization
43 * and correct atomic software state for all connectors, CRTCs and planes
45 * suspend. One way to solve this is to have a hardware state read-out
46 * infrastructure which reconstructs the full software state (e.g. the i915
49 * The simpler solution is to just reset the software state to everything off,
53 * On the upside the precise state tracking of atomic simplifies system suspend
61 * __drm_atomic_helper_crtc_reset - reset state on CRTC
63 * @crtc_state: CRTC state to assign
66 * the &drm_crtc->state pointer of @crtc, usually required when
70 * This is useful for drivers that subclass the CRTC state.
79 crtc->state = crtc_state; in __drm_atomic_helper_crtc_reset()
87 * Resets the atomic state for @crtc by freeing the state pointer (which might
88 * be NULL, e.g. at driver load time) and allocating a new empty state object.
93 kzalloc(sizeof(*crtc->state), GFP_KERNEL); in drm_atomic_helper_crtc_reset()
95 if (crtc->state) in drm_atomic_helper_crtc_reset()
96 crtc->funcs->atomic_destroy_state(crtc, crtc->state); in drm_atomic_helper_crtc_reset()
103 * __drm_atomic_helper_crtc_duplicate_state - copy atomic CRTC state
105 * @state: atomic CRTC state
107 * Copies atomic state from a CRTC's current state and resets inferred values.
108 * This is useful for drivers that subclass the CRTC state.
111 struct drm_crtc_state *state) in __drm_atomic_helper_crtc_duplicate_state() argument
113 memcpy(state, crtc->state, sizeof(*state)); in __drm_atomic_helper_crtc_duplicate_state()
115 if (state->mode_blob) in __drm_atomic_helper_crtc_duplicate_state()
116 drm_property_blob_get(state->mode_blob); in __drm_atomic_helper_crtc_duplicate_state()
117 if (state->degamma_lut) in __drm_atomic_helper_crtc_duplicate_state()
118 drm_property_blob_get(state->degamma_lut); in __drm_atomic_helper_crtc_duplicate_state()
119 if (state->ctm) in __drm_atomic_helper_crtc_duplicate_state()
120 drm_property_blob_get(state->ctm); in __drm_atomic_helper_crtc_duplicate_state()
121 if (state->gamma_lut) in __drm_atomic_helper_crtc_duplicate_state()
122 drm_property_blob_get(state->gamma_lut); in __drm_atomic_helper_crtc_duplicate_state()
123 state->mode_changed = false; in __drm_atomic_helper_crtc_duplicate_state()
124 state->active_changed = false; in __drm_atomic_helper_crtc_duplicate_state()
125 state->planes_changed = false; in __drm_atomic_helper_crtc_duplicate_state()
126 state->connectors_changed = false; in __drm_atomic_helper_crtc_duplicate_state()
127 state->color_mgmt_changed = false; in __drm_atomic_helper_crtc_duplicate_state()
128 state->zpos_changed = false; in __drm_atomic_helper_crtc_duplicate_state()
129 state->commit = NULL; in __drm_atomic_helper_crtc_duplicate_state()
130 state->event = NULL; in __drm_atomic_helper_crtc_duplicate_state()
131 state->async_flip = false; in __drm_atomic_helper_crtc_duplicate_state()
134 state->active = drm_atomic_crtc_effectively_active(state); in __drm_atomic_helper_crtc_duplicate_state()
135 state->self_refresh_active = false; in __drm_atomic_helper_crtc_duplicate_state()
140 * drm_atomic_helper_crtc_duplicate_state - default state duplicate hook
143 * Default CRTC state duplicate hook for drivers which don't have their own
144 * subclassed CRTC state structure.
149 struct drm_crtc_state *state; in drm_atomic_helper_crtc_duplicate_state() local
151 if (WARN_ON(!crtc->state)) in drm_atomic_helper_crtc_duplicate_state()
154 state = kmalloc(sizeof(*state), GFP_KERNEL); in drm_atomic_helper_crtc_duplicate_state()
155 if (state) in drm_atomic_helper_crtc_duplicate_state()
156 __drm_atomic_helper_crtc_duplicate_state(crtc, state); in drm_atomic_helper_crtc_duplicate_state()
158 return state; in drm_atomic_helper_crtc_duplicate_state()
163 * __drm_atomic_helper_crtc_destroy_state - release CRTC state
164 * @state: CRTC state object to release
166 * Releases all resources stored in the CRTC state without actually freeing
167 * the memory of the CRTC state. This is useful for drivers that subclass the
168 * CRTC state.
170 void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc_state *state) in __drm_atomic_helper_crtc_destroy_state() argument
172 if (state->commit) { in __drm_atomic_helper_crtc_destroy_state()
179 * state->event may be freed, so we can't directly look at in __drm_atomic_helper_crtc_destroy_state()
180 * state->event->base.completion. in __drm_atomic_helper_crtc_destroy_state()
182 if (state->event && state->commit->abort_completion) in __drm_atomic_helper_crtc_destroy_state()
183 drm_crtc_commit_put(state->commit); in __drm_atomic_helper_crtc_destroy_state()
185 kfree(state->commit->event); in __drm_atomic_helper_crtc_destroy_state()
186 state->commit->event = NULL; in __drm_atomic_helper_crtc_destroy_state()
188 drm_crtc_commit_put(state->commit); in __drm_atomic_helper_crtc_destroy_state()
191 drm_property_blob_put(state->mode_blob); in __drm_atomic_helper_crtc_destroy_state()
192 drm_property_blob_put(state->degamma_lut); in __drm_atomic_helper_crtc_destroy_state()
193 drm_property_blob_put(state->ctm); in __drm_atomic_helper_crtc_destroy_state()
194 drm_property_blob_put(state->gamma_lut); in __drm_atomic_helper_crtc_destroy_state()
199 * drm_atomic_helper_crtc_destroy_state - default state destroy hook
201 * @state: CRTC state object to release
203 * Default CRTC state destroy hook for drivers which don't have their own
204 * subclassed CRTC state structure.
207 struct drm_crtc_state *state) in drm_atomic_helper_crtc_destroy_state() argument
209 __drm_atomic_helper_crtc_destroy_state(state); in drm_atomic_helper_crtc_destroy_state()
210 kfree(state); in drm_atomic_helper_crtc_destroy_state()
215 * __drm_atomic_helper_plane_reset - resets planes state to default values
217 * @state: atomic plane state, must not be NULL
219 * Initializes plane state to default. This is useful for drivers that subclass
220 * the plane state.
223 struct drm_plane_state *state) in __drm_atomic_helper_plane_reset() argument
225 state->plane = plane; in __drm_atomic_helper_plane_reset()
226 state->rotation = DRM_MODE_ROTATE_0; in __drm_atomic_helper_plane_reset()
228 state->alpha = DRM_BLEND_ALPHA_OPAQUE; in __drm_atomic_helper_plane_reset()
229 state->pixel_blend_mode = DRM_MODE_BLEND_PREMULTI; in __drm_atomic_helper_plane_reset()
231 plane->state = state; in __drm_atomic_helper_plane_reset()
239 * Resets the atomic state for @plane by freeing the state pointer (which might
240 * be NULL, e.g. at driver load time) and allocating a new empty state object.
244 if (plane->state) in drm_atomic_helper_plane_reset()
245 __drm_atomic_helper_plane_destroy_state(plane->state); in drm_atomic_helper_plane_reset()
247 kfree(plane->state); in drm_atomic_helper_plane_reset()
248 plane->state = kzalloc(sizeof(*plane->state), GFP_KERNEL); in drm_atomic_helper_plane_reset()
249 if (plane->state) in drm_atomic_helper_plane_reset()
250 __drm_atomic_helper_plane_reset(plane, plane->state); in drm_atomic_helper_plane_reset()
255 * __drm_atomic_helper_plane_duplicate_state - copy atomic plane state
257 * @state: atomic plane state
259 * Copies atomic state from a plane's current state. This is useful for
260 * drivers that subclass the plane state.
263 struct drm_plane_state *state) in __drm_atomic_helper_plane_duplicate_state() argument
265 memcpy(state, plane->state, sizeof(*state)); in __drm_atomic_helper_plane_duplicate_state()
267 if (state->fb) in __drm_atomic_helper_plane_duplicate_state()
268 drm_framebuffer_get(state->fb); in __drm_atomic_helper_plane_duplicate_state()
270 state->fence = NULL; in __drm_atomic_helper_plane_duplicate_state()
271 state->commit = NULL; in __drm_atomic_helper_plane_duplicate_state()
272 state->fb_damage_clips = NULL; in __drm_atomic_helper_plane_duplicate_state()
277 * drm_atomic_helper_plane_duplicate_state - default state duplicate hook
280 * Default plane state duplicate hook for drivers which don't have their own
281 * subclassed plane state structure.
286 struct drm_plane_state *state; in drm_atomic_helper_plane_duplicate_state() local
288 if (WARN_ON(!plane->state)) in drm_atomic_helper_plane_duplicate_state()
291 state = kmalloc(sizeof(*state), GFP_KERNEL); in drm_atomic_helper_plane_duplicate_state()
292 if (state) in drm_atomic_helper_plane_duplicate_state()
293 __drm_atomic_helper_plane_duplicate_state(plane, state); in drm_atomic_helper_plane_duplicate_state()
295 return state; in drm_atomic_helper_plane_duplicate_state()
300 * __drm_atomic_helper_plane_destroy_state - release plane state
301 * @state: plane state object to release
303 * Releases all resources stored in the plane state without actually freeing
304 * the memory of the plane state. This is useful for drivers that subclass the
305 * plane state.
307 void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state) in __drm_atomic_helper_plane_destroy_state() argument
309 if (state->fb) in __drm_atomic_helper_plane_destroy_state()
310 drm_framebuffer_put(state->fb); in __drm_atomic_helper_plane_destroy_state()
312 if (state->fence) in __drm_atomic_helper_plane_destroy_state()
313 dma_fence_put(state->fence); in __drm_atomic_helper_plane_destroy_state()
315 if (state->commit) in __drm_atomic_helper_plane_destroy_state()
316 drm_crtc_commit_put(state->commit); in __drm_atomic_helper_plane_destroy_state()
318 drm_property_blob_put(state->fb_damage_clips); in __drm_atomic_helper_plane_destroy_state()
323 * drm_atomic_helper_plane_destroy_state - default state destroy hook
325 * @state: plane state object to release
327 * Default plane state destroy hook for drivers which don't have their own
328 * subclassed plane state structure.
331 struct drm_plane_state *state) in drm_atomic_helper_plane_destroy_state() argument
333 __drm_atomic_helper_plane_destroy_state(state); in drm_atomic_helper_plane_destroy_state()
334 kfree(state); in drm_atomic_helper_plane_destroy_state()
339 * __drm_atomic_helper_connector_reset - reset state on connector
341 * @conn_state: connector state to assign
344 * the &drm_connector->state pointer of @connector, usually required when
348 * This is useful for drivers that subclass the connector state.
357 connector->state = conn_state; in __drm_atomic_helper_connector_reset()
365 * Resets the atomic state for @connector by freeing the state pointer (which
366 * might be NULL, e.g. at driver load time) and allocating a new empty state
374 if (connector->state) in drm_atomic_helper_connector_reset()
375 __drm_atomic_helper_connector_destroy_state(connector->state); in drm_atomic_helper_connector_reset()
377 kfree(connector->state); in drm_atomic_helper_connector_reset()
391 struct drm_connector_state *state = connector->state; in drm_atomic_helper_connector_tv_reset() local
393 state->tv.margins.left = cmdline->tv_margins.left; in drm_atomic_helper_connector_tv_reset()
394 state->tv.margins.right = cmdline->tv_margins.right; in drm_atomic_helper_connector_tv_reset()
395 state->tv.margins.top = cmdline->tv_margins.top; in drm_atomic_helper_connector_tv_reset()
396 state->tv.margins.bottom = cmdline->tv_margins.bottom; in drm_atomic_helper_connector_tv_reset()
401 * __drm_atomic_helper_connector_duplicate_state - copy atomic connector state
403 * @state: atomic connector state
405 * Copies atomic state from a connector's current state. This is useful for
406 * drivers that subclass the connector state.
410 struct drm_connector_state *state) in __drm_atomic_helper_connector_duplicate_state() argument
412 memcpy(state, connector->state, sizeof(*state)); in __drm_atomic_helper_connector_duplicate_state()
413 if (state->crtc) in __drm_atomic_helper_connector_duplicate_state()
415 state->commit = NULL; in __drm_atomic_helper_connector_duplicate_state()
417 if (state->hdr_output_metadata) in __drm_atomic_helper_connector_duplicate_state()
418 drm_property_blob_get(state->hdr_output_metadata); in __drm_atomic_helper_connector_duplicate_state()
421 state->writeback_job = NULL; in __drm_atomic_helper_connector_duplicate_state()
426 * drm_atomic_helper_connector_duplicate_state - default state duplicate hook
429 * Default connector state duplicate hook for drivers which don't have their own
430 * subclassed connector state structure.
435 struct drm_connector_state *state; in drm_atomic_helper_connector_duplicate_state() local
437 if (WARN_ON(!connector->state)) in drm_atomic_helper_connector_duplicate_state()
440 state = kmalloc(sizeof(*state), GFP_KERNEL); in drm_atomic_helper_connector_duplicate_state()
441 if (state) in drm_atomic_helper_connector_duplicate_state()
442 __drm_atomic_helper_connector_duplicate_state(connector, state); in drm_atomic_helper_connector_duplicate_state()
444 return state; in drm_atomic_helper_connector_duplicate_state()
449 * __drm_atomic_helper_connector_destroy_state - release connector state
450 * @state: connector state object to release
452 * Releases all resources stored in the connector state without actually
453 * freeing the memory of the connector state. This is useful for drivers that
454 * subclass the connector state.
457 __drm_atomic_helper_connector_destroy_state(struct drm_connector_state *state) in __drm_atomic_helper_connector_destroy_state() argument
459 if (state->crtc) in __drm_atomic_helper_connector_destroy_state()
460 drm_connector_put(state->connector); in __drm_atomic_helper_connector_destroy_state()
462 if (state->commit) in __drm_atomic_helper_connector_destroy_state()
463 drm_crtc_commit_put(state->commit); in __drm_atomic_helper_connector_destroy_state()
465 if (state->writeback_job) in __drm_atomic_helper_connector_destroy_state()
466 drm_writeback_cleanup_job(state->writeback_job); in __drm_atomic_helper_connector_destroy_state()
468 drm_property_blob_put(state->hdr_output_metadata); in __drm_atomic_helper_connector_destroy_state()
473 * drm_atomic_helper_connector_destroy_state - default state destroy hook
475 * @state: connector state object to release
477 * Default connector state destroy hook for drivers which don't have their own
478 * subclassed connector state structure.
481 struct drm_connector_state *state) in drm_atomic_helper_connector_destroy_state() argument
483 __drm_atomic_helper_connector_destroy_state(state); in drm_atomic_helper_connector_destroy_state()
484 kfree(state); in drm_atomic_helper_connector_destroy_state()
489 * __drm_atomic_helper_private_duplicate_state - copy atomic private state
491 * @state: new private object state
493 * Copies atomic state from a private objects's current state and resets inferred values.
494 * This is useful for drivers that subclass the private state.
497 struct drm_private_state *state) in __drm_atomic_helper_private_obj_duplicate_state() argument
499 memcpy(state, obj->state, sizeof(*state)); in __drm_atomic_helper_private_obj_duplicate_state()