Skip to content

Commit fcd1e48

Browse files
Fangzhi Zuoalexdeucher
authored andcommitted
drm/amd/display: Add debugfs entry for dsc passthrough
[Why & How] Add debugfs entry to force dsc decoding at PCON when DSC capable external RX is connected. In such case, it is free to test DSC decoding at external RX or at PCON. Signed-off-by: Fangzhi Zuo <[email protected]> Reviewed-by: Hersen Wu <[email protected]> Acked-by: Stylon Wang <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 665f285 commit fcd1e48

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ struct dsc_preferred_settings {
456456
uint32_t dsc_num_slices_v;
457457
uint32_t dsc_num_slices_h;
458458
uint32_t dsc_bits_per_pixel;
459+
bool dsc_force_disable_passthrough;
459460
};
460461

461462
struct amdgpu_dm_connector {

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,47 @@ static int output_bpc_show(struct seq_file *m, void *data)
887887
return res;
888888
}
889889

890+
/*
891+
* Example usage:
892+
* Disable dsc passthrough, i.e.,: have dsc decoding at converver, not external RX
893+
* echo 1 /sys/kernel/debug/dri/0/DP-1/dsc_disable_passthrough
894+
* Enable dsc passthrough, i.e.,: have dsc passthrough to external RX
895+
* echo 0 /sys/kernel/debug/dri/0/DP-1/dsc_disable_passthrough
896+
*/
897+
static ssize_t dp_dsc_passthrough_set(struct file *f, const char __user *buf,
898+
size_t size, loff_t *pos)
899+
{
900+
struct amdgpu_dm_connector *aconnector = file_inode(f)->i_private;
901+
char *wr_buf = NULL;
902+
uint32_t wr_buf_size = 42;
903+
int max_param_num = 1;
904+
long param;
905+
uint8_t param_nums = 0;
906+
907+
if (size == 0)
908+
return -EINVAL;
909+
910+
wr_buf = kcalloc(wr_buf_size, sizeof(char), GFP_KERNEL);
911+
912+
if (!wr_buf) {
913+
DRM_DEBUG_DRIVER("no memory to allocate write buffer\n");
914+
return -ENOSPC;
915+
}
916+
917+
if (parse_write_buffer_into_params(wr_buf, size,
918+
&param, buf,
919+
max_param_num,
920+
&param_nums)) {
921+
kfree(wr_buf);
922+
return -EINVAL;
923+
}
924+
925+
aconnector->dsc_settings.dsc_force_disable_passthrough = param;
926+
927+
kfree(wr_buf);
928+
return 0;
929+
}
930+
890931
#ifdef CONFIG_DRM_AMD_DC_HDCP
891932
/*
892933
* Returns the HDCP capability of the Display (1.4 for now).
@@ -2535,6 +2576,12 @@ static const struct file_operations dp_max_bpc_debugfs_fops = {
25352576
.llseek = default_llseek
25362577
};
25372578

2579+
static const struct file_operations dp_dsc_disable_passthrough_debugfs_fops = {
2580+
.owner = THIS_MODULE,
2581+
.write = dp_dsc_passthrough_set,
2582+
.llseek = default_llseek
2583+
};
2584+
25382585
static const struct {
25392586
char *name;
25402587
const struct file_operations *fops;
@@ -2559,7 +2606,8 @@ static const struct {
25592606
{"dsc_chunk_size", &dp_dsc_chunk_size_debugfs_fops},
25602607
{"dsc_slice_bpg", &dp_dsc_slice_bpg_offset_debugfs_fops},
25612608
{"dp_dsc_fec_support", &dp_dsc_fec_support_fops},
2562-
{"max_bpc", &dp_max_bpc_debugfs_fops}
2609+
{"max_bpc", &dp_max_bpc_debugfs_fops},
2610+
{"dsc_disable_passthrough", &dp_dsc_disable_passthrough_debugfs_fops},
25632611
};
25642612

25652613
#ifdef CONFIG_DRM_AMD_DC_HDCP

0 commit comments

Comments
 (0)