beaufortfrancois / webgpu-cross-platform-app

WebGPU cross-platform app with CMake/Emscripten
https://developer.chrome.com/docs/web-platform/webgpu/build-app
97 stars 7 forks source link

X error with intel device #11

Closed jspanchu closed 2 weeks ago

jspanchu commented 1 month ago

On an intel gpu, I get an X error from glfwPollEvents() during the second iteration of the infinite loop.

X Error of failed request:  136
  Major opcode of failed request:  148 ()
  Minor opcode of failed request:  1
  Serial number of failed request:  274
  Current serial number in output stream:  274

The opcode details:

xdpyinfo -queryExt | grep opcode | grep 148
    Present  (opcode: 148)
Kangz commented 1 month ago

Could you add a call to SynchronouslyDebugX11() in Surface::Surface? It could help give a stack trace and lead to maybe a a root cause.

jspanchu commented 1 month ago

Good to know there is a function for that.

dawn::BreakPoint () at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/src/dawn/common/Assert.cpp:62
62  }
(gdb) bt
#0  dawn::BreakPoint () at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/src/dawn/common/Assert.cpp:62
#1  0x00007ffff672a993 in dawn::native::DebugX11::HandleError (d=0x555555ac1f40, e=0x7fffffffcce0) at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/src/dawn/native/X11Functions.cpp:78
#2  0x00007fffe64229f4 in _XError (dpy=dpy@entry=0x555555ac1f40, rep=rep@entry=0x7fffd0000b70) at ../../src/XlibInt.c:1503
#3  0x00007fffe6422af7 in handle_error (dpy=0x555555ac1f40, err=0x7fffd0000b70, in_XReply=<optimized out>) at ../../src/xcb_io.c:211
#4  0x00007fffe6422b95 in handle_response (dpy=dpy@entry=0x555555ac1f40, response=0x7fffd0000b70, in_XReply=in_XReply@entry=0) at ../../src/xcb_io.c:403
#5  0x00007fffe6422c6a in _XEventsQueued (mode=<optimized out>, dpy=0x555555ac1f40) at ../../src/xcb_io.c:442
#6  _XEventsQueued (dpy=0x555555ac1f40, mode=<optimized out>) at ../../src/xcb_io.c:423
#7  0x00007fffe640f291 in XPending (dpy=0x555555ac1f40) at ../../src/Pending.c:55
#8  0x0000555555578277 in _glfwPollEventsX11 () at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/third_party/glfw/src/x11_window.c:2790
#9  0x000055555556a9b6 in glfwPollEvents () at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/third_party/glfw/src/window.c:1170
#10 0x000055555555c208 in Start () at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/main.cpp:154
#11 0x000055555555c731 in main::$_0::operator()(wgpu::Adapter) const::{lambda(wgpu::Device)#1}::operator()(wgpu::Device) const (this=0x7fffffffcfe7, d=...)
    at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/main.cpp:168
#12 0x000055555555c708 in main::$_0::operator()(wgpu::Adapter) const::{lambda(wgpu::Device)#1}::__invoke(wgpu::Device) (d=...) at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/main.cpp:166
#13 0x000055555555c56b in GetDevice(void (*)(wgpu::Device))::$_0::operator()(WGPURequestDeviceStatus, WGPUDeviceImpl*, char const*, void*) const (this=0x7fffffffd07f, status=WGPURequestDeviceStatus_Success, 
    cDevice=0x55555598b6f0, message=0x0, userdata=0x55555555c6f0 <main::$_0::operator()(wgpu::Adapter) const::{lambda(wgpu::Device)#1}::__invoke(wgpu::Device)>)
    at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/main.cpp:67
#14 0x000055555555c4cf in GetDevice(void (*)(wgpu::Device))::$_0::__invoke(WGPURequestDeviceStatus, WGPUDeviceImpl*, char const*, void*) (status=WGPURequestDeviceStatus_Success, cDevice=0x55555598b6f0, message=0x0, 
    userdata=0x55555555c6f0 <main::$_0::operator()(wgpu::Adapter) const::{lambda(wgpu::Device)#1}::__invoke(wgpu::Device)>) at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/main.cpp:56
#15 0x00007ffff645fb5c in dawn::native::AdapterBase::APIRequestDeviceF(dawn::native::DeviceDescriptor const*, dawn::native::RequestDeviceCallbackInfo const&)::$_0::operator()(WGPURequestDeviceStatus, WGPUDeviceImpl*, char const*, void*, void*) const (this=0x7fffffffd107, status=WGPURequestDeviceStatus_Success, device=0x55555598b6f0, message=0x0, 
    callback=0x55555555c4a0 <GetDevice(void (*)(wgpu::Device))::$_0::__invoke(WGPURequestDeviceStatus, WGPUDeviceImpl*, char const*, void*)>, 
    userdata=0x55555555c6f0 <main::$_0::operator()(wgpu::Adapter) const::{lambda(wgpu::Device)#1}::__invoke(wgpu::Device)>)
    at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/src/dawn/native/Adapter.cpp:377
#16 0x00007ffff645fb17 in dawn::native::AdapterBase::APIRequestDeviceF(dawn::native::DeviceDescriptor const*, dawn::native::RequestDeviceCallbackInfo const&)::$_0::__invoke(WGPURequestDeviceStatus, WGPUDeviceImpl*, char const*, void*, void*) (status=WGPURequestDeviceStatus_Success, device=0x55555598b6f0, message=0x0, 
    callback=0x55555555c4a0 <GetDevice(void (*)(wgpu::Device))::$_0::__invoke(WGPURequestDeviceStatus, WGPUDeviceImpl*, char const*, void*)>, 
    userdata=0x55555555c6f0 <main::$_0::operator()(wgpu::Adapter) const::{lambda(wgpu::Device)#1}::__invoke(wgpu::Device)>)
    at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/src/dawn/native/Adapter.cpp:374
#17 0x00007ffff645fd0c in dawn::native::AdapterBase::APIRequestDevice2(dawn::native::DeviceDescriptor const*, WGPURequestDeviceCallbackInfo2 const&)::RequestDeviceEvent::Complete(dawn::EventCompletionType) (
    this=0x555555980930, completionType=dawn::EventCompletionType::Ready) at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/src/dawn/native/Adapter.cpp:421
#18 0x00007ffff65cb7b6 in dawn::native::EventManager::TrackedEvent::EnsureComplete (this=0x555555980930, completionType=dawn::EventCompletionType::Ready)
    at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/src/dawn/native/EventManager.cpp:592
#19 0x00007ffff65cb6b1 in dawn::native::EventManager::TrackEvent (this=0x5555555e9950, event=...) at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/src/dawn/native/EventManager.cpp:370
#20 0x00007ffff645f2f0 in dawn::native::AdapterBase::APIRequestDevice2 (this=0x55555582f080, descriptor=0x7ffff75641b8 <dawn::native::(anonymous namespace)::kDefaultDeviceDesc>, callbackInfo=...)
    at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/src/dawn/native/Adapter.cpp:434
#21 0x00007ffff645f1c9 in dawn::native::AdapterBase::APIRequestDeviceF (this=0x55555582f080, descriptor=0x0, callbackInfo=...)
    at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/src/dawn/native/Adapter.cpp:372
#22 0x00007ffff645f138 in dawn::native::AdapterBase::APIRequestDevice (this=0x55555582f080, descriptor=0x0, 
    callback=0x55555555c4a0 <GetDevice(void (*)(wgpu::Device))::$_0::__invoke(WGPURequestDeviceStatus, WGPUDeviceImpl*, char const*, void*)>, 
    userdata=0x55555555c6f0 <main::$_0::operator()(wgpu::Adapter) const::{lambda(wgpu::Device)#1}::__invoke(wgpu::Device)>)
    at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/src/dawn/native/Adapter.cpp:366
#23 0x00007ffff6418252 in dawn::native::NativeAdapterRequestDevice (cSelf=0x55555582f080, descriptor=0x0, 
    callback=0x55555555c4a0 <GetDevice(void (*)(wgpu::Device))::$_0::__invoke(WGPURequestDeviceStatus, WGPUDeviceImpl*, char const*, void*)>, 
    userdata=0x55555555c6f0 <main::$_0::operator()(wgpu::Adapter) const::{lambda(wgpu::Device)#1}::__invoke(wgpu::Device)>) at dawn/gen/src/dawn/native/ProcTable.cpp:126
#24 0x00007ffff755770d in wgpuAdapterRequestDevice (cSelf=0x55555582f080, descriptor=0x0, 
    callback=0x55555555c4a0 <GetDevice(void (*)(wgpu::Device))::$_0::__invoke(WGPURequestDeviceStatus, WGPUDeviceImpl*, char const*, void*)>, 
    userdata=0x55555555c6f0 <main::$_0::operator()(wgpu::Adapter) const::{lambda(wgpu::Device)#1}::__invoke(wgpu::Device)>) at dawn/gen/src/dawn/native/webgpu_dawn_native_proc.cpp:372
#25 0x000055555555ca05 in wgpu::Adapter::RequestDevice (this=0x5555555b2060 <adapter>, descriptor=0x0, 
    callback=0x55555555c4a0 <GetDevice(void (*)(wgpu::Device))::$_0::__invoke(WGPURequestDeviceStatus, WGPUDeviceImpl*, char const*, void*)>, 
    userdata=0x55555555c6f0 <main::$_0::operator()(wgpu::Adapter) const::{lambda(wgpu::Device)#1}::__invoke(wgpu::Device)>) at dawn/gen/include/dawn/webgpu_cpp.h:7454
#26 0x000055555555bb0c in GetDevice (callback=0x55555555c6f0 <main::$_0::operator()(wgpu::Adapter) const::{lambda(wgpu::Device)#1}::__invoke(wgpu::Device)>)
    at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/main.cpp:52
#27 0x000055555555c6bd in main::$_0::operator() (this=0x7fffffffd6d7, a=...) at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/main.cpp:166
#28 0x000055555555c688 in main::$_0::__invoke (a=...) at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/main.cpp:164
#29 0x000055555555c43e in GetAdapter(void (*)(wgpu::Adapter))::$_0::operator()(WGPURequestAdapterStatus, WGPUAdapterImpl*, char const*, void*) const (this=0x7fffffffd76f, status=WGPURequestAdapterStatus_Success, 
    cAdapter=0x55555582f080, message=0x0, userdata=0x55555555c670 <main::$_0::__invoke(wgpu::Adapter)>) at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/main.cpp:47
#30 0x000055555555c3af in GetAdapter(void (*)(wgpu::Adapter))::$_0::__invoke(WGPURequestAdapterStatus, WGPUAdapterImpl*, char const*, void*) (status=WGPURequestAdapterStatus_Success, cAdapter=0x55555582f080, message=0x0, 
    userdata=0x55555555c670 <main::$_0::__invoke(wgpu::Adapter)>) at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/main.cpp:38
#31 0x00007ffff65fdeec in dawn::native::InstanceBase::APIRequestAdapterF(dawn::native::RequestAdapterOptions const*, dawn::native::RequestAdapterCallbackInfo const&)::$_0::operator()(WGPURequestAdapterStatus, WGPUAdapterImpl*--Type <RET> for more, q to quit, c to continue without paging--
, char const*, void*, void*) const (this=0x7fffffffd7f7, status=WGPURequestAdapterStatus_Success, adapter=0x55555582f080, message=0x0, 
    callback=0x55555555c380 <GetAdapter(void (*)(wgpu::Adapter))::$_0::__invoke(WGPURequestAdapterStatus, WGPUAdapterImpl*, char const*, void*)>, userdata=0x55555555c670 <main::$_0::__invoke(wgpu::Adapter)>)
    at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/src/dawn/native/Instance.cpp:280
#32 0x00007ffff65fdea7 in dawn::native::InstanceBase::APIRequestAdapterF(dawn::native::RequestAdapterOptions const*, dawn::native::RequestAdapterCallbackInfo const&)::$_0::__invoke(WGPURequestAdapterStatus, WGPUAdapterImpl*, char const*, void*, void*) (status=WGPURequestAdapterStatus_Success, adapter=0x55555582f080, message=0x0, 
    callback=0x55555555c380 <GetAdapter(void (*)(wgpu::Adapter))::$_0::__invoke(WGPURequestAdapterStatus, WGPUAdapterImpl*, char const*, void*)>, userdata=0x55555555c670 <main::$_0::__invoke(wgpu::Adapter)>)
    at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/src/dawn/native/Instance.cpp:277
#33 0x00007ffff65fe0dc in dawn::native::InstanceBase::APIRequestAdapter2(dawn::native::RequestAdapterOptions const*, WGPURequestAdapterCallbackInfo2 const&)::RequestAdapterEvent::Complete(dawn::EventCompletionType) (
    this=0x5555559771f0, completionType=dawn::EventCompletionType::Ready) at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/src/dawn/native/Instance.cpp:316
#34 0x00007ffff65cb7b6 in dawn::native::EventManager::TrackedEvent::EnsureComplete (this=0x5555559771f0, completionType=dawn::EventCompletionType::Ready)
    at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/src/dawn/native/EventManager.cpp:592
#35 0x00007ffff65cb6b1 in dawn::native::EventManager::TrackEvent (this=0x5555555e9950, event=...) at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/src/dawn/native/EventManager.cpp:370
#36 0x00007ffff65fc612 in dawn::native::InstanceBase::APIRequestAdapter2 (this=0x5555555e97d0, 
    options=0x7ffff75dd598 <dawn::native::InstanceBase::APIRequestAdapter2(dawn::native::RequestAdapterOptions const*, WGPURequestAdapterCallbackInfo2 const&)::kDefaultOptions>, callbackInfo=...)
    at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/src/dawn/native/Instance.cpp:328
#37 0x00007ffff65fc509 in dawn::native::InstanceBase::APIRequestAdapterF (this=0x5555555e97d0, options=0x0, callbackInfo=...)
    at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/src/dawn/native/Instance.cpp:275
#38 0x00007ffff65fc478 in dawn::native::InstanceBase::APIRequestAdapter (this=0x5555555e97d0, options=0x0, 
    callback=0x55555555c380 <GetAdapter(void (*)(wgpu::Adapter))::$_0::__invoke(WGPURequestAdapterStatus, WGPUAdapterImpl*, char const*, void*)>, userdata=0x55555555c670 <main::$_0::__invoke(wgpu::Adapter)>)
    at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/dawn/src/dawn/native/Instance.cpp:268

#39 0x00007ffff641abd2 in dawn::native::NativeInstanceRequestAdapter (cSelf=0x5555555e97d0, options=0x0, 
    callback=0x55555555c380 <GetAdapter(void (*)(wgpu::Adapter))::$_0::__invoke(WGPURequestAdapterStatus, WGPUAdapterImpl*, char const*, void*)>, userdata=0x55555555c670 <main::$_0::__invoke(wgpu::Adapter)>)
    at dawn/gen/src/dawn/native/ProcTable.cpp:1327
#40 0x00007ffff7558eed in wgpuInstanceRequestAdapter (cSelf=0x5555555e97d0, options=0x0, 
    callback=0x55555555c380 <GetAdapter(void (*)(wgpu::Adapter))::$_0::__invoke(WGPURequestAdapterStatus, WGPUAdapterImpl*, char const*, void*)>, userdata=0x55555555c670 <main::$_0::__invoke(wgpu::Adapter)>)
    at dawn/gen/src/dawn/native/webgpu_dawn_native_proc.cpp:852
#41 0x000055555555c9c5 in wgpu::Instance::RequestAdapter (this=0x5555555b2058 <instance>, options=0x0, 
    callback=0x55555555c380 <GetAdapter(void (*)(wgpu::Adapter))::$_0::__invoke(WGPURequestAdapterStatus, WGPUAdapterImpl*, char const*, void*)>, userdata=0x55555555c670 <main::$_0::__invoke(wgpu::Adapter)>)
    at dawn/gen/include/dawn/webgpu_cpp.h:8214
#42 0x000055555555baac in GetAdapter (callback=0x55555555c670 <main::$_0::__invoke(wgpu::Adapter)>) at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/main.cpp:34
#43 0x000055555555c2a8 in main () at /home/local/KHQ/jaswant.panchumarti/dev/webgpu/webgpu-cross-platform-app/main.cpp:164

However it doesn't bring up any new clues. I was already aware that the issue occurred during glfwPollEvents.

Edit: updated stack trace after installing x11 debug syms

Kangz commented 1 month ago

At least we know that it is something done in glfwPollEvent itself and not a problem that's queued and only found in that function. I really don't know why "Present" would file then though :/

beaufortfrancois commented 1 month ago

@Kangz Shall we file a Chromium bug for this?

Kangz commented 1 month ago

TBH I don't know that we'd do anything, it seems to be between glfw and X11? Presumable that's not with the Dawn backend so IDK what we could do.

jspanchu commented 1 month ago

I could try without glfw and check if it still reports the same error

beaufortfrancois commented 2 weeks ago

Shall I close this issue?

jspanchu commented 2 weeks ago

yup, fine by me.