Closed Bug 555863 Opened 14 years ago Closed 14 years ago

Qt widget code assumes 32bpp target surface

Categories

(Core Graveyard :: Widget: Qt, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: dougt, Assigned: romaxa)

Details

Attachments

(5 files, 3 obsolete files)

Our current drawing code for Qt requires that the target device/surface we paint to is 32bpps.  On the maemo devices, the surface is 16bpps.  We haven't been seeing this regression because we have been running bug 545632.

When the gBufferImage does not patch the device, we should color correct (using pixman not QImage)
Assignee: nobody → romaxa
Attachment #435932 - Flags: review?(dougt)
Attachment #435932 - Flags: review?(dougt) → review?(jmuizelaar)
It looks like there at least two things going on in this patch:
1. Removing the Xlib render mode
2. Supporting 32 bit Qt drawing

Can we do them in separate patches?
(In reply to comment #3)
> It looks like there at least two things going on in this patch:
> 1. Removing the Xlib render mode
> 2. Supporting 32 bit Qt drawing

It was supported before, but not for qt raster backend

> 
> Can we do them in separate patches?

I think it does not make sense, because 2. will be very small patch in that case, because it just bugfix for raster mode.
Attachment #435753 - Attachment is obsolete: true
Attachment #437364 - Flags: review?(jmuizelaar)
Attachment #437365 - Flags: review?(jmuizelaar)
Attachment #437364 - Flags: review?(jmuizelaar) → review+
It still seems like there's a couple of things going on in the second patch (splitting them would be nice)..
Why do you switch from pixman to qt for doing the color conversion?
(In reply to comment #7)
> It still seems like there's a couple of things going on in the second patch
> (splitting them would be nice)..
> Why do you switch from pixman to qt for doing the color conversion?
To get rid of direct pixman code, and hardcoded pixman format values...
Also this pixman code looks a bit strange in Qt context which is allowing to do the same things... It would be possible to use gfxImageSurface here... but not know, because gfxImageSurface is not supporting 565 format yet...
Also with pixman I need to create separate function which is choosing pixman format according to depth value.
Comment on attachment 437365 [details] [diff] [review]
Make it works properly with raster backend

>diff -r 1cbd90b9b4c0 gfx/thebes/public/gfxSharedImageSurface.h
>--- a/gfx/thebes/public/gfxSharedImageSurface.h	Tue Apr 06 22:29:42 2010 +0300
>+++ b/gfx/thebes/public/gfxSharedImageSurface.h	Tue Apr 06 22:36:26 2010 +0300
>@@ -114,19 +114,25 @@ public:
>    * @param aShmId Shared Memory ID of data created outside,
>    *                if not specified, then class will allocate own shared memory
>    * @display aDisplay display used for X-Image creation
>    *                if not specified, then used system default
>    *
>    */
>   bool Init(const gfxIntSize& aSize,
>             gfxImageFormat aFormat = ImageFormatUnknown,
>+            int aDepth = 0,
>             int aShmId = -1,
>             Display *aDisplay = NULL);

It looks like a bunch of these default parameters are not used. Can we get rid of them?

>     // Check if system depth has related gfxImage format
>     gfxASurface::gfxImageFormat format =
>-        _depth_to_gfximage_format(gBufferPixmap->x11Info().depth());
>-
>-    gNeedColorConversion = (format == gfxASurface::ImageFormatUnknown);
>+        _depth_to_gfximage_format(aDepth);
>+    PRBool depthFormatInCompatible = (format == gfxASurface::ImageFormatUnknown);

I guess this can be cleaned up when we add 565 support?

>+
>+    // In raster backend we don't care about incompatible mode, and will paint in
>+    // default RB24 format... Raster engine will convert it t otarget color depth

typo here.


>+#if 0
>+    // No idea why this always returning type 0, it should work but it does not
>+    QPaintEngine::Type paintEngineType = GetViewWidget()->paintEngine()->type();
>+#else
>+    if (sCachedPaintEngineType < 0) {
>+        QPixmap temp_pix(1, 1);
>+        sCachedPaintEngineType = temp_pix.handle() ? QPaintEngine::X11 : QPaintEngine::Raster;
>+    }
>+    QPaintEngine::Type paintEngineType = (QPaintEngine::Type)sCachedPaintEngineType;
>+#endif

What's the cost of finding out the paint engine type? Is it worth caching? Also, can you figure out why paintEngine()->type() doesn't work.
Attachment #437365 - Flags: review?(jmuizelaar) → review-
> >    */
> >   bool Init(const gfxIntSize& aSize,
> >             gfxImageFormat aFormat = ImageFormatUnknown,
> >+            int aDepth = 0,
> >             int aShmId = -1,
> >             Display *aDisplay = NULL);
> 
> It looks like a bunch of these default parameters are not used. Can we get rid
> of them?

I think we can kill only aDisplay parameter, because aShmId is used for image initialization from remote ID in ipc/glue/XSHM


> >+    PRBool depthFormatInCompatible = (format == gfxASurface::ImageFormatUnknown);
> 
> I guess this can be cleaned up when we add 565 support?

Yes.

> 
> >+#if 0
> >+    // No idea why this always returning type 0, it should work but it does not
> >+    QPaintEngine::Type paintEngineType = GetViewWidget()->paintEngine()->type();
> >+#else
> >+    if (sCachedPaintEngineType < 0) {
> >+        QPixmap temp_pix(1, 1);
> >+        sCachedPaintEngineType = temp_pix.handle() ? QPaintEngine::X11 : QPaintEngine::Raster;
> >+    }
> >+    QPaintEngine::Type paintEngineType = (QPaintEngine::Type)sCachedPaintEngineType;
> >+#endif

> 
> What's the cost of finding out the paint engine type? Is it worth caching?

Probably I can move this engine type detection in function which is creating ViewWidget (::createWidget - toplevel), that will make this finding once, and cache it. is it ok?

> Also, can you figure out why paintEngine()->type() doesn't work.

Not sure that I can quickly understand why it does not work... need to recompile Qt for it... 
Can I create some bu about it, and fix later?
Attached patch Updated version. (obsolete) — Splinter Review
Attachment #437365 - Attachment is obsolete: true
Attachment #438482 - Attachment is obsolete: true
Attachment #438512 - Flags: review?(jmuizelaar)
Attachment #435932 - Flags: review?(jmuizelaar)
> > 
> > What's the cost of finding out the paint engine type? Is it worth caching?
> 
> Probably I can move this engine type detection in function which is creating
> ViewWidget (::createWidget - toplevel), that will make this finding once, and
> cache it. is it ok?

Is it worth caching at all? It looks like it should be very cheap to just check when needed.
Attached patch Removed caching.Splinter Review
Attachment #438796 - Flags: review+
Pushed in http://hg.mozilla.org/mozilla-central/rev/d926bc567542
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Comment on attachment 438512 [details] [diff] [review]
Fixed comments + solved problem with engine type detection

Already fixed
Attachment #438512 - Flags: review?(jmuizelaar)
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: