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

drm: Unexport primary plane helpers

Well except the destroy helper, which isn't really a primary helper
but generally useful, if mislabelled.

v2: Keep some of the nice comments about the limitations of the
primarmy plane helpers, and put them into the kerneldoc for
drm_crtc_init() (Sam).

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181005094732.31353-1-daniel.vetter@ffwll.ch

+26 -84
+15
drivers/gpu/drm/drm_modeset_helper.c
··· 146 146 * Initialize a CRTC object with a default helper-provided primary plane and no 147 147 * cursor plane. 148 148 * 149 + * Note that we make some assumptions about hardware limitations that may not be 150 + * true for all hardware: 151 + * 152 + * 1. Primary plane cannot be repositioned. 153 + * 2. Primary plane cannot be scaled. 154 + * 3. Primary plane must cover the entire CRTC. 155 + * 4. Subpixel positioning is not supported. 156 + * 5. The primary plane must always be on if the CRTC is enabled. 157 + * 158 + * This is purely a backwards compatibility helper for old drivers. Drivers 159 + * should instead implement their own primary plane. Atomic drivers must do so. 160 + * Drivers with the above hardware restriction can look into using &struct 161 + * drm_simple_display_pipe, which encapsulates the above limitations into a nice 162 + * interface. 163 + * 149 164 * Returns: 150 165 * Zero on success, error code on failure. 151 166 */
+11 -74
drivers/gpu/drm/drm_plane_helper.c
··· 42 42 * primary plane support on top of the normal CRTC configuration interface. 43 43 * Since the legacy &drm_mode_config_funcs.set_config interface ties the primary 44 44 * plane together with the CRTC state this does not allow userspace to disable 45 - * the primary plane itself. To avoid too much duplicated code use 46 - * drm_plane_helper_check_update() which can be used to enforce the same 47 - * restrictions as primary planes had thus. The default primary plane only 48 - * expose XRBG8888 and ARGB8888 as valid pixel formats for the attached 49 - * framebuffer. 45 + * the primary plane itself. The default primary plane only expose XRBG8888 and 46 + * ARGB8888 as valid pixel formats for the attached framebuffer. 50 47 * 51 48 * Drivers are highly recommended to implement proper support for primary 52 49 * planes, and newly merged drivers must not rely upon these transitional ··· 172 175 } 173 176 EXPORT_SYMBOL(drm_plane_helper_check_update); 174 177 175 - /** 176 - * drm_primary_helper_update() - Helper for primary plane update 177 - * @plane: plane object to update 178 - * @crtc: owning CRTC of owning plane 179 - * @fb: framebuffer to flip onto plane 180 - * @crtc_x: x offset of primary plane on crtc 181 - * @crtc_y: y offset of primary plane on crtc 182 - * @crtc_w: width of primary plane rectangle on crtc 183 - * @crtc_h: height of primary plane rectangle on crtc 184 - * @src_x: x offset of @fb for panning 185 - * @src_y: y offset of @fb for panning 186 - * @src_w: width of source rectangle in @fb 187 - * @src_h: height of source rectangle in @fb 188 - * @ctx: lock acquire context, not used here 189 - * 190 - * Provides a default plane update handler for primary planes. This is handler 191 - * is called in response to a userspace SetPlane operation on the plane with a 192 - * non-NULL framebuffer. We call the driver's modeset handler to update the 193 - * framebuffer. 194 - * 195 - * SetPlane() on a primary plane of a disabled CRTC is not supported, and will 196 - * return an error. 197 - * 198 - * Note that we make some assumptions about hardware limitations that may not be 199 - * true for all hardware -- 200 - * 201 - * 1. Primary plane cannot be repositioned. 202 - * 2. Primary plane cannot be scaled. 203 - * 3. Primary plane must cover the entire CRTC. 204 - * 4. Subpixel positioning is not supported. 205 - * 206 - * Drivers for hardware that don't have these restrictions can provide their 207 - * own implementation rather than using this helper. 208 - * 209 - * RETURNS: 210 - * Zero on success, error code on failure 211 - */ 212 - int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc, 213 - struct drm_framebuffer *fb, 214 - int crtc_x, int crtc_y, 215 - unsigned int crtc_w, unsigned int crtc_h, 216 - uint32_t src_x, uint32_t src_y, 217 - uint32_t src_w, uint32_t src_h, 218 - struct drm_modeset_acquire_ctx *ctx) 178 + static int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc, 179 + struct drm_framebuffer *fb, 180 + int crtc_x, int crtc_y, 181 + unsigned int crtc_w, unsigned int crtc_h, 182 + uint32_t src_x, uint32_t src_y, 183 + uint32_t src_w, uint32_t src_h, 184 + struct drm_modeset_acquire_ctx *ctx) 219 185 { 220 186 struct drm_mode_set set = { 221 187 .crtc = crtc, ··· 245 285 kfree(connector_list); 246 286 return ret; 247 287 } 248 - EXPORT_SYMBOL(drm_primary_helper_update); 249 288 250 - /** 251 - * drm_primary_helper_disable() - Helper for primary plane disable 252 - * @plane: plane to disable 253 - * @ctx: lock acquire context, not used here 254 - * 255 - * Provides a default plane disable handler for primary planes. This is handler 256 - * is called in response to a userspace SetPlane operation on the plane with a 257 - * NULL framebuffer parameter. It unconditionally fails the disable call with 258 - * -EINVAL the only way to disable the primary plane without driver support is 259 - * to disable the entire CRTC. Which does not match the plane 260 - * &drm_plane_funcs.disable_plane hook. 261 - * 262 - * Note that some hardware may be able to disable the primary plane without 263 - * disabling the whole CRTC. Drivers for such hardware should provide their 264 - * own disable handler that disables just the primary plane (and they'll likely 265 - * need to provide their own update handler as well to properly re-enable a 266 - * disabled primary plane). 267 - * 268 - * RETURNS: 269 - * Unconditionally returns -EINVAL. 270 - */ 271 - int drm_primary_helper_disable(struct drm_plane *plane, 272 - struct drm_modeset_acquire_ctx *ctx) 289 + static int drm_primary_helper_disable(struct drm_plane *plane, 290 + struct drm_modeset_acquire_ctx *ctx) 273 291 { 274 292 return -EINVAL; 275 293 } 276 - EXPORT_SYMBOL(drm_primary_helper_disable); 277 294 278 295 /** 279 296 * drm_primary_helper_destroy() - Helper for primary plane destruction
-10
include/drm/drm_plane_helper.h
··· 49 49 bool can_position, 50 50 bool can_update_disabled, 51 51 bool *visible); 52 - int drm_primary_helper_update(struct drm_plane *plane, 53 - struct drm_crtc *crtc, 54 - struct drm_framebuffer *fb, 55 - int crtc_x, int crtc_y, 56 - unsigned int crtc_w, unsigned int crtc_h, 57 - uint32_t src_x, uint32_t src_y, 58 - uint32_t src_w, uint32_t src_h, 59 - struct drm_modeset_acquire_ctx *ctx); 60 - int drm_primary_helper_disable(struct drm_plane *plane, 61 - struct drm_modeset_acquire_ctx *ctx); 62 52 void drm_primary_helper_destroy(struct drm_plane *plane); 63 53 extern const struct drm_plane_funcs drm_primary_helper_funcs; 64 54