drmmode_display.h revision 921a55d8
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;
42921a55d8Smrg  unsigned old_fb_id;
43ad43ddacSmrg  drmModeResPtr mode_res;
44ad43ddacSmrg  drmModeFBPtr mode_fb;
45ad43ddacSmrg  int cpp;
46ad43ddacSmrg  struct radeon_bo_manager *bufmgr;
472f39173dSmrg  ScrnInfoPtr scrn;
482f39173dSmrg#ifdef HAVE_LIBUDEV
492f39173dSmrg  struct udev_monitor *uevent_monitor;
502f39173dSmrg  InputHandlerProc uevent_handler;
512f39173dSmrg#endif
522f39173dSmrg  drmEventContext event_context;
532f39173dSmrg  int flip_count;
54921a55d8Smrg  void *event_data;
55921a55d8Smrg  unsigned int fe_frame;
56921a55d8Smrg  unsigned int fe_tv_sec;
57921a55d8Smrg  unsigned int fe_tv_usec;
58ad43ddacSmrg} drmmode_rec, *drmmode_ptr;
59ad43ddacSmrg
60921a55d8Smrgtypedef struct {
61921a55d8Smrg  drmmode_ptr drmmode;
62921a55d8Smrg  Bool dispatch_me;
63921a55d8Smrg} drmmode_flipevtcarrier_rec, *drmmode_flipevtcarrier_ptr;
64921a55d8Smrg
65ad43ddacSmrgtypedef struct {
66ad43ddacSmrg    drmmode_ptr drmmode;
67ad43ddacSmrg    drmModeCrtcPtr mode_crtc;
682f39173dSmrg    int hw_id;
69ad43ddacSmrg    struct radeon_bo *cursor_bo;
70ad43ddacSmrg    struct radeon_bo *rotate_bo;
71ad43ddacSmrg    unsigned rotate_fb_id;
72ad43ddacSmrg    uint16_t lut_r[256], lut_g[256], lut_b[256];
73ad43ddacSmrg} drmmode_crtc_private_rec, *drmmode_crtc_private_ptr;
74ad43ddacSmrg
75ad43ddacSmrgtypedef struct {
76ad43ddacSmrg    drmModePropertyPtr mode_prop;
77ad43ddacSmrg    uint64_t value;
78ad43ddacSmrg    int num_atoms; /* if range prop, num_atoms == 1; if enum prop, num_atoms == num_enums + 1 */
79ad43ddacSmrg    Atom *atoms;
80ad43ddacSmrg} drmmode_prop_rec, *drmmode_prop_ptr;
81ad43ddacSmrg
82ad43ddacSmrg
83ad43ddacSmrgtypedef struct {
84ad43ddacSmrg    drmmode_ptr drmmode;
85ad43ddacSmrg    int output_id;
86ad43ddacSmrg    drmModeConnectorPtr mode_output;
87ad43ddacSmrg    drmModeEncoderPtr *mode_encoders;
88ad43ddacSmrg    drmModePropertyBlobPtr edid_blob;
89ad43ddacSmrg    int dpms_enum_id;
90ad43ddacSmrg    int num_props;
91ad43ddacSmrg    drmmode_prop_ptr props;
92ad43ddacSmrg    int enc_mask;
93ad43ddacSmrg    int enc_clone_mask;
94ad43ddacSmrg} drmmode_output_private_rec, *drmmode_output_private_ptr;
95ad43ddacSmrg
96ad43ddacSmrg
97ad43ddacSmrgextern Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp);
98ad43ddacSmrgextern Bool drmmode_set_bufmgr(ScrnInfoPtr pScrn, drmmode_ptr drmmode, struct radeon_bo_manager *bufmgr);
99ad43ddacSmrgextern void drmmode_set_cursor(ScrnInfoPtr scrn, drmmode_ptr drmmode, int id, struct radeon_bo *bo);
100ad43ddacSmrgvoid drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y, int flags);
101ad43ddacSmrgextern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
102ad43ddacSmrgextern void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
103ad43ddacSmrgextern Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn);
1042f39173dSmrg
1052f39173dSmrgextern void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode);
1062f39173dSmrgextern void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode);
1072f39173dSmrg
108921a55d8Smrgextern int drmmode_get_height_align(ScrnInfoPtr scrn, uint32_t tiling);
109921a55d8Smrgextern int drmmode_get_pitch_align(ScrnInfoPtr scrn, int bpe, uint32_t tiling);
110921a55d8Smrgextern int drmmode_get_base_align(ScrnInfoPtr scrn, int bpe, uint32_t tiling);
111921a55d8Smrg
112921a55d8SmrgBool radeon_do_pageflip(ScrnInfoPtr scrn, struct radeon_bo *new_front, void *data, int ref_crtc_hw_id);
113921a55d8Smrg
114ad43ddacSmrg#endif
115ad43ddacSmrg
116ad43ddacSmrg#endif
117