Loading drivers/gpu/drm/msm/sde/sde_hw_catalog.c +11 −42 Original line number Diff line number Diff line Loading @@ -528,37 +528,6 @@ static struct sde_prop_type reg_dma_prop[REG_DMA_PROP_MAX] = { * static API list *************************************************************/ /** * _sde_copy_formats - copy formats from src_list to dst_list * @dst_list: pointer to destination list where to copy formats * @dst_list_size: size of destination list * @dst_list_pos: starting position on the list where to copy formats * @src_list: pointer to source list where to copy formats from * @src_list_size: size of source list * Return: number of elements populated */ static uint32_t _sde_copy_formats( struct sde_format_extended *dst_list, uint32_t dst_list_size, uint32_t dst_list_pos, const struct sde_format_extended *src_list, uint32_t src_list_size) { uint32_t cur_pos, i; if (!dst_list || !src_list || (dst_list_pos >= (dst_list_size - 1))) return 0; for (i = 0, cur_pos = dst_list_pos; (cur_pos < (dst_list_size - 1)) && (i < src_list_size) && src_list[i].fourcc_format; ++i, ++cur_pos) dst_list[cur_pos] = src_list[i]; dst_list[cur_pos].fourcc_format = 0; return i; } static int _parse_dt_u32_handler(struct device_node *np, char *prop_name, u32 *offsets, int len, bool mandatory) { Loading Loading @@ -2445,7 +2414,7 @@ static int sde_hardware_format_caps(struct sde_mdss_cfg *sde_cfg, rc = -ENOMEM; goto end; } index = _sde_copy_formats(sde_cfg->cursor_formats, index = sde_copy_formats(sde_cfg->cursor_formats, cursor_list_size, 0, cursor_formats, ARRAY_SIZE(cursor_formats)); } Loading Loading @@ -2486,34 +2455,34 @@ static int sde_hardware_format_caps(struct sde_mdss_cfg *sde_cfg, goto end; } index = _sde_copy_formats(sde_cfg->dma_formats, dma_list_size, index = sde_copy_formats(sde_cfg->dma_formats, dma_list_size, 0, plane_formats, ARRAY_SIZE(plane_formats)); index += _sde_copy_formats(sde_cfg->dma_formats, dma_list_size, index += sde_copy_formats(sde_cfg->dma_formats, dma_list_size, index, rgb_10bit_formats, ARRAY_SIZE(rgb_10bit_formats)); index = _sde_copy_formats(sde_cfg->vig_formats, vig_list_size, index = sde_copy_formats(sde_cfg->vig_formats, vig_list_size, 0, plane_formats_yuv, ARRAY_SIZE(plane_formats_yuv)); index += _sde_copy_formats(sde_cfg->vig_formats, vig_list_size, index += sde_copy_formats(sde_cfg->vig_formats, vig_list_size, index, rgb_10bit_formats, ARRAY_SIZE(rgb_10bit_formats)); index += _sde_copy_formats(sde_cfg->vig_formats, vig_list_size, index += sde_copy_formats(sde_cfg->vig_formats, vig_list_size, index, p010_formats, ARRAY_SIZE(p010_formats)); if (IS_SDE_MAJOR_MINOR_SAME((hw_rev), SDE_HW_VER_400)) index += _sde_copy_formats(sde_cfg->vig_formats, index += sde_copy_formats(sde_cfg->vig_formats, vig_list_size, index, p010_ubwc_formats, ARRAY_SIZE(p010_ubwc_formats)); index += _sde_copy_formats(sde_cfg->vig_formats, vig_list_size, index += sde_copy_formats(sde_cfg->vig_formats, vig_list_size, index, tp10_ubwc_formats, ARRAY_SIZE(tp10_ubwc_formats)); index = _sde_copy_formats(sde_cfg->wb_formats, wb2_list_size, index = sde_copy_formats(sde_cfg->wb_formats, wb2_list_size, 0, wb2_formats, ARRAY_SIZE(wb2_formats)); index += _sde_copy_formats(sde_cfg->wb_formats, wb2_list_size, index += sde_copy_formats(sde_cfg->wb_formats, wb2_list_size, index, rgb_10bit_formats, ARRAY_SIZE(rgb_10bit_formats)); index += _sde_copy_formats(sde_cfg->wb_formats, wb2_list_size, index += sde_copy_formats(sde_cfg->wb_formats, wb2_list_size, index, tp10_ubwc_formats, ARRAY_SIZE(tp10_ubwc_formats)); end: Loading drivers/gpu/drm/msm/sde/sde_hw_util.c +30 −0 Original line number Diff line number Diff line Loading @@ -91,3 +91,33 @@ void sde_hw_csc_setup(struct sde_hw_blk_reg_map *c, SDE_REG_WRITE(c, csc_reg_off + 0x40, data->csc_post_bv[2]); } /** * _sde_copy_formats - copy formats from src_list to dst_list * @dst_list: pointer to destination list where to copy formats * @dst_list_size: size of destination list * @dst_list_pos: starting position on the list where to copy formats * @src_list: pointer to source list where to copy formats from * @src_list_size: size of source list * Return: number of elements populated */ uint32_t sde_copy_formats( struct sde_format_extended *dst_list, uint32_t dst_list_size, uint32_t dst_list_pos, const struct sde_format_extended *src_list, uint32_t src_list_size) { uint32_t cur_pos, i; if (!dst_list || !src_list || (dst_list_pos >= (dst_list_size - 1))) return 0; for (i = 0, cur_pos = dst_list_pos; (cur_pos < (dst_list_size - 1)) && (i < src_list_size) && src_list[i].fourcc_format; ++i, ++cur_pos) dst_list[cur_pos] = src_list[i]; dst_list[cur_pos].fourcc_format = 0; return i; } drivers/gpu/drm/msm/sde/sde_hw_util.h +9 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ #include <linux/slab.h> #include "sde_hw_mdss.h" struct sde_format_extended; /* * This is the common struct maintained by each sub block * for mapping the register offsets in this block to the Loading Loading @@ -59,5 +61,11 @@ void sde_hw_csc_setup(struct sde_hw_blk_reg_map *c, u32 csc_reg_off, struct sde_csc_cfg *data, bool csc10); #endif /* _SDE_HW_UTIL_H */ uint32_t sde_copy_formats( struct sde_format_extended *dst_list, uint32_t dst_list_size, uint32_t dst_list_pos, const struct sde_format_extended *src_list, uint32_t src_list_size); #endif /* _SDE_HW_UTIL_H */ drivers/gpu/drm/msm/sde/sde_plane.c +47 −4 Original line number Diff line number Diff line Loading @@ -3028,6 +3028,7 @@ static void _sde_plane_install_properties(struct drm_plane *plane, {SDE_DRM_DEINTERLACE, "deinterlace"} }; const struct sde_format_extended *format_list; struct sde_format_extended *virt_format_list = NULL; struct sde_kms_info *info; struct sde_plane *psde = to_sde_plane(plane); int zpos_max = 255; Loading Loading @@ -3166,9 +3167,28 @@ static void _sde_plane_install_properties(struct drm_plane *plane, format_list = psde->pipe_sblk->format_list; if (master_plane_id) { int index, array_size; array_size = ARRAY_SIZE(plane_formats) + ARRAY_SIZE(rgb_10bit_formats); virt_format_list = kcalloc(array_size, sizeof(struct sde_format_extended), GFP_KERNEL); if (!virt_format_list) { SDE_ERROR( "failed to allocate virtual pipe format list\n"); return; } index = sde_copy_formats(virt_format_list, array_size, 0, plane_formats, ARRAY_SIZE(plane_formats)); sde_copy_formats(virt_format_list, array_size, index, rgb_10bit_formats, ARRAY_SIZE(rgb_10bit_formats)); format_list = virt_format_list; sde_kms_info_add_keyint(info, "primary_smart_plane_id", master_plane_id); format_list = plane_formats; } if (format_list) { Loading Loading @@ -3198,6 +3218,7 @@ static void _sde_plane_install_properties(struct drm_plane *plane, info->data, info->len, PLANE_PROP_INFO); kfree(info); kfree(virt_format_list); if (psde->features & BIT(SDE_SSPP_MEMCOLOR)) { snprintf(feature_name, sizeof(feature_name), "%s%d", Loading Loading @@ -3915,6 +3936,7 @@ struct drm_plane *sde_plane_init(struct drm_device *dev, { struct drm_plane *plane = NULL; const struct sde_format_extended *format_list; struct sde_format_extended *virt_format_list = NULL; struct sde_plane *psde; struct msm_drm_private *priv; struct sde_kms *kms; Loading Loading @@ -3989,8 +4011,28 @@ struct drm_plane *sde_plane_init(struct drm_device *dev, format_list = psde->pipe_sblk->format_list; if (master_plane_id) format_list = plane_formats; if (master_plane_id) { int index, array_size; array_size = ARRAY_SIZE(plane_formats) + ARRAY_SIZE(rgb_10bit_formats); virt_format_list = kcalloc(array_size, sizeof(struct sde_format_extended), GFP_KERNEL); if (!virt_format_list) { SDE_ERROR( "failed to allocate virtual pipe format list\n"); goto clean_sspp; } index = sde_copy_formats(virt_format_list, array_size, 0, plane_formats, ARRAY_SIZE(plane_formats)); sde_copy_formats(virt_format_list, array_size, index, rgb_10bit_formats, ARRAY_SIZE(rgb_10bit_formats)); format_list = virt_format_list; } psde->nformats = sde_populate_formats(format_list, psde->formats, Loading Loading @@ -4041,5 +4083,6 @@ struct drm_plane *sde_plane_init(struct drm_device *dev, clean_plane: kfree(psde); exit: kfree(virt_format_list); return ERR_PTR(ret); } Loading
drivers/gpu/drm/msm/sde/sde_hw_catalog.c +11 −42 Original line number Diff line number Diff line Loading @@ -528,37 +528,6 @@ static struct sde_prop_type reg_dma_prop[REG_DMA_PROP_MAX] = { * static API list *************************************************************/ /** * _sde_copy_formats - copy formats from src_list to dst_list * @dst_list: pointer to destination list where to copy formats * @dst_list_size: size of destination list * @dst_list_pos: starting position on the list where to copy formats * @src_list: pointer to source list where to copy formats from * @src_list_size: size of source list * Return: number of elements populated */ static uint32_t _sde_copy_formats( struct sde_format_extended *dst_list, uint32_t dst_list_size, uint32_t dst_list_pos, const struct sde_format_extended *src_list, uint32_t src_list_size) { uint32_t cur_pos, i; if (!dst_list || !src_list || (dst_list_pos >= (dst_list_size - 1))) return 0; for (i = 0, cur_pos = dst_list_pos; (cur_pos < (dst_list_size - 1)) && (i < src_list_size) && src_list[i].fourcc_format; ++i, ++cur_pos) dst_list[cur_pos] = src_list[i]; dst_list[cur_pos].fourcc_format = 0; return i; } static int _parse_dt_u32_handler(struct device_node *np, char *prop_name, u32 *offsets, int len, bool mandatory) { Loading Loading @@ -2445,7 +2414,7 @@ static int sde_hardware_format_caps(struct sde_mdss_cfg *sde_cfg, rc = -ENOMEM; goto end; } index = _sde_copy_formats(sde_cfg->cursor_formats, index = sde_copy_formats(sde_cfg->cursor_formats, cursor_list_size, 0, cursor_formats, ARRAY_SIZE(cursor_formats)); } Loading Loading @@ -2486,34 +2455,34 @@ static int sde_hardware_format_caps(struct sde_mdss_cfg *sde_cfg, goto end; } index = _sde_copy_formats(sde_cfg->dma_formats, dma_list_size, index = sde_copy_formats(sde_cfg->dma_formats, dma_list_size, 0, plane_formats, ARRAY_SIZE(plane_formats)); index += _sde_copy_formats(sde_cfg->dma_formats, dma_list_size, index += sde_copy_formats(sde_cfg->dma_formats, dma_list_size, index, rgb_10bit_formats, ARRAY_SIZE(rgb_10bit_formats)); index = _sde_copy_formats(sde_cfg->vig_formats, vig_list_size, index = sde_copy_formats(sde_cfg->vig_formats, vig_list_size, 0, plane_formats_yuv, ARRAY_SIZE(plane_formats_yuv)); index += _sde_copy_formats(sde_cfg->vig_formats, vig_list_size, index += sde_copy_formats(sde_cfg->vig_formats, vig_list_size, index, rgb_10bit_formats, ARRAY_SIZE(rgb_10bit_formats)); index += _sde_copy_formats(sde_cfg->vig_formats, vig_list_size, index += sde_copy_formats(sde_cfg->vig_formats, vig_list_size, index, p010_formats, ARRAY_SIZE(p010_formats)); if (IS_SDE_MAJOR_MINOR_SAME((hw_rev), SDE_HW_VER_400)) index += _sde_copy_formats(sde_cfg->vig_formats, index += sde_copy_formats(sde_cfg->vig_formats, vig_list_size, index, p010_ubwc_formats, ARRAY_SIZE(p010_ubwc_formats)); index += _sde_copy_formats(sde_cfg->vig_formats, vig_list_size, index += sde_copy_formats(sde_cfg->vig_formats, vig_list_size, index, tp10_ubwc_formats, ARRAY_SIZE(tp10_ubwc_formats)); index = _sde_copy_formats(sde_cfg->wb_formats, wb2_list_size, index = sde_copy_formats(sde_cfg->wb_formats, wb2_list_size, 0, wb2_formats, ARRAY_SIZE(wb2_formats)); index += _sde_copy_formats(sde_cfg->wb_formats, wb2_list_size, index += sde_copy_formats(sde_cfg->wb_formats, wb2_list_size, index, rgb_10bit_formats, ARRAY_SIZE(rgb_10bit_formats)); index += _sde_copy_formats(sde_cfg->wb_formats, wb2_list_size, index += sde_copy_formats(sde_cfg->wb_formats, wb2_list_size, index, tp10_ubwc_formats, ARRAY_SIZE(tp10_ubwc_formats)); end: Loading
drivers/gpu/drm/msm/sde/sde_hw_util.c +30 −0 Original line number Diff line number Diff line Loading @@ -91,3 +91,33 @@ void sde_hw_csc_setup(struct sde_hw_blk_reg_map *c, SDE_REG_WRITE(c, csc_reg_off + 0x40, data->csc_post_bv[2]); } /** * _sde_copy_formats - copy formats from src_list to dst_list * @dst_list: pointer to destination list where to copy formats * @dst_list_size: size of destination list * @dst_list_pos: starting position on the list where to copy formats * @src_list: pointer to source list where to copy formats from * @src_list_size: size of source list * Return: number of elements populated */ uint32_t sde_copy_formats( struct sde_format_extended *dst_list, uint32_t dst_list_size, uint32_t dst_list_pos, const struct sde_format_extended *src_list, uint32_t src_list_size) { uint32_t cur_pos, i; if (!dst_list || !src_list || (dst_list_pos >= (dst_list_size - 1))) return 0; for (i = 0, cur_pos = dst_list_pos; (cur_pos < (dst_list_size - 1)) && (i < src_list_size) && src_list[i].fourcc_format; ++i, ++cur_pos) dst_list[cur_pos] = src_list[i]; dst_list[cur_pos].fourcc_format = 0; return i; }
drivers/gpu/drm/msm/sde/sde_hw_util.h +9 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ #include <linux/slab.h> #include "sde_hw_mdss.h" struct sde_format_extended; /* * This is the common struct maintained by each sub block * for mapping the register offsets in this block to the Loading Loading @@ -59,5 +61,11 @@ void sde_hw_csc_setup(struct sde_hw_blk_reg_map *c, u32 csc_reg_off, struct sde_csc_cfg *data, bool csc10); #endif /* _SDE_HW_UTIL_H */ uint32_t sde_copy_formats( struct sde_format_extended *dst_list, uint32_t dst_list_size, uint32_t dst_list_pos, const struct sde_format_extended *src_list, uint32_t src_list_size); #endif /* _SDE_HW_UTIL_H */
drivers/gpu/drm/msm/sde/sde_plane.c +47 −4 Original line number Diff line number Diff line Loading @@ -3028,6 +3028,7 @@ static void _sde_plane_install_properties(struct drm_plane *plane, {SDE_DRM_DEINTERLACE, "deinterlace"} }; const struct sde_format_extended *format_list; struct sde_format_extended *virt_format_list = NULL; struct sde_kms_info *info; struct sde_plane *psde = to_sde_plane(plane); int zpos_max = 255; Loading Loading @@ -3166,9 +3167,28 @@ static void _sde_plane_install_properties(struct drm_plane *plane, format_list = psde->pipe_sblk->format_list; if (master_plane_id) { int index, array_size; array_size = ARRAY_SIZE(plane_formats) + ARRAY_SIZE(rgb_10bit_formats); virt_format_list = kcalloc(array_size, sizeof(struct sde_format_extended), GFP_KERNEL); if (!virt_format_list) { SDE_ERROR( "failed to allocate virtual pipe format list\n"); return; } index = sde_copy_formats(virt_format_list, array_size, 0, plane_formats, ARRAY_SIZE(plane_formats)); sde_copy_formats(virt_format_list, array_size, index, rgb_10bit_formats, ARRAY_SIZE(rgb_10bit_formats)); format_list = virt_format_list; sde_kms_info_add_keyint(info, "primary_smart_plane_id", master_plane_id); format_list = plane_formats; } if (format_list) { Loading Loading @@ -3198,6 +3218,7 @@ static void _sde_plane_install_properties(struct drm_plane *plane, info->data, info->len, PLANE_PROP_INFO); kfree(info); kfree(virt_format_list); if (psde->features & BIT(SDE_SSPP_MEMCOLOR)) { snprintf(feature_name, sizeof(feature_name), "%s%d", Loading Loading @@ -3915,6 +3936,7 @@ struct drm_plane *sde_plane_init(struct drm_device *dev, { struct drm_plane *plane = NULL; const struct sde_format_extended *format_list; struct sde_format_extended *virt_format_list = NULL; struct sde_plane *psde; struct msm_drm_private *priv; struct sde_kms *kms; Loading Loading @@ -3989,8 +4011,28 @@ struct drm_plane *sde_plane_init(struct drm_device *dev, format_list = psde->pipe_sblk->format_list; if (master_plane_id) format_list = plane_formats; if (master_plane_id) { int index, array_size; array_size = ARRAY_SIZE(plane_formats) + ARRAY_SIZE(rgb_10bit_formats); virt_format_list = kcalloc(array_size, sizeof(struct sde_format_extended), GFP_KERNEL); if (!virt_format_list) { SDE_ERROR( "failed to allocate virtual pipe format list\n"); goto clean_sspp; } index = sde_copy_formats(virt_format_list, array_size, 0, plane_formats, ARRAY_SIZE(plane_formats)); sde_copy_formats(virt_format_list, array_size, index, rgb_10bit_formats, ARRAY_SIZE(rgb_10bit_formats)); format_list = virt_format_list; } psde->nformats = sde_populate_formats(format_list, psde->formats, Loading Loading @@ -4041,5 +4083,6 @@ struct drm_plane *sde_plane_init(struct drm_device *dev, clean_plane: kfree(psde); exit: kfree(virt_format_list); return ERR_PTR(ret); }