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 struct drm_mode_set mode_set; 39235783Skib struct drm_display_mode *desired_mode; 40235783Skib}; 41235783Skib 42235783Skibstruct drm_fb_helper_surface_size { 43235783Skib u32 fb_width; 44235783Skib u32 fb_height; 45235783Skib u32 surface_width; 46235783Skib u32 surface_height; 47235783Skib u32 surface_bpp; 48235783Skib u32 surface_depth; 49235783Skib}; 50235783Skib 51235783Skibstruct drm_fb_helper_funcs { 52235783Skib void (*gamma_set)(struct drm_crtc *crtc, u16 red, u16 green, 53235783Skib u16 blue, int regno); 54235783Skib void (*gamma_get)(struct drm_crtc *crtc, u16 *red, u16 *green, 55235783Skib u16 *blue, int regno); 56235783Skib 57235783Skib int (*fb_probe)(struct drm_fb_helper *helper, 58235783Skib struct drm_fb_helper_surface_size *sizes); 59235783Skib}; 60235783Skib 61235783Skibstruct drm_fb_helper_connector { 62235783Skib struct drm_connector *connector; 63274865Sdumbbell struct drm_cmdline_mode cmdline_mode; 64235783Skib}; 65235783Skib 66235783Skibstruct drm_fb_helper { 67235783Skib struct drm_framebuffer *fb; 68235783Skib struct drm_framebuffer *saved_fb; 69235783Skib struct drm_device *dev; 70235783Skib struct drm_display_mode *mode; 71235783Skib int crtc_count; 72235783Skib struct drm_fb_helper_crtc *crtc_info; 73235783Skib int connector_count; 74235783Skib struct drm_fb_helper_connector **connector_info; 75235783Skib struct drm_fb_helper_funcs *funcs; 76235783Skib struct fb_info *fbdev; 77235783Skib u32 pseudo_palette[17]; 78235783Skib struct list_head kernel_fb_list; 79235783Skib 80235783Skib /* we got a hotplug but fbdev wasn't running the console 81235783Skib delay until next set_par */ 82235783Skib bool delayed_hotplug; 83235783Skib}; 84235783Skib 85235783Skibint drm_fb_helper_single_fb_probe(struct drm_fb_helper *helper, 86235783Skib int preferred_bpp); 87235783Skib 88235783Skibint drm_fb_helper_init(struct drm_device *dev, 89235783Skib struct drm_fb_helper *helper, int crtc_count, 90235783Skib int max_conn); 91235783Skibvoid drm_fb_helper_fini(struct drm_fb_helper *helper); 92235783Skibint drm_fb_helper_blank(int blank, struct fb_info *info); 93282199Sdumbbell#ifdef FREEBSD_NOTYET 94235783Skibint drm_fb_helper_pan_display(struct fb_var_screeninfo *var, 95235783Skib struct fb_info *info); 96282199Sdumbbell#endif /* FREEBSD_NOTYET */ 97235783Skibint drm_fb_helper_set_par(struct fb_info *info); 98282199Sdumbbell#ifdef FREEBSD_NOTYET 99235783Skibint drm_fb_helper_check_var(struct fb_var_screeninfo *var, 100235783Skib struct fb_info *info); 101282199Sdumbbell#endif /* FREEBSD_NOTYET */ 102235783Skibint drm_fb_helper_setcolreg(unsigned regno, 103235783Skib unsigned red, 104235783Skib unsigned green, 105235783Skib unsigned blue, 106235783Skib unsigned transp, 107235783Skib struct fb_info *info); 108235783Skib 109235783Skibbool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper); 110235783Skibvoid drm_fb_helper_restore(void); 111235783Skibvoid drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper, 112235783Skib uint32_t fb_width, uint32_t fb_height); 113235783Skibvoid drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, 114235783Skib uint32_t depth); 115235783Skib 116282199Sdumbbell#ifdef FREEBSD_NOTYET 117235783Skibint drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info); 118282199Sdumbbell#endif /* FREEBSD_NOTYET */ 119235783Skib 120235783Skibint drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper); 121235783Skibbool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel); 122235783Skibint drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper); 123235783Skibint drm_fb_helper_debug_enter(struct fb_info *info); 124235783Skibint drm_fb_helper_debug_leave(struct fb_info *info); 125235783Skib 126235783Skib#endif 127