Hi all and especially @djnice who from what I gather is the author of the FEL patch. Hopefully I got the attribution correct, if so I really appreciate your work.
I have some questions about the patched dovi.ko (5.15_2.6_dovi_patched_fix_fel.ko). I diffed it against the untouched version to see what was changed, there are 5 patches:
|
Function |
Address |
Patch |
| 1 |
commit_reg |
05CBDC |
disable checking disable_residual_flag if input_mode == OTT |
| 2 |
commit_reg |
05D894 |
Set Composer_Mode to 0 instead of 1 |
| 3 |
commit_reg |
05E564 |
changes if ( h_ctx->last_l11_avail == 1 ) to if ( h_ctx->last_l11_avail ) |
| 4 |
multi_control_path |
05EE74 |
forces if ( src_format == signal_format_enum__FORMAT_DOVI || src_format == signal_format_enum__FORMAT_DOVI_LL ) to always evaluate true |
| 5 |
multi_control_path |
05F5C0 |
forces if ( src_format == signal_format_enum__FORMAT_DOVI || src_format == signal_format_enum__FORMAT_DOVI_LL ) to always evaluate true |
I was wondering if we can skip patching dovi.ko all together? Patches 4 and 5, operate on src_format which we is set in the open kernel module. I also don’t really understand the purpose of these two patches, I’d appreciate an explanation if possible.
If I understand the architecture correctly, and that is dovi.ko just prepares the registers and amdolby_vision actually writes them to hardware we can also avoid having to do patch 2 (and update the value after the call to multi_control_path).
That leaves us with patch 1 and 3. Patch 3 to me seems redundant, looking at the surrounding code last_l11_avail is only ever set to 0 or 1. Finally patch 1 is interesting as disable_residual_flag is set in only 3 places:
Set disable_residual_flag in rpu_header_read
v268 = *p_i_bits;
if ( *p_i_bits <= 0 ) {
v275 = p_rpu_bitstream->ui_buf;
}
else {
v269 = rdc->rpu_bitstream.pui8_ptr;
v270 = rdc->rpu_bitstream.pui8_buffer_end;
if ( v269 > v270 + 4 ) {
v269 = rdc->rpu_bitstream.pui8_buffer_end;
rdc->rpu_bitstream.pui8_ptr = v270;
}
v271 = *v269;
v272 = v269[1];
v273 = rdc->rpu_bitstream.ui_buf;
rdc->rpu_bitstream.pui8_ptr = v269 + 2;
v274 = (v272 & 0xFFFF00FF | (v271 << 8)) << v268;
v268 -= 16;
v275 = v274 | v273;
rdc->rpu_bitstream.ui_buf = v275;
rdc->rpu_bitstream.i_bits = v268;
}
p_rpu_bitstream->ui_buf = 2 * v275;
*p_i_bits = v268 + 1;
++*p_i_le
// here
rpu_data_header->rpu_sequence_header.disable_residual_flag = v275 < 0;
if ( a1->prev_sequence_header_available ) {
// Irrelevant variables read [omitted]
disable_residual_flag = a1->rpu_sequence_header_store.disable_residual_flag;
// Other irrelevent variables set [omitted]
rpu_data_header->rpu_sequence_header.disable_residual_flag = disable_residual_flag;
}
else {
event_callback = a1->event_callback;
if ( event_callback ) {
_cfi_slowpath_diag(0x789936D4DD313E00LL, a1->event_callback, &unk_34D70);
event_callback(S_RPU_WARNING, 259, "No previous sequence header found, using default values.");
}
// Other defaults set [omitted]
rpu_data_header->rpu_sequence_header.disable_residual_flag = 1;
}
Set disable_residual_flag in rpu_decoder_process_buffer
if ( !rdc->disable_MEL_detection && detect_MEL(rdc) )
rdc->rpu_data->rpu_data_header->rpu_sequence_header.disable_residual_flag = 1;
The one in rpu_decoder_process_buffer can be disabled using a flag (disable_MEL_detection). But it also seems correct, detect_MEL seems right internally. Finally the way it’s set in rpu_header_read also looks about right, but someone more familiar with the format might take a look. All of this to say that the patches might not be necessary.
I’m hoping that using an unpatched dovi.ko will lead to less instability.