Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v5.15-rc5 128 lines 4.7 kB view raw
1/* SPDX-License-Identifier: GPL-2.0-or-later */ 2 3#ifndef __DRM_GEM_ATOMIC_HELPER_H__ 4#define __DRM_GEM_ATOMIC_HELPER_H__ 5 6#include <linux/dma-buf-map.h> 7 8#include <drm/drm_fourcc.h> 9#include <drm/drm_plane.h> 10 11struct drm_simple_display_pipe; 12 13/* 14 * Plane Helpers 15 */ 16 17int drm_gem_plane_helper_prepare_fb(struct drm_plane *plane, struct drm_plane_state *state); 18int drm_gem_simple_display_pipe_prepare_fb(struct drm_simple_display_pipe *pipe, 19 struct drm_plane_state *plane_state); 20 21/* 22 * Helpers for planes with shadow buffers 23 */ 24 25/** 26 * struct drm_shadow_plane_state - plane state for planes with shadow buffers 27 * 28 * For planes that use a shadow buffer, struct drm_shadow_plane_state 29 * provides the regular plane state plus mappings of the shadow buffer 30 * into kernel address space. 31 */ 32struct drm_shadow_plane_state { 33 /** @base: plane state */ 34 struct drm_plane_state base; 35 36 /* Transitional state - do not export or duplicate */ 37 38 /** 39 * @map: Mappings of the plane's framebuffer BOs in to kernel address space 40 * 41 * The memory mappings stored in map should be established in the plane's 42 * prepare_fb callback and removed in the cleanup_fb callback. 43 */ 44 struct dma_buf_map map[DRM_FORMAT_MAX_PLANES]; 45 46 /** 47 * @data: Address of each framebuffer BO's data 48 * 49 * The address of the data stored in each mapping. This is different 50 * for framebuffers with non-zero offset fields. 51 */ 52 struct dma_buf_map data[DRM_FORMAT_MAX_PLANES]; 53}; 54 55/** 56 * to_drm_shadow_plane_state - upcasts from struct drm_plane_state 57 * @state: the plane state 58 */ 59static inline struct drm_shadow_plane_state * 60to_drm_shadow_plane_state(struct drm_plane_state *state) 61{ 62 return container_of(state, struct drm_shadow_plane_state, base); 63} 64 65void __drm_gem_duplicate_shadow_plane_state(struct drm_plane *plane, 66 struct drm_shadow_plane_state *new_shadow_plane_state); 67void __drm_gem_destroy_shadow_plane_state(struct drm_shadow_plane_state *shadow_plane_state); 68void __drm_gem_reset_shadow_plane(struct drm_plane *plane, 69 struct drm_shadow_plane_state *shadow_plane_state); 70 71void drm_gem_reset_shadow_plane(struct drm_plane *plane); 72struct drm_plane_state *drm_gem_duplicate_shadow_plane_state(struct drm_plane *plane); 73void drm_gem_destroy_shadow_plane_state(struct drm_plane *plane, 74 struct drm_plane_state *plane_state); 75 76/** 77 * DRM_GEM_SHADOW_PLANE_FUNCS - 78 * Initializes struct drm_plane_funcs for shadow-buffered planes 79 * 80 * Drivers may use GEM BOs as shadow buffers over the framebuffer memory. This 81 * macro initializes struct drm_plane_funcs to use the rsp helper functions. 82 */ 83#define DRM_GEM_SHADOW_PLANE_FUNCS \ 84 .reset = drm_gem_reset_shadow_plane, \ 85 .atomic_duplicate_state = drm_gem_duplicate_shadow_plane_state, \ 86 .atomic_destroy_state = drm_gem_destroy_shadow_plane_state 87 88int drm_gem_prepare_shadow_fb(struct drm_plane *plane, struct drm_plane_state *plane_state); 89void drm_gem_cleanup_shadow_fb(struct drm_plane *plane, struct drm_plane_state *plane_state); 90 91/** 92 * DRM_GEM_SHADOW_PLANE_HELPER_FUNCS - 93 * Initializes struct drm_plane_helper_funcs for shadow-buffered planes 94 * 95 * Drivers may use GEM BOs as shadow buffers over the framebuffer memory. This 96 * macro initializes struct drm_plane_helper_funcs to use the rsp helper 97 * functions. 98 */ 99#define DRM_GEM_SHADOW_PLANE_HELPER_FUNCS \ 100 .prepare_fb = drm_gem_prepare_shadow_fb, \ 101 .cleanup_fb = drm_gem_cleanup_shadow_fb 102 103int drm_gem_simple_kms_prepare_shadow_fb(struct drm_simple_display_pipe *pipe, 104 struct drm_plane_state *plane_state); 105void drm_gem_simple_kms_cleanup_shadow_fb(struct drm_simple_display_pipe *pipe, 106 struct drm_plane_state *plane_state); 107void drm_gem_simple_kms_reset_shadow_plane(struct drm_simple_display_pipe *pipe); 108struct drm_plane_state * 109drm_gem_simple_kms_duplicate_shadow_plane_state(struct drm_simple_display_pipe *pipe); 110void drm_gem_simple_kms_destroy_shadow_plane_state(struct drm_simple_display_pipe *pipe, 111 struct drm_plane_state *plane_state); 112 113/** 114 * DRM_GEM_SIMPLE_DISPLAY_PIPE_SHADOW_PLANE_FUNCS - 115 * Initializes struct drm_simple_display_pipe_funcs for shadow-buffered planes 116 * 117 * Drivers may use GEM BOs as shadow buffers over the framebuffer memory. This 118 * macro initializes struct drm_simple_display_pipe_funcs to use the rsp helper 119 * functions. 120 */ 121#define DRM_GEM_SIMPLE_DISPLAY_PIPE_SHADOW_PLANE_FUNCS \ 122 .prepare_fb = drm_gem_simple_kms_prepare_shadow_fb, \ 123 .cleanup_fb = drm_gem_simple_kms_cleanup_shadow_fb, \ 124 .reset_plane = drm_gem_simple_kms_reset_shadow_plane, \ 125 .duplicate_plane_state = drm_gem_simple_kms_duplicate_shadow_plane_state, \ 126 .destroy_plane_state = drm_gem_simple_kms_destroy_shadow_plane_state 127 128#endif /* __DRM_GEM_ATOMIC_HELPER_H__ */