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 27*7daf8d54SMatt Roper #include <drm/drm_rect.h> 28*7daf8d54SMatt Roper 29*7daf8d54SMatt Roper /* 30*7daf8d54SMatt Roper * Drivers that don't allow primary plane scaling may pass this macro in place 31*7daf8d54SMatt Roper * of the min/max scale parameters of the update checker function. 32*7daf8d54SMatt Roper * 33*7daf8d54SMatt Roper * Due to src being in 16.16 fixed point and dest being in integer pixels, 34*7daf8d54SMatt Roper * 1<<16 represents no scaling. 35*7daf8d54SMatt Roper */ 36*7daf8d54SMatt Roper #define DRM_PLANE_HELPER_NO_SCALING (1<<16) 37*7daf8d54SMatt Roper 38c103d1cfSMatt Roper /** 39c103d1cfSMatt Roper * DOC: plane helpers 40c103d1cfSMatt Roper * 41c103d1cfSMatt Roper * Helper functions to assist with creation and handling of CRTC primary 42c103d1cfSMatt Roper * planes. 43c103d1cfSMatt Roper */ 44c103d1cfSMatt Roper 45*7daf8d54SMatt Roper extern int drm_plane_helper_check_update(struct drm_plane *plane, 46*7daf8d54SMatt Roper struct drm_crtc *crtc, 47*7daf8d54SMatt Roper struct drm_framebuffer *fb, 48*7daf8d54SMatt Roper struct drm_rect *src, 49*7daf8d54SMatt Roper struct drm_rect *dest, 50*7daf8d54SMatt Roper const struct drm_rect *clip, 51*7daf8d54SMatt Roper int min_scale, 52*7daf8d54SMatt Roper int max_scale, 53*7daf8d54SMatt Roper bool can_position, 54*7daf8d54SMatt Roper bool can_update_disabled, 55*7daf8d54SMatt Roper bool *visible); 56c103d1cfSMatt Roper extern int drm_primary_helper_update(struct drm_plane *plane, 57c103d1cfSMatt Roper struct drm_crtc *crtc, 58c103d1cfSMatt Roper struct drm_framebuffer *fb, 59c103d1cfSMatt Roper int crtc_x, int crtc_y, 60c103d1cfSMatt Roper unsigned int crtc_w, unsigned int crtc_h, 61c103d1cfSMatt Roper uint32_t src_x, uint32_t src_y, 62c103d1cfSMatt Roper uint32_t src_w, uint32_t src_h); 63c103d1cfSMatt Roper extern int drm_primary_helper_disable(struct drm_plane *plane); 64c103d1cfSMatt Roper extern void drm_primary_helper_destroy(struct drm_plane *plane); 65c103d1cfSMatt Roper extern const struct drm_plane_funcs drm_primary_helper_funcs; 66c103d1cfSMatt Roper extern struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev, 67f220e626SThierry Reding const uint32_t *formats, 68c103d1cfSMatt Roper int num_formats); 69c103d1cfSMatt Roper 70c103d1cfSMatt Roper 71c103d1cfSMatt Roper #endif 72