ecore_drm2: Pass Ecore_Drm2_Device instead of fd to most functions

Intended to simplify the upcoming commit that merges device find and
device open into a single function that returns a device.

The fd is something callers shouldn't really need to get their hands on,
right now there are still a few places where it's needed, but those will
be gone soon too.
This commit is contained in:
Derek Foreman 2017-07-21 15:48:40 -05:00
parent be0af0ed00
commit 8ff59b2c55
13 changed files with 81 additions and 52 deletions

View File

@ -144,7 +144,7 @@ EAPI int ecore_drm2_shutdown(void);
/** /**
* Read and process pending Drm events * Read and process pending Drm events
* *
* @param fd drm file descriptor * @param dev drm device
* @param ctx * @param ctx
* *
* @return 0 on success, -1 otherwise * @return 0 on success, -1 otherwise
@ -156,7 +156,7 @@ EAPI int ecore_drm2_shutdown(void);
* @ingroup Ecore_Drm_Init_Group * @ingroup Ecore_Drm_Init_Group
* @since 1.19 * @since 1.19
*/ */
EAPI int ecore_drm2_event_handle(int fd, Ecore_Drm2_Context *drmctx); EAPI int ecore_drm2_event_handle(Ecore_Drm2_Device *dev, Ecore_Drm2_Context *drmctx);
/** /**
* @defgroup Ecore_Drm2_Device_Group Drm device functions * @defgroup Ecore_Drm2_Device_Group Drm device functions
@ -832,7 +832,7 @@ EAPI unsigned int ecore_drm2_output_subpixel_get(const Ecore_Drm2_Output *output
/** /**
* Create a new framebuffer object * Create a new framebuffer object
* *
* @param fd * @param dev
* @param width * @param width
* @param height * @param height
* @param depth * @param depth
@ -844,9 +844,9 @@ EAPI unsigned int ecore_drm2_output_subpixel_get(const Ecore_Drm2_Output *output
* @ingroup Ecore_Drm2_Fb_Group * @ingroup Ecore_Drm2_Fb_Group
* @since 1.18 * @since 1.18
*/ */
EAPI Ecore_Drm2_Fb *ecore_drm2_fb_create(int fd, int width, int height, int depth, int bpp, unsigned int format); EAPI Ecore_Drm2_Fb *ecore_drm2_fb_create(Ecore_Drm2_Device *dev, int width, int height, int depth, int bpp, unsigned int format);
EAPI Ecore_Drm2_Fb *ecore_drm2_fb_gbm_create(int fd, int width, int height, int depth, int bpp, unsigned int format, unsigned int handle, unsigned int stride, void *bo); EAPI Ecore_Drm2_Fb *ecore_drm2_fb_gbm_create(Ecore_Drm2_Device *dev, int width, int height, int depth, int bpp, unsigned int format, unsigned int handle, unsigned int stride, void *bo);
/** /**
* Get a framebuffer's mmap'd data * Get a framebuffer's mmap'd data
@ -971,7 +971,7 @@ EAPI void *ecore_drm2_fb_bo_get(Ecore_Drm2_Fb *fb);
/** /**
* Import a dmabuf object as a Framebuffer * Import a dmabuf object as a Framebuffer
* *
* @param fd * @param dev
* @param width * @param width
* @param height * @param height
* @param depth * @param depth
@ -987,7 +987,7 @@ EAPI void *ecore_drm2_fb_bo_get(Ecore_Drm2_Fb *fb);
* @since 1.20 * @since 1.20
* *
*/ */
EAPI Ecore_Drm2_Fb *ecore_drm2_fb_dmabuf_import(int fd, int width, int height, int depth, int bpp, unsigned int format, unsigned int strides[4], int dmabuf_fd[4], int dmabuf_fd_count); EAPI Ecore_Drm2_Fb *ecore_drm2_fb_dmabuf_import(Ecore_Drm2_Device *dev, int width, int height, int depth, int bpp, unsigned int format, unsigned int strides[4], int dmabuf_fd[4], int dmabuf_fd_count);
/** /**
* Discard a framebuffer object * Discard a framebuffer object
@ -1094,6 +1094,18 @@ EAPI void ecore_drm2_fb_status_handler_set(Ecore_Drm2_Fb *fb, Ecore_Drm2_Fb_Stat
*/ */
EAPI Eina_Bool ecore_drm2_output_blanktime_get(Ecore_Drm2_Output *output, int sequence, long *sec, long *usec); EAPI Eina_Bool ecore_drm2_output_blanktime_get(Ecore_Drm2_Output *output, int sequence, long *sec, long *usec);
/**
* Get the fd of an Ecore_Drm2_Device
*
* Query the fd of the device.
*
* @param device
*
* @since 1.20
*/
EAPI int ecore_drm2_device_fd_get(Ecore_Drm2_Device *device);
# endif # endif
#endif #endif

View File

@ -219,16 +219,16 @@ ecore_drm2_shutdown(void)
} }
EAPI int EAPI int
ecore_drm2_event_handle(int fd, Ecore_Drm2_Context *drmctx) ecore_drm2_event_handle(Ecore_Drm2_Device *dev, Ecore_Drm2_Context *drmctx)
{ {
drmEventContext ctx; drmEventContext ctx;
EINA_SAFETY_ON_TRUE_RETURN_VAL((fd < 0), -1); EINA_SAFETY_ON_NULL_RETURN_VAL(dev, -1);
memset(&ctx, 0, sizeof(ctx)); memset(&ctx, 0, sizeof(ctx));
ctx.version = 2; ctx.version = 2;
ctx.page_flip_handler = drmctx->page_flip_handler; ctx.page_flip_handler = drmctx->page_flip_handler;
ctx.vblank_handler = drmctx->vblank_handler; ctx.vblank_handler = drmctx->vblank_handler;
return sym_drmHandleEvent(fd, &ctx); return sym_drmHandleEvent(dev->fd, &ctx);
} }

View File

@ -885,6 +885,14 @@ ecore_drm2_device_prefer_shadow(Ecore_Drm2_Device *device)
return EINA_FALSE; return EINA_FALSE;
} }
EAPI int
ecore_drm2_device_fd_get(Ecore_Drm2_Device *device)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(device, -1);
return device->fd;
}
/* prevent crashing with old apps compiled against these functions */ /* prevent crashing with old apps compiled against these functions */
EAPI void ecore_drm2_device_keyboard_cached_context_set(){}; EAPI void ecore_drm2_device_keyboard_cached_context_set(){};
EAPI void ecore_drm2_device_keyboard_cached_keymap_set(){}; EAPI void ecore_drm2_device_keyboard_cached_keymap_set(){};

View File

@ -16,7 +16,7 @@ _fb2_create(Ecore_Drm2_Fb *fb)
} }
EAPI Ecore_Drm2_Fb * EAPI Ecore_Drm2_Fb *
ecore_drm2_fb_create(int fd, int width, int height, int depth, int bpp, unsigned int format) ecore_drm2_fb_create(Ecore_Drm2_Device *dev, int width, int height, int depth, int bpp, unsigned int format)
{ {
Ecore_Drm2_Fb *fb; Ecore_Drm2_Fb *fb;
struct drm_mode_create_dumb carg; struct drm_mode_create_dumb carg;
@ -24,12 +24,12 @@ ecore_drm2_fb_create(int fd, int width, int height, int depth, int bpp, unsigned
struct drm_mode_map_dumb marg; struct drm_mode_map_dumb marg;
int ret; int ret;
EINA_SAFETY_ON_TRUE_RETURN_VAL((fd < 0), NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(dev, NULL);
fb = calloc(1, sizeof(Ecore_Drm2_Fb)); fb = calloc(1, sizeof(Ecore_Drm2_Fb));
if (!fb) return NULL; if (!fb) return NULL;
fb->fd = fd; fb->fd = dev->fd;
fb->w = width; fb->w = width;
fb->h = height; fb->h = height;
fb->bpp = bpp; fb->bpp = bpp;
@ -42,7 +42,7 @@ ecore_drm2_fb_create(int fd, int width, int height, int depth, int bpp, unsigned
carg.width = width; carg.width = width;
carg.height = height; carg.height = height;
ret = sym_drmIoctl(fd, DRM_IOCTL_MODE_CREATE_DUMB, &carg); ret = sym_drmIoctl(dev->fd, DRM_IOCTL_MODE_CREATE_DUMB, &carg);
if (ret) goto err; if (ret) goto err;
fb->handles[0] = carg.handle; fb->handles[0] = carg.handle;
@ -52,7 +52,7 @@ ecore_drm2_fb_create(int fd, int width, int height, int depth, int bpp, unsigned
if (!_fb2_create(fb)) if (!_fb2_create(fb))
{ {
ret = ret =
sym_drmModeAddFB(fd, width, height, depth, bpp, sym_drmModeAddFB(dev->fd, width, height, depth, bpp,
fb->strides[0], fb->handles[0], &fb->id); fb->strides[0], fb->handles[0], &fb->id);
if (ret) if (ret)
{ {
@ -63,14 +63,14 @@ ecore_drm2_fb_create(int fd, int width, int height, int depth, int bpp, unsigned
memset(&marg, 0, sizeof(struct drm_mode_map_dumb)); memset(&marg, 0, sizeof(struct drm_mode_map_dumb));
marg.handle = fb->handles[0]; marg.handle = fb->handles[0];
ret = sym_drmIoctl(fd, DRM_IOCTL_MODE_MAP_DUMB, &marg); ret = sym_drmIoctl(dev->fd, DRM_IOCTL_MODE_MAP_DUMB, &marg);
if (ret) if (ret)
{ {
ERR("Could not map framebuffer: %m"); ERR("Could not map framebuffer: %m");
goto map_err; goto map_err;
} }
fb->mmap = mmap(NULL, fb->sizes[0], PROT_WRITE, MAP_SHARED, fd, marg.offset); fb->mmap = mmap(NULL, fb->sizes[0], PROT_WRITE, MAP_SHARED, dev->fd, marg.offset);
if (fb->mmap == MAP_FAILED) if (fb->mmap == MAP_FAILED)
{ {
ERR("Could not mmap framebuffer memory: %m"); ERR("Could not mmap framebuffer memory: %m");
@ -80,22 +80,22 @@ ecore_drm2_fb_create(int fd, int width, int height, int depth, int bpp, unsigned
return fb; return fb;
map_err: map_err:
sym_drmModeRmFB(fd, fb->id); sym_drmModeRmFB(dev->fd, fb->id);
add_err: add_err:
memset(&darg, 0, sizeof(struct drm_mode_destroy_dumb)); memset(&darg, 0, sizeof(struct drm_mode_destroy_dumb));
darg.handle = fb->handles[0]; darg.handle = fb->handles[0];
sym_drmIoctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, &darg); sym_drmIoctl(dev->fd, DRM_IOCTL_MODE_DESTROY_DUMB, &darg);
err: err:
free(fb); free(fb);
return NULL; return NULL;
} }
EAPI Ecore_Drm2_Fb * EAPI Ecore_Drm2_Fb *
ecore_drm2_fb_gbm_create(int fd, int width, int height, int depth, int bpp, unsigned int format, unsigned int handle, unsigned int stride, void *bo) ecore_drm2_fb_gbm_create(Ecore_Drm2_Device *dev, int width, int height, int depth, int bpp, unsigned int format, unsigned int handle, unsigned int stride, void *bo)
{ {
Ecore_Drm2_Fb *fb; Ecore_Drm2_Fb *fb;
EINA_SAFETY_ON_TRUE_RETURN_VAL((fd < 0), NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(dev, NULL);
fb = calloc(1, sizeof(Ecore_Drm2_Fb)); fb = calloc(1, sizeof(Ecore_Drm2_Fb));
if (!fb) return NULL; if (!fb) return NULL;
@ -103,7 +103,7 @@ ecore_drm2_fb_gbm_create(int fd, int width, int height, int depth, int bpp, unsi
fb->gbm = EINA_TRUE; fb->gbm = EINA_TRUE;
fb->gbm_bo = bo; fb->gbm_bo = bo;
fb->fd = fd; fb->fd = dev->fd;
fb->w = width; fb->w = width;
fb->h = height; fb->h = height;
fb->bpp = bpp; fb->bpp = bpp;
@ -116,7 +116,7 @@ ecore_drm2_fb_gbm_create(int fd, int width, int height, int depth, int bpp, unsi
if (!_fb2_create(fb)) if (!_fb2_create(fb))
{ {
if (sym_drmModeAddFB(fd, width, height, depth, bpp, if (sym_drmModeAddFB(dev->fd, width, height, depth, bpp,
fb->strides[0], fb->handles[0], &fb->id)) fb->strides[0], fb->handles[0], &fb->id))
{ {
ERR("Could not add framebuffer: %m"); ERR("Could not add framebuffer: %m");
@ -664,20 +664,22 @@ ecore_drm2_fb_bo_get(Ecore_Drm2_Fb *fb)
} }
EAPI Ecore_Drm2_Fb * EAPI Ecore_Drm2_Fb *
ecore_drm2_fb_dmabuf_import(int fd, int width, int height, int depth, int bpp, unsigned int format, unsigned int strides[4], int dmabuf_fd[4], int dmabuf_fd_count) ecore_drm2_fb_dmabuf_import(Ecore_Drm2_Device *dev, int width, int height, int depth, int bpp, unsigned int format, unsigned int strides[4], int dmabuf_fd[4], int dmabuf_fd_count)
{ {
int i; int i;
Ecore_Drm2_Fb *fb; Ecore_Drm2_Fb *fb;
EINA_SAFETY_ON_NULL_RETURN_VAL(dev, NULL);
fb = calloc(1, sizeof(Ecore_Drm2_Fb)); fb = calloc(1, sizeof(Ecore_Drm2_Fb));
if (!fb) return NULL; if (!fb) return NULL;
for (i = 0; i < dmabuf_fd_count; i++) for (i = 0; i < dmabuf_fd_count; i++)
if (sym_drmPrimeFDToHandle(fd, dmabuf_fd[i], &fb->handles[i])) if (sym_drmPrimeFDToHandle(dev->fd, dmabuf_fd[i], &fb->handles[i]))
goto fail; goto fail;
fb->dmabuf = EINA_TRUE; fb->dmabuf = EINA_TRUE;
fb->fd = fd; fb->fd = dev->fd;
fb->w = width; fb->w = width;
fb->h = height; fb->h = height;
fb->bpp = bpp; fb->bpp = bpp;

View File

@ -48,7 +48,6 @@
typedef struct _Ecore_Evas_Engine_Drm_Data typedef struct _Ecore_Evas_Engine_Drm_Data
{ {
int fd;
int cw, ch; int cw, ch;
int clockid; int clockid;
int x, y, w, h; int x, y, w, h;
@ -156,8 +155,7 @@ _ecore_evas_drm_init(Ecore_Evas *ee, Ecore_Evas_Engine_Drm_Data *edata, const ch
goto dev_err; goto dev_err;
} }
edata->fd = ecore_drm2_device_open(edata->dev); if (ecore_drm2_device_open(edata->dev) < 0)
if (edata->fd < 0)
{ {
ERR("Failed to open device"); ERR("Failed to open device");
goto open_err; goto open_err;
@ -597,7 +595,7 @@ _cb_drm_event(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED)
ee = data; ee = data;
edata = ee->engine.data; edata = ee->engine.data;
ret = ecore_drm2_event_handle(edata->fd, &edata->ctx); ret = ecore_drm2_event_handle(edata->dev, &edata->ctx);
if (ret) if (ret)
{ {
WRN("drmHandleEvent failed to read an event"); WRN("drmHandleEvent failed to read an event");
@ -907,7 +905,7 @@ _ecore_evas_new_internal(const char *device, int x, int y, int w, int h, Eina_Bo
if ((num) && (!atoi(num))) if ((num) && (!atoi(num)))
einfo->info.vsync = EINA_FALSE; einfo->info.vsync = EINA_FALSE;
einfo->info.fd = edata->fd; einfo->info.dev = edata->dev;
einfo->info.bpp = edata->bpp; einfo->info.bpp = edata->bpp;
einfo->info.depth = edata->depth; einfo->info.depth = edata->depth;
einfo->info.format = edata->format; einfo->info.format = edata->format;
@ -925,7 +923,7 @@ _ecore_evas_new_internal(const char *device, int x, int y, int w, int h, Eina_Bo
{ {
Evas_Engine_Info_Drm *einfo = tinfo; Evas_Engine_Info_Drm *einfo = tinfo;
einfo->info.fd = edata->fd; einfo->info.dev = edata->dev;
einfo->info.bpp = edata->bpp; einfo->info.bpp = edata->bpp;
einfo->info.depth = edata->depth; einfo->info.depth = edata->depth;
einfo->info.format = edata->format; einfo->info.format = edata->format;
@ -962,7 +960,8 @@ _ecore_evas_new_internal(const char *device, int x, int y, int w, int h, Eina_Bo
edata->ctx.page_flip_handler = _cb_pageflip; edata->ctx.page_flip_handler = _cb_pageflip;
edata->hdlr = edata->hdlr =
ecore_main_fd_handler_add(edata->fd, ECORE_FD_READ, _cb_drm_event, ee, ecore_main_fd_handler_add(ecore_drm2_device_fd_get(edata->dev),
ECORE_FD_READ, _cb_drm_event, ee,
NULL, NULL); NULL, NULL);
canvases = eina_list_append(canvases, ee); canvases = eina_list_append(canvases, ee);

View File

@ -1,6 +1,8 @@
#ifndef _EVAS_ENGINE_DRM_H #ifndef _EVAS_ENGINE_DRM_H
# define _EVAS_ENGINE_DRM_H # define _EVAS_ENGINE_DRM_H
# include <Ecore_Drm2.h>
typedef struct _Evas_Engine_Info_Drm typedef struct _Evas_Engine_Info_Drm
{ {
/* PRIVATE - don't mess with this baby or evas will poke its tongue out */ /* PRIVATE - don't mess with this baby or evas will poke its tongue out */
@ -9,7 +11,7 @@ typedef struct _Evas_Engine_Info_Drm
struct struct
{ {
int fd; Ecore_Drm2_Device *dev;
int depth, bpp; int depth, bpp;
unsigned int format, rotation; unsigned int format, rotation;

View File

@ -5,7 +5,7 @@ typedef struct _Render_Engine
{ {
Render_Engine_Software_Generic generic; Render_Engine_Software_Generic generic;
int fd; Ecore_Drm2_Device *dev;
} Render_Engine; } Render_Engine;
struct scanout_handle struct scanout_handle
@ -30,7 +30,7 @@ _render_engine_setup(Evas_Engine_Info_Drm *info, int w, int h)
ob = _outbuf_setup(info, w, h); ob = _outbuf_setup(info, w, h);
if (!ob) goto err; if (!ob) goto err;
re->fd = info->info.fd; re->dev = info->info.dev;
if (!evas_render_engine_software_generic_init(&re->generic, ob, if (!evas_render_engine_software_generic_init(&re->generic, ob,
_outbuf_state_get, _outbuf_state_get,
@ -120,7 +120,7 @@ eng_output_free(void *engine EINA_UNUSED, void *data)
} }
static Ecore_Drm2_Fb * static Ecore_Drm2_Fb *
drm_import_simple_dmabuf(int fd, struct dmabuf_attributes *attributes) drm_import_simple_dmabuf(Ecore_Drm2_Device *dev, struct dmabuf_attributes *attributes)
{ {
unsigned int stride[4] = { 0 }; unsigned int stride[4] = { 0 };
int dmabuf_fd[4] = { 0 }; int dmabuf_fd[4] = { 0 };
@ -132,7 +132,7 @@ drm_import_simple_dmabuf(int fd, struct dmabuf_attributes *attributes)
dmabuf_fd[i] = attributes->fd[i]; dmabuf_fd[i] = attributes->fd[i];
} }
return ecore_drm2_fb_dmabuf_import(fd, attributes->width, return ecore_drm2_fb_dmabuf_import(dev, attributes->width,
attributes->height, 32, 32, attributes->height, 32, 32,
attributes->format, stride, attributes->format, stride,
dmabuf_fd, attributes->n_planes); dmabuf_fd, attributes->n_planes);
@ -197,7 +197,7 @@ eng_image_plane_assign(void *data, void *image, int x, int y)
* sticking to this one for now */ * sticking to this one for now */
if (n->ns.type != EVAS_NATIVE_SURFACE_WL_DMABUF) return NULL; if (n->ns.type != EVAS_NATIVE_SURFACE_WL_DMABUF) return NULL;
fb = drm_import_simple_dmabuf(re->fd, &n->ns_data.wl_surface_dmabuf.attr); fb = drm_import_simple_dmabuf(re->dev, &n->ns_data.wl_surface_dmabuf.attr);
if (!fb) return NULL; if (!fb) return NULL;
g = calloc(1, sizeof(struct scanout_handle)); g = calloc(1, sizeof(struct scanout_handle));

View File

@ -52,7 +52,8 @@ typedef struct _Outbuf_Fb
struct _Outbuf struct _Outbuf
{ {
int fd, w, h, bpp, rotation; Ecore_Drm2_Device *dev;
int w, h, bpp, rotation;
unsigned int depth, format; unsigned int depth, format;
struct struct

View File

@ -32,7 +32,7 @@ static Eina_Bool
_outbuf_fb_create(Outbuf *ob, Outbuf_Fb *ofb) _outbuf_fb_create(Outbuf *ob, Outbuf_Fb *ofb)
{ {
ofb->fb = ofb->fb =
ecore_drm2_fb_create(ob->fd, ob->w, ob->h, ecore_drm2_fb_create(ob->dev, ob->w, ob->h,
ob->depth, ob->bpp, ob->format); ob->depth, ob->bpp, ob->format);
if (!ofb->fb) return EINA_FALSE; if (!ofb->fb) return EINA_FALSE;
@ -66,7 +66,7 @@ _outbuf_setup(Evas_Engine_Info_Drm *info, int w, int h)
ob->w = w; ob->w = w;
ob->h = h; ob->h = h;
ob->fd = info->info.fd; ob->dev = info->info.dev;
ob->alpha = info->info.alpha; ob->alpha = info->info.alpha;
ob->rotation = info->info.rotation; ob->rotation = info->info.rotation;

View File

@ -18,7 +18,8 @@ struct _Evas_Engine_Info_GL_Drm
{ {
struct gbm_device *gbm; struct gbm_device *gbm;
int fd, bpp; Ecore_Drm2_Device *dev;
int bpp;
unsigned int rotation, depth; unsigned int rotation, depth;
unsigned int format, flags; unsigned int format, flags;

View File

@ -122,9 +122,11 @@ static const EVGL_Interface evgl_funcs =
Eina_Bool Eina_Bool
eng_gbm_init(Evas_Engine_Info_GL_Drm *info) eng_gbm_init(Evas_Engine_Info_GL_Drm *info)
{ {
int fd;
if (!info) return EINA_FALSE; if (!info) return EINA_FALSE;
if (!(info->info.gbm = gbm_create_device(info->info.fd))) fd = ecore_drm2_device_fd_get(info->info.dev);
if (!(info->info.gbm = gbm_create_device(fd)))
{ {
ERR("Coult not create gbm device"); ERR("Coult not create gbm device");
return EINA_FALSE; return EINA_FALSE;
@ -600,7 +602,7 @@ _re_winfree(Render_Engine *re)
} }
static Ecore_Drm2_Fb * static Ecore_Drm2_Fb *
drm_import_simple_dmabuf(int fd, struct dmabuf_attributes *attributes) drm_import_simple_dmabuf(Ecore_Drm2_Device *dev, struct dmabuf_attributes *attributes)
{ {
unsigned int stride[4] = { 0 }; unsigned int stride[4] = { 0 };
int dmabuf_fd[4] = { 0 }; int dmabuf_fd[4] = { 0 };
@ -612,7 +614,7 @@ drm_import_simple_dmabuf(int fd, struct dmabuf_attributes *attributes)
dmabuf_fd[i] = attributes->fd[i]; dmabuf_fd[i] = attributes->fd[i];
} }
return ecore_drm2_fb_dmabuf_import(fd, attributes->width, return ecore_drm2_fb_dmabuf_import(dev, attributes->width,
attributes->height, 32, 32, attributes->height, 32, 32,
attributes->format, stride, attributes->format, stride,
dmabuf_fd, attributes->n_planes); dmabuf_fd, attributes->n_planes);
@ -805,7 +807,7 @@ eng_image_plane_assign(void *data, void *image, int x, int y)
* sticking to this one for now */ * sticking to this one for now */
if (n->ns.type != EVAS_NATIVE_SURFACE_WL_DMABUF) return NULL; if (n->ns.type != EVAS_NATIVE_SURFACE_WL_DMABUF) return NULL;
fb = drm_import_simple_dmabuf(re->fd, &n->ns_data.wl_surface_dmabuf.attr); fb = drm_import_simple_dmabuf(re->dev, &n->ns_data.wl_surface_dmabuf.attr);
if (!fb) return NULL; if (!fb) return NULL;
@ -958,7 +960,7 @@ eng_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h)
return NULL; return NULL;
} }
re->fd = info->info.fd; re->dev = info->info.dev;
/* try to create new outbuf */ /* try to create new outbuf */
ob = evas_outbuf_new(info, w, h, swap_mode); ob = evas_outbuf_new(info, w, h, swap_mode);

View File

@ -70,7 +70,7 @@ struct _Render_Engine
{ {
Render_Engine_GL_Generic generic; Render_Engine_GL_Generic generic;
int fd; Ecore_Drm2_Device *dev;
}; };
struct _Context_3D struct _Context_3D
@ -85,7 +85,9 @@ struct _Outbuf
Evas_Engine_Info_GL_Drm *info; Evas_Engine_Info_GL_Drm *info;
Evas_Engine_GL_Context *gl_context; Evas_Engine_GL_Context *gl_context;
int fd, w, h, bpp; Ecore_Drm2_Device *dev;
int w, h, bpp;
unsigned int rotation, depth, format; unsigned int rotation, depth, format;
int prev_age; int prev_age;
Render_Engine_Swap_Mode swap_mode; Render_Engine_Swap_Mode swap_mode;

View File

@ -75,7 +75,7 @@ _evas_outbuf_fb_get(Outbuf *ob, struct gbm_bo *bo)
/* fb->size = fb->stride * fb->h; */ /* fb->size = fb->stride * fb->h; */
fb = fb =
ecore_drm2_fb_gbm_create(ob->fd, w, h, ob->depth, ob->bpp, ecore_drm2_fb_gbm_create(ob->dev, w, h, ob->depth, ob->bpp,
format, hdl, stride, bo); format, hdl, stride, bo);
if (!fb) if (!fb)
{ {
@ -407,7 +407,7 @@ evas_outbuf_new(Evas_Engine_Info_GL_Drm *info, int w, int h, Render_Engine_Swap_
/* ob->vsync = info->info.vsync; */ /* ob->vsync = info->info.vsync; */
ob->swap_mode = swap_mode; ob->swap_mode = swap_mode;
ob->fd = info->info.fd; ob->dev = info->info.dev;
ob->bpp = info->info.bpp; ob->bpp = info->info.bpp;
ob->format = info->info.format; ob->format = info->info.format;
ob->priv.output = info->info.output; ob->priv.output = info->info.output;