1301301Sdelphij/* 2275970Scy * Copyright (c) 2006-2009 Red Hat Inc. 3275970Scy * Copyright (c) 2006-2008 Intel Corporation 4275970Scy * Copyright (c) 2007 Dave Airlie <airlied@linux.ie> 5275970Scy * 6301301Sdelphij * DRM framebuffer helper functions 7275970Scy * 8275970Scy * Permission to use, copy, modify, distribute, and sell this software and its 9275970Scy * documentation for any purpose is hereby granted without fee, provided that 10275970Scy * the above copyright notice appear in all copies and that both that copyright 11275970Scy * notice and this permission notice appear in supporting documentation, and 12275970Scy * that the name of the copyright holders not be used in advertising or 13275970Scy * publicity pertaining to distribution of the software without specific, 14275970Scy * written prior permission. The copyright holders make no representations 15275970Scy * about the suitability of this software for any purpose. It is provided "as 16275970Scy * is" without express or implied warranty. 17275970Scy * 18275970Scy * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 19275970Scy * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 20275970Scy * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 21275970Scy * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 22275970Scy * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 23275970Scy * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 24275970Scy * OF THIS SOFTWARE. 25275970Scy * 26275970Scy * Authors: 27275970Scy * Dave Airlie <airlied@linux.ie> 28275970Scy * Jesse Barnes <jesse.barnes@intel.com> 29275970Scy * 30275970Scy * $FreeBSD: releng/10.2/sys/dev/drm2/drm_fb_helper.h 282199 2015-04-28 19:35:05Z dumbbell $ 31275970Scy */ 32275970Scy#ifndef DRM_FB_HELPER_H 33275970Scy#define DRM_FB_HELPER_H 34275970Scy 35275970Scystruct drm_fb_helper; 36275970Scy 37275970Scystruct drm_fb_helper_crtc { 38275970Scy struct drm_mode_set mode_set; 39275970Scy struct drm_display_mode *desired_mode; 40275970Scy}; 41275970Scy 42275970Scystruct drm_fb_helper_surface_size { 43275970Scy u32 fb_width; 44275970Scy u32 fb_height; 45275970Scy u32 surface_width; 46275970Scy u32 surface_height; 47275970Scy u32 surface_bpp; 48275970Scy u32 surface_depth; 49275970Scy}; 50275970Scy 51275970Scystruct drm_fb_helper_funcs { 52275970Scy void (*gamma_set)(struct drm_crtc *crtc, u16 red, u16 green, 53275970Scy u16 blue, int regno); 54275970Scy void (*gamma_get)(struct drm_crtc *crtc, u16 *red, u16 *green, 55275970Scy u16 *blue, int regno); 56275970Scy 57275970Scy int (*fb_probe)(struct drm_fb_helper *helper, 58301301Sdelphij struct drm_fb_helper_surface_size *sizes); 59275970Scy}; 60275970Scy 61275970Scystruct drm_fb_helper_connector { 62275970Scy struct drm_connector *connector; 63275970Scy struct drm_cmdline_mode cmdline_mode; 64275970Scy}; 65275970Scy 66275970Scystruct drm_fb_helper { 67275970Scy struct drm_framebuffer *fb; 68275970Scy struct drm_framebuffer *saved_fb; 69275970Scy struct drm_device *dev; 70275970Scy struct drm_display_mode *mode; 71275970Scy int crtc_count; 72275970Scy struct drm_fb_helper_crtc *crtc_info; 73275970Scy int connector_count; 74275970Scy struct drm_fb_helper_connector **connector_info; 75275970Scy struct drm_fb_helper_funcs *funcs; 76275970Scy struct fb_info *fbdev; 77275970Scy u32 pseudo_palette[17]; 78275970Scy struct list_head kernel_fb_list; 79275970Scy 80275970Scy /* we got a hotplug but fbdev wasn't running the console 81275970Scy delay until next set_par */ 82275970Scy bool delayed_hotplug; 83275970Scy}; 84275970Scy 85275970Scyint drm_fb_helper_single_fb_probe(struct drm_fb_helper *helper, 86275970Scy int preferred_bpp); 87275970Scy 88275970Scyint drm_fb_helper_init(struct drm_device *dev, 89 struct drm_fb_helper *helper, int crtc_count, 90 int max_conn); 91void drm_fb_helper_fini(struct drm_fb_helper *helper); 92int drm_fb_helper_blank(int blank, struct fb_info *info); 93#ifdef FREEBSD_NOTYET 94int drm_fb_helper_pan_display(struct fb_var_screeninfo *var, 95 struct fb_info *info); 96#endif /* FREEBSD_NOTYET */ 97int drm_fb_helper_set_par(struct fb_info *info); 98#ifdef FREEBSD_NOTYET 99int drm_fb_helper_check_var(struct fb_var_screeninfo *var, 100 struct fb_info *info); 101#endif /* FREEBSD_NOTYET */ 102int drm_fb_helper_setcolreg(unsigned regno, 103 unsigned red, 104 unsigned green, 105 unsigned blue, 106 unsigned transp, 107 struct fb_info *info); 108 109bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper); 110void drm_fb_helper_restore(void); 111void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper, 112 uint32_t fb_width, uint32_t fb_height); 113void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, 114 uint32_t depth); 115 116#ifdef FREEBSD_NOTYET 117int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info); 118#endif /* FREEBSD_NOTYET */ 119 120int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper); 121bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel); 122int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper); 123int drm_fb_helper_debug_enter(struct fb_info *info); 124int drm_fb_helper_debug_leave(struct fb_info *info); 125 126#endif 127