load pipe_r300 or pipe_r600 depending on the chip_id

needed for st/egl/kms which requests a "radeon" pipe
for both: r300 and r600 cards
---
 src/gallium/targets/egl/Makefile      |   15 ++++++++++++++-
 src/gallium/targets/egl/pipe_radeon.c |   24 ++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 1 deletions(-)
 create mode 100644 src/gallium/targets/egl/pipe_radeon.c

diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile
index 636fceb..625c1be 100644
--- a/src/gallium/targets/egl/Makefile
+++ b/src/gallium/targets/egl/Makefile
@@ -97,6 +97,16 @@ r300_LIBS := \
        $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
        $(TOP)/src/gallium/drivers/r300/libr300.a
 
+# radeon pipe driver (r300 + r600)
+radeon_CPPFLAGS := \
+       -I$(TOP)/src/gallium/state_trackers/egl \
+       -I$(TOP)/src/egl/main \
+       $(LIBDRM_CFLAGS)
+radeon_SYS := $(LIBDRM_LIB)
+radeon_LIBS := \
+       egl.o \
+       $(TOP)/src/gallium/state_trackers/egl/libegl.a
+
 # vmwgfx pipe driver
 vmwgfx_CPPFLAGS :=
 vmwgfx_SYS :=
@@ -151,7 +161,7 @@ ifneq ($(findstring nouveau/drm,$(GALLIUM_WINSYS_DIRS)),)
 OUTPUTS += nouveau
 endif
 ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
-OUTPUTS += r300
+OUTPUTS += r300 radeon
 endif
 ifneq ($(findstring svga/drm,$(GALLIUM_WINSYS_DIRS)),)
 OUTPUTS += vmwgfx
@@ -191,6 +201,9 @@ $(OUTPUT_PATH)/$(PIPE_PREFIX)nouveau.so: pipe_nouveau.o 
$(nouveau_LIBS)
 $(OUTPUT_PATH)/$(PIPE_PREFIX)r300.so: pipe_r300.o $(r300_LIBS)
        $(call mklib,r300)
 
+$(OUTPUT_PATH)/$(PIPE_PREFIX)radeon.so: pipe_radeon.o $(radeon_LIBS)
+       $(call mklib,radeon)
+
 $(OUTPUT_PATH)/$(PIPE_PREFIX)vmwgfx.so: pipe_vmwgfx.o $(vmwgfx_LIBS)
        $(call mklib,vmwgfx)
 
diff --git a/src/gallium/targets/egl/pipe_radeon.c 
b/src/gallium/targets/egl/pipe_radeon.c
new file mode 100644
index 0000000..6b802de
--- /dev/null
+++ b/src/gallium/targets/egl/pipe_radeon.c
@@ -0,0 +1,24 @@
+#include <xf86drm.h>
+#include <radeon_drm.h>
+
+#include "egldriver.h"
+#include "common/egl_g3d.h"
+
+#include "radeon/drm/radeon_drm.h"
+
+static struct pipe_screen *
+create_screen(int fd)
+{
+   int chip_id;
+
+   struct drm_radeon_info info = { .value = (unsigned long) &chip_id };
+
+   if (drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)) != 0)
+          return NULL;
+
+   return egl_g3d_driver(_eglMain(NULL))->loader->create_drm_screen(
+        is_r3xx(chip_id) ? "r300" : "r600", fd);
+}
+
+PUBLIC
+DRM_DRIVER_DESCRIPTOR("radeon", "radeon", create_screen)
-- 
1.7.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to