Bug 92706 - glBlitFramebuffer refuses to blit RGBA to RGB with MSAA
Summary: glBlitFramebuffer refuses to blit RGBA to RGB with MSAA
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-28 10:35 UTC by timon
Modified: 2015-12-16 16:35 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
patch to allow RGBA->RGB multi-sampled resolves (686 bytes, text/plain)
2015-10-28 10:35 UTC, timon
Details

Description timon 2015-10-28 10:35:55 UTC
Created attachment 119247 [details]
patch to allow RGBA->RGB multi-sampled resolves

When doing a glBlitFramebuffer from an RGBA multisampled texture to a regular RGB texture mesa gives GL_INVALID_OPERATION "(bad src/dst multisample pixel formats)".

With the attached patch the operation works fine on a Radeon HD6850 and Intel Core i7-4770R, which hints that the drivers already support it.

This issue breaks MSAA in "X Rebirth", both nvidia and amd proprietary drivers support this kind of resolve. We have a clean error log (using debug_output) so afaik we're doing everything correctly.
Comment 1 Neil Roberts 2015-10-28 13:02:12 UTC
It looks like in GL 4.4 they have completely removed the restriction that MSAA resolve blits need to have the same format. In the section entitled “Changes in the released Specification of July 22, 2013” it says:

“Relax BlitFramebuffer in section 18.3.1 so that format conversion can take
place during multisample blits, since drivers already allow this and some
apps depend on it.”

Maybe we should just entirely remove the restriction in Mesa too. On the Intel driver the multisample resolve is implemented as a shader so I don't think allowing all format conversions would cause any problems.
Comment 2 Ian Romanick 2015-10-28 19:16:25 UTC
(In reply to Neil Roberts from comment #1)
> It looks like in GL 4.4 they have completely removed the restriction that
> MSAA resolve blits need to have the same format. In the section entitled
> “Changes in the released Specification of July 22, 2013” it says:
> 
> “Relax BlitFramebuffer in section 18.3.1 so that format conversion can take
> place during multisample blits, since drivers already allow this and some
> apps depend on it.”

Often we take changes like this as, basically, spec bug fixes that should apply to older versions as well.  Since other drivers allow this and later specs allow it, we should too.

> Maybe we should just entirely remove the restriction in Mesa too. On the
> Intel driver the multisample resolve is implemented as a shader so I don't
> think allowing all format conversions would cause any problems.
Comment 3 Ian Romanick 2015-10-28 19:17:01 UTC
The biggest task will be updating existing piglit tests and adding new ones.
Comment 4 Neil Roberts 2015-11-04 14:58:23 UTC
It looks like there is only one test in Piglit that attempts this. I've made a patch to make it expect the new behaviour here:

http://patchwork.freedesktop.org/patch/63670/

I also made a patch to completely remove the format restriction in Mesa here:

http://patchwork.freedesktop.org/patch/63672/

Surprisingly this exposed a bug on HSW so it needs an additional patch which I also posted.

As this patch removes the restriction for all drivers I guess we would need testing on the other drivers as well before being confident we can land it.
Comment 5 EoD 2015-11-13 18:39:45 UTC
Is there any reason this is not getting merged? Is there any way to help getting it merged?

It would be great to fix the aforementioned bugs before an 11.1 release.
Comment 6 Neil Roberts 2015-11-16 13:17:55 UTC
(In reply to EoD from comment #5)

I think we would need some of the nouveau and radeon people to test the Piglit test on their drivers with the patch in order to ensure that it also works there before landing it. If you are able to test both patches on your Radeon card I think that would be a big help.

We'd also need to merge the fix for i965 but that already has some review thanks to Ben Widawsky so I'm hoping to land it later today.
Comment 7 EoD 2015-11-19 23:18:07 UTC
OpenGL renderer string: Gallium 0.4 on AMD BARTS (DRM 2.43.0, LLVM 3.7.0)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.1.0-devel (git-0cfc130)

After applying both patches, the patched piglit test passes just fine:

http://patchwork.freedesktop.org/patch/63670/
http://patchwork.freedesktop.org/patch/63672/

PIGLIT: {"result": "pass" }


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.