Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement forced 16 bit screenmodes #715

Closed
wants to merge 1 commit into from

Conversation

ali1234
Copy link
Contributor

@ali1234 ali1234 commented Sep 15, 2021

You can set ScreenMode::lores_565 or ScreenMode::hires_565 to be
guaranteed a 16 bit framebuffer on every platform. On Pico, this
does exactly the same as the normal screenmodes.

You can set ScreenMode::lores_565 or ScreenMode::hires_565 to be
guaranteed a 16 bit framebuffer on every platform. On Pico, this
does exactly the same as the normal screenmodes.
@ali1234
Copy link
Contributor Author

ali1234 commented Sep 15, 2021

Why: 565 screenmodes have better performance because they are word aligned. The whole pixel can be read or written in a single memory access.

This is a bit hacky though. For some reason the RGB565 mode is BGR in SDL. On Blit it is RGB.

I have converted a few if/else blocks into switch statements. And I duplicated the flip functions in the 32blit HAL. I assume those are supposed to be as fast as possible.

@ali1234
Copy link
Contributor Author

ali1234 commented Sep 15, 2021

Also most of these files have a mixture of tabs and spaces, so I have not attempted to format the new code to match.

@ali1234
Copy link
Contributor Author

ali1234 commented Sep 15, 2021

Also I haven't tested the lores modes.

@Daft-Freak
Copy link
Collaborator

Also most of these files have a mixture of tabs and spaces, so I have not attempted to format the new code to match.

I think most of the 32blit code is two spaces (and some of the code is definitely going from 2 -> 4 here)

Looks like there's a R/B swap bit for DMA2D if that helps with getting it consistent (DMA2D_OPFCCR_RBS)

@Daft-Freak
Copy link
Collaborator

Okay yeah, I see what you mean about it being RGB on the blit. I think the blit display is getting R/B swapped somewhere because the LTDC RGB888 mode is actually BGR... (Thought it was st7272a_set_bgr, but that's never called).

The important thing is that this all seems to work though.

@ali1234
Copy link
Contributor Author

ali1234 commented Sep 16, 2021

Yes, on blit I was surprised that it "just works" where as on SDL I had to tell it the buffer is BGR, even though on SDL the 24 bit buffer is declared as RGB.

@ali1234
Copy link
Contributor Author

ali1234 commented Sep 22, 2021

I need to make a test program before I'll really trust this...

@ali1234
Copy link
Contributor Author

ali1234 commented Jan 6, 2022

Replaced by #730

@ali1234 ali1234 closed this Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants