Back to index

xserver-xorg-video-modesetting  0.3.0
drmmode_display.h
Go to the documentation of this file.
00001 /*
00002  * Copyright © 2007 Red Hat, Inc.
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a
00005  * copy of this software and associated documentation files (the "Software"),
00006  * to deal in the Software without restriction, including without limitation
00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00008  * and/or sell copies of the Software, and to permit persons to whom the
00009  * Software is furnished to do so, subject to the following conditions:
00010  *
00011  * The above copyright notice and this permission notice (including the next
00012  * paragraph) shall be included in all copies or substantial portions of the
00013  * Software.
00014  *
00015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00016  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00017  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00018  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00019  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00020  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00021  * SOFTWARE.
00022  *
00023  * Authors:
00024  *     Dave Airlie <airlied@redhat.com>
00025  *
00026  */
00027 #ifndef DRMMODE_DISPLAY_H
00028 #define DRMMODE_DISPLAY_H
00029 
00030 #include "xf86drmMode.h"
00031 #ifdef HAVE_UDEV
00032 #include "libudev.h"
00033 #endif
00034 
00035 struct dumb_bo {
00036     uint32_t handle;
00037     uint32_t size;
00038     void *ptr;
00039     int map_count;
00040     uint32_t pitch;
00041 };
00042 
00043 typedef struct {
00044     int fd;
00045     unsigned fb_id;
00046     drmModeResPtr mode_res;
00047     drmModeFBPtr mode_fb;
00048     int cpp;
00049     ScrnInfoPtr scrn;
00050 #ifdef HAVE_UDEV
00051     struct udev_monitor *uevent_monitor;
00052     InputHandlerProc uevent_handler;
00053 #endif
00054     drmEventContext event_context;
00055     struct dumb_bo *front_bo;
00056     Bool sw_cursor;
00057 
00058     Bool shadow_enable;
00059     void *shadow_fb;
00060 
00061 } drmmode_rec, *drmmode_ptr;
00062 
00063 typedef struct {
00064     drmmode_ptr drmmode;
00065     drmModeCrtcPtr mode_crtc;
00066     int hw_id;
00067     struct dumb_bo *cursor_bo;
00068     unsigned rotate_fb_id;
00069     uint16_t lut_r[256], lut_g[256], lut_b[256];
00070 } drmmode_crtc_private_rec, *drmmode_crtc_private_ptr;
00071 
00072 typedef struct {
00073     drmModePropertyPtr mode_prop;
00074     uint64_t value;
00075     int num_atoms; /* if range prop, num_atoms == 1; if enum prop, num_atoms == num_enums + 1 */
00076     Atom *atoms;
00077 } drmmode_prop_rec, *drmmode_prop_ptr;
00078 
00079 
00080 typedef struct {
00081     drmmode_ptr drmmode;
00082     int output_id;
00083     drmModeConnectorPtr mode_output;
00084     drmModeEncoderPtr *mode_encoders;
00085     drmModePropertyBlobPtr edid_blob;
00086     int dpms_enum_id;
00087     int num_props;
00088     drmmode_prop_ptr props;
00089     int enc_mask;
00090     int enc_clone_mask;
00091 } drmmode_output_private_rec, *drmmode_output_private_ptr;
00092 
00093 
00094 extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp);
00095 void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y, int flags);
00096 extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
00097 extern Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn);
00098 
00099 extern void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode);
00100 extern void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode);
00101 
00102 Bool drmmode_create_initial_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
00103 void *drmmode_map_front_bo(drmmode_ptr drmmode);
00104 Bool drmmode_map_cursor_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
00105 void drmmode_free_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
00106 void drmmode_get_default_bpp(ScrnInfoPtr pScrn, drmmode_ptr drmmmode, int *depth, int *bpp);
00107 
00108 #ifndef DRM_CAP_DUMB_PREFERRED_DEPTH
00109 #define DRM_CAP_DUMB_PREFERRED_DEPTH 3
00110 #endif
00111 #ifndef DRM_CAP_DUMB_PREFER_SHADOW
00112 #define DRM_CAP_DUMB_PREFER_SHADOW 4
00113 #endif
00114 
00115 
00116 #endif