blob: f44cf4b338e405caa28bed1e90df614053800137 [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 Behrbb728f32019-09-03 17:52:13 -070031 int32_t panel_orientation; // DRM_PANEL_ORIENTATION_*
Dominik Behr83010f82016-03-18 18:43:08 -070032} drm_t;
33
34drm_t* drm_scan(void);
35void drm_set(drm_t* drm);
36void drm_close(void);
37drm_t* drm_addref(void);
38void drm_delref(drm_t* drm);
Dominik Behrda3c0102016-06-08 15:05:38 -070039int drm_dropmaster(drm_t* drm);
40int drm_setmaster(drm_t* drm);
Dominik Behr83010f82016-03-18 18:43:08 -070041bool drm_rescan(void);
42bool drm_valid(drm_t* drm);
43int32_t drm_setmode(drm_t* drm, uint32_t fb_id);
Dominik Behr6e0f6fd2016-12-02 17:54:08 -080044void drm_rmfb(drm_t* drm, uint32_t fb_id);
Dominik Behr83010f82016-03-18 18:43:08 -070045bool drm_read_edid(drm_t* drm);
46uint32_t drm_gethres(drm_t* drm);
47uint32_t drm_getvres(drm_t* drm);
48
49#endif