Lines Matching +full:simple +full:- +full:framebuffer

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 #include <linux/dma-resv.h>
17 * The GEM atomic helpers library implements generic atomic-commit
19 * synchronization helpers, and plane state and framebuffer BO mappings
22 * Before scanout, a plane's framebuffer needs to be synchronized with
23 * possible writers that draw into the framebuffer. All drivers should
26 * the framebuffer so that the DRM core can synchronize access automatically.
33 * .. code-block:: c
48 * into the HW's framebuffer memory during an atomic update. This requires
50 * cannot be established by commit-tail functions, such as atomic_update,
53 * The helpers for shadow-buffered planes establish and release mappings,
55 * for commit-tail functions.
57 * Shadow-buffered planes can easily be enabled by using the provided macros
59 * These macros set up the plane and plane-helper callbacks to point to the
60 * shadow-buffer helpers.
62 * .. code-block:: c
76 * In the driver's atomic-update function, shadow-buffer mappings are available
80 * .. code-block:: c
85 * struct drm_plane_state *plane_state = plane->state;
89 * // access shadow buffer via shadow_plane_state->map
92 * A mapping address for each of the framebuffer's buffer object is stored in
98 * callbacks. Access to shadow-buffer mappings is similar to regular
101 * .. code-block:: c
115 * // access shadow buffer via shadow_plane_state->map
124 * drm_gem_plane_helper_prepare_fb() - Prepare a GEM backed framebuffer
134 * There is no need for &drm_plane_helper_funcs.cleanup_fb hook for simple
135 * GEM based framebuffer drivers which have their buffers always pinned in
149 if (!state->fb) in drm_gem_plane_helper_prepare_fb()
152 obj = drm_gem_fb_get_obj(state->fb, 0); in drm_gem_plane_helper_prepare_fb()
153 fence = dma_resv_get_excl_unlocked(obj->resv); in drm_gem_plane_helper_prepare_fb()
161 * drm_gem_simple_display_pipe_prepare_fb - prepare_fb helper for &drm_simple_display_pipe
162 * @pipe: Simple display pipe
177 return drm_gem_plane_helper_prepare_fb(&pipe->plane, plane_state); in drm_gem_simple_display_pipe_prepare_fb()
182 * Shadow-buffered Planes
186 * __drm_gem_duplicate_shadow_plane_state - duplicates shadow-buffered plane state
188 * @new_shadow_plane_state: the new shadow-buffered plane state
190 * This function duplicates shadow-buffered plane state. This is helpful for drivers
202 __drm_atomic_helper_plane_duplicate_state(plane, &new_shadow_plane_state->base); in __drm_gem_duplicate_shadow_plane_state()
207 * drm_gem_duplicate_shadow_plane_state - duplicates shadow-buffered plane state
211 * shadow-buffered planes. It assumes the existing state to be of type
226 struct drm_plane_state *plane_state = plane->state; in drm_gem_duplicate_shadow_plane_state()
237 return &new_shadow_plane_state->base; in drm_gem_duplicate_shadow_plane_state()
242 * __drm_gem_destroy_shadow_plane_state - cleans up shadow-buffered plane state
243 * @shadow_plane_state: the shadow-buffered plane state
245 * This function cleans up shadow-buffered plane state. Helpful for drivers that
250 __drm_atomic_helper_plane_destroy_state(&shadow_plane_state->base); in __drm_gem_destroy_shadow_plane_state()
255 * drm_gem_destroy_shadow_plane_state - deletes shadow-buffered plane state
260 * for shadow-buffered planes. It expects that mappings of shadow buffers
275 * __drm_gem_reset_shadow_plane - resets a shadow-buffered plane
277 * @shadow_plane_state: the shadow-buffered plane state
279 * This function resets state for shadow-buffered planes. Helpful
285 __drm_atomic_helper_plane_reset(plane, &shadow_plane_state->base); in __drm_gem_reset_shadow_plane()
290 * drm_gem_reset_shadow_plane - resets a shadow-buffered plane
294 * shadow-buffered planes. It assumes the current plane state to be
302 if (plane->state) { in drm_gem_reset_shadow_plane()
303 drm_gem_destroy_shadow_plane_state(plane, plane->state); in drm_gem_reset_shadow_plane()
304 plane->state = NULL; /* must be set to NULL here */ in drm_gem_reset_shadow_plane()
315 * drm_gem_prepare_shadow_fb - prepares shadow framebuffers
320 * maps all buffer objects of the plane's framebuffer into kernel address
322 * framebuffer will be synchronized as part of the atomic commit.
332 struct drm_framebuffer *fb = plane_state->fb; in drm_gem_prepare_shadow_fb()
342 return drm_gem_fb_vmap(fb, shadow_plane_state->map, shadow_plane_state->data); in drm_gem_prepare_shadow_fb()
347 * drm_gem_cleanup_shadow_fb - releases shadow framebuffers
352 * This function unmaps all buffer objects of the plane's framebuffer.
359 struct drm_framebuffer *fb = plane_state->fb; in drm_gem_cleanup_shadow_fb()
364 drm_gem_fb_vunmap(fb, shadow_plane_state->map); in drm_gem_cleanup_shadow_fb()
369 * drm_gem_simple_kms_prepare_shadow_fb - prepares shadow framebuffers
370 * @pipe: the simple display pipe
374 * maps all buffer objects of the plane's framebuffer into kernel address
376 * framebuffer will be synchronized as part of the atomic commit.
386 return drm_gem_prepare_shadow_fb(&pipe->plane, plane_state); in drm_gem_simple_kms_prepare_shadow_fb()
391 * drm_gem_simple_kms_cleanup_shadow_fb - releases shadow framebuffers
392 * @pipe: the simple display pipe
396 * This function unmaps all buffer objects of the plane's framebuffer.
403 drm_gem_cleanup_shadow_fb(&pipe->plane, plane_state); in drm_gem_simple_kms_cleanup_shadow_fb()
408 * drm_gem_simple_kms_reset_shadow_plane - resets a shadow-buffered plane
409 * @pipe: the simple display pipe
412 * for shadow-buffered planes.
416 drm_gem_reset_shadow_plane(&pipe->plane); in drm_gem_simple_kms_reset_shadow_plane()
421 * drm_gem_simple_kms_duplicate_shadow_plane_state - duplicates shadow-buffered plane state
422 * @pipe: the simple display pipe
425 * for shadow-buffered planes. It does not duplicate existing mappings of the shadow
435 return drm_gem_duplicate_shadow_plane_state(&pipe->plane); in drm_gem_simple_kms_duplicate_shadow_plane_state()
440 * drm_gem_simple_kms_destroy_shadow_plane_state - resets shadow-buffered plane state
441 * @pipe: the simple display pipe
445 * for shadow-buffered planes. It expects that mappings of shadow buffers
451 drm_gem_destroy_shadow_plane_state(&pipe->plane, plane_state); in drm_gem_simple_kms_destroy_shadow_plane_state()