diff options
author | Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com> | 2018-11-01 15:11:31 +0000 |
---|---|---|
committer | Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com> | 2018-11-02 09:57:40 +0000 |
commit | 8db2dc852941cf1bc9ea22b4ba5c14b8c9ab7194 (patch) | |
tree | 325602f0be0fc353c92be40d5266f2a25f2d9d76 /drivers/gpu/drm/drm_framebuffer.c | |
parent | 55bc277d122402f3ee9f16cb037ec9a9ccd601e9 (diff) | |
download | linux-8db2dc852941cf1bc9ea22b4ba5c14b8c9ab7194.tar.gz linux-8db2dc852941cf1bc9ea22b4ba5c14b8c9ab7194.tar.bz2 linux-8db2dc852941cf1bc9ea22b4ba5c14b8c9ab7194.zip |
drm: Extend framebuffer_check to handle formats with cpp/char_per_block 0
For formats that are supported only with non-linear modifiers it
doesn't make to much sense to define cpp or char_per_block, so that
will be set to 0.
This patch adds a restriction to force having a modifier attached when
cpp/char_per_block is 0, and to bypass checking the pitch restriction.
This had been discussed here.
[1] https://people.freedesktop.org/~cbrill/dri-log/?channel=dri-devel&highlight_names=&date=2018-09-13&show_html=true
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181101151051.1509-5-alexandru-cosmin.gheorghe@arm.com
Diffstat (limited to 'drivers/gpu/drm/drm_framebuffer.c')
-rw-r--r-- | drivers/gpu/drm/drm_framebuffer.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index 6aca8a1ccdb6..167c1c4544af 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -195,8 +195,14 @@ static int framebuffer_check(struct drm_device *dev, for (i = 0; i < info->num_planes; i++) { unsigned int width = fb_plane_width(r->width, info, i); unsigned int height = fb_plane_height(r->height, info, i); + unsigned int block_size = info->char_per_block[i]; u64 min_pitch = drm_format_info_min_pitch(info, i, width); + if (!block_size && (r->modifier[i] == DRM_FORMAT_MOD_LINEAR)) { + DRM_DEBUG_KMS("Format requires non-linear modifier for plane %d\n", i); + return -EINVAL; + } + if (!r->handles[i]) { DRM_DEBUG_KMS("no buffer object handle for plane %d\n", i); return -EINVAL; @@ -208,7 +214,7 @@ static int framebuffer_check(struct drm_device *dev, if ((uint64_t) height * r->pitches[i] + r->offsets[i] > UINT_MAX) return -ERANGE; - if (r->pitches[i] < min_pitch) { + if (block_size && r->pitches[i] < min_pitch) { DRM_DEBUG_KMS("bad pitch %u for plane %d\n", r->pitches[i], i); return -EINVAL; } |