| @@ -42,11 +42,8 @@ · 41 unmodified lines |
| 42 | * primary plane support on top of the normal CRTC configuration interface. | 42 | * primary plane support on top of the normal CRTC configuration interface. |
| 43 | * Since the legacy &drm_mode_config_funcs.set_config interface ties the primary | 43 | * Since the legacy &drm_mode_config_funcs.set_config interface ties the primary |
| 44 | * plane together with the CRTC state this does not allow userspace to disable | 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 | 45 | * the primary plane itself. The default primary plane only expose XRBG8888 and |
| 46 | * drm_plane_helper_check_update() which can be used to enforce the same | 46 | * ARGB8888 as valid pixel formats for the attached framebuffer. |
| 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. | | |
| 50 | * | 47 | * |
| 51 | * Drivers are highly recommended to implement proper support for primary | 48 | * Drivers are highly recommended to implement proper support for primary |
| 52 | * planes, and newly merged drivers must not rely upon these transitional | 49 | * planes, and newly merged drivers must not rely upon these transitional |
| @@ -175,50 +172,13 @@ int drm_plane_helper_check_update(struct drm_plane *plane, · 122 unmodified lines |
| 175 | } | 172 | } |
| 176 | EXPORT_SYMBOL(drm_plane_helper_check_update); | 173 | EXPORT_SYMBOL(drm_plane_helper_check_update); |
| 177 | | 174 | |
| 178 | /** | 175 | static int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc, |
| 179 | * drm_primary_helper_update() - Helper for primary plane update | 176 | struct drm_framebuffer *fb, |
| 180 | * @plane: plane object to update | 177 | int crtc_x, int crtc_y, |
| 181 | * @crtc: owning CRTC of owning plane | 178 | unsigned int crtc_w, unsigned int crtc_h, |
| 182 | * @fb: framebuffer to flip onto plane | 179 | uint32_t src_x, uint32_t src_y, |
| 183 | * @crtc_x: x offset of primary plane on crtc | 180 | uint32_t src_w, uint32_t src_h, |
| 184 | * @crtc_y: y offset of primary plane on crtc | 181 | struct drm_modeset_acquire_ctx *ctx) |
| 185 | * @crtc_w: width of primary plane rectangle on crtc | | |
| 186 | * @crtc_h: height of primary plane rectangle on crtc | | |
| 187 | * @src_x: x offset of @fb for panning | | |
| 188 | * @src_y: y offset of @fb for panning | | |
| 189 | * @src_w: width of source rectangle in @fb | | |
| 190 | * @src_h: height of source rectangle in @fb | | |
| 191 | * @ctx: lock acquire context, not used here | | |
| 192 | * | | |
| 193 | * Provides a default plane update handler for primary planes. This is handler | | |
| 194 | * is called in response to a userspace SetPlane operation on the plane with a | | |
| 195 | * non-NULL framebuffer. We call the driver's modeset handler to update the | | |
| 196 | * framebuffer. | | |
| 197 | * | | |
| 198 | * SetPlane() on a primary plane of a disabled CRTC is not supported, and will | | |
| 199 | * return an error. | | |
| 200 | * | | |
| 201 | * Note that we make some assumptions about hardware limitations that may not be | | |
| 202 | * true for all hardware -- | | |
| 203 | * | | |
| 204 | * 1. Primary plane cannot be repositioned. | | |
| 205 | * 2. Primary plane cannot be scaled. | | |
| 206 | * 3. Primary plane must cover the entire CRTC. | | |
| 207 | * 4. Subpixel positioning is not supported. | | |
| 208 | * | | |
| 209 | * Drivers for hardware that don't have these restrictions can provide their | | |
| 210 | * own implementation rather than using this helper. | | |
| 211 | * | | |
| 212 | * RETURNS: | | |
| 213 | * Zero on success, error code on failure | | |
| 214 | */ | | |
| 215 | int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc, | | |
| 216 | struct drm_framebuffer *fb, | | |
| 217 | int crtc_x, int crtc_y, | | |
| 218 | unsigned int crtc_w, unsigned int crtc_h, | | |
| 219 | uint32_t src_x, uint32_t src_y, | | |
| 220 | uint32_t src_w, uint32_t src_h, | | |
| 221 | struct drm_modeset_acquire_ctx *ctx) | | |
| 222 | { | 182 | { |
| 223 | struct drm_mode_set set = { | 183 | struct drm_mode_set set = { |
| 224 | .crtc = crtc, | 184 | .crtc = crtc, |
| @@ -285,35 +245,12 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc, · 60 unmodified lines |
| 285 | kfree(connector_list); | 245 | kfree(connector_list); |
| 286 | return ret; | 246 | return ret; |
| 287 | } | 247 | } |
| 288 | EXPORT_SYMBOL(drm_primary_helper_update); | | |
| 289 | | 248 | |
| 290 | /** | 249 | static int drm_primary_helper_disable(struct drm_plane *plane, |
| 291 | * drm_primary_helper_disable() - Helper for primary plane disable | 250 | struct drm_modeset_acquire_ctx *ctx) |
| 292 | * @plane: plane to disable | | |
| 293 | * @ctx: lock acquire context, not used here | | |
| 294 | * | | |
| 295 | * Provides a default plane disable handler for primary planes. This is handler | | |
| 296 | * is called in response to a userspace SetPlane operation on the plane with a | | |
| 297 | * NULL framebuffer parameter. It unconditionally fails the disable call with | | |
| 298 | * -EINVAL the only way to disable the primary plane without driver support is | | |
| 299 | * to disable the entire CRTC. Which does not match the plane | | |
| 300 | * &drm_plane_funcs.disable_plane hook. | | |
| 301 | * | | |
| 302 | * Note that some hardware may be able to disable the primary plane without | | |
| 303 | * disabling the whole CRTC. Drivers for such hardware should provide their | | |
| 304 | * own disable handler that disables just the primary plane (and they'll likely | | |
| 305 | * need to provide their own update handler as well to properly re-enable a | | |
| 306 | * disabled primary plane). | | |
| 307 | * | | |
| 308 | * RETURNS: | | |
| 309 | * Unconditionally returns -EINVAL. | | |
| 310 | */ | | |
| 311 | int drm_primary_helper_disable(struct drm_plane *plane, | | |
| 312 | struct drm_modeset_acquire_ctx *ctx) | | |
| 313 | { | 251 | { |
| 314 | return -EINVAL; | 252 | return -EINVAL; |
| 315 | } | 253 | } |
| 316 | EXPORT_SYMBOL(drm_primary_helper_disable); | | |
| 317 | | 254 | |
| 318 | /** | 255 | /** |
| 319 | * drm_primary_helper_destroy() - Helper for primary plane destruction | 256 | * drm_primary_helper_destroy() - Helper for primary plane destruction |