WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
98728
[Texmap] Swizzling BGRA to RGBA in temp buffer while USE(TEXMAP_OPENGL_ES_2)
https://bugs.webkit.org/show_bug.cgi?id=98728
Summary
[Texmap] Swizzling BGRA to RGBA in temp buffer while USE(TEXMAP_OPENGL_ES_2)
Hyungchan Kim
Reported
2012-10-09 01:03:50 PDT
[Texmap] Swizzling BGRA to RGBA in temp buffer while USE(TEXMAP_OPENGL_ES_2)
Attachments
Patch
(9.78 KB, patch)
2012-10-09 01:16 PDT
,
Hyungchan Kim
no flags
Details
Formatted Diff
Diff
Patch
(2.50 KB, patch)
2012-10-09 01:25 PDT
,
Hyungchan Kim
no flags
Details
Formatted Diff
Diff
Patch
(2.74 KB, patch)
2012-10-09 06:20 PDT
,
Hyungchan Kim
no flags
Details
Formatted Diff
Diff
Patch
(12.24 KB, patch)
2012-10-15 19:17 PDT
,
Hyungchan Kim
no flags
Details
Formatted Diff
Diff
Patch
(22.84 KB, patch)
2012-10-16 23:11 PDT
,
Hyungchan Kim
no flags
Details
Formatted Diff
Diff
Patch
(22.47 KB, patch)
2012-10-17 23:51 PDT
,
Hyungchan Kim
no flags
Details
Formatted Diff
Diff
Patch
(22.56 KB, patch)
2012-10-18 08:50 PDT
,
Hyungchan Kim
no flags
Details
Formatted Diff
Diff
Show Obsolete
(6)
View All
Add attachment
proposed patch, testcase, etc.
Hyungchan Kim
Comment 1
2012-10-09 01:16:16 PDT
Created
attachment 167706
[details]
Patch
Hyungchan Kim
Comment 2
2012-10-09 01:25:38 PDT
Created
attachment 167708
[details]
Patch
Hyungchan Kim
Comment 3
2012-10-09 01:47:29 PDT
This problem happens in QtWebKit for Pandaboard ES. Launched QtTestBrowser under X with -graphicsbased, -gl-viewport options.
kov's GTK+ EWS bot
Comment 4
2012-10-09 04:18:19 PDT
Comment on
attachment 167708
[details]
Patch
Attachment 167708
[details]
did not pass gtk-ews (gtk): Output:
http://queues.webkit.org/results/14245039
Noam Rosenthal
Comment 5
2012-10-09 04:28:05 PDT
Comment on
attachment 167708
[details]
Patch This image is usually the backing store of a temporary ImageBuffer. This would create an extra unnecessary deep copy in the common case.
Hyungchan Kim
Comment 6
2012-10-09 06:20:35 PDT
Created
attachment 167746
[details]
Patch
Hyungchan Kim
Comment 7
2012-10-09 06:40:51 PDT
Thanks for reviewing, I agree with you. I didn't consider that common case, but I think swizzleBGRAToRGBA seems have a problem. In BitmapTextureGL::updateContents, const char *imageData should not be modified by swizzleBGRAToRGBA because 1) const_cast used 2) seems to be shared textures which point same NativeImagePtr A and B keep changing its data from BGRA to RGBA or from RGBA to BGRA. So, both A and B cannot have correct color simultaneously.
Noam Rosenthal
Comment 8
2012-10-10 20:44:35 PDT
Comment on
attachment 167746
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=167746&action=review
In some cases it's ok to swizzle the actual data (when it's a backing store for a temporary ImageBuffer), and in some cases it's not (when it's a directly composited image). We should add an enum parameter to updateContents that stands for whether it's ok to swizzle the actual data without copying.
> Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp:726 > + void* srcData = reinterpret_cast<void *>(const_cast<char*>(imageData));
why do you need srcData? If you're copying, you can use imageData directly...
Hyungchan Kim
Comment 9
2012-10-15 19:17:07 PDT
Created
attachment 168839
[details]
Patch
Hyungchan Kim
Comment 10
2012-10-15 22:20:07 PDT
Thanks for your review. I modified some code to use temp buffer only for directly composited image and did refactoring to use same temp buffer which was already used for driverSupportsSubImage() condition.
Noam Rosenthal
Comment 11
2012-10-16 08:43:49 PDT
Comment on
attachment 168839
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=168839&action=review
This is getting closer - however this should be an enum that gets passed along updateContents, not a bool member; Also this is not about directly composited images, it's about whether BitmapTexture is allowed to modify the original image. Something like enum UpdateContentsFlag { UpdateCanModifyOriginalImageData = 0x01 }
> Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp:76 > +void TextureMapperTile::updateContents(TextureMapper* textureMapper, Image* image, const IntRect& dirtyRect, bool isDirectlyCompositedImage)
This is a boolean trap... it should be an enum, like ContentUpdateOptions
> Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp:98 > + if (isDirectlyCompositedImage) > + m_texture->setDirectlyCompositedFlag(); > m_texture->updateContents(image, targetRect, sourceOffset); > + if (isDirectlyCompositedImage) > + m_texture->resetDirectlyCompositedFlag();
You don't really need this as a member. Pass it through the updateContents functions instead.
Hyungchan Kim
Comment 12
2012-10-16 23:11:54 PDT
Created
attachment 169095
[details]
Patch
Noam Rosenthal
Comment 13
2012-10-17 08:05:22 PDT
Comment on
attachment 169095
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=169095&action=review
Great! Please fix nits and then commit or cq?
> Source/WebCore/ChangeLog:13 > + BitmapTextureGL::updateContents() try to swizzle source Image if opengl > + driver doesn't support BGRA format. > + In case of directly composited image, swizzling source image > + should not be modified because another BitmapTexture will also try > + to swizzle. > + > + BitmapTexture now provide UpdateContentsFlag to separate whether > + source image can be modified or not
Some rewording: BitmapTexture swizzles the source image if the OpenGL driver doesn't support the BGRA extension. In case of directly composited images, the source image should not be modified. BitmapTexture::updateContents now accepts an UpdateContentsFlag argument to separate the different cases.
> Source/WebCore/ChangeLog:19 > + No new tests.
This should be tested - there are a few current test cases for directly composited images, do they test this?
> Source/WebCore/platform/graphics/texmap/TextureMapper.h:62 > + enum UpdateContentsFlag { > + UpdateCanModifyOriginalImageData = 0x01, > + UpdateCannotModifyOriginalImageData = 0x02 > + };
Any reason to use 0x01 and 0x02 instead of 0 and 1?
> Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp:57 > +void BitmapTextureImageBuffer::updateContents(Image* image, const IntRect& targetRect, const IntPoint& offset, UpdateContentsFlag /*updatecontentsflag*/)
You don't need the comment, just omit the argument name.
Noam Rosenthal
Comment 14
2012-10-17 08:12:25 PDT
Comment on
attachment 169095
[details]
Patch Sorry, changed to r- until we figure out if the existing tests actually cover this. I don't want this regressing in the future...
Hyungchan Kim
Comment 15
2012-10-17 23:51:52 PDT
Created
attachment 169353
[details]
Patch
Hyungchan Kim
Comment 16
2012-10-18 00:00:43 PDT
I fixed ChangeLog and removed some comments of unused parameters. But, I have no idea how to write test only for Qt Linux with OpenGLES. It would be great if you can give me some guide for writing test for this issue. I can compose a test for this, but it will always succeed under OpenGL support.
Noam Rosenthal
Comment 17
2012-10-18 06:30:32 PDT
(In reply to
comment #16
)
> I fixed ChangeLog and removed some comments of unused parameters. > But, I have no idea how to write test only for Qt Linux with OpenGLES. > > It would be great if you can give me some guide for writing test for this issue. > I can compose a test for this, but it will always succeed under OpenGL support.
OK - please update the changelog to say that this is only testable on specific hardware not currently available in the bots.
Hyungchan Kim
Comment 18
2012-10-18 08:50:48 PDT
Created
attachment 169423
[details]
Patch
Hyungchan Kim
Comment 19
2012-10-21 17:11:00 PDT
Can someone set cq+ for me? Or please let me know if there is something to get cq+.
WebKit Review Bot
Comment 20
2012-10-21 18:27:37 PDT
Comment on
attachment 169423
[details]
Patch Clearing flags on attachment: 169423 Committed
r132019
: <
http://trac.webkit.org/changeset/132019
>
WebKit Review Bot
Comment 21
2012-10-21 18:27:42 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug