2013-04-29 04:40:24 -07:00
|
|
|
#ifndef EVAS_ENGINE_H
|
|
|
|
# define EVAS_ENGINE_H
|
|
|
|
|
2014-02-10 23:09:39 -08:00
|
|
|
#include "evas_common_private.h"
|
|
|
|
#include "evas_macros.h"
|
|
|
|
#include "evas_private.h"
|
|
|
|
#include "Evas.h"
|
|
|
|
#include "Evas_Engine_Drm.h"
|
|
|
|
|
|
|
|
#include <xf86drm.h>
|
|
|
|
#include <xf86drmMode.h>
|
|
|
|
#include <drm_fourcc.h>
|
|
|
|
|
|
|
|
#include <signal.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
2013-04-29 04:40:24 -07:00
|
|
|
extern int _evas_engine_drm_log_dom;
|
|
|
|
|
|
|
|
# ifdef ERR
|
|
|
|
# undef ERR
|
|
|
|
# endif
|
|
|
|
# define ERR(...) EINA_LOG_DOM_ERR(_evas_engine_drm_log_dom, __VA_ARGS__)
|
|
|
|
|
|
|
|
# ifdef DBG
|
|
|
|
# undef DBG
|
|
|
|
# endif
|
|
|
|
# define DBG(...) EINA_LOG_DOM_DBG(_evas_engine_drm_log_dom, __VA_ARGS__)
|
|
|
|
|
|
|
|
# ifdef INF
|
|
|
|
# undef INF
|
|
|
|
# endif
|
|
|
|
# define INF(...) EINA_LOG_DOM_INFO(_evas_engine_drm_log_dom, __VA_ARGS__)
|
|
|
|
|
|
|
|
# ifdef WRN
|
|
|
|
# undef WRN
|
|
|
|
# endif
|
|
|
|
# define WRN(...) EINA_LOG_DOM_WARN(_evas_engine_drm_log_dom, __VA_ARGS__)
|
|
|
|
|
2013-12-25 19:22:05 -08:00
|
|
|
# ifdef CRI
|
|
|
|
# undef CRI
|
2013-04-29 04:40:24 -07:00
|
|
|
# endif
|
2013-12-25 19:22:05 -08:00
|
|
|
# define CRI(...) EINA_LOG_DOM_CRIT(_evas_engine_drm_log_dom, __VA_ARGS__)
|
2013-04-29 04:40:24 -07:00
|
|
|
|
2014-02-10 23:09:39 -08:00
|
|
|
/* define a maximum number of 'buffers' (double-buff, triple-buff, etc) */
|
2014-02-28 04:32:38 -08:00
|
|
|
# define NUM_BUFFERS 2
|
2014-02-10 23:09:39 -08:00
|
|
|
|
|
|
|
typedef struct _Buffer Buffer;
|
2014-02-12 06:28:00 -08:00
|
|
|
typedef struct _Plane Plane;
|
2013-04-29 23:08:25 -07:00
|
|
|
typedef struct _Outbuf Outbuf;
|
|
|
|
|
2013-05-01 02:24:08 -07:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
MODE_FULL,
|
|
|
|
MODE_COPY,
|
|
|
|
MODE_DOUBLE,
|
|
|
|
MODE_TRIPLE
|
|
|
|
};
|
|
|
|
|
2014-02-10 23:09:39 -08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
OUTBUF_DEPTH_NONE,
|
|
|
|
OUTBUF_DEPTH_ARGB_32BPP_8888_8888,
|
|
|
|
OUTBUF_DEPTH_RGB_32BPP_8888_8888,
|
|
|
|
OUTBUF_DEPTH_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Buffer
|
|
|
|
{
|
|
|
|
int w, h;
|
|
|
|
int stride, size;
|
|
|
|
int handle;
|
|
|
|
unsigned int fb;
|
2014-02-28 04:32:38 -08:00
|
|
|
|
2014-02-12 06:28:00 -08:00
|
|
|
void *data; // used for software framebuffers
|
2014-02-10 23:09:39 -08:00
|
|
|
|
2014-02-12 06:28:00 -08:00
|
|
|
# ifdef HAVE_DRM_HW_ACCEL
|
|
|
|
void *bo; // used for hardware framebuffers
|
|
|
|
# endif
|
2014-02-11 23:30:20 -08:00
|
|
|
|
2014-02-10 23:09:39 -08:00
|
|
|
Eina_Bool valid : 1;
|
|
|
|
};
|
|
|
|
|
2014-02-12 06:28:00 -08:00
|
|
|
struct _Plane
|
|
|
|
{
|
|
|
|
unsigned int id;
|
|
|
|
unsigned int crtcs;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
unsigned int x, y;
|
|
|
|
unsigned int w, h;
|
|
|
|
} src, dst;
|
|
|
|
|
|
|
|
unsigned int num_formats;
|
|
|
|
unsigned int formats[];
|
|
|
|
};
|
|
|
|
|
2013-04-29 23:08:25 -07:00
|
|
|
struct _Outbuf
|
|
|
|
{
|
2013-05-01 00:27:02 -07:00
|
|
|
int w, h;
|
|
|
|
unsigned int rotation, depth;
|
2013-04-29 23:08:25 -07:00
|
|
|
Eina_Bool destination_alpha : 1;
|
2014-02-28 04:32:38 -08:00
|
|
|
Eina_Bool vsync : 1;
|
2014-02-10 23:09:39 -08:00
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
2014-02-12 06:28:00 -08:00
|
|
|
int fd;
|
2014-03-18 00:29:47 -07:00
|
|
|
unsigned int conn, crtc, fb;
|
2014-02-12 06:28:00 -08:00
|
|
|
|
2014-02-28 04:32:38 -08:00
|
|
|
Buffer buffer[NUM_BUFFERS];
|
2014-02-10 23:09:39 -08:00
|
|
|
int curr, num;
|
|
|
|
|
|
|
|
drmModeModeInfo mode;
|
|
|
|
drmEventContext ctx;
|
|
|
|
Eina_Bool pending_flip : 1;
|
2014-02-28 04:32:38 -08:00
|
|
|
|
2014-02-10 23:09:39 -08:00
|
|
|
Eina_List *pending_writes;
|
2014-02-11 23:30:20 -08:00
|
|
|
|
2014-02-12 06:28:00 -08:00
|
|
|
Eina_List *planes;
|
|
|
|
|
|
|
|
# ifdef HAVE_DRM_HW_ACCEL
|
|
|
|
void *surface;
|
|
|
|
# endif
|
2014-02-10 23:09:39 -08:00
|
|
|
} priv;
|
2013-04-29 23:08:25 -07:00
|
|
|
};
|
|
|
|
|
2014-02-10 23:09:39 -08:00
|
|
|
Outbuf *evas_outbuf_setup(Evas_Engine_Info_Drm *info, int w, int h);
|
2013-04-29 23:08:25 -07:00
|
|
|
void evas_outbuf_free(Outbuf *ob);
|
2014-02-10 23:09:39 -08:00
|
|
|
void evas_outbuf_reconfigure(Evas_Engine_Info_Drm *info, Outbuf *ob, int w, int h);
|
|
|
|
int evas_outbuf_buffer_state_get(Outbuf *ob);
|
|
|
|
RGBA_Image *evas_outbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch);
|
|
|
|
void evas_outbuf_update_region_push(Outbuf *ob, RGBA_Image *update, int x, int y, int w, int h);
|
2014-02-28 04:32:38 -08:00
|
|
|
void evas_outbuf_update_region_free(Outbuf *ob, RGBA_Image *update);
|
2014-02-10 23:09:39 -08:00
|
|
|
void evas_outbuf_flush(Outbuf *ob);
|
|
|
|
|
2014-06-27 07:21:32 -07:00
|
|
|
Eina_Bool evas_drm_init(Evas_Engine_Info_Drm *info);
|
2014-02-10 23:09:39 -08:00
|
|
|
Eina_Bool evas_drm_shutdown(Evas_Engine_Info_Drm *info);
|
|
|
|
|
|
|
|
Eina_Bool evas_drm_outbuf_setup(Outbuf *ob);
|
|
|
|
void evas_drm_outbuf_framebuffer_set(Outbuf *ob, Buffer *buffer);
|
|
|
|
Eina_Bool evas_drm_framebuffer_create(int fd, Buffer *buffer, int depth);
|
|
|
|
void evas_drm_framebuffer_destroy(int fd, Buffer *buffer);
|
2014-02-28 04:32:38 -08:00
|
|
|
Eina_Bool evas_drm_framebuffer_send(Outbuf *ob, Buffer *buffer);
|
2013-04-29 23:08:25 -07:00
|
|
|
|
2013-04-29 04:40:24 -07:00
|
|
|
#endif
|