Start on basic ecore_evas_drm code.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-05-14 10:45:47 +01:00
parent 817284fb96
commit dd364de99d
3 changed files with 175 additions and 1 deletions

View File

@ -102,6 +102,7 @@ extern "C" {
#define HAVE_ECORE_EVAS_PSL1GHT 1
#define HAVE_ECORE_EVAS_WAYLAND_SHM 1
#define HAVE_ECORE_EVAS_WAYLAND_EGL 1
#define HAVE_ECORE_EVAS_DRM 1
typedef enum _Ecore_Evas_Engine_Type
{
@ -127,7 +128,8 @@ typedef enum _Ecore_Evas_Engine_Type
ECORE_EVAS_ENGINE_EWS,
ECORE_EVAS_ENGINE_PSL1GHT,
ECORE_EVAS_ENGINE_WAYLAND_SHM,
ECORE_EVAS_ENGINE_WAYLAND_EGL
ECORE_EVAS_ENGINE_WAYLAND_EGL,
ECORE_EVAS_ENGINE_DRM
} Ecore_Evas_Engine_Type;
typedef enum _Ecore_Evas_Avoid_Damage_Type
@ -982,6 +984,8 @@ EAPI void ecore_evas_wayland_pointer_set(Ecore_Evas *ee, int hot_x, i
EAPI void ecore_evas_wayland_type_set(Ecore_Evas *ee, int type);
EAPI Ecore_Wl_Window *ecore_evas_wayland_window_get(const Ecore_Evas *ee);
EAPI Ecore_Evas *ecore_evas_drm_new(const char *device, unsigned int parent, int x, int y, int w, int h);
/**
* @brief Create a new @c Ecore_Evas canvas bound to the Evas
* @b buffer engine

View File

@ -253,6 +253,13 @@ ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine)
#else
return EINA_FALSE;
#endif
case ECORE_EVAS_ENGINE_DRM:
#ifdef BUILD_ECORE_EVAS_DRM
return EINA_TRUE;
#else
return EINA_FALSE;
#endif
default:
return EINA_FALSE;
};
@ -595,6 +602,21 @@ _ecore_evas_constructor_wayland_egl(int x, int y, int w, int h, const char *extr
return ee;
}
static Ecore_Evas *
_ecore_evas_constructor_drm(int x, int y, int w, int h, const char *extra_options)
{
char *device = NULL;
unsigned int parent = 0;
Ecore_Evas *ee;
_ecore_evas_parse_extra_options_str(extra_options, "device=", &device);
_ecore_evas_parse_extra_options_uint(extra_options, "parent=", &parent);
ee = ecore_evas_drm_new(device, parent, x, y, w, h);
free(device);
return ee;
}
static Ecore_Evas *
_ecore_evas_constructor_software_gdi(int x, int y, int w, int h,
const char *extra_options EINA_UNUSED)
@ -651,6 +673,7 @@ static const struct ecore_evas_engine _engines[] = {
{"psl1ght", _ecore_evas_constructor_psl1ght},
{"wayland_shm", _ecore_evas_constructor_wayland_shm},
{"wayland_egl", _ecore_evas_constructor_wayland_egl},
{"drm", _ecore_evas_constructor_drm},
{"opengl_sdl", _ecore_evas_constructor_opengl_sdl},
{"sdl", _ecore_evas_constructor_sdl},
{"buffer", _ecore_evas_constructor_buffer},
@ -3335,6 +3358,20 @@ ecore_evas_wayland_window_get(const Ecore_Evas *ee)
return iface->window_get(ee);
}
EAPI Ecore_Evas *
ecore_evas_drm_new(const char *disp_name, unsigned int parent,
int x, int y, int w, int h)
{
Ecore_Evas *(*new)(const char *, unsigned int, int, int, int, int);
Eina_Module *m = _ecore_evas_engine_load("drm");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_drm_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(disp_name, parent, x, y, w, h);
}
EAPI Ecore_Evas *
ecore_evas_software_gdi_new(Ecore_Win32_Window *parent,
int x,

View File

@ -12,3 +12,136 @@
#include <Ecore_Input_Evas.h>
#include <Ecore_Evas.h>
#include "ecore_evas_private.h"
#include "ecore_evas_drm.h"
#ifdef BUILD_ECORE_EVAS_DRM
# include <Evas_Engine_Drm.h>
#endif
/* local structures */
typedef struct _Ecore_Evas_Engine_Data_Drm Ecore_Evas_Engine_Data_Drm;
struct _Ecore_Evas_Engine_Data_Drm
{
int fd;
};
/* local function prototypes */
static int _ecore_evas_drm_init(void);
static int _ecore_evas_drm_shutdown(void);
static Ecore_Evas_Interface_Drm *_ecore_evas_drm_interface_new(void);
/* local variables */
static int _ecore_evas_init_count = 0;
static Ecore_Evas_Engine_Func _ecore_evas_drm_engine_func =
{
NULL, //void (*fn_free) (Ecore_Evas *ee);
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, //void (*fn_callback_delete_request_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
NULL, //void (*fn_callback_destroy_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
NULL, //void (*fn_callback_focus_in_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
NULL, //void (*fn_callback_focus_out_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
NULL, //void (*fn_callback_mouse_in_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
NULL, //void (*fn_callback_mouse_out_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
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);
NULL, //void (*fn_move) (Ecore_Evas *ee, int x, int y);
NULL, //void (*fn_managed_move) (Ecore_Evas *ee, int x, int y);
NULL, //void (*fn_resize) (Ecore_Evas *ee, int w, int h);
NULL, //void (*fn_move_resize) (Ecore_Evas *ee, int x, int y, int w, int h);
NULL, //void (*fn_rotation_set) (Ecore_Evas *ee, int rot, int resize);
NULL, //void (*fn_shaped_set) (Ecore_Evas *ee, int shaped);
NULL, //void (*fn_show) (Ecore_Evas *ee);
NULL, //void (*fn_hide) (Ecore_Evas *ee);
NULL, //void (*fn_raise) (Ecore_Evas *ee);
NULL, //void (*fn_lower) (Ecore_Evas *ee);
NULL, //void (*fn_activate) (Ecore_Evas *ee);
NULL, //void (*fn_title_set) (Ecore_Evas *ee, const char *t);
NULL, //void (*fn_name_class_set) (Ecore_Evas *ee, const char *n, const char *c);
NULL, //void (*fn_size_min_set) (Ecore_Evas *ee, int w, int h);
NULL, //void (*fn_size_max_set) (Ecore_Evas *ee, int w, int h);
NULL, //void (*fn_size_base_set) (Ecore_Evas *ee, int w, int h);
NULL, //void (*fn_size_step_set) (Ecore_Evas *ee, int w, int h);
NULL, //void (*fn_object_cursor_set) (Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y);
NULL, //void (*fn_layer_set) (Ecore_Evas *ee, int layer);
NULL, //void (*fn_focus_set) (Ecore_Evas *ee, int on);
NULL, //void (*fn_iconified_set) (Ecore_Evas *ee, int on);
NULL, //void (*fn_borderless_set) (Ecore_Evas *ee, int on);
NULL, //void (*fn_override_set) (Ecore_Evas *ee, int on);
NULL, //void (*fn_maximized_set) (Ecore_Evas *ee, int on);
NULL, //void (*fn_fullscreen_set) (Ecore_Evas *ee, int on);
NULL, //void (*fn_avoid_damage_set) (Ecore_Evas *ee, int on);
NULL, //void (*fn_withdrawn_set) (Ecore_Evas *ee, int withdrawn);
NULL, //void (*fn_sticky_set) (Ecore_Evas *ee, int sticky);
NULL, //void (*fn_ignore_events_set) (Ecore_Evas *ee, int ignore);
NULL, //void (*fn_alpha_set) (Ecore_Evas *ee, int alpha);
NULL, //void (*fn_transparent_set) (Ecore_Evas *ee, int transparent);
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);
NULL, //void (*fn_aspect_set) (Ecore_Evas *ee, double aspect);
NULL, //void (*fn_urgent_set) (Ecore_Evas *ee, int urgent);
NULL, //void (*fn_modal_set) (Ecore_Evas *ee, int modal);
NULL, //void (*fn_demands_attention_set) (Ecore_Evas *ee, int demand);
NULL, //void (*fn_focus_skip_set) (Ecore_Evas *ee, int skip);
NULL, //int (*fn_render) (Ecore_Evas *ee);
NULL, //void (*fn_screen_geometry_get) (const Ecore_Evas *ee, int *x, int *y, int *w, int *h);
NULL, //void (*fn_screen_dpi_get) (const Ecore_Evas *ee, int *xdpi, int *ydpi);
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);
};
EAPI Ecore_Evas *
ecore_evas_drm_new_internal(const char *device, unsigned int parent, int x, int y, int w, int h)
{
Ecore_Evas *ee;
int method;
/* try to find the evas drm engine */
if (!(method = evas_render_method_lookup("drm")))
{
ERR("Render method lookup failed for Drm");
return NULL;
}
if (!(ee = calloc(1, sizeof(Ecore_Evas))))
{
ERR("Failed to allocate space for new Ecore_Evas");
return NULL;
}
return NULL;
}
/* local functions */
static int
_ecore_evas_drm_init(void)
{
_ecore_evas_init_count++;
if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
ecore_event_evas_init();
return _ecore_evas_init_count;
}
static int
_ecore_evas_drm_shutdown(void)
{
_ecore_evas_init_count--;
if (_ecore_evas_init_count == 0)
{
ecore_event_evas_shutdown();
}
if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
return _ecore_evas_init_count;
}