| Summary: | [PATCH] video: Backport the fast paths for 24/32-bit blitting | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Cameron Cawley <ccawley2011> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | sezeroz, sylvain.becker |
| Version: | HG 1.2 | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: |
video: Backport the fast paths for 24/32-bit blitting
test-case for SDL-1.2 compare script test-case for SDL-1.2 compare script results file test-case for SDL-1.2 results file |
||
(In reply to Cameron Cawley from comment #0) > however I haven't done > extensive amounts of testing for all of the new paths. If you can do some more testing, I'd wait, say, a week or something. Hey, if you look at the bug 4503 There is a testcase, an image, and a script to compare. the testcase load a multi-color image, convert to all format and print some CRC for each step. if you run it before the patch to have a reference and after: the compare script will tell if it breaks anything and the speed improvements. (I think there was a few fix to add like ... https://hg.libsdl.org/SDL/rev/233b2a61cad1 https://hg.libsdl.org/SDL/rev/dff36de37426 ) maybe the format of SDL 1.2 are different and testcase should be adapted Has the patch received more testing? Created attachment 4515 [details]
test-case for SDL-1.2
Hello, I tried the test-case from the previous ticket, and there are much more differences that what I remembered of SDL-1.2.
So I ported it to SDL-1.2.
At least, it compiles and runs.
gcc fast_bench.c -Ibuild/include/SDL/ -Lbuild/lib -lSDL -lz -lcrypto
There are TODOs open:
- Need to use IMG_Load (instead of loadBMP) for a .png file, so that the image has an alpha channel for testing.
- Is there blending in SDL-1.2 ?
- Currently it has lots of pixel_format:
It takes all SDL2 pixel formats and copies them as SDL1 pixel formats.
Not sure if that are all relevant. ( BPP1 and BPP4 commented out )
It needs to be tested with the SDL-1.2 + patch
Created attachment 4516 [details]
compare script
The compare script hasn't changed much. I just updated to python3
(if needed:
- keys = db2.keys()
+ keys = list(db2.keys()) #python3
)
Usage:
./testcase.out test.png > ref1.txt
apply the patch
./testcase.out test.png > ref2.txt
python compare_blitlog.py ref1.txt ref2.txt
The image must be relevant. big enough to mesure the image processing time.
Multi color + alpha so that we have all corner cases.
various size odd/even, pitch padding.
After fixing a crash: https://hg.libsdl.org/SDL/rev/0bbdbc7b3ff2 I've just tested the patch, and all pixel format ARGB2101010 are failing. not sure if this is supported, but at there are not "unsupported()" neither ? Otherwise, there are improvements as expected: like BGRX8888 -> RGB24 with goes from 15 ms to 3 ms. and many others. Created attachment 4517 [details]
test-case for SDL-1.2
Update the test-case to remove ARGB2101010 and use IMG_Load from SDL_image
Created attachment 4518 [details]
compare script
Update the script to print the "faster/slower" indication
Created attachment 4519 [details]
results file
This my result file if you want to look at.
It shows where there are blit improvements.
(NB: there are a few irrelevant suspicious/slower conversion because blits at two fast in those cases.)
Created attachment 4521 [details]
test-case for SDL-1.2
Update the test-case to re-add the SDL_GetPerformanceCounter + some padding/memcheck.
Created attachment 4522 [details] results file This the results file which show the the speed improvements on 50 conversions. using the image "IMG_2476_ColorKey_very_small.png" from bug 4503 The results file looks ok to me, So I have committed the patch https://hg.libsdl.org/SDL/rev/e901fc96cf25 Sylvain: Thanks for marvelous work testing this! And thanks Cameron Cawley for the backport patch! Closing this as fixed. Closed as fixed. Thanks a lot for sorting this out! |
Created attachment 4484 [details] video: Backport the fast paths for 24/32-bit blitting This backports the optimized blitting code to SDL 1.2. This provides noticeable performance improvements in CSE2, however I haven't done extensive amounts of testing for all of the new paths.