mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-07 16:17:41 -04:00
drm/msm/dpu: split dpu_format_populate_layout
Split dpu_format_populate_layout() into addess-related and pitch/format-related parts. Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com> Tested-by: Abhinav Kumar <quic_abhinavk@quicinc.com> # sc7280 Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Patchwork: https://patchwork.freedesktop.org/patch/612244/ Link: https://lore.kernel.org/r/20240903-dpu-mode-config-width-v6-10-617e1ecc4b7a@linaro.org
This commit is contained in:
@@ -582,7 +582,13 @@ static void dpu_encoder_phys_wb_prepare_wb_job(struct dpu_encoder_phys *phys_enc
|
||||
|
||||
format = msm_framebuffer_format(job->fb);
|
||||
|
||||
ret = dpu_format_populate_layout(aspace, job->fb, &wb_cfg->dest);
|
||||
ret = dpu_format_populate_plane_sizes(job->fb, &wb_cfg->dest);
|
||||
if (ret) {
|
||||
DPU_DEBUG("failed to populate plane sizes%d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = dpu_format_populate_addrs(aspace, job->fb, &wb_cfg->dest);
|
||||
if (ret) {
|
||||
DPU_DEBUG("failed to populate layout %d\n", ret);
|
||||
return;
|
||||
|
||||
@@ -93,7 +93,7 @@ static int _dpu_format_get_media_color_ubwc(const struct msm_format *fmt)
|
||||
return color_fmt;
|
||||
}
|
||||
|
||||
static int _dpu_format_get_plane_sizes_ubwc(
|
||||
static int _dpu_format_populate_plane_sizes_ubwc(
|
||||
const struct msm_format *fmt,
|
||||
struct drm_framebuffer *fb,
|
||||
struct dpu_hw_fmt_layout *layout)
|
||||
@@ -170,7 +170,7 @@ static int _dpu_format_get_plane_sizes_ubwc(
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int _dpu_format_get_plane_sizes_linear(
|
||||
static int _dpu_format_populate_plane_sizes_linear(
|
||||
const struct msm_format *fmt,
|
||||
struct drm_framebuffer *fb,
|
||||
struct dpu_hw_fmt_layout *layout)
|
||||
@@ -244,12 +244,21 @@ static int _dpu_format_get_plane_sizes_linear(
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dpu_format_get_plane_sizes(
|
||||
const struct msm_format *fmt,
|
||||
/*
|
||||
* dpu_format_populate_addrs - populate non-address part of the layout based on
|
||||
* fb, and format found in the fb
|
||||
* @fb: framebuffer pointer
|
||||
* @layout: format layout structure to populate
|
||||
*
|
||||
* Return: error code on failure or 0 if new addresses were populated
|
||||
*/
|
||||
int dpu_format_populate_plane_sizes(
|
||||
struct drm_framebuffer *fb,
|
||||
struct dpu_hw_fmt_layout *layout)
|
||||
{
|
||||
if (!layout || !fmt) {
|
||||
const struct msm_format *fmt;
|
||||
|
||||
if (!layout || !fb) {
|
||||
DRM_ERROR("invalid pointer\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -260,10 +269,12 @@ static int dpu_format_get_plane_sizes(
|
||||
return -ERANGE;
|
||||
}
|
||||
|
||||
if (MSM_FORMAT_IS_UBWC(fmt) || MSM_FORMAT_IS_TILE(fmt))
|
||||
return _dpu_format_get_plane_sizes_ubwc(fmt, fb, layout);
|
||||
fmt = msm_framebuffer_format(fb);
|
||||
|
||||
return _dpu_format_get_plane_sizes_linear(fmt, fb, layout);
|
||||
if (MSM_FORMAT_IS_UBWC(fmt) || MSM_FORMAT_IS_TILE(fmt))
|
||||
return _dpu_format_populate_plane_sizes_ubwc(fmt, fb, layout);
|
||||
|
||||
return _dpu_format_populate_plane_sizes_linear(fmt, fb, layout);
|
||||
}
|
||||
|
||||
static int _dpu_format_populate_addrs_ubwc(
|
||||
@@ -377,7 +388,7 @@ static int _dpu_format_populate_addrs_linear(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dpu_format_populate_layout(
|
||||
int dpu_format_populate_addrs(
|
||||
struct msm_gem_address_space *aspace,
|
||||
struct drm_framebuffer *fb,
|
||||
struct dpu_hw_fmt_layout *layout)
|
||||
@@ -398,11 +409,6 @@ int dpu_format_populate_layout(
|
||||
|
||||
fmt = msm_framebuffer_format(fb);
|
||||
|
||||
/* Populate the plane sizes etc via get_format */
|
||||
ret = dpu_format_get_plane_sizes(fmt, fb, layout);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Populate the addresses given the fb */
|
||||
if (MSM_FORMAT_IS_UBWC(fmt) ||
|
||||
MSM_FORMAT_IS_TILE(fmt))
|
||||
|
||||
@@ -32,7 +32,7 @@ static inline bool dpu_find_format(u32 format, const u32 *supported_formats,
|
||||
}
|
||||
|
||||
/**
|
||||
* dpu_format_populate_layout - populate the given format layout based on
|
||||
* dpu_format_populate_addrs - populate buffer addresses based on
|
||||
* mmu, fb, and format found in the fb
|
||||
* @aspace: address space pointer
|
||||
* @fb: framebuffer pointer
|
||||
@@ -41,9 +41,13 @@ static inline bool dpu_find_format(u32 format, const u32 *supported_formats,
|
||||
* Return: error code on failure, -EAGAIN if success but the addresses
|
||||
* are the same as before or 0 if new addresses were populated
|
||||
*/
|
||||
int dpu_format_populate_layout(
|
||||
int dpu_format_populate_addrs(
|
||||
struct msm_gem_address_space *aspace,
|
||||
struct drm_framebuffer *fb,
|
||||
struct dpu_hw_fmt_layout *fmtl);
|
||||
|
||||
int dpu_format_populate_plane_sizes(
|
||||
struct drm_framebuffer *fb,
|
||||
struct dpu_hw_fmt_layout *layout);
|
||||
|
||||
#endif /*_DPU_FORMATS_H */
|
||||
|
||||
@@ -675,10 +675,19 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane,
|
||||
}
|
||||
}
|
||||
|
||||
ret = dpu_format_populate_plane_sizes(new_state->fb, &pstate->layout);
|
||||
if (ret) {
|
||||
DPU_ERROR_PLANE(pdpu, "failed to get format plane sizes, %d\n", ret);
|
||||
if (pstate->aspace)
|
||||
msm_framebuffer_cleanup(new_state->fb, pstate->aspace,
|
||||
pstate->needs_dirtyfb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* validate framebuffer layout before commit */
|
||||
ret = dpu_format_populate_layout(pstate->aspace,
|
||||
new_state->fb,
|
||||
&pstate->layout);
|
||||
ret = dpu_format_populate_addrs(pstate->aspace,
|
||||
new_state->fb,
|
||||
&pstate->layout);
|
||||
if (ret) {
|
||||
DPU_ERROR_PLANE(pdpu, "failed to get format layout, %d\n", ret);
|
||||
if (pstate->aspace)
|
||||
|
||||
Reference in New Issue
Block a user