drm/amd/display: Store gem objects for planes 1-3
Also do the proper validation which was missed. Besides the missing validation, not storing the objects in the framebuffer led to wrong results in the getfb2 ioctl. Note that this should really have been done for multi-plane formats like NV12 already before modifiers landed. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
544645f2ec
commit
3505b2ff53
|
@ -687,13 +687,26 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
|
|||
const struct drm_mode_fb_cmd2 *mode_cmd,
|
||||
struct drm_gem_object *obj)
|
||||
{
|
||||
int ret;
|
||||
int ret, i;
|
||||
rfb->base.obj[0] = obj;
|
||||
drm_helper_mode_fill_fb_struct(dev, &rfb->base, mode_cmd);
|
||||
ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
|
||||
if (ret)
|
||||
goto fail;
|
||||
|
||||
/*
|
||||
* This needs to happen before modifier conversion as that might change
|
||||
* the number of planes.
|
||||
*/
|
||||
for (i = 1; i < rfb->base.format->num_planes; ++i) {
|
||||
if (mode_cmd->handles[i] != mode_cmd->handles[0]) {
|
||||
dev_err(&dev->pdev->dev, "Plane 0 and %d have different BOs: %u vs. %u\n",
|
||||
i, mode_cmd->handles[0], mode_cmd->handles[i]);
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
ret = amdgpu_display_get_fb_info(rfb, &rfb->tiling_flags, &rfb->tmz_surface);
|
||||
if (ret)
|
||||
goto fail;
|
||||
|
@ -705,6 +718,11 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
|
|||
goto fail;
|
||||
}
|
||||
|
||||
for (i = 1; i < rfb->base.format->num_planes; ++i) {
|
||||
rfb->base.obj[i] = rfb->base.obj[0];
|
||||
drm_gem_object_get(rfb->base.obj[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
|
|
Loading…
Reference in New Issue