drmmode_display.h revision 2f39173d
1ad43ddacSmrg/*
2ad43ddacSmrg * Copyright © 2007 Red Hat, Inc.
3ad43ddacSmrg *
4ad43ddacSmrg * Permission is hereby granted, free of charge, to any person obtaining a
5ad43ddacSmrg * copy of this software and associated documentation files (the "Software"),
6ad43ddacSmrg * to deal in the Software without restriction, including without limitation
7ad43ddacSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8ad43ddacSmrg * and/or sell copies of the Software, and to permit persons to whom the
9ad43ddacSmrg * Software is furnished to do so, subject to the following conditions:
10ad43ddacSmrg *
11ad43ddacSmrg * The above copyright notice and this permission notice (including the next
12ad43ddacSmrg * paragraph) shall be included in all copies or substantial portions of the
13ad43ddacSmrg * Software.
14ad43ddacSmrg *
15ad43ddacSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16ad43ddacSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17ad43ddacSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18ad43ddacSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19ad43ddacSmrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20ad43ddacSmrg * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21ad43ddacSmrg * SOFTWARE.
22ad43ddacSmrg *
23ad43ddacSmrg * Authors:
24ad43ddacSmrg *     Dave Airlie <airlied@redhat.com>
25ad43ddacSmrg *
26ad43ddacSmrg */
27ad43ddacSmrg#ifndef DRMMODE_DISPLAY_H
28ad43ddacSmrg#define DRMMODE_DISPLAY_H
29ad43ddacSmrg
30ad43ddacSmrg#ifdef XF86DRM_MODE
31ad43ddacSmrg
32ad43ddacSmrg#include "xf86drmMode.h"
332f39173dSmrg#ifdef HAVE_LIBUDEV
342f39173dSmrg#include "libudev.h"
352f39173dSmrg#endif
36ad43ddacSmrg
37ad43ddacSmrg#include "radeon_probe.h"
38ad43ddacSmrg
39ad43ddacSmrgtypedef struct {
40ad43ddacSmrg  int fd;
41ad43ddacSmrg  unsigned fb_id;
42ad43ddacSmrg  drmModeResPtr mode_res;
43ad43ddacSmrg  drmModeFBPtr mode_fb;
44ad43ddacSmrg  int cpp;
45ad43ddacSmrg  struct radeon_bo_manager *bufmgr;
462f39173dSmrg  ScrnInfoPtr scrn;
472f39173dSmrg#ifdef HAVE_LIBUDEV
482f39173dSmrg  struct udev_monitor *uevent_monitor;
492f39173dSmrg  InputHandlerProc uevent_handler;
502f39173dSmrg#endif
512f39173dSmrg  drmEventContext event_context;
522f39173dSmrg  int flip_count;
53ad43ddacSmrg} drmmode_rec, *drmmode_ptr;
54ad43ddacSmrg
55ad43ddacSmrgtypedef struct {
56ad43ddacSmrg    drmmode_ptr drmmode;
57ad43ddacSmrg    drmModeCrtcPtr mode_crtc;
582f39173dSmrg    int hw_id;
59ad43ddacSmrg    struct radeon_bo *cursor_bo;
60ad43ddacSmrg    struct radeon_bo *rotate_bo;
61ad43ddacSmrg    unsigned rotate_fb_id;
62ad43ddacSmrg    uint16_t lut_r[256], lut_g[256], lut_b[256];
63ad43ddacSmrg} drmmode_crtc_private_rec, *drmmode_crtc_private_ptr;
64ad43ddacSmrg
65ad43ddacSmrgtypedef struct {
66ad43ddacSmrg    drmModePropertyPtr mode_prop;
67ad43ddacSmrg    uint64_t value;
68ad43ddacSmrg    int num_atoms; /* if range prop, num_atoms == 1; if enum prop, num_atoms == num_enums + 1 */
69ad43ddacSmrg    Atom *atoms;
70ad43ddacSmrg} drmmode_prop_rec, *drmmode_prop_ptr;
71ad43ddacSmrg
72ad43ddacSmrg
73ad43ddacSmrgtypedef struct {
74ad43ddacSmrg    drmmode_ptr drmmode;
75ad43ddacSmrg    int output_id;
76ad43ddacSmrg    drmModeConnectorPtr mode_output;
77ad43ddacSmrg    drmModeEncoderPtr *mode_encoders;
78ad43ddacSmrg    drmModePropertyBlobPtr edid_blob;
79ad43ddacSmrg    int dpms_enum_id;
80ad43ddacSmrg    int num_props;
81ad43ddacSmrg    drmmode_prop_ptr props;
82ad43ddacSmrg    int enc_mask;
83ad43ddacSmrg    int enc_clone_mask;
84ad43ddacSmrg} drmmode_output_private_rec, *drmmode_output_private_ptr;
85ad43ddacSmrg
86ad43ddacSmrg
87ad43ddacSmrgextern Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp);
88ad43ddacSmrgextern Bool drmmode_set_bufmgr(ScrnInfoPtr pScrn, drmmode_ptr drmmode, struct radeon_bo_manager *bufmgr);
89ad43ddacSmrgextern void drmmode_set_cursor(ScrnInfoPtr scrn, drmmode_ptr drmmode, int id, struct radeon_bo *bo);
90ad43ddacSmrgvoid drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y, int flags);
91ad43ddacSmrgextern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
92ad43ddacSmrgextern void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
93ad43ddacSmrgextern Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn);
942f39173dSmrg
952f39173dSmrgextern void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode);
962f39173dSmrgextern void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode);
972f39173dSmrg
98ad43ddacSmrg#endif
99ad43ddacSmrg
100ad43ddacSmrg#endif
101