forked from enlightenment/efl
elput: Fix multiple open/close of drm devices
When I added the code to probe drm devices to ensure they're
modeset capable (ref 414d406b3b
)
I didn't realize elput didn't allow us to open and close more than
one drm device at startup without blowing up libinput.
This is a somewhat dirty hack to rough that in.
The problem is that open/close the device during startup will
result in an async "gone" callback from logind, which then kicks
off an input shutdown. We need to try harder to only do that
shutdown when it makes sense.
This commit is contained in:
parent
aae4d21b63
commit
27f88b534a
|
@ -84,6 +84,7 @@ _cb_device_paused(void *data, const Eldbus_Message *msg)
|
|||
uint32_t maj, min;
|
||||
|
||||
em = data;
|
||||
if (!em->drm_opens) return;
|
||||
|
||||
if (eldbus_message_error_get(msg, &errname, &errmsg))
|
||||
{
|
||||
|
@ -93,6 +94,20 @@ _cb_device_paused(void *data, const Eldbus_Message *msg)
|
|||
|
||||
if (eldbus_message_arguments_get(msg, "uus", &maj, &min, &type))
|
||||
{
|
||||
/* If we opened a device during probing then we're still going
|
||||
* to get a "gone" callback when we release it, so we'd better
|
||||
* eat that instead of treating it like losing the drm device
|
||||
* we currently have open, and crapping up libinput's internals
|
||||
* for a nice deferred explosion at shutdown...
|
||||
*
|
||||
* FIXME: do this better?
|
||||
*/
|
||||
if ((em->drm_opens > 1) && (maj == 226) && !strcmp(type, "gone"))
|
||||
{
|
||||
em->drm_opens--;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strcmp(type, "pause"))
|
||||
_logind_device_pause_complete(em, maj, min);
|
||||
|
||||
|
@ -607,6 +622,9 @@ _logind_open(Elput_Manager *em, const char *path, int flags)
|
|||
fd = _logind_device_take(em, major(st.st_rdev), minor(st.st_rdev));
|
||||
if (fd < 0) return fd;
|
||||
|
||||
if (major(st.st_rdev) == 226) //DRM_MAJOR
|
||||
em->drm_opens++;
|
||||
|
||||
fl = fcntl(fd, F_GETFL);
|
||||
if (fl < 0) goto err;
|
||||
|
||||
|
|
|
@ -279,6 +279,8 @@ struct _Elput_Manager
|
|||
} cached;
|
||||
int output_w, output_h;
|
||||
|
||||
int drm_opens;
|
||||
|
||||
Elput_Input input;
|
||||
Eina_Bool del : 1;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue