Seunghun Lee [Mon, 13 Feb 2023 23:27:51 +0000 (08:27 +0900)]
client: Remove struct wl_thread_data
The wl_thread_data was introduced to prevent deadlock as explained by
the following commit message.
Since the problem described by the commit message seems to have
disappeared, let's remove it and observe the results.
If we decided to keep this code, we will need to add a reference count
mechanism or something to prevent use after free and memory leaks. I
believe this code will only add complexity and increase the likelihood
of errors.
Wayland specification says clearly that if a thread successfully calls
wl_display_prepare_read_queue(), it must either call
wl_display_read_events() when it's ready or cancel the read intention by
calling wl_display_cancel_read().
So even if a deadlock occur again around this APIs, I believe we should
still handle it as the application's responsibility.
commit
409d548f6d3b43b8a4991619c3effeeed809f789
Author: Boram Park <boram1288.park@samsung.com>
Date: Fri Apr 8 08:14:42 2016 +0900
client: use the thread reader_count to fix deadlock.
Let's see the below scenario.
1. A thread polls several fds including the wayland's fd.
2. This thread probably calls wl_display_prepare_read()
before polling fds.
3. This thread could be awake by other event source which
isn't related with wayland fd.
4. After wake up, this thread could call wl_display_dispatch
or wl_display_roundtrip for sync operation.
Then, when this thread got a done event. this thread will fall
in deadlock because this thread increases +2 reader_count in the
sam thread. The read_event or cancel_read for the first
prepare_read is not going to happen because this thread sleeps
in pthread_cond_wait() line of read_event.
This problem can be solved by using the reader_count per thread.
The reader_count of thread will be increased/decreased whenever
prepare_read, cancel_read and read_event are called.
However, the original reader_count of display will be increased
only once per thread. And, when cancel_read and read_event are
called, it will be decreased to read event from fd and wake up
other threads. And that, if the thread reader_count is still
more than 0, it will be increased because it means the thread
is still polling in somewhere.
Change-Id: I2e881a6222e5ad380ace7a6d9571d5463cf701d9
Change-Id: Id77a4468fafaafe0fa79fbe186767adb8b09cde1
Junkyeong Kim [Thu, 16 Feb 2023 11:46:27 +0000 (20:46 +0900)]
Packaging: upgrade to 1.21.0
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
Junkyeong Kim [Thu, 16 Feb 2023 11:44:20 +0000 (20:44 +0900)]
cursor: Fix build error by unmatching function name
Seunghun Lee [Thu, 10 Nov 2022 09:58:52 +0000 (18:58 +0900)]
Log creating and destroying of queue for debugging
Crashes has been observed several times in libwayland-client.so with the
following backtrace.
#0 0x44ff4b56 in wl_list_insert (list=0xb1c03678, elm=elm@entry=0x207c1f8) at /usr/src/debug/wayland-1.20.0/builddir/../src/wayland-util.c:60
#1 0x44ff6de0 in queue_event (len=8, display=<optimized out>) at /usr/src/debug/wayland-1.20.0/builddir/../src/wayland-client.c:1940
#2 read_events (display=0x20733b0) at /usr/src/debug/wayland-1.20.0/builddir/../src/wayland-client.c:2184
#3 wl_display_read_events (display=0x20733b0) at /usr/src/debug/wayland-1.20.0/builddir/../src/wayland-client.c:2380
...
I've tried to investigate it and I suppose there is high possibility
that somewhere using libwayland-client could destroy a wl_event_queue
first before all wayland proxies that the queue is associated with.
So, this patch adds log message in where creating and destroying a queue
in the hope that it would help us find the cause of problem next time.
Change-Id: If6a35ec738c2cf88b9ef7dea46bcd1b2fb4821ba
Joonbum Ko [Thu, 22 Sep 2022 09:43:24 +0000 (18:43 +0900)]
wayland-client: add missed mutex_destroy for threads_mutex
Change-Id: I088b3fbd64a3a077f832f5e4bc70e17f2915d9fa
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
SooChan Lim [Wed, 29 Dec 2021 05:48:00 +0000 (14:48 +0900)]
print thread_count under display->threads_mutex
Change-Id: I179e0690ada8da7e216c49cf7e10daebcd0c1eef
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Wed, 29 Dec 2021 02:06:04 +0000 (11:06 +0900)]
wayland-client: add mutex protection to destroy_thread_data
In multi threads situation,
at the same time that the newly created thread performs
wl_list_for_each_safe() in get_thread_data(),
the destroyed thread may cause a conflict problem
in an attempt to erase its link with wl_list_remove.
Added threads_mutex to struct wl_display to protect
accessing display->threads.
Change-Id: I673c3f9a63794d514e871839049257425bd06bc2
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Seunghun Lee [Thu, 22 Sep 2022 06:58:47 +0000 (15:58 +0900)]
Revert two commits as an attempt to avoid crash
This reverts following two commits.
"wayland-client: Delete pthread_key before iterating thread_data"
commit
c4a2e5dbe2d6d371de814c24b578e9d3196ec971.
"wayland-client: Destroy all thread data on disconnect"
commit
d5f09227a4d62c48ade0905be13b4645fde02cd0.
And this is the backtrace.
(gdb)bt full
0 0xb56937f8 in wl_list_remove (elm=elm@entry=0xa40520) at
/usr/src/debug/wayland-1.20.0/builddir/../src/wayland-util.c:67
No locals.
1 0xb5693a86 in destroy_thread_data (data=0xa40520) at
/usr/src/debug/wayland-1.20.0/builddir/../src/wayland-client.c:1195
display = 0x913d80
thread_data = 0xa40520
__PRETTY_FUNCTION__ = "destroy_thread_data"
2 0xb5e1634c in __nptl_deallocate_tsd () at
/usr/src/debug/glibc-2.30/nptl/pthread_create.c:301
data = <optimized out>
inner = <optimized out>
level2 = 0x9b9731ac
idx = <optimized out>
round = 0
cnt = <optimized out>
self = 0x9b973120
3 0xb5e164d4 in start_thread (arg=0x9b973120) at
/usr/src/debug/glibc-2.30/nptl/pthread_create.c:490
pd = 0x9b973120
unwind_buf = {cancel_jmp_buf = {{jmp_buf = {
1530611246,
1967982998, -
1684590304, -
1552949728, -
1552943648, 338, -
1552949818, 0,
-
1684590304, -
1684591524, 0 <repeats 54 times>}, mask_was_saved = 0}},
priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0,
canceltype = 0}}}
not_first_call = <optimized out>
4 0xb5f3c988 in __inet_pton_length () at
/usr/src/debug/glibc-2.30/misc/../sysdeps/unix/sysv/linux/arm/clone.S:73
No locals.
5 0x00000000 in ?? ()
Not sure this crash happened because of the patches to be reverted but
let just the leak happen and let's see if crash happen again.
Change-Id: I478fe965ae5b633039b31e103203c733948abda1
Seunghun Lee [Wed, 8 Jun 2022 10:06:39 +0000 (19:06 +0900)]
wayland-client: Delete pthread_key before iterating thread_data
As iterating the list of thread_data on disconnect, if a thread_data
referred by 'th_data_next' got freed by a thread exiting, then illegal
access would have happened.
To prevent destroy_thread_data() from calling by a thread exiting while
iterating the list of thread_data, this patch deletes pthread_key before
iterating the list.
Change-Id: I1b1616ec02bd3a7a45157b51e1913f9fea79388f
Seunghun Lee [Wed, 27 Apr 2022 07:01:47 +0000 (16:01 +0900)]
wayland-client: Destroy all thread data on disconnect
This fixes memory leak.
The leak could be observed if you call wl_display_disconnect() from
a different thread than the thread that creates wl_display object
calling wl_display_connect().
That's because the thread-specific object which is created at
wl_display_connect would remain permanently not being destroyed.
Since thread-specific data key is also deleted at wl_display_disconnect,
we can't rely on an associated destructor of thread-specific data key.
So, all associated thread data should be destroyed along with a
wl_display.
Change-Id: Icb363b8895d5618868c8332c469ee09343a12814
Junseok Kim [Wed, 16 Feb 2022 05:57:22 +0000 (14:57 +0900)]
Packaging: upgrade to 1.20.0
Change-Id: I55f15e741325061e4e9fec3e8e8053c5c278dcf0
Junseok Kim [Fri, 11 Feb 2022 05:07:38 +0000 (14:07 +0900)]
wayland-shm: fix build warning
Change-Id: If0a5cde6254bfcedacaa3e20e89ee0dad55b450f
Junseok Kim [Fri, 11 Feb 2022 05:06:08 +0000 (14:06 +0900)]
xcursor: fix memory leak
Change-Id: I6739a6c95c2f8e479d906fd47bf6ad67fb125bc2
Signed-off-by: Junseok Kim <juns.kim@samsung.com>
Sung-Jin Park [Mon, 20 Dec 2021 06:40:15 +0000 (15:40 +0900)]
wayland-client: cleanup thread specific data when disconnect, leave logs
Change-Id: I04e4ed9265bc9b3377c683ec891069060e85143c
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Sung-Jin Park [Wed, 8 Dec 2021 04:22:37 +0000 (13:22 +0900)]
wayland-client: init a thread_data item before insert to a list
Change-Id: Ib03c2bbbc454a383ab5abdc9504457cee041310f
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Sung-Jin Park [Tue, 7 Dec 2021 11:17:04 +0000 (20:17 +0900)]
wayland-client: fix to check if thread_data is valid before accessing it
Change-Id: Id620472d91f5e493a4de77538ef5e49a3966cefb
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Changyeon Lee [Fri, 19 Mar 2021 03:00:01 +0000 (12:00 +0900)]
fix null dereference
Change-Id: Id9961fd6d504fd389059b6b9739b33de3b2ed7af
Changyeon Lee [Wed, 10 Mar 2021 10:28:46 +0000 (19:28 +0900)]
wayland-client : do not abort when there is an EBADF error on marshalling request
wayland-tbm create wl_buffer with fd but it is sometimes failed because
fd duplication is failed with EBADF error.
we guess another thread close fd of wayland-tbm.
wayland-tbm retry to create wl_buffer with key when it is failed with fd
but process is aborted in wayland-client.
so this patch allows wayland-tbm create wl_buffer proxy with key
when fd duplication is failed in wayland-client.
Change-Id: Id56e0ff87784678a5a192a0bc6f0aabae39da5df
Sung-Jin Park [Mon, 11 Jan 2021 22:52:52 +0000 (07:52 +0900)]
Packaging: remove TODO from %doc
Change-Id: Ie13a3c337a5e94b04706d0ee2fbb75a400823d99
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Joonbum Ko [Thu, 3 Sep 2020 04:36:31 +0000 (13:36 +0900)]
wayland-client: handled case where pthread_setspecific failed.
- The thread_data of wayland-client is managed in
pthread specific and wl_list.
- When pthread_setspecific fails, the returned
error number will be printed.
- If pthread_setspecific fails, pthread_getspecific
in get_thread_data called next will also return null,
but thread_data has been registered in wl_list.
- In that case, it should be able to use thread_data in wl_list.
Change-Id: Ib4e436427715d0cc23bdcf0d8b6417212530803d
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Sung-Jin Park [Tue, 28 Jul 2020 09:26:52 +0000 (18:26 +0900)]
wayland-util: calls wl_log_handler only when dlog is not available or when there is new wl_log_handler set
Change-Id: If3ebe372467d528f96554790de9defb657b710f8
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Junkyeong Kim [Mon, 20 Jul 2020 08:59:17 +0000 (17:59 +0900)]
wayland-client: add NULL check
Change-Id: Iceba83f91a51ca000c3868379f6bf3b189610344
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
Sung-Jin Park [Sat, 16 May 2020 12:42:20 +0000 (21:42 +0900)]
wayland-client: add APIs for setting/getting name of a display
Change-Id: I5c136ceb65d1fbdc64a5419c1ec317fbb20ab815
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Sung-Jin Park [Tue, 19 May 2020 07:55:13 +0000 (16:55 +0900)]
wayland-client: enhance log when connection has been failed
Change-Id: I8fde364f585083b4c3ea39ac19e18e6b64eae0f0
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
(cherry picked from commit
905fdf47ee45e7afa8409689ed2ab29bed3a5d46)
Junseok, Kim [Tue, 19 May 2020 07:24:26 +0000 (16:24 +0900)]
compositor-introspection-test: fix build warning
Change-Id: I0e4cf18dcb7b2775aa915bfb207b548cc6e033c5
Signed-off-by: Junseok, Kim <juns.kim@samsung.com>
Junseok, Kim [Tue, 19 May 2020 07:16:33 +0000 (16:16 +0900)]
wayland: change strerror() to %m to ensure thread-safety
Change-Id: If6b64cca09022ccc268df455906ebab6ab93cdf0
Signed-off-by: Junseok, Kim <juns.kim@samsung.com>
Sung-Jin Park [Sat, 16 May 2020 07:01:41 +0000 (16:01 +0900)]
wayland-client: added null check for intf->version for logging
Change-Id: I6ef7e5aa7bccd2b246f275b8ad7e83ea3fc28174
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Gwanglim Lee [Sat, 16 May 2020 06:28:36 +0000 (15:28 +0900)]
wayland-client: added null check for logging
Change-Id: I6cefc3507863ae5d05b5fce65c49e79bd5d4ea51
Sung-Jin Park [Fri, 15 May 2020 12:37:03 +0000 (21:37 +0900)]
wayland-client: fix not to repeat logs regarding errno and display->last_error
Change-Id: I3e914f0d134a01fbc77ef9d4c03970cf9885492a
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Sung-Jin Park [Fri, 6 Mar 2020 04:49:25 +0000 (13:49 +0900)]
wayland-client : do abort when there is an error on marshalling request
Change-Id: I012cdbdaa9e2059475cc78f91e77febe409c8ee1
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Sung-Jin Park [Fri, 6 Mar 2020 04:47:43 +0000 (13:47 +0900)]
connection: fix to use %m and to include fd number in log when dup failed
Change-Id: Ia48b7ee50e1eed6311cdc1e6b19259f098e9bf83
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Sung-Jin Park [Fri, 21 Feb 2020 08:53:36 +0000 (17:53 +0900)]
Packaging: version up to 1.18.92
Change-Id: I19174c628d38d91bcb03a9f5e9f8c25adecbf733
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Sung-Jin Park [Fri, 21 Feb 2020 06:43:35 +0000 (15:43 +0900)]
wayland-shm: fix a build warning (seals variable)
Change-Id: I8a006ee664e346c39f3ac84b8220d37c02d1fa60
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Sung-Jin Park [Wed, 12 Feb 2020 07:59:48 +0000 (16:59 +0900)]
wayland-client: reuse the existing map entry for the new_id of object from server
This change will make a wayland client reuse an existing map entry for the new id
of object in an event coming from server. To sum up, this is an error recovery code
that occurs when a wayland client doesn't destroy both the server-side resource and
the client-side proxy object in critical section that is guaranteed with the display
lock(mutex).
There is an error about the reservation of an entry in server_entries of the map of
a client. It will be caused when there is data of a wl_object stored already in the
map entry associated with the new object id coming from the server as an event.
Actually this issue will happen in a multi-threaded wayland client. Now let me give
you an example associate with a wl_buffer object created in the display server.
Suppose there are two threads in the client process. A thread(TA) is dispatching
events in its event queue and the other thread(TB) called wl_display_prepare_read()
to prepare for reading the display. And then thread(TA) called wl_buffer_destroy()
to destroy a wl_buffer object and then it finished to send the "WL_BUFFER_DESTROY"
request to the server via wl_proxy_marshal(). At the same time, thread(TB) polled
the display fd, returned from the polling function by the events coming from the
server and then called wl_display_read_events() to read/queue events.
In this situation, thread(TB) will be waiting for getting the display lock(mutex)
and will get it soon as there is no threads which holds the display lock.
thread(TB) will soon read events from the display fd and will queue the events
to the queue(s). At the same time, thread(TA) will call wl_proxy_destroy() to
destroy the proxy object, it'll try to hold the display lock. But it'll stop at the
part where it waits for the lock because thread(TB) holds the lock.
In the server side, it'll release the wl_buffer resource associate with the
id given from the destroy request from the client. And then the id will be reused
when it creates a new wl_buffer resource and will send the event contains the id as
a new_id of object. While thread(TB) is reading events and creating/queuing events,
the event from the server will also be handled.
In the process of demarshalling an event and calling wl_map_reserve_new() to reserve
a map entry for a new id of object on the map, the wayland client sets an error(EINVAL).
It's because the client finds that there is already data in the map entry corresponding
to the new object id coming from the server. Once the error is set, the error value will
be set to display->last_error and then the wayland client doesn't work properly.
In this change of code, the additional flag(WL_PROXY_FLAG_ID_OVERRIDEN) for wl_proxy
object will be appeared newly. When a new object id that is already associated with the
map entry where data exists come from the server, the wayland client adds the flag
(WL_PROXY_FLAG_ID_OVERRIDEN) to the proxy object stored int he map entry.
And this allows only the proxy object itself to be destroyed without destroying the data
of the linked map entry when the proxy object is destroyed in the future. Of course,
the data (in the map entry associated with the object id) has been being reused for a new
proxy object created in queue_event().
Change-Id: I62e762e94d081ef3d2ce2f54a0cc5d54c371327c
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
jeon [Fri, 31 Jan 2020 07:55:39 +0000 (16:55 +0900)]
wayland-client: check fd is a valid value
- fix a svace issue: tainted integer
Change-Id: I1aaf98f93f06383599643d1febd8315901a7f438
Sung-Jin Park [Wed, 20 Nov 2019 04:22:11 +0000 (13:22 +0900)]
wayland-client: fix not to cancel reading events when destroying a thread
Change-Id: Ib3b0dae56c3d70b9cf675da1f6fd14d966476632
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Sung-Jin Park [Thu, 7 Nov 2019 03:33:04 +0000 (12:33 +0900)]
tests: fix NULL_RETURNS issues in tests
Change-Id: I0c2307a788ed6d58985c3ae042147cfd7a4b8b66
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Sung-Jin Park [Tue, 5 Nov 2019 05:23:29 +0000 (14:23 +0900)]
wayland-client: leave log when the reader counts are invalid during destroying a thread
Change-Id: I6ca626431a976a2d67104fc750b925d8642b0b01
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Sung-Jin Park [Thu, 31 Oct 2019 02:52:52 +0000 (11:52 +0900)]
wayland-client: abort when the reader_count is invalid and cancel read when a thread is being destroyed if necessary
display->reader_count must be equal or smaller than the number of threads
already prepared to read events. If it is larger than the number of threads,
most threads will wait for the last reader to wake them up, which can create
a blocking situation. In this case, we will do abort().
If a thread that was preparing to read the event(s) suddenly ends, we must
check if the reader_count_in_thread is greater than zero and call cancel_read()
if necessary. Otherwise, a blocking situation may occur.
Change-Id: Id496c83c244b03f97106d350b44b8798c9a6c0a9
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Sung-Jin Park [Wed, 24 Jul 2019 09:41:45 +0000 (18:41 +0900)]
wayland-client: do wl_abort() when reader_count becomes negative
Change-Id: I808a59f208a1af1467e94b31c815325afd0a5fcf
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Joonbum Ko [Mon, 1 Jul 2019 08:00:03 +0000 (17:00 +0900)]
egl: Changed to flag EGL_PACKAGE to 1 to build wayland-egl.
- If there are no any problems, EGL_PACKAGE flag will be deprecated.
- This fix has dependencies on libtpl-egl-1.6.4
Change-Id: I318ed83009038c2b66e6db05247e21fec75b14f4
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Mon, 1 Jul 2019 07:57:28 +0000 (16:57 +0900)]
Revert "wayland-egl: Add wl_egl_window_set_rotation / wl_egl_window_get_capabilities apis for prerotation of egl_window."
This reverts commit
b008ce72390677acdf388a1754e51e14c2f81551.
Change-Id: Ie0ce923eddba733a92d6b581bf826979e0e13021
Joonbum Ko [Mon, 1 Jul 2019 07:57:23 +0000 (16:57 +0900)]
Revert "wayland-egl: Added APIs for setting buffer transform and frontbuffer rendering."
This reverts commit
321162446f28a6caf3d4a1b1b46a6f7d0cfc069c.
Change-Id: Iea341a4891331403e5f5aa9711ca03ea11f57166
Sung-Jin Park [Tue, 16 Jul 2019 11:27:21 +0000 (20:27 +0900)]
wayland-client: remove tabs
Change-Id: I17a9eb2e40954730eb2f4965b3124e13bd0ea656
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Sung-Jin Park [Tue, 16 Jul 2019 11:13:02 +0000 (20:13 +0900)]
wayland-server: remove unnecessary variable
Change-Id: I8014208fe4c42890d2f51178ae0eb42ab893404d
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Sung-Jin Park [Tue, 16 Jul 2019 10:56:11 +0000 (19:56 +0900)]
wayland-client: force sync of display when threads are waiting for over WL_PTHREAD_COND_TIMEDWAIT_TIMEOUT
Change-Id: I4973ab7794c0ea4831878f2f5e0d8141ca3d51fc
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Sung-Jin Park [Mon, 25 Mar 2019 05:12:40 +0000 (14:12 +0900)]
Packaging: upgrade to 1.17.0
Change-Id: Ibba67b9352bf634e229dbda9766a2542e3cad9ce
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Sung-Jin Park [Thu, 7 Feb 2019 06:04:15 +0000 (15:04 +0900)]
wayland-util: change strerror() to strerror_r() to ensure thread-safety in wl_abort()
Change-Id: Ibf2288afcbde267b630a39de6236d98a293aa98e
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Sung-Jin Park [Thu, 17 Jan 2019 03:55:03 +0000 (12:55 +0900)]
wayland-util: leave errno in wl_abort_errno before doing abort() in wl_abort()
Change-Id: I90f21cac63c1828bc5557b51b0aa0b90d0edd14b
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
(cherry picked from commit
4fc6112dde0d53c90cf18e2825d90bbd6ef5438f)
jeon [Thu, 17 Jan 2019 10:33:12 +0000 (19:33 +0900)]
wayland-cursor: fix a memory leak
Change-Id: I021e69744840cfc673d787751220a5d2758f3cb9
jeon [Thu, 22 Nov 2018 01:08:31 +0000 (10:08 +0900)]
server: event_source fd update if flush will be failed via EAGAIN
Change-Id: I5443c31b004220f27a164894f1381bacd50800a5
JengHyun Kang [Tue, 2 Oct 2018 09:00:17 +0000 (18:00 +0900)]
wayland-cursor: using old shm pool if reallocation is failed
Change-Id: I7ab1b2401e5eb487a719c0a4b0dd7e3d4df2117c
Boram Park [Thu, 7 Apr 2016 23:14:42 +0000 (08:14 +0900)]
client: use the thread reader_count to fix deadlock.
Let's see the below scenario.
1. A thread polls several fds including the wayland's fd.
2. This thread probably calls wl_display_prepare_read()
before polling fds.
3. This thread could be awake by other event source which isn't
related with wayland fd.
4. After wake up, this thread could call wl_display_dispatch or
wl_display_roundtrip for sync operation.
Then, when this thread got a done event. this thread will fall in
deadlock because this thread increases +2 reader_count in the same
thread. The read_event or cancel_read for the first prepare_read
is not going to happen because this thread sleeps in
pthread_cond_wait() line of read_event.
This problem can be solved by using the reader_count per thread.
The reader_count of thread will be increased/decreased whenever
prepare_read, cancel_read and read_event are called.
However, the original reader_count of display will be increased
only once per thread. And, when cancel_read and read_event are
called, it will be decreased to read event from fd and wake up
other threads. And that, if the thread reader_count is still more
than 0, it will be increased because it means the thread is still
polling in somewhere.
Change-Id: I2e881a6222e5ad380ace7a6d9571d5463cf701d9
Boram Park [Wed, 11 Apr 2018 02:25:19 +0000 (11:25 +0900)]
add EGL_PACAKGE to disable an egl library temporarily
when ready, we have to remove this patch
Change-Id: I317e78a60fb2228dd102caa16dcd8d5913eb7c41
Sangjin.Lee [Fri, 2 Mar 2018 04:32:22 +0000 (13:32 +0900)]
packaging: upgrade to 1.15.0
Change-Id: I179a88016e0e9e1c98960fa26cedaff1159602ef
Sangjin.Lee [Fri, 2 Mar 2018 04:32:22 +0000 (13:32 +0900)]
packaging: add libwayland-egl package
Change-Id: I179a88016e0e9e1c98960fa26cedaff1159602ef
Amarnath [Thu, 5 Jan 2017 11:10:42 +0000 (16:40 +0530)]
log: add debugging logs
commit
72b8e3b37c109aebeab15e9692fc9e98131eabd6
Author: Dipen Somani <dipen.somani@samsung.com>
Debug logs added to identify the failure cause of wl_display_connect()
commit
83cf12e7ca426c69571d952716625707009d2ac6
Author: Bhavi Dhingra <b.dhingra@samsung.com>
Adding debug information about pending requests from client, before it is aborted, if sendmsg() fails due to EAGAIN error
commit
4f1f607365c017c864aef54713dbd11a02d514e1
Author: Dipen Somani <dipen.somani@samsung.com>
wayland-server: Added debug logs for client disconnection
commit
2ee9534c137a0d3a7b5f81422eedd0f2ccded5c7
Author: Dipen Somani <dipen.somani@samsung.com>
Wayland-server: Added warning logs if application binds with a lower version of the interface than that of the event.
commit
f6c29ea10a9f09be82c195608d485287bb12006b
Author: ritesh.u <ritesh.u@samsung.com>
wayland-server: Error log for client disconnection on hangup/error flag set
Change-Id: Ie255b6637226c5e3ad3593d22aa9ec4905fb947f
Sangjin Lee [Wed, 9 Aug 2017 07:20:46 +0000 (16:20 +0900)]
protocol: add destructor to the registry
In some user side library, it create wl_registry for check global resource to many times.
it also destory the wl_registry when finished but in wayland server, the registry resource remained
untill client is destroy. So memory in server side is increase.
This is the reason why add destructor to wl_registry.
Change-Id: I473e70eb3ef60e6604be4cc0314f3ef95f1f59c4
joonbum.ko [Thu, 15 Jun 2017 10:03:43 +0000 (19:03 +0900)]
wayland-egl: Added APIs for setting buffer transform and frontbuffer rendering.
- Added APIs
wl_egl_window_set_buffer_transform(struct wl_egl_window *egl_window, int wl_output_transform)
wl_egl_window_set_frontbuffer_mode(struct wl_egl_window *egl_window, int set)
wl_egl_window_set_window_transform(struct wl_egl_window *egl_window, int window_transform)
Change-Id: Ife7ea6e6982fe223b4369c15c9b425dd00832122
Signed-off-by: joonbum.ko <joonbum.ko@samsung.com>
Sung-Jin Park [Wed, 17 May 2017 05:29:50 +0000 (14:29 +0900)]
wayland-cursor: fix cursor image broken problem
This fixes a bug related to recreate/use a new shm pool for cursor(s).
When recreating a shm pool, we usually need to copy the existing contents
in the old shm pool to the new shm pool. Otherwise, cursor images in the
old shm pool will be lost and they will be displayed abnormaly.
Change-Id: Id7515f9d15d8406c3dfb1ad52072a2442ce0c1aa
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
JengHyun Kang [Wed, 19 Apr 2017 08:27:06 +0000 (17:27 +0900)]
wayland-cursor: fix a dereference about theme->pool
Change-Id: If998c79832ccb68bb5ba650e6564bca139638f1e
Sung-Jin Park [Wed, 5 Apr 2017 08:02:22 +0000 (17:02 +0900)]
wayland-cursor: fix to recreate to shm pool when it's not enough to contain a new cursor
Change-Id: I9028c891ecbcabdb815c070ca414124f2206e392
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
Boram Park [Thu, 2 Mar 2017 08:44:09 +0000 (17:44 +0900)]
server: checking if the process has the super-user right to read /proc/cmdline
Change-Id: Ib1b3564c98e1cd398e9b764dfb82402a6a53eec4
Debi Prasanna Mohanty [Mon, 27 Feb 2017 17:06:57 +0000 (22:36 +0530)]
Add null check to prevent crash in case connection is deleted.
Change-Id: Ib4b2f80620b0e5fd08899c62e4df27f7afc10a05
Signed-off-by: Debi Prasanna Mohanty <debi.m@samsung.com>
Boram Park [Sun, 19 Feb 2017 12:16:22 +0000 (21:16 +0900)]
log: add debugging logs
b50bff1a3e2376c4512af8295d6f6f45fda46170 log: add more logs for debugging
e00cbc1c23df2164f5e9bc4a6c0201c9b6424c5d log: add logs for tracing events in multi thread
06580d8ddac98f06f54d06bc4f1fe6bdc90f222f log: add error logs for debugging
bbb9077f93887bed9357ba9253f51e73720d1ed1 print protocol error logs
Change-Id: Ibde99add3590e032c8fada839f74b5a5c417f80d
Boram Park [Sun, 19 Feb 2017 11:57:10 +0000 (20:57 +0900)]
client: add mutex lock/unlock for proxy
Actually this is not the perfect solution to protect wayland client resources in
multi-threads. They SHOULD be protected by applications. For example, during polling
the display fd, if a thread calls wl_display_disconnect, it will make issues. However,
adding mutex lock/unlock looks worth to protect wayland client resources inside of
wayland library at least.
Change-Id: I26b5f9598ccaaf5620a64a84af49f8637a360acb
Boram Park [Sun, 19 Feb 2017 10:47:31 +0000 (19:47 +0900)]
connection: add some sanity-check
Change-Id: Iafcb073744cc95d44a6ac2a89980596da3b5ceee
ritesh.u [Wed, 28 Dec 2016 14:46:33 +0000 (20:16 +0530)]
wayland-cursor.c: Load cursors only on demand to save application load time and fix for theme inheritance functionality
Change-Id: I73aa858e36b97a71d438365980e4ee49aea9b9bd
Signed-off-by: ritesh.u <ritesh.u@samsung.com>
Junseok Kim [Fri, 11 Feb 2022 03:45:07 +0000 (12:45 +0900)]
wayland-cursor: added wl_cursor_theme_get_name for get cursor theme name
Change-Id: Ib0ac1d2d767512fc400b52afa1d1c2291d648051
Mun, Gwan-gyeong [Wed, 9 Nov 2016 08:19:56 +0000 (17:19 +0900)]
wayland-egl: Add wl_egl_window_set_rotation / wl_egl_window_get_capabilities apis for prerotation of egl_window.
Change-Id: Id8b0bce697347efa7f5256bda217cc2e3eef045f
Boram Park [Wed, 11 Apr 2018 01:20:01 +0000 (10:20 +0900)]
flush forcely if closure has fds
This patch is quite different with the original patch. The original patch did
two things. One is flushing forcely if closure has fds. Another is closing fds
remained in connection fds_in array.
Now closing fds is patched in wayland 1.15.0. So, we just remain the force flushing
patch.
Below is the original patch message
[original patch message]
commit
d83694a742291e283f88b4db43ad5d9a9acf75bc
Author: Sangjin Lee <lsj119@samsung.com>
wayland-client: fix invalid fd about destroyed proxy
If server sends fds but the proxy was destroyed,
then that fds remain in connetion fds_in array.
so they can be misused by other proxy.
The simple solution is to separate the message including fds from the other messages
and In queueing process in clients, if received message of proxy is invaild,
just consume the fds_in array.
Change-Id: I07dd9cf87f2b8cf6265bdbdb046ed0593faaa89c
Gwanglim Lee [Wed, 1 Jun 2016 02:46:45 +0000 (11:46 +0900)]
scanner: Ensuring XMLCALL macro is only defined once to avoid build error on i586.
XMLCALL exportable macro is defined in two header files on i586.
(expat_external.h and xmlexports.h)
In order to avoid redefined error, we should put undef that macro.
Change-Id: I9270d4038443978548d197a8196b40eb5db7e065
Gwanglim Lee [Fri, 27 May 2016 04:47:37 +0000 (13:47 +0900)]
tests: fix warnings
add checking values for read and write.
correct order of declaration for struct wl_closure.
Change-Id: I99e40210e387562ed2dbd050b7219e35d303c668
Seunghun Lee [Tue, 15 Mar 2016 08:52:11 +0000 (17:52 +0900)]
use a environment "TIZEN_WAYLAND_SHM_DIR" as a path of shared memory.
allow to locate the shm file in the Tizen specific directory.
Change-Id: If11af6064b6a94fe1d7940cc76d7c59e7ba1bf48
Ju Yeon Lee [Mon, 21 Dec 2015 11:11:22 +0000 (20:11 +0900)]
server: Add new api to get wayland clients' resource
allows us to get connected clients and their resources
could be utilized more efficient sever resource usage and debug resource leakage
added tests 'clients-resource-test' for presenting howto.
Change-Id: I53647d3095b51d8f435eaaad0fedb6e13dedfb3b
Sung-Jin Park [Fri, 13 Nov 2015 09:55:17 +0000 (18:55 +0900)]
add apis to enable/disable wayland debug at runtime both for server/client
Change-Id: Ibcb9da8db2185d0d2a9f225e0f6d80e5a30e9cd4
Boram Park [Wed, 11 Apr 2018 01:33:29 +0000 (10:33 +0900)]
packaging: add packaging directory
Change-Id: I3703dd75576b486c7982f0d1e8ef0b63b18162fe
Simon Ser [Thu, 30 Jun 2022 21:59:11 +0000 (23:59 +0200)]
build: bump to version 1.21.0 for the official release
Peter Hutterer [Fri, 24 Jun 2022 03:45:58 +0000 (13:45 +1000)]
protocol: minor clarification for axis_discrete events
Explicitly spell out that multiple axis_discrete events *for the same axis*
within the same wl_pointer.frame are not permitted.
References: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/911#note_1438099
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Simon Ser [Tue, 28 Jun 2022 09:59:26 +0000 (11:59 +0200)]
util: set errno when hitting WL_MAP_MAX_OBJECTS
Callers may check errno when wl_map_insert_* functions return an
error (since [1]). Make sure it's always set to a meaningful value
when returning an error, otherwise callers might end up checking an
errno coming from a completely different function.
[1]: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/205
Signed-off-by: Simon Ser <contact@emersion.fr>
Fixes:
b19488c7154b ("util: Limit size of wl_map")
Simon Ser [Thu, 23 Jun 2022 19:59:18 +0000 (21:59 +0200)]
build: bump to version 1.20.93 for the RC1 release
Simon Ser [Wed, 15 Jun 2022 08:37:18 +0000 (10:37 +0200)]
server: warn about global filtering consistency
The filtering needs to be static given a client and a global,
otherwise libwayland will misbehave.
Signed-off-by: Simon Ser <contact@emersion.fr>
References: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/241#note_1421888
Simon Ser [Tue, 31 May 2022 17:23:38 +0000 (19:23 +0200)]
server: add PID race condition disclaimer to wl_client_get_credentials
PIDs are re-used and cannot be used to reliably check the identity of
a Wayland client.
Signed-off-by: Simon Ser <contact@emersion.fr>
Simon Ser [Thu, 12 May 2022 17:30:38 +0000 (19:30 +0200)]
tests: add a test for dynamic filtered globals
Ensure dynamically created and destroyed globals which are filtered
don't trigger any global/global_remove event.
Signed-off-by: Simon Ser <contact@emersion.fr>
Simon Ser [Thu, 12 May 2022 17:29:11 +0000 (19:29 +0200)]
server: check visibility before sending global/global_remove
See the previous discussion at [1]: libwayland incorrectly skips
the visibility checks when sending global/global_remove events.
The check is only performed when a client performs a
wl_display.get_registry request.
[1]: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/148
Signed-off-by: Simon Ser <contact@emersion.fr>
Olivier Fourdan [Mon, 30 May 2022 07:14:04 +0000 (09:14 +0200)]
cursor/os-compatibility: handle EINTR gracefully
If os_resize_anonymous_file() called from os_create_anonymous_file()
fails with EINTR (Interrupted system call), then the buffer allocation
fails.
To avoid that, retry posix_fallocate() on EINTR.
However, in the presence of an alarm, the interrupt may trigger
repeatedly and prevent a large posix_fallocate() to ever complete
successfully, so we need to first block SIGALRM to prevent this.
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Simon Ser [Thu, 9 Jun 2022 18:52:32 +0000 (20:52 +0200)]
build: bump to version 1.20.92 for the beta release
Signed-off-by: Simon Ser <contact@emersion.fr>
Alexandros Frantzis [Thu, 26 May 2022 09:18:28 +0000 (12:18 +0300)]
client: Lock display when setting a proxy event queue
Assignments to a wl_proxy's queue member are currently not synchronized
with potential reads of that member during event reading/queuing.
Assuming atomic pointer value reads and writes (which is a reasonable
assumption), and using the documented best practices to handle event
queue changes, a queue change should still be safe to perform.
That being said, such implicitly atomic accesses are difficult to assess
for correctness, especially since they do not introduce memory barriers.
To make the code more obviously correct, and handle any potential races
we are not currently aware of, this commit updates wl_proxy_set_queue()
to set the proxy's event queue under the display lock (all other
proxy queue accesses are already done under the display lock).
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Alexandros Frantzis [Thu, 26 May 2022 09:05:15 +0000 (12:05 +0300)]
client: Document best practices for event queue changes
Document the proper way to deal with event queue changes, in order to
guarantee proper handing of all events which were queued before the
queue change takes effect, especially in multi-threaded setups.
Make a special note about queue changes of newly created proxies,
which require the use of a proxy wrapper for thread safety.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Antonin Décimo [Fri, 11 Mar 2022 13:08:49 +0000 (14:08 +0100)]
Check that XDG base directories paths are absolute
The [spec][1] reads:
> All paths set in these environment variables must be absolute. If an
> implementation encounters a relative path in any of these variables it should
> consider the path invalid and ignore it.
and
> If $XDG_DATA_HOME is either not set or empty, a default equal to
> $HOME/.local/share should be used.
Testing that the path is absolute also entails that is is non-empty.
[1]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
Simon Ser [Sat, 4 Jun 2022 20:58:50 +0000 (22:58 +0200)]
cursor/os-compatibility: fix trailing space
Signed-off-by: Simon Ser <contact@emersion.fr>
Simon Ser [Sat, 4 Jun 2022 20:56:36 +0000 (22:56 +0200)]
cursor/os-compatibility: remove strcpy/strcat usage
These functions don't perform bounds checking, so they are easy to
misuse and complicate audits.
Signed-off-by: Simon Ser <contact@emersion.fr>
Simon Ser [Fri, 27 May 2022 15:52:35 +0000 (17:52 +0200)]
cursor: move xcursor_theme_inherits declarations at the top
Per code style, declarations need to be at the start of the block.
And make l const while at it.
Signed-off-by: Simon Ser <contact@emersion.fr>
Simon Ser [Fri, 27 May 2022 15:49:10 +0000 (17:49 +0200)]
cursor: drop xcursor_add_path_elt
Just use snprintf instead. It doesn't really matter if we have
some duplicate slashes in filenames.
Signed-off-by: Simon Ser <contact@emersion.fr>
Simon Ser [Fri, 27 May 2022 15:17:42 +0000 (17:17 +0200)]
cursor: drop unused XCursor comment declarations
Signed-off-by: Simon Ser <contact@emersion.fr>
Simon Ser [Fri, 27 May 2022 15:16:17 +0000 (17:16 +0200)]
cursor: fix indentation of xcursor_load_theme declaration
Signed-off-by: Simon Ser <contact@emersion.fr>
Simon Ser [Fri, 27 May 2022 15:14:24 +0000 (17:14 +0200)]
cursor: simplify xcursor_library_path
- Use early returns
- De-duplicate XDG_DATA_HOME code-paths
- Don't crash on allocation failure
- Use size_t when appropriate
- Fix indentation
Signed-off-by: Simon Ser <contact@emersion.fr>
Simon Ser [Fri, 27 May 2022 15:09:48 +0000 (17:09 +0200)]
cursor: remove unnecessary ifs in xcursor_load_theme
load_all_cursors_from_dir and xcursor_theme_inherits already have
the NULL checks we want.
Signed-off-by: Simon Ser <contact@emersion.fr>
Simon Ser [Fri, 27 May 2022 15:07:08 +0000 (17:07 +0200)]
cursor: drop xcursor_images_set_name
We don't ever need to set the name multiple times for a single
struct xcursor_images, so we can just set the field directly. Also
replace the hand-rolled logic with strdup.
Signed-off-by: Simon Ser <contact@emersion.fr>
Simon Ser [Fri, 27 May 2022 14:54:49 +0000 (16:54 +0200)]
cursor: use getline instead of fgets
This avoids storing 8KiB on the stack, and removes the line length
limit.
Signed-off-by: Simon Ser <contact@emersion.fr>