-
Notifications
You must be signed in to change notification settings - Fork 41
DVR reencode: guarantee <4GB physical placement for RGA-touched buffers #143
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| #pragma once | ||
| /** | ||
| * mem_info.h | ||
| * | ||
| * Gate for the DVR-reencode CONTIG/CMA buffer workaround (see | ||
| * frame_processor.cpp and frame_colorcorrect.cpp): RGA2's MMU can only | ||
| * address physical memory below 4GB, and a kernel bug in the Rockchip GEM | ||
| * allocator (the __GFP_DMA32 safety flag is only ever applied under | ||
| * CONFIG_ARM_LPAE, a 32-bit-only Kconfig symbol never set on this arm64 | ||
| * kernel) means a buffer can silently land above that boundary on board | ||
| * variants with >=4GB RAM. On the 1GB variant no buffer can ever | ||
| * physically be placed above 4GB, so forcing CMA allocation there would | ||
| * only add memory pressure for zero benefit -- gate on actual installed | ||
| * RAM rather than a compile-time board flag so one binary is correct on | ||
| * both variants. | ||
| */ | ||
|
|
||
| #include <cstdio> | ||
|
|
||
| inline bool platform_has_large_ram() { | ||
| FILE *f = fopen("/proc/meminfo", "r"); | ||
| if (!f) return false; | ||
| char line[256]; | ||
| unsigned long kb = 0; | ||
| bool found = false; | ||
| while (fgets(line, sizeof(line), f)) { | ||
| if (sscanf(line, "MemTotal: %lu kB", &kb) == 1) { found = true; break; } | ||
| } | ||
| fclose(f); | ||
| // Wide margin between the ~1GB and ~4GB board variants -- this only | ||
| // needs to land on the right side, not find a precise boundary. | ||
| return found && kb > 2ul * 1024 * 1024; | ||
| } |
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 |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #pragma once | ||
| /** | ||
| * rockchip_bo.h | ||
| * | ||
| * Rockchip vendor extension to struct drm_mode_create_dumb.flags (normally | ||
| * "must be zero"), from include/uapi/drm/rockchip_drm.h -- not shipped in | ||
| * this build's sysroot, so mirrored here. ROCKCHIP_BO_CONTIG requests | ||
| * CMA-backed allocation, guaranteed to sit below the 4GB physical boundary | ||
| * RGA2's MMU can address; see mem_info.h for why that matters. | ||
| */ | ||
|
|
||
| #include <cstdint> | ||
|
|
||
| static constexpr uint32_t ROCKCHIP_BO_CONTIG = 1u << 0; |
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.
Uh oh!
There was an error while loading. Please reload this page.