From patchwork Tue Nov 12 11:50:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: oscar.mateo@intel.com X-Patchwork-Id: 3171621 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E0E8A9F693 for ; Tue, 12 Nov 2013 10:54:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9494A203AF for ; Tue, 12 Nov 2013 10:54:30 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 622A42024D for ; Tue, 12 Nov 2013 10:54:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 57B51FA93E; Tue, 12 Nov 2013 02:54:27 -0800 (PST) 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 8A580FA934 for ; Tue, 12 Nov 2013 02:54:13 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 12 Nov 2013 02:54:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,535,1378882800"; d="scan'208";a="433802921" Received: from omateolo-linux2.isw.intel.com ([10.102.226.43]) by orsmga002.jf.intel.com with ESMTP; 12 Nov 2013 02:54:12 -0800 From: oscar.mateo@intel.com To: intel-gfx@lists.freedesktop.org Date: Tue, 12 Nov 2013 11:50:39 +0000 Message-Id: <1384257045-15524-6-git-send-email-oscar.mateo@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1384257045-15524-1-git-send-email-oscar.mateo@intel.com> References: <1384257045-15524-1-git-send-email-oscar.mateo@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] =?utf-8?q?=5BPATCH_v2_05/11=5D_rendercopy=3A_Remove_r?= =?utf-8?q?endercopy=2Ec?= X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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: Oscar Mateo Move scratch_buf_write_to_png() to its only user, gem_render_copy.c. This makes the cairo dependencies easier to handle from the Android perspective, but if there is a good reason why this file exists I can try to handle it differently. Signed-off-by: Oscar Mateo --- lib/Makefile.sources | 1 - lib/rendercopy.c | 49 ----------------------------------------------- lib/rendercopy.h | 2 -- tests/gem_render_copy.c | 21 ++++++++++++++++++++ 4 files changed, 21 insertions(+), 52 deletions(-) delete mode 100644 lib/rendercopy.c diff --git a/lib/Makefile.sources b/lib/Makefile.sources index 78e2034..699621b 100644 --- a/lib/Makefile.sources +++ b/lib/Makefile.sources @@ -28,7 +28,6 @@ libintel_tools_la_SOURCES = \ rendercopy_gen7.c \ rendercopy_gen8.c \ rendercopy.h \ - rendercopy.c \ intel_reg_map.c \ intel_dpio.c \ intel_iosf.c \ diff --git a/lib/rendercopy.c b/lib/rendercopy.c deleted file mode 100644 index 2c1684d..0000000 --- a/lib/rendercopy.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright © 2013 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - * Authors: - * Damien Lespiau - */ - -#include - -#include "rendercopy.h" - -void scratch_buf_write_to_png(struct scratch_buf *buf, const char *filename) -{ - cairo_surface_t *surface; - cairo_status_t ret; - - drm_intel_bo_map(buf->bo, 0); - surface = cairo_image_surface_create_for_data(buf->bo->virtual, - CAIRO_FORMAT_RGB24, - buf_width(buf), - buf_height(buf), - buf->stride); - ret = cairo_surface_write_to_png(surface, filename); - if (ret != CAIRO_STATUS_SUCCESS) { - fprintf(stderr, "%s: %s\n", __func__, - cairo_status_to_string(ret)); - } - cairo_surface_destroy(surface); - drm_intel_bo_unmap(buf->bo); -} diff --git a/lib/rendercopy.h b/lib/rendercopy.h index 4605264..f726df6 100644 --- a/lib/rendercopy.h +++ b/lib/rendercopy.h @@ -89,6 +89,4 @@ void gen2_render_copyfunc(struct intel_batchbuffer *batch, unsigned width, unsigned height, struct scratch_buf *dst, unsigned dst_x, unsigned dst_y); -void scratch_buf_write_to_png(struct scratch_buf *buf, const char *filename); - #endif /* RENDERCOPY_H */ diff --git a/tests/gem_render_copy.c b/tests/gem_render_copy.c index e481733..ed49622 100644 --- a/tests/gem_render_copy.c +++ b/tests/gem_render_copy.c @@ -31,6 +31,7 @@ #include #include +#include #include "rendercopy.h" @@ -49,6 +50,26 @@ typedef struct { uint32_t linear[WIDTH * HEIGHT]; } data_t; +static void scratch_buf_write_to_png(struct scratch_buf *buf, const char *filename) +{ + cairo_surface_t *surface; + cairo_status_t ret; + + drm_intel_bo_map(buf->bo, 0); + surface = cairo_image_surface_create_for_data(buf->bo->virtual, + CAIRO_FORMAT_RGB24, + buf_width(buf), + buf_height(buf), + buf->stride); + ret = cairo_surface_write_to_png(surface, filename); + if (ret != CAIRO_STATUS_SUCCESS) { + fprintf(stderr, "%s: %s\n", __func__, + cairo_status_to_string(ret)); + } + cairo_surface_destroy(surface); + drm_intel_bo_unmap(buf->bo); +} + static void scratch_buf_init(data_t *data, struct scratch_buf *buf, int width, int height, int stride, uint32_t color) {