Home | History | Annotate | Line # | Download | only in src
      1 /*
      2  * Copyright  2007 Red Hat, Inc.
      3  *
      4  * Permission is hereby granted, free of charge, to any person obtaining a
      5  * copy of this software and associated documentation files (the "Software"),
      6  * to deal in the Software without restriction, including without limitation
      7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      8  * and/or sell copies of the Software, and to permit persons to whom the
      9  * Software is furnished to do so, subject to the following conditions:
     10  *
     11  * The above copyright notice and this permission notice (including the next
     12  * paragraph) shall be included in all copies or substantial portions of the
     13  * Software.
     14  *
     15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
     21  * SOFTWARE.
     22  *
     23  * Authors:
     24  *     Dave Airlie <airlied (at) redhat.com>
     25  *
     26  */
     27 #ifndef DRMMODE_DISPLAY_H
     28 #define DRMMODE_DISPLAY_H
     29 
     30 #ifdef XF86DRM_MODE
     31 
     32 #include "xf86drm.h"
     33 #include "xf86drmMode.h"
     34 #include "xf86str.h"
     35 #include "randrstr.h"
     36 #include "xf86Crtc.h"
     37 #ifdef HAVE_LIBUDEV
     38 #include "libudev.h"
     39 #endif
     40 
     41 typedef struct {
     42   int fd;
     43   unsigned fb_id;
     44   drmModeResPtr mode_res;
     45   drmModeFBPtr mode_fb;
     46   int cpp;
     47   ScrnInfoPtr scrn;
     48 #ifdef HAVE_LIBUDEV
     49   struct udev_monitor *uevent_monitor;
     50   InputHandlerProc uevent_handler;
     51 #endif
     52 } drmmode_rec, *drmmode_ptr;
     53 
     54 typedef struct {
     55     drmmode_ptr drmmode;
     56     drmModeCrtcPtr mode_crtc;
     57     int hw_id;
     58     struct qxl_bo *cursor_bo;
     59     void *cursor_ptr;
     60   //    struct radeon_bo *rotate_bo;
     61     unsigned rotate_fb_id;
     62     int dpms_mode;
     63     uint16_t lut_r[256], lut_g[256], lut_b[256];
     64 } drmmode_crtc_private_rec, *drmmode_crtc_private_ptr;
     65 
     66 
     67 typedef struct {
     68     drmModePropertyPtr mode_prop;
     69     uint64_t value;
     70     int num_atoms; /* if range prop, num_atoms == 1; if enum prop, num_atoms == num_enums + 1 */
     71     Atom *atoms;
     72     int index; /* index within the kernel-size property array */
     73 } drmmode_prop_rec, *drmmode_prop_ptr;
     74 
     75 typedef struct {
     76     drmmode_ptr drmmode;
     77     int output_id;
     78     drmModeConnectorPtr mode_output;
     79     drmModeEncoderPtr *mode_encoders;
     80     drmModePropertyBlobPtr edid_blob;
     81     int dpms_enum_id;
     82     int num_props;
     83     drmmode_prop_ptr props;
     84     int enc_mask;
     85     int enc_clone_mask;
     86 } drmmode_output_private_rec, *drmmode_output_private_ptr;
     87 
     88 extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp);
     89 
     90 extern void qxl_drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode);
     91 extern void qxl_drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode);
     92 #endif
     93 
     94 #endif
     95