Repository navigation
mgras: decode a PIO readback pixel once, not once per byte - #802
Open
jamesbraid wants to merge 1 commit into
Open
jamesbraid wants to merge 1 commit into
jamesbraid wants to merge 1 commit into
Conversation
pio_doubleword built each doubleword from eight line_byte calls. Each call re-read and re-decoded its pixel, and for RGB(A) PIO order and the generic formats it also allocated a Vec to pick one byte out of it. An RGBA pixel was decoded four times with four allocations. Decode a pixel into a stack buffer (pixel_bytes) and serve the doubleword's bytes from it, re-decoding only when the doubleword moves to the next pixel. get_line shares pixel_bytes for the non-generic formats; host_comp and host_pixel write into a caller's array instead of pushing onto a Vec. The largest pixel is four 32-bit components, 16 bytes. Per doubleword, best of five over a 1280x1024 block, ignored test bench_pio_readback, release build with the default (loop) profile, same machine, before -> after: RGBA, GL order 468 ns -> 112 ns (307 ms -> 73 ms per frame) RGBA, X server order 150 ns -> 55 ns ( 98 ms -> 36 ms per frame) CI8 147 ns -> 158 ns ( 24 ms -> 26 ms per frame) RGBA readback is about 4x faster in GL order and 2.7x in X server order. CI8 decodes one byte per pixel either way and is about 6% slower (an independent rerun, 14 paired rounds, gave +5 to 6%: about 2 ms a frame, against 230 ms saved on an RGBA frame); a CI8 fast path gained nothing. The loop profile is not timing evidence for absolute numbers. readback_bytes_are_stable_for_every_format pins the bytes: it reads a known framebuffer back by PIO and DMA in every format and type, both RGB orders, both 12-bit and 24-bit pixels, and with row padding, and hashes the lot. The hash was taken on the code before this change and is unchanged after it. Fixes: c673ae3 ("mgras: GE pixel pipeline HLE; raster transfer formats by type")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pio_doubleword built each doubleword from eight line_byte calls. Each
call re-read and re-decoded its pixel, and for RGB(A) PIO order and the
generic formats it also allocated a Vec to pick one byte out of it. An
RGBA pixel was decoded four times with four allocations.
Decode a pixel into a stack buffer (pixel_bytes) and serve the
doubleword's bytes from it, re-decoding only when the doubleword moves
to the next pixel. get_line shares pixel_bytes for the non-generic
formats; host_comp and host_pixel write into a caller's array instead of
pushing onto a Vec. The largest pixel is four 32-bit components, 16
bytes.
Per doubleword, best of five over a 1280x1024 block, ignored test
bench_pio_readback, release build with the default (loop) profile, same
machine, before -> after:
RGBA, GL order 468 ns -> 112 ns (307 ms -> 73 ms per frame)
RGBA, X server order 150 ns -> 55 ns ( 98 ms -> 36 ms per frame)
CI8 147 ns -> 158 ns ( 24 ms -> 26 ms per frame)
RGBA readback is about 4x faster in GL order and 2.7x in X server order.
CI8 decodes one byte per pixel either way and is about 6% slower (an
independent rerun, 14 paired rounds, gave +5 to 6%: about 2 ms a frame,
against 230 ms saved on an RGBA frame); a CI8 fast path gained nothing.
The loop profile is not timing evidence for absolute numbers.
readback_bytes_are_stable_for_every_format pins the bytes: it reads a
known framebuffer back by PIO and DMA in every format and type, both
RGB orders, both 12-bit and 24-bit pixels, and with row padding, and
hashes the lot. The hash was taken on the code before this change and
is unchanged after it.
Fixes: c673ae3 ("mgras: GE pixel pipeline HLE; raster transfer formats by type")