Compare commits

...

79 Commits

Author SHA1 Message Date
Eric Anholt
482d9dd21d Don't index box by the box's index within numClipRects; just dereference it.
Fixes drawing with more than one cliprect. (Keith Packard)
2006-04-01 00:57:57 +00:00
Eric Anholt
9e8659f346 Call driUpdateFramebufferSize when we've found an updated DRI drawable stamp,
like other drivers.  Failure to do so resulted in incorrect buffer sizes for
resized windows.
2006-04-01 00:55:02 +00:00
Brian Paul
e3f41ce611 6.5 updates 2006-03-31 23:10:21 +00:00
Daniel Borca
3a3e63dc4f DMesa now uses OSMesa as a back-end. 2006-03-31 20:53:12 +00:00
Daniel Borca
3a46dff27d Removed empty arrays. 2006-03-31 20:49:55 +00:00
Aapo Tahkola
29d833bd52 Enough testing already 2006-03-31 18:46:33 +00:00
Brian Paul
9305cba6a7 bump version/date 2006-03-31 17:31:22 +00:00
Brian Paul
f2ad1b60c0 Dave Reveman's patch for GLX_MESA_copy_sub_buffer support 2006-03-31 15:48:04 +00:00
Brian Paul
df3d4e0bb9 Fix the fetch_texel_ci8() code to deal with floating point color palettes.
Fixes Quake on Windows bug.  (Karl Schultz)
2006-03-31 15:22:09 +00:00
Aapo Tahkola
6652dc8aac free rs300 and ban r350(according to r300.sf.net) 2006-03-31 14:11:41 +00:00
Aapo Tahkola
7da1daf0a2 make u_list adjustable 2006-03-31 10:10:45 +00:00
Karl Schultz
18b72d184c updated again for 6.5. 2006-03-31 06:54:11 +00:00
Aapo Tahkola
ef5b48dea1 warn about broken dxt 3/5 2006-03-31 03:54:36 +00:00
Aapo Tahkola
2cd4056fae Dont rely on writebacks 2006-03-31 03:50:29 +00:00
Aapo Tahkola
fb0175db93 disable r300 chips. R300_FORCE_R300 to force 2006-03-31 03:16:39 +00:00
Aapo Tahkola
aa70d92a13 More meaningful warning. 2006-03-31 03:01:28 +00:00
Eric Anholt
aba4967150 The pitches of the driRenderbuffers are in bytes, so no need to multiply by cpp.
Fixes software fallbacks. (Keith Packard)
2006-03-30 22:44:51 +00:00
Karl Schultz
174ce730c6 Clean up data structures, finishing off some of the cleanup work suggested by Brian. Now also creating two renderbuffers, so apps can now switch with glDrawBuffer. 2006-03-30 21:53:23 +00:00
Adam Jackson
48547ee129 Clarify which version of Mesa we're talking about 2006-03-30 19:26:54 +00:00
Adam Jackson
823c581f7c Revert my change from 1.37 as being bogus (see ensuing list discussion for
rationale).
2006-03-30 19:23:38 +00:00
Adam Jackson
8982697981 Update the install docs to make explicit note of libdrm version dependency.
Change pdx.fd.o to {anon,}cvs.fd.o as appropriate.
2006-03-30 19:21:20 +00:00
Adam Jackson
9542537cee Style fix, drop the explicit -ldrm from the link line. 2006-03-30 19:20:25 +00:00
Karl Schultz
c3f2c287ce Fix logic error in viewport function so that we still resize the buffers if the viewport and the window both change to the same new size. This lets the gloss demo work with the -f option. 2006-03-30 18:03:41 +00:00
Brian Paul
9e81d6ae3a When creating front/back renderbuffers, init the Red/Green/Blue/AlphaBits fields 2006-03-30 16:33:35 +00:00
Brian Paul
94d6bf883b Init the Red/Green/Blue/Alpha/Depth/StencilBits fields in driNewRenderbuffer() 2006-03-30 16:32:16 +00:00
Brian Paul
84c5d0a789 comments regarding assertions 2006-03-30 16:29:41 +00:00
Karl Schultz
dd7074736f Use [][3] for write_rgb_span_16 2006-03-30 16:26:26 +00:00
Brian Paul
ef8b89faee some comments for Darwin 2006-03-30 14:28:28 +00:00
Brian Paul
159ca321cb added glfbdev.h to MAIN_FILES 2006-03-30 14:27:25 +00:00
Brian Paul
ec83f38e2e fix bad call to FindLine() 2006-03-30 14:26:29 +00:00
Brian Paul
197d725601 added -f option for full-screeen 2006-03-30 14:25:54 +00:00
Brian Paul
693a66aea9 press '0' for glDrawBuffer(GL_NONE) 2006-03-30 14:24:58 +00:00
Brian Paul
8ea3353ec3 XMesaDrawLine macro, not currently used 2006-03-30 14:20:26 +00:00
Karl Schultz
87af12dbdc Fixes from Brian to help migrate to render buffer DD interfaces. Also fix bug in the viewport function that was using the viewport size to resize the buffer, when it should have been using the window size. Fix bug in write_rgb_span_32 where the incoming pixel data parameter was coded as a [][4] instead of [][3]. Now all the demos work correctly except singlebuffer. 2006-03-30 07:58:24 +00:00
Karl Schultz
a8c9ecfab0 Fixes from Brian 2006-03-30 07:53:15 +00:00
Dave Airlie
4ecb9f0532 Fix up some incorrect pointers and clear screen 2006-03-30 05:47:08 +00:00
Dave Airlie
8b186e3695 add initial miniglx files for i915, not integrated yet 2006-03-30 04:33:58 +00:00
Karl Schultz
e43edd3c70 Updated for Mesa 6.5 2006-03-29 23:53:43 +00:00
Brian Paul
20e15f9381 Add -ansi -pedantic flags to OPT_FLAGS. This got lost at some point. Good for catching sloppy coding. 2006-03-29 23:45:44 +00:00
Brian Paul
75a8383e8d Update the _WindowMap matrix in _mesa_set_viewport() and _mesa_DepthRange().
This is a temporary fix for the DRI drivers.
Should really only have to update the matrix via _mesa_update_state().
2006-03-29 23:44:31 +00:00
Brian Paul
920023240c put braces around RENDER_SPAN macro when called, not when defined. Fixes -pedantic warnings in x11 driver 2006-03-29 23:42:44 +00:00
Brian Paul
62c325af3f fix GETPROCADDRESS usage, remove carriage return chars (bug 6430) 2006-03-29 23:20:49 +00:00
Brian Paul
32244ac7e9 s/glslnose.c/glslnoise/ (bug 6430) 2006-03-29 23:18:13 +00:00
Kristian Høgsberg
3a6d968f37 Fixes to silence warnings in code generated by glapi scripts. 2006-03-29 22:32:38 +00:00
Karl Schultz
cec74532bf Add newest source code files to project. 2006-03-29 20:55:48 +00:00
Brian Paul
f331bb0312 added some no-op virtual destructors to silence g++ 4.0.0 warnings 2006-03-29 18:54:00 +00:00
Brian Paul
c3051df8e1 fixes from John Shell (bug 6339) 2006-03-29 18:46:46 +00:00
Brian Paul
db79d2abac minor clean-up 2006-03-29 18:41:19 +00:00
Brian Paul
c19de0b7f6 FP textures and fixes (Ewald Snel) 2006-03-29 15:21:01 +00:00
Brian Paul
e5b6eee15d fix components initialization in two places (Ewald Snel) 2006-03-29 15:17:57 +00:00
Brian Paul
006e183b6e move NumNativeAlu/TexInstruction assignments (Ewald Snel) 2006-03-29 15:15:37 +00:00
Jouk Jansen
180b0dab8b Committing in .
Removing <CR>

 Modified Files:
 	Mesa/src/mesa/main/fog.c Mesa/src/mesa/main/hint.c
 	Mesa/src/mesa/main/mtypes.h
 ----------------------------------------------------------------------
2006-03-29 12:09:08 +00:00
Brian Paul
a85fbb1d36 prep for 6.5 release 2006-03-29 04:53:02 +00:00
Brian Paul
555478fed6 New code for rendering to depth/stencil textures.
Re-org of the renderbuffer wrapper code.
2006-03-29 04:51:03 +00:00
Brian Paul
2742c4e4db new tests for GL_DEPTH_STENCIL_EXT 2006-03-29 04:48:21 +00:00
Brian Paul
2b430ef56a a few new assertions 2006-03-29 04:47:34 +00:00
Karl Schultz
b7a5a9db88 Windows makefile to easily build all demo programs. 2006-03-29 04:02:44 +00:00
Karl Schultz
888ab86f85 Repair corrupted file and remove rogue 'test' project. 2006-03-29 04:01:25 +00:00
Brian Paul
2526152a10 fix a GLuint vs GLushort test, new assertions 2006-03-29 04:01:05 +00:00
Brian Paul
519a2e7cb7 Move the computation of the viewport matrix into a new update_viewport_matrix()
function since the matrix depends on the viewport params and the framebuffer's
depth buffer resolution.
Fixes some renderbuffer / depth range issues.
This simplifies the _mesa_set_viewport() and _mesa_DepthRange() functions too.
2006-03-29 03:59:34 +00:00
Karl Schultz
b687531f69 Undef a conflicting symbol in Windows. 2006-03-29 03:42:32 +00:00
Karl Schultz
54b65e080e add showbuffer.[ch] which could be in this dir after the targets are built. 2006-03-29 03:41:38 +00:00
Karl Schultz
3076557ca3 Update for new Mesa entry points. I need to change the python script that generates this file to the new XML scheme, but for now, a manual update is OK. 2006-03-29 02:12:31 +00:00
Karl Schultz
4f21180416 Remove unneeded includes of time.h 2006-03-29 02:09:47 +00:00
Daniel Borca
c61763b5d2 Match pixel addresses with `compute_row_addresses' in RGB mode (also obey RGB/UNSIGNED_BYTE rule). 2006-03-28 21:40:14 +00:00
Roland Scheidegger
08e62a1476 fix missing *_STATECHANGE in *UpdateViewportOffset for radeon, r200 and r300 (reported by Jim Duchek). Fix some potential problems with strict-aliasing with r200 and radeon drivers in *UpdateViewportOffset, *PolygonOffset and *UpdateWindow functions (some compiler warnings about strict-aliasing remain in the codegen vertex code, and there may be more problems unnoticed by the compiler). 2006-03-28 17:22:57 +00:00
Brian Paul
0e26ca0834 updated comment about framebuffer's Visual field 2006-03-28 15:28:00 +00:00
Brian Paul
e44499480f added known issue: render to depth textures not working 2006-03-28 15:25:44 +00:00
Brian Paul
9f6ff49650 update conditional for render to GL_DEPTH_STENCIL texture, check for valid teximage before calling ctx->Driver.RenderTexture() 2006-03-28 15:24:50 +00:00
Brian Paul
c7a5d528c7 a little code movement so we don't make invalid casts from gl_renderbuffers to xmesa_renderbuffers 2006-03-28 15:21:44 +00:00
Aapo Tahkola
b8915340ea fix #6072 (Keith Whitwell) 2006-03-28 10:26:34 +00:00
Keith Whitwell
1155f64cc0 Revert merge of new/experimental code from texmem branch. 2006-03-28 07:40:57 +00:00
Brian Paul
255e8ebd58 enable GL_ARB_half_float_pixel, was GL_MESAX_half_float_pixel 2006-03-28 01:23:43 +00:00
Brian Paul
95174c4eb2 comment about byteswapping in _mesa_unpack_depth_span() 2006-03-28 01:22:48 +00:00
Roland Scheidegger
f76ff7e4a7 make allow_large_textures 1 by default for radeon and r200, and consequently enable all texture units by default on those cards (3 for radeon, 6 for r200). Fix the usually forgotten DRIVER_DATE accordingly. 2006-03-27 23:53:53 +00:00
Roland Scheidegger
96aa403cee remove unnecessary typedefs causing compiler warnings 2006-03-27 23:34:53 +00:00
Daniel Borca
004673d4d1 Disable `hidden' attribute for DJGPP 2006-03-27 17:34:31 +00:00
Daniel Borca
0ad1bda7a1 PutRowRGB was not initialized for OSMESA_RGB_565 2006-03-27 17:32:22 +00:00
Dave Airlie
e72b745f32 Fixup makefile for solo non-egl 2006-03-27 00:07:21 +00:00
138 changed files with 5022 additions and 3380 deletions

View File

@@ -166,6 +166,7 @@ MAIN_FILES = \
$(DIRECTORY)/include/GL/glx.h \
$(DIRECTORY)/include/GL/glxext.h \
$(DIRECTORY)/include/GL/glx_mangle.h \
$(DIRECTORY)/include/GL/glfbdev.h \
$(DIRECTORY)/include/GL/mesa_wgl.h \
$(DIRECTORY)/include/GL/mglmesa.h \
$(DIRECTORY)/include/GL/osmesa.h \

View File

@@ -20,9 +20,9 @@
# 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.
# DOS/DJGPP makefile v1.6 for Mesa
# DOS/DJGPP makefile for Mesa
#
# Copyright (C) 2002 - Daniel Borca
# Author: Daniel Borca
# Email : dborca@users.sourceforge.net
# Web : http://www.geocities.com/dborca
@@ -31,9 +31,6 @@
# Available options:
#
# Environment variables:
# GLU=[mesa|sgi] specify GLU directory; can be `sgi' (requires GNU/C++)
# or `mesa'.
# default = mesa
# GLIDE path to Glide3 SDK; used with FX.
# default = $(TOP)/glide3
# FX=1 build for 3dfx Glide3. Note that this disables
@@ -57,8 +54,6 @@
.PHONY : all libgl libglu libglut clean realclean
GLU ?= mesa
CFLAGS = -Wall -W -pedantic
CFLAGS += -O2 -ffast-math
@@ -75,7 +70,7 @@ all: libgl libglu libglut
libgl: lib
$(MAKE) -f Makefile.DJ -C src/mesa
libglu: lib
$(MAKE) -f Makefile.DJ -C src/glu/$(GLU)
$(MAKE) -f Makefile.DJ -C src/glu/sgi
libglut: lib
$(MAKE) -f Makefile.DJ -C src/glut/dos

View File

@@ -502,6 +502,9 @@ case $ARCH in
${LINK} ${OPTS} ${LIBNAME} ${OBJECTS}
FINAL_LIBS=${LIBNAME}
else
# may need these:
# CFLAGS += -fno-common
# LDFLAGS += -bundle -flat_namespace -undefined suppress
LIBNAME="lib${LIBNAME}.dylib"
echo "mklib: Making Darwin shared library: " ${LIBNAME}
FLAGS="-dynamiclib -multiply_defined suppress -current_version ${MAJOR}.${MINOR}.0 -compatibility_version ${MAJOR}.${MINOR}.0"

View File

@@ -22,7 +22,7 @@ CXXFLAGS = $(DEFINES) -Wall -g -ansi -pedantic -fPIC
ASM_SOURCES =
# Library/program dependencies
LIBDRM_LIB = `pkg-config --libs libdrm` -ldrm
LIBDRM_LIB = `pkg-config --libs libdrm`
DRI_LIB_DEPS = -L/usr/local/lib -lm -lpthread -lexpat $(LIBDRM_LIB)
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lm -lpthread $(LIBDRM_LIB)

View File

@@ -4,5 +4,5 @@ include $(TOP)/configs/linux
CONFIG_NAME = linux-debug
OPT_FLAGS = -g
OPT_FLAGS = -g -ansi -pedantic
DEFINES += -DDEBUG -DDEBUG_MATH

View File

@@ -37,7 +37,7 @@ ASM_SOURCES =
# Library/program dependencies
EXTRA_LIB_PATH=-L/usr/X11R6/lib
LIBDRM_LIB = `pkg-config --libs libdrm` -ldrm
LIBDRM_LIB = `pkg-config --libs libdrm`
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl \
$(LIBDRM_LIB)

View File

@@ -37,7 +37,7 @@ ASM_SOURCES =
# Library/program dependencies
EXTRA_LIB_PATH=`pkg-config --libs-only-L x11`
LIBDRM_LIB = `pkg-config --libs libdrm` -ldrm
LIBDRM_LIB = `pkg-config --libs libdrm`
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl \
$(LIBDRM_LIB) `pkg-config --libs xcb`

View File

@@ -1,4 +1,4 @@
Mesa 6.3 DOS/DJGPP Port v1.7
Mesa 6.5 DOS/DJGPP Port v1.8
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -7,8 +7,7 @@ Description:
~~~~~~~~~~~~
Well, guess what... this is the DOS port of Mesa 6.3, for DJGPP fans... Whoa!
The driver has its origins in ddsample.c, written by Brian Paul and found by me
in Mesa 3.4.2.
The driver uses OSMesa to draw off screen, and then blits the buffer.
@@ -32,9 +31,6 @@ Available options:
Environment variables:
CPU optimize for the given processor.
default = pentium
GLU=[mesa|sgi] specify GLU directory; can be `sgi' (requires GNU/C++)
or `mesa'.
default = mesa
GLIDE path to Glide3 SDK; used with FX.
default = $(TOP)/glide3
FX=1 build for 3dfx Glide3. Note that this disables
@@ -56,11 +52,9 @@ Available options:
Tested on:
CPU: AMD Athlon XP 1800+
Mainboard: GA-7VTXE w/ 512 MB DDRAM
Video card: Voodoo5 6000 AGP w/ 128 MB SDRAM
DJGPP: djdev 2.04 + gcc v3.4.3 + make v3.80
OS: DOS and Win98SE
Video card: Radeon 9500
DJGPP: djdev 2.04 + gcc v4.1.0 + make v3.80
OS: DOS, Win98SE, WinXP (using Videoport driver)
@@ -98,7 +92,7 @@ FAQ:
Q) DMesa is so SLOOOW! The Win32 OpenGL performs so much better...
A) Is that a question? If you have a 3dfx Voodoo (any model), you're
lucky (check http://sourceforge.net/projects/glide for the DJGPP port).
If you haven't, sorry; everything is done in software. Suggestions?
If you haven't, sorry; everything is done in software.
Q) I tried to set refresh rate w/ DMesa, but without success.
A) Refresh rate control works only for VESA 3.0 and the 3dfx driver (in
@@ -107,7 +101,8 @@ FAQ:
Q) I made a simple application and it does nothing. It exits right away. Not
even a blank screen.
A) Pure software drivers (VESA/VGA/NUL) support only double-buffered modes.
A) Software drivers (VESA/VGA/NUL) must to be constructed as single-buffered
visuals. However, DMesaSwapBuffers must be called to get any output.
A) Another weird "feature" is that buffer width must be multiple of 8 (I'm a
lazy programmer and I found that the easiest way to keep buffer handling
at peak performance ;-).
@@ -265,6 +260,11 @@ v1.7 (???-2005)
* no more GLX sources in DOS GLUT
* made GLUT timer callbacks less accurate but safer
v1.8 (apr-2006)
* killed lots of code, the driver is now a front-end to OSMesa
* fixed problem with WinNT (http://www.volny.cz/martin.sulak/)
- removed 3dfx Glide3 support (temporarily?)
Contact:

View File

@@ -1,15 +1,15 @@
File: docs/README.WIN32
Last updated: Jul 01, 2005 - Karl Schultz - kschultz@users.sourceforge.net
Last updated: Mar 31, 2006 - Karl Schultz - kschultz@users.sourceforge.net
Quick Start
----- -----
Unzip both ZIP files (MesaLib and MesaDemos) into the same directory.
The libs and demos build separately, so if you do not care about the
demos, you do not have to unzip that zip file. But if you do, it does
need to be unzipped into the same directory as the lib zip file
because the demos depend on the libs.
Unzip the MesaLib, MesaGLUT, and MesaDemos ZIP files into the same
directory. The libs and demos build separately, so if you do not care
about the demos or GLUT, you only need to unzip MesaLib. If you unzip
more than one ZIP file, they all need to be unzipped into the same
directory. Don't worry, you will not overwrite anything.
The Windows build system uses Microsoft Visual Studio. Project files
for a specific version of Visual Studio are in their own directory in
@@ -22,6 +22,10 @@ of Version 8 and it runs on 64-bit Windows. If you want to try this,
start by importing the VC7 files and create the 64-bit targets in the
configuration manager.
It is likely that the new and free Visual Studio Express can be used
to build Mesa, but it hasn't been tried yet. Start with the VC7
project files.
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.
@@ -33,10 +37,11 @@ from the projects using Visual Studio.
Windows Drivers
------- -------
At this time, only the GDI driver is known to work, as it has been
ported and rewritten to the latest Mesa DD interfaces. Source code
also exists in the tree for other drivers in src/mesa/drivers/windows,
but the status of this code is unknown.
At this time, only the GDI driver is known to work. Most of the demos
in progs/demos should work with this driver.
Source code also exists in the tree for other drivers in
src/mesa/drivers/windows, but the status of this code is unknown.
The GDI driver operates basically by writing pixel spans into a DIB
section and then blitting the DIB to the window. The driver was
@@ -86,6 +91,14 @@ simply run the demo executables from the demo directory.
If you want to run the demos from the Visual Studio, you may have to
change the startup directory and explicitly state where the executables are.
You may also build all the demo programs by using a makefile. Go to
the progs/demos directory and make sure you have executed VCVARS32.BAT
or whatever setup script is appropriate for your compiler. Then,
nmake -f Makefile.win
should build all the demos.
Build System Notes
----- ------ -----
@@ -98,6 +111,9 @@ 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
---

View File

@@ -15,26 +15,29 @@ Even numbered versions (such as 6.4) designate stable releases.
New Features
------------
GL_EXT_timer_query - used to get elapsed time information from the renderer.
OpenGL Shading language support
This includes the GL_ARB_shader_objects, GL_ARB_shading_language_100,
GL_ARB_vertex_shader and GL_ARB_fragment_shader extensions. Most of
the work was done by Michal Krol.
There's probably a fair number of bugs since this is a pretty large,
complicated body of code.
GL_EXT_packed_depth_stencil - defines a new GL_DEPTH_STENCIL_EXT pixel format.
The OpenGL 2.0 interface to these features will be implemented in a
future version of Mesa,
GL_EXT_framebuffer_blit extension - simplified glCopyPixels-like feature
GL_EXT_timer_query
Used to measure the time of OpenGL operations at high precision.
Only supported in the software/Xlib driver at this time.
GL_EXT_packed_depth_stencil
Defines a new GL_DEPTH_STENCIL_EXT pixel format.
Driver Interface Changes
------------------------
Stencil: The Driver.StencilOp/Func/Mask() functions have been replaced by
the two-sided versions: Driver.Stencil*Separate().
To Do
-----
Fix linux-glide target/driver.
Fix lambda calculation for frag progs.
GL_EXT_framebuffer_blit
A simplified glCopyPixels-like feature for copying pixel rectangles.
GL_ARB_half_float_pixel
Adds a new half-precision floating point format for image transfers,
such as for glDrawPixels, glReadPixels, glTexImage, etc.
@@ -47,18 +50,37 @@ The following extensions have been removed:
Known Issues
------------
Rendering to depth textures will not work. Rendering to GL_DEPTH_STENCIL
textures should work.
Driver Interface Changes
------------------------
Stencil: The Driver.StencilOp/Func/Mask() functions have been replaced by
the two-sided versions: Driver.Stencil*Separate().
Render-to-texture: The functions for rendering to textures have changed.
To Do (someday) items
---------------------
Switch to freeglut
Increase MAX_DRAWBUFFERS
Fix linux-glide target/driver.
Fix lambda calculation for frag progs.
Driver Status
---------------------- ----------------------
DRI drivers varies with the driver
XMesa (Xlib) implements OpenGL 1.5
XMesa/GLX (on Xlib) implements OpenGL 1.5
OSMesa (off-screen) implements OpenGL 1.5
Glide (3dfx Voodoo1/2) implements OpenGL 1.3
SVGA implements OpenGL 1.3
@@ -72,4 +94,4 @@ D3D needs updating
----------------------------------------------------------------------
$Id: RELNOTES-6.5,v 3.2 2006/03/02 04:12:34 brianp Exp $
$Id: RELNOTES-6.5,v 3.4 2006/03/29 04:53:02 brianp Exp $

View File

@@ -1434,11 +1434,15 @@ Mesa Version History
- fixed TNL initialization bug which could lead to crash (bug 5791)
6.5 month, day, 2005
6.5 March 31, 2006
New:
- OpenGL Shading Language support through GL_ARB_shader_objects,
GL_ARB_shading_language_100, GL_ARB_vertex_shader and
GL_ARB_fragment_shader (done by Michal Krol)
- GL_EXT_packed_depth_stencil extension
- GL_EXT_timer_query extension
- GL_EXT_framebuffer_blit extension
- GL_ARB_half_float_pixel
- reflect demo improved to support multiple windows
- singlebuffer demo (shows no/little-flicker single-buffered rendering)
- r200: enable GL_ARB_texture_env_crossbar, separate the texture
@@ -1454,4 +1458,15 @@ Mesa Version History
- removed GL_HP_occlusion_test (use GL_ARB_occlusion_query instead)
- removed GL_SGIX/SGIS_pixel_texture extensions
Bug fixes:
- fixed glxcontextmodes.c datatype problem (bug 5835)
- fixed aix-gcc build/install bugs (bug 5874)
- fixed some bugs in texture env program generation
- glXCopyContext() didn't handle texture object bindings properly
- glXCopyContext() didn't copy all lighting state
- fixed FreeBSD config (Pedro Giffuni)
- fixed some minor framebuffer object bugs
- replaced dprintf() with _glu_printf() in GLU (bug 6244)
- fixed a number of thread safety bugs/regressions
- fixed a number of GLU tesselator bugs (John Shell, bug 6339)
- paletted texturing was broken w/ floating point palettes (K. Schultz)
- lots of assorted framebuffer object bug fixes

View File

@@ -40,14 +40,14 @@ Here are the basic instructions for Unix systems:
Version 1.9.28 is known to work.
<li>Login as an anonymous user:
<pre>
cvs -d:pserver:anonymous@pdx.freedesktop.org:/cvs/mesa login
cvs -d:pserver:anonymous@anoncvs.freedesktop.org:/cvs/mesa login
</pre>
Just press Enter/Return when prompted for a password.
<br>
<br>
<li>Check out the code:
<pre>
cvs -d:pserver:anonymous@pdx.freedesktop.org:/cvs/mesa co Mesa
cvs -d:pserver:anonymous@anoncvs.freedesktop.org:/cvs/mesa co Mesa
</pre>
</ol>
@@ -56,7 +56,7 @@ Here are the basic instructions for Unix systems:
<ol>
<li><code>cd Mesa</code>
<li><code>cvs -z3 -d:pserver:anonymous@pdx.freedesktop.org:/cvs/mesa update</code>
<li><code>cvs -z3 -d:pserver:anonymous@anoncvs.freedesktop.org:/cvs/mesa update</code>
</ol>
@@ -86,7 +86,7 @@ with:
</pre>
followed by:
<pre>
cvs -d:ext:yourusername@pdx.freedesktop.org:/cvs/mesa co Mesa
cvs -d:ext:yourusername@cvs.freedesktop.org:/cvs/mesa co Mesa
</pre>
<p>

View File

@@ -83,7 +83,7 @@ Brace example:
Here's the GNU indent command which will best approximate my preferred style:
</p>
<pre>
indent -br -i3 -npcs infile.c -o outfile.c
indent -br -i3 -npcs --no-tabs infile.c -o outfile.c
</pre>
@@ -145,7 +145,7 @@ DEMO_NAME are correct.
</p>
<p>
Update the docs/news.html file and docs/contents.html files.
Update the docs/news.html file and docs/download.html files.
</p>
<p>

View File

@@ -9,11 +9,11 @@
<H1>Downloading</H1>
<p>
Last development release: <b>6.3.2</b>
Last development release: <b>6.5</b>
</p>
<p>
Last stable release: <b>6.2.1</b>
Last stable release: <b>6.4.2</b>
</p>
<p>

View File

@@ -70,13 +70,13 @@ They're found in a module of the DRI CVS tree.
To obtain the code do the following:
</p>
<pre>
cvs -d:pserver:anonymous@pdx.freedesktop.org:/cvs/dri login
cvs -d:pserver:anonymous@anoncvs.freedesktop.org:/cvs/dri login
</pre>
<p>
Press Enter/Return when prompted for a password. Then,
</p>
<pre>
cvs -d:pserver:anonymous@pdx.freedesktop.org:/cvs/dri co drm
cvs -d:pserver:anonymous@anoncvs.freedesktop.org:/cvs/dri co drm
</pre>
<p>

View File

@@ -50,26 +50,18 @@ Rendering Manager) kernel drivers and header files.
They're available from the <a href="http://dri.sf.net/" target="_parent">DRI</a> project.
</p>
<p>
You can get them from CVS by doing:
Your distribution should already have both the kernel modules and support
library already installed. If not, you can get them from CVS by doing:
<pre>
cvs -d:pserver:anonymous@pds.freedesktop.org:/cvs/dri login
(hit enter when prompted for a password)
cvs -z3 -d:pserver:anonymous@pdx.freedesktop.org:/cvs/dri co drm
cvs -z3 -d:pserver:anonymous@anoncvs.freedesktop.org:/cvs/dri co drm
</pre>
<p>
Make note of the directory in which the drm files are placed.
</p>
<p>
See the <a href="http://dri.freedesktop.org/wiki/Building" target="_parent">
DRI Building Instructions</a> for the steps to build the DRM modules.
DRI Building Instructions</a> for the steps to build the DRM modules. Mesa
6.5 requires at least libdrm 2.0.1 or greater.
</p>
<p>
Next, in the <code>Mesa-x.y.z/configs/default</code> file, set the
<code>DRM_SOURCE_PATH</code> variable to indicate where the DRM files
are located.
</p>
<p>
Now build Mesa and the DRI drivers by running
Build Mesa and the DRI drivers by running
</p>
<pre>
make linux-dri

View File

@@ -11,6 +11,56 @@
<H1>News</H1>
<h2>March 31, 2006</h2>
<p>
Mesa 6.5 has been released. This is a new development release.
</p>
<pre>
New:
- OpenGL Shading Language support through GL_ARB_shader_objects,
GL_ARB_shading_language_100, GL_ARB_vertex_shader and
GL_ARB_fragment_shader (done by Michal Krol)
- GL_EXT_packed_depth_stencil extension
- GL_EXT_timer_query extension
- GL_EXT_framebuffer_blit extension
- GL_ARB_half_float_pixel
- GLX_MESA_copy_sub_buffer for DRI drivers (Dave Reveman)
- reflect demo improved to support multiple windows
- singlebuffer demo (shows no/little-flicker single-buffered rendering)
- r200: enable GL_ARB_texture_env_crossbar, separate the texture
sampling unit bits from the texture env combine enable bits
- r200: add support for GL_ATI_fragment_shader
- added fast XOR-mode line drawing optimization
- radeon: add support for all 3 tmus, GL_ARB_texture_cube_map
and GL_EXT_fog_coord
- MESA_GLX_ALPHA_BITS env var for xlib driver
- many DRI driver updates (including screen rotation support
for the Intel DRI driver)
Changes:
- removed GL_HP_occlusion_test (use GL_ARB_occlusion_query instead)
- removed GL_SGIX/SGIS_pixel_texture extensions
Bug fixes:
- fixed glxcontextmodes.c datatype problem (bug 5835)
- fixed aix-gcc build/install bugs (bug 5874)
- fixed some bugs in texture env program generation
- glXCopyContext() didn't handle texture object bindings properly
- glXCopyContext() didn't copy all lighting state
- fixed FreeBSD config (Pedro Giffuni)
- fixed some minor framebuffer object bugs
- replaced dprintf() with _glu_printf() in GLU (bug 6244)
- fixed a number of thread safety bugs/regressions
- fixed a number of GLU tesselator bugs (John Shell, bug 6339)
- paletted texturing was broken w/ floating point palettes (K. Schultz)
- lots of assorted framebuffer object bug fixes
</pre>
<p>
The MD5 checksums are:
</p>
<pre>
TBD
</pre>
<h2>February 2, 2006</h2>
<p>
Mesa 6.4.2 has been released. This is primarily a bug-fix release.
@@ -1168,6 +1218,6 @@ source code</a>.</p>
<hr>
$Id: news.html,v 3.26 2006/02/03 17:21:54 brianp Exp $
$Id: news.html,v 3.27 2006/03/31 23:10:21 brianp Exp $
</body>
</html>

View File

@@ -23,9 +23,9 @@
*/
/*
* DOS/DJGPP device driver v1.7 for Mesa
* DOS/DJGPP device driver for Mesa
*
* Copyright (C) 2002 - Daniel Borca
* Author: Daniel Borca
* Email : dborca@users.sourceforge.net
* Web : http://www.geocities.com/dborca
*/
@@ -35,7 +35,7 @@
#define DMESA_H_included
#define DMESA_MAJOR_VERSION 6
#define DMESA_MINOR_VERSION 3
#define DMESA_MINOR_VERSION 5
/* Sample Usage:
*
@@ -138,7 +138,7 @@ void DMesaSetCI (int ndx, GLfloat red, GLfloat green, GLfloat blue);
/*
* DMesa functions
*/
typedef void (*DMesaProc) (void);
typedef void (*DMesaProc) ();
DMesaProc DMesaGetProcAddress (const char *name);
/*
@@ -149,8 +149,8 @@ DMesaProc DMesaGetProcAddress (const char *name);
#define DMESA_GET_VIDEO_MODES 0x0300
#define DMESA_GET_BUFFER_ADDR 0x0400
#define DMESA_DRIVER_SWDB_BIT 0x1 /* software double-buffered */
#define DMESA_DRIVER_LLWO_BIT 0x2 /* lower-left window origin */
#define DMESA_DRIVER_DBL_BIT 0x1 /* double-buffered */
#define DMESA_DRIVER_YUP_BIT 0x2 /* lower-left window origin */
int DMesaGetIntegerv (GLenum pname, GLint *params);
#ifdef __cplusplus

View File

@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
* Version: 6.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2006 Brian Paul 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"),

View File

@@ -2,7 +2,7 @@
* Mesa 3-D graphics library
* Version: 6.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2006 Brian Paul 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"),

View File

@@ -472,6 +472,14 @@ struct __DRIdrawableRec {
* \since Internal API version 20030317.
*/
unsigned swap_interval;
/**
* Used by drivers that implement the GLX_MESA_copy_sub_buffer extension.
*
* \since Internal API version 20060314.
*/
void (*copySubBuffer)(__DRInativeDisplay *dpy, void *drawablePrivate,
int x, int y, int w, int h);
};
#endif

View File

@@ -100,15 +100,14 @@ extern WMesaContext WMesaCreateContext(HDC hDC,HPALETTE* pPal,
/*
* Destroy a rendering context as returned by WMesaCreateContext()
*/
/*extern void WMesaDestroyContext( WMesaContext ctx );*/
extern void WMesaDestroyContext( void );
extern void WMesaDestroyContext( WMesaContext ctx );
/*
* Make the specified context the current one.
*/
extern void WMesaMakeCurrent( WMesaContext ctx );
extern void WMesaMakeCurrent( WMesaContext ctx, HDC hdc );
/*
@@ -121,7 +120,7 @@ extern WMesaContext WMesaGetCurrentContext( void );
* Swap the front and back buffers for the current context. No action
* taken if the context is not double buffered.
*/
extern void WMesaSwapBuffers(void);
extern void WMesaSwapBuffers(HDC hdc);
/*

View File

@@ -64,6 +64,7 @@ typedef XColor XMesaColor;
#define XMesaDrawPoint XDrawPoint
#define XMesaDrawPoints XDrawPoints
#define XMesaDrawLine XDrawLine
#define XMesaFillRectangle XFillRectangle
#define XMesaPutImage XPutImage
#define XMesaCopyArea XCopyArea

View File

@@ -95,6 +95,18 @@ do { \
(*gc->ops->PolyPoint)(__b, __gc, __m, __n, __p); \
} while (0)
#define XMesaDrawLine(__d, __b, __gc, __x0, __y0, __x1, __y1) \
do { \
XMesaPoint __p[2]; \
(void) __d; \
__p[0].x = __x0; \
__p[0].y = __y0; \
__p[1].x = __x1; \
__p[1].y = __y1; \
ValidateGC(__b, __gc); \
(*gc->ops->PolyLines)(__b, __gc, CoordModeOrigin, 2, __p); \
} while (0)
#define XMesaFillRectangle(__d,__b,__gc,__x,__y,__w,__h) \
do { \
xRectangle __r[1]; \

View File

@@ -31,6 +31,8 @@ readtex.h
reflect
renormal
shadowtex
showbuffer.c
showbuffer.h
spectex
stex3d
teapot

View File

@@ -30,7 +30,7 @@ PROGS = \
geartrain \
glinfo \
gloss \
glslnoise.c \
glslnoise \
gltestperf \
glutfx \
isosurf \

118
progs/demos/Makefile.win Normal file
View File

@@ -0,0 +1,118 @@
# Mesa 3-D graphics library
# Version: 6.5
# Copyright (C) 1995-2006 Brian Paul
# Makefile for GLUT-based demo programs for Windows
# Build the Mesa and GLUT libraries by using the Visual Studio
# Workspaces in this distribution before running this Makefile.
# Invocation: nmake -f Makefile.win
NODEBUG=1
!include <win32.mak>
##### MACROS #####
TOP = ..\..
INCDIR = ..\..\include
LIBDIR = ..\..\lib
LIBS = GLUT32.LIB OPENGL32.LIB
all: OPENGL32.DLL GLU32.DLL GLUT32.DLL \
readtex.h readtex.c showbuffer.h showbuffer.c \
arbfplight.exe arbfslight.exe arbocclude.exe bounce.exe \
clearspd.exe cubemap.exe drawpix.exe fire.exe fogcoord.exe \
fplight.exe gamma.exe gearbox.exe \
gears.exe geartrain.exe gloss.exe \
glinfo.exe glslnoise.exe \
gltestperf.exe glutfx.exe ipers.exe isosurf.exe lodbias.exe \
morph3d.exe multiarb.exe occlude.exe paltex.exe pointblast.exe \
ray.exe readpix.exe reflect.exe renormal.exe \
shadowtex.exe singlebuffer.exe spectex.exe spriteblast.exe \
stex3d.exe teapot.exe terrain.exe tessdemo.exe texcyl.exe \
texdown.exe texenv.exe texobj.exe trispd.exe tunnel.exe tunnel2.exe \
winpos.exe
arbfplight.exe: arbfplight.obj
arbfslight.exe: arbfslight.obj
arbocclude.exe: arbocclude.obj
bounce.exe: bounce.obj
clearspd.exe: clearspd.obj
cubemap.exe: cubemap.obj readtex.obj
drawpix.exe: drawpix.obj readtex.obj
fire.exe: fire.obj readtex.obj
fogcoord.exe: fogcoord.obj readtex.obj
fplight.exe: fplight.obj
gamma.exe: gamma.obj
gearbox.exe: gearbox.obj
gears.exe: gears.obj
geartrain.exe: geartrain.obj
gloss.exe: gloss.obj readtex.obj
glinfo.exe: glinfo.obj
glslnoise.exe: glslnoise.obj
gltestperf.exe: gltestperf.obj
glutfx.exe: glutfx.obj
ipers.exe: ipers.obj readtex.obj
isosurf.exe: isosurf.obj readtex.obj
lodbias.exe: lodbias.obj readtex.obj
morph3d.exe: morph3d.obj
multiarb.exe: multiarb.obj readtex.obj
occlude.exe: occlude.obj
paltex.exe: paltex.obj
pointblast.exe: pointblast.obj
ray.exe: ray.obj
readpix.exe: readpix.obj readtex.obj
reflect.exe: reflect.obj readtex.obj showbuffer.obj
renormal.exe: renormal.obj
shadowtex.exe: shadowtex.obj showbuffer.obj
singlebuffer.exe: singlebuffer.obj
spectex.exe: spectex.obj
spriteblast.exe: spriteblast.obj
stex3d.exe: stex3d.obj
teapot.exe: teapot.obj readtex.obj
terrain.exe: terrain.obj
tessdemo.exe: tessdemo.obj
texcyl.exe: texcyl.obj readtex.obj
texdown.exe: texdown.obj
texenv.exe: texenv.obj
texobj.exe: texobj.obj
trispd.exe: trispd.obj
tunnel.exe: tunnel.obj readtex.obj
tunnel2.exe: tunnel2.obj readtex.obj
winpos.exe: winpos.obj readtex.obj
OPENGL32.DLL: $(LIBDIR)\OPENGL32.DLL
copy $? .
GLU32.DLL: $(LIBDIR)\GLU32.DLL
copy $? .
GLUT32.DLL: $(LIBDIR)\GLUT32.DLL
copy $? .
readtex.c: $(TOP)\progs\util\readtex.c
copy $** .
readtex.h: $(TOP)\progs\util\readtex.h
copy $** .
showbuffer.c: $(TOP)\progs\util\showbuffer.c
copy $** .
showbuffer.h: $(TOP)\progs\util\showbuffer.h
copy $** .
.obj.exe:
$(link) $(ldebug) -out:$@ $** /LIBPATH:$(LIBDIR) $(LIBS)
.c.obj:
$(cc) $(cdebug) $(cflags) $(cvars) /I$(INCDIR) $*.c
clean::
del *.obj *.exe readtex.* showbuffer.*
clobber::

View File

@@ -343,7 +343,7 @@ static void Init( void )
(const GLubyte *) vertProgramText);
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorPos);
if (glGetError() != GL_NO_ERROR || errorPos != -1) {
int l = FindLine(fragProgramText, errorPos);
int l = FindLine(vertProgramText, errorPos);
printf("Vertex Program Error (pos=%d line=%d): %s\n", errorPos, l,
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
exit(0);

View File

@@ -14,8 +14,6 @@
#include <stdlib.h>
#include <string.h>
#include <GL/glut.h>
#include <sys/time.h>
#include <time.h>
#define COS(X) cos( (X) * 3.14159/180.0 )
#define SIN(X) sin( (X) * 3.14159/180.0 )

View File

@@ -236,6 +236,7 @@ static void SpecialKey( int key, int x, int y )
static void Init( int argc, char *argv[] )
{
GLboolean convolve = GL_FALSE;
GLboolean fullscreen = GL_FALSE;
int i;
for (i = 1; i < argc; i++) {
@@ -248,8 +249,13 @@ static void Init( int argc, char *argv[] )
else if (strcmp(argv[i], "-c")==0) {
convolve = GL_TRUE;
}
else if (strcmp(argv[i], "-f")==0) {
fullscreen = GL_TRUE;
}
}
if (fullscreen)
glutFullScreen();
/* Cylinder object */
{
@@ -421,7 +427,8 @@ int main( int argc, char *argv[] )
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutDisplayFunc( Display );
glutIdleFunc( Idle );
if (Animate)
glutIdleFunc( Idle );
glutCreateMenu(ModeMenu);
glutAddMenuEntry("Toggle Highlight", DO_SPEC_TEXTURE);

View File

@@ -1,62 +1,62 @@
/*
* GLSL noise demo.
*
* Michal Krol
*
* Michal Krol
* 20 February 2006
*
*
* Based on the original demo by:
* Stefan Gustavson (stegu@itn.liu.se) 2004, 2005
*/
#ifdef WIN32
#include <windows.h>
*/
#ifdef WIN32
#include <windows.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#ifdef WIN32
#define GETPROCADDRESS wglGetProcAddress
#else
#define GETPROCADDRESS glutGetProcAddress
#endif
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#ifdef WIN32
#define GETPROCADDRESS(F) wglGetProcAddress(F)
#else
#define GETPROCADDRESS(F) glutGetProcAddress(F)
#endif
static GLhandleARB fragShader;
static GLhandleARB vertShader;
static GLhandleARB program;
static GLint uTime;
static GLfloat u_time = 0.0f;
static GLhandleARB vertShader;
static GLhandleARB program;
static PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB = NULL;
static PFNGLSHADERSOURCEARBPROC glShaderSourceARB = NULL;
static PFNGLCOMPILESHADERARBPROC glCompileShaderARB = NULL;
static PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = NULL;
static PFNGLATTACHOBJECTARBPROC glAttachObjectARB = NULL;
static PFNGLLINKPROGRAMARBPROC glLinkProgramARB = NULL;
static PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = NULL;
static PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB = NULL;
static GLint uTime;
static GLfloat u_time = 0.0f;
static PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB = NULL;
static PFNGLSHADERSOURCEARBPROC glShaderSourceARB = NULL;
static PFNGLCOMPILESHADERARBPROC glCompileShaderARB = NULL;
static PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = NULL;
static PFNGLATTACHOBJECTARBPROC glAttachObjectARB = NULL;
static PFNGLLINKPROGRAMARBPROC glLinkProgramARB = NULL;
static PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = NULL;
static PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB = NULL;
static PFNGLUNIFORM1FARBPROC glUniform1fARB = NULL;
static void Redisplay (void)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glUniform1fARB (uTime, u_time);
glPushMatrix ();
glutSolidSphere (2.0, 20, 10);
glutSolidSphere (2.0, 20, 10);
glPopMatrix ();
glutSwapBuffers();
}
static void Idle (void)
{
{
u_time += 0.1f;
glutPostRedisplay ();
}
@@ -75,9 +75,9 @@ static void Reshape (int width, int height)
static void Key (unsigned char key, int x, int y)
{
(void) x;
(void) y;
(void) y;
switch (key)
switch (key)
{
case 27:
exit(0);
@@ -88,69 +88,79 @@ static void Key (unsigned char key, int x, int y)
static void Init (void)
{
static const char *fragShaderText =
static const char *fragShaderText =
"uniform float time;\n"
"void main () {\n"
" gl_FragColor = gl_Color * vec4 ((0.5 + 0.5 * vec3 (noise1 (\n"
" vec4 (4.0 * gl_TexCoord[0].xyz, 0.5 * time)))), 1.0);\n"
"void main () {\n"
" gl_FragColor = gl_Color * vec4 ((0.5 + 0.5 * vec3 (noise1 (\n"
" vec4 (4.0 * gl_TexCoord[0].xyz, 0.5 * time)))), 1.0);\n"
"}\n"
;
static const char *vertShaderText =
"void main () {\n"
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
" gl_TexCoord[0] = gl_Vertex;\n"
" gl_FrontColor = gl_Color;\n"
"void main () {\n"
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
" gl_TexCoord[0] = gl_Vertex;\n"
" gl_FrontColor = gl_Color;\n"
"}\n"
;
if (!glutExtensionSupported ("GL_ARB_fragment_shader"))
if (!glutExtensionSupported ("GL_ARB_fragment_shader"))
{
printf ("Sorry, this demo requires GL_ARB_fragment_shader\n");
exit(1);
}
if (!glutExtensionSupported ("GL_ARB_shader_objects"))
{
printf ("Sorry, this demo requires GL_ARB_shader_objects\n");
exit(1);
}
if (!glutExtensionSupported ("GL_ARB_shading_language_100"))
{
printf ("Sorry, this demo requires GL_ARB_shading_language_100\n");
exit(1);
}
if (!glutExtensionSupported ("GL_ARB_vertex_shader"))
{
printf ("Sorry, this demo requires GL_ARB_vertex_shader\n");
exit(1);
}
if (!glutExtensionSupported ("GL_ARB_shader_objects"))
{
printf ("Sorry, this demo requires GL_ARB_shader_objects\n");
exit(1);
}
if (!glutExtensionSupported ("GL_ARB_shading_language_100"))
{
printf ("Sorry, this demo requires GL_ARB_shading_language_100\n");
exit(1);
}
if (!glutExtensionSupported ("GL_ARB_vertex_shader"))
{
printf ("Sorry, this demo requires GL_ARB_vertex_shader\n");
exit(1);
}
glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) wglGetProcAddress ("glCreateShaderObjectARB");
glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) wglGetProcAddress ("glShaderSourceARB");
glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) wglGetProcAddress ("glCompileShaderARB");
glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) wglGetProcAddress ("glCreateProgramObjectARB");
glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) wglGetProcAddress ("glAttachObjectARB");
glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) wglGetProcAddress ("glLinkProgramARB");
glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) wglGetProcAddress ("glUseProgramObjectARB");
glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) GETPROCADDRESS ("glGetUniformLocationARB");
glUniform1fARB = (PFNGLUNIFORM1FARBPROC) GETPROCADDRESS ("glUniform1fARB");
fragShader = glCreateShaderObjectARB (GL_FRAGMENT_SHADER_ARB);
glShaderSourceARB (fragShader, 1, &fragShaderText, NULL);
glCompileShaderARB (fragShader);
vertShader = glCreateShaderObjectARB (GL_VERTEX_SHADER_ARB);
glShaderSourceARB (vertShader, 1, &vertShaderText, NULL);
glCompileShaderARB (vertShader);
program = glCreateProgramObjectARB ();
glAttachObjectARB (program, fragShader);
glAttachObjectARB (program, vertShader);
glLinkProgramARB (program);
glUseProgramObjectARB (program);
uTime = glGetUniformLocationARB (program, "time");
glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)
GETPROCADDRESS("glCreateShaderObjectARB");
glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)
GETPROCADDRESS("glShaderSourceARB");
glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)
GETPROCADDRESS("glCompileShaderARB");
glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)
GETPROCADDRESS("glCreateProgramObjectARB");
glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)
GETPROCADDRESS("glAttachObjectARB");
glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)
GETPROCADDRESS ("glLinkProgramARB");
glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)
GETPROCADDRESS("glUseProgramObjectARB");
glClearColor (0.0f, 0.1f, 0.3f, 1.0f);
glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC)
GETPROCADDRESS("glGetUniformLocationARB");
glUniform1fARB = (PFNGLUNIFORM1FARBPROC)
GETPROCADDRESS("glUniform1fARB");
fragShader = glCreateShaderObjectARB (GL_FRAGMENT_SHADER_ARB);
glShaderSourceARB (fragShader, 1, &fragShaderText, NULL);
glCompileShaderARB (fragShader);
vertShader = glCreateShaderObjectARB (GL_VERTEX_SHADER_ARB);
glShaderSourceARB (vertShader, 1, &vertShaderText, NULL);
glCompileShaderARB (vertShader);
program = glCreateProgramObjectARB ();
glAttachObjectARB (program, fragShader);
glAttachObjectARB (program, vertShader);
glLinkProgramARB (program);
glUseProgramObjectARB (program);
uTime = glGetUniformLocationARB (program, "time");
glClearColor (0.0f, 0.1f, 0.3f, 1.0f);
glEnable (GL_CULL_FACE);
glEnable (GL_DEPTH_TEST);
@@ -172,4 +182,4 @@ int main (int argc, char *argv[])
glutMainLoop ();
return 0;
}

View File

@@ -42,6 +42,9 @@
#define INIT_WIDTH 400
#define INIT_HEIGHT 300
#ifdef _WIN32
#undef CreateWindowA
#endif
struct window {
int id; /* returned by glutCreateWindow() */
@@ -299,11 +302,21 @@ DrawWindow(void)
GLfloat dist = 20.0;
GLfloat eyex, eyey, eyez;
glDrawBuffer(w->drawBuffer);
glReadBuffer(w->drawBuffer);
if (w->drawBuffer == GL_NONE) {
glDrawBuffer(GL_BACK);
glReadBuffer(GL_BACK);
}
else {
glDrawBuffer(w->drawBuffer);
glReadBuffer(w->drawBuffer);
}
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
if (w->drawBuffer == GL_NONE) {
glDrawBuffer(GL_NONE);
}
eyex = dist * cos(w->yrot * DEG2RAD) * cos(w->xrot * DEG2RAD);
eyez = dist * sin(w->yrot * DEG2RAD) * cos(w->xrot * DEG2RAD);
eyey = dist * sin(w->xrot * DEG2RAD);
@@ -373,10 +386,10 @@ DrawWindow(void)
ShowAlphaBuffer(w->width, w->height);
}
if (w->drawBuffer == GL_BACK)
glutSwapBuffers();
else
if (w->drawBuffer == GL_FRONT)
glFinish();
else
glutSwapBuffers();
/* calc/show frame rate */
{
@@ -457,6 +470,10 @@ Key(unsigned char key, int x, int y)
w->drawBuffer = GL_FRONT;
glutPostRedisplay();
break;
case '0':
w->drawBuffer = GL_NONE;
glutPostRedisplay();
break;
case ' ':
w->anim = !w->anim;
w->t0 = -1;

View File

@@ -35,8 +35,8 @@
/*
* glcurveval.c++
*
* $Date: 2004/05/12 15:29:36 $ $Revision: 1.6 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glcurveval.cc,v 1.6 2004/05/12 15:29:36 brianp Exp $
* $Date: 2006/03/29 18:46:46 $ $Revision: 1.7 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glcurveval.cc,v 1.7 2006/03/29 18:46:46 brianp Exp $
*/
/* Polynomial Evaluator Interface */
@@ -74,6 +74,7 @@ OpenGLCurveEvaluator::OpenGLCurveEvaluator(void)
em_normal.uprime = -1.0;
em_color.uprime = -1.0;
em_texcoord.uprime = -1.0;
output_triangles = 0; // don't output triangles by default
}
OpenGLCurveEvaluator::~OpenGLCurveEvaluator(void)

View File

@@ -335,7 +335,7 @@ ArcTessellator::tessellateNonlinear( Arc *arc, REAL geo_stepsize, REAL arc_steps
REAL min_u, min_v, max_u,max_v;
min_u = max_u = bezierArc->cpts[0];
min_v = max_v = bezierArc->cpts[1];
for(i=1, j=2; i<bezierArc->order; i++, j+= bezierArc->stride)
for(i=1, j=bezierArc->stride; i<bezierArc->order; i++, j+= bezierArc->stride)
{
if(bezierArc->cpts[j] < min_u)
min_u = bezierArc->cpts[j];

View File

@@ -35,8 +35,8 @@
/*
* basiccurveeval.h
*
* $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/basiccrveval.h,v 1.1 2001/03/17 00:25:40 brianp Exp $
* $Date: 2006/03/29 18:54:00 $ $Revision: 1.2 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/basiccrveval.h,v 1.2 2006/03/29 18:54:00 brianp Exp $
*/
#ifndef __glubasiccrveval_h_
@@ -48,6 +48,7 @@
class BasicCurveEvaluator : public CachingEvaluator {
public:
virtual ~BasicCurveEvaluator() { /* silence warning*/ }
virtual void domain1f( REAL, REAL );
virtual void range1f( long, REAL *, REAL * );

View File

@@ -35,8 +35,8 @@
/*
* basicsurfeval.h
*
* $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/basicsurfeval.h,v 1.1 2001/03/17 00:25:40 brianp Exp $
* $Date: 2006/03/29 18:54:00 $ $Revision: 1.2 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/basicsurfeval.h,v 1.2 2006/03/29 18:54:00 brianp Exp $
*/
#ifndef __glubasicsurfeval_h_
@@ -48,6 +48,7 @@
class BasicSurfaceEvaluator : public CachingEvaluator {
public:
virtual ~BasicSurfaceEvaluator() { /* silence warning*/ }
virtual void range2f( long, REAL *, REAL * );
virtual void domain2f( REAL, REAL, REAL, REAL );

View File

@@ -35,8 +35,8 @@
/*
* bufpool.h
*
* $Date: 2001/03/22 11:38:36 $ $Revision: 1.2 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/bufpool.h,v 1.2 2001/03/22 11:38:36 joukj Exp $
* $Date: 2006/03/29 18:46:46 $ $Revision: 1.3 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/bufpool.h,v 1.3 2006/03/29 18:46:46 brianp Exp $
*/
#ifndef __glubufpool_h_
@@ -128,6 +128,7 @@ public:
inline void * operator new( size_t s)
{ return ::new char[s]; }
inline void operator delete( void * ) { assert( 0 ); }
inline void operator delete( void *, Pool & ) { assert( 0 ); }
inline void deleteMe( Pool & );
};

View File

@@ -35,8 +35,8 @@
/*
* cachingeval.h
*
* $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/cachingeval.h,v 1.1 2001/03/17 00:25:40 brianp Exp $
* $Date: 2006/03/29 18:54:00 $ $Revision: 1.2 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/cachingeval.h,v 1.2 2006/03/29 18:54:00 brianp Exp $
*/
#ifndef __glucachingval_h_
@@ -44,6 +44,7 @@
class CachingEvaluator {
public:
virtual ~CachingEvaluator() { /* silence warning*/ }
enum ServiceMode { play, record, playAndRecord };
virtual int canRecord( void );
virtual int canPlayAndRecord( void );

View File

@@ -35,8 +35,8 @@
/*
* flistsorter.h
*
* $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/flistsorter.h,v 1.1 2001/03/17 00:25:41 brianp Exp $
* $Date: 2006/03/29 18:54:00 $ $Revision: 1.2 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/flistsorter.h,v 1.2 2006/03/29 18:54:00 brianp Exp $
*/
#ifndef __gluflistsorter_h_
@@ -48,6 +48,7 @@
class FlistSorter : public Sorter {
public:
FlistSorter(void);
virtual ~FlistSorter() { /* silence warning*/ }
void qsort( REAL *a, int n );
protected:

View File

@@ -31,10 +31,10 @@
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
**
** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
** $Date: 2006/03/29 18:54:00 $ $Revision: 1.2 $
*/
/*
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/sorter.h,v 1.1 2001/03/17 00:25:41 brianp Exp $
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/sorter.h,v 1.2 2006/03/29 18:54:00 brianp Exp $
*/
#ifndef __glusorter_h_
@@ -43,6 +43,7 @@
class Sorter {
public:
Sorter( int es );
virtual ~Sorter() { /* silence warning*/ }
void qsort( void *a, int n );
protected:

View File

@@ -31,10 +31,10 @@
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
**
** $Date: 2005/10/28 13:09:23 $ $Revision: 1.4 $
** $Date: 2006/03/29 18:46:46 $ $Revision: 1.5 $
*/
/*
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/monoTriangulation.cc,v 1.4 2005/10/28 13:09:23 brianp Exp $
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/monoTriangulation.cc,v 1.5 2006/03/29 18:46:46 brianp Exp $
*/
#include <stdlib.h>
@@ -619,8 +619,10 @@ void monoTriangulationFun(directedLine* monoPolygon, Int (*compFun)(Real*, Real*
dec_chain.appendVertex(tempV->getVertex(i));
}
monoTriangulationRecFun(topV->head(), botV->head(), &inc_chain, 0, &dec_chain, 0, compFun, pStream);
if (!(0 == inc_chain.getNumElements() && 0 == dec_chain.getNumElements())) {
monoTriangulationRecFun(topV->head(), botV->head(), &inc_chain, 0,
&dec_chain, 0, compFun, pStream);
}
}
void monoTriangulation(directedLine* monoPolygon, primStream* pStream)

View File

@@ -5,11 +5,7 @@
/* char: 0x20 */
static const GLUTStrokeStrip ch32st[] =
{
};
static const GLUTStrokeChar ch32 = {104.7619f,0,ch32st};
static const GLUTStrokeChar ch32 = {104.7619f,0,NULL};
/* char: 0x21 */

View File

@@ -5,11 +5,7 @@
/* char: 0x20 */
static const GLUTStrokeStrip ch32st[] =
{
};
static const GLUTStrokeChar ch32 = {104.7619f,0,ch32st};
static const GLUTStrokeChar ch32 = {104.7619f,0,NULL};
/* char: 0x21 */

View File

@@ -66,6 +66,10 @@ glutCreateWindow (const char *title)
int i;
int m8width = (_glut_default.width + 7) & ~7;
if (!(_glut_default.mode & GLUT_DOUBLE)) {
return 0;
}
/* We set the Visual once. This will be our desktop (graphic mode).
* We should do this in the `glutInit' code, but we don't have any idea
* about its geometry. Supposedly, when we are about to create one
@@ -73,7 +77,7 @@ glutCreateWindow (const char *title)
*/
if (!visual) {
if ((visual=DMesaCreateVisual(_glut_default.x + m8width, _glut_default.y + _glut_default.height, _glut_visual.bpp, _glut_visual.refresh,
_glut_default.mode & GLUT_DOUBLE,
GLUT_SINGLE,
!(_glut_default.mode & GLUT_INDEX),
(_glut_default.mode & GLUT_ALPHA ) ? _glut_visual.alpha : 0,
(_glut_default.mode & GLUT_DEPTH ) ? _glut_visual.depth : 0,

View File

@@ -2570,18 +2570,69 @@ PUBLIC GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
return 0;
}
#define X_GLXvop_CopySubBufferMESA 5154 /* temporary */
PUBLIC void glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable,
int x, int y, int width, int height)
{
(void) dpy;
(void) drawable;
(void) x;
(void) y;
(void) width;
(void) height;
}
xGLXVendorPrivateReq *req;
GLXContext gc;
GLXContextTag tag;
CARD32 *drawable_ptr;
INT32 *x_ptr, *y_ptr, *w_ptr, *h_ptr;
CARD8 opcode;
#ifdef GLX_DIRECT_RENDERING
int screen;
__DRIdrawable *pdraw = GetDRIDrawable( dpy, drawable, & screen );
if ( pdraw != NULL ) {
__GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, screen );
if ( __glXExtensionBitIsEnabled( psc, MESA_copy_sub_buffer_bit ) ) {
(*pdraw->copySubBuffer)(dpy, pdraw->private, x, y, width, height);
}
return;
}
#endif
opcode = __glXSetupForCommand(dpy);
if (!opcode)
return;
/*
** The calling thread may or may not have a current context. If it
** does, send the context tag so the server can do a flush.
*/
gc = __glXGetCurrentContext();
if ((gc != NULL) && (dpy == gc->currentDpy) &&
((drawable == gc->currentDrawable) ||
(drawable == gc->currentReadable)) ) {
tag = gc->currentContextTag;
} else {
tag = 0;
}
LockDisplay(dpy);
GetReqExtra(GLXVendorPrivate, sizeof(CARD32) + sizeof(INT32) * 4,req);
req->reqType = opcode;
req->glxCode = X_GLXVendorPrivate;
req->vendorCode = X_GLXvop_CopySubBufferMESA;
req->contextTag = tag;
drawable_ptr = (CARD32 *) (req + 1);
x_ptr = (INT32 *) (drawable_ptr + 1);
y_ptr = (INT32 *) (drawable_ptr + 2);
w_ptr = (INT32 *) (drawable_ptr + 3);
h_ptr = (INT32 *) (drawable_ptr + 4);
*drawable_ptr = drawable;
*x_ptr = x;
*y_ptr = y;
*w_ptr = width;
*h_ptr = height;
UnlockDisplay(dpy);
SyncHandle();
}
PUBLIC Bool glXSet3DfxModeMESA( int mode )
{
@@ -2973,8 +3024,9 @@ int __glXGetInternalVersion(void)
* months ago. :(
* 20050727 - Gut all the old interfaces. This breaks compatability with
* any DRI driver built to any previous version.
* 20060314 - Added support for GLX_MESA_copy_sub_buffer.
*/
return 20050727;
return 20060314;
}

View File

@@ -79,7 +79,7 @@ static const struct extension_info known_glx_extensions[] = {
{ GLX(EXT_visual_rating), VER(0,0), Y, Y, N, N },
{ GLX(MESA_agp_offset), VER(0,0), N, N, N, Y }, /* Deprecated */
{ GLX(MESA_allocate_memory), VER(0,0), Y, N, N, Y },
{ GLX(MESA_copy_sub_buffer), VER(0,0), N, N, N, N }, /* Deprecated? */
{ GLX(MESA_copy_sub_buffer), VER(0,0), Y, N, N, N },
{ GLX(MESA_pixmap_colormap), VER(0,0), N, N, N, N }, /* Deprecated */
{ GLX(MESA_release_buffers), VER(0,0), N, N, N, N }, /* Deprecated */
{ GLX(MESA_set_3dfx_mode), VER(0,0), N, N, N, N }, /* Deprecated */

View File

@@ -103,8 +103,8 @@ DRIVER_SOURCES += \
$(GLIDE_DRIVER_SOURCES)
else
DRIVER_SOURCES += \
$(OSMESA_DRIVER_SOURCES) \
drivers/dos/video.c \
drivers/dos/virtual.S \
drivers/dos/vesa.c \
drivers/dos/blit.S \
drivers/dos/vga.c \
@@ -112,8 +112,6 @@ DRIVER_SOURCES += \
drivers/dos/dpmi.c
endif
#DRIVER_SOURCES += $(OSMESA_DRIVER_SOURCES)
SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(COMMON_DRIVER_SOURCES) $(DRIVER_SOURCES)
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))

View File

@@ -23,9 +23,9 @@
*/
/*
* DOS/DJGPP device driver v1.3 for Mesa
* DOS/DJGPP device driver for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Author: Daniel Borca
* Email : dborca@yahoo.com
* Web : http://www.geocities.com/dborca
*/
@@ -197,3 +197,844 @@ _vesa_l_dump_virtual_mmx:
emms
#endif
ret
#define CVT_32_TO_16(s, tmp) \
/* SRC = bbbbbbbbggggggggrrrrrrrr******** */\
movl %e##s##x, %tmp ;\
/* TMP = bbbbbbbbggggggggrrrrrrrr******** */\
shrb $2, %s##h ;\
/* SRC = bbbbbbbbgggggg00rrrrrrrr******** */\
andl $0xF80000, %tmp ;\
/* TMP = 0000000000000000000rrrrr00000000 */\
shrw $3, %s##x ;\
/* SRC = bbbbbgggggg00000rrrrrrrr******** */\
shrl $8, %tmp ;\
/* TMP = 00000000000rrrrr0000000000000000 */\
orl %tmp, %e##s##x ;\
/* SRC = bbbbbggggggrrrrrrrrrrrrr******** */
#define CVT_32_TO_15(s, tmp) \
/* SRC = bbbbbbbbggggggggrrrrrrrr******** */\
movl %e##s##x, %tmp ;\
/* TMP = bbbbbbbbggggggggrrrrrrrr******** */\
shrb $3, %s##h ;\
/* SRC = bbbbbbbbgggggg00rrrrrrrr******** */\
andl $0xF80000, %tmp ;\
/* TMP = 0000000000000000000rrrrr00000000 */\
shrw $3, %s##x ;\
/* SRC = bbbbbgggggg00000rrrrrrrr******** */\
shrl $9, %tmp ;\
/* TMP = 00000000000rrrrr0000000000000000 */\
orl %tmp, %e##s##x ;\
/* SRC = bbbbbggggggrrrrrrrrrrrrr******** */
#define CVT_16_TO_15(src, tmp) \
/* SRC = bbbbbggggggrrrrrBBBBBGGGGGGRRRRR */\
movl %src, %tmp ;\
/* TMP = bbbbbggggggrrrrrBBBBBGGGGGGRRRRR */\
andl $0x1F001F, %src ;\
/* SRC = bbbbb00000000000BBBBB00000000000 */\
andl $0xFFC0FFC0, %tmp ;\
/* TMP = 000000gggggrrrrr000000GGGGGRRRRR */\
shrl %tmp ;\
/* TMP = 00000gggggrrrrr000000GGGGGRRRRR0 */\
orl %tmp, %src ;\
/* SRC = bbbbbgggggrrrrr0BBBBBGGGGGRRRRR0 */\
/* transform BGRA to BGR */
.p2align 5,,31
.global _vesa_l_dump_32_to_24
_vesa_l_dump_32_to_24:
pushl %ebx
pushl %esi
pushl %edi
movl _vl_video_selector, %fs
movl _vl_current_draw_buffer, %esi
movl _vl_current_offset, %edi
movl _vl_current_stride, %ecx
movl _vl_current_height, %edx
movl _vl_current_delta, %ebx
.balign 4
0:
pushl %ecx
1:
movl (%esi), %eax
addl $4, %esi
movw %ax, %fs:(%edi)
shrl $16, %eax
movb %al, %fs:2(%edi)
addl $3, %edi
subl $3, %ecx
jnz 1b
popl %ecx
addl %ebx, %edi
decl %edx
jnz 0b
popl %edi
popl %esi
popl %ebx
ret
/* transform BGRA to B5G6R5 */
.p2align 5,,31
.global _vesa_l_dump_32_to_16
_vesa_l_dump_32_to_16:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movl _vl_video_selector, %fs
movl _vl_current_draw_buffer, %esi
movl _vl_current_offset, %edi
movl _vl_current_stride, %ecx
movl _vl_current_height, %edx
movl _vl_current_delta, %ebx
.balign 4
0:
pushl %ecx
1:
movl (%esi), %eax
addl $4, %esi
CVT_32_TO_16(a, ebp)
movw %ax, %fs:(%edi)
addl $2, %edi
subl $2, %ecx
jnz 1b
popl %ecx
addl %ebx, %edi
decl %edx
jnz 0b
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
/* transform BGRA to B5G5R5 */
.p2align 5,,31
.global _vesa_l_dump_32_to_15
_vesa_l_dump_32_to_15:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movl _vl_video_selector, %fs
movl _vl_current_draw_buffer, %esi
movl _vl_current_offset, %edi
movl _vl_current_stride, %ecx
movl _vl_current_height, %edx
movl _vl_current_delta, %ebx
.balign 4
0:
pushl %ecx
1:
movl (%esi), %eax
addl $4, %esi
CVT_32_TO_15(a, ebp)
movw %ax, %fs:(%edi)
addl $2, %edi
subl $2, %ecx
jnz 1b
popl %ecx
addl %ebx, %edi
decl %edx
jnz 0b
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
/* transform BGRA to fake8 */
.p2align 5,,31
.global _vesa_l_dump_32_to_8
_vesa_l_dump_32_to_8:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movl _vl_video_selector, %fs
movl _vl_current_draw_buffer, %esi
movl _vl_current_offset, %edi
movl _vl_current_stride, %ecx
movl _vl_current_height, %edx
movl _vl_current_delta, %ebx
.balign 4
0:
pushl %edx
pushl %ecx
pushl %ebx
1:
movl (%esi), %eax
addl $4, %esi
#if 1
xorl %ebx, %ebx
movl %eax, %edx
movb %ah, %bl
shrl $16, %edx
andl $0xFF, %edx
andl $0xFF, %eax
movb _array_b(%eax), %al
movb _array_r(%edx), %dl
movb _array_g(%ebx), %bl
imull $36, %eax
imull $6, %ebx
addl %edx, %eax
addl %ebx, %eax
#endif
movb %al, %fs:(%edi)
incl %edi
decl %ecx
jnz 1b
popl %ebx
popl %ecx
popl %edx
addl %ebx, %edi
decl %edx
jnz 0b
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
/* transform BGR to BGRx */
.p2align 5,,31
.global _vesa_l_dump_24_to_32
_vesa_l_dump_24_to_32:
pushl %ebx
pushl %esi
pushl %edi
movl _vl_video_selector, %fs
movl _vl_current_draw_buffer, %esi
movl _vl_current_offset, %edi
movl _vl_current_stride, %ecx
movl _vl_current_height, %edx
movl _vl_current_delta, %ebx
.balign 4
0:
pushl %ecx
1:
movl (%esi), %eax
addl $3, %esi
movl %eax, %fs:(%edi)
addl $4, %edi
subl $4, %ecx
jnz 1b
popl %ecx
addl %ebx, %edi
decl %edx
jnz 0b
popl %edi
popl %esi
popl %ebx
ret
/* transform BGR to fake8 */
.p2align 5,,31
.global _vesa_l_dump_24_to_8
_vesa_l_dump_24_to_8:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movl _vl_video_selector, %fs
movl _vl_current_draw_buffer, %esi
movl _vl_current_offset, %edi
movl _vl_current_stride, %ecx
movl _vl_current_height, %edx
movl _vl_current_delta, %ebx
.balign 4
0:
pushl %edx
pushl %ecx
pushl %ebx
1:
movl (%esi), %eax
addl $3, %esi
#if 1
xorl %ebx, %ebx
movl %eax, %edx
movb %ah, %bl
shrl $16, %edx
andl $0xFF, %edx
andl $0xFF, %eax
movb _array_b(%eax), %al
movb _array_r(%edx), %dl
movb _array_g(%ebx), %bl
imull $36, %eax
imull $6, %ebx
addl %edx, %eax
addl %ebx, %eax
#endif
movb %al, %fs:(%edi)
incl %edi
decl %ecx
jnz 1b
popl %ebx
popl %ecx
popl %edx
addl %ebx, %edi
decl %edx
jnz 0b
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
/* transform B5G6R5 to B5G5R5 */
.p2align 5,,31
.global _vesa_l_dump_16_to_15
_vesa_l_dump_16_to_15:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movl _vl_video_selector, %fs
movl _vl_current_draw_buffer, %esi
movl _vl_current_offset, %edi
movl _vl_current_stride, %ecx
movl _vl_current_height, %edx
movl _vl_current_delta, %ebx
.balign 4
0:
pushl %ecx
1:
movl (%esi), %eax
addl $4, %esi
CVT_16_TO_15(eax, ebp)
movl %eax, %fs:(%edi)
addl $4, %edi
subl $4, %ecx
jnz 1b
popl %ecx
addl %ebx, %edi
decl %edx
jnz 0b
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
/* transform B5G6R5 to fake8 */
.p2align 5,,31
.global _vesa_l_dump_16_to_8
_vesa_l_dump_16_to_8:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movl _vl_video_selector, %fs
movl _vl_current_draw_buffer, %esi
movl _vl_current_offset, %edi
movl _vl_current_stride, %ecx
movl _vl_current_height, %edx
movl _vl_current_delta, %ebx
.balign 4
0:
pushl %ecx
pushl %ebx
1:
movl (%esi), %eax
addl $4, %esi
#if 1
movl %eax, %ebx
andl $0xFFFF, %eax
shrl $16, %ebx
movb _tab_16_8(%eax), %al
movb _tab_16_8(%ebx), %ah
#endif
movw %ax, %fs:(%edi)
addl $2, %edi
subl $2, %ecx
jnz 1b
popl %ebx
popl %ecx
addl %ebx, %edi
decl %edx
jnz 0b
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
.p2align 5,,31
.global _vesa_b_dump_32_to_24
_vesa_b_dump_32_to_24:
pushl %ebx
pushl %esi
pushl %edi
pushl %ebp
movl _vl_video_selector, %fs
movl _vl_current_draw_buffer, %esi
movl _vl_current_offset, %edi
movl _vesa_gran_shift, %ecx
movl _vesa_gran_mask, %ebp
movl %edi, %edx
xorl %ebx, %ebx
andl %ebp, %edi
shrl %cl, %edx
incl %ebp
call *_vesa_swbank
movl _vl_current_stride, %ecx
movl _vl_current_height, %eax
movl $0x00FFFFFF, %ebx
.balign 4
0:
pushl %eax
pushl %ecx
.balign 4
1:
cmpl %ebp, %edi
jb 2f
pushl %ebx
incl %edx
xorl %ebx, %ebx
call *_vesa_swbank
popl %ebx
subl %ebp, %edi
.balign 4
2:
movb (%esi), %al /* XXX too many accesses */
incl %esi
rorl $8, %ebx
jnc 2b
movb %al, %fs:(%edi)
incl %edi
decl %ecx
jnz 1b
popl %ecx
popl %eax
addl _vl_current_delta, %edi
decl %eax
jnz 0b
popl %ebp
popl %edi
popl %esi
popl %ebx
ret
.p2align 5,,31
.global _vesa_b_dump_32_to_16
_vesa_b_dump_32_to_16:
pushl %ebx
pushl %esi
pushl %edi
pushl %ebp
movl _vl_video_selector, %fs
movl _vl_current_draw_buffer, %esi
movl _vl_current_offset, %edi
movl _vesa_gran_shift, %ecx
movl _vesa_gran_mask, %ebp
movl %edi, %edx
xorl %ebx, %ebx
andl %ebp, %edi
shrl %cl, %edx
incl %ebp
call *_vesa_swbank
movl _vl_current_stride, %ecx
movl _vl_current_height, %eax
.balign 4
0:
pushl %eax
pushl %ecx
.balign 4
1:
cmpl %ebp, %edi
jb 2f
incl %edx
xorl %ebx, %ebx
call *_vesa_swbank
subl %ebp, %edi
.balign 4
2:
movl (%esi), %eax
addl $4, %esi
CVT_32_TO_16(a, ebx)
movw %ax, %fs:(%edi)
addl $2, %edi
subl $2, %ecx
jnz 1b
popl %ecx
popl %eax
addl _vl_current_delta, %edi
decl %eax
jnz 0b
popl %ebp
popl %edi
popl %esi
popl %ebx
ret
.p2align 5,,31
.global _vesa_b_dump_32_to_15
_vesa_b_dump_32_to_15:
pushl %ebx
pushl %esi
pushl %edi
pushl %ebp
movl _vl_video_selector, %fs
movl _vl_current_draw_buffer, %esi
movl _vl_current_offset, %edi
movl _vesa_gran_shift, %ecx
movl _vesa_gran_mask, %ebp
movl %edi, %edx
xorl %ebx, %ebx
andl %ebp, %edi
shrl %cl, %edx
incl %ebp
call *_vesa_swbank
movl _vl_current_stride, %ecx
movl _vl_current_height, %eax
.balign 4
0:
pushl %eax
pushl %ecx
.balign 4
1:
cmpl %ebp, %edi
jb 2f
incl %edx
xorl %ebx, %ebx
call *_vesa_swbank
subl %ebp, %edi
.balign 4
2:
movl (%esi), %eax
addl $4, %esi
CVT_32_TO_15(a, ebx)
movw %ax, %fs:(%edi)
addl $2, %edi
subl $2, %ecx
jnz 1b
popl %ecx
popl %eax
addl _vl_current_delta, %edi
decl %eax
jnz 0b
popl %ebp
popl %edi
popl %esi
popl %ebx
ret
.p2align 5,,31
.global _vesa_b_dump_32_to_8
_vesa_b_dump_32_to_8:
pushl %ebx
pushl %esi
pushl %edi
pushl %ebp
movl _vl_video_selector, %fs
movl _vl_current_draw_buffer, %esi
movl _vl_current_offset, %edi
movl _vesa_gran_shift, %ecx
movl _vesa_gran_mask, %ebp
movl %edi, %edx
xorl %ebx, %ebx
andl %ebp, %edi
shrl %cl, %edx
incl %ebp
call *_vesa_swbank
movl _vl_current_stride, %ecx
movl _vl_current_height, %eax
.balign 4
0:
pushl %eax
pushl %ecx
pushl %edx
.balign 4
1:
cmpl %ebp, %edi
jb 2f
popl %edx
incl %edx
pushl %edx
xorl %ebx, %ebx
call *_vesa_swbank
subl %ebp, %edi
.balign 4
2:
movl (%esi), %eax
addl $4, %esi
#if 1
xorl %ebx, %ebx
movl %eax, %edx
movb %ah, %bl
shrl $16, %edx
andl $0xFF, %edx
andl $0xFF, %eax
movb _array_b(%eax), %al
movb _array_r(%edx), %dl
movb _array_g(%ebx), %bl
imull $36, %eax
imull $6, %ebx
addl %edx, %eax
addl %ebx, %eax
#endif
movb %al, %fs:(%edi)
incl %edi
decl %ecx
jnz 1b
popl %edx
popl %ecx
popl %eax
addl _vl_current_delta, %edi
decl %eax
jnz 0b
popl %ebp
popl %edi
popl %esi
popl %ebx
ret
.p2align 5,,31
.global _vesa_b_dump_24_to_32
_vesa_b_dump_24_to_32:
pushl %ebx
pushl %esi
pushl %edi
pushl %ebp
movl _vl_video_selector, %fs
movl _vl_current_draw_buffer, %esi
movl _vl_current_offset, %edi
movl _vesa_gran_shift, %ecx
movl _vesa_gran_mask, %ebp
movl %edi, %edx
xorl %ebx, %ebx
andl %ebp, %edi
shrl %cl, %edx
incl %ebp
call *_vesa_swbank
movl _vl_current_stride, %ecx
movl _vl_current_height, %eax
movl _vl_current_delta, %ebx
.balign 4
0:
pushl %eax
pushl %ecx
.balign 4
1:
cmpl %ebp, %edi
jb 2f
pushl %ebx
incl %edx
xorl %ebx, %ebx
call *_vesa_swbank
popl %ebx
subl %ebp, %edi
.balign 4
2:
movl (%esi), %eax
addl $3, %esi
movl %eax, %fs:(%edi)
addl $4, %edi
subl $4, %ecx
jnz 1b
popl %ecx
popl %eax
addl %ebx, %edi
decl %eax
jnz 0b
popl %ebp
popl %edi
popl %esi
popl %ebx
ret
.p2align 5,,31
.global _vesa_b_dump_24_to_8
_vesa_b_dump_24_to_8:
pushl %ebx
pushl %esi
pushl %edi
pushl %ebp
movl _vl_video_selector, %fs
movl _vl_current_draw_buffer, %esi
movl _vl_current_offset, %edi
movl _vesa_gran_shift, %ecx
movl _vesa_gran_mask, %ebp
movl %edi, %edx
xorl %ebx, %ebx
andl %ebp, %edi
shrl %cl, %edx
incl %ebp
call *_vesa_swbank
movl _vl_current_stride, %ecx
movl _vl_current_height, %eax
.balign 4
0:
pushl %eax
pushl %ecx
pushl %edx
.balign 4
1:
cmpl %ebp, %edi
jb 2f
popl %edx
incl %edx
pushl %edx
xorl %ebx, %ebx
call *_vesa_swbank
subl %ebp, %edi
.balign 4
2:
movl (%esi), %eax
addl $3, %esi
#if 1
xorl %ebx, %ebx
movl %eax, %edx
movb %ah, %bl
shrl $16, %edx
andl $0xFF, %edx
andl $0xFF, %eax
movb _array_b(%eax), %al
movb _array_r(%edx), %dl
movb _array_g(%ebx), %bl
imull $36, %eax
imull $6, %ebx
addl %edx, %eax
addl %ebx, %eax
#endif
movb %al, %fs:(%edi)
incl %edi
decl %ecx
jnz 1b
popl %edx
popl %ecx
popl %eax
addl _vl_current_delta, %edi
decl %eax
jnz 0b
popl %ebp
popl %edi
popl %esi
popl %ebx
ret
.p2align 5,,31
.global _vesa_b_dump_16_to_15
_vesa_b_dump_16_to_15:
pushl %ebx
pushl %esi
pushl %edi
pushl %ebp
movl _vl_video_selector, %fs
movl _vl_current_draw_buffer, %esi
movl _vl_current_offset, %edi
movl _vesa_gran_shift, %ecx
movl _vesa_gran_mask, %ebp
movl %edi, %edx
xorl %ebx, %ebx
andl %ebp, %edi
shrl %cl, %edx
incl %ebp
call *_vesa_swbank
movl _vl_current_stride, %ecx
movl _vl_current_height, %eax
.balign 4
0:
pushl %eax
pushl %ecx
.balign 4
1:
cmpl %ebp, %edi
jb 2f
incl %edx
xorl %ebx, %ebx
call *_vesa_swbank
subl %ebp, %edi
.balign 4
2:
movw (%esi), %ax
addl $2, %esi
CVT_16_TO_15(eax, ebx)
movw %ax, %fs:(%edi)
addl $2, %edi
subl $2, %ecx
jnz 1b
popl %ecx
popl %eax
addl _vl_current_delta, %edi
decl %eax
jnz 0b
popl %ebp
popl %edi
popl %esi
popl %ebx
ret
.p2align 5,,31
.global _vesa_b_dump_16_to_8
_vesa_b_dump_16_to_8:
pushl %ebx
pushl %esi
pushl %edi
pushl %ebp
movl _vl_video_selector, %fs
movl _vl_current_draw_buffer, %esi
movl _vl_current_offset, %edi
movl _vesa_gran_shift, %ecx
movl _vesa_gran_mask, %ebp
movl %edi, %edx
xorl %ebx, %ebx
andl %ebp, %edi
shrl %cl, %edx
incl %ebp
call *_vesa_swbank
movl _vl_current_stride, %ecx
movl _vl_current_height, %eax
movl _vl_current_delta, %ebx
.balign 4
0:
pushl %eax
pushl %ecx
.balign 4
1:
cmpl %ebp, %edi
jb 2f
pushl %ebx
incl %edx
xorl %ebx, %ebx
call *_vesa_swbank
popl %ebx
subl %ebp, %edi
.balign 4
2:
movw (%esi), %ax
addl $2, %esi
#if 1
andl $0xFFFF, %eax
movb _tab_16_8(%eax), %al
#endif
movb %al, %fs:(%edi)
addl $1, %edi
subl $1, %ecx
jnz 1b
popl %ecx
popl %eax
addl %ebx, %edi
decl %eax
jnz 0b
popl %ebp
popl %edi
popl %esi
popl %ebx
ret

File diff suppressed because it is too large Load Diff

View File

@@ -23,9 +23,9 @@
*/
/*
* DOS/DJGPP device driver v1.5 for Mesa
* DOS/DJGPP device driver for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Author: Daniel Borca
* Email : dborca@yahoo.com
* Web : http://www.geocities.com/dborca
*/

View File

@@ -23,9 +23,9 @@
*/
/*
* DOS/DJGPP device driver v1.6 for Mesa
* DOS/DJGPP device driver for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Author: Daniel Borca
* Email : dborca@users.sourceforge.net
* Web : http://www.geocities.com/dborca
*/
@@ -54,6 +54,8 @@ typedef unsigned long word32;
#define _16_ *(word16 *)&
#define _32_ *(word32 *)&
typedef void (*BLTFUNC) (void);
/*
* video mode structure
@@ -75,7 +77,7 @@ typedef struct vl_mode {
*/
typedef struct {
vl_mode *(*init) (void);
int (*entermode) (vl_mode *p, int refresh);
int (*entermode) (vl_mode *p, int refresh, int fbbits);
void (*blit) (void);
void (*setCI_f) (int index, float red, float green, float blue);
void (*setCI_i) (int index, int red, int green, int blue);
@@ -100,32 +102,4 @@ void _remove_selector (int *segment);
int _can_mmx (void);
/*
* asm routines to deal with virtual buffering
*/
extern void v_clear8 (int color);
#define v_clear15 v_clear16
extern void v_clear16 (int color);
extern void v_clear24 (int color);
extern void v_clear32 (int color);
extern void v_clear8_mmx (int color);
#define v_clear15_mmx v_clear16_mmx
extern void v_clear16_mmx (int color);
extern void v_clear24_mmx (int color);
extern void v_clear32_mmx (int color);
extern void v_rect8 (int x, int y, int width, int height, int color);
#define v_rect15 v_rect16
extern void v_rect16 (int x, int y, int width, int height, int color);
extern void v_rect24 (int x, int y, int width, int height, int color);
extern void v_rect32 (int x, int y, int width, int height, int color);
extern void v_putpixel8 (unsigned int offset, int color);
#define v_putpixel15 v_putpixel16
extern void v_putpixel16 (unsigned int offset, int color);
extern void v_putpixel24 (unsigned int offset, int color);
extern void v_putpixel32 (unsigned int offset, int color);
#endif

View File

@@ -23,9 +23,9 @@
*/
/*
* DOS/DJGPP device driver v1.7 for Mesa
* DOS/DJGPP device driver for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Author: Daniel Borca
* Email : dborca@users.sourceforge.net
* Web : http://www.geocities.com/dborca
*/
@@ -137,13 +137,13 @@ null_fini (void)
* Note: -
*/
static int
null_entermode (vl_mode *p, int refresh)
null_entermode (vl_mode *p, int refresh, int fbbits)
{
NUL.blit = null_blit_nop;
return 0;
(void)(p && refresh); /* silence compiler warning */
(void)(p && refresh && fbbits); /* silence compiler warning */
}

View File

@@ -23,9 +23,9 @@
*/
/*
* DOS/DJGPP device driver v1.6 for Mesa
* DOS/DJGPP device driver for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Author: Daniel Borca
* Email : dborca@yahoo.com
* Web : http://www.geocities.com/dborca
*/

View File

@@ -23,9 +23,9 @@
*/
/*
* DOS/DJGPP device driver v1.6 for Mesa
* DOS/DJGPP device driver for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Author: Daniel Borca
* Email : dborca@users.sourceforge.net
* Web : http://www.geocities.com/dborca
*/
@@ -86,16 +86,16 @@ unsigned int vesa_gran_mask, vesa_gran_shift;
* VESA 3.0 CRTC timings structure
*/
typedef struct CRTCInfoBlock {
unsigned short HorizontalTotal;
unsigned short HorizontalSyncStart;
unsigned short HorizontalSyncEnd;
unsigned short VerticalTotal;
unsigned short VerticalSyncStart;
unsigned short VerticalSyncEnd;
unsigned char Flags;
unsigned long PixelClock; /* units of Hz */
unsigned short RefreshRate; /* units of 0.01 Hz */
unsigned char reserved[40];
unsigned short HorizontalTotal;
unsigned short HorizontalSyncStart;
unsigned short HorizontalSyncEnd;
unsigned short VerticalTotal;
unsigned short VerticalSyncStart;
unsigned short VerticalSyncEnd;
unsigned char Flags;
unsigned long PixelClock; /* units of Hz */
unsigned short RefreshRate; /* units of 0.01 Hz */
unsigned char reserved[40];
} __PACKED__ CRTCInfoBlock;
#define HNEG (1 << 2)
@@ -113,116 +113,122 @@ typedef struct CRTCInfoBlock {
static vl_mode *
vesa_init (void)
{
__dpmi_regs r;
word16 *p;
vl_mode *q;
char vesa_info[512], tmp[512];
int maxsize = 0;
word32 linearfb = 0;
__dpmi_regs r;
word16 *p;
vl_mode *q;
char vesa_info[512], tmp[512];
int maxsize = 0;
word32 linearfb = 0;
if (vesa_ver) {
return modes;
}
if (vesa_ver) {
return modes;
}
_farpokel(_stubinfo->ds_selector, 0, 0x32454256);
r.x.ax = 0x4f00;
r.x.di = 0;
r.x.es = _stubinfo->ds_segment;
__dpmi_int(0x10, &r);
movedata(_stubinfo->ds_selector, 0, _my_ds(), (unsigned)vesa_info, 512);
if ((r.x.ax != 0x004f) || ((_32_ vesa_info[V_SIGN]) != 0x41534556)) {
return NULL;
}
_farpokel(_stubinfo->ds_selector, 0, 0x32454256);
r.x.ax = 0x4f00;
r.x.di = 0;
r.x.es = _stubinfo->ds_segment;
__dpmi_int(0x10, &r);
movedata(_stubinfo->ds_selector, 0, _my_ds(), (unsigned)vesa_info, 512);
if ((r.x.ax != 0x004f) || ((_32_ vesa_info[V_SIGN]) != 0x41534556)) {
return NULL;
}
p = (word16 *)(((_16_ vesa_info[V_MODE_SEG])<<4) + (_16_ vesa_info[V_MODE_OFS]));
q = modes;
do {
if ((q->mode=_farpeekw(__djgpp_dos_sel, (unsigned long)(p++))) == 0xffff) {
break;
}
p = (word16 *)(((_16_ vesa_info[V_MODE_SEG]) << 4) + (_16_ vesa_info[V_MODE_OFS]));
q = modes;
do {
if ((q->mode = _farpeekw(__djgpp_dos_sel, (unsigned long)(p++))) == 0xffff) {
break;
}
r.x.ax = 0x4f01;
r.x.cx = q->mode;
r.x.di = 512;
r.x.es = _stubinfo->ds_segment;
__dpmi_int(0x10, &r);
movedata(_stubinfo->ds_selector, 512, _my_ds(), (unsigned)tmp, 256);
switch (tmp[M_BPP]) {
case 16:
q->bpp = tmp[M_RED] + tmp[M_GREEN] + tmp[M_BLUE];
break;
case 8:
case 15:
case 24:
case 32:
q->bpp = tmp[M_BPP];
break;
default:
q->bpp = 0;
}
if ((r.x.ax == 0x004f) && ((tmp[M_ATTR] & 0x11) == 0x11) && q->bpp) {
q->xres = _16_ tmp[M_XRES];
q->yres = _16_ tmp[M_YRES];
q->scanlen = _16_ tmp[M_SCANLEN];
q->gran = (_16_ tmp[M_GRAN])<<10;
if (tmp[M_ATTR] & 0x80) {
vl_mode *q1 = q + 1;
*q1 = *q++;
linearfb = _32_ tmp[M_PHYS_PTR];
q->mode |= 0x4000;
}
if (maxsize < (q->scanlen * q->yres)) {
maxsize = q->scanlen * q->yres;
}
q++;
}
} while (TRUE);
r.x.ax = 0x4f01;
r.x.cx = q->mode;
r.x.di = 512;
r.x.es = _stubinfo->ds_segment;
__dpmi_int(0x10, &r);
movedata(_stubinfo->ds_selector, 512, _my_ds(), (unsigned)tmp, 256);
switch (tmp[M_BPP]) {
case 16:
q->bpp = tmp[M_RED] + tmp[M_GREEN] + tmp[M_BLUE];
break;
case 8:
case 15:
case 24:
case 32:
q->bpp = tmp[M_BPP];
break;
default:
q->bpp = 0;
}
if ((r.x.ax == 0x004f) && ((tmp[M_ATTR] & 0x11) == 0x11) && q->bpp) {
q->xres = _16_ tmp[M_XRES];
q->yres = _16_ tmp[M_YRES];
q->scanlen = _16_ tmp[M_SCANLEN];
q->gran = (_16_ tmp[M_GRAN]) << 10;
if (tmp[M_ATTR] & 0x80) {
vl_mode *q1 = q + 1;
*q1 = *q++;
linearfb = _32_ tmp[M_PHYS_PTR];
q->mode |= 0x4000;
}
if (maxsize < (q->scanlen * q->yres)) {
maxsize = q->scanlen * q->yres;
}
q++;
}
} while (TRUE);
if (q == modes) {
return NULL;
}
if (linearfb) {
maxsize = (maxsize + 0xfffUL) & ~0xfffUL;
if (_create_selector(&linear_selector, linearfb, maxsize)) {
return NULL;
}
}
if (_create_selector(&banked_selector, 0xa0000, modes[0].gran)) {
_remove_selector(&linear_selector);
return NULL;
}
if (q == modes) {
return NULL;
}
if (_create_selector(&banked_selector, 0xa0000, modes[0].gran)) {
return NULL;
}
if (linearfb) {
maxsize = ((maxsize + 0xfffUL) & ~0xfffUL);
if (_create_selector(&linear_selector, linearfb, maxsize)) {
linear_selector = banked_selector;
}
}
for (q = modes; q->mode != 0xffff; q++) {
q->sel = (q->mode & 0x4000) ? linear_selector : banked_selector;
}
for (q = modes; q->mode != 0xffff; q++) {
q->sel = banked_selector;
if (q->mode & 0x4000) {
if (linear_selector != banked_selector) {
q->sel = linear_selector;
} else {
q->mode &= ~0x4000;
}
}
}
if (vesa_info[V_MAJOR] >= 2) {
r.x.ax = 0x4f0a;
r.x.bx = 0;
__dpmi_int(0x10, &r);
if (r.x.ax == 0x004f) {
vesa_pmcode = (word16 *)malloc(r.x.cx);
if (vesa_pmcode != NULL) {
movedata(__djgpp_dos_sel, (r.x.es << 4) + r.x.di, _my_ds(), (unsigned)vesa_pmcode, r.x.cx);
if (vesa_pmcode[3]) {
p = (word16 *)((long)vesa_pmcode + vesa_pmcode[3]);
while (*p++ != 0xffff) {
}
} else {
p = NULL;
}
if (p && (*p != 0xffff)) {
free(vesa_pmcode);
vesa_pmcode = NULL;
} else {
vesa_swbank = (void *)((long)vesa_pmcode + vesa_pmcode[0]);
}
}
}
}
if (vesa_info[V_MAJOR] >= 2) {
r.x.ax = 0x4f0a;
r.x.bx = 0;
__dpmi_int(0x10, &r);
if (r.x.ax == 0x004f) {
vesa_pmcode = (word16 *)malloc(r.x.cx);
if (vesa_pmcode != NULL) {
movedata(__djgpp_dos_sel, (r.x.es << 4) + r.x.di, _my_ds(), (unsigned)vesa_pmcode, r.x.cx);
if (vesa_pmcode[3]) {
p = (word16 *)((long)vesa_pmcode + vesa_pmcode[3]);
while (*p++ != 0xffff) {
}
} else {
p = NULL;
}
if (p && (*p != 0xffff)) {
free(vesa_pmcode);
vesa_pmcode = NULL;
} else {
vesa_swbank = (void *)((long)vesa_pmcode + vesa_pmcode[0]);
}
}
}
}
vesa_ver = _16_ vesa_info[V_MINOR];
return modes;
vesa_ver = _16_ vesa_info[V_MINOR];
return modes;
}
@@ -236,14 +242,14 @@ vesa_init (void)
static void
vesa_fini (void)
{
if (vesa_ver) {
_remove_selector(&linear_selector);
_remove_selector(&banked_selector);
if (vesa_pmcode != NULL) {
free(vesa_pmcode);
vesa_pmcode = NULL;
}
}
if (vesa_ver) {
_remove_selector(&linear_selector);
_remove_selector(&banked_selector);
if (vesa_pmcode != NULL) {
free(vesa_pmcode);
vesa_pmcode = NULL;
}
}
}
@@ -257,15 +263,15 @@ vesa_fini (void)
static unsigned long
_closest_pixclk (int mode_no, unsigned long vclk)
{
__dpmi_regs r;
__dpmi_regs r;
r.x.ax = 0x4F0B;
r.h.bl = 0;
r.d.ecx = vclk;
r.x.dx = mode_no;
__dpmi_int(0x10, &r);
r.x.ax = 0x4F0B;
r.h.bl = 0;
r.d.ecx = vclk;
r.x.dx = mode_no;
__dpmi_int(0x10, &r);
return (r.x.ax == 0x004f) ? r.d.ecx : 0;
return (r.x.ax == 0x004f) ? r.d.ecx : 0;
}
@@ -279,77 +285,253 @@ _closest_pixclk (int mode_no, unsigned long vclk)
static void
_crtc_timing (CRTCInfoBlock *crtc, int xres, int yres, int xadjust, int yadjust)
{
int HTotal, VTotal;
int HDisp, VDisp;
int HSS, VSS;
int HSE, VSE;
int HSWidth, VSWidth;
int SS, SE;
int doublescan = FALSE;
int HTotal, VTotal;
int HDisp, VDisp;
int HSS, VSS;
int HSE, VSE;
int HSWidth, VSWidth;
int SS, SE;
int doublescan = FALSE;
if (yres < 400) {
doublescan = TRUE;
yres *= 2;
}
if (yres < 400) {
doublescan = TRUE;
yres *= 2;
}
HDisp = xres;
HTotal = (int)(HDisp * 1.27) & ~0x7;
HSWidth = (int)((HTotal - HDisp) / 5) & ~0x7;
HSS = HDisp + 16;
HSE = HSS + HSWidth;
VDisp = yres;
VTotal = VDisp * 1.07;
VSWidth = (VTotal / 100) + 1;
VSS = VDisp + ((int)(VTotal - VDisp) / 5) + 1;
VSE = VSS + VSWidth;
HDisp = xres;
HTotal = (int)(HDisp * 1.27) & ~0x7;
HSWidth = (int)((HTotal - HDisp) / 5) & ~0x7;
HSS = HDisp + 16;
HSE = HSS + HSWidth;
VDisp = yres;
VTotal = VDisp * 1.07;
VSWidth = (VTotal / 100) + 1;
VSS = VDisp + ((int)(VTotal - VDisp) / 5) + 1;
VSE = VSS + VSWidth;
SS = HSS + xadjust;
SE = HSE + xadjust;
SS = HSS + xadjust;
SE = HSE + xadjust;
if (xadjust < 0) {
if (SS < (HDisp + 8)) {
SS = HDisp + 8;
SE = SS + HSWidth;
}
} else {
if ((HTotal - 24) < SE) {
SE = HTotal - 24;
SS = SE - HSWidth;
}
}
if (xadjust < 0) {
if (SS < (HDisp + 8)) {
SS = HDisp + 8;
SE = SS + HSWidth;
}
} else {
if ((HTotal - 24) < SE) {
SE = HTotal - 24;
SS = SE - HSWidth;
}
}
HSS = SS;
HSE = SE;
HSS = SS;
HSE = SE;
SS = VSS + yadjust;
SE = VSE + yadjust;
SS = VSS + yadjust;
SE = VSE + yadjust;
if (yadjust < 0) {
if (SS < (VDisp + 3)) {
SS = VDisp + 3;
SE = SS + VSWidth;
}
} else {
if ((VTotal - 4) < SE) {
SE = VTotal - 4;
SS = SE - VSWidth;
}
}
if (yadjust < 0) {
if (SS < (VDisp + 3)) {
SS = VDisp + 3;
SE = SS + VSWidth;
}
} else {
if ((VTotal - 4) < SE) {
SE = VTotal - 4;
SS = SE - VSWidth;
}
}
VSS = SS;
VSE = SE;
VSS = SS;
VSE = SE;
crtc->HorizontalTotal = HTotal;
crtc->HorizontalSyncStart = HSS;
crtc->HorizontalSyncEnd = HSE;
crtc->VerticalTotal = VTotal;
crtc->VerticalSyncStart = VSS;
crtc->VerticalSyncEnd = VSE;
crtc->Flags = HNEG | VNEG;
crtc->HorizontalTotal = HTotal;
crtc->HorizontalSyncStart = HSS;
crtc->HorizontalSyncEnd = HSE;
crtc->VerticalTotal = VTotal;
crtc->VerticalSyncStart = VSS;
crtc->VerticalSyncEnd = VSE;
crtc->Flags = HNEG | VNEG;
if (doublescan) {
crtc->Flags |= DOUBLESCAN;
}
if (doublescan) {
crtc->Flags |= DOUBLESCAN;
}
}
/* Desc: Attempts to choose a suitable blitter.
*
* In : ptr to mode structure, software framebuffer bits
* Out : blitter funciton, or NULL
*
* Note: -
*/
static BLTFUNC
_choose_blitter (vl_mode *p, int fbbits)
{
BLTFUNC blitter;
if (p->mode & 0x4000) {
blitter = _can_mmx() ? vesa_l_dump_virtual_mmx : vesa_l_dump_virtual;
switch (p->bpp) {
case 8:
switch (fbbits) {
case 8:
break;
case 16:
blitter = vesa_l_dump_16_to_8;
break;
case 24:
blitter = vesa_l_dump_24_to_8;
break;
case 32:
blitter = vesa_l_dump_32_to_8;
break;
case 15:
default:
return NULL;
}
break;
case 15:
switch (fbbits) {
case 16:
blitter = vesa_l_dump_16_to_15;
break;
case 32:
blitter = vesa_l_dump_32_to_15;
break;
case 8:
case 15:
case 24:
default:
return NULL;
}
break;
case 16:
switch (fbbits) {
case 16:
break;
case 32:
blitter = vesa_l_dump_32_to_16;
break;
case 8:
case 15:
case 24:
default:
return NULL;
}
break;
case 24:
switch (fbbits) {
case 24:
break;
case 32:
blitter = vesa_l_dump_32_to_24;
break;
case 8:
case 15:
case 16:
default:
return NULL;
}
break;
case 32:
switch (fbbits) {
case 24:
blitter = vesa_l_dump_24_to_32;
break;
case 32:
break;
case 8:
case 15:
case 16:
default:
return NULL;
}
break;
}
} else {
blitter = vesa_b_dump_virtual;
switch (p->bpp) {
case 8:
switch (fbbits) {
case 8:
break;
case 16:
blitter = vesa_b_dump_16_to_8;
break;
case 24:
blitter = vesa_b_dump_24_to_8;
break;
case 32:
blitter = vesa_b_dump_32_to_8;
break;
case 15:
default:
return NULL;
}
break;
case 15:
switch (fbbits) {
case 16:
blitter = vesa_b_dump_16_to_15;
break;
case 32:
blitter = vesa_b_dump_32_to_15;
break;
case 8:
case 15:
case 24:
default:
return NULL;
}
break;
case 16:
switch (fbbits) {
case 16:
break;
case 32:
blitter = vesa_b_dump_32_to_16;
break;
case 8:
case 15:
case 24:
default:
return NULL;
}
break;
case 24:
switch (fbbits) {
case 24:
break;
case 32:
blitter = vesa_b_dump_32_to_24;
break;
case 8:
case 15:
case 16:
default:
return NULL;
}
break;
case 32:
switch (fbbits) {
case 24:
blitter = vesa_b_dump_24_to_32;
break;
case 32:
break;
case 8:
case 15:
case 16:
default:
return NULL;
}
break;
}
}
return blitter;
}
@@ -361,74 +543,76 @@ _crtc_timing (CRTCInfoBlock *crtc, int xres, int yres, int xadjust, int yadjust)
* Note: -
*/
static int
vesa_entermode (vl_mode *p, int refresh)
vesa_entermode (vl_mode *p, int refresh, int fbbits)
{
__dpmi_regs r;
__dpmi_regs r;
if (p->mode & 0x4000) {
VESA.blit = _can_mmx() ? vesa_l_dump_virtual_mmx : vesa_l_dump_virtual;
} else {
VESA.blit = vesa_b_dump_virtual;
{ int n; for (vesa_gran_shift=0, n=p->gran; n; vesa_gran_shift++, n>>=1) ; }
vesa_gran_mask = (1 << (--vesa_gran_shift)) - 1;
if ((unsigned)p->gran != (vesa_gran_mask+1)) {
return !0;
}
}
if (!(p->mode & 0x4000)) {
{ int n; for (vesa_gran_shift = 0, n = p->gran; n; vesa_gran_shift++, n >>= 1); }
vesa_gran_mask = (1 << (--vesa_gran_shift)) - 1;
if ((unsigned)p->gran != (vesa_gran_mask + 1)) {
return !0;
}
}
if (oldmode == -1) {
r.x.ax = 0x4f03;
__dpmi_int(0x10, &r);
oldmode = r.x.bx;
}
VESA.blit = _choose_blitter(p, fbbits);
if (VESA.blit == NULL) {
return !0;
}
r.x.ax = 0x4f02;
r.x.bx = p->mode;
if (oldmode == -1) {
r.x.ax = 0x4f03;
__dpmi_int(0x10, &r);
oldmode = r.x.bx;
}
if (refresh && ((vesa_ver>>8) >= 3)) {
/* VESA 3.0 stuff for controlling the refresh rate */
CRTCInfoBlock crtc;
unsigned long vclk;
double f0;
r.x.ax = 0x4f02;
r.x.bx = p->mode;
_crtc_timing(&crtc, p->xres, p->yres, 0, 0);
if (refresh && ((vesa_ver >> 8) >= 3)) {
/* VESA 3.0 stuff for controlling the refresh rate */
CRTCInfoBlock crtc;
unsigned long vclk;
double f0;
vclk = (double)crtc.HorizontalTotal * crtc.VerticalTotal * refresh;
vclk = _closest_pixclk(p->mode, vclk);
_crtc_timing(&crtc, p->xres, p->yres, 0, 0);
if (vclk != 0) {
f0 = (double)vclk / (crtc.HorizontalTotal * crtc.VerticalTotal);
/*_current_refresh_rate = (int)(f0 + 0.5);*/
vclk = (double)crtc.HorizontalTotal * crtc.VerticalTotal * refresh;
vclk = _closest_pixclk(p->mode, vclk);
crtc.PixelClock = vclk;
crtc.RefreshRate = refresh * 100;
if (vclk != 0) {
f0 = (double)vclk / (crtc.HorizontalTotal * crtc.VerticalTotal);
/*_current_refresh_rate = (int)(f0 + 0.5);*/
movedata(_my_ds(), (unsigned)&crtc, _stubinfo->ds_selector, 0, sizeof(crtc));
crtc.PixelClock = vclk;
crtc.RefreshRate = refresh * 100;
r.x.di = 0;
r.x.es = _stubinfo->ds_segment;
r.x.bx |= 0x0800;
}
}
movedata(_my_ds(), (unsigned)&crtc, _stubinfo->ds_selector, 0, sizeof(crtc));
__dpmi_int(0x10, &r);
if (r.x.ax != 0x004f) {
return !0;
}
r.x.di = 0;
r.x.es = _stubinfo->ds_segment;
r.x.bx |= 0x0800;
}
}
if (p->bpp == 8) {
r.x.ax = 0x4f08;
r.x.bx = 0x0800;
__dpmi_int(0x10, &r);
if (r.x.ax == 0x004f) {
r.x.ax = 0x4f08;
r.h.bl = 0x01;
__dpmi_int(0x10, &r);
vesa_color_precision = r.h.bh;
}
}
__dpmi_int(0x10, &r);
if (r.x.ax != 0x004f) {
return !0;
}
return 0;
if (p->bpp == 8) {
r.x.ax = 0x4f08;
r.x.bx = 0x0800;
__dpmi_int(0x10, &r);
if (r.x.ax == 0x004f) {
r.x.ax = 0x4f08;
r.h.bl = 0x01;
__dpmi_int(0x10, &r);
vesa_color_precision = r.h.bh;
}
}
return 0;
}
@@ -442,14 +626,18 @@ vesa_entermode (vl_mode *p, int refresh)
static void
vesa_restore (void)
{
__dpmi_regs r;
__dpmi_regs r;
if (oldmode != -1) {
r.x.ax = 0x4f02;
r.x.bx = oldmode;
__dpmi_int(0x10, &r);
oldmode = -1;
}
if (oldmode != -1) {
if (oldmode < 0x100) {
__asm("int $0x10"::"a"(oldmode));
} else {
r.x.ax = 0x4f02;
r.x.bx = oldmode;
__dpmi_int(0x10, &r);
}
oldmode = -1;
}
}
@@ -464,17 +652,17 @@ static void
vesa_setCI_i (int index, int red, int green, int blue)
{
#if 0
__asm("\n\
__asm("\n\
movw $0x1010, %%ax \n\
movb %1, %%dh \n\
movb %2, %%ch \n\
int $0x10 \n\
"::"b"(index), "m"(red), "m"(green), "c"(blue):"%eax", "%edx");
#else
outportb(0x03C8, index);
outportb(0x03C9, red);
outportb(0x03C9, green);
outportb(0x03C9, blue);
outportb(0x03C8, index);
outportb(0x03C9, red);
outportb(0x03C9, green);
outportb(0x03C9, blue);
#endif
}
@@ -489,9 +677,9 @@ vesa_setCI_i (int index, int red, int green, int blue)
static void
vesa_setCI_f (int index, float red, float green, float blue)
{
float max = (1 << vesa_color_precision) - 1;
float max = (1 << vesa_color_precision) - 1;
vesa_setCI_i(index, (int)(red * max), (int)(green * max), (int)(blue * max));
vesa_setCI_i(index, (int)(red * max), (int)(green * max), (int)(blue * max));
}
@@ -505,14 +693,14 @@ vesa_setCI_f (int index, float red, float green, float blue)
static int
vesa_get (int pname, int *params)
{
switch (pname) {
case VL_GET_CI_PREC:
params[0] = vesa_color_precision;
break;
default:
return -1;
}
return 0;
switch (pname) {
case VL_GET_CI_PREC:
params[0] = vesa_color_precision;
break;
default:
return -1;
}
return 0;
}
@@ -520,12 +708,12 @@ vesa_get (int pname, int *params)
* the driver
*/
vl_driver VESA = {
vesa_init,
vesa_entermode,
NULL,
vesa_setCI_f,
vesa_setCI_i,
vesa_get,
vesa_restore,
vesa_fini
vesa_init,
vesa_entermode,
NULL,
vesa_setCI_f,
vesa_setCI_i,
vesa_get,
vesa_restore,
vesa_fini
};

View File

@@ -23,9 +23,9 @@
*/
/*
* DOS/DJGPP device driver v1.3 for Mesa
* DOS/DJGPP device driver for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Author: Daniel Borca
* Email : dborca@yahoo.com
* Web : http://www.geocities.com/dborca
*/
@@ -42,6 +42,24 @@ extern void vesa_b_dump_virtual (void);
extern void vesa_l_dump_virtual (void);
extern void vesa_l_dump_virtual_mmx (void);
extern void vesa_l_dump_32_to_24 (void);
extern void vesa_l_dump_32_to_16 (void);
extern void vesa_l_dump_32_to_15 (void);
extern void vesa_l_dump_32_to_8 (void);
extern void vesa_l_dump_24_to_32 (void);
extern void vesa_l_dump_24_to_8 (void);
extern void vesa_l_dump_16_to_15 (void);
extern void vesa_l_dump_16_to_8 (void);
extern void vesa_b_dump_32_to_24 (void);
extern void vesa_b_dump_32_to_16 (void);
extern void vesa_b_dump_32_to_15 (void);
extern void vesa_b_dump_32_to_8 (void);
extern void vesa_b_dump_24_to_32 (void);
extern void vesa_b_dump_24_to_8 (void);
extern void vesa_b_dump_16_to_15 (void);
extern void vesa_b_dump_16_to_8 (void);
extern vl_driver VESA;
#endif

View File

@@ -23,9 +23,9 @@
*/
/*
* DOS/DJGPP device driver v1.7 for Mesa
* DOS/DJGPP device driver for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Author: Daniel Borca
* Email : dborca@users.sourceforge.net
* Web : http://www.geocities.com/dborca
*/
@@ -123,6 +123,41 @@ vga_fini (void)
}
/* Desc: Attempts to choose a suitable blitter.
*
* In : ptr to mode structure, software framebuffer bits
* Out : blitter funciton, or NULL
*
* Note: -
*/
static BLTFUNC
_choose_blitter (vl_mode *p, int fbbits)
{
BLTFUNC blitter;
switch (fbbits) {
case 8:
blitter = _can_mmx() ? vesa_l_dump_virtual_mmx : vesa_l_dump_virtual;
break;
case 16:
blitter = vesa_l_dump_16_to_8;
break;
case 24:
blitter = vesa_l_dump_24_to_8;
break;
case 32:
blitter = vesa_l_dump_32_to_8;
break;
default:
return NULL;
}
return blitter;
(void)p;
}
/* Desc: Attempts to enter specified video mode.
*
* In : ptr to mode structure, refresh rate
@@ -131,27 +166,31 @@ vga_fini (void)
* Note: -
*/
static int
vga_entermode (vl_mode *p, int refresh)
vga_entermode (vl_mode *p, int refresh, int fbbits)
{
if (!(p->mode & 0x4000)) {
return -1;
}
VGA.blit = _can_mmx() ? vesa_l_dump_virtual_mmx : vesa_l_dump_virtual;
if (!(p->mode & 0x4000)) {
return -1;
}
if (oldmode == -1) {
__asm("\n\
VGA.blit = _choose_blitter(p, fbbits);
if (VGA.blit == NULL) {
return !0;
}
if (oldmode == -1) {
__asm("\n\
movb $0x0f, %%ah \n\
int $0x10 \n\
andl $0xff, %%eax \n\
movl %%eax, %0 \n\
":"=g"(oldmode)::"%eax", "%ebx");
}
":"=g"(oldmode)::"%eax", "%ebx");
}
__asm("int $0x10"::"a"(p->mode&0xff));
__asm("int $0x10"::"a"(p->mode&0xff));
return 0;
return 0;
(void)refresh; /* silence compiler warning */
(void)refresh; /* silence compiler warning */
}

View File

@@ -23,9 +23,9 @@
*/
/*
* DOS/DJGPP device driver v1.3 for Mesa
* DOS/DJGPP device driver for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Author: Daniel Borca
* Email : dborca@yahoo.com
* Web : http://www.geocities.com/dborca
*/

View File

@@ -23,9 +23,9 @@
*/
/*
* DOS/DJGPP device driver v1.6 for Mesa
* DOS/DJGPP device driver for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Author: Daniel Borca
* Email : dborca@users.sourceforge.net
* Web : http://www.geocities.com/dborca
*
@@ -53,17 +53,25 @@ int vl_current_stride, vl_current_width, vl_current_height, vl_current_bytes;
int vl_current_offset, vl_current_delta;
#if HUGE_LOOKUP
/* These lookup tables are used to extract RGB values in [0,255]
* from 15/16-bit pixel values.
*/
static unsigned char pix15r[0x8000];
static unsigned char pix15g[0x8000];
static unsigned char pix15b[0x8000];
static unsigned char pix16r[0x10000];
static unsigned char pix16g[0x10000];
static unsigned char pix16b[0x10000];
#else
void (*vl_flip) (void);
/* FakeColor data */
#define R_CNT 6
#define G_CNT 6
#define B_CNT 6
#define R_BIAS 7
#define G_BIAS 7
#define B_BIAS 7
static word32 VGAPalette[256];
word8 array_r[256];
word8 array_g[256];
word8 array_b[256];
word8 tab_16_8[0x10000];
/* lookup table for scaling 5 bit colors up to 8 bits */
static int _rgb_scale_5[32] = {
0, 8, 16, 25, 33, 41, 49, 58,
@@ -71,7 +79,6 @@ static int _rgb_scale_5[32] = {
132, 140, 148, 156, 165, 173, 181, 189,
197, 206, 214, 222, 230, 239, 247, 255
};
#endif
/* lookup table for scaling 6 bit colors up to 8 bits */
static int _rgb_scale_6[64] = {
@@ -85,92 +92,6 @@ static int _rgb_scale_6[64] = {
227, 231, 235, 239, 243, 247, 251, 255
};
/* FakeColor data */
#define R_CNT 6
#define G_CNT 6
#define B_CNT 6
#define R_BIAS 7
#define G_BIAS 7
#define B_BIAS 7
static word32 VGAPalette[256];
static word8 array_r[256];
static word8 array_g[256];
static word8 array_b[256];
int (*vl_mixfix) (fixed r, fixed g, fixed b);
int (*vl_mixrgb) (const unsigned char rgb[]);
int (*vl_mixrgba) (const unsigned char rgba[]);
void (*vl_getrgba) (unsigned int offset, unsigned char rgba[4]);
int (*vl_getpixel) (unsigned int offset);
void (*vl_clear) (int color);
void (*vl_rect) (int x, int y, int width, int height, int color);
void (*vl_flip) (void);
void (*vl_putpixel) (unsigned int offset, int color);
/* Desc: color composition (w/o ALPHA)
*
* In : R, G, B
* Out : color
*
* Note: -
*/
static int
vl_mixfix8fake (fixed r, fixed g, fixed b)
{
return array_b[b>>FIXED_SHIFT]*G_CNT*R_CNT
+ array_g[g>>FIXED_SHIFT]*R_CNT
+ array_r[r>>FIXED_SHIFT];
}
#define vl_mixfix8 vl_mixfix8fake
static int
vl_mixfix15 (fixed r, fixed g, fixed b)
{
return ((r>>(3+FIXED_SHIFT))<<10)
|((g>>(3+FIXED_SHIFT))<<5)
| (b>>(3+FIXED_SHIFT));
}
static int
vl_mixfix16 (fixed r, fixed g, fixed b)
{
return ((r>>(3+FIXED_SHIFT))<<11)
|((g>>(2+FIXED_SHIFT))<<5)
| (b>>(3+FIXED_SHIFT));
}
#define vl_mixfix24 vl_mixfix32
static int
vl_mixfix32 (fixed r, fixed g, fixed b)
{
return ((r>>FIXED_SHIFT)<<16)
|((g>>FIXED_SHIFT)<<8)
| (b>>FIXED_SHIFT);
}
/* Desc: color composition (w/ ALPHA)
*
* In : array of integers (R, G, B, A)
* Out : color
*
* Note: -
*/
#define vl_mixrgba8 vl_mixrgb8fake
#define vl_mixrgba15 vl_mixrgb15
#define vl_mixrgba16 vl_mixrgb16
#define vl_mixrgba24 vl_mixrgb24
static int
vl_mixrgba32 (const unsigned char rgba[])
{
/* Hack alert:
* currently, DMesa uses Mesa's alpha buffer;
* so we don't really care about alpha value here...
*/
return /*(rgba[3]<<24) | */(rgba[0]<<16) | (rgba[1]<<8) | (rgba[2]);
}
/* Desc: color composition (w/o ALPHA)
*
@@ -180,29 +101,12 @@ vl_mixrgba32 (const unsigned char rgba[])
* Note: -
*/
static int
vl_mixrgb8fake (const unsigned char rgb[])
v_mixrgb8fake (const unsigned char rgb[])
{
return array_b[rgb[2]]*G_CNT*R_CNT
+ array_g[rgb[1]]*R_CNT
+ array_r[rgb[0]];
}
#define vl_mixrgb8 vl_mixrgb8fake
static int
vl_mixrgb15 (const unsigned char rgb[])
{
return ((rgb[0]>>3)<<10) | ((rgb[1]>>3)<<5) | (rgb[2]>>3);
}
static int
vl_mixrgb16 (const unsigned char rgb[])
{
return ((rgb[0]>>3)<<11) | ((rgb[1]>>2)<<5) | (rgb[2]>>3);
}
#define vl_mixrgb24 vl_mixrgb32
static int
vl_mixrgb32 (const unsigned char rgb[])
{
return (rgb[0]<<16) | (rgb[1]<<8) | (rgb[2]);
}
/* Desc: color decomposition
@@ -213,102 +117,43 @@ vl_mixrgb32 (const unsigned char rgb[])
* Note: uses current read buffer
*/
static void
v_getrgba8fake6 (unsigned int offset, unsigned char rgba[4])
v_getrgb8fake6 (unsigned int offset, unsigned char rgb[])
{
word32 c = VGAPalette[((word8 *)vl_current_read_buffer)[offset]];
rgba[0] = _rgb_scale_6[(c >> 16) & 0x3F];
rgba[1] = _rgb_scale_6[(c >> 8) & 0x3F];
rgba[2] = _rgb_scale_6[ c & 0x3F];
/*rgba[3] = c >> 24;*/ /* dummy alpha; we have separate SW alpha, so ignore */
rgb[0] = _rgb_scale_6[(c >> 16) & 0x3F];
rgb[1] = _rgb_scale_6[(c >> 8) & 0x3F];
rgb[2] = _rgb_scale_6[ c & 0x3F];
}
static void
v_getrgba8fake8 (unsigned int offset, unsigned char rgba[4])
v_getrgb8fake8 (unsigned int offset, unsigned char rgb[])
{
word32 c = VGAPalette[((word8 *)vl_current_read_buffer)[offset]];
rgba[0] = c >> 16;
rgba[1] = c >> 8;
rgba[2] = c;
/*rgba[3] = c >> 24;*/ /* dummy alpha; we have separate SW alpha, so ignore */
}
#define v_getrgba8 v_getrgba8fake6
static void
v_getrgba15 (unsigned int offset, unsigned char rgba[4])
{
word32 c = ((word16 *)vl_current_read_buffer)[offset];
#if HUGE_LOOKUP
c &= 0x7fff;
rgba[0] = pix15r[c];
rgba[1] = pix15g[c];
rgba[2] = pix15b[c];
#else
rgba[0] = _rgb_scale_5[(c >> 10) & 0x1F];
rgba[1] = _rgb_scale_5[(c >> 5) & 0x1F];
rgba[2] = _rgb_scale_5[ c & 0x1F];
#endif
/*rgba[3] = 255;*/ /* dummy alpha; we have separate SW alpha, so ignore */
}
static void
v_getrgba16 (unsigned int offset, unsigned char rgba[4])
{
word32 c = ((word16 *)vl_current_read_buffer)[offset];
#if HUGE_LOOKUP
rgba[0] = pix16r[c];
rgba[1] = pix16g[c];
rgba[2] = pix16b[c];
#else
rgba[0] = _rgb_scale_5[(c >> 11) & 0x1F];
rgba[1] = _rgb_scale_6[(c >> 5) & 0x3F];
rgba[2] = _rgb_scale_5[ c & 0x1F];
#endif
/*rgba[3] = 255;*/ /* dummy alpha; we have separate SW alpha, so ignore */
}
static void
v_getrgba24 (unsigned int offset, unsigned char rgba[4])
{
word32 c = *(word32 *)((long)vl_current_read_buffer+offset*3);
rgba[0] = c >> 16;
rgba[1] = c >> 8;
rgba[2] = c;
/*rgba[3] = 255;*/ /* dummy alpha; we have separate SW alpha, so ignore */
}
static void
v_getrgba32 (unsigned int offset, unsigned char rgba[4])
{
word32 c = ((word32 *)vl_current_read_buffer)[offset];
rgba[0] = c >> 16;
rgba[1] = c >> 8;
rgba[2] = c;
/*rgba[3] = c >> 24;*/ /* dummy alpha; we have separate SW alpha, so ignore */
rgb[0] = c >> 16;
rgb[1] = c >> 8;
rgb[2] = c;
}
/* Desc: pixel retrieval
/* Desc: create R5G6B5 to FakeColor table lookup
*
* In : pixel offset
* Out : pixel value
* In : -
* Out : -
*
* Note: uses current read buffer
* Note: -
*/
static int
v_getpixel8 (unsigned int offset)
static void
init_tab_16_8 (void)
{
return ((word8 *)vl_current_read_buffer)[offset];
}
#define v_getpixel15 v_getpixel16
static int
v_getpixel16 (unsigned int offset)
{
return ((word16 *)vl_current_read_buffer)[offset];
}
static int
v_getpixel24 (unsigned int offset)
{
return *(word32 *)((long)vl_current_read_buffer+offset*3);
}
static int
v_getpixel32 (unsigned int offset)
{
return ((word32 *)vl_current_read_buffer)[offset];
int i;
for (i = 0; i < 0x10000; i++) {
unsigned char rgb[3];
rgb[0] = _rgb_scale_5[(i >> 11) & 0x1F];
rgb[1] = _rgb_scale_6[(i >> 5) & 0x3F];
rgb[2] = _rgb_scale_5[ i & 0x1F];
tab_16_8[i] = v_mixrgb8fake(rgb);
}
(void)v_getrgb8fake6;
(void)v_getrgb8fake8;
}
@@ -379,54 +224,6 @@ fake_buildpalette (int bits)
}
#if HUGE_LOOKUP
/* Desc: initialize lookup arrays
*
* In : -
* Out : -
*
* Note: -
*/
void
v_init_pixeltables (void)
{
unsigned int pixel;
for (pixel = 0; pixel <= 0xffff; pixel++) {
unsigned int r, g, b;
if (pixel <= 0x7fff) {
/* 15bit */
r = (pixel & 0x7c00) >> 8;
g = (pixel & 0x03E0) >> 3;
b = (pixel & 0x001F) << 2;
r = (unsigned int)(((double)r * 255. / 0x7c) + 0.5);
g = (unsigned int)(((double)g * 255. / 0x7c) + 0.5);
b = (unsigned int)(((double)b * 255. / 0x7c) + 0.5);
pix15r[pixel] = r;
pix15g[pixel] = g;
pix15b[pixel] = b;
}
/* 16bit */
r = (pixel & 0xF800) >> 8;
g = (pixel & 0x07E0) >> 3;
b = (pixel & 0x001F) << 3;
r = (unsigned int)(((double)r * 255. / 0xF8) + 0.5);
g = (unsigned int)(((double)g * 255. / 0xFC) + 0.5);
b = (unsigned int)(((double)b * 255. / 0xF8) + 0.5);
pix16r[pixel] = r;
pix16g[pixel] = g;
pix16b[pixel] = b;
}
}
#endif
/* Desc: initialize hardware
*
* In : -
@@ -471,7 +268,7 @@ v_init_hw (void)
int
vl_sync_buffer (void **buffer, int x, int y, int width, int height)
{
if ((width & 7) || (x < 0) || (y < 0) || (x+width > video_mode->xres) || (y+height > video_mode->yres)) {
if ((/*XXX*/width & 7) || (x < 0) || (y < 0) || (x+width > video_mode->xres) || (y+height > video_mode->yres)) {
return -1;
} else {
void *newbuf = *buffer;
@@ -553,38 +350,21 @@ vl_setup_mode (vl_mode *p)
return -1;
}
#define INITPTR(bpp) \
vl_putpixel = v_putpixel##bpp; \
vl_getrgba = v_getrgba##bpp; \
vl_getpixel = v_getpixel##bpp; \
vl_rect = v_rect##bpp; \
vl_mixfix = vl_mixfix##bpp; \
vl_mixrgb = vl_mixrgb##bpp; \
vl_mixrgba = vl_mixrgba##bpp; \
vl_clear = _can_mmx() ? v_clear##bpp##_mmx : v_clear##bpp
switch (p->bpp) {
case 8:
INITPTR(8);
break;
case 15:
INITPTR(15);
break;
case 16:
INITPTR(16);
break;
case 24:
INITPTR(24);
break;
case 32:
INITPTR(32);
break;
default:
return -1;
}
#undef INITPTR
video_mode = p;
video_bypp = (p->bpp+7)/8;
video_scanlen = p->scanlen;
@@ -618,7 +398,7 @@ vl_video_exit (void)
* Note: -
*/
int
vl_video_init (int width, int height, int bpp, int rgb, int refresh)
vl_video_init (int width, int height, int bpp, int rgb, int refresh, int fbbits)
{
int fake;
vl_mode *p, *q;
@@ -630,11 +410,6 @@ vl_video_init (int width, int height, int bpp, int rgb, int refresh)
} else if (bpp == 8) {
fake = 1;
}
#if HUGE_LOOKUP
else if (bpp < 24) {
v_init_pixeltables();
}
#endif
/* initialize hardware */
if ((q = v_init_hw()) == NULL) {
@@ -651,18 +426,16 @@ vl_video_init (int width, int height, int bpp, int rgb, int refresh)
}
}
/* setup and enter mode */
if ((vl_setup_mode(p) == 0) && (drv->entermode(p, refresh) == 0)) {
vl_flip = drv->blit;
if (fake) {
drv->get(VL_GET_CI_PREC, (int *)(&min));
fake_buildpalette(min);
if (min == 8) {
vl_getrgba = v_getrgba8fake8;
}
}
return bpp;
}
/* setup and enter mode */
if ((vl_setup_mode(p) == 0) && (drv->entermode(p, refresh, fbbits) == 0)) {
vl_flip = drv->blit;
if (fake) {
drv->get(VL_GET_CI_PREC, (int *)(&min));
fake_buildpalette(min);
init_tab_16_8();
}
return bpp;
}
/* abort */
return 0;

View File

@@ -23,9 +23,9 @@
*/
/*
* DOS/DJGPP device driver v1.5 for Mesa
* DOS/DJGPP device driver for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Author: Daniel Borca
* Email : dborca@users.sourceforge.net
* Web : http://www.geocities.com/dborca
*/
@@ -43,16 +43,7 @@ typedef int fixed;
#define VL_GET_SCREEN_SIZE 0x0202
#define VL_GET_VIDEO_MODES 0x0300
extern int (*vl_mixfix) (fixed r, fixed g, fixed b);
extern int (*vl_mixrgb) (const unsigned char rgb[]);
extern int (*vl_mixrgba) (const unsigned char rgba[]);
extern void (*vl_getrgba) (unsigned int offset, unsigned char rgba[4]);
extern void (*vl_clear) (int color);
extern void (*vl_rect) (int x, int y, int width, int height, int color);
extern void (*vl_flip) (void);
extern void (*vl_putpixel) (unsigned int offset, int color);
extern int (*vl_getpixel) (unsigned int offset);
void vl_setCI (int index, float red, float green, float blue);
@@ -60,6 +51,6 @@ int vl_sync_buffer (void **buffer, int x, int y, int width, int height);
int vl_get (int pname, int *params);
void vl_video_exit (void);
int vl_video_init (int width, int height, int bpp, int rgb, int refresh);
int vl_video_init (int width, int height, int bpp, int rgb, int refresh, int fbbits);
#endif

View File

@@ -1,489 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 4.0
*
* Copyright (C) 1999 Brian Paul 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, sublicense,
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL 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.
*/
/*
* DOS/DJGPP device driver v1.3 for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
* Web : http://www.geocities.com/dborca
*/
.file "virtual.S"
/*
* extern void *vl_current_draw_buffer;
* extern int vl_current_width, vl_current_bytes;
*/
.text
/* Desc: void v_clear8 (int color);
*
* In : color
* Out : -
*
* Note: uses current draw buffer
*/
.p2align 5,,31
.global _v_clear8
_v_clear8:
movl 4(%esp), %eax
movb %al, %ah
pushw %ax
pushw %ax
popl %eax
jmp _v_clear_common
/* Desc: void v_clear16 (int color);
*
* In : color
* Out : -
*
* Note: uses current draw buffer
*/
.p2align 5,,31
.global _v_clear16
_v_clear16:
movl 4(%esp), %eax
pushw %ax
pushw %ax
popl %eax
jmp _v_clear_common
/* Desc: void v_clear32 (int color);
*
* In : color
* Out : -
*
* Note: uses current draw buffer
*/
.p2align 5,,31
.global _v_clear32
_v_clear32:
movl 4(%esp), %eax
.balign 4
_v_clear_common:
movl _vl_current_bytes, %ecx
movl _vl_current_draw_buffer, %edx
shrl $2, %ecx
.balign 4
0:
movl %eax, (%edx)
addl $4, %edx
decl %ecx
jnz 0b
ret
/* Desc: void v_clear8_mmx (int color);
*
* In : color
* Out : -
*
* Note: uses current draw buffer
*/
.p2align 5,,31
.global _v_clear8_mmx
_v_clear8_mmx:
#ifdef USE_MMX_ASM
movd 4(%esp), %mm0
punpcklbw %mm0, %mm0
punpcklwd %mm0, %mm0
jmp _v_clear_common_mmx
#endif
/* Desc: void v_clear16_mmx (int color);
*
* In : color
* Out : -
*
* Note: uses current draw buffer
*/
.p2align 5,,31
.global _v_clear16_mmx
_v_clear16_mmx:
#ifdef USE_MMX_ASM
movd 4(%esp), %mm0
punpcklwd %mm0, %mm0
jmp _v_clear_common_mmx
#endif
/* Desc: void v_clear32_mmx (int color);
*
* In : color
* Out : -
*
* Note: uses current draw buffer
*/
.p2align 5,,31
.global _v_clear32_mmx
_v_clear32_mmx:
#ifdef USE_MMX_ASM
movd 4(%esp), %mm0
.balign 4
_v_clear_common_mmx:
punpckldq %mm0, %mm0
movl _vl_current_bytes, %ecx
movl _vl_current_draw_buffer, %edx
shrl $3, %ecx
.balign 4
0:
movq %mm0, (%edx)
addl $8, %edx
decl %ecx
jnz 0b
emms
#endif
ret
/* Desc: void v_clear24 (int color);
*
* In : color
* Out : -
*
* Note: uses current draw buffer
*/
.p2align 5,,31
.global _v_clear24
_v_clear24:
movl $0xaaaaaaab, %eax
mull _vl_current_bytes
movl 4(%esp), %eax
movl %edx, %ecx
pushl %ebx
movl _vl_current_draw_buffer, %edx
shrl %ecx
movb 10(%esp), %bl
.balign 4
0:
movw %ax, (%edx)
movb %bl, 2(%edx)
addl $3, %edx
decl %ecx
jnz 0b
popl %ebx
ret
/* Desc: void v_clear24_mmx (int color);
*
* In : color
* Out : -
*
* Note: uses current draw buffer
*/
.p2align 5,,31
.global _v_clear24_mmx
_v_clear24_mmx:
#ifdef USE_MMX_ASM
movl 4(%esp), %eax
movl %eax, %edx
movl %eax, %ecx
shll $16, %edx
rorl $8, %ecx
movw %cx, %dx
rorl $16, %ecx
movb %dh, %cl
shll $8, %eax
movb %ch, %al
rorl $8, %eax
pushl %edx
pushl %eax
movq (%esp), %mm0
pushl %ecx
movq (%esp), %mm1
pushl %edx
movq (%esp), %mm2
movl $0xaaaaaaab, %eax
mull _vl_current_bytes
movl %edx, %ecx
movl _vl_current_draw_buffer, %edx
shrl $4, %ecx
.balign 4
0:
movq %mm0, (%edx)
movq %mm1, 8(%edx)
movq %mm2, 16(%edx)
addl $24, %edx
decl %ecx
jnz 0b
emms
addl $16, %esp
#endif
ret
/* Desc: void v_rect8 (int color);
*
* In : color
* Out : -
*
* Note: uses current draw buffer
*/
.p2align 5,,31
.global _v_rect8
_v_rect8:
cld
pushl %esi
pushl %edi
movl 28(%esp), %eax
movl _vl_current_width, %esi
movl 16(%esp), %edi
movb %al, %ah
movl 20(%esp), %ecx
imull %esi, %edi
movl 24(%esp), %edx
subl %ecx, %esi
addl 12(%esp), %edi
pushw %ax
pushw %ax
pushl %ds
popl %es
addl _vl_current_draw_buffer, %edi
popl %eax
pushl %ebx
movl %ecx, %ebx
andl $3, %ebx
.balign 4
0:
pushl %ecx
.balign 4
1:
shrl $2, %ecx
rep; stosl
testl %ebx, %ebx
jz 2f
movl %ebx, %ecx
rep; stosb
.balign 4
2:
popl %ecx
addl %esi, %edi
decl %edx
jnz 0b
popl %ebx
popl %edi
popl %esi
ret
/* Desc: void v_rect16 (int color);
*
* In : color
* Out : -
*
* Note: uses current draw buffer
*/
.p2align 5,,31
.global _v_rect16
_v_rect16:
cld
pushl %esi
pushl %edi
movl 28(%esp), %eax
movl _vl_current_width, %esi
movl 16(%esp), %edi
movl 20(%esp), %ecx
imull %esi, %edi
movl 24(%esp), %edx
subl %ecx, %esi
addl 12(%esp), %edi
pushw %ax
shll %esi
pushw %ax
shll %edi
pushl %ds
popl %es
addl _vl_current_draw_buffer, %edi
popl %eax
.balign 4
0:
pushl %ecx
.balign 4
1:
shrl %ecx
rep; stosl
jnc 2f
stosw
.balign 4
2:
popl %ecx
addl %esi, %edi
decl %edx
jnz 0b
popl %edi
popl %esi
ret
/* Desc: void v_rect24 (int color);
*
* In : color
* Out : -
*
* Note: uses current draw buffer
*/
.p2align 5,,31
.global _v_rect24
_v_rect24:
pushl %esi
pushl %edi
movl 28(%esp), %eax
movl _vl_current_width, %esi
movl 16(%esp), %edi
movl 20(%esp), %ecx
imull %esi, %edi
movl 24(%esp), %edx
subl %ecx, %esi
addl 12(%esp), %edi
leal (%esi, %esi, 2), %esi
pushl %ebx
leal (%edi, %edi, 2), %edi
movl %eax, %ebx
addl _vl_current_draw_buffer, %edi
shrl $16, %ebx
.balign 4
0:
pushl %ecx
.balign 4
1:
movw %ax, (%edi)
movb %bl, 2(%edi)
addl $3, %edi
decl %ecx
jnz 1b
popl %ecx
addl %esi, %edi
decl %edx
jnz 0b
popl %ebx
popl %edi
popl %esi
ret
/* Desc: void v_rect32 (int color);
*
* In : color
* Out : -
*
* Note: uses current draw buffer
*/
.p2align 5,,31
.global _v_rect32
_v_rect32:
pushl %esi
pushl %edi
movl _vl_current_width, %esi
movl 16(%esp), %edi
movl 20(%esp), %ecx
imull %esi, %edi
movl 24(%esp), %edx
subl %ecx, %esi
addl 12(%esp), %edi
shll $2, %esi
shll $2, %edi
movl 28(%esp), %eax
addl _vl_current_draw_buffer, %edi
.balign 4
0:
pushl %ecx
.balign 4
1:
movl %eax, (%edi)
addl $4, %edi
decl %ecx
jnz 1b
popl %ecx
addl %esi, %edi
decl %edx
jnz 0b
popl %edi
popl %esi
ret
/* Desc: void v_putpixel8 (unsigned int offset, int color);
*
* In : offset within buffer, color
* Out : -
*
* Note: uses current draw buffer
*/
.p2align 5,,31
.global _v_putpixel8
_v_putpixel8:
movl 8(%esp), %ecx
movl 4(%esp), %edx
movl _vl_current_draw_buffer, %eax
movb %cl, (%eax,%edx)
ret
/* Desc: void v_putpixel16 (unsigned int offset, int color);
*
* In : offset within buffer, color
* Out : -
*
* Note: uses current draw buffer
*/
.p2align 5,,31
.global _v_putpixel16
_v_putpixel16:
movl 8(%esp), %ecx
movl 4(%esp), %edx
movl _vl_current_draw_buffer, %eax
movw %cx, (%eax,%edx,2)
ret
/* Desc: void v_putpixel24 (unsigned int offset, int color);
*
* In : offset within buffer, color
* Out : -
*
* Note: uses current draw buffer
*/
.p2align 5,,31
.global _v_putpixel24
_v_putpixel24:
movl 4(%esp), %eax
movl 8(%esp), %edx
movl _vl_current_draw_buffer, %ecx
leal (%eax,%eax,2), %eax
movw %dx, (%ecx,%eax)
shrl $16, %edx
movb %dl, 2(%ecx,%eax)
ret
/* Desc: void v_putpixel32 (unsigned int offset, int color);
*
* In : offset within buffer, color
* Out : -
*
* Note: uses current draw buffer
*/
.p2align 5,,31
.global _v_putpixel32
_v_putpixel32:
movl 8(%esp), %ecx
movl 4(%esp), %edx
movl _vl_current_draw_buffer, %eax
movl %ecx, (%eax,%edx,4)
ret

View File

@@ -547,6 +547,13 @@ static int64_t driSwapBuffersMSC( __DRInativeDisplay * dpy, void *drawablePriv,
remainder );
}
static void driCopySubBuffer( __DRInativeDisplay *dpy, void *drawablePrivate,
int x, int y, int w, int h)
{
__DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
dPriv->driScreenPriv->DriverAPI.CopySubBuffer(dPriv, x, y, w, h);
(void) dpy;
}
/**
* This is called via __DRIscreenRec's createNewDrawable pointer.
@@ -623,6 +630,9 @@ static void *driCreateNewDrawable(__DRInativeDisplay *dpy,
pdraw->frameTracking = NULL;
pdraw->queryFrameTracking = driQueryFrameTracking;
if (driCompareGLXAPIVersion (20060314) >= 0)
pdraw->copySubBuffer = driCopySubBuffer;
/* This special default value is replaced with the configured
* default value when the drawable is first bound to a direct
* rendering context.
@@ -831,7 +841,7 @@ static void driDestroyScreen(__DRInativeDisplay *dpy, int scrn, void *screenPriv
(void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX);
(void)drmUnmap((drmAddress)psp->pFB, psp->fbSize);
_mesa_free(psp->pDevPriv);
(void)drmCloseOnce(psp->fd);
(void)drmClose(psp->fd);
if ( psp->modes != NULL ) {
(*dri_interface->destroyContextModes)( psp->modes );
}

View File

@@ -189,6 +189,8 @@ struct __DriverAPIRec {
int64_t (*SwapBuffersMSC)( __DRIdrawablePrivate *priv, int64_t target_msc,
int64_t divisor, int64_t remainder );
/*@}*/
void (*CopySubBuffer)(__DRIdrawablePrivate *driDrawPriv,
int x, int y, int w, int h);
};

View File

@@ -40,6 +40,10 @@ driDeleteRenderbuffer(struct gl_renderbuffer *rb)
* Allocate a new driRenderbuffer object.
* Individual drivers are free to implement different versions of
* this function.
*
* At this time, this function can only be used for window-system
* renderbuffers, not user-created RBOs.
*
* \param format Either GL_RGBA, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24,
* GL_DEPTH_COMPONENT32, or GL_STENCIL_INDEX8_EXT (for now).
* \param addr address in main memory of the buffer. Probably a memory
@@ -81,30 +85,45 @@ driNewRenderbuffer(GLenum format, GLvoid *addr,
/* Color */
drb->Base._BaseFormat = GL_RGBA;
drb->Base.DataType = GL_UNSIGNED_BYTE;
if (format == GL_RGB5) {
drb->Base.RedBits = 5;
drb->Base.GreenBits = 6;
drb->Base.BlueBits = 5;
}
else {
drb->Base.RedBits =
drb->Base.GreenBits =
drb->Base.BlueBits =
drb->Base.AlphaBits = 8;
}
}
else if (format == GL_DEPTH_COMPONENT16) {
/* Depth */
drb->Base._BaseFormat = GL_DEPTH_COMPONENT;
/* we always Get/Put 32-bit Z values */
drb->Base.DataType = GL_UNSIGNED_INT;
drb->Base.DepthBits = 16;
}
else if (format == GL_DEPTH_COMPONENT24) {
/* Depth */
drb->Base._BaseFormat = GL_DEPTH_COMPONENT;
/* we always Get/Put 32-bit Z values */
drb->Base.DataType = GL_UNSIGNED_INT;
drb->Base.DepthBits = 24;
}
else if (format == GL_DEPTH_COMPONENT32) {
/* Depth */
drb->Base._BaseFormat = GL_DEPTH_COMPONENT;
/* we always Get/Put 32-bit Z values */
drb->Base.DataType = GL_UNSIGNED_INT;
drb->Base.DepthBits = 32;
}
else {
/* Stencil */
ASSERT(format == GL_STENCIL_INDEX8_EXT);
drb->Base._BaseFormat = GL_STENCIL_INDEX;
drb->Base.DataType = GL_UNSIGNED_BYTE;
drb->Base.StencilBits = 8;
}
/* XXX if we were allocating a user-created renderbuffer, we'd have

View File

@@ -5,9 +5,14 @@ include $(TOP)/configs/current
LIBNAME = fb_dri.so
ifeq ($(USING_EGL), 1)
EGL_SOURCES = server/radeon_egl.c
endif
DRIVER_SOURCES = \
fb_dri.c \
fb_egl.c
$(EGL_SOURCES)
C_SOURCES = \
$(COMMON_SOURCES) \
@@ -16,7 +21,7 @@ C_SOURCES = \
ASM_SOURCES =
# XXX not 100% sure this is right
WINDOW_SYSTEM = solo
#WINDOW_SYSTEM = solo
include ../Makefile.template

View File

@@ -366,7 +366,8 @@ static void intelWaitForFrameCompletion( intelContextPtr intel )
/*
* Copy the back buffer to the front buffer.
*/
void intelCopyBuffer( const __DRIdrawablePrivate *dPriv )
void intelCopyBuffer( const __DRIdrawablePrivate *dPriv,
const drm_clip_rect_t *rect)
{
intelContextPtr intel;
GLboolean missed_target;
@@ -385,15 +386,19 @@ void intelCopyBuffer( const __DRIdrawablePrivate *dPriv )
LOCK_HARDWARE( intel );
intelWaitForFrameCompletion( intel );
UNLOCK_HARDWARE( intel );
driWaitForVBlank( dPriv, &intel->vbl_seq, intel->vblank_flags, & missed_target );
LOCK_HARDWARE( intel );
if (!rect)
{
UNLOCK_HARDWARE( intel );
driWaitForVBlank( dPriv, &intel->vbl_seq, intel->vblank_flags, & missed_target );
LOCK_HARDWARE( intel );
}
{
const intelScreenPrivate *intelScreen = intel->intelScreen;
const __DRIdrawablePrivate *dPriv = intel->driDrawable;
const int nbox = dPriv->numClipRects;
const drm_clip_rect_t *pbox = dPriv->pClipRects;
drm_clip_rect_t box;
const int cpp = intelScreen->cpp;
const int pitch = intelScreen->front.pitch; /* in bytes */
int i;
@@ -429,18 +434,35 @@ void intelCopyBuffer( const __DRIdrawablePrivate *dPriv )
continue;
}
box = *pbox;
if (rect)
{
if (rect->x1 > box.x1)
box.x1 = rect->x1;
if (rect->y1 > box.y1)
box.y1 = rect->y1;
if (rect->x2 < box.x2)
box.x2 = rect->x2;
if (rect->y2 < box.y2)
box.y2 = rect->y2;
if (box.x1 > box.x2 || box.y1 > box.y2)
continue;
}
BEGIN_BATCH( 8);
OUT_BATCH( CMD );
OUT_BATCH( BR13 );
OUT_BATCH( (pbox->y1 << 16) | pbox->x1 );
OUT_BATCH( (pbox->y2 << 16) | pbox->x2 );
OUT_BATCH( (box.y1 << 16) | box.x1 );
OUT_BATCH( (box.y2 << 16) | box.x2 );
if (intel->sarea->pf_current_page == 0)
OUT_BATCH( intelScreen->front.offset );
else
OUT_BATCH( intelScreen->back.offset );
OUT_BATCH( (pbox->y1 << 16) | pbox->x1 );
OUT_BATCH( (box.y1 << 16) | box.x1 );
OUT_BATCH( BR13 & 0xffff );
if (intel->sarea->pf_current_page == 0)
@@ -454,14 +476,17 @@ void intelCopyBuffer( const __DRIdrawablePrivate *dPriv )
intelFlushBatchLocked( intel, GL_TRUE, GL_TRUE, GL_TRUE );
UNLOCK_HARDWARE( intel );
intel->swap_count++;
(*dri_interface->getUST)(&ust);
if (missed_target) {
intel->swap_missed_count++;
intel->swap_missed_ust = ust - intel->swap_ust;
}
if (!rect)
{
intel->swap_count++;
(*dri_interface->getUST)(&ust);
if (missed_target) {
intel->swap_missed_count++;
intel->swap_missed_ust = ust - intel->swap_ust;
}
intel->swap_ust = ust;
intel->swap_ust = ust;
}
}
@@ -630,10 +655,10 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield flags, GLboolean all,
drm_clip_rect_t b;
if (!all) {
GLint x = box[i].x1;
GLint y = box[i].y1;
GLint w = box[i].x2 - x;
GLint h = box[i].y2 - y;
GLint x = box->x1;
GLint y = box->y1;
GLint w = box->x2 - x;
GLint h = box->y2 - y;
if (x < cx) w -= cx - x, x = cx;
if (y < cy) h -= cy - y, y = cy;

View File

@@ -75,7 +75,8 @@ extern void intelRestartInlinePrimitive( intelContextPtr intel );
extern GLuint *intelEmitInlinePrimitiveLocked(intelContextPtr intel,
int primitive, int dwords,
int vertex_size);
extern void intelCopyBuffer( const __DRIdrawablePrivate *dpriv );
extern void intelCopyBuffer( const __DRIdrawablePrivate *dpriv,
const drm_clip_rect_t *rect);
extern void intelClearWithBlit(GLcontext *ctx, GLbitfield mask, GLboolean all,
GLint cx1, GLint cy1, GLint cw, GLint ch);

View File

@@ -555,6 +555,8 @@ void intelWindowMoved( intelContextPtr intel )
intelSetFrontClipRects( intel );
}
else {
driUpdateFramebufferSize(&intel->ctx, intel->driDrawable);
switch (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0]) {
case BUFFER_BIT_FRONT_LEFT:
intelSetFrontClipRects( intel );
@@ -722,7 +724,7 @@ void intelSwapBuffers( __DRIdrawablePrivate *dPriv )
if ( 0 /*intel->doPageFlip*/ ) { /* doPageFlip is never set !!! */
intelPageFlip( dPriv );
} else {
intelCopyBuffer( dPriv );
intelCopyBuffer( dPriv, NULL );
}
if (screen->current_rotation != 0) {
intelRotateWindow(intel, dPriv, BUFFER_BIT_FRONT_LEFT);
@@ -734,6 +736,29 @@ void intelSwapBuffers( __DRIdrawablePrivate *dPriv )
}
}
void intelCopySubBuffer( __DRIdrawablePrivate *dPriv,
int x, int y, int w, int h )
{
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
intelContextPtr intel;
GLcontext *ctx;
intel = (intelContextPtr) dPriv->driContextPriv->driverPrivate;
ctx = &intel->ctx;
if (ctx->Visual.doubleBufferMode) {
intelScreenPrivate *screen = intel->intelScreen;
drm_clip_rect_t rect;
rect.x1 = x + dPriv->x;
rect.y1 = (dPriv->h - y - h) + dPriv->y;
rect.x2 = rect.x1 + w;
rect.y2 = rect.y1 + h;
_mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
intelCopyBuffer( dPriv, &rect );
}
} else {
/* XXX this shouldn't be an error but we can't handle it for now */
fprintf(stderr, "%s: drawable has no context!\n", __FUNCTION__);
}
}
void intelInitState( GLcontext *ctx )
{

View File

@@ -341,6 +341,7 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
(*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
(*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
(*glx_enable_extension)( psc, "GLX_MESA_allocate_memory" );
(*glx_enable_extension)( psc, "GLX_MESA_copy_sub_buffer" );
}
sPriv->psc->allocateMemory = (void *) intelAllocateMemoryMESA;
@@ -534,7 +535,8 @@ static const struct __DriverAPIRec intelAPI = {
.GetMSC = driGetMSC32,
.WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL,
.SwapBuffersMSC = NULL
.SwapBuffersMSC = NULL,
.CopySubBuffer = intelCopySubBuffer
};

View File

@@ -106,4 +106,7 @@ intelMakeCurrent(__DRIcontextPrivate *driContextPriv,
extern void
intelSwapBuffers(__DRIdrawablePrivate *dPriv);
extern void
intelCopySubBuffer( __DRIdrawablePrivate *dPriv, int x, int y, int w, int h );
#endif

View File

@@ -43,7 +43,7 @@
intelContextPtr intel = INTEL_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = intel->driDrawable; \
driRenderbuffer *drb = (driRenderbuffer *) rb; \
GLuint pitch = drb->pitch * drb->cpp; \
GLuint pitch = drb->pitch; \
GLuint height = dPriv->h; \
char *buf = (char *) drb->Base.Data + \
dPriv->x * drb->cpp + \
@@ -55,7 +55,7 @@
intelContextPtr intel = INTEL_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = intel->driDrawable; \
driRenderbuffer *drb = (driRenderbuffer *) rb; \
GLuint pitch = drb->pitch * drb->cpp; \
GLuint pitch = drb->pitch; \
GLuint height = dPriv->h; \
char *buf = (char *) drb->Base.Data + \
dPriv->x * drb->cpp + \
@@ -133,7 +133,7 @@ do { \
intelContextPtr intel = INTEL_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = intel->driDrawable; \
driRenderbuffer *drb = (driRenderbuffer *) rb; \
GLuint pitch = drb->pitch * drb->cpp; \
GLuint pitch = drb->pitch; \
GLuint height = dPriv->h; \
char *buf = (char *)drb->Base.Data + \
dPriv->x * drb->cpp + \

View File

@@ -0,0 +1,294 @@
#ifndef _INTEL_H_
#define _INTEL_H_
#include "xf86drm.h" /* drm_handle_t, etc */
/* Intel */
#ifndef PCI_CHIP_I810
#define PCI_CHIP_I810 0x7121
#define PCI_CHIP_I810_DC100 0x7123
#define PCI_CHIP_I810_E 0x7125
#define PCI_CHIP_I815 0x1132
#define PCI_CHIP_I810_BRIDGE 0x7120
#define PCI_CHIP_I810_DC100_BRIDGE 0x7122
#define PCI_CHIP_I810_E_BRIDGE 0x7124
#define PCI_CHIP_I815_BRIDGE 0x1130
#endif
#define PCI_CHIP_845_G 0x2562
#define PCI_CHIP_I830_M 0x3577
#ifndef PCI_CHIP_I855_GM
#define PCI_CHIP_I855_GM 0x3582
#define PCI_CHIP_I855_GM_BRIDGE 0x3580
#endif
#ifndef PCI_CHIP_I865_G
#define PCI_CHIP_I865_G 0x2572
#define PCI_CHIP_I865_G_BRIDGE 0x2570
#endif
#ifndef PCI_CHIP_I915_G
#define PCI_CHIP_I915_G 0x2582
#define PCI_CHIP_I915_G_BRIDGE 0x2580
#endif
#ifndef PCI_CHIP_I915_GM
#define PCI_CHIP_I915_GM 0x2592
#define PCI_CHIP_I915_GM_BRIDGE 0x2590
#endif
#ifndef PCI_CHIP_E7221_G
#define PCI_CHIP_E7221_G 0x258A
/* Same as I915_G_BRIDGE */
#define PCI_CHIP_E7221_G_BRIDGE 0x2580
#endif
#ifndef PCI_CHIP_I945_G
#define PCI_CHIP_I945_G 0x2772
#define PCI_CHIP_I945_G_BRIDGE 0x2770
#endif
#ifndef PCI_CHIP_I945_GM
#define PCI_CHIP_I945_GM 0x27A2
#define PCI_CHIP_I945_GM_BRIDGE 0x27A0
#endif
#define IS_I810(pI810) (pI810->Chipset == PCI_CHIP_I810 || \
pI810->Chipset == PCI_CHIP_I810_DC100 || \
pI810->Chipset == PCI_CHIP_I810_E)
#define IS_I815(pI810) (pI810->Chipset == PCI_CHIP_I815)
#define IS_I830(pI810) (pI810->Chipset == PCI_CHIP_I830_M)
#define IS_845G(pI810) (pI810->Chipset == PCI_CHIP_845_G)
#define IS_I85X(pI810) (pI810->Chipset == PCI_CHIP_I855_GM)
#define IS_I852(pI810) (pI810->Chipset == PCI_CHIP_I855_GM && (pI810->variant == I852_GM || pI810->variant == I852_GME))
#define IS_I855(pI810) (pI810->Chipset == PCI_CHIP_I855_GM && (pI810->variant == I855_GM || pI810->variant == I855_GME))
#define IS_I865G(pI810) (pI810->Chipset == PCI_CHIP_I865_G)
#define IS_I915G(pI810) (pI810->Chipset == PCI_CHIP_I915_G || pI810->Chipset == PCI_CHIP_E7221_G)
#define IS_I915GM(pI810) (pI810->Chipset == PCI_CHIP_I915_GM)
#define IS_I945G(pI810) (pI810->Chipset == PCI_CHIP_I945_G)
#define IS_I945GM(pI810) (pI810->Chipset == PCI_CHIP_I945_GM)
#define IS_I9XX(pI810) (IS_I915G(pI810) || IS_I915GM(pI810) || IS_I945G(pI810) || IS_I945GM(pI810))
#define IS_MOBILE(pI810) (IS_I830(pI810) || IS_I85X(pI810) || IS_I915GM(pI810) || IS_I945GM(pI810))
#define I830_GMCH_CTRL 0x52
#define I830_GMCH_GMS_MASK 0x70
#define I830_GMCH_GMS_DISABLED 0x00
#define I830_GMCH_GMS_LOCAL 0x10
#define I830_GMCH_GMS_STOLEN_512 0x20
#define I830_GMCH_GMS_STOLEN_1024 0x30
#define I830_GMCH_GMS_STOLEN_8192 0x40
#define I855_GMCH_GMS_MASK (0x7 << 4)
#define I855_GMCH_GMS_DISABLED 0x00
#define I855_GMCH_GMS_STOLEN_1M (0x1 << 4)
#define I855_GMCH_GMS_STOLEN_4M (0x2 << 4)
#define I855_GMCH_GMS_STOLEN_8M (0x3 << 4)
#define I855_GMCH_GMS_STOLEN_16M (0x4 << 4)
#define I855_GMCH_GMS_STOLEN_32M (0x5 << 4)
#define I915G_GMCH_GMS_STOLEN_48M (0x6 << 4)
#define I915G_GMCH_GMS_STOLEN_64M (0x7 << 4)
typedef unsigned char Bool;
#define TRUE 1
#define FALSE 0
#define PIPE_NONE 0<<0
#define PIPE_CRT 1<<0
#define PIPE_TV 1<<1
#define PIPE_DFP 1<<2
#define PIPE_LFP 1<<3
#define PIPE_CRT2 1<<4
#define PIPE_TV2 1<<5
#define PIPE_DFP2 1<<6
#define PIPE_LFP2 1<<7
typedef struct _I830MemPool *I830MemPoolPtr;
typedef struct _I830MemRange *I830MemRangePtr;
typedef struct _I830MemRange {
long Start;
long End;
long Size;
unsigned long Physical;
unsigned long Offset; /* Offset of AGP-allocated portion */
unsigned long Alignment;
drm_handle_t Key;
unsigned long Pitch; // add pitch
I830MemPoolPtr Pool;
} I830MemRange;
typedef struct _I830MemPool {
I830MemRange Total;
I830MemRange Free;
I830MemRange Fixed;
I830MemRange Allocated;
} I830MemPool;
typedef struct {
int tail_mask;
I830MemRange mem;
unsigned char *virtual_start;
int head;
int tail;
int space;
} I830RingBuffer;
typedef struct {
unsigned int Fence[8];
} I830RegRec, *I830RegPtr;
typedef struct _I830Rec {
unsigned char *MMIOBase;
unsigned char *FbBase;
int cpp;
unsigned int bios_version;
/* These are set in PreInit and never changed. */
long FbMapSize;
long TotalVideoRam;
I830MemRange StolenMemory; /* pre-allocated memory */
long BIOSMemorySize; /* min stolen pool size */
int BIOSMemSizeLoc;
/* These change according to what has been allocated. */
long FreeMemory;
I830MemRange MemoryAperture;
I830MemPool StolenPool;
long allocatedMemory;
/* Regions allocated either from the above pools, or from agpgart. */
/* for single and dual head configurations */
I830MemRange FrontBuffer;
I830MemRange FrontBuffer2;
I830MemRange Scratch;
I830MemRange Scratch2;
I830RingBuffer *LpRing;
I830MemRange BackBuffer;
I830MemRange DepthBuffer;
I830MemRange TexMem;
int TexGranularity;
I830MemRange ContextMem;
int drmMinor;
Bool have3DWindows;
Bool NeedRingBufferLow;
Bool allowPageFlip;
Bool disableTiling;
int Chipset;
unsigned long LinearAddr;
unsigned long MMIOAddr;
drmSize registerSize; /**< \brief MMIO register map size */
drm_handle_t registerHandle; /**< \brief MMIO register map handle */
// IOADDRESS ioBase;
int irq; /**< \brief IRQ number */
int GttBound;
drm_handle_t ring_map;
} I830Rec;
/*
* 12288 is set as the maximum, chosen because it is enough for
* 1920x1440@32bpp with a 2048 pixel line pitch with some to spare.
*/
#define I830_MAXIMUM_VBIOS_MEM 12288
#define I830_DEFAULT_VIDEOMEM_2D (MB(32) / 1024)
#define I830_DEFAULT_VIDEOMEM_3D (MB(64) / 1024)
/* Flags for memory allocation function */
#define FROM_ANYWHERE 0x00000000
#define FROM_POOL_ONLY 0x00000001
#define FROM_NEW_ONLY 0x00000002
#define FROM_MASK 0x0000000f
#define ALLOCATE_AT_TOP 0x00000010
#define ALLOCATE_AT_BOTTOM 0x00000020
#define FORCE_GAPS 0x00000040
#define NEED_PHYSICAL_ADDR 0x00000100
#define ALIGN_BOTH_ENDS 0x00000200
#define FORCE_LOW 0x00000400
#define ALLOC_NO_TILING 0x00001000
#define ALLOC_INITIAL 0x00002000
#define ALLOCATE_DRY_RUN 0x80000000
/* Chipset registers for VIDEO BIOS memory RW access */
#define _855_DRAM_RW_CONTROL 0x58
#define _845_DRAM_RW_CONTROL 0x90
#define DRAM_WRITE 0x33330000
#define KB(x) ((x) * 1024)
#define MB(x) ((x) * KB(1024))
#define GTT_PAGE_SIZE KB(4)
#define ROUND_TO(x, y) (((x) + (y) - 1) / (y) * (y))
#define ROUND_DOWN_TO(x, y) ((x) / (y) * (y))
#define ROUND_TO_PAGE(x) ROUND_TO((x), GTT_PAGE_SIZE)
#define ROUND_TO_MB(x) ROUND_TO((x), MB(1))
#define PRIMARY_RINGBUFFER_SIZE KB(128)
/* Ring buffer registers, p277, overview p19
*/
#define LP_RING 0x2030
#define HP_RING 0x2040
#define RING_TAIL 0x00
#define TAIL_ADDR 0x000FFFF8
#define I830_TAIL_MASK 0x001FFFF8
#define RING_HEAD 0x04
#define HEAD_WRAP_COUNT 0xFFE00000
#define HEAD_WRAP_ONE 0x00200000
#define HEAD_ADDR 0x001FFFFC
#define I830_HEAD_MASK 0x001FFFFC
#define RING_START 0x08
#define START_ADDR 0x03FFFFF8
#define I830_RING_START_MASK 0xFFFFF000
#define RING_LEN 0x0C
#define RING_NR_PAGES 0x001FF000
#define I830_RING_NR_PAGES 0x001FF000
#define RING_REPORT_MASK 0x00000006
#define RING_REPORT_64K 0x00000002
#define RING_REPORT_128K 0x00000004
#define RING_NO_REPORT 0x00000000
#define RING_VALID_MASK 0x00000001
#define RING_VALID 0x00000001
#define RING_INVALID 0x00000000
#include <mmio.h>
# define MMIO_IN8(base, offset) \
*(volatile unsigned char *)(((unsigned char*)(base)) + (offset))
# define MMIO_IN32(base, offset) \
read_MMIO_LE32(base, offset)
# define MMIO_OUT8(base, offset, val) \
*(volatile unsigned char *)(((unsigned char*)(base)) + (offset)) = (val)
# define MMIO_OUT32(base, offset, val) \
*(volatile unsigned int *)(void *)(((unsigned char*)(base)) + (offset)) = CPU_TO_LE32(val)
/* Memory mapped register access macros */
#define INREG8(addr) MMIO_IN8(MMIO, addr)
#define INREG(addr) MMIO_IN32(MMIO, addr)
#define OUTREG8(addr, val) MMIO_OUT8(MMIO, addr, val)
#define OUTREG(addr, val) MMIO_OUT32(MMIO, addr, val)
#define DSPABASE 0x70184
#endif

View File

@@ -0,0 +1,957 @@
/**
* \file server/intel_dri.c
* \brief File to perform the device-specific initialization tasks typically
* done in the X server.
*
* Here they are converted to run in the client (or perhaps a standalone
* process), and to work with the frame buffer device rather than the X
* server infrastructure.
*
* Copyright (C) 2006 Dave Airlie (airlied@linux.ie)
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 THE COPYRIGHT HOLDERS AND/OR THEIR 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include "driver.h"
#include "drm.h"
#include "intel.h"
#include "i830_dri.h"
#include "memops.h"
#include "pciaccess.h"
static size_t drm_page_size;
#define xf86DrvMsg(...) do {} while(0)
static Bool I830DRIDoMappings(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea);
static int I830DetectMemory(const DRIDriverContext *ctx, I830Rec *pI830)
{
struct pci_device host_bridge;
uint32_t gmch_ctrl;
int memsize = 0;
int range;
memset(&host_bridge, 0, sizeof(host_bridge));
pci_device_cfg_read_u32(&host_bridge, &gmch_ctrl, I830_GMCH_CTRL);
/* We need to reduce the stolen size, by the GTT and the popup.
* The GTT varying according the the FbMapSize and the popup is 4KB */
range = (ctx->shared.fbSize / (1024*1024)) + 4;
if (IS_I85X(pI830) || IS_I865G(pI830) || IS_I9XX(pI830)) {
switch (gmch_ctrl & I830_GMCH_GMS_MASK) {
case I855_GMCH_GMS_STOLEN_1M:
memsize = MB(1) - KB(range);
break;
case I855_GMCH_GMS_STOLEN_4M:
memsize = MB(4) - KB(range);
break;
case I855_GMCH_GMS_STOLEN_8M:
memsize = MB(8) - KB(range);
break;
case I855_GMCH_GMS_STOLEN_16M:
memsize = MB(16) - KB(range);
break;
case I855_GMCH_GMS_STOLEN_32M:
memsize = MB(32) - KB(range);
break;
case I915G_GMCH_GMS_STOLEN_48M:
if (IS_I9XX(pI830))
memsize = MB(48) - KB(range);
break;
case I915G_GMCH_GMS_STOLEN_64M:
if (IS_I9XX(pI830))
memsize = MB(64) - KB(range);
break;
}
} else {
switch (gmch_ctrl & I830_GMCH_GMS_MASK) {
case I830_GMCH_GMS_STOLEN_512:
memsize = KB(512) - KB(range);
break;
case I830_GMCH_GMS_STOLEN_1024:
memsize = MB(1) - KB(range);
break;
case I830_GMCH_GMS_STOLEN_8192:
memsize = MB(8) - KB(range);
break;
case I830_GMCH_GMS_LOCAL:
memsize = 0;
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Local memory found, but won't be used.\n");
break;
}
}
if (memsize > 0) {
fprintf(stderr,
"detected %d kB stolen memory.\n", memsize / 1024);
} else {
fprintf(stderr,
"no video memory detected.\n");
}
return memsize;
}
static int AgpInit(const DRIDriverContext *ctx, I830Rec *info)
{
unsigned long mode = 0x4;
if (drmAgpAcquire(ctx->drmFD) < 0) {
fprintf(stderr, "[gart] AGP not available\n");
return 0;
}
if (drmAgpEnable(ctx->drmFD, mode) < 0) {
fprintf(stderr, "[gart] AGP not enabled\n");
drmAgpRelease(ctx->drmFD);
return 0;
}
else
fprintf(stderr, "[gart] AGP enabled at %dx\n", ctx->agpmode);
return 1;
}
static unsigned long AllocFromAGP(const DRIDriverContext *ctx, I830Rec *pI830, long size, unsigned long alignment, I830MemRange *result)
{
unsigned long start, end;
unsigned long newApStart, newApEnd;
int ret;
if (!result || !size)
return 0;
if (!alignment)
alignment = 4;
start = ROUND_TO(pI830->MemoryAperture.Start, alignment);
end = ROUND_TO(start + size, alignment);
newApStart = end;
newApEnd = pI830->MemoryAperture.End;
ret=drmAgpAlloc(ctx->drmFD, size, 0, &(result->Physical), (drm_handle_t *)&(result->Key));
if (ret)
{
fprintf(stderr,"drmAgpAlloc failed %d\n", ret);
return 0;
}
pI830->allocatedMemory += size;
pI830->MemoryAperture.Start = newApStart;
pI830->MemoryAperture.End = newApEnd;
pI830->MemoryAperture.Size = newApEnd - newApStart;
pI830->FreeMemory -= size;
result->Start = start;
result->End = start + size;
result->Size = size;
result->Offset = start;
result->Alignment = alignment;
result->Pool = NULL;
return size;
}
static Bool BindAgpRange(const DRIDriverContext *ctx, I830MemRange *mem)
{
if (!mem)
return FALSE;
if (mem->Key == -1)
return TRUE;
return drmAgpBind(ctx->drmFD, mem->Key, mem->Offset);
}
/* simple memory allocation routines needed */
/* put ring buffer in low memory */
/* need to allocate front, back, depth buffers aligned correctly,
allocate ring buffer,
*/
/* */
static Bool
I830AllocateMemory(const DRIDriverContext *ctx, I830Rec *pI830)
{
unsigned long size, ret;
unsigned long lines, lineSize, align;
/* allocate ring buffer */
memset(pI830->LpRing, 0, sizeof(I830RingBuffer));
pI830->LpRing->mem.Key = -1;
size = PRIMARY_RINGBUFFER_SIZE;
ret = AllocFromAGP(ctx, pI830, size, 0x1000, &pI830->LpRing->mem);
if (ret != size)
{
fprintf(stderr,"unable to allocate ring buffer %ld\n", ret);
return FALSE;
}
pI830->LpRing->tail_mask = pI830->LpRing->mem.Size - 1;
/* allocate front buffer */
memset(&(pI830->FrontBuffer), 0, sizeof(pI830->FrontBuffer));
pI830->FrontBuffer.Key = -1;
pI830->FrontBuffer.Pitch = ctx->shared.virtualWidth;
align = KB(512);
lineSize = ctx->shared.virtualWidth * ctx->cpp;
lines = (ctx->shared.virtualHeight + 15) / 16 * 16;
size = lineSize * lines;
size = ROUND_TO_PAGE(size);
ret = AllocFromAGP(ctx, pI830, size, align, &pI830->FrontBuffer);
if (ret != size)
{
fprintf(stderr,"unable to allocate front buffer %ld\n", ret);
return FALSE;
}
memset(&(pI830->BackBuffer), 0, sizeof(pI830->BackBuffer));
pI830->BackBuffer.Key = -1;
pI830->BackBuffer.Pitch = ctx->shared.virtualWidth;
ret = AllocFromAGP(ctx, pI830, size, align, &pI830->BackBuffer);
if (ret != size)
{
fprintf(stderr,"unable to allocate back buffer %ld\n", ret);
return FALSE;
}
memset(&(pI830->DepthBuffer), 0, sizeof(pI830->DepthBuffer));
pI830->DepthBuffer.Key = -1;
pI830->DepthBuffer.Pitch = ctx->shared.virtualWidth;
ret = AllocFromAGP(ctx, pI830, size, align, &pI830->DepthBuffer);
if (ret != size)
{
fprintf(stderr,"unable to allocate depth buffer %ld\n", ret);
return FALSE;
}
memset(&(pI830->ContextMem), 0, sizeof(pI830->ContextMem));
pI830->ContextMem.Key = -1;
size = KB(32);
ret = AllocFromAGP(ctx, pI830, size, align, &pI830->ContextMem);
if (ret != size)
{
fprintf(stderr,"unable to allocate back buffer %ld\n", ret);
return FALSE;
}
memset(&(pI830->TexMem), 0, sizeof(pI830->TexMem));
pI830->TexMem.Key = -1;
size = 32768 * 1024;
ret = AllocFromAGP(ctx, pI830, size, align, &pI830->TexMem);
if (ret != size)
{
fprintf(stderr,"unable to allocate texture memory %ld\n", ret);
return FALSE;
}
return TRUE;
}
static Bool
I830BindMemory(const DRIDriverContext *ctx, I830Rec *pI830)
{
if (BindAgpRange(ctx, &pI830->LpRing->mem))
return FALSE;
if (BindAgpRange(ctx, &pI830->FrontBuffer))
return FALSE;
if (BindAgpRange(ctx, &pI830->BackBuffer))
return FALSE;
if (BindAgpRange(ctx, &pI830->DepthBuffer))
return FALSE;
if (BindAgpRange(ctx, &pI830->ContextMem))
return FALSE;
if (BindAgpRange(ctx, &pI830->TexMem))
return FALSE;
return TRUE;
}
static Bool
I830CleanupDma(const DRIDriverContext *ctx)
{
drmI830Init info;
memset(&info, 0, sizeof(drmI830Init));
info.func = I830_CLEANUP_DMA;
if (drmCommandWrite(ctx->drmFD, DRM_I830_INIT,
&info, sizeof(drmI830Init))) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830 Dma Cleanup Failed\n");
return FALSE;
}
return TRUE;
}
static Bool
I830InitDma(const DRIDriverContext *ctx, I830Rec *pI830)
{
I830RingBuffer *ring = pI830->LpRing;
drmI830Init info;
memset(&info, 0, sizeof(drmI830Init));
info.func = I830_INIT_DMA;
info.ring_start = ring->mem.Start + pI830->LinearAddr;
info.ring_end = ring->mem.End + pI830->LinearAddr;
info.ring_size = ring->mem.Size;
info.mmio_offset = (unsigned int)ctx->MMIOStart;
info.sarea_priv_offset = sizeof(drm_sarea_t);
info.front_offset = pI830->FrontBuffer.Start;
info.back_offset = pI830->BackBuffer.Start;
info.depth_offset = pI830->DepthBuffer.Start;
info.w = ctx->shared.virtualWidth;
info.h = ctx->shared.virtualHeight;
info.pitch = ctx->shared.virtualWidth;
info.back_pitch = pI830->BackBuffer.Pitch;
info.depth_pitch = pI830->DepthBuffer.Pitch;
info.cpp = pI830->cpp;
if (drmCommandWrite(ctx->drmFD, DRM_I830_INIT,
&info, sizeof(drmI830Init))) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"I830 Dma Initialization Failed\n");
return FALSE;
}
return TRUE;
}
static int I830CheckDRMVersion( const DRIDriverContext *ctx,
I830Rec *pI830 )
{
drmVersionPtr version;
version = drmGetVersion(ctx->drmFD);
if (version) {
int req_minor, req_patch;
req_minor = 4;
req_patch = 0;
if (version->version_major != 1 ||
version->version_minor < req_minor ||
(version->version_minor == req_minor &&
version->version_patchlevel < req_patch)) {
/* Incompatible drm version */
fprintf(stderr,
"[dri] I830DRIScreenInit failed because of a version "
"mismatch.\n"
"[dri] i915.o kernel module version is %d.%d.%d "
"but version 1.%d.%d or newer is needed.\n"
"[dri] Disabling DRI.\n",
version->version_major,
version->version_minor,
version->version_patchlevel,
req_minor,
req_patch);
drmFreeVersion(version);
return 0;
}
pI830->drmMinor = version->version_minor;
drmFreeVersion(version);
}
return 1;
}
static void
I830SetRingRegs(const DRIDriverContext *ctx, I830Rec *pI830)
{
unsigned int itemp;
unsigned char *MMIO = ctx->MMIOAddress;
OUTREG(LP_RING + RING_LEN, 0);
OUTREG(LP_RING + RING_TAIL, 0);
OUTREG(LP_RING + RING_HEAD, 0);
if ((long)(pI830->LpRing->mem.Start & I830_RING_START_MASK) !=
pI830->LpRing->mem.Start) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"I830SetRingRegs: Ring buffer start (%lx) violates its "
"mask (%x)\n", pI830->LpRing->mem.Start, I830_RING_START_MASK);
}
/* Don't care about the old value. Reserved bits must be zero anyway. */
itemp = pI830->LpRing->mem.Start & I830_RING_START_MASK;
OUTREG(LP_RING + RING_START, itemp);
if (((pI830->LpRing->mem.Size - 4096) & I830_RING_NR_PAGES) !=
pI830->LpRing->mem.Size - 4096) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"I830SetRingRegs: Ring buffer size - 4096 (%lx) violates its "
"mask (%x)\n", pI830->LpRing->mem.Size - 4096,
I830_RING_NR_PAGES);
}
/* Don't care about the old value. Reserved bits must be zero anyway. */
itemp = (pI830->LpRing->mem.Size - 4096) & I830_RING_NR_PAGES;
itemp |= (RING_NO_REPORT | RING_VALID);
OUTREG(LP_RING + RING_LEN, itemp);
pI830->LpRing->head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK;
pI830->LpRing->tail = INREG(LP_RING + RING_TAIL);
pI830->LpRing->space = pI830->LpRing->head - (pI830->LpRing->tail + 8);
if (pI830->LpRing->space < 0)
pI830->LpRing->space += pI830->LpRing->mem.Size;
/* RESET THE DISPLAY PIPE TO POINT TO THE FRONTBUFFER - hacky
hacky hacky */
OUTREG(DSPABASE, pI830->FrontBuffer.Start + pI830->LinearAddr);
}
static Bool
I830SetParam(const DRIDriverContext *ctx, int param, int value)
{
drmI830SetParam sp;
memset(&sp, 0, sizeof(sp));
sp.param = param;
sp.value = value;
if (drmCommandWrite(ctx->drmFD, DRM_I830_SETPARAM, &sp, sizeof(sp))) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830 SetParam Failed\n");
return FALSE;
}
return TRUE;
}
static Bool
I830DRIMapScreenRegions(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea)
{
fprintf(stderr,
"[drm] Mapping front buffer\n");
if (drmAddMap(ctx->drmFD,
(drm_handle_t)(sarea->front_offset + pI830->LinearAddr),
sarea->front_size,
DRM_FRAME_BUFFER, /*DRM_AGP,*/
0,
&sarea->front_handle) < 0) {
fprintf(stderr,
"[drm] drmAddMap(front_handle) failed. Disabling DRI\n");
return FALSE;
}
ctx->shared.hFrameBuffer = sarea->front_handle;
ctx->shared.fbSize = sarea->front_size;
fprintf(stderr, "[drm] Front Buffer = 0x%08x\n",
sarea->front_handle);
if (drmAddMap(ctx->drmFD,
(drm_handle_t)(sarea->back_offset),
sarea->back_size, DRM_AGP, 0,
&sarea->back_handle) < 0) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"[drm] drmAddMap(back_handle) failed. Disabling DRI\n");
return FALSE;
}
fprintf(stderr, "[drm] Back Buffer = 0x%08x\n",
sarea->back_handle);
if (drmAddMap(ctx->drmFD,
(drm_handle_t)sarea->depth_offset,
sarea->depth_size, DRM_AGP, 0,
&sarea->depth_handle) < 0) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"[drm] drmAddMap(depth_handle) failed. Disabling DRI\n");
return FALSE;
}
fprintf(stderr, "[drm] Depth Buffer = 0x%08x\n",
sarea->depth_handle);
if (drmAddMap(ctx->drmFD,
(drm_handle_t)sarea->tex_offset,
sarea->tex_size, DRM_AGP, 0,
&sarea->tex_handle) < 0) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"[drm] drmAddMap(tex_handle) failed. Disabling DRI\n");
return FALSE;
}
fprintf(stderr, "[drm] textures = 0x%08x\n",
sarea->tex_handle);
return TRUE;
}
static void
I830DRIUnmapScreenRegions(const DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea)
{
#if 1
if (sarea->front_handle) {
drmRmMap(ctx->drmFD, sarea->front_handle);
sarea->front_handle = 0;
}
#endif
if (sarea->back_handle) {
drmRmMap(ctx->drmFD, sarea->back_handle);
sarea->back_handle = 0;
}
if (sarea->depth_handle) {
drmRmMap(ctx->drmFD, sarea->depth_handle);
sarea->depth_handle = 0;
}
if (sarea->tex_handle) {
drmRmMap(ctx->drmFD, sarea->tex_handle);
sarea->tex_handle = 0;
}
}
static void
I830InitTextureHeap(const DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea)
{
/* Start up the simple memory manager for agp space */
drmI830MemInitHeap drmHeap;
drmHeap.region = I830_MEM_REGION_AGP;
drmHeap.start = 0;
drmHeap.size = sarea->tex_size;
if (drmCommandWrite(ctx->drmFD, DRM_I830_INIT_HEAP,
&drmHeap, sizeof(drmHeap))) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"[drm] Failed to initialized agp heap manager\n");
} else {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"[drm] Initialized kernel agp heap manager, %d\n",
sarea->tex_size);
I830SetParam(ctx, I830_SETPARAM_TEX_LRU_LOG_GRANULARITY,
sarea->log_tex_granularity);
}
}
static Bool
I830DRIDoMappings(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea)
{
if (drmAddMap(ctx->drmFD,
(drm_handle_t)pI830->LpRing->mem.Start,
pI830->LpRing->mem.Size, DRM_AGP, 0,
&pI830->ring_map) < 0) {
fprintf(stderr,
"[drm] drmAddMap(ring_map) failed. Disabling DRI\n");
return FALSE;
}
fprintf(stderr, "[drm] ring buffer = 0x%08x\n",
pI830->ring_map);
if (I830InitDma(ctx, pI830) == FALSE) {
return FALSE;
}
/* init to zero to be safe */
I830DRIMapScreenRegions(ctx, pI830, sarea);
I830InitTextureHeap(ctx, pI830, sarea);
if (ctx->pciDevice != PCI_CHIP_845_G &&
ctx->pciDevice != PCI_CHIP_I830_M) {
I830SetParam(ctx, I830_SETPARAM_USE_MI_BATCHBUFFER_START, 1 );
}
/* Okay now initialize the dma engine */
{
pI830->irq = drmGetInterruptFromBusID(ctx->drmFD,
ctx->pciBus,
ctx->pciDevice,
ctx->pciFunc);
if (drmCtlInstHandler(ctx->drmFD, pI830->irq)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"[drm] failure adding irq handler\n");
pI830->irq = 0;
return FALSE;
}
else
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"[drm] dma control initialized, using IRQ %d\n",
pI830DRI->irq);
}
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] visual configs initialized\n");
return TRUE;
}
static Bool
I830ClearScreen(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea)
{
/* need to drmMap front and back buffers and zero them */
drmAddress map_addr;
int ret;
ret = drmMap(ctx->drmFD,
sarea->front_handle,
sarea->front_size,
&map_addr);
if (ret)
{
fprintf(stderr, "Unable to map front buffer\n");
return FALSE;
}
drimemsetio((char *)map_addr,
0,
sarea->front_size);
drmUnmap(map_addr, sarea->front_size);
ret = drmMap(ctx->drmFD,
sarea->back_handle,
sarea->back_size,
&map_addr);
if (ret)
{
fprintf(stderr, "Unable to map back buffer\n");
return FALSE;
}
drimemsetio((char *)map_addr,
0,
sarea->back_size);
drmUnmap(map_addr, sarea->back_size);
return TRUE;
}
static Bool
I830ScreenInit(DRIDriverContext *ctx, I830Rec *pI830)
{
I830DRIPtr pI830DRI;
drmI830Sarea *pSAREAPriv;
int err;
drm_page_size = getpagesize();
pI830->registerSize = ctx->MMIOSize;
/* This is a hack for now. We have to have more than a 4k page here
* because of the size of the state. However, the state should be
* in a per-context mapping. This will be added in the Mesa 3.5 port
* of the I830 driver.
*/
ctx->shared.SAREASize = SAREA_MAX;
/* Note that drmOpen will try to load the kernel module, if needed. */
ctx->drmFD = drmOpen("i915", NULL );
if (ctx->drmFD < 0) {
fprintf(stderr, "[drm] drmOpen failed\n");
return 0;
}
if ((err = drmSetBusid(ctx->drmFD, ctx->pciBusID)) < 0) {
fprintf(stderr, "[drm] drmSetBusid failed (%d, %s), %s\n",
ctx->drmFD, ctx->pciBusID, strerror(-err));
return 0;
}
if (drmAddMap( ctx->drmFD,
0,
ctx->shared.SAREASize,
DRM_SHM,
DRM_CONTAINS_LOCK,
&ctx->shared.hSAREA) < 0)
{
fprintf(stderr, "[drm] drmAddMap failed\n");
return 0;
}
fprintf(stderr, "[drm] added %d byte SAREA at 0x%08x\n",
ctx->shared.SAREASize, ctx->shared.hSAREA);
if (drmMap( ctx->drmFD,
ctx->shared.hSAREA,
ctx->shared.SAREASize,
(drmAddressPtr)(&ctx->pSAREA)) < 0)
{
fprintf(stderr, "[drm] drmMap failed\n");
return 0;
}
memset(ctx->pSAREA, 0, ctx->shared.SAREASize);
fprintf(stderr, "[drm] mapped SAREA 0x%08x to %p, size %d\n",
ctx->shared.hSAREA, ctx->pSAREA, ctx->shared.SAREASize);
if (drmAddMap(ctx->drmFD,
ctx->MMIOStart,
ctx->MMIOSize,
DRM_REGISTERS,
DRM_READ_ONLY,
&pI830->registerHandle) < 0) {
fprintf(stderr, "[drm] drmAddMap mmio failed\n");
return 0;
}
fprintf(stderr,
"[drm] register handle = 0x%08x\n", pI830->registerHandle);
if (!I830CheckDRMVersion(ctx, pI830)) {
return FALSE;
}
/* Create a 'server' context so we can grab the lock for
* initialization ioctls.
*/
if ((err = drmCreateContext(ctx->drmFD, &ctx->serverContext)) != 0) {
fprintf(stderr, "%s: drmCreateContext failed %d\n", __FUNCTION__, err);
return 0;
}
DRM_LOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext, 0);
/* Initialize the SAREA private data structure */
pSAREAPriv = (drmI830Sarea *)(((char*)ctx->pSAREA) +
sizeof(drm_sarea_t));
memset(pSAREAPriv, 0, sizeof(*pSAREAPriv));
pI830->StolenMemory.Size = I830DetectMemory(ctx, pI830);
pI830->StolenMemory.Start = 0;
pI830->StolenMemory.End = pI830->StolenMemory.Size;
pI830->MemoryAperture.Start = pI830->StolenMemory.End;
pI830->MemoryAperture.End = KB(40000);
pI830->MemoryAperture.Size = pI830->MemoryAperture.End - pI830->MemoryAperture.Start;
if (!AgpInit(ctx, pI830))
return FALSE;
if (I830AllocateMemory(ctx, pI830) == FALSE)
{
return FALSE;
}
if (I830BindMemory(ctx, pI830) == FALSE)
{
return FALSE;
}
pSAREAPriv->front_offset = pI830->FrontBuffer.Start;
pSAREAPriv->front_size = pI830->FrontBuffer.Size;
pSAREAPriv->width = ctx->shared.virtualWidth;
pSAREAPriv->height = ctx->shared.virtualHeight;
pSAREAPriv->pitch = ctx->shared.virtualWidth;
pSAREAPriv->virtualX = ctx->shared.virtualWidth;
pSAREAPriv->virtualY = ctx->shared.virtualHeight;
pSAREAPriv->back_offset = pI830->BackBuffer.Start;
pSAREAPriv->back_size = pI830->BackBuffer.Size;
pSAREAPriv->depth_offset = pI830->DepthBuffer.Start;
pSAREAPriv->depth_size = pI830->DepthBuffer.Size;
pSAREAPriv->tex_offset = pI830->TexMem.Start;
pSAREAPriv->tex_size = pI830->TexMem.Size;
pSAREAPriv->log_tex_granularity = pI830->TexGranularity;
ctx->driverClientMsg = malloc(sizeof(I830DRIRec));
ctx->driverClientMsgSize = sizeof(I830DRIRec);
pI830DRI = (I830DRIPtr)ctx->driverClientMsg;
pI830DRI->deviceID = pI830->Chipset;
pI830DRI->regsSize = I830_REG_SIZE;
pI830DRI->width = ctx->shared.virtualWidth;
pI830DRI->height = ctx->shared.virtualHeight;
pI830DRI->mem = ctx->shared.fbSize;
pI830DRI->cpp = ctx->cpp;
pI830DRI->backOffset = pI830->BackBuffer.Start;
pI830DRI->backPitch = pI830->BackBuffer.Pitch;
pI830DRI->depthOffset = pI830->DepthBuffer.Start;
pI830DRI->depthPitch = pI830->DepthBuffer.Pitch;
pI830DRI->fbOffset = pI830->FrontBuffer.Start;
pI830DRI->fbStride = pI830->FrontBuffer.Pitch;
pI830DRI->bitsPerPixel = ctx->bpp;
pI830DRI->sarea_priv_offset = sizeof(drm_sarea_t);
err = I830DRIDoMappings(ctx, pI830, pSAREAPriv);
if (err == FALSE)
return FALSE;
/* Quick hack to clear the front & back buffers. Could also use
* the clear ioctl to do this, but would need to setup hw state
* first.
*/
I830ClearScreen(ctx, pI830, pSAREAPriv);
I830SetRingRegs(ctx, pI830);
return TRUE;
}
/**
* \brief Validate the fbdev mode.
*
* \param ctx display handle.
*
* \return one on success, or zero on failure.
*
* Saves some registers and returns 1.
*
* \sa radeonValidateMode().
*/
static int i830ValidateMode( const DRIDriverContext *ctx )
{
return 1;
}
/**
* \brief Examine mode returned by fbdev.
*
* \param ctx display handle.
*
* \return one on success, or zero on failure.
*
* Restores registers that fbdev has clobbered and returns 1.
*
* \sa i810ValidateMode().
*/
static int i830PostValidateMode( const DRIDriverContext *ctx )
{
I830Rec *pI830 = ctx->driverPrivate;
I830SetRingRegs(ctx, pI830);
return 1;
}
/**
* \brief Initialize the framebuffer device mode
*
* \param ctx display handle.
*
* \return one on success, or zero on failure.
*
* Fills in \p info with some default values and some information from \p ctx
* and then calls I810ScreenInit() for the screen initialization.
*
* Before exiting clears the framebuffer memory accessing it directly.
*/
static int i830InitFBDev( DRIDriverContext *ctx )
{
I830Rec *pI830 = calloc(1, sizeof(I830Rec));
{
int dummy = ctx->shared.virtualWidth;
switch (ctx->bpp / 8) {
case 1: dummy = (ctx->shared.virtualWidth + 127) & ~127; break;
case 2: dummy = (ctx->shared.virtualWidth + 31) & ~31; break;
case 3:
case 4: dummy = (ctx->shared.virtualWidth + 15) & ~15; break;
}
ctx->shared.virtualWidth = dummy;
}
ctx->driverPrivate = (void *)pI830;
pI830->LpRing = calloc(1, sizeof(I830RingBuffer));
pI830->Chipset = ctx->chipset;
pI830->LinearAddr = ctx->FBStart;
if (!I830ScreenInit( ctx, pI830 ))
return 0;
return 1;
}
/**
* \brief The screen is being closed, so clean up any state and free any
* resources used by the DRI.
*
* \param ctx display handle.
*
* Unmaps the SAREA, closes the DRM device file descriptor and frees the driver
* private data.
*/
static void i830HaltFBDev( DRIDriverContext *ctx )
{
drmI830Sarea *pSAREAPriv;
I830Rec *pI830 = ctx->driverPrivate;
if (pI830->irq) {
drmCtlUninstHandler(ctx->drmFD);
pI830->irq = 0; }
I830CleanupDma(ctx);
pSAREAPriv = (drmI830Sarea *)(((char*)ctx->pSAREA) +
sizeof(drm_sarea_t));
I830DRIUnmapScreenRegions(ctx, pI830, pSAREAPriv);
drmUnmap( ctx->pSAREA, ctx->shared.SAREASize );
drmClose(ctx->drmFD);
if (ctx->driverPrivate) {
free(ctx->driverPrivate);
ctx->driverPrivate = 0;
}
}
extern void i810NotifyFocus( int );
/**
* \brief Exported driver interface for Mini GLX.
*
* \sa DRIDriverRec.
*/
const struct DRIDriverRec __driDriver = {
i830ValidateMode,
i830PostValidateMode,
i830InitFBDev,
i830HaltFBDev,
NULL,//I830EngineShutdown,
NULL, //I830EngineRestore,
#ifndef _EMBEDDED
0,
#else
i810NotifyFocus,
#endif
};

View File

@@ -76,7 +76,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define need_GL_NV_vertex_program
#include "extension_helper.h"
#define DRIVER_DATE "20050831"
#define DRIVER_DATE "20060327"
#include "vblank.h"
#include "utils.h"
@@ -637,7 +637,7 @@ r200SwapBuffers( __DRIdrawablePrivate *dPriv )
r200PageFlip( dPriv );
}
else {
r200CopyBuffer( dPriv );
r200CopyBuffer( dPriv, NULL );
}
}
}
@@ -647,6 +647,30 @@ r200SwapBuffers( __DRIdrawablePrivate *dPriv )
}
}
void
r200CopySubBuffer( __DRIdrawablePrivate *dPriv,
int x, int y, int w, int h )
{
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
r200ContextPtr rmesa;
GLcontext *ctx;
rmesa = (r200ContextPtr) dPriv->driContextPriv->driverPrivate;
ctx = rmesa->glCtx;
if (ctx->Visual.doubleBufferMode) {
drm_clip_rect_t rect;
rect.x1 = x + dPriv->x;
rect.y1 = (dPriv->h - y - h) + dPriv->y;
rect.x2 = rect.x1 + w;
rect.y2 = rect.y1 + h;
_mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
r200CopyBuffer( dPriv, &rect );
}
}
else {
/* XXX this shouldn't be an error but we can't handle it for now */
_mesa_problem(NULL, "%s: drawable has no context!", __FUNCTION__);
}
}
/* Force the context `c' to be the current context and associate with it
* buffer `b'.

View File

@@ -53,6 +53,10 @@ struct r200_context;
typedef struct r200_context r200ContextRec;
typedef struct r200_context *r200ContextPtr;
/* This union is used to avoid warnings/miscompilation
with float to uint32_t casts due to strict-aliasing */
typedef union { GLfloat f; uint32_t ui32; } float_ui32_type;
#include "r200_lock.h"
#include "radeon_screen.h"
#include "mm.h"
@@ -1002,6 +1006,8 @@ extern GLboolean r200CreateContext( const __GLcontextModes *glVisual,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate);
extern void r200SwapBuffers( __DRIdrawablePrivate *dPriv );
extern void r200CopySubBuffer( __DRIdrawablePrivate * dPriv,
int x, int y, int w, int h );
extern GLboolean r200MakeCurrent( __DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawPriv,
__DRIdrawablePrivate *driReadPriv );

View File

@@ -420,7 +420,8 @@ static void r200WaitForFrameCompletion( r200ContextPtr rmesa )
/* Copy the back color buffer to the front color buffer.
*/
void r200CopyBuffer( const __DRIdrawablePrivate *dPriv )
void r200CopyBuffer( const __DRIdrawablePrivate *dPriv,
const drm_clip_rect_t *rect)
{
r200ContextPtr rmesa;
GLint nbox, i, ret;
@@ -446,9 +447,12 @@ void r200CopyBuffer( const __DRIdrawablePrivate *dPriv )
* request at a time.
*/
r200WaitForFrameCompletion( rmesa );
UNLOCK_HARDWARE( rmesa );
driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target );
LOCK_HARDWARE( rmesa );
if (!rect)
{
UNLOCK_HARDWARE( rmesa );
driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target );
LOCK_HARDWARE( rmesa );
}
nbox = dPriv->numClipRects; /* must be in locked region */
@@ -459,8 +463,27 @@ void r200CopyBuffer( const __DRIdrawablePrivate *dPriv )
GLint n = 0;
for ( ; i < nr ; i++ ) {
*b++ = box[i];
n++;
*b = box[i];
if (rect)
{
if (rect->x1 > b->x1)
b->x1 = rect->x1;
if (rect->y1 > b->y1)
b->y1 = rect->y1;
if (rect->x2 < b->x2)
b->x2 = rect->x2;
if (rect->y2 < b->y2)
b->y2 = rect->y2;
if (b->x1 < b->x2 && b->y1 < b->y2)
b++;
}
else
b++;
n++;
}
rmesa->sarea->nbox = n;
@@ -474,18 +497,21 @@ void r200CopyBuffer( const __DRIdrawablePrivate *dPriv )
}
UNLOCK_HARDWARE( rmesa );
rmesa->hw.all_dirty = GL_TRUE;
if (!rect)
{
rmesa->hw.all_dirty = GL_TRUE;
rmesa->swap_count++;
(*dri_interface->getUST)( & ust );
if ( missed_target ) {
rmesa->swap_missed_count++;
rmesa->swap_missed_ust = ust - rmesa->swap_ust;
rmesa->swap_count++;
(*dri_interface->getUST)( & ust );
if ( missed_target ) {
rmesa->swap_missed_count++;
rmesa->swap_missed_ust = ust - rmesa->swap_ust;
}
rmesa->swap_ust = ust;
sched_yield();
}
rmesa->swap_ust = ust;
sched_yield();
}
void r200PageFlip( const __DRIdrawablePrivate *dPriv )

View File

@@ -90,7 +90,8 @@ extern void r200ReleaseDmaRegion( r200ContextPtr rmesa,
struct r200_dma_region *region,
const char *caller );
extern void r200CopyBuffer( const __DRIdrawablePrivate *drawable );
extern void r200CopyBuffer( const __DRIdrawablePrivate *drawable,
const drm_clip_rect_t *rect);
extern void r200PageFlip( const __DRIdrawablePrivate *drawable );
extern void r200Flush( GLcontext *ctx );
extern void r200Finish( GLcontext *ctx );

View File

@@ -763,9 +763,11 @@ static int print_float_reg_assignment( struct reg *reg, float data )
static int print_reg_assignment( struct reg *reg, int data )
{
float_ui32_type datau;
datau.ui32 = data;
reg->flags |= TOUCHED;
if (reg->flags & ISFLOAT)
return print_float_reg_assignment( reg, *(float *)&data );
return print_float_reg_assignment( reg, datau.f );
else
return print_int_reg_assignment( reg, data );
}

View File

@@ -762,16 +762,17 @@ static void r200PolygonOffset( GLcontext *ctx,
GLfloat factor, GLfloat units )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLfloat constant = units * rmesa->state.depth.scale;
float_ui32_type constant = { units * rmesa->state.depth.scale };
float_ui32_type factoru = { factor };
/* factor *= 2; */
/* constant *= 2; */
/* fprintf(stderr, "%s f:%f u:%f\n", __FUNCTION__, factor, constant); */
R200_STATECHANGE( rmesa, zbs );
rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_FACTOR] = *(GLuint *)&factor;
rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_CONSTANT] = *(GLuint *)&constant;
rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_FACTOR] = factoru.ui32;
rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_CONSTANT] = constant.ui32;
}
static void r200PolygonStipple( GLcontext *ctx, const GLubyte *mask )
@@ -1624,22 +1625,22 @@ void r200UpdateWindow( GLcontext *ctx )
GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h;
const GLfloat *v = ctx->Viewport._WindowMap.m;
GLfloat sx = v[MAT_SX];
GLfloat tx = v[MAT_TX] + xoffset + SUBPIXEL_X;
GLfloat sy = - v[MAT_SY];
GLfloat ty = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y;
GLfloat sz = v[MAT_SZ] * rmesa->state.depth.scale;
GLfloat tz = v[MAT_TZ] * rmesa->state.depth.scale;
float_ui32_type sx = { v[MAT_SX] };
float_ui32_type tx = { v[MAT_TX] + xoffset + SUBPIXEL_X };
float_ui32_type sy = { - v[MAT_SY] };
float_ui32_type ty = { (- v[MAT_TY]) + yoffset + SUBPIXEL_Y };
float_ui32_type sz = { v[MAT_SZ] * rmesa->state.depth.scale };
float_ui32_type tz = { v[MAT_TZ] * rmesa->state.depth.scale };
R200_FIREVERTICES( rmesa );
R200_STATECHANGE( rmesa, vpt );
rmesa->hw.vpt.cmd[VPT_SE_VPORT_XSCALE] = *(GLuint *)&sx;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = *(GLuint *)&tx;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_YSCALE] = *(GLuint *)&sy;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = *(GLuint *)&ty;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZSCALE] = *(GLuint *)&sz;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZOFFSET] = *(GLuint *)&tz;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_XSCALE] = sx.ui32;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = tx.ui32;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_YSCALE] = sy.ui32;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = ty.ui32;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZSCALE] = sz.ui32;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZOFFSET] = tz.ui32;
}
@@ -1668,18 +1669,22 @@ void r200UpdateViewportOffset( GLcontext *ctx )
GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h;
const GLfloat *v = ctx->Viewport._WindowMap.m;
GLfloat tx = v[MAT_TX] + xoffset + SUBPIXEL_X;
GLfloat ty = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y;
float_ui32_type tx;
float_ui32_type ty;
if ( rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] != *(GLuint *)&tx ||
rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] != *(GLuint *)&ty )
tx.f = v[MAT_TX] + xoffset + SUBPIXEL_X;
ty.f = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y;
if ( rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] != tx.ui32 ||
rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] != ty.ui32 )
{
/* Note: this should also modify whatever data the context reset
* code uses...
*/
rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = *(GLuint *)&tx;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = *(GLuint *)&ty;
R200_STATECHANGE( rmesa, vpt );
rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = tx.ui32;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = ty.ui32;
/* update polygon stipple x/y screen offset */
{
GLuint stx, sty;

View File

@@ -116,6 +116,7 @@ const struct dri_extension card_extensions[] = {
{"GL_ATI_texture_mirror_once", NULL},
{"GL_MESA_pack_invert", NULL},
{"GL_MESA_ycbcr_texture", NULL},
{"GL_MESAX_texture_float", NULL},
{"GL_NV_blend_square", NULL},
{"GL_NV_vertex_program", GL_NV_vertex_program_functions},
{"GL_SGIS_generate_mipmap", NULL},

View File

@@ -86,9 +86,6 @@ typedef struct r300_context *r300ContextPtr;
#define WARN_ONCE(a, ...) {}
#endif
typedef GLuint uint32_t;
typedef GLubyte uint8_t;
/* We should probably change types within vertex_shader
and pixel_shader structure later on */
#define CARD32 GLuint
@@ -618,7 +615,7 @@ struct r300_vertex_program {
#define PFS_MAX_TEX_INST 64
#define PFS_MAX_TEX_INDIRECT 4
#define PFS_NUM_TEMP_REGS 32
#define PFS_NUM_CONST_REGS 32
#define PFS_NUM_CONST_REGS 16
/* Tracking data for Mesa registers */
struct reg_acc {

View File

@@ -886,7 +886,7 @@ static void emit_arith(struct r300_fragment_program *rp, int op,
sop = r300_fpop[op].s_op;
argc = r300_fpop[op].argc;
if (mask & WRITEMASK_XYZ)
if ((mask & WRITEMASK_XYZ) || vop == R300_FPI0_OUTC_DP3)
emit_vop = GL_TRUE;
if ((mask & WRITEMASK_W) || vop == R300_FPI0_OUTC_REPL_ALPHA)
emit_sop = GL_TRUE;

View File

@@ -552,7 +552,6 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean all,
swapped = r300->radeon.doPageFlip && (r300->radeon.sarea->pfCurrentPage == 1);
#ifdef CB_DPATH
WARN_ONCE("CB_DPATH has been enabled.\nPlease let me know if this introduces new instabilities.\n");
/* Make sure it fits there. */
r300EnsureCmdBufSpace(r300, 419*3, __FUNCTION__);
if(flags || bits)

View File

@@ -453,8 +453,8 @@ GLboolean r300_run_vb_render(GLcontext *ctx,
do { \
if (expr) { \
if (1 || RADEON_DEBUG & DEBUG_FALLBACKS) \
WARN_ONCE("fallback:%s\n", #expr); \
return R300_FALLBACK_RAST; \
WARN_ONCE("Software fallback:%s\n", #expr); \
return R300_FALLBACK_RAST; \
} \
} while(0)

View File

@@ -880,6 +880,7 @@ void r300UpdateViewportOffset( GLcontext *ctx )
/* Note: this should also modify whatever data the context reset
* code uses...
*/
R300_STATECHANGE( rmesa, vpt );
rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = r300PackFloat32(tx);
rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = r300PackFloat32(ty);

View File

@@ -442,6 +442,31 @@ static const struct gl_texture_format *r300ChooseTextureFormat(GLcontext * ctx,
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
return &_mesa_texformat_rgba_dxt5;
case GL_ALPHA16F_ARB:
return &_mesa_texformat_alpha_float16;
case GL_ALPHA32F_ARB:
return &_mesa_texformat_alpha_float32;
case GL_LUMINANCE16F_ARB:
return &_mesa_texformat_luminance_float16;
case GL_LUMINANCE32F_ARB:
return &_mesa_texformat_luminance_float32;
case GL_LUMINANCE_ALPHA16F_ARB:
return &_mesa_texformat_luminance_alpha_float16;
case GL_LUMINANCE_ALPHA32F_ARB:
return &_mesa_texformat_luminance_alpha_float32;
case GL_INTENSITY16F_ARB:
return &_mesa_texformat_intensity_float16;
case GL_INTENSITY32F_ARB:
return &_mesa_texformat_intensity_float32;
case GL_RGB16F_ARB:
return &_mesa_texformat_rgba_float16;
case GL_RGB32F_ARB:
return &_mesa_texformat_rgba_float32;
case GL_RGBA16F_ARB:
return &_mesa_texformat_rgba_float16;
case GL_RGBA32F_ARB:
return &_mesa_texformat_rgba_float32;
default:
_mesa_problem(ctx,
"unexpected internalFormat 0x%x in r300ChooseTextureFormat",

View File

@@ -382,7 +382,17 @@ static void uploadSubImage( r300ContextPtr rmesa, r300TexObjPtr t,
/* copy (x,y,width,height,data) */
memcpy( &tmp, &t->image[face][hwlevel], sizeof(tmp) );
if (texImage->TexFormat->TexelBytes) {
if (texImage->TexFormat->TexelBytes > 4) {
const int log2TexelBytes = (3 + (texImage->TexFormat->TexelBytes >> 4));
tex.format = RADEON_TXFORMAT_I8; /* any 1-byte texel format */
tex.pitch = MAX2((texImage->Width * texImage->TexFormat->TexelBytes) / 64, 1);
tex.height = imageHeight;
tex.width = imageWidth << log2TexelBytes;
tex.offset += (tmp.x << log2TexelBytes) & ~1023;
tmp.x = tmp.x % (1024 >> log2TexelBytes);
tmp.width = tmp.width << log2TexelBytes;
}
else if (texImage->TexFormat->TexelBytes) {
/* use multi-byte upload scheme */
tex.height = imageHeight;
tex.width = imageWidth;

View File

@@ -69,7 +69,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
[ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f, R200_YUV_TO_RGB }
#define _INVALID(f) \
[ MESA_FORMAT_ ## f ] = { 0xffffffff, 0 }
#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_RGBA_DXT5) \
#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_RGBA_DXT5 \
|| ((f) >= MESA_FORMAT_RGBA_FLOAT32 && (f) <= MESA_FORMAT_INTENSITY_FLOAT16)) \
&& tx_table[f].flag )
#define _ASSIGN(entry, format) \
@@ -141,6 +142,18 @@ static const struct {
_ASSIGN(RGBA_DXT1, R300_EASY_TX_FORMAT(X, Y, Z, W, DXT1)),
_ASSIGN(RGBA_DXT3, R300_EASY_TX_FORMAT(X, Y, Z, W, DXT3)),
_ASSIGN(RGBA_DXT5, R300_EASY_TX_FORMAT(Y, Z, W, X, DXT5)),
_ASSIGN(RGBA_FLOAT32, R300_EASY_TX_FORMAT(Z, Y, X, W, FL_R32G32B32A32)),
_ASSIGN(RGBA_FLOAT16, R300_EASY_TX_FORMAT(Z, Y, X, W, FL_R16G16B16A16)),
_ASSIGN(RGB_FLOAT32, 0xffffffff),
_ASSIGN(RGB_FLOAT16, 0xffffffff),
_ASSIGN(ALPHA_FLOAT32, R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, FL_I32)),
_ASSIGN(ALPHA_FLOAT16, R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, FL_I16)),
_ASSIGN(LUMINANCE_FLOAT32, R300_EASY_TX_FORMAT(X, X, X, ONE, FL_I32)),
_ASSIGN(LUMINANCE_FLOAT16, R300_EASY_TX_FORMAT(X, X, X, ONE, FL_I16)),
_ASSIGN(LUMINANCE_ALPHA_FLOAT32, R300_EASY_TX_FORMAT(X, X, X, Y, FL_I32A32)),
_ASSIGN(LUMINANCE_ALPHA_FLOAT16, R300_EASY_TX_FORMAT(X, X, X, Y, FL_I16A16)),
_ASSIGN(INTENSITY_FLOAT32, R300_EASY_TX_FORMAT(X, X, X, X, FL_I32)),
_ASSIGN(INTENSITY_FLOAT16, R300_EASY_TX_FORMAT(X, X, X, X, FL_I16)),
};
#undef _COLOR
@@ -256,6 +269,7 @@ static void r300SetTexImages(r300ContextPtr rmesa,
}
else /* DXT3/5, 16 bytes per block */
{
WARN_ONCE("DXT 3/5 suffers from multitexturing problems!\n");
// fprintf(stderr,"DXT 3/5 %d\n", texImage->Width);
if ((texImage->Width + 3) < 8)
size = texImage->CompressedSize * 2;

View File

@@ -231,7 +231,7 @@ void radeonSwapBuffers(__DRIdrawablePrivate * dPriv)
if (radeon->doPageFlip) {
radeonPageFlip(dPriv);
} else {
radeonCopyBuffer(dPriv);
radeonCopyBuffer(dPriv, NULL);
}
}
} else {
@@ -241,6 +241,31 @@ void radeonSwapBuffers(__DRIdrawablePrivate * dPriv)
}
}
void radeonCopySubBuffer(__DRIdrawablePrivate * dPriv,
int x, int y, int w, int h )
{
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
radeonContextPtr radeon;
GLcontext *ctx;
radeon = (radeonContextPtr) dPriv->driContextPriv->driverPrivate;
ctx = radeon->glCtx;
if (ctx->Visual.doubleBufferMode) {
drm_clip_rect_t rect;
rect.x1 = x + dPriv->x;
rect.y1 = (dPriv->h - y - h) + dPriv->y;
rect.x2 = rect.x1 + w;
rect.y2 = rect.y1 + h;
_mesa_notifySwapBuffers(ctx); /* flush pending rendering comands */
radeonCopyBuffer(dPriv, &rect);
}
} else {
/* XXX this shouldn't be an error but we can't handle it for now */
_mesa_problem(NULL, "%s: drawable has no context!",
__FUNCTION__);
}
}
/* Force the context `c' to be the current context and associate with it
* buffer `b'.

View File

@@ -203,6 +203,8 @@ struct radeon_context {
#define RADEON_CONTEXT(glctx) ((radeonContextPtr)(ctx->DriverCtx))
extern void radeonSwapBuffers(__DRIdrawablePrivate * dPriv);
extern void radeonCopySubBuffer(__DRIdrawablePrivate * dPriv,
int x, int y, int w, int h);
extern GLboolean radeonInitContext(radeonContextPtr radeon,
struct dd_function_table* functions,
const __GLcontextModes * glVisual,

View File

@@ -81,6 +81,25 @@ static uint32_t radeonGetLastFrame(radeonContextPtr radeon)
return frame;
}
uint32_t radeonGetAge(radeonContextPtr radeon)
{
drm_radeon_getparam_t gp;
int ret;
uint32_t age;
gp.param = RADEON_PARAM_LAST_CLEAR;
gp.value = (int *)&age;
ret = drmCommandWriteRead(radeon->dri.fd, DRM_RADEON_GETPARAM,
&gp, sizeof(gp));
if (ret) {
fprintf(stderr, "%s: drmRadeonGetParam: %d\n", __FUNCTION__,
ret);
exit(1);
}
return age;
}
static void radeonEmitIrqLocked(radeonContextPtr radeon)
{
drm_radeon_irq_emit_t ie;
@@ -145,7 +164,8 @@ static void radeonWaitForFrameCompletion(radeonContextPtr radeon)
/* Copy the back color buffer to the front color buffer.
*/
void radeonCopyBuffer(const __DRIdrawablePrivate * dPriv)
void radeonCopyBuffer(const __DRIdrawablePrivate * dPriv,
const drm_clip_rect_t * rect)
{
radeonContextPtr radeon;
GLint nbox, i, ret;
@@ -174,10 +194,13 @@ void radeonCopyBuffer(const __DRIdrawablePrivate * dPriv)
* request at a time.
*/
radeonWaitForFrameCompletion(radeon);
UNLOCK_HARDWARE(radeon);
driWaitForVBlank(dPriv, &radeon->vbl_seq, radeon->vblank_flags,
&missed_target);
LOCK_HARDWARE(radeon);
if (!rect)
{
UNLOCK_HARDWARE(radeon);
driWaitForVBlank(dPriv, &radeon->vbl_seq, radeon->vblank_flags,
&missed_target);
LOCK_HARDWARE(radeon);
}
nbox = dPriv->numClipRects; /* must be in locked region */
@@ -187,9 +210,28 @@ void radeonCopyBuffer(const __DRIdrawablePrivate * dPriv)
drm_clip_rect_t *b = radeon->sarea->boxes;
GLint n = 0;
for (; i < nr; i++) {
*b++ = box[i];
n++;
for ( ; i < nr ; i++ ) {
*b = box[i];
if (rect)
{
if (rect->x1 > b->x1)
b->x1 = rect->x1;
if (rect->y1 > b->y1)
b->y1 = rect->y1;
if (rect->x2 < b->x2)
b->x2 = rect->x2;
if (rect->y2 < b->y2)
b->y2 = rect->y2;
if (b->x1 < b->x2 && b->y1 < b->y2)
b++;
}
else
b++;
n++;
}
radeon->sarea->nbox = n;
@@ -204,22 +246,24 @@ void radeonCopyBuffer(const __DRIdrawablePrivate * dPriv)
}
UNLOCK_HARDWARE(radeon);
if (IS_R200_CLASS(radeon->radeonScreen))
if (!rect)
{
if (IS_R200_CLASS(radeon->radeonScreen))
((r200ContextPtr)radeon)->hw.all_dirty = GL_TRUE;
else
else
((r300ContextPtr)radeon)->hw.all_dirty = GL_TRUE;
radeon->swap_count++;
(*dri_interface->getUST) (&ust);
if (missed_target) {
radeon->swap_count++;
(*dri_interface->getUST) (&ust);
if (missed_target) {
radeon->swap_missed_count++;
radeon->swap_missed_ust = ust - radeon->swap_ust;
}
radeon->swap_ust = ust;
sched_yield();
}
radeon->swap_ust = ust;
sched_yield();
}
void radeonPageFlip(const __DRIdrawablePrivate * dPriv)

View File

@@ -44,10 +44,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r200_context.h"
#include "radeon_drm.h"
extern void radeonCopyBuffer(const __DRIdrawablePrivate * drawable);
extern void radeonCopyBuffer(const __DRIdrawablePrivate * drawable,
const drm_clip_rect_t * rect);
extern void radeonPageFlip(const __DRIdrawablePrivate * drawable);
extern void radeonFlush(GLcontext * ctx);
extern void radeonFinish(GLcontext * ctx);
extern void radeonWaitForIdleLocked(radeonContextPtr radeon);
extern uint32_t radeonGetAge(radeonContextPtr radeon);
#endif /* __RADEON_IOCTL_H__ */

View File

@@ -35,21 +35,43 @@
#include "r300_cmdbuf.h"
#include "r300_ioctl.h"
#include "radeon_mm.h"
#include "radeon_ioctl.h"
#ifdef USER_BUFFERS
static void resize_u_list(r300ContextPtr rmesa)
{
void *temp;
int nsize;
temp = rmesa->rmm->u_list;
nsize = rmesa->rmm->u_size * 2;
rmesa->rmm->u_list = _mesa_malloc(nsize * sizeof(*rmesa->rmm->u_list));
_mesa_memset(rmesa->rmm->u_list, 0, nsize * sizeof(*rmesa->rmm->u_list));
if (temp) {
r300FlushCmdBuf(rmesa, __FUNCTION__);
_mesa_memcpy(rmesa->rmm->u_list, temp, rmesa->rmm->u_size * sizeof(*rmesa->rmm->u_list));
_mesa_free(temp);
}
rmesa->rmm->u_size = nsize;
}
void radeon_mm_init(r300ContextPtr rmesa)
{
rmesa->rmm = malloc(sizeof(struct radeon_memory_manager));
memset(rmesa->rmm, 0, sizeof(struct radeon_memory_manager));
rmesa->rmm->u_size = 512*8; //2048;
rmesa->rmm->u_list = malloc(rmesa->rmm->u_size *sizeof(*rmesa->rmm->u_list));
memset(rmesa->rmm->u_list, 0, rmesa->rmm->u_size*sizeof(*rmesa->rmm->u_list));
rmesa->rmm->u_size = 128;
resize_u_list(rmesa);
}
void *radeon_mm_ptr(r300ContextPtr rmesa, int id)
{
assert(id <= rmesa->rmm->u_last);
return rmesa->rmm->u_list[id].ptr;
}
@@ -98,7 +120,10 @@ int radeon_mm_alloc(r300ContextPtr rmesa, int alignment, int size)
again:
done_age = rmesa->radeon.radeonScreen->scratch[RADEON_MM_SCRATCH];
done_age = radeonGetAge((radeonContextPtr)rmesa);
if (rmesa->rmm->u_last + 1 >= rmesa->rmm->u_size)
resize_u_list(rmesa);
for (i = rmesa->rmm->u_last + 1; i > 0; i --) {
if (rmesa->rmm->u_list[i].ptr == NULL) {
@@ -120,7 +145,7 @@ int radeon_mm_alloc(r300ContextPtr rmesa, int alignment, int size)
exit(1);
} else {
#ifdef MM_DEBUG
fprintf(stderr, "really freed %d at age %x\n", i, rmesa->radeon.radeonScreen->scratch[RADEON_MM_SCRATCH]);
fprintf(stderr, "really freed %d at age %x\n", i, radeonGetAge((radeonContextPtr)rmesa));
#endif
if (i == rmesa->rmm->u_last)
rmesa->rmm->u_last --;
@@ -196,7 +221,7 @@ int radeon_mm_alloc(r300ContextPtr rmesa, int alignment, int size)
//fprintf(stderr, "alloc %p at id %d\n", rmesa->rmm->u_list[i].ptr, i);
#ifdef MM_DEBUG
fprintf(stderr, "allocated %d at age %x\n", i, rmesa->radeon.radeonScreen->scratch[RADEON_MM_SCRATCH]);
fprintf(stderr, "allocated %d at age %x\n", i, radeonGetAge((radeonContextPtr)rmesa));
#endif
return i;
@@ -261,10 +286,12 @@ void radeon_mm_use(r300ContextPtr rmesa, int id)
{
uint64_t ull;
#ifdef MM_DEBUG
fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, rmesa->radeon.radeonScreen->scratch[RADEON_MM_SCRATCH]);
fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, radeonGetAge((radeonContextPtr)rmesa));
#endif
drm_r300_cmd_header_t *cmd;
assert(id <= rmesa->rmm->u_last);
if(id == 0)
return;
@@ -323,6 +350,8 @@ unsigned long radeon_mm_offset(r300ContextPtr rmesa, int id)
{
unsigned long offset;
assert(id <= rmesa->rmm->u_last);
if (rmesa->rmm->u_list[id].fb) {
offset = rmesa->radeon.radeonScreen->texOffset[0] + rmesa->rmm->u_list[id].fb->ofs;
} else {
@@ -336,6 +365,8 @@ unsigned long radeon_mm_offset(r300ContextPtr rmesa, int id)
int radeon_mm_on_card(r300ContextPtr rmesa, int id)
{
assert(id <= rmesa->rmm->u_last);
if (rmesa->rmm->u_list[id].fb)
return GL_TRUE;
@@ -345,11 +376,13 @@ int radeon_mm_on_card(r300ContextPtr rmesa, int id)
void *radeon_mm_map(r300ContextPtr rmesa, int id, int access)
{
#ifdef MM_DEBUG
fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, rmesa->radeon.radeonScreen->scratch[RADEON_MM_SCRATCH]);
fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, radeonGetAge((radeonContextPtr)rmesa));
#endif
void *ptr;
int tries = 0;
assert(id <= rmesa->rmm->u_last);
rmesa->rmm->u_list[id].ref_count = 0;
if (rmesa->rmm->u_list[id].fb) {
WARN_ONCE("Mapping fb!\n");
@@ -385,12 +418,12 @@ void *radeon_mm_map(r300ContextPtr rmesa, int id, int access)
return NULL;
}
while(rmesa->rmm->u_list[id].age > rmesa->radeon.radeonScreen->scratch[RADEON_MM_SCRATCH] && tries++ < 1000)
while(rmesa->rmm->u_list[id].age > radeonGetAge((radeonContextPtr)rmesa) && tries++ < 1000)
usleep(10);
if (tries >= 1000) {
fprintf(stderr, "Idling failed (%x vs %x)\n",
rmesa->rmm->u_list[id].age, rmesa->radeon.radeonScreen->scratch[RADEON_MM_SCRATCH]);
rmesa->rmm->u_list[id].age, radeonGetAge((radeonContextPtr)rmesa));
return NULL;
}
@@ -406,9 +439,11 @@ void *radeon_mm_map(r300ContextPtr rmesa, int id, int access)
void radeon_mm_unmap(r300ContextPtr rmesa, int id)
{
#ifdef MM_DEBUG
fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, rmesa->radeon.radeonScreen->scratch[RADEON_MM_SCRATCH]);
fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, radeonGetAge((radeonContextPtr)rmesa));
#endif
assert(id <= rmesa->rmm->u_last);
if(rmesa->rmm->u_list[id].mapped == 0)
WARN_ONCE("buffer %d not mapped\n", id);
@@ -423,9 +458,11 @@ void radeon_mm_unmap(r300ContextPtr rmesa, int id)
void radeon_mm_free(r300ContextPtr rmesa, int id)
{
#ifdef MM_DEBUG
fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, rmesa->radeon.radeonScreen->scratch[RADEON_MM_SCRATCH]);
fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, radeonGetAge((radeonContextPtr)rmesa));
#endif
assert(id <= rmesa->rmm->u_last);
if(id == 0)
return;

View File

@@ -70,7 +70,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define need_GL_EXT_secondary_color
#include "extension_helper.h"
#define DRIVER_DATE "20051013"
#define DRIVER_DATE "20060327"
#include "vblank.h"
#include "utils.h"
@@ -572,7 +572,7 @@ radeonSwapBuffers( __DRIdrawablePrivate *dPriv )
radeonPageFlip( dPriv );
}
else {
radeonCopyBuffer( dPriv );
radeonCopyBuffer( dPriv, NULL );
}
}
}
@@ -582,6 +582,31 @@ radeonSwapBuffers( __DRIdrawablePrivate *dPriv )
}
}
void radeonCopySubBuffer(__DRIdrawablePrivate * dPriv,
int x, int y, int w, int h )
{
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
radeonContextPtr radeon;
GLcontext *ctx;
radeon = (radeonContextPtr) dPriv->driContextPriv->driverPrivate;
ctx = radeon->glCtx;
if (ctx->Visual.doubleBufferMode) {
drm_clip_rect_t rect;
rect.x1 = x + dPriv->x;
rect.y1 = (dPriv->h - y - h) + dPriv->y;
rect.x2 = rect.x1 + w;
rect.y2 = rect.y1 + h;
_mesa_notifySwapBuffers(ctx); /* flush pending rendering comands */
radeonCopyBuffer(dPriv, &rect);
}
} else {
/* XXX this shouldn't be an error but we can't handle it for now */
_mesa_problem(NULL, "%s: drawable has no context!",
__FUNCTION__);
}
}
/* Make context `c' the current context and bind it to the given
* drawing and reading surfaces.

View File

@@ -52,6 +52,10 @@ struct radeon_context;
typedef struct radeon_context radeonContextRec;
typedef struct radeon_context *radeonContextPtr;
/* This union is used to avoid warnings/miscompilation
with float to uint32_t casts due to strict-aliasing */
typedef union { GLfloat f; uint32_t ui32; } float_ui32_type;
#include "radeon_lock.h"
#include "radeon_screen.h"
#include "mm.h"
@@ -846,6 +850,8 @@ extern GLboolean radeonCreateContext(const __GLcontextModes *glVisual,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate);
extern void radeonSwapBuffers( __DRIdrawablePrivate *dPriv );
extern void radeonCopySubBuffer(__DRIdrawablePrivate * dPriv,
int x, int y, int w, int h);
extern GLboolean radeonMakeCurrent( __DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawPriv,
__DRIdrawablePrivate *driReadPriv );

View File

@@ -875,7 +875,8 @@ static void radeonWaitForFrameCompletion( radeonContextPtr rmesa )
/* Copy the back color buffer to the front color buffer.
*/
void radeonCopyBuffer( const __DRIdrawablePrivate *dPriv )
void radeonCopyBuffer( const __DRIdrawablePrivate *dPriv,
const drm_clip_rect_t *rect)
{
radeonContextPtr rmesa;
GLint nbox, i, ret;
@@ -899,9 +900,12 @@ void radeonCopyBuffer( const __DRIdrawablePrivate *dPriv )
* request at a time.
*/
radeonWaitForFrameCompletion( rmesa );
UNLOCK_HARDWARE( rmesa );
driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target );
LOCK_HARDWARE( rmesa );
if (!rect)
{
UNLOCK_HARDWARE( rmesa );
driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target );
LOCK_HARDWARE( rmesa );
}
nbox = dPriv->numClipRects; /* must be in locked region */
@@ -912,8 +916,27 @@ void radeonCopyBuffer( const __DRIdrawablePrivate *dPriv )
GLint n = 0;
for ( ; i < nr ; i++ ) {
*b++ = box[i];
n++;
*b = box[i];
if (rect)
{
if (rect->x1 > b->x1)
b->x1 = rect->x1;
if (rect->y1 > b->y1)
b->y1 = rect->y1;
if (rect->x2 < b->x2)
b->x2 = rect->x2;
if (rect->y2 < b->y2)
b->y2 = rect->y2;
if (b->x1 < b->x2 && b->y1 < b->y2)
b++;
}
else
b++;
n++;
}
rmesa->sarea->nbox = n;
@@ -927,15 +950,18 @@ void radeonCopyBuffer( const __DRIdrawablePrivate *dPriv )
}
UNLOCK_HARDWARE( rmesa );
rmesa->swap_count++;
(*dri_interface->getUST)( & ust );
if ( missed_target ) {
rmesa->swap_missed_count++;
rmesa->swap_missed_ust = ust - rmesa->swap_ust;
}
if (!rect)
{
rmesa->swap_count++;
(*dri_interface->getUST)( & ust );
if ( missed_target ) {
rmesa->swap_missed_count++;
rmesa->swap_missed_ust = ust - rmesa->swap_ust;
}
rmesa->swap_ust = ust;
rmesa->hw.all_dirty = GL_TRUE;
rmesa->swap_ust = ust;
rmesa->hw.all_dirty = GL_TRUE;
}
}
void radeonPageFlip( const __DRIdrawablePrivate *dPriv )

View File

@@ -87,7 +87,8 @@ extern void radeonReleaseDmaRegion( radeonContextPtr rmesa,
struct radeon_dma_region *region,
const char *caller );
extern void radeonCopyBuffer( const __DRIdrawablePrivate *drawable );
extern void radeonCopyBuffer( const __DRIdrawablePrivate *drawable,
const drm_clip_rect_t *rect);
extern void radeonPageFlip( const __DRIdrawablePrivate *drawable );
extern void radeonFlush( GLcontext *ctx );
extern void radeonFinish( GLcontext *ctx );

View File

@@ -487,9 +487,11 @@ static int print_float_reg_assignment( struct reg *reg, float data )
static int print_reg_assignment( struct reg *reg, int data )
{
float_ui32_type datau;
datau.ui32 = data;
reg->flags |= TOUCHED;
if (reg->flags & ISFLOAT)
return print_float_reg_assignment( reg, *(float *)&data );
return print_float_reg_assignment( reg, datau.f );
else
return print_int_reg_assignment( reg, data );
}

View File

@@ -76,7 +76,7 @@ DRI_CONF_BEGIN
DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN)
DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
DRI_CONF_MAX_TEXTURE_UNITS(2,2,3)
DRI_CONF_MAX_TEXTURE_UNITS(3,2,3)
DRI_CONF_HYPERZ(false)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_QUALITY
@@ -87,7 +87,7 @@ DRI_CONF_BEGIN
DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
DRI_CONF_ALLOW_LARGE_TEXTURES(0)
DRI_CONF_ALLOW_LARGE_TEXTURES(1)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_DEBUG
DRI_CONF_NO_RAST(false)
@@ -103,7 +103,7 @@ DRI_CONF_BEGIN
DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN)
DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
DRI_CONF_MAX_TEXTURE_UNITS(4,2,6)
DRI_CONF_MAX_TEXTURE_UNITS(6,2,6)
DRI_CONF_HYPERZ(false)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_QUALITY
@@ -114,7 +114,7 @@ DRI_CONF_BEGIN
DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
DRI_CONF_ALLOW_LARGE_TEXTURES(0)
DRI_CONF_ALLOW_LARGE_TEXTURES(1)
DRI_CONF_TEXTURE_BLEND_QUALITY(1.0,"0.0:1.0")
DRI_CONF_SECTION_END
DRI_CONF_SECTION_DEBUG
@@ -637,6 +637,14 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
dri_priv->deviceID);
return NULL;
}
if (screen->chip_family == CHIP_FAMILY_R350 ||
screen->chip_family == CHIP_FAMILY_R300) {
if (getenv("R300_FORCE_R300") == NULL) {
fprintf(stderr, "Radeon 9500/9700/9800 cards are not currently stable.\n");
fprintf(stderr, "More details can be found at https://bugs.freedesktop.org/show_bug.cgi?id=6318\n");
return NULL;
}
}
if (screen->chip_family <= CHIP_FAMILY_RS200)
screen->chip_flags |= RADEON_CLASS_R100;
@@ -708,6 +716,8 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
(*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
if (IS_R200_CLASS(screen))
(*glx_enable_extension)( psc, "GLX_MESA_allocate_memory" );
(*glx_enable_extension)( psc, "GLX_MESA_copy_sub_buffer" );
}
#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200)
@@ -915,7 +925,8 @@ static struct __DriverAPIRec radeonAPI = {
.GetMSC = driGetMSC32,
.WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL,
.SwapBuffersMSC = NULL
.SwapBuffersMSC = NULL,
.CopySubBuffer = radeonCopySubBuffer,
};
#else
static const struct __DriverAPIRec r200API = {
@@ -932,7 +943,8 @@ static const struct __DriverAPIRec r200API = {
.GetMSC = driGetMSC32,
.WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL,
.SwapBuffersMSC = NULL
.SwapBuffersMSC = NULL,
.CopySubBuffer = r200CopySubBuffer
};
#endif

View File

@@ -624,11 +624,12 @@ static void radeonPolygonOffset( GLcontext *ctx,
GLfloat factor, GLfloat units )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat constant = units * rmesa->state.depth.scale;
float_ui32_type constant = { units * rmesa->state.depth.scale };
float_ui32_type factoru = { factor };
RADEON_STATECHANGE( rmesa, zbs );
rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_FACTOR] = *(GLuint *)&factor;
rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_CONSTANT] = *(GLuint *)&constant;
rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_FACTOR] = factoru.ui32;
rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_CONSTANT] = constant.ui32;
}
static void radeonPolygonStipple( GLcontext *ctx, const GLubyte *mask )
@@ -1486,21 +1487,22 @@ void radeonUpdateWindow( GLcontext *ctx )
GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h;
const GLfloat *v = ctx->Viewport._WindowMap.m;
GLfloat sx = v[MAT_SX];
GLfloat tx = v[MAT_TX] + xoffset + SUBPIXEL_X;
GLfloat sy = - v[MAT_SY];
GLfloat ty = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y;
GLfloat sz = v[MAT_SZ] * rmesa->state.depth.scale;
GLfloat tz = v[MAT_TZ] * rmesa->state.depth.scale;
float_ui32_type sx = { v[MAT_SX] };
float_ui32_type tx = { v[MAT_TX] + xoffset + SUBPIXEL_X };
float_ui32_type sy = { - v[MAT_SY] };
float_ui32_type ty = { (- v[MAT_TY]) + yoffset + SUBPIXEL_Y };
float_ui32_type sz = { v[MAT_SZ] * rmesa->state.depth.scale };
float_ui32_type tz = { v[MAT_TZ] * rmesa->state.depth.scale };
RADEON_FIREVERTICES( rmesa );
RADEON_STATECHANGE( rmesa, vpt );
rmesa->hw.vpt.cmd[VPT_SE_VPORT_XSCALE] = *(GLuint *)&sx;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = *(GLuint *)&tx;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_YSCALE] = *(GLuint *)&sy;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = *(GLuint *)&ty;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZSCALE] = *(GLuint *)&sz;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZOFFSET] = *(GLuint *)&tz;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_XSCALE] = sx.ui32;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = tx.ui32;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_YSCALE] = sy.ui32;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = ty.ui32;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZSCALE] = sz.ui32;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZOFFSET] = tz.ui32;
}
@@ -1528,18 +1530,22 @@ void radeonUpdateViewportOffset( GLcontext *ctx )
GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h;
const GLfloat *v = ctx->Viewport._WindowMap.m;
GLfloat tx = v[MAT_TX] + xoffset + SUBPIXEL_X;
GLfloat ty = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y;
float_ui32_type tx;
float_ui32_type ty;
if ( rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] != *(GLuint *)&tx ||
rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] != *(GLuint *)&ty )
tx.f = v[MAT_TX] + xoffset + SUBPIXEL_X;
ty.f = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y;
if ( rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] != tx.ui32 ||
rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] != ty.ui32 )
{
/* Note: this should also modify whatever data the context reset
* code uses...
*/
rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = *(GLuint *)&tx;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = *(GLuint *)&ty;
RADEON_STATECHANGE( rmesa, vpt );
rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = tx.ui32;
rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = ty.ui32;
/* update polygon stipple x/y screen offset */
{
GLuint stx, sty;

View File

@@ -235,7 +235,7 @@ get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height )
#define SPAN_VARS \
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
#define INIT_PIXEL_PTR(P, X, Y) \
GLchan *P = osmesa->rowaddr[Y] + 4 * (X)
GLchan *P = osmesa->rowaddr[Y] + 3 * (X)
#define INC_PIXEL_PTR(P) P += 3
#define STORE_PIXEL(DST, X, Y, VALUE) \
DST[0] = VALUE[RCOMP]; \
@@ -254,7 +254,7 @@ get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height )
#define SPAN_VARS \
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
#define INIT_PIXEL_PTR(P, X, Y) \
GLchan *P = osmesa->rowaddr[Y] + 4 * (X)
GLchan *P = osmesa->rowaddr[Y] + 3 * (X)
#define INC_PIXEL_PTR(P) P += 3
#define STORE_PIXEL(DST, X, Y, VALUE) \
DST[2] = VALUE[RCOMP]; \
@@ -601,6 +601,7 @@ osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
{
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
/* Note: we can ignoring internalFormat for "window-system" renderbuffers */
if (osmesa->format == OSMESA_RGBA) {
rb->GetRow = get_row_RGBA;
rb->GetValues = get_values_RGBA;
@@ -609,6 +610,10 @@ osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
rb->PutMonoRow = put_mono_row_RGBA;
rb->PutValues = put_values_RGBA;
rb->PutMonoValues = put_mono_values_RGBA;
rb->RedBits =
rb->GreenBits =
rb->BlueBits =
rb->AlphaBits = 8 * sizeof(GLchan);
}
else if (osmesa->format == OSMESA_BGRA) {
rb->GetRow = get_row_BGRA;
@@ -618,6 +623,10 @@ osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
rb->PutMonoRow = put_mono_row_BGRA;
rb->PutValues = put_values_BGRA;
rb->PutMonoValues = put_mono_values_BGRA;
rb->RedBits =
rb->GreenBits =
rb->BlueBits =
rb->AlphaBits = 8 * sizeof(GLchan);
}
else if (osmesa->format == OSMESA_ARGB) {
rb->GetRow = get_row_ARGB;
@@ -627,6 +636,10 @@ osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
rb->PutMonoRow = put_mono_row_ARGB;
rb->PutValues = put_values_ARGB;
rb->PutMonoValues = put_mono_values_ARGB;
rb->RedBits =
rb->GreenBits =
rb->BlueBits =
rb->AlphaBits = 8 * sizeof(GLchan);
}
else if (osmesa->format == OSMESA_RGB) {
rb->GetRow = get_row_RGB;
@@ -636,6 +649,9 @@ osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
rb->PutMonoRow = put_mono_row_RGB;
rb->PutValues = put_values_RGB;
rb->PutMonoValues = put_mono_values_RGB;
rb->RedBits =
rb->GreenBits =
rb->BlueBits = 8 * sizeof(GLchan);
}
else if (osmesa->format == OSMESA_BGR) {
rb->GetRow = get_row_BGR;
@@ -645,16 +661,22 @@ osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
rb->PutMonoRow = put_mono_row_BGR;
rb->PutValues = put_values_BGR;
rb->PutMonoValues = put_mono_values_BGR;
rb->RedBits =
rb->GreenBits =
rb->BlueBits = 8 * sizeof(GLchan);
}
#if CHAN_TYPE == GL_UNSIGNED_BYTE
else if (osmesa->format == OSMESA_RGB_565) {
rb->GetRow = get_row_RGB_565;
rb->GetValues = get_values_RGB_565;
rb->PutRow = put_row_RGB_565;
rb->PutRow = put_row_rgb_RGB_565;
rb->PutRowRGB = put_row_rgb_RGB_565;
rb->PutMonoRow = put_mono_row_RGB_565;
rb->PutValues = put_values_RGB_565;
rb->PutMonoValues = put_mono_values_RGB_565;
rb->RedBits = 5;
rb->GreenBits = 6;
rb->BlueBits = 5;
}
#endif
else if (osmesa->format == OSMESA_COLOR_INDEX) {
@@ -664,6 +686,7 @@ osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
rb->PutMonoRow = put_mono_row_CI;
rb->PutValues = put_values_CI;
rb->PutMonoValues = put_mono_values_CI;
rb->IndexBits = 8;
}
else {
_mesa_problem(ctx, "bad pixel format in osmesa renderbuffer_storage");

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