Re: [PATCH 2/2] drm/i915: Fail addfb ioctl if color and CCS buffers overlap

Gabriel Krisman Bertazi
2017-09-01T04:35:09Z

Ben Widawsky <ben@bwidawsk.net> writes:

> On 17-08-31 16:52:15, Gabriel Krisman Bertazi wrote:
>>With this patch the new testcase igt@kms_ccs@pipe-X-invalid-ccs-offset
>>succeeds.
>>
>>Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
>>---
>> drivers/gpu/drm/i915/intel_display.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>>diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
>>index b28f076f98bc..ff1ed67a9eff 100644
>>--- a/drivers/gpu/drm/i915/intel_display.c
>>+++ b/drivers/gpu/drm/i915/intel_display.c
>>@@ -13989,6 +13989,11 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
>> DRM_DEBUG_KMS("RC supported only with RGB8888 formats\n");
>> goto err;
>> }
>>+
>>+ if (mode_cmd->offsets[1] < mode_cmd->pitches[0]) {
>>+ DRM_DEBUG_KMS("CCS and color buffers overlap\n");
>>+ return -EINVAL;
>>+ }
>
> This check doesn't look nearly strict enough to determine overlap. All it's
> checking is that the aux buffer isn't in the first row of the main buffer.
> Second of all, while today our requirement is that the aux buffer always come
> after the main buffer, that may not be the case forever.

Right. Thanks for catching it. I'll re-spin with a more strict (and
correct) test for overlapping.

--
Gabriel Krisman Bertazi