RESOLVED FIXED 106878
[EFL][Qt][WebGL] Avoid deleting an uncreated canvas.
https://bugs.webkit.org/show_bug.cgi?id=106878
Summary [EFL][Qt][WebGL] Avoid deleting an uncreated canvas.
Kalyan
Reported 2013-01-15 00:23:25 PST
Try to load https://www.khronos.org/registry/webgl/sdk/demos/webkit/SpiritBox.html Expected Result: Spinning cube Actual Result: MiniBrowser crashes with an Assert !m_surfaceBackingStores.contains(id);
Attachments
patch (3.36 KB, patch)
2013-01-15 06:30 PST, Kalyan
no flags
patchv2 (4.18 KB, patch)
2013-01-15 12:43 PST, Kalyan
no flags
patchv3 (6.04 KB, patch)
2013-01-15 16:58 PST, Kalyan
no flags
patchv5 (6.04 KB, patch)
2013-01-15 17:27 PST, Kalyan
benjamin: review-
patchv6 (6.03 KB, patch)
2013-01-17 15:17 PST, Kalyan
benjamin: review-
patchv7 (5.99 KB, patch)
2013-01-18 07:22 PST, Kalyan
kenneth: review-
patchv8 (6.03 KB, patch)
2013-01-19 01:03 PST, Kalyan
no flags
patchv9 (11.47 KB, patch)
2013-01-22 20:11 PST, Kalyan
webkit.review.bot: commit-queue-
patchv10 (11.42 KB, patch)
2013-01-23 20:06 PST, Kalyan
no flags
patchv11 (10.08 KB, patch)
2013-01-28 13:59 PST, Kalyan
no flags
patchv12 (11.62 KB, patch)
2013-01-28 15:37 PST, Kalyan
benjamin: review+
webkit.review.bot: commit-queue-
rebasedpatch (11.52 KB, patch)
2013-01-30 00:19 PST, Kalyan
no flags
Kalyan
Comment 1 2013-01-15 01:40:10 PST
(In reply to comment #0) > Try to load https://www.khronos.org/registry/webgl/sdk/demos/webkit/SpiritBox.html > > Expected Result: Spinning cube > > Actual Result: MiniBrowser crashes with an Assert !m_surfaceBackingStores.contains(id); sorry, the assert is in void LayerTreeRenderer::destroyCanvas(CoordinatedLayerID id) m_surfaceBackingStores.contains(id);
Kalyan
Comment 2 2013-01-15 06:30:11 PST
Rafael Brandao
Comment 3 2013-01-15 11:30:05 PST
Comment on attachment 182753 [details] patch Instead of using a yet another bool, can't you use some of the existing ones? If a canvas has not been created yet, shouldn't it have "canvasNeedsCreated" turned on? If this is the case, you could simply turn that off when you're asked to delete it.
Kalyan
Comment 4 2013-01-15 11:44:55 PST
(In reply to comment #3) > (From update of attachment 182753 [details]) > Instead of using a yet another bool, can't you use some of the existing ones? If a canvas has not been created yet, shouldn't it have "canvasNeedsCreated" turned on? If this is the case, you could simply turn that off when you're asked to delete it. This would be fine if the canvas wasn't created. But we also need to handle the case where canvas needs to be re-created.In this case both m_canvasNeedsDestroy and m_canvasNeedsCreate are enabled in setContentsToCanvas and Destroy is handled first.
Rafael Brandao
Comment 5 2013-01-15 12:12:43 PST
(In reply to comment #4) > (In reply to comment #3) > > (From update of attachment 182753 [details] [details]) > > Instead of using a yet another bool, can't you use some of the existing ones? If a canvas has not been created yet, shouldn't it have "canvasNeedsCreated" turned on? If this is the case, you could simply turn that off when you're asked to delete it. > > This would be fine if the canvas wasn't created. But we also need to handle the case where canvas needs to be re-created.In this case both m_canvasNeedsDestroy and m_canvasNeedsCreate are enabled in setContentsToCanvas and Destroy is handled first. In this special case, if both are turned on, you could ignore the deletion by turning it off and early returning. Is that right that always when they both are turned on it means we expect a recreation? My feeling is that we have too many states here and maybe we could get a more understandable code if we used enums to track them accurately.
Kalyan
Comment 6 2013-01-15 12:35:15 PST
(In reply to comment #5) > (In reply to comment #4) > > (In reply to comment #3) > > > (From update of attachment 182753 [details] [details] [details]) > > > My feeling is that we have too many states here and maybe we could get a more understandable code if we used enums to track them accurately. I agree, enum with some well defined states would be good here. On a side note when recreation is needed we need to destroy the previous canvas with that particular id and create a new one. So we cannot ignore either state in that case.
Kalyan
Comment 7 2013-01-15 12:43:08 PST
Created attachment 182829 [details] patchv2 The patch still uses bool values but should cover all the cases now.
Kalyan
Comment 8 2013-01-15 16:58:48 PST
Kalyan
Comment 9 2013-01-15 17:00:24 PST
replaced the usage of boolean member variables with enum
WebKit Review Bot
Comment 10 2013-01-15 17:01:13 PST
Attachment 182876 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit..." exit_code: 1 Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h:170: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 1 in 3 files If any of these errors are false positives, please file a bug against check-webkit-style.
Kalyan
Comment 11 2013-01-15 17:03:04 PST
Comment on attachment 182876 [details] patchv3 will upload a new patch with style fix
Kalyan
Comment 12 2013-01-15 17:27:16 PST
Zeno Albisser
Comment 13 2013-01-16 02:48:35 PST
Comment on attachment 182881 [details] patchv5 View in context: https://bugs.webkit.org/attachment.cgi?id=182881&action=review > Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h:256 > + unsigned m_canvasState; I'd make this of type CanvasState, to make the type explicit. Seems much better than the booleans. :)
Viatcheslav Ostapenko
Comment 14 2013-01-16 23:04:49 PST
Comment on attachment 182881 [details] patchv5 View in context: https://bugs.webkit.org/attachment.cgi?id=182881&action=review >> Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h:256 >> + unsigned m_canvasState; > > I'd make this of type CanvasState, to make the type explicit. > > Seems much better than the booleans. :) I don't think it is good idea. m_canvasState is not an enum, but bit field here. BTW, I don't know why it is better than old bool m_var:1 . Instead of 3 bits used inside common bit space for bool vars in original proposal now it uses extra 32 bits.
Noam Rosenthal
Comment 15 2013-01-16 23:09:37 PST
> I don't think it is good idea. m_canvasState is not an enum, but bit field here. You can typedef it to unsigned. > BTW, I don't know why it is better than old bool m_var:1 . Instead of 3 bits used inside common bit space for bool vars in original proposal now it uses extra 32 bits. Either is fine.
Noam Rosenthal
Comment 16 2013-01-16 23:13:28 PST
Comment on attachment 182881 [details] patchv5 I'm ok with this. Please ask a WebKit2 owner for review.
Benjamin Poulain
Comment 17 2013-01-17 14:30:12 PST
Comment on attachment 182881 [details] patchv5 View in context: https://bugs.webkit.org/attachment.cgi?id=182881&action=review You maintain m_canvasState even if USE(GRAPHICS_SURFACE) is false. You never use the value in that case. It looks like something is wrong with the #ifdef. > Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp:334 > + } else if ((m_canvasSize != platformLayer->platformLayerSize()) || (m_canvasToken != platformLayer->graphicsSurfaceToken())) > // m_canvasToken can be different to platformLayer->graphicsSurfaceToken(), even if m_canvasPlatformLayer equals platformLayer. > - m_canvasNeedsDestroy = true; > - m_canvasNeedsCreate = true; > - } > + m_canvasState |= RecreateCanvas; I would use a bracket here for clarity.
Kalyan
Comment 18 2013-01-17 15:17:44 PST
Kalyan
Comment 19 2013-01-17 15:18:53 PST
(In reply to comment #17) > (From update of attachment 182881 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=182881&action=review > > You maintain m_canvasState even if USE(GRAPHICS_SURFACE) is false. You never use the value in that case. > It looks like something is wrong with the #ifdef. fixed. > > Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics > > + m_canvasState |= RecreateCanvas; > > I would use a bracket here for clarity. done.
Benjamin Poulain
Comment 20 2013-01-17 21:33:03 PST
Comment on attachment 183296 [details] patchv6 View in context: https://bugs.webkit.org/attachment.cgi?id=183296&action=review Better but you still have an unused variable without the USE() > Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp:127 > + , m_canvasState(0) This should be in a #ifdef block for USE(GRAPHICS_SURFACE) > Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h:256 > + unsigned m_canvasState; This should be in the block USE(GRAPHICS_SURFACE) above.
Kalyan
Comment 21 2013-01-18 07:22:34 PST
Kalyan
Comment 22 2013-01-18 07:28:33 PST
(In reply to comment #20) > (From update of attachment 183296 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=183296&action=review > > This should be in the block USE(GRAPHICS_SURFACE) above. done.
Kenneth Rohde Christiansen
Comment 23 2013-01-18 07:30:51 PST
Comment on attachment 183449 [details] patchv7 View in context: https://bugs.webkit.org/attachment.cgi?id=183449&action=review > Source/WebKit2/ChangeLog:11 > + is later used to either create or delete the canvas. The issue seems > + to be that we mark a canvas for deletion even though it has not "seems" that doesn't make me confident in the patch > Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp:333 > + if (!platformLayer) { > + m_canvasState |= DestroyCanvas; > + m_canvasState &= ~CreateCanvas; this sounds more like a pending operation to me than a state > Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h:174 > + enum CanvasState { > + CreateCanvas = 0x01, > + ValidCanvas = 0x02, > + DestroyCanvas = 0x04, > + RecreateCanvas = CreateCanvas | DestroyCanvas > + }; This seems a bit confusing to me... like mixing "create" with "valid"
Kalyan
Comment 24 2013-01-19 01:03:40 PST
Kalyan
Comment 25 2013-01-19 01:10:26 PST
(In reply to comment #23) > (From update of attachment 183449 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=183449&action=review > "seems" that doesn't make me confident in the patch fixed the changelog. /CoordinatedGraphicsLayer.h:174 > > + enum CanvasState { > > + CreateCanvas = 0x01, > > + ValidCanvas = 0x02, > > + DestroyCanvas = 0x04, > > + RecreateCanvas = CreateCanvas | DestroyCanvas > > + }; > > This seems a bit confusing to me... like mixing "create" with "valid" Renamed the enum to PendingCanvasOperation, this would keep track of any pending canvas operations. A valid canvas (i.e Canvas creation request has been issued) is tracked separately.
Kalyan
Comment 26 2013-01-22 20:11:52 PST
Kalyan
Comment 27 2013-01-22 20:17:43 PST
(In reply to comment #26) > Created an attachment (id=184115) [details] > patchv9 Added a layout test to reproduce the issue. For completeness, removed m_canvasNeedsDisplay usage and made it part of PendingCanvasOperation.
Benjamin Poulain
Comment 28 2013-01-22 20:25:36 PST
Comment on attachment 184115 [details] patchv9 View in context: https://bugs.webkit.org/attachment.cgi?id=184115&action=review > LayoutTests/fast/canvas/webgl/canvas-resize-crash.html:12 > +description('Test Canvas resize.'); I'd be a little more descriptive. > LayoutTests/fast/canvas/webgl/canvas-resize-crash.html:20 > + // change the size of the canvas's backing store to match the size it is displayed. Uppercase C. > LayoutTests/fast/canvas/webgl/canvas-resize-crash.html:25 > + canvas.width = canvas.clientWidth; > + canvas.height = canvas.clientHeight; No need to force a relayout here? > Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp:122 > + , m_validCanvas(false) This is not a great name for a boolean.
WebKit Review Bot
Comment 29 2013-01-22 21:24:20 PST
Comment on attachment 184115 [details] patchv9 Attachment 184115 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/16039937 New failing tests: fast/canvas/webgl/canvas-resize-crash.html platform/chromium/virtual/gpu/fast/canvas/webgl/canvas-resize-crash.html
Build Bot
Comment 30 2013-01-22 21:40:33 PST
Comment on attachment 184115 [details] patchv9 Attachment 184115 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/16063394 New failing tests: fast/canvas/webgl/canvas-resize-crash.html
WebKit Review Bot
Comment 31 2013-01-22 21:57:04 PST
Comment on attachment 184115 [details] patchv9 Attachment 184115 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/16038948 New failing tests: fast/canvas/webgl/canvas-resize-crash.html platform/chromium/virtual/gpu/fast/canvas/webgl/canvas-resize-crash.html
Kalyan
Comment 32 2013-01-23 20:06:02 PST
Created attachment 184386 [details] patchv10
Kalyan
Comment 33 2013-01-23 20:11:36 PST
(In reply to comment #28) > (From update of attachment 184115 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=184115&action=review > > I'd be a little more descriptive. > > Uppercase C. done > > Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp:122 > > + , m_validCanvas(false) > > This is not a great name for a boolean. renamed it as m_isValidCanvas.
Kalyan
Comment 34 2013-01-23 21:00:23 PST
(In reply to comment #32) > Created an attachment (id=184386) [details] > patchv10 Test seems to fail with texdiff on some of the bots. Will update a new patch after looking into this issue.
Kalyan
Comment 35 2013-01-28 13:59:27 PST
Created attachment 185054 [details] patchv11 based on chromium test results
Kalyan
Comment 36 2013-01-28 15:37:00 PST
Created attachment 185084 [details] patchv12
Benjamin Poulain
Comment 37 2013-01-29 13:50:02 PST
Comment on attachment 185084 [details] patchv12 Okay, everything looks good to me. I sign off on this for WebKit2. Noam already r+ed on his side so let's go with this.
WebKit Review Bot
Comment 38 2013-01-29 22:53:02 PST
Comment on attachment 185084 [details] patchv12 Rejecting attachment 185084 [details] from commit-queue. Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '--bot-id=gce-cq-04', 'apply-attachment', '--no-update', '--non-interactive', 185084, '--port=chromium-xvfb']" exit_code: 2 cwd: /mnt/git/webkit-commit-queue Last 500 characters of output: oordinatedGraphics/CoordinatedGraphicsLayer.h Hunk #1 FAILED at 166. Hunk #2 succeeded at 190 (offset 6 lines). Hunk #3 succeeded at 198 (offset 6 lines). Hunk #4 succeeded at 227 (offset 6 lines). 1 out of 4 hunks FAILED -- saving rejects to file Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h.rej Failed to run "[u'/mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply', '--force', '--reviewer', 'Benjamin Poulain']" exit_code: 1 cwd: /mnt/git/webkit-commit-queue Full output: http://queues.webkit.org/results/16218340
Kalyan
Comment 39 2013-01-30 00:19:03 PST
Created attachment 185413 [details] rebasedpatch
Noam Rosenthal
Comment 40 2013-01-30 01:38:23 PST
(In reply to comment #39) > Created an attachment (id=185413) [details] > rebasedpatch Is this up for review?
Kalyan
Comment 41 2013-01-30 03:31:23 PST
(In reply to comment #40) > (In reply to comment #39) > > Created an attachment (id=185413) [details] [details] > > rebasedpatch > Is this up for review? Put it up for cq. Patch has been reviewed already. Had a discussion with noam and he was k with it.
WebKit Review Bot
Comment 42 2013-01-30 03:58:14 PST
Comment on attachment 185413 [details] rebasedpatch Clearing flags on attachment: 185413 Committed r141247: <http://trac.webkit.org/changeset/141247>
WebKit Review Bot
Comment 43 2013-01-30 03:58:20 PST
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.