diff mbox

[v2,05/11] rendercopy: Remove rendercopy.c

Message ID 1384257045-15524-6-git-send-email-oscar.mateo@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

oscar.mateo@intel.com Nov. 12, 2013, 11:50 a.m. UTC
From: Oscar Mateo <oscar.mateo@intel.com>

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 <oscar.mateo@intel.com>
---
 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 mbox

Patch

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 <damien.lespiau@intel.com>
- */
-
-#include <cairo.h>
-
-#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 <stdbool.h>
 #include <unistd.h>
+#include <cairo.h>
 
 #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)
 {