-
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
Draft
zejiang0jason
wants to merge
2
commits into
zephyrproject-rtos:main
Choose a base branch
from
nxp-upstream:display_buffer_pitch_pixel_to_byte
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+252
−187
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,7 @@ | |
| uint16_t panel_height; | ||
| uint16_t channel; | ||
| uint16_t num_of_lanes; | ||
| uint16_t frame_pitch_align; /* Pitch alignment requirement, in bytes. */ | ||
| }; | ||
|
|
||
| struct co5300_data { | ||
|
|
@@ -46,7 +47,7 @@ | |
| struct k_sem tear_effect_sem; | ||
| /* Pointer to framebuffer */ | ||
| uint8_t *frame_ptr; | ||
| uint32_t frame_pitch; | ||
| uint32_t frame_pitch; /* Pitch in bytes. */ | ||
| }; | ||
|
|
||
| /* Organized as MIPI_CMD | SIZE OF MIPI PARAM | MIPI PARAM */ | ||
|
|
@@ -108,12 +109,12 @@ | |
|
|
||
| /* Copy the update area to the framebuffer */ | ||
| src = buf; | ||
| dst = data->frame_ptr + (y * data->frame_pitch * data->bytes_per_pixel) | ||
| dst = data->frame_ptr + (y * data->frame_pitch) | ||
| + (x * data->bytes_per_pixel); | ||
| for (uint16_t row = 0; row < desc->height; row++) { | ||
| memcpy(dst, src, desc->width * data->bytes_per_pixel); | ||
| src += desc->pitch * data->bytes_per_pixel; | ||
| dst += data->frame_pitch * data->bytes_per_pixel; | ||
| src += desc->pitch; | ||
| dst += data->frame_pitch; | ||
| } | ||
|
|
||
| /* | ||
|
|
@@ -139,7 +140,7 @@ | |
| local_desc->height = ROUND_UP(local_desc->height, 2U); | ||
| local_desc->pitch = data->frame_pitch; | ||
| local_desc->frame_incomplete = desc->frame_incomplete; | ||
| local_desc->buf_size = local_desc->width * local_desc->height * data->bytes_per_pixel; | ||
| local_desc->buf_size = local_desc->pitch * local_desc->height; | ||
| } | ||
|
|
||
| static int co5300_write(const struct device *dev, | ||
|
|
@@ -222,7 +223,7 @@ | |
|
|
||
| /* Start memory write. */ | ||
| /* The address and the total pixel size of the updated area. */ | ||
| src = data->frame_ptr + (local_y * data->frame_pitch * data->bytes_per_pixel) | ||
| src = data->frame_ptr + (local_y * data->frame_pitch) | ||
| + (local_x * data->bytes_per_pixel); | ||
| tx_size = local_desc.buf_size; | ||
|
|
||
|
|
@@ -246,11 +247,11 @@ | |
| } | ||
|
|
||
| /* Advance source pointer and decrement remaining */ | ||
| if (local_desc.pitch > local_desc.width) { | ||
| if (local_desc.pitch > local_desc.width * data->bytes_per_pixel) { | ||
| total_bytes_sent += bytes_written; | ||
| src += bytes_written + total_bytes_sent / | ||
| (local_desc.width * data->bytes_per_pixel) * | ||
| ((local_desc.pitch - local_desc.width) * data->bytes_per_pixel); | ||
| (local_desc.pitch - local_desc.width * data->bytes_per_pixel); | ||
| } else { | ||
| src += bytes_written; | ||
| } | ||
|
|
@@ -342,6 +343,7 @@ | |
| /* Update the format in the device data after DCS command succeeds. */ | ||
| data->bytes_per_pixel = bytes_per_pixel; | ||
| data->pixel_format = mipi_pixel_format; | ||
| data->frame_pitch = ROUND_UP(config->panel_width * bytes_per_pixel, config->frame_pitch_align); | ||
|
Check warning on line 346 in drivers/display/display_co5300.c
|
||
|
|
||
| return 0; | ||
| } | ||
|
|
@@ -552,13 +554,12 @@ | |
| .tear_effect_gpios = GPIO_DT_SPEC_INST_GET_OR(node_id, tear_effect_gpios, {0}), \ | ||
| .panel_width = DT_INST_PROP(node_id, width), \ | ||
| .panel_height = DT_INST_PROP(node_id, height), \ | ||
| .frame_pitch_align = DT_INST_PROP_OR(node_id, pitch_align, 1), \ | ||
| }; \ | ||
| CO5300_FRAMEBUFFER_DECL(node_id); \ | ||
| 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), \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| DT_INST_PROP(node_id, pitch_align)), \ | ||
| }; \ | ||
| DEVICE_DT_INST_DEFINE(node_id, \ | ||
| &co5300_init, \ | ||
|
|
||
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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)?