ppython[394] <Error>: kCGErrorIllegalArgument: CGSCopyRegion : Null pointer

Bug #727887 reported by Mike Stoddart
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Panda3D
Fix Released
High
David Rose
1.7.x
Fix Released
High
rdb

Bug Description

All of the demos I have tried show the following errors on my MacBook Pro (2009 15" i7 model):

ppython Tut-Fireflies.py
DirectStart: Starting the game.
Known pipe types:
  osxGraphicsPipe
(all display modules loaded.)
Wed Mar 2 11:49:25 Mike-Stoddarts-MacBook-Pro.local ppython[394] <Error>: kCGErrorIllegalArgument: CGSCopyRegion : Null pointer
Wed Mar 2 11:49:25 Mike-Stoddarts-MacBook-Pro.local ppython[394] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
:display:gsg:glgsg(error): Could not load Cg fragment program:/Developer/Examples/Panda3D/Fireflies/model.sha (arbfp1 Error on line 2: unrecognised option (hint: 'ATI_draw_buffers'))
:display:gsg:glgsg(error): at 384 of panda/src/glstuff/glShaderContext_src.cxx : GL error 1282
Wed Mar 2 11:49:30 Mike-Stoddarts-MacBook-Pro.local ppython[394] <Error>: kCGErrorIllegalArgument: _CGSFindSharedWindow: WID 490
Wed Mar 2 11:49:30 Mike-Stoddarts-MacBook-Pro.local ppython[394] <Error>: kCGErrorIllegalArgument: CGSRemoveSurface: Invalid window 0x1ea

That particular demo still runs.

Tags: osx
rdb (rdb)
tags: added: osx
Revision history for this message
Craig Macomber (craigm) wrote :

This code spews an error every frame:

import direct.directbase.DirectStart
buffer = base.win.makeTextureBuffer('break', 1, 1)
run()

Fri Mar 11 18:40:34 CraigsBook.local Python[4509] <Error>: kCGErrorIllegalArgument: CGSCopyRegion : Null pointer

Every frame I get these from my active back buffer (as in the example code) for water reflections. I also get a bunch of the same errors when doing other stuff with buffers I only activate for a single (or a few) frames.

Entire error report from my example code:

DirectStart: Starting the game.
Known pipe types:
  osxGraphicsPipe
(all display modules loaded.)
Fri Mar 11 18:40:34 CraigsBook.local Python[4509] <Error>: kCGErrorIllegalArgument: CGSCopyRegion : Null pointer
Fri Mar 11 18:40:34 CraigsBook.local Python[4509] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
Fri Mar 11 18:40:34 CraigsBook.local Python[4509] <Error>: kCGErrorIllegalArgument: CGSCopyRegion : Null pointer
Fri Mar 11 18:40:34 CraigsBook.local Python[4509] <Error>: kCGErrorIllegalArgument: CGSCopyRegion : Null pointer
...
Fri Mar 11 18:40:35 CraigsBook.local Python[4509] <Error>: kCGErrorIllegalArgument: CGSCopyRegion : Null pointer
Fri Mar 11 18:40:35 CraigsBook.local Python[4509] <Error>: kCGErrorIllegalArgument: CGSCopyRegion : Null pointer
Fri Mar 11 18:40:35 CraigsBook.local Python[4509] <Error>: kCGErrorIllegalArgument: CGSCopyRegion : Null pointer
Fri Mar 11 18:40:35 CraigsBook.local Python[4509] <Error>: kCGErrorIllegalArgument: _CGSFindSharedWindow: WID 295
Fri Mar 11 18:40:35 CraigsBook.local Python[4509] <Error>: kCGErrorIllegalArgument: CGSRemoveSurface: Invalid window 0x127

I have seen this error before in 1.7.0, however I do not think the case of it showing up every single frame occurred before, like it does in 1.7.1

Revision history for this message
Craig Macomber (craigm) wrote :

I have confirmed that my test code produces this output on 1.7.0:
>>> import direct.directbase.DirectStart
DirectStart: Starting the game.
Known pipe types:
  osxGraphicsPipe
(all display modules loaded.)
Fri Mar 18 00:47:51 CraigsBook.local Python[4652] <Error>: kCGErrorIllegalArgument: CGSCopyRegion : Null pointer
Fri Mar 18 00:47:51 CraigsBook.local Python[4652] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
>>> buffer = base.win.makeTextureBuffer('break', 1, 1)
>>> run()

This is in contrast to the infinite error spam it produces in 1.7.1. As shown, the initial error is produced by importing direct.directbase.DirectStart, and happens under both 1.7.1 and 1.7.0, while the other repeated errors (which are the same error) are only present in 1.7.1, and produced by having an active buffer.

rdb (rdb)
Changed in panda3d:
milestone: none → 1.7.2
importance: Undecided → High
status: New → Confirmed
Revision history for this message
rdb (rdb) wrote :

Does setting "osx-support-gl-buffer" to 1 in Config.prc help any?

Revision history for this message
Yaio (yaio79) wrote :

@rdb: I tested your last suggestion. In my case, it doesn't solve: I get this error with or without that setting:
<Error>: kCGErrorIllegalArgument: CGSCopyRegion : Null pointer

Revision history for this message
Yaio (yaio79) wrote :

Regarding the flooding that appears in the Craig's example, actually rdb's suggestion prevents the flooding.

Revision history for this message
rdb (rdb) wrote :

OK, I'll commit a workaround to the 1.7 branch to stop the flood.
The flood was triggered by the fact that David added osx-support-gl-buffer and set it to false by default. I accidentally picked it up for 1.7.1, which shouldn't have happened, so I just checked in a workaround to set it to true on the 1.7 branch, to revert to the 1.7.0 behaviour.

I haven't touched the trunk, so it's still broken there. Perhaps David can give some feedback on the issue? (David, I assigned it to you just to attract your attention, feel free to reassign it)

Changed in panda3d:
assignee: nobody → David Rose (droklaunchpad)
milestone: 1.7.2 → 1.8.0
Revision history for this message
rdb (rdb) wrote :

Just to clarify:

1.7.0/1.7.2:
  Error shows up once.

1.7.1/trunk:
  Error floods the terminal due to osx-support-gl-buffer being set to #f.

So for 1.7.2, I didn't really 'fix' the issue, I only reverted to 1.7.0 behaviour, which just shows the error once instead of flooding.

Revision history for this message
David Rose (droklaunchpad) wrote :

I added that config variable to protect against crashes in Pirates by people who had crappy graphics cards and/or buggy drivers. With that variable set #f, an offscreen buffer is created via the older AGLPbuffers interface, which seemed to be less likely to crash horribly.

However, it also appears that this interface has other flaws; in particular, it doesn't support multiple render targets; and it causes this error spammage. The error message is particularly mysterious, because it appears to be generated when the *main* window calls aglSetDrawable(), just by virtue of the fact that an offscreen buffer has been created.

Whatever. I'll change the default to true, to avoid this spammage and make the fireflies demo work, assuming your graphics drivers are not as bad as the users who were trying to run Pirates.

David

Revision history for this message
rdb (rdb) wrote :

Thanks!

Changed in panda3d:
status: Confirmed → Fix Committed
rdb (rdb)
Changed in panda3d:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.