Initial Cell driver infrastructure.
No real code yet. Just stand-ins and make/build infrastructure.
This commit is contained in:
parent
233c374d02
commit
88b715b049
1
Makefile
1
Makefile
|
@ -97,6 +97,7 @@ irix6-o32-static \
|
|||
linux \
|
||||
linux-alpha \
|
||||
linux-alpha-static \
|
||||
linux-cell \
|
||||
linux-debug \
|
||||
linux-directfb \
|
||||
linux-dri \
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
# linux-cell
|
||||
|
||||
include $(TOP)/configs/default
|
||||
|
||||
CONFIG_NAME = linux-cell
|
||||
|
||||
|
||||
# Compiler and flags
|
||||
CC = /usr/bin/ppu32-gcc
|
||||
CXX = /usr/bin/ppu32-g++
|
||||
|
||||
# Cell SDK location
|
||||
SDK = /opt/ibm/cell-sdk/prototype/sysroot/usr
|
||||
|
||||
|
||||
CFLAGS = -g -W -Wall -Winline -m32 -mabi=altivec -maltivec -I. -I/usr/include -I$(SDK)/include -include altivec.h
|
||||
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
|
||||
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread \
|
||||
-L$(SDK)/lib -m32 -Wl,-m,elf32ppc -R$(SDK)/lib -lspe
|
||||
|
||||
|
||||
|
||||
### SPU stuff
|
||||
|
||||
SPU_CC = /usr/bin/spu-gcc
|
||||
|
||||
SPU_CFLAGS = -g -W -Wall -Winline -Wno-main -I. -I $(SDK)/spu/include -include spu_intrinsics.h -I $(TOP)/src/mesa/
|
||||
|
||||
SPU_LFLAGS = -L$(SDK)/spu/lib -Wl,-N -lmisc
|
||||
|
||||
SPU_AR = /usr/bin/ar
|
||||
SPU_AR_FLAGS = -qcs
|
||||
|
||||
SPU_EMBED = /usr/bin/embedspu
|
||||
SPU_EMBED_FLAGS = -m32
|
|
@ -13,6 +13,11 @@ GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
|
|||
|
||||
SOFTPIPE_LIB = $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a
|
||||
|
||||
ifeq ($(CONFIG_NAME), linux-cell)
|
||||
CELL_LIB = $(TOP)/src/mesa/pipe/cell/ppu/libcell.a
|
||||
endif
|
||||
|
||||
|
||||
.SUFFIXES : .cpp
|
||||
|
||||
.c.o:
|
||||
|
@ -112,12 +117,12 @@ stand-alone: depend subdirs $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$
|
|||
osmesa-only: depend subdirs $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)
|
||||
|
||||
# Make the GL library
|
||||
$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS) $(SOFTPIPE_LIB)
|
||||
$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS) $(SOFTPIPE_LIB) $(CELL_LIB)
|
||||
@ $(TOP)/bin/mklib -o $(GL_LIB) \
|
||||
-major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \
|
||||
-install $(TOP)/$(LIB_DIR) \
|
||||
$(MKLIB_OPTIONS) $(STAND_ALONE_OBJECTS) \
|
||||
$(SOFTPIPE_LIB) $(GL_LIB_DEPS)
|
||||
$(SOFTPIPE_LIB) $(CELL_LIB)$(GL_LIB_DEPS)
|
||||
|
||||
# Make the OSMesa library
|
||||
$(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OSMESA_DRIVER_OBJECTS) $(OSMESA16_OBJECTS)
|
||||
|
|
|
@ -1,7 +1,25 @@
|
|||
default:
|
||||
cd softpipe ; make
|
||||
cd i915simple ; make
|
||||
cd failover ; make
|
||||
|
||||
TOP = ../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
|
||||
ifeq ($(CONFIG_NAME), linux-cell)
|
||||
CELL_DIR = cell
|
||||
endif
|
||||
|
||||
SUBDIRS = softpipe i915simple failover $(CELL_DIR)
|
||||
|
||||
|
||||
default: subdirs
|
||||
|
||||
|
||||
subdirs:
|
||||
@for dir in $(SUBDIRS) ; do \
|
||||
if [ -d $$dir ] ; then \
|
||||
(cd $$dir && $(MAKE)) || exit 1 ; \
|
||||
fi \
|
||||
done
|
||||
|
||||
|
||||
clean:
|
||||
rm -f `find . -name \*.[oa]`
|
|
@ -0,0 +1,12 @@
|
|||
# Cell Gallium driver Makefile
|
||||
|
||||
|
||||
default:
|
||||
( cd spu ; make )
|
||||
( cd ppu ; make )
|
||||
|
||||
|
||||
|
||||
clean:
|
||||
( cd spu ; make clean )
|
||||
( cd ppu ; make clean )
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
#ifndef CELL_COMMON_H
|
||||
#define CELL_COMMON_H
|
||||
|
||||
|
||||
struct init_info
|
||||
{
|
||||
int foo;
|
||||
int bar;
|
||||
};
|
||||
|
||||
|
||||
#endif /* CELL_COMMON_H */
|
|
@ -0,0 +1,39 @@
|
|||
# Gallium3D Cell driver: PPU code
|
||||
|
||||
# This makefile builds the g3dcell.a library which gets pulled into
|
||||
# the main libGL.so library
|
||||
|
||||
|
||||
TOP = ../../../../..
|
||||
include $(TOP)/configs/linux-cell
|
||||
|
||||
|
||||
#PROG = gl4
|
||||
|
||||
CELL_LIB = libcell.a
|
||||
|
||||
SPU_CODE_MODULE = ../spu/g3d_spu.a
|
||||
|
||||
OBJECTS = cell_context.o cell_surface.o
|
||||
|
||||
INCLUDE_DIRS = -I$(TOP)/src/mesa
|
||||
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
|
||||
|
||||
|
||||
|
||||
default: $(CELL_LIB)
|
||||
|
||||
|
||||
$(CELL_LIB): $(OBJECTS) $(SPU_CODE_MODULE)
|
||||
ar -ru $(CELL_LIB) $(OBJECTS) $(SPU_CODE_MODULE)
|
||||
|
||||
#$(PROG): $(PPU_OBJECTS)
|
||||
# $(CC) -o $(PROG) $(PPU_OBJECTS) $(SPU_CODE_MODULE) $(PPU_LFLAGS)
|
||||
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.o $(CELL_LIB)
|
|
@ -0,0 +1,76 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* 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, sub license, 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 NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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
|
||||
* Brian Paul
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <libspe.h>
|
||||
#include <libmisc.h>
|
||||
#include "pipe/cell/ppu/cell_context.h"
|
||||
#include "pipe/cell/common.h"
|
||||
|
||||
#define NUM_SPUS 6
|
||||
|
||||
|
||||
extern spe_program_handle_t g3d_spu;
|
||||
|
||||
static speid_t speid[NUM_SPUS];
|
||||
static struct init_info inits[NUM_SPUS];
|
||||
|
||||
|
||||
static void
|
||||
start_spus(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_SPUS; i++) {
|
||||
inits[i].foo = i;
|
||||
inits[i].bar = i * 10;
|
||||
|
||||
speid[i] = spe_create_thread(0, /* gid */
|
||||
&g3d_spu, /* spe program handle */
|
||||
&inits[i], /* argp */
|
||||
NULL, /* envp */
|
||||
-1, /* mask */
|
||||
0 ); /* flags */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void cell_create_context(void)
|
||||
{
|
||||
printf("cell_create_context\n");
|
||||
|
||||
start_spus();
|
||||
|
||||
/* TODO: do something with the SPUs! */
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* 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, sub license, 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 NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#ifndef CELL_CONTEXT_H
|
||||
#define CELL_CONTEXT_H
|
||||
|
||||
|
||||
#include "pipe/p_context.h"
|
||||
|
||||
|
||||
|
||||
struct cell_context
|
||||
{
|
||||
struct pipe_context pipe;
|
||||
|
||||
int spu_info;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* CELL_CONTEXT_H */
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
void cell_create_surface(void)
|
||||
{
|
||||
printf("cell_create_surface\n");
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
# Gallium3D Cell driver: PPU code
|
||||
|
||||
# This makefile builds the g3d_spu.a file that's linked into the
|
||||
# PPU code/library.
|
||||
|
||||
|
||||
TOP = ../../../../..
|
||||
include $(TOP)/configs/linux-cell
|
||||
|
||||
|
||||
PROG = g3d
|
||||
|
||||
PROG_SPU = $(PROG)_spu
|
||||
PROG_SPU_A = $(PROG)_spu.a
|
||||
PROG_SPU_EMBED_O = $(PROG)_spu-embed.o
|
||||
|
||||
|
||||
SPU_OBJECTS = main.o tri.o
|
||||
|
||||
|
||||
# The .a file will be linked into the main/PPU executable
|
||||
default: $(PROG_SPU_A)
|
||||
|
||||
$(PROG_SPU_A): $(PROG_SPU_EMBED_O)
|
||||
$(SPU_AR) $(SPU_AR_FLAGS) $(PROG_SPU_A) $(PROG_SPU_EMBED_O)
|
||||
|
||||
$(PROG_SPU_EMBED_O): $(PROG_SPU)
|
||||
$(SPU_EMBED) $(SPU_EMBED_FLAGS) $(PROG_SPU) $(PROG_SPU) $(PROG_SPU_EMBED_O)
|
||||
|
||||
$(PROG_SPU): $(SPU_OBJECTS)
|
||||
$(SPU_CC) -o $(PROG_SPU) $(SPU_OBJECTS) $(SPU_LFLAGS)
|
||||
|
||||
|
||||
main.o: main.c
|
||||
$(SPU_CC) $(SPU_CFLAGS) -c main.c
|
||||
|
||||
tri.o: tri.c
|
||||
$(SPU_CC) $(SPU_CFLAGS) -c tri.c
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a *.d $(PROG_SPU)
|
|
@ -0,0 +1,29 @@
|
|||
/* main.c for cell SPU code */
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <libmisc.h>
|
||||
#include <spu_mfcio.h>
|
||||
|
||||
#include "tri.h"
|
||||
#include "pipe/cell/common.h"
|
||||
|
||||
|
||||
static struct init_info init;
|
||||
|
||||
|
||||
int
|
||||
main(unsigned long long speid,
|
||||
unsigned long long argp,
|
||||
unsigned long long envp)
|
||||
{
|
||||
int tag = 0;
|
||||
|
||||
mfc_get(&init, (unsigned int) argp, sizeof(struct init_info), tag, 0, 0);
|
||||
|
||||
printf("Enter spu main(): init.foo=%d\n", init.foo);
|
||||
|
||||
draw_triangle(0, 1, 2);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
#include "tri.h"
|
||||
|
||||
void
|
||||
draw_triangle(int v1, int v2, int v3)
|
||||
{
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
|
||||
extern void
|
||||
draw_triangle(int v1, int v2, int v3);
|
Loading…
Reference in New Issue