drmmode_display.h revision 40732134
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@redhat.com>
25 *
26 */
27#ifndef DRMMODE_DISPLAY_H
28#define DRMMODE_DISPLAY_H
29
30#ifdef XF86DRM_MODE
31
32#include "xf86drmMode.h"
33#ifdef HAVE_LIBUDEV
34#include "libudev.h"
35#endif
36
37#include "radeon_probe.h"
38
39typedef struct {
40  int fd;
41  unsigned fb_id;
42  drmModeResPtr mode_res;
43  drmModeFBPtr mode_fb;
44  int cpp;
45  struct radeon_bo_manager *bufmgr;
46  ScrnInfoPtr scrn;
47#ifdef HAVE_LIBUDEV
48  struct udev_monitor *uevent_monitor;
49  InputHandlerProc uevent_handler;
50#endif
51  drmEventContext event_context;
52} drmmode_rec, *drmmode_ptr;
53
54typedef struct {
55  drmmode_ptr drmmode;
56  unsigned old_fb_id;
57  int flip_count;
58  void *event_data;
59  unsigned int fe_frame;
60  unsigned int fe_tv_sec;
61  unsigned int fe_tv_usec;
62} drmmode_flipdata_rec, *drmmode_flipdata_ptr;
63
64typedef struct {
65  drmmode_flipdata_ptr flipdata;
66  Bool dispatch_me;
67} drmmode_flipevtcarrier_rec, *drmmode_flipevtcarrier_ptr;
68
69typedef struct {
70    drmmode_ptr drmmode;
71    drmModeCrtcPtr mode_crtc;
72    int hw_id;
73    struct radeon_bo *cursor_bo;
74    struct radeon_bo *rotate_bo;
75    unsigned rotate_fb_id;
76    uint16_t lut_r[256], lut_g[256], lut_b[256];
77} drmmode_crtc_private_rec, *drmmode_crtc_private_ptr;
78
79typedef struct {
80    drmModePropertyPtr mode_prop;
81    uint64_t value;
82    int num_atoms; /* if range prop, num_atoms == 1; if enum prop, num_atoms == num_enums + 1 */
83    Atom *atoms;
84} drmmode_prop_rec, *drmmode_prop_ptr;
85
86
87typedef struct {
88    drmmode_ptr drmmode;
89    int output_id;
90    drmModeConnectorPtr mode_output;
91    drmModeEncoderPtr *mode_encoders;
92    drmModePropertyBlobPtr edid_blob;
93    int dpms_enum_id;
94    int num_props;
95    drmmode_prop_ptr props;
96    int enc_mask;
97    int enc_clone_mask;
98} drmmode_output_private_rec, *drmmode_output_private_ptr;
99
100
101extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp);
102extern void drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
103extern Bool drmmode_set_bufmgr(ScrnInfoPtr pScrn, drmmode_ptr drmmode, struct radeon_bo_manager *bufmgr);
104extern void drmmode_set_cursor(ScrnInfoPtr scrn, drmmode_ptr drmmode, int id, struct radeon_bo *bo);
105void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y, int flags);
106extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
107extern void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
108extern Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn);
109
110extern void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode);
111extern void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode);
112
113extern int drmmode_get_height_align(ScrnInfoPtr scrn, uint32_t tiling);
114extern int drmmode_get_pitch_align(ScrnInfoPtr scrn, int bpe, uint32_t tiling);
115extern int drmmode_get_base_align(ScrnInfoPtr scrn, int bpe, uint32_t tiling);
116
117Bool radeon_do_pageflip(ScrnInfoPtr scrn, struct radeon_bo *new_front, void *data, int ref_crtc_hw_id);
118
119#endif
120
121#endif
122