drm/msm/sde: add support for a5x tile pixel formats
Add new modifier for a5x tile and support for a5x tile pixel format layout calculation. CRs-Fixed: 2009714 Change-Id: If0d1d6ba8d8d3e36dd5d5aef4a9b217d8e5779ba Signed-off-by: Alan Kwong <akwong@codeaurora.org>
This commit is contained in:
parent
9b56352695
commit
9e89f2eed8
4 changed files with 185 additions and 28 deletions
|
@ -10,6 +10,8 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define pr_fmt(fmt) "[drm:%s:%d] " fmt, __func__, __LINE__
|
||||||
|
|
||||||
#include <uapi/drm/drm_fourcc.h>
|
#include <uapi/drm/drm_fourcc.h>
|
||||||
#include <uapi/media/msm_media_info.h>
|
#include <uapi/media/msm_media_info.h>
|
||||||
|
|
||||||
|
@ -407,6 +409,82 @@ static const struct sde_format sde_format_map[] = {
|
||||||
SDE_FETCH_LINEAR, 3),
|
SDE_FETCH_LINEAR, 3),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A5x tile formats tables:
|
||||||
|
* These tables hold the A5x tile formats supported.
|
||||||
|
*/
|
||||||
|
static const struct sde_format sde_format_map_tile[] = {
|
||||||
|
INTERLEAVED_RGB_FMT(ARGB8888,
|
||||||
|
COLOR_8BIT, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
||||||
|
C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
|
||||||
|
true, 4, 0,
|
||||||
|
SDE_FETCH_UBWC, 1),
|
||||||
|
|
||||||
|
INTERLEAVED_RGB_FMT(ABGR8888,
|
||||||
|
COLOR_8BIT, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
||||||
|
C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
|
||||||
|
true, 4, 0,
|
||||||
|
SDE_FETCH_UBWC, 1),
|
||||||
|
|
||||||
|
INTERLEAVED_RGB_FMT(RGBA8888,
|
||||||
|
COLOR_8BIT, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
||||||
|
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
|
||||||
|
true, 4, 0,
|
||||||
|
SDE_FETCH_UBWC, 1),
|
||||||
|
|
||||||
|
INTERLEAVED_RGB_FMT(BGRA8888,
|
||||||
|
COLOR_8BIT, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
||||||
|
C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
|
||||||
|
true, 4, 0,
|
||||||
|
SDE_FETCH_UBWC, 1),
|
||||||
|
|
||||||
|
INTERLEAVED_RGB_FMT(BGRX8888,
|
||||||
|
COLOR_8BIT, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
||||||
|
C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
|
||||||
|
false, 4, 0,
|
||||||
|
SDE_FETCH_UBWC, 1),
|
||||||
|
|
||||||
|
INTERLEAVED_RGB_FMT(XRGB8888,
|
||||||
|
COLOR_8BIT, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
||||||
|
C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
|
||||||
|
false, 4, 0,
|
||||||
|
SDE_FETCH_UBWC, 1),
|
||||||
|
|
||||||
|
INTERLEAVED_RGB_FMT(RGBX8888,
|
||||||
|
COLOR_8BIT, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
||||||
|
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
|
||||||
|
false, 4, 0,
|
||||||
|
SDE_FETCH_UBWC, 1),
|
||||||
|
|
||||||
|
PSEUDO_YUV_FMT(NV12,
|
||||||
|
0, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
||||||
|
C1_B_Cb, C2_R_Cr,
|
||||||
|
SDE_CHROMA_420, SDE_FORMAT_FLAG_YUV,
|
||||||
|
SDE_FETCH_UBWC, 2),
|
||||||
|
|
||||||
|
PSEUDO_YUV_FMT(NV21,
|
||||||
|
0, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
||||||
|
C2_R_Cr, C1_B_Cb,
|
||||||
|
SDE_CHROMA_420, SDE_FORMAT_FLAG_YUV,
|
||||||
|
SDE_FETCH_UBWC, 2),
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct sde_format sde_format_map_p010_tile[] = {
|
||||||
|
PSEUDO_YUV_FMT_LOOSE(NV12,
|
||||||
|
0, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
||||||
|
C1_B_Cb, C2_R_Cr,
|
||||||
|
SDE_CHROMA_420, (SDE_FORMAT_FLAG_YUV | SDE_FORMAT_FLAG_DX),
|
||||||
|
SDE_FETCH_UBWC, 2),
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct sde_format sde_format_map_tp10_tile[] = {
|
||||||
|
PSEUDO_YUV_FMT(NV12,
|
||||||
|
0, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
||||||
|
C1_B_Cb, C2_R_Cr,
|
||||||
|
SDE_CHROMA_420, (SDE_FORMAT_FLAG_YUV | SDE_FORMAT_FLAG_DX),
|
||||||
|
SDE_FETCH_UBWC, 2),
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* UBWC formats table:
|
* UBWC formats table:
|
||||||
* This table holds the UBWC formats supported.
|
* This table holds the UBWC formats supported.
|
||||||
|
@ -417,37 +495,38 @@ static const struct sde_format sde_format_map_ubwc[] = {
|
||||||
INTERLEAVED_RGB_FMT(BGR565,
|
INTERLEAVED_RGB_FMT(BGR565,
|
||||||
0, COLOR_5BIT, COLOR_6BIT, COLOR_5BIT,
|
0, COLOR_5BIT, COLOR_6BIT, COLOR_5BIT,
|
||||||
C2_R_Cr, C0_G_Y, C1_B_Cb, 0, 3,
|
C2_R_Cr, C0_G_Y, C1_B_Cb, 0, 3,
|
||||||
false, 2, 0,
|
false, 2, SDE_FORMAT_FLAG_COMPRESSED,
|
||||||
SDE_FETCH_UBWC, 2),
|
SDE_FETCH_UBWC, 2),
|
||||||
|
|
||||||
INTERLEAVED_RGB_FMT(ABGR8888,
|
INTERLEAVED_RGB_FMT(ABGR8888,
|
||||||
COLOR_8BIT, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
COLOR_8BIT, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
||||||
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
|
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
|
||||||
true, 4, 0,
|
true, 4, SDE_FORMAT_FLAG_COMPRESSED,
|
||||||
SDE_FETCH_UBWC, 2),
|
SDE_FETCH_UBWC, 2),
|
||||||
|
|
||||||
INTERLEAVED_RGB_FMT(XBGR8888,
|
INTERLEAVED_RGB_FMT(XBGR8888,
|
||||||
COLOR_8BIT, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
COLOR_8BIT, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
||||||
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
|
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
|
||||||
false, 4, 0,
|
false, 4, SDE_FORMAT_FLAG_COMPRESSED,
|
||||||
SDE_FETCH_UBWC, 2),
|
SDE_FETCH_UBWC, 2),
|
||||||
|
|
||||||
INTERLEAVED_RGB_FMT(ABGR2101010,
|
INTERLEAVED_RGB_FMT(ABGR2101010,
|
||||||
COLOR_8BIT, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
COLOR_8BIT, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
||||||
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
|
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
|
||||||
true, 4, SDE_FORMAT_FLAG_DX,
|
true, 4, SDE_FORMAT_FLAG_DX | SDE_FORMAT_FLAG_COMPRESSED,
|
||||||
SDE_FETCH_UBWC, 2),
|
SDE_FETCH_UBWC, 2),
|
||||||
|
|
||||||
INTERLEAVED_RGB_FMT(XBGR2101010,
|
INTERLEAVED_RGB_FMT(XBGR2101010,
|
||||||
COLOR_8BIT, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
COLOR_8BIT, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
||||||
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
|
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
|
||||||
true, 4, SDE_FORMAT_FLAG_DX,
|
true, 4, SDE_FORMAT_FLAG_DX | SDE_FORMAT_FLAG_COMPRESSED,
|
||||||
SDE_FETCH_UBWC, 2),
|
SDE_FETCH_UBWC, 2),
|
||||||
|
|
||||||
PSEUDO_YUV_FMT(NV12,
|
PSEUDO_YUV_FMT(NV12,
|
||||||
0, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
0, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
||||||
C1_B_Cb, C2_R_Cr,
|
C1_B_Cb, C2_R_Cr,
|
||||||
SDE_CHROMA_420, SDE_FORMAT_FLAG_YUV,
|
SDE_CHROMA_420, SDE_FORMAT_FLAG_YUV |
|
||||||
|
SDE_FORMAT_FLAG_COMPRESSED,
|
||||||
SDE_FETCH_UBWC, 4),
|
SDE_FETCH_UBWC, 4),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -463,7 +542,8 @@ static const struct sde_format sde_format_map_p010_ubwc[] = {
|
||||||
PSEUDO_YUV_FMT_LOOSE(NV12,
|
PSEUDO_YUV_FMT_LOOSE(NV12,
|
||||||
0, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
0, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
||||||
C1_B_Cb, C2_R_Cr,
|
C1_B_Cb, C2_R_Cr,
|
||||||
SDE_CHROMA_420, (SDE_FORMAT_FLAG_YUV | SDE_FORMAT_FLAG_DX),
|
SDE_CHROMA_420, (SDE_FORMAT_FLAG_YUV | SDE_FORMAT_FLAG_DX |
|
||||||
|
SDE_FORMAT_FLAG_COMPRESSED),
|
||||||
SDE_FETCH_UBWC, 4),
|
SDE_FETCH_UBWC, 4),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -471,7 +551,8 @@ static const struct sde_format sde_format_map_tp10_ubwc[] = {
|
||||||
PSEUDO_YUV_FMT(NV12,
|
PSEUDO_YUV_FMT(NV12,
|
||||||
0, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
0, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
|
||||||
C1_B_Cb, C2_R_Cr,
|
C1_B_Cb, C2_R_Cr,
|
||||||
SDE_CHROMA_420, (SDE_FORMAT_FLAG_YUV | SDE_FORMAT_FLAG_DX),
|
SDE_CHROMA_420, (SDE_FORMAT_FLAG_YUV | SDE_FORMAT_FLAG_DX |
|
||||||
|
SDE_FORMAT_FLAG_COMPRESSED),
|
||||||
SDE_FETCH_UBWC, 4),
|
SDE_FETCH_UBWC, 4),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -545,6 +626,7 @@ static int _sde_format_get_plane_sizes_ubwc(
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int color;
|
int color;
|
||||||
|
bool meta = SDE_FORMAT_IS_UBWC(fmt);
|
||||||
|
|
||||||
memset(layout, 0, sizeof(struct sde_hw_fmt_layout));
|
memset(layout, 0, sizeof(struct sde_hw_fmt_layout));
|
||||||
layout->format = fmt;
|
layout->format = fmt;
|
||||||
|
@ -564,7 +646,7 @@ static int _sde_format_get_plane_sizes_ubwc(
|
||||||
uint32_t y_meta_scanlines = 0;
|
uint32_t y_meta_scanlines = 0;
|
||||||
uint32_t uv_meta_scanlines = 0;
|
uint32_t uv_meta_scanlines = 0;
|
||||||
|
|
||||||
layout->num_planes = 4;
|
layout->num_planes = 2;
|
||||||
layout->plane_pitch[0] = VENUS_Y_STRIDE(color, width);
|
layout->plane_pitch[0] = VENUS_Y_STRIDE(color, width);
|
||||||
y_sclines = VENUS_Y_SCANLINES(color, height);
|
y_sclines = VENUS_Y_SCANLINES(color, height);
|
||||||
layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] *
|
layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] *
|
||||||
|
@ -575,6 +657,10 @@ static int _sde_format_get_plane_sizes_ubwc(
|
||||||
layout->plane_size[1] = MSM_MEDIA_ALIGN(layout->plane_pitch[1] *
|
layout->plane_size[1] = MSM_MEDIA_ALIGN(layout->plane_pitch[1] *
|
||||||
uv_sclines, SDE_UBWC_PLANE_SIZE_ALIGNMENT);
|
uv_sclines, SDE_UBWC_PLANE_SIZE_ALIGNMENT);
|
||||||
|
|
||||||
|
if (!meta)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
layout->num_planes += 2;
|
||||||
layout->plane_pitch[2] = VENUS_Y_META_STRIDE(color, width);
|
layout->plane_pitch[2] = VENUS_Y_META_STRIDE(color, width);
|
||||||
y_meta_scanlines = VENUS_Y_META_SCANLINES(color, height);
|
y_meta_scanlines = VENUS_Y_META_SCANLINES(color, height);
|
||||||
layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] *
|
layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] *
|
||||||
|
@ -588,19 +674,23 @@ static int _sde_format_get_plane_sizes_ubwc(
|
||||||
} else {
|
} else {
|
||||||
uint32_t rgb_scanlines, rgb_meta_scanlines;
|
uint32_t rgb_scanlines, rgb_meta_scanlines;
|
||||||
|
|
||||||
layout->num_planes = 3;
|
layout->num_planes = 1;
|
||||||
|
|
||||||
layout->plane_pitch[0] = VENUS_RGB_STRIDE(color, width);
|
layout->plane_pitch[0] = VENUS_RGB_STRIDE(color, width);
|
||||||
rgb_scanlines = VENUS_RGB_SCANLINES(color, height);
|
rgb_scanlines = VENUS_RGB_SCANLINES(color, height);
|
||||||
layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] *
|
layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] *
|
||||||
rgb_scanlines, SDE_UBWC_PLANE_SIZE_ALIGNMENT);
|
rgb_scanlines, SDE_UBWC_PLANE_SIZE_ALIGNMENT);
|
||||||
|
|
||||||
|
if (!meta)
|
||||||
|
goto done;
|
||||||
|
layout->num_planes += 2;
|
||||||
layout->plane_pitch[2] = VENUS_RGB_META_STRIDE(color, width);
|
layout->plane_pitch[2] = VENUS_RGB_META_STRIDE(color, width);
|
||||||
rgb_meta_scanlines = VENUS_RGB_META_SCANLINES(color, height);
|
rgb_meta_scanlines = VENUS_RGB_META_SCANLINES(color, height);
|
||||||
layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] *
|
layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] *
|
||||||
rgb_meta_scanlines, SDE_UBWC_PLANE_SIZE_ALIGNMENT);
|
rgb_meta_scanlines, SDE_UBWC_PLANE_SIZE_ALIGNMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
for (i = 0; i < SDE_MAX_PLANES; i++)
|
for (i = 0; i < SDE_MAX_PLANES; i++)
|
||||||
layout->total_size += layout->plane_size[i];
|
layout->total_size += layout->plane_size[i];
|
||||||
|
|
||||||
|
@ -667,7 +757,7 @@ static int _sde_format_get_plane_sizes_linear(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _sde_format_get_plane_sizes(
|
int sde_format_get_plane_sizes(
|
||||||
const struct sde_format *fmt,
|
const struct sde_format *fmt,
|
||||||
const uint32_t w,
|
const uint32_t w,
|
||||||
const uint32_t h,
|
const uint32_t h,
|
||||||
|
@ -683,7 +773,7 @@ static int _sde_format_get_plane_sizes(
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDE_FORMAT_IS_UBWC(fmt))
|
if (SDE_FORMAT_IS_UBWC(fmt) || SDE_FORMAT_IS_TILE(fmt))
|
||||||
return _sde_format_get_plane_sizes_ubwc(fmt, w, h, layout);
|
return _sde_format_get_plane_sizes_ubwc(fmt, w, h, layout);
|
||||||
|
|
||||||
return _sde_format_get_plane_sizes_linear(fmt, w, h, layout);
|
return _sde_format_get_plane_sizes_linear(fmt, w, h, layout);
|
||||||
|
@ -695,6 +785,7 @@ static int _sde_format_populate_addrs_ubwc(
|
||||||
struct sde_hw_fmt_layout *layout)
|
struct sde_hw_fmt_layout *layout)
|
||||||
{
|
{
|
||||||
uint32_t base_addr;
|
uint32_t base_addr;
|
||||||
|
bool meta;
|
||||||
|
|
||||||
if (!fb || !layout) {
|
if (!fb || !layout) {
|
||||||
DRM_ERROR("invalid pointers\n");
|
DRM_ERROR("invalid pointers\n");
|
||||||
|
@ -707,6 +798,8 @@ static int _sde_format_populate_addrs_ubwc(
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
meta = SDE_FORMAT_IS_UBWC(layout->format);
|
||||||
|
|
||||||
/* Per-format logic for verifying active planes */
|
/* Per-format logic for verifying active planes */
|
||||||
if (SDE_FORMAT_IS_YUV(layout->format)) {
|
if (SDE_FORMAT_IS_YUV(layout->format)) {
|
||||||
/************************************************/
|
/************************************************/
|
||||||
|
@ -736,6 +829,9 @@ static int _sde_format_populate_addrs_ubwc(
|
||||||
layout->plane_addr[1] = base_addr + layout->plane_size[0]
|
layout->plane_addr[1] = base_addr + layout->plane_size[0]
|
||||||
+ layout->plane_size[2] + layout->plane_size[3];
|
+ layout->plane_size[2] + layout->plane_size[3];
|
||||||
|
|
||||||
|
if (!meta)
|
||||||
|
goto done;
|
||||||
|
|
||||||
/* configure Y metadata plane */
|
/* configure Y metadata plane */
|
||||||
layout->plane_addr[2] = base_addr;
|
layout->plane_addr[2] = base_addr;
|
||||||
|
|
||||||
|
@ -763,10 +859,14 @@ static int _sde_format_populate_addrs_ubwc(
|
||||||
|
|
||||||
layout->plane_addr[0] = base_addr + layout->plane_size[2];
|
layout->plane_addr[0] = base_addr + layout->plane_size[2];
|
||||||
layout->plane_addr[1] = 0;
|
layout->plane_addr[1] = 0;
|
||||||
|
|
||||||
|
if (!meta)
|
||||||
|
goto done;
|
||||||
|
|
||||||
layout->plane_addr[2] = base_addr;
|
layout->plane_addr[2] = base_addr;
|
||||||
layout->plane_addr[3] = 0;
|
layout->plane_addr[3] = 0;
|
||||||
}
|
}
|
||||||
|
done:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,7 +920,7 @@ int sde_format_populate_layout(
|
||||||
layout->format = to_sde_format(msm_framebuffer_format(fb));
|
layout->format = to_sde_format(msm_framebuffer_format(fb));
|
||||||
|
|
||||||
/* Populate the plane sizes etc via get_format */
|
/* Populate the plane sizes etc via get_format */
|
||||||
ret = _sde_format_get_plane_sizes(layout->format, fb->width, fb->height,
|
ret = sde_format_get_plane_sizes(layout->format, fb->width, fb->height,
|
||||||
layout);
|
layout);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -829,7 +929,8 @@ int sde_format_populate_layout(
|
||||||
plane_addr[i] = layout->plane_addr[i];
|
plane_addr[i] = layout->plane_addr[i];
|
||||||
|
|
||||||
/* Populate the addresses given the fb */
|
/* Populate the addresses given the fb */
|
||||||
if (SDE_FORMAT_IS_UBWC(layout->format))
|
if (SDE_FORMAT_IS_UBWC(layout->format) ||
|
||||||
|
SDE_FORMAT_IS_TILE(layout->format))
|
||||||
ret = _sde_format_populate_addrs_ubwc(aspace, fb, layout);
|
ret = _sde_format_populate_addrs_ubwc(aspace, fb, layout);
|
||||||
else
|
else
|
||||||
ret = _sde_format_populate_addrs_linear(aspace, fb, layout);
|
ret = _sde_format_populate_addrs_linear(aspace, fb, layout);
|
||||||
|
@ -923,7 +1024,7 @@ int sde_format_check_modified_format(
|
||||||
fmt = to_sde_format(msm_fmt);
|
fmt = to_sde_format(msm_fmt);
|
||||||
num_base_fmt_planes = drm_format_num_planes(fmt->base.pixel_format);
|
num_base_fmt_planes = drm_format_num_planes(fmt->base.pixel_format);
|
||||||
|
|
||||||
ret = _sde_format_get_plane_sizes(fmt, cmd->width, cmd->height,
|
ret = sde_format_get_plane_sizes(fmt, cmd->width, cmd->height,
|
||||||
&layout);
|
&layout);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -962,14 +1063,14 @@ const struct sde_format *sde_get_sde_format_ext(
|
||||||
* All planes used must specify the same modifier.
|
* All planes used must specify the same modifier.
|
||||||
*/
|
*/
|
||||||
if (modifiers_len && !modifiers) {
|
if (modifiers_len && !modifiers) {
|
||||||
DRM_ERROR("invalid modifiers array\n");
|
SDE_ERROR("invalid modifiers array\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (modifiers && modifiers_len && modifiers[0]) {
|
} else if (modifiers && modifiers_len && modifiers[0]) {
|
||||||
mod0 = modifiers[0];
|
mod0 = modifiers[0];
|
||||||
DBG("plane format modifier 0x%llX", mod0);
|
SDE_DEBUG("plane format modifier 0x%llX\n", mod0);
|
||||||
for (i = 1; i < modifiers_len; i++) {
|
for (i = 1; i < modifiers_len; i++) {
|
||||||
if (modifiers[i] != mod0) {
|
if (modifiers[i] != mod0) {
|
||||||
DRM_ERROR("bad fmt mod 0x%llX on plane %d\n",
|
SDE_ERROR("bad fmt mod 0x%llX on plane %d\n",
|
||||||
modifiers[i], i);
|
modifiers[i], i);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -982,29 +1083,55 @@ const struct sde_format *sde_get_sde_format_ext(
|
||||||
map_size = ARRAY_SIZE(sde_format_map);
|
map_size = ARRAY_SIZE(sde_format_map);
|
||||||
break;
|
break;
|
||||||
case DRM_FORMAT_MOD_QCOM_COMPRESSED:
|
case DRM_FORMAT_MOD_QCOM_COMPRESSED:
|
||||||
|
case DRM_FORMAT_MOD_QCOM_COMPRESSED | DRM_FORMAT_MOD_QCOM_TILE:
|
||||||
map = sde_format_map_ubwc;
|
map = sde_format_map_ubwc;
|
||||||
map_size = ARRAY_SIZE(sde_format_map_ubwc);
|
map_size = ARRAY_SIZE(sde_format_map_ubwc);
|
||||||
DBG("found fmt 0x%X DRM_FORMAT_MOD_QCOM_COMPRESSED", format);
|
SDE_DEBUG("found fmt 0x%X DRM_FORMAT_MOD_QCOM_COMPRESSED\n",
|
||||||
|
format);
|
||||||
break;
|
break;
|
||||||
case DRM_FORMAT_MOD_QCOM_DX:
|
case DRM_FORMAT_MOD_QCOM_DX:
|
||||||
map = sde_format_map_p010;
|
map = sde_format_map_p010;
|
||||||
map_size = ARRAY_SIZE(sde_format_map_p010);
|
map_size = ARRAY_SIZE(sde_format_map_p010);
|
||||||
DBG("found fmt 0x%X DRM_FORMAT_MOD_QCOM_DX", format);
|
SDE_DEBUG("found fmt 0x%X DRM_FORMAT_MOD_QCOM_DX\n", format);
|
||||||
break;
|
break;
|
||||||
case (DRM_FORMAT_MOD_QCOM_DX | DRM_FORMAT_MOD_QCOM_COMPRESSED):
|
case (DRM_FORMAT_MOD_QCOM_DX | DRM_FORMAT_MOD_QCOM_COMPRESSED):
|
||||||
|
case (DRM_FORMAT_MOD_QCOM_DX | DRM_FORMAT_MOD_QCOM_COMPRESSED |
|
||||||
|
DRM_FORMAT_MOD_QCOM_TILE):
|
||||||
map = sde_format_map_p010_ubwc;
|
map = sde_format_map_p010_ubwc;
|
||||||
map_size = ARRAY_SIZE(sde_format_map_p010_ubwc);
|
map_size = ARRAY_SIZE(sde_format_map_p010_ubwc);
|
||||||
DBG("found fmt 0x%X DRM_FORMAT_MOD_QCOM_COMPRESSED/DX", format);
|
SDE_DEBUG("found fmt 0x%X DRM_FORMAT_MOD_QCOM_COMPRESSED/DX\n",
|
||||||
|
format);
|
||||||
break;
|
break;
|
||||||
case (DRM_FORMAT_MOD_QCOM_DX | DRM_FORMAT_MOD_QCOM_COMPRESSED |
|
case (DRM_FORMAT_MOD_QCOM_DX | DRM_FORMAT_MOD_QCOM_COMPRESSED |
|
||||||
DRM_FORMAT_MOD_QCOM_TIGHT):
|
DRM_FORMAT_MOD_QCOM_TIGHT):
|
||||||
|
case (DRM_FORMAT_MOD_QCOM_DX | DRM_FORMAT_MOD_QCOM_COMPRESSED |
|
||||||
|
DRM_FORMAT_MOD_QCOM_TIGHT | DRM_FORMAT_MOD_QCOM_TILE):
|
||||||
map = sde_format_map_tp10_ubwc;
|
map = sde_format_map_tp10_ubwc;
|
||||||
map_size = ARRAY_SIZE(sde_format_map_tp10_ubwc);
|
map_size = ARRAY_SIZE(sde_format_map_tp10_ubwc);
|
||||||
DBG("found fmt 0x%X DRM_FORMAT_MOD_QCOM_COMPRESSED/DX/TIGHT",
|
SDE_DEBUG(
|
||||||
|
"found fmt 0x%X DRM_FORMAT_MOD_QCOM_COMPRESSED/DX/TIGHT\n",
|
||||||
format);
|
format);
|
||||||
break;
|
break;
|
||||||
|
case DRM_FORMAT_MOD_QCOM_TILE:
|
||||||
|
map = sde_format_map_tile;
|
||||||
|
map_size = ARRAY_SIZE(sde_format_map_tile);
|
||||||
|
SDE_DEBUG("found fmt 0x%X DRM_FORMAT_MOD_QCOM_TILE\n", format);
|
||||||
|
break;
|
||||||
|
case (DRM_FORMAT_MOD_QCOM_TILE | DRM_FORMAT_MOD_QCOM_DX):
|
||||||
|
map = sde_format_map_p010_tile;
|
||||||
|
map_size = ARRAY_SIZE(sde_format_map_p010_tile);
|
||||||
|
SDE_DEBUG("found fmt 0x%X DRM_FORMAT_MOD_QCOM_TILE/DX\n",
|
||||||
|
format);
|
||||||
|
break;
|
||||||
|
case (DRM_FORMAT_MOD_QCOM_TILE | DRM_FORMAT_MOD_QCOM_DX |
|
||||||
|
DRM_FORMAT_MOD_QCOM_TIGHT):
|
||||||
|
map = sde_format_map_tp10_tile;
|
||||||
|
map_size = ARRAY_SIZE(sde_format_map_tp10_tile);
|
||||||
|
SDE_DEBUG("found fmt 0x%X DRM_FORMAT_MOD_QCOM_TILE/DX/TIGHT\n",
|
||||||
|
format);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
DRM_ERROR("unsupported format modifier %llX\n", mod0);
|
SDE_ERROR("unsupported format modifier %llX\n", mod0);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1016,10 +1143,10 @@ const struct sde_format *sde_get_sde_format_ext(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fmt == NULL)
|
if (fmt == NULL)
|
||||||
DRM_ERROR("unsupported fmt 0x%X modifier 0x%llX\n",
|
SDE_ERROR("unsupported fmt 0x%X modifier 0x%llX\n",
|
||||||
format, mod0);
|
format, mod0);
|
||||||
else
|
else
|
||||||
DBG("fmt %s mod 0x%llX ubwc %d yuv %d",
|
SDE_DEBUG("fmt %s mod 0x%llX ubwc %d yuv %d\n",
|
||||||
drm_get_format_name(format), mod0,
|
drm_get_format_name(format), mod0,
|
||||||
SDE_FORMAT_IS_UBWC(fmt),
|
SDE_FORMAT_IS_UBWC(fmt),
|
||||||
SDE_FORMAT_IS_YUV(fmt));
|
SDE_FORMAT_IS_YUV(fmt));
|
||||||
|
|
|
@ -58,6 +58,21 @@ uint32_t sde_populate_formats(
|
||||||
uint64_t *pixel_modifiers,
|
uint64_t *pixel_modifiers,
|
||||||
uint32_t pixel_formats_max);
|
uint32_t pixel_formats_max);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sde_format_get_plane_sizes - calculate size and layout of given buffer format
|
||||||
|
* @fmt: pointer to sde_format
|
||||||
|
* @w: width of the buffer
|
||||||
|
* @h: height of the buffer
|
||||||
|
* @layout: layout of the buffer
|
||||||
|
*
|
||||||
|
* Return: size of the buffer
|
||||||
|
*/
|
||||||
|
int sde_format_get_plane_sizes(
|
||||||
|
const struct sde_format *fmt,
|
||||||
|
const uint32_t w,
|
||||||
|
const uint32_t h,
|
||||||
|
struct sde_hw_fmt_layout *layout);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sde_format_check_modified_format - validate format and buffers for
|
* sde_format_check_modified_format - validate format and buffers for
|
||||||
* sde non-standard, i.e. modified format
|
* sde non-standard, i.e. modified format
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 and
|
* it under the terms of the GNU General Public License version 2 and
|
||||||
|
@ -44,17 +44,24 @@
|
||||||
enum sde_format_flags {
|
enum sde_format_flags {
|
||||||
SDE_FORMAT_FLAG_YUV_BIT,
|
SDE_FORMAT_FLAG_YUV_BIT,
|
||||||
SDE_FORMAT_FLAG_DX_BIT,
|
SDE_FORMAT_FLAG_DX_BIT,
|
||||||
|
SDE_FORMAT_FLAG_COMPRESSED_BIT,
|
||||||
SDE_FORMAT_FLAG_BIT_MAX,
|
SDE_FORMAT_FLAG_BIT_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SDE_FORMAT_FLAG_YUV BIT(SDE_FORMAT_FLAG_YUV_BIT)
|
#define SDE_FORMAT_FLAG_YUV BIT(SDE_FORMAT_FLAG_YUV_BIT)
|
||||||
#define SDE_FORMAT_FLAG_DX BIT(SDE_FORMAT_FLAG_DX_BIT)
|
#define SDE_FORMAT_FLAG_DX BIT(SDE_FORMAT_FLAG_DX_BIT)
|
||||||
|
#define SDE_FORMAT_FLAG_COMPRESSED BIT(SDE_FORMAT_FLAG_COMPRESSED_BIT)
|
||||||
#define SDE_FORMAT_IS_YUV(X) \
|
#define SDE_FORMAT_IS_YUV(X) \
|
||||||
(test_bit(SDE_FORMAT_FLAG_YUV_BIT, (X)->flag))
|
(test_bit(SDE_FORMAT_FLAG_YUV_BIT, (X)->flag))
|
||||||
#define SDE_FORMAT_IS_DX(X) \
|
#define SDE_FORMAT_IS_DX(X) \
|
||||||
(test_bit(SDE_FORMAT_FLAG_DX_BIT, (X)->flag))
|
(test_bit(SDE_FORMAT_FLAG_DX_BIT, (X)->flag))
|
||||||
#define SDE_FORMAT_IS_LINEAR(X) ((X)->fetch_mode == SDE_FETCH_LINEAR)
|
#define SDE_FORMAT_IS_LINEAR(X) ((X)->fetch_mode == SDE_FETCH_LINEAR)
|
||||||
#define SDE_FORMAT_IS_UBWC(X) ((X)->fetch_mode == SDE_FETCH_UBWC)
|
#define SDE_FORMAT_IS_TILE(X) \
|
||||||
|
(((X)->fetch_mode == SDE_FETCH_UBWC) && \
|
||||||
|
!test_bit(SDE_FORMAT_FLAG_COMPRESSED_BIT, (X)->flag))
|
||||||
|
#define SDE_FORMAT_IS_UBWC(X) \
|
||||||
|
(((X)->fetch_mode == SDE_FETCH_UBWC) && \
|
||||||
|
test_bit(SDE_FORMAT_FLAG_COMPRESSED_BIT, (X)->flag))
|
||||||
|
|
||||||
#define SDE_BLEND_FG_ALPHA_FG_CONST (0 << 0)
|
#define SDE_BLEND_FG_ALPHA_FG_CONST (0 << 0)
|
||||||
#define SDE_BLEND_FG_ALPHA_BG_CONST (1 << 0)
|
#define SDE_BLEND_FG_ALPHA_BG_CONST (1 << 0)
|
||||||
|
|
|
@ -257,6 +257,14 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
#define DRM_FORMAT_MOD_QCOM_TIGHT fourcc_mod_code(QCOM, 0x4)
|
#define DRM_FORMAT_MOD_QCOM_TIGHT fourcc_mod_code(QCOM, 0x4)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* QTI Tile Format
|
||||||
|
*
|
||||||
|
* Refers to a tile variant of the base format.
|
||||||
|
* Implementation may be platform and base-format specific.
|
||||||
|
*/
|
||||||
|
#define DRM_FORMAT_MOD_QCOM_TILE fourcc_mod_code(QCOM, 0x8)
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue