2018-05-06 19:35:47 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#if defined (__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <xf86drm.h>
|
|
|
|
#include <xf86drmMode.h>
|
2018-08-22 22:20:29 +02:00
|
|
|
#include "CustomAssert.h"
|
2018-05-06 19:35:47 +02:00
|
|
|
|
2018-09-18 22:22:43 +02:00
|
|
|
#include "common.h"
|
2018-05-09 22:02:32 +02:00
|
|
|
|
2020-04-17 18:51:48 +02:00
|
|
|
typedef struct modeset_plane {
|
|
|
|
drmModePlanePtr plane;
|
|
|
|
uint32_t currentConnectorID;
|
|
|
|
uint32_t possibleConnectors[16];
|
|
|
|
uint32_t numPossibleConnectors;
|
|
|
|
} modeset_plane;
|
|
|
|
|
2020-04-16 01:04:41 +02:00
|
|
|
typedef struct modeset_display {
|
|
|
|
char name[32];
|
|
|
|
uint32_t mmWidth, mmHeight;
|
|
|
|
uint32_t resWidth, resHeight;
|
|
|
|
uint32_t connectorID;
|
|
|
|
} modeset_display;
|
|
|
|
|
|
|
|
typedef struct modeset_display_mode {
|
|
|
|
uint32_t connectorID;
|
|
|
|
uint32_t modeID;
|
|
|
|
uint32_t resWidth, resHeight;
|
|
|
|
uint32_t refreshRate;
|
|
|
|
} modeset_display_mode;
|
|
|
|
|
|
|
|
typedef struct modeset_display_surface {
|
2020-04-16 18:33:46 +02:00
|
|
|
drmModeConnectorPtr connector;
|
|
|
|
drmModeCrtcPtr crtc;
|
2020-04-16 01:04:41 +02:00
|
|
|
uint32_t modeID;
|
2020-04-16 18:33:46 +02:00
|
|
|
uint32_t savedState;
|
2020-04-16 01:34:51 +02:00
|
|
|
} modeset_display_surface;
|
2020-04-16 01:04:41 +02:00
|
|
|
|
2020-04-16 18:33:46 +02:00
|
|
|
typedef struct modeset_saved_state {
|
|
|
|
uint32_t used;
|
|
|
|
drmModeConnectorPtr conn;
|
|
|
|
drmModeCrtcPtr crtc;
|
|
|
|
} modeset_saved_state;
|
|
|
|
|
|
|
|
modeset_saved_state modeset_saved_states[32];
|
2018-05-06 19:35:47 +02:00
|
|
|
|
2020-04-16 01:34:51 +02:00
|
|
|
void modeset_enum_displays(int fd, uint32_t* numDisplays, modeset_display* displays);
|
|
|
|
void modeset_enum_modes_for_display(int fd, uint32_t display, uint32_t* numModes, modeset_display_mode* modes);
|
2020-04-16 01:04:41 +02:00
|
|
|
void modeset_create_surface_for_mode(int fd, uint32_t display, uint32_t mode, modeset_display_surface* surface);
|
2020-04-16 18:33:46 +02:00
|
|
|
void modeset_create_fb_for_surface(int fd, _image* buf, modeset_display_surface* surface);
|
|
|
|
void modeset_destroy_fb(int fd, _image* buf);
|
2020-06-03 23:12:27 +02:00
|
|
|
void modeset_present(int fd, _image* buf, modeset_display_surface* surface, uint64_t seqno);
|
2020-06-02 23:06:55 +02:00
|
|
|
void modeset_acquire_image(int fd, _image** buf, modeset_display_surface** surface);
|
2020-04-16 18:33:46 +02:00
|
|
|
void modeset_destroy_surface(int fd, modeset_display_surface* surface);
|
|
|
|
void modeset_debug_print(int fd);
|
2020-04-16 01:04:41 +02:00
|
|
|
|
2018-05-06 19:35:47 +02:00
|
|
|
#if defined (__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|