提交 08fb78e5 编写于 作者: D Dave Stevenson 提交者: Zheng Zengkai

drm: Checking of the pitch is only valid for linear formats

raspberrypi inclusion
category: feature
bugzilla: 50432

--------------------------------

framebuffer_check was computing a minimum pitch value and ensuring
that the provided value was greater than this.
That check is only valid if the format is linear.
Signed-off-by: NDave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: NFang Yafen <yafen@iscas.ac.cn>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 79869dfc
......@@ -217,12 +217,16 @@ static int framebuffer_check(struct drm_device *dev,
if (min_pitch > UINT_MAX)
return -ERANGE;
if ((uint64_t) height * r->pitches[i] + r->offsets[i] > UINT_MAX)
return -ERANGE;
if (block_size && r->pitches[i] < min_pitch) {
DRM_DEBUG_KMS("bad pitch %u for plane %d\n", r->pitches[i], i);
return -EINVAL;
if (r->modifier[i] == DRM_FORMAT_MOD_LINEAR) {
if ((uint64_t)height * r->pitches[i] + r->offsets[i] >
UINT_MAX)
return -ERANGE;
if (block_size && r->pitches[i] < min_pitch) {
DRM_DEBUG_KMS("bad pitch %u for plane %d\n",
r->pitches[i], i);
return -EINVAL;
}
}
if (r->modifier[i] && !(r->flags & DRM_MODE_FB_MODIFIERS)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册