Joonbum Ko [Tue, 21 May 2024 10:10:31 +0000 (19:10 +0900)]
wl_egl: implement set_pre_commit_callback
Change-Id: I223fd84d00c9e951d04d4149d3851c6c57c38610
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Tue, 21 May 2024 10:05:50 +0000 (19:05 +0900)]
wayland-egl-tizen: add new API to set pre_commit callback.
Set pre-commit callback with data to wl_egl_window.
The registered callback function will be called with the data
immedately before the frame's wl_surface_commit.
The callback registered before calling eglSwapBuffers will be called
at the time the swap requested buffer is attached.
* Important *
- Since the callback may be called from a separate thread that performs
wl_surface_commit, protection is required if there is a critical section
inside the callback function.
- To avoid poor performance or complicated lifecycle issues,
it is recommended that the behavior inside the callback function be concise.
- This API should be called from one thread.
- If it is called multiple times in a frame, the previously registered ones
are overwritten.
* Callback Options *
- ONCE : The registered callback and data are stored in the buffer requested
for swap when calling eglSwapBuffers and then initialized.
The callback function is called only once when the buffer requested
for swap is committed, and is not called after that.
- CONTINUOUS : Once the callback and data are registered, the callback function
is called continuously until it is released.
To release the callback, simply pass NULL to func.
Change-Id: Ic08c6dd1aeafe88d4059760f6bbffbd9d0da8c05
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 23 May 2024 04:57:21 +0000 (13:57 +0900)]
wayland-egl-tizen: add a new API to increase serial and obtain it
Increment the window serial and then returns it.
The updated serial is copied to the buffer at the next eglSwapBuffers
and delivered to the server when wl_surface_commit.
* Important *
- This API should be called only from the thread that calls eglSwapBuffers
because it is not thread safe.
- It is recommended not to use it with wl_egl_window_tizen_set_window_serial
because set_window_seriaal can overwrite serial with a completely different value.
- If caller want to obtain the current serial without increasing it,
need to call get_window_serial
Change-Id: I780cccc175d2ef7d080805bc301ec92da1445e7c
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 23 May 2024 03:51:19 +0000 (12:51 +0900)]
wayland-egl-tizen: add internal function to get tizen_private
Change-Id: I69ebd607b0ba1fe3af38e325426e63d68ab909b4
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Tue, 21 May 2024 10:10:31 +0000 (19:10 +0900)]
wl_egl: implement set_pre_commit_callback
Change-Id: I223fd84d00c9e951d04d4149d3851c6c57c38610
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Tue, 21 May 2024 10:05:50 +0000 (19:05 +0900)]
wayland-egl-tizen: add new API to set pre_commit callback.
Set pre-commit callback with data to wl_egl_window.
The registered callback function will be called with the data
immedately before the frame's wl_surface_commit.
The callback registered before calling eglSwapBuffers will be called
at the time the swap requested buffer is attached.
* Important *
- Since the callback may be called from a separate thread that performs
wl_surface_commit, protection is required if there is a critical section
inside the callback function.
- To avoid poor performance or complicated lifecycle issues,
it is recommended that the behavior inside the callback function be concise.
- This API should be called from one thread.
- If it is called multiple times in a frame, the previously registered ones
are overwritten.
* Callback Options *
- ONCE : The registered callback and data are stored in the buffer requested
for swap when calling eglSwapBuffers and then initialized.
The callback function is called only once when the buffer requested
for swap is committed, and is not called after that.
- CONTINUOUS : Once the callback and data are registered, the callback function
is called continuously until it is released.
To release the callback, simply pass NULL to func.
Change-Id: Ic08c6dd1aeafe88d4059760f6bbffbd9d0da8c05
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 3 May 2024 08:29:11 +0000 (17:29 +0900)]
Package version up to 1.11.3
Change-Id: Ie44a2200ef7a05d2d33b67745af5b99d9ac31571
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 3 May 2024 08:26:22 +0000 (17:26 +0900)]
wl_egl: modify some operation related with buffer serial
- The point of storing the serial to wl_egl_buffer was
changed from dequeue to enqueue.
Change-Id: I060fb29da38b5e16d8fcc2c453db6250b9a89327
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 12 Apr 2024 03:59:10 +0000 (12:59 +0900)]
wl_egl: add logs to print elapsed time
Change-Id: Ie910e39d5ec15800dd04db1d7198a40361dd9e8f
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 12 Apr 2024 04:13:51 +0000 (13:13 +0900)]
wl_egl: add exception checking to find invalid wl_egl_buffer
Change-Id: If5d66523e1d190d2c341f81ff01edf3411c2f3b5
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Wed, 31 Jan 2024 11:02:55 +0000 (20:02 +0900)]
Package version up to 1.11.2
Change-Id: Ide2da7a347b003d6811f4067adf80a553385097d
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Wed, 17 Jan 2024 05:04:55 +0000 (14:04 +0900)]
wl_egl: check is_activated after calling can_dequeue
- to resolve regression issue related to support frontbuffer rendering mode.
- The issue was caused by the commit below
wl_egl: remove checking activated when dequeue buffer
c362b0b2860d1ebab098956e2567aeef8313952c
- Actual buffer will be attached when calling tbm_surface_queue_can_dequeue().
So calling wayland_tbm_client_queue_check_activate() at dequeue_buffer
is not appropriate.
Change-Id: I88b58a62bc42537d7bd8fe1d446a343fd40aab7b
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
jphnix [Tue, 30 Jan 2024 10:33:55 +0000 (10:33 +0000)]
Add missing Lock
- gthread->loop is held with thread_mutex.
- But it doesn't hold thread_mutex in tpl_gthread_add_idle
Change-Id: Ibaddbcf7e4d4b9ec661ee69c0a95dbc517970ea2
jphnix [Wed, 31 Jan 2024 05:46:09 +0000 (05:46 +0000)]
Move protected area by mutex
- surface->post_interval is needed to be protected by mutex
Change-Id: I8f70ccb15e38fcfc24f2a4d326eeea6003eba9e8
jphnix [Tue, 30 Jan 2024 10:51:47 +0000 (10:51 +0000)]
Fix missed protection by lock
- dequeued_buffers buffer can be NULL in mutex protection.
- but checking it is NULL is used without mutex protection.
- so it is need to fix.
Change-Id: Ifd57d769c760cd43f2816ab9477560dc0f1e5ae5
Joonbum Ko [Thu, 18 Jan 2024 06:21:03 +0000 (15:21 +0900)]
Package version up to 1.11.1
Change-Id: I9106d5403ea315c729ce23e3e01d0f671040bc32
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 18 Jan 2024 06:05:36 +0000 (15:05 +0900)]
wl_egl: improve end-of-use guarantee for previous buffers
AS-IS
- Dequeue thread waits for the wl-egl-thread to send signal
after commit the buffer that was last enqueued.
PROBLEMS
- Complex mutex locking is required to access last_enq_buffer.
- Complex process is required to validate last_enq_buffer.
TO-BE
- The list of buffers in use is traversed by wl-egl-thread
and signal is sent when all buffers enqeueued after queue reset
are committed.
Change-Id: Ib81186c2cc1faf856372c0a668b47ffc615258eb
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Wed, 17 Jan 2024 05:04:55 +0000 (14:04 +0900)]
wl_egl: add missing is_activated flag setting
Change-Id: I091d812f9354bd98e5b19a6eb35df83d92c45473
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Wed, 17 Jan 2024 04:40:11 +0000 (13:40 +0900)]
wl_egl: queue resize will be run in thread
AS-IS
- In an arbitrary thread where wl_egl_window_resize called,
if the reisze callback is called inside it,
and reset the tbm_surface_queue to the requested size.
PROBLEMS
- It is difficult to protect against all cases of resizing at
unpredictable times.
TO-BE
- All resets of the tbm_surface_queue are performed only in
wl-egl-thread.
Change-Id: Idaa6609594e47321c3c28715d46001ff8269711a
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Tue, 16 Jan 2024 09:03:53 +0000 (18:03 +0900)]
wl_egl: queue force flush will be run in thread
AS-IS
- In case where can_dequeue returns timeout error,
the operation of forcibly flushing the tbm_queue and
emptying buffer list of wl_egl_surface were performed in
the parent thread (dequeue thread).
PROBLEMS
- Whenever a buffer lis is traversed, the thread should be paused,
but the timeout error is often occured in pausing operation.
- In order to flush tbm_queue, it is necessary to use complex
mutex locking.
TO-BE
- The operation of emptying the queue and buffer list is performed
in the wl-egl-thread.
- The parent thread waits for the operation in the wl-egl-thread
to be completed, and in the following cases, it is regarded as an
error situation and causes the dequeue to return NULL.
1. If the result of tpl_gcond_timed_wait is a timeout error
2. If the result of tbm_surface_queue_can_dequeue is not 1 even
after receiving the signal from the wl-egl-thread.
Change-Id: Ibe65330f508d2193a02fd5fe43ba1b651dc0499c
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Mon, 15 Jan 2024 07:43:14 +0000 (16:43 +0900)]
delete unused variable
Change-Id: I5e53e461444bc0776d46cdd998e879538af74f57
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 12 Jan 2024 11:38:41 +0000 (20:38 +0900)]
wl_egl: change buffers_mutex to tpl_gmutex_rec from tpl_gmutex
- When buffers are released while traversing the buffer list,
both traversal and deletion from the list in wl_egl_buffer_free
must be protected by buffers_mutex.
- Since it is possible to continuously lock on the same thread,
changed buffers_mutex to use GRecMutex.
Change-Id: I22ee38bfb19f2cef84b5a0b681ed9f37e20a54e3
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 12 Jan 2024 11:37:21 +0000 (20:37 +0900)]
utils_gthread: add APIs to use GRecMutex
Change-Id: I4a6931f756d33658a332b9579a6dd0d42321c655
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 12 Jan 2024 08:10:23 +0000 (17:10 +0900)]
wl_egl: implement idle_cb that waits for buffers to be finalized
AS-IS
- The parent thread waits for buffer to be released in
traversing the buffer list of surface.
PROBLEMS
- Whenever a buffer lis is traversed, the thread should be paused,
but the timeout error is often occured in pausing operation.
TO-BE
- Perform the operation of releasing buffer while traversing
buffer list in __idle_cb_buffers_finalize.
- __idle_cb_buffers_finalize is called whenever the main loop's idles,
and not called after all buffers are released.
- The parent thread sets a timeout (1s) and waits for all buffers
to be released, and if the timeout error occurs, forcibly releases
the buffers that were not released just before tbm_queue destroy.
Change-Id: I6a31786dbe5b7340f7b9b8b00741d5fc3009c78b
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Wed, 10 Jan 2024 10:19:40 +0000 (19:19 +0900)]
utils_gthread: add a new API to attach idle source
Change-Id: Ic28c36f5b8d67cfd2f967b130cb854d1a9301ecf
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
jinbong, Lee [Tue, 19 Sep 2023 04:50:56 +0000 (13:50 +0900)]
modify the locking buffer->mutex to include surface_commit
- In the case when _thread_wl_surface_commit() is called after
the mutex of wl_egl_buffer has been unlocked in the thread,
the wl_egl_buffer may be freed in the parent thread.
- In that case, a problem occurs during commit operation.
Therefore, the buffer must be maintained until the commit is completed.
Change-Id: I994b4ed1a1c8670d3f6f25ec580681875ece7c0a
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Tue, 2 Jan 2024 11:09:34 +0000 (20:09 +0900)]
handle null exception when printing protocol errors
- Sometimes the interface obtained from wl_display_get_protocol_error
is NULL when interface has already been destroyed.
Change-Id: I0fe2fe9b759682078366bdc5fe4076e9f66a6d8a
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
jinbong, Lee [Wed, 10 Jan 2024 11:10:42 +0000 (11:10 +0000)]
Implementation for SwapInterval is zero
- asynchronous swap mode implementation for benchmark
- Clearing waiting-buffers will be run in vblank event's callback,
because of vblank callback will be called at least once if there is a buffer waiting to commit
- add vblank_enable flag it can be changed during runtime, and it is related with post_interval & vblank
Change-Id: Ieb50ebad4350b293fa7e243ce960f125ee7029dd
Joonbum Ko [Thu, 30 Nov 2023 04:53:26 +0000 (13:53 +0900)]
clean up type casting lines for readability
Change-Id: Ic7910b7e474cc796db67a4cf8c509dab0d8f641d
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 30 Nov 2023 02:05:54 +0000 (11:05 +0900)]
remove the duplicate codes from the signal sending
Change-Id: I303b2293ec399a7107f1c49956e4cb234253e034
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Wed, 29 Nov 2023 07:31:29 +0000 (16:31 +0900)]
Package version up to 1.10.10
Change-Id: Ic54f49fb9c580ef58a4bd11ff946c0b0b10503b6
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Wed, 29 Nov 2023 07:14:44 +0000 (16:14 +0900)]
change wait_idle timeout from 200ms to 500ms
- There are often cases where scheduling is not received
for more than 200ms in unexpectable situations such as cpu contension.
- Since wait_idle is called in parts where synchronization is absolutely necessary,
it is necessary to minimize the problem by increasing it to 500ms.
Change-Id: I2844a5700f12a77668df526ce65bd5d6f486b56a
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Wed, 29 Nov 2023 07:11:37 +0000 (16:11 +0900)]
disable printing buffer list when flusher called
- Although this info logs are not absolutely necessary,
it may cause a seg fault in some situations.
- It must be modified later.
Change-Id: Idfe95f940058ed194f7f62064ee767979e167dd7
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
jinbong, Lee [Tue, 19 Sep 2023 05:24:10 +0000 (14:24 +0900)]
Package version up to 1.10.9
Change-Id: I0d6d6d7bdd7709481d591b245e0d3c936deb5dfd
jinbong, Lee [Tue, 19 Sep 2023 05:23:11 +0000 (14:23 +0900)]
Move wl_display_flush after wayland_tbm_client_destroy_buffer
- When wayland_tbm_client_destroy_buffer() is called,
then we need to send message to server as soon as possible
Change-Id: I4abc7e273d7103526b8fde550601fa5993bd3e9b
jinbong, Lee [Mon, 18 Sep 2023 06:37:32 +0000 (15:37 +0900)]
Package version up to 1.10.8
Change-Id: Ibc178293f788b1a372ac9f4e7288d7d2aa7b7b5d
jinbong, Lee [Mon, 18 Sep 2023 06:19:41 +0000 (15:19 +0900)]
Enqueued tbm_surface is needed to unref when surface's finalize is called
- If main thread called __tpl_wl_egl_surface_fini(),
then sometimes enqueued buffer can be remained before acquire.
so in that case tbm_surface must be unreferenced.
Change-Id: I3482feca808deec9c238d5ca32ee46c9ebeec401
jinbong, Lee [Mon, 18 Sep 2023 06:13:55 +0000 (15:13 +0900)]
protect wl_egl_buffer->wl_buffer with mutex_lock
- wl_egl_buffer->wl_buffer is must protected when call wl_egl_display && wl_egl_display->wl_tbm_client
Change-Id: I223f1521b1f412914194226ce69a996fc4ef91db
jinbong, Lee [Tue, 29 Aug 2023 11:06:33 +0000 (20:06 +0900)]
Package version up to 1.10.7
Change-Id: I7fc5a01433d47123fca4a008bbfec74dbc9d9c01
jinbong, Lee [Tue, 29 Aug 2023 10:56:54 +0000 (19:56 +0900)]
Remove double free situation
- if (source->fd_type == FD_TYPE_FENCE && source->type == SOURCE_TYPE_DISPOSABLE)
then g_source_remove_unix_fd, g_source_destroy, g_source_unref is called twice for source->gsource.
- it can cause error like that free already freed memory or free with invalid pointer (garbage value)
Change-Id: I44e3b1d50b0710d9cd2ddcf8e8c8f4215acff344
Joonbum Ko [Mon, 24 Jul 2023 07:15:58 +0000 (16:15 +0900)]
Package version up to 1.10.6
Change-Id: Ie0023ea5aaf82238fb8c50fec70e6c4bc676b642
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Tue, 18 Jul 2023 10:40:25 +0000 (19:40 +0900)]
wl_vk: untrack the swapchain_buffers when destroy_swapchain called
Change-Id: I72ed5fdf2fec9f00fa25e5bc87ea26501d1042f9
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Xuelian Bai [Mon, 24 Jul 2023 03:15:17 +0000 (11:15 +0800)]
Fix a typo
This typo will cause frozen for all vulkan app, since display dispatch
didn't work
Change-Id: Ibd3d753e35c0825bb7a6bc008baa4ace2fb076ff
Signed-off-by: Xuelian Bai <xuelian.bai@samsung.com>
Joonbum Ko [Mon, 17 Jul 2023 07:37:55 +0000 (16:37 +0900)]
Package version up to 1.10.5
Change-Id: I1a3e22b04d5b73a5ba2f4dceb80f8202e5e6af93
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Mon, 17 Jul 2023 07:35:16 +0000 (16:35 +0900)]
utils_gthread: do not make data into NULL before the source is destroyed
- Even if thread call the g_source_destroy & unref it, it may not be destroyed
immediately. (waiting for dispatch in g_main_context)
- source->data will be changed to NULL only when it destroyed perfectly.
Change-Id: Iecf8ce7599a0ad92346fe7dc802bfcebbb7cd25c
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Tue, 11 Jul 2023 06:47:59 +0000 (15:47 +0900)]
Package version up to 1.10.4
Change-Id: I480c76e12c88d8e9d972e7903d1fbaae6b39a72c
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Tue, 11 Jul 2023 06:33:48 +0000 (15:33 +0900)]
wl_egl: close fence_fd when gsource finalized
- Even though when main thread have called tpl_gsource_destroy for
fence_waiting_source, which has not yet signaled, gsource may not be
completely destroyed because it might be in dispatch queue in g_main_context.
- In this case, if the fence_waiting_source is dispatched, it can try
to commit with the invalid wl_egl_buffer that has already been freed.
- This commit makes to prevent operating with an invalid wl_egl_buffer
and to close fence_fd properly.
Change-Id: Ibce274b062bf8a6354a76464fca8f1e10b77c7b8
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Mon, 10 Jul 2023 11:06:47 +0000 (20:06 +0900)]
utils_gthread: add enum type to distinguish the fd type
Change-Id: Idca314bb4cb28cae973c56b9bc99a32195924e47
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Mon, 10 Jul 2023 08:24:02 +0000 (17:24 +0900)]
wl_vk: change the event message processing
Change-Id: I6d3b6c7aa7b5289fb1b91a9c3f9cb563499fabd4
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 7 Jul 2023 04:09:29 +0000 (13:09 +0900)]
log: add & apply TPL_LOG_D instead of TPL_DEBUG
- TPL_LOG_D can print the tag manually.
- The prefix of almost all logs is modified to print wl_egl_surface
to distinguish each wl_egl_surface.
Change-Id: I68a5b450693ed0d9422a9ba72e119f56235d7a32
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 15 Jun 2023 07:02:37 +0000 (16:02 +0900)]
wl_egl: remove checking activated when dequeue buffer
- Actual buffer will be attached when calling tbm_surface_queue_can_dequeue().
So calling wayland_tbm_client_queue_check_activate() at dequeue_buffer
is not appropriate.
Change-Id: Ie5500aa50f396e4a76160c703932d6c805e93d3d
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 2 Jun 2023 04:21:49 +0000 (13:21 +0900)]
Package version up to 1.10.3
Change-Id: I4f29af23350c5f5c8ffcea997021256f579f93b1
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 2 Jun 2023 04:15:03 +0000 (13:15 +0900)]
wl_egl/vk: use new tdm API to handle pending events.
refer to
https://review.tizen.org/gerrit/#/c/platform/core/uifw/libtdm/+/293679/
client: Add new API to handle pending events
fb76bf4
Change-Id: I036bc7b9f704b9f1bd250a6c651d5c90a9d94a65
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 14 Apr 2023 10:00:36 +0000 (19:00 +0900)]
wl_egl: Initialize vblank_done flag when dequeue timeout occured
- Rarely, even if client cannot receive vblank event from tdm server,
timeout may occur in can_dequeue.
- In this case, if wl_egl_surface->vblank_done flag
is not initialized to TPL_TRUE, problem situation may occur
waiting vblank without calling tdm_client_vblank_wait
after force_flush(can_dequeue_timeout).
Change-Id: If3f8eee13b5ae91a3728f189f53aa25720696b12
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Xuelian Bai [Thu, 23 Mar 2023 06:07:12 +0000 (06:07 +0000)]
Merge "Fix memory leak" into tizen
Xuelian Bai [Tue, 21 Mar 2023 06:56:27 +0000 (14:56 +0800)]
Fix memory leak
Wait until tbm_queue is destroyed, on pixel phone swapchain is destroyed
before tbm_queue is destroyed, then tbm_queue is never destroyed, then
cause memory leak
Change-Id: I897be13684f0e1f901aad751111c1e469414e178
Jinbong Lee [Mon, 20 Mar 2023 07:53:38 +0000 (07:53 +0000)]
Merge changes Ibac91ed8,I7e6a6891,I779718fd into tizen
* changes:
Package version up to 1.10.2
wl_egl: Implement the backend function of fence_sync_is_available
Add new API checks if fence sync is available
jinbong, Lee [Fri, 17 Mar 2023 10:27:02 +0000 (19:27 +0900)]
wl_egl : remive wl_egl_buffer in vblank's waiting buffers when wl_egl_buffer is freed
- Bug fix
. if __cb_wl_egl_buffer_free is called then some wl_egl_buffer can be in waiting buffers for vblank.
so it must be removed it before wl_egl_buffer is freed.
Change-Id: Ia08a7ecc6dcfd8f9d63e644b7cb733740672666b
Joonbum Ko [Fri, 17 Mar 2023 10:45:17 +0000 (19:45 +0900)]
Package version up to 1.10.2
Change-Id: Ibac91ed8fd994c1882d9433bc4dbedfd20cfdf21
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 27 Jan 2023 11:16:44 +0000 (20:16 +0900)]
wl_egl: Implement the backend function of fence_sync_is_available
Change-Id: I7e6a6891ff12b6869e66cf3a2d5f64098b04cb94
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 27 Jan 2023 11:08:05 +0000 (20:08 +0900)]
Add new API checks if fence sync is available
/**
* Check the surface can support fence sync mechanism.
*
* It is recommended that checking fence sync is available
* for every frame because the results may change depending on
* frontbuffer rendering is activated or not.
*
* @param surface surface to check fence sync is available.
* @return TPL_TRUE if tpl_surface can support it.
*/
tpl_bool_t
tpl_surface_fence_sync_is_available(tpl_surface_t *surface);
- This API helps DDK to determine whether to deliver the acquire_fence
to signal the render complete when call the surface_enqueue.
- In backend where waiting fence is not implemented,
the result of fixed to TPL_FALSE will be returned.
- The result from the backend with the waiting fence implementation
depends on whether the frontbuffer rendering is activated.
Change-Id: I779718fdc7e8efc7890e17b0d4df4d81974a7907
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 12 Jan 2023 08:15:40 +0000 (17:15 +0900)]
Package version up to 1.10.1
Change-Id: I8018c7726952577eda15361b938c722e09f7b13c
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 12 Jan 2023 08:15:20 +0000 (17:15 +0900)]
wayland-egl-tizen: Add description of set_frontbuffer_mode
Change-Id: Ic9e966c1b7b7f4064996765cb5e4f63cd55f813a
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 12 Jan 2023 07:16:50 +0000 (16:16 +0900)]
wl_egl: support for frontbuffer mode set by surface
- Patch for supporting this API.
wl_egl_window_tizen_set_frontbuffer_mode()
AS-IS:
- If the application, which wants to use frontbuffer rendering,
sets the frontbuffer mode using setenv(), EGL driver checks whether
frontbuffer mode is set using getenv() and if it true calls
tpl_surface_set_frontbuffer_mode().
PROBLEMS:
- The operation using setenv()/getenv() is not thread safe.
- Using env value to set frontbuffer mode cannot manage on/off in runtime.
- Using env value to set frontbuffer mode cannot set by surface.
TO-BE:
- Application would be better to use this API
wl_egl_window_tizen_set_frontbuffer_mode()
- This API makes supports the setting of frontbuffer mode
to the desired surface(window).
- This API gurantee thread safety using tpl_surface object lock.
- Using this API can help application to turn on/off
the frontbuffer mode in runtime.
Change-Id: I608309869dcb9d0bd0ba42c7e54afee6da1b5e04
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Wed, 4 Jan 2023 07:49:41 +0000 (16:49 +0900)]
wl_egl_thread: prepare for the failure of pause_in_idle
- The calling tpl_gthread_pause_in_idle() move from force_flush()
to outside.
- Add locking wl_event_mutex after trying tpl_gthread_pause_in_idle.
- Locking wl_event_mutex is a secondary means of preparing for
the failure of tpl_gthread_pause_in_idle().
If tpl_gthread_pause_in_idle()is successful,
locking wl_event_mutex does not affect.
Change-Id: I35132da013f67921c0f6deecc0909118461f3872
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Wed, 4 Jan 2023 07:29:57 +0000 (16:29 +0900)]
utils_gthread: cancel pause when wait_idle failed
- If the tpl_gthread_wait_idle fails with timeout,
it should be unlock pause_mutex immediately.
Change-Id: If33cc3c0b617ca34bb63d110d927e0dd7c022526
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Tue, 6 Dec 2022 08:51:24 +0000 (17:51 +0900)]
wl_egl: Delete calling wait_idle in surface_fini
- tpl_gthread_wait_idle will be called in tpl_gthread_pause_in_idle()
tpl_gthread_pause_in_idle will be called in buffer_clear()
So, calling wait_idle() is duplicated & meaningless operation
Change-Id: I50b2aa2e73f5a22be5860ab3e6be241def2d862f
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 2 Dec 2022 07:17:32 +0000 (16:17 +0900)]
utils_gthread: Prevent deadlock caused by wait_idle
Deadlock situation: Multi-threaded and multi surfaces for each thread
T2: call pause_in_idle()->wait_idle()
cond_wait() until idle signaled
T1: call wait_idle()
wait for lock idle_mutex
T2: _thread_idle_cb unlock idle_mutex,
set is_idle to TPL_TRUE
and wait to lock pause_mutex
T1: change is_idle to TPL_FALSE
cond_wait()
T2: cannot exit from while loop
still cond_wait()
- is_idle changing should be set TPL_FALSE after cond_wait finished
Change-Id: I44292e486a1b9f686ec28bc0ae10ddedf94a48e3
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 2 Dec 2022 01:52:44 +0000 (10:52 +0900)]
Package version up to 1.9.14
Change-Id: Id42e31cefc898f35fb9d84a8f949513a77eac515
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 2 Dec 2022 01:51:23 +0000 (10:51 +0900)]
utils_gthread: Add missed initializing paused flag
This missed line can cause deadlock issue.
Change-Id: I8d098e79010133dec4d7cc2cec071213cd02ec1a
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
jinbong, Lee [Wed, 30 Nov 2022 06:59:49 +0000 (15:59 +0900)]
Package version up to 1.9.13
Change-Id: I73f1638107fb67870bbc782cf970de7e35e2ff47
jinbong, Lee [Wed, 30 Nov 2022 06:47:33 +0000 (15:47 +0900)]
remove vblank's waiting_buffers in _tbm_queue_force_flush for prevent committing flushed tbm_surface
Change-Id: Ic91aa678659b12c9ce80bce87504deef2e4299af
Joonbum Ko [Wed, 30 Nov 2022 04:47:29 +0000 (13:47 +0900)]
utils_gthread: Change to use g_cond_wait_until to wait idle
- In some cases, signal was sent by idle_callback but
there is a problem that this signal is lost and g_cond_wait
cannot be awakened.
- Above case can cause deadlock problem.
- So set 200ms timeout ms with using g_cond_wait_until instead of
g_cond_wait.
Change-Id: Ib0a549616f74a9fb39e78f7b37b1b8b09e16031d
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 18 Nov 2022 08:40:21 +0000 (17:40 +0900)]
Package version up to 1.9.12
Change-Id: I24145794da2f4bd1505ee64518a427092c6472de
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 18 Nov 2022 08:30:17 +0000 (17:30 +0900)]
wl_egl: Set last_enq_buffer before tbm enqueue
- Since the operation from queue_enqueue to surface_commit
can be done at a time slice in thread, last_enq_buffer
must be set to enqueued tbm_surface before tbm queue enqueue
to initialize with NULL when do surface_commit.
Change-Id: I8b753abf44f92d4de4dab43185a7a29cb30c59fd
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 18 Nov 2022 08:21:49 +0000 (17:21 +0900)]
wl_egl: Use buffers list instead of buffers array
- If surface use array to track buffers,
index management is difficult and difficult
to assign a suitable size.
- The use of list can reduce some of the potential problems
that can occur from complex management.
Change-Id: I9a4574f542cde0ad8d32fed575d03e1a2c861b0b
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 17 Nov 2022 08:33:11 +0000 (17:33 +0900)]
wl_egl: Apply pause and wait_idle at buffer clear
AS-IS
Using wl_event_mutex lock to pause thread.
Using wl_event_mutex is not good way to pause thread
because locking wl_event_mutex can effect other wayland threads.
TO-BE
Using tpl_gthread_pause_in_idle is better way than before.
Because locking on idle allows thread to handle other tasks.
Change-Id: I47a1b82a91ede648ceb8a8a1e7967fa56950ba00
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Wed, 16 Nov 2022 08:21:08 +0000 (17:21 +0900)]
utils_gthread: Add new functions to pause/continue thread
tpl_gthread_wait_idle
- Create a new idle source and attach it to thread context.
This function will be blocked until idle callback is called.
If the thread has some worksto be handled, wait for
the thread to finish it.
tpl_gthread_pause_in_idle
- Pause the thread when idle callback is called.
tpl_gthread_continue
- Continue the paused thread.
Change-Id: I5a2aaf3b8b9579306246234d252b643b6cc0bf3e
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 10 Nov 2022 14:57:16 +0000 (23:57 +0900)]
Package version up to 1.9.11
Change-Id: I03d05215651ab24596e24a9a8d011cd7a4940b2f
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 10 Nov 2022 14:45:49 +0000 (23:45 +0900)]
wl_egl: Print additional INFO logs at buffer_clear
Change-Id: I5cbd4b6b96bc149407969834d4147aeebb3cf2e2
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 10 Nov 2022 10:36:33 +0000 (19:36 +0900)]
wl_egl: Set timeout for buffer_clear to 500ms
- Some system condition problems may cause signal after 200ms.
Change-Id: I40bdbf7cc862e0026228b85644eda60f15b86dec
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 27 Oct 2022 23:35:20 +0000 (08:35 +0900)]
Package version up to 1.9.10
Change-Id: I43791c514fa7abd274b238d7cdfbc3489e8278eb
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 27 Oct 2022 15:02:58 +0000 (00:02 +0900)]
wl_egl: Add defense code for fake signal in buffer_clear
tpl_gcond_timed_wait is changed to be called within the while loop.
It will repeat the process of checking status even if it wakes up
due to Fake Signal.
Change-Id: Ia66810da64ba2830c166f01dcb2f2f4615fc8e4f
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 27 Oct 2022 11:04:52 +0000 (20:04 +0900)]
wl_vk: Add missed flag setting when surface_init
Change-Id: I45e7d3135a6780a1f08b10fe8913fc9ffe71af7f
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
jinbong, Lee [Wed, 19 Oct 2022 09:58:06 +0000 (18:58 +0900)]
Remove unused int64, int32 hash key for fixing Svace warning
Change-Id: I9bb85b566db975860e4243c39683f40e60601aed
Joonbum Ko [Wed, 5 Oct 2022 01:58:46 +0000 (10:58 +0900)]
Package version up to 1.9.9
Change-Id: I6c7059dae6306e235be00ac9ec8bd1f7d3112136
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Wed, 5 Oct 2022 01:57:23 +0000 (10:57 +0900)]
Add null checking before calling tpl_gsource_destroy.
Change-Id: I431f21b80215abeafc5ab6daa45778f617cc661a
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Wed, 5 Oct 2022 01:49:43 +0000 (10:49 +0900)]
Remove unncessary header
Change-Id: I810ec7c149bbb782d8e04167f66810171226d728
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 30 Sep 2022 07:35:33 +0000 (16:35 +0900)]
Package version up to 1.9.8
Change-Id: I7a1bda7114b8cf98de0cd8f2f02dfb6b8d2c25fa
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 30 Sep 2022 07:33:54 +0000 (16:33 +0900)]
Modified to call tpl_gsource_destroy only once.
- tpl_gsource_destroy means 'sending destroy message to thread'.
So it need not to be called in loop.
Change-Id: Ifd5706d738a2385396acaa3723138b2f564de4c2
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Fri, 30 Sep 2022 07:23:50 +0000 (16:23 +0900)]
Changed the order of lock/unlock at buffer_clear.
- The lock/unlock order of buffer->mutex and display->wl_event_mutex
is important. display->mutex must surround buffer->mutex
- Before applying this patch, deadlock issue may be
occured in buffer_clear.
Change-Id: I90d9b36874def4e4c7f0bd36742b3bbd00faab44
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 29 Sep 2022 12:04:56 +0000 (21:04 +0900)]
Delete wrong g_main_context_unref
- GMainContext is also destroyed when GMainLoop is destroyed.
Therefore, it is the wrong code to do context_unref before loop_unref.
Change-Id: Ib57eab7ba4345565977102abb0df3268d7f42acb
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 29 Sep 2022 11:45:42 +0000 (20:45 +0900)]
Changed the function name properly.
tpl_cond_timed_wait -> tpl_gcond_timed_wait
Change-Id: Iebe13b6aa7598d652cf3b5968dbc7b2bb96a44e0
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Tue, 27 Sep 2022 11:41:14 +0000 (20:41 +0900)]
Modified the codes related to call tpl_gcond_wait.
- g_cond_wait is sometimes awakened by unknown or stolen signal.
In such cases, unexpected problems may arise. To prevent these problems,
each tpl_gsource has tpl_gmutex and tpl_gcond, and modified to try
tpl_gcond_wait() until gsource_finalized flag becomes true.
- It may be modified with better way.
Change-Id: I1360c0a3888186ba0309fe4d94c5be8e29c6f1b8
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Wed, 28 Sep 2022 11:26:57 +0000 (20:26 +0900)]
Delete g_cond_wait from tpl_gsource_destroy.
- g_cond_wait does not guarantee perfectly.
Therefore, it is recommended that the caller of tpl_gsource_destroy
should call the g_cond_wait to confirm if the destroy is
actually complete.
- https://docs.gtk.org/glib/method.Cond.wait.html
Atomically releases mutex and waits until cond is signalled.
When this function returns, mutex is locked again
and owned by the calling thread.
When using condition variables, it is possible that a spurious
wakeup may occur (ie: g_cond_wait() returns even though g_cond_signal()
was not called). It’s also possible that a stolen wakeup may occur.
This is when g_cond_signal() is called, but another thread acquires
mutex before this thread and modifies the state of the program in such
a way that when g_cond_wait() is able to return,
the expected condition is no longer met.
For this reason, g_cond_wait() must always be used in a loop.
See the documentation for GCond for a complete example.
Change-Id: If3b98b4d79b205d9125558edb75f4b85ef6a3a99
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 9 Jun 2022 10:13:37 +0000 (19:13 +0900)]
Package version up to 1.9.7
Change-Id: I9a15a0ff3f4accd438af5fe8abd89d71fc1275fa
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 9 Jun 2022 10:04:11 +0000 (19:04 +0900)]
Fixed to prevent page fault via invalid address.
- If the last_enq_buffer of wl_egl_surface has a wrong pointer address,
page fault may occur inside the tbm_surface_internal_is_valid of libtbm.
- To prevent this problem, it is modified to check in advance from
the list of buffers of wl_egl_surface.
Change-Id: I459b182e9ed435ce93a3a862251869fb9c7829ad
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Joonbum Ko [Thu, 9 Jun 2022 09:43:49 +0000 (18:43 +0900)]
Added internal function to check buffer is validate
- It can be modified flexibly.
- For now, this function can check if given tbm_surface_h
is managed by wl_egl_surface.
Change-Id: Ied59f583666a5f18f15537be6507c83c5277a866
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
Jinbong [Mon, 18 Jul 2022 05:53:58 +0000 (14:53 +0900)]
Fix pointer to int cast warning
Change-Id: Id0af40582f900c46745f6c1b8e6864789daeca81
Jinbong [Mon, 18 Jul 2022 05:46:27 +0000 (14:46 +0900)]
Revert "Remove compile warning about casting to pointer from integer of different size"
This reverts commit
b1725298fc58f3e2e63da142bf9687a214f38146.