2016-03-09 05:22:22 -08:00
|
|
|
/* Portions of this code have been derived from Weston
|
|
|
|
*
|
|
|
|
* Copyright © 2008-2012 Kristian Høgsberg
|
|
|
|
* Copyright © 2010-2012 Intel Corporation
|
|
|
|
* Copyright © 2010-2011 Benjamin Franzke
|
|
|
|
* Copyright © 2011-2012 Collabora, Ltd.
|
|
|
|
* Copyright © 2010 Red Hat <mjg@redhat.com>
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2014-03-06 01:43:48 -08:00
|
|
|
#include "ecore_drm_private.h"
|
|
|
|
#include <dlfcn.h>
|
|
|
|
|
2015-04-08 07:41:26 -07:00
|
|
|
#define INSIDE(x, y, xx, yy, ww, hh) \
|
|
|
|
(((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && \
|
|
|
|
((x) >= (xx)) && ((y) >= (yy)))
|
|
|
|
|
ecore-drm: add ecore_drm_devices_get to get the list of drm devices
Summary:
when enlightenment is working as wayland display server, enlightenment
changes KDSETMODE to KD_GRAPHICS in _ecore_drm_tty_setup(). However,
when enlightenment is killed by SIGSEGV, it doesn't changes KDSETMODE
to KD_TEXT because englightenment process doesn't call ecore_drm_tty_close().
To make possible enlightenment call ecore_drm_tty_close(), drm devices
should be exposed.
When enlightenment is killed by SIGSEGV, it will get drm devices with
ecore_drm_device_get_list(), and will call ecore_drm_launcher_disconnect(),
and ecore_drm_launcher_disconnect will call ecore_drm_tty_close() internally.
@feature
Change-Id: I1c594739ec96660a09cee77b823ace6548ee5282
Reviewers: zmike, cedric, raster, gwanglim, devilhorns
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D2159
2015-03-17 06:30:59 -07:00
|
|
|
static Eina_List *drm_devices;
|
2016-02-18 11:22:19 -08:00
|
|
|
static int ticking = 0;
|
ecore-drm: add ecore_drm_devices_get to get the list of drm devices
Summary:
when enlightenment is working as wayland display server, enlightenment
changes KDSETMODE to KD_GRAPHICS in _ecore_drm_tty_setup(). However,
when enlightenment is killed by SIGSEGV, it doesn't changes KDSETMODE
to KD_TEXT because englightenment process doesn't call ecore_drm_tty_close().
To make possible enlightenment call ecore_drm_tty_close(), drm devices
should be exposed.
When enlightenment is killed by SIGSEGV, it will get drm devices with
ecore_drm_device_get_list(), and will call ecore_drm_launcher_disconnect(),
and ecore_drm_launcher_disconnect will call ecore_drm_tty_close() internally.
@feature
Change-Id: I1c594739ec96660a09cee77b823ace6548ee5282
Reviewers: zmike, cedric, raster, gwanglim, devilhorns
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D2159
2015-03-17 06:30:59 -07:00
|
|
|
|
2020-05-05 03:28:39 -07:00
|
|
|
struct xkb_keymap *cached_keymap;
|
|
|
|
struct xkb_context *cached_context;
|
|
|
|
|
2016-03-11 11:48:44 -08:00
|
|
|
static void _ecore_drm_tick_source_set(Ecore_Drm_Device *dev);
|
|
|
|
|
2016-02-18 11:22:19 -08:00
|
|
|
static void
|
|
|
|
_ecore_drm_tick_schedule(Ecore_Drm_Device *dev)
|
2014-03-06 01:43:48 -08:00
|
|
|
{
|
2016-02-18 11:22:19 -08:00
|
|
|
drmVBlank vbl;
|
2014-03-06 01:43:48 -08:00
|
|
|
|
2016-02-18 11:22:19 -08:00
|
|
|
if (!ticking) return;
|
2015-05-13 11:33:08 -07:00
|
|
|
|
2016-02-18 11:22:19 -08:00
|
|
|
vbl.request.type = (DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT);
|
|
|
|
vbl.request.sequence = 1;
|
|
|
|
vbl.request.signal = (unsigned long)dev;
|
2016-03-11 11:48:44 -08:00
|
|
|
if (drmWaitVBlank(dev->drm.fd, &vbl) < 0)
|
|
|
|
{
|
|
|
|
WRN("Vblank failed, disabling custom ticks");
|
|
|
|
_ecore_drm_tick_source_set(NULL);
|
|
|
|
}
|
2016-02-18 11:22:19 -08:00
|
|
|
}
|
2015-04-08 10:50:50 -07:00
|
|
|
|
2016-02-18 11:22:19 -08:00
|
|
|
static void
|
|
|
|
_ecore_drm_tick_begin(void *data)
|
|
|
|
{
|
|
|
|
ticking = 1;
|
|
|
|
_ecore_drm_tick_schedule(data);
|
|
|
|
}
|
2015-04-08 10:50:50 -07:00
|
|
|
|
2016-02-18 11:22:19 -08:00
|
|
|
static void
|
|
|
|
_ecore_drm_tick_end(void *data EINA_UNUSED)
|
|
|
|
{
|
|
|
|
ticking = 0;
|
|
|
|
}
|
2015-04-08 10:50:50 -07:00
|
|
|
|
2016-02-18 11:22:19 -08:00
|
|
|
static void
|
|
|
|
_ecore_drm_tick_source_set(Ecore_Drm_Device *dev)
|
|
|
|
{
|
2016-03-11 11:48:44 -08:00
|
|
|
if (!dev)
|
|
|
|
{
|
|
|
|
ecore_animator_custom_source_tick_begin_callback_set(NULL, NULL);
|
|
|
|
ecore_animator_custom_source_tick_end_callback_set(NULL, NULL);
|
|
|
|
ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER);
|
|
|
|
return;
|
|
|
|
}
|
2016-02-18 11:22:19 -08:00
|
|
|
ecore_animator_custom_source_tick_begin_callback_set
|
|
|
|
(_ecore_drm_tick_begin, dev);
|
|
|
|
ecore_animator_custom_source_tick_end_callback_set
|
|
|
|
(_ecore_drm_tick_end, dev);
|
|
|
|
ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM);
|
|
|
|
}
|
2015-04-08 10:50:50 -07:00
|
|
|
|
2016-02-18 11:22:19 -08:00
|
|
|
static void
|
|
|
|
_ecore_drm_device_cb_page_flip(int fd EINA_UNUSED, unsigned int frame EINA_UNUSED, unsigned int sec EINA_UNUSED, unsigned int usec EINA_UNUSED, void *data)
|
|
|
|
{
|
|
|
|
Ecore_Drm_Output *output = data;
|
|
|
|
Ecore_Drm_Fb *next;
|
2015-04-08 10:50:50 -07:00
|
|
|
|
2016-02-18 11:22:19 -08:00
|
|
|
if (output->pending_destroy)
|
|
|
|
{
|
|
|
|
ecore_drm_output_free(output);
|
|
|
|
return;
|
|
|
|
}
|
2016-03-10 16:34:19 -08:00
|
|
|
|
|
|
|
output->dev->current = output->current;
|
2016-02-18 11:22:19 -08:00
|
|
|
/* We were unable to queue a page on the last flip attempt, so we'll
|
|
|
|
* try again now. */
|
|
|
|
next = output->next;
|
|
|
|
if (next)
|
|
|
|
{
|
|
|
|
output->next = NULL;
|
2016-01-26 08:43:21 -08:00
|
|
|
_ecore_drm_output_fb_send(output->dev, next, output);
|
2016-02-18 11:22:19 -08:00
|
|
|
}
|
2014-03-06 01:43:48 -08:00
|
|
|
}
|
|
|
|
|
2016-02-18 11:22:19 -08:00
|
|
|
static void
|
2014-03-06 01:43:48 -08:00
|
|
|
_ecore_drm_device_cb_vblank(int fd EINA_UNUSED, unsigned int frame EINA_UNUSED, unsigned int sec EINA_UNUSED, unsigned int usec EINA_UNUSED, void *data)
|
|
|
|
{
|
2016-02-18 11:22:19 -08:00
|
|
|
ecore_animator_custom_tick();
|
|
|
|
if (ticking) _ecore_drm_tick_schedule(data);
|
2014-03-06 01:43:48 -08:00
|
|
|
}
|
|
|
|
|
2016-02-18 11:22:19 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_cb_drm_event_handle(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED)
|
2015-04-20 09:14:27 -07:00
|
|
|
{
|
2016-02-18 11:22:19 -08:00
|
|
|
Ecore_Drm_Device *dev = data;
|
|
|
|
int err;
|
2015-04-20 09:14:27 -07:00
|
|
|
|
2016-02-18 11:22:19 -08:00
|
|
|
err = drmHandleEvent(dev->drm.fd, &dev->drm_ctx);
|
|
|
|
if (err)
|
2015-04-20 09:14:27 -07:00
|
|
|
{
|
2016-02-18 11:22:19 -08:00
|
|
|
ERR("drmHandleEvent failed to read an event");
|
|
|
|
return EINA_FALSE;
|
2015-04-20 09:14:27 -07:00
|
|
|
}
|
2016-02-18 11:22:19 -08:00
|
|
|
return EINA_TRUE;
|
2015-04-20 09:14:27 -07:00
|
|
|
}
|
2014-03-06 01:43:48 -08:00
|
|
|
|
2015-04-07 08:08:19 -07:00
|
|
|
static void
|
|
|
|
_ecore_drm_device_cb_output_event(const char *device EINA_UNUSED, Eeze_Udev_Event event EINA_UNUSED, void *data, Eeze_Udev_Watch *watch EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Ecore_Drm_Device *dev;
|
|
|
|
|
|
|
|
if (!(dev = data)) return;
|
|
|
|
_ecore_drm_outputs_update(dev);
|
|
|
|
}
|
|
|
|
|
ecore-drm: Add a new API for keymap cache
Summary:
Originally, each keyboard devices could have their own keymap.
The one keyboard's keymap could different with others.
But for this, Ecore_Drm compile a new keymap when a keyboard is connected.
But this is a burden for some people who doesn't manage keymap for each keyboard.
They want to maintain only one keymap for system.
So, I added cached context/keymap and just ref/unref for each keyboard device.
People who want to different keymap for each keyboard just do not set cached
context/keymap. Then Ecore_Drm maintain keymaps about each keyboard devices.
Test Plan:
Connect a keyboard device and watch flow of ioctl.
Originally Ecore_Drm opened xkb data and compile keymap,
but after patch, that ioctl is disppeared.
@feature
Reviewers: raster, devilhorns, ManMower
Reviewed By: devilhorns, ManMower
Subscribers: cedric, input.hacker, ohduna, jpeg
Differential Revision: https://phab.enlightenment.org/D3503
2016-01-04 05:47:43 -08:00
|
|
|
struct xkb_context *
|
|
|
|
_ecore_drm_device_cached_context_get(enum xkb_context_flags flags)
|
|
|
|
{
|
|
|
|
if (!cached_context)
|
|
|
|
return xkb_context_new(flags);
|
|
|
|
else
|
|
|
|
return xkb_context_ref(cached_context);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct xkb_keymap *
|
2016-01-07 05:55:49 -08:00
|
|
|
_ecore_drm_device_cached_keymap_get(struct xkb_context *ctx, const struct xkb_rule_names *names, enum xkb_keymap_compile_flags flags)
|
ecore-drm: Add a new API for keymap cache
Summary:
Originally, each keyboard devices could have their own keymap.
The one keyboard's keymap could different with others.
But for this, Ecore_Drm compile a new keymap when a keyboard is connected.
But this is a burden for some people who doesn't manage keymap for each keyboard.
They want to maintain only one keymap for system.
So, I added cached context/keymap and just ref/unref for each keyboard device.
People who want to different keymap for each keyboard just do not set cached
context/keymap. Then Ecore_Drm maintain keymaps about each keyboard devices.
Test Plan:
Connect a keyboard device and watch flow of ioctl.
Originally Ecore_Drm opened xkb data and compile keymap,
but after patch, that ioctl is disppeared.
@feature
Reviewers: raster, devilhorns, ManMower
Reviewed By: devilhorns, ManMower
Subscribers: cedric, input.hacker, ohduna, jpeg
Differential Revision: https://phab.enlightenment.org/D3503
2016-01-04 05:47:43 -08:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, NULL);
|
|
|
|
|
|
|
|
if (!cached_keymap)
|
2016-04-27 09:49:11 -07:00
|
|
|
cached_keymap = xkb_map_new_from_names(ctx, names, flags);
|
|
|
|
return xkb_map_ref(cached_keymap);
|
ecore-drm: Add a new API for keymap cache
Summary:
Originally, each keyboard devices could have their own keymap.
The one keyboard's keymap could different with others.
But for this, Ecore_Drm compile a new keymap when a keyboard is connected.
But this is a burden for some people who doesn't manage keymap for each keyboard.
They want to maintain only one keymap for system.
So, I added cached context/keymap and just ref/unref for each keyboard device.
People who want to different keymap for each keyboard just do not set cached
context/keymap. Then Ecore_Drm maintain keymaps about each keyboard devices.
Test Plan:
Connect a keyboard device and watch flow of ioctl.
Originally Ecore_Drm opened xkb data and compile keymap,
but after patch, that ioctl is disppeared.
@feature
Reviewers: raster, devilhorns, ManMower
Reviewed By: devilhorns, ManMower
Subscribers: cedric, input.hacker, ohduna, jpeg
Differential Revision: https://phab.enlightenment.org/D3503
2016-01-04 05:47:43 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_drm_device_cached_context_update(struct xkb_context *ctx)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Ecore_Drm_Device *dev;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(drm_devices, l, dev)
|
|
|
|
{
|
|
|
|
xkb_context_unref(dev->xkb_ctx);
|
|
|
|
dev->xkb_ctx = xkb_context_ref(ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_drm_device_cached_keymap_update(struct xkb_keymap *map)
|
|
|
|
{
|
|
|
|
Eina_List *l, *l2, *l3;
|
|
|
|
Ecore_Drm_Device *dev;
|
|
|
|
Ecore_Drm_Seat *seat;
|
|
|
|
Ecore_Drm_Evdev *edev;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(drm_devices, l, dev)
|
|
|
|
EINA_LIST_FOREACH(dev->seats, l2, seat)
|
|
|
|
EINA_LIST_FOREACH(seat->devices, l3, edev)
|
|
|
|
{
|
|
|
|
xkb_keymap_unref(edev->xkb.keymap);
|
|
|
|
edev->xkb.keymap = xkb_keymap_ref(map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-06 01:43:48 -08:00
|
|
|
/**
|
|
|
|
* @defgroup Ecore_Drm_Device_Group Device manipulation functions
|
2020-06-20 02:43:56 -07:00
|
|
|
*
|
|
|
|
* Functions that deal with finding, opening, closing, and otherwise using
|
2014-03-06 01:43:48 -08:00
|
|
|
* the DRM device itself.
|
|
|
|
*/
|
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API Ecore_Drm_Device *
|
2014-03-06 01:43:48 -08:00
|
|
|
ecore_drm_device_find(const char *name, const char *seat)
|
|
|
|
{
|
|
|
|
Ecore_Drm_Device *dev = NULL;
|
2014-09-23 10:13:25 -07:00
|
|
|
Eina_Bool found = EINA_FALSE;
|
2014-10-08 07:06:45 -07:00
|
|
|
Eina_Bool platform = EINA_FALSE;
|
2014-09-23 10:13:25 -07:00
|
|
|
Eina_List *devs, *l;
|
2014-09-24 06:06:47 -07:00
|
|
|
const char *device;
|
2014-03-06 01:43:48 -08:00
|
|
|
|
2014-09-23 10:13:25 -07:00
|
|
|
/* try to get a list of drm devics */
|
|
|
|
if (!(devs = eeze_udev_find_by_type(EEZE_UDEV_TYPE_DRM, name)))
|
|
|
|
return NULL;
|
2014-03-06 01:43:48 -08:00
|
|
|
|
2014-09-23 10:13:25 -07:00
|
|
|
DBG("Find Drm Device: %s", name);
|
2014-03-06 01:43:48 -08:00
|
|
|
|
2014-09-23 10:13:25 -07:00
|
|
|
EINA_LIST_FOREACH(devs, l, device)
|
2014-03-06 01:43:48 -08:00
|
|
|
{
|
2014-09-23 10:13:25 -07:00
|
|
|
const char *devpath;
|
|
|
|
const char *devseat;
|
|
|
|
const char *devparent;
|
2014-03-06 01:43:48 -08:00
|
|
|
|
2014-09-23 10:13:25 -07:00
|
|
|
if (!(devpath = eeze_udev_syspath_get_devpath(device)))
|
2014-03-06 01:43:48 -08:00
|
|
|
continue;
|
|
|
|
|
2014-09-23 10:13:25 -07:00
|
|
|
DBG("Found Drm Device");
|
|
|
|
DBG("\tDevice: %s", device);
|
|
|
|
DBG("\tDevpath: %s", devpath);
|
2014-03-06 01:43:48 -08:00
|
|
|
|
2014-09-23 10:13:25 -07:00
|
|
|
if ((name) && (strcmp(name, devpath))) goto cont;
|
2014-03-06 01:43:48 -08:00
|
|
|
|
2014-09-23 10:13:25 -07:00
|
|
|
if (!(devseat = eeze_udev_syspath_get_property(device, "ID_SEAT")))
|
|
|
|
devseat = eina_stringshare_add("seat0");
|
|
|
|
|
2020-06-20 02:43:56 -07:00
|
|
|
if ((seat) && (strcmp(seat, devseat)))
|
2014-09-23 10:13:25 -07:00
|
|
|
goto cont;
|
|
|
|
else if (strcmp(devseat, "seat0"))
|
|
|
|
goto cont;
|
2014-03-06 01:43:48 -08:00
|
|
|
|
2014-09-23 10:13:25 -07:00
|
|
|
devparent = eeze_udev_syspath_get_parent_filtered(device, "pci", NULL);
|
2014-10-08 06:31:37 -07:00
|
|
|
if (!devparent)
|
|
|
|
{
|
2020-06-20 02:43:56 -07:00
|
|
|
devparent =
|
2014-10-08 06:31:37 -07:00
|
|
|
eeze_udev_syspath_get_parent_filtered(device, "platform", NULL);
|
2014-10-08 07:06:45 -07:00
|
|
|
platform = EINA_TRUE;
|
2014-10-08 06:31:37 -07:00
|
|
|
}
|
|
|
|
|
2014-09-23 10:13:25 -07:00
|
|
|
if (devparent)
|
2014-03-06 01:43:48 -08:00
|
|
|
{
|
2014-10-08 07:06:45 -07:00
|
|
|
if (!platform)
|
2014-03-06 01:43:48 -08:00
|
|
|
{
|
2014-10-08 07:06:45 -07:00
|
|
|
const char *id;
|
|
|
|
|
|
|
|
if ((id = eeze_udev_syspath_get_sysattr(devparent, "boot_vga")))
|
|
|
|
{
|
|
|
|
if (!strcmp(id, "1")) found = EINA_TRUE;
|
|
|
|
eina_stringshare_del(id);
|
|
|
|
}
|
2014-03-06 01:43:48 -08:00
|
|
|
}
|
2014-10-08 07:06:45 -07:00
|
|
|
else
|
|
|
|
found = EINA_TRUE;
|
2014-09-23 10:13:25 -07:00
|
|
|
|
|
|
|
eina_stringshare_del(devparent);
|
2014-03-06 01:43:48 -08:00
|
|
|
}
|
|
|
|
|
2014-09-23 10:13:25 -07:00
|
|
|
cont:
|
|
|
|
eina_stringshare_del(devpath);
|
2014-09-24 06:06:47 -07:00
|
|
|
if (found) break;
|
2014-03-06 01:43:48 -08:00
|
|
|
}
|
|
|
|
|
2014-09-24 06:06:47 -07:00
|
|
|
if (!found) goto out;
|
2014-03-06 01:43:48 -08:00
|
|
|
|
2014-09-23 10:13:25 -07:00
|
|
|
if ((dev = calloc(1, sizeof(Ecore_Drm_Device))))
|
|
|
|
{
|
2016-01-11 12:43:12 -08:00
|
|
|
dev->drm.fd = -1;
|
2014-09-24 06:06:47 -07:00
|
|
|
dev->drm.name = eeze_udev_syspath_get_devpath(device);
|
|
|
|
dev->drm.path = eina_stringshare_add(device);
|
2014-03-06 01:43:48 -08:00
|
|
|
|
2014-09-24 06:06:47 -07:00
|
|
|
dev->id = eeze_udev_syspath_get_sysnum(device);
|
2014-03-06 01:43:48 -08:00
|
|
|
|
2014-09-24 06:06:47 -07:00
|
|
|
dev->seat = eeze_udev_syspath_get_property(device, "ID_SEAT");
|
2014-09-23 10:13:25 -07:00
|
|
|
if (!dev->seat) dev->seat = eina_stringshare_add("seat0");
|
2014-03-06 01:43:48 -08:00
|
|
|
|
2015-01-22 09:36:00 -08:00
|
|
|
dev->vt = 0;
|
2014-09-23 10:13:25 -07:00
|
|
|
dev->format = 0;
|
|
|
|
dev->use_hw_accel = EINA_FALSE;
|
2015-01-22 09:36:00 -08:00
|
|
|
dev->session = NULL;
|
2014-03-06 01:43:48 -08:00
|
|
|
|
2014-09-23 10:13:25 -07:00
|
|
|
DBG("Using Drm Device: %s", dev->drm.name);
|
ecore-drm: add ecore_drm_devices_get to get the list of drm devices
Summary:
when enlightenment is working as wayland display server, enlightenment
changes KDSETMODE to KD_GRAPHICS in _ecore_drm_tty_setup(). However,
when enlightenment is killed by SIGSEGV, it doesn't changes KDSETMODE
to KD_TEXT because englightenment process doesn't call ecore_drm_tty_close().
To make possible enlightenment call ecore_drm_tty_close(), drm devices
should be exposed.
When enlightenment is killed by SIGSEGV, it will get drm devices with
ecore_drm_device_get_list(), and will call ecore_drm_launcher_disconnect(),
and ecore_drm_launcher_disconnect will call ecore_drm_tty_close() internally.
@feature
Change-Id: I1c594739ec96660a09cee77b823ace6548ee5282
Reviewers: zmike, cedric, raster, gwanglim, devilhorns
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D2159
2015-03-17 06:30:59 -07:00
|
|
|
|
|
|
|
drm_devices = eina_list_append(drm_devices, dev);
|
2014-03-06 01:43:48 -08:00
|
|
|
}
|
|
|
|
|
2014-09-24 06:06:47 -07:00
|
|
|
out:
|
|
|
|
EINA_LIST_FREE(devs, device)
|
|
|
|
eina_stringshare_del(device);
|
2014-03-06 01:43:48 -08:00
|
|
|
|
|
|
|
return dev;
|
|
|
|
}
|
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API void
|
2014-03-06 01:43:48 -08:00
|
|
|
ecore_drm_device_free(Ecore_Drm_Device *dev)
|
|
|
|
{
|
2015-04-07 11:07:12 -07:00
|
|
|
unsigned int i = 0;
|
2014-03-06 01:43:48 -08:00
|
|
|
|
|
|
|
/* check for valid device */
|
|
|
|
if (!dev) return;
|
|
|
|
|
2015-04-07 11:07:12 -07:00
|
|
|
for (; i < ALEN(dev->dumb); i++)
|
|
|
|
{
|
|
|
|
if (dev->dumb[i]) ecore_drm_fb_destroy(dev->dumb[i]);
|
|
|
|
dev->dumb[i] = NULL;
|
|
|
|
}
|
2014-03-06 01:43:48 -08:00
|
|
|
|
2016-01-21 08:32:53 -08:00
|
|
|
if (dev->watch) eeze_udev_watch_del(dev->watch);
|
|
|
|
|
2014-03-06 01:43:48 -08:00
|
|
|
/* free crtcs */
|
|
|
|
if (dev->crtcs) free(dev->crtcs);
|
|
|
|
|
|
|
|
/* free device name */
|
|
|
|
if (dev->drm.name) eina_stringshare_del(dev->drm.name);
|
|
|
|
|
|
|
|
/* free device path */
|
|
|
|
if (dev->drm.path) eina_stringshare_del(dev->drm.path);
|
|
|
|
|
|
|
|
/* free device seat */
|
|
|
|
if (dev->seat) eina_stringshare_del(dev->seat);
|
|
|
|
|
2015-01-22 09:36:00 -08:00
|
|
|
/* free session */
|
|
|
|
free(dev->session);
|
|
|
|
|
ecore-drm: add ecore_drm_devices_get to get the list of drm devices
Summary:
when enlightenment is working as wayland display server, enlightenment
changes KDSETMODE to KD_GRAPHICS in _ecore_drm_tty_setup(). However,
when enlightenment is killed by SIGSEGV, it doesn't changes KDSETMODE
to KD_TEXT because englightenment process doesn't call ecore_drm_tty_close().
To make possible enlightenment call ecore_drm_tty_close(), drm devices
should be exposed.
When enlightenment is killed by SIGSEGV, it will get drm devices with
ecore_drm_device_get_list(), and will call ecore_drm_launcher_disconnect(),
and ecore_drm_launcher_disconnect will call ecore_drm_tty_close() internally.
@feature
Change-Id: I1c594739ec96660a09cee77b823ace6548ee5282
Reviewers: zmike, cedric, raster, gwanglim, devilhorns
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D2159
2015-03-17 06:30:59 -07:00
|
|
|
drm_devices = eina_list_remove(drm_devices, dev);
|
|
|
|
|
2014-03-06 01:43:48 -08:00
|
|
|
/* free structure */
|
|
|
|
free(dev);
|
|
|
|
}
|
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API Eina_Bool
|
2014-03-06 01:43:48 -08:00
|
|
|
ecore_drm_device_open(Ecore_Drm_Device *dev)
|
|
|
|
{
|
|
|
|
uint64_t caps;
|
2015-04-07 08:08:19 -07:00
|
|
|
int events = 0;
|
2015-10-30 13:00:32 -07:00
|
|
|
drmVersionPtr ver;
|
2014-03-06 01:43:48 -08:00
|
|
|
|
|
|
|
/* check for valid device */
|
|
|
|
if ((!dev) || (!dev->drm.name)) return EINA_FALSE;
|
|
|
|
|
2016-01-11 12:43:12 -08:00
|
|
|
/* check if device is already opened */
|
|
|
|
if (dev->drm.fd != -1)
|
|
|
|
{
|
|
|
|
ERR("Device is already opened");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-12-09 06:36:42 -08:00
|
|
|
/* DRM device node is needed immediately to keep going. */
|
2016-01-11 12:43:12 -08:00
|
|
|
dev->drm.fd =
|
2015-01-22 09:36:00 -08:00
|
|
|
_ecore_drm_launcher_device_open_no_pending(dev->drm.name, O_RDWR);
|
2014-03-06 01:43:48 -08:00
|
|
|
if (dev->drm.fd < 0) return EINA_FALSE;
|
|
|
|
|
|
|
|
DBG("Opened Device %s : %d", dev->drm.name, dev->drm.fd);
|
|
|
|
|
2015-10-30 13:00:32 -07:00
|
|
|
ver = drmGetVersion(dev->drm.fd);
|
|
|
|
if (ver)
|
|
|
|
{
|
|
|
|
DBG("\tDriver Name: %s", ver->name);
|
|
|
|
DBG("\tDriver Date: %s", ver->date);
|
|
|
|
DBG("\tDriver Description: %s", ver->desc);
|
|
|
|
DBG("\tDriver Version: %d.%d.%d",
|
|
|
|
ver->version_major, ver->version_minor,
|
|
|
|
ver->version_patchlevel);
|
|
|
|
drmFreeVersion(ver);
|
|
|
|
}
|
|
|
|
|
2015-05-06 08:31:57 -07:00
|
|
|
/* set client capabilities to 'universal planes' so drm core will expose
|
|
|
|
* the full universal plane list (including primary & cursor planes) */
|
|
|
|
drmSetClientCap(dev->drm.fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
|
|
|
|
|
2014-03-06 01:43:48 -08:00
|
|
|
if (!drmGetCap(dev->drm.fd, DRM_CAP_TIMESTAMP_MONOTONIC, &caps))
|
|
|
|
{
|
|
|
|
if (caps == 1)
|
|
|
|
dev->drm.clock = CLOCK_MONOTONIC;
|
|
|
|
else
|
|
|
|
dev->drm.clock = CLOCK_REALTIME;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-06-27 06:30:35 -07:00
|
|
|
ERR("Could not get TIMESTAMP_MONOTONIC device capabilities: %m");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Without DUMB_BUFFER we can't do software rendering on DRM. Fail without it
|
|
|
|
* until we have rock solid hardware accelerated DRM on all drivers */
|
|
|
|
if (drmGetCap(dev->drm.fd, DRM_CAP_DUMB_BUFFER, &caps) < 0 || !caps)
|
|
|
|
{
|
|
|
|
ERR("Could not get DUMB_BUFFER device capabilities: %m");
|
|
|
|
return EINA_FALSE;
|
2014-03-06 01:43:48 -08:00
|
|
|
}
|
|
|
|
|
2014-03-10 02:56:24 -07:00
|
|
|
/* try to create xkb context */
|
ecore-drm: Add a new API for keymap cache
Summary:
Originally, each keyboard devices could have their own keymap.
The one keyboard's keymap could different with others.
But for this, Ecore_Drm compile a new keymap when a keyboard is connected.
But this is a burden for some people who doesn't manage keymap for each keyboard.
They want to maintain only one keymap for system.
So, I added cached context/keymap and just ref/unref for each keyboard device.
People who want to different keymap for each keyboard just do not set cached
context/keymap. Then Ecore_Drm maintain keymaps about each keyboard devices.
Test Plan:
Connect a keyboard device and watch flow of ioctl.
Originally Ecore_Drm opened xkb data and compile keymap,
but after patch, that ioctl is disppeared.
@feature
Reviewers: raster, devilhorns, ManMower
Reviewed By: devilhorns, ManMower
Subscribers: cedric, input.hacker, ohduna, jpeg
Differential Revision: https://phab.enlightenment.org/D3503
2016-01-04 05:47:43 -08:00
|
|
|
if (!(dev->xkb_ctx = _ecore_drm_device_cached_context_get(0)))
|
2014-03-10 02:56:24 -07:00
|
|
|
{
|
2016-01-14 10:05:55 -08:00
|
|
|
ERR("Failed to create xkb context");
|
2014-03-10 02:56:24 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2015-04-07 11:30:43 -07:00
|
|
|
memset(&dev->drm_ctx, 0, sizeof(dev->drm_ctx));
|
|
|
|
dev->drm_ctx.version = DRM_EVENT_CONTEXT_VERSION;
|
|
|
|
dev->drm_ctx.page_flip_handler = _ecore_drm_device_cb_page_flip;
|
|
|
|
dev->drm_ctx.vblank_handler = _ecore_drm_device_cb_vblank;
|
|
|
|
|
2015-04-07 08:08:19 -07:00
|
|
|
events = (EEZE_UDEV_EVENT_ADD | EEZE_UDEV_EVENT_REMOVE |
|
|
|
|
EEZE_UDEV_EVENT_CHANGE);
|
|
|
|
|
|
|
|
dev->watch =
|
|
|
|
eeze_udev_watch_add(EEZE_UDEV_TYPE_DRM, events,
|
2015-04-16 07:51:56 -07:00
|
|
|
_ecore_drm_device_cb_output_event, dev);
|
2015-04-07 08:08:19 -07:00
|
|
|
|
2016-02-18 11:22:19 -08:00
|
|
|
dev->drm.hdlr =
|
|
|
|
ecore_main_fd_handler_add(dev->drm.fd, ECORE_FD_READ,
|
|
|
|
_cb_drm_event_handle, dev, NULL, NULL);
|
|
|
|
|
2015-04-08 10:50:50 -07:00
|
|
|
/* dev->drm.idler = */
|
|
|
|
/* ecore_idle_enterer_add(_ecore_drm_device_cb_idle, dev); */
|
2014-03-06 01:43:48 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API Eina_Bool
|
2014-03-06 01:43:48 -08:00
|
|
|
ecore_drm_device_close(Ecore_Drm_Device *dev)
|
|
|
|
{
|
|
|
|
/* check for valid device */
|
2015-04-24 09:51:34 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(dev, EINA_FALSE);
|
2014-03-06 01:43:48 -08:00
|
|
|
|
2016-01-11 12:43:12 -08:00
|
|
|
/* check if device is opened */
|
|
|
|
if (dev->drm.fd == -1) return EINA_FALSE;
|
|
|
|
|
2015-04-07 08:08:19 -07:00
|
|
|
/* delete udev watch */
|
|
|
|
if (dev->watch) eeze_udev_watch_del(dev->watch);
|
2016-01-21 08:32:53 -08:00
|
|
|
dev->watch = NULL;
|
2015-04-07 08:08:19 -07:00
|
|
|
|
2014-03-10 02:56:24 -07:00
|
|
|
/* close xkb context */
|
|
|
|
if (dev->xkb_ctx) xkb_context_unref(dev->xkb_ctx);
|
2016-01-21 08:32:53 -08:00
|
|
|
dev->xkb_ctx = NULL;
|
2014-03-10 02:56:24 -07:00
|
|
|
|
2014-12-09 06:36:42 -08:00
|
|
|
_ecore_drm_launcher_device_close(dev->drm.name, dev->drm.fd);
|
2014-03-06 01:43:48 -08:00
|
|
|
|
|
|
|
/* reset device fd */
|
|
|
|
dev->drm.fd = -1;
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API const Eina_List *
|
ecore-drm: add ecore_drm_devices_get to get the list of drm devices
Summary:
when enlightenment is working as wayland display server, enlightenment
changes KDSETMODE to KD_GRAPHICS in _ecore_drm_tty_setup(). However,
when enlightenment is killed by SIGSEGV, it doesn't changes KDSETMODE
to KD_TEXT because englightenment process doesn't call ecore_drm_tty_close().
To make possible enlightenment call ecore_drm_tty_close(), drm devices
should be exposed.
When enlightenment is killed by SIGSEGV, it will get drm devices with
ecore_drm_device_get_list(), and will call ecore_drm_launcher_disconnect(),
and ecore_drm_launcher_disconnect will call ecore_drm_tty_close() internally.
@feature
Change-Id: I1c594739ec96660a09cee77b823ace6548ee5282
Reviewers: zmike, cedric, raster, gwanglim, devilhorns
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D2159
2015-03-17 06:30:59 -07:00
|
|
|
ecore_drm_devices_get(void)
|
|
|
|
{
|
|
|
|
return drm_devices;
|
|
|
|
}
|
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API Eina_Bool
|
2014-03-06 01:43:48 -08:00
|
|
|
ecore_drm_device_master_get(Ecore_Drm_Device *dev)
|
|
|
|
{
|
2014-07-15 06:38:25 -07:00
|
|
|
drm_magic_t mag;
|
2014-03-06 01:43:48 -08:00
|
|
|
|
|
|
|
/* check for valid device */
|
|
|
|
if ((!dev) || (dev->drm.fd < 0)) return EINA_FALSE;
|
|
|
|
|
|
|
|
/* get if we are master or not */
|
2020-06-20 02:43:56 -07:00
|
|
|
if ((drmGetMagic(dev->drm.fd, &mag) == 0) &&
|
2014-07-15 06:38:25 -07:00
|
|
|
(drmAuthMagic(dev->drm.fd, mag) == 0))
|
|
|
|
return EINA_TRUE;
|
2014-03-06 01:43:48 -08:00
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API Eina_Bool
|
2014-03-06 01:43:48 -08:00
|
|
|
ecore_drm_device_master_set(Ecore_Drm_Device *dev)
|
|
|
|
{
|
|
|
|
/* check for valid device */
|
|
|
|
if ((!dev) || (dev->drm.fd < 0)) return EINA_FALSE;
|
|
|
|
|
|
|
|
DBG("Set Master On Fd: %d", dev->drm.fd);
|
|
|
|
|
2014-07-15 06:38:25 -07:00
|
|
|
drmSetMaster(dev->drm.fd);
|
2014-03-06 01:43:48 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API Eina_Bool
|
2014-03-06 01:43:48 -08:00
|
|
|
ecore_drm_device_master_drop(Ecore_Drm_Device *dev)
|
|
|
|
{
|
|
|
|
/* check for valid device */
|
|
|
|
if ((!dev) || (dev->drm.fd < 0)) return EINA_FALSE;
|
|
|
|
|
|
|
|
DBG("Drop Master On Fd: %d", dev->drm.fd);
|
|
|
|
|
2014-07-15 06:38:25 -07:00
|
|
|
drmDropMaster(dev->drm.fd);
|
2014-03-06 01:43:48 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API int
|
2014-03-06 01:43:48 -08:00
|
|
|
ecore_drm_device_fd_get(Ecore_Drm_Device *dev)
|
|
|
|
{
|
2015-04-24 09:51:34 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(dev, -1);
|
2014-03-06 01:43:48 -08:00
|
|
|
return dev->drm.fd;
|
|
|
|
}
|
2014-03-10 05:36:21 -07:00
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API void
|
2014-03-18 00:24:32 -07:00
|
|
|
ecore_drm_device_window_set(Ecore_Drm_Device *dev, unsigned int window)
|
2014-03-10 05:36:21 -07:00
|
|
|
{
|
|
|
|
/* check for valid device */
|
2015-04-24 09:51:34 -07:00
|
|
|
EINA_SAFETY_ON_TRUE_RETURN((!dev) || (dev->drm.fd < 0));
|
2014-03-10 05:36:21 -07:00
|
|
|
|
|
|
|
dev->window = window;
|
|
|
|
}
|
2014-03-12 02:26:43 -07:00
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API const char *
|
2014-03-12 02:26:43 -07:00
|
|
|
ecore_drm_device_name_get(Ecore_Drm_Device *dev)
|
|
|
|
{
|
|
|
|
/* check for valid device */
|
2015-04-24 09:51:34 -07:00
|
|
|
EINA_SAFETY_ON_TRUE_RETURN_VAL((!dev) || (dev->drm.fd < 0), NULL);
|
2014-03-12 02:26:43 -07:00
|
|
|
|
|
|
|
return dev->drm.name;
|
|
|
|
}
|
2015-03-04 08:46:22 -08:00
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API void
|
2015-03-04 08:46:22 -08:00
|
|
|
ecore_drm_device_pointer_xy_get(Ecore_Drm_Device *dev, int *x, int *y)
|
|
|
|
{
|
|
|
|
Ecore_Drm_Seat *seat;
|
|
|
|
Ecore_Drm_Evdev *edev;
|
|
|
|
Eina_List *l, *ll;
|
|
|
|
|
|
|
|
if (x) *x = 0;
|
|
|
|
if (y) *y = 0;
|
|
|
|
|
|
|
|
/* check for valid device */
|
2015-04-24 09:51:34 -07:00
|
|
|
EINA_SAFETY_ON_TRUE_RETURN((!dev) || (dev->drm.fd < 0));
|
2015-03-04 08:46:22 -08:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(dev->seats, l, seat)
|
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(seat->devices, ll, edev)
|
|
|
|
{
|
ecore-drm: Add logical pointer x, y variable in seat for reflecting multiple pointer's movement
Summary: When one pointer moves, we should update the position of other devices.
Test Plan:
(1) Two pointer devices are connected.
(2) Move the cursor to (x, y) position using "device 1".
(3) When you move the cursor using "device 2", the cursor doesn't start from (x, y) position. This causes discontinuous mouse motion.
Reviewers: raster, zmike, gwanglim, stefan_schmidt, devilhorns, ManMower
Reviewed By: devilhorns, ManMower
Subscribers: cedric, Jeon, input.hacker, jpeg
Differential Revision: https://phab.enlightenment.org/D3384
2015-11-30 08:05:07 -08:00
|
|
|
if (!libinput_device_has_capability(edev->device,
|
2015-03-04 08:46:22 -08:00
|
|
|
LIBINPUT_DEVICE_CAP_POINTER))
|
|
|
|
continue;
|
|
|
|
|
ecore-drm: Add logical pointer x, y variable in seat for reflecting multiple pointer's movement
Summary: When one pointer moves, we should update the position of other devices.
Test Plan:
(1) Two pointer devices are connected.
(2) Move the cursor to (x, y) position using "device 1".
(3) When you move the cursor using "device 2", the cursor doesn't start from (x, y) position. This causes discontinuous mouse motion.
Reviewers: raster, zmike, gwanglim, stefan_schmidt, devilhorns, ManMower
Reviewed By: devilhorns, ManMower
Subscribers: cedric, Jeon, input.hacker, jpeg
Differential Revision: https://phab.enlightenment.org/D3384
2015-11-30 08:05:07 -08:00
|
|
|
if (x) *x = seat->ptr.dx;
|
|
|
|
if (y) *y = seat->ptr.dy;
|
2015-03-04 08:46:22 -08:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-04-07 11:07:12 -07:00
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API void
|
2016-01-25 14:20:18 -08:00
|
|
|
ecore_drm_device_pointer_warp(Ecore_Drm_Device *dev, int x, int y)
|
|
|
|
{
|
|
|
|
Ecore_Drm_Seat *seat;
|
|
|
|
Ecore_Drm_Evdev *edev;
|
|
|
|
Eina_List *l, *ll;
|
|
|
|
|
|
|
|
/* check for valid device */
|
|
|
|
EINA_SAFETY_ON_TRUE_RETURN((!dev) || (dev->drm.fd < 0));
|
|
|
|
EINA_LIST_FOREACH(dev->seats, l, seat)
|
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(seat->devices, ll, edev)
|
|
|
|
{
|
|
|
|
if (!libinput_device_has_capability(edev->device,
|
|
|
|
LIBINPUT_DEVICE_CAP_POINTER))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
seat->ptr.dx = seat->ptr.ix = x;
|
|
|
|
seat->ptr.dy = seat->ptr.iy = y;
|
|
|
|
_ecore_drm_pointer_motion_post(edev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API Eina_Bool
|
2015-04-07 11:07:12 -07:00
|
|
|
ecore_drm_device_software_setup(Ecore_Drm_Device *dev)
|
|
|
|
{
|
|
|
|
unsigned int i = 0;
|
|
|
|
int w = 0, h = 0;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(dev, EINA_FALSE);
|
|
|
|
|
|
|
|
/* destroy any old buffers */
|
|
|
|
for (; i < ALEN(dev->dumb); i++)
|
|
|
|
{
|
|
|
|
if (dev->dumb[i]) ecore_drm_fb_destroy(dev->dumb[i]);
|
|
|
|
dev->dumb[i] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get screen size */
|
|
|
|
ecore_drm_outputs_geometry_get(dev, NULL, NULL, &w, &h);
|
|
|
|
|
|
|
|
/* create new buffers */
|
|
|
|
for (i = 0; i < ALEN(dev->dumb); i++)
|
|
|
|
{
|
|
|
|
if (!(dev->dumb[i] = ecore_drm_fb_create(dev, w, h)))
|
|
|
|
{
|
2016-01-14 10:05:55 -08:00
|
|
|
ERR("Could not create dumb framebuffer");
|
2015-04-07 11:07:12 -07:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
DBG("Ecore_Drm_Device Created Dumb Buffer");
|
|
|
|
DBG("\tFb: %d", dev->dumb[i]->id);
|
|
|
|
DBG("\tHandle: %d", dev->dumb[i]->hdl);
|
|
|
|
DBG("\tStride: %d", dev->dumb[i]->stride);
|
|
|
|
DBG("\tSize: %d", dev->dumb[i]->size);
|
|
|
|
DBG("\tW: %d\tH: %d", dev->dumb[i]->w, dev->dumb[i]->h);
|
|
|
|
}
|
2016-02-18 11:22:19 -08:00
|
|
|
_ecore_drm_tick_source_set(dev);
|
2015-04-07 11:07:12 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
err:
|
|
|
|
for (i = 0; i < ALEN(dev->dumb); i++)
|
|
|
|
{
|
|
|
|
if (dev->dumb[i]) ecore_drm_fb_destroy(dev->dumb[i]);
|
|
|
|
dev->dumb[i] = NULL;
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2015-04-08 07:41:26 -07:00
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API Ecore_Drm_Output *
|
2015-04-08 07:41:26 -07:00
|
|
|
ecore_drm_device_output_find(Ecore_Drm_Device *dev, int x, int y)
|
|
|
|
{
|
|
|
|
Ecore_Drm_Output *output;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(dev, NULL);
|
2015-04-24 09:51:34 -07:00
|
|
|
EINA_SAFETY_ON_TRUE_RETURN_VAL((x < 0) || (y < 0), NULL);
|
2015-04-08 07:41:26 -07:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(dev->outputs, l, output)
|
|
|
|
{
|
|
|
|
int ox = 0, oy = 0;
|
|
|
|
int ow = 0, oh = 0;
|
|
|
|
|
|
|
|
if (!output->cloned)
|
|
|
|
{
|
|
|
|
ox = output->x;
|
|
|
|
oy = output->y;
|
|
|
|
}
|
|
|
|
|
|
|
|
ow = output->current_mode->width;
|
|
|
|
oh = output->current_mode->height;
|
|
|
|
|
|
|
|
if (INSIDE(x, y, ox, oy, ow, oh))
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2015-05-04 10:25:15 -07:00
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API void
|
2015-05-04 10:25:15 -07:00
|
|
|
ecore_drm_screen_size_range_get(Ecore_Drm_Device *dev, int *minw, int *minh, int *maxw, int *maxh)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(dev);
|
|
|
|
|
|
|
|
if (minw) *minw = dev->min_width;
|
|
|
|
if (minh) *minh = dev->min_height;
|
|
|
|
if (maxw) *maxw = dev->max_width;
|
|
|
|
if (maxh) *maxh = dev->max_height;
|
|
|
|
}
|
2015-05-07 08:31:46 -07:00
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API Ecore_Drm_Output *
|
2015-05-07 08:31:46 -07:00
|
|
|
ecore_drm_device_output_name_find(Ecore_Drm_Device *dev, const char *name)
|
|
|
|
{
|
|
|
|
Ecore_Drm_Output *output;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(dev, NULL);
|
2015-05-07 08:37:54 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL);
|
2015-05-07 08:31:46 -07:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(dev->outputs, l, output)
|
|
|
|
if ((output->name) && (!strcmp(name, output->name)))
|
|
|
|
return output;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2015-12-29 06:03:43 -08:00
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API Eina_Bool
|
2015-12-29 06:03:43 -08:00
|
|
|
ecore_drm_device_pointer_left_handed_set(Ecore_Drm_Device *dev, Eina_Bool left_handed)
|
|
|
|
{
|
|
|
|
Ecore_Drm_Seat *seat = NULL;
|
|
|
|
Ecore_Drm_Evdev *edev = NULL;
|
|
|
|
Eina_List *l = NULL, *l2 = NULL;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(dev, EINA_FALSE);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(dev->seats, EINA_FALSE);
|
|
|
|
|
|
|
|
if (dev->left_handed == left_handed)
|
|
|
|
return EINA_TRUE;
|
|
|
|
dev->left_handed = !!left_handed;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(dev->seats, l, seat)
|
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(seat->devices, l2, edev)
|
|
|
|
{
|
|
|
|
if (libinput_device_has_capability(edev->device,
|
|
|
|
LIBINPUT_DEVICE_CAP_POINTER))
|
|
|
|
{
|
|
|
|
if (libinput_device_config_left_handed_set(edev->device, (int)left_handed) !=
|
|
|
|
LIBINPUT_CONFIG_STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
WRN("Failed to set left hand mode about device: %s\n",
|
|
|
|
libinput_device_get_name(edev->device));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
ecore-drm: Add a new API for keymap cache
Summary:
Originally, each keyboard devices could have their own keymap.
The one keyboard's keymap could different with others.
But for this, Ecore_Drm compile a new keymap when a keyboard is connected.
But this is a burden for some people who doesn't manage keymap for each keyboard.
They want to maintain only one keymap for system.
So, I added cached context/keymap and just ref/unref for each keyboard device.
People who want to different keymap for each keyboard just do not set cached
context/keymap. Then Ecore_Drm maintain keymaps about each keyboard devices.
Test Plan:
Connect a keyboard device and watch flow of ioctl.
Originally Ecore_Drm opened xkb data and compile keymap,
but after patch, that ioctl is disppeared.
@feature
Reviewers: raster, devilhorns, ManMower
Reviewed By: devilhorns, ManMower
Subscribers: cedric, input.hacker, ohduna, jpeg
Differential Revision: https://phab.enlightenment.org/D3503
2016-01-04 05:47:43 -08:00
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API void
|
ecore-drm: Add a new API for keymap cache
Summary:
Originally, each keyboard devices could have their own keymap.
The one keyboard's keymap could different with others.
But for this, Ecore_Drm compile a new keymap when a keyboard is connected.
But this is a burden for some people who doesn't manage keymap for each keyboard.
They want to maintain only one keymap for system.
So, I added cached context/keymap and just ref/unref for each keyboard device.
People who want to different keymap for each keyboard just do not set cached
context/keymap. Then Ecore_Drm maintain keymaps about each keyboard devices.
Test Plan:
Connect a keyboard device and watch flow of ioctl.
Originally Ecore_Drm opened xkb data and compile keymap,
but after patch, that ioctl is disppeared.
@feature
Reviewers: raster, devilhorns, ManMower
Reviewed By: devilhorns, ManMower
Subscribers: cedric, input.hacker, ohduna, jpeg
Differential Revision: https://phab.enlightenment.org/D3503
2016-01-04 05:47:43 -08:00
|
|
|
ecore_drm_device_keyboard_cached_context_set(struct xkb_context *ctx)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(ctx);
|
|
|
|
|
|
|
|
if (cached_context == ctx) return;
|
|
|
|
|
|
|
|
if (cached_context)
|
|
|
|
_ecore_drm_device_cached_context_update(ctx);
|
|
|
|
|
|
|
|
cached_context = ctx;
|
|
|
|
}
|
|
|
|
|
2020-10-15 11:48:08 -07:00
|
|
|
ECORE_DRM_API void
|
ecore-drm: Add a new API for keymap cache
Summary:
Originally, each keyboard devices could have their own keymap.
The one keyboard's keymap could different with others.
But for this, Ecore_Drm compile a new keymap when a keyboard is connected.
But this is a burden for some people who doesn't manage keymap for each keyboard.
They want to maintain only one keymap for system.
So, I added cached context/keymap and just ref/unref for each keyboard device.
People who want to different keymap for each keyboard just do not set cached
context/keymap. Then Ecore_Drm maintain keymaps about each keyboard devices.
Test Plan:
Connect a keyboard device and watch flow of ioctl.
Originally Ecore_Drm opened xkb data and compile keymap,
but after patch, that ioctl is disppeared.
@feature
Reviewers: raster, devilhorns, ManMower
Reviewed By: devilhorns, ManMower
Subscribers: cedric, input.hacker, ohduna, jpeg
Differential Revision: https://phab.enlightenment.org/D3503
2016-01-04 05:47:43 -08:00
|
|
|
ecore_drm_device_keyboard_cached_keymap_set(struct xkb_keymap *map)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(map);
|
|
|
|
|
|
|
|
if (cached_keymap == map) return;
|
|
|
|
|
|
|
|
if (cached_keymap)
|
|
|
|
_ecore_drm_device_cached_keymap_update(map);
|
|
|
|
|
|
|
|
cached_keymap = map;
|
|
|
|
}
|