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>
20 * The GEM atomic helpers library implements generic atomic-commit
33 * .. code-block:: c
45 * cannot be established by commit-tail functions, such as atomic_update,
48 * The helpers for shadow-buffered planes establish and release mappings,
50 * for commit-tail functions.
52 * Shadow-buffered planes can easily be enabled by using the provided macros
54 * These macros set up the plane and plane-helper callbacks to point to the
55 * shadow-buffer helpers.
57 * .. code-block:: c
71 * In the driver's atomic-update function, shadow-buffer mappings are available
75 * .. code-block:: c
80 * struct drm_plane_state *plane_state = plane->state;
84 * // access shadow buffer via shadow_plane_state->map
93 * callbacks. Access to shadow-buffer mappings is similar to regular
96 * .. code-block:: c
110 * // access shadow buffer via shadow_plane_state->map
119 * drm_gem_plane_helper_prepare_fb() - Prepare a GEM backed framebuffer
139 struct dma_fence *fence = dma_fence_get(state->fence); in drm_gem_plane_helper_prepare_fb()
144 if (!state->fb) in drm_gem_plane_helper_prepare_fb()
152 * which is important to make explicit fencing use-cases work: One in drm_gem_plane_helper_prepare_fb()
162 for (i = 0; i < state->fb->format->num_planes; ++i) { in drm_gem_plane_helper_prepare_fb()
163 struct drm_gem_object *obj = drm_gem_fb_get_obj(state->fb, i); in drm_gem_plane_helper_prepare_fb()
167 ret = -EINVAL; in drm_gem_plane_helper_prepare_fb()
171 ret = dma_resv_get_singleton(obj->resv, usage, &new); in drm_gem_plane_helper_prepare_fb()
179 ret = -ENOMEM; in drm_gem_plane_helper_prepare_fb()
184 fence = &chain->base; in drm_gem_plane_helper_prepare_fb()
191 dma_fence_put(state->fence); in drm_gem_plane_helper_prepare_fb()
192 state->fence = fence; in drm_gem_plane_helper_prepare_fb()
202 * Shadow-buffered Planes
206 * __drm_gem_duplicate_shadow_plane_state - duplicates shadow-buffered plane state
208 * @new_shadow_plane_state: the new shadow-buffered plane state
210 * This function duplicates shadow-buffered plane state. This is helpful for drivers
222 struct drm_plane_state *plane_state = plane->state; in __drm_gem_duplicate_shadow_plane_state()
226 __drm_atomic_helper_plane_duplicate_state(plane, &new_shadow_plane_state->base); in __drm_gem_duplicate_shadow_plane_state()
228 drm_format_conv_state_copy(&new_shadow_plane_state->fmtcnv_state, in __drm_gem_duplicate_shadow_plane_state()
229 &shadow_plane_state->fmtcnv_state); in __drm_gem_duplicate_shadow_plane_state()
234 * drm_gem_duplicate_shadow_plane_state - duplicates shadow-buffered plane state
238 * shadow-buffered planes. It assumes the existing state to be of type
253 struct drm_plane_state *plane_state = plane->state; in drm_gem_duplicate_shadow_plane_state()
264 return &new_shadow_plane_state->base; in drm_gem_duplicate_shadow_plane_state()
269 * __drm_gem_destroy_shadow_plane_state - cleans up shadow-buffered plane state
270 * @shadow_plane_state: the shadow-buffered plane state
272 * This function cleans up shadow-buffered plane state. Helpful for drivers that
277 drm_format_conv_state_release(&shadow_plane_state->fmtcnv_state); in __drm_gem_destroy_shadow_plane_state()
278 __drm_atomic_helper_plane_destroy_state(&shadow_plane_state->base); in __drm_gem_destroy_shadow_plane_state()
283 * drm_gem_destroy_shadow_plane_state - deletes shadow-buffered plane state
288 * for shadow-buffered planes. It expects that mappings of shadow buffers
303 * __drm_gem_reset_shadow_plane - resets a shadow-buffered plane
305 * @shadow_plane_state: the shadow-buffered plane state
307 * This function resets state for shadow-buffered planes. Helpful
314 __drm_atomic_helper_plane_reset(plane, &shadow_plane_state->base); in __drm_gem_reset_shadow_plane()
315 drm_format_conv_state_init(&shadow_plane_state->fmtcnv_state); in __drm_gem_reset_shadow_plane()
323 * drm_gem_reset_shadow_plane - resets a shadow-buffered plane
327 * shadow-buffered planes. It assumes the current plane state to be
335 if (plane->state) { in drm_gem_reset_shadow_plane()
336 drm_gem_destroy_shadow_plane_state(plane, plane->state); in drm_gem_reset_shadow_plane()
337 plane->state = NULL; /* must be set to NULL here */ in drm_gem_reset_shadow_plane()
348 * drm_gem_begin_shadow_fb_access - prepares shadow framebuffers for CPU access
360 * 0 on success, or a negative errno code otherwise.
365 struct drm_framebuffer *fb = plane_state->fb; in drm_gem_begin_shadow_fb_access()
370 return drm_gem_fb_vmap(fb, shadow_plane_state->map, shadow_plane_state->data); in drm_gem_begin_shadow_fb_access()
375 * drm_gem_end_shadow_fb_access - releases shadow framebuffers from CPU access
387 struct drm_framebuffer *fb = plane_state->fb; in drm_gem_end_shadow_fb_access()
392 drm_gem_fb_vunmap(fb, shadow_plane_state->map); in drm_gem_end_shadow_fb_access()
397 * drm_gem_simple_kms_begin_shadow_fb_access - prepares shadow framebuffers for CPU access
407 * 0 on success, or a negative errno code otherwise.
412 return drm_gem_begin_shadow_fb_access(&pipe->plane, plane_state); in drm_gem_simple_kms_begin_shadow_fb_access()
417 * drm_gem_simple_kms_end_shadow_fb_access - releases shadow framebuffers from CPU access
430 drm_gem_end_shadow_fb_access(&pipe->plane, plane_state); in drm_gem_simple_kms_end_shadow_fb_access()
435 * drm_gem_simple_kms_reset_shadow_plane - resets a shadow-buffered plane
439 * for shadow-buffered planes.
443 drm_gem_reset_shadow_plane(&pipe->plane); in drm_gem_simple_kms_reset_shadow_plane()
448 * drm_gem_simple_kms_duplicate_shadow_plane_state - duplicates shadow-buffered plane state
452 * for shadow-buffered planes. It does not duplicate existing mappings of the shadow
462 return drm_gem_duplicate_shadow_plane_state(&pipe->plane); in drm_gem_simple_kms_duplicate_shadow_plane_state()
467 * drm_gem_simple_kms_destroy_shadow_plane_state - resets shadow-buffered plane state
472 * for shadow-buffered planes. It expects that mappings of shadow buffers
478 drm_gem_destroy_shadow_plane_state(&pipe->plane, plane_state); in drm_gem_simple_kms_destroy_shadow_plane_state()