remove old ecore_drm1 code from wl_drm module
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
3f2ea65112
commit
307072fc43
|
@ -794,7 +794,7 @@ define([CHECK_MODULE_WL_DRM],
|
|||
AC_DEFINE_UNQUOTED([HAVE_DRM2],[1],[enable ecore-drm2 support])
|
||||
], [WL_DRM=false])
|
||||
else
|
||||
AC_E_CHECK_PKG(WL_DRM, [ ecore-drm >= $efl_version ], [WL_DRM=true], [WL_DRM=false])
|
||||
WL_DRM=false
|
||||
fi
|
||||
else
|
||||
WL_DRM=false
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
#include "e.h"
|
||||
#include <drm_mode.h>
|
||||
|
||||
#ifdef HAVE_DRM2
|
||||
# include <Ecore_Drm2.h>
|
||||
# include <Elput.h>
|
||||
#include <Ecore_Drm2.h>
|
||||
#include <Elput.h>
|
||||
static Ecore_Event_Handler *seat_handler;
|
||||
#else
|
||||
# include <Ecore_Drm.h>
|
||||
#endif
|
||||
|
||||
E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Drm" };
|
||||
|
||||
|
@ -48,11 +44,7 @@ static E_Randr2_Connector rtype[] =
|
|||
static Eina_Bool
|
||||
_e_mod_drm_cb_activate(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
||||
{
|
||||
# ifdef HAVE_DRM2
|
||||
Ecore_Drm2_Event_Activate *ev;
|
||||
# else
|
||||
Ecore_Drm_Event_Activate *ev;
|
||||
# endif
|
||||
|
||||
if (!(ev = event)) goto end;
|
||||
|
||||
|
@ -99,11 +91,7 @@ _e_mod_drm_cb_output(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
|||
E_Randr2_Screen *screen;
|
||||
Eina_Bool connected = EINA_FALSE;
|
||||
int subpixel = 0;
|
||||
#ifdef HAVE_DRM2
|
||||
Ecore_Drm2_Event_Output_Changed *e;
|
||||
#else
|
||||
Ecore_Drm_Event_Output *e;
|
||||
#endif
|
||||
|
||||
if (!(e = event)) goto end;
|
||||
|
||||
|
@ -114,13 +102,8 @@ _e_mod_drm_cb_output(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
|||
if ((!strcmp(screen->info.name, e->name)) &&
|
||||
(!strcmp(screen->info.screen, e->model)))
|
||||
{
|
||||
#ifdef HAVE_DRM2
|
||||
connected = e->enabled;
|
||||
subpixel = e->subpixel;
|
||||
#else
|
||||
connected = e->plug;
|
||||
subpixel = e->subpixel_order;
|
||||
#endif
|
||||
|
||||
if (connected)
|
||||
{
|
||||
|
@ -147,48 +130,6 @@ end:
|
|||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
#ifndef HAVE_DRM2
|
||||
static Ecore_Drm_Output_Mode *
|
||||
_e_mod_drm_mode_screen_find(E_Randr2_Screen *s, Ecore_Drm_Output *output)
|
||||
{
|
||||
Ecore_Drm_Output_Mode *mode, *m = NULL;
|
||||
const Eina_List *l;
|
||||
int diff, distance = 0x7fffffff;
|
||||
|
||||
EINA_LIST_FOREACH(ecore_drm_output_modes_get(output), l, mode)
|
||||
{
|
||||
diff = (100 * abs(s->config.mode.w - mode->width)) +
|
||||
(100 * abs(s->config.mode.h - mode->height)) +
|
||||
fabs((100 * s->config.mode.refresh) - (100 * mode->refresh));
|
||||
if (diff < distance)
|
||||
{
|
||||
m = mode;
|
||||
distance = diff;
|
||||
}
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_e_mod_drm_output_exists(Ecore_Drm_Output *output, unsigned int crtc)
|
||||
{
|
||||
/* find out if this output can go into the 'possibles' */
|
||||
return ecore_drm_output_possible_crtc_get(output, crtc);
|
||||
}
|
||||
|
||||
static char *
|
||||
_e_mod_drm_output_screen_get(Ecore_Drm_Output *output)
|
||||
{
|
||||
const char *model;
|
||||
|
||||
model = ecore_drm_output_model_get(output);
|
||||
if (!model) return NULL;
|
||||
|
||||
return strdup(model);
|
||||
}
|
||||
#endif
|
||||
|
||||
static E_Randr2_Screen *
|
||||
_info_unconf_primary_find(E_Randr2 *r)
|
||||
{
|
||||
|
@ -355,7 +296,6 @@ _e_mod_drm_relative_fixup(E_Randr2 *r)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_DRM2
|
||||
static E_Randr2 *
|
||||
_drm2_randr_create(void)
|
||||
{
|
||||
|
@ -807,355 +747,6 @@ _drm2_read_pixels(E_Comp_Wl_Output *output, void *pixels)
|
|||
}
|
||||
|
||||
}
|
||||
#else
|
||||
static E_Randr2 *
|
||||
_drm_randr_create(void)
|
||||
{
|
||||
Ecore_Drm_Device *dev;
|
||||
Ecore_Drm_Output *output;
|
||||
const Eina_List *l, *ll;
|
||||
E_Randr2 *r = NULL;
|
||||
unsigned int type;
|
||||
|
||||
printf("DRM RRR: ................. info get!\n");
|
||||
|
||||
r = E_NEW(E_Randr2, 1);
|
||||
if (!r) return NULL;
|
||||
|
||||
EINA_LIST_FOREACH(ecore_drm_devices_get(), l, dev)
|
||||
{
|
||||
EINA_LIST_FOREACH(dev->outputs, ll, output)
|
||||
{
|
||||
E_Randr2_Screen *s;
|
||||
E_Config_Randr2_Screen *cs;
|
||||
const Eina_List *m;
|
||||
Ecore_Drm_Output_Mode *omode;
|
||||
// size_t n, e = 0;
|
||||
unsigned int j;
|
||||
int priority;
|
||||
Eina_Bool ok = EINA_FALSE;
|
||||
Eina_Bool possible = EINA_FALSE;
|
||||
|
||||
s = E_NEW(E_Randr2_Screen, 1);
|
||||
if (!s) continue;
|
||||
|
||||
s->info.name = ecore_drm_output_name_get(output);
|
||||
printf("DRM RRR: .... out %s\n", s->info.name);
|
||||
|
||||
s->info.connected = ecore_drm_output_connected_get(output);
|
||||
printf("DRM RRR: ...... connected %i\n", s->info.connected);
|
||||
|
||||
s->info.screen = _e_mod_drm_output_screen_get(output);
|
||||
|
||||
s->info.edid = ecore_drm_output_edid_get(output);
|
||||
if (s->info.edid)
|
||||
s->id = malloc(strlen(s->info.name) + 1 + strlen(s->info.edid) + 1);
|
||||
else
|
||||
s->id = malloc(strlen(s->info.name) + 1 + 1);
|
||||
if (!s->id)
|
||||
{
|
||||
free(s->info.screen);
|
||||
free(s->info.edid);
|
||||
free(s);
|
||||
continue;
|
||||
}
|
||||
strcpy(s->id, s->info.name);
|
||||
strcat(s->id, "/");
|
||||
if (s->info.edid) strcat(s->id, s->info.edid);
|
||||
|
||||
printf("DRM RRR: Created Screen: %s\n", s->id);
|
||||
|
||||
type = MIN(ecore_drm_output_connector_type_get(output),
|
||||
EINA_C_ARRAY_LENGTH(conn_types) - 1);
|
||||
s->info.connector = rtype[type];
|
||||
s->info.is_lid = ((type == DRM_MODE_CONNECTOR_LVDS) ||
|
||||
(type == DRM_MODE_CONNECTOR_eDP));
|
||||
s->info.lid_closed = (s->info.is_lid && e_acpi_lid_is_closed());
|
||||
printf("DRM RRR: ...... lid_closed = %i (%i && %i)\n",
|
||||
s->info.lid_closed, s->info.is_lid, e_acpi_lid_is_closed());
|
||||
|
||||
s->info.backlight = ecore_drm_output_backlight_get(output);
|
||||
|
||||
ecore_drm_output_physical_size_get(output, &s->info.size.w,
|
||||
&s->info.size.h);
|
||||
|
||||
EINA_LIST_FOREACH(ecore_drm_output_modes_get(output), m, omode)
|
||||
{
|
||||
E_Randr2_Mode *rmode;
|
||||
|
||||
rmode = malloc(sizeof(E_Randr2_Mode));
|
||||
if (!rmode) continue;
|
||||
|
||||
rmode->w = omode->width;
|
||||
rmode->h = omode->height;
|
||||
rmode->refresh = omode->refresh;
|
||||
rmode->preferred = (omode->flags & DRM_MODE_TYPE_PREFERRED);
|
||||
|
||||
s->info.modes = eina_list_append(s->info.modes, rmode);
|
||||
}
|
||||
|
||||
cs = NULL;
|
||||
priority = 0;
|
||||
if (e_randr2_cfg)
|
||||
cs = e_randr2_config_screen_find(s, e_randr2_cfg);
|
||||
if (cs)
|
||||
priority = cs->priority;
|
||||
else if (ecore_drm_output_primary_get(dev) == output)
|
||||
priority = 100;
|
||||
s->config.priority = priority;
|
||||
|
||||
for (j = 0; j < dev->crtc_count; j++)
|
||||
{
|
||||
if (dev->crtcs[j] == ecore_drm_output_crtc_id_get(output))
|
||||
{
|
||||
ok = EINA_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
/* get possible crtcs, compare to output_crtc_id_get */
|
||||
for (j = 0; j < dev->crtc_count; j++)
|
||||
{
|
||||
if (_e_mod_drm_output_exists(output, dev->crtcs[j]))
|
||||
{
|
||||
ok = EINA_TRUE;
|
||||
possible = EINA_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ok)
|
||||
{
|
||||
if (!possible)
|
||||
{
|
||||
unsigned int refresh;
|
||||
|
||||
ecore_drm_output_position_get(output, &s->config.geom.x,
|
||||
&s->config.geom.y);
|
||||
ecore_drm_output_crtc_size_get(output, &s->config.geom.w,
|
||||
&s->config.geom.h);
|
||||
|
||||
ecore_drm_output_current_resolution_get(output,
|
||||
&s->config.mode.w,
|
||||
&s->config.mode.h,
|
||||
&refresh);
|
||||
s->config.mode.refresh = refresh;
|
||||
s->config.enabled =
|
||||
((s->config.mode.w != 0) && (s->config.mode.h != 0));
|
||||
|
||||
printf("DRM RRR: '%s' %i %i %ix%i\n", s->info.name,
|
||||
s->config.geom.x, s->config.geom.y,
|
||||
s->config.geom.w, s->config.geom.h);
|
||||
}
|
||||
|
||||
#if (EFL_VERSION_MAJOR > 1) || (EFL_VERSION_MINOR >= 18)
|
||||
unsigned int rotations;
|
||||
|
||||
rotations =
|
||||
ecore_drm_output_supported_rotations_get(output,
|
||||
ECORE_DRM_PLANE_TYPE_PRIMARY);
|
||||
|
||||
if (rotations & ECORE_DRM_PLANE_ROTATION_NORMAL)
|
||||
s->info.can_rot_0 = EINA_TRUE;
|
||||
if (rotations & ECORE_DRM_PLANE_ROTATION_90)
|
||||
s->info.can_rot_90 = EINA_TRUE;
|
||||
if (rotations & ECORE_DRM_PLANE_ROTATION_180)
|
||||
s->info.can_rot_180 = EINA_TRUE;
|
||||
if (rotations & ECORE_DRM_PLANE_ROTATION_270)
|
||||
s->info.can_rot_270 = EINA_TRUE;
|
||||
#endif
|
||||
|
||||
if (cs)
|
||||
{
|
||||
if (cs->profile)
|
||||
s->config.profile = strdup(cs->profile);
|
||||
else
|
||||
s->config.profile = NULL;
|
||||
s->config.scale_multiplier = cs->scale_multiplier;
|
||||
}
|
||||
}
|
||||
|
||||
r->screens = eina_list_append(r->screens, s);
|
||||
}
|
||||
}
|
||||
|
||||
_e_mod_drm_relative_fixup(r);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static void
|
||||
_drm_randr_apply(void)
|
||||
{
|
||||
Ecore_Drm_Device *dev;
|
||||
Ecore_Drm_Output *out;
|
||||
E_Randr2_Screen *s;
|
||||
const Eina_List *l, *ll;
|
||||
int nw, nh, pw, ph, ww, hh;
|
||||
int minw, minh, maxw, maxh;
|
||||
int top_priority = 0;
|
||||
|
||||
/* TODO: what the actual fuck */
|
||||
|
||||
nw = e_randr2->w;
|
||||
nh = e_randr2->h;
|
||||
EINA_LIST_FOREACH(ecore_drm_devices_get(), l, dev)
|
||||
{
|
||||
ecore_drm_screen_size_range_get(dev, &minw, &minh, &maxw, &maxh);
|
||||
printf("DRM RRR: size range: %ix%i -> %ix%i\n", minw, minh, maxw, maxh);
|
||||
|
||||
ecore_drm_outputs_geometry_get(dev, NULL, NULL, &pw, &ph);
|
||||
if (nw > maxw) nw = maxw;
|
||||
if (nh > maxh) nh = maxh;
|
||||
if (nw < minw) nw = minw;
|
||||
if (nh < minh) nh = minh;
|
||||
ww = nw;
|
||||
hh = nh;
|
||||
if (nw < pw) ww = pw;
|
||||
if (nh < ph) hh = ph;
|
||||
|
||||
printf("DRM RRR: set vsize: %ix%i\n", ww, hh);
|
||||
|
||||
EINA_LIST_FOREACH(e_randr2->screens, ll, s)
|
||||
{
|
||||
Ecore_Drm_Output_Mode *mode = NULL;
|
||||
|
||||
printf("DRM RRR: find output for '%s'\n", s->info.name);
|
||||
|
||||
out = ecore_drm_device_output_name_find(dev, s->info.name);
|
||||
if (!out) continue;
|
||||
|
||||
if (s->config.configured)
|
||||
{
|
||||
printf("\tDRM RRR: configured by E\n");
|
||||
|
||||
if (s->config.enabled)
|
||||
{
|
||||
printf("\tDRM RRR: Enabled\n");
|
||||
mode = _e_mod_drm_mode_screen_find(s, out);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tDRM RRR: Disabled\n");
|
||||
}
|
||||
|
||||
if (s->config.priority > top_priority)
|
||||
top_priority = s->config.priority;
|
||||
|
||||
printf("\tDRM RRR: Priority: %d\n", s->config.priority);
|
||||
|
||||
printf("\tDRM RRR: Geom: %d %d %d %d\n",
|
||||
s->config.geom.x, s->config.geom.y,
|
||||
s->config.geom.w, s->config.geom.h);
|
||||
|
||||
if (mode)
|
||||
{
|
||||
printf("\tDRM RRR: Found Valid Drm Mode\n");
|
||||
printf("\t\tDRM RRR: %dx%d\n", mode->width, mode->height);
|
||||
}
|
||||
else
|
||||
printf("\tDRM RRR: No Valid Drm Mode Found\n");
|
||||
|
||||
ecore_drm_output_mode_set(out, mode,
|
||||
s->config.geom.x, s->config.geom.y);
|
||||
#if (EFL_VERSION_MAJOR > 1) || (EFL_VERSION_MINOR >= 18)
|
||||
int orient;
|
||||
|
||||
if (s->config.rotation == 0)
|
||||
orient = (1 << 0);
|
||||
else if (s->config.rotation == 90)
|
||||
orient = (1 << 1);
|
||||
else if (s->config.rotation == 180)
|
||||
orient = (1 << 2);
|
||||
else if (s->config.rotation == 270)
|
||||
orient = (1 << 3);
|
||||
|
||||
ecore_drm_output_rotation_set(out,
|
||||
ECORE_DRM_PLANE_TYPE_PRIMARY,
|
||||
orient);
|
||||
#endif
|
||||
|
||||
if (s->config.priority == top_priority)
|
||||
ecore_drm_output_primary_set(out);
|
||||
|
||||
if (s->config.enabled)
|
||||
ecore_drm_output_enable(out);
|
||||
else
|
||||
ecore_drm_output_disable(out);
|
||||
|
||||
printf("\tDRM RRR: Mode\n");
|
||||
printf("\t\tDRM RRR: Geom: %d %d\n",
|
||||
s->config.mode.w, s->config.mode.h);
|
||||
printf("\t\tDRM RRR: Refresh: %f\n", s->config.mode.refresh);
|
||||
printf("\t\tDRM RRR: Preferred: %d\n",
|
||||
s->config.mode.preferred);
|
||||
|
||||
printf("\tDRM RRR: Rotation: %d\n", s->config.rotation);
|
||||
|
||||
printf("\tDRM RRR: Relative Mode: %d\n",
|
||||
s->config.relative.mode);
|
||||
printf("\tDRM RRR: Relative To: %s\n",
|
||||
s->config.relative.to);
|
||||
printf("\tDRM RRR: Align: %f\n", s->config.relative.align);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_drm_dpms(int set)
|
||||
{
|
||||
Ecore_Drm_Device *dev;
|
||||
Ecore_Drm_Output *out;
|
||||
E_Randr2_Screen *s;
|
||||
const Eina_List *l, *ll;
|
||||
|
||||
EINA_LIST_FOREACH(ecore_drm_devices_get(), l, dev)
|
||||
{
|
||||
EINA_LIST_FOREACH(e_randr2->screens, ll, s)
|
||||
{
|
||||
out = ecore_drm_device_output_name_find(dev, s->info.name);
|
||||
if (!out) continue;
|
||||
|
||||
if ((!s->config.configured) || s->config.enabled)
|
||||
ecore_drm_output_dpms_set(out, set);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_drm_read_pixels(E_Comp_Wl_Output *output, void *pixels)
|
||||
{
|
||||
Ecore_Drm_Device *dev;
|
||||
Ecore_Drm_Fb *fb;
|
||||
const Eina_List *drm_devs, *l;
|
||||
int i = 0, bstride;
|
||||
unsigned char *s, *d = pixels;
|
||||
|
||||
drm_devs = ecore_drm_devices_get();
|
||||
EINA_LIST_FOREACH(drm_devs, l, dev)
|
||||
{
|
||||
fb = dev->next;
|
||||
if (!fb) fb = dev->current;
|
||||
if (fb) break;
|
||||
}
|
||||
|
||||
if (!fb) return;
|
||||
|
||||
bstride = output->w * sizeof(int);
|
||||
|
||||
for (i = output->y; i < output->y + output->h; i++)
|
||||
{
|
||||
s = fb->mmap;
|
||||
s += (fb->stride * i) + (output->x * sizeof(int));
|
||||
memcpy(d, s, (output->w * sizeof(int)));
|
||||
d += bstride;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static Eina_Bool
|
||||
_drm_randr_available(void)
|
||||
|
@ -1163,13 +754,6 @@ _drm_randr_available(void)
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
#ifndef HAVE_DRM2
|
||||
static void
|
||||
_drm_randr_stub(void)
|
||||
{}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DRM2
|
||||
static Eina_Bool
|
||||
_drm2_cb_seat_caps(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
||||
{
|
||||
|
@ -1213,12 +797,10 @@ _drm2_shutdown(void)
|
|||
{
|
||||
ecore_event_handler_del(seat_handler);
|
||||
}
|
||||
#endif
|
||||
|
||||
static E_Comp_Screen_Iface drmiface =
|
||||
{
|
||||
.available = _drm_randr_available,
|
||||
#ifdef HAVE_DRM2
|
||||
.init = _drm2_init,
|
||||
.shutdown = _drm2_shutdown,
|
||||
.create = _drm2_randr_create,
|
||||
|
@ -1226,13 +808,6 @@ static E_Comp_Screen_Iface drmiface =
|
|||
.dpms = _drm2_dpms,
|
||||
.key_down = _drm2_key_down,
|
||||
.key_up = _drm2_key_up,
|
||||
#else
|
||||
.init = _drm_randr_stub,
|
||||
.shutdown = _drm_randr_stub,
|
||||
.create = _drm_randr_create,
|
||||
.apply = _drm_randr_apply,
|
||||
.dpms = _drm_dpms,
|
||||
#endif
|
||||
};
|
||||
|
||||
E_API void *
|
||||
|
@ -1283,11 +858,7 @@ e_modapi_init(E_Module *m)
|
|||
if (!e_comp_wl_init()) return NULL;
|
||||
if (!e_comp_canvas_init(w, h)) return NULL;
|
||||
|
||||
#ifdef HAVE_DRM2
|
||||
e_comp_wl->extensions->screenshooter.read_pixels = _drm2_read_pixels;
|
||||
#else
|
||||
e_comp_wl->extensions->screenshooter.read_pixels = _drm_read_pixels;
|
||||
#endif
|
||||
|
||||
ecore_evas_pointer_xy_get(e_comp->ee, &e_comp_wl->ptr.x,
|
||||
&e_comp_wl->ptr.y);
|
||||
|
@ -1297,12 +868,9 @@ e_modapi_init(E_Module *m)
|
|||
e_comp_wl_input_keyboard_enabled_set(EINA_TRUE);
|
||||
e_comp_wl_input_touch_enabled_set(EINA_TRUE);
|
||||
|
||||
/* comp->pointer = */
|
||||
/* e_pointer_window_new(ecore_evas_window_get(comp->ee), 1); */
|
||||
e_comp->pointer = e_pointer_canvas_new(e_comp->ee, EINA_TRUE);
|
||||
e_comp->pointer->color = EINA_TRUE;
|
||||
|
||||
#ifdef HAVE_DRM2
|
||||
activate_handler =
|
||||
ecore_event_handler_add(ECORE_DRM2_EVENT_ACTIVATE,
|
||||
_e_mod_drm_cb_activate, NULL);
|
||||
|
@ -1310,15 +878,6 @@ e_modapi_init(E_Module *m)
|
|||
output_handler =
|
||||
ecore_event_handler_add(ECORE_DRM2_EVENT_OUTPUT_CHANGED,
|
||||
_e_mod_drm_cb_output, NULL);
|
||||
#else
|
||||
activate_handler =
|
||||
ecore_event_handler_add(ECORE_DRM_EVENT_ACTIVATE,
|
||||
_e_mod_drm_cb_activate, NULL);
|
||||
|
||||
output_handler =
|
||||
ecore_event_handler_add(ECORE_DRM_EVENT_OUTPUT,
|
||||
_e_mod_drm_cb_output, NULL);
|
||||
#endif
|
||||
|
||||
return m;
|
||||
}
|
||||
|
@ -1326,9 +885,6 @@ e_modapi_init(E_Module *m)
|
|||
E_API int
|
||||
e_modapi_shutdown(E_Module *m EINA_UNUSED)
|
||||
{
|
||||
/* shutdown ecore_drm */
|
||||
/* ecore_drm_shutdown(); */
|
||||
|
||||
if (output_handler) ecore_event_handler_del(output_handler);
|
||||
output_handler = NULL;
|
||||
|
||||
|
|
Loading…
Reference in New Issue