Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug when rendering images loaded from another thread #25

Closed
Ceylo opened this issue Apr 10, 2011 · 3 comments
Closed

Bug when rendering images loaded from another thread #25

Ceylo opened this issue Apr 10, 2011 · 3 comments

Comments

@Ceylo
Copy link
Contributor

Ceylo commented Apr 10, 2011

This a sum up of the original discussion created here : http://www.sfml-dev.org/forum-fr/viewtopic.php?t=3455 (french)

The issue: sprites may not be displayed depending on how they are used. More precisely, they are not displayed when the image data is loaded from another thread and some time elapses between the sf::Sprite::Draw() call and sf::Window::Display().

This bug has been tested on an Intel MacBook with an Intel GMA X3100 graphics card, on both Windows, Linux and Mac OS X. The bug happens on Window and Linux only. It's been tested with the latest sources from the Git repository, in both Release and Debug mode.

Here are the two most important sample codes:
http://www.sfml-dev.org/forum-fr/viewtopic.php?p=33557#33557

http://www.sfml-dev.org/forum-fr/viewtopic.php?p=33563#33563

On Windows, the image won't show if:

  • we're sleeping a little bit after the Draw() call
  • we're using UpdatePixels() instead of Create()/LoadFromFile()

On Linux, it's little bit more.. rough, it'll either show correctly or crash.
With Create/Load:

  • without sleeping: a.out: ../../intel/intel_bufmgr_gem.c:344: drm_intel_gem_bo_reference: Assertion '((&bo_gem->refcount)->atomic) > 0' failed.
  • with sleeping: a.out: ../../intel/intel_bufmgr_gem.c:452: drm_intel_bo_gem_set_in_aperture_size: Assertion '!bo_gem->used_as_reloc_target' failed.

a.out: ../../intel/intel_bufmgr_gem.c:344: drm_intel_gem_bo_reference: Assertion `((&bo_gem->refcount)->atomic) > 0' failed.

With Update..():

  • without sleeping:

0 0x0097e0ca in ?? () from /usr/lib/dri/i965_dri.so
1 0x0097649c in ?? () from /usr/lib/dri/i965_dri.so
2 0x008a15c7 in ?? () from /usr/lib/dri/i965_dri.so
3 0x008a19e6 in ?? () from /usr/lib/dri/i965_dri.so
4 0x0096bb2b in ?? () from /usr/lib/dri/i965_dri.so
5 0x00160844 in sf::Image::UpdatePixels(unsigned char const*) () from /usr/local/lib/libsfml-graphics.so.2.0
6 0x0804929d in thread_func () at sf.cpp:14
7 0x0804991e in sf::priv::ThreadFunctor<void (*)()>::Run (this=0x85a9f28) at /usr/local/include/SFML/System/Thread.inl:39
8 0x00134b44 in sf::Thread::Run() () from /usr/local/lib/libsfml-system.so.2.0
9 0x001350d1 in sf::priv::ThreadImpl::EntryPoint(void*) () from /usr/local/lib/libsfml-system.so.2.0
10 0x00475cc9 in start_thread () from /lib/libpthread.so.0
11 0x003e369e in clone () from /lib/libc.so.6

  • with sleeping: runs fine but crashes at exit with:
    ../../intel/intel_bufmgr_gem.c:1077: Error setting domain 7: Bad file descriptor
    DRM_IOCTL_GEM_CLOSE 6 failed (region): Bad file descriptor
@ghost ghost assigned LaurentGomila Apr 10, 2011
@maximl
Copy link

maximl commented Apr 28, 2012

I've got stuck with this issue on my laptop with amd A6 cpu + amd integrated graphics. The same code works fine on my desktop machine (amd + geforce).
My environment is: MSVC 10.0 + sfml 2.0
The main criteria is: load image from other thread and wait (sleep) a little before calling draw of render window.
Please, contact me if you need any help in reproducing this bug.

Edit:
This issue appears only for first draw of sprite. If sprite already drawed before (without sleep) - you can draw it anytime after that and all works fine.

@LaurentGomila
Copy link
Member

This issue is old, is it still happening?

@LaurentGomila
Copy link
Member

I close this issue due to the lack of feedback. Don't hesitate to reply if you think it should be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants