From patchwork Thu May 7 18:56:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 6360621 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EBADC9F1C2 for ; Thu, 7 May 2015 18:57:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1AE4320392 for ; Thu, 7 May 2015 18:57:39 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 320E520303 for ; Thu, 7 May 2015 18:57:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A801272145; Thu, 7 May 2015 11:57:37 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qg0-f52.google.com (mail-qg0-f52.google.com [209.85.192.52]) by gabe.freedesktop.org (Postfix) with ESMTP id BA48E7213F for ; Thu, 7 May 2015 11:57:36 -0700 (PDT) Received: by qgeb100 with SMTP id b100so25722899qge.3 for ; Thu, 07 May 2015 11:57:36 -0700 (PDT) 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=6xPVcrFNc9N2hXffuSiqggT/fHAs6qLmzjWmPMpHLT4=; b=k6C8u/lFT2qI2O8SLNUxpvHwWCOaQ5Z63OeCTjboussc7iHdVY+OLDwSyN6I2xI+Ad luQ2CBN1ZRpIripcU/XDPlwbK3qByC5t1d4I9rR6Dgea7qWqfU17hbdmRbIm5wJ56A5/ tbQyQl3AZcdoxaPwVpCOY2fTuDcs5FSAoPTlQtm+ptNMKRYPEdNck9oKvrEUqCEciAM3 hygoAJRHM84BpFVOi3ZJ96H62+fL/99cyf8I0SPDCeU54IQViNR38TS+pnD4IAyMuIY1 wlfJuk/dxfRV6ILrK+4GzPIA6N2zdiNY+ovot8DeU1nd4bsfQPdRBl7D5EQD47BWWfkx 6tSg== X-Received: by 10.140.21.168 with SMTP id 37mr70889qgl.7.1431025056432; Thu, 07 May 2015 11:57:36 -0700 (PDT) Received: from localhost.localdomain ([187.121.142.45]) by mx.google.com with ESMTPSA id a8sm1955331qkh.43.2015.05.07.11.57.34 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 May 2015 11:57:35 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Thu, 7 May 2015 15:56:35 -0300 Message-Id: <1431024996-2267-8-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1431024996-2267-1-git-send-email-przanoni@gmail.com> References: <1431024996-2267-1-git-send-email-przanoni@gmail.com> Cc: Paulo Zanoni Subject: [Intel-gfx] [PATCH igt 7/8] tests/kms_fbc_crc: extract fill_mmap_{cpu, gtt}() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Paulo Zanoni Just like we have fill_render() and fill_blt(). I'm also going to use fill_mmap_gtt() for the code that generates the reference CRCs. Signed-off-by: Paulo Zanoni --- tests/kms_fbc_crc.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c index a66aa51..b52ac29 100644 --- a/tests/kms_fbc_crc.c +++ b/tests/kms_fbc_crc.c @@ -190,6 +190,29 @@ static void fill_render(data_t *data, uint32_t handle, gem_bo_busy(data->drm_fd, handle); } +static void fill_mmap_cpu(data_t *data, uint32_t handle, unsigned char color) +{ + void *ptr; + + ptr = gem_mmap__cpu(data->drm_fd, handle, 0, 4096, PROT_WRITE); + gem_set_domain(data->drm_fd, handle, I915_GEM_DOMAIN_CPU, + I915_GEM_DOMAIN_CPU); + memset(ptr, color, 4); + munmap(ptr, 4096); + gem_sw_finish(data->drm_fd, handle); +} + +static void fill_mmap_gtt(data_t *data, uint32_t handle, unsigned char color) +{ + void *ptr; + + ptr = gem_mmap__gtt(data->drm_fd, handle, 4096, PROT_WRITE); + gem_set_domain(data->drm_fd, handle, I915_GEM_DOMAIN_GTT, + I915_GEM_DOMAIN_GTT); + memset(ptr, color, 4); + munmap(ptr, 4096); +} + static bool fbc_enabled(data_t *data) { FILE *status; @@ -237,24 +260,16 @@ static void test_crc(data_t *data, enum test_mode mode) } switch (mode) { - void *ptr; drm_intel_context *context = NULL; case TEST_PAGE_FLIP: break; case TEST_MMAP_CPU: case TEST_PAGE_FLIP_AND_MMAP_CPU: - ptr = gem_mmap__cpu(data->drm_fd, handle, 0, 4096, PROT_WRITE); - gem_set_domain(data->drm_fd, handle, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU); - memset(ptr, 0xff, 4); - munmap(ptr, 4096); - gem_sw_finish(data->drm_fd, handle); + fill_mmap_cpu(data, handle, 0xff); break; case TEST_MMAP_GTT: case TEST_PAGE_FLIP_AND_MMAP_GTT: - ptr = gem_mmap__gtt(data->drm_fd, handle, 4096, PROT_WRITE); - gem_set_domain(data->drm_fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); - memset(ptr, 0xff, 4); - munmap(ptr, 4096); + fill_mmap_gtt(data, handle, 0xff); break; case TEST_BLT: case TEST_PAGE_FLIP_AND_BLT: