diff options
| author | Clarence Ip <cip@codeaurora.org> | 2016-07-15 16:23:59 -0400 |
|---|---|---|
| committer | Dhaval Patel <pdhaval@codeaurora.org> | 2016-08-01 12:35:47 -0700 |
| commit | 85c292d0eded75c7e890ddae9238df10b104fadf (patch) | |
| tree | 4bc02917a181be019130d9348a75e0a1bbfb397b /drivers/gpu/drm | |
| parent | 52c83189277e9317d044756192b90b1f52a15900 (diff) | |
drm/msm/sde: use msm_display_info for display information
Replace dsi_display_info and display_info structures with
a common msm_display_info structure to reduce unnecessary
structure layering and translation.
Change-Id: Ia097a5d64fa35472ea715ac99e14f496553d4b44
Signed-off-by: Clarence Ip <cip@codeaurora.org>
Diffstat (limited to 'drivers/gpu/drm')
| -rw-r--r-- | drivers/gpu/drm/msm/display-manager/display_manager.c | 35 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm/display-manager/display_manager.h | 73 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm/dsi-staging/dsi_display.c | 38 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm/dsi-staging/dsi_display.h | 42 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm/dsi-staging/dsi_drm.c | 16 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm/msm_drv.h | 62 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm/sde/sde_encoder.c | 18 |
7 files changed, 112 insertions, 172 deletions
diff --git a/drivers/gpu/drm/msm/display-manager/display_manager.c b/drivers/gpu/drm/msm/display-manager/display_manager.c index 236550ad9b41..17cc224c570f 100644 --- a/drivers/gpu/drm/msm/display-manager/display_manager.c +++ b/drivers/gpu/drm/msm/display-manager/display_manager.c @@ -310,12 +310,10 @@ int display_manager_get_count(struct display_manager *disp_m) int display_manager_get_info_by_index(struct display_manager *disp_m, u32 display_index, - struct display_info *info) + struct msm_display_info *info) { - int rc = 0; - int i, j; struct dsi_display *display; - struct dsi_display_info dsi_info; + int i, rc = 0; if (!disp_m || !info) { pr_err("Invalid params\n"); @@ -331,38 +329,15 @@ int display_manager_get_info_by_index(struct display_manager *disp_m, if (!display || !dsi_display_is_active(display)) continue; - memset(&dsi_info, 0x0, sizeof(dsi_info)); - rc = dsi_display_get_info(display, &dsi_info); + memset(info, 0x0, sizeof(*info)); + rc = dsi_display_get_info(info, display); if (rc) { - pr_err("failed to get display info, rc=%d\n", rc); - goto error; - } - - info->intf = DISPLAY_INTF_DSI; - info->num_of_h_tiles = dsi_info.num_of_h_tiles; - - for (j = 0; j < info->num_of_h_tiles; j++) - info->h_tile_instance[j] = dsi_info.h_tile_ids[j]; - - info->is_hot_pluggable = dsi_info.is_hot_pluggable; - info->is_connected = dsi_info.is_connected; - info->is_edid_supported = dsi_info.is_edid_supported; - info->max_width = 1920; /* TODO: */ - info->max_height = 1080; /* TODO: */ - info->compression = DISPLAY_COMPRESSION_NONE; - if (dsi_info.op_mode == DSI_OP_VIDEO_MODE) { - info->intf_mode |= DISPLAY_INTF_MODE_VID; - } else if (dsi_info.op_mode == DSI_OP_CMD_MODE) { - info->intf_mode |= DISPLAY_INTF_MODE_CMD; - } else { - pr_err("unknwown dsi op_mode %d\n", dsi_info.op_mode); + pr_err("failed to get dsi info, rc=%d\n", rc); rc = -EINVAL; - goto error; } break; } -error: mutex_unlock(&disp_m->lock); return rc; } diff --git a/drivers/gpu/drm/msm/display-manager/display_manager.h b/drivers/gpu/drm/msm/display-manager/display_manager.h index 7e44573f2458..68659db53b02 100644 --- a/drivers/gpu/drm/msm/display-manager/display_manager.h +++ b/drivers/gpu/drm/msm/display-manager/display_manager.h @@ -15,77 +15,6 @@ #ifndef _DISPLAY_MANAGER_H_ #define _DISPLAY_MANAGER_H_ -#define MAX_H_TILES_PER_DISPLAY 2 - -/** - * enum display_interface_type - enumerates display interface types - * @DISPLAY_INTF_DSI: DSI interface - * @DISPLAY_INTF_HDMI: HDMI interface - * @DISPLAY_INTF_DP: Display Port interface - */ -enum display_interface_type { - DISPLAY_INTF_DSI = 0, - DISPLAY_INTF_HDMI, - DISPLAY_INTF_DP, - DISPLAY_INTF_MAX, -}; - -/** - * enum display_compression_type - compression method used for pixel stream - * @DISPLAY_COMPRESISON_NONE: Pixel data is not compressed. - * @DISPLAY_COMPRESSION_DSC: DSC compresison is used. - * @DISPLAY_COMPRESSION_FBC: FBC compression is used. - */ -enum display_compression_type { - DISPLAY_COMPRESSION_NONE = 0, - DISPLAY_COMPRESSION_DSC, - DISPLAY_COMPRESSION_FBC, - DISPLAY_COMPRESISON_MAX -}; - -/** - * enum display_interface_mode - interface modes supported by the display - * @DISPLAY_INTF_MODE_VID: Display supports video or "active" mode - * @DISPLAY_INTF_MODE_CMD: Display supports command mode - */ -enum display_interface_mode { - DISPLAY_INTF_MODE_VID = BIT(0), - DISPLAY_INTF_MODE_CMD = BIT(1), -}; - -/** - * struct display_info - defines display properties - * @intf: The interface on which display is connected to SOC. - * @num_of_h_tiles: number of horizontal tiles in case of split interface. - * @h_tile_instance: controller instance used per tile. Number of elements is - * based on num_of_h_tiles. - * @is_hot_pluggable: Set to true if hot plug detection is supported. - * @is_connected: Set to true if display is connected. - * @is_edid_supported: True if display supports EDID. - * @max_width: Max width of display. In case of hot pluggable display, - * this is max width supported by controller. - * @max_height: Max height of display. In case of hot pluggable display, - * this is max height supported by controller. - * @compression: Compression supported by the display. - * @intf_mode: Bitmask of interface modes supported by the display - */ -struct display_info { - enum display_interface_type intf; - - u32 num_of_h_tiles; - u32 h_tile_instance[MAX_H_TILES_PER_DISPLAY]; - - bool is_hot_pluggable; - bool is_connected; - bool is_edid_supported; - - u32 max_width; - u32 max_height; - - enum display_compression_type compression; - enum display_interface_mode intf_mode; -}; - struct display_manager { struct drm_device *drm_dev; struct platform_device *pdev; @@ -120,7 +49,7 @@ int display_manager_get_count(struct display_manager *disp_m); */ int display_manager_get_info_by_index(struct display_manager *disp_m, u32 display_index, - struct display_info *info); + struct msm_display_info *info); /** * display_manager_drm_init_by_index() - initialize drm objects for display diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_display.c b/drivers/gpu/drm/msm/dsi-staging/dsi_display.c index a531c7f3141f..2475e2078a7a 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_display.c +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_display.c @@ -1956,17 +1956,17 @@ int dsi_display_drm_bridge_deinit(struct dsi_display *display) return rc; } -int dsi_display_get_info(struct dsi_display *display, - struct dsi_display_info *info) +int dsi_display_get_info(struct msm_display_info *info, void *disp) { - int rc = 0; - int i; + struct dsi_display *display; struct dsi_panel_phy_props phy_props; + int i, rc; - if (!display || !info) { - pr_err("Invalid params\n"); + if (!info || !disp) { + pr_err("invalid params\n"); return -EINVAL; } + display = disp; mutex_lock(&display->display_lock); rc = dsi_panel_get_phy_props(display->panel, &phy_props); @@ -1976,21 +1976,31 @@ int dsi_display_get_info(struct dsi_display *display, goto error; } - info->type = display->type; + info->intf_type = DRM_MODE_CONNECTOR_DSI; - /* TODO: do not access dsi_ctrl structure */ info->num_of_h_tiles = display->ctrl_count; for (i = 0; i < info->num_of_h_tiles; i++) - info->h_tile_ids[i] = display->ctrl[i].ctrl->index; - - info->is_hot_pluggable = false; - info->is_edid_supported = false; + info->h_tile_instance[i] = display->ctrl[i].ctrl->index; + info->is_connected = true; info->width_mm = phy_props.panel_width_mm; info->height_mm = phy_props.panel_height_mm; + info->max_width = 1920; + info->max_height = 1080; + info->compression = MSM_DISPLAY_COMPRESS_NONE; - info->op_mode = display->panel->mode.panel_mode; - + switch (display->panel->mode.panel_mode) { + case DSI_OP_VIDEO_MODE: + info->capabilities |= MSM_DISPLAY_CAP_VID_MODE; + break; + case DSI_OP_CMD_MODE: + info->capabilities |= MSM_DISPLAY_CAP_CMD_MODE; + break; + default: + pr_err("unknwown dsi panel mode %d\n", + display->panel->mode.panel_mode); + break; + } error: mutex_unlock(&display->display_lock); return rc; diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_display.h b/drivers/gpu/drm/msm/dsi-staging/dsi_display.h index 88f396f99af6..1731e9dff63b 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_display.h +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_display.h @@ -22,6 +22,7 @@ #include <drm/drmP.h> #include <drm/drm_crtc.h> +#include "msm_drv.h" #include "dsi_defs.h" #include "dsi_ctrl.h" #include "dsi_phy.h" @@ -54,42 +55,6 @@ enum dsi_display_type { }; /** - * struct dsi_display_info - defines dsi display properties - * @type: Type of panel connected to DSI interface. - * @num_of_h_tiles: In case of split panels, number of h tiles indicates the - * number of dsi interfaces used. For single DSI panels this - * is set to 1. This will be set for horizontally split - * panels. - * @h_tile_ids: The DSI instance ID for each tile. - * @is_hot_pluggable: Can panel be hot plugged. - * @is_connected: Is panel connected. - * @is_edid_supported: Does panel support reading EDID information. - * @width_mm: Physical width of panel in millimeters. - * @height_mm: Physical height of panel in millimeters. - * @dsi_op_mode: dsi operation mode, video or cmd mode - */ -struct dsi_display_info { - enum dsi_display_type type; - - /* Split DSI properties */ - bool h_tiled; - u32 num_of_h_tiles; - u32 h_tile_ids[MAX_DSI_CTRLS_PER_DISPLAY]; - - /* HPD */ - bool is_hot_pluggable; - bool is_connected; - bool is_edid_supported; - - /* Physical properties */ - u32 width_mm; - u32 height_mm; - - /* Operation properties */ - enum dsi_op_mode op_mode; -}; - -/** * struct dsi_display_ctrl - dsi ctrl/phy information for the display * @ctrl: Handle to the DSI controller device. * @ctrl_of_node: pHandle to the DSI controller device. @@ -301,13 +266,12 @@ int dsi_display_drm_bridge_deinit(struct dsi_display *display); /** * dsi_display_get_info() - returns the display properties - * @display: Handle to the display. * @info: Pointer to the structure where info is stored. + * @disp: Handle to the display. * * Return: error code. */ -int dsi_display_get_info(struct dsi_display *display, - struct dsi_display_info *info); +int dsi_display_get_info(struct msm_display_info *info, void *disp); /** * dsi_display_get_modes() - get modes supported by display diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_drm.c b/drivers/gpu/drm/msm/dsi-staging/dsi_drm.c index 7ffcfa7f962b..e41dd41ade41 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_drm.c +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_drm.c @@ -282,28 +282,28 @@ enum drm_connector_status dsi_conn_detect(struct drm_connector *conn, void *display) { enum drm_connector_status status = connector_status_unknown; - struct dsi_display_info dsi_info; + struct msm_display_info info; int rc; if (!conn || !display) return status; /* get display dsi_info */ - memset(&dsi_info, 0x0, sizeof(dsi_info)); - rc = dsi_display_get_info(display, &dsi_info); + memset(&info, 0x0, sizeof(info)); + rc = dsi_display_get_info(&info, display); if (rc) { - pr_err("failed to get display dsi_info, rc=%d\n", rc); + pr_err("failed to get display info, rc=%d\n", rc); return connector_status_disconnected; } - if (dsi_info.is_hot_pluggable) - status = (dsi_info.is_connected ? connector_status_connected : + if (info.capabilities & MSM_DISPLAY_CAP_HOT_PLUG) + status = (info.is_connected ? connector_status_connected : connector_status_disconnected); else status = connector_status_connected; - conn->display_info.width_mm = dsi_info.width_mm; - conn->display_info.height_mm = dsi_info.height_mm; + conn->display_info.width_mm = info.width_mm; + conn->display_info.height_mm = info.height_mm; return status; } diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index deccd82db347..da149812c6a0 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -131,6 +131,68 @@ struct msm_vblank_ctrl { spinlock_t lock; }; +#define MAX_H_TILES_PER_DISPLAY 2 + +/** + * enum msm_display_compression - compression method used for pixel stream + * @MSM_DISPLAY_COMPRESS_NONE: Pixel data is not compressed + * @MSM_DISPLAY_COMPRESS_DSC: DSC compresison is used + * @MSM_DISPLAY_COMPRESS_FBC: FBC compression is used + */ +enum msm_display_compression { + MSM_DISPLAY_COMPRESS_NONE, + MSM_DISPLAY_COMPRESS_DSC, + MSM_DISPLAY_COMPRESS_FBC, +}; + +/** + * enum msm_display_caps - features/capabilities supported by displays + * @MSM_DISPLAY_CAP_VID_MODE: Video or "active" mode supported + * @MSM_DISPLAY_CAP_CMD_MODE: Command mode supported + * @MSM_DISPLAY_CAP_HOT_PLUG: Hot plug detection supported + * @MSM_DISPLAY_CAP_EDID: EDID supported + */ +enum msm_display_caps { + MSM_DISPLAY_CAP_VID_MODE = BIT(0), + MSM_DISPLAY_CAP_CMD_MODE = BIT(1), + MSM_DISPLAY_CAP_HOT_PLUG = BIT(2), + MSM_DISPLAY_CAP_EDID = BIT(3), +}; + +/** + * struct msm_display_info - defines display properties + * @intf_type: DRM_MODE_CONNECTOR_ display type + * @capabilities: Bitmask of display flags + * @num_of_h_tiles: Number of horizontal tiles in case of split interface + * @h_tile_instance: Controller instance used per tile. Number of elements is + * based on num_of_h_tiles + * @is_connected: Set to true if display is connected + * @width_mm: Physical width + * @height_mm: Physical height + * @max_width: Max width of display. In case of hot pluggable display + * this is max width supported by controller + * @max_height: Max height of display. In case of hot pluggable display + * this is max height supported by controller + * @compression: Compression supported by the display + */ +struct msm_display_info { + int intf_type; + uint32_t capabilities; + + uint32_t num_of_h_tiles; + uint32_t h_tile_instance[MAX_H_TILES_PER_DISPLAY]; + + bool is_connected; + + unsigned int width_mm; + unsigned int height_mm; + + uint32_t max_width; + uint32_t max_height; + + enum msm_display_compression compression; +}; + struct display_manager; struct msm_drm_private { diff --git a/drivers/gpu/drm/msm/sde/sde_encoder.c b/drivers/gpu/drm/msm/sde/sde_encoder.c index 53a001615596..159be1c990e1 100644 --- a/drivers/gpu/drm/msm/sde/sde_encoder.c +++ b/drivers/gpu/drm/msm/sde/sde_encoder.c @@ -508,7 +508,7 @@ void sde_encoder_schedule_kickoff(struct drm_encoder *drm_enc, } static int sde_encoder_virt_add_phys_encs( - enum display_interface_mode intf_mode, + u32 display_caps, struct sde_encoder_virt *sde_enc, struct sde_kms *sde_kms, enum sde_intf intf_idx, @@ -535,7 +535,7 @@ static int sde_encoder_virt_add_phys_encs( return -EINVAL; } - if (intf_mode & DISPLAY_INTF_MODE_VID) { + if (display_caps & MSM_DISPLAY_CAP_VID_MODE) { enc = sde_encoder_phys_vid_init(sde_kms, intf_idx, ctl_idx, split_role, &sde_enc->base, parent_ops); @@ -549,7 +549,7 @@ static int sde_encoder_virt_add_phys_encs( ++sde_enc->num_phys_encs; } - if (intf_mode & DISPLAY_INTF_MODE_CMD) { + if (display_caps & MSM_DISPLAY_CAP_CMD_MODE) { enc = sde_encoder_phys_cmd_init(sde_kms, intf_idx, pp_idx, ctl_idx, split_role, &sde_enc->base, parent_ops); @@ -569,7 +569,7 @@ static int sde_encoder_virt_add_phys_encs( static int sde_encoder_setup_display(struct sde_encoder_virt *sde_enc, struct sde_kms *sde_kms, - struct display_info *disp_info, + struct msm_display_info *disp_info, int *drm_enc_mode) { int ret = 0; @@ -578,10 +578,10 @@ static int sde_encoder_setup_display(struct sde_encoder_virt *sde_enc, DBG(""); - if (disp_info->intf == DISPLAY_INTF_DSI) { + if (disp_info->intf_type == DRM_MODE_CONNECTOR_DSI) { *drm_enc_mode = DRM_MODE_ENCODER_DSI; intf_type = INTF_DSI; - } else if (disp_info->intf == DISPLAY_INTF_HDMI) { + } else if (disp_info->intf_type == DRM_MODE_CONNECTOR_HDMIA) { *drm_enc_mode = DRM_MODE_ENCODER_TMDS; intf_type = INTF_HDMI; } else { @@ -633,7 +633,7 @@ static int sde_encoder_setup_display(struct sde_encoder_virt *sde_enc, if (!ret) { ret = sde_encoder_virt_add_phys_encs( - disp_info->intf_mode, + disp_info->capabilities, sde_enc, sde_kms, intf_idx, pp_idx, ctl_idx, split_role); if (ret) @@ -646,7 +646,7 @@ static int sde_encoder_setup_display(struct sde_encoder_virt *sde_enc, } static struct drm_encoder *sde_encoder_virt_init( - struct drm_device *dev, struct display_info *disp_info) + struct drm_device *dev, struct msm_display_info *disp_info) { struct msm_drm_private *priv = dev->dev_private; struct sde_kms *sde_kms = to_sde_kms(priv->kms); @@ -750,7 +750,7 @@ void sde_encoders_init(struct drm_device *dev) } for (i = 0; i < num_displays; i++) { - struct display_info info = { 0 }; + struct msm_display_info info = { 0 }; struct drm_encoder *enc = NULL; u32 ret = 0; |
