summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/g3dvl
diff options
context:
space:
mode:
authorYounes Manton <[email protected]>2008-07-22 22:26:26 -0400
committerYounes Manton <[email protected]>2008-07-22 22:41:31 -0400
commit0c25ac52425e6d6eb037b99ab90f41b47e3f4491 (patch)
tree67c8739b48a6210e51858189b0583552cee65f2c /src/gallium/state_trackers/g3dvl
parent90bd0e338d315c426c2d0255331610055023739e (diff)
g3dvl: Add Nouveau winsys, libdriclient.
Nouveau winsys is based on Mesa's Nouveau winsys and soft-links to most of it. The 'nouveau_context' and 'nouveau_screen' code contains most of the changes, 'nouveau_winsys_pipe', 'nouveau_swapbuffers' and 'nouveau_lock' contain some minor changes. The driclient library contains the DRI userland stuff, most of which was based on Mesa's DRI code.
Diffstat (limited to 'src/gallium/state_trackers/g3dvl')
-rw-r--r--src/gallium/state_trackers/g3dvl/Makefile2
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_context.c68
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_shader_build.c12
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_shader_build.h1
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_surface.c4
5 files changed, 73 insertions, 14 deletions
diff --git a/src/gallium/state_trackers/g3dvl/Makefile b/src/gallium/state_trackers/g3dvl/Makefile
index 50e3c843b55..c6a22cad4e2 100644
--- a/src/gallium/state_trackers/g3dvl/Makefile
+++ b/src/gallium/state_trackers/g3dvl/Makefile
@@ -2,7 +2,7 @@ TARGET = libg3dvl.a
OBJECTS = vl_context.o vl_data.o vl_surface.o vl_shader_build.o vl_util.o
GALLIUMDIR = ../..
-CFLAGS += -g -Wall -fPIC -Werror -I${GALLIUMDIR}/include -I${GALLIUMDIR}/auxiliary
+CFLAGS += -g -Wall -fPIC -Werror -I${GALLIUMDIR}/include -I${GALLIUMDIR}/auxiliary -I${GALLIUMDIR}/winsys/g3dvl
#############################################
diff --git a/src/gallium/state_trackers/g3dvl/vl_context.c b/src/gallium/state_trackers/g3dvl/vl_context.c
index 3d4ca7cf4e2..850a769376e 100644
--- a/src/gallium/state_trackers/g3dvl/vl_context.c
+++ b/src/gallium/state_trackers/g3dvl/vl_context.c
@@ -330,6 +330,10 @@ static int vlCreateVertexShaderIMC(struct VL_CONTEXT *context)
ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
}
+ /* decl t0 */
+ decl = vl_decl_temps(0, 0);
+ ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
+
/* mul t0, i0, c0 ; Scale unit rect to normalized MB size */
inst = vl_inst3(TGSI_OPCODE_MUL, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_INPUT, 0, TGSI_FILE_CONSTANT, 0);
ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti);
@@ -354,7 +358,7 @@ static int vlCreateVertexShaderIMC(struct VL_CONTEXT *context)
vs.tokens = tokens;
context->states.mc.i_vs = pipe->create_vs_state(pipe, &vs);
- free(tokens);
+ //free(tokens);
return 0;
}
@@ -432,7 +436,7 @@ static int vlCreateFragmentShaderIMC(struct VL_CONTEXT *context)
fs.tokens = tokens;
context->states.mc.i_fs = pipe->create_fs_state(pipe, &fs);
- free(tokens);
+ //free(tokens);
return 0;
}
@@ -499,6 +503,10 @@ static int vlCreateVertexShaderFramePMC(struct VL_CONTEXT *context)
ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
}
+ /* decl t0 */
+ decl = vl_decl_temps(0, 0);
+ ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
+
/* mul t0, i0, c0 ; Scale unit rect to normalized MB size */
inst = vl_inst3(TGSI_OPCODE_MUL, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_INPUT, 0, TGSI_FILE_CONSTANT, 0);
ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti);
@@ -527,7 +535,7 @@ static int vlCreateVertexShaderFramePMC(struct VL_CONTEXT *context)
vs.tokens = tokens;
context->states.mc.p_vs[0] = pipe->create_vs_state(pipe, &vs);
- free(tokens);
+ //free(tokens);
return 0;
}
@@ -603,6 +611,10 @@ static int vlCreateVertexShaderFieldPMC(struct VL_CONTEXT *context)
ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
}
+ /* decl t0, t1 */
+ decl = vl_decl_temps(0, 1);
+ ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
+
/* mul t0, i0, c0 ; Scale unit rect to normalized MB size */
inst = vl_inst3(TGSI_OPCODE_MUL, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_INPUT, 0, TGSI_FILE_CONSTANT, 0);
ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti);
@@ -643,7 +655,7 @@ static int vlCreateVertexShaderFieldPMC(struct VL_CONTEXT *context)
vs.tokens = tokens;
context->states.mc.p_vs[1] = pipe->create_vs_state(pipe, &vs);
- free(tokens);
+ //free(tokens);
return 0;
}
@@ -700,6 +712,10 @@ static int vlCreateFragmentShaderFramePMC(struct VL_CONTEXT *context)
decl = vl_decl_output(TGSI_SEMANTIC_COLOR, 0, 0, 0);
ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
+ /* decl t0, t1 */
+ decl = vl_decl_temps(0, 1);
+ ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
+
/*
* decl s0 ; Sampler for luma texture
* decl s1 ; Sampler for chroma Cb texture
@@ -761,7 +777,7 @@ static int vlCreateFragmentShaderFramePMC(struct VL_CONTEXT *context)
fs.tokens = tokens;
context->states.mc.p_fs[0] = pipe->create_fs_state(pipe, &fs);
- free(tokens);
+ //free(tokens);
return 0;
}
@@ -821,6 +837,10 @@ static int vlCreateFragmentShaderFieldPMC(struct VL_CONTEXT *context)
decl = vl_decl_output(TGSI_SEMANTIC_COLOR, 0, 0, 0);
ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
+ /* decl t0-t4 */
+ decl = vl_decl_temps(0, 4);
+ ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
+
/*
* decl s0 ; Sampler for luma texture
* decl s1 ; Sampler for chroma Cb texture
@@ -928,7 +948,7 @@ static int vlCreateFragmentShaderFieldPMC(struct VL_CONTEXT *context)
fs.tokens = tokens;
context->states.mc.p_fs[1] = pipe->create_fs_state(pipe, &fs);
- free(tokens);
+ //free(tokens);
return 0;
}
@@ -998,6 +1018,10 @@ static int vlCreateVertexShaderFrameBMC(struct VL_CONTEXT *context)
ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
}
+ /* decl t0 */
+ decl = vl_decl_temps(0, 0);
+ ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
+
/* mul t0, i0, c0 ; Scale unit rect to normalized MB size */
inst = vl_inst3(TGSI_OPCODE_MUL, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_INPUT, 0, TGSI_FILE_CONSTANT, 0);
ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti);
@@ -1030,7 +1054,7 @@ static int vlCreateVertexShaderFrameBMC(struct VL_CONTEXT *context)
vs.tokens = tokens;
context->states.mc.b_vs[0] = pipe->create_vs_state(pipe, &vs);
- free(tokens);
+ //free(tokens);
return 0;
}
@@ -1104,6 +1128,10 @@ static int vlCreateVertexShaderFieldBMC(struct VL_CONTEXT *context)
ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
}
+ /* decl t0, t1 */
+ decl = vl_decl_temps(0, 1);
+ ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
+
/* mul t0, i0, c0 ; Scale unit rect to normalized MB size */
inst = vl_inst3(TGSI_OPCODE_MUL, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_INPUT, 0, TGSI_FILE_CONSTANT, 0);
ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti);
@@ -1148,7 +1176,7 @@ static int vlCreateVertexShaderFieldBMC(struct VL_CONTEXT *context)
vs.tokens = tokens;
context->states.mc.b_vs[1] = pipe->create_vs_state(pipe, &vs);
- free(tokens);
+ //free(tokens);
return 0;
}
@@ -1207,6 +1235,10 @@ static int vlCreateFragmentShaderFrameBMC(struct VL_CONTEXT *context)
decl = vl_decl_output(TGSI_SEMANTIC_COLOR, 0, 0, 0);
ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
+ /* decl t0-t2 */
+ decl = vl_decl_temps(0, 2);
+ ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
+
/*
* decl s0 ; Sampler for luma texture
* decl s1 ; Sampler for chroma Cb texture
@@ -1283,7 +1315,7 @@ static int vlCreateFragmentShaderFrameBMC(struct VL_CONTEXT *context)
fs.tokens = tokens;
context->states.mc.b_fs[0] = pipe->create_fs_state(pipe, &fs);
- free(tokens);
+ //free(tokens);
return 0;
}
@@ -1346,6 +1378,10 @@ static int vlCreateFragmentShaderFieldBMC(struct VL_CONTEXT *context)
decl = vl_decl_output(TGSI_SEMANTIC_COLOR, 0, 0, 0);
ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
+ /* decl t0-t5 */
+ decl = vl_decl_temps(0, 5);
+ ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
+
/*
* decl s0 ; Sampler for luma texture
* decl s1 ; Sampler for chroma Cb texture
@@ -1479,7 +1515,7 @@ static int vlCreateFragmentShaderFieldBMC(struct VL_CONTEXT *context)
fs.tokens = tokens;
context->states.mc.b_fs[1] = pipe->create_fs_state(pipe, &fs);
- free(tokens);
+ //free(tokens);
return 0;
}
@@ -1771,6 +1807,10 @@ static int vlCreateVertexShaderCSC(struct VL_CONTEXT *context)
ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
}
+ /* decl t0 */
+ decl = vl_decl_temps(0, 0);
+ ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
+
/* mov o0, i0 ; Move pos in to pos out */
inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_OUTPUT, 0, TGSI_FILE_INPUT, 0);
ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti);
@@ -1789,7 +1829,7 @@ static int vlCreateVertexShaderCSC(struct VL_CONTEXT *context)
vs.tokens = tokens;
context->states.csc.vertex_shader = pipe->create_vs_state(pipe, &vs);
- free(tokens);
+ //free(tokens);
return 0;
}
@@ -1839,6 +1879,10 @@ static int vlCreateFragmentShaderCSC(struct VL_CONTEXT *context)
decl = vl_decl_output(TGSI_SEMANTIC_COLOR, 0, 0, 0);
ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
+ /* decl t0 */
+ decl = vl_decl_temps(0, 0);
+ ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
+
/* decl s0 ; Sampler for tex containing picture to display */
decl = vl_decl_samplers(0, 0);
ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
@@ -1870,7 +1914,7 @@ static int vlCreateFragmentShaderCSC(struct VL_CONTEXT *context)
fs.tokens = tokens;
context->states.csc.fragment_shader = pipe->create_fs_state(pipe, &fs);
- free(tokens);
+ //free(tokens);
return 0;
}
diff --git a/src/gallium/state_trackers/g3dvl/vl_shader_build.c b/src/gallium/state_trackers/g3dvl/vl_shader_build.c
index 365ad697257..1dc5be6fdbb 100644
--- a/src/gallium/state_trackers/g3dvl/vl_shader_build.c
+++ b/src/gallium/state_trackers/g3dvl/vl_shader_build.c
@@ -74,6 +74,18 @@ struct tgsi_full_declaration vl_decl_output(unsigned int name, unsigned int inde
return decl;
}
+struct tgsi_full_declaration vl_decl_temps(unsigned int first, unsigned int last)
+{
+ struct tgsi_full_declaration decl = tgsi_default_full_declaration();
+
+ decl = tgsi_default_full_declaration();
+ decl.Declaration.File = TGSI_FILE_TEMPORARY;
+ decl.DeclarationRange.First = first;
+ decl.DeclarationRange.Last = last;
+
+ return decl;
+}
+
struct tgsi_full_declaration vl_decl_samplers(unsigned int first, unsigned int last)
{
struct tgsi_full_declaration decl = tgsi_default_full_declaration();
diff --git a/src/gallium/state_trackers/g3dvl/vl_shader_build.h b/src/gallium/state_trackers/g3dvl/vl_shader_build.h
index 9e64bbeeae0..878d7e2c457 100644
--- a/src/gallium/state_trackers/g3dvl/vl_shader_build.h
+++ b/src/gallium/state_trackers/g3dvl/vl_shader_build.h
@@ -14,6 +14,7 @@ struct tgsi_full_declaration vl_decl_interpolated_input
);
struct tgsi_full_declaration vl_decl_constants(unsigned int name, unsigned int index, unsigned int first, unsigned int last);
struct tgsi_full_declaration vl_decl_output(unsigned int name, unsigned int index, unsigned int first, unsigned int last);
+struct tgsi_full_declaration vl_decl_temps(unsigned int first, unsigned int last);
struct tgsi_full_declaration vl_decl_samplers(unsigned int first, unsigned int last);
struct tgsi_full_instruction vl_inst2
(
diff --git a/src/gallium/state_trackers/g3dvl/vl_surface.c b/src/gallium/state_trackers/g3dvl/vl_surface.c
index 145ea32892a..9b91ab4e223 100644
--- a/src/gallium/state_trackers/g3dvl/vl_surface.c
+++ b/src/gallium/state_trackers/g3dvl/vl_surface.c
@@ -5,6 +5,7 @@
#include <pipe/p_state.h>
#include <pipe/p_format.h>
#include <pipe/p_inlines.h>
+#include <vl_winsys.h>
#include "vl_context.h"
#include "vl_defs.h"
#include "vl_util.h"
@@ -711,12 +712,13 @@ int vlPutSurface
pipe->set_sampler_textures(pipe, 1, &surface->texture);
pipe->draw_arrays(pipe, PIPE_PRIM_TRIANGLE_STRIP, 0, 4);
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
+ bind_pipe_drawable(pipe, drawable);
/* TODO: Need to take destx, desty into consideration */
pipe->winsys->flush_frontbuffer
(
pipe->winsys,
surface->context->states.csc.framebuffer.cbufs[0],
- &drawable
+ pipe->priv
);
vlBeginRender(surface->context);