From patchwork Fri Nov 25 09:35:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Varad Gautam X-Patchwork-Id: 84083 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp46714qgi; Fri, 25 Nov 2016 01:35:43 -0800 (PST) X-Received: by 10.98.149.140 with SMTP id c12mr6862488pfk.100.1480066543460; Fri, 25 Nov 2016 01:35:43 -0800 (PST) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id u62si43658294pgc.183.2016.11.25.01.35.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Nov 2016 01:35:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of piglit-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: best guess record for domain of piglit-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=piglit-bounces@lists.freedesktop.org; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8E9346EB4B; Fri, 25 Nov 2016 09:35:42 +0000 (UTC) X-Original-To: piglit@lists.freedesktop.org Delivered-To: piglit@lists.freedesktop.org Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 331776EAF4 for ; Fri, 25 Nov 2016 09:35:41 +0000 (UTC) Received: by mail-pg0-x243.google.com with SMTP id x23so5161064pgx.3 for ; Fri, 25 Nov 2016 01:35:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QEHtDRBcUSnNup8eVNDJwtrJ+Z22RhZiEkNwPjzKB4Y=; b=jmmVmVqjI3NmXWMrlIIVNymymFhxhrbTyhfno2rvGzgm4GCYqPCz4mUc4YKy1zV4Ot 42hZHTTgu78YAsbpcaC/wwaVePTFZELbmTYYHm0fClt31ckXEYU5nwIo4c8Mk7XiH1Hs /ncMyCoOxH5oUe42WvI3d4/fLpoX2qwarXpqR9IvwBFizbg2NgEJcW6REoz1YmWii5lK dwW3uwWQAGw9Ibf8B6oX92Z93hFtGC05ravehjt2yaKdLkIdwGU7FbTifTT1X+vRNF5D ET74Cij1u+dNX29aZM7acJuWvUWMQS94VGSeoKtpgnILTyr6iU/oUEVfYPwvMvyZmEtw ZZxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QEHtDRBcUSnNup8eVNDJwtrJ+Z22RhZiEkNwPjzKB4Y=; b=CgSUCifH+LN3tco8Fx8vkYlVtLPN6H3fIUbBjGOEBfsc86wGfVNDRxUx9cQ6VtcnvA vF8/azL/S1Wdd7DbolikFvVLwyWfWzwaWwlb75HFwPWD25PRodFYUUTuFC5hkncFEw6n agUgeZUhVZNpJSE4/k5UdSgXB6p4wOuEJtYB+OlGz4tQsmEhBGE7HmQTTPA2Qp4UKlAB Dnn3rqmsLuK995nsxx/iraVufEsndzEH0tCCm1icHklAxPMNPSjP5G/6t4S4zCftivZe JLlugOiF+RmZhIbEaYGyI1jo0CFBhgGZpRy8B7A35D8Jy9gzOu+BmC9GGKtvraVzvQHi TxTA== X-Gm-Message-State: AKaTC03t8F/CdyMcUxBsNUzZnrKs1Cqzgt5ANlhphsP49sh95jguRmtHCPjByVg9YT0MEQ== X-Received: by 10.84.179.67 with SMTP id a61mr15066103plc.98.1480066540673; Fri, 25 Nov 2016 01:35:40 -0800 (PST) Received: from linux-e1tz.suse ([122.168.223.25]) by smtp.googlemail.com with ESMTPSA id y73sm66241752pfa.68.2016.11.25.01.35.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 Nov 2016 01:35:40 -0800 (PST) From: Varad Gautam To: piglit@lists.freedesktop.org Date: Fri, 25 Nov 2016 15:05:16 +0530 Message-Id: <1480066519-20283-4-git-send-email-varadgautam@gmail.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1480066519-20283-1-git-send-email-varadgautam@gmail.com> References: <1480066519-20283-1-git-send-email-varadgautam@gmail.com> Cc: Varad Gautam Subject: [Piglit] [PATCH 3/6] ext_image_dma_buf_import/invalid_attributes: fail on incomplete modifiers X-BeenThere: piglit@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: piglit-bounces@lists.freedesktop.org Sender: "Piglit" From: Varad Gautam incomplete modifier attributes must be treated as invalid as per EGL_EXT_image_dma_buf_import_modifiers. Signed-off-by: Varad Gautam --- .../ext_image_dma_buf_import/invalid_attributes.c | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/tests/spec/ext_image_dma_buf_import/invalid_attributes.c b/tests/spec/ext_image_dma_buf_import/invalid_attributes.c index cc0b046..edda9bc 100644 --- a/tests/spec/ext_image_dma_buf_import/invalid_attributes.c +++ b/tests/spec/ext_image_dma_buf_import/invalid_attributes.c @@ -54,6 +54,53 @@ PIGLIT_GL_TEST_CONFIG_END #define DRM_FORMAT_INVALID fourcc_code('F', 'O', 'O', '0') static bool +test_half_modifier(unsigned w, unsigned h, int fd, unsigned stride, + unsigned offset) { + const EGLint attr_lo[15] = { + EGL_HEIGHT, h, + EGL_WIDTH, w, + EGL_LINUX_DRM_FOURCC_EXT, DRM_FORMAT_ARGB8888, + EGL_DMA_BUF_PLANE0_FD_EXT, fd, + EGL_DMA_BUF_PLANE0_OFFSET_EXT, offset, + EGL_DMA_BUF_PLANE0_PITCH_EXT, stride, + EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, 1, + EGL_NONE }; + + const EGLint attr_hi[15] = { + EGL_HEIGHT, h, + EGL_WIDTH, w, + EGL_LINUX_DRM_FOURCC_EXT, DRM_FORMAT_ARGB8888, + EGL_DMA_BUF_PLANE0_FD_EXT, fd, + EGL_DMA_BUF_PLANE0_OFFSET_EXT, offset, + EGL_DMA_BUF_PLANE0_PITCH_EXT, stride, + EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, 1, + EGL_NONE }; + + EGLImageKHR img = eglCreateImageKHR(eglGetCurrentDisplay(), + EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, + (EGLClientBuffer)NULL, attr_lo); + + if (!piglit_check_egl_error(EGL_BAD_PARAMETER)) { + if (img) + eglDestroyImageKHR(eglGetCurrentDisplay(), img); + return false; + } + eglDestroyImageKHR(eglGetCurrentDisplay(), img); + + img = eglCreateImageKHR(eglGetCurrentDisplay(), + EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, + (EGLClientBuffer)NULL, attr_hi); + + if (!piglit_check_egl_error(EGL_BAD_PARAMETER)) { + if (img) + eglDestroyImageKHR(eglGetCurrentDisplay(), img); + return false; + } + + return true; +} + +static bool test_excess_attributes(unsigned w, unsigned h, int fd, unsigned stride, unsigned offset, EGLint attr_id, EGLint attr_val) { @@ -238,6 +285,14 @@ piglit_display(void) pass = test_invalid_format(w, h, buf->fd, buf->stride[0], buf->offset[0]) && pass; pass = test_pitch_zero(w, h, buf->fd, buf->stride[0], buf->offset[0]) && pass; + if (piglit_is_egl_extension_supported(eglGetCurrentDisplay(), + "EGL_EXT_image_dma_buf_import_modifiers")) { + pass = test_half_modifier(w, h, buf->fd, buf->stride[0], + buf->offset[0]) && pass; + pass = test_half_modifier(w, h, buf->fd, buf->stride[0], + buf->offset[0]) && pass; + } + /** * EGL stack can claim the ownership of the file descriptor only when it * succeeds. Close the file descriptor here and check that it really