1c103d1cfSMatt Roper /*
2c103d1cfSMatt Roper  * Copyright (C) 2011-2013 Intel Corporation
3c103d1cfSMatt Roper  *
4c103d1cfSMatt Roper  * Permission is hereby granted, free of charge, to any person obtaining a
5c103d1cfSMatt Roper  * copy of this software and associated documentation files (the "Software"),
6c103d1cfSMatt Roper  * to deal in the Software without restriction, including without limitation
7c103d1cfSMatt Roper  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8c103d1cfSMatt Roper  * and/or sell copies of the Software, and to permit persons to whom the
9c103d1cfSMatt Roper  * Software is furnished to do so, subject to the following conditions:
10c103d1cfSMatt Roper  *
11c103d1cfSMatt Roper  * The above copyright notice and this permission notice (including the next
12c103d1cfSMatt Roper  * paragraph) shall be included in all copies or substantial portions of the
13c103d1cfSMatt Roper  * Software.
14c103d1cfSMatt Roper  *
15c103d1cfSMatt Roper  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16c103d1cfSMatt Roper  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17c103d1cfSMatt Roper  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18c103d1cfSMatt Roper  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19c103d1cfSMatt Roper  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20c103d1cfSMatt Roper  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21c103d1cfSMatt Roper  * SOFTWARE.
22c103d1cfSMatt Roper  */
23c103d1cfSMatt Roper 
24c103d1cfSMatt Roper #ifndef DRM_PLANE_HELPER_H
25c103d1cfSMatt Roper #define DRM_PLANE_HELPER_H
26c103d1cfSMatt Roper 
2730c63715SThomas Zimmermann #include <linux/types.h>
287daf8d54SMatt Roper 
29*4e699e34SMa Jun struct drm_atomic_state;
3030c63715SThomas Zimmermann struct drm_crtc;
3130c63715SThomas Zimmermann struct drm_framebuffer;
3230c63715SThomas Zimmermann struct drm_modeset_acquire_ctx;
3330c63715SThomas Zimmermann struct drm_plane;
3430c63715SThomas Zimmermann 
3530c63715SThomas Zimmermann int drm_plane_helper_update_primary(struct drm_plane *plane, struct drm_crtc *crtc,
3630c63715SThomas Zimmermann 				    struct drm_framebuffer *fb,
3730c63715SThomas Zimmermann 				    int crtc_x, int crtc_y,
3830c63715SThomas Zimmermann 				    unsigned int crtc_w, unsigned int crtc_h,
3930c63715SThomas Zimmermann 				    uint32_t src_x, uint32_t src_y,
4030c63715SThomas Zimmermann 				    uint32_t src_w, uint32_t src_h,
4130c63715SThomas Zimmermann 				    struct drm_modeset_acquire_ctx *ctx);
4230c63715SThomas Zimmermann int drm_plane_helper_disable_primary(struct drm_plane *plane,
4330c63715SThomas Zimmermann 				     struct drm_modeset_acquire_ctx *ctx);
4430c63715SThomas Zimmermann void drm_plane_helper_destroy(struct drm_plane *plane);
458401bd36SJavier Martinez Canillas int drm_plane_helper_atomic_check(struct drm_plane *plane, struct drm_atomic_state *state);
46c103d1cfSMatt Roper 
4702d6f9a1SThomas Zimmermann /**
4802d6f9a1SThomas Zimmermann  * DRM_PLANE_NON_ATOMIC_FUNCS - Default plane functions for non-atomic drivers
4902d6f9a1SThomas Zimmermann  *
5002d6f9a1SThomas Zimmermann  * This macro initializes plane functions for non-atomic drivers to default
5102d6f9a1SThomas Zimmermann  * values. Non-atomic interfaces are deprecated and should not be used in new
5202d6f9a1SThomas Zimmermann  * drivers.
5302d6f9a1SThomas Zimmermann  */
5402d6f9a1SThomas Zimmermann #define DRM_PLANE_NON_ATOMIC_FUNCS \
5502d6f9a1SThomas Zimmermann 	.update_plane = drm_plane_helper_update_primary, \
5602d6f9a1SThomas Zimmermann 	.disable_plane = drm_plane_helper_disable_primary, \
5702d6f9a1SThomas Zimmermann 	.destroy = drm_plane_helper_destroy
5802d6f9a1SThomas Zimmermann 
59c103d1cfSMatt Roper #endif
60