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-06-03 14:56:59 +02:00
|
|
|
typedef struct VkImage_T
|
|
|
|
{
|
2018-05-09 22:02:32 +02:00
|
|
|
uint32_t handle;
|
2018-06-03 14:56:59 +02:00
|
|
|
uint32_t fb; //needed for swapchain
|
|
|
|
uint32_t width, height, depth;
|
2018-08-23 20:07:36 +02:00
|
|
|
uint32_t paddedWidth, paddedHeight;
|
2018-08-25 14:50:03 +02:00
|
|
|
uint32_t miplevels, samples;
|
|
|
|
uint32_t layers; //number of views for multiview/stereo
|
|
|
|
uint32_t size; //overall size including padding
|
2018-08-22 22:20:29 +02:00
|
|
|
uint32_t stride; //the number of bytes from one row of pixels in memory to the next row of pixels in memory (aka pitch)
|
2018-06-03 14:56:59 +02:00
|
|
|
uint32_t usageBits;
|
2018-08-23 20:07:36 +02:00
|
|
|
uint32_t format;
|
2018-08-25 14:50:03 +02:00
|
|
|
uint32_t imageSpace;
|
|
|
|
uint32_t tiling;
|
2018-08-25 19:10:07 +02:00
|
|
|
uint32_t needToClear;
|
|
|
|
uint32_t clearColor[2];
|
|
|
|
uint32_t layout;
|
2018-08-25 14:50:03 +02:00
|
|
|
uint32_t concurrentAccess; //TODO
|
|
|
|
uint32_t numQueueFamiliesWithAccess;
|
|
|
|
uint32_t* queueFamiliesWithAccess;
|
|
|
|
uint32_t preTransformMode;
|
|
|
|
uint32_t compositeAlpha;
|
|
|
|
uint32_t presentMode;
|
|
|
|
uint32_t clipped;
|
2018-06-03 14:56:59 +02:00
|
|
|
} _image;
|
2018-05-09 22:02:32 +02:00
|
|
|
|
|
|
|
typedef struct modeset_dev {
|
|
|
|
struct modeset_dev *next;
|
|
|
|
|
2018-06-03 14:56:59 +02:00
|
|
|
//unsigned int front_buf;
|
|
|
|
//struct modeset_buf bufs[2];
|
2018-05-09 22:02:32 +02:00
|
|
|
|
|
|
|
drmModeModeInfo mode;
|
|
|
|
uint32_t conn;
|
|
|
|
uint32_t crtc;
|
|
|
|
drmModeCrtc *saved_crtc;
|
2018-06-03 14:56:59 +02:00
|
|
|
uint32_t width;
|
|
|
|
uint32_t height;
|
2018-08-22 22:20:29 +02:00
|
|
|
uint32_t handle;
|
2018-05-09 22:02:32 +02:00
|
|
|
} modeset_dev;
|
2018-05-07 17:13:39 +02:00
|
|
|
|
2018-05-13 16:29:43 +02:00
|
|
|
modeset_dev* modeset_create(int fd);
|
2018-06-03 14:56:59 +02:00
|
|
|
void modeset_present_buffer(int fd, modeset_dev* dev, _image* buffer);
|
2018-05-13 16:29:43 +02:00
|
|
|
void modeset_destroy(int fd, modeset_dev* dev);
|
2018-06-03 14:56:59 +02:00
|
|
|
int modeset_create_fb(int fd, _image *buf);
|
|
|
|
void modeset_destroy_fb(int fd, _image *buf);
|
|
|
|
int modeset_fb_for_dev(int fd, modeset_dev* dev, _image* buffer);
|
2018-05-06 19:35:47 +02:00
|
|
|
|
|
|
|
#if defined (__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|