#2491 closed defect (fixed)
macos opengl paint error
Reported by: | Antoine Martin | Owned by: | Antoine Martin |
---|---|---|---|
Priority: | critical | Milestone: | 4.0 |
Component: | client | Version: | 4.0.x |
Keywords: | Cc: |
Description (last modified by )
Was just running xpra keyboard-test
trying to reproduce #2480.
client 1 @25.820 Error painting planar update client 1 @25.820 File "/Users/osx/Desktop/Xpra.app/Contents/Resources/lib/python/xpra/client/gl/gl_window_backing_base.py", line 1113, in gl_paint_planar client 1 @25.820 self.update_planar_textures(enc_width, enc_height, img, pixel_format, scaling=scaling) client 1 @25.820 File "/Users/osx/Desktop/Xpra.app/Contents/Resources/lib/python/xpra/client/gl/gl_window_backing_base.py", line 1190, in update_planar_textures client 1 @25.820 glTexSubImage2D(target, 0, 0, 0, w, h, GL_LUMINANCE, GL_UNSIGNED_BYTE, pixel_data) client 1 @25.820 File "latebind.pyx", line 32, in OpenGL_accelerate.latebind.LateBind.__call__ (src/latebind.c:989) client 1 @25.820 File "wrapper.pyx", line 318, in OpenGL_accelerate.wrapper.Wrapper.__call__ (src/wrapper.c:6561) client 1 @25.820 GLError: GLError( client 1 @25.820 err = 1282, client 1 @25.820 description = 'invalid operation', client 1 @25.820 baseOperation = glTexSubImage2D, client 1 @25.820 pyArgs = ( client 1 @25.820 GL_TEXTURE_RECTANGLE_ARB, client 1 @25.820 0, client 1 @25.820 0, client 1 @25.820 0, client 1 @25.820 500, client 1 @25.820 274, client 1 @25.820 GL_LUMINANCE, client 1 @25.820 GL_UNSIGNED_BYTE, client 1 @25.820 <memory at 0x11fc289b0>, client 1 @25.820 ), client 1 @25.820 cArgs = ( client 1 @25.820 GL_TEXTURE_RECTANGLE_ARB, client 1 @25.820 0, client 1 @25.820 0, client 1 @25.820 0, client 1 @25.820 500, client 1 @25.820 274, client 1 @25.820 GL_LUMINANCE, client 1 @25.820 GL_UNSIGNED_BYTE, client 1 @25.820 <memory at 0x11fc289b0>, client 1 @25.820 ), client 1 @25.820 cArguments = ( client 1 @25.820 GL_TEXTURE_RECTANGLE_ARB, client 1 @25.820 0, client 1 @25.820 0, client 1 @25.820 0, client 1 @25.820 500, client 1 @25.820 274, client 1 @25.820 GL_LUMINANCE, client 1 @25.820 GL_UNSIGNED_BYTE, client 1 @25.820 <memory at 0x11fc289b0>, client 1 @25.820 ) client 1 @25.820 ) Warning: client decoding error: OpenGL h264 paint failed: GLError( err=1282, description = 'invalid operation', baseOperation = glTexSubImage2D ) client 1 @25.828 flush=0, image=AVImageWrapper-AVFrameWrapper(0x7f98f8cdb540)(GBRP:(0, 0, 500, 274, 24):3_PLANES), coords=(20, 170, 500, 274), size=500x274 client 1 @25.938 Error painting planar update client 1 @25.938 File "/Users/osx/Desktop/Xpra.app/Contents/Resources/lib/python/xpra/client/gl/gl_window_backing_base.py", line 1113, in gl_paint_planar client 1 @25.938 self.update_planar_textures(enc_width, enc_height, img, pixel_format, scaling=scaling) client 1 @25.938 File "/Users/osx/Desktop/Xpra.app/Contents/Resources/lib/python/xpra/client/gl/gl_window_backing_base.py", line 1190, in update_planar_textures client 1 @25.938 glTexSubImage2D(target, 0, 0, 0, w, h, GL_LUMINANCE, GL_UNSIGNED_BYTE, pixel_data) client 1 @25.938 File "latebind.pyx", line 32, in OpenGL_accelerate.latebind.LateBind.__call__ (src/latebind.c:989) client 1 @25.938 File "wrapper.pyx", line 318, in OpenGL_accelerate.wrapper.Wrapper.__call__ (src/wrapper.c:6561) client 1 @25.938 GLError: GLError( client 1 @25.938 err = 1282, client 1 @25.938 description = 'invalid operation', client 1 @25.938 baseOperation = glTexSubImage2D, client 1 @25.938 pyArgs = ( client 1 @25.938 GL_TEXTURE_RECTANGLE_ARB, client 1 @25.938 0, client 1 @25.938 0, client 1 @25.938 0, client 1 @25.938 500, client 1 @25.938 274, client 1 @25.938 GL_LUMINANCE, client 1 @25.938 GL_UNSIGNED_BYTE, client 1 @25.938 <memory at 0x11fc28b90>, client 1 @25.938 ), client 1 @25.938 cArgs = ( client 1 @25.938 GL_TEXTURE_RECTANGLE_ARB, client 1 @25.938 0, client 1 @25.938 0, client 1 @25.938 0, client 1 @25.938 500, client 1 @25.938 274, client 1 @25.938 GL_LUMINANCE, client 1 @25.938 GL_UNSIGNED_BYTE, client 1 @25.938 <memory at 0x11fc28b90>, client 1 @25.938 ), client 1 @25.938 cArguments = ( client 1 @25.938 GL_TEXTURE_RECTANGLE_ARB, client 1 @25.938 0, client 1 @25.938 0, client 1 @25.938 0, client 1 @25.938 500, client 1 @25.938 274, client 1 @25.938 GL_LUMINANCE, client 1 @25.938 GL_UNSIGNED_BYTE, client 1 @25.938 <memory at 0x11fc28b90>, client 1 @25.938 ) client 1 @25.938 ) client 1 @25.947 flush=0, image=AVImageWrapper-AVFrameWrapper(0x7f98fc3e9000)(GBRP:(0, 0, 500, 274, 24):3_PLANES), coords=(20, 170, 500, 274), size=500x274 (..) Warning: client decoding error: OpenGL RGB paint failed: GLError( err=1282, description = 'invalid operation', baseOperation = glEnd ) client 1 @26.588 Error painting planar update client 1 @26.588 File "/Users/osx/Desktop/Xpra.app/Contents/Resources/lib/python/xpra/client/gl/gl_window_backing_base.py", line 1121, in gl_paint_planar client 1 @26.588 self.render_planar_update(x, y, enc_width, enc_height, x_scale, y_scale, shader) client 1 @26.588 File "/Users/osx/Desktop/Xpra.app/Contents/Resources/lib/python/xpra/client/gl/gl_window_backing_base.py", line 1218, in render_planar_update client 1 @26.588 glEnd() client 1 @26.588 File "latebind.pyx", line 44, in OpenGL_accelerate.latebind.Curry.__call__ (src/latebind.c:1201) client 1 @26.588 File "/Users/osx/Desktop/Xpra.app/Contents/Resources/lib/python/site-packages.zip/OpenGL/GL/exceptional.py", line 45, in glEnd client 1 @26.588 return baseFunction( ) client 1 @26.588 File "errorchecker.pyx", line 53, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError (src/errorchecker.c:1218) client 1 @26.588 GLError: GLError( client 1 @26.588 err = 1282, client 1 @26.588 description = 'invalid operation', client 1 @26.588 baseOperation = glEnd, client 1 @26.588 cArguments = () client 1 @26.588 ) client 1 @26.596 flush=0, image=AVImageWrapper-AVFrameWrapper(0x7f98fc3e8900)(GBRP:(0, 0, 504, 236, 24):3_PLANES), coords=(20, 151, 504, 236), size=504x236 Warning: client decoding error: OpenGL h264 paint failed: GLError( err=1282, description = 'invalid operation', baseOperation = glEnd ) client 1 @26.685 Error painting planar update client 1 @26.685 File "/Users/osx/Desktop/Xpra.app/Contents/Resources/lib/python/xpra/client/gl/gl_window_backing_base.py", line 1121, in gl_paint_planar client 1 @26.685 self.render_planar_update(x, y, enc_width, enc_height, x_scale, y_scale, shader) client 1 @26.685 File "/Users/osx/Desktop/Xpra.app/Contents/Resources/lib/python/xpra/client/gl/gl_window_backing_base.py", line 1218, in render_planar_update client 1 @26.685 glEnd() client 1 @26.685 File "latebind.pyx", line 44, in OpenGL_accelerate.latebind.Curry.__call__ (src/latebind.c:1201) client 1 @26.685 File "/Users/osx/Desktop/Xpra.app/Contents/Resources/lib/python/site-packages.zip/OpenGL/GL/exceptional.py", line 45, in glEnd client 1 @26.685 return baseFunction( ) client 1 @26.685 File "errorchecker.pyx", line 53, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError (src/errorchecker.c:1218) client 1 @26.685 GLError: GLError( client 1 @26.685 err = 1282, client 1 @26.685 description = 'invalid operation', client 1 @26.685 baseOperation = glEnd, client 1 @26.685 cArguments = () client 1 @26.685 ) client 1 @26.694 flush=0, image=AVImageWrapper-AVFrameWrapper(0x7f98fb0f4c40)(GBRP:(0, 0, 504, 236, 24):3_PLANES), coords=(20, 151, 504, 236), size=504x236
This could well be related to the changes from #2481
Attachments (1)
Change History (13)
comment:1 Changed 16 months ago by
Description: | modified (diff) |
---|---|
Priority: | major → critical |
Status: | new → assigned |
Version: | 3.0.x → 4.0.x |
comment:3 Changed 15 months ago by
Easy to reproduce with keyboard-test
and --encodings=jpeg
.
Adding debug logging to the glMultiTexCoord2i
and glVertex2i
calls found in the glBegin
/ glEnd
block does not show any invalid values.
Could be related to the changes of how / when we call present_fbo
but XPRA_OPENGL_DRAW_REFRESH=0
does not help.
Even when this bug is fixed, maybe we should re-initialize the window in case of paint errors?
Maybe the opengl probe should use a JPEG YUV paint?
What is the difference between a new window and one we just connected to?
It is the very first paint that fails. Keeping jpeg but switching to XPRA_JPEG_YUV=0
works OK. Delaying the first YUV paint using a counter does not help.
comment:4 Changed 15 months ago by
Duplicate ticket: #2499.
Bisection:
- r24565 bad
- r24000 needs this patch to run:
--- ../src/xpra/platform/darwin/gui.py (revision 24000) +++ ../src/xpra/platform/darwin/gui.py (working copy) @@ -89,7 +89,7 @@ import gi gi.require_version('GtkosxApplication', '1.0') from gi.repository import GtkosxApplication #@UnresolvedImport - gtkosx_application = GtkosxApplication() + gtkosx_application = GtkosxApplication macapp = gtkosx_application.Application() macapp.connect("NSApplicationWillTerminate", quit_handler) return macapp
- r24250 bad
- r24125 runtime problems with missing opengl bits..
- r24000 ditto
- r23900 ditto
- r23800 OK, just needs r24191 added
- r23850 opengl runtime problems
- r23825 ditto
- r23810 ditto
...
Not so easy then as the range from r23800 to ~r24250 cannot be bisected.
Trying to find the fix for the "runtime opengl problem", to then be able to bisect before r24250:
comment:5 Changed 15 months ago by
Restarting bisection (and adding +r24188 + r24189 + r24191):
- r24000: bad
- r23900: bad
- r23850: bad
- r23825: bad
- r23812: bad
- r23806: bad
- r23803: bad
- r23802: bad (no change)
- r23801: bad (no change: tag v3.0.x)
- r23800: bad - wth? (tested OK before!)
Trying with v2.5.x: needs r23527 to be able to run the packaging scripts, r24575 automates this.
v2.5.3-r24575 works OK (latest from 2.5.x branch)
So the regression happened somewhere between r22133 (tag v2.5.x) and 3.0.3.
Changed 15 months ago by
Attachment: | bundle.patch added |
---|
updated patch for building trunk circa 3.0-dev
comment:6 Changed 15 months ago by
comment:7 Changed 15 months ago by
Splitting the patch and applying piece by piece.
No problems with these parts of r23560 (some for obvious reasons since unused, ie: gtk2, gtkgl):
- browser/xpra/trunk/src/xpra/client/gl/gtk3/gtkgl_client_window.py
- browser/xpra/trunk/src/xpra/client/gtk2/gtk2_window_base.py
- browser/xpra/trunk/src/xpra/client/gtk_base/gtk_client_window_base.py
- browser/xpra/trunk/src/xpra/client/gtk3/client_window.py
The last few are harder to untangle. gtk3/gtk3_client_window.py
started as a copy of gtk3/client_window.py
.
Applying this part of the change triggers the bug: browser/xpra/trunk/src/xpra/client/gl/gtk3/gl_client_window.py.
But unsurprisingly, keeping gtk3/gtk3_client_window.py
as a verbatim copy of gtk3/client_window.py
works OK.
So the problem comes from the seemingly innocuous changes here: changeset/23560/xpra
Applying piece by piece, it is the init_drawing_area
vs init_widget_events
change that breaks things.
Specifically, overriding init_widget_events
and registering the "draw" event callback.
This ensures we use our custom code for painting the drawing area widget, and this calls backing.cairo_draw
which calls present_fbo
with the opengl backend.
Skipping cairo_draw
also works.
The updates end up on screen thanks to queue_draw_area
which calls gl_expose_rect
.
Removing the queue_draw_area
overrides from both gl_client_window
and gtk3_client_window
and letting the normal GTK code call down to our drawing_area_draw
also triggers the error..
Again, only reliably with a new window, not when connecting to an existing window!?!
comment:8 Changed 15 months ago by
Interestingly, XPRA_OPENGL_DRAW_REFRESH=0
triggers the bug more.
Using the big hammer, looking for log differences with -d opengl,metadata,geometry,state,window
:
- window created after connecting (bug) - summarized:
process_new_common: [7, 0, 0, 540, 800, {b'xid': b'0x400003', ... make_new_backing(<class 'xpra.client.gl.gtk3.gl_drawing_area.GLDrawingArea'>, 540, 800, 540, 800) effective backing class=<class 'xpra.client.gl.gtk3.gl_drawing_area.GLDrawingArea'>, server alpha=False, window alpha=False make_new_window(..) window(7)=GLClientWindow(7 : GLDrawingArea(7, (540, 800), None)) clip_to_backing(GLDrawingArea(7, (540, 800), None), <cairo.Context object at 0x12191e470>) rectangle=(0, 0, 540, 667) get_paint_context(<__gi__.GdkQuartzWindow object at 0x1234a20f0 (GdkQuartzWindow at 0x7f89e21a3650)>) nsview(0x7f89e42ce100)=<GdkQuartzView: 0x7f89e42ce100> AGLWindowContext(<NSOpenGLContext: 0x7f89e42da890>, <GdkQuartzView: 0x7f89e42ce100>) present_fbo: adding (0, 0, 540, 800) to pending paint list (size=0), flush=0, paint_screen=False 'configure-window', 7, 0, 45, 540, 667, {'encodings.rgb_formats': ... 'configure-window', 7, 0, 45, 540, 667, {}, 0, {}, False, 7, (0, 443), ['mod2'] window_state_updated(..) state updates: {'focused': True}, actual updates: {'focused': True}, server updates: {'focused': True} map-window wid=7, geometry=(0, 45, 540, 667), client props={'workspace': 65535}, state={'focused': True, 'frame': (0, 0, 22, 0)} get_paint_context(<__gi__.GdkQuartzWindow object at 0x129040a00 (GdkQuartzWindow at 0x7fbcea023650)>) nsview(0x7fbce97b7300)=<GdkQuartzView: 0x7fbce97b7300> -> AGLWindowContext(<NSOpenGLContext: 0x7f89e46f99b0>, <GdkQuartzView: 0x7f89e42ce100>) do_present_fbo: painting ((0, 0, 540, 667),) 2.do_gl_show(GLDrawingArea(7, (540, 667), None)) swapping buffers now GL cursor 16x16 uploaded 1024 bytes of RGBA pixel data using zerocopy:bytes-as-memoryview metadata update for window 7: {b'iconic': False} metadata update for window 7: {b'size-constraints': {b'base-size': (0, 0), b'gravity': 1, b'minimum-size': (139, 139)}} gl_paint_planar(0, 'jpeg', ImageWrapper(YUV444P:(0, 0, 540, 667, 24):PACKED), 0, 0, 540, 667, 540, 667, [<function WindowClient._do_draw.<locals>.record_decode_time at 0x110689170>, <bound method ClientWindowBase.after_draw_refresh of GLClientWindow(7 : GLDrawingArea(7, (540, 667), None))>]) GLDrawingArea(7, (540, 667), YUV444P).render_planar_update(0, 0, 540, 667, 1, 1, 2) pixel_format=YUV444P OpenGL jpeg paint failed: GLError( err=1282, description = b'invalid operation', baseOperation = glEnd )
- window already created (OK):
process_new_common: [7, 0, 45, 540, 667, {b'xid': b'0x400003', ... make_new_backing(<class 'xpra.client.gl.gtk3.gl_drawing_area.GLDrawingArea'>, 540, 667, 540, 667) effective backing class=<class 'xpra.client.gl.gtk3.gl_drawing_area.GLDrawingArea'>, server alpha=False, window alpha=False make_new_window(..) window(7)=GLClientWindow(7 : GLDrawingArea(7, (540, 667), None)) -> missing clip_to_backing? get_paint_context(<__gi__.GdkQuartzWindow object at 0x12a9a4550 (GdkQuartzWindow at 0x7f90690ba1a0)>) nsview(0x7f9068fbd640)=<GdkQuartzView: 0x7f9068fbd640> AGLWindowContext(<NSOpenGLContext: 0x7f9068fa14c0>, <GdkQuartzView: 0x7f9068fbd640>) -> GL cursor 16x16 uploaded 1024 bytes of RGBA pixel data using zerocopy:bytes-as-memoryview -> clip_to_backing(GLDrawingArea(7, (540, 667), None), <cairo.Context object at 0x11972bc30>) rectangle=(0, 0, 540, 667) present_fbo: adding (0, 0, 540, 667) to pending paint list (size=0), flush=0, paint_screen=False 'configure-window', 7, 0, 45, 540, 667, {'encodings.rgb_formats': ... 'configure-window', 7, 0, 45, 540, 667, {}, 0, {}, False, 7, (3, 552), ['mod2'] window_state_updated(..) state updates: {'focused': True}, actual updates: {'focused': True}, server updates: {'focused': True} map-window wid=7, geometry=(0, 45, 540, 667), client props={'workspace': 65535}, state={'focused': True, 'frame': (0, 0, 22, 0)} do_present_fbo: painting ((0, 0, 540, 667),) 2.do_gl_show(GLDrawingArea(7, (540, 667), None)) swapping buffers now GL cursor 16x16 uploaded 1024 bytes of RGBA pixel data using zerocopy:bytes-as-memoryview gl_paint_planar(3, 'jpeg', ImageWrapper(YUV444P:(0, 0, 540, 178, 24):PACKED), 0, 489, 540, 178, 540, 178, [<function WindowClient._do_draw.<locals>.record_decode_time at 0x1196ecd40>]) Creating new planar textures, pixel format YUV444P (was None), texture size (540, 178) (was (0, 0)) GLDrawingArea(7, (540, 667), YUV444P).render_planar_update(0, 489, 540, 178, 1, 1, 2) pixel_format=YUV444P ... gl_paint_planar(2, 'jpeg', .. gl_paint_planar(1, 'jpeg', .. gl_paint_planar(0, 'jpeg', do_present_fbo: painting ((0, 0, 540, 667),) 1.do_gl_show(GLDrawingArea(7, (540, 667), YUV444P)) swapping buffers now
Disabling the cursor code makes no difference.
The two AGLWindowContext
instances look suspicious: the GdkQuartzWindow
they're for is not the same!?
One is preceded by a clip_to_backing
which is not the case when things work OK.
Turns out that this is due to the "context-reinit" workaround added in r23441 for macos: #2372, so smooth resizing #478 and window gravity #2217 will need to be re-tested.
We can't change the value of the flag because then window contents look weird after resizing.
"context-reinit" needs to be fixed or fbo resizing made to work on macos.. no easy fix!
comment:10 Changed 15 months ago by
Found the solution here: Update the Rendering Context When the Renderer or Geometry Changes using NSOpenGLContext.update().
So r24590 fixes "fbo resizing" on macos, and r24591 disables "context reinit" mode.
One more thing needed: we need to repaint the outer edge of the window which is not part of the drawing area.
comment:11 Changed 15 months ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Not going to worry about the outer edge as it's pretty difficult to trigger it and there's nothing to see there: it only happens when there's a geometry mismatch and the client geometry is bigger than it should be because GTK3 didn't honour our geometry constraints...
comment:12 Changed 6 weeks ago by
this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/2491
Reproducible if the window is created from an xterm, but re-connecting to the same session where the window is already shown does not show any errors!?
Also not present in v3?
With
-d draw,paint,opengl
: