drm/tegra: Add tiling FB modifiers

Add FB modifiers to allow user-space to specify that a surface is in one
of the two tiling formats supported by Tegra chips, and add support in
the tegradrm driver to handle them properly. This is necessary for the
display controller to directly display buffers generated by the GPU.

This feature is intended to replace the dedicated IOCTL enabled
by TEGRA_STAGING and to provide a non-staging alternative to that
solution.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Thierry Reding <treding@nvidia.com>
此提交包含在:
Alexandre Courbot
2016-11-08 16:50:42 +09:00
提交者 Thierry Reding
父節點 bdd2f9cd10
當前提交 5e91144dd7
共有 3 個檔案被更改,包括 66 行新增2 行删除

查看文件

@@ -164,6 +164,8 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
drm->mode_config.max_width = 4096;
drm->mode_config.max_height = 4096;
drm->mode_config.allow_fb_modifiers = true;
drm->mode_config.funcs = &tegra_drm_mode_funcs;
err = tegra_drm_fb_prepare(drm);

查看文件

@@ -52,9 +52,26 @@ int tegra_fb_get_tiling(struct drm_framebuffer *framebuffer,
struct tegra_bo_tiling *tiling)
{
struct tegra_fb *fb = to_tegra_fb(framebuffer);
uint64_t modifier = fb->base.modifier;
/* TODO: handle YUV formats? */
*tiling = fb->planes[0]->tiling;
switch (fourcc_mod_tegra_mod(modifier)) {
case NV_FORMAT_MOD_TEGRA_TILED:
tiling->mode = TEGRA_BO_TILING_MODE_TILED;
tiling->value = 0;
break;
case NV_FORMAT_MOD_TEGRA_16BX2_BLOCK(0):
tiling->mode = TEGRA_BO_TILING_MODE_BLOCK;
tiling->value = fourcc_mod_tegra_param(modifier);
if (tiling->value > 5)
return -EINVAL;
break;
default:
/* TODO: handle YUV formats? */
*tiling = fb->planes[0]->tiling;
break;
}
return 0;
}