[Mesa-dev] [PATCH] XXXsq: create standalone libxatracker library

Emil Velikov emil.l.velikov at gmail.com
Tue Feb 11 06:32:07 PST 2014


Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---

This is what I had in mind + a last second extra
 - drops the wrappers
 - clean up all the linker mayham
 - include $(top_srcdir)/install-lib-links.mk to handle symlinks for library

-Emil

 src/gallium/state_trackers/xa/Makefile.am  |  3 +-
 src/gallium/state_trackers/xa/xa_tracker.c | 10 +++---
 src/gallium/targets/xa/Makefile.am         | 26 +++++++---------
 src/gallium/targets/xa/xa.c                | 49 ------------------------------
 src/gallium/targets/xa/xa.h                | 37 ----------------------
 5 files changed, 17 insertions(+), 108 deletions(-)
 delete mode 100644 src/gallium/targets/xa/xa.c
 delete mode 100644 src/gallium/targets/xa/xa.h

diff --git a/src/gallium/state_trackers/xa/Makefile.am b/src/gallium/state_trackers/xa/Makefile.am
index af79ccd..c61c427 100644
--- a/src/gallium/state_trackers/xa/Makefile.am
+++ b/src/gallium/state_trackers/xa/Makefile.am
@@ -29,7 +29,8 @@ AM_CFLAGS = \
 	$(VISIBILITY_CFLAGS)
 
 AM_CPPFLAGS = \
-	-I$(top_srcdir)/src/gallium/targets/xa \
+	$(GALLIUM_PIPE_LOADER_DEFINES) \
+	-DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\" \
 	-I$(top_srcdir)/src/gallium/ \
 	-I$(top_srcdir)/src/gallium/winsys \
 	-I$(top_srcdir)/src/gallium/drivers
diff --git a/src/gallium/state_trackers/xa/xa_tracker.c b/src/gallium/state_trackers/xa/xa_tracker.c
index 6943a29..31a9854 100644
--- a/src/gallium/state_trackers/xa/xa_tracker.c
+++ b/src/gallium/state_trackers/xa/xa_tracker.c
@@ -28,7 +28,6 @@
 
 #include "xa_tracker.h"
 #include "xa_priv.h"
-#include "xa.h"
 #include "pipe/p_state.h"
 #include "pipe/p_format.h"
 #include "pipe-loader/pipe_loader.h"
@@ -145,9 +144,8 @@ xa_tracker_create(int drm_fd)
     if (!xa)
 	return NULL;
 
-    xa->dev = xa_pipe_probe(drm_fd);
-    if (xa->dev)
-	xa->screen = xa_pipe_create_screen(xa->dev);
+    if (pipe_loader_drm_probe_fd(&xa->dev, drm_fd))
+	xa->screen = pipe_loader_create_screen(xa->dev, PIPE_SEARCH_DIR);
     if (!xa->screen)
 	goto out_no_screen;
 
@@ -195,7 +193,7 @@ xa_tracker_create(int drm_fd)
     xa->screen->destroy(xa->screen);
  out_no_screen:
     if (xa->dev)
-	xa_pipe_release(xa->dev);
+	pipe_loader_release(xa->dev, 1);
     free(xa);
     return NULL;
 }
@@ -206,7 +204,7 @@ xa_tracker_destroy(struct xa_tracker *xa)
     free(xa->supported_formats);
     xa_context_destroy(xa->default_ctx);
     xa->screen->destroy(xa->screen);
-    xa_pipe_release(xa->dev);
+    pipe_loader_release(xa->dev, 1);
     free(xa);
 }
 
diff --git a/src/gallium/targets/xa/Makefile.am b/src/gallium/targets/xa/Makefile.am
index dddb05c..59b5790 100644
--- a/src/gallium/targets/xa/Makefile.am
+++ b/src/gallium/targets/xa/Makefile.am
@@ -23,11 +23,10 @@
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CPPFLAGS = \
+	$(GALLIUM_PIPE_LOADER_DEFINES) \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src/gallium/state_trackers/xa \
-	-I$(top_srcdir)/src/gallium/winsys \
-	$(GALLIUM_PIPE_LOADER_DEFINES) \
-	-DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
+	-I$(top_srcdir)/src/gallium/winsys
 
 AM_CFLAGS = \
 	$(GALLIUM_CFLAGS) \
@@ -39,7 +38,8 @@ pkgconfig_DATA = xatracker.pc
 
 lib_LTLIBRARIES = libxatracker.la
 
-libxatracker_la_SOURCES = xa.c
+libxatracker_la_SOURCES =
+nodist_EXTRA_libxatracker_la_SOURCES = dummy.cpp
 
 libxatracker_la_LIBADD = \
 	$(GALLIUM_PIPE_LOADER_LIBS) \
@@ -50,19 +50,15 @@ libxatracker_la_LIBADD = \
 	$(LIBDRM_LIBS)
 
 libxatracker_la_LDFLAGS = \
-	-no-undefined \
-	-version-number $(XA_MAJOR):$(XA_MINOR):$(XA_TINY)
+	-module \
+	-version-number $(XA_MAJOR):$(XA_MINOR):$(XA_TINY) \
+	-shared \
+	-no-undefined
 
-# FIXME: this shouldn't be needed
-if HAVE_MESA_LLVM
-libxatracker_la_LINK = $(CXXLINK) $(libxatracker_la_LDFLAGS)
-# Mention a dummy pure C++ file to trigger generation of the $(LINK) variable
-nodist_EXTRA_libxatracker_la_SOURCES = dummy-cpp.cpp
 
+if HAVE_MESA_LLVM
 libxatracker_la_LIBADD += $(LLVM_LIBS)
 libxatracker_la_LDFLAGS += $(LLVM_LDFLAGS)
-else
-libxatracker_la_LINK = $(CXXLINK) $(libxatracker_la_LDFLAGS)
-# Mention a dummy pure C file to trigger generation of the $(LINK) variable
-nodist_EXTRA_libxatracker_la_SOURCES = dummy-c.c
 endif
+
+include $(top_srcdir)/install-lib-links.mk
diff --git a/src/gallium/targets/xa/xa.c b/src/gallium/targets/xa/xa.c
deleted file mode 100644
index e3ceaf6..0000000
--- a/src/gallium/targets/xa/xa.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2014 Red Hat
- *
- * 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:
- *    Rob Clark <robclark at freedesktop.org>
- */
-
-#include "xa.h"
-
-struct pipe_loader_device *
-xa_pipe_probe(int fd)
-{
-    struct pipe_loader_device *dev;
-    if (pipe_loader_drm_probe_fd(&dev, fd))
-	return dev;
-    return NULL;
-}
-
-void
-xa_pipe_release(struct pipe_loader_device *dev)
-{
-    if (dev)
-	pipe_loader_release(&dev, 1);
-}
-
-struct pipe_screen *
-xa_pipe_create_screen(struct pipe_loader_device *dev)
-{
-    return pipe_loader_create_screen(dev, PIPE_SEARCH_DIR);
-}
diff --git a/src/gallium/targets/xa/xa.h b/src/gallium/targets/xa/xa.h
deleted file mode 100644
index 9de6851..0000000
--- a/src/gallium/targets/xa/xa.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2014 Red Hat
- *
- * 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:
- *    Rob Clark <robclark at freedesktop.org>
- */
-
-#ifndef _XA_H_
-#define _XA_H_
-
-#include "pipe/p_screen.h"
-#include "pipe-loader/pipe_loader.h"
-
-struct pipe_loader_device *xa_pipe_probe(int fd);
-void xa_pipe_release(struct pipe_loader_device *dev);
-struct pipe_screen * xa_pipe_create_screen(struct pipe_loader_device *dev);
-
-#endif /* _XA_H_ */
-- 
1.8.5.4



More information about the mesa-dev mailing list