From patchwork Thu Apr 30 11:27:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 6302021 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0232EBEEE1 for ; Thu, 30 Apr 2015 11:28:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2B7B4201EC for ; Thu, 30 Apr 2015 11:28:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2932A201EF for ; Thu, 30 Apr 2015 11:28:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B9A646E7EE; Thu, 30 Apr 2015 04:28:03 -0700 (PDT) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id A1B3D6E7F1 for ; Thu, 30 Apr 2015 04:28:02 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 30 Apr 2015 04:28:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,676,1422950400"; d="scan'208";a="564222346" Received: from tursulin-linux.isw.intel.com ([10.102.226.59]) by orsmga003.jf.intel.com with ESMTP; 30 Apr 2015 04:28:01 -0700 From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Thu, 30 Apr 2015 12:27:55 +0100 Message-Id: <1430393275-23124-2-git-send-email-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.3.5 In-Reply-To: <1430393275-23124-1-git-send-email-tvrtko.ursulin@linux.intel.com> References: <1430393275-23124-1-git-send-email-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH i-g-t 2/2] kms_plane_scaling: Find the image regardless how the test is run 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=-3.2 required=5.0 tests=BAYES_00,HK_RANDOM_FROM, RCVD_IN_DNSWL_MED, 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: Tvrtko Ursulin As it stands running the test like "sudo tests/kms_plane_scaling" does not work. Fix it by using the same method igt_paint_image uses. Signed-off-by: Tvrtko Ursulin Cc: chandra konduru --- tests/kms_plane_scaling.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c index 00db5cb..8ff154f 100644 --- a/tests/kms_plane_scaling.c +++ b/tests/kms_plane_scaling.c @@ -202,6 +202,15 @@ static void iterate_plane_scaling(data_t *d, drmModeModeInfo *mode) } } +static cairo_status_t +stdio_read_func(void *closure, unsigned char* data, unsigned int size) +{ + if (fread(data, 1, size, (FILE*)closure) != size) + return CAIRO_STATUS_READ_ERROR; + + return CAIRO_STATUS_SUCCESS; +} + static void test_plane_scaling(data_t *d) { igt_display_t *display = &d->display; @@ -210,6 +219,7 @@ static void test_plane_scaling(data_t *d) enum pipe pipe; int valid_tests = 0; int primary_plane_scaling = 0; /* For now */ + FILE* f; igt_require(d->display.has_universal_planes); igt_require(d->num_scalers); @@ -223,11 +233,15 @@ static void test_plane_scaling(data_t *d) mode = igt_output_get_mode(output); /* allocate fb2 with image size */ - image = cairo_image_surface_create_from_png(FILE_NAME); + + f = igt_fopen_data(FILE_NAME); + image = cairo_image_surface_create_from_png_stream( + &stdio_read_func, f); igt_assert(cairo_surface_status(image) == CAIRO_STATUS_SUCCESS); d->image_w = cairo_image_surface_get_width(image); d->image_h = cairo_image_surface_get_height(image); cairo_surface_destroy(image); + fclose(f); d->fb_id2 = igt_create_fb(d->drm_fd, d->image_w, d->image_h, @@ -355,7 +369,6 @@ igt_simple_main igt_skip_on_simulation(); - data.drm_fd = drm_open_any(); igt_require_pipe_crc(); igt_display_init(&data.display, data.drm_fd);