Bug 42131 - Problem with resizing OpenGL windows when using XCB
Summary: Problem with resizing OpenGL windows when using XCB
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: 7.11
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: mesa-dev
QA Contact:
: 35945 (view as bug list)
Depends on:
Reported: 2011-10-23 10:40 UTC by nilschrbrause
Modified: 2019-09-18 20:22 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:

Test program demonstrating the problem (4.51 KB, text/x-csrc)
2011-10-23 10:40 UTC, nilschrbrause
Demonstration how it may work (201.10 KB, text/html)
2012-01-03 08:03 UTC, ikrabbe.ask
Complete with Makefile (100.00 KB, application/octet-stream)
2012-01-03 08:07 UTC, ikrabbe.ask

Description nilschrbrause 2011-10-23 10:40:52 UTC
Created attachment 52651 [details]
Test program demonstrating the problem

The attached program creates a window using XCB and draws a rectangle inside it using OpenGL. When using indirect software rendering (LIBGL_ALWAYS_INDIRECT=1), everything works as expected. But when using the R600 Gallium3D driver, the OpenGL view port doesn't seem to get resized properly and the window contents get screwed up.
Comment 1 ikrabbe.ask 2012-01-03 07:05:34 UTC
I can confirm this bug. It seems that there are some internal events, forwarded to the DRI(2) module that get lost, as xcb doesn't use XEvents. That's why it works, when you use the Xlib Event Loop { if (XPending(D)) XNextEvent(D,&E); } with XSetEventQueueOwner(Xlib...);

When you use the xcb event loop mechanism, mesa does not detect the events, that need to be reacted on by the DRI module.

So after all, this problem has to be solved within mesa, not within xcb. Obviously there where some experiments that care about xcb and mesa, but I haven't found a good development branch yet.

What I do about this problem now is to create a glXCreateWindow (overlay) at full screen size and render my scene into the visible part of the window, by translation and scaling.
Comment 2 ikrabbe.ask 2012-01-03 08:03:49 UTC
Created attachment 55087 [details]
Demonstration how it may work

This program is a bit bigger, than actually needed for this bug, but I'm too lazy to strip the example from my test repository.
Comment 3 ikrabbe.ask 2012-01-03 08:07:48 UTC
Created attachment 55088 [details]
Complete with Makefile

Edit the MESA and XCB Variables in the Makefile or optionally in your own, config.mk. Currently they are setup to compile against my test setup, with
quite recent git origin/master installations.
Comment 4 ikrabbe.ask 2012-01-05 03:17:58 UTC
*** Bug 35945 has been marked as a duplicate of this bug. ***
Comment 5 GitLab Migration User 2019-09-18 20:22:45 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/968.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.