Commit a5585cb5 authored by Keith Whitwell's avatar Keith Whitwell

Merge commit 'origin/master' into i965g-restart

Conflicts:
	SConstruct
	configs/default
	configs/linux-dri
parents d288a306 574715d8

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
......@@ -440,8 +440,7 @@ DEMO_FILES = \
$(DIRECTORY)/progs/windml/Makefile.ugl \
$(DIRECTORY)/progs/windml/*.c \
$(DIRECTORY)/progs/windml/*.bmp \
$(DIRECTORY)/progs/ggi/*.c \
$(DIRECTORY)/windows/VC7/progs/progs.sln
$(DIRECTORY)/progs/ggi/*.c
GLUT_FILES = \
$(DIRECTORY)/include/GL/glut.h \
......@@ -464,9 +463,7 @@ GLUT_FILES = \
$(DIRECTORY)/src/glut/mini/glut.pc.in \
$(DIRECTORY)/src/glut/directfb/Makefile \
$(DIRECTORY)/src/glut/directfb/NOTES \
$(DIRECTORY)/src/glut/directfb/*[ch] \
$(DIRECTORY)/windows/VC6/progs/glut/glut.dsp \
$(DIRECTORY)/windows/VC7/progs/glut/glut.vcproj
$(DIRECTORY)/src/glut/directfb/*[ch]
DEPEND_FILES = \
$(TOP)/src/mesa/depend \
......
......@@ -32,10 +32,10 @@ import common
default_statetrackers = 'mesa'
if common.default_platform in ('linux', 'freebsd', 'darwin'):
default_drivers = 'softpipe,failover,i915,i965,trace,identity,llvmpipe'
default_drivers = 'softpipe,failover,svga,i915,i965,trace,identity,llvmpipe'
default_winsys = 'xlib'
elif common.default_platform in ('winddk',):
default_drivers = 'softpipe,i915,i965,trace,identity'
default_drivers = 'softpipe,svga,i915,i965,trace,identity'
default_winsys = 'all'
else:
default_drivers = 'all'
......@@ -46,9 +46,9 @@ common.AddOptions(opts)
opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statetrackers,
['mesa', 'python', 'xorg']))
opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers,
['softpipe', 'failover', 'i915', 'i965', 'cell', 'trace', 'r300', 'identity', 'llvmpipe']))
['softpipe', 'failover', 'svga', 'i915', 'i965', 'cell', 'trace', 'r300', 'identity', 'llvmpipe']))
opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys,
['xlib', 'intel', 'i965', 'gdi', 'radeon']))
['xlib', 'vmware', 'intel', 'i965', 'gdi', 'radeon']))
opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
......
#!/usr/bin/env python
##########################################################################
#
# Copyright 2008 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.
#
##########################################################################
import sys
import optparse
import re
import struct
from gprof2dot import Call, Function, Profile
from gprof2dot import CALLS, SAMPLES, TIME, TIME_RATIO, TOTAL_TIME, TOTAL_TIME_RATIO
from gprof2dot import DotWriter, TEMPERATURE_COLORMAP
__version__ = '0.1'
class ParseError(Exception):
pass
class MsvcDemangler:
# http://www.kegel.com/mangle.html
def __init__(self, symbol):
self._symbol = symbol
self._pos = 0
def lookahead(self):
return self._symbol[self._pos]
def consume(self):
ret = self.lookahead()
self._pos += 1
return ret
def match(self, c):
if self.lookahead() != c:
raise ParseError
self.consume()
def parse(self):
self.match('?')
name = self.parse_name()
qualifications = self.parse_qualifications()
return '::'.join(qualifications + [name])
def parse_name(self):
if self.lookahead() == '?':
return self.consume() + self.consume()
else:
name = self.parse_id()
self.match('@')
return name
def parse_qualifications(self):
qualifications = []
while self.lookahead() != '@':
name = self.parse_id()
qualifications.append(name)
self.match('@')
return qualifications
def parse_id(self):
s = ''
while True:
c = self.lookahead()
if c.isalnum() or c in '_':
s += c
self.consume()
else:
break
return s
def demangle(name):
if name.startswith('_'):
name = name[1:]
idx = name.rfind('@')
if idx != -1 and name[idx+1:].isdigit():
name = name[:idx]
return name
if name.startswith('?'):
demangler = MsvcDemangler(name)
return demangler.parse()
return name
class Reader:
def __init__(self):
self.symbols = []
self.symbol_cache = {}
self.base_addr = None
def read_map(self, mapfile):
# See http://msdn.microsoft.com/en-us/library/k7xkk3e2.aspx
last_addr = 0
last_name = 0
for line in file(mapfile, "rt"):
fields = line.split()
try:
section_offset, name, addr, type, lib_object = fields
except ValueError:
continue
if type != 'f':
continue
section, offset = section_offset.split(':')
addr = int(offset, 16)
self.symbols.append((addr, name))
last_addr = addr
last_name = name
# sort symbols
self.symbols.sort(key = lambda (addr, name): addr)
def lookup_addr(self, addr):
try:
return self.symbol_cache[addr]
except KeyError:
pass
tolerance = 4196
s, e = 0, len(self.symbols)
while s != e:
i = (s + e)//2
start_addr, name = self.symbols[i]
try:
end_addr, next_name = self.symbols[i + 1]
except IndexError:
end_addr = start_addr + tolerance
if addr < start_addr:
e = i
continue
if addr == end_addr:
return next_name, addr - start_addr
if addr > end_addr:
s = i
continue
return name, addr - start_addr
raise ValueError
def lookup_symbol(self, name):
for symbol_addr, symbol_name in self.symbols:
if name == symbol_name:
return symbol_addr
return 0
def read_data(self, data):
profile = Profile()
fp = file(data, "rb")
entry_format = "IIII"
entry_size = struct.calcsize(entry_format)
caller = None
caller_stack = []
while True:
entry = fp.read(entry_size)
if len(entry) < entry_size:
break
caller_addr, callee_addr, samples_lo, samples_hi = struct.unpack(entry_format, entry)
if caller_addr == 0 and callee_addr == 0:
continue
if self.base_addr is None:
ref_addr = self.lookup_symbol('___debug_profile_reference@0')
if ref_addr:
self.base_addr = (caller_addr - ref_addr) & ~(options.align - 1)
else:
self.base_addr = 0
sys.stderr.write('Base addr: %08x\n' % self.base_addr)
samples = (samples_hi << 32) | samples_lo
try:
caller_raddr = caller_addr - self.base_addr
caller_sym, caller_ofs = self.lookup_addr(caller_raddr)
try:
caller = profile.functions[caller_sym]
except KeyError:
caller_name = demangle(caller_sym)
caller = Function(caller_sym, caller_name)
profile.add_function(caller)
caller[CALLS] = 0
caller[SAMPLES] = 0
except ValueError:
caller = None
if not callee_addr:
if caller:
caller[SAMPLES] += samples
else:
callee_raddr = callee_addr - self.base_addr
callee_sym, callee_ofs = self.lookup_addr(callee_raddr)
try:
callee = profile.functions[callee_sym]
except KeyError:
callee_name = demangle(callee_sym)
callee = Function(callee_sym, callee_name)
profile.add_function(callee)
callee[CALLS] = samples
callee[SAMPLES] = 0
else:
callee[CALLS] += samples
if caller is not None:
try:
call = caller.calls[callee.id]
except KeyError:
call = Call(callee.id)
call[CALLS] = samples
caller.add_call(call)
else:
call[CALLS] += samples
if options.verbose:
if not callee_addr:
sys.stderr.write('%s+%u: %u\n' % (caller_sym, caller_ofs, samples))
else:
sys.stderr.write('%s+%u -> %s+%u: %u\n' % (caller_sym, caller_ofs, callee_sym, callee_ofs, samples))
# compute derived data
profile.validate()
profile.find_cycles()
profile.aggregate(SAMPLES)
profile.ratio(TIME_RATIO, SAMPLES)
profile.call_ratios(CALLS)
profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO)
return profile
def main():
parser = optparse.OptionParser(
usage="\n\t%prog [options] [file] ...",
version="%%prog %s" % __version__)
parser.add_option(
'-a', '--align', metavar='NUMBER',
type="int", dest="align", default=16,
help="section alignment")
parser.add_option(
'-m', '--map', metavar='FILE',
type="string", dest="map",
help="map file")
parser.add_option(
'-b', '--base', metavar='FILE',
type="string", dest="base",
help="base addr")
parser.add_option(
'-n', '--node-thres', metavar='PERCENTAGE',
type="float", dest="node_thres", default=0.5,
help="eliminate nodes below this threshold [default: %default]")
parser.add_option(
'-e', '--edge-thres', metavar='PERCENTAGE',
type="float", dest="edge_thres", default=0.1,
help="eliminate edges below this threshold [default: %default]")
parser.add_option(
'-v', '--verbose',
action="count",
dest="verbose", default=0,
help="verbose output")
global options
(options, args) = parser.parse_args(sys.argv[1:])
reader = Reader()
if options.base is not None:
reader.base_addr = int(options.base, 16)
if options.map is not None:
reader.read_map(options.map)
for arg in args:
profile = reader.read_data(arg)
profile.prune(options.node_thres/100.0, options.edge_thres/100.0)
output = sys.stdout
dot = DotWriter(output)
colormap = TEMPERATURE_COLORMAP
dot.graph(profile, colormap)
if __name__ == '__main__':
main()
......@@ -124,7 +124,7 @@ INSTALL_INC_DIR = $(includedir)
DRI_DRIVER_INSTALL_DIR = @DRI_DRIVER_INSTALL_DIR@
# Where libGL will look for DRI hardware drivers
DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR)
DRI_DRIVER_SEARCH_DIR = @DRI_DRIVER_SEARCH_DIR@
# Xorg driver install directory (for xorg state-tracker)
XORG_DRIVER_INSTALL_DIR = @XORG_DRIVER_INSTALL_DIR@
......
......@@ -9,7 +9,7 @@ CONFIG_NAME = default
# Version info
MESA_MAJOR=7
MESA_MINOR=7
MESA_MINOR=8
MESA_TINY=0
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
......@@ -96,7 +96,7 @@ EGL_DRIVERS_DIRS = demo
GALLIUM_DIRS = auxiliary drivers state_trackers
GALLIUM_AUXILIARY_DIRS = rbug draw translate cso_cache pipebuffer tgsi sct rtasm util indices vl
GALLIUM_AUXILIARIES = $(foreach DIR,$(GALLIUM_AUXILIARY_DIRS),$(TOP)/src/gallium/auxiliary/$(DIR)/lib$(DIR).a)
GALLIUM_DRIVERS_DIRS = i965 softpipe i915 failover trace identity
GALLIUM_DRIVERS_DIRS = softpipe failover svga i915 i965 trace identity
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
GALLIUM_WINSYS_DIRS = xlib egl_xlib
GALLIUM_WINSYS_DRM_DIRS =
......
......@@ -23,11 +23,11 @@ DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
X11_INCLUDES = -I/usr/X11R6/include
CFLAGS = -Wall -Wmissing-prototypes -Wdeclaration-after-statement \
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \
$(DEFINES) $(ASM_FLAGS) $(X11_INCLUDES) -std=c99 -ffast-math
-Wpointer-arith $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \
$(DEFINES) $(ASM_FLAGS) $(X11_INCLUDES) -std=c99 -ffast-math
CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
$(X11_INCLUDES)
CXXFLAGS = -Wall -Wpointer-arith $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \
$(DEFINES) $(X11_INCLUDES)
# Work around aliasing bugs - developers should comment this out
CFLAGS += -fno-strict-aliasing
......
......@@ -4,5 +4,6 @@ include $(TOP)/configs/linux
CONFIG_NAME = linux-debug
OPT_FLAGS = -g -ansi -pedantic
OPT_FLAGS = -g
CFLAGS += -ansi -pedantic
DEFINES += -DDEBUG -DDEBUG_MATH
......@@ -60,7 +60,7 @@ EGL_DRIVERS_DIRS = demo glx
DRIVER_DIRS = dri
WINDOW_SYSTEM = dri
GALLIUM_WINSYS_DIRS = drm
GALLIUM_WINSYS_DRM_DIRS = intel i965
GALLIUM_STATE_TRACKERS_DIRS = egl dri
GALLIUM_WINSYS_DRM_DIRS = vmware intel i965
GALLIUM_STATE_TRACKERS_DIRS = egl
DRI_DIRS = i915 i965
......@@ -649,6 +649,13 @@ AC_ARG_WITH([dri-driverdir],
[DRI_DRIVER_INSTALL_DIR="$withval"],
[DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
AC_SUBST([DRI_DRIVER_INSTALL_DIR])
dnl Extra search path for DRI drivers
AC_ARG_WITH([dri-searchpath],
[AS_HELP_STRING([--with-dri-searchpath=DIRS...],
[semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
[DRI_DRIVER_SEARCH_DIR="$withval"],
[DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
AC_SUBST([DRI_DRIVER_SEARCH_DIR])
dnl Direct rendering or just indirect rendering
AC_ARG_ENABLE([driglx-direct],
[AS_HELP_STRING([--disable-driglx-direct],
......@@ -1182,6 +1189,19 @@ AC_ARG_WITH([max-height],
[AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
)
dnl
dnl Gallium SVGA configuration
dnl
AC_ARG_ENABLE([gallium-svga],
[AS_HELP_STRING([--disable-gallium-svga],
[build gallium SVGA @<:@default=enabled@:>@])],
[enable_gallium_svga="$enableval"],
[enable_gallium_svga=yes])
if test "x$enable_gallium_svga" = xyes; then
GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS vmware"
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
fi
dnl
dnl Gallium Intel configuration
dnl
......
......@@ -27,12 +27,6 @@ using the SDK with Visual Studio Express can be found at
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
If you are stuck using VC6 or VC7, you may start with these project
files, but you may need to modify them to reflect changes in the
Mesa source code tree. If you sucessfully update the project files,
please submit them to the author of this document so that they may
be included in the next distribution.
The project files to build the core Mesa library, Windows Mesa
drivers, OSMesa, and GLU are in the mesa directory. The project files
to build GLUT and some demo programs are in the progs directory.
......@@ -106,23 +100,6 @@ should build all the demos.
Build System Notes
----- ------ -----
VC6 (not actively supported)
---
Visual Studio 6 does not recognize files with the .cc extension as C++
language files, without a lot of unnatural tweaking. So, the VC6
build process uses custom build steps to compile these files in the
GLU library.
Two additional configurations are provided, Debug x86 and Release x86
that activate the shader code compilation by defining SLANG_86. It is
unknown if and how this works.
VC7 (not actively supported)
---
The above-mentioned .cc problem does not exist in this version.
VC8
---
......
Introduction
------------
This document describes the implementation of the XFree86 4.0 libGL.so
library defined by the Linux/OpenGL Base specification found at
http://reality.sgi.com/opengl/linux/linuxbase.html.
The documentation is divided into two sections:
User's Guide
Driver Developer's Guide
Author: Brian Paul (brian@precisioninsight.com)
Date: February 2000
User's Guide
------------
Using libGL.so
The libGL.so library defines the gl- and glX-prefixed functions needed to
run OpenGL programs. OpenGL client applications should link with the
-lGL option to use it.
libGL.so serves two primary functions: GLX protocol generation for indirect
rendering and loading/management of hardware drivers for direct rendering.
When libGL.so initializes itself it uses the DRI to determine the
appropriate hardware driver for each screen on the local X display.
The hardware drivers are expected to be in the /usr/X11R6/lib/modules/dri/
directory. Drivers are named with the convention <name>_dri.so where
<name> is a driver such as "tdfx", "i810", "gamma", etc.
The LIBGL_DRIVERS_DIR environment variable may be used to specify a
different DRI modules directory, overriding /usr/X11R6/lib/modules/dri/.
This environment variable is ignored in setuid programs for security
reasons.
When libGL.so is unable to locate appropriate hardware drivers it will
fall back to using indirect GLX rendering.
To aid in solving problems, libGL.so will print diagnostic messages to
stderr if the LIBGL_DEBUG environment variable is defined.
libGL.so is thread safe. The overhead of thread safety for common,
single-thread clients is negligible. However, the overhead of thread
safety for multi-threaded clients is significant. Each GL API call
requires two calls to pthread_get_specific() which can noticably
impact performance. Warning: libGL.so is thread safe but individual
DRI drivers may not be. Please consult the documentation for a driver
to learn if it is thread safe.
Indirect Rendering
You can force indirect rendering mode by setting the LIBGL_ALWAYS_INDIRECT
environment variable. Hardware acceleration will not be used.
libGL.so Extensibility
libGL.so is designed to be extended without upgrading. That is,
drivers may install new OpenGL extension functions into libGL.so
without requiring libGL.so to be replaced. Clients of libGL.so should
use the glXGetProcAddressEXT() function to obtain the address of
functions by name. For more details of GLX_ARB_get_proc_address see
http://oss.sgi.com/projects/ogl-sample/registry/ARB/get_proc_address.spec
libGL.so is also designed with flexibility such that it may be used
with many generations of hardware drivers to come.
Driver Developer's Guide
------------------------
This section describes the requirements to make an XFree86 4.0
libGL.so-compatible hardware driver. It is not intended for end
users of libGL.so.
XFree86 source files
libGL.so is built inside XFree86 with sources found in xc/lib/GL/.
Specifically, libGL.so is built from:
xc/lib/GL/glx/*.c
xc/lib/dri/XF86dri.c
xc/lib/dri/dri_glx.c
xc/lib/GL/mesa/src/glapi.c
xc/lib/GL/mesa/src/glapitemp.h
xc/lib/GL/mesa/src/glapitable.h
xc/lib/GL/mesa/src/glapioffsets.h
xc/lib/GL/mesa/src/glapinoop.c
xc/lib/GL/mesa/src/glheader.h
xc/lib/GL/mesa/src/glthread.c
xc/lib/GL/mesa/src/glthread.h
xc/lib/GL/mesa/src/X86/glapi_x86.S
xc/lib/GL/mesa/src/X86/assyntax.h
Understand that the mesa/src/gl*.[ch] files are not tied to Mesa. They
have no dependencies on the rest of Mesa and are designed to be reusable
in a number of projects.
The glapi_x86.X and assyntax.h files implement x86-optimized dispatch
of GL functions. They are not required; C-based dispatch can be used
instead, with a slight performance penalty.
Driver loading and binding