• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

hardware/intel/common/libva


Commit MetaInfo

修订版9ca99eb84cdb6ea638af567f6074c53fa51a416c (tree)
时间2017-08-17 12:06:29
作者Philipp Kerling <pkerling@casi...>
CommiterXiang, Haihao

Log Message

wayland: Add wl_drm listener immediately upon bind

Events on wl_drm could get lost if the listener is bound only after
the roundtrip is complete. While it is correct that to get all wl_drm
events at most two roundtrips are required, in fact one roundtrip may
be enough if another thread flushes and reads from the connection
in parallel to the initial libva wl_registry roundtrip. It is thus too
late to call wl_drm_add_listener after the roundtrip.

Fixes: #101

更改概述

差异

--- a/va/wayland/va_wayland_drm.c
+++ b/va/wayland/va_wayland_drm.c
@@ -154,7 +154,8 @@ registry_handle_global(
154154 uint32_t version
155155 )
156156 {
157- struct va_wayland_drm_context *wl_drm_ctx = data;
157+ VADisplayContextP const pDisplayContext = data;
158+ struct va_wayland_drm_context * const wl_drm_ctx = pDisplayContext->opaque;
158159
159160 if (strcmp(interface, "wl_drm") == 0) {
160161 /* bind to at most version 2, but also support version 1 if
@@ -164,6 +165,13 @@ registry_handle_global(
164165 wl_drm_ctx->drm =
165166 wl_registry_bind(wl_drm_ctx->registry, name, &wl_drm_interface,
166167 (version < 2) ? version : 2);
168+
169+ if (wl_drm_ctx->drm
170+ && wl_drm_add_listener(wl_drm_ctx->drm, &drm_listener, pDisplayContext) != 0) {
171+ va_wayland_error("could not add listener to wl_drm");
172+ wl_drm_destroy(wl_drm_ctx->drm);
173+ wl_drm_ctx->drm = NULL;
174+ }
167175 }
168176 }
169177
@@ -259,7 +267,7 @@ va_wayland_drm_create(VADisplayContextP pDisplayContext)
259267 va_wayland_error("could not create wl_registry");
260268 goto end;
261269 }
262- if (wl_registry_add_listener(wl_drm_ctx->registry, &registry_listener, wl_drm_ctx) != 0) {
270+ if (wl_registry_add_listener(wl_drm_ctx->registry, &registry_listener, pDisplayContext) != 0) {
263271 va_wayland_error("could not add listener to wl_registry");
264272 goto end;
265273 }
@@ -273,11 +281,6 @@ va_wayland_drm_create(VADisplayContextP pDisplayContext)
273281 /* Do not print an error, the compositor might just not support wl_drm */
274282 if (!wl_drm_ctx->drm)
275283 goto end;
276-
277- if (wl_drm_add_listener(wl_drm_ctx->drm, &drm_listener, pDisplayContext) != 0) {
278- va_wayland_error("could not add listener to wl_drm");
279- goto end;
280- }
281284 if (!wayland_roundtrip_queue(ctx->native_dpy, wl_drm_ctx->queue))
282285 goto end;
283286 if (drm_state->fd < 0) {