-
Notifications
You must be signed in to change notification settings - Fork 14
video: driver: use global UBWC config on KLM platforms #100
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
Open
venvenk
wants to merge
1
commit into
qualcomm-linux:video.qclinux.main
Choose a base branch
from
venvenk:video.qclinux.main
base: video.qclinux.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.
Open
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
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,100 @@ | ||
| // SPDX-License-Identifier: GPL-2.0-only | ||
| /* | ||
| * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
| */ | ||
|
|
||
| #include <linux/err.h> | ||
| #include <linux/version.h> | ||
|
|
||
| #include "msm_vidc_platform.h" | ||
| #include "msm_vidc_debug.h" | ||
|
|
||
| #ifndef MSM_VIDC_HAS_QCOM_UBWC_HEADER | ||
| /* | ||
| * Downstream driver: enable if kernel provides global UBWC config database | ||
| * (include/linux/soc/qcom/ubwc.h with qcom_ubwc_config_get_data()). | ||
| */ | ||
| #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0) | ||
| #define MSM_VIDC_HAS_QCOM_UBWC_HEADER 1 | ||
| #else | ||
| #define MSM_VIDC_HAS_QCOM_UBWC_HEADER 0 | ||
| #endif | ||
| #endif | ||
|
|
||
| #if MSM_VIDC_HAS_QCOM_UBWC_HEADER | ||
| #include <linux/soc/qcom/ubwc.h> | ||
|
|
||
| static bool msm_vidc_qcom_ubwc_min_acc_length_64b( | ||
| const struct qcom_ubwc_cfg_data *cfg) | ||
| { | ||
| return cfg->ubwc_enc_version == UBWC_1_0 && | ||
| (cfg->ubwc_dec_version == UBWC_2_0 || | ||
| cfg->ubwc_dec_version == UBWC_3_0); | ||
| } | ||
|
|
||
| static bool msm_vidc_qcom_ubwc_macrotile_mode( | ||
| const struct qcom_ubwc_cfg_data *cfg) | ||
| { | ||
| return cfg->macrotile_mode; | ||
| } | ||
|
|
||
| static bool msm_vidc_qcom_ubwc_bank_spread( | ||
| const struct qcom_ubwc_cfg_data *cfg) | ||
| { | ||
| return cfg->ubwc_bank_spread; | ||
| } | ||
|
|
||
| static u32 msm_vidc_qcom_ubwc_swizzle( | ||
| const struct qcom_ubwc_cfg_data *cfg) | ||
| { | ||
| return cfg->ubwc_swizzle; | ||
| } | ||
|
|
||
| int msm_vidc_update_ubwc_config(struct msm_vidc_core *core) | ||
| { | ||
| const struct qcom_ubwc_cfg_data *ubwc_cfg; | ||
| struct msm_vidc_ubwc_config_data *ubwc_config; | ||
| u32 swizzle; | ||
|
|
||
| if (!core || !core->platform || !core->platform->data.ubwc_config) | ||
|
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. Defensive coding. Why? Can core be NULL here? |
||
| return 0; | ||
|
|
||
| ubwc_cfg = qcom_ubwc_config_get_data(); | ||
| if (IS_ERR(ubwc_cfg)) { | ||
| long rc = PTR_ERR(ubwc_cfg); | ||
|
|
||
| if (rc == -EINVAL) { | ||
| d_vpr_h("%s: no global UBWC config for this platform, using platform defaults\n", | ||
| __func__); | ||
| return 0; | ||
| } | ||
|
|
||
| d_vpr_e("%s: failed to get global UBWC config: %ld\n", | ||
| __func__, rc); | ||
| return rc; | ||
| } | ||
|
|
||
| ubwc_config = core->platform->data.ubwc_config; | ||
| swizzle = msm_vidc_qcom_ubwc_swizzle(ubwc_cfg); | ||
|
|
||
| ubwc_config->max_channels = | ||
| msm_vidc_qcom_ubwc_macrotile_mode(ubwc_cfg) ? 8 : 4; | ||
| ubwc_config->mal_length = | ||
| msm_vidc_qcom_ubwc_min_acc_length_64b(ubwc_cfg) ? 64 : 32; | ||
| ubwc_config->highest_bank_bit = ubwc_cfg->highest_bank_bit; | ||
| ubwc_config->bank_swzl_level = !!(swizzle & UBWC_SWIZZLE_ENABLE_LVL1); | ||
| ubwc_config->bank_swz2_level = !!(swizzle & UBWC_SWIZZLE_ENABLE_LVL2); | ||
| ubwc_config->bank_swz3_level = !!(swizzle & UBWC_SWIZZLE_ENABLE_LVL3); | ||
| ubwc_config->bank_spreading = | ||
| msm_vidc_qcom_ubwc_bank_spread(ubwc_cfg); | ||
|
|
||
| d_vpr_h("%s: global UBWC config applied\n", __func__); | ||
|
|
||
| return 0; | ||
| } | ||
| #else | ||
| int msm_vidc_update_ubwc_config(struct msm_vidc_core *core) | ||
| { | ||
| return 0; | ||
| } | ||
| #endif | ||
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 |
|---|---|---|
|
|
@@ -2154,5 +2154,6 @@ int msm_vidc_init_platform_monaco(struct msm_vidc_core *core) | |
| if (rc) | ||
| return rc; | ||
|
|
||
|
|
||
| return rc; | ||
| } | ||
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
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.
You definitely don't follow the reviews. Stop using
msm_vidc_ubwc_config_data, and switch toqcom_ubwc_cfg_data. Provide necessary kludges (and definitions) if the struct is not available (because of the kernel being too old).