-
Notifications
You must be signed in to change notification settings - Fork 8.4k
drivers: display: Change display buffer pitch from pixel to byte #100749
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
base: main
Are you sure you want to change the base?
drivers: display: Change display buffer pitch from pixel to byte #100749
Conversation
The `pitch` in `struct display_buffer_descriptor` is defined as "Number of pixels between consecutive rows in the data buffer". Limitation: Some display controller needs the pitch of byte be dividable by an even value (e.g., 4, 64, ...), if the parameter pitch here is the number of pixels, then the RGB888 (3 bytes per pixel) can't work Change the unit of `pitch` from pixel to byte Signed-off-by: Jason Yu <[email protected]>
The `pitch` in `struct display_buffer_descriptor` is changed from "Number of pixels between consecutive rows in the data buffer" to "Number of bytes between consecutive rows in the data buffer". Update the display controller drivers and samples accordingly. Signed-off-by: Jason Yu <[email protected]>
|
|
Thanks, I support this initiative, will try to do a review and testing. |
| static struct co5300_data co5300_data_##node_id = { \ | ||
| .pixel_format = DT_INST_PROP(node_id, pixel_format), \ | ||
| .frame_ptr = CO5300_FRAMEBUFFER(node_id), \ | ||
| .frame_pitch = ROUND_UP(DT_INST_PROP(node_id, width), \ |
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.
Do not delete this, frame pitch needs a initial value after system init
|
|
||
| /* Advance source pointer and decrement remaining */ | ||
| if (local_desc.pitch > local_desc.width) { | ||
| if (local_desc.pitch > local_desc.width * data->bytes_per_pixel) { |
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.
local_desc.pitch > (local_desc.width * data->bytes_per_pixel)?
| LCDIF_SetFrameBufferConfig(config->base, 0, &fbConfig); | ||
|
|
||
| if (bytes_per_pixel == 3U) { | ||
| /* For RGB888 the stride shall be calculated as |
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.
For pitch in bytes it shall follow the same law here
| .buf_size = (w * h) / 8U, | ||
| .width = w, | ||
| .pitch = w, | ||
| .pitch = DIV_ROUND_UP(w, 8), |
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.
Need to updatelvgl_display_16bit/24bit/32bit as well?
| } | ||
|
|
||
| buf_desc.pitch = ROUND_UP(rect_w, CONFIG_SAMPLE_PITCH_ALIGN); | ||
| switch (capabilities.current_pixel_format) { |
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.
May be separate a function?



The
pitchinstruct display_buffer_descriptoris defined as "Number of pixels between consecutive rows in the data buffer".Limitation:
Some display controller needs the pitch of byte be dividable by an even value (e.g., 4, 64, ...), if the parameter pitch here is the number of pixels, then the RGB888 (3 bytes per pixel) can't work
Change the unit of
pitchfrom pixel to byte.For easy review: