RESOLVED FIXED 148307
Clear cairo-gl surface for initialization
https://bugs.webkit.org/show_bug.cgi?id=148307
Summary Clear cairo-gl surface for initialization
Jinyoung Hur
Reported 2015-08-21 08:10:48 PDT
Clear cairo-gl surface for initialization
Attachments
Patch (2.89 KB, patch)
2015-08-21 08:34 PDT, Jinyoung Hur
no flags
Patch (2.89 KB, patch)
2015-08-21 08:53 PDT, Jinyoung Hur
no flags
Patch (2.70 KB, patch)
2015-08-24 17:41 PDT, Jinyoung Hur
no flags
Jinyoung Hur
Comment 1 2015-08-21 08:34:00 PDT
Jinyoung Hur
Comment 2 2015-08-21 08:50:04 PDT
The accelerated canvas backed by cairo-gl has a possible memory initialize problem. A texture memory that is created by calling glTexImage2D with no data, is in undefined status[1] so it can have a garbage data. And also, according to the comments[2] in cairo.h, cairo seems not cleaning the passed texture when it create a surface. So it would be good to clean the just created cairo-gl surface by hand. [1] https://www.opengl.org/sdk/docs/man/html/glTexImage2D.xhtml "The image is undefined if the user tries..." [2] "if the user passes in a reference to some backing storage and asks cairo to wrap that in a #cairo_surface_t, then the contents are not modified.
Jinyoung Hur
Comment 3 2015-08-21 08:53:45 PDT
Gyuyoung Kim
Comment 4 2015-08-24 00:12:32 PDT
CC'ing Martin.
Martin Robinson
Comment 5 2015-08-24 09:43:19 PDT
Comment on attachment 259616 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=259616&action=review Looks okay to me, but the code has a few extra steps which I think are unnecessary. > Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp:80 > + cairo_rectangle(cr.get(), 0, 0, size.width(), size.height()); > + cairo_set_operator(cr.get(), CAIRO_OPERATOR_CLEAR); > + cairo_fill(cr.get()); You don't need to use cairo_rectangle + cairo_fill, you can simply do cairo_paint. > Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp:81 > + cairo_restore(cr.get()); No need to save and restore the context state, you are just throwing it away afterward.
Jinyoung Hur
Comment 6 2015-08-24 17:41:43 PDT
Jinyoung Hur
Comment 7 2015-08-24 17:43:59 PDT
(In reply to comment #5) > Comment on attachment 259616 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=259616&action=review > > Looks okay to me, but the code has a few extra steps which I think are > unnecessary. > > > Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp:80 > > + cairo_rectangle(cr.get(), 0, 0, size.width(), size.height()); > > + cairo_set_operator(cr.get(), CAIRO_OPERATOR_CLEAR); > > + cairo_fill(cr.get()); > > You don't need to use cairo_rectangle + cairo_fill, you can simply do > cairo_paint. > > > Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp:81 > > + cairo_restore(cr.get()); > > No need to save and restore the context state, you are just throwing it away > afterward. Thank you for a helpful review! I've modified the patch as you said.
WebKit Commit Bot
Comment 8 2015-08-24 18:57:01 PDT
Comment on attachment 259798 [details] Patch Clearing flags on attachment: 259798 Committed r188902: <http://trac.webkit.org/changeset/188902>
WebKit Commit Bot
Comment 9 2015-08-24 18:57:06 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.