17f4dd379Sjsg /*
27f4dd379Sjsg  * Copyright (C) 2011-2013 Intel Corporation
37f4dd379Sjsg  *
47f4dd379Sjsg  * Permission is hereby granted, free of charge, to any person obtaining a
57f4dd379Sjsg  * copy of this software and associated documentation files (the "Software"),
67f4dd379Sjsg  * to deal in the Software without restriction, including without limitation
77f4dd379Sjsg  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
87f4dd379Sjsg  * and/or sell copies of the Software, and to permit persons to whom the
97f4dd379Sjsg  * Software is furnished to do so, subject to the following conditions:
107f4dd379Sjsg  *
117f4dd379Sjsg  * The above copyright notice and this permission notice (including the next
127f4dd379Sjsg  * paragraph) shall be included in all copies or substantial portions of the
137f4dd379Sjsg  * Software.
147f4dd379Sjsg  *
157f4dd379Sjsg  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
167f4dd379Sjsg  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
177f4dd379Sjsg  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
187f4dd379Sjsg  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
197f4dd379Sjsg  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
207f4dd379Sjsg  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
217f4dd379Sjsg  * SOFTWARE.
227f4dd379Sjsg  */
237f4dd379Sjsg 
247f4dd379Sjsg #ifndef DRM_PLANE_HELPER_H
257f4dd379Sjsg #define DRM_PLANE_HELPER_H
267f4dd379Sjsg 
271bb76ff1Sjsg #include <linux/types.h>
287f4dd379Sjsg 
29*44c37aa1Sjsg struct drm_atomic_state;
301bb76ff1Sjsg struct drm_crtc;
311bb76ff1Sjsg struct drm_framebuffer;
321bb76ff1Sjsg struct drm_modeset_acquire_ctx;
331bb76ff1Sjsg struct drm_plane;
341bb76ff1Sjsg 
351bb76ff1Sjsg int drm_plane_helper_update_primary(struct drm_plane *plane, struct drm_crtc *crtc,
361bb76ff1Sjsg 				    struct drm_framebuffer *fb,
371bb76ff1Sjsg 				    int crtc_x, int crtc_y,
381bb76ff1Sjsg 				    unsigned int crtc_w, unsigned int crtc_h,
391bb76ff1Sjsg 				    uint32_t src_x, uint32_t src_y,
401bb76ff1Sjsg 				    uint32_t src_w, uint32_t src_h,
411bb76ff1Sjsg 				    struct drm_modeset_acquire_ctx *ctx);
421bb76ff1Sjsg int drm_plane_helper_disable_primary(struct drm_plane *plane,
431bb76ff1Sjsg 				     struct drm_modeset_acquire_ctx *ctx);
441bb76ff1Sjsg void drm_plane_helper_destroy(struct drm_plane *plane);
451bb76ff1Sjsg int drm_plane_helper_atomic_check(struct drm_plane *plane, struct drm_atomic_state *state);
461bb76ff1Sjsg 
471bb76ff1Sjsg /**
481bb76ff1Sjsg  * DRM_PLANE_NON_ATOMIC_FUNCS - Default plane functions for non-atomic drivers
497f4dd379Sjsg  *
501bb76ff1Sjsg  * This macro initializes plane functions for non-atomic drivers to default
511bb76ff1Sjsg  * values. Non-atomic interfaces are deprecated and should not be used in new
521bb76ff1Sjsg  * drivers.
537f4dd379Sjsg  */
541bb76ff1Sjsg #define DRM_PLANE_NON_ATOMIC_FUNCS \
551bb76ff1Sjsg 	.update_plane = drm_plane_helper_update_primary, \
561bb76ff1Sjsg 	.disable_plane = drm_plane_helper_disable_primary, \
571bb76ff1Sjsg 	.destroy = drm_plane_helper_destroy
587f4dd379Sjsg 
597f4dd379Sjsg #endif
60