If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Detect GPU switches so GPU-specific workarounds actually work

RESOLVED WORKSFORME

Status

()

Core
Graphics
RESOLVED WORKSFORME
6 years ago
6 years ago

People

(Reporter: reuben, Unassigned)

Tracking

Trunk
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
We don't detect GPU switches happening under our feet, which causes GPU-specific workarounds like bug 684882 not to work after a GPU switch.

See bug 631258#c30 – the bug only happens when there's a GPU switch after creating the GL context.
(Reporter)

Comment 1

6 years ago
Registering for Display Change notifications using Quartz Display Services:
  https://developer.apple.com/library/mac/#technotes/tn2229/_index.html#//apple_ref/doc/uid/DTS40008924-CH1-SECTION4
We run WebGL using the discrete GPU. Can you describe a scenario where this is an issue?
(Reporter)

Comment 3

6 years ago
(In reply to Benoit Girard (:BenWa) from comment #2)
> We run WebGL using the discrete GPU. Can you describe a scenario where this
> is an issue?

I think it will be an issue after WebGL gets popular, since it has a big impact in battery life, but the problem here is that the context information used by WebGL is not updated when there's a GPU switch, and this causes bug 631258 to happen, even on OS X 10.7.2.

><bjacob> so, when the renderer changes, we need to update GLContext::mVendor, because that's what the WebGL implementation uses, and we don't
><bjacob> alternatively, one could replace that by a Vendor() function that would query that everytime it's called, if it's cheap
><bjacob> see GLContext::Vendor in gfx/thebes/GLContext.h
><bjacob> currently it's:
><bjacob>    int Vendor() const {
><bjacob>        return mVendor;
><bjacob>    }
I've thought about this a bit more and the problem is actually more far-reaching:

  1. even if we know the right vendor, regarding the cube map bug we would need at least to update WebGLContext::mGLMaxCubeMapTextureSize which is initialized once and for all on WebGL context creation.

  2. what happens if large cube maps migrate from the NVIDIA GPU to the Intel GPU: can corruption start happening then?

For these reasons I'm in favor of just losing WebGL contexts upon GPU switch. We need to force web devs to care about contextlost events anyways, and this looks like a decent occasion to do so, actually if 2. is confirmed then we don't have a choice.
(In reply to Benoit Jacob [:bjacob] from comment #4)
>   2. what happens if large cube maps migrate from the NVIDIA GPU to the
> Intel GPU: can corruption start happening then?

WebGL cannot currently switch GPUs. It will always run on the discrete.
My question in Comment #2 has not been answered. WebGL does not support GPU switch so concerning ourselves with GPU-specific workarounds is premature. I'm closing this bug for now. Please re-open it if I'm misunderstanding how this could effect users outside the scenario where they force a GPU switch using gfxCardStatus.

Updated

6 years ago
Status: UNCONFIRMED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → INVALID
(Reporter)

Comment 7

6 years ago
(In reply to Benoit Girard (:BenWa) from comment #6)
> My question in Comment #2 has not been answered. WebGL does not support GPU
> switch so concerning ourselves with GPU-specific workarounds is premature.
> I'm closing this bug for now. Please re-open it if I'm misunderstanding how
> this could effect users outside the scenario where they force a GPU switch
> using gfxCardStatus.

The bug is triggered by the automatic GPU switch that happens when you load WebGL content for the first time, which can happen independently of gfxCardStatus.

As far as I understand, Firefox 7 still activates discrete graphics mode all the time when "Enable hardware acceleration" is enabled. On 8 and newer, discrete graphics mode is only enabled on demand, which includes rendering WebGL content. When this happens for the first time, the GPU is changed and bug 684882 can be reproduced.
bug 684882 only happens when were on the Intel (integrated). On any version of Firefox we should only run WebGL on discrete.
(Reporter)

Comment 9

6 years ago
We only run WebGL on the discrete GPU, but if we have to enable it (integrated was being used until WebGL content is loaded), bug 684882 still happens.
Alright, in that case we should check the gpu after we've switched.
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: INVALID → ---
(Reporter)

Updated

6 years ago
Status: REOPENED → RESOLVED
Last Resolved: 6 years ago6 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.