1235783Skib/* 2235783Skib * Copyright (c) 2006-2009 Red Hat Inc. 3235783Skib * Copyright (c) 2006-2008 Intel Corporation 4235783Skib * Copyright (c) 2007 Dave Airlie <airlied@linux.ie> 5235783Skib * 6235783Skib * DRM framebuffer helper functions 7235783Skib * 8235783Skib * Permission to use, copy, modify, distribute, and sell this software and its 9235783Skib * documentation for any purpose is hereby granted without fee, provided that 10235783Skib * the above copyright notice appear in all copies and that both that copyright 11235783Skib * notice and this permission notice appear in supporting documentation, and 12235783Skib * that the name of the copyright holders not be used in advertising or 13235783Skib * publicity pertaining to distribution of the software without specific, 14235783Skib * written prior permission. The copyright holders make no representations 15235783Skib * about the suitability of this software for any purpose. It is provided "as 16235783Skib * is" without express or implied warranty. 17235783Skib * 18235783Skib * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 19235783Skib * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 20235783Skib * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 21235783Skib * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 22235783Skib * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 23235783Skib * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 24235783Skib * OF THIS SOFTWARE. 25235783Skib * 26235783Skib * Authors: 27235783Skib * Dave Airlie <airlied@linux.ie> 28235783Skib * Jesse Barnes <jesse.barnes@intel.com> 29235783Skib * 30235783Skib * $FreeBSD$ 31235783Skib */ 32235783Skib#ifndef DRM_FB_HELPER_H 33235783Skib#define DRM_FB_HELPER_H 34235783Skib 35235783Skibstruct drm_fb_helper; 36235783Skib 37235783Skibstruct drm_fb_helper_crtc { 38235783Skib uint32_t crtc_id; 39235783Skib struct drm_mode_set mode_set; 40235783Skib struct drm_display_mode *desired_mode; 41235783Skib}; 42235783Skib 43235783Skib/* mode specified on the command line */ 44235783Skibstruct drm_fb_helper_cmdline_mode { 45235783Skib bool specified; 46235783Skib bool refresh_specified; 47235783Skib bool bpp_specified; 48235783Skib int xres, yres; 49235783Skib int bpp; 50235783Skib int refresh; 51235783Skib bool rb; 52235783Skib bool interlace; 53235783Skib bool cvt; 54235783Skib bool margins; 55235783Skib}; 56235783Skib 57235783Skibstruct drm_fb_helper_surface_size { 58235783Skib u32 fb_width; 59235783Skib u32 fb_height; 60235783Skib u32 surface_width; 61235783Skib u32 surface_height; 62235783Skib u32 surface_bpp; 63235783Skib u32 surface_depth; 64235783Skib}; 65235783Skib 66235783Skibstruct drm_fb_helper_funcs { 67235783Skib void (*gamma_set)(struct drm_crtc *crtc, u16 red, u16 green, 68235783Skib u16 blue, int regno); 69235783Skib void (*gamma_get)(struct drm_crtc *crtc, u16 *red, u16 *green, 70235783Skib u16 *blue, int regno); 71235783Skib 72235783Skib int (*fb_probe)(struct drm_fb_helper *helper, 73235783Skib struct drm_fb_helper_surface_size *sizes); 74235783Skib}; 75235783Skib 76235783Skibstruct drm_fb_helper_connector { 77235783Skib struct drm_fb_helper_cmdline_mode cmdline_mode; 78235783Skib struct drm_cmdline_mode cmdline_mode1; 79235783Skib struct drm_connector *connector; 80235783Skib}; 81235783Skib 82235783Skibstruct drm_fb_helper { 83235783Skib struct drm_framebuffer *fb; 84235783Skib struct drm_framebuffer *saved_fb; 85235783Skib struct drm_device *dev; 86235783Skib struct drm_display_mode *mode; 87235783Skib int crtc_count; 88235783Skib struct drm_fb_helper_crtc *crtc_info; 89235783Skib int connector_count; 90235783Skib struct drm_fb_helper_connector **connector_info; 91235783Skib struct drm_fb_helper_funcs *funcs; 92235783Skib int conn_limit; 93235783Skib struct fb_info *fbdev; 94235783Skib u32 pseudo_palette[17]; 95235783Skib struct list_head kernel_fb_list; 96235783Skib 97235783Skib /* we got a hotplug but fbdev wasn't running the console 98235783Skib delay until next set_par */ 99235783Skib bool delayed_hotplug; 100235783Skib}; 101235783Skib 102235783Skibstruct fb_var_screeninfo; 103235783Skibstruct fb_cmap; 104235783Skib 105235783Skibint drm_fb_helper_single_fb_probe(struct drm_fb_helper *helper, 106235783Skib int preferred_bpp); 107235783Skib 108235783Skibint drm_fb_helper_init(struct drm_device *dev, 109235783Skib struct drm_fb_helper *helper, int crtc_count, 110235783Skib int max_conn); 111235783Skibvoid drm_fb_helper_fini(struct drm_fb_helper *helper); 112235783Skibint drm_fb_helper_blank(int blank, struct fb_info *info); 113235783Skibint drm_fb_helper_pan_display(struct fb_var_screeninfo *var, 114235783Skib struct fb_info *info); 115235783Skibint drm_fb_helper_set_par(struct fb_info *info); 116235783Skibint drm_fb_helper_check_var(struct fb_var_screeninfo *var, 117235783Skib struct fb_info *info); 118235783Skibint drm_fb_helper_setcolreg(unsigned regno, 119235783Skib unsigned red, 120235783Skib unsigned green, 121235783Skib unsigned blue, 122235783Skib unsigned transp, 123235783Skib struct fb_info *info); 124235783Skib 125235783Skibbool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper); 126235783Skibvoid drm_fb_helper_restore(void); 127235783Skibvoid drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper, 128235783Skib uint32_t fb_width, uint32_t fb_height); 129235783Skibvoid drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, 130235783Skib uint32_t depth); 131235783Skib 132235783Skibint drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info); 133235783Skib 134235783Skibint drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper); 135235783Skibbool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel); 136235783Skibint drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper); 137235783Skibint drm_fb_helper_debug_enter(struct fb_info *info); 138235783Skibint drm_fb_helper_debug_leave(struct fb_info *info); 139235783Skibbool drm_fb_helper_force_kernel_mode(void); 140235783Skib 141235783Skib#endif 142