2013-05-14 00:16:45 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <Eina.h>
|
|
|
|
#include <Ecore.h>
|
|
|
|
#include "ecore_private.h"
|
|
|
|
#include <Ecore_Input.h>
|
|
|
|
#include <Ecore_Input_Evas.h>
|
|
|
|
#include <Ecore_Evas.h>
|
|
|
|
#include "ecore_evas_private.h"
|
2013-05-14 02:45:47 -07:00
|
|
|
#include "ecore_evas_drm.h"
|
2016-05-03 09:03:00 -07:00
|
|
|
#include <Ecore_Drm2.h>
|
2014-08-21 02:22:16 -07:00
|
|
|
#include <Evas_Engine_Drm.h>
|
2013-05-14 02:45:47 -07:00
|
|
|
|
2017-05-26 13:34:10 -07:00
|
|
|
#define DRM2_NODEFS
|
|
|
|
#include "ecore_drm2_private.h"
|
|
|
|
|
|
|
|
#define ELPUT_NODEFS
|
|
|
|
#include "elput_private.h"
|
|
|
|
|
2014-08-28 10:36:59 -07:00
|
|
|
#ifdef BUILD_ECORE_EVAS_GL_DRM
|
2014-08-21 02:22:16 -07:00
|
|
|
# include <Evas_Engine_GL_Drm.h>
|
|
|
|
# include <dlfcn.h>
|
|
|
|
#endif
|
2013-05-14 02:45:47 -07:00
|
|
|
|
2015-04-28 05:24:48 -07:00
|
|
|
#ifdef _WIN32
|
modules: Rename EAPI macro to MODAPI for modules
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, jptiz, woohyun, lucas, SPAM-smith78899
Reviewed By: vtorri, SPAM-smith78899
Subscribers: SPAM-smith78899, raster, SPAM-cabanacatalogs, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12228
2021-04-17 12:07:55 -07:00
|
|
|
# ifndef EFL_MODULE_STATIC
|
|
|
|
# define EMODAPI __declspec(dllexport)
|
2015-04-28 05:24:48 -07:00
|
|
|
# else
|
modules: Rename EAPI macro to MODAPI for modules
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, jptiz, woohyun, lucas, SPAM-smith78899
Reviewed By: vtorri, SPAM-smith78899
Subscribers: SPAM-smith78899, raster, SPAM-cabanacatalogs, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12228
2021-04-17 12:07:55 -07:00
|
|
|
# define EMODAPI
|
|
|
|
# endif
|
2015-04-28 05:24:48 -07:00
|
|
|
#else
|
|
|
|
# ifdef __GNUC__
|
|
|
|
# if __GNUC__ >= 4
|
modules: Rename EAPI macro to MODAPI for modules
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, jptiz, woohyun, lucas, SPAM-smith78899
Reviewed By: vtorri, SPAM-smith78899
Subscribers: SPAM-smith78899, raster, SPAM-cabanacatalogs, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12228
2021-04-17 12:07:55 -07:00
|
|
|
# define EMODAPI __attribute__ ((visibility("default")))
|
2015-04-28 05:24:48 -07:00
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
#endif /* ! _WIN32 */
|
|
|
|
|
modules: Rename EAPI macro to MODAPI for modules
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, jptiz, woohyun, lucas, SPAM-smith78899
Reviewed By: vtorri, SPAM-smith78899
Subscribers: SPAM-smith78899, raster, SPAM-cabanacatalogs, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12228
2021-04-17 12:07:55 -07:00
|
|
|
#ifndef EMODAPI
|
|
|
|
# define EMODAPI
|
|
|
|
#endif
|
|
|
|
|
2019-04-30 03:48:15 -07:00
|
|
|
#define VSYNC_ANIMATOR 1
|
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
typedef struct _Ecore_Evas_Engine_Drm_Data
|
2014-03-28 03:36:44 -07:00
|
|
|
{
|
2016-05-03 09:03:00 -07:00
|
|
|
int cw, ch;
|
|
|
|
int clockid;
|
|
|
|
int x, y, w, h;
|
|
|
|
int depth, bpp;
|
|
|
|
unsigned int format;
|
2017-07-28 13:24:30 -07:00
|
|
|
double offset;
|
2017-08-11 15:02:23 -07:00
|
|
|
double tick_job_timestamp;
|
2016-11-14 12:24:16 -08:00
|
|
|
Ecore_Drm2_Context ctx;
|
2016-09-02 12:47:49 -07:00
|
|
|
Ecore_Fd_Handler *hdlr;
|
2016-05-03 09:03:00 -07:00
|
|
|
Ecore_Drm2_Device *dev;
|
|
|
|
Ecore_Drm2_Output *output;
|
2017-05-26 13:34:10 -07:00
|
|
|
Evas_Device *seat;
|
2016-09-02 12:47:49 -07:00
|
|
|
Eina_Bool ticking : 1;
|
2017-07-28 13:24:30 -07:00
|
|
|
Eina_Bool once : 1;
|
2017-08-11 15:02:23 -07:00
|
|
|
Ecore_Job *tick_job;
|
2018-02-25 07:28:47 -08:00
|
|
|
Ecore_Job *focus_job;
|
2016-05-03 09:03:00 -07:00
|
|
|
} Ecore_Evas_Engine_Drm_Data;
|
2014-03-28 03:36:44 -07:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
static int _drm_init_count = 0;
|
2017-05-26 13:34:10 -07:00
|
|
|
static Eina_List *handlers;
|
|
|
|
static Eina_List *canvases;
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_drm_device_change(void *d EINA_UNUSED, int t EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Elput_Event_Device_Change *ev = event;
|
|
|
|
const Eina_List *l;
|
|
|
|
Ecore_Evas *ee;
|
|
|
|
Ecore_Evas_Engine_Drm_Data *edata;
|
|
|
|
Elput_Seat *seat;
|
|
|
|
Elput_Manager *manager;
|
|
|
|
Eina_Bool found = EINA_FALSE;
|
|
|
|
Elput_Device_Caps caps;
|
|
|
|
Evas_Device_Class devclass = EVAS_DEVICE_CLASS_NONE;
|
|
|
|
Eo *dev;
|
|
|
|
|
|
|
|
seat = elput_device_seat_get(ev->device);
|
|
|
|
manager = elput_seat_manager_get(seat);
|
|
|
|
caps = elput_device_caps_get(ev->device);
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(canvases, l, ee)
|
|
|
|
{
|
|
|
|
edata = ee->engine.data;
|
|
|
|
found = edata->dev->em == manager;
|
|
|
|
if (found) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!found) return ECORE_CALLBACK_RENEW;
|
|
|
|
if (caps & ELPUT_DEVICE_CAPS_TABLET_TOOL)
|
|
|
|
devclass = EVAS_DEVICE_CLASS_PEN; // idk how "pen" is a device class?
|
|
|
|
else if (caps & ELPUT_DEVICE_CAPS_POINTER)
|
|
|
|
devclass = EVAS_DEVICE_CLASS_MOUSE;
|
|
|
|
else if (caps & ELPUT_DEVICE_CAPS_TOUCH)
|
|
|
|
devclass = EVAS_DEVICE_CLASS_TOUCH;
|
|
|
|
else if (caps & ELPUT_DEVICE_CAPS_KEYBOARD)
|
|
|
|
devclass = EVAS_DEVICE_CLASS_KEYBOARD;
|
|
|
|
switch (ev->type)
|
|
|
|
{
|
|
|
|
case ELPUT_DEVICE_ADDED:
|
|
|
|
{
|
|
|
|
if (!edata->seat)
|
|
|
|
{
|
|
|
|
Eina_Stringshare *name = elput_seat_name_get(seat);
|
|
|
|
edata->seat = evas_device_add_full(ee->evas, name,
|
2017-05-31 01:46:21 -07:00
|
|
|
"drm seat", NULL, NULL, EVAS_DEVICE_CLASS_SEAT, EVAS_DEVICE_SUBCLASS_NONE);
|
2017-05-26 13:34:10 -07:00
|
|
|
evas_device_seat_id_set(edata->seat, strtol(name, NULL, 10));
|
|
|
|
}
|
|
|
|
|
|
|
|
dev = evas_device_add_full(ee->evas, elput_device_output_name_get(ev->device),
|
2017-05-31 01:46:21 -07:00
|
|
|
"drm device", edata->seat, NULL, devclass, EVAS_DEVICE_SUBCLASS_NONE);
|
2017-05-26 13:34:10 -07:00
|
|
|
ev->device->evas_device = dev;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case ELPUT_DEVICE_REMOVED:
|
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(evas_device_list(ee->evas, edata->seat), l, dev)
|
|
|
|
{
|
|
|
|
if (dev != ev->device->evas_device) continue;
|
|
|
|
evas_device_del(dev);
|
2017-06-02 15:23:45 -07:00
|
|
|
ev->device->evas_device = NULL;
|
2017-05-26 13:34:10 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
2014-08-21 02:22:16 -07:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
static int
|
2016-09-02 12:47:49 -07:00
|
|
|
_ecore_evas_drm_init(Ecore_Evas *ee, Ecore_Evas_Engine_Drm_Data *edata, const char *device)
|
2013-05-14 02:45:47 -07:00
|
|
|
{
|
2020-04-28 09:35:07 -07:00
|
|
|
_drm_init_count++;
|
|
|
|
if (_drm_init_count > 1) return _drm_init_count;
|
2013-05-14 02:45:47 -07:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
if (!ecore_drm2_init())
|
2015-04-07 11:10:41 -07:00
|
|
|
{
|
2016-05-03 09:03:00 -07:00
|
|
|
ERR("Failed to init Ecore_Drm2 library");
|
|
|
|
goto init_err;
|
2015-04-07 11:10:41 -07:00
|
|
|
}
|
|
|
|
|
2017-12-01 12:32:35 -08:00
|
|
|
/* NB: No seat name passed in, try to get from env */
|
|
|
|
if (!device) device = getenv("XDG_SEAT");
|
|
|
|
|
|
|
|
/* NB: fallback to seat0 if env var is not set */
|
2016-05-03 09:03:00 -07:00
|
|
|
if (!device) device = "seat0";
|
2013-05-14 02:45:47 -07:00
|
|
|
|
2017-08-03 12:56:19 -07:00
|
|
|
edata->dev = ecore_drm2_device_open(device, 0);
|
2016-05-03 09:03:00 -07:00
|
|
|
if (!edata->dev)
|
2015-01-07 06:51:12 -08:00
|
|
|
{
|
2016-05-03 09:03:00 -07:00
|
|
|
ERR("Failed to open device");
|
|
|
|
goto open_err;
|
2015-01-07 06:51:12 -08:00
|
|
|
}
|
2014-03-10 03:02:31 -07:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
edata->clockid = ecore_drm2_device_clock_id_get(edata->dev);
|
|
|
|
ecore_drm2_device_cursor_size_get(edata->dev, &edata->cw, &edata->ch);
|
2014-03-10 03:02:31 -07:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
if (!ecore_drm2_outputs_create(edata->dev))
|
2014-03-10 03:02:31 -07:00
|
|
|
{
|
2016-05-03 09:03:00 -07:00
|
|
|
ERR("Could not create outputs");
|
|
|
|
goto output_err;
|
2014-03-10 03:02:31 -07:00
|
|
|
}
|
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
edata->output = ecore_drm2_output_find(edata->dev, edata->x, edata->y);
|
2016-09-02 12:47:49 -07:00
|
|
|
if (edata->output) ecore_drm2_output_user_data_set(edata->output, ee);
|
|
|
|
else WRN("Could not find output at %d %d", edata->x, edata->y);
|
2014-03-18 00:27:33 -07:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
ecore_event_evas_init();
|
2017-05-26 13:34:10 -07:00
|
|
|
if (!handlers)
|
|
|
|
{
|
2017-09-18 07:27:04 -07:00
|
|
|
handlers =
|
|
|
|
eina_list_append(handlers,
|
|
|
|
ecore_event_handler_add(ELPUT_EVENT_DEVICE_CHANGE,
|
|
|
|
_drm_device_change, NULL));
|
2017-05-26 13:34:10 -07:00
|
|
|
}
|
2015-11-17 12:55:41 -08:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
return _drm_init_count;
|
2015-11-17 12:55:41 -08:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
output_err:
|
|
|
|
ecore_drm2_device_close(edata->dev);
|
|
|
|
open_err:
|
|
|
|
ecore_drm2_shutdown();
|
|
|
|
init_err:
|
|
|
|
return --_drm_init_count;
|
|
|
|
}
|
2015-11-17 12:55:41 -08:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
static int
|
|
|
|
_ecore_evas_drm_shutdown(Ecore_Evas_Engine_Drm_Data *edata)
|
|
|
|
{
|
2017-05-26 13:34:10 -07:00
|
|
|
Ecore_Event_Handler *h;
|
2015-11-17 12:55:41 -08:00
|
|
|
|
2020-04-28 09:35:07 -07:00
|
|
|
_drm_init_count--;
|
|
|
|
if (_drm_init_count == 0)
|
2018-02-25 07:28:47 -08:00
|
|
|
{
|
2020-04-28 09:35:07 -07:00
|
|
|
if (edata->focus_job)
|
|
|
|
{
|
|
|
|
ecore_job_del(edata->focus_job);
|
|
|
|
edata->focus_job = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (edata->dev)
|
|
|
|
{
|
|
|
|
ecore_drm2_outputs_destroy(edata->dev);
|
|
|
|
ecore_drm2_device_close(edata->dev);
|
|
|
|
edata->dev = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ecore_drm2_shutdown();
|
|
|
|
ecore_event_evas_shutdown();
|
|
|
|
|
|
|
|
EINA_LIST_FREE(handlers, h)
|
|
|
|
ecore_event_handler_del(h);
|
2018-02-25 07:28:47 -08:00
|
|
|
}
|
2014-08-21 02:22:16 -07:00
|
|
|
|
2020-04-28 09:35:07 -07:00
|
|
|
if (_drm_init_count < 0) _drm_init_count = 0;
|
2016-05-03 09:03:00 -07:00
|
|
|
return _drm_init_count;
|
2014-08-21 02:22:16 -07:00
|
|
|
}
|
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
static void
|
|
|
|
_drm_free(Ecore_Evas *ee)
|
2014-08-21 02:22:16 -07:00
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Drm_Data *edata;
|
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
ecore_evas_input_event_unregister(ee);
|
2014-08-21 02:22:16 -07:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
edata = ee->engine.data;
|
2017-05-26 13:34:10 -07:00
|
|
|
canvases = eina_list_remove(canvases, ee);
|
2019-08-07 10:14:06 -07:00
|
|
|
ecore_main_fd_handler_del(edata->hdlr);
|
|
|
|
edata->hdlr = NULL;
|
2016-05-03 09:03:00 -07:00
|
|
|
_ecore_evas_drm_shutdown(edata);
|
|
|
|
free(edata);
|
|
|
|
}
|
2014-08-21 02:22:16 -07:00
|
|
|
|
2017-02-13 10:43:21 -08:00
|
|
|
static void
|
2017-09-19 08:58:55 -07:00
|
|
|
_drm_rotation_do(Ecore_Evas *ee, int rotation, int resize)
|
2017-02-13 10:43:21 -08:00
|
|
|
{
|
|
|
|
Evas_Engine_Info_Drm *einfo;
|
2019-03-22 09:41:28 -07:00
|
|
|
int diff;
|
2017-09-19 08:58:55 -07:00
|
|
|
|
2017-02-13 10:43:21 -08:00
|
|
|
einfo = (Evas_Engine_Info_Drm *)evas_engine_info_get(ee->evas);
|
|
|
|
if (!einfo) return;
|
2017-09-19 08:58:55 -07:00
|
|
|
|
2019-03-22 09:41:28 -07:00
|
|
|
diff = ee->rotation - rotation;
|
|
|
|
if (diff < 0) diff = -diff;
|
2017-10-04 08:41:59 -07:00
|
|
|
|
2019-03-22 09:41:28 -07:00
|
|
|
einfo->info.rotation = rotation;
|
2017-10-04 08:41:59 -07:00
|
|
|
|
2019-03-22 09:41:28 -07:00
|
|
|
if (diff != 180)
|
|
|
|
{
|
|
|
|
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
|
|
|
|
ERR("evas_engine_info_set() for engine '%s' failed", ee->driver);
|
2017-10-04 08:41:59 -07:00
|
|
|
|
2019-03-22 09:41:28 -07:00
|
|
|
if (!resize)
|
2017-10-04 08:41:59 -07:00
|
|
|
{
|
2019-03-22 09:41:28 -07:00
|
|
|
if (!ee->prop.fullscreen)
|
2017-10-04 08:41:59 -07:00
|
|
|
{
|
2019-03-22 09:41:28 -07:00
|
|
|
ee->expecting_resize.w = ee->h;
|
|
|
|
ee->expecting_resize.h = ee->w;
|
|
|
|
evas_output_size_set(ee->evas, ee->req.h, ee->req.w);
|
|
|
|
evas_output_viewport_set(ee->evas, 0, 0, ee->req.h, ee->req.w);
|
2017-10-04 08:41:59 -07:00
|
|
|
}
|
2019-03-22 09:41:28 -07:00
|
|
|
else
|
2017-10-04 08:41:59 -07:00
|
|
|
{
|
2019-03-22 09:41:28 -07:00
|
|
|
if (PORTRAIT_CHECK(rotation))
|
|
|
|
{
|
|
|
|
evas_output_size_set(ee->evas, ee->req.w, ee->req.h);
|
|
|
|
evas_output_viewport_set(ee->evas, 0, 0, ee->req.w, ee->req.h);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_output_size_set(ee->evas, ee->req.h, ee->req.w);
|
|
|
|
evas_output_viewport_set(ee->evas, 0, 0, ee->req.h, ee->req.w);
|
|
|
|
}
|
|
|
|
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
2017-10-04 08:41:59 -07:00
|
|
|
}
|
2019-03-22 09:41:28 -07:00
|
|
|
if (PORTRAIT_CHECK(rotation))
|
2017-09-19 08:58:55 -07:00
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
|
|
|
|
else
|
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.h, ee->req.w);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-03-22 09:41:28 -07:00
|
|
|
if (PORTRAIT_CHECK(rotation))
|
2017-09-19 08:58:55 -07:00
|
|
|
{
|
|
|
|
evas_output_size_set(ee->evas, ee->w, ee->h);
|
|
|
|
evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_output_size_set(ee->evas, ee->h, ee->w);
|
|
|
|
evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
|
|
|
|
}
|
2019-03-22 09:41:28 -07:00
|
|
|
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
|
|
|
if (PORTRAIT_CHECK(rotation))
|
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
|
|
|
|
else
|
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
|
2017-09-19 08:58:55 -07:00
|
|
|
}
|
2019-03-22 09:41:28 -07:00
|
|
|
ee->rotation = rotation;
|
2017-09-19 08:58:55 -07:00
|
|
|
}
|
2017-10-11 10:07:09 -07:00
|
|
|
else
|
2019-03-22 09:41:28 -07:00
|
|
|
{
|
|
|
|
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
|
|
|
|
ERR("evas_engine_info_set() for engine '%s' failed", ee->driver);
|
|
|
|
ee->rotation = rotation;
|
|
|
|
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
|
|
|
if (PORTRAIT_CHECK(rotation))
|
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
|
|
|
|
else
|
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
|
|
|
|
}
|
2017-02-13 10:43:21 -08:00
|
|
|
}
|
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
static void
|
2017-05-08 15:01:49 -07:00
|
|
|
_drm_render_updates(void *data, Evas *evas EINA_UNUSED, void *event EINA_UNUSED)
|
2016-05-03 09:03:00 -07:00
|
|
|
{
|
2017-05-08 15:01:49 -07:00
|
|
|
Ecore_Evas *ee = data;
|
2017-02-13 10:43:21 -08:00
|
|
|
|
|
|
|
if (ee->delayed.rotation_changed)
|
|
|
|
{
|
|
|
|
_drm_rotation_do(ee, ee->delayed.rotation, ee->delayed.rotation_resize);
|
|
|
|
ee->delayed.rotation_changed = EINA_FALSE;
|
|
|
|
}
|
2013-05-14 02:45:47 -07:00
|
|
|
}
|
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
static void
|
|
|
|
_drm_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h)
|
2013-05-14 02:45:47 -07:00
|
|
|
{
|
2016-05-03 09:03:00 -07:00
|
|
|
Ecore_Evas_Engine_Drm_Data *edata;
|
2014-03-10 03:02:31 -07:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
edata = ee->engine.data;
|
2017-08-08 10:02:15 -07:00
|
|
|
ecore_drm2_output_info_get(edata->output, x, y, w, h, NULL);
|
2014-03-10 03:02:31 -07:00
|
|
|
}
|
|
|
|
|
2016-11-28 07:01:39 -08:00
|
|
|
static void
|
|
|
|
_drm_screen_dpi_get(const Ecore_Evas *ee, int *xdpi, int *ydpi)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Drm_Data *edata;
|
|
|
|
|
|
|
|
edata = ee->engine.data;
|
|
|
|
ecore_drm2_output_dpi_get(edata->output, xdpi, ydpi);
|
|
|
|
}
|
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
static void
|
|
|
|
_drm_pointer_xy_get(const Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y)
|
2014-03-10 03:02:31 -07:00
|
|
|
{
|
2016-05-03 09:03:00 -07:00
|
|
|
Ecore_Evas_Engine_Drm_Data *edata;
|
2014-03-10 03:02:31 -07:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
edata = ee->engine.data;
|
|
|
|
ecore_drm2_device_pointer_xy_get(edata->dev, x, y);
|
2014-03-10 03:02:31 -07:00
|
|
|
}
|
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_drm_pointer_warp(const Ecore_Evas *ee, Evas_Coord x, Evas_Coord y)
|
2014-03-10 03:02:31 -07:00
|
|
|
{
|
2016-05-03 09:03:00 -07:00
|
|
|
Ecore_Evas_Engine_Drm_Data *edata;
|
2014-03-28 03:36:44 -07:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
edata = ee->engine.data;
|
|
|
|
ecore_drm2_device_pointer_warp(edata->dev, x, y);
|
|
|
|
return EINA_TRUE;
|
2014-03-10 03:02:31 -07:00
|
|
|
}
|
|
|
|
|
2018-02-25 07:28:47 -08:00
|
|
|
static void
|
|
|
|
_drm_show_focus_job(void *data)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee = data;
|
|
|
|
Ecore_Evas_Engine_Drm_Data *edata;
|
|
|
|
|
|
|
|
_ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
|
|
|
|
edata = ee->engine.data;
|
|
|
|
edata->focus_job = NULL;
|
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_show(Ecore_Evas *ee)
|
2014-03-18 03:15:05 -07:00
|
|
|
{
|
2017-06-02 12:19:39 -07:00
|
|
|
Ecore_Evas_Engine_Drm_Data *edata;
|
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
if ((!ee) || (ee->visible)) return;
|
2014-03-18 03:15:05 -07:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
ee->should_be_visible = 1;
|
2014-03-18 03:15:05 -07:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
if (ee->prop.avoid_damage)
|
2017-05-08 15:01:49 -07:00
|
|
|
{
|
|
|
|
ecore_evas_render(ee);
|
|
|
|
ecore_evas_render_wait(ee);
|
|
|
|
}
|
2014-03-18 03:18:58 -07:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
if (ee->prop.override)
|
|
|
|
{
|
|
|
|
ee->prop.withdrawn = EINA_FALSE;
|
|
|
|
if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
|
|
|
|
}
|
2014-03-18 03:18:58 -07:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
ee->visible = 1;
|
|
|
|
if (ee->func.fn_show) ee->func.fn_show(ee);
|
2017-06-02 12:19:39 -07:00
|
|
|
|
|
|
|
edata = ee->engine.data;
|
2018-02-25 07:28:47 -08:00
|
|
|
edata->focus_job = ecore_job_add(_drm_show_focus_job, ee);
|
2017-06-02 12:19:39 -07:00
|
|
|
/* HACK: sometimes we still have an animator ticking when we vc switch
|
|
|
|
* so for now we just fire off a flip here to kick it when we come back.
|
|
|
|
* This is just papering over a bug for now until I have time to track
|
|
|
|
* it down properly. :(
|
|
|
|
*/
|
|
|
|
ecore_drm2_fb_flip(NULL, edata->output);
|
2014-03-18 03:20:43 -07:00
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_hide(Ecore_Evas *ee)
|
2014-03-10 03:02:31 -07:00
|
|
|
{
|
2016-05-03 09:03:00 -07:00
|
|
|
if ((!ee) || (!ee->visible)) return;
|
|
|
|
|
|
|
|
if (ee->prop.override)
|
|
|
|
{
|
|
|
|
ee->prop.withdrawn = EINA_TRUE;
|
|
|
|
if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ee->visible) return;
|
|
|
|
|
|
|
|
ee->visible = 0;
|
|
|
|
ee->should_be_visible = 0;
|
|
|
|
evas_sync(ee->evas);
|
|
|
|
if (ee->func.fn_hide) ee->func.fn_hide(ee);
|
2014-03-10 03:02:31 -07:00
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_move(Ecore_Evas *ee, int x, int y)
|
2014-03-18 03:23:55 -07:00
|
|
|
{
|
|
|
|
ee->req.x = x;
|
|
|
|
ee->req.y = y;
|
|
|
|
if ((ee->x == x) && (ee->y == y)) return;
|
|
|
|
ee->x = x;
|
|
|
|
ee->y = y;
|
|
|
|
if (ee->func.fn_move) ee->func.fn_move(ee);
|
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_resize(Ecore_Evas *ee, int w, int h)
|
2014-03-10 03:02:31 -07:00
|
|
|
{
|
|
|
|
ee->req.w = w;
|
|
|
|
ee->req.h = h;
|
|
|
|
if ((ee->w == w) && (ee->h == h)) return;
|
|
|
|
ee->w = w;
|
|
|
|
ee->h = h;
|
|
|
|
evas_output_size_set(ee->evas, w, h);
|
|
|
|
evas_output_viewport_set(ee->evas, 0, 0, w, h);
|
|
|
|
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
|
2014-03-18 03:27:02 -07:00
|
|
|
{
|
|
|
|
if ((ee->x != x) || (ee->y != y))
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_move(ee, x, y);
|
2014-03-18 03:27:02 -07:00
|
|
|
if ((ee->w != w) || (ee->h != h))
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_resize(ee, w, h);
|
2014-03-18 03:27:02 -07:00
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2017-02-13 10:43:21 -08:00
|
|
|
_drm_rotation_set(Ecore_Evas *ee, int rotation, int resize)
|
2014-03-18 03:30:44 -07:00
|
|
|
{
|
|
|
|
if (ee->rotation == rotation) return;
|
2017-02-13 10:43:21 -08:00
|
|
|
|
|
|
|
if (ee->in_async_render)
|
|
|
|
{
|
|
|
|
ee->delayed.rotation = rotation;
|
|
|
|
ee->delayed.rotation_resize = resize;
|
|
|
|
ee->delayed.rotation_changed = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
_drm_rotation_do(ee, rotation, resize);
|
2014-03-18 03:30:44 -07:00
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_title_set(Ecore_Evas *ee, const char *title)
|
2014-03-18 03:33:38 -07:00
|
|
|
{
|
2015-01-22 11:37:56 -08:00
|
|
|
if (eina_streq(ee->prop.title, title)) return;
|
2014-03-18 03:33:38 -07:00
|
|
|
if (ee->prop.title) free(ee->prop.title);
|
|
|
|
ee->prop.title = NULL;
|
|
|
|
if (title) ee->prop.title = strdup(title);
|
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
|
2014-03-18 03:38:36 -07:00
|
|
|
{
|
2015-01-22 11:37:56 -08:00
|
|
|
if (!eina_streq(ee->prop.name, n))
|
|
|
|
{
|
|
|
|
if (ee->prop.name) free(ee->prop.name);
|
|
|
|
ee->prop.name = NULL;
|
|
|
|
if (n) ee->prop.name = strdup(n);
|
|
|
|
}
|
2016-05-03 09:03:00 -07:00
|
|
|
|
2015-01-22 11:37:56 -08:00
|
|
|
if (!eina_streq(ee->prop.clas, c))
|
|
|
|
{
|
|
|
|
if (ee->prop.clas) free(ee->prop.clas);
|
|
|
|
ee->prop.clas = NULL;
|
|
|
|
if (c) ee->prop.clas = strdup(c);
|
|
|
|
}
|
2014-03-18 03:38:36 -07:00
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_size_min_set(Ecore_Evas *ee, int w, int h)
|
2014-03-18 03:42:19 -07:00
|
|
|
{
|
|
|
|
if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return;
|
|
|
|
ee->prop.min.w = w;
|
|
|
|
ee->prop.min.h = h;
|
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_size_max_set(Ecore_Evas *ee, int w, int h)
|
2014-03-18 03:42:19 -07:00
|
|
|
{
|
|
|
|
if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return;
|
|
|
|
ee->prop.max.w = w;
|
|
|
|
ee->prop.max.h = h;
|
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_size_base_set(Ecore_Evas *ee, int w, int h)
|
2014-03-18 03:42:19 -07:00
|
|
|
{
|
|
|
|
if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return;
|
|
|
|
ee->prop.base.w = w;
|
|
|
|
ee->prop.base.h = h;
|
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_size_step_set(Ecore_Evas *ee, int w, int h)
|
2014-03-18 03:42:19 -07:00
|
|
|
{
|
|
|
|
if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return;
|
|
|
|
ee->prop.step.w = w;
|
2016-05-03 09:03:00 -07:00
|
|
|
ee->prop.step.h = h;
|
2014-03-18 03:48:16 -07:00
|
|
|
}
|
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
static void
|
|
|
|
_drm_layer_set(Ecore_Evas *ee, int layer)
|
2014-03-18 03:50:26 -07:00
|
|
|
{
|
|
|
|
if (layer < 1) layer = 1;
|
|
|
|
else if (layer > 255) layer = 255;
|
|
|
|
if (ee->prop.layer == layer) return;
|
|
|
|
ee->prop.layer = layer;
|
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_iconified_set(Ecore_Evas *ee, Eina_Bool on)
|
2014-03-18 03:52:10 -07:00
|
|
|
{
|
|
|
|
if (ee->prop.iconified == on) return;
|
|
|
|
ee->prop.iconified = on;
|
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_borderless_set(Ecore_Evas *ee, Eina_Bool on)
|
2014-03-18 04:00:32 -07:00
|
|
|
{
|
|
|
|
if (ee->prop.borderless == on) return;
|
|
|
|
ee->prop.borderless = on;
|
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_maximized_set(Ecore_Evas *ee, Eina_Bool on)
|
2014-03-18 04:11:23 -07:00
|
|
|
{
|
|
|
|
if (ee->prop.maximized == on) return;
|
|
|
|
ee->prop.maximized = on;
|
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_fullscreen_set(Ecore_Evas *ee, Eina_Bool on)
|
2014-03-18 04:11:23 -07:00
|
|
|
{
|
2014-03-28 03:36:44 -07:00
|
|
|
Eina_Bool resized = EINA_FALSE;
|
|
|
|
Ecore_Evas_Engine_Drm_Data *edata;
|
|
|
|
|
|
|
|
edata = ee->engine.data;
|
2014-03-18 04:11:23 -07:00
|
|
|
if (ee->prop.fullscreen == on) return;
|
2016-05-03 09:03:00 -07:00
|
|
|
ee->prop.fullscreen = on;
|
|
|
|
|
2014-03-28 03:36:44 -07:00
|
|
|
if (on)
|
|
|
|
{
|
|
|
|
int ow = 0, oh = 0;
|
|
|
|
|
|
|
|
edata->w = ee->w;
|
|
|
|
edata->h = ee->h;
|
|
|
|
|
2017-08-08 10:02:15 -07:00
|
|
|
ecore_drm2_output_info_get(edata->output, NULL, NULL, &ow, &oh, NULL);
|
2014-03-28 03:36:44 -07:00
|
|
|
if ((ow == 0) || (oh == 0))
|
|
|
|
{
|
|
|
|
ow = ee->w;
|
|
|
|
oh = ee->h;
|
|
|
|
}
|
|
|
|
if ((ow != ee->w) || (oh != ee->h)) resized = EINA_TRUE;
|
|
|
|
ee->w = ow;
|
|
|
|
ee->h = oh;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((edata->w != ee->w) || (edata->h != ee->h)) resized = EINA_TRUE;
|
|
|
|
ee->w = edata->w;
|
|
|
|
ee->h = edata->h;
|
|
|
|
}
|
|
|
|
|
|
|
|
ee->req.w = ee->w;
|
|
|
|
ee->req.h = ee->h;
|
2014-03-18 04:11:23 -07:00
|
|
|
ee->prop.fullscreen = on;
|
2014-03-28 03:36:44 -07:00
|
|
|
evas_output_size_set(ee->evas, ee->w, ee->h);
|
|
|
|
evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
|
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
|
|
|
|
|
|
|
|
if (resized)
|
|
|
|
{
|
|
|
|
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
|
|
|
}
|
2014-03-18 04:11:23 -07:00
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_withdrawn_set(Ecore_Evas *ee, Eina_Bool on)
|
2014-03-18 04:11:23 -07:00
|
|
|
{
|
|
|
|
if (ee->prop.withdrawn == on) return;
|
|
|
|
ee->prop.withdrawn = on;
|
|
|
|
if (on) ecore_evas_hide(ee);
|
|
|
|
else ecore_evas_show(ee);
|
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_ignore_events_set(Ecore_Evas *ee, int on)
|
2014-03-18 04:11:23 -07:00
|
|
|
{
|
2016-05-03 09:03:00 -07:00
|
|
|
if (ee->ignore_events == on) return;
|
|
|
|
ee->ignore_events = on;
|
2014-03-18 04:11:23 -07:00
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_alpha_set(Ecore_Evas *ee, int alpha)
|
2014-03-18 04:21:02 -07:00
|
|
|
{
|
|
|
|
if (ee->in_async_render)
|
|
|
|
{
|
|
|
|
ee->delayed.alpha = alpha;
|
|
|
|
ee->delayed.alpha_changed = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_transparent_set(Ecore_Evas *ee, int transparent)
|
2014-03-18 04:21:02 -07:00
|
|
|
{
|
|
|
|
if (ee->in_async_render)
|
|
|
|
{
|
|
|
|
ee->delayed.transparent = transparent;
|
|
|
|
ee->delayed.transparent_changed = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-21 02:22:16 -07:00
|
|
|
static void
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_aspect_set(Ecore_Evas *ee, double aspect)
|
2014-03-18 04:23:49 -07:00
|
|
|
{
|
2017-01-06 09:57:46 -08:00
|
|
|
if (EINA_FLT_EQ(ee->prop.aspect, aspect)) return;
|
2014-03-18 04:23:49 -07:00
|
|
|
ee->prop.aspect = aspect;
|
|
|
|
}
|
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
static Ecore_Evas_Interface_Drm *
|
|
|
|
_ecore_evas_drm_interface_new(void)
|
2014-03-10 03:02:31 -07:00
|
|
|
{
|
2016-05-03 09:03:00 -07:00
|
|
|
Ecore_Evas_Interface_Drm *iface;
|
2014-03-10 03:02:31 -07:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
iface = calloc(1, sizeof(Ecore_Evas_Interface_Drm));
|
|
|
|
if (!iface) return NULL;
|
2014-03-10 03:02:31 -07:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
iface->base.name = "drm";
|
|
|
|
iface->base.version = 1;
|
|
|
|
|
|
|
|
return iface;
|
|
|
|
}
|
|
|
|
|
2016-09-02 12:47:49 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_cb_drm_event(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee;
|
|
|
|
Ecore_Evas_Engine_Drm_Data *edata;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ee = data;
|
|
|
|
edata = ee->engine.data;
|
2017-07-21 13:48:40 -07:00
|
|
|
ret = ecore_drm2_event_handle(edata->dev, &edata->ctx);
|
2016-09-02 12:47:49 -07:00
|
|
|
if (ret)
|
|
|
|
{
|
|
|
|
WRN("drmHandleEvent failed to read an event");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-11-14 12:12:58 -08:00
|
|
|
_cb_pageflip(int fd EINA_UNUSED, unsigned int frame EINA_UNUSED, unsigned int sec, unsigned int usec, void *data)
|
2016-09-02 12:47:49 -07:00
|
|
|
{
|
|
|
|
Ecore_Evas *ee;
|
2019-01-02 08:05:07 -08:00
|
|
|
Ecore_Drm2_Output *output;
|
2016-09-02 12:47:49 -07:00
|
|
|
Ecore_Evas_Engine_Drm_Data *edata;
|
2016-09-02 13:38:32 -07:00
|
|
|
int ret;
|
2016-09-02 12:47:49 -07:00
|
|
|
|
2019-01-02 08:05:07 -08:00
|
|
|
output = data;
|
|
|
|
|
|
|
|
ee = ecore_drm2_output_user_data_get(output);
|
|
|
|
if (!ee) return;
|
|
|
|
|
2016-09-02 12:47:49 -07:00
|
|
|
edata = ee->engine.data;
|
|
|
|
|
2019-01-02 08:05:07 -08:00
|
|
|
ret = ecore_drm2_fb_flip_complete(output);
|
2016-09-02 13:38:32 -07:00
|
|
|
|
|
|
|
if (edata->ticking)
|
2016-09-02 12:47:49 -07:00
|
|
|
{
|
2018-02-06 06:12:39 -08:00
|
|
|
int x, y, w, h;
|
2016-11-14 12:12:58 -08:00
|
|
|
double t = (double)sec + ((double)usec / 1000000);
|
|
|
|
|
2019-01-02 08:05:07 -08:00
|
|
|
ecore_drm2_output_info_get(output, &x, &y, &w, &h, NULL);
|
2018-02-06 06:12:39 -08:00
|
|
|
|
2017-07-28 13:24:30 -07:00
|
|
|
if (!edata->once) t = ecore_time_get();
|
2020-05-23 01:33:54 -07:00
|
|
|
// printf("ECORE_EVAS: drm tick %1.5f @ %1.5f\n", t, ecore_time_get());
|
2018-02-06 06:12:39 -08:00
|
|
|
ecore_evas_animator_tick(ee, &(Eina_Rectangle){x, y, w, h},
|
|
|
|
t - edata->offset);
|
2016-11-14 12:30:11 -08:00
|
|
|
}
|
|
|
|
else if (ret)
|
2019-01-02 08:05:07 -08:00
|
|
|
ecore_drm2_fb_flip(NULL, output);
|
2016-09-02 12:47:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-09-02 13:38:32 -07:00
|
|
|
_drm_evas_changed(Ecore_Evas *ee, Eina_Bool changed)
|
2016-09-02 12:47:49 -07:00
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Drm_Data *edata;
|
|
|
|
|
2016-09-02 13:38:32 -07:00
|
|
|
if (changed) return;
|
2016-09-02 12:47:49 -07:00
|
|
|
|
2016-09-02 13:38:32 -07:00
|
|
|
edata = ee->engine.data;
|
2017-08-11 12:51:30 -07:00
|
|
|
if (edata->ticking && !ecore_drm2_output_pending_get(edata->output))
|
|
|
|
ecore_drm2_fb_flip(NULL, edata->output);
|
2016-09-02 12:47:49 -07:00
|
|
|
}
|
|
|
|
|
2017-08-11 15:02:23 -07:00
|
|
|
static void
|
|
|
|
_tick_job(void *data)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Drm_Data *edata;
|
|
|
|
Ecore_Evas *ee;
|
2018-02-06 06:12:39 -08:00
|
|
|
int x, y, w, h;
|
2017-08-11 15:02:23 -07:00
|
|
|
|
|
|
|
ee = data;
|
|
|
|
edata = ee->engine.data;
|
|
|
|
edata->tick_job = NULL;
|
2018-02-06 06:12:39 -08:00
|
|
|
|
|
|
|
ecore_drm2_output_info_get(edata->output, &x, &y, &w, &h, NULL);
|
|
|
|
|
|
|
|
ecore_evas_animator_tick(ee, &(Eina_Rectangle){x, y, w, h},
|
2018-08-08 13:58:33 -07:00
|
|
|
edata->tick_job_timestamp - edata->offset);
|
2017-08-11 15:02:23 -07:00
|
|
|
}
|
|
|
|
|
2016-09-02 12:47:49 -07:00
|
|
|
static void
|
|
|
|
_drm_animator_register(Ecore_Evas *ee)
|
|
|
|
{
|
2017-07-28 13:24:30 -07:00
|
|
|
double t;
|
|
|
|
long sec, usec;
|
2016-09-02 12:47:49 -07:00
|
|
|
Ecore_Evas_Engine_Drm_Data *edata;
|
2017-07-28 13:24:30 -07:00
|
|
|
Eina_Bool r;
|
2016-09-02 12:47:49 -07:00
|
|
|
|
2017-07-10 14:07:15 -07:00
|
|
|
if (ee->manual_render)
|
2017-07-11 14:08:55 -07:00
|
|
|
ERR("Attempt to schedule tick for manually rendered canvas");
|
2017-07-10 14:07:15 -07:00
|
|
|
|
2016-09-02 12:47:49 -07:00
|
|
|
edata = ee->engine.data;
|
2017-07-28 13:24:30 -07:00
|
|
|
|
|
|
|
/* Some graphics stacks appear to lie about their clock sources
|
|
|
|
* so attempt to measure the difference between our clock and the
|
|
|
|
* GPU's source of timestamps once at startup and apply that.
|
|
|
|
* If it's tiny, just assume they're the same clock and it's
|
|
|
|
* measurement error.
|
|
|
|
*
|
|
|
|
* <cedric> what happen when you suspend ?
|
|
|
|
* <cedric> what about drift ?
|
|
|
|
*
|
|
|
|
* If someone could relay the message to cedric that I'm not
|
|
|
|
* talking to him anymore, that would be helpful.
|
|
|
|
*/
|
|
|
|
if (!edata->once)
|
|
|
|
{
|
|
|
|
r = ecore_drm2_output_blanktime_get(edata->output, 1, &sec, &usec);
|
|
|
|
if (r)
|
|
|
|
{
|
|
|
|
t = (double)sec + ((double)usec / 1000000.0);
|
|
|
|
edata->offset = t - ecore_time_get();
|
|
|
|
if (fabs(edata->offset) < 0.010)
|
|
|
|
edata->offset = 0.0;
|
|
|
|
|
|
|
|
edata->once = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-15 12:49:56 -07:00
|
|
|
if (ee->animator_ticked || ee->animator_ran)
|
|
|
|
{
|
|
|
|
edata->ticking = EINA_TRUE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-08-11 15:02:23 -07:00
|
|
|
if (edata->tick_job) ERR("Double animator register");
|
|
|
|
else
|
|
|
|
if (!edata->ticking &&
|
|
|
|
!(ecore_drm2_output_pending_get(edata->output) || ee->in_async_render))
|
|
|
|
{
|
|
|
|
r = ecore_drm2_output_blanktime_get(edata->output, 0, &sec, &usec);
|
|
|
|
if (r)
|
|
|
|
{
|
|
|
|
edata->tick_job_timestamp = (double)sec
|
|
|
|
+ ((double)usec / 1000000);
|
|
|
|
edata->tick_job = ecore_job_add(_tick_job, ee);
|
|
|
|
}
|
2018-03-21 13:03:55 -07:00
|
|
|
else
|
|
|
|
ecore_drm2_fb_flip(NULL, edata->output);
|
2017-08-11 15:02:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
edata->ticking = EINA_TRUE;
|
2016-09-02 12:47:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_drm_animator_unregister(Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Drm_Data *edata;
|
|
|
|
|
|
|
|
edata = ee->engine.data;
|
|
|
|
edata->ticking = EINA_FALSE;
|
2017-08-11 15:02:23 -07:00
|
|
|
if (edata->tick_job)
|
|
|
|
{
|
|
|
|
ERR("Animator unregister before first tick");
|
|
|
|
ecore_job_del(edata->tick_job);
|
|
|
|
edata->tick_job = NULL;
|
|
|
|
}
|
2016-09-02 12:47:49 -07:00
|
|
|
}
|
|
|
|
|
2017-07-12 14:30:07 -07:00
|
|
|
static double
|
|
|
|
_drm_last_tick_get(Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Drm_Data *edata;
|
|
|
|
long sec, usec;
|
|
|
|
|
|
|
|
edata = ee->engine.data;
|
2017-07-28 07:40:40 -07:00
|
|
|
if (!ecore_drm2_output_blanktime_get(edata->output, 0, &sec, &usec))
|
2017-07-12 14:30:07 -07:00
|
|
|
return -1.0;
|
|
|
|
|
|
|
|
return sec + usec / 1000000.0;
|
|
|
|
}
|
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
static Ecore_Evas_Engine_Func _ecore_evas_drm_engine_func =
|
|
|
|
{
|
|
|
|
_drm_free,
|
|
|
|
NULL, //void (*fn_callback_resize_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
|
|
|
|
NULL, //void (*fn_callback_move_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
|
|
|
|
NULL, //void (*fn_callback_show_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
|
|
|
|
NULL, //void (*fn_callback_hide_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
|
|
|
|
NULL, //_ecore_evas_drm_delete_request_set,
|
|
|
|
NULL, //void (*fn_callback_destroy_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
|
|
|
|
NULL, //_ecore_evas_drm_callback_focus_in_set,
|
|
|
|
NULL, //_ecore_evas_drm_callback_focus_out_set,
|
|
|
|
NULL, //_ecore_evas_drm_callback_mouse_in_set,
|
|
|
|
NULL, //_ecore_evas_drm_callback_mouse_out_set,
|
|
|
|
NULL, //void (*fn_callback_sticky_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
|
|
|
|
NULL, //void (*fn_callback_unsticky_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
|
|
|
|
NULL, //void (*fn_callback_pre_render_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
|
|
|
|
NULL, //void (*fn_callback_post_render_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
|
|
|
|
_drm_move,
|
|
|
|
NULL, //void (*fn_managed_move) (Ecore_Evas *ee, int x, int y);
|
|
|
|
_drm_resize,
|
|
|
|
_drm_move_resize,
|
|
|
|
_drm_rotation_set,
|
|
|
|
NULL, //void (*fn_shaped_set) (Ecore_Evas *ee, int shaped);
|
|
|
|
_drm_show,
|
|
|
|
_drm_hide,
|
|
|
|
NULL, //void (*fn_raise) (Ecore_Evas *ee);
|
|
|
|
NULL, //void (*fn_lower) (Ecore_Evas *ee);
|
|
|
|
NULL, //void (*fn_activate) (Ecore_Evas *ee);
|
|
|
|
_drm_title_set,
|
|
|
|
_drm_name_class_set,
|
|
|
|
_drm_size_min_set,
|
|
|
|
_drm_size_max_set,
|
|
|
|
_drm_size_base_set,
|
|
|
|
_drm_size_step_set,
|
2016-11-22 10:14:03 -08:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2016-05-03 09:03:00 -07:00
|
|
|
_drm_layer_set,
|
|
|
|
NULL, //void (*fn_focus_set) (Ecore_Evas *ee, Eina_Bool on);
|
|
|
|
_drm_iconified_set,
|
|
|
|
_drm_borderless_set,
|
|
|
|
NULL, //void (*fn_override_set) (Ecore_Evas *ee, Eina_Bool on);
|
|
|
|
_drm_maximized_set,
|
|
|
|
_drm_fullscreen_set,
|
|
|
|
NULL, //void (*fn_avoid_damage_set) (Ecore_Evas *ee, int on);
|
|
|
|
_drm_withdrawn_set,
|
|
|
|
NULL, //void (*fn_sticky_set) (Ecore_Evas *ee, Eina_Bool on);
|
|
|
|
_drm_ignore_events_set,
|
|
|
|
_drm_alpha_set,
|
|
|
|
_drm_transparent_set,
|
|
|
|
NULL, //void (*fn_profiles_set) (Ecore_Evas *ee, const char **profiles, int count);
|
|
|
|
NULL, //void (*fn_profile_set) (Ecore_Evas *ee, const char *profile);
|
|
|
|
|
|
|
|
NULL, //void (*fn_window_group_set) (Ecore_Evas *ee, const Ecore_Evas *ee_group);
|
|
|
|
_drm_aspect_set,
|
|
|
|
NULL, //void (*fn_urgent_set) (Ecore_Evas *ee, Eina_Bool on);
|
|
|
|
NULL, //void (*fn_modal_set) (Ecore_Evas *ee, Eina_Bool on);
|
|
|
|
NULL, //void (*fn_demands_attention_set) (Ecore_Evas *ee, Eina_Bool on);
|
|
|
|
NULL, //void (*fn_focus_skip_set) (Ecore_Evas *ee, Eina_Bool on);
|
|
|
|
|
2017-05-08 15:01:49 -07:00
|
|
|
NULL,
|
2016-05-03 09:03:00 -07:00
|
|
|
|
|
|
|
_drm_screen_geometry_get,
|
2016-11-28 07:01:39 -08:00
|
|
|
_drm_screen_dpi_get,
|
2016-05-03 09:03:00 -07:00
|
|
|
NULL, //void (*fn_msg_parent_send) (Ecore_Evas *ee, int maj, int min, void *data, int size);
|
|
|
|
NULL, //void (*fn_msg_send) (Ecore_Evas *ee, int maj, int min, void *data, int size);
|
|
|
|
|
|
|
|
_drm_pointer_xy_get,
|
|
|
|
_drm_pointer_warp,
|
|
|
|
|
|
|
|
NULL, // wm_rot_preferred_rotation_set
|
|
|
|
NULL, // wm_rot_available_rotations_set
|
|
|
|
NULL, // wm_rot_manual_rotation_done_set
|
|
|
|
NULL, // wm_rot_manual_rotation_done
|
|
|
|
|
|
|
|
NULL, // aux_hints_set
|
|
|
|
|
2019-04-30 03:48:15 -07:00
|
|
|
#ifndef VSYNC_ANIMATOR
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
#else
|
2016-09-02 12:47:49 -07:00
|
|
|
_drm_animator_register, // animator_register
|
|
|
|
_drm_animator_unregister, // animator_unregister
|
2019-04-30 03:48:15 -07:00
|
|
|
#endif
|
2016-08-30 13:47:17 -07:00
|
|
|
|
2016-09-02 13:38:32 -07:00
|
|
|
_drm_evas_changed, // evas_changed
|
2016-11-03 07:07:40 -07:00
|
|
|
NULL, //fn_focus_device_set
|
|
|
|
NULL, //fn_callback_focus_device_in_set
|
|
|
|
NULL, //fn_callback_focus_device_out_set
|
2017-07-12 14:24:09 -07:00
|
|
|
NULL, //fn_callback_device_mouse_in_set
|
|
|
|
NULL, //fn_callback_device_mouse_out_set
|
2016-11-21 09:11:08 -08:00
|
|
|
NULL, //fn_pointer_device_xy_get
|
2017-05-08 15:01:49 -07:00
|
|
|
NULL, //fn_prepare
|
2017-07-12 14:30:07 -07:00
|
|
|
_drm_last_tick_get,
|
2016-05-03 09:03:00 -07:00
|
|
|
};
|
|
|
|
|
2019-01-17 06:26:17 -08:00
|
|
|
#ifdef BUILD_ECORE_EVAS_GL_DRM
|
|
|
|
static void *
|
|
|
|
_drm_gl_canvas_setup(Ecore_Evas *ee, Ecore_Evas_Engine_Drm_Data *edata)
|
|
|
|
{
|
|
|
|
Evas_Engine_Info_GL_Drm *einfo;
|
|
|
|
char *num;
|
|
|
|
|
|
|
|
einfo = (Evas_Engine_Info_GL_Drm *)evas_engine_info_get(ee->evas);
|
|
|
|
if (!einfo) return NULL;
|
|
|
|
|
|
|
|
einfo->info.vsync = EINA_TRUE;
|
|
|
|
|
|
|
|
num = getenv("EVAS_DRM_VSYNC");
|
|
|
|
if ((num) && (!atoi(num)))
|
|
|
|
einfo->info.vsync = EINA_FALSE;
|
|
|
|
|
|
|
|
einfo->info.dev = edata->dev;
|
|
|
|
einfo->info.bpp = edata->bpp;
|
|
|
|
einfo->info.depth = edata->depth;
|
|
|
|
einfo->info.format = edata->format;
|
|
|
|
einfo->info.rotation = ee->rotation;
|
|
|
|
einfo->info.output = edata->output;
|
|
|
|
|
|
|
|
return einfo;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void *
|
|
|
|
_drm_canvas_setup(Ecore_Evas *ee, Ecore_Evas_Engine_Drm_Data *edata)
|
|
|
|
{
|
|
|
|
Evas_Engine_Info_Drm *einfo;
|
|
|
|
|
|
|
|
einfo = (Evas_Engine_Info_Drm *)evas_engine_info_get(ee->evas);
|
|
|
|
if (!einfo) return NULL;
|
|
|
|
|
|
|
|
einfo->info.dev = edata->dev;
|
|
|
|
einfo->info.bpp = edata->bpp;
|
|
|
|
einfo->info.depth = edata->depth;
|
|
|
|
einfo->info.format = edata->format;
|
|
|
|
einfo->info.rotation = ee->rotation;
|
|
|
|
einfo->info.output = edata->output;
|
|
|
|
|
|
|
|
return einfo;
|
|
|
|
}
|
|
|
|
|
2016-09-02 09:07:17 -07:00
|
|
|
static Ecore_Evas *
|
|
|
|
_ecore_evas_new_internal(const char *device, int x, int y, int w, int h, Eina_Bool gl)
|
2016-05-03 09:03:00 -07:00
|
|
|
{
|
|
|
|
Ecore_Evas *ee;
|
|
|
|
Ecore_Evas_Interface_Drm *iface;
|
|
|
|
Ecore_Evas_Engine_Drm_Data *edata;
|
2016-05-26 07:46:40 -07:00
|
|
|
int method, mw, mh;
|
2016-09-02 09:07:17 -07:00
|
|
|
void *tinfo;
|
|
|
|
|
2019-01-17 05:51:23 -08:00
|
|
|
if (gl)
|
|
|
|
method = evas_render_method_lookup("gl_drm");
|
|
|
|
else
|
|
|
|
method = evas_render_method_lookup("drm");
|
2016-05-03 09:03:00 -07:00
|
|
|
|
|
|
|
if (!method) return NULL;
|
|
|
|
|
|
|
|
ee = calloc(1, sizeof(Ecore_Evas));
|
|
|
|
if (!ee) return NULL;
|
|
|
|
|
|
|
|
edata = calloc(1, sizeof(Ecore_Evas_Engine_Drm_Data));
|
|
|
|
if (!edata)
|
2013-05-14 02:45:47 -07:00
|
|
|
{
|
2016-05-03 09:03:00 -07:00
|
|
|
free(ee);
|
|
|
|
return NULL;
|
2013-05-14 02:45:47 -07:00
|
|
|
}
|
|
|
|
|
2017-07-29 06:52:16 -07:00
|
|
|
if (!getenv("ECORE_EVAS_DRM_GPU_CLOCK_WRONG"))
|
|
|
|
{
|
|
|
|
edata->once = EINA_TRUE;
|
|
|
|
edata->offset = 0.0;
|
|
|
|
}
|
2016-05-03 09:03:00 -07:00
|
|
|
edata->x = x;
|
|
|
|
edata->y = y;
|
|
|
|
edata->w = w;
|
|
|
|
edata->h = h;
|
|
|
|
edata->depth = 24; // FIXME: Remove hardcode
|
|
|
|
edata->bpp = 32; // FIXME: Remove hardcode
|
|
|
|
edata->format = DRM_FORMAT_XRGB8888;
|
|
|
|
|
2016-09-02 12:47:49 -07:00
|
|
|
if (_ecore_evas_drm_init(ee, edata, device) < 1)
|
2014-03-10 03:02:31 -07:00
|
|
|
{
|
2016-05-03 09:03:00 -07:00
|
|
|
free(edata);
|
|
|
|
free(ee);
|
|
|
|
return NULL;
|
2014-03-10 03:02:31 -07:00
|
|
|
}
|
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
|
2014-03-10 03:02:31 -07:00
|
|
|
|
2016-09-02 09:07:17 -07:00
|
|
|
if (gl) ee->driver = "gl_drm";
|
|
|
|
else ee->driver = "drm";
|
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_evas_drm_engine_func;
|
|
|
|
ee->engine.data = edata;
|
2014-03-10 03:02:31 -07:00
|
|
|
|
2019-05-22 04:37:36 -07:00
|
|
|
if (!ecore_drm2_vblank_supported(edata->dev))
|
|
|
|
{
|
|
|
|
ee->engine.func->fn_animator_register = NULL;
|
|
|
|
ee->engine.func->fn_animator_unregister = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ee->engine.func->fn_animator_register = _drm_animator_register;
|
|
|
|
ee->engine.func->fn_animator_unregister = _drm_animator_unregister;
|
|
|
|
}
|
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
/* FIXME */
|
|
|
|
/* if (edata->device) ee->name = strdup(edata->device); */
|
|
|
|
|
|
|
|
iface = _ecore_evas_drm_interface_new();
|
|
|
|
ee->engine.ifaces = eina_list_append(ee->engine.ifaces, iface);
|
|
|
|
|
|
|
|
ee->x = ee->req.x = x;
|
|
|
|
ee->y = ee->req.y = y;
|
|
|
|
ee->w = ee->req.w = w;
|
|
|
|
ee->h = ee->req.h = h;
|
|
|
|
|
|
|
|
ee->prop.max.w = 32767;
|
|
|
|
ee->prop.max.h = 32767;
|
|
|
|
ee->prop.layer = 4;
|
|
|
|
ee->prop.request_pos = 0;
|
|
|
|
ee->prop.sticky = 0;
|
|
|
|
ee->prop.withdrawn = EINA_TRUE;
|
|
|
|
ee->alpha = EINA_FALSE;
|
|
|
|
|
2016-09-02 09:07:17 -07:00
|
|
|
ee->can_async_render = !gl;
|
2016-05-03 09:03:00 -07:00
|
|
|
if (getenv("ECORE_EVAS_FORCE_SYNC_RENDER"))
|
|
|
|
ee->can_async_render = 0;
|
|
|
|
|
2018-04-02 14:55:57 -07:00
|
|
|
if (!ecore_evas_evas_new(ee, w, h))
|
|
|
|
{
|
|
|
|
ERR("Can not create a Canvas.");
|
|
|
|
goto eng_err;
|
|
|
|
}
|
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
evas_output_method_set(ee->evas, method);
|
|
|
|
|
|
|
|
if (ee->can_async_render)
|
|
|
|
evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST,
|
|
|
|
_drm_render_updates, ee);
|
|
|
|
|
2016-09-09 03:11:06 -07:00
|
|
|
#ifdef BUILD_ECORE_EVAS_GL_DRM
|
2019-01-17 06:26:17 -08:00
|
|
|
if (gl)
|
|
|
|
tinfo = _drm_gl_canvas_setup(ee, edata);
|
2016-09-09 03:11:06 -07:00
|
|
|
else
|
|
|
|
#endif
|
2019-01-17 06:26:17 -08:00
|
|
|
tinfo = _drm_canvas_setup(ee, edata);
|
|
|
|
|
|
|
|
if (!tinfo)
|
2016-05-03 09:03:00 -07:00
|
|
|
{
|
2019-01-17 06:26:17 -08:00
|
|
|
ERR("evas_engine_info_get() for engine '%s' failed", ee->driver);
|
|
|
|
goto eng_err;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)tinfo))
|
|
|
|
{
|
|
|
|
ERR("evas_engine_info_set() for engine '%s' failed", ee->driver);
|
|
|
|
goto eng_err;
|
2014-03-10 03:02:31 -07:00
|
|
|
}
|
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
ee->prop.window = ecore_drm2_output_crtc_get(edata->output);
|
|
|
|
ecore_drm2_device_window_set(edata->dev, ee->prop.window);
|
2014-03-10 03:02:31 -07:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
ecore_evas_data_set(ee, "device", edata->dev);
|
2014-09-04 07:03:28 -07:00
|
|
|
|
2018-04-02 14:55:57 -07:00
|
|
|
ecore_evas_done(ee, EINA_FALSE);
|
2014-09-15 08:44:10 -07:00
|
|
|
|
2017-08-08 10:03:12 -07:00
|
|
|
ecore_drm2_output_info_get(edata->output, NULL, NULL, &mw, &mh, NULL);
|
2016-05-26 07:46:40 -07:00
|
|
|
|
|
|
|
ecore_drm2_device_calibrate(edata->dev, mw, mh);
|
|
|
|
ecore_drm2_device_pointer_max_set(edata->dev, mw, mh);
|
|
|
|
ecore_drm2_device_pointer_warp(edata->dev, mw / 2, mh / 2);
|
|
|
|
|
2016-09-02 12:47:49 -07:00
|
|
|
/* setup vblank handler */
|
|
|
|
memset(&edata->ctx, 0, sizeof(edata->ctx));
|
|
|
|
edata->ctx.page_flip_handler = _cb_pageflip;
|
|
|
|
|
|
|
|
edata->hdlr =
|
2017-07-21 13:48:40 -07:00
|
|
|
ecore_main_fd_handler_add(ecore_drm2_device_fd_get(edata->dev),
|
|
|
|
ECORE_FD_READ, _cb_drm_event, ee,
|
2016-09-02 12:47:49 -07:00
|
|
|
NULL, NULL);
|
2017-05-26 13:34:10 -07:00
|
|
|
|
|
|
|
canvases = eina_list_append(canvases, ee);
|
2016-05-03 09:03:00 -07:00
|
|
|
return ee;
|
2016-01-25 14:20:27 -08:00
|
|
|
|
2016-05-03 09:03:00 -07:00
|
|
|
eng_err:
|
|
|
|
ecore_evas_free(ee);
|
|
|
|
return NULL;
|
2016-01-25 14:20:27 -08:00
|
|
|
}
|
2016-09-02 09:07:17 -07:00
|
|
|
|
modules: Rename EAPI macro to MODAPI for modules
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, jptiz, woohyun, lucas, SPAM-smith78899
Reviewed By: vtorri, SPAM-smith78899
Subscribers: SPAM-smith78899, raster, SPAM-cabanacatalogs, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12228
2021-04-17 12:07:55 -07:00
|
|
|
EMODAPI Ecore_Evas *
|
2016-09-02 09:07:17 -07:00
|
|
|
ecore_evas_drm_new_internal(const char *device, unsigned int parent EINA_UNUSED, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
return _ecore_evas_new_internal(device, x, y, w, h, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef BUILD_ECORE_EVAS_GL_DRM
|
modules: Rename EAPI macro to MODAPI for modules
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, jptiz, woohyun, lucas, SPAM-smith78899
Reviewed By: vtorri, SPAM-smith78899
Subscribers: SPAM-smith78899, raster, SPAM-cabanacatalogs, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12228
2021-04-17 12:07:55 -07:00
|
|
|
EMODAPI Ecore_Evas *
|
2016-09-02 09:07:17 -07:00
|
|
|
ecore_evas_gl_drm_new_internal(const char *device, unsigned int parent EINA_UNUSED, int x, int y, int w, int h)
|
|
|
|
{
|
2019-08-05 05:48:14 -07:00
|
|
|
static void *libglapi = NULL;
|
|
|
|
|
|
|
|
if (!libglapi) libglapi = dlopen("libglapi.so.0", RTLD_LAZY | RTLD_GLOBAL);
|
2016-09-02 09:07:17 -07:00
|
|
|
if (dlerror()) return NULL;
|
|
|
|
|
|
|
|
return _ecore_evas_new_internal(device, x, y, w, h, EINA_TRUE);
|
|
|
|
}
|
2016-05-03 09:03:00 -07:00
|
|
|
#endif
|