blob: 65a523e4d0095eb66360f3c5e33a13e8ff41e374 [file] [log] [blame]
Dominik Behr83010f82016-03-18 18:43:08 -07001/*
2 * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7#ifndef DRM_H
8#define DRM_H
9
10
11#include <stdbool.h>
12#include <stdio.h>
13#include <edid_utils.h>
14#include <xf86drm.h>
15#include <xf86drmMode.h>
16
17typedef struct _drm_t {
18 int refcount;
19 int fd;
20 drmModeRes* resources;
21 drmModePlaneResPtr plane_resources;
Dominik Behr57b5c722018-08-08 18:52:31 -070022 uint32_t console_connector_id;
23 uint32_t console_mmWidth;
24 uint32_t console_mmHeight;
25 bool console_connector_internal;
26 drmModeModeInfo console_mode_info;
Dominik Behr83010f82016-03-18 18:43:08 -070027 bool edid_found;
28 char edid[EDID_SIZE];
Dominik Behr6e0f6fd2016-12-02 17:54:08 -080029 uint32_t delayed_rmfb_fb_id;
Dominik Behrbf08a552018-08-07 19:46:03 -070030 bool atomic;
Dominik Behr83010f82016-03-18 18:43:08 -070031} drm_t;
32
33drm_t* drm_scan(void);
34void drm_set(drm_t* drm);
35void drm_close(void);
36drm_t* drm_addref(void);
37void drm_delref(drm_t* drm);
Dominik Behrda3c0102016-06-08 15:05:38 -070038int drm_dropmaster(drm_t* drm);
39int drm_setmaster(drm_t* drm);
Dominik Behr83010f82016-03-18 18:43:08 -070040bool drm_rescan(void);
41bool drm_valid(drm_t* drm);
42int32_t drm_setmode(drm_t* drm, uint32_t fb_id);
Dominik Behr6e0f6fd2016-12-02 17:54:08 -080043void drm_rmfb(drm_t* drm, uint32_t fb_id);
Dominik Behr83010f82016-03-18 18:43:08 -070044bool drm_read_edid(drm_t* drm);
45uint32_t drm_gethres(drm_t* drm);
46uint32_t drm_getvres(drm_t* drm);
47
48#endif