FFe: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

Bug #217908 reported by Christian Göbel
312
This bug affects 55 people
Affects Status Importance Assigned to Milestone
Libpixman
Fix Released
Undecided
Unassigned
Mozilla Firefox
Fix Released
Medium
X.Org X server
Invalid
Undecided
Unassigned
XULRunner
Invalid
Undecided
Unassigned
openchrome
Fix Released
Unknown
xf86-video-ati
Fix Released
Medium
xf86-video-mga
Fix Released
Medium
openSUSE
Fix Released
Critical
cairo (Ubuntu)
Fix Released
High
Unassigned
Declined for Hardy by Steve Langasek
Declined for Intrepid by Bryce Harrington
Declined for Jaunty by Steve Langasek
Nominated for Karmic by Սահակ
Nominated for Lucid by Սահակ
Nominated for Maverick by Miroslav Hadzhiev
Nominated for Natty by Miroslav Hadzhiev
firefox (Ubuntu)
Fix Released
Medium
Unassigned
Declined for Hardy by Steve Langasek
Declined for Intrepid by Bryce Harrington
Declined for Jaunty by Steve Langasek
Nominated for Karmic by Սահակ
Nominated for Lucid by Սահակ
Nominated for Maverick by Miroslav Hadzhiev
Nominated for Natty by Miroslav Hadzhiev
firefox-3.0 (Ubuntu)
Invalid
Wishlist
Unassigned
Declined for Hardy by Steve Langasek
Declined for Intrepid by Bryce Harrington
Declined for Jaunty by Steve Langasek
Nominated for Karmic by Սահակ
Nominated for Lucid by Սահակ
Nominated for Maverick by Miroslav Hadzhiev
Nominated for Natty by Miroslav Hadzhiev
pixman (Ubuntu)
Fix Released
Undecided
Unassigned
Declined for Hardy by Steve Langasek
Declined for Intrepid by Bryce Harrington
Declined for Jaunty by Steve Langasek
Nominated for Karmic by Սահակ
Nominated for Lucid by Սահակ
Nominated for Maverick by Miroslav Hadzhiev
Nominated for Natty by Miroslav Hadzhiev
xorg-server (Ubuntu)
Invalid
Undecided
Unassigned
Declined for Hardy by Steve Langasek
Declined for Intrepid by Bryce Harrington
Declined for Jaunty by Steve Langasek
Nominated for Karmic by Սահակ
Nominated for Lucid by Սահակ
Nominated for Maverick by Miroslav Hadzhiev
Nominated for Natty by Miroslav Hadzhiev
xserver-xorg-video-ati (Ubuntu)
Fix Released
Medium
Unassigned
Declined for Hardy by Steve Langasek
Declined for Intrepid by Bryce Harrington
Declined for Jaunty by Steve Langasek
Nominated for Karmic by Սահակ
Nominated for Lucid by Սահակ
Nominated for Maverick by Miroslav Hadzhiev
Nominated for Natty by Miroslav Hadzhiev
xserver-xorg-video-i128 (Ubuntu)
Fix Released
Medium
Unassigned
Declined for Hardy by Steve Langasek
Declined for Intrepid by Bryce Harrington
Declined for Jaunty by Steve Langasek
Nominated for Karmic by Սահակ
Nominated for Lucid by Սահակ
Nominated for Maverick by Miroslav Hadzhiev
Nominated for Natty by Miroslav Hadzhiev
xserver-xorg-video-mga (Ubuntu)
Fix Released
Medium
Unassigned
Declined for Hardy by Steve Langasek
Declined for Intrepid by Bryce Harrington
Declined for Jaunty by Steve Langasek
Nominated for Karmic by Սահակ
Nominated for Lucid by Սահակ
Nominated for Maverick by Miroslav Hadzhiev
Nominated for Natty by Miroslav Hadzhiev
xserver-xorg-video-openchrome (Ubuntu)
Fix Released
Medium
Unassigned
Declined for Hardy by Steve Langasek
Declined for Intrepid by Bryce Harrington
Declined for Jaunty by Steve Langasek
Nominated for Karmic by Սահակ
Nominated for Lucid by Սահակ
Nominated for Maverick by Miroslav Hadzhiev
Nominated for Natty by Miroslav Hadzhiev
xserver-xorg-video-radeonhd (Ubuntu)
Fix Released
Medium
Unassigned
Declined for Hardy by Steve Langasek
Declined for Intrepid by Bryce Harrington
Declined for Jaunty by Steve Langasek
Nominated for Karmic by Սահակ
Nominated for Lucid by Սահակ
Nominated for Maverick by Miroslav Hadzhiev
Nominated for Natty by Miroslav Hadzhiev
xulrunner-1.9 (Ubuntu)
Won't Fix
Medium
Unassigned
Declined for Hardy by Steve Langasek
Declined for Intrepid by Bryce Harrington
Declined for Jaunty by Steve Langasek
Nominated for Karmic by Սահակ
Nominated for Lucid by Սահակ
Nominated for Maverick by Miroslav Hadzhiev
Nominated for Natty by Miroslav Hadzhiev
xulrunner-1.9.1 (Ubuntu)
Fix Released
Medium
Unassigned
Declined for Hardy by Steve Langasek
Declined for Intrepid by Bryce Harrington
Declined for Jaunty by Steve Langasek
Nominated for Karmic by Սահակ
Nominated for Lucid by Սահակ
Nominated for Maverick by Miroslav Hadzhiev
Nominated for Natty by Miroslav Hadzhiev

Bug Description

[Problem]
Upscaled images in Firefox (and Opera) look pixelated when zoomed, edges appear jagged.

[Discussion]
This is because firefox is using nearest-neighbor interpolation for upscaling. It would look better if bilinear filtering were used by Cairo, which requires EXTEND_PAD. However, EXTEND_PAD is not implemented very well in several video drivers, and Cairo is unable to distinguish drivers that have good implementations from ones with bad ones, so it is currently using a client-side fall back which is deemed too slow by the firefox developers.

Solving this requires updating each video driver to either implement EXTEND_PAD correctly or at least stop advertising it can do it when it really can't. Once this is done, cairo's client-side workaround can be removed and firefox can be updated to use EXTEND_PAD.

The proposed fixes are available (for jaunty and karmic) in the firefox-smooth-scaling PPA:
https://launchpad.net/~firefox-smooth-scaling/+archive/ppa

[Original Report]
With Ubuntu Hardy beta + latest updates (15th April 2008) I suffer from bad image rendering quality in Firefox.
To see the type of problem just open the attached screenshot and scale to 100%.

The images that are blurred are razor sharp if I do a right click -> view image so it is perhaps a problem related to
image scaling.

The problem appears only with my laptop - so perhaps it is not a bug in Firefox but elsewhere (X-windows??/intel-driver??).
The laptop has a 3-year old Centrino-Platform uses 915 intel driver and has a lcd monitor with 1400x1050 resolution.

The rendering problem appears independent of the Desktop-Effects are on/off. So it does not seem to be a problem with
compiz.

p.s. Also the text in the Gnome-terminal is somewhat blurred (compared with e.g. text in Gedit)
p.s. The same homepage renders nicely on my desktop computer with a 1280x1045 and the ati-driver.

Don't hesitate to ask for more information.

Revision history for this message
In , Mardeg (mardeg) wrote :
Revision history for this message
In , Jo-hermans (jo-hermans) wrote :

see bug 259672 and the patch in bug 296818

Revision history for this message
In , Jim Kronebusch (jim-winonacotter) wrote :

I referenced both the bug and the patch above. I have the mozilla source downloaded and the diff and have been trying to get this to work with patch, but get many errors. I would love to test if this patch would fix the pixmap problem. If anyone could post some quick steps I'll give it a whirl.

Thanks,
Jim Kronebusch

Revision history for this message
In , Peter-vanderwoude (peter-vanderwoude) wrote :

*** This bug has been marked as a duplicate of bug 296818 ***

Revision history for this message
In , Bzbarsky (bzbarsky) wrote :

I think this would be better addressed by a different solution from bug 296818. See bug 296818 comment 27.

Revision history for this message
In , Bzbarsky (bzbarsky) wrote :

To summarize that comment, I think it makes sense to have a preference for maximal size of the pixmap cache we end up with. Once we get there, we stop decoding new images that would take us over the cache size. The default can be either infinite or something large enough that not rendering images is better than trying to render them at that point. Deployments in low-resource situations (e.g. mobiles with no virtual memory, thin clients, etc) can set the preference as needed.

Revision history for this message
In , Pavlov (pavlov) wrote :

there is already a feature to disable caching image data as pixmaps (we don't cache pixmaps to X11).

MOZ_DISABLE_IMAGE_OPTIMIZE=1 firefox

Revision history for this message
In , Pavlov (pavlov) wrote :

not sure what people are hoping to get out of this bug. if it is "need feature to disable" then it is already there (dup of bug 336191).

If you want to be smarter about the way we allocate pixmaps, that could be done separately and in addition to what we already have.

Revision history for this message
In , Jim Kronebusch (jim-winonacotter) wrote :

Stuart, where is the MOZ_DISABLE_IMAGE_OPTIMIZE=1 firefox to be set? Do we just add that to about:config? I am not sure if I am misreading your statement in Comment 8 or not. If I monitor resources with xrestop, I can see system memory usage spike as a result of Firefox hitting an image intense website (see the example website in Comment 1). I looked at bug 336191, but still don't understand where to set the parameter and am not clear on if this patch is already present in current release firefox.

Boris, I think your suggestion for a user settable limit is a good idea. Is it possible to set so that once the limit is reached, older data is simply overwritten still allowing new data to be cached but not exceeding the limit?

Jim

Revision history for this message
In , Bzbarsky (bzbarsky) wrote :

> Stuart, where is the MOZ_DISABLE_IMAGE_OPTIMIZE=1 firefox to be set?

In the environment. Shell-agnostic command-line:

  env MOZ_DISABLE_IMAGE_OPTIMIZE=1 firefox

> not clear on if this patch is already present

It's present in the alphas of Firefox 3.

Revision history for this message
In , Jim Kronebusch (jim-winonacotter) wrote :

I have a build of firefox-granparadiso to test Federico's patch. I launched it at the command line with env MOZ_DISABLE_IMAGE_OPTIMIZE=1 firefox-granparadiso. Then I loaded the site http://www.carteretcountyschools.org/bms/teacherwebs/sdavenport/artgallery6.htm to see what happened and monitored with xrestop. Pixmap storage would hit very close to 25MB then be cleared and start over. This seemed to work very well. If I simply launched without the environment variable, Pixmap storage would climb to over 500MB+ by the time the page finished loading. This seems acceptable. Is this possible to do in Firefox 2.0.0.6 and is it possible to set the environment variable permanently?

I could still see a use for a user settable limit on storage, and the ability to set this environment variable in about:config to make it more user friendly. A settable discard timer would also be helpful. All of these would make Firefox more usable in low memory situations and still allow defaults to be set for performance in standard higher memory situations.

Thanks,
Jim

Revision history for this message
In , Bzbarsky (bzbarsky) wrote :

> Is this possible to do in Firefox 2.0.0.6

No. The support for this is in the new Thebes rendering code. I suppose you could try to backport that fix to branch, but...

> is it possible to set the environment variable permanently

In your own account? Of course. See your shell's documentation.

Revision history for this message
In , Gavin McCullagh (gmccullagh) wrote :

(In reply to comment #11)
> Then I loaded the site
> http://www.carteretcountyschools.org/bms/teacherwebs/sdavenport/artgallery6.htm

Something strikes me about the way firefox (or is it Gecko?) deals with this page. The real cause of this issue is that the page contains a number of massive images, which are embedded at small resolution in the page. We all know this is down to bad web page authoring, but obviously firefox has to deal with it. My laptop slows to a crawl loading this page.

Arguably the reason for the problems in that webpage is that firefox uses the video card to do the resizing -- therefore caching a huge quantity of image data which it will never actually display (unless the person chooses to view the image which is probably quite rare).

I realise the video card will do the resize more quickly, but if firefox resized the image in software, the X server's RAM usage would be fairly minimal as it would be caching the data which was actually needed. There is often a balance between cpu and ram usage, this seems to be one of them.

I would therefore be inclined to suggest an optional feature (particularly for remote X servers or low ram situations) where firefox would resize the image in software and send the resized pixmap to the X server. Perhaps this would only be used where the original image was above a certain size -- or where the display size was under some fraction of the image size (eg less than half the width and height).

The X server seems often to do a simple resample, rather than a resize, so I would expect firefox to do the same.

Revision history for this message
In , Jim Kronebusch (jim-winonacotter) wrote :

Gavin, maybe this is how non-gecko based browsers are handling this and possibly why they are not affected in the same fashion.

Boris, Stuart, is this possible?

Revision history for this message
In , Bzbarsky (bzbarsky) wrote :

Storing images at the original size is a pretty long-standing imagelib design decision. You might want to read the various existing bugs that discuss that behavior.

Revision history for this message
In , Norbert-notz (norbert-notz) wrote :

User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.9b4) Gecko/2008030318 Firefox/3.0b4
Build Identifier: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.9b4) Gecko/2008030318 Firefox/3.0b4

Implement Bug 381661 (image filtering) for Linux

Reproducible: Always

Steps to Reproduce:
.
Actual Results:
Images in zoomed pages looks ugly.

Expected Results:
Images in zoomed pages look like in Firefox Windows build.

Revision history for this message
In , TheQuickBrownFox (theprash) wrote :

Any chance of this getting fixed by FF3 final? At least as an about:config setting? Us Linux users are feeling a little left out despite all the talk of equality across platforms.

Revision history for this message
In , Vladimir Vukicevic (vvuk) wrote :

(In reply to comment #1)
> Any chance of this getting fixed by FF3 final? At least as an about:config
> setting? Us Linux users are feeling a little left out despite all the talk of
> equality across platforms.

Talk to your distro provider then; the lack of the needed functionality in X is beyond our control.

Revision history for this message
Christian Göbel (christiangoebel) wrote : Images in Firefox are blurred

Binary package hint: firefox-3.0

With Ubuntu Hardy beta + latest updates (15th April 2008) I suffer from bad image rendering quality in Firefox.
To see the type of problem just open the attached screenshot and scale to 100%.

The images that are blurred are razor sharp if I do a right click -> view image so it is perhaps a problem related to
image scaling.

The problem appears only with my laptop - so perhaps it is not a bug in Firefox but elsewhere (X-windows??/intel-driver??).
The laptop has a 3-year old Centrino-Platform uses 915 intel driver and has a lcd monitor with 1400x1050 resolution.

The rendering problem appears independent of the Desktop-Effects are on/off. So it does not seem to be a problem with
compiz.

p.s. Also the text in the Gnome-terminal is somewhat blurred (compared with e.g. text in Gedit)
p.s. The same homepage renders nicely on my desktop computer with a 1280x1045 and the ati-driver.

Don't hesitate to ask for more information.

Revision history for this message
Christian Göbel (christiangoebel) wrote :
Revision history for this message
Christian Göbel (christiangoebel) wrote :

O.k. the problem with blurred fonts in the Gnome-terminal seems to be bug #190848 - so this is a different issue.

Reading through the Ubuntu-forums I got a hint, that the blurred images in Firefox may have something to do with zooming.
So if Firefox preserves the zooming-level that has been used in the last session this might lead to the impression that there is
a rendering problem. I am gonna check this evening.

Revision history for this message
Christian Göbel (christiangoebel) wrote :

Effectively the images are o.k. when the page is viewed without zoom.
Perhaps Firefox should set the zoom-level to 100% when restarted?

I also compared the rendering quality (when zoomed) with Firefox 3.0 beta5 on Windows XP and it appears that on Windows the images are blurred but it is less disturbing since on Windows the images are not pixeled.

Probably the bug description should changed to:
"Images in Firefox are extremely pixeled when zoomed"

To reproduce:
1) open Firefox, go to ubuntuforums: http://ubuntuforums.org/
2) type Str++ twice to zoom
3) look at the "ubuntu forums logo"

Revision history for this message
John Vivirito (gnomefreak) wrote : Re: Images in Firefox are extremely pixeled when zoomed

The bug about the zoom has already been reported in Launchpad just cant recall bug number, If i find it while going through email today ill mark it as such.

Revision history for this message
John Vivirito (gnomefreak) wrote :

I will look for it in morning some more it should be in my bugs list somewhere.

Changed in firefox-3.0:
assignee: nobody → mozilla-bugs
status: New → Incomplete
Revision history for this message
John Vivirito (gnomefreak) wrote :

The bug i thought was the same was bug #182038 but seems to be a different issue with zoom allk together. PLease look at bug and let me know if you are seeing the same issue as on that bug.

Revision history for this message
Alexander Behringer (alexander-behringer-deactivatedaccount) wrote :

I think there are two separate problems with zoomed images:

The first thing is, that in firefox 2.x only the text size was increased (and all objects with related size) when "zooming" (e.g. with ctrl+"+"). In firefox 3 however the image size is increased as well. But its possible to disable zooming of images via the menu (View -> Zoom -> Zoom Text Only). Maybe the default of that option should be changed.

The other thing is, that zoomed images are apparently nearest-neighbor interpolated, which indeed does not look very nice.
However shrinked images (e.g. via ctrl+"-") look good.
So i guess (real) interpolation is only enabled for shrinked images. Maybe for performance reasons?

Revision history for this message
Christian Göbel (christiangoebel) wrote :

@ John Vivirito: I tried most of the example of bug #182038 and I couldn't reproduce a single example. Perhaps I don't have the described bugs because I have a intel-centrino graphic card?

The phenomenon I reported as a bug seems only be related to the way images are zoomed / interpolated. Is there a known reason why this is done differently under WindowsXP and under Linux?

Revision history for this message
Christian Göbel (christiangoebel) wrote :

Can anybody reproduce/confirm this bug? Should I provide additional information?

Revision history for this message
In , Federico-ximian (federico-ximian) wrote :

Where in the code should this be implemented? What is needed from X?

Revision history for this message
In , Federico-ximian (federico-ximian) wrote :

To wit: nothing should be needed from X; GTK+ can already do beautiful scaling for you :)

Revision history for this message
Mr_Miyagi (david-wargert) wrote : Re: Images in Firefox are extremely pixeled when zoomed

I've had the same problem and it seems to be related to the zoom, when I reset it the images were rendered correctly.
The difference between the rendering on linux compared to windows could be because of this:
http://blog.vlad1.com/2008/03/18/a-little-more-cairo-just-for-you/

"Linux users will have to wait a little longer to get higher quality image scaling; as we now rely on the X server to do image compositing through the Render extension, we'll have to wait until the pixman patches are integrated into the X server. I'm hoping that will happen in time for the next X.org release."

Revision history for this message
In , Dao (dao) wrote :

*** Bug 431990 has been marked as a duplicate of this bug. ***

Changed in firefox-3.0:
status: Incomplete → Confirmed
Revision history for this message
John Vivirito (gnomefreak) wrote : Re: [Bug 217908] Re: Images in Firefox are extremely pixeled when zoomed

Christian Göbel wrote:
> ** Changed in: firefox-3.0 (Ubuntu)
> Status: Incomplete => Confirmed
>
Added tags mt-eval and mt-upstream.
Can someone please look for this bug in mozilla's bugzilla to see if it
has already been reported and what the status is, If you find one or
more that look like it is the bug please post the link on this bug
report and we will take a look at it and add it as needed. Incase you do
find it and are sure its the same please add it to tasks or post link here.
I think we have enough info on this bug to triage upstream but added
mt-eval in case someone on MT can think of other info needed but looks
right to me.

--
Sincerely Yours,
     John Vivirito

https://launchpad.net/~gnomefreak
https://wiki.ubuntu.com/JohnVivirito
Linux User# 414246

Changed in firefox:
status: Unknown → Invalid
Revision history for this message
ubuntu_demon (ubuntu-demon) wrote : Re: Images in Firefox are extremely pixeled when zoomed

I am also affected. I have an intel 945 graphics chipset. I have attached my lspci -nn.

This issue is known upstream :
https://bugzilla.mozilla.org/show_bug.cgi?id=411831

I discovered the upstream bug because it was listed between the known issues for Firefox RC2 in the Linux and Unix section as a problem with the nvidia driver :
http://www.mozilla.com/en-US/firefox/3.0rc2/releasenotes/#issues

I found a comment which is potentially interesting :
from https://bugzilla.mozilla.org/show_bug.cgi?id=411831#c101 :

[quote=Luke Hutchison ]
If anybody is wondering why this bug magically fixed itself in their distro
recently, it's because Ubuntu and Fedora have inverted the default behavior of
the XAANoOffscreenPixmaps option.

https://bugs.launchpad.net/ubuntu/+source/firefox-3.0/+bug/182038/comments/111

In case you're trying to debug this, you may need one of the following options
to bring back the broken behavior:

        Option "XAANoOffscreenPixmaps" "false"
        Option "XAAOffscreenPixmaps" "true"

Seems like sweeping things under the rug to me :o)
[/quote]

Revision history for this message
Alexander Sack (asac) wrote : Re: [Bug 217908] Re: Images in Firefox are extremely pixeled when zoomed

On Sat, Jun 07, 2008 at 07:41:36AM -0000, ubuntu_demon wrote:
> I am also affected. I have an intel 945 graphics chipset. I have
> attached my lspci -nn.
>
> This issue is known upstream :
> https://bugzilla.mozilla.org/show_bug.cgi?id=411831

vlad states that this is a X issue. However, X upstream wont fix XAA
so this probably is a dead end bug. Lets hope that EXA will be
everywhere soon.

 - Alexander

Revision history for this message
In , moenchmeyer (rm-anracon) wrote :

(In reply to comment #2)
> (In reply to comment #1)
> > Any chance of this getting fixed by FF3 final? At least as an about:config
> > setting? Us Linux users are feeling a little left out despite all the talk of
> > equality across platforms.
>
> Talk to your distro provider then; the lack of the needed functionality in X is
> beyond our control.
>

Does this mean that X could provide the necessary functionality but that it is the fault of the distro provider that the distro's X server implementation lacks the required properties?

Or is a basic feature missing in the xorg X-server itself?

Revision history for this message
In , Federico-ximian (federico-ximian) wrote :

I don't really know where in the code Mozilla scales the images, but if it needs to do that on Linux, it seems that it could use the gdk_pixbuf_scale*() family of functions very easily. Use GDK_INTERP_BILINEAR which is very nice and fast.

Revision history for this message
In , Federico-ximian (federico-ximian) wrote :

The documentation is here:
http://library.gnome.org/devel/gdk-pixbuf/stable/gdk-pixbuf-scaling.html

I'll be happy to assist anyone who wants to implement this.

Revision history for this message
In , Vladimir Vukicevic (vvuk) wrote :

Mozilla doesn't scale the images at all -- we hand off the image and a transform to RENDER, which needs to do the scaling. The issue is that the version of pixman that's currently shipped with all X servers doesn't implement EXTEND_PAD, which we need to get correct behaviour at image edges.

Revision history for this message
In , Marin-krkac (marin-krkac) wrote :

I was slightly annoyed by this not working so I tried to see what would happen if I uncommented the two special cases for bug 324698 in gfx/src/thebes/nsThebesImage.cpp (at lines ~573 and ~785). This means that the default case, with EXTEND_PAD, is used in the switch statement.

I compiled Firefox (the official Mozilla version) with --enable-system-cairo on Ubuntu 8.04, and it worked. I've been using it like this since RC1 and I haven't noticed any problems. I also tried zooming in on the IE 8 Beta page and it looks the same as the image on your blog.

If I'm not missing something obvious here, could you please create an (temporary?) official patch that could be used to enable this in the packages of the distributions for which it works?

Packages on my system:
xserver-xorg-core
2:1.4.1~git20080131-1ubuntu9.2

libpixman-1-0
0.10.0-0ubuntu1

libcairo2
1.6.0-0ubuntu2

Revision history for this message
In , Marin-krkac (marin-krkac) wrote :

I'm sorry, I meant "...what would happen if I *commented out* (not uncommented) the two special cases...".

Revision history for this message
In , Vladimir Vukicevic (vvuk) wrote :

It will "work", it will just be "slow". If you set EXTEND_PAD, then all images will be scaled in software, which will require a read from the x server and a write back for /every/ image paint. If you don't set EXTEND_PAD, then testcases such as https://bugzilla.mozilla.org/attachment.cgi?id=209616 and see that it doesn't work will fail.

Revision history for this message
In , Mozilla-francisrobichaud (mozilla-francisrobichaud) wrote :

Created an attachment (id=328690)
patch - reduce pixmap memory usage in X

Patch prescales images overflowing their Thebes destination rectangle because they've been resized with the "width" or "height" html tags. The patch uses the GDK library to perform downscaling using a bilinear interpolation algorithm. We also optimized the consumed X memory by only transferring the visible portion of a pixmap between the X application and server. This also reduces bandwith consumption and reduces the delay before an image is painted by X. Pixmaps are now kept in the application's memory instead of X's.

This patch only affects the behavior of pixmaps storage on UNIX systems. It could easily be ported to other platforms if similar issues are discovered.

Complete blog posts :
http://www.francisrobichaud.com/index.php/2008/07/08/optimizing-mozilla-and-pixmap-management-in-x/

Revision history for this message
In , Mozilla-francisrobichaud (mozilla-francisrobichaud) wrote :

Created an attachment (id=328694)
updated patch - reduce pixmap memory usage in X

Revision history for this message
In , Bzbarsky (bzbarsky) wrote :

Given that the same nsThebesImage can be drawn to multiple different destination rectangle sizes how does this page behave? Do we end up thrashing the pixmap on such draws?

Revision history for this message
In , Mozilla-francisrobichaud (mozilla-francisrobichaud) wrote :

The complete pixmap is always kept in Firefox's memory while one subpixmap is generated and sent to X for each destination rectangle. These subpixmaps do not trash the original pixmap and are only used for painting in X.

Revision history for this message
In , Bzbarsky (bzbarsky) wrote :

Yes, I understand all that. But the point is that before this patch we send the data to the server _once_ and then use it to paint whenever we need, right? With this patch, we send the data on every sub-rectangle paint? And multiple times if the image appears on the page multiple times?

How is scrolling performance with a non-local X server with this approach?

Revision history for this message
In , Mozilla-francisrobichaud (mozilla-francisrobichaud) wrote :

Data needs to be retransfered to the server for images that need resizing or
those that are partially visible. When it's transfered once, image
manimuplation is done by X which leads to poor quality in the case of image
resizing.

I've just tested scrolling and I confirm that the feeling is as good as with
the FF 3.0 official build on a local machine (for both regular and smooth
scrolling).

There is a very slight difference when scrolling with a thin client caused by
the transfer of images between the server and client. I will limit image
manipulations to find the best balance between memory consumption and bandwith
usage (e.g. only pre-scale under a certain ratio).

Revision history for this message
Sancho Panza (prashanthr-deactivatedaccount-deactivatedaccount) wrote : Re: Images in Firefox are extremely pixeled when zoomed

@ubuntu demon: The issue is discussed here:
https://bugzilla.mozilla.org/show_bug.cgi?id=422179
and not the bug that you mentioned.

vlad says about the bug (https://bugzilla.mozilla.org/show_bug.cgi?id=422179#c9) that
"Mozilla doesn't scale the images at all -- we hand off the image and a transform to RENDER,
which needs to do the scaling. The issue is that the
version of pixman that's currently shipped with all X servers doesn't implement
EXTEND_PAD, which we need to get correct behaviour at image edges."

I'm a noob, and this bug is really bothering me. I have my account of the problems on ubuntuforums:
http://ubuntuforums.org/showthread.php?t=841739

Please help.

Changed in firefox:
status: Unknown → Confirmed
Revision history for this message
Sancho Panza (prashanthr-deactivatedaccount-deactivatedaccount) wrote :

The exact same issue exists while using page zoom/image scaling in Opera web browser.

Revision history for this message
Sancho Panza (prashanthr-deactivatedaccount-deactivatedaccount) wrote : Re: Images in Firefox and Opera are extremely pixeled when zoomed

Based on the comment here https://bugzilla.mozilla.org/show_bug.cgi?id=422179#c9 and
here http://blog.vlad1.com/2008/03/18/a-little-more-cairo-just-for-you/ and the release of the
library pixman( http://lists.freedesktop.org/archives/xorg-announce/2008-March/000529.html ),
seems like the issue might be resolved by using that version of pixman at freedesktop. Could this be released as
a patch for hardy? Or would it involve complicated dependency issues and stuff?

If not, is there any way I could fix this on my system? If so, how?

Thanks,

Changed in libpixman:
status: New → Fix Committed
status: Fix Committed → Confirmed
Changed in xorg-server:
status: New → Confirmed
Changed in libpixman:
status: Confirmed → Invalid
Changed in xorg-server:
status: New → Confirmed
Changed in pixman:
status: New → Confirmed
Changed in xorg-server:
status: Confirmed → New
Changed in libpixman:
status: Invalid → New
Revision history for this message
In , Mozilla-francisrobichaud (mozilla-francisrobichaud) wrote :

Created an attachment (id=329705)
patch update - upscaling about:config pref

After testing the patch in a few environments, I discovered that the scrolling quality could be sluggish when Firefox was used on a thin client with an application server having low resources. Since we can assume that a thin client’s backend should have the minimum ressources to support mallocs without using the swap area, there should be no visible difference of usage on a thin client.

To give users control over image manipulation, I added the “browser.gdk_interpolation_threshold_percent” preference variable that allows values between 1-100 and has for effect to either use or bypass GDK image manipulations. The default value is 50% which only affects images being scaled by a factor of 50% or 200% and images with a visible portion under 50%. Lowering this value to it’s minimum (1%) would turn the feature off while using 100% will premanipulate any image overflowing it’s container.

Finally, as Joe from #gfx did mention, I added support for images upscaling with GDK to increase the image quality by also using the bilinear interpolation algorithm.

Revision history for this message
In , Bzbarsky (bzbarsky) wrote :

So you tested the patch with X over a WAN link (not just thin client, but appreciable latency and low bandwidth) and there was no impact?

Revision history for this message
In , Mozilla-francisrobichaud (mozilla-francisrobichaud) wrote :

Boris, I tested X over WAN and there is no difference between the original FF 3.0 and my patched version.

Revision history for this message
In , Mozilla-francisrobichaud (mozilla-francisrobichaud) wrote :

Created an attachment (id=329724)
update - missing all.js file

Changed in firefox-3.0:
assignee: mozilla-bugs → lusiads
Revision history for this message
Alexander Sack (asac) wrote : Re: [Bug 217908] Re: Images in Firefox and Opera are extremely pixeled when zoomed

On Fri, Jul 11, 2008 at 12:49:08AM -0000, Sancho Panza wrote:
> a patch for hardy? Or would it involve complicated dependency issues and stuff?
>
> If not, is there any way I could fix this on my system? If so, how?

Please verify that the latest pixman from intrepid fixes this
issue. Only then it makes sense to look if its possible to cherry pic
a fix for the EXPAND_PAD feature.

 - Alexander

Revision history for this message
Alexander Sack (asac) wrote :

On Fri, Jul 11, 2008 at 02:35:24PM -0000, Sancho Panza wrote:
> ** Also affects: xorg-server
> Importance: Undecided
> Status: New
>
> ** Changed in: xorg-server
> Status: New => Confirmed
>

closing firefox 2 task
 affects ubuntu/firefox
 status invalid

 - Alexander

Revision history for this message
In , Mozilla-francisrobichaud (mozilla-francisrobichaud) wrote :

Created an attachment (id=330932)
optimized/increased quality + fixed interlacing issue

needs reviewal

intensive testing has been done with that patch on both thin clients and desktops and no issue was reported.

http://www.francisrobichaud.com/index.php/2008/07/23/optimizing-mozilla-and-pixmap-management-in-x-updates/

Revision history for this message
In , Mozilla-francisrobichaud (mozilla-francisrobichaud) wrote :

(From update of attachment 330932)
lines
+/*#ifdef XP_UNIX
+ mTinySurf = nsnull;
+#endif*/
should be removed. can this be done without reuploading a new patch ?

Revision history for this message
In , Vladimir Vukicevic (vvuk) wrote :
Download full text (5.7 KiB)

(From update of attachment 330932)
Some comments on the patch, and then overall comments at the end...

>Index: ./gfx/src/thebes/nsThebesImage.cpp
>===================================================================
>RCS file: /cvsroot/mozilla/gfx/src/thebes/nsThebesImage.cpp,v
>retrieving revision 1.86
>diff -u -8 -p -B -b -r1.86 nsThebesImage.cpp
>--- ./gfx/src/thebes/nsThebesImage.cpp 28 Apr 2008 21:27:05 -0000 1.86
>+++ ./gfx/src/thebes/nsThebesImage.cpp 22 Jul 2008 20:36:07 -0000
>@@ -43,48 +44,68 @@
> #include "gfxPattern.h"
>
> #include "gfxPlatform.h"
>
> #include "prenv.h"
>
> static PRBool gDisableOptimize = PR_FALSE;
>
>+#ifdef XP_UNIX
>+static gfxFloat gImageThreshold = 0.5;

This variable is oddly named; I'm not sure what it means, especially
not from the name. gImagePreScaleFactor? Though that's not quite how
it's used, see below.

> nsresult
> nsThebesImage::Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth, nsMaskRequirements aMaskRequirements)
> {
> mWidth = aWidth;
> mHeight = aHeight;
>
>@@ -206,29 +227,28 @@ PRInt32
> nsThebesImage::GetAlphaLineStride()
> {
> return (mAlphaDepth > 0) ? mStride : 0;
> }
>
> void
> nsThebesImage::ImageUpdated(nsIDeviceContext *aContext, PRUint8 aFlags, nsRect *aUpdateRect)
> {
>+ mImageIncomplete = aFlags & nsImageUpdateFlags_ImageIncomplete;

You only modified the PNG decoder to pass down ImageIncomplete; why is
this info needed at all? You should be able to tell whether the image
is complete or not via the same mechanism used in GetIsImageComplete.

> nsresult
> nsThebesImage::Optimize(nsIDeviceContext* aContext)
> {
> if (gDisableOptimize)
> return NS_OK;
>
>@@ -326,21 +346,26 @@ nsThebesImage::Optimize(nsIDeviceContext
>
> #ifdef XP_MACOSX
> if (mQuartzSurface) {
> mQuartzSurface->Flush();
> mOptSurface = mQuartzSurface;
> }
> #endif
>
>+#ifndef XP_UNIX
> if (mOptSurface == nsnull)
> mOptSurface = gfxPlatform::GetPlatform()->OptimizeImage(mImageSurface, mFormat);
>+#endif
>+

If you want to do this, we should just early-return from Optimize
after the 1x1 check, instead of adding the extra ifdefs. But I'm not
sure it's a good idea, see below.

>@@ -482,24 +507,108 @@ nsThebesImage::Draw(nsIRenderingContext
> return NS_ERROR_FAILURE;
>
> // Expand the subimageRect to place its edges on integer coordinates.
> // Basically, if we're allowed to sample part of a pixel we can
> // sample the whole pixel.
> subimageRect.RoundOut();
>
> nsRefPtr<gfxPattern> pat;
>+#ifdef XP_UNIX
>+ // We optimize the image surface to it's visible size and use scaling algorithms
>+ // to reduce X memory consumption, bug 395260. We bypass 1x1 rectangles to avoid useless operations.
>+ if (destRect.size != gfxSize(1.0, 1.0) &&
>+ (mWidth > (destRect.size.width / gImageThreshold) ||
>+ mHeight > (destRect.size.height / gImageThreshold) ||
>+ xscale < (1.0 * gImageThreshold) || yscale < (1.0 * gImageThreshold) ||
>+ xscale > (1.0 / gImageThreshold) || yscale > (1.0 / gImageThreshold))) {

I don't understand this check at all; why isn't this just checking if
the xscale is...

Read more...

Revision history for this message
Sancho Panza (prashanthr-deactivatedaccount-deactivatedaccount) wrote : Re: Images in Firefox and Opera are extremely pixeled when zoomed

The ubuntu forums post on this thread (http://ubuntuforums.org/showthread.php?t=867161 ) claims that the bug still exists on Intrepid.

Changed in firefox-3.0:
assignee: lusiads → nobody
Revision history for this message
In , Mozilla-francisrobichaud (mozilla-francisrobichaud) wrote :

Created an attachment (id=331837)
changed GDK for cairo scaling

Updates:
- We don't use offscreen surfaces when we're drawing temp surfaces
- We use cairo transforms only to create visible image portions or to scale instead of GDK
- It is now multiplatform (compiled and tested on Windows)
- The modifications for the ImageUpdate flag is required for interlaced images. It is an issue with the GetIsImageComplete() which would return true even if we only had decoded the first pass on an interlaced image.

Revision history for this message
In , Mozilla-francisrobichaud (mozilla-francisrobichaud) wrote :

Created an attachment (id=332858)
updated patch from reviewers comments

Patch was separated in two bugs, PNGDecoding for interlaced image is now referred to bug 449655.
I added some comments and removed the all.js variable. Users must now create the browser.image_prescaling_threshold variable of type integer in the about:config panel.

Revision history for this message
In , ®om (rom1v) wrote :

*** Bug 455495 has been marked as a duplicate of this bug. ***

Revision history for this message
Sancho Panza (prashanthr-deactivatedaccount-deactivatedaccount) wrote : Re: Images in Firefox and Opera are extremely pixeled when zoomed

This bug has been fixed in the latest xorg packages, but has yet to be patched in Intrepid. Will this bugfix ever get integrated into Intrepid? Can someone please tell me why it is this hard to implement this patch for a graphics issue that affects Firefox and Opera on Linux alone? This issue is practically ruining my browsing experience.

Revision history for this message
crjackson (crjackson) wrote :

Just adding that I get the same results as the original poster. I have 12 test systems with ATI, nVidia, Intel and VIA graphics cards. I can reproduce this problem on EVERY machine. Each machine is running either Hardy 32 or 64 with all updates. Someone needs to address this issue soon. It IS very annoying!

Revision history for this message
In , Joe-drew (joe-drew) wrote :

(From update of attachment 332858)
Couple of problems with this patch:
1. Not having a browser.image_prescaling_threshold pref doesn't disable prescaling.

2. (much more important) It breaks several reftests, including the apng reftest.

Changed in libpixman:
status: New → Confirmed
Changed in xorg-server:
status: New → Confirmed
Revision history for this message
shafin (mahdee-jameel) wrote : Re: Images in Firefox and Opera are extremely pixeled when zoomed

I can confirm this bug on intrepid too.
I think resetting the zoom would be a bad idea, as I have to change it every time. BTW, I had the problem with ubuntuforums.org, I zoomed in one thread, and all other was zoomed too. So if there is a way to induce page specific zoom,instead of site specific one's, that'd be a good temporary fix.

Revision history for this message
Bryce Harrington (bryce) wrote :

@Sancho, you refer to a patch - can you give a pointer to the patch? We are relatively caught up to upstream's latest released code, but if there are new patches we can certainly consider backporting them, but the exact patches need to be identified first.

For anyone still seeing this problem, please attach your /var/log/Xorg.0.log. Simply giving a "me too" with no details is sort of like phoning your friend and telling them you're lost, without telling them what street you're on. ;-) The Xorg.0.log has the info about your video card, software versions, etc. needed for troubleshooting.

Revision history for this message
Bryce Harrington (bryce) wrote :

@Sancho, in comment #16 you claim that the issue is fixed in pixman 0.10, yet we're shipping 0.12 in Intrepid. I cannot find evidence to back up your claim that this is fixed upstream. Feel free to provide some additional proof, but for now I'm going to decline the Intrepid nomination.

Revision history for this message
In , longsonr (longsonr) wrote :

*** Bug 459508 has been marked as a duplicate of this bug. ***

Revision history for this message
Sancho Panza (prashanthr-deactivatedaccount-deactivatedaccount) wrote : Re: Images in Firefox and Opera are extremely pixeled when zoomed

@Bryce, thank you so much for your time. I trying for so long to get some response on this.
I a relative noob and am not into coding, so I can't compare actual codes and the like. My comments are based on what I have read on forums and mailing lists. Based on that and my personal experience, here are the answers to your queries:

* On the comment here https://bugzilla.mozilla.org/show_bug.cgi?id=422179#c9 says
"Mozilla doesn't scale the images at all -- we hand off the image and a transform to RENDER,
which needs to do the scaling. The issue is that the
version of pixman that's currently shipped with all X servers doesn't implement
EXTEND_PAD, which we need to get correct behaviour at image edges."
* And here http://blog.vlad1.com/2008/03/18/a-little-more-cairo-just-for-you/ which says "Linux users will have to wait a little longer to get higher quality image scaling; as we now rely on the X server to do image compositing through the Render extension, we'll have to wait until the pixman patches are integrated into the X server. I'm hoping that will happen in time for the next X.org release."
* And the release of the library pixman( http://lists.freedesktop.org/archives/xorg-announce/2008-March/000529.html ) makes reference to modifications in the EXTEND_PAD.
* Related comparison of graphics renderings on winXP and ubuntu hardy are here: http://farm3.static.flickr.com/2162/2481984708_dedc30e9df_o.png
* This poll on Ubuntu forums indicates that 45 of 56 voters had this issue on intrepid as of today http://ubuntuforums.org/showthread.php?t=867161

These are the pieces that I used to guess that the bug might be fixed upstream. Thats the best I could do.
I'm aware that latest Intrepid and Fedora10 beta use the latest xorg packages but dont seem to have this bug fixed.
Based on the above info, I also assumed that it had nothing to do with the graphics card.

My Xorg log is attached.

Revision history for this message
In , Mozilla-francisrobichaud (mozilla-francisrobichaud) wrote :

Bilinear interpolation has been implemented for image upscaling and downscaling with bug https://bugzilla.mozilla.org/show_bug.cgi?id=395260 for Linux.
This should be a child of 395260. Basically, it relies on an about:config parameter where the user can set a value between 0 and 100 which defines when bilinear interpolation will be used for scaled images.

Revision history for this message
Sancho Panza (prashanthr-deactivatedaccount-deactivatedaccount) wrote : Re: Images in Firefox and Opera are extremely pixeled when zoomed

Here's something that I find truly weird: When I zoom any page a whole bunch
of times, the image files are all jagged and messy, but if I click-n-drag any such
badly zoomed image, the image that gets dragged with the mouse is zoomed
perfectly, and to the same scale as the original!

Revision history for this message
In , Jo-hermans (jo-hermans) wrote :

*** Bug 465494 has been marked as a duplicate of this bug. ***

Revision history for this message
Bonaldo2000 (morten-m-olsen) wrote : Re: Images in Firefox and Opera are extremely pixeled when zoomed

I also have the bug on Intrepid. My zoom is both slow and the images get very ugly.
I would love for it to be fixed!

Alexander Sack (asac)
Changed in firefox-3.0:
importance: Undecided → Wishlist
status: Confirmed → Triaged
Revision history for this message
Sancho Panza (prashanthr-deactivatedaccount-deactivatedaccount) wrote :

Why is the importance of this bug set to 'wishlist'? Isnt this something that is not working the way it is intended to, rather than a feature request?Having the page zoom functionality would be a wishlist, but asking for a broken page zoom functionality to be fixed would be a proper bug (Low priority, maybe).
    Is a wishlist simply because, strictly speaking, the bug affects a feature that one can live without? I (and many others using high ppi displays) would like to disagree bcos it can sometimes be really hard to read webpages (designed for standard 96ppi displays) without zooming. And with more people having high ppi displays nowadays, it is not a wishlist anymore, but an accessibility issue.
    But one rather curious point that I would like to bring to the attention of whoever is working on the bug is my comment above: https://bugs.launchpad.net/ubuntu/+source/firefox-3.0/+bug/217908/comments/26
It gives me an impression that the bug fix might be easier to fix that I imagine it to be. But I'm no developer and I could not know for sure.

Revision history for this message
In , Mozilla-francisrobichaud (mozilla-francisrobichaud) wrote :

Created an attachment (id=351844)
partially fixed some reftests

Fixed the aPNG tests.
text/zwnj-02.html, bugs/214077-1b.html and bugs/214077-1a.html are still failing but I'm out of ideas.
Some other SVG tests are also failing and this is due to gfxImageFrame::SetMutable where I changed mImage->Optimize() for mImage-SetMutable(). We can't restore mImage->Optimize() or we won't be able to reduce memory usage.

Revision history for this message
In , Zweinberg (zweinberg) wrote :

Created an attachment (id=351955)
test case

The attached test case takes an 1x2 pixel image and stretches it horizontally to several hundred pixels wide, several times (with different stretch distances). On Linux, some of the green lines will show black dots at the far right. If you change the zoom level, the dots change size jump from one line to another, and at some zoom levels there are also black lines at the bottom of each image. I have anecdotal reports that similar image artifacts are highly visible with Ubuntu 8.10's build of Firefox 3.0.x (not sure which point revision) when playing the browser-hosted game at www.kingdomofloathing.com, so this is not merely a problem for contrived test cases.

The artifacts arise because, on Linux, we are trying to avoid the use of the CAIRO_EXTEND_PAD source filter because it takes a slow fallback path. Instead, we use nearest-neighbor image scaling, on the theory that that will never sample pixels outside the image. As this test case demonstrates, that theory is incorrect.

I will shortly attach a patch which uses EXTEND_PAD universally and modifies the Cairo library to turn on accelerated handling of this mode when the X server supports it. (Render protocol 0.10 - available in X.org server 1.5 - includes support for EXTEND_PAD and it appears to work when I make the library aware of it.) I'd be happy to see a fix that don't involve a major performance hit on older X servers but I have been unable to think of one.

(I suspect this test case, or a slight modification, will also show artifacts at some zoom levels on Mac, because we are also not using EXTEND_PAD there - in that case not for performance but because someone had the erroneous impression that EXTEND_PAD is the default on Mac. Code inspection suggests that Cairo does implement EXTEND_PAD correctly and speedily on Mac.)

Revision history for this message
In , Zweinberg (zweinberg) wrote :

Created an attachment (id=351956)
proposed patch (incl Cairo changes)

Here's the patch as described above. Reftest run in progress.

Revision history for this message
In , Vladimir Vukicevic (vvuk) wrote :

(From update of attachment 351956)
Looks fine, except for:

>+ pattern->SetExtend(gfxPattern::EXTEND_PAD);

This shouldn't be done on OSX; the quartz surface behaves slightly differently and PAD will cause us to take a slow path.

Also, make sure you do the cairo patch bit -- add the patch file itself to gfx/cairo and edit gfx/cairo/README to reference it, or it'll get blown away next cairo upgrade. Jeff or I will upstream it when we can.

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

I seem to recall problems with PAD being buggy in the X server, but I don't remember any details. I guess if reftests pass that's a pretty good sign, but how confident are we about the various server/driver combinations? Does Carl know?

I basically like the patch but I'd like to see a new version addressing Vlad's comments. Also, what does returning UNSUPPORTED actually cause cairo to do here?

Revision history for this message
In , Zweinberg (zweinberg) wrote :

(In reply to comment #2)
> >+ pattern->SetExtend(gfxPattern::EXTEND_PAD);
>
> This shouldn't be done on OSX; the quartz surface behaves slightly differently
> and PAD will cause us to take a slow path.

It's necessary. I haven't tried this exact testcase but I can reproduce visual artifacts on OSX without it. Also, looking at cairo-quartz-surface.c, it doesn't seem to take a fallback for EXTEND_PAD, only EXTEND_REPEAT/REFLECT.

> Also, make sure you do the cairo patch bit -- add the patch file itself to
> gfx/cairo and edit gfx/cairo/README to reference it, or it'll get blown away
> next cairo upgrade. Jeff or I will upstream it when we can.

Ok.

(In reply to comment #3)
> I seem to recall problems with PAD being buggy in the X server, but I don't
> remember any details. I guess if reftests pass that's a pretty good sign, but
> how confident are we about the various server/driver combinations? Does Carl
> know?

For the record, I see no regressions in the reftests with this change, but the reftest included in the patch fails -- still analyzing. I think it's an accident of how I wrote the test.

> I basically like the patch but I'd like to see a new version addressing Vlad's
> comments. Also, what does returning UNSUPPORTED actually cause cairo to do
> here?

The failure propagates to _cairo_surface_composite in cairo-surface.c which then calls _cairo_surface_fallback_composite -- so the rendering is the same, but without X-server acceleration.

Revision history for this message
In , Vladimir Vukicevic (vvuk) wrote :

(In reply to comment #4)
> (In reply to comment #2)
> > >+ pattern->SetExtend(gfxPattern::EXTEND_PAD);
> >
> > This shouldn't be done on OSX; the quartz surface behaves slightly differently
> > and PAD will cause us to take a slow path.
>
> It's necessary. I haven't tried this exact testcase but I can reproduce visual
> artifacts on OSX without it. Also, looking at cairo-quartz-surface.c, it
> doesn't seem to take a fallback for EXTEND_PAD, only EXTEND_REPEAT/REFLECT.

I can't reproduce with this testcase; no black or anything but green shows up. As you say, PAD is ignored anyway (incorrectly, I guess, but correctly for perf). So there's a separate bug there, I think.

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

Yeah, if there's a Mac problem, let's handle that under a separate bug.

Revision history for this message
In , Zweinberg (zweinberg) wrote :

(In reply to comment #5)
> > I haven't tried this exact testcase but I can reproduce visual
> > artifacts on OSX without it. Also, looking at cairo-quartz-surface.c, it
> > doesn't seem to take a fallback for EXTEND_PAD, only EXTEND_REPEAT/REFLECT.
>
> I can't reproduce with this testcase; no black or anything but green shows up.
> As you say, PAD is ignored anyway (incorrectly, I guess, but correctly for
> perf). So there's a separate bug there, I think.

PAD is not ignored on OSX. I have empirical evidence that it does *something*, and my impression from reading the code is that it is implemented with acceleration. Compare the rendering of reftests/border-image/solid-image-2.html at all zoom levels with these two builds:

https://build.mozilla.org/tryserver-builds/2008-12-02_11:<email address hidden><email address hidden>

https://build.mozilla.org/tryserver-builds/2008-12-05_17:<email address hidden><email address hidden>

At some zoom levels (reportedly not the default, though) you should see gaps in the borders with the first, but not the second. The only difference is that the second one sets EXTEND_PAD for quartz surfaces. (Note that both builds have other patches in them -- you should *not* see gaps in the border with a trunk build.)

Given that the mitigating change is in a shared code path for all images, I am certain it is possible to construct a test case that doesn't use border-image but nonetheless fails on OSX, but I have to leave it to someone who actually has a Mac.

I don't see any value in splitting the bug. It is the same bug on both Mac and Linux - we need to be using EXTEND_PAD and we're not.

Revision history for this message
In , Zweinberg (zweinberg) wrote :

(In reply to comment #4)
> For the record, I see no regressions in the reftests with this change, but the
> reftest included in the patch fails -- still analyzing. I think it's an
> accident of how I wrote the test.

Bad news: the reftest failure in the patch seems to be caused by going back to whatever Cairo's default is for resampling on image upscale. With the patch as posted, the test file's images are rendered with a very slight color gradient: at about one-third of the way across each image, the white stripe changes from #ffffff to #fbfffb, and at about two-thirds across, the green stripe changes from #00ff00 to #04ff04. This does not happen if I leave in the call to pattern->SetFilter(0).

I'd be interested to know if this test fails in Windows and Mac builds.

Revision history for this message
In , Zweinberg (zweinberg) wrote :

... I can reproduce the equivalent of the reftest failure with code that uses only the patched cairo library, and the failure goes away if I take the patches out of cairo. + some web searches turned up other cases where RepeatPad in Render just plain doesn't work.

This makes me a lot less sanguine about the whole idea. :-(

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

Can you paste some links here which refer to specific problems we should watch out for the next time we think about enabling PAD on GTK?

Revision history for this message
In , Zweinberg (zweinberg) wrote :

http://lists.freedesktop.org/archives/xorg/2008-February/032973.html has a test program that fails catastrophically for PAD and REFLECT (or rather, the Render equivalents) on my desktop computer (ATI graphics) and for REFLECT, but not PAD, on my laptop (Intel graphics). Which has the lovely implication that this is not just about the Render implementation, but about which specific video driver you've got...

I'll attach the test program I wrote tomorrow, when the desktop is on again.

Any thoughts on how to proceed here?

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

No suggestions here other than "mark some tests random on GTK and hope things get better someday"

Revision history for this message
In , Vladimir Vukicevic (vvuk) wrote :

wanted1.9.1 is dead

Revision history for this message
In , Zweinberg (zweinberg) wrote :

Created an attachment (id=353263)
"stretch single pixel" cairo-only test case

I promised to attach this test case, which demonstrates bugs in X Render (you need to use it with a Cairo library patched to try to use RepeatPad for CAIRO_EXTEND_PAD).

Revision history for this message
NoBugs! (luke32j) wrote : Re: Images in Firefox and Opera are extremely pixeled when zoomed

Same problem here. Very annoying bug.

Revision history for this message
In , Tom Jaeger (thjaeger) wrote :

Vladimir, could you explain what needs to happen in X/pixman and/or firefox for this bug to be fixed? Thanks.

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: Images in Firefox and Opera are extremely pixeled when zoomed

I've added a patched xulrunner package to my PPA where EXTEND_PAD is used for upscaling instead of nearest-neighbor (this is roughly what was suggested here: https://bugzilla.mozilla.org/show_bug.cgi?id=422179#c10). This might be a little slower because it's using a software fallback (if I understand comment 12 in the mozilla bugtracker correctly), but you'll only take that hit for images that are actually upscaled and those will look much better.

Packages are here:
http://ppa.launchpad.net/thjaeger/ubuntu/pool/main/x/xulrunner-1.9/
You'll probably just need the xulrunner-1.9 and xulrunner-1.9-gnome-support packages. These are jaunty packages (so that people won't get them by accident), but they should work fine on intrepid.

Revision history for this message
In , Tom Jaeger (thjaeger) wrote :

My testing suggests that EXTEND_PAD is supported by XRender now. The following seems to fix the issue for me:

* Change pat->SetFilter(0) to pat->SetExtend(gfxPattern::EXTEND_PAD) to use EXTEND_PAD for upscaling
* patch cairo to not claim that REPEAT_PAD is unsupported by XRender.

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: Images in Firefox and Opera are extremely pixeled when zoomed

Okay, I dug a little deeper and it turns out firefox uses cairo for rendering and cairo will use client-side rendering because it thinks the X server doesn't support EXTEND_PAD. My testing suggests that XRender does support it, though (at least since hardy). So the solution to the performance issues outlined above is to patch cairo to not claim EXTEND_PAD is unsupported by XRender. Jaunty packages are in my PPA:

http://ppa.launchpad.net/thjaeger/ubuntu/pool/main/c/cairo/

Revision history for this message
Tom Jaeger (thjaeger) wrote :

I suggest the following changes to the bug status:

* Close for xorg-server and pixman.
* Mark the bug invalid for firefox(-3.0)
* Open for xulrunner-1.9 and cairo

Revision history for this message
Tom Jaeger (thjaeger) wrote :

Okay, so it turns out that the reason for these fallbacks is that some drivers implement certain Xrender operations incorrectly (see this thread for details: http://lists.cairographics.org/archives/cairo/2009-January/016320.html). One such case is the opensource radeon driver, the intel driver is apparently find (at least on i965). It's trivial to patch broken drivers to use a server-side software fallback instead, which doesn't cause nearly as much of performance hit as the client-side fallback that we would have right now. It'd be nice to get a few more data-points (especially from users of the closed-source ati and nvidia drivers, as we can't patch those).

A test that would be helpful to run is attached to the following mailing list post:
http://lists.freedesktop.org/archives/xorg/2008-February/032973.html
For your convenience, I'm also attaching an i686 binary. Use 'chmod +x repeat-test_i686 && ./repeat-test_i686' to run it.

Revision history for this message
Sancho Panza (prashanthr-deactivatedaccount-deactivatedaccount) wrote :

Thanks Tom, for all your effort in pushing this. I did run the test (without any of
the patches you listed in earlier posts) and my output is:

Testing repeat mode none: PASS
Testing repeat mode normal: PASS
Testing repeat mode pad: PASS
Testing repeat mode reflect: *** FAIL ***
 60 pixels differ from expected result.
 Expected output written to repeat-test-reflect-expected.png
 Actual output written to repeat-test-reflect-out.png

I have an Intel integrated graphics card. I dont remember the command I could use to
get more details about the card, else would have given more specifics. Should I go
ahead and install the patched xulrunner and rerun the tests?

Cheers!

Revision history for this message
Sancho Panza (prashanthr-deactivatedaccount-deactivatedaccount) wrote :

Tom, regarding the patch, you mentioned that applying it be slower and performance could take a hit.
I scale up almost all the webpages I browse, so does that mean it would add up to a notable
performance hit?

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: Images in Firefox and Opera are extremely pixeled when zoomed

Sancho Panza wrote:
> Thanks Tom, for all your effort in pushing this. I did run the test (without any of
> the patches you listed in earlier posts) and my output is:
>
> Testing repeat mode none: PASS
> Testing repeat mode normal: PASS
> Testing repeat mode pad: PASS
> Testing repeat mode reflect: *** FAIL ***
> 60 pixels differ from expected result.
> Expected output written to repeat-test-reflect-expected.png
> Actual output written to repeat-test-reflect-out.png
>
> I have an Intel integrated graphics card. I dont remember the command I could use to
> get more details about the card,

You can figure out what card you have using the command below. Is this
hardy, intrepid or jaunty?

lspci | grep Display

> else would have given more specifics. Should I go
> ahead and install the patched xulrunner and rerun the tests?

The tests use XRender directly, so they won't be affected by installing
those packages.

> Tom, regarding the patch, you mentioned that applying it be slower and
> performance could take a hit.
> I scale up almost all the webpages I browse, so does that mean it
> would add up to a notable performance hit?

There'll be a noticable performance degradation if you only install the
xulrunner package. If you also install the cairo package, you should be
fine. You'll probably have to pull in a few dependencies from jaunty to
be able to use the package on intrepid (I can't put intrepid packages in
my PPA, unfortunately).

Revision history for this message
Sancho Panza (prashanthr-deactivatedaccount-deactivatedaccount) wrote : Re: Images in Firefox and Opera are extremely pixeled when zoomed

Tom,
My graphics card specifics (on Intrepid) are:

00:02.1 Display controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 0c)

Regarding installing xulrunner and cairo using jaunty dependencies, that sounds like
dependency hell waiting to happen. I guess I'll wait till the official release.

Cheers,

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: Images in Firefox and Opera are extremely pixeled when zoomed

Sancho Panza wrote:
> Tom,
> My graphics card specifics (on Intrepid) are:
>
> 00:02.1 Display controller: Intel Corporation Mobile GM965/GL960
> Integrated Graphics Controller (rev 0c)
Okay, I have the same card. Intrepid has a 2.4 intel driver, so
presumably Reflect has been fixed in 2.5, which means we're good for
intrepid. The only one that matters for image scaling is pad anyway,
but I'd rather fix everything while we're at it.

Could some more people run the reflect-test program? It's important to
know where we're standing before deciding how to proceed.

Revision history for this message
Sancho Panza (prashanthr-deactivatedaccount-deactivatedaccount) wrote : Re: Images in Firefox and Opera are extremely pixeled when zoomed

Here are the results of the test on another separate machine:

Ubuntu version: 8.04 LTS (Hardy Heron)
00:02.0 VGA compatible controller: Intel Corporation 82945G/GZ Integrated Graphics Controller (rev 02)

Testing repeat mode none: PASS
Testing repeat mode normal: PASS
Testing repeat mode pad: PASS
Testing repeat mode reflect: *** FAIL ***
 60 pixels differ from expected result.
 Expected output written to repeat-test-reflect-expected.png
 Actual output written to repeat-test-reflect-out.png

Hope this helps,
Cheers!

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: Images in Firefox and Opera are extremely pixeled when zoomed

Thanks. So intel is fine. I looked at the source of all the drivers in
jaunty and five of them are broken (vmware I'm unsure about):

xserver-xorg-video-ati-6.10.0
xserver-xorg-video-mga-1.4.9.dfsg (probably won't be an issue in
practice as it almost never accelerates)
xserver-xorg-video-i128-1.3.1 (Is anybody still using this one?)
xserver-xorg-video-openchrome-0.2.903+svn599

Details here:
http://lists.cairographics.org/archives/cairo/2009-January/016342.html

So at this point, the only input that I'm looking for is from people who
are using the closed source nvidia/ati driver (preferably on intrepid).

Sancho Panza wrote:
> Here are the results of the test on another separate machine:
>
> Ubuntu version: 8.04 LTS (Hardy Heron)
> 00:02.0 VGA compatible controller: Intel Corporation 82945G/GZ Integrated Graphics Controller (rev 02)
>
> Testing repeat mode none: PASS
> Testing repeat mode normal: PASS
> Testing repeat mode pad: PASS
> Testing repeat mode reflect: *** FAIL ***
> 60 pixels differ from expected result.
> Expected output written to repeat-test-reflect-expected.png
> Actual output written to repeat-test-reflect-out.png
>
> Hope this helps,
> Cheers!
>

Revision history for this message
In , Francis Giraldeau (francis-giraldeau) wrote :

Are there any news about this bug? We will need this patch into firefox 3.1 to prevent crash of linux thin-clients, caused by large pictures loaded in X server memory. Where is it stuck?

Revision history for this message
In , Joe-drew (joe-drew) wrote :

I haven't looked into the other reftest failures, but until they're fixed, there's no way this can be applied.

Tom Jaeger (thjaeger)
Changed in xorg-server:
status: Confirmed → Invalid
Changed in pixman:
status: Confirmed → Fix Released
Changed in firefox-3.0:
status: Triaged → Invalid
Changed in xorg-server:
status: Confirmed → Invalid
Changed in libpixman:
status: Confirmed → Fix Released
Revision history for this message
Sancho Panza (prashanthr-deactivatedaccount-deactivatedaccount) wrote : Re: Images in Firefox and Opera are extremely pixeled when zoomed

Hey Tom,
Is it ok to request people on UbuntuForums to help with running the test that you need?
Should I go ahead and make a post asking for volunteers using nvidia/ati to run the
reflect-test program? Is there any possibility of any issues with their systems
while running the test?

Cheers!

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: Images in Firefox and Opera are extremely pixeled when zoomed

Yes, that would be very helpful. The test is completely harmless, it
just executes a few Render operations and dumps the results to .png
files that can be safely deleted afterwards.

Thanks!

Sancho Panza wrote:
> Hey Tom,
> Is it ok to request people on UbuntuForums to help with running the test that you need?
> Should I go ahead and make a post asking for volunteers using nvidia/ati to run the
> reflect-test program? Is there any possibility of any issues with their systems
> while running the test?
>
> Cheers!
>

Changed in xulrunner:
status: Unknown → In Progress
Revision history for this message
Sancho Panza (prashanthr-deactivatedaccount-deactivatedaccount) wrote : Re: Images in Firefox and Opera are extremely pixeled when zoomed

Trying to install the xulrunner packages and/or the cairo package from your ppa
leads to unresolved dependencies on Intrepid.

Cheers!

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: Images in Firefox and Opera are extremely pixeled when zoomed

I created a special PPA for this bug with intrepid and jaunty packages
in it:

https://launchpad.net/~firefox-smooth-scaling/+archive

It'll take about an hour for the packages to build.

Sancho Panza wrote:
> Trying to install the xulrunner packages and/or the cairo package from your ppa
> leads to unresolved dependencies on Intrepid.
>
> Cheers!
>

Revision history for this message
Michael Basil (michael-ashtonbrsc) wrote : Re: Images in Firefox and Opera are extremely pixeled when zoomed

Ubuntu 8.10
02:00.0 VGA compatible controller: nVidia Corporation GeForce 8400 GS (rev a1)
Using closed source nvidia driver

Testing repeat mode none: PASS
Testing repeat mode normal: PASS
Testing repeat mode pad: PASS
Testing repeat mode reflect: *** FAIL ***
 60 pixels differ from expected result.
 Expected output written to repeat-test-reflect-expected.png
 Actual output written to repeat-test-reflect-out.png

Revision history for this message
Sancho Panza (prashanthr-deactivatedaccount-deactivatedaccount) wrote :

Thanks Michael.

Hi Tom, I'm able to install the libpixman and xulrunner files in your repo without issues and that fixes the
problem. I'm unable to install the cairo/udeb packages in the repo due to unresolved dependencies. Does that mean im taking a performance hit?

Thanks,

Revision history for this message
Tom Jaeger (thjaeger) wrote :

Thanks, Michael, that's very helpful. So nvidia is okay (most likely falls back to software rendering), so we're good there.

Sancho, the packages are built against intrepid, so there shouldn't be any dependency problems. Just adding the two lines to your sources.list file and running an upgrade should work.

Revision history for this message
Michał Gołębiowski-Owczarek (mgol) wrote :

My hardware:
$ lspci | grep Display
01:00.0 VGA compatible controller: Silicon Integrated Systems [SiS] 661/741/760 PCI/AGP or 662/761Gx PCIE VGA Display Adapter

OS: Hardy

repeat-test_i686 script output:

$ ./repeat-test_i686
Testing repeat mode none: PASS
Testing repeat mode normal: PASS
Testing repeat mode pad: PASS
Testing repeat mode reflect: *** FAIL ***
 60 pixels differ from expected result.
 Expected output written to repeat-test-reflect-expected.png
 Actual output written to repeat-test-reflect-out.png

I attach repeat-test-reflect-expected.png and repeat-test-reflect-out.png

Revision history for this message
Michał Gołębiowski-Owczarek (mgol) wrote :
Bryce Harrington (bryce)
Changed in xserver-xorg-video-ati:
status: New → Confirmed
Changed in xserver-xorg-video-i128:
status: New → Confirmed
Changed in xserver-xorg-video-mga:
status: New → Confirmed
Changed in xserver-xorg-video-openchrome:
status: New → Confirmed
Revision history for this message
Սահակ (petrosyan) wrote :

My hardware:

$ lspci | grep Display
01:00.1 Display controller: ATI Technologies Inc R520 [Radeon X1800] (Secondary)

OS: Ubuntu 8.10, 64 bit

$ ./repeat-test_i686
Testing repeat mode none: PASS
Testing repeat mode normal: PASS
Testing repeat mode pad: PASS
Testing repeat mode reflect: *** FAIL ***
 60 pixels differ from expected result.
 Expected output written to repeat-test-reflect-expected.png
 Actual output written to repeat-test-reflect-out.png

My monitor has 1600x1200 resolution, and I rescale many websites. The new Firefox displays them a lot better than the old version.

Revision history for this message
toxwa (d-w63) wrote :

Hi was just looking for a fix, and was lucky to find it was posted here just a few hours ago here. Thanks, Tom.

I first automatically updated xulrunner and that gave much better quality resizing. But this did give a performance drop.
cairo didn't update automatically. It has the same version number (1.8.0-0) as the one in the standard intrepid repositories. I had to force synaptic to use the "older version" from your repo. And now it works smoothly (both speed and image quality :-) as it should.

BTW: I'm using Intrepid 64bit, with nVidia Corporation GeForce Ti4200 (closed source nVidia driver: 96.43.09)
thanks again for the help.

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: Images in Firefox and Opera are extremely pixeled when zoomed

> I first automatically updated xulrunner and that gave much better quality resizing. But this did give a performance drop.
> cairo didn't update automatically. It has the same version number (1.8.0-0) as the one in the standard intrepid repositories. I had to force synaptic to use the "older version" from your repo. And now it works smoothly (both speed and image quality :-) as it should.

I've uploaded an updated cairo package to the PPA.

Thanks to everyone who posted their results, we're apparently fine as
far as the closed-source drivers are concerned.

I will try to get the necessary driver fixes upstream. As for cairo and
mozilla, both upstream projects are aware of the issues and are planning
to go this route eventually [1,2], but it's unlikely to happen in time
before jaunty because they have no way of checking whether the X server
is using buggy drivers. Since we can make sure that all the drivers
shipped with ubuntu are fine, we can enable those fixes earlier to get
faster and better-quality scaling.

[1]
http://cgit.freedesktop.org/xorg/driver/xf86-video-intel/commit/?id=128223ee9b7880e640056475462eca9a88415492
[2] http://lists.cairographics.org/archives/cairo/2009-January/016324.html

Revision history for this message
In , Tom Jaeger (thjaeger) wrote :

XRender supports four possible repeat types: RepeatNone, RepeatNormal, RepeatPad and RepeatReflect. The driver currently only handles the first two, so it should fall back to software when it encounters RepeatPad or RepeatReflect. This is currently forcing cairo to use slow client-side rendering, thus preventing firefox from enabling bilinear filtering on linux.

Revision history for this message
In , Tom Jaeger (thjaeger) wrote :

Created an attachment (id=22191)
patch

Changed in xf86-video-ati:
status: Unknown → Confirmed
Changed in openchrome:
status: Unknown → New
Revision history for this message
In , Michel Dänzer (michel-daenzer) wrote :

Pushed, thanks.

Note that I think it should be easy to accelerate RepeatPad and RepeatReflect, as in contrast to RepeatNormal they have similar semantics to 3D APIs.

Revision history for this message
In , Michel Dänzer (michel-daenzer) wrote :

(In reply to comment #2)
> Note that I think it should be easy to accelerate RepeatPad and RepeatReflect,
> as in contrast to RepeatNormal they have similar semantics to 3D APIs.

Err, s/RepeatNormal/RepeatNone/ .

Revision history for this message
In , Tom Jaeger (thjaeger) wrote :
Revision history for this message
In , Clemens Eisserer (linuxhippy) wrote :

At least accalerated RepeatPad would be great, basically I think its even more important RepeatNone (if that wouldn't be default).

Mozilla is evaluating using RepeatPad for their images, and my Java2D XRender backend uses it a lot too.

Revision history for this message
In , Clemens Eisserer (linuxhippy) wrote :

At least accalerated RepeatPad would be great, basically I think its even more
important RepeatNone (if that wouldn't be default).

Mozilla is evaluating using RepeatPad for their images, and my Java2D XRender
backend uses it a lot too heavily.

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: Images in Firefox and Opera are extremely pixeled when zoomed
Changed in xf86-video-radeonhd:
status: Unknown → Confirmed
Changed in xf86-video-ati:
status: Confirmed → Fix Released
Revision history for this message
In , Michel Dänzer (michel-daenzer) wrote :

Created an attachment (id=22250)
Start of acceleration for RepeatPad and RepeatReflect

Here's a possible start for acceleration of RepeatPad and RepeatReflect. R100/R200 parts only compile tested, R300 parts only lightly tested - are there any simple tests for RepeatPad/Reflect?

Revision history for this message
In , Tom Jaeger (thjaeger) wrote :
Revision history for this message
In , Michel Dänzer (michel-daenzer) wrote :

(In reply to comment #6)
> http://lists.freedesktop.org/archives/xorg/2008-February/032973.html

Thanks for reminding me of this. It passes on my RV350. :)

Bryce Harrington (bryce)
description: updated
Revision history for this message
Bryce Harrington (bryce) wrote : Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

Hi Tom,

Thanks for all your work on this bug!

I've attempted to update the description from reviewing all the discussion so far. I'd appreciate it if you could review it and correct any mistakes I've added, and elaborate any relevant details.

Also, we've dropped the jaunty targets, but not because we don't want to see this in jaunty... just because there are a lot of package tasks for this bug and adding targeting on top of that generates a lot of clutter.

Changed in xserver-xorg-video-radeonhd:
status: New → Confirmed
Changed in xserver-xorg-video-ati:
importance: Undecided → Medium
status: Confirmed → In Progress
Revision history for this message
Bryce Harrington (bryce) wrote :

Also, I notice there are not tasks against -intel or -nv; is this because the issue is known not to occur with those?

Changed in xserver-xorg-video-radeonhd:
importance: Undecided → Medium
status: Confirmed → Triaged
Changed in cairo:
importance: Undecided → High
status: New → Triaged
Revision history for this message
Sancho Panza (prashanthr-deactivatedaccount-deactivatedaccount) wrote :

I just wanted to point out that the same (page-zoom) issue that exists in Opera is
still the same even though it has been fixed in Firefox. I was initially under the
impression that the page-zoom-image-distortion issue in both browsers was related,
simply bcos the poorly zoomed images in both browsers displayed similar symptoms/artifacts.

So I guess the two issues are unrelated, and maybe we should separate them as two
different bugs instead of one.

Tom Jaeger (thjaeger)
description: updated
Revision history for this message
Tom Jaeger (thjaeger) wrote :

Thanks Bryce, I've made a minor clarification to the description.

-intel has always been fine (it used to fall back to software, but it has hardware acceleration since commit 128223ee9b7880e640056475462eca9a88415492)
-nv doesn't accelerate the composite operation at all, so it's fine

I only checked the drivers that are dependencies of xserver-xorg-video-all (that's why I initially missed radeonhd). I'll have a look at the universe drivers now, too. nouveau is the second driver I found to implement the various extends mode correctly, by the way..

Revision history for this message
Tom Jaeger (thjaeger) wrote :

Okay, none of the other drivers (except nouveau, which is doing the correct thing, it looks like) accelerate Compose/repeat at all, so the list of affected drivers should be complete.

Sancho: Opera probably falls back to nearest-neighbor filtering for similar reasons, but this would need to addressed in opera itself.

Revision history for this message
In , agd5f (agd5f) wrote :

both r100 and r200 fail on the repeat reflect test. OTOH, the reflect test fails even without the patch.

Revision history for this message
In , Michel Dänzer (michel-daenzer) wrote :

(In reply to comment #8)
> both r100 and r200 fail on the repeat reflect test.

Do you see the problem in the repeat-test-reflect-out.png file generated by the test? Have you tried other *_CLAMP_S/T_MIRROR_* flags?

> OTOH, the reflect test fails even without the patch.

Hmm, so maybe something else is (also) broken on your system?

Revision history for this message
In , Michel Dänzer (michel-daenzer) wrote :

Actually, the 2x2 source used by the test is probably a fallback because it doesn't match the hardware's implicit POT texture pitch. So the problem you're seeing is probably a pixman bug, but I haven't really verified my change either. :}

Revision history for this message
In , Michel Dänzer (michel-daenzer) wrote :

Created an attachment (id=22354)
Modified test using an 8x8 source, which should hit hardware acceleration

This still passes on my RV350. :)

Revision history for this message
In , Tom Jaeger (thjaeger) wrote :

Sorry, I probably should have mentioned this earlier. This is a known bug in pixman:

http://bugs.freedesktop.org/show_bug.cgi?id=19704

Revision history for this message
In , agd5f (agd5f) wrote :

8 isn't big enough since the EXA pitch alignment is 64 bytes.

Revision history for this message
In , Clemens Eisserer (linuxhippy) wrote :

Some documentation about hardware restrictions would be quite cool - I am currently working on a Java2D XRender backend - and optimal performance across different driver/gpu combinations causes a lot of guessing.

Revision history for this message
In , Michel Dänzer (michel-daenzer) wrote :

Created an attachment (id=22375)
Test using a 16x16 source, really hits hardware acceleration for me

Revision history for this message
In , Michel Dänzer (michel-daenzer) wrote :

(In reply to comment #13)
> 8 isn't big enough since the EXA pitch alignment is 64 bytes.

Argh. Try the 16x16 test. I also forgot this doesn't matter for >= R300, so I was hitting acceleration even with 2x2.

(In reply to comment #14)
> Some documentation about hardware restrictions would be quite cool - I am
> currently working on a Java2D XRender backend - and optimal performance across
> different driver/gpu combinations causes a lot of guessing.

In general, older hardware tends to only support repeat with power-of-two dimensions. And pre-R300 Radeons have this peculiarity where you can't choose an explicit pitch for power-of-two textures, the hardware just rounds up the width to the next multiple of 32 bytes. For other reasons, we can currently only use multiples of 64 bytes for the pitch, so if those pitches don't match (and the height is > 1) we can't do repeat. See RADEONPitchMatches() and its callers.

(In reply to comment #12)
> Sorry, I probably should have mentioned this earlier. This is a known bug in
> pixman:
>
> http://bugs.freedesktop.org/show_bug.cgi?id=19704

So it looks like this patch already gets us ahead of software fallbacks, at least on >= R300. :)

Revision history for this message
In , agd5f (agd5f) wrote :

Both r1xx and r2xx pass the test.

Revision history for this message
In , Michel Dänzer (michel-daenzer) wrote :

(In reply to comment #17)
> Both r1xx and r2xx pass the test.

Yay! I pushed the patch, someone may want to look into extending the source tile code to handle RepeatReflect as well.

Revision history for this message
In , Tom Jaeger (thjaeger) wrote :

Created an attachment (id=22390)
patch

XRender supports four possible repeat types: RepeatNone, RepeatNormal, RepeatPad and RepeatReflect?. The driver currently only handles the first two, so it should fall back to software when it encounters RepeatPad or RepeatReflect. This is currently forcing cairo to use slow client-side rendering, thus preventing firefox from enabling bilinear filtering on linux. Test cases can be found in the corresponding ati driver bug report:

http://bugs.freedesktop.org/show_bug.cgi?id=19712

Note that pixman currently implements RepeatReflect incorrectly, so the last test case will fail.

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

Fix for openchrome is upstream as of revision r726. Attaching a debdiff.

Revision history for this message
Tom Jaeger (thjaeger) wrote :

Also, there is hardware acceleration for Pad/Reflect in the ati driver now:

http://cgit.freedesktop.org/xorg/driver/xf86-video-ati/commit/?id=fa8e5a4fc236f8f15f462cb0d6164b194a65a118

Tom Jaeger (thjaeger)
description: updated
Changed in xf86-video-mga:
status: Unknown → Confirmed
Revision history for this message
Tom Jaeger (thjaeger) wrote :

Reported the i128 issue on the xorg mailing list:

http://lists.freedesktop.org/archives/xorg/2009-January/043109.html

Bryce Harrington (bryce)
Changed in xserver-xorg-video-openchrome:
importance: Undecided → Medium
status: Confirmed → Triaged
Changed in xserver-xorg-video-i128:
importance: Undecided → Medium
status: Confirmed → Triaged
Changed in xserver-xorg-video-mga:
importance: Undecided → Medium
status: Confirmed → Triaged
Changed in openchrome:
status: New → Fix Released
Revision history for this message
In , Ozhdan (ozhdan) wrote :

http://forums.opensuse.org/applications/404572-display-problems-firefox-while-using-zoom.html

Could someone help me to resolve display issue that I see in openSUSE 11.1

I used Firefox 3.0.4 but I see the same issue in Opera. What I see is everything looks normal in Firefox when you get to any web page. Example below is a Russian site, but you see the same issue on any page. When you try to zoom in on the page everything readjust the size (pictures, fonts),but picture degrades in quality so it is unpleasant to see. Here is an example of a normal page without zoom. It looks normal:

http://i128.photobucket.com/albums/p191/belarus2007/picture2_regular.png

Most of the time you can adjust View in FireFox by Zooming in/out (Ctrl ++/ Ctrl -- )

See the same page after 2nd zoom:

http://i128.photobucket.com/albums/p191/belarus2007/picture2_2times.png

Picture quality is degrades.

See the same page after 4th zoom:

http://i128.photobucket.com/albums/p191/belarus2007/picture2_4times.png

Picture quality is degrades.

See the same pate after 6th zoom:

http://i128.photobucket.com/albums/p191/belarus2007/picture2_6times.png

As you can see there is no issue with fonts. When you zoom in fonts adjust and look normal, but picture quality degrades with each zoom.

It is a dual-boot PC with Vista and openSUSE 11/1. I have Nvidia Video Card GeForce 7900GS with Nvidia Linux driver.

The interesting part that I don't see a problem on Vista (the same hardware, the same PC). Firefox zooms in font and pictures and scales just fine. (no picture quality degradation)

I'd like to find a solution for this zoom/scale issue. I'd like to use openSUSE,but this thing just drives me nuts and I keep switching back to Vista that I dislike, but has good FireFox zoom in feature.

P.S.

I'm duplicating this on SLES-11-RC1

Revision history for this message
In , Hfiguiere (hfiguiere) wrote :

Does this happen with an Intel video on SUSE? Because if it also happen with Opera, then it is unlikely a Firefox problem.

Revision history for this message
In , Ozhdan (ozhdan) wrote :

Correct, I see similar image quality degradation with Opera 9.63 on the same box when I zoom in.

I run openSUSE 11.1 on Latitude D630/ Nvidia Quadro NVS 135M ( Nvidia driver). I don't know how to test "Intel video on SUSE".

If it is not Firefox or/and Opera issue it is still an issue for users.

Questions:

1. Are you duplicating this on your hardware?
2. Which group needs to be involved to resolve this issue?

Revision history for this message
In , Hfiguiere (hfiguiere) wrote :

(In reply to comment #2)
>
> I don't know how to test "Intel video on SUSE".

You need a machine with Intel video (which is what I chose), like Thinkpad X60/61.

> If it is not Firefox or/and Opera issue it is still an issue for users.
>
> Questions:
>
> 1. Are you duplicating this on your hardware?

I have an Intel card and I didn't give the address of the website to test.

> 2. Which group needs to be involved to resolve this issue?

If it works fine on a non-nvidia card, I'll bounce back to the Xorg team, but then they'll say they can't do anything because the Nvidia driver is closed (ie not properly supported on Linux).

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

Bryce, how do you feel about patching the drivers ourselves where upstream hasn't responded?

By the way, you might have noticed that the little test program failed for RepeatPad for almost everyone. This was a bug in pixman that is now fixed upstream:

http://cgit.freedesktop.org/pixman/commit/?id=2d9c7cd84b276ebe2ff72d03c34a2d7f4f98b9f9

Revision history for this message
In , Zweinberg (zweinberg) wrote :

I think there is a way to get consistent cross-platform rendering without sacrificing too much performance. The common case is that images are not scaled, and post-bug 296818, we don't even keep them around in memory in uncompressed form. So that says to me that we could treat images in display memory as a pure cache, and in particular, we could do all the scaling on the client side before copying to display memory. That would mean that it's our copy of pixman doing all the work, so we know it's correct, but there wouldn't be any need to pull the image data off the X server, rescale it, and put it back, like what happens now if you enable EXTEND_PAD on Linux.

We *would* create offscreen bitmap surfaces for the scaled images so that as long as the nsThebesImage object sticks around, repaint doesn't have to repeat the scaling work. I think this might even make scrolling of a scaled document faster, because right now we're scaling everything on every draw operation.

I'm reluctant to implement this before joedrew!'s rumored image layer cleanups land, because right now it's such a horrible mess in there, but I'm willing to make an attempt at it if those are not happening anytime soon.

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

We used to do things that way. We stopped. Better people than I can explain why.

Revision history for this message
In , Vladimir Vukicevic (vvuk) wrote :

I think that's what we want to get to, once we get to being able to do decode-on-draw. It's not a great solution right now though, because we don't want to cache all scaled images since they can become quite large; you can toss in a limit, and then you're back to having to scale on demand, which means having to keep the original bits around. It also means that if hardware does accelerate the scaling, that we'd lose any access to that; for example, if the native image representation is a GL texture.

But, I think that we should be able to at least partially do it the way you describe... I think the missing piece is decode-on-draw, so that we can better manage memory usage.

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

I don't understand ... how is decode-on-draw going to work with scaled images? How can you pre-scale the compressed data?

Revision history for this message
In , Vladimir Vukicevic (vvuk) wrote :

Just so that we have a way to request the image to get redecoded from within the code that does the final rendering, to avoid having to keep different decoded regions in memory at all times.

Revision history for this message
Սահակ (petrosyan) wrote : Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

I am running Ubuntu 9.04 and Firefox is still not scaling the images properly.
Tom, are you going to merge these patches into Ubuntu 9.04?

Revision history for this message
Tom Jaeger (thjaeger) wrote :

I can't because I'm not an ubuntu developer. All I can do is post .debdiffs and hope that someone will pick them up. I maintain a separate PPA which contains all the fixes, though. Enabling smooth scaling in firefox should be as simple as adding the two lines to your /etc/sources.list and running 'apt-get update && apt-get upgrade':

https://launchpad.net/~firefox-smooth-scaling/+archive/ppa

Revision history for this message
Bryce Harrington (bryce) wrote :

Tom, I'm cool with patching the drivers ourselves in Ubuntu. Sorry if I'm laggy on following up, got lots of irons in the fire. But I can promise to shepherd your debdiffs through as you post them.

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

Bryce Harrington wrote:
> Tom, I'm cool with patching the drivers ourselves in Ubuntu. Sorry if
> I'm laggy on following up, got lots of irons in the fire. But I can
> promise to shepherd your debdiffs through as you post them.

Cool, thanks. I'll prepare the .dibdiffs later tonight. The -ati fixes
are included in 6.10.99.0, so the -ati target can be closed.

Revision history for this message
Bryce Harrington (bryce) wrote : Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

Sounds good, I just uploaded 6.10.99.0 today so guess the -ati target one can be marked fixed now.

Changed in xserver-xorg-video-ati:
status: In Progress → Fix Released
Revision history for this message
Sancho Panza (prashanthr-deactivatedaccount-deactivatedaccount) wrote :

Hey Tom, this bug that I had fixed using the patches in your PPA has
resurfaced again after the ubuntu firefox update that happened today.
It looks like the xulrunner package has been updated and I'm not able
to force it to your version without breaking dependencies. The cairo
and pixman files are still your versions.
Any suggestions?

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

Phew, here they are. The one for -openchrome was already posted
earlier, the one for -ati is obsolete now. For cairo, I just enabled
EXTEND_PAD (this is different from the PPA where I enabled both
EXTEND_PAD and EXTEND_REFLECT and also patched pixman).

Bryce Harrington wrote:
> Tom, I'm cool with patching the drivers ourselves in Ubuntu. Sorry if
> I'm laggy on following up, got lots of irons in the fire. But I can
> promise to shepherd your debdiffs through as you post them.
>

Revision history for this message
Oibaf (oibaf) wrote : Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

i128 patch notified on fdo bugzilla:
https://bugs.freedesktop.org/show_bug.cgi?id=20076

Revision history for this message
Erik Postma (e-j-postma+launchpad) wrote :

Just to add another data point; this is with the *closed* ati driver, fglrx:

$ lspci | grep Display
04:00.1 Display controller: ATI Technologies Inc RV370 [Radeon X300SE]
$ ../repeat-test_i686
Testing repeat mode none: PASS
Testing repeat mode normal: PASS
Testing repeat mode pad: PASS
Testing repeat mode reflect: *** FAIL ***
 60 pixels differ from expected result.
 Expected output written to repeat-test-reflect-expected.png
 Actual output written to repeat-test-reflect-out.png

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xserver-xorg-video-openchrome - 1:0.2.903+svn713-1ubuntu1

---------------
xserver-xorg-video-openchrome (1:0.2.903+svn713-1ubuntu1) jaunty; urgency=low

  * Add 02_fix_repeat_pad.patch. Fall back to software for unsupported
    repeat modes (LP: #217908)

 -- Thomas Jaeger <email address hidden> Fri, 30 Jan 2009 11:49:56 -0500

Changed in xserver-xorg-video-openchrome:
status: Triaged → Fix Released
Revision history for this message
Bryce Harrington (bryce) wrote :

Got this error trying to do the cairo patch:

$ patch -p1 < ../cairo.debdiff
patching file debian/changelog
patching file debian/patches/06_Xlib-Xcb-Hand-off-EXTEND_PAD-to-XRender.dpatch
patch unexpectedly ends in middle of line
patch: **** malformed patch at line 55:

will give the others a shot tomorrow.

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

Weird. It looks like launchpad swallowed the newline at the end of the
file.

Bryce Harrington wrote:
> Got this error trying to do the cairo patch:
>
> $ patch -p1 < ../cairo.debdiff
> patching file debian/changelog
> patching file debian/patches/06_Xlib-Xcb-Hand-off-EXTEND_PAD-to-XRender.dpatch
> patch unexpectedly ends in middle of line
> patch: **** malformed patch at line 55:
>
>
> will give the others a shot tomorrow.
>

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

Attaching a .tar.gz via the web interface. Hopefully that will work better.

Revision history for this message
Bryce Harrington (bryce) wrote :

Aha, that did it. Several of the patches had this problem, odd.

Also in the future make sure to include mention of the patch that was added or modified in your changelog. I took care of that here. It makes it easier if/when people need to scan for when a patch was introduced.

Thanks, cario, -mga, -i128, and -radeonhd are all uploaded now.

The xulrunner packages I'll leave for asac to review and upload.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xserver-xorg-video-i128 - 1:1.3.1-1ubuntu1

---------------
xserver-xorg-video-i128 (1:1.3.1-1ubuntu1) jaunty; urgency=low

  * 02_CheckComposite-Add-a-few-checks.patch: Return FALSE in
    CheckComposite for operations the driver doesn't support (LP: #217908)

 -- Thomas Jaeger <email address hidden> Thu, 12 Feb 2009 03:17:05 -0500

Changed in xserver-xorg-video-i128:
status: Triaged → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xserver-xorg-video-mga - 1:1.4.9.dfsg-2ubuntu1

---------------
xserver-xorg-video-mga (1:1.4.9.dfsg-2ubuntu1) jaunty; urgency=low

  * 04_Fall-back-to-software-for-unsupported-repeat-modes.patch: Fall back
    to software for unsupported repeat modes (LP: #217908)

 -- Thomas Jaeger <email address hidden> Thu, 12 Feb 2009 02:58:16 -0500

Changed in xserver-xorg-video-mga:
status: Triaged → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cairo - 1.8.6-1ubuntu2

---------------
cairo (1.8.6-1ubuntu2) jaunty; urgency=low

  * 06_Xlib-Xcb-Hand-off-EXTEND_PAD-to-XRender.dpatch: Hand off EXTEND_PAD
    to XRender (LP: #217908)

 -- Thomas Jaeger <email address hidden> Thu, 12 Feb 2009 02:38:27 -0500

Changed in cairo:
status: Triaged → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xserver-xorg-video-radeonhd - 1.2.4-1ubuntu1

---------------
xserver-xorg-video-radeonhd (1.2.4-1ubuntu1) jaunty; urgency=low

  * 02_Fall-back-to-software-for-unsupported-repeat-modes.patch: Fall back
    to software for unsupported repeat modes (LP: #217908) Patch is taken
    from the upstream -ati driver

 -- Thomas Jaeger <email address hidden> Thu, 12 Feb 2009 02:51:52 -0500

Changed in xserver-xorg-video-radeonhd:
status: Triaged → Fix Released
Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

Sweet, thanks.

Bryce Harrington wrote:
> Aha, that did it. Several of the patches had this problem, odd.
>
> Also in the future make sure to include mention of the patch that was
> added or modified in your changelog. I took care of that here. It
> makes it easier if/when people need to scan for when a patch was
> introduced.

Will do, that makes sense. I've actually had the problem before where I
couldn't figure out why a particular patch was there, I didn't think of
grepping the changelog...

>
> Thanks, cario, -mga, -i128, and -radeonhd are all uploaded now.
>
> The xulrunner packages I'll leave for asac to review and upload.

Revision history for this message
Sebastien Bacher (seb128) wrote : Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

has this cairo change be sent upstream, could you give the freedesktop bugzilla url?

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

Upstream is aware of the issue, they can't do anything about it at the
moment, though, because they can't be sure that the drivers are fixed
at this point.

On Sat, Feb 14, 2009 at 5:38 AM, Sebastien Bacher <email address hidden> wrote:
> has this cairo change be sent upstream, could you give the freedesktop
> bugzilla url?

Revision history for this message
John Vivirito (gnomefreak) wrote : Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

Is this still concidered a firefox/xulrunner issue? I see everything but firefox has been fixed

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

Yes. Firefox has been using nearest-neighbor filtering to avoid hitting
the slow path in cairo. Now that cairo has been fixed, we can enable
EXTEND_PAD in firefox, which is needed to get correct results with
bilinear filtering. Debdiffs (for both versions of xulrunner that are
in jaunty) are attached to comment #75.

John Vivirito wrote:
> Is this still concidered a firefox/xulrunner issue? I see everything but
> firefox has been fixed
>

Revision history for this message
Sebastien Bacher (seb128) wrote : Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

could you give the url to an upstream cairo discussion? there is no reason why we should ship distribution changes there which have not been discussed upstream, that creates extra work, bugs and political issues

Revision history for this message
Sebastien Bacher (seb128) wrote :

the previous comment suggests that driver need to be fixed, what about closed source ones?

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

Sebastien Bacher wrote:
> could you give the url to an upstream cairo discussion? there is no
> reason why we should ship distribution changes there which have not been
> discussed upstream, that creates extra work, bugs and political issues
>

This has been discussed several times, the last time here:

http://lists.cairographics.org/archives/cairo/2009-January/016320.html

Carl has stated that he intends to use XRender for
EXTEND_PAD/EXTEND_REFLECT eventually, see here:

http://cgit.freedesktop.org/xorg/driver/xf86-video-intel/commit/?id=128223ee9b7880e640056475462eca9a88415492

The amount of work this should cause is minimal, as it's normal
procedure to maintain a few patches. In the unlikely event that this
might cause a bugs, it's easy to have the offending driver fall back to
software. There is certainly no potential for this to cause political
issues.

Revision history for this message
Tom Jaeger (thjaeger) wrote :

Testing suggests (comments #45, #50, #71) that the closed source drivers
fall back to software anyway, so this shouldn't be an issue. The
artifacts that this may cause are very minor in any case.

Sebastien Bacher wrote:
> the previous comment suggests that driver need to be fixed, what about
> closed source ones?
>

Revision history for this message
Sebastien Bacher (seb128) wrote : Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

the issue has been discussed on IRC and using the changes should be alright, thanks for the detailled explanations

Tom Jaeger (thjaeger)
Changed in cairo:
status: Fix Released → New
Revision history for this message
Tom Jaeger (thjaeger) wrote :

Sorry, I screwed up the cairo patch. dpatch-edit-patch really didn't work the way I expected. Not only did it not automatically add the patch to 00list, but it also somehow created a patch where all the changes appeare twice. Go figure.

Revision history for this message
Tom Jaeger (thjaeger) wrote :

Sorry, the debdiff above is wrong again. This is the patch that I used for the PPA, which also enables EXTEND_REFLECT.

Revision history for this message
Tom Jaeger (thjaeger) wrote :

Again, sorry for the confusion. Here is the correct .debdiff. It's a shame that in this day of distributed VCSs, we still have to deal with things like dpatch, which apparently can't even keep track of commit messages.

Revision history for this message
Tom Jaeger (thjaeger) wrote :

Status of EXTEND_PAD hardware acceleration:

Fully hardware accelerated: -intel, -ati, -nouveau
Incorrect rendering upstream, fixed in ubuntu: -radeonhd (only POT), -mga (only POT), -i128
Unknown status, but known to fall back to software for 2x2 source and 8x8 dest: nvidia and ati binary drivers
All the remaining drivers use software fallbacks.

Revision history for this message
Tom Jaeger (thjaeger) wrote :

I've sent a reminder about the remaining three drivers to the xorg-devel mailing list.

http://lists.freedesktop.org/archives/xorg-devel/2009-February/000214.html

Revision history for this message
In , Francis Giraldeau (francis-giraldeau) wrote :

bugs/214077-1b.html and bugs/214077-1a.html failed on a pristine 3.1b2 on ubuntu intrepid, so it's not related to this.

I do have some problems, since nsThebesImage.cpp changed a lot and the patch doesn't apply anymore. But I confirm the problem is still there.

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

Updated cairo .debdiff that checks for Render 0.10. It won't make any difference in practice, but I suppose it is more correct this way.

Revision history for this message
Chris Wilson (ickle) wrote :

I'm sorry I haven't take the time to fully review the cairo patch, but I just want you to be aware of the work Eric Anholt did a couple of years ago to support the extend repeat modes and server-side gradients (but we failed to merge in a timely manner): http://cgit.freedesktop.org/~anholt/cairo/log/?h=server-gradients

If you care to implement something along those lines, then I will be happy to merge it into upstream post-1.10 (which should give us a while to check the behaviour on non-Ubuntu systems). And also provide the circumstances where implementing h/w accelerated gradients becomes worthwhile. I suspect that even with s/w fallbacks switching to XRender gradients should be a performance win due to reduced transport costs and potentially improved pixmap allocation.

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

Chris Wilson wrote:
> I'm sorry I haven't take the time to fully review the cairo patch, but I
> just want you to be aware of the work Eric Anholt did a couple of years
> ago to support the extend repeat modes and server-side gradients (but we
> failed to merge in a timely manner):
> http://cgit.freedesktop.org/~anholt/cairo/log/?h=server-gradients

Thanks, I wasn't aware of this. The patch we're dealing with here is
basically a (small) subset of David Reveman's patch. I'll see if I can
find the time to update the gradient part of the patch next weekend and
port it to xcb.

> If you care to implement something along those lines, then I will be
> happy to merge it into upstream post-1.10 (which should give us a while
> to check the behaviour on non-Ubuntu systems). And also provide the
> circumstances where implementing h/w accelerated gradients becomes
> worthwhile. I suspect that even with s/w fallbacks switching to XRender
> gradients should be a performance win due to reduced transport costs and
> potentially improved pixmap allocation.

I would think so, too. The nice thing here is that we are guaranteed
that gradients are handled in the server by software, so we don't have
to worry about drivers implementing them incorrectly. And if we ever
decide to enable hardware acceleration for gradients, as Michel Dänzer
suggested in [1], driver maintainers will be instantly aware of the
issue, because most (all?) drivers will currently crash if the source's
pDrawable is NULL.

[1]
http://lists.freedesktop.org/archives/xorg-devel/2009-February/000238.html

Revision history for this message
In , Telcontale (telcontale) wrote :

I see the same issue on a Thinkpad T60 with ATI x1400 and OpenSuSE 11.1 with Firefox. Could someone please look into this?

The image quality degradation is present while browsing any website with any zoom level other than the original (eg. NY Times).

Revision history for this message
m2 (dudam99) wrote : Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

The firefox zoom bug still exists in Jaunty Alpha 5 with the proprietry NVIDIA driver (180.35) and is driving me nuts.

Below is the output repeat-test_i686. I am not sure where to post this so have just put it here and hope it gets forwarded to the correct person.

mk@desktop:~$ lspci
00:00.0 Host bridge: Intel Corporation 82945G/GZ/P/PL Memory Controller Hub (rev 81)
00:01.0 PCI bridge: Intel Corporation 82945G/GZ/P/PL PCI Express Root Port (rev 81)
00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 01)
00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 01)
00:1c.3 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 4 (rev 01)
00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 (rev 01)
00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 (rev 01)
00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 (rev 01)
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 (rev 01)
00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 01)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1)
00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)
00:1f.2 IDE interface: Intel Corporation 82801GB/GR/GH (ICH7 Family) SATA IDE Controller (rev 01)
00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 01)
01:00.0 VGA compatible controller: nVidia Corporation GeForce 8600 GT (rev a1)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)
mk@desktop:~$
mk@desktop:~$ chmod +x repeat-test_i686 && ./repeat-test_i686
Testing repeat mode none: PASS
Testing repeat mode normal: PASS
Testing repeat mode pad: PASS
Testing repeat mode reflect: *** FAIL ***
60 pixels differ from expected result.
Expected output written to repeat-test-reflect-expected.png
Actual output written to repeat-test-reflect-out.png

mk@desktop:~$
mk@desktop:~$

Changed in xf86-video-mga:
status: Confirmed → Fix Released
Revision history for this message
Oibaf (oibaf) wrote :

Any news of integrating the cairo and firefox patches in the packages, now that the x drivers are fixed?

Revision history for this message
Tom Jaeger (thjaeger) wrote :

I met a lot of resistance when discussing this with people over IRC, so I've decided it's easier for me to just maintain the fixes in a PPA than to push for these changes and probably be disappointed.

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

I met a lot of resistance when discussion this with people over IRC, so
I've decided it's easier for me to maintain the fixes in a PPA than to
push for the changes and probably be disappointed.

Fabio Pedretti wrote:
> Any news of integrating the cairo and firefox patches in the packages,
> now that the x drivers are fixed?
>

Revision history for this message
Oibaf (oibaf) wrote : Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

Tom, a bit unrelated here but when you plan to update the xulrunner package could you also include the patch at:
https://bugzilla.mozilla.org/show_bug.cgi?id=406646#c181
that should fix bug #187313?

Thanks!

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

I'll keep it in mind for the next time I update the packages. Hopefully
won't be necessary, though.

Fabio Pedretti wrote:
> Tom, a bit unrelated here but when you plan to update the xulrunner package could you also include the patch at:
> https://bugzilla.mozilla.org/show_bug.cgi?id=406646#c181
> that should fix bug #187313?
>
> Thanks!
>
> ** Bug watch added: Mozilla Bugzilla #406646
> https://bugzilla.mozilla.org/show_bug.cgi?id=406646
>

Revision history for this message
m2 (dudam99) wrote : Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

https://launchpad.net/~firefox-smooth-scaling/+archive/ppa

The ppa which fixed this previously seems to be broken now.

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

m2 wrote:
> https://launchpad.net/~firefox-smooth-scaling/+archive/ppa
>
> The ppa which fixed this previously seems to be broken now.
>

Define 'broken'.

Alexander Sack (asac)
Changed in xulrunner-1.9.1 (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Changed in xulrunner-1.9 (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
In , JSmith (justinsmith2009) wrote :

are any of these preferences “browser.gdk_interpolation_threshold_percent” or browser.image_prescaling_threshold implemented in a build with firefox? I tried using this in FF3 and FF3.1Beta4 but doesn't seem to impact the image quality

Revision history for this message
In , Jo-hermans (jo-hermans) wrote :

no, attachment 351844 isn't checked in (it's not even ready to be checked in, see comment 34)

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

I've posted relevant patches on the cairo mailing list:

http://lists.cairographics.org/archives/cairo/2009-May/017131.html

Revision history for this message
In , Tom Jaeger (thjaeger) wrote :

Vladimir: The drivers are now fixed, and cairo will use XRender for EXTEND_PAD as of commit a1d0a06b[1], provided that a 1.7 X server is running, so it looks like this can be finally fixed in firefox.

[1] http://cgit.freedesktop.org/cairo/commit/?id=a1d0a06b6275cac3974be84919993e187394fe43

Revision history for this message
In , longsonr (longsonr) wrote :

*** Bug 500191 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Mozilla-bugs-dotancohen (mozilla-bugs-dotancohen) wrote :

Created an attachment (id=384896)
Screenshots of Firefox zoom and Compiz zoom

Here is a screenshot of the wikipedia logo with 200% zoom in Firefox, and to compare the same logo with the same zoom as performed by Compiz.

Revision history for this message
In , Tom Jaeger (thjaeger) wrote :

Created an attachment (id=384996)
fix

Vladimir: Attaching a patch that should finally fix this bug. The patch enables EXTEND_PAD if (1) the cairo version used is at least 1.9.2 and (2) the X server is at least a 1.7 pre-release (i.e. current git master). This ensures that cairo hands off the EXTEND_PAD operation to XRender.

Revision history for this message
Launchpad Janitor (janitor) wrote : Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

This bug was fixed in the package cairo - 1.8.8-2ubuntu1

---------------
cairo (1.8.8-2ubuntu1) karmic; urgency=low

  * Add Vcs-* fields.
  * Wrap build-deps and deps.
  * Merge Ubuntu changes with Debian tip:
    - Fix removed trailing spaces in old changelog entries.
    - Add description to dpatch 06_Xlib-Xcb-Hand-off-EXTEND_PAD-to-XRender.
    - Update descriptions of dpatches
      03_only_destroy_FT_Faces_created_by_cairo and 04_lcd_filter.
    - Drop dpatch 03_only_destroy_FT_Faces_created_by_cairo, merged upstream.
    - Remaining Ubuntu changes:
      * New dpatch, 04_lcd_filter, adds a Cairo LCD filter to use FreeType LCD
        colour filtering features; initial implementation from FreeDesktop
        #10301; build-deps and dep on libfontconfig1-dev >= 2.5.92 and
        libfreetype6-dev >= 2.3.5-1ubuntu4.
      * New disabled dpatch, 06_Xlib-Xcb-Hand-off-EXTEND_PAD-to-XRender, hand
        off EXTEND_PAD to XRender; LP #217908.
  * Fix double patching in dpatch 06_Xlib-Xcb-Hand-off-EXTEND_PAD-to-
    XRender.
  * Enable dpatch 06_Xlib-Xcb-Hand-off-EXTEND_PAD-to-XRender; LP: #217908.
  * Use mode 755 for dpatches.

 -- Loic Minier <email address hidden> Wed, 24 Jun 2009 21:21:03 +0200

Changed in cairo (Ubuntu):
status: New → Fix Released
Revision history for this message
Tom Jaeger (thjaeger) wrote :

The cairo issue is fixed upstream as of commit a1d0a06b6275cac3974be84919993e187394fe43, enabling EXTEND_PATCH via XRender conditionally on the X server version. Also, I've posted a patch for firefox on the mozilla bugtracker.

Revision history for this message
NoBugs! (luke32j) wrote :

Can this be fixed in Jaunty 9.04 by installing the newer cairo packages? Or does it also require a fix for Firefox?

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

NoBugs! wrote:
> Can this be fixed in Jaunty 9.04 by installing the newer cairo packages?
> Or does it also require a fix for Firefox?
>

No, you need both updated cairo and xulrunner packages. They are
available for jaunty in the firefox-smooth-scaling PPA:

https://launchpad.net/~firefox-smooth-scaling/+archive/ppa

Revision history for this message
In , Oibaf (oibaf) wrote :

This is fixed also in radeonhd now.

However, while radeon also accelerate the repeat modes radeonhd still fall back to software.

Changed in xf86-video-radeonhd:
status: Confirmed → Fix Released
Revision history for this message
In , Alexander Sack (asac) wrote :

(From update of attachment 384996)
> if (!isDownscale) {
>- pattern->SetFilter(0);
>+ PRBool fastExtendPad = false;
>+ if (currentTarget->GetType() == gfxASurface::SurfaceTypeXlib &&
>+ cairo_version() >= CAIRO_VERSION_ENCODE(1,9,2)) {

please fix indentation and request review.

Revision history for this message
In , Tom Jaeger (thjaeger) wrote :

Created an attachment (id=386032)
fixed indentation

Tom Jaeger (thjaeger)
description: updated
Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

*** Bug 477552 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Zweinberg (zweinberg) wrote :

*** Bug 499308 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Zweinberg (zweinberg) wrote :

*** Bug 467832 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

*** Bug 487996 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Zweinberg (zweinberg) wrote :

*** Bug 460989 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Zweinberg (zweinberg) wrote :

(From update of attachment 351956)
canceling r/sr on the patch -- something similar may eventually be the right thing but not now.

Tom Jaeger (thjaeger)
description: updated
Revision history for this message
VegCyclist (jrwoiderski) wrote : Re: [Bug 217908] Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers
Download full text (5.8 KiB)

Thanks for your help! This worked for me.

2009/7/11 Tom Jaeger <email address hidden>

> ** Description changed:
>
> [Problem]
> - Scaled images in Firefox, Opera, etc. look blurred or pixelated when
> zoomed.
> + Upscaled images in Firefox (and Opera) look pixelated when zoomed, edges
> appear jagged.
>
> [Discussion]
> This is because firefox is using nearest-neighbor interpolation for
> upscaling. It would look better if bilinear filtering were used by Cairo,
> which requires EXTEND_PAD. However, EXTEND_PAD is not implemented very well
> in several video drivers, and Cairo is unable to distinguish drivers that
> have good implementations from ones with bad ones, so it is currently using
> a client-side fall back which is deemed too slow by the firefox developers.
>
> Solving this requires updating each video driver to either implement
> EXTEND_PAD correctly or at least stop advertising it can do it when it
> really can't. Once this is done, cairo's client-side workaround can be
> removed and firefox can be updated to use EXTEND_PAD.
>
> The proposed fixes are available (for jaunty and karmic) in the
> firefox-smooth-scaling PPA:
> https://launchpad.net/~firefox-smooth-scaling/+archive/ppa<https://launchpad.net/%7Efirefox-smooth-scaling/+archive/ppa>
>
> [Original Report]
> With Ubuntu Hardy beta + latest updates (15th April 2008) I suffer from
> bad image rendering quality in Firefox.
> To see the type of problem just open the attached screenshot and scale to
> 100%.
>
> The images that are blurred are razor sharp if I do a right click ->
> view image so it is perhaps a problem related to
> image scaling.
>
> The problem appears only with my laptop - so perhaps it is not a bug in
> Firefox but elsewhere (X-windows??/intel-driver??).
> The laptop has a 3-year old Centrino-Platform uses 915 intel driver and
> has a lcd monitor with 1400x1050 resolution.
>
> The rendering problem appears independent of the Desktop-Effects are
> on/off. So it does not seem to be a problem with
> compiz.
>
> p.s. Also the text in the Gnome-terminal is somewhat blurred (compared
> with e.g. text in Gedit)
> p.s. The same homepage renders nicely on my desktop computer with a
> 1280x1045 and the ati-driver.
>
> Don't hesitate to ask for more information.
>
> --
> Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD
> implementation in several video drivers
> https://bugs.launchpad.net/bugs/217908
> You received this bug notification because you are a direct subscriber
> of a duplicate bug.
>
> Status in The Mozilla Firefox Browser: Confirmed
> Status in Libpixman: Fix Released
> Status in openchrome: Fix Released
> Status in Opera Browser: New
> Status in xf86-video-ati: Fix Released
> Status in xf86-video-mga: Fix Released
> Status in xf86-video-radeonhd: Fix Released
> Status in X.Org X server: Invalid
> Status in XUL + XPCOM application runner: In Progress
> Status in “cairo” package in Ubuntu: Fix Released
> Status in “firefox” package in Ubuntu: Invalid
> Status in “firefox-3.0” package in Ubuntu: Invalid
> Status in “pixman” package in Ubuntu: Fix Released
> Status in “xorg-server” package in Ubuntu: Invalid
> Status i...

Read more...

Revision history for this message
In , Jmuizelaar (jmuizelaar) wrote :

(From update of attachment 386032)
>@@ -685,11 +688,33 @@
>+ //
>+ // Update 6/24/09: The underlying X server/driver bugs are now
>+ // fixed, and cairo uses the fast XRender code-path as of 1.9.2
>+ // (commit commit a1d0a06b6275cac3974be84919993e187394fe43) --

The word commit is repeated.

>+ // but only if running on a 1.7 X server.
>+ // So we enable EXTEND_PAD provided that we're running a recent
>+ // enough cairo version (obviously, this is only relevant if
>+ // --enable-system-cairo is used) AND running on a recent
>+ // enough X server. This should finally bring linux up to par
>+ // with other systems.
> PRBool isDownscale =
> deviceToImage.xx >= 1.0 && deviceToImage.yy >= 1.0 &&
> deviceToImage.xy == 0.0 && deviceToImage.yx == 0.0;
> if (!isDownscale) {
>- pattern->SetFilter(0);
>+ PRBool fastExtendPad = false;
>+ if (currentTarget->GetType() == gfxASurface::SurfaceTypeXlib &&
>+ cairo_version() >= CAIRO_VERSION_ENCODE(1,9,2)) {
>+ gfxXlibSurface *xlibSurface = static_cast<gfxXlibSurface *>((gfxASurface *)currentTarget);

Why cast to (gfxASurface *) first?

>+ Display *dpy = xlibSurface->XDisplay();
>+ if (VendorRelease (dpy) < 60700000 && VendorRelease (dpy) >= 10699000)
>+ fastExtendPad = true;

I don't understand this VendorRelease check. I would expect something more like:
  VendorRelease(dpy) >= 10700000
Please add a comment explaining why you don't use the more intuitive check.

>+ }
>+ if (fastExtendPad) {
>+ pattern->SetExtend(gfxPattern::EXTEND_PAD);
>+ } else {
>+ pattern->SetFilter(0);
>+ }

Revision history for this message
In , Tom Jaeger (thjaeger) wrote :

Thanks for your comments.

<email address hidden> wrote:
>> @@ -685,11 +688,33 @@
>> + //
>> + // Update 6/24/09: The underlying X server/driver bugs are now
>> + // fixed, and cairo uses the fast XRender code-path as of 1.9.2
>> + // (commit commit a1d0a06b6275cac3974be84919993e187394fe43) --
>
> The word commit is repeated.
Sorry, fixed.

>> + // but only if running on a 1.7 X server.
>> + // So we enable EXTEND_PAD provided that we're running a recent
>> + // enough cairo version (obviously, this is only relevant if
>> + // --enable-system-cairo is used) AND running on a recent
>> + // enough X server. This should finally bring linux up to par
>> + // with other systems.
>> PRBool isDownscale =
>> deviceToImage.xx >= 1.0 && deviceToImage.yy >= 1.0 &&
>> deviceToImage.xy == 0.0 && deviceToImage.yx == 0.0;
>> if (!isDownscale) {
>> - pattern->SetFilter(0);
>> + PRBool fastExtendPad = false;
>> + if (currentTarget->GetType() == gfxASurface::SurfaceTypeXlib &&
>> + cairo_version() >= CAIRO_VERSION_ENCODE(1,9,2)) {
>> + gfxXlibSurface *xlibSurface = static_cast<gfxXlibSurface *>((gfxASurface *)currentTarget);
>
> Why cast to (gfxASurface *) first?
It's not really a cast. currentTarget is of type nsRefPtr<gfxASurface>, which is converted into a (gfxASurface *) in order to be able to use the static cast. There might be a better way, but I couldn't find any nsRefPtr cast operators in the mozilla source.

>
>> + Display *dpy = xlibSurface->XDisplay();
>> + if (VendorRelease (dpy) < 60700000 && VendorRelease (dpy) >= 10699000)
>> + fastExtendPad = true;
>
> I don't understand this VendorRelease check. I would expect something more
> like:
> VendorRelease(dpy) >= 10700000
> Please add a comment explaining why you don't use the more intuitive check.
We need to use the exact same check that cairo is using. The reason for the VendorRelease check is explained at length in src/cairo-xlib-display.c, basically there used to be a different numbering scheme in older X servers. We use 10699000 instead of 10700000 in order to be able to test the code with pre-release servers.

>> + }
>> + if (fastExtendPad) {
>> + pattern->SetExtend(gfxPattern::EXTEND_PAD);
>> + } else {
>> + pattern->SetFilter(0);
>> + }
>

Revision history for this message
In , Tom Jaeger (thjaeger) wrote :

Created an attachment (id=388683)
comment updates

Revision history for this message
In , Jmuizelaar (jmuizelaar) wrote :

(From update of attachment 388683)
>diff -r b91c9ee69e6e gfx/src/thebes/nsThebesImage.cpp
>--- a/gfx/src/thebes/nsThebesImage.cpp Wed Jul 15 01:39:35 2009 -0400
>+++ b/gfx/src/thebes/nsThebesImage.cpp Wed Jul 15 08:43:01 2009 -0400
>@@ -46,6 +46,9 @@
>
> #include "prenv.h"
>
>+#include "cairo.h"
>+#include "gfxXlibSurface.h"
>+
> static PRBool gDisableOptimize = PR_FALSE;
>
> #ifdef XP_WIN
>@@ -685,11 +688,34 @@
> // have adjusted the pattern's matrix ... but the adjustment
> // is only a translation so the scale factors in deviceToImage
> // are still valid.
>+ //
>+ // Update 6/24/09: The underlying X server/driver bugs are now
>+ // fixed, and cairo uses the fast XRender code-path as of 1.9.2
>+ // (commit a1d0a06b6275cac3974be84919993e187394fe43) --
>+ // but only if running on a 1.7 X server.
>+ // So we enable EXTEND_PAD provided that we're running a recent
>+ // enough cairo version (obviously, this is only relevant if
>+ // --enable-system-cairo is used) AND running on a recent
>+ // enough X server. This should finally bring linux up to par
>+ // with other systems.
> PRBool isDownscale =
> deviceToImage.xx >= 1.0 && deviceToImage.yy >= 1.0 &&
> deviceToImage.xy == 0.0 && deviceToImage.yx == 0.0;
> if (!isDownscale) {
>- pattern->SetFilter(0);
>+ PRBool fastExtendPad = false;
>+ if (currentTarget->GetType() == gfxASurface::SurfaceTypeXlib &&
>+ cairo_version() >= CAIRO_VERSION_ENCODE(1,9,2)) {
>+ gfxXlibSurface *xlibSurface = static_cast<gfxXlibSurface *>((gfxASurface *)currentTarget);

Using currentTarget.get() is better than (gfxASurface *)currentTarget.

>+ Display *dpy = xlibSurface->XDisplay();
>+ // This is the exact condition for cairo to use XRender for EXTEND_PAD
>+ if (VendorRelease (dpy) < 60700000 && VendorRelease (dpy) >= 10699000)

The whitespace for the comment "// This is .." uses tabs, the line below it does not.

>+ fastExtendPad = true;
>+ }
>+ if (fastExtendPad) {
>+ pattern->SetExtend(gfxPattern::EXTEND_PAD);
>+ } else {
>+ pattern->SetFilter(0);
>+ }
> }
> break;
> }

Revision history for this message
In , Tom Jaeger (thjaeger) wrote :

Created an attachment (id=388713)
cosmetic changes

Thanks. I've made the two requested changes.

Revision history for this message
In , Jmuizelaar (jmuizelaar) wrote :

(From update of attachment 388713)
Looks good

Revision history for this message
In , Mark-finkle (mark-finkle) wrote :

*** Bug 500805 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Hrvoje Nikšić (hniksic) wrote :

I've been running with this patch[1] for a few days now without problems. The images are smoothly scaled.

[1]
I modified the patch to insist on Cairo 1.9.2 since ubuntu 9.04 ships with the cairo fix backported. I also had to change the X server version check because my X server didn't pass, but I've seen no artifacts in the images, so I assume the properietary nvidia driver correctly implements the needed functionality.

Changed in xf86-video-radeonhd:
status: Fix Released → Fix Committed
Changed in xf86-video-radeonhd:
status: Fix Committed → Fix Released
Revision history for this message
In , Jo-hermans (jo-hermans) wrote :

*** Bug 509292 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Dao (dao) wrote :

Is this ready to land?

Revision history for this message
In , Dao (dao) wrote :

(From update of attachment 388713)
This is outdated. That code lives in modules/libpr0n/src/imgFrame.cpp now.

Revision history for this message
In , Tom Jaeger (thjaeger) wrote :

Created an attachment (id=393971)
updated patch

I ported the patch to what I believe is current trunk. Untested, but should be fine, since the code in question hasn't actually changed.

Revision history for this message
In , Dao (dao) wrote :

(From update of attachment 393971)
No, this doesn't work.

error: gfxXlibSurface.h: No such file or directory

Revision history for this message
In , Dao (dao) wrote :

(In reply to comment #36)
> (From update of attachment 393971 [details])
> No, this doesn't work.
>
> error: gfxXlibSurface.h: No such file or directory

This is on Mac and Windows.

Revision history for this message
In , Vladimir Vukicevic (vvuk) wrote :

Also imgFrame shouldn't be reaching into cairo symbols; if we need the cairo version, we should expose it through thebes somehow.

Revision history for this message
In , Dao (dao) wrote :

Isn't it unlikely that someone would run X Server 1.7 and an old cairo version? Can the cairo version check be left out?

Revision history for this message
In , Tom Jaeger (thjaeger) wrote :

(In reply to comment #38)
> Also imgFrame shouldn't be reaching into cairo symbols; if we need the cairo
> version, we should expose it through thebes somehow.

I'm not familiar enough with mozilla internals to produce a patch, but this shouldn't be too hard, should it? I'd also be fine with skipping the cairo check if that helps move things along.

Revision history for this message
In , Samuel Sidler (samuel-sidler) wrote :

This has a few dupes and we currently list it as our only known Linux-specific issue (in our release notes). Seems like we should push a bit harder to fix it if possible.

Revision history for this message
In , Zweinberg (zweinberg) wrote :

Similar effects can be seen on Mac for a closely-related reason (see bug 472037 and bug 486761). I've been meaning to ask bholley to look into the proposal outlined in comment 15 once he's done with basic decode-on-draw.

Revision history for this message
In , Beltzner (beltzner) wrote :

Definitely wanted, would take a safe patch, but can't block 3.6 on this.

Revision history for this message
NoBugs! (luke32j) wrote : Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

This patch worked very well:
https://launchpad.net/~firefox-smooth-scaling
However, after update to firefox 3.5.3 it seems this is no longer compatible.
Can this patch be included in the updated Ubuntu packages?

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

NoBugs! wrote:
> This patch worked very well:
> https://launchpad.net/~firefox-smooth-scaling
> However, after update to firefox 3.5.3 it seems this is no longer compatible.
> Can this patch be included in the updated Ubuntu packages?

Thanks for letting me know, I've updated the jaunty package in the PPA.
 It should build within the next couple hours.

Revision history for this message
kenjo (ken-kenjo) wrote : Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

I'm not sure if the problem I have is related but I have had problems with image sacling for a LOONG time now in several firefox versions. I use the binary nvidia driver.

What makes me a bit confused is that if I nuke .mozilla directory and restarts I have no problem for some time but it always comes back after a week or two and once it starts it never gets good again.

I have attached a small test case that shows what the problem looks like on my computer.

Oibaf (oibaf)
summary: - Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD
+ FFe: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD
implementation in several video drivers
Revision history for this message
kenjo (ken-kenjo) wrote : Re: [Bug 217908] Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

I have now added.

deb http://ppa.launchpad.net/firefox-smooth-scaling/ppa/ubuntu jaunty main

done and install and got

ii xulrunner 1.8.1.16+nobinonly-0ubuntu1 XUL + XPCOM application runner
ii xulrunner-1.9 1.9.0.14+build2+nobinonly-0ubuntu0.9.04.1 XUL + XPCOM application runner
ii xulrunner-1.9-gnome-support 1.9.0.14+build2+nobinonly-0ubuntu0.9.04.1 Support for Gnome in xulrunner-1.9 applicati
ii xulrunner-1.9.1 1.9.1.4~hg20091002r26447+nobinonly-0ubuntu2~umd1~jaunty XUL + XPCOM application runner
ii xulrunner-1.9.1-gnome-support 1.9.1.4~hg20091002r26447+nobinonly-0ubuntu2~umd1~jaunty Support for GNOME in xulrunner-1.9.1 applica
ii libcairo2 1.8.6-1ubuntu3+thjaeger1 The Cairo 2D vector graphics library
ii libcairo2-dev 1.8.6-1ubuntu3+thjaeger1 Development files for the Cairo 2D graphics

still resizing issues.

Revision history for this message
Tom Jaeger (thjaeger) wrote :

kenjo wrote:
> deb http://ppa.launchpad.net/firefox-smooth-scaling/ppa/ubuntu jaunty

> ii xulrunner-1.9.1 1.9.1.4~hg20091002r26447+nobinonly-0ubuntu2~umd1~jaunty XUL + XPCOM application runner
> ii xulrunner-1.9.1-gnome-support 1.9.1.4~hg20091002r26447+nobinonly-0ubuntu2~umd1~jaunty Support for GNOME in xulrunner-1.9.1 applica

These are not the xulrunner-1.9.1 packages from my PPA.

> still resizing issues.

Revision history for this message
kenjo (ken-kenjo) wrote :

On Mon, 2009-10-05 at 17:29 +0000, Tom Jaeger wrote:
> kenjo wrote:
> > deb http://ppa.launchpad.net/firefox-smooth-scaling/ppa/ubuntu jaunty
>
> > ii xulrunner-1.9.1 1.9.1.4~hg20091002r26447+nobinonly-0ubuntu2~umd1~jaunty XUL + XPCOM application runner
> > ii xulrunner-1.9.1-gnome-support 1.9.1.4~hg20091002r26447+nobinonly-0ubuntu2~umd1~jaunty Support for GNOME in xulrunner-1.9.1 applica
>
> These are not the xulrunner-1.9.1 packages from my PPA.

you are right. After making sure I got your version I now do not have
any scaling issue.

Revision history for this message
zuban (zuban) wrote : Re: [Bug 217908] Re: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

Don't know wheather this is known, but I have these resizing problems
*BOTH* on Linux *AND* Windows with different versions of Firefox. As I
did not see Firefox or mentioned video drivers source files, I cannot
assert, but imho this seems unlikely to be video driver related problem.

This is part of my xorg.conf (Linux configuration):
Section "Device"
         Identifier "Intel Corporation Mobile GM965/GL960
Integrated Graphics Controller"
         Boardname "intel"
         Busid "PCI:0:2:0"
         Driver "intel"
         Screen 0
EndSection

Revision history for this message
In , Adesai (adesai) wrote :

*** Bug 520261 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Jo-hermans (jo-hermans) wrote :

*** Bug 521866 has been marked as a duplicate of this bug. ***

Revision history for this message
Sancho Panza (prashanthr-deactivatedaccount-deactivatedaccount) wrote :

Why is the bugfix by Tom Jaeger not being rolled out to the main ppa? Every time
some routine update breaks my patched system, I have to wait for Tom to compile
and post updates patches on his ppa.

Thanks,

Revision history for this message
In , Carter McKendry (carter-mckendry) wrote :

If we can update the patch to alleviate the gfxXlibSurface.h error on Mac/Win, would the cairo version check be the only other blocking issue?

If the version check is not appropriate, it might make sense to just do a best-effort attempt here and be prepared to fail out gracefully if certain resources are not available.

Revision history for this message
In , Mozilla-bugs-micahscomputing (mozilla-bugs-micahscomputing) wrote :
Revision history for this message
NoBugs! (luke32j) wrote :

Firefox 3.5.4 update seems to have broken the pixellated images fix.
Will this package be updated in 9.04?

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: FFe: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

I don't have the time and energy to keep the jaunty packages up to date,
so I deleted them. The karmic packages should work fine on jaunty, though.

NoBugs! wrote:
> Firefox 3.5.4 update seems to have broken the pixellated images fix.
> Will this package be updated in 9.04?
>

Revision history for this message
NoBugs! (luke32j) wrote :

The updated packages give dependency error in jaunty, I wasn't able to install them. Is there some way to manually patch or fix this?

Revision history for this message
Սահակ (petrosyan) wrote :

Because this bug got never fixed in Ubuntu, I have switched to using Google Chrome on Ubuntu.

Revision history for this message
Michał Gołębiowski-Owczarek (mgol) wrote :

@Սահակ
You mean Chromium? Google Chrome hasn't been released for Linux yet.

Revision history for this message
Niels Egberts (nielsegberts) wrote :

> You mean Chromium? Google Chrome hasn't been released for Linux yet.

The alpha's of google chrome are available in Google's repository. For now its just a rebranded chromium (I don't know if that's going to change in the future).

Revision history for this message
Marco Kar.ma (makhellion) wrote :

I confirm this bug on Karmic. I discovered it using "Image Zoom" firefox add-on, but it can be seen loading such an html command, too:
<img src="http://images.google.it/intl/it_it/images/logos/images_logo.gif" height="200">

Now, well, I'm a bit confused: is there a working fix? Maybe https://launchpad.net/~firefox-smooth-scaling/+archive/ppa ?

Revision history for this message
kenjo (ken-kenjo) wrote :

On Thu, 2009-10-22 at 17:50 +0000, Sancho Panza wrote:
> Why is the bugfix by Tom Jaeger not being rolled out to the main ppa? Every time
> some routine update breaks my patched system, I have to wait for Tom to compile
> and post updates patches on his ppa.
>
> Thanks,
>

Could we please get some action on this issue.

First could someone explain exactly what feature in the graphics driver
people think is wrong.

Googling shows that Nvidia do not think there is a driver error.

Could a small test program be written to show the error ?? has maybe
someone written one already.

This needs to get solved one way or the other having a fix outside the
normal distribution is not acceptable. but working around the problem in
only firefox obviously is not the correct fix.

If it really is a driver problem I need to have a test case that shows
the issue so we can get some reaction from nvidia.

Revision history for this message
Tom Jaeger (thjaeger) wrote :

> First could someone explain exactly what feature in the graphics driver
> people think is wrong.

Many graphics drivers didn't use to accelerate composite operations with
repeat type PAD (and REFLECT) correctly. This was a year ago; i believe
these issues have long been fixed.

> Could a small test program be written to show the error ?? has maybe
> someone written one already.

There is a very simple test case attached to this very bug report. Its
source surface is only 2x2 (IIRC), which might not hit an accelerated
path on every driver; there's a test case with a larger source surface
attached to the -ati driver bug report.

> This needs to get solved one way or the other having a fix outside the
> normal distribution is not acceptable. but working around the problem in
> only firefox obviously is not the correct fix.

No, firefox is the correct place to fix this issue. Firefox asks for
nearest-neighbor interpolation because on unpatched cairo 1.8.6,
bilinear filtering forces a slow client-side fallback to insure correctness.

Revision history for this message
kenjo (ken-kenjo) wrote :

On Wed, 2009-11-18 at 01:57 +0000, Tom Jaeger wrote:
> > First could someone explain exactly what feature in the graphics driver
> > people think is wrong.
>
> Many graphics drivers didn't use to accelerate composite operations with
> repeat type PAD (and REFLECT) correctly. This was a year ago; i believe
> these issues have long been fixed.

not here I still have really bad scale problems with firefox.

> > Could a small test program be written to show the error ?? has maybe
> > someone written one already.
>
> There is a very simple test case attached to this very bug report. Its
> source surface is only 2x2 (IIRC), which might not hit an accelerated
> path on every driver;

hmm I have attached the scale_error.tar.gz and that is simply a example
html page with a image scale. what I wanted as example was C code that
only uses X to provoke the problem.

> there's a test case with a larger source surface
> attached to the -ati driver bug report.

where is this ?? I cant find it.

> > This needs to get solved one way or the other having a fix outside the
> > normal distribution is not acceptable. but working around the problem in
> > only firefox obviously is not the correct fix.
>
> No, firefox is the correct place to fix this issue. Firefox asks for
> nearest-neighbor interpolation because on unpatched cairo 1.8.6,
> bilinear filtering forces a slow client-side fallback to insure correctness.
>
but if it's a driver bug there would be nothing to fix in firefox.
if it is a firefox bug on the other hand the yes obviously

Revision history for this message
Tom Jaeger (thjaeger) wrote :

kenjo wrote:
> On Wed, 2009-11-18 at 01:57 +0000, Tom Jaeger wrote:
>>> First could someone explain exactly what feature in the graphics driver
>>> people think is wrong.
>> Many graphics drivers didn't use to accelerate composite operations with
>> repeat type PAD (and REFLECT) correctly. This was a year ago; i believe
>> these issues have long been fixed.
>
> not here I still have really bad scale problems with firefox.

This is not a driver problem, the driver renders exactly as firefox
instructs it to.

>>> Could a small test program be written to show the error ?? has maybe
>>> someone written one already.
>> There is a very simple test case attached to this very bug report. Its
>> source surface is only 2x2 (IIRC), which might not hit an accelerated
>> path on every driver;
>
> hmm I have attached the scale_error.tar.gz and that is simply a example
> html page with a image scale. what I wanted as example was C code that
> only uses X to provoke the problem.

comment #33

>
>> there's a test case with a larger source surface
>> attached to the -ati driver bug report.
>
> where is this ?? I cant find it.
At the top of the page:

https://bugs.freedesktop.org/show_bug.cgi?id=19712

>>> This needs to get solved one way or the other having a fix outside the
>>> normal distribution is not acceptable. but working around the problem in
>>> only firefox obviously is not the correct fix.
>> No, firefox is the correct place to fix this issue. Firefox asks for
>> nearest-neighbor interpolation because on unpatched cairo 1.8.6,
>> bilinear filtering forces a slow client-side fallback to insure correctness.
>>
> but if it's a driver bug there would be nothing to fix in firefox.
> if it is a firefox bug on the other hand the yes obviously

As explained many times before, firefox disables bilinear filtering due
to hitting a slow path in cairo. The underlying issues are fixed now,
but firefox continues to use the same workaround that was needed before.

Revision history for this message
laulau (olaulau) wrote :

if the workaround isn't still needed, can someone drop it so that Firefox has the same features as under Windows (fast and beatifull scalings) ?

Revision history for this message
Tom Jaeger (thjaeger) wrote :

laulau wrote:
> if the workaround isn't still needed, can someone drop it so that
> Firefox has the same features as under Windows (fast and beatifull
> scalings) ?
>

That's exactly what the packages in the firefox-smooth-scaling PPA do.

But upstream is unresponsive on the issue, and the ubuntu maintainers
can't (or don't want to) roll out their own patches.

Revision history for this message
Niels Egberts (nielsegberts) wrote : Re: [Bug 217908] Re: FFe: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

>But upstream is unresponsive on the issue, and the ubuntu maintainers
>can't (or don't want to) roll out their own patches.

It probably has to do with the fact that you can't distribute a
modified version of Firefox, and still call it Firefox. Cause the name
is trade-marked

Revision history for this message
In , Astralstorm (astralstorm) wrote :

Please finally fix this. Nearest neighbor scaling is completely unsuitable for non-integer scaling factors, i.e. makes text in graphics totally unreadable.

This problem could be fixed by implementing error diffusion, but I think bilinear may be even better.

Revision history for this message
In , Dave Farrance (dave-tmp1) wrote :

Yes, please do fix this. This bug is horrible. Recent flat-panel monitors tend to have a fine pixel-pitch, and web images frequently benefit from zooming, but not when they look this bad. This pic shows how bad the zoom of Firefox Linux looks on my system compared to the same zoom with Firefox Windows on Wine:
http://anvil.pwp.blueyonder.co.uk/images/planes-ff-cmp.jpg

Revision history for this message
In , Jiakomo (jiakomo) wrote :

Chrome is the only linux browser that I have used that does not have this problem...

Revision history for this message
In , Adesai (adesai) wrote :

*** Bug 534054 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Mozbugz-dougt (mozbugz-dougt) wrote :

*** Bug 534645 has been marked as a duplicate of this bug. ***

Revision history for this message
NoBugs! (luke32j) wrote :

I don't think Firefox itself needs modification, the PPA for firefox-smooth-zoom only has one changed package, xulrunner.
However, the firefox-smooth-zoom PPA doesn't seem to work anymore after the latest updates to Firefox.

Revision history for this message
In , Janboe-ye (janboe-ye) wrote :

Created an attachment (id=419100)
change to using extend_pad against on cairo 1.9.2

This patch could fix the issue on my laptop. But firefox is still not as good as chrome. Does anyone know why chrome has subpixel capability when the image include text?

Revision history for this message
In , Janboe-ye (janboe-ye) wrote :

Created an attachment (id=419101)
screenshot of chrome, firefox w/wo extend_pad

Chrome has better quality than firefox with cairo_extend_pad. Does anyone know why?
Thanks

Revision history for this message
In , Janboe-ye (janboe-ye) wrote :

ok. I got it. This is because chromium's skia engine supports resampling kernel. This could not depends on xrender. But pixman which is used by cairo current does not support resampling.

(In reply to comment #47)
> Created an attachment (id=419101) [details]
> screenshot of chrome, firefox w/wo extend_pad
>
> Chrome has better quality than firefox with cairo_extend_pad. Does anyone know
> why?
> Thanks

Revision history for this message
Tom Jaeger (thjaeger) wrote :

For the record, here's an updated patch for xulrunner-1.9.2/firefox-3.6.

Revision history for this message
In , charles (cse-charles) wrote :

Zoom are less bad but there is square with big zoom. Are you modify or works on it pixman for resolve this problem of resampling ?

Before support new function of web browser please resolve this problem .

Thank you in advance.

Why Firefox for linux is less fast under windows ? That is the question!

Revision history for this message
In , duckien (wingofchao) wrote :

This is no longer listed as a known issue in Firefox 3.6 but it's still not fixed. Please fix it soon.

Revision history for this message
Christian Niemeyer (christian-niemeyer) wrote :

here's a good and simple explanation what causes the problem on linux:
http://www.neowin.net/forum/index.php?showtopic=826968&view=findpost&p=591626200

Revision history for this message
Christian Niemeyer (christian-niemeyer) wrote :

However, please fix this upstream or patch xulrunner in the ubuntu repositories for lucid at least!

I often use Ctrl++ to view websites larger, e.g. forums, articles etc. This is very annoying, when images get messep up. It's not a nice web experience. Thanks.

Revision history for this message
In , duckien (wingofchao) wrote :

Somebody please review the patch and apply it.

Revision history for this message
In , duckien (wingofchao) wrote :

The patch is outdated. nsThebesImage.cpp no longer exist in firefox 3.6.

Revision history for this message
In , Joe-drew (joe-drew) wrote :

FWIW, that code was moved to imgFrame.cpp.

Revision history for this message
In , Lyan (lyan) wrote :

The same image scaling problem still exists in openSUSE 11.2

Revision history for this message
In , Eric-rannaud (eric-rannaud) wrote :

In #12, Vladimir implies that smooth software scaling is too slow. Is that claim still true in 2010? (And was it ever true?) Scaling can be done with a dozen instructions per pixel, at the very most. Considering the cost of decoding JPEG and PNG, I have a hard time believing this would be "slow". Or even noticeable on any desktop or laptop built in the past 5-8 years.

Chromium uses software scaling, and it is damn fast.

There is more and more discrepancy between webpage "sizes" these days. At one extreme, http://msdn.microsoft.com/en-us/library/default.aspx uses very small fonts (apparently using an absolute 'pt' size), and requires scaling on many setups, and good citizens, like google.com that simply use '100%' fonts.

Webpages that are scaled to make the text readable end up with horrid images with Firefox on Linux, this is a shame. Two years after the original report, the approach first considered is not getting anywhere.

Please reconsider this question.

Revision history for this message
In , Astralstorm (astralstorm) wrote :

@47: Looks like chrome does bicubic scaling, while cairo seems to be doing simple bilinear. A patch against cairo to support bicubic would be nice to have.

Also, wasn't the problem with EXTEND_PAD originally lack of support or broken support in older versions of pixman?

Revision history for this message
In , Janboe-ye (janboe-ye) wrote :

hi, Radoslaw

Yes. I also think it'd better implement the resampling kernel in cairo or pixman. I saw there is a patch which implement the resampling kernel in pixman but it is rejected.

EXTEND_PAD is supported since cairo 1.92 which fixed some hw support issue.

Revision history for this message
In , Astralstorm (astralstorm) wrote :

Actually, EXTEND_PAD seems to work fine in cairo 1.8.8 as well.
And fast at that. (although I am using a fresh version of pixman and well-accelerated drivers...)

Revision history for this message
Luke Symes (allsymes) wrote :

Firefox will not be using system xulrunner in Lucid, according to this spec (marked "Essential"):
https://blueprints.launchpad.net/ubuntu/+spec/desktop-lucid-new-firefox-support-model
So, any patches will need to be made against firefox itself.

Revision history for this message
NoBugs! (luke32j) wrote :

The latest Firefox security update broke the zoom fix again...

tags: added: patch
Revision history for this message
kingofqueens (david-rouhani) wrote :

How do I use this patch?

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: FFe: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

Sorry, I've been slow at uploading updated packages lately, partly
because I'm not running karmic anymore, so I don't notice when the
repository gets out of date. Anyway, it should work now until the next
update...

On 02/21/2010 08:13 PM, NoBugs! wrote:
> The latest Firefox security update broke the zoom fix again...
>

Revision history for this message
In , Rogi (rogi) wrote :

I use OpenSuse 11.2 and extendet_pad work good for me (I use standard packages with official updates). Please integrate it in source code finally.

Revision history for this message
In , Jo-hermans (jo-hermans) wrote :

*** Bug 557438 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Figjina (figjina) wrote :

I installed cairo-1.92 and Firefox-3.6.3pre (nightly build 64bit) but the images are still raw. Shouldn't this simply work now?

Revision history for this message
In , Rogi (rogi) wrote :

You need to edit the source code before you compile it. Change

if (!isDownscale) {
          pattern->SetFilter(gfxPattern::FILTER_FAST);

to

if (!isDownscale) {
          pattern->SetExtend(gfxPattern::EXTEND_PAD);

in ~/modules/libpr0n/src/imgFrame.cpp.

Revision history for this message
In , Éric Piel (pieleric) wrote :

On a distro with xserver 1.7, cairo 1.9, and Firefox 3.6, this one-line change is sufficient to fix this bug without any drawback (like huge slowdown with some video drivers)?

If so, this could be a huge step to apply to the distro-compiled versions of Firefox (where those requirements can be insured in the package itself).

Revision history for this message
In , Jwalden+bmo (jwalden+bmo) wrote :

At this point, maybe it makes sense to assume by default that X isn't broken, and then require vendors with broken X to opt out manually by reverting to current behavior. Given the churn rate with Linux installs I think this may be better for most users who try to track more recent distro releases. It would cut down on extra patches distros have to schlep around and that Mozilla has to review (or do any distros actually ship with patches to fix this?). Just a thought...

Revision history for this message
Michał Gołębiowski-Owczarek (mgol) wrote :

@Tom Jaeger
The next update is needed, patched packages are out of date, again. Thx for the fix, anyway.

Revision history for this message
In , Rogi (rogi) wrote :

With extendet_pad is scrolling not so smoothly as without. But it is implement in Windows version by default and nobody is worried. For me appearance is more important that performance. But in Chromium browser there is no such problem with scrolling and zoom quality in Windows and Linux. Firefox should do it like Chromium.

Revision history for this message
In , Tom Jaeger (thjaeger) wrote :

(In reply to comment #61)
> With extendet_pad is scrolling not so smoothly as without. But it is implement
> in Windows version by default and nobody is worried. For me appearance is more
> important that performance. But in Chromium browser there is no such problem
> with scrolling and zoom quality in Windows and Linux. Firefox should do it like
> Chromium.

This means that you're missing the cairo part of the fix. There shouldn't be any noticeable performance difference between nearest-neighbor and bilinear interpolation on current hardware.

Revision history for this message
In , Rogi (rogi) wrote :

(In reply to comment #62)
> This means that you're missing the cairo part of the fix. There shouldn't be
> any noticeable performance difference between nearest-neighbor and bilinear
> interpolation on current hardware.

Thanks for your tip. I have used diff from Janboe Ye with cairo 1.8.8. But your diff needs newer cairo and it is to difficult to install for me. I hope that my distribution will use newer cairo in the next version.

Revision history for this message
NoBugs! (luke32j) wrote :

Looks like 10.04 beta2 doesn't have this fix yet...?
Hope it gets added for the final release.
Thanks again for the Firefox fix.

Revision history for this message
In , Figjina (figjina) wrote :

but when will this patch be applied to the official firefox branch??

Revision history for this message
In , 21-vingtetun (21-vingtetun) wrote :

*** Bug 559871 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Zweinberg (zweinberg) wrote :

I am not realistically going to fix this anytime soon.

Changed in xulrunner:
status: In Progress → Confirmed
Tom Jaeger (thjaeger)
Changed in xulrunner:
importance: Unknown → Undecided
status: Confirmed → New
status: New → Invalid
Changed in firefox (Ubuntu):
status: Invalid → Confirmed
Revision history for this message
In , Bugreply-20-herbalizer (bugreply-20-herbalizer) wrote :

Tom Jaeger's fix from launchpad is working perfectly on Ubuntu 10.04. - Is there any specific reason why this isn't being added to firefox?

Revision history for this message
In , Henri Sivonen (hsivonen) wrote :

Nominating for 1.9.3. Without this patch, Firefox scales images on Linux in a substantially uglier way than Opera or Chrome. I've been running with this patch for weeks now on Karmic with no ill effects.

Revision history for this message
In , Rogi (rogi) wrote :

(In reply to comment #65)
> Tom Jaeger's fix from launchpad is working perfectly on Ubuntu 10.04. - Is
> there any specific reason why this isn't being added to firefox?

There are some steps needed to get this patch work correctly with all current linux graphic-drivers. See here for more infos: https://bugs.launchpad.net/ubuntu/+source/firefox-3.0/+bug/217908

Revision history for this message
Rogi (rogi) wrote :

Nouvea has small issue with fix, see my attachment with kaffeine homepage-screenshot. It happens with other pages too, wikipedia.org, openstreetmap.org, start.ubuntu.com start.ubuntu.com/10.04/Google/ for example. No issues on the same system with nvidia proprietary driver.

Revision history for this message
In , longsonr (longsonr) wrote :

*** Bug 571853 has been marked as a duplicate of this bug. ***

Revision history for this message
NoBugs! (luke32j) wrote :

I noticed when Firefox updated to the normal version, it was called Firefox. Then when it updated to the firefox-smooth-scaling version, it was called "Namoroka", and it also sends "Namoroka" as user-agent instead of "firefox". This causes compatibility problems for some sites, similar to this bug:
https://bugs.launchpad.net/ubuntu/+source/firefox-3.5/+bug/397211

Revision history for this message
Tom Jaeger (thjaeger) wrote : Re: [Bug 217908] Re: FFe: Pixellated Images in Firefox/Opera due to incorrect EXTEND_PAD implementation in several video drivers

The mozilla foundation does not allow the use of the firefox name and
logo when shipping a modified version of firefox, so this is both
expected and unavoidable.

On 06/30/2010 08:44 PM, NoBugs! wrote:
> I noticed when Firefox updated to the normal version, it was called Firefox. Then when it updated to the firefox-smooth-scaling version, it was called "Namoroka", and it also sends "Namoroka" as user-agent instead of "firefox". This causes compatibility problems for some sites, similar to this bug:
> https://bugs.launchpad.net/ubuntu/+source/firefox-3.5/+bug/397211
>

Revision history for this message
In , Miroslav Hadzhiev (xtigyro) wrote :

I've used Tom Jaeger's fix since Ubuntu 8.10 and it's working flawlessly.
I've Ati Mobility X1600 (OSS radeon driver in use).
And on my old computer nVDIA video card on board (and nVIDIA proprietary driver in use).

No problems at all.

Revision history for this message
In , Astralstorm (astralstorm) wrote :

Well, the Ubuntu bug is wrt Hardy Heron, which is really outdated by now, the problem has been fixed in i915 driver a long time ago.
Also, pixman software scaling performance has improved a lot since with addition of SSE and SSE2 scaling - some versions back.

Please do review and apply the patch finally and stop holding Linux Firefox in 2009. This bug is forcing high resolution screen and Linux users to rebuild patched Firefox.

Revision history for this message
In , Mozilla-bugs-micahscomputing (mozilla-bugs-micahscomputing) wrote :

(In reply to comment #70)
> Well, the Ubuntu bug is wrt Hardy Heron, which is really outdated by now, the
> problem has been fixed in i915 driver a long time ago.
> Also, pixman software scaling performance has improved a lot since with
> addition of SSE and SSE2 scaling - some versions back.
>
> Please do review and apply the patch finally and stop holding Linux Firefox in
> 2009. This bug is forcing high resolution screen and Linux users to rebuild
> patched Firefox.

Ubuntu just upgraded Hardy to Firefox 3.6.x and will hopefully finish out the 3 yr support on that branch. But regardless, we're using in-source cairo now, so we shouldn't be holding anything back.

Revision history for this message
In , Elvanor2007 (elvanor2007) wrote :

I want to add that this problem also causes graphical artefacts on some sites even without manually zooming. See

http://playground.kameleoon.net/engine/image_scaling.html

Under Linux, Firefox 3.6.8 will display a red block next to the gradient because the image is not correctly scaled (look at the attached screenshot).

Under Chrome or with a patched Firefox using EXTEND_PAD, it looks as it should.

Therefore please really consider applying this patch for Firefox 4 final; it causes artefacts with perfectly valid HTML / CSS for Linux Firefox users.

Revision history for this message
In , Elvanor2007 (elvanor2007) wrote :

Created attachment 465688
Screenshot of a valid web page, with an artefact on FF under Linux

Revision history for this message
In , Graham Perry (misc-noisp) wrote :

Is there anything stopping this patch being applied?

Revision history for this message
In , Karlt (karlt) wrote :

I think the server version check is needed.
(I wouldn't bother with a cairo version check.)

Might as well use EXTEND_PAD for upscaling with server >= 1.7.
I was thinking something like

 gfxPattern::GraphicsExtend gfxContext::PreferredExtend().

Revision history for this message
In , Kurosawa Takeshi (takenspc) wrote :

(In reply to comment #75)
> I think the server version check is needed.
> (I wouldn't bother with a cairo version check.)
>
> Might as well use EXTEND_PAD for upscaling with server >= 1.7.
> I was thinking something like
>
> gfxPattern::GraphicsExtend gfxContext::PreferredExtend().

cairo seems already to do something like it,

http://mxr.mozilla.org/mozilla-central/source/gfx/cairo/cairo/src/cairo-xlib-display.c#339

... and fallbacks if the server is buggy, doesn't it?

http://mxr.mozilla.org/mozilla-central/source/gfx/cairo/cairo/src/cairo-xlib-surface.c#1591

Revision history for this message
In , Karlt (karlt) wrote :

(In reply to comment #76)
> cairo seems already to do something like it,
>
> http://mxr.mozilla.org/mozilla-central/source/gfx/cairo/cairo/src/cairo-xlib-display.c#339

Yes, we need to match those buggy_pad_reflect server version tests exactly.

> ... and fallbacks if the server is buggy, doesn't it?

Right. But the fallback that cairo needs to do is quite disastrous to performance. It will read back the image (and the destination, if there is an alpha channel in the image) from the server to software scale and then return to the server.

I assume it's possible to do some fancy FILTER_NEAREST only for the source-image-pixel-width outer border and FILTER_BILINEAR for the interior of the image,
but I'm not sure it's worth it just for older servers.

Simplest is probably to keep the old behavior for older servers, but fix up things with EXTEND_PAD/FILTER_BILINEAR for newer servers.

Revision history for this message
In , Eric-rannaud (eric-rannaud) wrote :

>> ... and fallbacks if the server is buggy, doesn't it?
>
> Right. But the fallback that cairo needs to do is quite disastrous to
> performance. It will read back the image (and the destination, if there is an
> alpha channel in the image) from the server to software scale and then return
> to the server.

This is FUD. Many apps do purely software scaling with reasonable performance. Google Chrome was, at least until recently (and probably still is). And it's still faster than current Firefox with in-server NEAREST.

Images are small wrt the available memory bandwidth. The majority of images on the web render to bitmaps that are way less than 1 or 2 MB (4 Bytes per pixel). Bandwidth is over 1GB/s on any computers bought since 2003.

Scaling images is cheap. The 90s are over.

Revision history for this message
In , Graham Perry (misc-noisp) wrote :

So the quickest, simplest way forward is to implement the patch, rely on cairo for the fallback and accept the performance hit due software scaling on older servers, then in future (if the need should arise) create a fallback to the old behaviour?

Revision history for this message
In , Karlt (karlt) wrote :

These older servers are not very old (~ Oct 2009),
and the performance hit would be more due to readback than software scaling.
(EXTEND_NONE is often done is software even server-side.)
(I don't know what Chrome does but maybe its doing its compositing client-side, so there's no need to read back.)

Revision history for this message
In , Hrvoje Nikšić (hniksic) wrote :

For testing the performance of cairo software scaling with readback, and possible comparison with chrome and hardware-enabled scaling in firefox, here is an example web page that embeds ten large images scaled to a smaller size:

http://www.flickr.com/groups/highres_favorites/discuss/72157611461261406/

Revision history for this message
In , Karlt (karlt) wrote :

That's great thanks, Hrvoje.

Since bug 572680, the code has moved back to thebes (gfxDrawable.cpp), so your reviewed patch would also apply there (and we don't need anything like gfxContext::PreferredExtend()).

Revision history for this message
In , Karlt (karlt) wrote :

Oh, sorry, it's Tom's patch.

Revision history for this message
In , Kurosawa Takeshi (takenspc) wrote :

Created attachment 469348
Updated version of Tom's patch

Updated version of Tom's last patch with some #ifdefs and minor modifications.

Revision history for this message
In , Kurosawa Takeshi (takenspc) wrote :

Created attachment 469353
honor cairo version in tree

This is needed for main patch.

The revision of cairo in tree is 12d521df8acc483b2daa844d4f05dc2fe2765ba6,
thus the version of cairo is 1.9.5.

* http://hg.mozilla.org/mozilla-central/rev/f236632a9747
* http://cgit.freedesktop.org/cairo/tree/cairo-version.h?id=12d521df8acc483b2daa844d4f05dc2fe2765ba6

Revision history for this message
Micah Gersten (micahg) wrote :

Marking this Triaged. Looks like this will hit Firefox trunk soon.

Changed in firefox (Ubuntu):
importance: Undecided → Medium
status: Confirmed → Triaged
Revision history for this message
Micah Gersten (micahg) wrote :

This won't be fixed in xulrunner-1.9 since it's EOL.

Changed in xulrunner-1.9 (Ubuntu):
status: Triaged → Won't Fix
Revision history for this message
In , Dao (dao) wrote :

Is this ready to land?

Revision history for this message
In , Lovyagin (lovyagin) wrote :

What is the problem to implement this https://launchpad.net/~firefox-smooth-scaling/+archive/ppa patch for example? I've just looked at firefox 4 beta and images still looks pixelated...

Revision history for this message
In , Astralstorm (astralstorm) wrote :

lovaygin:
Those patches are for older versions of firefox.
The patches included in this bug (last two) apply to latest firefox betas and work well, superseding those old ones.
They haven't been applied yet to the development tree.

Of course, you need either cairo 1.9.2 or to use the included one with firefox and run on Xorg 1.7 to see the improvement, which is great. Doesn't even compare with cairo 1.8.x and older EXTEND_PAD patches.

(Tested on ATI closed driver and Radeon open driver.)

Seems to me this is ready to land.

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

(In reply to comment #80)
> (I don't know what Chrome does but maybe its doing its compositing client-side,
> so there's no need to read back.)

That is indeed what Chrome does.

Revision history for this message
In , Lovyagin (lovyagin) wrote :

Szkodziński:
Do you going to say that I need those new patches and new cairo to compile and run new version of firefox or it's better for 3.6.x too? Do I need to patch xulrunner too as I did with older patch from launchpad?

So, no chance that firefox will runs well without pain of patching each update in a near future? (Well, I have NVidia and use closed driver.)

Changed in firefox:
importance: Unknown → Medium
Revision history for this message
In , Ehsan-mozilla (ehsan-mozilla) wrote :

Created attachment 473677
Part 3: disable a failing reftest on linux

This reftest fails on Linux with this patch because now we do bilinear filtering on Linux like everywhere else.

Revision history for this message
In , Ehsan-mozilla (ehsan-mozilla) wrote :
Revision history for this message
In , 甘露 (Lu Gan) (rhythm-gan) wrote :

I downloaded the "Mozilla/5.0 (X11; Linux i686; rv:2.0b6pre) Gecko/20100910 Firefox/4.0b6pre" nightly, it works greatly when zooming.
My configuration:
Arch Linux current (xorg-server 1.8.1.902 xf86-video-ati 6.13.1 cairo 1.8.10)
ATI radeon V3200 on a old IBM T43P

Revision history for this message
olive (olivier.fraysse) wrote :

mozilla-bugs #422179 is "RESOLVED FIXED"

2010-09-10 04:43 PDT

Changed in firefox:
status: Confirmed → Fix Released
Changed in xf86-video-ati:
importance: Unknown → Medium
Changed in xf86-video-mga:
importance: Unknown → Medium
Changed in xf86-video-radeonhd:
importance: Unknown → Medium
Revision history for this message
NoBugs! (luke32j) wrote :

Firefox zoom ppa isn't up-to-date for 10.04.
https://launchpad.net/~firefox-smooth-scaling/+archive/ppa
I'd update to Firefox 4, but some addons aren't available...

Changed in xf86-video-ati:
importance: Medium → Unknown
Changed in xf86-video-radeonhd:
importance: Medium → Unknown
Changed in xf86-video-mga:
importance: Medium → Unknown
Changed in xf86-video-ati:
importance: Unknown → Medium
Changed in xf86-video-radeonhd:
importance: Unknown → Medium
Changed in xf86-video-mga:
importance: Unknown → Medium
Revision history for this message
In , Oibaf (oibaf) wrote :

This should be fixed in openSUSE 11.4 which ships Firefox 4.

Changed in opensuse:
importance: Unknown → Critical
status: Confirmed → Fix Released
Revision history for this message
Oibaf (oibaf) wrote :

Fixed in natty with firefox 4.

Changed in xulrunner-1.9.1 (Ubuntu):
status: Triaged → Fix Released
Changed in firefox (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.