Closed Bug 556027 Opened 13 years ago Closed 13 years ago

Allow setting an attribute to use Hardware layermanagers


(Core :: Widget, defect)

Not set





(Reporter: bas.schouten, Assigned: bas.schouten)



(Keywords: dev-doc-complete)


(2 files, 1 obsolete file)

We need to allow setting an attribute on XUL windows in order to tell them to use a hardware layers manager. This will allow us to enable hardware acceleration on a per widget basis.
Depends on: 556029
This patch adds a boolean to nsWidgetInitData to flag if a widget should use hardware layers. It will then try and create and initialize a LayerManagerOGL on that platform. If this fails to initialize it will fallback to a normal basic layer manager.

Other platforms should have their paint routines adapted to not always assume basic layer managers once we make the OGL initializations succeed there.

Sadly a large part of this patch is indentation depth changing in OnPaint on windows!
Attachment #436008 - Flags: review?(roc)
+    } else if (GetLayerManager()->GetBackendType() ==
+               LayerManager::LAYERS_OPENGL) {
+      static_cast<mozilla::layers::LayerManagerOGL*>(GetLayerManager())->
+        SetClippingRegion(event.region);
+      result = DispatchWindowEvent(&event, eventStatus);

Probably we should just switch on GetLayerManager()->GetBackendType(). There should be a "default" clause which does NS_ERROR.

How about mAcceleratedRendering instead of mUseHardwareLayers?

I think we should take this out of the initdata and just have a method SetAcceleratedRendering. Then we can switch dynamically if desired.
Updated to now have an AcceleratedRendering attribute. Setting this on child widgets is pointless, they will reset automatically to the parent widget setting.
Attachment #436008 - Attachment is obsolete: true
Attachment #436100 - Flags: review?(roc)
Attachment #436008 - Flags: review?(roc)
Comment on attachment 436100 [details] [diff] [review]
Part 1: Allow SetAcceleratedRendering on top level widgets

+  GetNSWindowPtr(GetTopLevelHWND(mWnd, PR_TRUE))->
+    GetAcceleratedRendering(&useAcceleration);

Null-check the result of GetNSWindowPtr. In embedded situations this could be null when we don't own the toplevel window.

+      "AutoLayerManagerSetup instantiated for none basic layer backend!");


+  NS_IMETHOD              GetAcceleratedRendering(PRBool *aEnabled);

Just make this virtual PRBool (returning the value directly)
Attachment #436100 - Flags: review?(roc) → review+
Comment on attachment 436101 [details] [diff] [review]
Part 2: Add 'accelerated' attribute to nsXULWindow

+GK_ATOM(accelerated, "accelerated")

Don't add this, since we don't use it.
Attachment #436101 - Flags: review?(roc) → review+
Closed: 13 years ago
Resolution: --- → FIXED
Most other boolean XUL attributes work via case-sensitive comparison to "true", not via hasAttribute.
Keywords: dev-doc-needed
That's true, but the Web works differently ... anyway, it doesn't matter too much. This code is actually temporary because sooner or later all our windows will be accelerated.
Depends on: 556540
Depends on: 559070
You need to log in before you can comment on or make changes to this bug.