WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
170608
ImageDiff: Add CG implementation for new ImageDiff
https://bugs.webkit.org/show_bug.cgi?id=170608
Summary
ImageDiff: Add CG implementation for new ImageDiff
Carlos Garcia Campos
Reported
2017-04-07 11:47:26 PDT
In
bug #85299
there's a patch to move GTK+ port to use a cairo only image diff. While working on it I realized we have 3 implementations with a lot of duplicated code, so as part of the patch I refactored the code to share all the common code. On top of that patch adding the CG implementations is easy.
Attachments
Patch
(26.14 KB, patch)
2017-04-07 11:50 PDT
,
Carlos Garcia Campos
no flags
Details
Formatted Diff
Diff
Rebased patch
(26.08 KB, patch)
2017-04-10 04:50 PDT
,
Carlos Garcia Campos
no flags
Details
Formatted Diff
Diff
Rebased patch
(26.08 KB, patch)
2017-04-10 05:55 PDT
,
Carlos Garcia Campos
no flags
Details
Formatted Diff
Diff
Fix debug build
(26.06 KB, patch)
2017-04-11 06:08 PDT
,
Carlos Garcia Campos
no flags
Details
Formatted Diff
Diff
Include win changes
(40.34 KB, patch)
2017-04-11 07:00 PDT
,
Carlos Garcia Campos
bfulgham
: review+
commit-queue
: commit-queue-
Details
Formatted Diff
Diff
Rebased patch
(39.44 KB, patch)
2017-05-09 06:36 PDT
,
Carlos Garcia Campos
achristensen
: review+
buildbot
: commit-queue-
Details
Formatted Diff
Diff
Archive of layout-test-results from ews122 for ios-simulator-wk2
(8.05 MB, application/zip)
2017-05-09 08:43 PDT
,
Build Bot
no flags
Details
Rebase again after r216504
(39.48 KB, patch)
2017-05-09 08:46 PDT
,
Carlos Garcia Campos
no flags
Details
Formatted Diff
Diff
Try to fix win build
(40.32 KB, patch)
2017-05-09 09:06 PDT
,
Carlos Garcia Campos
no flags
Details
Formatted Diff
Diff
Try to fix win build
(40.41 KB, patch)
2017-05-09 10:15 PDT
,
Carlos Garcia Campos
no flags
Details
Formatted Diff
Diff
Show Obsolete
(9)
View All
Add attachment
proposed patch, testcase, etc.
Carlos Garcia Campos
Comment 1
2017-04-07 11:50:40 PDT
Created
attachment 306522
[details]
Patch
Carlos Garcia Campos
Comment 2
2017-04-10 04:50:59 PDT
Created
attachment 306683
[details]
Rebased patch
Carlos Garcia Campos
Comment 3
2017-04-10 05:55:50 PDT
Created
attachment 306687
[details]
Rebased patch
Carlos Garcia Campos
Comment 4
2017-04-10 07:02:55 PDT
hmm, the debug failure is because of the ASSERT, doesn't image diff link to WTF already? or am I missing a header include? I can easily fix the build by removing the ASSERT, I guess.
Carlos Garcia Campos
Comment 5
2017-04-11 06:08:12 PDT
Created
attachment 306807
[details]
Fix debug build I have no idea why it fails to build so I've just removed the assert.
Carlos Garcia Campos
Comment 6
2017-04-11 07:00:04 PDT
Created
attachment 306812
[details]
Include win changes I've realized that the patch would break windows, because it removes the ImageDiffCG from DRT. So, this new patch also includes the windows changed that was going to do in a follow up patch. I have no way to test windows changes, so I don't know whether it works or not.
Build Bot
Comment 7
2017-04-11 07:01:39 PDT
Attachment 306812
[details]
did not pass style-queue: ERROR: Tools/ImageDiff/cg/PlatformImageCG.cpp:36: Alphabetical sorting problem. [build/include_order] [4] ERROR: Tools/ImageDiff/cg/PlatformImageCG.cpp:37: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 2 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Carlos Garcia Campos
Comment 8
2017-04-21 01:49:39 PDT
Ping reviewers
Brent Fulgham
Comment 9
2017-04-21 12:39:49 PDT
This builds and seems to work locally.
Brent Fulgham
Comment 10
2017-04-21 12:40:56 PDT
Comment on
attachment 306812
[details]
Include win changes Looks good, and works properly on Windows (at least locally). Let's land it.
Carlos Garcia Campos
Comment 11
2017-04-22 00:37:07 PDT
(In reply to Brent Fulgham from
comment #10
)
> Comment on
attachment 306812
[details]
> Include win changes > > Looks good, and works properly on Windows (at least locally). Let's land it.
Thanks! I hope it also works in WinCairo . . .
WebKit Commit Bot
Comment 12
2017-04-22 01:07:01 PDT
Comment on
attachment 306812
[details]
Include win changes Rejecting
attachment 306812
[details]
from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-03', 'build', '--no-clean', '--no-update', '--build-style=release', '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit Last 500 characters of output: eC /Volumes/Data/EWS/WebKit/WebKitBuild/DumpRenderTree.build/Release/ImageDiff.build/Objects-normal/x86_64/PlatformImage.o /Volumes/Data/EWS/WebKit/Tools/ImageDiff/PlatformImage.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler CompileC /Volumes/Data/EWS/WebKit/WebKitBuild/DumpRenderTree.build/Release/ImageDiff.build/Objects-normal/x86_64/ImageDiff.o /Volumes/Data/EWS/WebKit/Tools/ImageDiff/ImageDiff.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (2 failures) Full output:
http://webkit-queues.webkit.org/results/3582981
Carlos Garcia Campos
Comment 13
2017-04-22 01:26:57 PDT
(In reply to WebKit Commit Bot from
comment #12
)
> Comment on
attachment 306812
[details]
> Include win changes > > Rejecting
attachment 306812
[details]
from commit-queue. > > Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', > '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-03', 'build', > '--no-clean', '--no-update', '--build-style=release', '--port=mac']" > exit_code: 2 cwd: /Volumes/Data/EWS/WebKit > > Last 500 characters of output: > eC > /Volumes/Data/EWS/WebKit/WebKitBuild/DumpRenderTree.build/Release/ImageDiff. > build/Objects-normal/x86_64/PlatformImage.o > /Volumes/Data/EWS/WebKit/Tools/ImageDiff/PlatformImage.cpp normal x86_64 c++ > com.apple.compilers.llvm.clang.1_0.compiler > CompileC > /Volumes/Data/EWS/WebKit/WebKitBuild/DumpRenderTree.build/Release/ImageDiff. > build/Objects-normal/x86_64/ImageDiff.o > /Volumes/Data/EWS/WebKit/Tools/ImageDiff/ImageDiff.cpp normal x86_64 c++ > com.apple.compilers.llvm.clang.1_0.compiler > (2 failures) > > Full output:
http://webkit-queues.webkit.org/results/3582981
#include <WebCore/PlatformExportMacros.h> ^ 1 error generated. I have no idea why this is failing to build now.
Carlos Garcia Campos
Comment 14
2017-04-26 23:49:05 PDT
(In reply to Carlos Garcia Campos from
comment #13
)
> (In reply to WebKit Commit Bot from
comment #12
) > > Comment on
attachment 306812
[details]
> > Include win changes > > > > Rejecting
attachment 306812
[details]
from commit-queue. > > > > Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', > > '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-03', 'build', > > '--no-clean', '--no-update', '--build-style=release', '--port=mac']" > > exit_code: 2 cwd: /Volumes/Data/EWS/WebKit > > > > Last 500 characters of output: > > eC > > /Volumes/Data/EWS/WebKit/WebKitBuild/DumpRenderTree.build/Release/ImageDiff. > > build/Objects-normal/x86_64/PlatformImage.o > > /Volumes/Data/EWS/WebKit/Tools/ImageDiff/PlatformImage.cpp normal x86_64 c++ > > com.apple.compilers.llvm.clang.1_0.compiler > > CompileC > > /Volumes/Data/EWS/WebKit/WebKitBuild/DumpRenderTree.build/Release/ImageDiff. > > build/Objects-normal/x86_64/ImageDiff.o > > /Volumes/Data/EWS/WebKit/Tools/ImageDiff/ImageDiff.cpp normal x86_64 c++ > > com.apple.compilers.llvm.clang.1_0.compiler > > (2 failures) > > > > Full output:
http://webkit-queues.webkit.org/results/3582981
> > #include <WebCore/PlatformExportMacros.h> > ^ > 1 error generated. > > I have no idea why this is failing to build now.
Could someone help me with this? I don't know why this is failing now. It worked for me locally and in EWS, but now it's failing, and I don't know what have changed since then.
Alex Christensen
Comment 15
2017-04-27 11:07:47 PDT
It builds fine for me locally, and EWS liked it. I'd say commit it and see what happens. I'm not sure why the commit queue didn't like it.
Carlos Garcia Campos
Comment 16
2017-04-27 22:34:25 PDT
(In reply to Alex Christensen from
comment #15
)
> It builds fine for me locally, and EWS liked it. I'd say commit it and see > what happens. I'm not sure why the commit queue didn't like it.
The thing is that I tried yesterday in a mac and got the same error than EWS.
Carlos Garcia Campos
Comment 17
2017-05-09 04:05:20 PDT
I'm trying to rebase this patch now that ImageDiff has been moved from DRT to its own project, but I don't see the ImageDiff now in Xcode to do the changes. Is there any magic I need to do in Xcode for the new project to show up?
Carlos Garcia Campos
Comment 18
2017-05-09 05:27:33 PDT
Manually adding a new group to WebKit.xcworkspace/contents.xcworkspacedata made it appear in XCode.
Carlos Garcia Campos
Comment 19
2017-05-09 06:36:34 PDT
Created
attachment 309491
[details]
Rebased patch
Build Bot
Comment 20
2017-05-09 06:38:32 PDT
Attachment 309491
[details]
did not pass style-queue: ERROR: Tools/ImageDiff/cg/PlatformImageCG.cpp:27: Found header this file implements before WebCore config.h. Should be: config.h, primary header, blank line, and then alphabetically sorted. [build/include_order] [4] ERROR: Tools/ImageDiff/cg/PlatformImageCG.cpp:36: Alphabetical sorting problem. [build/include_order] [4] ERROR: Tools/ImageDiff/cg/PlatformImageCG.cpp:37: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 3 in 9 files If any of these errors are false positives, please file a bug against check-webkit-style.
Build Bot
Comment 21
2017-05-09 08:43:25 PDT
Comment on
attachment 309491
[details]
Rebased patch
Attachment 309491
[details]
did not pass ios-sim-ews (ios-simulator-wk2): Output:
http://webkit-queues.webkit.org/results/3705722
New failing tests: compositing/absolute-inside-out-of-view-fixed.html fast/forms/file/intrinsic-min-width-overrides-width.html
Build Bot
Comment 22
2017-05-09 08:43:27 PDT
Created
attachment 309498
[details]
Archive of layout-test-results from ews122 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews122 Port: ios-simulator-wk2 Platform: Mac OS X 10.11.6
Carlos Garcia Campos
Comment 23
2017-05-09 08:46:43 PDT
Created
attachment 309500
[details]
Rebase again after
r216504
Build Bot
Comment 24
2017-05-09 08:47:57 PDT
Attachment 309500
[details]
did not pass style-queue: ERROR: Tools/ImageDiff/cg/PlatformImageCG.cpp:27: Found header this file implements before WebCore config.h. Should be: config.h, primary header, blank line, and then alphabetically sorted. [build/include_order] [4] ERROR: Tools/ImageDiff/cg/PlatformImageCG.cpp:36: Alphabetical sorting problem. [build/include_order] [4] ERROR: Tools/ImageDiff/cg/PlatformImageCG.cpp:37: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 3 in 9 files If any of these errors are false positives, please file a bug against check-webkit-style.
Carlos Garcia Campos
Comment 25
2017-05-09 09:06:21 PDT
Created
attachment 309501
[details]
Try to fix win build
Build Bot
Comment 26
2017-05-09 09:09:38 PDT
Attachment 309501
[details]
did not pass style-queue: ERROR: Tools/ImageDiff/cg/PlatformImageCG.cpp:27: Found header this file implements before WebCore config.h. Should be: config.h, primary header, blank line, and then alphabetically sorted. [build/include_order] [4] ERROR: Tools/ImageDiff/cg/PlatformImageCG.cpp:36: Alphabetical sorting problem. [build/include_order] [4] ERROR: Tools/ImageDiff/cg/PlatformImageCG.cpp:37: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 3 in 10 files If any of these errors are false positives, please file a bug against check-webkit-style.
Alex Christensen
Comment 27
2017-05-09 09:58:28 PDT
Comment on
attachment 309491
[details]
Rebased patch View in context:
https://bugs.webkit.org/attachment.cgi?id=309491&action=review
r=me. There's room for improvement, but this is an improvement because it unites the code from the different platforms.
> Tools/ImageDiff/cg/PlatformImageCG.cpp:116 > +PlatformImage::PlatformImage(CGImageRef image) > + : m_image(image) > +{ > +} > + > +PlatformImage::~PlatformImage() > +{ > + CFRelease(m_image); > + free(m_buffer); > +}
I think it would be nicer to have the constructor call CFRetain and have the callers properly release their images. We shouldn't rely on the caller knowing that this object adopts it without any annotation. I guess it's just a small tool that nobody looks at often, but it should still make sense.
> Tools/ImageDiff/cg/PlatformImageCG.cpp:145 > + m_buffer = calloc(height, rowBytes);
It would be nice if we could use std::unique_ptr<uint8_t[]> or something so we could avoid all this manual memory management. Just glancing at this makes it hard to tell if we should check m_buffer for something already there and free it if there is.
Carlos Garcia Campos
Comment 28
2017-05-09 10:06:58 PDT
(In reply to Alex Christensen from
comment #27
)
> Comment on
attachment 309491
[details]
> Rebased patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=309491&action=review
> > r=me. There's room for improvement, but this is an improvement because it > unites the code from the different platforms.
Yes, I tried to keep existing code as mush as possible, just removing all the duplications.
> > Tools/ImageDiff/cg/PlatformImageCG.cpp:116 > > +PlatformImage::PlatformImage(CGImageRef image) > > + : m_image(image) > > +{ > > +} > > + > > +PlatformImage::~PlatformImage() > > +{ > > + CFRelease(m_image); > > + free(m_buffer); > > +} > > I think it would be nicer to have the constructor call CFRetain and have the > callers properly release their images. We shouldn't rely on the caller > knowing that this object adopts it without any annotation. I guess it's > just a small tool that nobody looks at often, but it should still make sense.
My previous patch used RetainPtr everywhere and the constructor received a &&, but then ImageDiff was made standalone and WTF dependency removed, so I had to go back to manually release everything as existing code does. Note that I'm not familiar with CG APIs.
> > Tools/ImageDiff/cg/PlatformImageCG.cpp:145 > > + m_buffer = calloc(height, rowBytes); > > It would be nice if we could use std::unique_ptr<uint8_t[]> or something so > we could avoid all this manual memory management. Just glancing at this > makes it hard to tell if we should check m_buffer for something already > there and free it if there is.
I agree, but again this is just moving existing code. We can add further improvements in follow up patches. I don't think we need to null check m_buffer since free is null safe and m_buffer is initialized to nullptr in the header.
Carlos Garcia Campos
Comment 29
2017-05-09 10:15:03 PDT
Created
attachment 309510
[details]
Try to fix win build
Build Bot
Comment 30
2017-05-09 10:17:27 PDT
Attachment 309510
[details]
did not pass style-queue: ERROR: Tools/ImageDiff/cg/PlatformImageCG.cpp:27: Found header this file implements before WebCore config.h. Should be: config.h, primary header, blank line, and then alphabetically sorted. [build/include_order] [4] ERROR: Tools/ImageDiff/cg/PlatformImageCG.cpp:36: Alphabetical sorting problem. [build/include_order] [4] ERROR: Tools/ImageDiff/cg/PlatformImageCG.cpp:37: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 3 in 10 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Commit Bot
Comment 31
2017-05-10 01:16:18 PDT
Comment on
attachment 309510
[details]
Try to fix win build Clearing flags on attachment: 309510 Committed
r216576
: <
http://trac.webkit.org/changeset/216576
>
WebKit Commit Bot
Comment 32
2017-05-10 01:16:20 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