gamescope/src/drm.h
Pierre-Loup A. Griffais bc7207c69d More DRM flipping/importing, getting half of glxgears on screen.
Lower half is getting eaten by something, presumably underflow as it's black.

Make EGL and DRM coexist; make ensure_win_resources safe to call regardless
of what resources we want, so outer code doesn't have to care.
2020-01-01 15:30:37 +09:00

58 lines
1.1 KiB
C

// DRM output stuff
#pragma once
#include <xf86drm.h>
#include <xf86drmMode.h>
#include <wlr/render/dmabuf.h>
struct plane {
drmModePlane *plane;
drmModeObjectProperties *props;
drmModePropertyRes **props_info;
};
struct crtc {
drmModeCrtc *crtc;
drmModeObjectProperties *props;
drmModePropertyRes **props_info;
};
struct connector {
drmModeConnector *connector;
drmModeObjectProperties *props;
drmModePropertyRes **props_info;
};
struct drm_t {
int fd;
/* only used for atomic: */
struct plane *plane;
struct crtc *crtc;
struct connector *connector;
int crtc_index;
int kms_in_fence_fd;
int kms_out_fence_fd;
drmModeModeInfo *mode;
uint32_t crtc_id;
uint32_t connector_id;
uint32_t plane_id;
};
#ifndef C_SIDE
extern "C" {
#endif
extern struct drm_t g_DRM;
int init_drm(struct drm_t *drm, const char *device, const char *mode_str, unsigned int vrefresh);
int drm_atomic_commit(struct drm_t *drm, uint32_t fb_id, uint32_t width, uint32_t height, uint32_t flags);
uint32_t drm_fbid_from_dmabuf( struct drm_t *drm, struct wlr_dmabuf_attributes *dma_buf );
#ifndef C_SIDE
}
#endif