98N/A/*
98N/A * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
963N/A */
98N/A
98N/A/*
919N/A * Copyright (c) 2006-2009 Red Hat Inc.
919N/A * Copyright (c) 2006-2008, 2012, Intel Corporation
919N/A * Copyright (c) 2007 Dave Airlie <airlied@linux.ie>
919N/A *
919N/A * DRM framebuffer helper functions
919N/A *
919N/A * Permission to use, copy, modify, distribute, and sell this software and its
919N/A * documentation for any purpose is hereby granted without fee, provided that
919N/A * the above copyright notice appear in all copies and that both that copyright
919N/A * notice and this permission notice appear in supporting documentation, and
919N/A * that the name of the copyright holders not be used in advertising or
919N/A * publicity pertaining to distribution of the software without specific,
919N/A * written prior permission. The copyright holders make no representations
919N/A * about the suitability of this software for any purpose. It is provided "as
919N/A * is" without express or implied warranty.
919N/A *
919N/A * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
98N/A * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
98N/A * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
98N/A * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
98N/A * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
967N/A * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
98N/A * OF THIS SOFTWARE.
493N/A *
493N/A * Authors:
493N/A * Dave Airlie <airlied@linux.ie>
967N/A * Jesse Barnes <jesse.barnes@intel.com>
493N/A */
493N/A#ifndef _DRM_FB_HELPER_H
493N/A#define _DRM_FB_HELPER_H
493N/A
493N/Astruct drm_fb_helper;
493N/A
98N/Astruct drm_fb_helper_crtc {
493N/A struct drm_mode_set mode_set;
493N/A struct drm_display_mode *desired_mode;
493N/A};
493N/A
493N/Astruct drm_fb_helper_surface_size {
493N/A u32 fb_width;
963N/A u32 fb_height;
493N/A u32 surface_width;
493N/A u32 surface_height;
493N/A u32 surface_bpp;
493N/A u32 surface_depth;
493N/A};
493N/A
493N/A/**
98N/A * struct drm_fb_helper_funcs - driver callbacks for the fbdev emulation library
98N/A * @gamma_set: - Set the given gamma lut register on the given crtc.
967N/A * @gamma_get: - Read the given gamma lut register on the given crtc, used to
98N/A * save the current lut when force-restoring the fbdev for e.g.
98N/A * kdbg.
98N/A * @fb_probe: - Driver callback to allocate and initialize the fbdev info
* structure. Futhermore it also needs to allocate the drm
* framebuffer used to back the fbdev.
*
* Driver callbacks used by the fbdev emulation helper library.
*/
struct drm_fb_helper_funcs {
void (*gamma_set)(struct drm_crtc *crtc, u16 red, u16 green,
u16 blue, int regno);
void (*gamma_get)(struct drm_crtc *crtc, u16 *red, u16 *green,
u16 *blue, int regno);
int (*fb_probe)(struct drm_fb_helper *helper,
struct drm_fb_helper_surface_size *sizes);
bool (*initial_config)(struct drm_fb_helper *fb_helper,
struct drm_fb_helper_crtc **crtcs,
struct drm_display_mode **modes,
bool *enabled, int width, int height);
};
struct drm_fb_helper_connector {
struct drm_connector *connector;
struct drm_cmdline_mode cmdline_mode;
};
struct drm_fb_helper {
struct drm_framebuffer *fb;
struct drm_device *dev;
int crtc_count;
struct drm_fb_helper_crtc *crtc_info;
int connector_count;
struct drm_fb_helper_connector **connector_info;
struct drm_fb_helper_funcs *funcs;
struct fb_info *fbdev;
u32 pseudo_palette[17];
struct list_head kernel_fb_list;
/* we got a hotplug but fbdev wasn't running the console
delay until next set_par */
bool delayed_hotplug;
};
int drm_fb_helper_single_fb_probe(struct drm_fb_helper *helper,
int preferred_bpp);
int drm_fb_helper_init(struct drm_device *dev,
struct drm_fb_helper *helper, int crtc_count,
int max_conn);
void drm_fb_helper_fini(struct drm_fb_helper *helper);
bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper);
bool drm_fb_helper_force_kernel_mode(void);
void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper,
uint32_t fb_width, uint32_t fb_height);
void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
uint32_t depth);
int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper);
bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel);
int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper);
void drm_register_fbops(struct drm_device *dev);
int drm_getfb_size(struct drm_device *dev);
#endif /* _DRM_FB_HELPER_H */