Merge branch 'gallium-0.2' of git+ssh://marcheu@git.freedesktop.org/git/mesa/mesa into gallium-0.2

This commit is contained in:
Stephane Marchesin 2009-02-02 02:13:07 +01:00
commit 59edbc70cd
115 changed files with 550 additions and 501 deletions

View file

@ -1,4 +1,5 @@
SConscript([
'util/SConscript',
'demos/SConscript',
'trivial/SConscript',
'vp/SConscript',

View file

@ -1,11 +1,22 @@
Import('env')
Import('*')
if not env['GLUT']:
Return()
env = env.Clone()
env.Prepend(LIBS = ['$GLUT_LIB'])
env.Prepend(CPPPATH = [
'../util',
])
env.Prepend(LIBS = [
util,
'$GLUT_LIB'
])
if env['platform'] == 'windows':
env.Append(CPPDEFINES = ['NOMINMAX'])
env.Prepend(LIBS = ['winmm'])
progs = [
'arbfplight',
@ -38,7 +49,6 @@ progs = [
'multiarb',
'paltex',
'pointblast',
'rain',
'ray',
'readpix',
'reflect',
@ -65,7 +75,15 @@ progs = [
]
for prog in progs:
prog = env.Program(
env.Program(
target = prog,
source = prog + '.c',
)
env.Program(
target = 'rain',
source = [
'rain.cxx',
'particles.cxx',
]
)

View file

@ -7,19 +7,16 @@
* Daniel Borca
*/
#define GL_GLEXT_PROTOTYPES
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/glut.h>
#define DEPTH 5.0f
static PFNGLFOGCOORDFEXTPROC glFogCoordf_ext;
static PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointer_ext;
static GLboolean have_fog_coord;
static GLfloat camz;
static GLint fogMode;
@ -45,10 +42,11 @@ Reset(void)
}
static void APIENTRY
glFogCoordf_nop (GLfloat f)
static void
glFogCoordf_ext (GLfloat f)
{
(void)f;
if (fogCoord)
glFogCoordfEXT(f);
}
@ -120,14 +118,11 @@ SetFogMode(GLint fogMode)
static GLboolean
SetFogCoord(GLboolean fogCoord)
{
glFogCoordf_ext = glFogCoordf_nop;
if (!have_fog_coord) {
if (!GLEW_EXT_fog_coord) {
return GL_FALSE;
}
if (fogCoord) {
glFogCoordf_ext = (PFNGLFOGCOORDFEXTPROC)glutGetProcAddress("glFogCoordfEXT");
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
}
else {
@ -340,7 +335,7 @@ Key( unsigned char key, int x, int y )
SetFogMode(fogMode);
break;
case 'c':
fogCoord = SetFogCoord(fogCoord ^ GL_TRUE);
fogCoord = SetFogCoord(fogCoord ^ GL_TRUE);
break;
case 't':
Texture = !Texture;
@ -372,8 +367,7 @@ Init(void)
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
have_fog_coord = glutExtensionSupported("GL_EXT_fog_coord");
if (!have_fog_coord) {
if (!GLEW_EXT_fog_coord) {
printf("GL_EXT_fog_coord not supported!\n");
}
@ -400,10 +394,9 @@ Init(void)
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, texcoord_pointer);
if (have_fog_coord) {
glFogCoordPointer_ext = (PFNGLFOGCOORDPOINTEREXTPROC)glutGetProcAddress("glFogCoordPointerEXT");
if (GLEW_EXT_fog_coord) {
glEnableClientState(GL_FOG_COORDINATE_ARRAY_EXT);
glFogCoordPointer_ext(GL_FLOAT, 0, fogcoord_pointer);
glFogCoordPointerEXT(GL_FLOAT, 0, fogcoord_pointer);
}
Reset();
@ -417,6 +410,7 @@ main( int argc, char *argv[] )
glutInitWindowSize( 600, 600 );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );

View file

@ -22,6 +22,7 @@
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include "readtex.h"
@ -438,6 +439,7 @@ int main( int argc, char *argv[] )
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutCreateWindow(argv[0] );
glewInit();
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );

View file

@ -14,6 +14,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include "readtex.h"
@ -326,6 +327,7 @@ int main( int argc, char *argv[] )
glutInitWindowPosition( 0, 0 );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
glutCreateWindow(argv[0] );
glewInit();
Init( argc, argv );

View file

@ -24,8 +24,6 @@ extern "C" {
#ifdef _WIN32
#include <windows.h>
#include <mmsystem.h>
#include "particles.cxx"
#include "readtex.c"
#endif
#ifdef XMESA

View file

@ -18,7 +18,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
@ -662,6 +662,8 @@ main(int argc, char **argv)
exit(0);
}
glewInit();
init();
printHelp();

View file

@ -11,7 +11,7 @@
#ifdef _WIN32
#include <windows.h>
#endif
#define GL_GLEXT_PROTOTYPES
#include "GL/glew.h"
#include "GL/glut.h"
#include "readtex.h"
@ -29,8 +29,7 @@ static GLubyte *Image;
static int ImgWidth, ImgHeight;
static GLenum ImgFormat;
typedef void (APIENTRY * PFNWINDOWPOSFUNC)(GLfloat x, GLfloat y);
static PFNWINDOWPOSFUNC WindowPosFunc;
static PFNGLWINDOWPOS2FPROC WindowPosFunc;
static void draw( void )
{
@ -71,19 +70,16 @@ static void reshape( int width, int height )
static void init( void )
{
#ifdef GL_ARB_window_pos
if (glutExtensionSupported("GL_ARB_window_pos")) {
if (GLEW_ARB_window_pos) {
printf("Using GL_ARB_window_pos\n");
WindowPosFunc = &glWindowPos2fARB;
WindowPosFunc = glWindowPos2fARB;
}
else
#elif defined(GL_MESA_window_pos)
if (glutExtensionSupported("GL_MESA_window_pos")) {
if (GLEW_MESA_window_pos) {
printf("Using GL_MESA_window_pos\n");
WindowPosFunc = &glWindowPos2fMESA;
WindowPosFunc = glWindowPos2fMESA;
}
else
#endif
{
printf("Sorry, GL_ARB/MESA_window_pos extension not available.\n");
exit(1);
@ -109,6 +105,8 @@ int main( int argc, char *argv[] )
exit(0);
}
glewInit();
init();
glutReshapeFunc( reshape );

View file

@ -5,10 +5,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
static GLuint fragShader;
@ -56,9 +54,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@ -110,15 +108,15 @@ LoadAndCompileShader(GLuint shader, const char *text)
{
GLint stat;
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
glShaderSource(shader, 1, (const GLchar **) &text, NULL);
glCompileShader_func(shader);
glCompileShader(shader);
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
glGetShaderiv(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetShaderInfoLog_func(shader, 1000, &len, log);
glGetShaderInfoLog(shader, 1000, &len, log);
fprintf(stderr, "fslight: problem compiling shader:\n%s\n", log);
exit(1);
}
@ -129,11 +127,11 @@ static void
CheckLink(GLuint prog)
{
GLint stat;
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
glGetProgramiv(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetProgramInfoLog_func(prog, 1000, &len, log);
glGetProgramInfoLog(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
}
@ -165,24 +163,22 @@ Init(void)
exit(1);
}
GetExtensionFuncs();
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
fragShader = glCreateShader(GL_FRAGMENT_SHADER);
LoadAndCompileShader(fragShader, fragShaderText);
#if 0
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
vertShader = glCreateShader(GL_VERTEX_SHADER);
LoadAndCompileShader(vertShader, vertShaderText);
#endif
program = glCreateProgram_func();
glAttachShader_func(program, fragShader);
program = glCreateProgram();
glAttachShader(program, fragShader);
#if 0
glAttachShader_func(program, vertShader);
glAttachShader(program, vertShader);
#endif
glLinkProgram_func(program);
glLinkProgram(program);
CheckLink(program);
glUseProgram_func(program);
glUseProgram(program);
assert(glGetError() == 0);
@ -200,6 +196,7 @@ main(int argc, char *argv[])
glutInitWindowSize(200, 200);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

15
progs/util/SConscript Normal file
View file

@ -0,0 +1,15 @@
Import('env')
env = env.Clone()
util = env.StaticLibrary(
target = ['util'],
source = [
'readtex.c',
'trackball.c',
'showbuffer.c',
'shaderutil.c',
],
)
Export('util')

View file

@ -303,7 +303,7 @@ def generate(env):
#'_UNICODE',
#'UNICODE',
# http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx,
'WIN32_LEAN_AND_MEAN',
#'WIN32_LEAN_AND_MEAN',
'VC_EXTRALEAN',
'_CRT_SECURE_NO_DEPRECATE',
]
@ -362,24 +362,26 @@ def generate(env):
])
# C compiler options
cflags = []
cflags = [] # C
cxxflags = [] # C++
ccflags = [] # C & C++
if gcc:
if debug:
cflags += ['-O0', '-g3']
ccflags += ['-O0', '-g3']
else:
cflags += ['-O3', '-g0']
ccflags += ['-O3', '-g0']
if env['profile']:
cflags += ['-pg']
ccflags += ['-pg']
if env['machine'] == 'x86':
cflags += [
ccflags += [
'-m32',
#'-march=pentium4',
'-mmmx', '-msse', '-msse2', # enable SIMD intrinsics
#'-mfpmath=sse',
]
if env['machine'] == 'x86_64':
cflags += ['-m64']
cflags += [
ccflags += ['-m64']
ccflags += [
'-Wall',
'-Wmissing-prototypes',
'-Wno-long-long',
@ -387,43 +389,46 @@ def generate(env):
'-pedantic',
'-fmessage-length=0', # be nice to Eclipse
]
cflags += [
'-Wmissing-prototypes',
]
if msvc:
# See also:
# - http://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
# - cl /?
if debug:
cflags += [
ccflags += [
'/Od', # disable optimizations
'/Oi', # enable intrinsic functions
'/Oy-', # disable frame pointer omission
]
else:
cflags += [
ccflags += [
'/Ox', # maximum optimizations
'/Oi', # enable intrinsic functions
'/Ot', # favor code speed
#'/fp:fast', # fast floating point
]
if env['profile']:
cflags += [
ccflags += [
'/Gh', # enable _penter hook function
'/GH', # enable _pexit hook function
]
cflags += [
ccflags += [
'/W3', # warning level
#'/Wp64', # enable 64 bit porting warnings
]
if env['machine'] == 'x86':
cflags += [
ccflags += [
#'/QIfist', # Suppress _ftol
#'/arch:SSE2', # use the SSE2 instructions
]
if platform == 'windows':
cflags += [
ccflags += [
# TODO
]
if platform == 'winddk':
cflags += [
ccflags += [
'/Zl', # omit default library name in .OBJ
'/Zp8', # 8bytes struct member alignment
'/Gy', # separate functions for linker
@ -442,7 +447,7 @@ def generate(env):
]
if platform == 'wince':
# See also C:\WINCE600\public\common\oak\misc\makefile.def
cflags += [
ccflags += [
'/Zl', # omit default library name in .OBJ
'/GF', # enable read-only string pooling
'/GR-', # disable C++ RTTI
@ -459,8 +464,9 @@ def generate(env):
# See http://scons.tigris.org/issues/show_bug.cgi?id=1656
env.EnsureSConsVersion(0, 98, 0)
env['PDB'] = '${TARGET.base}.pdb'
env.Append(CCFLAGS = ccflags)
env.Append(CFLAGS = cflags)
env.Append(CXXFLAGS = cflags)
env.Append(CXXFLAGS = cxxflags)
if env['platform'] == 'windows' and msvc:
# Choose the appropriate MSVC CRT

View file

@ -14,8 +14,7 @@ C_SOURCES = \
pb_bufmgr_ondemand.c \
pb_bufmgr_pool.c \
pb_bufmgr_slab.c \
pb_validate.c \
pb_winsys.c
pb_validate.c
include ../../Makefile.template

View file

@ -14,7 +14,6 @@ pipebuffer = env.ConvenienceLibrary(
'pb_bufmgr_pool.c',
'pb_bufmgr_slab.c',
'pb_validate.c',
'pb_winsys.c',
])
auxiliaries.insert(0, pipebuffer)

View file

@ -44,7 +44,7 @@
#include "pipe/p_compiler.h"
#include "pipe/p_error.h"
#include "pipe/p_debug.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_thread.h"
#include "util/u_memory.h"
#include "util/u_double_list.h"

View file

@ -36,7 +36,6 @@
#include "pipe/p_compiler.h"
#include "pipe/p_debug.h"
#include "pipe/p_winsys.h"
#include "pipe/p_thread.h"
#include "util/u_memory.h"
#include "util/u_double_list.h"

View file

@ -35,7 +35,6 @@
#include "pipe/p_compiler.h"
#include "pipe/p_debug.h"
#include "pipe/p_winsys.h"
#include "pipe/p_thread.h"
#include "util/u_math.h"
#include "util/u_memory.h"

View file

@ -1,191 +0,0 @@
/**************************************************************************
*
* 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.
*
**************************************************************************/
/**
* \file
* Implementation of client buffer (also designated as "user buffers"), which
* are just state-tracker owned data masqueraded as buffers.
*
* \author Jose Fonseca <jrfonseca@tungstengraphics.com>
*/
#include "pipe/p_winsys.h"
#include "util/u_memory.h"
#include "pb_buffer.h"
#include "pb_winsys.h"
/**
* User buffers are special buffers that initially reference memory
* held by the user but which may if necessary copy that memory into
* device memory behind the scenes, for submission to hardware.
*
* These are particularly useful when the referenced data is never
* submitted to hardware at all, in the particular case of software
* vertex processing.
*/
struct pb_user_buffer
{
struct pb_buffer base;
void *data;
};
extern const struct pb_vtbl pb_user_buffer_vtbl;
static INLINE struct pb_user_buffer *
pb_user_buffer(struct pb_buffer *buf)
{
assert(buf);
assert(buf->vtbl == &pb_user_buffer_vtbl);
return (struct pb_user_buffer *)buf;
}
static void
pb_user_buffer_destroy(struct pb_buffer *buf)
{
assert(buf);
FREE(buf);
}
static void *
pb_user_buffer_map(struct pb_buffer *buf,
unsigned flags)
{
return pb_user_buffer(buf)->data;
}
static void
pb_user_buffer_unmap(struct pb_buffer *buf)
{
/* No-op */
}
static enum pipe_error
pb_user_buffer_validate(struct pb_buffer *buf,
struct pb_validate *vl,
unsigned flags)
{
assert(0);
return PIPE_ERROR;
}
static void
pb_user_buffer_fence(struct pb_buffer *buf,
struct pipe_fence_handle *fence)
{
assert(0);
}
static void
pb_user_buffer_get_base_buffer(struct pb_buffer *buf,
struct pb_buffer **base_buf,
unsigned *offset)
{
*base_buf = buf;
*offset = 0;
}
const struct pb_vtbl
pb_user_buffer_vtbl = {
pb_user_buffer_destroy,
pb_user_buffer_map,
pb_user_buffer_unmap,
pb_user_buffer_validate,
pb_user_buffer_fence,
pb_user_buffer_get_base_buffer
};
struct pipe_buffer *
pb_winsys_user_buffer_create(struct pipe_winsys *winsys,
void *data,
unsigned bytes)
{
struct pb_user_buffer *buf = CALLOC_STRUCT(pb_user_buffer);
if(!buf)
return NULL;
buf->base.base.refcount = 1;
buf->base.base.size = bytes;
buf->base.base.alignment = 0;
buf->base.base.usage = 0;
buf->base.vtbl = &pb_user_buffer_vtbl;
buf->data = data;
return &buf->base.base;
}
void *
pb_winsys_buffer_map(struct pipe_winsys *winsys,
struct pipe_buffer *buf,
unsigned flags)
{
(void)winsys;
return pb_map(pb_buffer(buf), flags);
}
void
pb_winsys_buffer_unmap(struct pipe_winsys *winsys,
struct pipe_buffer *buf)
{
(void)winsys;
pb_unmap(pb_buffer(buf));
}
void
pb_winsys_buffer_destroy(struct pipe_winsys *winsys,
struct pipe_buffer *buf)
{
(void)winsys;
pb_destroy(pb_buffer(buf));
}
void
pb_init_winsys(struct pipe_winsys *winsys)
{
winsys->user_buffer_create = pb_winsys_user_buffer_create;
winsys->buffer_map = pb_winsys_buffer_map;
winsys->buffer_unmap = pb_winsys_buffer_unmap;
winsys->buffer_destroy = pb_winsys_buffer_destroy;
}

View file

@ -23,7 +23,8 @@ C_SOURCES = \
u_stream_wd.c \
u_tile.c \
u_time.c \
u_timed_winsys.c
u_timed_winsys.c \
u_simple_screen.c
include ../../Makefile.template

View file

@ -24,6 +24,7 @@ util = env.ConvenienceLibrary(
'u_tile.c',
'u_time.c',
'u_timed_winsys.c',
'u_simple_screen.c',
])
auxiliaries.insert(0, util)

View file

@ -37,7 +37,6 @@
#include "pipe/p_debug.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/p_shader_tokens.h"
#include "util/u_blit.h"

View file

@ -29,7 +29,6 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "util/u_draw_quad.h"

View file

@ -38,7 +38,6 @@
#include "pipe/p_debug.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/p_shader_tokens.h"
#include "util/u_memory.h"

View file

@ -0,0 +1,143 @@
/**************************************************************************
*
* Copyright 2009 VMware, Inc.
* 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.
*
**************************************************************************/
#include "u_simple_screen.h"
#include "pipe/p_screen.h"
#include "pipe/internal/p_winsys_screen.h"
static struct pipe_buffer *
pass_buffer_create(struct pipe_screen *screen,
unsigned alignment,
unsigned usage,
unsigned size)
{
return screen->winsys->buffer_create(screen->winsys,
alignment, usage, size);
}
static struct pipe_buffer *
pass_user_buffer_create(struct pipe_screen *screen,
void *ptr,
unsigned bytes)
{
return screen->winsys->user_buffer_create(screen->winsys,
ptr, bytes);
}
static struct pipe_buffer *
pass_surface_buffer_create(struct pipe_screen *screen,
unsigned width, unsigned height,
enum pipe_format format,
unsigned usage,
unsigned *stride)
{
return screen->winsys->surface_buffer_create(screen->winsys,
width, height,
format, usage, stride);
}
static void *
pass_buffer_map(struct pipe_screen *screen,
struct pipe_buffer *buf,
unsigned usage)
{
return screen->winsys->buffer_map(screen->winsys,
buf, usage);
}
static void
pass_buffer_unmap(struct pipe_screen *screen,
struct pipe_buffer *buf)
{
screen->winsys->buffer_unmap(screen->winsys, buf);
}
static void
pass_buffer_destroy(struct pipe_screen *screen,
struct pipe_buffer *buf)
{
screen->winsys->buffer_destroy(screen->winsys, buf);
}
static void
pass_flush_frontbuffer(struct pipe_screen *screen,
struct pipe_surface *surf,
void *context_private)
{
screen->winsys->flush_frontbuffer(screen->winsys,
surf, context_private);
}
static void
pass_fence_reference(struct pipe_screen *screen,
struct pipe_fence_handle **ptr,
struct pipe_fence_handle *fence)
{
screen->winsys->fence_reference(screen->winsys,
ptr, fence);
}
static int
pass_fence_signalled(struct pipe_screen *screen,
struct pipe_fence_handle *fence,
unsigned flag)
{
return screen->winsys->fence_signalled(screen->winsys,
fence, flag);
}
static int
pass_fence_finish(struct pipe_screen *screen,
struct pipe_fence_handle *fence,
unsigned flag)
{
return screen->winsys->fence_finish(screen->winsys,
fence, flag);
}
void u_simple_screen_init(struct pipe_screen *screen)
{
screen->buffer_create = pass_buffer_create;
screen->user_buffer_create = pass_user_buffer_create;
screen->surface_buffer_create = pass_surface_buffer_create;
screen->buffer_map = pass_buffer_map;
screen->buffer_unmap = pass_buffer_unmap;
screen->buffer_destroy = pass_buffer_destroy;
screen->flush_frontbuffer = pass_flush_frontbuffer;
screen->fence_reference = pass_fence_reference;
screen->fence_signalled = pass_fence_signalled;
screen->fence_finish = pass_fence_finish;
}
const char* u_simple_screen_winsys_name(struct pipe_screen *screen)
{
return screen->winsys->get_name(screen->winsys);
}

View file

@ -1,6 +1,6 @@
/**************************************************************************
*
* Copyright 2009 VMWare, Inc.
* Copyright 2009 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@ -18,62 +18,30 @@
* 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 VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* 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 U_SIMPLE_SCREEN_H
#define U_SIMPLE_SCREEN_H
struct pipe_screen;
struct pipe_winsys;
/**
* @file
* Drop-in replacements for winsys buffer callbacks.
* The following function initializes a simple passthrough screen.
*
* The requirement to use this functions is that all pipe_buffers must be in
* fact pb_buffers.
*
* @author Jose Fonseca <jfonseca@vmware.com>
* All the relevant screen function pointers will forwarded to the
* winsys.
*/
void u_simple_screen_init(struct pipe_screen *screen);
#ifndef PB_WINSYS_H_
#define PB_WINSYS_H_
/**
* Returns the name of the winsys associated with this screen.
*/
const char* u_simple_screen_winsys_name(struct pipe_screen *screen);
#include "pipe/p_compiler.h"
#include "pipe/p_debug.h"
#include "pipe/p_state.h"
#include "pipe/p_inlines.h"
#ifdef __cplusplus
extern "C" {
#endif
struct pipe_buffer *
pb_winsys_user_buffer_create(struct pipe_winsys *winsys,
void *data,
unsigned bytes);
void *
pb_winsys_buffer_map(struct pipe_winsys *winsys,
struct pipe_buffer *buf,
unsigned flags);
void
pb_winsys_buffer_unmap(struct pipe_winsys *winsys,
struct pipe_buffer *buf);
void
pb_winsys_buffer_destroy(struct pipe_winsys *winsys,
struct pipe_buffer *buf);
void
pb_init_winsys(struct pipe_winsys *winsys);
#ifdef __cplusplus
}
#endif
#endif /*PB_WINSYS_H_*/

View file

@ -37,7 +37,7 @@
#include "pipe/p_debug.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/p_screen.h"
#include "pipe/p_shader_tokens.h"
#include "util/u_memory.h"

View file

@ -29,7 +29,7 @@
* Authors: Keith Whitwell <keithw-at-tungstengraphics-dot-com>
*/
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "u_timed_winsys.h"
#include "util/u_memory.h"
#include "util/u_time.h"
@ -121,7 +121,8 @@ timed_buffer_create(struct pipe_winsys *winsys,
struct pipe_winsys *backend = timed_winsys(winsys)->backend;
uint64_t start = time_start();
struct pipe_buffer *buf = backend->buffer_create( backend, alignment, usage, size );
struct pipe_buffer *buf =
backend->buffer_create( backend, alignment, usage, size );
time_finish(winsys, start, 0, __FUNCTION__);
@ -300,9 +301,9 @@ struct pipe_winsys *u_timed_winsys_create( struct pipe_winsys *backend )
ws->base.buffer_unmap = timed_buffer_unmap;
ws->base.buffer_destroy = timed_buffer_destroy;
ws->base.buffer_create = timed_buffer_create;
ws->base.surface_buffer_create = timed_surface_buffer_create;
ws->base.flush_frontbuffer = timed_flush_frontbuffer;
ws->base.get_name = timed_get_name;
ws->base.surface_buffer_create = timed_surface_buffer_create;
ws->base.fence_reference = timed_fence_reference;
ws->base.fence_signalled = timed_fence_signalled;
ws->base.fence_finish = timed_fence_finish;

View file

@ -36,7 +36,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_format.h"
#include "util/u_memory.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_screen.h"
#include "draw/draw_context.h"

View file

@ -33,7 +33,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_context.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "cell_context.h"
@ -53,7 +53,7 @@ cell_map_constant_buffers(struct cell_context *sp)
for (i = 0; i < 2; i++) {
if (sp->constants[i].size) {
sp->mapped_constants[i] = ws->buffer_map(ws, sp->constants[i].buffer,
PIPE_BUFFER_USAGE_CPU_READ);
PIPE_BUFFER_USAGE_CPU_READ);
cell_flush_buffer_range(sp, sp->mapped_constants[i],
sp->constants[i].buffer->size);
}

View file

@ -27,7 +27,8 @@
#include "util/u_memory.h"
#include "pipe/p_winsys.h"
#include "util/u_simple_screen.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
@ -169,6 +170,7 @@ cell_create_screen(struct pipe_winsys *winsys)
screen->is_format_supported = cell_is_format_supported;
cell_init_screen_texture_funcs(screen);
u_simple_screen_init(screen);
return screen;
}

View file

@ -28,7 +28,7 @@
#include "pipe/p_defines.h"
#include "util/u_memory.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "draw/draw_context.h"
#include "tgsi/tgsi_parse.h"
@ -194,9 +194,9 @@ cell_set_constant_buffer(struct pipe_context *pipe,
draw_flush(cell->draw);
/* note: reference counting */
winsys_buffer_reference(ws,
&cell->constants[shader].buffer,
buf->buffer);
pipe_buffer_reference(pipe->screen,
&cell->constants[shader].buffer,
buf->buffer);
cell->constants[shader].size = buf->size;
if (shader == PIPE_SHADER_VERTEX)

View file

@ -34,7 +34,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@ -113,7 +113,7 @@ cell_texture_create(struct pipe_screen *screen,
cell_texture_layout(ct);
ct->buffer = ws->buffer_create(ws, 32, PIPE_BUFFER_USAGE_PIXEL,
ct->buffer_size);
ct->buffer_size);
if (!ct->buffer) {
FREE(ct);
@ -154,7 +154,7 @@ cell_texture_release(struct pipe_screen *screen,
*/
if (ct->tiled_buffer[i]) {
ct->tiled_mapped[i] = NULL;
winsys_buffer_reference(screen->winsys, &ct->tiled_buffer[i], NULL);
pipe_buffer_reference(screen, &ct->tiled_buffer[i], NULL);
}
}
@ -325,11 +325,11 @@ cell_twiddle_texture(struct pipe_screen *screen,
struct pipe_winsys *ws = screen->winsys;
uint bytes = bufWidth * bufHeight * 4 * numFaces;
ct->tiled_buffer[level] = ws->buffer_create(ws, 16,
PIPE_BUFFER_USAGE_PIXEL,
bytes);
PIPE_BUFFER_USAGE_PIXEL,
bytes);
/* and map it */
ct->tiled_mapped[level] = ws->buffer_map(ws, ct->tiled_buffer[level],
PIPE_BUFFER_USAGE_GPU_READ);
PIPE_BUFFER_USAGE_GPU_READ);
}
dst = (uint *) ((ubyte *) ct->tiled_mapped[level] + offset);
@ -406,7 +406,7 @@ cell_get_tex_surface(struct pipe_screen *screen,
if (ps) {
assert(ps->refcount);
assert(ps->winsys);
winsys_buffer_reference(ws, &ps->buffer, ct->buffer);
pipe_buffer_reference(screen, &ps->buffer, ct->buffer);
ps->format = pt->format;
ps->block = pt->block;
ps->width = pt->width[level];

View file

@ -31,7 +31,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_context.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "cell_context.h"

View file

@ -27,7 +27,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_memory.h"
#include "pipe/p_context.h"

View file

@ -34,7 +34,7 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_memory.h"
#include "pipe/p_screen.h"

View file

@ -30,7 +30,7 @@
#include "i915_winsys.h"
#include "i915_debug.h"
#include "i915_batch.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_debug.h"

View file

@ -72,7 +72,7 @@ void i915_print_ureg(const char *msg, unsigned ureg);
#if defined(DEBUG) && defined(FILE_DEBUG_FLAG)
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
static INLINE void
I915_DBG(

View file

@ -28,7 +28,7 @@
#include "i915_reg.h"
#include "i915_debug.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_memory.h"

View file

@ -42,7 +42,7 @@
#include "draw/draw_vbuf.h"
#include "pipe/p_debug.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"

View file

@ -27,7 +27,8 @@
#include "util/u_memory.h"
#include "pipe/p_winsys.h"
#include "util/u_simple_screen.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_string.h"
@ -279,6 +280,7 @@ i915_create_screen(struct pipe_winsys *winsys, uint pci_id)
i915screen->screen.surface_unmap = i915_surface_unmap;
i915_init_screen_texture_functions(&i915screen->screen);
u_simple_screen_init(&i915screen->screen);
return &i915screen->screen;
}

View file

@ -30,7 +30,7 @@
#include "draw/draw_context.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@ -537,7 +537,7 @@ static void i915_set_constant_buffer(struct pipe_context *pipe,
void *mapped;
if (buf->buffer && buf->buffer->size &&
(mapped = ws->buffer_map(ws, buf->buffer,
PIPE_BUFFER_USAGE_CPU_READ))) {
PIPE_BUFFER_USAGE_CPU_READ))) {
memcpy(i915->current.constants[shader], mapped, buf->buffer->size);
ws->buffer_unmap(ws, buf->buffer);
i915->current.num_user_constants[shader]

View file

@ -31,7 +31,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_tile.h"
#include "util/u_rect.h"

View file

@ -34,7 +34,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@ -606,8 +606,8 @@ i915_texture_create(struct pipe_screen *screen,
tex_size = tex->stride * tex->total_nblocksy;
tex->buffer = ws->buffer_create(ws, 64,
PIPE_BUFFER_USAGE_PIXEL,
tex_size);
PIPE_BUFFER_USAGE_PIXEL,
tex_size);
if (!tex->buffer)
goto fail;

View file

@ -35,7 +35,7 @@
#include "brw_reg.h"
#include "pipe/p_context.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#define FILE_DEBUG_FLAG DEBUG_BLIT

View file

@ -37,7 +37,7 @@
#include "brw_tex_layout.h"
#include "brw_winsys.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_context.h"
#include "util/u_memory.h"
#include "pipe/p_screen.h"

View file

@ -38,7 +38,7 @@
#include "brw_util.h"
#include "brw_wm.h"
#include "pipe/p_state.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"

View file

@ -34,7 +34,7 @@
#include "brw_state.h"
#include "pipe/p_context.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
static unsigned hw_prim[PIPE_PRIM_POLYGON+1] = {
_3DPRIM_POINTLIST,

View file

@ -27,8 +27,9 @@
#include "util/u_memory.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_string.h"
#include "util/u_simple_screen.h"
#include "brw_context.h"
#include "brw_screen.h"
@ -239,6 +240,7 @@ brw_create_screen(struct pipe_winsys *winsys, uint pci_id)
brwscreen->screen.is_format_supported = brw_is_format_supported;
brw_init_screen_texture_funcs(&brwscreen->screen);
u_simple_screen_init(&brwscreen->screen);
return &brwscreen->screen;
}

View file

@ -30,7 +30,7 @@
*/
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_memory.h"
#include "pipe/p_inlines.h"
#include "pipe/p_shader_tokens.h"

View file

@ -42,7 +42,7 @@
* the pool.
*/
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "pipe/p_inlines.h"

View file

@ -30,7 +30,7 @@
#include "brw_state.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_tile.h"
#include "util/u_rect.h"

View file

@ -37,7 +37,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "brw_context.h"
@ -296,9 +296,9 @@ brw_texture_create_screen(struct pipe_screen *screen,
if (brw_miptree_layout(tex))
tex->buffer = ws->buffer_create(ws, 64,
PIPE_BUFFER_USAGE_PIXEL,
tex->stride *
tex->total_nblocksy);
PIPE_BUFFER_USAGE_PIXEL,
tex->stride *
tex->total_nblocksy);
if (!tex->buffer) {
FREE(tex);
@ -322,7 +322,6 @@ brw_texture_release_screen(struct pipe_screen *screen,
__FUNCTION__, (void *) *pt, (*pt)->refcount - 1);
*/
if (--(*pt)->refcount <= 0) {
struct pipe_winsys *ws = screen->winsys;
struct brw_texture *tex = (struct brw_texture *)*pt;
uint i;
@ -330,7 +329,7 @@ brw_texture_release_screen(struct pipe_screen *screen,
DBG("%s deleting %p\n", __FUNCTION__, (void *) tex);
*/
winsys_buffer_reference(ws, &tex->buffer, NULL);
pipe_buffer_reference(screen, &tex->buffer, NULL);
for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++)
if (tex->image_offset[i])
@ -347,7 +346,6 @@ brw_get_tex_surface_screen(struct pipe_screen *screen,
struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice)
{
struct pipe_winsys *ws = screen->winsys;
struct brw_texture *tex = (struct brw_texture *)pt;
struct pipe_surface *ps;
unsigned offset; /* in bytes */
@ -369,7 +367,7 @@ brw_get_tex_surface_screen(struct pipe_screen *screen,
if (ps) {
ps->refcount = 1;
pipe_texture_reference(&ps->texture, pt);
winsys_buffer_reference(ws, &ps->buffer, tex->buffer);
pipe_buffer_reference(screen, &ps->buffer, tex->buffer);
ps->format = pt->format;
ps->width = pt->width[level];
ps->height = pt->height[level];

View file

@ -2,7 +2,7 @@
#define NOUVEAU_WINSYS_H
#include <stdint.h>
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_defines.h"
#include "nouveau/nouveau_bo.h"

View file

@ -1,6 +1,6 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "nv04_context.h"
#include "nv04_screen.h"

View file

@ -1,7 +1,7 @@
#include "pipe/p_debug.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_compiler.h"
#include "draw/draw_vbuf.h"

View file

@ -1,4 +1,5 @@
#include "pipe/p_screen.h"
#include "util/u_simple_screen.h"
#include "nv04_context.h"
#include "nv04_screen.h"
@ -215,6 +216,7 @@ nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
screen->pipe.surface_unmap = nv04_surface_unmap;
nv04_screen_init_miptree_functions(&screen->pipe);
u_simple_screen_init(&screen->pipe);
return &screen->pipe;
}

View file

@ -28,7 +28,7 @@
#include "nv04_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_tile.h"

View file

@ -1,6 +1,6 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "nv10_context.h"
#include "nv10_screen.h"

View file

@ -40,7 +40,7 @@
#include "pipe/p_debug.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "nv10_context.h"
#include "nv10_state.h"

View file

@ -1,4 +1,5 @@
#include "pipe/p_screen.h"
#include "util/u_simple_screen.h"
#include "nv10_context.h"
#include "nv10_screen.h"
@ -204,6 +205,7 @@ nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
screen->pipe.surface_unmap = nv10_surface_unmap;
nv10_screen_init_miptree_functions(&screen->pipe);
u_simple_screen_init(&screen->pipe);
return &screen->pipe;
}

View file

@ -28,7 +28,7 @@
#include "nv10_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_tile.h"

View file

@ -9,4 +9,5 @@ nv20_clear(struct pipe_context *pipe, struct pipe_surface *ps,
unsigned clearValue)
{
pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
ps->status = PIPE_SURFACE_STATUS_CLEAR;
}

View file

@ -1,6 +1,6 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "nv20_context.h"
#include "nv20_screen.h"
@ -263,7 +263,7 @@ static void nv20_init_hwctx(struct nv20_context *nv20)
BEGIN_RING(kelvin, NV20TCL_DEPTH_FUNC, 1);
OUT_RING (NV20TCL_DEPTH_FUNC_LESS);
BEGIN_RING(kelvin, NV20TCL_DEPTH_WRITE_ENABLE, 1);
OUT_RING (1);
OUT_RING (0);
BEGIN_RING(kelvin, NV20TCL_DEPTH_TEST_ENABLE, 1);
OUT_RING (0);
BEGIN_RING(kelvin, NV20TCL_POLYGON_OFFSET_FACTOR, 2);
@ -349,7 +349,7 @@ static void nv20_init_hwctx(struct nv20_context *nv20)
memset(projectionmatrix, 0, sizeof(projectionmatrix));
projectionmatrix[0*4+0] = 1.0;
projectionmatrix[1*4+1] = 1.0;
projectionmatrix[2*4+2] = 1.0;
projectionmatrix[2*4+2] = 16777215.0;
projectionmatrix[3*4+3] = 1.0;
BEGIN_RING(kelvin, NV20TCL_PROJECTION_MATRIX(0), 16);
for (i = 0; i < 16; i++) {
@ -357,20 +357,20 @@ static void nv20_init_hwctx(struct nv20_context *nv20)
}
BEGIN_RING(kelvin, NV20TCL_DEPTH_RANGE_NEAR, 2);
OUT_RINGf (0.0);
OUT_RINGf (16777216.0); /* bpp dependant? */
OUT_RINGf (0.0);
OUT_RINGf (16777216.0); /* [0, 1] scaled approx to [0, 2^24] */
BEGIN_RING(kelvin, NV20TCL_VIEWPORT_SCALE0_X, 4);
OUT_RINGf (0.0); /* x-offset */
OUT_RINGf (0.0); /* y-offset */
OUT_RINGf (16777215.0 * 0.5);
OUT_RING (0);
OUT_RINGf (0.0); /* x-offset, w/2 + 1.031250 */
OUT_RINGf (0.0); /* y-offset, h/2 + 0.030762 */
OUT_RINGf (0.0);
OUT_RINGf (16777215.0);
BEGIN_RING(kelvin, NV20TCL_VIEWPORT_SCALE1_X, 4);
OUT_RINGf (0.0); /* no effect? */
OUT_RINGf (0.0); /* no effect? */
OUT_RINGf (16777215.0 * 0.5);
OUT_RINGf (65535.0);
OUT_RINGf (0.0); /* no effect?, w/2 */
OUT_RINGf (0.0); /* no effect?, h/2 */
OUT_RINGf (16777215.0 * 0.5);
OUT_RINGf (65535.0);
FIRE_RING (NULL);
}

View file

@ -40,7 +40,7 @@
#include "pipe/p_debug.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "nv20_context.h"
#include "nv20_state.h"

View file

@ -1,4 +1,5 @@
#include "pipe/p_screen.h"
#include "util/u_simple_screen.h"
#include "nv20_context.h"
#include "nv20_screen.h"
@ -200,6 +201,7 @@ nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
screen->pipe.surface_unmap = nv20_surface_unmap;
nv20_screen_init_miptree_functions(&screen->pipe);
u_simple_screen_init(&screen->pipe);
return &screen->pipe;
}

View file

@ -73,6 +73,9 @@ static void nv20_state_emit_dsa(struct nv20_context* nv20)
BEGIN_RING(kelvin, NV20TCL_DEPTH_TEST_ENABLE, 1);
OUT_RING (d->depth.test_enable);
BEGIN_RING(kelvin, NV20TCL_DEPTH_UNK17D8, 1);
OUT_RING (1);
#if 0
BEGIN_RING(kelvin, NV20TCL_STENCIL_ENABLE, 1);
OUT_RING (d->stencil.enable);
@ -352,16 +355,14 @@ nv20_emit_hw_state(struct nv20_context *nv20)
*/
/* Render target */
/* XXX figre out who's who for NV10TCL_DMA_* and fill accordingly
* BEGIN_RING(kelvin, NV20TCL_DMA_COLOR0, 1);
* OUT_RELOCo(nv20->rt[0], NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); */
BEGIN_RING(kelvin, NV20TCL_DMA_COLOR, 1);
OUT_RELOCo(nv20->rt[0], NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
BEGIN_RING(kelvin, NV20TCL_COLOR_OFFSET, 1);
OUT_RELOCl(nv20->rt[0], 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
if (nv20->zeta) {
/* XXX
* BEGIN_RING(kelvin, NV20TCL_DMA_ZETA, 1);
* OUT_RELOCo(nv20->zeta, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); */
BEGIN_RING(kelvin, NV20TCL_DMA_ZETA, 1);
OUT_RELOCo(nv20->zeta, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
BEGIN_RING(kelvin, NV20TCL_ZETA_OFFSET, 1);
OUT_RELOCl(nv20->zeta, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
/* XXX for when we allocate LMA on nv17 */

View file

@ -28,7 +28,7 @@
#include "nv20_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_tile.h"

View file

@ -64,6 +64,7 @@ boolean nv20_draw_elements( struct pipe_context *pipe,
draw_set_mapped_element_buffer(draw, 0, NULL);
}
draw_flush(nv20->draw);
return TRUE;
}

View file

@ -1,6 +1,6 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "nv30_context.h"
#include "nv30_screen.h"

View file

@ -181,7 +181,7 @@ nv30_miptree_surface_del(struct pipe_screen *pscreen,
return;
pipe_texture_reference(&ps->texture, NULL);
pipe_buffer_reference(pscreen->winsys, &ps->buffer, NULL);
pipe_buffer_reference(pscreen, &ps->buffer, NULL);
FREE(ps);
}

View file

@ -1,4 +1,5 @@
#include "pipe/p_screen.h"
#include "util/u_simple_screen.h"
#include "nv30_context.h"
#include "nv30_screen.h"
@ -381,6 +382,7 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
screen->pipe.surface_unmap = nv30_surface_unmap;
nv30_screen_init_miptree_functions(&screen->pipe);
u_simple_screen_init(&screen->pipe);
return &screen->pipe;
}

View file

@ -28,7 +28,7 @@
#include "nv30_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_tile.h"

View file

@ -1,6 +1,6 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "nv40_context.h"
#include "nv40_screen.h"

View file

@ -242,7 +242,7 @@ nv40_draw_elements_swtnl(struct pipe_context *pipe,
for (i = 0; i < nv40->vtxbuf_nr; i++) {
map = ws->buffer_map(ws, nv40->vtxbuf[i].buffer,
PIPE_BUFFER_USAGE_CPU_READ);
PIPE_BUFFER_USAGE_CPU_READ);
draw_set_mapped_vertex_buffer(nv40->draw, i, map);
}

View file

@ -1,4 +1,5 @@
#include "pipe/p_screen.h"
#include "util/u_simple_screen.h"
#include "nv40_context.h"
#include "nv40_screen.h"
@ -363,6 +364,7 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
screen->pipe.surface_unmap = nv40_surface_unmap;
nv40_screen_init_miptree_functions(&screen->pipe);
u_simple_screen_init(&screen->pipe);
return &screen->pipe;
}

View file

@ -28,7 +28,7 @@
#include "nv40_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_tile.h"

View file

@ -22,7 +22,7 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "nv50_context.h"
#include "nv50_screen.h"

View file

@ -62,7 +62,7 @@ nv50_query_destroy(struct pipe_context *pipe, struct pipe_query *pq)
struct nv50_query *q = nv50_query(pq);
if (q) {
pipe_buffer_reference(pipe, &q->buffer, NULL);
pipe_buffer_reference(pipe->screen, &q->buffer, NULL);
FREE(q);
}
}

View file

@ -22,6 +22,8 @@
#include "pipe/p_screen.h"
#include "util/u_simple_screen.h"
#include "nv50_context.h"
#include "nv50_screen.h"
@ -323,6 +325,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
nv50_screen_init_miptree_functions(&screen->pipe);
nv50_surface_init_screen_functions(&screen->pipe);
u_simple_screen_init(&screen->pipe);
return &screen->pipe;
}

View file

@ -22,7 +22,7 @@
#include "nv50_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_tile.h"

View file

@ -87,7 +87,7 @@ softpipe_unmap_surfaces(struct softpipe_context *sp)
static void softpipe_destroy( struct pipe_context *pipe )
{
struct softpipe_context *softpipe = softpipe_context( pipe );
struct pipe_winsys *ws = pipe->winsys;
struct pipe_screen *screen = pipe->screen;
uint i;
if (softpipe->draw)
@ -116,7 +116,7 @@ static void softpipe_destroy( struct pipe_context *pipe )
for (i = 0; i < Elements(softpipe->constants); i++) {
if (softpipe->constants[i].buffer) {
winsys_buffer_reference(ws, &softpipe->constants[i].buffer, NULL);
pipe_buffer_reference(screen, &softpipe->constants[i].buffer, NULL);
}
}

View file

@ -33,7 +33,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_context.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "sp_context.h"

View file

@ -27,7 +27,8 @@
#include "util/u_memory.h"
#include "pipe/p_winsys.h"
#include "util/u_simple_screen.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
@ -174,6 +175,7 @@ softpipe_create_screen(struct pipe_winsys *winsys)
screen->base.is_format_supported = softpipe_is_format_supported;
softpipe_init_screen_texture_funcs(&screen->base);
u_simple_screen_init(&screen->base);
return &screen->base;
}

View file

@ -32,7 +32,7 @@
#include "pipe/p_defines.h"
#include "util/u_memory.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_shader_tokens.h"
#include "draw/draw_context.h"
#include "tgsi/tgsi_dump.h"
@ -146,13 +146,13 @@ softpipe_set_constant_buffer(struct pipe_context *pipe,
const struct pipe_constant_buffer *buf)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
struct pipe_winsys *ws = pipe->winsys;
struct pipe_screen *screen = pipe->screen;
assert(shader < PIPE_SHADER_TYPES);
assert(index == 0);
/* note: reference counting */
winsys_buffer_reference(ws,
pipe_buffer_reference(screen,
&softpipe->constants[shader].buffer,
buf ? buf->buffer : NULL);

View file

@ -33,7 +33,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@ -106,11 +106,11 @@ softpipe_displaytarget_layout(struct pipe_screen *screen,
spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height[0]);
spt->buffer = ws->surface_buffer_create( ws,
spt->base.width[0],
spt->base.height[0],
spt->base.format,
usage,
&spt->stride[0]);
spt->base.width[0],
spt->base.height[0],
spt->base.format,
usage,
&spt->stride[0]);
return spt->buffer != NULL;
}

View file

@ -31,7 +31,7 @@
#include "pipe/p_compiler.h"
#include "pipe/p_debug.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
/**

View file

@ -36,7 +36,7 @@
#define P_WINSYS_H
#include "p_format.h"
#include "pipe/p_format.h"
#ifdef __cplusplus
@ -178,7 +178,6 @@ struct pipe_winsys
};
#ifdef __cplusplus
}
#endif

View file

@ -31,7 +31,6 @@
#include "p_context.h"
#include "p_defines.h"
#include "p_screen.h"
#include "p_winsys.h"
#ifdef __cplusplus
@ -89,29 +88,6 @@ pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf)
}
/* XXX: thread safety issues!
*/
static INLINE void
winsys_buffer_reference(struct pipe_winsys *winsys,
struct pipe_buffer **ptr,
struct pipe_buffer *buf)
{
if (buf) {
assert(buf->refcount);
buf->refcount++;
}
if (*ptr) {
assert((*ptr)->refcount);
if(--(*ptr)->refcount == 0)
winsys->buffer_destroy( winsys, *ptr );
}
*ptr = buf;
}
/**
* \sa pipe_surface_reference
*/
@ -152,20 +128,20 @@ pipe_texture_release(struct pipe_texture **ptr)
/**
* Convenience wrappers for winsys buffer functions.
* Convenience wrappers for screen buffer functions.
*/
static INLINE struct pipe_buffer *
pipe_buffer_create( struct pipe_screen *screen,
unsigned alignment, unsigned usage, unsigned size )
{
return screen->winsys->buffer_create(screen->winsys, alignment, usage, size);
return screen->buffer_create(screen, alignment, usage, size);
}
static INLINE struct pipe_buffer *
pipe_user_buffer_create( struct pipe_screen *screen, void *ptr, unsigned size )
{
return screen->winsys->user_buffer_create(screen->winsys, ptr, size);
return screen->user_buffer_create(screen, ptr, size);
}
static INLINE void *
@ -173,25 +149,36 @@ pipe_buffer_map(struct pipe_screen *screen,
struct pipe_buffer *buf,
unsigned usage)
{
return screen->winsys->buffer_map(screen->winsys, buf, usage);
return screen->buffer_map(screen, buf, usage);
}
static INLINE void
pipe_buffer_unmap(struct pipe_screen *screen,
struct pipe_buffer *buf)
{
screen->winsys->buffer_unmap(screen->winsys, buf);
screen->buffer_unmap(screen, buf);
}
/* XXX when we're using this everywhere, get rid of
* winsys_buffer_reference() above.
/* XXX: thread safety issues!
*/
static INLINE void
pipe_buffer_reference(struct pipe_screen *screen,
struct pipe_buffer **ptr,
struct pipe_buffer *buf)
{
winsys_buffer_reference(screen->winsys, ptr, buf);
if (buf) {
assert(buf->refcount);
buf->refcount++;
}
if (*ptr) {
assert((*ptr)->refcount);
if(--(*ptr)->refcount == 0) {
screen->buffer_destroy( screen, *ptr );
}
}
*ptr = buf;
}

View file

@ -48,6 +48,8 @@ extern "C" {
#endif
/** Opaque type */
struct pipe_fence_handle;
/**
* Gallium screen/adapter context. Basically everything
@ -128,7 +130,108 @@ struct pipe_screen {
void (*surface_unmap)( struct pipe_screen *,
struct pipe_surface *surface );
/**
* Buffer management. Buffer attributes are mostly fixed over its lifetime.
*
*/
struct pipe_buffer *(*buffer_create)( struct pipe_screen *screen,
unsigned alignment,
unsigned usage,
unsigned size );
/**
* Create a buffer that wraps user-space data.
*
* Effectively this schedules a delayed call to buffer_create
* followed by an upload of the data at *some point in the future*,
* or perhaps never. Basically the allocate/upload is delayed
* until the buffer is actually passed to hardware.
*
* The intention is to provide a quick way to turn regular data
* into a buffer, and secondly to avoid a copy operation if that
* data subsequently turns out to be only accessed by the CPU.
*
* Common example is OpenGL vertex buffers that are subsequently
* processed either by software TNL in the driver or by passing to
* hardware.
*
* XXX: What happens if the delayed call to buffer_create() fails?
*
* Note that ptr may be accessed at any time upto the time when the
* buffer is destroyed, so the data must not be freed before then.
*/
struct pipe_buffer *(*user_buffer_create)(struct pipe_screen *screen,
void *ptr,
unsigned bytes);
/**
* Allocate storage for a display target surface.
*
* Often surfaces which are meant to be blitted to the front screen (i.e.,
* display targets) must be allocated with special characteristics, memory
* pools, or obtained directly from the windowing system.
*
* This callback is invoked by the pipe_screenwhen creating a texture marked
* with the PIPE_TEXTURE_USAGE_DISPLAY_TARGET flag to get the underlying
* buffer storage.
*/
struct pipe_buffer *(*surface_buffer_create)(struct pipe_screen *screen,
unsigned width, unsigned height,
enum pipe_format format,
unsigned usage,
unsigned *stride);
/**
* Map the entire data store of a buffer object into the client's address.
* flags is bitmask of PIPE_BUFFER_USAGE_CPU_READ/WRITE flags.
*/
void *(*buffer_map)( struct pipe_screen *screen,
struct pipe_buffer *buf,
unsigned usage );
void (*buffer_unmap)( struct pipe_screen *screen,
struct pipe_buffer *buf );
void (*buffer_destroy)( struct pipe_screen *screen,
struct pipe_buffer *buf );
/**
* Do any special operations to ensure frontbuffer contents are
* displayed, eg copy fake frontbuffer.
*/
void (*flush_frontbuffer)( struct pipe_screen *screen,
struct pipe_surface *surf,
void *context_private );
/** Set ptr = fence, with reference counting */
void (*fence_reference)( struct pipe_screen *screen,
struct pipe_fence_handle **ptr,
struct pipe_fence_handle *fence );
/**
* Checks whether the fence has been signalled.
* \param flags driver-specific meaning
* \return zero on success.
*/
int (*fence_signalled)( struct pipe_screen *screen,
struct pipe_fence_handle *fence,
unsigned flag );
/**
* Wait for the fence to finish.
* \param flags driver-specific meaning
* \return zero on success.
*/
int (*fence_finish)( struct pipe_screen *screen,
struct pipe_fence_handle *fence,
unsigned flag );
};

View file

@ -10,7 +10,6 @@
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
#include "pipe/p_winsys.h"
#include "state_tracker/st_public.h"
#include "state_tracker/drm_api.h"

View file

@ -10,7 +10,7 @@
#include "state_tracker/drm_api.h"
#include "pipe/p_screen.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
/** HACK */
void* driDriverAPI;

View file

@ -2,7 +2,6 @@
#include "vl_basic_csc.h"
#include <assert.h>
#include <pipe/p_context.h>
#include <pipe/p_winsys.h>
#include <pipe/p_state.h>
#include <pipe/p_inlines.h>
#include <tgsi/tgsi_parse.h>

View file

@ -2,7 +2,6 @@
#include "vl_r16snorm_mc_buf.h"
#include <assert.h>
#include <pipe/p_context.h>
#include <pipe/p_winsys.h>
#include <pipe/p_screen.h>
#include <pipe/p_state.h>
#include <pipe/p_inlines.h>
@ -649,9 +648,9 @@ static int vlFlush
pipe->set_framebuffer_state(pipe, &mc->render_target);
pipe->set_viewport_state(pipe, &mc->viewport);
vs_consts = pipe->winsys->buffer_map
vs_consts = pipe_buffer_map
(
pipe->winsys,
pipe->screen,
mc->vs_const_buf.buffer,
PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD
);

View file

@ -26,7 +26,7 @@
**************************************************************************/
#include "pipe/p_winsys.h"
#include "pipe/p_screen.h"
#include "pipe/p_context.h"
#include "pipe/p_shader_tokens.h"
#include "pipe/p_inlines.h"

View file

@ -36,7 +36,7 @@
*/
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"/* port to just p_screen */
#include "pipe/p_format.h"
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"

View file

@ -10,7 +10,7 @@
#include "ws_dri_bufpool.h"
#include "ws_dri_fencemgr.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
#include "pipe/p_inlines.h"

View file

@ -1,7 +1,7 @@
#ifndef INTEL_DRM_DEVICE_H
#define INTEL_DRM_DEVICE_H
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_context.h"
/*

View file

@ -1,7 +1,7 @@
#include "intel_be_device.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
#include "pipe/p_inlines.h"

View file

@ -2,7 +2,7 @@
#ifndef INTEL_DRM_DEVICE_H
#define INTEL_DRM_DEVICE_H
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_context.h"
#include "drm.h"

View file

@ -1,4 +1,4 @@
#include <pipe/p_winsys.h>
#include "pipe/internal/p_winsys_screen.h"
#include <pipe/p_defines.h>
#include <pipe/p_inlines.h>
#include <util/u_memory.h>

View file

@ -2,7 +2,7 @@
#define NOUVEAU_PIPE_WINSYS_H
#include "pipe/p_context.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "nouveau_context.h"
struct nouveau_pipe_buffer {

Some files were not shown because too many files have changed in this diff Show more