Skip to content
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

[7.1.r1] drm/msm/sde: sde_hw_top: Fix UBWC version detection for SDM630 #2356

Draft
wants to merge 1 commit into
base: aosp/LA.UM.7.1.r1
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions drivers/gpu/drm/msm/sde/sde_hw_top.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,31 +387,36 @@ void sde_hw_reset_ubwc(struct sde_hw_mdp *mdp, struct sde_mdss_cfg *m)
{
struct sde_hw_blk_reg_map c;
u32 ubwc_version;
u32 reg = m->mdp[0].ubwc_static |
(m->mdp[0].ubwc_swizzle & 0x1) |
((m->mdp[0].highest_bank_bit & 0x3) << 4) |
((m->macrotile_mode & 0x1) << 12);

if (!mdp || !m)
return;

/* force blk offset to zero to access beginning of register region */
c = mdp->hw;
c.blk_off = 0x0;
ubwc_version = SDE_REG_READ(&c, UBWC_DEC_HW_VERSION);
/* 630 doesn't seem to have the UBWC version register */
//ubwc_version = SDE_REG_READ(&c, UBWC_DEC_HW_VERSION);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, remove the line instead of commenting it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought keeping it for reference is okay, newer platforms have this feature.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is WIP code. The original below reads both the register in ubwc_version and what was stored in DT as m->ubwc_version. Seems like it's done on purpose, I doubt this is correct. @konradybcio What do they do on mainline?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, we can see in drivers/gpu/drm/msm/sde/sde_hw_catalog.h:

* @ubwc_version UBWC feature version (0x0 for not supported)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MarijnS95 on mainline the version is hardcoded per platform.

ubwc_version = m->ubwc_version;

if (IS_UBWC_20_SUPPORTED(ubwc_version)) {
SDE_REG_WRITE(&c, UBWC_STATIC, m->mdp[0].ubwc_static);
} else if (IS_UBWC_30_SUPPORTED(ubwc_version)) {
u32 reg = m->mdp[0].ubwc_static |
(m->mdp[0].ubwc_swizzle & 0x1) |
((m->mdp[0].highest_bank_bit & 0x3) << 4) |
((m->macrotile_mode & 0x1) << 12);

if (IS_UBWC_30_SUPPORTED(m->ubwc_version))
reg |= BIT(10);
if (IS_UBWC_10_SUPPORTED(m->ubwc_version))
switch(ubwc_version) {
case 0x10000000:
reg |= BIT(8);

SDE_REG_WRITE(&c, UBWC_STATIC, reg);
} else {
SDE_ERROR("Unsupported UBWC version 0x%08x\n", ubwc_version);
SDE_REG_WRITE(&c, UBWC_STATIC, reg);
break;
case 0x20000000:
SDE_REG_WRITE(&c, UBWC_STATIC, m->mdp[0].ubwc_static);
break;
case 0x30000000:
reg |= BIT(10);
SDE_REG_WRITE(&c, UBWC_STATIC, reg);
break;
default:
SDE_ERROR("Unsupported UBWC version 0x%08x\n", ubwc_version);
break;
}
}

Expand Down