drivers: gpu: drm: Properly track slice_per_pkt

This commit is contained in:
Nia Espera 2023-08-30 20:09:29 +02:00
parent a0c3877910
commit 590b46c190
No known key found for this signature in database
GPG key ID: F224CEC23756E2AD
2 changed files with 21 additions and 2 deletions

View file

@ -167,6 +167,7 @@ struct msm_dsi_host {
unsigned int lanes; unsigned int lanes;
enum mipi_dsi_pixel_format format; enum mipi_dsi_pixel_format format;
unsigned long mode_flags; unsigned long mode_flags;
unsigned int slice_per_pkt;
/* lane data parsed via DT */ /* lane data parsed via DT */
int dlane_swap; int dlane_swap;
@ -863,7 +864,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod
* Since the current driver only supports slice_per_pkt = 1, * Since the current driver only supports slice_per_pkt = 1,
* pkt_per_line will be equal to slice per intf for now. * pkt_per_line will be equal to slice per intf for now.
*/ */
pkt_per_line = slice_per_intf; pkt_per_line = slice_per_intf * msm_host->slice_per_pkt;
if (is_cmd_mode) /* packet data type */ if (is_cmd_mode) /* packet data type */
reg = DSI_COMMAND_COMPRESSION_MODE_CTRL_STREAM0_DATATYPE(MIPI_DSI_DCS_LONG_WRITE); reg = DSI_COMMAND_COMPRESSION_MODE_CTRL_STREAM0_DATATYPE(MIPI_DSI_DCS_LONG_WRITE);
@ -1002,7 +1003,8 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)
* TODO: Expand mipi_dsi_device struct to hold slice_per_pkt info * TODO: Expand mipi_dsi_device struct to hold slice_per_pkt info
* and adjust DSC math to account for slice_per_pkt. * and adjust DSC math to account for slice_per_pkt.
*/ */
wc = msm_host->dsc->slice_chunk_size + 1; wc = msm_host->dsc->slice_chunk_size *
msm_host->slice_per_pkt + 1;
dsi_write(msm_host, REG_DSI_CMD_MDP_STREAM0_CTRL, dsi_write(msm_host, REG_DSI_CMD_MDP_STREAM0_CTRL,
DSI_CMD_MDP_STREAM0_CTRL_WORD_COUNT(wc) | DSI_CMD_MDP_STREAM0_CTRL_WORD_COUNT(wc) |
@ -1629,6 +1631,7 @@ static int dsi_host_attach(struct mipi_dsi_host *host,
msm_host->lanes = dsi->lanes; msm_host->lanes = dsi->lanes;
msm_host->format = dsi->format; msm_host->format = dsi->format;
msm_host->mode_flags = dsi->mode_flags; msm_host->mode_flags = dsi->mode_flags;
msm_host->slice_per_pkt = dsi->slice_per_pkt;
if (dsi->dsc) if (dsi->dsc)
msm_host->dsc = dsi->dsc; msm_host->dsc = dsi->dsc;
@ -1762,6 +1765,18 @@ static int dsi_host_parse_lane_data(struct msm_dsi_host *msm_host,
return -EINVAL; return -EINVAL;
} }
static void dsi_host_set_num_slices(struct msm_dsi_host *msm_host)
{
struct mipi_dsi_device *dsi = to_mipi_dsi_device(&msm_host->pdev->dev);
if (dsi->slice_per_pkt)
msm_host->slice_per_pkt = dsi->slice_per_pkt;
else {
msm_host->slice_per_pkt = 1;
dsi->slice_per_pkt = 1;
}
}
static int dsi_populate_dsc_params(struct msm_dsi_host *msm_host, struct drm_dsc_config *dsc) static int dsi_populate_dsc_params(struct msm_dsi_host *msm_host, struct drm_dsc_config *dsc)
{ {
int ret; int ret;
@ -1833,6 +1848,8 @@ static int dsi_host_parse_dt(struct msm_dsi_host *msm_host)
} }
} }
dsi_host_set_num_slices(msm_host);
err: err:
of_node_put(endpoint); of_node_put(endpoint);

View file

@ -172,6 +172,7 @@ struct mipi_dsi_device_info {
* @channel: virtual channel assigned to the peripheral * @channel: virtual channel assigned to the peripheral
* @format: pixel format for video mode * @format: pixel format for video mode
* @lanes: number of active data lanes * @lanes: number of active data lanes
* @slice_per_pkt: number of slices in a data packet
* @mode_flags: DSI operation mode related flags * @mode_flags: DSI operation mode related flags
* @hs_rate: maximum lane frequency for high speed mode in hertz, this should * @hs_rate: maximum lane frequency for high speed mode in hertz, this should
* be set to the real limits of the hardware, zero is only accepted for * be set to the real limits of the hardware, zero is only accepted for
@ -188,6 +189,7 @@ struct mipi_dsi_device {
char name[DSI_DEV_NAME_SIZE]; char name[DSI_DEV_NAME_SIZE];
unsigned int channel; unsigned int channel;
unsigned int lanes; unsigned int lanes;
unsigned int slice_per_pkt;
enum mipi_dsi_pixel_format format; enum mipi_dsi_pixel_format format;
unsigned long mode_flags; unsigned long mode_flags;
unsigned long hs_rate; unsigned long hs_rate;