-
Notifications
You must be signed in to change notification settings - Fork 84
drm/phytium: Fix some Bugs in Phytium Display Engine #753
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
Reviewer's Guide by SourceryThe pull request refactors the Phytium Display Engine driver to add support for display scaling, introduce specific handling for BMC mode (including disabling the cursor plane and using different primary formats), and change backlight/panel power control to use PWM and GPIO instead of command registers. It also includes architecture-specific FPU handling and various minor fixes. No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
Hey @xuyan213 - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider refactoring duplicated code sections, such as the platform initialization and DC reset logic.
- Explore using standard kernel APIs for the scaling calculations instead of custom floating-point math and manual FPU/NEON handling.
- Review the placement and necessity of the architecture-specific FPU/NEON conditional compilation added in multiple files.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
uint32_t dst_size, | ||
struct filter_blit_array *kernel_info) | ||
{ | ||
uint32_t scale_factor; |
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.
issue (complexity): Consider extracting the weight computation and normalization loops in dc_calculate_sync_table()
into a separate helper function to improve readability and maintainability.
It might help to extract parts of the inner loops from dc_calculate_sync_table()
into separate helper functions. For example, consider moving the weight computation and normalization (the two inner loops) into a helper like:
static void compute_kernel_weights(float *fSubpixelSet, uint16_t *kernel_array,
int kernel_half, int kernelSize, float f_subpixel_offset, float f_scale) {
float fWeightSum = 0.0f;
int kernel_pos, index;
int padding = (MAXKERNELSIZE - kernelSize) / 2;
for (kernel_pos = 0; kernel_pos < MAXKERNELSIZE; kernel_pos++) {
index = kernel_pos - padding;
if (index < 0 || index >= kernelSize) {
fSubpixelSet[kernel_pos] = 0.0f;
} else if (kernelSize == 1) {
fSubpixelSet[kernel_pos] = 1.0f;
} else {
float fX = MATH_Add(MATH_I2Float(index - kernel_half), f_subpixel_offset);
fX = MATH_Multiply(fX, f_scale);
fSubpixelSet[kernel_pos] = dc_sinc_filter(fX, kernel_half);
}
fWeightSum = MATH_Add(fWeightSum, fSubpixelSet[kernel_pos]);
}
for (kernel_pos = 0; kernel_pos < MAXKERNELSIZE; kernel_pos++) {
float fWeight = MATH_Divide(fSubpixelSet[kernel_pos], fWeightSum);
if (fWeight == 0.0f)
kernel_array[kernel_pos] = 0x0000;
else if (fWeight >= 1.0f)
kernel_array[kernel_pos] = 0x4000;
else if (fWeight <= -1.0f)
kernel_array[kernel_pos] = 0xC000;
else
kernel_array[kernel_pos] = (int16_t) MATH_Multiply(fWeight, 16384.0f);
}
}
Then, in dc_calculate_sync_table()
you simply call this helper inside your subpixel loop:
for (subpixel_pos = 0; subpixel_pos < SUBPIXELLOADCOUNT; subpixel_pos++) {
float fSubpixelSet[MAXKERNELSIZE];
compute_kernel_weights(fSubpixelSet, kernel_array, kernel_half,
kernel_info->kernelSize, f_subpixel_offset, f_scale);
/* ... remaining adjustments and table update ... */
kernel_array += MAXKERNELSIZE;
f_subpixel_offset = MATH_Add(f_subpixel_offset, -f_subpixel_step);
}
This refactoring reduces nesting in the main function and isolates the weight computation logic, making it easier to maintain while preserving functionality.
/retest |
drivers/gpu/drm/phytium/Makefile
Outdated
@@ -16,3 +16,8 @@ phytium-dc-drm-y := phytium_display_drv.o \ | |||
|
|||
obj-$(CONFIG_DRM_PHYTIUM) += phytium-dc-drm.o | |||
CFLAGS_REMOVE_phytium_crtc.o += -mgeneral-regs-only | |||
ifeq ($(ARCH), x86) | |||
FPU_CFLAGS += -mhard-float |
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.
clang-19: error: unsupported option '-mhard-float' for target 'x86_64-linux-gnu'
/retest |
由于当前x86未开启phytium drm所以ci检测不出编译错误,clang的x86 target不支持-mhard-float |
drivers/gpu/drm/phytium/Makefile
Outdated
@@ -16,3 +16,12 @@ phytium-dc-drm-y := phytium_display_drv.o \ | |||
|
|||
obj-$(CONFIG_DRM_PHYTIUM) += phytium-dc-drm.o | |||
CFLAGS_REMOVE_phytium_crtc.o += -mgeneral-regs-only | |||
ifeq ($(ARCH), x86) | |||
ifeq ($(shell uname -m), x86_64) | |||
FPU_CFLAGS += |
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.
bb3406a
to
a1a1a15
Compare
modified this files to support Phytium Display Engine more. Signed-off-by: Xu Yan <[email protected]> Signed-off-by: Yang Xun <[email protected]> Signed-off-by: Chen Baozi <[email protected]> Signed-off-by: Wang Yinfeng <[email protected]>
6a4f1c9
into
deepin-community:linux-6.6.y
modified this files to support Phytium Display Engine more.
Summary by Sourcery
Add display scaling, BMC mode support, and PWM backlight control for Phytium display driver, along with various fixes and improvements.
New Features:
Bug Fixes:
Enhancements:
Build:
Chores: