Lines Matching +full:buffered +full:- +full:negative
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 #include <linux/dma-resv.h>
4 #include <linux/dma-fence-chain.h>
19 * The GEM atomic helpers library implements generic atomic-commit
32 * .. code-block:: c
44 * cannot be established by commit-tail functions, such as atomic_update,
47 * The helpers for shadow-buffered planes establish and release mappings,
49 * for commit-tail functions.
51 * Shadow-buffered planes can easily be enabled by using the provided macros
53 * These macros set up the plane and plane-helper callbacks to point to the
54 * shadow-buffer helpers.
56 * .. code-block:: c
70 * In the driver's atomic-update function, shadow-buffer mappings are available
74 * .. code-block:: c
79 * struct drm_plane_state *plane_state = plane->state;
83 * // access shadow buffer via shadow_plane_state->map
92 * callbacks. Access to shadow-buffer mappings is similar to regular
95 * .. code-block:: c
109 * // access shadow buffer via shadow_plane_state->map
118 * drm_gem_plane_helper_prepare_fb() - Prepare a GEM backed framebuffer
138 struct dma_fence *fence = dma_fence_get(state->fence); in drm_gem_plane_helper_prepare_fb()
143 if (!state->fb) in drm_gem_plane_helper_prepare_fb()
151 * which is important to make explicit fencing use-cases work: One in drm_gem_plane_helper_prepare_fb()
161 for (i = 0; i < state->fb->format->num_planes; ++i) { in drm_gem_plane_helper_prepare_fb()
162 struct drm_gem_object *obj = drm_gem_fb_get_obj(state->fb, i); in drm_gem_plane_helper_prepare_fb()
166 ret = -EINVAL; in drm_gem_plane_helper_prepare_fb()
170 ret = dma_resv_get_singleton(obj->resv, usage, &new); in drm_gem_plane_helper_prepare_fb()
178 ret = -ENOMEM; in drm_gem_plane_helper_prepare_fb()
183 fence = &chain->base; in drm_gem_plane_helper_prepare_fb()
190 dma_fence_put(state->fence); in drm_gem_plane_helper_prepare_fb()
191 state->fence = fence; in drm_gem_plane_helper_prepare_fb()
201 * Shadow-buffered Planes
205 * __drm_gem_duplicate_shadow_plane_state - duplicates shadow-buffered plane state
207 * @new_shadow_plane_state: the new shadow-buffered plane state
209 * This function duplicates shadow-buffered plane state. This is helpful for drivers
221 struct drm_plane_state *plane_state = plane->state; in __drm_gem_duplicate_shadow_plane_state()
225 __drm_atomic_helper_plane_duplicate_state(plane, &new_shadow_plane_state->base); in __drm_gem_duplicate_shadow_plane_state()
227 drm_format_conv_state_copy(&new_shadow_plane_state->fmtcnv_state, in __drm_gem_duplicate_shadow_plane_state()
228 &shadow_plane_state->fmtcnv_state); in __drm_gem_duplicate_shadow_plane_state()
233 * drm_gem_duplicate_shadow_plane_state - duplicates shadow-buffered plane state
237 * shadow-buffered planes. It assumes the existing state to be of type
252 struct drm_plane_state *plane_state = plane->state; in drm_gem_duplicate_shadow_plane_state()
263 return &new_shadow_plane_state->base; in drm_gem_duplicate_shadow_plane_state()
268 * __drm_gem_destroy_shadow_plane_state - cleans up shadow-buffered plane state
269 * @shadow_plane_state: the shadow-buffered plane state
271 * This function cleans up shadow-buffered plane state. Helpful for drivers that
276 drm_format_conv_state_release(&shadow_plane_state->fmtcnv_state); in __drm_gem_destroy_shadow_plane_state()
277 __drm_atomic_helper_plane_destroy_state(&shadow_plane_state->base); in __drm_gem_destroy_shadow_plane_state()
282 * drm_gem_destroy_shadow_plane_state - deletes shadow-buffered plane state
287 * for shadow-buffered planes. It expects that mappings of shadow buffers
302 * __drm_gem_reset_shadow_plane - resets a shadow-buffered plane
304 * @shadow_plane_state: the shadow-buffered plane state
306 * This function resets state for shadow-buffered planes. Helpful
312 __drm_atomic_helper_plane_reset(plane, &shadow_plane_state->base); in __drm_gem_reset_shadow_plane()
313 drm_format_conv_state_init(&shadow_plane_state->fmtcnv_state); in __drm_gem_reset_shadow_plane()
318 * drm_gem_reset_shadow_plane - resets a shadow-buffered plane
322 * shadow-buffered planes. It assumes the current plane state to be
330 if (plane->state) { in drm_gem_reset_shadow_plane()
331 drm_gem_destroy_shadow_plane_state(plane, plane->state); in drm_gem_reset_shadow_plane()
332 plane->state = NULL; /* must be set to NULL here */ in drm_gem_reset_shadow_plane()
343 * drm_gem_begin_shadow_fb_access - prepares shadow framebuffers for CPU access
355 * 0 on success, or a negative errno code otherwise.
360 struct drm_framebuffer *fb = plane_state->fb; in drm_gem_begin_shadow_fb_access()
365 return drm_gem_fb_vmap(fb, shadow_plane_state->map, shadow_plane_state->data); in drm_gem_begin_shadow_fb_access()
370 * drm_gem_end_shadow_fb_access - releases shadow framebuffers from CPU access
382 struct drm_framebuffer *fb = plane_state->fb; in drm_gem_end_shadow_fb_access()
387 drm_gem_fb_vunmap(fb, shadow_plane_state->map); in drm_gem_end_shadow_fb_access()
392 * drm_gem_simple_kms_begin_shadow_fb_access - prepares shadow framebuffers for CPU access
402 * 0 on success, or a negative errno code otherwise.
407 return drm_gem_begin_shadow_fb_access(&pipe->plane, plane_state); in drm_gem_simple_kms_begin_shadow_fb_access()
412 * drm_gem_simple_kms_end_shadow_fb_access - releases shadow framebuffers from CPU access
425 drm_gem_end_shadow_fb_access(&pipe->plane, plane_state); in drm_gem_simple_kms_end_shadow_fb_access()
430 * drm_gem_simple_kms_reset_shadow_plane - resets a shadow-buffered plane
434 * for shadow-buffered planes.
438 drm_gem_reset_shadow_plane(&pipe->plane); in drm_gem_simple_kms_reset_shadow_plane()
443 * drm_gem_simple_kms_duplicate_shadow_plane_state - duplicates shadow-buffered plane state
447 * for shadow-buffered planes. It does not duplicate existing mappings of the shadow
457 return drm_gem_duplicate_shadow_plane_state(&pipe->plane); in drm_gem_simple_kms_duplicate_shadow_plane_state()
462 * drm_gem_simple_kms_destroy_shadow_plane_state - resets shadow-buffered plane state
467 * for shadow-buffered planes. It expects that mappings of shadow buffers
473 drm_gem_destroy_shadow_plane_state(&pipe->plane, plane_state); in drm_gem_simple_kms_destroy_shadow_plane_state()