Closed Bug 546515 Opened 14 years ago Closed 14 years ago

Direct3D 9 Layers Backend

Categories

(Core :: Graphics, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

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

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 2 obsolete files)

A Direct3D 9 Layers Backend can be used on Win2K+ where D3D9 is available and working hardware is found for hardware acceleration.
Blocks: 546508
No longer blocks: layers
Depends on: 550846
Attached patch Part 1: Add D3D9 Layers Backend (obsolete) — Splinter Review
Attachment #446637 - Flags: review?(jmuizelaar)
It looks like if prefer-opengl is false, but we can't instantiate the GL layer manager, we'll just fall back to basic rendering instead of D2D. I think we should use D2D in that case. So I suggest copying LayerManagerOGL construction in here and don't call nsBaseWidget::GetLayerManager at all for the accelerated case.
By the way, would you mind letting me push (or pushing yourself) patches 4 and 5 from bug 564993 before these land and rot me again?
Attachment #446643 - Attachment is obsolete: true
Attachment #446648 - Flags: review?(roc)
Attachment #446643 - Flags: review?(roc)
Adapted to layers restructuring.
Attachment #446637 - Attachment is obsolete: true
Attachment #446656 - Flags: review?(jmuizelaar)
Attachment #446637 - Flags: review?(jmuizelaar)
Comment on attachment 446656 [details] [diff] [review]
Part 1: Add D3D9 Layers Backend v2

I've only done a quick pass over this, but figure that it's not super high risk. I plan on going through it more thoroughly, but I can also do that after it's landed. If you do land it early, make sure it does indeed work better than the ogl backend before defaulting to it. We don't want any regressions there.

I noticed a couple of '/**' comments, and I'm not a huge fan of that style. I find the extra '*' rarely adds much value.

> 
>-DEFINES += -DIMPL_THEBES
>+DEFINES += -DIMPL_THEBES -DD3D_DEBUG_INFO

We probably don't want to unconditionally define this right?

>+
>+#ifdef XP_WIN
>+    if (mSurface->GetType() == gfxASurface::SurfaceTypeWin32) {
>+      sourceSurface = static_cast<gfxWindowsSurface*>(mSurface.get())->GetImageSurface();
>+      startBits = sourceSurface->Data() + sourceSurface->Stride() * aRect.y +
>+                  aRect.x * 4;
>+      sourceStride = sourceSurface->Stride();
>+    } else
>+#endif

I'm not sure we need this #ifdef

>+void
>+LayerManagerD3D9::CopyToTarget()
>+{

I think PaintToTarget would be a better name.

>+
>+PRBool
>+LayerManagerD3D9::VerifyCaps()
>+{
>+  return PR_TRUE;
>+}

Failures in the above would be useful to communicate in a log or some such thing. Probably not needed for this patch though.

>+} /* layers */
>+} /* mozilla */
>+#endif /* GFX_THEBESLAYEROGL_H */

s/GFX_THEBESLAYEROGL_H/GFX_THEBESLAYERD3D9_H/
Attachment #446656 - Flags: review?(jmuizelaar) → review+
Pushed http://hg.mozilla.org/mozilla-central/rev/f87f31d83650.
Pushed http://hg.mozilla.org/mozilla-central/rev/d4e5f5f19777.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
God save Mozilla !
What needs to be done to use this on XP?  I can't find info.
Correct me if I'm wrong, Right now its being used for full screen Theora videos.
(In reply to comment #12)
> Correct me if I'm wrong, Right now its being used for full screen Theora
> videos.

It is, nothing needs to be done. If you have a GPU supporting Shader Model 2.0 or higher and DirectX 9 installed (comes with XP SP2), you will have this used for fullscreen video.
Depends on: 567844
So, what SDK do I need to have to be able to build this successfully?
Comment on attachment 446648 [details] [diff] [review]
Part 2: Use D3D9 layers backend as preferred backend on Windows v2

>+      nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
Nit: it wasn't necessary to use nsIPrefBranch2 here; nsIPrefBranch suffices.
(In reply to comment #15)
> (From update of attachment 446648 [details] [diff] [review])
> >+      nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
> Nit: it wasn't necessary to use nsIPrefBranch2 here; nsIPrefBranch suffices.

As far as I know you can't get a pref value lower in the branch directly with nsIPrefBranch, can you?
(In reply to comment #14)
> So, what SDK do I need to have to be able to build this successfully?

They include the needed headers with the Windows SDK these days. But to get a lot of useful tools (The D3D debugger, shader compiler, debug libs, etc.), you'd need the DirectX SDK (any recent version).
(In reply to comment #16)
> (In reply to comment #15)
> > (From update of attachment 446648 [details] [diff] [review] [details])
> > >+      nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
> > Nit: it wasn't necessary to use nsIPrefBranch2 here; nsIPrefBranch suffices.
> As far as I know you can't get a pref value lower in the branch directly with
> nsIPrefBranch, can you?
??? The only reason you need an nsIPrefBranch2 is if you need to call addObserver or removeObserver, which don't exist on nsIPrefBranch.

(In reply to comment #17)
> (In reply to comment #14)
> > So, what SDK do I need to have to be able to build this successfully?
> They include the needed headers with the Windows SDK these days.
Yes, but which one? Prior to this patch you could build (most of) the app with the Windows Server 2003 SDK, since all the optional stuff was #ifdef out.
Depends on: 569490
Blocks: 956570
You need to log in before you can comment on or make changes to this bug.