Bug 39588 - [bisected] mesa demo xeglgears draw nothing if surface type is a pixmap
Summary: [bisected] mesa demo xeglgears draw nothing if surface type is a pixmap
Status: RESOLVED MOVED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Other (show other bugs)
Version: git
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-27 02:16 UTC by Jin Yang
Modified: 2019-09-18 20:16 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
intel: Set ctx's drawbuffer according to drawables visual (1.38 KB, patch)
2011-08-04 02:43 UTC, Benjamin Franzke
Details | Splinter Review

Description Jin Yang 2011-07-27 02:16:32 UTC
run this demo with parameter
./xeglgears -info -pixmap
or 
./xeglgears -info -pixmap-texture

or 
./xeglgears -info -pbuffer

or 
./xeglgears -info -pbuffer-texture

show black screen with mesa 7.11rc2 and latest code in git.

run with mesa 7.9.1 is ok to show the gears.

./xeglgears -info in 7.11rc2, will print infomation:
EGL_VERSION = 1.4 (DRI2)
GL_RENDERER   = Mesa DRI Intel(R) IGD x86/MMX/SSE2
GL_VERSION    = 1.4 Mesa 7.11-rc2
GL_VENDOR     = Tungsten Graphics, Inc
Comment 1 Gordon Jin 2011-07-28 19:07:35 UTC
Shuang to reproduce.
Comment 2 Shuang He 2011-07-28 19:16:12 UTC
I can reproduce this bug with upstream driver on pineview
Comment 3 Ian Romanick 2011-08-02 18:50:28 UTC
This seems to work on current 7.10 branch, but it fails on 7.11 and master.  Since this is a regression, is there a bisect?
Comment 4 Ian Romanick 2011-08-02 19:22:08 UTC
I've bisected this to:

commit 87dde5b1cd596c4008695ff2db9469f88c09f925
Author: Benjamin Franzke <benjaminfranzke@googlemail.com>
Date:   Wed Feb 9 15:30:20 2011 +0100

    egl_dri2: Use double buffering for window surfaces

We really should have piglit tests for drawing to pixmaps and pbuffers.  Simple tests that just draw a single triangle should be sufficient.
Comment 5 Benjamin Franzke 2011-08-04 02:42:36 UTC
(In reply to comment #4)
> I've bisected this to:
> 
> commit 87dde5b1cd596c4008695ff2db9469f88c09f925
> Author: Benjamin Franzke <benjaminfranzke@googlemail.com>
> Date:   Wed Feb 9 15:30:20 2011 +0100
> 
>     egl_dri2: Use double buffering for window surfaces
> 
> We really should have piglit tests for drawing to pixmaps and pbuffers.  Simple
> tests that just draw a single triangle should be sufficient.

Ok, Thanks for bisecting.

At the time of writing this patch I owned only radeon hardware, where it works (r600g).
So a piglit test wouldnt have helped directly (sure, you'd have found it earlier).

The commit was about using dri double buffer configs for window surfaces
(made the wayland backend code nicer).
This results in contexts being created with double buffer configs,
which are somewhat mixed with single buffer configs, when using pixmap surfaces.

Why does this work with r600g?
st/mesa sets the context's DrawBuffer[0] depending on its visual render_buffer, which is set by st/dri depending on the drawables gl_config's doubleBufferMode.

I'll attach a patch that does this for intel in make_current.
Comment 6 Benjamin Franzke 2011-08-04 02:43:33 UTC
Created attachment 49902 [details] [review]
intel: Set ctx's drawbuffer according to drawables visual
Comment 7 huihui.zhang 2011-08-08 20:02:52 UTC
(In reply to comment #6)
> Created an attachment (id=49902) [details]
> intel: Set ctx's drawbuffer according to drawables visual

Hi,

I just try your patch. 
./xeglgears -pixmap works fine
but
./xeglgears -pixmap -fullscreen doesn't work

The pixmap fullscreen mode doesn't work out on both the 7.9 and 7.11.

Would you mind helping me looking into this issue. Thanks a lot.
Comment 8 Ian Romanick 2011-08-09 10:51:42 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Created an attachment (id=49902) [details] [details]
> > intel: Set ctx's drawbuffer according to drawables visual

This patch doesn't seem like the right fix, and the commit message is a bit confusing to me (see below).  What particularly concerns me is that the change that created the bug was in common code, but the fix is in driver code.  Does this leave other drivers broken?

> egl_dri2 creates contexts with a doubleBufferConfig when PIXMAP and
> WINDOW bit is request, so _mesa_init_color sets DrawBuffer[0] to
> GL_BACK.

I'm confused about this.  The application creates a context with a particular fbconfig, and that determines whether the context is single-buffered or double-buffered.  What does egl_dri2 have to do with anything?

> If a pixmap surface is created egl_dri2 will use a single buffer config,
> so MakeCurrent has to adjust DrawBuffer[0] to the current drawable.

One other nit with the commit message.  The usual way to reference a bug is:

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=39588

This makes it easier to search in 'git log' for things to cherry pick to stable branches.

> I just try your patch. 
> ./xeglgears -pixmap works fine

Do the other modes mentioned in comment #0 also work?

> but
> ./xeglgears -pixmap -fullscreen doesn't work
> 
> The pixmap fullscreen mode doesn't work out on both the 7.9 and 7.11.

If fullscreen didn't work with Mesa 7.9, it's not the same bug.

> Would you mind helping me looking into this issue. Thanks a lot.
Comment 9 Benjamin Franzke 2011-08-09 11:43:14 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > (In reply to comment #6)
> > > Created an attachment (id=49902) [details] [details] [details]
> > > intel: Set ctx's drawbuffer according to drawables visual
> 
> This patch doesn't seem like the right fix, and the commit message is a bit
> confusing to me (see below).  What particularly concerns me is that the change
> that created the bug was in common code, but the fix is in driver code.  Does
> this leave other drivers broken?

I did this in the driver since its also done in st/mesa like that, but yes,
I also want this to be in _mesa_make_current.
I sent an updated patch in this mail:
http://lists.freedesktop.org/archives/mesa-dev/2011-August/010167.html

Please look at the whole review-thread, since it may already answer your questions,
but i'll try to answer them here as well.

> > egl_dri2 creates contexts with a doubleBufferConfig when PIXMAP and
> > WINDOW bit is request, so _mesa_init_color sets DrawBuffer[0] to
> > GL_BACK.
> 
> I'm confused about this.  The application creates a context with a particular
> fbconfig, and that determines whether the context is single-buffered or
> double-buffered.  What does egl_dri2 have to do with anything?

- egl_dri2 creates a context (either single or double buffered)
- egl_dri2 creates surfaces (either single or double buffered = pixmap or window)
If the user requests a config with PIXMAP_BIT and WINDOW_BIT (like xeglgears),
egl_dri2 has to decide for one type of config for the context (either single or double buffered),
but it needs the ability to use both types of configs for surfaces
(since the user can use both pixmap and window surfaces with the same context).

> > If a pixmap surface is created egl_dri2 will use a single buffer config,
> > so MakeCurrent has to adjust DrawBuffer[0] to the current drawable.
> 
> One other nit with the commit message.  The usual way to reference a bug is:
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=39588
> 
> This makes it easier to search in 'git log' for things to cherry pick to stable
> branches.

Actually I couldnt detect a general rule for this in mesa, and looking in the recent
log gave me more "Fixes bug_url" than "Bugzilla: bug_url"

> > I just try your patch. 
> > ./xeglgears -pixmap works fine
> 
> Do the other modes mentioned in comment #0 also work?
> 
> > but
> > ./xeglgears -pixmap -fullscreen doesn't work
> > 
> > The pixmap fullscreen mode doesn't work out on both the 7.9 and 7.11.
> 
> If fullscreen didn't work with Mesa 7.9, it's not the same bug.
> 
> > Would you mind helping me looking into this issue. Thanks a lot.
Comment 10 huihui.zhang 2011-08-10 19:20:07 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > (In reply to comment #6)
> > > Created an attachment (id=49902) [details] [details] [details]
> > > intel: Set ctx's drawbuffer according to drawables visual
> 
> This patch doesn't seem like the right fix, and the commit message is a bit
> confusing to me (see below).  What particularly concerns me is that the change
> that created the bug was in common code, but the fix is in driver code.  Does
> this leave other drivers broken?
> 
> > egl_dri2 creates contexts with a doubleBufferConfig when PIXMAP and
> > WINDOW bit is request, so _mesa_init_color sets DrawBuffer[0] to
> > GL_BACK.
> 
> I'm confused about this.  The application creates a context with a particular
> fbconfig, and that determines whether the context is single-buffered or
> double-buffered.  What does egl_dri2 have to do with anything?
> 
> > If a pixmap surface is created egl_dri2 will use a single buffer config,
> > so MakeCurrent has to adjust DrawBuffer[0] to the current drawable.
> 
> One other nit with the commit message.  The usual way to reference a bug is:
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=39588
> 
> This makes it easier to search in 'git log' for things to cherry pick to stable
> branches.
> 
> > I just try your patch. 
> > ./xeglgears -pixmap works fine
> 
> Do the other modes mentioned in comment #0 also work?
> 
> > but
> > ./xeglgears -pixmap -fullscreen doesn't work
> > 
> > The pixmap fullscreen mode doesn't work out on both the 7.9 and 7.11.
> 
> If fullscreen didn't work with Mesa 7.9, it's not the same bug.
> 
> > Would you mind helping me looking into this issue. Thanks a lot.

Sorry for the late response. 

GL_RENDERER   = Mesa DRI Intel(R) IGD x86/MMX/SSE2
GL_VERSION    = 1.4 Mesa 7.12-devel (git-4dd3272)

./xeglgears -pixmap                      works
./xeglgears -pixmap-texture              works
./xeglgears -pixmap -fullscreen          doesn't work
./xeglgears -pixmap-texture -fullscreen  works
./xeglgears -pbuffer                     works
./xeglgears -pbuffer-texture             works
./xeglgears -pbuffer -fullscreen         works
./xeglgears -pbuffer-texture -fullscreen works

Hope that can help you.
Comment 11 Benjamin Franzke 2012-03-16 09:23:50 UTC
The problem still exists, the NAKed patch was never commited.
Comment 12 GitLab Migration User 2019-09-18 20:16:55 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/895.


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.