0001
0002
0003 #ifndef __DRM_GEM_ATOMIC_HELPER_H__
0004 #define __DRM_GEM_ATOMIC_HELPER_H__
0005
0006 #include <linux/iosys-map.h>
0007
0008 #include <drm/drm_fourcc.h>
0009 #include <drm/drm_plane.h>
0010
0011 struct drm_simple_display_pipe;
0012
0013
0014
0015
0016
0017 int drm_gem_plane_helper_prepare_fb(struct drm_plane *plane, struct drm_plane_state *state);
0018 int drm_gem_simple_display_pipe_prepare_fb(struct drm_simple_display_pipe *pipe,
0019 struct drm_plane_state *plane_state);
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 #define DRM_SHADOW_PLANE_MAX_WIDTH (4096u)
0033
0034
0035
0036
0037
0038
0039
0040
0041 #define DRM_SHADOW_PLANE_MAX_HEIGHT (4096u)
0042
0043
0044
0045
0046
0047
0048
0049
0050 struct drm_shadow_plane_state {
0051
0052 struct drm_plane_state base;
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062 struct iosys_map map[DRM_FORMAT_MAX_PLANES];
0063
0064
0065
0066
0067
0068
0069
0070 struct iosys_map data[DRM_FORMAT_MAX_PLANES];
0071 };
0072
0073
0074
0075
0076
0077 static inline struct drm_shadow_plane_state *
0078 to_drm_shadow_plane_state(struct drm_plane_state *state)
0079 {
0080 return container_of(state, struct drm_shadow_plane_state, base);
0081 }
0082
0083 void __drm_gem_duplicate_shadow_plane_state(struct drm_plane *plane,
0084 struct drm_shadow_plane_state *new_shadow_plane_state);
0085 void __drm_gem_destroy_shadow_plane_state(struct drm_shadow_plane_state *shadow_plane_state);
0086 void __drm_gem_reset_shadow_plane(struct drm_plane *plane,
0087 struct drm_shadow_plane_state *shadow_plane_state);
0088
0089 void drm_gem_reset_shadow_plane(struct drm_plane *plane);
0090 struct drm_plane_state *drm_gem_duplicate_shadow_plane_state(struct drm_plane *plane);
0091 void drm_gem_destroy_shadow_plane_state(struct drm_plane *plane,
0092 struct drm_plane_state *plane_state);
0093
0094
0095
0096
0097
0098
0099
0100
0101 #define DRM_GEM_SHADOW_PLANE_FUNCS \
0102 .reset = drm_gem_reset_shadow_plane, \
0103 .atomic_duplicate_state = drm_gem_duplicate_shadow_plane_state, \
0104 .atomic_destroy_state = drm_gem_destroy_shadow_plane_state
0105
0106 int drm_gem_prepare_shadow_fb(struct drm_plane *plane, struct drm_plane_state *plane_state);
0107 void drm_gem_cleanup_shadow_fb(struct drm_plane *plane, struct drm_plane_state *plane_state);
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117 #define DRM_GEM_SHADOW_PLANE_HELPER_FUNCS \
0118 .prepare_fb = drm_gem_prepare_shadow_fb, \
0119 .cleanup_fb = drm_gem_cleanup_shadow_fb
0120
0121 int drm_gem_simple_kms_prepare_shadow_fb(struct drm_simple_display_pipe *pipe,
0122 struct drm_plane_state *plane_state);
0123 void drm_gem_simple_kms_cleanup_shadow_fb(struct drm_simple_display_pipe *pipe,
0124 struct drm_plane_state *plane_state);
0125 void drm_gem_simple_kms_reset_shadow_plane(struct drm_simple_display_pipe *pipe);
0126 struct drm_plane_state *
0127 drm_gem_simple_kms_duplicate_shadow_plane_state(struct drm_simple_display_pipe *pipe);
0128 void drm_gem_simple_kms_destroy_shadow_plane_state(struct drm_simple_display_pipe *pipe,
0129 struct drm_plane_state *plane_state);
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139 #define DRM_GEM_SIMPLE_DISPLAY_PIPE_SHADOW_PLANE_FUNCS \
0140 .prepare_fb = drm_gem_simple_kms_prepare_shadow_fb, \
0141 .cleanup_fb = drm_gem_simple_kms_cleanup_shadow_fb, \
0142 .reset_plane = drm_gem_simple_kms_reset_shadow_plane, \
0143 .duplicate_plane_state = drm_gem_simple_kms_duplicate_shadow_plane_state, \
0144 .destroy_plane_state = drm_gem_simple_kms_destroy_shadow_plane_state
0145
0146 #endif