-
Notifications
You must be signed in to change notification settings - Fork 53
Use a 512 bytes buffer for the fill operations #9
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
Conversation
adafruit_rgb_display/rgb.py
Outdated
@@ -80,7 +80,7 @@ def fill_rectangle(self, x, y, width, height, color): | |||
w = min(self.width - x, max(1, width)) | |||
h = min(self.height - y, max(1, height)) | |||
self._block(x, y, x + w - 1, y + h - 1, b'') | |||
chunks, rest = divmod(w * h, 512) | |||
chunks, rest = divmod(w * h, 256) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment explaining the buffer choice size?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved it into a constant and added explanation.
adafruit_rgb_display/rgb.py
Outdated
@@ -80,7 +80,7 @@ def fill_rectangle(self, x, y, width, height, color): | |||
w = min(self.width - x, max(1, width)) | |||
h = min(self.height - y, max(1, height)) | |||
self._block(x, y, x + w - 1, y + h - 1, b'') | |||
chunks, rest = divmod(w * h, 512) | |||
chunks, rest = divmod(w * h, 256) | |||
pixel = self._encode_pixel(color) | |||
if chunks: | |||
data = pixel * 512 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be 256 also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I should slow down a little.
Right now we are using 1024 bytes (512 16-bit pixels), and it doesn't really give us any speed advantage, since the DMA buffer is only 512 bytes anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Updating https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display to 3.0.0 from 2.0.1: > Merge pull request adafruit/Adafruit_CircuitPython_RGB_Display#10 from mrmcwethy/lint > Update to SSD1331 driver (adafruit/Adafruit_CircuitPython_RGB_Display#11) > Merge pull request adafruit/Adafruit_CircuitPython_RGB_Display#9 from deshipu/fix-small-buffer > Merge pull request adafruit/Adafruit_CircuitPython_RGB_Display#8 from deshipu/fix-readinto
Right now we are using 1024 bytes (512 16-bit pixels), and it doesn't
really give us any speed advantage, since the DMA buffer is only 512
bytes anyways.