Compare commits

...

427 Commits

Author SHA1 Message Date
Brian Paul
2f1b5ffcda mesa: remove debug code 2008-07-08 16:52:45 -06:00
Brian Paul
e4d9cc94b8 add yet another Makefile 2008-07-08 16:28:33 -06:00
Brian Paul
ee2a101123 bump version to rc3 2008-07-08 16:26:28 -06:00
Brian Paul
7d3feef9d6 added more Makefiles to file list 2008-07-08 16:26:06 -06:00
Brian Paul
2be54a8e8c mesa: implement glGetUniformiv() with new ctx->Driver function
The old implementation could overwrite the caller's param buffer.
2008-07-08 16:17:04 -06:00
Brian Paul
44029f15a8 added src/mesa/drivers/Makefile to file list 2008-07-08 16:16:57 -06:00
Brian Paul
6fe7857629 mesa: bump version to rc2 2008-07-08 15:12:48 -06:00
Brian Paul
c71fa34728 added null texObj ptr check (bug 15567) 2008-07-08 15:11:53 -06:00
Brian Paul
fd6cb1b11d mesa: more debug output 2008-07-08 15:11:53 -06:00
Brian Paul
d14b7890a4 mesa: compute global var size before doing codegen 2008-07-08 15:11:53 -06:00
Brian Paul
477d597df6 mesa: add missing VARYING case to storage_string() 2008-07-08 15:11:53 -06:00
Xiang, Haihao
92c075eeb7 i965: official name for GM45 chipset 2008-07-08 14:14:04 +08:00
George Sapountzis
a36bf890e8 glx: add LIBGL_ALWAYS_SOFTWARE
this disables accelerated DRI and fallbacks to client-side software rendering.

compile-tested only.
2008-07-07 18:34:17 +03:00
Dan Nicholson
e6e4f25aa5 autoconf: Allow commas or spaces to separate DRI drivers
Explicitly allow the argument to --with-dri-drivers to contain
comma-separated or space-separated drivers. A space-separated driver
list worked by chance before.
2008-07-06 14:17:54 -07:00
Dan Nicholson
11ac5b2456 Set library and header installation directories from configuration
Currently the installation directories for libraries and headers are
resolved within the install commands. For instance, the libraries will
be installed to $(INSTALL_DIR)/$(LIB_DIR). This limits the flexibility
of the installation, such as when the libraries should be installed to a
subdirectory like /usr/lib/tls.

This adds the make variables $(INSTALL_LIB_DIR) and $(INSTALL_INC_DIR)
to define the locations that the libraries and headers are installed.
For the static configs, this resolves exactly as before to
$(INSTALL_DIR)/include and $(INSTALL_DIR)/$(LIB_DIR). For autoconf, they
are derived directly from the --libdir and --includedir settings.
2008-07-06 14:15:40 -07:00
Nicolai Haehnle
056689d457 r500_fragprog: Fix RSQ with negative parameters 2008-07-06 16:39:31 +02:00
Nicolai Haehnle
2b2cb56656 r300_fragprog: Emulate trigonometric functions in radeon_program_alu 2008-07-06 10:00:35 +02:00
Nicolai Haehnle
4746752f16 r300: Translate fragment program DST in radeon_program_alu 2008-07-06 10:00:35 +02:00
Nicolai Haehnle
03abd021f2 r300: Translate fragment program LRP in radeon_program_alu.c 2008-07-06 10:00:35 +02:00
Nicolai Haehnle
62bccd6df0 r300: Allow adding parameters during fragprog transform, share LIT code 2008-07-06 09:59:43 +02:00
Nicolai Haehnle
77fdfaa23a r300: Correctly scan for used temporary registers
This fixes a regression introduced by dea8719f0...
2008-07-05 20:01:20 +02:00
Nicolai Haehnle
364d45a3e1 r500: Major refactoring of fragment program emit
Use the common facilities to convert non-native instructions into native ones.
Worked hard to make the code easier to read (hopefully), by using helper
functions instead of direct manipulation of the machine code.
Fixes two bugs related to FLR and XPD.
2008-07-05 18:04:10 +02:00
Nicolai Haehnle
dea8719f00 r300: Remove clause stuff for now in favour of a cloned generic gl_program 2008-07-05 18:04:10 +02:00
Nicolai Haehnle
85b46fbe9c r500_fragprog: Cleanup some unused variables and code. 2008-07-05 18:04:10 +02:00
Nicolai Haehnle
13c44679ad r500: Fix a mixup in fragment program LRP instruction emit 2008-07-05 18:04:10 +02:00
Nicolai Haehnle
09e587fcf3 r500: Fix blend color. 2008-07-05 18:04:09 +02:00
Nicolai Haehnle
82635aad42 _mesa_clone_program: Copy ShadowSamplers 2008-07-05 18:04:04 +02:00
Nicolai Haehnle
e187627c1d r300: Fix depth texture in compare mode
Missed the homogenous divide of R by Q before...
2008-07-04 18:22:16 +02:00
Nicolai Haehnle
845e3f701d Enable TexGen based on InputsRead when a fragment program is active
The old behaviour depended on which texture images the fragment program
reads from, which seems to contradict the shader specifications.

Note: Piglit's general/texgen test checks for this problem.
2008-07-04 18:22:15 +02:00
Brian Paul
1f4d0748ba GLSL-related bug fixes 2008-07-04 10:05:39 -06:00
Brian Paul
e06565b103 mesa: generate GL_INVALID_OPERATION in _mesa_get_uniform_location() if program isn't linked 2008-07-04 10:04:03 -06:00
Brian Paul
b931a0c1d9 mesa: remove incorrect assertion 2008-07-04 10:04:03 -06:00
Alan Hourihane
9157b1e09a glcontextmodes.c is required remove the reference in .gitignore 2008-07-04 13:54:49 +01:00
Xiang, Haihao
0c1e96e6d3 mesa: fix polygon offset issue (bug #12061) 2008-07-04 09:53:51 +08:00
Brian Paul
530df581dd mesa: fix various error codes 2008-07-03 16:21:11 -06:00
Brian Paul
011185396b mesa: fix some error codes in _mesa_ShaderSourceARB() 2008-07-03 16:02:05 -06:00
Brian Paul
3dc6591a7c mesa: fix problem freeing framebuffer/renderbuffer objects
Basically, set up no-op Delete() methods for the DummyFrame/Renderbuffer objects.
2008-07-03 15:40:38 -06:00
Brian Paul
7acb7c1ac0 mesa: additional error checking, fix error codes 2008-07-03 13:49:48 -06:00
Brian Paul
d866cb3712 mesa: regenerated file 2008-07-03 13:24:28 -06:00
Brian Paul
7f4f2ac39d mesa: additional vec4 constructor 2008-07-03 13:24:19 -06:00
Brian Paul
6e46c121f9 mesa: fix array storage allocation bug 2008-07-03 13:05:28 -06:00
Brian Paul
1dc20c7916 mesa: fix incorrect array size, added assertion 2008-07-03 13:03:35 -06:00
Brian Paul
b3e1f9bd52 mesa: fix vertex array validation test for attribute 0 (vert pos)
We don't actually need vertex array[0] enabled when using a vertex
program/shader.
2008-07-02 19:17:11 -06:00
Brian Paul
1726b7d1d3 mesa: when linking a shader program, make sure all the shaders compiled OK 2008-07-02 16:51:49 -06:00
Brian Paul
cb79c5c7c6 mesa: added some debug code (disabled) 2008-07-02 16:50:52 -06:00
Brian Paul
36a5826411 mesa: fix error codes in _mesa_shader_source(), _mesa_get_shader_source()
If the 'shader' parameter is wrong, need to either generate GL_INVALID_VALUE
or GL_INVALID_OPERATION.  It depends on whether 'shader' actually names a
'program' or is a totally unknown ID.
There might be other cases to fix...
2008-07-02 16:40:24 -06:00
Brian Paul
a405d69063 mesa: regenerated 2008-07-02 16:39:48 -06:00
Brian Paul
a2cddf58d2 mesa: added some missing equal() notEqual() intrinsics 2008-07-02 16:39:26 -06:00
Brian Paul
918f3b17e5 mesa: regenerated files 2008-07-02 12:38:48 -06:00
Brian Paul
18adc71822 mesa: fix all(bvec2) function typo, add missing bvec2/3/4() constuctors 2008-07-02 12:38:48 -06:00
Roland Scheidegger
5ef4e4ffb8 mesa: fix issues around multisample enable
multisample enable is enabled by default, however gl mandates multisample
rendering rules only apply if there's also a multisampled buffer.
2008-07-02 20:21:06 +02:00
Brian Paul
6befdca6a3 generate a link error if the vertex shader references too many textures 2008-07-02 09:16:10 -06:00
Brian Paul
43346fb1fb set ctx->Const.MaxVertexTextureImageUnits = 0
This disallows vertex shader texture sampling.  See bugs 16157, 13838.
2008-07-02 09:14:53 -06:00
Ian Romanick
ea190fe050 VBO: Regenerate files based on recent changes to gl_API.xml
Since GL_ARB_vertex_buffer_object protocol isn't supported yet, these
changes are innocuous.
2008-07-02 06:26:11 -07:00
Paulo Cesar Pereira de Andrade
abd71144f0 Bring over commit 8d4d0b47a07a298a20ffae9fefe96c8c7ca9dccc from xserver tree 2008-07-02 06:22:47 -07:00
Ian Romanick
21e0d47514 VBO: Add missing functions related to VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 2008-07-01 19:30:32 -07:00
Ian Romanick
c52d6ad465 VBO: add GLX related annotations 2008-07-01 18:20:21 -07:00
Brian Paul
028739faed mesa: fix a GLSL vector subscript/writemask bug
This fixes a failure for cases like:
   vec4 v;
   v[1] *= 2.0;

The v[1] actually acts like a writemask, equivalent to v.y
The fix is a bit convoluted, but will do for now.
2008-07-01 17:59:07 -06:00
Brian Paul
e19af171cf mesa: move some functions 2008-07-01 17:52:31 -06:00
Brian Paul
9ae4d778d8 mesa: make _slang_swizzle_swizzle() non-private 2008-07-01 17:50:14 -06:00
Brian Paul
32a5c40336 mesa: better function inlining in the presence of 'return' statements
Before, the presence of a 'return' statement always prevented inlining
a function.  This was because we didn't want to accidentally return from
the _calling_ function.  We still need the semantic of 'return' when inlining
but we can't always use unconditional branches/jumps (GPUs don't always
support arbitrary branching).

Now, we allow inlining functions w/ return if the return is the last
statement in the function.  This fixes the common case of a function
that returns a value, such as:

vec4 square(const in vec4 x)
{
   return x * x;
}

which effectively compiles into:

vec4 square(const in vec4 x)
{
   __retVal = x * x;
   return;
}

The 'return' can be no-op'd now and we can inline the function.
2008-07-01 11:41:21 -06:00
Brian Paul
b2247c7d29 mesa: add/fix some IrInfo entries for debugging purposes 2008-07-01 11:41:02 -06:00
Brian Paul
011b0e51e4 link to DRM 2.3.1 2008-07-01 09:02:10 -06:00
Brian Paul
2ce4b985a5 press 'm' to toggle multisample enable/disable 2008-07-01 08:49:12 -06:00
Brian Paul
634d2af2b0 init machine->Samplers (fixes vertex program texture fetches) 2008-07-01 08:49:12 -06:00
Dave Airlie
d3f7b463c3 dri: drop asserts to make build against stable libdrm
These asserts are of questionable use at the moment with things in flux.
2008-07-01 18:22:12 +10:00
Xiang, Haihao
bcc2a3d7e3 dri: Take the base image size into account when computing
first level of the mipmap.  fix #16210
2008-07-01 11:50:50 +08:00
Dan Nicholson
5cae1b747b autoconf: Improve the visibility of the swrast DRI driver
Improve the --with-dri-drivers help text so that users are aware that
they should install the swrast DRI driver.
2008-06-30 11:16:09 -07:00
Corbin Simpson
bb1744970d r3xx/r5xx: Enable ARB_point_parameters.
This isn't complete yet. It does cover the two most common usage cases,
though, and at least the third one (POINT_DISTANCE_ATTENUATION) is possible,
so I'll do that later.
2008-06-30 11:12:51 -07:00
Nicolai Haehnle
23e9b43ce4 r300: Fix dumb mistake in LOD bias translation 2008-06-30 08:37:37 +02:00
Nicolai Haehnle
4002b75e62 r300: Cleanup LodBias support
. There is both a per-texture unit and a per-texture object (at least for
OpenGL 1.4); this should now be supported properly.
. The LOD bias calculation in r300_state has been simplified and corrected
  (need to multiply by 32 instead of 31, and ensure clamping)
. do not clamp LOD bias in TexEnv, as that behaviour conflicts with what
  the spec says
. set Const.MaxTextureLodBias properly
. remove the no_neg_lod_bias property; if somebody can explain what
  it's good for, we can add it back in, but according to Google, nobody
  seems to use it
. removed some dead code and unused variables
2008-06-30 00:49:00 +02:00
Corbin Simpson
a74d22ba71 r300: Change LOD bias emission to more closely follow per-tex rules.
Okay, this time it's for real, and for good. This should be a perma-fix.
2008-06-29 10:32:19 -07:00
Corbin Simpson
543893eefd Revert accidental edit to progs/demos/lodbias.
*puts yet another paper bag over head*
2008-06-29 10:32:19 -07:00
Nicolai Haehnle
0918023c28 demos/shadowtex: Don't set TEXTURE_WRAP_T for 1D texture
The operation doesn't really make sense. It triggered a bug in the r300 DRI
driver (and possibly other drivers that simulate 1D textures via 2D textures).
I've added an isolated test case for this bug to Piglit, so everybody wins.
2008-06-29 17:34:14 +02:00
Nicolai Haehnle
bc775066aa r300: Fix wrap mode for 1D textures 2008-06-29 17:28:13 +02:00
Brian Paul
6cb1270491 s/GL_INVALID_VALUE/GL_INVALID_OPERATION/ in _mesa_get_uniformfv() 2008-06-28 16:48:58 -06:00
Brian Paul
b429e9b2d7 mesa: added null ptr checks 2008-06-28 16:48:58 -06:00
Dan Nicholson
f6da1453c5 DRI-specific pkg-config file
Since the gl pkg-config file doesn't convey any specifics about the
backend in use, this adds a new pkg-config file for when DRI is in use.
This can be used by the xserver build to determine if the DRI and/or
GLX extensions are appropriate.
2008-06-27 16:25:28 -07:00
Dan Nicholson
985e1cdfe8 autoconf: Check for posix_memalign
Rather than just defining HAVE_POSIX_MEMALIGN on Linux, check whether
the function exists on all platforms and define the macro if it is.
2008-06-27 16:24:42 -07:00
Alan Hourihane
3b132b297f Check in SwapBuffers for any new pending dri2 events 2008-06-26 22:53:29 +01:00
Eric Anholt
5174b85a0c intel: Fix glCopyPixels when x or y are < 0 in hw coordinates.
Nothing would get drawn as the negative coordinates broke the rectangle
intersection code that used unsigned ints.  Tested with copypix demo and
sliding the copy to the upper left.
2008-06-24 14:04:11 -07:00
Eric Anholt
9a0d773116 i965: Use the shared intel_pixel_copy.c.
This disables the textured copy implementation on 965, which didn't appear
to work (mesa copypix demo, disable the blit path, move so that regions don't
overlap and textured is used, and you get garbage).  If we resurrect this for
i965, I'd rather it used the 915-style metaops instead.  Current metaops code
left in place so that whoever picks it up has a reference.
2008-06-24 13:18:40 -07:00
Eric Anholt
744357e29c intel: Same pixel function init for everyone now. 2008-06-24 11:49:21 -07:00
Eric Anholt
f5eb62a116 intel: Avoid glBitmap software fallback for blending when no blending occurs.
Mesa demos tend to leave blending on but in GL_ONE/GL_ZERO, or
GL_SRC_ALPHA/GL_ONE_MINUS_SRC_ALPHA with a source alpha of 1.0.
2008-06-24 11:44:42 -07:00
Eric Anholt
f23adc504d intel: Merge check_blit_fragment_ops between i915/i965.
Both had some useful bits for the other.
2008-06-24 11:34:42 -07:00
Eric Anholt
90d33edf37 intel: Note reasons for blit pixel op fallbacks under INTEL_DEBUG=pix. 2008-06-24 10:50:10 -07:00
Eric Anholt
eda68cccc0 i915: Add support for accelerated glBitmap, shared from 965. 2008-06-24 10:26:57 -07:00
Eric Anholt
5989098779 i915: Fix read != draw drawable for glCopyPixels.
Taken from commit bad6e175cf.
2008-06-24 10:25:19 -07:00
Eric Anholt
98fa0aec36 i915: Allow accelerated pixel ops to be disabled with INTEL_NO_BLIT.
This matches 965.
2008-06-24 10:24:32 -07:00
Dan Nicholson
fe3b62b5b1 Ensure all objects are built when installing DRI 2008-06-22 20:29:45 -07:00
Dan Nicholson
5aa4d5a87d Don't make libmesa.a or libglapi.a depend on asm_subdirs
Since the asm_subdirs target does not actually create a file, make will
always consider that it needs to be rebuilt. If libmesa.a and libglapi.a
have asm_subdirs as a prerequisite, then they will always need to be
rebuilt, too. The correct order will be preserved by the default target,
though.

This should fix #16358.
2008-06-22 20:27:00 -07:00
Dan Nicholson
7ec5e6a032 Create $(TOP)/$(LIB_DIR) for install, too
If `make install' is run without running `make' first, the $(LIB_DIR)
will not be created. This also changes the mkdir a little bit so that it
isn't run if necessary and added `-p' so that it is immune to races.
2008-06-22 20:19:35 -07:00
Brian Paul
71d2578ac5 replace __inline and __inline__ with INLINE macro 2008-06-21 10:55:24 -06:00
Brian Paul
ba97ed2b74 replace __inline and __inline__ with INLINE macro 2008-06-21 10:52:40 -06:00
Brian Paul
cc96d54920 replace __inline and __inline__ with INLINE macro 2008-06-21 10:52:32 -06:00
Brian Paul
37f19b94ac replace __inline and __inline__ with INLINE macro 2008-06-21 10:49:45 -06:00
Brian Paul
402e7f76b1 #undef DEBUG to silence warnings 2008-06-21 10:49:40 -06:00
Brian Paul
5ee7b7912c replace __inline and __inline__ with INLINE macro 2008-06-21 10:34:38 -06:00
Brian Paul
055ab81920 replace __inline and __inline__ with INLINE macro 2008-06-21 10:34:00 -06:00
Brian Paul
24197b4901 replace __inline and __inline__ with INLINE macro 2008-06-21 10:30:01 -06:00
Brian Paul
7899270b9f replace __inline and __inline__ with INLINE macro 2008-06-21 10:27:36 -06:00
Brian Paul
2e922b0e35 replace __inline and __inline__ with INLINE macro 2008-06-21 10:24:43 -06:00
Brian Paul
2c1bead069 s/inline/INLINE 2008-06-21 10:20:54 -06:00
Brian Paul
77d917a74a remove old comments 2008-06-21 10:20:31 -06:00
Alan Coopersmith
e1f9adc274 Solaris port of Mesa 7.1 with autoconf support
Signed-off-by: Brian Paul <brian.paul@tungstengraphics.com>
2008-06-21 10:19:45 -06:00
Daniel Zhu
f30e4af734 Rename quad function to quadr to avoid clash with Solaris quad typedef
Signed-off-by: Brian Paul <brian.paul@tungstengraphics.com>
2008-06-21 10:19:45 -06:00
Alan Coopersmith
1043a7c71a Make minstall work with Solaris /bin/sh
Solaris /bin/sh doesn't set $PWD for you

Signed-off-by: Brian Paul <brian.paul@tungstengraphics.com>
2008-06-21 10:19:45 -06:00
Alan Coopersmith
4ba39c40ae Fix builds with compilers other than gcc 3.0 & newer
Add #include "glheader.h" for definition of __builtin_expect for compilers
that don't support it.

Signed-off-by: Brian Paul <brian.paul@tungstengraphics.com>
2008-06-21 10:19:45 -06:00
Brian Paul
3491cbea88 added pointer to beta/release candidates 2008-06-21 10:19:45 -06:00
Alex Deucher
dc25661099 R300: 1002:5657 is actually RV410
See bug 14289
2008-06-21 10:52:49 -04:00
Roland Scheidegger
b3f1aac95e r200: fix typo in r200TryDrawPixels parameter validation (bug 16406) 2008-06-21 02:54:14 +02:00
Brian Paul
21177c8764 mesa: tweak mipmap level selection for cube maps
This is just a hack.  After we convert the 3D texcoord into a face plus 2D
texcoord we need to recompute the partial derivatives and mipmap LOD.
But we don't have the info to do that.  Adjusting the original mipmap
level by -1 seems to give somewhat better results than before though.
2008-06-19 14:37:50 -06:00
Eric Anholt
cf29ab3ba0 i915: Bug #14313: Fix accelerated (PBO) ReadPixels.
Refactoring of mine in 02d5ba8491 broke it
by failing to understand that the masking was about sign extension.
2008-06-18 13:50:49 -07:00
Xiang, Haihao
3e8aadee8b i965: add support for Intel 4 series chipsets 2008-06-18 15:33:33 +08:00
Brian Paul
3064069540 mesa: fix inconsistent use of GL_UNSIGNED_INT vs. GL_UNSIGNED_INT_24_8_EXT for Z unpacking 2008-06-17 16:44:04 -06:00
Wilfried Holzke
5b5bf21874 assorted glide driver fixes 2008-06-17 10:08:22 -06:00
Brian Paul
51ad6e3425 glu: silence warnings 2008-06-17 10:08:22 -06:00
Dave Airlie
a1523c61ea mesa: make mm.c use unsigned ints for offsets.
If you have a GPU using this code and it has the offsets up in this space,
this fails.
2008-06-17 16:29:45 +10:00
Corbin Simpson
27b7f896d4 r300: Make LOD bias a persistent environment variable.
Per airlied's suggestion.
2008-06-16 11:40:34 -07:00
H. Verbeet
e9d1889891 Compute/setup fog coordinates even if vertex program is enabled.
Only when fog's enabled, of course.
In the usual case, this is just a pass-through operation.
2008-06-16 10:40:32 -06:00
Brian Paul
ec2d0decbd mesa: allocate pixel zoom arrays on heap, not stack
Fixes stack overflow on Windows.
2008-06-16 10:03:05 -06:00
H. Verbeet
bbce58802d Don't compute vertex fog when fragment program is active. 2008-06-16 09:41:08 -06:00
Corbin Simpson
588abd6696 r300: Fix new incarnation of bug 3195.
tests/bug_3195 doesn't render right, but at least it doesn't segfault this way.
2008-06-16 01:21:42 -07:00
Corbin Simpson
1738a9a535 r300: Forgot to clear old state before writing new state.
Oooops. Hehe.
2008-06-16 01:02:16 -07:00
Corbin Simpson
776580a6af r300: Enable LOD bias state emission.
Properly set t->filter_1 for r300_state to emit.
Expect buggies as people see LOD bias enabled for the first time...
2008-06-15 23:54:32 -07:00
Corbin Simpson
f7b8a13d65 Oops, misordered a few instructions.
Not like it matters, though, since it's not taking effect yet.
2008-06-15 17:30:07 -07:00
Corbin Simpson
6e6ca40f29 r300: Unbreak LOD biasing, a bit.
Needs a bit more work on submission.
2008-06-15 17:14:07 -07:00
Dan Nicholson
4fc66be296 No more drivers/xorg
Don't try to clean in xorg since GLcore is gone.
2008-06-15 09:06:27 -07:00
Corbin Simpson
f1ae5d4b44 r5xx: Enable fragment.position, partial ARB_shadow.
I don't like PROGRAM_BUILTIN; could we either patch Mesa or just use a different constant?
2008-06-14 19:32:33 -07:00
Corbin Simpson
7413c55d93 r5xx: Detangle FP fallback and translation switches.
r5xx should fallback if it encounters a bad FP.
TODO: Re-enable the dumb shader so we don't have to completely fallback.
2008-06-14 17:59:10 -07:00
Nicolai Haehnle
43da118961 r300: Add radeonTransformALU and fix a bug in r300_fragprog DPH
This new generic transform replaces "special" instructions by more generic
variants. Hopefully, we will be able to share this code between r300 and r500.
2008-06-14 23:09:15 +02:00
Nicolai Haehnle
825fdfd0c1 r300_fragprog: Use less complex instructions
MOV, ADD and MUL do not fit the hardware as well as MAD, but they are less
complex and thus leave more room for future optimizations.
2008-06-14 20:26:10 +02:00
Corbin Simpson
b97e48ffe3 r5xx: More FP rewriting; fix texrect FP insts. 2008-06-14 08:56:03 -07:00
Corbin Simpson
69004fb758 r5xx: New FP code, take two.
Add the code emission source file, and comment out unneeded tex de-swizzling.
2008-06-14 07:21:40 -07:00
Corbin Simpson
0a341ef296 r5xx: FP refactor, take one.
Yes, I know it's massive. Imagine how I felt, auditing 3000 lines of code.
2008-06-14 07:03:08 -07:00
Corbin Simpson
9704414d13 r3xx/r5xx: Don't force aniso.
*Pulls paper bag down over head*
2008-06-14 04:37:09 -07:00
Nicolai Haehnle
a1c0c56d70 r300: Implement GL_ARB_shadow and GL_EXT_shadow_funcs 2008-06-14 04:15:42 +02:00
Nicolai Haehnle
83ad2a756e texenvprogram: Mark textures using ARB_shadow as ShadowSamplers
Since ARB_fragment_program and friends are defined to ignore the setting of
the GL_TEXTURE_COMPARE_FUNC parameter, we have to explicitly enable the
shadow comparison by marking the texture unit in ShadowSamplers when
appropriate.
2008-06-14 04:15:31 +02:00
Nicolai Haehnle
2882e51625 r300: Add radeonCompilerDump for debugging 2008-06-14 04:15:20 +02:00
Nicolai Haehnle
e34dc8227c r300_fragprog: Refactor TEX transformation
Streamlining source and destination registers, as well as texcoord scaling for
RECT textures is now done in a radeon_program based transformation.

The idea is that this will allow us to optimize away unnecessary indirections
more easily.
2008-06-14 04:14:56 +02:00
Nicolai Haehnle
b5170bc9d3 r300: Add radeon_program and trivial refactoring of r300_fragprog to use it
The idea/hope is that radeon_program will serve as an intermediate
representation for r3xx up to r6xx fragment and vertex programs.
Right now, it is nothing more than a simplistic wrapper around Mesa's
prog_instruction, together with the notion of clauses, taken from r6xx docs.

The clauses will eventually be used to represent the nodes that are used in
r300 family fragment programs.
2008-06-14 04:14:05 +02:00
Nicolai Haehnle
e2aa45c2f9 r300: Do not include r300_fragprog.h from r300_context.h and other cleanups 2008-06-14 04:11:21 +02:00
Nicolai Haehnle
caeabb1ebe r300_fragprog: Remove dead declarations, move NOP declarations into source 2008-06-14 04:11:13 +02:00
Nicolai Haehnle
4ba1c7d848 r300_fragprog: Refactoring and cleanup
Refactor so that r300_pfs_compile_state "owns"/holds a pointer to
r300_fragment_program instead of the other way round. This is more natural from
an object orientation point of view.

Move the compiled hardware state into r300_fragment_program_code, in
anticipation of on-the-fly program recompilation based on external OpenGL
state.
2008-06-14 04:11:05 +02:00
Nicolai Haehnle
defadd9c03 r300_fragprog: Remove dead code 2008-06-14 04:10:52 +02:00
Nicolai Haehnle
b7669e4a86 r300/r500: Separate fragprog compiler structures
r500 code still used r300_pfs_compile_state, which contains some fields that
really only make sense on r3xx type hardware. In order to allow both fragprog
implementations to go forward without disturbing each other, I've pushed this
structure down into the respective r[3|5]00_fragprog.c
2008-06-13 20:51:20 +02:00
Nicolai Haehnle
4919cc3a2c r300: Fix depth texture GL_LUMINANCE vs. GL_INTENSITY mixup 2008-06-13 19:36:03 +02:00
Nicolai Haehnle
b1056b6127 r300: Reenable t->filter_1 (though currently not used) 2008-06-13 19:36:02 +02:00
George Sapountzis
1087cc61b3 glx: load swrast_dri.so
caveats:

- does not work with old (i.e. libGLcore) xserver:

- made unbindContext a noop

- extensions:

  GLX_SGI_make_current_read
  GLX_EXT_texture_from_pixmap
  GLX_MESA_copy_sub_buffer
2008-06-13 15:54:08 +03:00
George Sapountzis
7ffb1230b3 dri/swrast: make unbind a noop
This is for loading swrast_dri.so from libGL.

MakeContextCurrent() seems to unbind the context right after binding it and
DRI drivers also have a noop DriverAPI.UnbindContext ...
2008-06-13 15:52:32 +03:00
George Sapountzis
341987f688 dri/swrast: add OpenGL 2.1 functions 2008-06-13 15:48:34 +03:00
George Sapountzis
4297413656 glx: use ErrorMessageF 2008-06-13 15:48:06 +03:00
Zack Rusin
95b34baa8f silly bug: it's PROGRAM_VARYING 2008-06-12 19:43:10 -04:00
Zack Rusin
928ec5cd3b glsl: make sure we replace all output reads with temporaries
test in if.glsl
2008-06-12 19:39:20 -04:00
Zack Rusin
53f5b9741a glsl: allow uniforms 2008-06-12 19:37:26 -04:00
Zack Rusin
effb73befa glsl: fix array size initialiazers using const variables
e.g.
const int kernelSize = 9;
uniform vec2 kernel[kernelSize];
2008-06-12 15:15:34 -04:00
Zack Rusin
19659a50f9 almost forgot - RelAddr is a boolean so use it here 2008-06-12 15:08:58 -04:00
Zack Rusin
2542c59c55 shaders: fix allocation of arrays of parameters 2008-06-12 15:08:27 -04:00
Zack Rusin
74964ff04d glsl: implement variable array indexes 2008-06-12 15:08:12 -04:00
Dan Nicholson
0440f5a187 Update .gitignore for progs/glsl 2008-06-12 06:37:45 -07:00
Dave Airlie
41bdb88f27 sparc: add swrast to dri drivers 2008-06-12 16:26:46 +10:00
Dave Airlie
2b0e75ea7a sparc: add DRI drivers for sparc patch from Fedora 2008-06-12 12:06:50 +10:00
Brian Paul
3f3e4f645d remove obsoleted doxygen \param comments
Someone changed the function parameters but didn't bother to update the
comments.

Also, whitespace changes, clean-ups.
2008-06-11 19:33:30 -06:00
Brian Paul
8d976aedc4 comments 2008-06-11 19:33:14 -06:00
Brian Paul
9563449c14 remove unnecessary swrast, tnl includes 2008-06-10 12:08:30 -06:00
Brian Paul
c233b4245f add some missing rule dependencies 2008-06-10 10:10:12 -06:00
Roland Scheidegger
17ec0dbd75 copy msaa visuals capability 2008-06-10 15:45:20 +02:00
Dan Nicholson
fbb96a0301 Distribute version.mk in case autoconf needs to be run again
Users may need to rebuild the configure script, so we need to distribute
version.mk so autoconf can run successfully.
2008-06-10 06:06:40 -07:00
Xiang, Haihao
a742bed99a i965: apply commit 6c1a98e97a to glsl 2008-06-10 16:31:36 +08:00
Brian Paul
72f87b6947 fix Xlib libGL.so build problem.
Also, build driverfuncs.c into libmesa.a since it's always needed.
2008-06-09 16:06:44 -06:00
Brian Paul
f6246f85d7 s/SOLO/MESA/ 2008-06-09 14:09:09 -06:00
Brian Paul
910b3bfaeb Makefile clean-ups 2008-06-09 13:52:22 -06:00
Brian Paul
a80ccaadc7 more old stuff, rename SOLO->MESA, etc 2008-06-09 13:52:22 -06:00
Brian Paul
08c07b60be Makefile clean-ups 2008-06-09 13:52:22 -06:00
Brian Paul
376203cff8 document makefile changes 2008-06-09 13:52:22 -06:00
Alan Hourihane
5cf69fe511 Check for NULL pointer 2008-06-09 16:25:01 +01:00
George Sapountzis
906e189bd3 glx: use goto's vs. nested if's ala xserver
compile tested only
2008-06-09 17:47:49 +03:00
George Sapountzis
0793457039 glx: add dri_common.c ala xserver
also drop driFilterModes which is unused

in preparation of loading swrast_dri.so
2008-06-09 17:47:09 +03:00
George Sapountzis
4c7e02298f dri/swrast: minor cosmetic 2008-06-09 17:46:39 +03:00
Nicolai Haehnle
0009973119 r300: Workaround hardware readcache problem
This workaround is similar to the one found in r200_span.c.
It seems like some part of the read hardware doesn't realize that
VRAM has changed. By reading from an arbitrary position, this is fixed.

The piglit test bugs/r300-readcache is a regression test for this bug.
2008-06-08 22:38:58 +02:00
Brian
f440b0ddd9 remove realglx.[ch] from build 2008-06-08 11:25:30 -06:00
Roland Scheidegger
28c28f72fd i965: fix OPCODE_TEX when additional ops are needed 2008-06-08 14:05:07 +02:00
Corbin Simpson
21f50818b0 r300: Allow driconf to set a default anisotropy.
If an app does not use GL_EXT_tex_filter_aniso, this lets driconf set it instead.
2008-06-07 12:37:31 -07:00
Nicolai Haehnle
cb16876608 r300: Some cleanups in depth and stencil state handling
This also fixes a bug with Zfunc set to GL_NEVER in glean/paths.
2008-06-07 21:08:43 +02:00
Nicolai Haehnle
7cb63a25de r300: Apply writemask when clearing stencil buffer
This fixes the glean/maskedClear test.
2008-06-07 20:34:06 +02:00
Nicolai Haehnle
731686b713 r300: Fix stencil buffer clear
The glean/readPixSanity test passes now.
2008-06-07 20:28:04 +02:00
Nicolai Haehnle
75bfe630ff r300: Further anisotropic filtering fixes
Thanks to Corbin for the initial cut today. Fixed some minor stuff (in
particular, make sure we still use a MIP_LINEAR filtering mode; anisotropy
without MIP_LINEAR filtering is not the truly pleasing anisotropy).
2008-06-07 18:56:55 +02:00
Nicolai Haehnle
bf1a7c884d r300: Update LOD_BIAS register constants 2008-06-07 18:34:44 +02:00
Corbin Simpson
5e58e5d777 r5xx: Unbreak anisotropic filtering?
Not quite finished, maybe? Not sure.
2008-06-07 01:37:35 -07:00
Corbin Simpson
f39780242e r5xx: Fix speedy LIT once and for all.
To do: Add a slightly more accurate LIT. Will do later.
2008-06-06 22:07:18 -07:00
Jose Fonseca
ae18cbcfc5 Fix CRLF line endings. 2008-06-07 12:34:45 +09:00
Jose Fonseca
9286a14fbe Fix CRLF line endings. 2008-06-07 12:33:47 +09:00
Nicolai Haehnle
fa1bc0d7d6 r300: Improve texture layout calculations
The texture layout calculations for mipmapped cubemaps used to be completely
wrong, since the GPU expects images to be grouped by miplevel instead of by
face number.

This has been fixed now, though the memory layout is still slightly incorrect
for the smaller miplevels. Unfortunately, the docs are lacking in that area.
2008-06-06 23:47:46 +02:00
Nicolai Haehnle
03a1144cd1 r300: Cleanup TX_MIN_FILTER defines
This commit should not affect the functionality at all, just cleanup
some of the original texture filter guesswork using information from
the register documentation.
2008-06-06 21:34:34 +02:00
Nicolai Haehnle
665605234d r300: Remove unused variable r300_tex_obj::dirty_state and related defines
This variable was only ever written to, but nobody used its value.
2008-06-06 21:34:34 +02:00
Brian Paul
0b72fada6a s/subdirs/asm_subdirs/ 2008-06-06 12:27:55 -06:00
Brian Paul
1d5b51abc8 move the install rules 2008-06-06 12:27:14 -06:00
Brian Paul
bde6b57e48 remove stray semicolon 2008-06-06 12:25:24 -06:00
Brian Paul
847f54e2fa move a beos-ism down into drivers/beos/Makefile 2008-06-06 12:24:44 -06:00
Brian Paul
dd750e0763 Remove the old, complicated default build rule; use the new driver_subdirs rule
Also, all the old driver-specific rules are now gone.
2008-06-06 12:18:40 -06:00
Brian Paul
358dcd7178 remove more old stuff, insert new driver_subdir build rules (but not enabled yet) 2008-06-06 12:12:59 -06:00
Brian Paul
04c6ca99dd new drivers/Makefile with simple default/clean/install rules 2008-06-06 12:09:55 -06:00
Brian Paul
c9739b2055 move directfb-libgl into drivers/directfb/Makefile 2008-06-06 12:09:01 -06:00
Brian Paul
f8563ddddb Move fbdev driver construction into src/mesa/drivers/fbdev/Makefile 2008-06-05 16:44:11 -06:00
Brian Paul
b55694512a reorder some lines, more make clean cmds 2008-06-05 16:28:00 -06:00
Brian Paul
4a68b62b86 remove X11, Glide, OSMesa sources 2008-06-05 16:27:43 -06:00
Brian Paul
e89e94e01a added dependencies 2008-06-05 16:26:15 -06:00
Brian Paul
2b84b22bad Move building of stand-alone Mesa into drivers/x11/Makefile
Also, some re-org, renaming, and general clean-up.
We're just a few steps away from removing the all the special case rules
for building drivers.
2008-06-05 16:08:42 -06:00
Brian Paul
ea7eb9a374 new Makefile for building "stand-alone", Xlib-based libGL 2008-06-05 16:06:17 -06:00
Brian Paul
bf5e573926 prefix some includes with mesa/ or glapi/ 2008-06-05 16:05:02 -06:00
Brian Paul
f8c6b6628d minor changes 2008-06-05 15:37:17 -06:00
Brian Paul
18906b7904 Move construction of libOSMesa.so into src/mesa/drivers/osmesa/Makefile
This removes some cruft from src/mesa/Makefile.
Something similar could be done for stand-alone / Xlib-Mesa libGL...
2008-06-05 15:36:07 -06:00
Brian Paul
91b491debe insert mesa/ before include files 2008-06-05 15:26:11 -06:00
Alan Hourihane
b2a9788ec6 Silence warning 2008-06-05 11:47:20 +01:00
Brian Paul
4c7a17c251 fix event handling issues (such as when resizing when not animating) 2008-06-04 16:11:24 -06:00
Brian Paul
6d9c3fa0c2 press 'a' to toggle animation 2008-06-04 16:04:04 -06:00
Brian Paul
c35e021f37 code refactoring (draw_frame(0, handle_event()) 2008-06-04 16:01:47 -06:00
Brian Paul
c5342ad0d0 remove references to incorrect -winwidth/-winheight, replace with -geometry 2008-06-04 15:56:30 -06:00
Brian Paul
028fd5594c Set the attribute as used.
cherry-picked from gallium-0.1
2008-06-04 14:41:33 -06:00
Dan Nicholson
871125a68d autoconf: Collect arch/platform settings in one location
The architecture- and platorm-specific settings were scattered
throughout the configure script. This moves them near the beginning
before any of the driver-specific settings.
2008-06-04 13:00:35 -07:00
Brian Paul
0d8676822d remove old/unused foomesa.h example header 2008-06-04 09:33:02 -06:00
Brian Paul
f34767f04c call glutDestroyWindow() before exit 2008-06-04 09:30:32 -06:00
Xiang, Haihao
9e95fad02e i915: Fix GL_DEPTH_TEXTURE_MODE issue. (bug #16221) 2008-06-04 15:44:38 +08:00
Dave Airlie
0b734bd7cf mesa/drm/ttm: allow build against non-TTM aware libdrm
I'll release a libdrm 2.3.1 without TTM apis included from a special
drm branch that should allow mesa 7.1 to build against it.

I've had to turn off DRI2 stuff.
2008-06-04 14:08:27 +10:00
Ian Romanick
f688827ebd bug #16503: use INSTALL macro instead of hard-coding to bin/minstall
This is only part of the fix.  Someone with more autoconf-fu will have
to fix the rest
2008-06-02 11:19:35 -07:00
Nicolai Haehnle
96adcc2e21 [t_vp_build] Fix refcounting-related memory leak
This memory leak is identical to the earlier one in texenvprogram.
Fixed by not creating an additional reference to new programs in cache_item.

On top of that, remove some duplicated state setting.
2008-06-02 18:42:52 +02:00
Nicolai Haehnle
934a53eb44 [texenvprogram] Fix refcounting-related memory leak.
All newly created programs have RefCount == 1, but the fragment program cache
added an additional reference in cache_item, with the result being that none
of the programs were ever freed.

Solve the problem by not creating the additional reference in cache_item.
2008-06-02 18:42:49 +02:00
Dave Airlie
7ead1c5d06 r500: add missing brackets around depth testing 2008-06-02 07:18:21 +10:00
Corbin Simpson
915e49e0fd r5xx: Enable depth write emission.
Thanks to nh for the r3xx version.
2008-06-01 11:45:30 -07:00
Nicolai Haehnle
c9ea62444c r300: Writing to result.depth in fragment programs (R3xx; only stub for R5xx)
Setup fg_depth_src for depth writing programs and change early Z (ztop)
semantics.

Piglit's version of glean/fragprog test passes now (unlike Glean, its
dependency on EXT_fog_coord, which we don't support, is optional).

R3xx only at the moment, but should be straightforward to adapt to R5xx
(I don't own an R5xx, and I don't want to break anything.)
2008-06-01 19:59:42 +02:00
Nicolai Haehnle
d9c7c5f071 [r300] Fix KIL instruction and swizzling of texture coordinates
The KIL instruction only works if at least one texture unit is enabled
in hardware.

Texture instructions do not support swizzles, negations etc. natively,
so we now emit an explicit swizzling etc. operation when the texture coordinate
requires it.

This fixes the Piglit fp-kil test.
2008-06-01 13:23:53 +02:00
Corbin Simpson
3225e2cdb6 r5xx: Add OPCODE_FLR.
Why didn't anybody tell me we were missing this one? I thought I committed it ages ago!
2008-06-01 03:23:00 -07:00
Corbin Simpson
9a34c68faf r5xx: Last emit_sop() for now.
This should also clean up LIT later on.
2008-05-31 22:41:54 -07:00
Corbin Simpson
bffa0909cb r5xx: More emit_sop(), stage 2.
SIN/COS.
2008-05-31 22:23:11 -07:00
Corbin Simpson
ea58dceb1c r5xx: Cleanup SOP with emit_sop().
I wish I had a snarky commit message, but I'll save that for after I get the
trig working with this.
2008-05-31 22:09:38 -07:00
Corbin Simpson
c9679ce1d2 r5xx: Dump shader constants when dumping program assembly. 2008-05-31 20:48:15 -07:00
Dave Airlie
7013eecf28 r300: disable the lowimpact fallbacks by default.
because really we should be able to just fix the driver.
2008-06-01 09:32:55 +10:00
Markus Amsler
a947c1a3fe r500: Use 8bit fog alpha compare value.
This fixes transparency issues on r500 by enabling
backwards compatibility with the r300 alpha compare value.
2008-05-31 03:10:21 +02:00
Luc Verhaegen
4a69c4173d Fix segfault on exit in unichrome driver (bug 16150) 2008-05-29 11:00:06 -06:00
Brian Paul
ef56a563a1 undo prev change to this VC7 project file
Meant to update the VC8 project file.
2008-05-29 10:46:39 -06:00
Karl Schultz
1190261c47 added prog_uniform.[ch] 2008-05-29 10:43:48 -06:00
Brian Paul
645c131264 Assorted Windows fixes (Karl Schultz) 2008-05-29 10:42:02 -06:00
Brian Paul
a1a0e51043 Use the GLuint64EXT type defined by GL_EXT_timer_query
Removes some compiler #ifdef stuff.
2008-05-29 10:42:02 -06:00
Dennis Kasprzyk
328621509f R1/2/3/4/5xx: fixed calculation of cliprects in CopyBuffer. 2008-05-29 11:25:21 +02:00
Dennis Kasprzyk
377016d728 Report correct damage rectangle in CopySubBuffer. 2008-05-29 11:24:16 +02:00
Markus Amsler
74a217fbcd r300: fix R300_FG_ALPHA_FUNC_VAL_MASK 2008-05-29 02:14:26 +02:00
Brian Paul
5adc763898 updated function list 2008-05-28 09:06:28 -06:00
Brian Paul
5429d4a04a replace make with $(MAKE) (bug 16133) 2008-05-28 08:53:53 -06:00
Dave Airlie
3e6c791390 r300: disable cmdbuf debug again 2008-05-28 10:23:25 +10:00
Dave Airlie
261a15cf63 Merge branch 'r500-support'
Bring in all the r500 3D code into master should be as stable as the r300
code it is landing on top off.

Conflicts:

	src/mesa/drivers/dri/r300/r300_reg.h
	src/mesa/drivers/dri/r300/r300_state.c
	src/mesa/drivers/dri/radeon/radeon_screen.c
2008-05-28 10:20:14 +10:00
Dave Airlie
85af4fde7f r500: remove warnings and only start on newer drms.
This removes lots of warnings to the user, and only allows the driver
to run on > .29 drms for r500 cards.
2008-05-28 10:11:41 +10:00
Alex Deucher
867f5aac53 R3/4/5xx: update to use drm get_param for num gb pipes 2008-05-28 10:11:14 +10:00
Dave Airlie
5552500cdf r500: cleanup warnings and include files 2008-05-28 10:03:10 +10:00
Corbin Simpson
8c39e24ec3 r5xx: Add OPCODE_XPD. In working condition, I might add.
And we're officially finished with the ARB_fragment_program
instruction set. It's worth noting that LIT is still not reliable.
SIN and COS were fixed a few commits ago. We're finished with stage 1!
Whoohoo!
2008-05-27 02:12:10 -07:00
Corbin Simpson
a242b331c6 r5xx: Just a few small LIT fixes.
Still broken; will fix tomorrow.
2008-05-27 01:36:25 -07:00
Corbin Simpson
9412aee4dc r5xx: Fix emit_mov() regression.
Specifically, fix improper swizzling.
2008-05-27 01:36:25 -07:00
Dave Airlie
eee53dfb22 r500: the cs is shared per context - doh so don't use for program upload.
Also remove some unused bits of the r500 fragprog struct
2008-05-27 18:15:14 +10:00
Dave Airlie
7278266612 r500: need to re-setup inst offset/end for translated programs
this fixes texenv
2008-05-27 17:39:35 +10:00
Dave Airlie
774b3bc5a5 r500: reset fp/fp_const counts 2008-05-27 17:11:04 +10:00
Dave Airlie
4af22c9076 r300/r500: emit flush inside vap_cntl state atom
Not sure if this is a good or bad plan, it certainly doesn't make things worse here.
2008-05-27 17:08:03 +10:00
Dave Airlie
8eb7df6302 r500: hopefully fix 4096 texture harder 2008-05-27 15:29:39 +10:00
Corbin Simpson
b5372746ff r5xx: Fix FP temp counting.
One of the ref counters wasn't being added to the temp counter.
Yet another product of late-night coding...
2008-05-26 22:12:24 -07:00
Dave Airlie
9f03e93de9 r500: remove debugging 2008-05-27 12:46:44 +10:00
Dave Airlie
7b88f40116 r300/r500: fix r500 fragment program texture unit references 2008-05-27 12:45:15 +10:00
Dave Airlie
5a5ba35069 r500: initial support for tmu mappings 2008-05-27 10:59:42 +10:00
Corbin Simpson
b57ba7c5b0 r5xx: Enhance emit_mov().
Now we can add arbitrary sources and swizzles. Will make many things smoother.
2008-05-26 16:00:05 -07:00
Corbin Simpson
5499685931 r5xx: Moar LIT.
Still not working, but getting closer.
2008-05-26 15:18:41 -07:00
Corbin Simpson
a2db33219d r5xx: First stab at LIT. 2008-05-26 12:35:39 -07:00
Corbin Simpson
21b352bb14 Replace copyright on r500_fragprog.c
Huh, could have sworn I already did this once before...
Maybe I forgot to commit it?
2008-05-25 22:50:00 -07:00
Corbin Simpson
27d8fcd506 r5xx: Unbreak texture swizzling. 2008-05-25 19:53:48 -07:00
Corbin Simpson
f776f693c0 r5xx: Massive MAD cleanup.
Common uses of MAD now use emit_mad(), the two common negation masks work,
and fixed a few off-by-one errors.
2008-05-25 11:46:16 -07:00
Corbin Simpson
594760148c r5xx: Negation masks for every inst except SWZ.
Yay?
2008-05-25 11:35:54 -07:00
Corbin Simpson
bd74d2aa26 r5xx: More emit_alu().
Converted ADD.
2008-05-25 11:35:20 -07:00
Corbin Simpson
810270ad11 r5xx: Add emit_mad() for FP.
If it uses MAD, emit it with emit_mad()!
(Now available at your local grocer's. Multiply and add responsibly.)
2008-05-25 11:07:51 -07:00
Corbin Simpson
f1d04cd766 r5xx: Consolidate FP tex insts.
They're all the same, really.
2008-05-24 11:30:57 -07:00
Corbin Simpson
b6b5190682 r5xx: Fix SGE/SLT. 2008-05-24 10:25:22 -07:00
Corbin Simpson
6f918a9fda r5xx: Remove some debugging cruft. 2008-05-24 10:25:22 -07:00
Dave Airlie
af77de66d9 r500: missed a couple of inst4s. 2008-05-24 18:18:18 +10:00
Dave Airlie
e9031d6f63 r500: add depth output write
Not sure how well this works yet, but we need to set the alpha to w_omask
2008-05-24 18:12:26 +10:00
Corbin Simpson
9ab7a2df03 r5xx: Clean up some compiler warnings. 2008-05-23 00:18:14 -07:00
Corbin Simpson
30e61500e1 r5xx: Move dumb_shader.
Was getting ticked having to scroll around it, lawl.
2008-05-23 00:18:14 -07:00
Corbin Simpson
34010bcc91 r5xx: Add OPCODE_DST.
Works completely, swizzles and everything.
2008-05-23 00:18:14 -07:00
Corbin Simpson
d4e93864b8 r5xx: More trig work.
SCS now works. COS/SIN have slight issues still.
2008-05-23 00:18:14 -07:00
Dave Airlie
a01816da59 r500: bump state atom size up for fp and fp constants 2008-05-22 17:09:58 +10:00
Corbin Simpson
4f9dcdc35b r5xx: Fixed LRP.
Works perfectly. It's a complex one, though, so it might fail in weird ways...
2008-05-21 23:35:43 -07:00
Corbin Simpson
0dfbe9cdd7 r5xx: Change debug info for readability.
It's weird seeing the compiled program before the assembly, that's all.
2008-05-21 23:33:13 -07:00
Corbin Simpson
d06f4edb14 r5xx: Initial (broken) OPCODE_LRP.
Will compile, run, and not eat your kids, but the math is wrong.
2008-05-21 13:51:32 -07:00
Corbin Simpson
1e2907f170 r5xx: Add OPCODE_POW.
Necessary for Google Earth, among other things.
2008-05-21 08:24:28 -07:00
Dave Airlie
bb57c30a53 r500: print out opcode string 2008-05-21 16:00:18 +10:00
Dave Airlie
b453b0e2e1 r500: set the RS unit register for R500 not R300 dangnammit..
So this appears to be my BUG. damn it to hell.

also fix sec color to be more like spec says.
2008-05-21 12:14:42 +10:00
Dave Airlie
9ec2b1c83f r500: finish main texture instruction decoding 2008-05-21 10:49:26 +10:00
Corbin Simpson
2bda1a9502 r5xx: Count refs so we don't have to guess on temp reg allocation.
As a bonus, we can now have multiple temp temps, by slot.
2008-05-20 09:47:50 -07:00
Corbin Simpson
94994b13c5 r5xx: Fixup SOP insts.
Use the correct swizzle for alpha/SOP stuff.
2008-05-19 23:56:53 -07:00
Corbin Simpson
78fa506059 r5xx: New fix for COS/SIN/SCS.
Not perfect yet, but getting better.
2008-05-19 23:56:53 -07:00
Dave Airlie
f0d76d526b r300/r500: fixup some of the register write sizes 2008-05-20 16:30:36 +10:00
Dave Airlie
2005de48f9 r300: some ctrl-m's wierd. 2008-05-20 16:02:19 +10:00
Dave Airlie
282cdc8b5c r300/r500: fix RS col fmt bits 2008-05-20 15:59:56 +10:00
Corbin Simpson
476248befe r5xx: Fixup emit_tex, add debugging info, enable temp temps.
emit_tex now chases itself with an OUT if needed.
Added airlied's dump_program, with some fixes.
2008-05-19 11:06:41 -07:00
Dave Airlie
03b3fed8f1 r500: add more input srcs 2008-05-19 21:58:28 +10:00
Dave Airlie
ac315792bf r500: fix swz gets and some returns 2008-05-19 21:40:40 +10:00
Dave Airlie
60b8e1f524 r500: add mask debugging 2008-05-19 21:11:55 +10:00
Dave Airlie
cddab021e3 r500: add fragment program debug dumper 2008-05-19 20:24:09 +10:00
Corbin Simpson
c60bdcf8a8 r5xx: Fix magic offsets for output fifo write masks.
Well, this sure explains a lot.
2008-05-19 00:00:08 -07:00
Corbin Simpson
2708d7f700 r5xx: Swap sources for CMP.
Follows the same pattern as the op on r3xx/r4xx. Thanks airlied.
2008-05-18 23:52:54 -07:00
Corbin Simpson
a6c38f2f64 r5xx: Fix typo of epic proportions. 2008-05-18 23:35:07 -07:00
Corbin Simpson
2225b9bdb0 r5xx: ALU/OUT fixups.
Lots of small changes. Intentionally breaks some tex stuffs.
2008-05-18 22:38:28 -07:00
Dave Airlie
bdfd5d95c5 r300: fixup US_OUT_FMT bits 2008-05-18 17:58:29 +10:00
Dave Airlie
126673261d r500: you can have a single texcoord 2008-05-18 15:25:08 +10:00
Corbin Simpson
0910d9d4d6 r5xx: Add OPCODE_KIL. 2008-05-17 13:38:35 -07:00
Corbin Simpson
c57b3b1d2c r5xx: Added OPCODE_DPH.
Like DP4, but with one swizzle change.
2008-05-17 12:45:46 -07:00
Corbin Simpson
6dd3c0ed96 r5xx: Fix FRC.
This makes tri-frc work.
(Remind me again why I'm allowed near a compiler, lawl.)
2008-05-17 09:27:35 -07:00
Corbin Simpson
16cc362f0b r5xx: Fix SCS.
Output instructions need to be marked OUT so they can write to the fifo.
Also, negation doesn't work with SWZ yet.
2008-05-17 07:12:38 -07:00
Corbin Simpson
c11a33fe76 r5xx: Add OPCODE_SWZ.
It's so easy!
2008-05-17 07:12:37 -07:00
Corbin Simpson
d5aa421661 r5xx: Add OPCODE_SCS.
It's disabled, though, because it doesn't work. I'll figure it out later...
2008-05-17 07:12:37 -07:00
Corbin Simpson
405ee871c5 r5xx: Adding more opcodes.
EX2, FRC, LG2, SIN, RCP, and RSQ, if you care.
All of these except FRC are like COS. This pretty much rounds out the set of
opcodes which can be done in one ALU inst.
2008-05-17 07:12:37 -07:00
Corbin Simpson
0de02f1716 r5xx: First swing at OPCODE_COS. 2008-05-17 07:12:37 -07:00
Corbin Simpson
d8529d9b00 r5xx: Unbreak MAX and MIN.
Both of them had faulty copypasta.
2008-05-17 07:12:37 -07:00
Dave Airlie
5e075fb809 r500: set fragprog end to correct place 2008-05-17 13:31:14 +10:00
Alex Deucher
ba50c3fed3 r300: SC register naming cleanup 2008-05-17 10:40:47 +10:00
Alex Deucher
791c95230c r500: write out the correct FP registers 2008-05-17 10:29:52 +10:00
Dave Airlie
d6333af7e9 r500: default rsunit swizzle like fglrx 2008-05-15 20:38:41 +10:00
Dave Airlie
9aa62c7238 r500: shift tex src properly 2008-05-15 18:40:07 +10:00
Dave Airlie
76f32499d2 r500: fixup r500 rs unit texture coordinate counting 2008-05-15 18:40:07 +10:00
Dave Airlie
a0bc6d2fb2 r500: remove some debugging 2008-05-15 18:40:07 +10:00
Dave Airlie
73af48fff5 r500: split output/pixel masks and emit in the correct places 2008-05-15 18:40:07 +10:00
Dave Airlie
c9d5d11d2d r3/500: emit RS state before VAP 2008-05-15 18:40:07 +10:00
Dave Airlie
412c850eab r500: fixup the program allocations to be the correct sizes 2008-05-15 18:40:07 +10:00
Dave Airlie
350c80fa99 r300: set screen so that context init can find out chip ids 2008-05-15 18:40:07 +10:00
Dave Airlie
e1bffd0318 r500: add cmp support in theory 2008-05-15 18:40:07 +10:00
Dave Airlie
10e0a36a49 r500: some trivial fixups to get tri working.
the counter was being used one instruction over the end
2008-05-15 18:40:07 +10:00
Dave Airlie
375656440b r500: we just need to emit a colour for clear drop tex instruction 2008-05-15 18:40:07 +10:00
Alex Deucher
f86baae1a7 R300: clean up GA registers 2008-05-13 16:12:57 -04:00
Alex Deucher
de3fc8b1c4 R3xx: clean up ZB registers 2008-05-13 15:46:23 -04:00
Alex Deucher
c5b7a1ee3c R300: clean up CB registers 2008-05-13 14:32:30 -04:00
Alex Deucher
8d70181b03 R300: clean up Fog registers 2008-05-13 14:02:29 -04:00
Alex Deucher
d09aa2138b R500: fixup r300EmitClearState() FP for r5xx 2008-05-13 13:38:30 -04:00
Alex Deucher
9ef4126d48 R300: cleanup FS code and fill in missing details 2008-05-13 08:37:58 -04:00
Alex Deucher
0cc8ed5ccc R3xx: more PVS cleanup 2008-05-13 06:09:55 -04:00
Alex Deucher
e000f2ab6e Merge branch 'r500-support' of git+ssh://agd5f@git.freedesktop.org/git/mesa/mesa into r500-support 2008-05-12 11:58:35 -04:00
Alex Deucher
2a4d1085cb R500: add support for 4k textures 2008-05-12 11:57:08 -04:00
Dave Airlie
3d15280278 r500: cleanup r500 RS setup 2008-05-07 17:48:17 +10:00
Dave Airlie
53a7ccc08b r500: for rectangular textures set to unscaled coordinates. 2008-05-07 17:48:17 +10:00
Corbin Simpson
1da094c9ad r5xx: Fix FP inputs. (For good?)
FP inputs are now counted and mapped correctly, and temps
are allocated tightly and correctly.
2008-05-07 00:06:26 -07:00
Corbin Simpson
49c30ce958 r5xx: Fix false error with DP3/DP4.
DP3/DP4 only takes two arguments, but tried to load three, causing
a false fallback to the dumb shader.
2008-05-06 23:36:50 -07:00
Corbin Simpson
dc24fb51a3 r5xx: Index inputs and temps.
This is not the same as r3xx indexing. It only tries to protect inputs on
the pixel stack from getting clobbered by temps or texs.

Texs don't need special treatment since they read from special input regs
and write to the same temp regs as ALU/FC instructions.
2008-05-06 22:18:28 -07:00
Corbin Simpson
40db59038c r5xx: FP: Add OPCODE_TXB.
Tex lookup with biased LOD. Should magically work.
2008-05-06 18:14:21 -07:00
Corbin Simpson
20baf128ef r5xx: FP: Make MOV/ABS look pretty.
We can't really do anything like emit_alu, so we're doing emit_mov instead.
2008-05-06 17:21:30 -07:00
Corbin Simpson
1562dd2c26 r5xx: Emit an OUT instruction at the end of execution.
This should make TEX/TXP work right. (Note: "Should" is not "does.")
2008-05-06 12:44:53 -07:00
Corbin Simpson
fa465fb2b1 r5xx: We update max_temp_idx now, so no need to hard-code it.
This roughly doubles the speed of glxgears (GINAB) by allowing
more pixels to run concurrently.
2008-05-06 12:42:40 -07:00
Corbin Simpson
171ba1d0d1 r5xx: Fix typo.
Gotta be more careful with my cut'n'paste, lawl.
2008-05-06 12:18:07 -07:00
Corbin Simpson
06e2e1b87c r5xx: Use max_temp_idx. 2008-05-06 12:03:28 -07:00
Dave Airlie
66a49df9cb r500: consolidate tex instructions
you cannot change a tex into an output so this means we have to actually
do another instruction after this one to mov if its an output
2008-05-05 18:42:27 +10:00
Dave Airlie
697680d687 r500: mov cleanup macros 2008-05-05 18:15:40 +10:00
Dave Airlie
3816ae9ce8 r500: make tri-param work
This makes constant work which are 32-bit on r500 unlike r300.

Switch MOV to using MAD no idea if we might have negative things MAX 0,-5 is
likely to do the wrong thing..
2008-05-05 18:05:59 +10:00
Dave Airlie
1f420b008b r500: make sure we emit max temp atom.
We don't appear to update max_temp_idx yet anywhere though
2008-05-05 16:41:07 +10:00
Dave Airlie
66a5562ce2 r300: fix swtcl texrect path properly.
We really need to update the shader state so the texrect parameters work.

This should fix compiz looking crappy on rs480 and rs690
2008-05-05 23:49:50 +10:00
Markus Amsler
63503f2848 r300: Set correct VAP_CNTL per vertex program.
adapted from Markus' patch on bug 15386 with updates for non-TCL
and R500.
2008-05-03 12:55:45 -04:00
Corbin Simpson
b79a769b2d r5xx: Fix for loops.
Thanks to dli in IRC for pointing this out.
2008-05-03 09:09:57 -07:00
Corbin Simpson
4ef195a369 r5xx: Fix dumb shader.
For some reason, FGLRX doesn't actually set R500_US_INST_TEX.
Let us not make that same mistake.
2008-05-03 09:08:07 -07:00
Corbin Simpson
0f07e0aea3 Merge branch 'r500test' of git://people.freedesktop.org/~csimpson/mesa into r500-support 2008-05-03 08:39:15 -07:00
Dave Airlie
a03e261193 r300: remove debugging code 2008-05-04 04:17:15 +10:00
Dave Airlie
d3eb5df259 r300: setup vte according to inputs 2008-05-04 04:13:56 +10:00
Dave Airlie
37924cf175 r300: update r300 rs unit for swtcl need to fix r500 most likely 2008-05-03 22:08:11 +10:00
Dave Airlie
cea4f1464b r300: recombine the vap input route 0 code and clean
This gets non-tcl cards working again on this branch..

at least texrect and glxgears
2008-05-03 21:31:47 +10:00
Dave Airlie
026ef8111a r300: add R300_NO_TCL to allow testing of non-tcl on tcl cards 2008-05-03 21:31:22 +10:00
Corbin Simpson
e081603850 Merge branch 'r500-support' into r500test
Bringing the FPS code up-to-date.
Conflicts:

	src/mesa/drivers/dri/r300/r300_emit.c
	src/mesa/drivers/dri/r300/r300_ioctl.c
	src/mesa/drivers/dri/r300/r300_state.c
	src/mesa/drivers/dri/r300/r300_swtcl.c
	src/mesa/drivers/dri/r300/r500_fragprog.c
	src/mesa/drivers/dri/r300/r500_fragprog.h
2008-05-02 20:49:13 -07:00
Corbin Simpson
568d369d77 Merge branch 'r345-cleanup' of git://people.freedesktop.org/~agd5f/mesa into r500test
Adding Alex's cleanup patches. This adds r5xx TCL! Whoo-hoo!
Conflicts:

	src/mesa/drivers/dri/r300/r300_state.c
	src/mesa/drivers/dri/radeon/radeon_chipset.h
	src/mesa/drivers/dri/radeon/radeon_screen.c
2008-05-02 15:57:57 -07:00
Corbin Simpson
92a0e93ac3 Make radeon stuff build again.
Yet more evidence that I am incompetent with git.
2008-05-02 15:33:02 -07:00
Alex Deucher
ae09292a6e R300: fix rebase conflicts 2008-05-02 15:20:28 -04:00
Corbin Simpson
9a82fde43a Merge branch 'r500test' of git://people.freedesktop.org/~airlied/mesa into r500test
Conflicts:

	src/mesa/drivers/dri/r300/r300_cmdbuf.c
	src/mesa/drivers/dri/r300/r300_ioctl.c
	src/mesa/drivers/dri/r300/r300_state.c
	src/mesa/drivers/dri/r300/r500_fragprog.c
	src/mesa/drivers/dri/r300/r500_fragprog.h
	src/mesa/drivers/dri/radeon/radeon_chipset.h
	src/mesa/drivers/dri/radeon/radeon_screen.c
2008-05-02 12:15:44 -07:00
Alex Deucher
9e7ae34da5 R3/4/5: fix TCL on r5xx, cleanup PVS code 2008-05-02 15:13:49 -04:00
Alex Deucher
a94cd0d774 R300: fix VAP_OUTPUT_VTX_FMT_1 defines 2008-05-02 15:13:49 -04:00
Alex Deucher
d5448ceb95 R300: cleanup VAP_CLIP_CNTL 2008-05-02 15:13:49 -04:00
Alex Deucher
e61dadf3de R300: clean up VAP_PROG_STREAM_CNTL* register usage 2008-05-02 15:13:49 -04:00
Alex Deucher
2bd26f4afa Update comment 2008-05-02 15:13:49 -04:00
Alex Deucher
e3721a3b3f R5xx: various updates
- fixup VAP_CNTL setup
- remove extra instruction in r5xx passthrough shader
- add notes about pipe config
2008-05-02 15:13:48 -04:00
Alex Deucher
831fc138c1 R5xx: Add R5xx pci ids 2008-05-02 15:13:48 -04:00
Dave Airlie
28904e54d2 fixup r500 bits for renaming 2008-05-02 15:13:48 -04:00
Dave Airlie
de9c1c3627 r500: fixup fake shader to keep gears going 2008-05-02 15:13:48 -04:00
Dave Airlie
fbab11e9b0 r500: enable gb tiling for r5xx 2008-05-02 15:13:48 -04:00
Dave Airlie
6864220c28 r500: fixup support for emitting fragment program to hardware.
Also fixup the constant emission

this breaks glxgears from what I can see but its another step to correctness
2008-05-02 15:13:48 -04:00
Dave Airlie
3b7c5bfb98 r500: setup fragment program constant emission atom 2008-05-02 15:13:48 -04:00
Dave Airlie
6443da0865 r300: add rv530 pci id for the t60p laptop 2008-05-02 15:13:48 -04:00
Dave Airlie
c07534dc71 r300: this code really shouldn't be here.
For R500 just ignore it for now while I do something interesting like
run glxgears.
2008-05-02 15:13:48 -04:00
Dave Airlie
c0cb9bc84c mesa: cleanup state emission and rs for r500
trivial clear app now renders
2008-05-02 15:13:48 -04:00
Dave Airlie
a453b3154e r500 RS unit setup 2008-05-02 15:13:47 -04:00
Dave Airlie
ed1584aed8 more r500 vs r300 kickin 2008-05-02 15:13:47 -04:00
Dave Airlie
5a143e91dc some basic r500 portage 2008-05-02 15:12:37 -04:00
Dave Airlie
8aa98a409b r500: fragprog 2008-05-02 15:11:03 -04:00
Corbin Simpson
b15c49e59b r5xx: Fragprog shader now handles TEX/TXP correctly. 2008-05-02 12:06:21 -07:00
Corbin Simpson
029cb1fd0f Start of TEX/TXP support.
Still having problems with temps and consts, though...
2008-05-02 12:06:21 -07:00
Corbin Simpson
b5246de562 Added OPCODE_ABS, slightly fixed ADD/SUB 2008-05-02 12:06:21 -07:00
Corbin Simpson
6e96ea535a Initial r5xx fragment program compiler support.
Includes fallback shader and a handful of working opcodes.
2008-05-02 12:06:21 -07:00
Corbin Simpson
c02d1863d1 Add chip id 71D5 (RV530 M66) to radeon_chipset.h 2008-05-02 12:06:21 -07:00
Dave Airlie
d06e61aa80 fixup r500 bits for renaming 2008-05-02 12:06:21 -07:00
Dave Airlie
a3996ba2d1 r500: fixup fake shader to keep gears going 2008-05-02 12:06:21 -07:00
Dave Airlie
8e33a83b68 r500: enable gb tiling for r5xx 2008-05-02 12:06:21 -07:00
Dave Airlie
70335540c6 r500: fixup support for emitting fragment program to hardware.
Also fixup the constant emission

this breaks glxgears from what I can see but its another step to correctness
2008-05-02 12:06:21 -07:00
Dave Airlie
14c3bdb3f7 r500: setup fragment program constant emission atom 2008-05-02 12:06:21 -07:00
Dave Airlie
e46c3d7bcf r300: add rv530 pci id for the t60p laptop 2008-05-02 12:06:21 -07:00
Dave Airlie
99e75135ee r300: this code really shouldn't be here.
For R500 just ignore it for now while I do something interesting like
run glxgears.
2008-05-02 12:06:21 -07:00
Dave Airlie
9d9f66cc8d mesa: cleanup state emission and rs for r500
trivial clear app now renders
2008-05-02 12:06:21 -07:00
Dave Airlie
a87914993d r500 RS unit setup 2008-05-02 12:06:21 -07:00
Dave Airlie
55418dc87d more r500 vs r300 kickin 2008-05-02 12:06:21 -07:00
Dave Airlie
2ffa112ed3 some basic r500 portage 2008-05-02 12:05:28 -07:00
Dave Airlie
cd66f0e2d9 r500: fragprog 2008-05-02 12:04:04 -07:00
Alex Deucher
1226aba119 R3/4/5: fix TCL on r5xx, cleanup PVS code 2008-05-02 13:56:56 -04:00
Alex Deucher
25d9f2dd24 R300: fix VAP_OUTPUT_VTX_FMT_1 defines 2008-05-02 13:03:48 -04:00
Alex Deucher
734ef96d5f R300: cleanup VAP_CLIP_CNTL 2008-05-02 12:48:39 -04:00
Alex Deucher
db1fc51ccc R300: clean up VAP_PROG_STREAM_CNTL* register usage 2008-05-02 12:29:40 -04:00
Alex Deucher
45077fc323 Update comment 2008-05-02 10:54:20 -04:00
Alex Deucher
279ea105d8 R5xx: various updates
- fixup VAP_CNTL setup
- remove extra instruction in r5xx passthrough shader
- add notes about pipe config
2008-05-02 10:51:40 -04:00
Alex Deucher
f25b37c1da R5xx: Add R5xx pci ids 2008-05-01 16:02:58 -04:00
Alex Deucher
44791e2d78 Merge branch 'r500test' of git://people.freedesktop.org/~airlied/mesa into r345-cleanup 2008-05-01 14:51:26 -04:00
Dave Airlie
eff6f12032 fixup r500 bits for renaming 2008-04-16 20:42:15 +10:00
Dave Airlie
09df5eaff2 Merge branch 'master' into r500test
Conflicts:

	src/mesa/drivers/dri/r300/r300_cmdbuf.c
	src/mesa/drivers/dri/r300/r300_ioctl.c
2008-04-16 20:25:08 +10:00
Dave Airlie
9566cf0e2f r500: fixup fake shader to keep gears going 2008-03-22 11:00:25 +10:00
Dave Airlie
4feac4e40e r500: enable gb tiling for r5xx 2008-03-22 10:56:48 +10:00
Dave Airlie
583ed4bde3 r500: fixup support for emitting fragment program to hardware.
Also fixup the constant emission

this breaks glxgears from what I can see but its another step to correctness
2008-03-22 10:55:32 +10:00
Dave Airlie
3eb8e5871f r500: setup fragment program constant emission atom 2008-03-21 17:05:29 +10:00
Dave Airlie
ed18005a99 r300: add rv530 pci id for the t60p laptop 2008-03-20 14:34:04 +10:00
Dave Airlie
d019f101e8 r300: this code really shouldn't be here.
For R500 just ignore it for now while I do something interesting like
run glxgears.
2008-03-20 14:30:59 +10:00
Dave Airlie
2b8e422b31 mesa: cleanup state emission and rs for r500
trivial clear app now renders
2008-03-20 14:21:10 +10:00
Dave Airlie
9e6e4ae49a r500 RS unit setup 2008-03-20 13:57:22 +10:00
Dave Airlie
57028236c8 more r500 vs r300 kickin 2008-03-19 16:29:11 +10:00
Dave Airlie
1c71ec4d45 some basic r500 portage 2008-03-17 21:09:49 +10:00
Dave Airlie
5da8289e9c r500: fragprog 2008-03-17 19:05:44 +10:00
264 changed files with 20032 additions and 15435 deletions

View File

@@ -174,10 +174,10 @@ ultrix-gcc:
# Rules for making release tarballs
DIRECTORY = Mesa-7.1-rc1
LIB_NAME = MesaLib-7.1-rc1
DEMO_NAME = MesaDemos-7.1-rc1
GLUT_NAME = MesaGLUT-7.1-rc1
DIRECTORY = Mesa-7.1-rc3
LIB_NAME = MesaLib-7.1-rc3
DEMO_NAME = MesaDemos-7.1-rc3
GLUT_NAME = MesaGLUT-7.1-rc3
MAIN_FILES = \
$(DIRECTORY)/Makefile* \
@@ -192,6 +192,7 @@ MAIN_FILES = \
$(DIRECTORY)/bin/install-sh \
$(DIRECTORY)/bin/mklib \
$(DIRECTORY)/bin/minstall \
$(DIRECTORY)/bin/version.mk \
$(DIRECTORY)/configs/[a-z]* \
$(DIRECTORY)/docs/*.html \
$(DIRECTORY)/docs/COPYING \
@@ -257,6 +258,7 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/tnl_dd/*.[ch] \
$(DIRECTORY)/src/mesa/tnl_dd/imm/*.[ch] \
$(DIRECTORY)/src/mesa/tnl_dd/imm/NOTES.imm \
$(DIRECTORY)/src/mesa/drivers/Makefile \
$(DIRECTORY)/src/mesa/drivers/beos/*.cpp \
$(DIRECTORY)/src/mesa/drivers/beos/Makefile \
$(DIRECTORY)/src/mesa/drivers/common/*.[ch] \
@@ -264,6 +266,7 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/drivers/directfb/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/directfb/Makefile \
$(DIRECTORY)/src/mesa/drivers/dos/*.[chS] \
$(DIRECTORY)/src/mesa/drivers/fbdev/Makefile \
$(DIRECTORY)/src/mesa/drivers/fbdev/glfbdev.c \
$(DIRECTORY)/src/mesa/drivers/glide/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/ggi/*.[ch] \
@@ -273,6 +276,7 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/drivers/ggi/display/*.c \
$(DIRECTORY)/src/mesa/drivers/ggi/display/fbdev.conf.in \
$(DIRECTORY)/src/mesa/drivers/ggi/include/ggi/mesa/*.h \
$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile \
$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile.win \
$(DIRECTORY)/src/mesa/drivers/osmesa/descrip.mms \
$(DIRECTORY)/src/mesa/drivers/osmesa/osmesa.def \
@@ -280,6 +284,7 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/drivers/svga/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/windows/*/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/windows/*/*.def \
$(DIRECTORY)/src/mesa/drivers/x11/Makefile \
$(DIRECTORY)/src/mesa/drivers/x11/descrip.mms \
$(DIRECTORY)/src/mesa/drivers/x11/*.[ch] \
$(DIRECTORY)/src/mesa/ppc/*.[ch] \
@@ -316,6 +321,7 @@ DRI_FILES = \
$(DIRECTORY)/src/glx/x11/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/dri/Makefile \
$(DIRECTORY)/src/mesa/drivers/dri/Makefile.template \
$(DIRECTORY)/src/mesa/drivers/dri/dri.pc.in \
$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.po \
$(DIRECTORY)/src/mesa/drivers/dri/*/*.[chS] \

View File

@@ -42,6 +42,8 @@ if [ $# -ge 2 ] ; then
exit 0
fi
PWDSAVE=`pwd`
# determine file's type
if [ -h "$FILE" ] ; then
#echo $FILE is a symlink
@@ -57,7 +59,6 @@ if [ $# -ge 2 ] ; then
FILE=`basename "$FILE"`
# Go to $DEST and make the link
PWDSAVE="$PWD"
cd "$DEST" # pushd
$RM "$FILE"
$SYMLINK "$TARGET" "$FILE"

View File

@@ -61,7 +61,8 @@ do
echo ' -minor N specifies minor version number (default is 0)'
echo ' -patch N specifies patch version number (default is 0)'
echo ' -lLIBRARY specifies a dependency on LIBRARY'
echo ' -LDIR search in DIR for library dependencies'
echo ' -LDIR search in DIR for library dependencies at build time'
echo ' -RDIR search in DIR for library dependencies at run time'
echo ' -linker L explicity specify the linker program to use (eg: gcc, g++)'
echo ' Not observed on all systems at this time.'
echo ' -ldflags OPT specify any additional linker flags in OPT'
@@ -107,6 +108,9 @@ do
-L*)
DEPS="$DEPS $1"
;;
-R*)
DEPS="$DEPS $1"
;;
-Wl*)
DEPS="$DEPS $1"
;;
@@ -336,7 +340,7 @@ case $ARCH in
# use g++
LINK="g++"
else
echo "mklib: warning: can't find C++ comiler, trying CC."
echo "mklib: warning: can't find C++ compiler, trying CC."
LINK="CC"
fi
else
@@ -365,9 +369,11 @@ case $ARCH in
# Check if objects are SPARC v9
# file says: ELF 64-bit MSB relocatable SPARCV9 Version 1
set ${OBJECTS}
SPARCV9=`file $1 | grep SPARCV9`
if [ "${SPARCV9}" ] ; then
OPTS="${OPTS} -xarch=v9"
if [ ${LINK} = "cc" -o ${LINK} = "CC" ] ; then
SPARCV9=`file $1 | grep SPARCV9`
if [ "${SPARCV9}" ] ; then
OPTS="${OPTS} -xarch=v9"
fi
fi
if [ "${ALTOPTS}" ] ; then
OPTS=${ALTOPTS}
@@ -379,7 +385,7 @@ case $ARCH in
${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
else
rm -f ${LIBNAME}.${MAJOR} ${LIBNAME}
${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS}
${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.${MAJOR} -h ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS}
ln -s ${LIBNAME}.${MAJOR} ${LIBNAME}
fi
FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}"

View File

@@ -89,12 +89,18 @@ EXPAT_INCLUDES = @EXPAT_INCLUDES@
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
includedir = @includedir@
# Installation directories (for make install)
INSTALL_DIR = $(prefix)
INSTALL_LIB_DIR = $(libdir)
INSTALL_INC_DIR = $(includedir)
# DRI installation directories
DRI_DRIVER_INSTALL_DIR = @DRI_DRIVER_INSTALL_DIR@
# Where libGL will look for DRI hardware drivers
DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR)
# Additional per-platform configuration settings
@EXTRA_CONFIG_LINES@

View File

@@ -84,7 +84,9 @@ APP_LIB_DEPS = -lm
# Installation directories (for make install)
INSTALL_DIR = /usr/local
DRI_DRIVER_INSTALL_DIR = $(INSTALL_DIR)/$(LIB_DIR)/dri
INSTALL_LIB_DIR = $(INSTALL_DIR)/$(LIB_DIR)
INSTALL_INC_DIR = $(INSTALL_DIR)/include
DRI_DRIVER_INSTALL_DIR = $(INSTALL_LIB_DIR)/dri
# Where libGL will look for DRI hardware drivers
DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR)

View File

@@ -29,6 +29,18 @@ AC_CHECK_PROGS([MAKE], [gmake make])
AC_PATH_PROG([MKDEP], [makedepend])
AC_PATH_PROG([SED], [sed])
dnl Platform-specific program settings
EXTRA_CONFIG_LINES=""
AC_SUBST([EXTRA_CONFIG_LINES])
case "$host_os" in
solaris*)
# Solaris /bin/sh is too old/non-POSIX compliant
AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
EXTRA_CONFIG_LINES="SHELL=$POSIX_SHELL"
;;
esac
MKDEP_OPTIONS=-fdepend
dnl Ask gcc where it's keeping its secret headers
if test "x$GCC" = xyes; then
@@ -39,11 +51,6 @@ if test "x$GCC" = xyes; then
fi
AC_SUBST([MKDEP_OPTIONS])
dnl Check to see if dlopen is in default libraries (like Solaris, which
dnl has it in libc), or if libdl is needed to get it.
AC_CHECK_FUNC([dlopen], [],
[AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
dnl Make sure the pkg-config macros are defined
m4_ifdef([PKG_PROG_PKG_CONFIG],[],[
m4_errprint([Error: Could not locate the pkg-config autoconf macros.
@@ -78,7 +85,10 @@ linux*)
if test "x$GCC" = xyes; then
DEFINES="$DEFINES -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
fi
DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN"
DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS"
;;
solaris*)
DEFINES="$DEFINES -DPTHREADS -DSVR4"
;;
esac
@@ -230,6 +240,120 @@ AC_SUBST([GLUT_LIB_NAME])
AC_SUBST([GLW_LIB_NAME])
AC_SUBST([OSMESA_LIB_NAME])
dnl
dnl Arch/platform-specific settings
dnl
AC_ARG_ENABLE([asm],
[AS_HELP_STRING([--disable-asm],
[disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
[enable_asm="$enableval"],
[enable_asm=yes]
)
asm_arch=""
ASM_FLAGS=""
ASM_SOURCES=""
ASM_API=""
AC_MSG_CHECKING([whether to enable assembly])
test "x$enable_asm" = xno && AC_MSG_RESULT([no])
# disable if cross compiling on x86/x86_64 since we must run gen_matypes
if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
case "$host_cpu" in
i?86 | x86_64)
enable_asm=no
AC_MSG_RESULT([no, cross compiling])
;;
esac
fi
# check for supported arches
if test "x$enable_asm" = xyes; then
case "$host_cpu" in
i?86)
case "$host_os" in
linux* | freebsd* | dragonfly*)
test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
;;
esac
;;
x86_64)
case "$host_os" in
linux* | freebsd* | dragonfly*)
test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
;;
esac
;;
powerpc)
case "$host_os" in
linux*)
asm_arch=ppc
;;
esac
;;
esac
case "$asm_arch" in
x86)
ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
ASM_SOURCES='$(X86_SOURCES)'
ASM_API='$(X86_API)'
AC_MSG_RESULT([yes, x86])
;;
x86_64)
ASM_FLAGS="-DUSE_X86_64_ASM"
ASM_SOURCES='$(X86-64_SOURCES)'
ASM_API='$(X86-64_API)'
AC_MSG_RESULT([yes, x86_64])
;;
ppc)
ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
ASM_SOURCES='$(PPC_SOURCES)'
AC_MSG_RESULT([yes, ppc])
;;
*)
AC_MSG_RESULT([no, platform not supported])
;;
esac
fi
AC_SUBST([ASM_FLAGS])
AC_SUBST([ASM_SOURCES])
AC_SUBST([ASM_API])
dnl PIC code macro
MESA_PIC_FLAGS
dnl Check to see if dlopen is in default libraries (like Solaris, which
dnl has it in libc), or if libdl is needed to get it.
AC_CHECK_FUNC([dlopen], [],
[AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
dnl See if posix_memalign is available
AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
dnl SELinux awareness.
AC_ARG_ENABLE([selinux],
[AS_HELP_STRING([--enable-selinux],
[Build SELinux-aware Mesa @<:@default=disabled@:>@])],
[MESA_SELINUX="$enableval"],
[MESA_SELINUX=no])
if test "x$enable_selinux" = "xyes"; then
AC_CHECK_HEADER([selinux/selinux.h],[],
[AC_MSG_ERROR([SELinux headers not found])])
AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
[AC_MSG_ERROR([SELinux library not found])])
SELINUX_LIBS="-lselinux"
DEFINES="$DEFINES -DMESA_SELINUX"
fi
dnl OS-specific libraries
OS_LIBS=""
case "$host_os" in
solaris*)
OS_LIBS="-lc"
if test "x$GXX" != xyes; then
OS_CPLUSPLUS_LIBS="-lCrun $OS_LIBS"
fi
;;
esac
dnl
dnl Driver configuration. Options are xlib, dri and osmesa right now.
dnl More later: directfb, fbdev, ...
@@ -368,21 +492,6 @@ else
enable_xcb=no
fi
# SELinux awareness.
AC_ARG_ENABLE([selinux],
[AS_HELP_STRING([--enable-selinux],
[Build SELinux-aware Mesa (default: disabled)])],
[MESA_SELINUX="$enableval"],
[MESA_SELINUX=no])
if test "x$enable_selinux" = "xyes"; then
AC_CHECK_HEADER([selinux/selinux.h],[],
[AC_MSG_ERROR([SELinux headers not found])])
AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
[AC_MSG_ERROR([SELinux library not found])])
SELINUX_LIBS="-lselinux"
DEFINES="$DEFINES -DMESA_SELINUX"
fi
dnl
dnl libGL configuration per driver
dnl
@@ -397,7 +506,7 @@ xlib)
X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
fi
GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $OS_LIBS"
# if static, move the external libraries to the programs
# and empty the libraries for libGL
@@ -441,11 +550,11 @@ dri)
fi
# need DRM libs, -lpthread, etc.
GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS $OS_LIBS"
;;
osmesa)
# No libGL for osmesa
GL_LIB_DEPS=""
GL_LIB_DEPS="$OS_LIBS"
;;
esac
AC_SUBST([GL_LIB_DEPS])
@@ -478,11 +587,25 @@ AC_ARG_ENABLE([driglx-direct],
[enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
[driglx_direct="$enableval"],
[driglx_direct="yes"])
dnl ttm support
AC_ARG_ENABLE([ttm-api],
[AS_HELP_STRING([--enable-ttm-api],
[enable TTM API users @<:@default=disabled@:>@])],
[ttmapi="$enableval"],
[ttmapi="no"])
if test "x$ttmapi" = "xyes"; then
save_CFLAGS=$CFLAGS
CFLAGS=$LIBDRM_CFLAGS
AC_CHECK_HEADERS([xf86mm.h],[],[AC_MSG_ERROR([xf86mm.h required for TTM.])],[#include "stdint.h"\n#include "drm.h"])
CFLAGS=$save_CFLAGS
fi
dnl Which drivers to build - default is chosen by platform
AC_ARG_WITH([dri-drivers],
[AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
[comma delimited DRI drivers, e.g. "i965,radeon,nouveau" @<:@default=auto@:>@])],
[comma delimited DRI drivers list, e.g.
"swrast,i965,radeon,nouveau" @<:@default=auto@:>@])],
[with_dri_drivers="$withval"],
[with_dri_drivers=yes])
if test "x$with_dri_drivers" = x; then
@@ -496,7 +619,7 @@ case "$with_dri_drivers" in
no|yes) ;;
*)
# verify the requested driver directories exist
dri_drivers=`IFS=,; echo $with_dri_drivers`
dri_drivers=`IFS=', '; echo $with_dri_drivers`
for driver in $dri_drivers; do
test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
@@ -516,6 +639,10 @@ if test "$mesa_driver" = dri; then
DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
fi
if test "x$ttmapi" = xyes; then
DEFINES="$DEFINES -DTTM_API"
fi
if test "x$USING_EGL" = x1; then
PROGRAM_DIRS="egl"
fi
@@ -547,6 +674,12 @@ if test "$mesa_driver" = dri; then
DRI_DIRS="mach64 r128 r200 r300 radeon tdfx swrast"
fi
;;
sparc*)
# Build only the drivers for cards that exist on sparc`
if test "x$DRI_DIRS" = x; then
DRI_DIRS="mach64 r128 r200 r300 radeon ffb swrast"
fi
;;
esac
;;
freebsd* | dragonfly*)
@@ -567,6 +700,13 @@ if test "$mesa_driver" = dri; then
unichrome savage sis swrast"
fi
;;
solaris*)
DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
if test "x$driglx_direct" = xyes; then
DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
fi
;;
esac
# default drivers
@@ -646,7 +786,7 @@ AC_SUBST([OSMESA_LIB])
case "$mesa_driver" in
osmesa)
# only link librararies with osmesa if shared
# only link libraries with osmesa if shared
if test "$enable_static" = no; then
OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
else
@@ -657,7 +797,7 @@ osmesa)
*)
# Link OSMesa to libGL otherwise
OSMESA_LIB_DEPS=""
# only link librararies with osmesa if shared
# only link libraries with osmesa if shared
if test "$enable_static" = no; then
OSMESA_MESA_DEPS='-l$(GL_LIB)'
else
@@ -665,6 +805,9 @@ osmesa)
fi
;;
esac
if test "$enable_static" = no; then
OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS $OS_LIBS"
fi
AC_SUBST([OSMESA_LIB_DEPS])
AC_SUBST([OSMESA_MESA_DEPS])
@@ -708,6 +851,9 @@ if test "x$enable_glu" = xyes; then
;;
esac
fi
if test "$enable_static" = no; then
GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
fi
AC_SUBST([GLU_LIB_DEPS])
AC_SUBST([GLU_MESA_DEPS])
@@ -737,6 +883,7 @@ if test "x$enable_glw" = xyes; then
# If static, empty GLW_LIB_DEPS and add libs for programs to link
if test "$enable_static" = no; then
GLW_MESA_DEPS='-l$(GL_LIB)'
GLW_LIB_DEPS="$GLW_LIB_DEPS $OS_LIBS"
else
APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
GLW_LIB_DEPS=""
@@ -784,7 +931,7 @@ if test "x$enable_glut" = xyes; then
# should check these...
GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
fi
GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm $OS_LIBS"
# If glut is available, we can build most programs
if test "$with_demos" = yes; then
@@ -810,91 +957,18 @@ dnl Only libm is added here if necessary as the libraries should
dnl be pulled in by the linker
dnl
if test "x$APP_LIB_DEPS" = x; then
APP_LIB_DEPS="-lm"
case "$host_os" in
solaris*)
APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
;;
*)
APP_LIB_DEPS="-lm"
;;
esac
fi
AC_SUBST([APP_LIB_DEPS])
AC_SUBST([PROGRAM_DIRS])
dnl
dnl Arch/platform-specific settings
dnl
AC_ARG_ENABLE([asm],
[AS_HELP_STRING([--disable-asm],
[disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
[enable_asm="$enableval"],
[enable_asm=yes]
)
asm_arch=""
ASM_FLAGS=""
ASM_SOURCES=""
ASM_API=""
AC_MSG_CHECKING([whether to enable assembly])
test "x$enable_asm" = xno && AC_MSG_RESULT([no])
# disable if cross compiling on x86/x86_64 since we must run gen_matypes
if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
case "$host_cpu" in
i?86 | x86_64)
enable_asm=no
AC_MSG_RESULT([no, cross compiling])
;;
esac
fi
# check for supported arches
if test "x$enable_asm" = xyes; then
case "$host_cpu" in
i?86)
case "$host_os" in
linux* | freebsd* | dragonfly*)
test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
;;
esac
;;
x86_64)
case "$host_os" in
linux* | freebsd* | dragonfly*)
test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
;;
esac
;;
powerpc)
case "$host_os" in
linux*)
asm_arch=ppc
;;
esac
;;
esac
case "$asm_arch" in
x86)
ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
ASM_SOURCES='$(X86_SOURCES)'
ASM_API='$(X86_API)'
AC_MSG_RESULT([yes, x86])
;;
x86_64)
ASM_FLAGS="-DUSE_X86_64_ASM"
ASM_SOURCES='$(X86-64_SOURCES)'
ASM_API='$(X86-64_API)'
AC_MSG_RESULT([yes, x86_64])
;;
ppc)
ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
ASM_SOURCES='$(PPC_SOURCES)'
AC_MSG_RESULT([yes, ppc])
;;
*)
AC_MSG_RESULT([no, platform not supported])
;;
esac
fi
AC_SUBST([ASM_FLAGS])
AC_SUBST([ASM_SOURCES])
AC_SUBST([ASM_API])
dnl PIC code macro
MESA_PIC_FLAGS
dnl Restore LDFLAGS and CPPFLAGS
LDFLAGS="$_SAVE_LDFLAGS"
@@ -920,6 +994,7 @@ echo ""
echo " prefix: $prefix"
echo " exec_prefix: $exec_prefix"
echo " libdir: $libdir"
echo " includedir: $includedir"
dnl Driver info
echo ""
@@ -934,6 +1009,7 @@ if test "$mesa_driver" = dri; then
dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
echo " DRI drivers: $dri_dirs"
echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
echo " TTM API support: $ttmapi"
fi
dnl Libraries

View File

@@ -182,11 +182,12 @@ will search for DRI drivers. The default is <code>${libdir}/dri</code>.
</li>
<li><code>--with-dri-drivers=DRIVER,DRIVER,...</code> - This option
allows a specific set of DRI drivers to be built. For example,
<code>--with-dri-drivers="i965,radeon,nouveau"</code>. By default,
the drivers will be chosen depending on the target platform. See the
directory <code>src/mesa/drivers/dri</code> in the source tree for
available drivers.
</li>
<code>--with-dri-drivers="swrast,i965,radeon,nouveau"</code>. By
default, the drivers will be chosen depending on the target platform.
See the directory <code>src/mesa/drivers/dri</code> in the source tree
for available drivers. Beware that the swrast DRI driver is used by both
libGL and the X.Org xserver GLX module to do software rendering, so you
may run into problems if it is not available.</li>
<!-- This explanation might be totally bogus. Kristian? -->
<li><code>--disable-driglx-direct</code> - Disable direct rendering in
GLX. Normally, direct hardware rendering through the DRI drivers and

View File

@@ -18,6 +18,11 @@ Primary download site:
target="_parent">SourceForge</a>
</p>
<p>
When a new release is coming, release candidates (betas) can be found
<a href="http://www.mesa3d.org/beta/">here</a>.
</p>
<p>
Mesa is distributed in several parts:

View File

@@ -25,23 +25,12 @@
<h3>1.1 Prerequisites for DRI and Hardware Acceleration</h3>
<p>
To build Mesa with DRI-based hardware acceleration you must first have
the right version of DRM.
To build Mesa 7.1 with DRI-based hardware acceleration you must first have
the <a href="http://dri.freedesktop.org/libdrm/" target="_parent">DRM version 2.3.1</a>.
</p>
<p>
For Mesa 7.1 a particular snapshot of
<a href="http://dri.freedesktop.org/libdrm/">DRM</a> from git is required:
</p>
<pre>
git-clone git://anongit.freedesktop.org/git/mesa/drm
git-checkout (XXXX HASH ID TBD)
</pre>
</li>
<p>
You should also be using Xorg server version 1.4
You should also be using the Xorg server version 1.4 or 1.5.
</p>

View File

@@ -26,13 +26,20 @@ TBD
<h2>New features</h2>
<ul>
<li>autoconf-based configuration
<li>autoconf-based configuration (and clean-up of Makefiles)
<li>Reduced dependencies between X server and Mesa
<li>GL_EXT_texture_from_pixmap extension for Xlib driver
<li>Support for the GL shading language with i965 driver (implemented by Intel)
</ul>
<h2>Bug fixes</h2>
<ul>
<li>Fixed a number of minor GLSL intrinsic function/constructor bugs
<li>Fixed some error code/detection bugs in the GLSL-related API functions
</ul>
<h2>To Do (someday) items</h2>
<ul>
<li>Remove the MEMCPY() and _mesa_memcpy() wrappers and just use memcpy().

View File

@@ -1,17 +1,17 @@
<html>
<head>
<title>Mesa Source Code Documentation</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="qindex">
<a class="qindex" href="../main/index.html">core</a> |
<a class="qindex" href="../glapi/index.html">glapi</a> |
<a class="qindex" href="../vbo/index.html">vbo</a> |
<a class="qindex" href="../math/index.html">math</a> |
<a class="qindex" href="../shader/index.html">shader</a> |
<a class="qindex" href="../swrast/index.html">swrast</a> |
<a class="qindex" href="../swrast_setup/index.html">swrast_setup</a> |
<a class="qindex" href="../tnl/index.html">tnl</a> |
<a class="qindex" href="../tnl_dd/index.html">tnl_dd</a>
</div>
<html>
<head>
<title>Mesa Source Code Documentation</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="qindex">
<a class="qindex" href="../main/index.html">core</a> |
<a class="qindex" href="../glapi/index.html">glapi</a> |
<a class="qindex" href="../vbo/index.html">vbo</a> |
<a class="qindex" href="../math/index.html">math</a> |
<a class="qindex" href="../shader/index.html">shader</a> |
<a class="qindex" href="../swrast/index.html">swrast</a> |
<a class="qindex" href="../swrast_setup/index.html">swrast_setup</a> |
<a class="qindex" href="../tnl/index.html">tnl</a> |
<a class="qindex" href="../tnl_dd/index.html">tnl_dd</a>
</div>

View File

@@ -1,11 +1,11 @@
<html>
<head><title>Mesa Source Code Documentation</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="qindex">
<a class="qindex" href="../core_subset/index.html">Mesa Core</a> |
<a class="qindex" href="../math_subset/index.html">math</a> |
<a class="qindex" href="../miniglx/index.html">MiniGLX</a> |
<a class="qindex" href="../radeon_subset/index.html">radeon_subset</a>
</div>
<html>
<head><title>Mesa Source Code Documentation</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="qindex">
<a class="qindex" href="../core_subset/index.html">Mesa Core</a> |
<a class="qindex" href="../math_subset/index.html">math</a> |
<a class="qindex" href="../miniglx/index.html">MiniGLX</a> |
<a class="qindex" href="../radeon_subset/index.html">radeon_subset</a>
</div>

View File

@@ -1,76 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 3.0
* Copyright (C) 1995-1998 Brian Paul
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Example Foo/Mesa interface. See src/ddsample.c for more info.
*/
#ifndef FOOMESA_H
#define FOOMESA_H
typedef struct foo_mesa_visual *FooMesaVisual;
typedef struct foo_mesa_buffer *FooMesaBuffer;
typedef struct foo_mesa_context *FooMesaContext;
#ifdef BEOS
#pragma export on
#endif
extern FooMesaVisual FooMesaChooseVisual( /* your params */ );
extern void FooMesaDestroyVisual( FooMesaVisual visual );
extern FooMesaBuffer FooMesaCreateBuffer( FooMesaVisual visual,
void *your_window_id );
extern void FooMesaDestroyBuffer( FooMesaBuffer buffer );
extern FooMesaContext FooMesaCreateContext( FooMesaVisual visual,
FooMesaContext sharelist );
extern void FooMesaDestroyContext( FooMesaContext context );
extern void FooMesaMakeCurrent( FooMesaContext context, FooMesaBuffer buffer );
extern void FooMesaSwapBuffers( FooMesaBuffer buffer );
/* Probably some more functions... */
#ifdef BEOS
#pragma export off
#endif
#endif

View File

@@ -130,7 +130,7 @@ extern void WMesaPaletteChange(HPALETTE Pal);
extern void WMesaMove(void);
void WMesaShareLists(WMesaContext ctx_to_share, WMesaContext ctx);
#ifdef __cplusplus
}

View File

@@ -955,7 +955,6 @@ Init(void)
glGenTextures(1, &GrayTexture);
glBindTexture(GL_TEXTURE_1D, GrayTexture);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
{

View File

@@ -76,6 +76,7 @@ int textureWidth = 64;
int textureHeight = 64;
int winWidth = 580, winHeight = 720;
int win;
struct formatInfo {
GLenum baseFormat;
@@ -288,6 +289,7 @@ static void keyboard( unsigned char c, int x, int y )
displayLevelInfo = !displayLevelInfo;
break;
case 27: /* Escape key should force exit. */
glutDestroyWindow(win);
exit(0);
break;
default:
@@ -785,7 +787,7 @@ int main( int argc, char *argv[] )
glutInitWindowSize( winWidth, winHeight );
glutInitWindowPosition( 0, 0 );
glutCreateWindow( "Texture Environment Test" );
win = glutCreateWindow( "Texture Environment Test" );
initialize();
instructions();

View File

@@ -4,10 +4,13 @@ bump
deriv
extfuncs.h
mandelbrot
multitex
noise
points
readtex.c
readtex.h
shaderutil.c
shaderutil.h
texdemo1
toyball
trirast

View File

@@ -407,7 +407,10 @@ test(GLenum type, GLint bits, const char *filename)
glGetIntegerv(GL_ALPHA_BITS, &cBits);
assert(cBits == bits);
printf("Rendering %d bit/channel image: %s\n", bits, filename);
if (WriteFiles)
printf("Rendering %d bit/channel image: %s\n", bits, filename);
else
printf("Rendering %d bit/channel image\n", bits);
OSMesaColorClamp(GL_TRUE);
@@ -458,6 +461,8 @@ main( int argc, char *argv[] )
{
int i;
printf("Use -f to write image files\n");
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-f") == 0)
WriteFiles = GL_TRUE;

View File

@@ -16,6 +16,7 @@
static GLfloat Zrot = 0;
static GLboolean Anim = GL_TRUE;
static GLboolean HaveMultisample = GL_TRUE;
static GLboolean DoMultisample = GL_TRUE;
static void
@@ -86,7 +87,10 @@ Display( void )
glColor3f(1, 1, 1);
if (HaveMultisample) {
glRasterPos2f(-3.1, -1.6);
PrintString("MULTISAMPLE");
if (DoMultisample)
PrintString("MULTISAMPLE");
else
PrintString("MULTISAMPLE (off)");
}
glRasterPos2f(-0.8, -1.6);
PrintString("No antialiasing");
@@ -96,7 +100,8 @@ Display( void )
/* multisample */
if (HaveMultisample) {
glEnable(GL_DEPTH_TEST);
glEnable(GL_MULTISAMPLE_ARB);
if (DoMultisample)
glEnable(GL_MULTISAMPLE_ARB);
glPushMatrix();
glTranslatef(-2.5, 0, 0);
glPushMatrix();
@@ -173,6 +178,9 @@ Key( unsigned char key, int x, int y )
else
glutIdleFunc(NULL);
break;
case 'm':
DoMultisample = !DoMultisample;
break;
case 'z':
Zrot = (int) (Zrot - step);
break;

View File

@@ -88,12 +88,18 @@ current_time(void)
#endif
/** Event handler results: */
#define NOP 0
#define EXIT 1
#define DRAW 2
static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
static GLint gear1, gear2, gear3;
static GLfloat angle = 0.0;
static GLboolean fullscreen = GL_FALSE; /* Create a single fullscreen window */
static GLboolean stereo = GL_FALSE; /* Enable stereo. */
static GLboolean animate = GL_TRUE; /* Animation */
static GLfloat eyesep = 5.0; /* Eye separation. */
static GLfloat fix_point = 40.0; /* Fixation point distance. */
static GLfloat left, right, asp; /* Stereo frustum params. */
@@ -239,7 +245,7 @@ gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
static void
do_draw(void)
draw(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -269,8 +275,9 @@ do_draw(void)
glPopMatrix();
}
static void
draw(void)
draw_gears(void)
{
if (stereo) {
/* First left eye. */
@@ -284,7 +291,7 @@ draw(void)
glPushMatrix();
glTranslated(+0.5 * eyesep, 0.0, 0.0);
do_draw();
draw();
glPopMatrix();
/* Then right eye. */
@@ -298,10 +305,50 @@ draw(void)
glPushMatrix();
glTranslated(-0.5 * eyesep, 0.0, 0.0);
do_draw();
draw();
glPopMatrix();
} else
do_draw();
}
else {
draw();
}
}
/** Draw single frame, do SwapBuffers, compute FPS */
static void
draw_frame(Display *dpy, Window win)
{
static int frames = 0;
static double tRot0 = -1.0, tRate0 = -1.0;
double dt, t = current_time();
if (tRot0 < 0.0)
tRot0 = t;
dt = t - tRot0;
tRot0 = t;
if (animate) {
/* advance rotation for next frame */
angle += 70.0 * dt; /* 70 degrees per second */
if (angle > 3600.0)
angle -= 3600.0;
}
draw_gears();
glXSwapBuffers(dpy, win);
frames++;
if (tRate0 < 0.0)
tRate0 = t;
if (t - tRate0 >= 5.0) {
GLfloat seconds = t - tRate0;
GLfloat fps = frames / seconds;
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds,
fps);
tRate0 = t;
frames = 0;
}
}
@@ -319,7 +366,8 @@ reshape(int width, int height)
left = -5.0 * ((w - 0.5 * eyesep) / fix_point);
right = 5.0 * ((w + 0.5 * eyesep) / fix_point);
} else {
}
else {
GLfloat h = (GLfloat) height / (GLfloat) width;
glMatrixMode(GL_PROJECTION);
@@ -430,6 +478,7 @@ make_window( Display *dpy, const char *name,
attr.border_pixel = 0;
attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
/* XXX this is a bad way to get a borderless window! */
attr.override_redirect = fullscreen;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect;
@@ -463,79 +512,70 @@ make_window( Display *dpy, const char *name,
}
/**
* Handle one X event.
* \return NOP, EXIT or DRAW
*/
static int
handle_event(Display *dpy, Window win, XEvent *event)
{
switch (event->type) {
case Expose:
return DRAW;
case ConfigureNotify:
reshape(event->xconfigure.width, event->xconfigure.height);
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event->xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event->xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 27) {
/* escape */
return EXIT;
}
else if (buffer[0] == 'a' || buffer[0] == 'A') {
animate = !animate;
}
}
return DRAW;
}
}
return NOP;
}
static void
event_loop(Display *dpy, Window win)
{
while (1) {
while (XPending(dpy) > 0) {
int op;
while (!animate || XPending(dpy) > 0) {
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
/* we'll redraw below */
break;
case ConfigureNotify:
reshape(event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 27) {
/* escape */
return;
}
}
}
}
op = handle_event(dpy, win, &event);
if (op == EXIT)
return;
else if (op == DRAW)
break;
}
{
static int frames = 0;
static double tRot0 = -1.0, tRate0 = -1.0;
double dt, t = current_time();
if (tRot0 < 0.0)
tRot0 = t;
dt = t - tRot0;
tRot0 = t;
/* advance rotation for next frame */
angle += 70.0 * dt; /* 70 degrees per second */
if (angle > 3600.0)
angle -= 3600.0;
draw();
glXSwapBuffers(dpy, win);
frames++;
if (tRate0 < 0.0)
tRate0 = t;
if (t - tRate0 >= 5.0) {
GLfloat seconds = t - tRate0;
GLfloat fps = frames / seconds;
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds,
fps);
tRate0 = t;
frames = 0;
}
}
draw_frame(dpy, win);
}
}
@@ -548,8 +588,7 @@ usage(void)
printf(" -stereo run in stereo mode\n");
printf(" -fullscreen run in fullscreen mode\n");
printf(" -info display OpenGL renderer info\n");
printf(" -winwidth <width> window width (default: 300)\n");
printf(" -winheight <height> window height (default: 300)\n");
printf(" -geometry WxH+X+Y window geometry\n");
}

View File

@@ -21,7 +21,7 @@ subdirs:
fi \
done
install:
install: $(TOP)/$(LIB_DIR)
@for dir in $(SUBDIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE) install) || exit 1 ; \
@@ -29,7 +29,7 @@ install:
done
$(TOP)/$(LIB_DIR):
-mkdir $(TOP)/$(LIB_DIR)
-@test -d $(TOP)/$(LIB_DIR) || mkdir -p $(TOP)/$(LIB_DIR)
clean:

View File

@@ -16,16 +16,17 @@ default: $(TOP)/configs/current
# GLU pkg-config file
pcedit = sed \
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
-e 's,@LIB_DIR@,$(LIB_DIR),' \
-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
-e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),'
glu.pc: glu.pc.in
$(pcedit) $< > $@
install: glu.pc
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
$(INSTALL) $(TOP)/$(LIB_DIR)/libGLU.* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
$(INSTALL) -m 644 glu.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
$(INSTALL) $(TOP)/$(LIB_DIR)/libGLU.* $(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) -m 644 glu.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
clean:
-@for dir in $(SUBDIRS) ; do \

View File

@@ -1,7 +1,7 @@
prefix=@INSTALL_DIR@
exec_prefix=${prefix}
libdir=${exec_prefix}/@LIB_DIR@
includedir=${prefix}/include
libdir=@INSTALL_LIB_DIR@
includedir=@INSTALL_INC_DIR@
Name: glu
Description: Mesa OpenGL Utility library

View File

@@ -713,8 +713,8 @@ gluSphere(GLUquadric *qobj, GLdouble radius, GLint slices, GLint stacks)
GLfloat cosCache3b[CACHE_SIZE];
GLfloat angle;
GLfloat zLow, zHigh;
GLfloat sintemp1, sintemp2, sintemp3 = 0.0, sintemp4 = 0.0;
GLfloat costemp1, costemp2 = 0.0, costemp3 = 0.0, costemp4 = 0.0;
GLfloat sintemp1 = 0.0, sintemp2 = 0.0, sintemp3 = 0.0, sintemp4 = 0.0;
GLfloat costemp1 = 0.0, costemp2 = 0.0, costemp3 = 0.0, costemp4 = 0.0;
GLboolean needCache2, needCache3;
GLint start, finish;

View File

@@ -69,10 +69,10 @@ $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
$(MKLIB_OPTIONS) $(OBJECTS)
install:
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_DIR)/include/GL
$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_INC_DIR)/GL
$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_LIB_DIR)
# Run 'make -f Makefile.solo dep' to update the dependencies if you change
# what's included by any source file.

View File

@@ -100,18 +100,19 @@ $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
# glut pkgconfig file
pcedit = sed \
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
-e 's,@LIB_DIR@,$(LIB_DIR),' \
-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
-e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),'
glut.pc: glut.pc.in
$(pcedit) $< > $@
install: glut.pc
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_DIR)/include/GL
$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
$(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_INC_DIR)/GL
$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
clean:

View File

@@ -1,7 +1,7 @@
prefix=@INSTALL_DIR@
exec_prefix=${prefix}
libdir=${exec_prefix}/@LIB_DIR@
includedir=${prefix}/include
libdir=@INSTALL_LIB_DIR@
includedir=@INSTALL_INC_DIR@
Name: glut
Description: Mesa OpenGL Utility Toolkit library

View File

@@ -75,18 +75,19 @@ tags:
# glut pkgconfig file
pcedit = sed \
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
-e 's,@LIB_DIR@,$(LIB_DIR),' \
-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
-e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),'
glut.pc: glut.pc.in
$(pcedit) $< > $@
install: glut.pc
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_DIR)/include/GL
$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
$(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_INC_DIR)/GL
$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
# Remove .o and backup files

View File

@@ -1,7 +1,7 @@
prefix=@INSTALL_DIR@
exec_prefix=${prefix}
libdir=${exec_prefix}/@LIB_DIR@
includedir=${prefix}/include
libdir=@INSTALL_LIB_DIR@
includedir=@INSTALL_INC_DIR@
Name: glut
Description: Mesa OpenGL Utility Toolkit library

View File

@@ -1,420 +1,420 @@
/* WarpWin.c */
/* glut for Warp */
#include <stdio.h>
#include <string.h>
#include "WarpWin.h"
#include "WarpGL.h"
#define POKA 0
/* global variables that must be set for some functions to operate
correctly. */
HDC XHDC;
HWND XHWND;
void
XStoreColor(Display* display, Colormap colormap, XColor* color)
{
/* KLUDGE: set XHDC to 0 if the palette should NOT be realized after
setting the color. set XHDC to the correct HDC if it should. */
LONG pe;
ULONG cclr;
int r,g,b;
/* X11 stores color from 0-65535, Win32 expects them to be 0-256, so
twiddle the bits ( / 256). */
r = color->red / 256;
g = color->green / 256;
b = color->blue / 256;
pe = LONGFromRGB(r,g,b);
/* make sure we use this flag, otherwise the colors might get mapped
to another place in the colormap, and when we glIndex() that
color, it may have moved (argh!!) */
pe |= (PC_NOCOLLAPSE<<24);
/* This function changes the entries in a palette. */
#if POKA
OS2:
rc = GpiSetPaletteEntries(colormap,LCOLF_CONSECRGB, color->pixel, 1, &pe);
GpiSelectPalette(hps,colormap);
WinRealizePalette(hwnd,hps,&cclr);
source Win:
if (XHDC) {
UnrealizeObject(colormap);
SelectPalette(XHDC, colormap, FALSE);
RealizePalette(XHDC);
}
#endif
}
void
XSetWindowColormap(Display* display, Window window, Colormap colormap)
{
#if POKA
HDC hdc = GetDC(window);
/* if the third parameter is FALSE, the logical colormap is copied
into the device palette when the application is in the
foreground, if it is TRUE, the colors are mapped into the current
palette in the best possible way. */
SelectPalette(hdc, colormap, FALSE);
RealizePalette(hdc);
/* note that we don't have to release the DC, since our window class
uses the WC_OWNDC flag! */
#endif
}
/* display, root and visual - don't used at all */
Colormap
XCreateColormap(Display* display, Window root, Visual* visual, int alloc)
{
/* KLUDGE: this function needs XHDC to be set to the HDC currently
being operated on before it is invoked! */
HPAL palette;
int n;
#if POKA
PIXELFORMATDESCRIPTOR pfd;
LOGPALETTE *logical;
/* grab the pixel format */
memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
DescribePixelFormat(XHDC, GetPixelFormat(XHDC),
sizeof(PIXELFORMATDESCRIPTOR), &pfd);
if (!(pfd.dwFlags & PFD_NEED_PALETTE ||
pfd.iPixelType == PFD_TYPE_COLORINDEX))
{
return 0;
}
n = 1 << pfd.cColorBits;
/* allocate a bunch of memory for the logical palette (assume 256
colors in a Win32 palette */
logical = (LOGPALETTE*)malloc(sizeof(LOGPALETTE) +
sizeof(PALETTEENTRY) * n);
memset(logical, 0, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * n);
/* set the entries in the logical palette */
logical->palVersion = 0x300;
logical->palNumEntries = n;
/* start with a copy of the current system palette */
GetSystemPaletteEntries(XHDC, 0, 256, &logical->palPalEntry[0]);
if (pfd.iPixelType == PFD_TYPE_RGBA) {
int redMask = (1 << pfd.cRedBits) - 1;
int greenMask = (1 << pfd.cGreenBits) - 1;
int blueMask = (1 << pfd.cBlueBits) - 1;
int i;
/* fill in an RGBA color palette */
for (i = 0; i < n; ++i) {
logical->palPalEntry[i].peRed =
(((i >> pfd.cRedShift) & redMask) * 255) / redMask;
logical->palPalEntry[i].peGreen =
(((i >> pfd.cGreenShift) & greenMask) * 255) / greenMask;
logical->palPalEntry[i].peBlue =
(((i >> pfd.cBlueShift) & blueMask) * 255) / blueMask;
logical->palPalEntry[i].peFlags = 0;
}
}
palette = CreatePalette(logical);
free(logical);
SelectPalette(XHDC, palette, FALSE);
RealizePalette(XHDC);
#endif /* POKA */
return palette;
}
int GetSystemMetrics( int mode)
{ RECTL rect;
switch(mode)
{ case SM_CXSCREEN:
WinQueryWindowRect(HWND_DESKTOP,&rect);
return (rect.xRight-rect.xLeft);
break;
case SM_CYSCREEN:
WinQueryWindowRect(HWND_DESKTOP,&rect);
return (rect.yTop-rect.yBottom);
break;
default: ;
}
return 0;
}
/*
* XParseGeometry parses strings of the form
* "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where
* width, height, xoffset, and yoffset are unsigned integers.
* Example: "=80x24+300-49"
* The equal sign is optional.
* It returns a bitmask that indicates which of the four values
* were actually found in the string. For each value found,
* the corresponding argument is updated; for each value
* not found, the corresponding argument is left unchanged.
*/
static int
ReadInteger(char *string, char **NextString)
{
register int Result = 0;
int Sign = 1;
if (*string == '+')
string++;
else if (*string == '-')
{
string++;
Sign = -1;
}
for (; (*string >= '0') && (*string <= '9'); string++)
{
Result = (Result * 10) + (*string - '0');
}
*NextString = string;
if (Sign >= 0)
return (Result);
else
return (-Result);
}
int XParseGeometry(char *string, int *x, int *y, unsigned int *width, unsigned int *height)
{
int mask = NoValue;
register char *strind;
unsigned int tempWidth, tempHeight;
int tempX, tempY;
char *nextCharacter;
if ( (string == NULL) || (*string == '\0')) return(mask);
if (*string == '=')
string++; /* ignore possible '=' at beg of geometry spec */
strind = (char *)string;
if (*strind != '+' && *strind != '-' && *strind != 'x') {
tempWidth = ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter)
return (0);
strind = nextCharacter;
mask |= WidthValue;
}
if (*strind == 'x' || *strind == 'X') {
strind++;
tempHeight = ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter)
return (0);
strind = nextCharacter;
mask |= HeightValue;
}
if ((*strind == '+') || (*strind == '-')) {
if (*strind == '-') {
strind++;
tempX = -ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter)
return (0);
strind = nextCharacter;
mask |= XNegative;
}
else
{ strind++;
tempX = ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter)
return(0);
strind = nextCharacter;
}
mask |= XValue;
if ((*strind == '+') || (*strind == '-')) {
if (*strind == '-') {
strind++;
tempY = -ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter)
return(0);
strind = nextCharacter;
mask |= YNegative;
}
else
{
strind++;
tempY = ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter)
return(0);
strind = nextCharacter;
}
mask |= YValue;
}
}
/* If strind isn't at the end of the string the it's an invalid
geometry specification. */
if (*strind != '\0') return (0);
if (mask & XValue)
*x = tempX;
if (mask & YValue)
*y = tempY;
if (mask & WidthValue)
*width = tempWidth;
if (mask & HeightValue)
*height = tempHeight;
return (mask);
}
int gettimeofday(struct timeval* tp, void* tzp)
{
DATETIME DateTime;
APIRET ulrc; /* Return Code. */
ulrc = DosGetDateTime(&DateTime);
tp->tv_sec = 60 * (60*DateTime.hours + DateTime.minutes) + DateTime.seconds;
tp->tv_usec = DateTime.hundredths * 10000;
return 0;
}
int
XPending(Display* display)
{
/* similar functionality...I don't think that it is exact, but this
will have to do. */
QMSG msg;
extern HAB hab; /* PM anchor block handle */
//?? WinPeekMsg(hab
return WinPeekMsg(hab, &msg, NULLHANDLE, 0, 0, PM_NOREMOVE);
}
void
__glutAdjustCoords(Window parent, int* x, int* y, int* width, int* height)
{
RECTL rect;
/* adjust the window rectangle because Win32 thinks that the x, y,
width & height are the WHOLE window (including decorations),
whereas GLUT treats the x, y, width & height as only the CLIENT
area of the window. */
rect.xLeft = *x; rect.yTop = *y;
rect.xRight = *x + *width; rect.yBottom = *y + *height;
/* must adjust the coordinates according to the correct style
because depending on the style, there may or may not be
borders. */
//?? AdjustWindowRect(&rect, WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
//?? (parent ? WS_CHILD : WS_OVERLAPPEDWINDOW),
//?? FALSE);
/* FALSE in the third parameter = window has no menu bar */
/* readjust if the x and y are offscreen */
if(rect.xLeft < 0) {
*x = 0;
} else {
*x = rect.xLeft;
}
if(rect.yTop < 0) {
*y = 0;
} else {
*y = rect.yTop;
}
*width = rect.xRight - rect.xLeft; /* adjusted width */
*height = -(rect.yBottom - rect.yTop); /* adjusted height */
}
int
__glutGetTransparentPixel(Display * dpy, XVisualInfo * vinfo)
{
/* the transparent pixel on Win32 is always index number 0. So if
we put this routine in this file, we can avoid compiling the
whole of layerutil.c which is where this routine normally comes
from. */
return 0;
}
/* Translate point coordinates src_x and src_y from src to dst */
Bool
XTranslateCoordinates(Display *display, Window src, Window dst,
int src_x, int src_y,
int* dest_x_return, int* dest_y_return,
Window* child_return)
{
SWP swp_src,swp_dst;
WinQueryWindowPos(src,&swp_src);
WinQueryWindowPos(dst,&swp_dst);
*dest_x_return = src_x + swp_src.x - swp_dst.x;
*dest_y_return = src_y + swp_src.y - swp_dst.y;
/* just to make compilers happy...we don't use the return value. */
return True;
}
Status
XGetGeometry(Display* display, Window window, Window* root_return,
int* x_return, int* y_return,
unsigned int* width_return, unsigned int* height_return,
unsigned int *border_width_return, unsigned int* depth_return)
{
/* KLUDGE: doesn't return the border_width or depth or root, x & y
are in screen coordinates. */
SWP swp_src;
WinQueryWindowPos(window,&swp_src);
*x_return = swp_src.x;
*y_return = swp_src.y;
*width_return = swp_src.cx;
*height_return = swp_src.cy;
/* just to make compilers happy...we don't use the return value. */
return 1;
}
/* Get Display Width in millimeters */
int
DisplayWidthMM(Display* display, int screen)
{
int width;
LONG *pVC_Caps;
pVC_Caps = GetVideoConfig(NULLHANDLE);
width = (int)( 0.001 * pVC_Caps[CAPS_WIDTH] / pVC_Caps[CAPS_HORIZONTAL_RESOLUTION]);/* mm */
return width;
}
/* Get Display Height in millimeters */
int
DisplayHeightMM(Display* display, int screen)
{
int height;
LONG *pVC_Caps;
pVC_Caps = GetVideoConfig(NULLHANDLE);
height = (int)( 0.001 * pVC_Caps[CAPS_HEIGHT] / pVC_Caps[CAPS_VERTICAL_RESOLUTION]); /* mm */
return height;
}
void ScreenToClient( HWND hwnd, POINTL *point)
{
SWP swp_src;
WinQueryWindowPos(hwnd,&swp_src);
point->x -= swp_src.x;
point->y -= swp_src.y;
}
/* WarpWin.c */
/* glut for Warp */
#include <stdio.h>
#include <string.h>
#include "WarpWin.h"
#include "WarpGL.h"
#define POKA 0
/* global variables that must be set for some functions to operate
correctly. */
HDC XHDC;
HWND XHWND;
void
XStoreColor(Display* display, Colormap colormap, XColor* color)
{
/* KLUDGE: set XHDC to 0 if the palette should NOT be realized after
setting the color. set XHDC to the correct HDC if it should. */
LONG pe;
ULONG cclr;
int r,g,b;
/* X11 stores color from 0-65535, Win32 expects them to be 0-256, so
twiddle the bits ( / 256). */
r = color->red / 256;
g = color->green / 256;
b = color->blue / 256;
pe = LONGFromRGB(r,g,b);
/* make sure we use this flag, otherwise the colors might get mapped
to another place in the colormap, and when we glIndex() that
color, it may have moved (argh!!) */
pe |= (PC_NOCOLLAPSE<<24);
/* This function changes the entries in a palette. */
#if POKA
OS2:
rc = GpiSetPaletteEntries(colormap,LCOLF_CONSECRGB, color->pixel, 1, &pe);
GpiSelectPalette(hps,colormap);
WinRealizePalette(hwnd,hps,&cclr);
source Win:
if (XHDC) {
UnrealizeObject(colormap);
SelectPalette(XHDC, colormap, FALSE);
RealizePalette(XHDC);
}
#endif
}
void
XSetWindowColormap(Display* display, Window window, Colormap colormap)
{
#if POKA
HDC hdc = GetDC(window);
/* if the third parameter is FALSE, the logical colormap is copied
into the device palette when the application is in the
foreground, if it is TRUE, the colors are mapped into the current
palette in the best possible way. */
SelectPalette(hdc, colormap, FALSE);
RealizePalette(hdc);
/* note that we don't have to release the DC, since our window class
uses the WC_OWNDC flag! */
#endif
}
/* display, root and visual - don't used at all */
Colormap
XCreateColormap(Display* display, Window root, Visual* visual, int alloc)
{
/* KLUDGE: this function needs XHDC to be set to the HDC currently
being operated on before it is invoked! */
HPAL palette;
int n;
#if POKA
PIXELFORMATDESCRIPTOR pfd;
LOGPALETTE *logical;
/* grab the pixel format */
memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
DescribePixelFormat(XHDC, GetPixelFormat(XHDC),
sizeof(PIXELFORMATDESCRIPTOR), &pfd);
if (!(pfd.dwFlags & PFD_NEED_PALETTE ||
pfd.iPixelType == PFD_TYPE_COLORINDEX))
{
return 0;
}
n = 1 << pfd.cColorBits;
/* allocate a bunch of memory for the logical palette (assume 256
colors in a Win32 palette */
logical = (LOGPALETTE*)malloc(sizeof(LOGPALETTE) +
sizeof(PALETTEENTRY) * n);
memset(logical, 0, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * n);
/* set the entries in the logical palette */
logical->palVersion = 0x300;
logical->palNumEntries = n;
/* start with a copy of the current system palette */
GetSystemPaletteEntries(XHDC, 0, 256, &logical->palPalEntry[0]);
if (pfd.iPixelType == PFD_TYPE_RGBA) {
int redMask = (1 << pfd.cRedBits) - 1;
int greenMask = (1 << pfd.cGreenBits) - 1;
int blueMask = (1 << pfd.cBlueBits) - 1;
int i;
/* fill in an RGBA color palette */
for (i = 0; i < n; ++i) {
logical->palPalEntry[i].peRed =
(((i >> pfd.cRedShift) & redMask) * 255) / redMask;
logical->palPalEntry[i].peGreen =
(((i >> pfd.cGreenShift) & greenMask) * 255) / greenMask;
logical->palPalEntry[i].peBlue =
(((i >> pfd.cBlueShift) & blueMask) * 255) / blueMask;
logical->palPalEntry[i].peFlags = 0;
}
}
palette = CreatePalette(logical);
free(logical);
SelectPalette(XHDC, palette, FALSE);
RealizePalette(XHDC);
#endif /* POKA */
return palette;
}
int GetSystemMetrics( int mode)
{ RECTL rect;
switch(mode)
{ case SM_CXSCREEN:
WinQueryWindowRect(HWND_DESKTOP,&rect);
return (rect.xRight-rect.xLeft);
break;
case SM_CYSCREEN:
WinQueryWindowRect(HWND_DESKTOP,&rect);
return (rect.yTop-rect.yBottom);
break;
default: ;
}
return 0;
}
/*
* XParseGeometry parses strings of the form
* "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where
* width, height, xoffset, and yoffset are unsigned integers.
* Example: "=80x24+300-49"
* The equal sign is optional.
* It returns a bitmask that indicates which of the four values
* were actually found in the string. For each value found,
* the corresponding argument is updated; for each value
* not found, the corresponding argument is left unchanged.
*/
static int
ReadInteger(char *string, char **NextString)
{
register int Result = 0;
int Sign = 1;
if (*string == '+')
string++;
else if (*string == '-')
{
string++;
Sign = -1;
}
for (; (*string >= '0') && (*string <= '9'); string++)
{
Result = (Result * 10) + (*string - '0');
}
*NextString = string;
if (Sign >= 0)
return (Result);
else
return (-Result);
}
int XParseGeometry(char *string, int *x, int *y, unsigned int *width, unsigned int *height)
{
int mask = NoValue;
register char *strind;
unsigned int tempWidth, tempHeight;
int tempX, tempY;
char *nextCharacter;
if ( (string == NULL) || (*string == '\0')) return(mask);
if (*string == '=')
string++; /* ignore possible '=' at beg of geometry spec */
strind = (char *)string;
if (*strind != '+' && *strind != '-' && *strind != 'x') {
tempWidth = ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter)
return (0);
strind = nextCharacter;
mask |= WidthValue;
}
if (*strind == 'x' || *strind == 'X') {
strind++;
tempHeight = ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter)
return (0);
strind = nextCharacter;
mask |= HeightValue;
}
if ((*strind == '+') || (*strind == '-')) {
if (*strind == '-') {
strind++;
tempX = -ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter)
return (0);
strind = nextCharacter;
mask |= XNegative;
}
else
{ strind++;
tempX = ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter)
return(0);
strind = nextCharacter;
}
mask |= XValue;
if ((*strind == '+') || (*strind == '-')) {
if (*strind == '-') {
strind++;
tempY = -ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter)
return(0);
strind = nextCharacter;
mask |= YNegative;
}
else
{
strind++;
tempY = ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter)
return(0);
strind = nextCharacter;
}
mask |= YValue;
}
}
/* If strind isn't at the end of the string the it's an invalid
geometry specification. */
if (*strind != '\0') return (0);
if (mask & XValue)
*x = tempX;
if (mask & YValue)
*y = tempY;
if (mask & WidthValue)
*width = tempWidth;
if (mask & HeightValue)
*height = tempHeight;
return (mask);
}
int gettimeofday(struct timeval* tp, void* tzp)
{
DATETIME DateTime;
APIRET ulrc; /* Return Code. */
ulrc = DosGetDateTime(&DateTime);
tp->tv_sec = 60 * (60*DateTime.hours + DateTime.minutes) + DateTime.seconds;
tp->tv_usec = DateTime.hundredths * 10000;
return 0;
}
int
XPending(Display* display)
{
/* similar functionality...I don't think that it is exact, but this
will have to do. */
QMSG msg;
extern HAB hab; /* PM anchor block handle */
//?? WinPeekMsg(hab
return WinPeekMsg(hab, &msg, NULLHANDLE, 0, 0, PM_NOREMOVE);
}
void
__glutAdjustCoords(Window parent, int* x, int* y, int* width, int* height)
{
RECTL rect;
/* adjust the window rectangle because Win32 thinks that the x, y,
width & height are the WHOLE window (including decorations),
whereas GLUT treats the x, y, width & height as only the CLIENT
area of the window. */
rect.xLeft = *x; rect.yTop = *y;
rect.xRight = *x + *width; rect.yBottom = *y + *height;
/* must adjust the coordinates according to the correct style
because depending on the style, there may or may not be
borders. */
//?? AdjustWindowRect(&rect, WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
//?? (parent ? WS_CHILD : WS_OVERLAPPEDWINDOW),
//?? FALSE);
/* FALSE in the third parameter = window has no menu bar */
/* readjust if the x and y are offscreen */
if(rect.xLeft < 0) {
*x = 0;
} else {
*x = rect.xLeft;
}
if(rect.yTop < 0) {
*y = 0;
} else {
*y = rect.yTop;
}
*width = rect.xRight - rect.xLeft; /* adjusted width */
*height = -(rect.yBottom - rect.yTop); /* adjusted height */
}
int
__glutGetTransparentPixel(Display * dpy, XVisualInfo * vinfo)
{
/* the transparent pixel on Win32 is always index number 0. So if
we put this routine in this file, we can avoid compiling the
whole of layerutil.c which is where this routine normally comes
from. */
return 0;
}
/* Translate point coordinates src_x and src_y from src to dst */
Bool
XTranslateCoordinates(Display *display, Window src, Window dst,
int src_x, int src_y,
int* dest_x_return, int* dest_y_return,
Window* child_return)
{
SWP swp_src,swp_dst;
WinQueryWindowPos(src,&swp_src);
WinQueryWindowPos(dst,&swp_dst);
*dest_x_return = src_x + swp_src.x - swp_dst.x;
*dest_y_return = src_y + swp_src.y - swp_dst.y;
/* just to make compilers happy...we don't use the return value. */
return True;
}
Status
XGetGeometry(Display* display, Window window, Window* root_return,
int* x_return, int* y_return,
unsigned int* width_return, unsigned int* height_return,
unsigned int *border_width_return, unsigned int* depth_return)
{
/* KLUDGE: doesn't return the border_width or depth or root, x & y
are in screen coordinates. */
SWP swp_src;
WinQueryWindowPos(window,&swp_src);
*x_return = swp_src.x;
*y_return = swp_src.y;
*width_return = swp_src.cx;
*height_return = swp_src.cy;
/* just to make compilers happy...we don't use the return value. */
return 1;
}
/* Get Display Width in millimeters */
int
DisplayWidthMM(Display* display, int screen)
{
int width;
LONG *pVC_Caps;
pVC_Caps = GetVideoConfig(NULLHANDLE);
width = (int)( 0.001 * pVC_Caps[CAPS_WIDTH] / pVC_Caps[CAPS_HORIZONTAL_RESOLUTION]);/* mm */
return width;
}
/* Get Display Height in millimeters */
int
DisplayHeightMM(Display* display, int screen)
{
int height;
LONG *pVC_Caps;
pVC_Caps = GetVideoConfig(NULLHANDLE);
height = (int)( 0.001 * pVC_Caps[CAPS_HEIGHT] / pVC_Caps[CAPS_VERTICAL_RESOLUTION]); /* mm */
return height;
}
void ScreenToClient( HWND hwnd, POINTL *point)
{
SWP swp_src;
WinQueryWindowPos(hwnd,&swp_src);
point->x -= swp_src.x;
point->y -= swp_src.y;
}


View File

@@ -1,259 +1,259 @@
/* Copyright (c) Mark J. Kilgard, 1994, 1996, 1997. */
/* This program is freely distributable without licensing fees
and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
#include <stdlib.h>
#include "glutint.h"
#if defined(__OS2PM__)
#define IsWindowVisible WinIsWindowVisible
#endif
#define CLAMP(i) ((i) > 1.0 ? 1.0 : ((i) < 0.0 ? 0.0 : (i)))
/* CENTRY */
void GLUTAPIENTRY
glutSetColor(int ndx, GLfloat red, GLfloat green, GLfloat blue)
{
GLUTcolormap *cmap, *newcmap;
XVisualInfo *vis;
XColor color;
int i;
if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) {
cmap = __glutCurrentWindow->colormap;
vis = __glutCurrentWindow->vis;
} else {
cmap = __glutCurrentWindow->overlay->colormap;
vis = __glutCurrentWindow->overlay->vis;
if (ndx == __glutCurrentWindow->overlay->transparentPixel) {
__glutWarning(
"glutSetColor: cannot set color of overlay transparent index %d\n",
ndx);
return;
}
}
if (!cmap) {
__glutWarning("glutSetColor: current window is RGBA");
return;
}
#if defined(_WIN32) || defined(__OS2PM__)
if (ndx >= 256 || /* always assume 256 colors on Win32 */
#else
if (ndx >= vis->visual->map_entries ||
#endif
ndx < 0) {
__glutWarning("glutSetColor: index %d out of range", ndx);
return;
}
if (cmap->refcnt > 1) {
newcmap = __glutAssociateNewColormap(vis);
cmap->refcnt--;
/* Wouldn't it be nice if XCopyColormapAndFree could be
told not to free the old colormap's entries! */
for (i = cmap->size - 1; i >= 0; i--) {
if (i == ndx) {
/* We are going to set this cell shortly! */
continue;
}
if (cmap->cells[i].component[GLUT_RED] >= 0.0) {
color.pixel = i;
newcmap->cells[i].component[GLUT_RED] =
cmap->cells[i].component[GLUT_RED];
color.red = (GLfloat) 0xffff *
cmap->cells[i].component[GLUT_RED];
newcmap->cells[i].component[GLUT_GREEN] =
cmap->cells[i].component[GLUT_GREEN];
color.green = (GLfloat) 0xffff *
cmap->cells[i].component[GLUT_GREEN];
newcmap->cells[i].component[GLUT_BLUE] =
cmap->cells[i].component[GLUT_BLUE];
color.blue = (GLfloat) 0xffff *
cmap->cells[i].component[GLUT_BLUE];
color.flags = DoRed | DoGreen | DoBlue;
#if defined(_WIN32) || defined(__OS2PM__)
if (IsWindowVisible(__glutCurrentWindow->win)) {
XHDC = __glutCurrentWindow->hdc;
} else {
XHDC = 0;
}
#endif
XStoreColor(__glutDisplay, newcmap->cmap, &color);
} else {
/* Leave unallocated entries unallocated. */
}
}
cmap = newcmap;
if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) {
__glutCurrentWindow->colormap = cmap;
__glutCurrentWindow->cmap = cmap->cmap;
} else {
__glutCurrentWindow->overlay->colormap = cmap;
__glutCurrentWindow->overlay->cmap = cmap->cmap;
}
XSetWindowColormap(__glutDisplay,
__glutCurrentWindow->renderWin, cmap->cmap);
#if !defined(_WIN32) && !defined(__OS2PM__)
{
GLUTwindow *toplevel;
toplevel = __glutToplevelOf(__glutCurrentWindow);
if (toplevel->cmap != cmap->cmap) {
__glutPutOnWorkList(toplevel, GLUT_COLORMAP_WORK);
}
}
#endif
}
color.pixel = ndx;
red = CLAMP(red);
cmap->cells[ndx].component[GLUT_RED] = red;
color.red = (GLfloat) 0xffff *red;
green = CLAMP(green);
cmap->cells[ndx].component[GLUT_GREEN] = green;
color.green = (GLfloat) 0xffff *green;
blue = CLAMP(blue);
cmap->cells[ndx].component[GLUT_BLUE] = blue;
color.blue = (GLfloat) 0xffff *blue;
color.flags = DoRed | DoGreen | DoBlue;
#if defined(_WIN32) || defined(__OS2PM__)
if (IsWindowVisible(__glutCurrentWindow->win)) {
XHDC = __glutCurrentWindow->hdc;
} else {
XHDC = 0;
}
#endif
XStoreColor(__glutDisplay, cmap->cmap, &color);
}
GLfloat GLUTAPIENTRY
glutGetColor(int ndx, int comp)
{
GLUTcolormap *colormap;
XVisualInfo *vis;
if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) {
colormap = __glutCurrentWindow->colormap;
vis = __glutCurrentWindow->vis;
} else {
colormap = __glutCurrentWindow->overlay->colormap;
vis = __glutCurrentWindow->overlay->vis;
if (ndx == __glutCurrentWindow->overlay->transparentPixel) {
__glutWarning("glutGetColor: requesting overlay transparent index %d\n",
ndx);
return -1.0;
}
}
if (!colormap) {
__glutWarning("glutGetColor: current window is RGBA");
return -1.0;
}
#if defined(_WIN32) || defined(__OS2PM__)
#define OUT_OF_RANGE_NDX(ndx) (ndx >= 256 || ndx < 0)
#else
#define OUT_OF_RANGE_NDX(ndx) (ndx >= vis->visual->map_entries || ndx < 0)
#endif
if (OUT_OF_RANGE_NDX(ndx)) {
__glutWarning("glutGetColor: index %d out of range", ndx);
return -1.0;
}
return colormap->cells[ndx].component[comp];
}
void GLUTAPIENTRY
glutCopyColormap(int winnum)
{
GLUTwindow *window = __glutWindowList[winnum - 1];
GLUTcolormap *oldcmap, *newcmap;
XVisualInfo *dstvis;
if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) {
oldcmap = __glutCurrentWindow->colormap;
dstvis = __glutCurrentWindow->vis;
newcmap = window->colormap;
} else {
oldcmap = __glutCurrentWindow->overlay->colormap;
dstvis = __glutCurrentWindow->overlay->vis;
if (!window->overlay) {
__glutWarning("glutCopyColormap: window %d has no overlay", winnum);
return;
}
newcmap = window->overlay->colormap;
}
if (!oldcmap) {
__glutWarning("glutCopyColormap: destination colormap must be color index");
return;
}
if (!newcmap) {
__glutWarning(
"glutCopyColormap: source colormap of window %d must be color index",
winnum);
return;
}
if (newcmap == oldcmap) {
/* Source and destination are the same; now copy needed. */
return;
}
#if !defined(_WIN32) && !defined(__OS2PM__)
/* Play safe: compare visual IDs, not Visual*'s. */
if (newcmap->visual->visualid == oldcmap->visual->visualid) {
#endif
/* Visuals match! "Copy" by reference... */
__glutFreeColormap(oldcmap);
newcmap->refcnt++;
if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) {
__glutCurrentWindow->colormap = newcmap;
__glutCurrentWindow->cmap = newcmap->cmap;
} else {
__glutCurrentWindow->overlay->colormap = newcmap;
__glutCurrentWindow->overlay->cmap = newcmap->cmap;
}
XSetWindowColormap(__glutDisplay, __glutCurrentWindow->renderWin,
newcmap->cmap);
#if !defined(_WIN32) && !defined(__OS2PM__)
__glutPutOnWorkList(__glutToplevelOf(window), GLUT_COLORMAP_WORK);
bla bla bla
} else {
GLUTcolormap *copycmap;
XColor color;
int i, last;
/* Visuals different - need a distinct X colormap! */
copycmap = __glutAssociateNewColormap(dstvis);
/* Wouldn't it be nice if XCopyColormapAndFree could be
told not to free the old colormap's entries! */
last = newcmap->size;
if (last > copycmap->size) {
last = copycmap->size;
}
for (i = last - 1; i >= 0; i--) {
if (newcmap->cells[i].component[GLUT_RED] >= 0.0) {
color.pixel = i;
copycmap->cells[i].component[GLUT_RED] =
newcmap->cells[i].component[GLUT_RED];
color.red = (GLfloat) 0xffff *
newcmap->cells[i].component[GLUT_RED];
copycmap->cells[i].component[GLUT_GREEN] =
newcmap->cells[i].component[GLUT_GREEN];
color.green = (GLfloat) 0xffff *
newcmap->cells[i].component[GLUT_GREEN];
copycmap->cells[i].component[GLUT_BLUE] =
newcmap->cells[i].component[GLUT_BLUE];
color.blue = (GLfloat) 0xffff *
newcmap->cells[i].component[GLUT_BLUE];
color.flags = DoRed | DoGreen | DoBlue;
XStoreColor(__glutDisplay, copycmap->cmap, &color);
}
}
}
#endif
}
/* ENDCENTRY */
/* Copyright (c) Mark J. Kilgard, 1994, 1996, 1997. */
/* This program is freely distributable without licensing fees
and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
#include <stdlib.h>
#include "glutint.h"
#if defined(__OS2PM__)
#define IsWindowVisible WinIsWindowVisible
#endif
#define CLAMP(i) ((i) > 1.0 ? 1.0 : ((i) < 0.0 ? 0.0 : (i)))
/* CENTRY */
void GLUTAPIENTRY
glutSetColor(int ndx, GLfloat red, GLfloat green, GLfloat blue)
{
GLUTcolormap *cmap, *newcmap;
XVisualInfo *vis;
XColor color;
int i;
if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) {
cmap = __glutCurrentWindow->colormap;
vis = __glutCurrentWindow->vis;
} else {
cmap = __glutCurrentWindow->overlay->colormap;
vis = __glutCurrentWindow->overlay->vis;
if (ndx == __glutCurrentWindow->overlay->transparentPixel) {
__glutWarning(
"glutSetColor: cannot set color of overlay transparent index %d\n",
ndx);
return;
}
}
if (!cmap) {
__glutWarning("glutSetColor: current window is RGBA");
return;
}
#if defined(_WIN32) || defined(__OS2PM__)
if (ndx >= 256 || /* always assume 256 colors on Win32 */
#else
if (ndx >= vis->visual->map_entries ||
#endif
ndx < 0) {
__glutWarning("glutSetColor: index %d out of range", ndx);
return;
}
if (cmap->refcnt > 1) {
newcmap = __glutAssociateNewColormap(vis);
cmap->refcnt--;
/* Wouldn't it be nice if XCopyColormapAndFree could be
told not to free the old colormap's entries! */
for (i = cmap->size - 1; i >= 0; i--) {
if (i == ndx) {
/* We are going to set this cell shortly! */
continue;
}
if (cmap->cells[i].component[GLUT_RED] >= 0.0) {
color.pixel = i;
newcmap->cells[i].component[GLUT_RED] =
cmap->cells[i].component[GLUT_RED];
color.red = (GLfloat) 0xffff *
cmap->cells[i].component[GLUT_RED];
newcmap->cells[i].component[GLUT_GREEN] =
cmap->cells[i].component[GLUT_GREEN];
color.green = (GLfloat) 0xffff *
cmap->cells[i].component[GLUT_GREEN];
newcmap->cells[i].component[GLUT_BLUE] =
cmap->cells[i].component[GLUT_BLUE];
color.blue = (GLfloat) 0xffff *
cmap->cells[i].component[GLUT_BLUE];
color.flags = DoRed | DoGreen | DoBlue;
#if defined(_WIN32) || defined(__OS2PM__)
if (IsWindowVisible(__glutCurrentWindow->win)) {
XHDC = __glutCurrentWindow->hdc;
} else {
XHDC = 0;
}
#endif
XStoreColor(__glutDisplay, newcmap->cmap, &color);
} else {
/* Leave unallocated entries unallocated. */
}
}
cmap = newcmap;
if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) {
__glutCurrentWindow->colormap = cmap;
__glutCurrentWindow->cmap = cmap->cmap;
} else {
__glutCurrentWindow->overlay->colormap = cmap;
__glutCurrentWindow->overlay->cmap = cmap->cmap;
}
XSetWindowColormap(__glutDisplay,
__glutCurrentWindow->renderWin, cmap->cmap);
#if !defined(_WIN32) && !defined(__OS2PM__)
{
GLUTwindow *toplevel;
toplevel = __glutToplevelOf(__glutCurrentWindow);
if (toplevel->cmap != cmap->cmap) {
__glutPutOnWorkList(toplevel, GLUT_COLORMAP_WORK);
}
}
#endif
}
color.pixel = ndx;
red = CLAMP(red);
cmap->cells[ndx].component[GLUT_RED] = red;
color.red = (GLfloat) 0xffff *red;
green = CLAMP(green);
cmap->cells[ndx].component[GLUT_GREEN] = green;
color.green = (GLfloat) 0xffff *green;
blue = CLAMP(blue);
cmap->cells[ndx].component[GLUT_BLUE] = blue;
color.blue = (GLfloat) 0xffff *blue;
color.flags = DoRed | DoGreen | DoBlue;
#if defined(_WIN32) || defined(__OS2PM__)
if (IsWindowVisible(__glutCurrentWindow->win)) {
XHDC = __glutCurrentWindow->hdc;
} else {
XHDC = 0;
}
#endif
XStoreColor(__glutDisplay, cmap->cmap, &color);
}
GLfloat GLUTAPIENTRY
glutGetColor(int ndx, int comp)
{
GLUTcolormap *colormap;
XVisualInfo *vis;
if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) {
colormap = __glutCurrentWindow->colormap;
vis = __glutCurrentWindow->vis;
} else {
colormap = __glutCurrentWindow->overlay->colormap;
vis = __glutCurrentWindow->overlay->vis;
if (ndx == __glutCurrentWindow->overlay->transparentPixel) {
__glutWarning("glutGetColor: requesting overlay transparent index %d\n",
ndx);
return -1.0;
}
}
if (!colormap) {
__glutWarning("glutGetColor: current window is RGBA");
return -1.0;
}
#if defined(_WIN32) || defined(__OS2PM__)
#define OUT_OF_RANGE_NDX(ndx) (ndx >= 256 || ndx < 0)
#else
#define OUT_OF_RANGE_NDX(ndx) (ndx >= vis->visual->map_entries || ndx < 0)
#endif
if (OUT_OF_RANGE_NDX(ndx)) {
__glutWarning("glutGetColor: index %d out of range", ndx);
return -1.0;
}
return colormap->cells[ndx].component[comp];
}
void GLUTAPIENTRY
glutCopyColormap(int winnum)
{
GLUTwindow *window = __glutWindowList[winnum - 1];
GLUTcolormap *oldcmap, *newcmap;
XVisualInfo *dstvis;
if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) {
oldcmap = __glutCurrentWindow->colormap;
dstvis = __glutCurrentWindow->vis;
newcmap = window->colormap;
} else {
oldcmap = __glutCurrentWindow->overlay->colormap;
dstvis = __glutCurrentWindow->overlay->vis;
if (!window->overlay) {
__glutWarning("glutCopyColormap: window %d has no overlay", winnum);
return;
}
newcmap = window->overlay->colormap;
}
if (!oldcmap) {
__glutWarning("glutCopyColormap: destination colormap must be color index");
return;
}
if (!newcmap) {
__glutWarning(
"glutCopyColormap: source colormap of window %d must be color index",
winnum);
return;
}
if (newcmap == oldcmap) {
/* Source and destination are the same; now copy needed. */
return;
}
#if !defined(_WIN32) && !defined(__OS2PM__)
/* Play safe: compare visual IDs, not Visual*'s. */
if (newcmap->visual->visualid == oldcmap->visual->visualid) {
#endif
/* Visuals match! "Copy" by reference... */
__glutFreeColormap(oldcmap);
newcmap->refcnt++;
if (__glutCurrentWindow->renderWin == __glutCurrentWindow->win) {
__glutCurrentWindow->colormap = newcmap;
__glutCurrentWindow->cmap = newcmap->cmap;
} else {
__glutCurrentWindow->overlay->colormap = newcmap;
__glutCurrentWindow->overlay->cmap = newcmap->cmap;
}
XSetWindowColormap(__glutDisplay, __glutCurrentWindow->renderWin,
newcmap->cmap);
#if !defined(_WIN32) && !defined(__OS2PM__)
__glutPutOnWorkList(__glutToplevelOf(window), GLUT_COLORMAP_WORK);
bla bla bla
} else {
GLUTcolormap *copycmap;
XColor color;
int i, last;
/* Visuals different - need a distinct X colormap! */
copycmap = __glutAssociateNewColormap(dstvis);
/* Wouldn't it be nice if XCopyColormapAndFree could be
told not to free the old colormap's entries! */
last = newcmap->size;
if (last > copycmap->size) {
last = copycmap->size;
}
for (i = last - 1; i >= 0; i--) {
if (newcmap->cells[i].component[GLUT_RED] >= 0.0) {
color.pixel = i;
copycmap->cells[i].component[GLUT_RED] =
newcmap->cells[i].component[GLUT_RED];
color.red = (GLfloat) 0xffff *
newcmap->cells[i].component[GLUT_RED];
copycmap->cells[i].component[GLUT_GREEN] =
newcmap->cells[i].component[GLUT_GREEN];
color.green = (GLfloat) 0xffff *
newcmap->cells[i].component[GLUT_GREEN];
copycmap->cells[i].component[GLUT_BLUE] =
newcmap->cells[i].component[GLUT_BLUE];
color.blue = (GLfloat) 0xffff *
newcmap->cells[i].component[GLUT_BLUE];
color.flags = DoRed | DoGreen | DoBlue;
XStoreColor(__glutDisplay, copycmap->cmap, &color);
}
}
}
#endif
}
/* ENDCENTRY */


File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,127 +1,127 @@
/* Copyright (c) Mark J. Kilgard, 1994. */
/* This program is freely distributable without licensing fees
and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "glutint.h"
/* CENTRY */
void GLUTAPIENTRY
glutSetWindowTitle(const char *title)
{
#if defined(__OS2PM__)
__glutSetWindowText(__glutCurrentWindow->win, (char *)title);
#else
XTextProperty textprop;
assert(!__glutCurrentWindow->parent);
IGNORE_IN_GAME_MODE();
textprop.value = (unsigned char *) title;
textprop.encoding = XA_STRING;
textprop.format = 8;
textprop.nitems = strlen(title);
XSetWMName(__glutDisplay,
__glutCurrentWindow->win, &textprop);
XFlush(__glutDisplay);
#endif
}
void GLUTAPIENTRY
glutSetIconTitle(const char *title)
{
#if defined(__OS2PM__)
//todo ?
#else
XTextProperty textprop;
assert(!__glutCurrentWindow->parent);
IGNORE_IN_GAME_MODE();
textprop.value = (unsigned char *) title;
textprop.encoding = XA_STRING;
textprop.format = 8;
textprop.nitems = strlen(title);
XSetWMIconName(__glutDisplay,
__glutCurrentWindow->win, &textprop);
XFlush(__glutDisplay);
#endif
}
void GLUTAPIENTRY
glutPositionWindow(int x, int y)
{
IGNORE_IN_GAME_MODE();
__glutCurrentWindow->desiredX = x;
__glutCurrentWindow->desiredY = y;
__glutCurrentWindow->desiredConfMask |= CWX | CWY;
__glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
}
void GLUTAPIENTRY
glutReshapeWindow(int w, int h)
{
IGNORE_IN_GAME_MODE();
if (w <= 0 || h <= 0)
__glutWarning("glutReshapeWindow: non-positive width or height not allowed");
__glutCurrentWindow->desiredWidth = w;
__glutCurrentWindow->desiredHeight = h;
__glutCurrentWindow->desiredConfMask |= CWWidth | CWHeight;
__glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
}
void GLUTAPIENTRY
glutPopWindow(void)
{
IGNORE_IN_GAME_MODE();
__glutCurrentWindow->desiredStack = Above;
__glutCurrentWindow->desiredConfMask |= CWStackMode;
__glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
}
void GLUTAPIENTRY
glutPushWindow(void)
{
IGNORE_IN_GAME_MODE();
__glutCurrentWindow->desiredStack = Below;
__glutCurrentWindow->desiredConfMask |= CWStackMode;
__glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
}
void GLUTAPIENTRY
glutIconifyWindow(void)
{
IGNORE_IN_GAME_MODE();
assert(!__glutCurrentWindow->parent);
__glutCurrentWindow->desiredMapState = IconicState;
__glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK);
}
void GLUTAPIENTRY
glutShowWindow(void)
{
IGNORE_IN_GAME_MODE();
__glutCurrentWindow->desiredMapState = NormalState;
__glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK);
}
void GLUTAPIENTRY
glutHideWindow(void)
{
IGNORE_IN_GAME_MODE();
__glutCurrentWindow->desiredMapState = WithdrawnState;
__glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK);
}
/* ENDCENTRY */
/* Copyright (c) Mark J. Kilgard, 1994. */
/* This program is freely distributable without licensing fees
and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "glutint.h"
/* CENTRY */
void GLUTAPIENTRY
glutSetWindowTitle(const char *title)
{
#if defined(__OS2PM__)
__glutSetWindowText(__glutCurrentWindow->win, (char *)title);
#else
XTextProperty textprop;
assert(!__glutCurrentWindow->parent);
IGNORE_IN_GAME_MODE();
textprop.value = (unsigned char *) title;
textprop.encoding = XA_STRING;
textprop.format = 8;
textprop.nitems = strlen(title);
XSetWMName(__glutDisplay,
__glutCurrentWindow->win, &textprop);
XFlush(__glutDisplay);
#endif
}
void GLUTAPIENTRY
glutSetIconTitle(const char *title)
{
#if defined(__OS2PM__)
//todo ?
#else
XTextProperty textprop;
assert(!__glutCurrentWindow->parent);
IGNORE_IN_GAME_MODE();
textprop.value = (unsigned char *) title;
textprop.encoding = XA_STRING;
textprop.format = 8;
textprop.nitems = strlen(title);
XSetWMIconName(__glutDisplay,
__glutCurrentWindow->win, &textprop);
XFlush(__glutDisplay);
#endif
}
void GLUTAPIENTRY
glutPositionWindow(int x, int y)
{
IGNORE_IN_GAME_MODE();
__glutCurrentWindow->desiredX = x;
__glutCurrentWindow->desiredY = y;
__glutCurrentWindow->desiredConfMask |= CWX | CWY;
__glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
}
void GLUTAPIENTRY
glutReshapeWindow(int w, int h)
{
IGNORE_IN_GAME_MODE();
if (w <= 0 || h <= 0)
__glutWarning("glutReshapeWindow: non-positive width or height not allowed");
__glutCurrentWindow->desiredWidth = w;
__glutCurrentWindow->desiredHeight = h;
__glutCurrentWindow->desiredConfMask |= CWWidth | CWHeight;
__glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
}
void GLUTAPIENTRY
glutPopWindow(void)
{
IGNORE_IN_GAME_MODE();
__glutCurrentWindow->desiredStack = Above;
__glutCurrentWindow->desiredConfMask |= CWStackMode;
__glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
}
void GLUTAPIENTRY
glutPushWindow(void)
{
IGNORE_IN_GAME_MODE();
__glutCurrentWindow->desiredStack = Below;
__glutCurrentWindow->desiredConfMask |= CWStackMode;
__glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
}
void GLUTAPIENTRY
glutIconifyWindow(void)
{
IGNORE_IN_GAME_MODE();
assert(!__glutCurrentWindow->parent);
__glutCurrentWindow->desiredMapState = IconicState;
__glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK);
}
void GLUTAPIENTRY
glutShowWindow(void)
{
IGNORE_IN_GAME_MODE();
__glutCurrentWindow->desiredMapState = NormalState;
__glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK);
}
void GLUTAPIENTRY
glutHideWindow(void)
{
IGNORE_IN_GAME_MODE();
__glutCurrentWindow->desiredMapState = WithdrawnState;
__glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK);
}
/* ENDCENTRY */


View File

@@ -1,146 +1,146 @@
/* os2_glx.c */
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include "gl/gl.h"
#include "WarpGL.h"
#include "GL/os2mesa.h"
#define POKA 0
/* global current HDC */
XVisualInfo *wglDescribePixelFormat(int iPixelFormat);
extern HDC XHDC;
extern HWND XHWND;
//extern HPS hpsCurrent;
extern HAB hab; /* PM anchor block handle */
GLXContext
glXCreateContext(HPS hps, XVisualInfo * visinfo,
GLXContext share, Bool direct)
{
/* KLUDGE: GLX really expects a display pointer to be passed
in as the first parameter, but Win32 needs an HDC instead,
so BE SURE that the global XHDC is set before calling this
routine. */
HGLRC context;
context = wglCreateContext(XHDC,hps,hab);
/* Since direct rendering is implicit, the direct flag is
ignored. */
return context;
}
int
glXGetConfig(XVisualInfo * visual, int attrib, int *value)
{
if (!visual)
return GLX_BAD_VISUAL;
switch (attrib) {
case GLX_USE_GL:
if (visual->dwFlags & (PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW)) {
/* XXX Brad's Matrix Millenium II has problems creating
color index windows in 24-bit mode (lead to GDI crash)
and 32-bit mode (lead to black window). The cColorBits
filed of the PIXELFORMATDESCRIPTOR returned claims to
have 24 and 32 bits respectively of color indices. 2^24
and 2^32 are ridiculously huge writable colormaps.
Assume that if we get back a color index
PIXELFORMATDESCRIPTOR with 24 or more bits, the
PIXELFORMATDESCRIPTOR doesn't really work and skip it.
-mjk */
if (visual->iPixelType == PFD_TYPE_COLORINDEX
&& visual->cColorBits >= 24) {
*value = 0;
} else {
*value = 1;
}
} else {
*value = 0;
}
break;
case GLX_BUFFER_SIZE:
/* KLUDGE: if we're RGBA, return the number of bits/pixel,
otherwise, return 8 (we guessed at 256 colors in CI
mode). */
if (visual->iPixelType == PFD_TYPE_RGBA)
*value = visual->cColorBits;
else
*value = 8;
break;
case GLX_LEVEL:
/* The bReserved flag of the pfd contains the
overlay/underlay info. */
*value = visual->bReserved;
break;
case GLX_RGBA:
*value = visual->iPixelType == PFD_TYPE_RGBA;
break;
case GLX_DOUBLEBUFFER:
*value = visual->dwFlags & PFD_DOUBLEBUFFER;
break;
case GLX_STEREO:
*value = visual->dwFlags & PFD_STEREO;
break;
case GLX_AUX_BUFFERS:
*value = visual->cAuxBuffers;
break;
case GLX_RED_SIZE:
*value = visual->cRedBits;
break;
case GLX_GREEN_SIZE:
*value = visual->cGreenBits;
break;
case GLX_BLUE_SIZE:
*value = visual->cBlueBits;
break;
case GLX_ALPHA_SIZE:
*value = visual->cAlphaBits;
break;
case GLX_DEPTH_SIZE:
*value = visual->cDepthBits;
break;
case GLX_STENCIL_SIZE:
*value = visual->cStencilBits;
break;
case GLX_ACCUM_RED_SIZE:
*value = visual->cAccumRedBits;
break;
case GLX_ACCUM_GREEN_SIZE:
*value = visual->cAccumGreenBits;
break;
case GLX_ACCUM_BLUE_SIZE:
*value = visual->cAccumBlueBits;
break;
case GLX_ACCUM_ALPHA_SIZE:
*value = visual->cAccumAlphaBits;
break;
#if POKA == 100
#endif /* POKA == 100 */
default:
return GLX_BAD_ATTRIB;
}
return 0;
}
XVisualInfo * glXChooseVisual(int mode)
{ int imode = 2;
if(mode & GLUT_DOUBLE)
imode = 1;
return
wglDescribePixelFormat(imode);
}
#if POKA
#endif /* POKA */
/* os2_glx.c */
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include "gl/gl.h"
#include "WarpGL.h"
#include "GL/os2mesa.h"
#define POKA 0
/* global current HDC */
XVisualInfo *wglDescribePixelFormat(int iPixelFormat);
extern HDC XHDC;
extern HWND XHWND;
//extern HPS hpsCurrent;
extern HAB hab; /* PM anchor block handle */
GLXContext
glXCreateContext(HPS hps, XVisualInfo * visinfo,
GLXContext share, Bool direct)
{
/* KLUDGE: GLX really expects a display pointer to be passed
in as the first parameter, but Win32 needs an HDC instead,
so BE SURE that the global XHDC is set before calling this
routine. */
HGLRC context;
context = wglCreateContext(XHDC,hps,hab);
/* Since direct rendering is implicit, the direct flag is
ignored. */
return context;
}
int
glXGetConfig(XVisualInfo * visual, int attrib, int *value)
{
if (!visual)
return GLX_BAD_VISUAL;
switch (attrib) {
case GLX_USE_GL:
if (visual->dwFlags & (PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW)) {
/* XXX Brad's Matrix Millenium II has problems creating
color index windows in 24-bit mode (lead to GDI crash)
and 32-bit mode (lead to black window). The cColorBits
filed of the PIXELFORMATDESCRIPTOR returned claims to
have 24 and 32 bits respectively of color indices. 2^24
and 2^32 are ridiculously huge writable colormaps.
Assume that if we get back a color index
PIXELFORMATDESCRIPTOR with 24 or more bits, the
PIXELFORMATDESCRIPTOR doesn't really work and skip it.
-mjk */
if (visual->iPixelType == PFD_TYPE_COLORINDEX
&& visual->cColorBits >= 24) {
*value = 0;
} else {
*value = 1;
}
} else {
*value = 0;
}
break;
case GLX_BUFFER_SIZE:
/* KLUDGE: if we're RGBA, return the number of bits/pixel,
otherwise, return 8 (we guessed at 256 colors in CI
mode). */
if (visual->iPixelType == PFD_TYPE_RGBA)
*value = visual->cColorBits;
else
*value = 8;
break;
case GLX_LEVEL:
/* The bReserved flag of the pfd contains the
overlay/underlay info. */
*value = visual->bReserved;
break;
case GLX_RGBA:
*value = visual->iPixelType == PFD_TYPE_RGBA;
break;
case GLX_DOUBLEBUFFER:
*value = visual->dwFlags & PFD_DOUBLEBUFFER;
break;
case GLX_STEREO:
*value = visual->dwFlags & PFD_STEREO;
break;
case GLX_AUX_BUFFERS:
*value = visual->cAuxBuffers;
break;
case GLX_RED_SIZE:
*value = visual->cRedBits;
break;
case GLX_GREEN_SIZE:
*value = visual->cGreenBits;
break;
case GLX_BLUE_SIZE:
*value = visual->cBlueBits;
break;
case GLX_ALPHA_SIZE:
*value = visual->cAlphaBits;
break;
case GLX_DEPTH_SIZE:
*value = visual->cDepthBits;
break;
case GLX_STENCIL_SIZE:
*value = visual->cStencilBits;
break;
case GLX_ACCUM_RED_SIZE:
*value = visual->cAccumRedBits;
break;
case GLX_ACCUM_GREEN_SIZE:
*value = visual->cAccumGreenBits;
break;
case GLX_ACCUM_BLUE_SIZE:
*value = visual->cAccumBlueBits;
break;
case GLX_ACCUM_ALPHA_SIZE:
*value = visual->cAccumAlphaBits;
break;
#if POKA == 100
#endif /* POKA == 100 */
default:
return GLX_BAD_ATTRIB;
}
return 0;
}
XVisualInfo * glXChooseVisual(int mode)
{ int imode = 2;
if(mode & GLUT_DOUBLE)
imode = 1;
return
wglDescribePixelFormat(imode);
}
#if POKA
#endif /* POKA */


File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -28,18 +28,19 @@ default: $(TOP)/$(LIB_DIR)/$(GLW_LIB_NAME)
# GLU pkg-config file
pcedit = sed \
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
-e 's,@LIB_DIR@,$(LIB_DIR),' \
-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
-e 's,@VERSION@,$(MAJOR).$(MINOR).$(TINY),'
glw.pc: glw.pc.in
$(pcedit) $< > $@
install: glw.pc
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
$(INSTALL) -m 644 *.h $(DESTDIR)$(INSTALL_DIR)/include/GL
$(INSTALL) $(TOP)/$(LIB_DIR)/libGLw.* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
$(INSTALL) -m 644 glw.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
$(INSTALL) -m 644 *.h $(DESTDIR)$(INSTALL_INC_DIR)/GL
$(INSTALL) $(TOP)/$(LIB_DIR)/libGLw.* $(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) -m 644 glw.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
clean:
-rm -f depend depend.bak

View File

@@ -1,7 +1,7 @@
prefix=@INSTALL_DIR@
exec_prefix=${prefix}
libdir=${exec_prefix}/@LIB_DIR@
includedir=${prefix}/include
libdir=@INSTALL_LIB_DIR@
includedir=@INSTALL_INC_DIR@
Name: glw
Description: Mesa OpenGL widget library

View File

@@ -1 +0,0 @@
glcontextmodes.c

View File

@@ -31,6 +31,8 @@ SOURCES = \
xfont.c \
glx_pbuffer.c \
glx_query.c \
drisw_glx.c \
dri_common.c \
dri_glx.c \
XF86dri.c \
glxhash.c \
@@ -85,7 +87,7 @@ tags:
etags `find . -name \*.[ch]` `find $(TOP)/include`
install: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
make -C $(TOP)/src/mesa install-libgl
$(MAKE) -C $(TOP)/src/mesa install-libgl
# Remove .o and backup files
clean:

View File

@@ -32,7 +32,6 @@
#ifdef GLX_DIRECT_RENDERING
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/extensions/Xfixes.h>
#include <X11/extensions/Xdamage.h>
@@ -46,18 +45,10 @@
#include <sys/mman.h>
#include "xf86drm.h"
#include "dri2.h"
#ifndef RTLD_NOW
#define RTLD_NOW 0
#endif
#ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif
#include "dri_common.h"
typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate;
typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate;
typedef struct __GLXDRIconfigPrivateRec __GLXDRIconfigPrivate;
struct __GLXDRIdisplayPrivateRec {
__GLXDRIdisplay base;
@@ -76,11 +67,6 @@ struct __GLXDRIcontextPrivateRec {
__GLXscreenConfigs *psc;
};
struct __GLXDRIconfigPrivateRec {
__GLcontextModes modes;
const __DRIconfig *driConfig;
};
static void dri2DestroyContext(__GLXDRIcontext *context,
__GLXscreenConfigs *psc, Display *dpy)
{
@@ -253,94 +239,12 @@ static const __DRIloaderExtension dri2LoaderExtension = {
dri2PostDamage
};
_X_HIDDEN const __DRIsystemTimeExtension systemTimeExtension;
static const __DRIextension *loader_extensions[] = {
&dri2LoaderExtension.base,
&systemTimeExtension.base,
NULL
};
/* We need a dri_common.h type-of-thing. */
extern void ErrorMessageF(const char *f, ...);
extern void *driOpenDriver(const char *driverName);
extern __GLcontextModes *
driConvertConfigs(const __DRIcoreExtension *core,
__GLcontextModes *modes, const __DRIconfig **configs);
extern void driBindExtensions(__GLXscreenConfigs *psc);
void
driBindExtensions(__GLXscreenConfigs *psc)
{
const __DRIextension **extensions;
int i;
extensions = psc->core->getExtensions(psc->__driScreen);
for (i = 0; extensions[i]; i++) {
#ifdef __DRI_COPY_SUB_BUFFER
if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
psc->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
__glXEnableDirectExtension(psc, "GLX_MESA_copy_sub_buffer_bit");
}
#endif
#ifdef __DRI_SWAP_CONTROL
if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
psc->swapControl = (__DRIswapControlExtension *) extensions[i];
__glXEnableDirectExtension(psc, "GLX_SGI_swap_control");
__glXEnableDirectExtension(psc, "GLX_MESA_swap_control");
}
#endif
#ifdef __DRI_ALLOCATE
if (strcmp(extensions[i]->name, __DRI_ALLOCATE) == 0) {
psc->allocate = (__DRIallocateExtension *) extensions[i];
__glXEnableDirectExtension(psc, "GLX_MESA_allocate_memory");
}
#endif
#ifdef __DRI_FRAME_TRACKING
if (strcmp(extensions[i]->name, __DRI_FRAME_TRACKING) == 0) {
psc->frameTracking = (__DRIframeTrackingExtension *) extensions[i];
__glXEnableDirectExtension(psc, "GLX_MESA_swap_frame_usage");
}
#endif
#ifdef __DRI_MEDIA_STREAM_COUNTER
if (strcmp(extensions[i]->name, __DRI_MEDIA_STREAM_COUNTER) == 0) {
psc->msc = (__DRImediaStreamCounterExtension *) extensions[i];
__glXEnableDirectExtension(psc, "GLX_SGI_video_sync");
}
#endif
#ifdef __DRI_SWAP_BUFFER_COUNTER
/* No driver supports this at this time and the extension is
* not defined in dri_interface.h. Will enable
* GLX_OML_sync_control if implemented. */
#endif
#ifdef __DRI_READ_DRAWABLE
if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
__glXEnableDirectExtension(psc, "GLX_SGI_make_current_read");
}
#endif
#ifdef __DRI_TEX_BUFFER
if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
psc->texBuffer = (__DRItexBufferExtension *) extensions[i];
__glXEnableDirectExtension(psc, "GLX_EXT_texture_from_pixmap");
}
#endif
/* Ignore unknown extensions */
}
}
static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen,
__GLXdisplayPrivate *priv)
{

399
src/glx/x11/dri_common.c Normal file
View File

@@ -0,0 +1,399 @@
/*
* Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
* Copyright © 2008 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Soft-
* ware"), to deal in the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distribute,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, provided that the above copyright
* notice(s) and this permission notice appear in all copies of the Soft-
* ware and that both the above copyright notice(s) and this permission
* notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
* RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
* THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
* QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
* MANCE OF THIS SOFTWARE.
*
* Except as contained in this notice, the name of a copyright holder shall
* not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization of
* the copyright holder.
*
* Authors:
* Kevin E. Martin <kevin@precisioninsight.com>
* Brian Paul <brian@precisioninsight.com>
* Kristian Høgsberg (krh@redhat.com)
*/
#ifdef GLX_DIRECT_RENDERING
#include <unistd.h>
#include <dlfcn.h>
#include "glheader.h"
#include "glxclient.h"
#include "glcontextmodes.h"
#include "dri_common.h"
#ifndef RTLD_NOW
#define RTLD_NOW 0
#endif
#ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif
_X_HIDDEN void InfoMessageF(const char *f, ...)
{
va_list args;
const char *env;
if ((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose")) {
fprintf(stderr, "libGL: ");
va_start(args, f);
vfprintf(stderr, f, args);
va_end(args);
}
}
/**
* Print error to stderr, unless LIBGL_DEBUG=="quiet".
*/
_X_HIDDEN void ErrorMessageF(const char *f, ...)
{
va_list args;
const char *env;
if ((env = getenv("LIBGL_DEBUG")) && !strstr(env, "quiet")) {
fprintf(stderr, "libGL error: ");
va_start(args, f);
vfprintf(stderr, f, args);
va_end(args);
}
}
#ifndef DEFAULT_DRIVER_DIR
/* this is normally defined in Mesa/configs/default with DRI_DRIVER_SEARCH_PATH */
#define DEFAULT_DRIVER_DIR "/usr/local/lib/dri"
#endif
/**
* Try to \c dlopen the named driver.
*
* This function adds the "_dri.so" suffix to the driver name and searches the
* directories specified by the \c LIBGL_DRIVERS_PATH environment variable in
* order to find the driver.
*
* \param driverName - a name like "tdfx", "i810", "mga", etc.
*
* \returns
* A handle from \c dlopen, or \c NULL if driver file not found.
*/
_X_HIDDEN void *driOpenDriver(const char *driverName)
{
void *glhandle, *handle;
const char *libPaths, *p, *next;
char realDriverName[200];
int len;
/* Attempt to make sure libGL symbols will be visible to the driver */
glhandle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL);
libPaths = NULL;
if (geteuid() == getuid()) {
/* don't allow setuid apps to use LIBGL_DRIVERS_PATH */
libPaths = getenv("LIBGL_DRIVERS_PATH");
if (!libPaths)
libPaths = getenv("LIBGL_DRIVERS_DIR"); /* deprecated */
}
if (libPaths == NULL)
libPaths = DEFAULT_DRIVER_DIR;
handle = NULL;
for (p = libPaths; *p; p = next) {
next = strchr(p, ':');
if (next == NULL) {
len = strlen(p);
next = p + len;
} else {
len = next - p;
next++;
}
#ifdef GLX_USE_TLS
snprintf(realDriverName, sizeof realDriverName,
"%.*s/tls/%s_dri.so", len, p, driverName);
InfoMessageF("OpenDriver: trying %s\n", realDriverName);
handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL);
#endif
if ( handle == NULL ) {
snprintf(realDriverName, sizeof realDriverName,
"%.*s/%s_dri.so", len, p, driverName);
InfoMessageF("OpenDriver: trying %s\n", realDriverName);
handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL);
}
if ( handle != NULL )
break;
else
ErrorMessageF("dlopen %s failed (%s)\n", realDriverName, dlerror());
}
if (!handle)
ErrorMessageF("unable to load driver: %s_dri.so\n", driverName);
if (glhandle)
dlclose(glhandle);
return handle;
}
_X_HIDDEN const __DRIsystemTimeExtension systemTimeExtension = {
{ __DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION },
__glXGetUST,
__driGetMscRateOML
};
#define __ATTRIB(attrib, field) \
{ attrib, offsetof(__GLcontextModes, field) }
static const struct { unsigned int attrib, offset; } attribMap[] = {
__ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits),
__ATTRIB(__DRI_ATTRIB_LEVEL, level),
__ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits),
__ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits),
__ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits),
__ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits),
__ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits),
__ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits),
__ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers),
__ATTRIB(__DRI_ATTRIB_SAMPLES, samples),
__ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode),
__ATTRIB(__DRI_ATTRIB_STEREO, stereoMode),
__ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers),
#if 0
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentIndex),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha),
__ATTRIB(__DRI_ATTRIB_RED_MASK, redMask),
__ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask),
__ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask),
__ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask),
#endif
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth),
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight),
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels),
__ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth),
__ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight),
#if 0
__ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod),
#endif
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb),
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba),
__ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture),
__ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),
};
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
static int
scalarEqual(__GLcontextModes *mode, unsigned int attrib, unsigned int value)
{
unsigned int glxValue;
int i;
for (i = 0; i < ARRAY_SIZE(attribMap); i++)
if (attribMap[i].attrib == attrib) {
glxValue = *(unsigned int *) ((char *) mode + attribMap[i].offset);
return glxValue == GLX_DONT_CARE || glxValue == value;
}
return GL_TRUE; /* Is a non-existing attribute equal to value? */
}
static int
driConfigEqual(const __DRIcoreExtension *core,
__GLcontextModes *modes, const __DRIconfig *driConfig)
{
unsigned int attrib, value, glxValue;
int i;
i = 0;
while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) {
switch (attrib) {
case __DRI_ATTRIB_RENDER_TYPE:
glxValue = 0;
if (value & __DRI_ATTRIB_RGBA_BIT) {
glxValue |= GLX_RGBA_BIT;
} else if (value & __DRI_ATTRIB_COLOR_INDEX_BIT) {
glxValue |= GLX_COLOR_INDEX_BIT;
}
if (glxValue != modes->renderType)
return GL_FALSE;
break;
case __DRI_ATTRIB_CONFIG_CAVEAT:
if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
glxValue = GLX_NON_CONFORMANT_CONFIG;
else if (value & __DRI_ATTRIB_SLOW_BIT)
glxValue = GLX_SLOW_CONFIG;
else
glxValue = GLX_NONE;
if (glxValue != modes->visualRating)
return GL_FALSE;
break;
case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS:
glxValue = 0;
if (value & __DRI_ATTRIB_TEXTURE_1D_BIT)
glxValue |= GLX_TEXTURE_1D_BIT_EXT;
if (value & __DRI_ATTRIB_TEXTURE_2D_BIT)
glxValue |= GLX_TEXTURE_2D_BIT_EXT;
if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT)
glxValue |= GLX_TEXTURE_RECTANGLE_BIT_EXT;
if (modes->bindToTextureTargets != GLX_DONT_CARE &&
glxValue != modes->bindToTextureTargets)
return GL_FALSE;
break;
default:
if (!scalarEqual(modes, attrib, value))
return GL_FALSE;
}
}
return GL_TRUE;
}
static __GLcontextModes *
createDriMode(const __DRIcoreExtension *core,
__GLcontextModes *modes, const __DRIconfig **driConfigs)
{
__GLXDRIconfigPrivate *config;
int i;
for (i = 0; driConfigs[i]; i++) {
if (driConfigEqual(core, modes, driConfigs[i]))
break;
}
if (driConfigs[i] == NULL)
return NULL;
config = Xmalloc(sizeof *config);
if (config == NULL)
return NULL;
config->modes = *modes;
config->driConfig = driConfigs[i];
return &config->modes;
}
_X_HIDDEN __GLcontextModes *
driConvertConfigs(const __DRIcoreExtension *core,
__GLcontextModes *modes, const __DRIconfig **configs)
{
__GLcontextModes head, *tail, *m;
tail = &head;
head.next = NULL;
for (m = modes; m; m = m->next) {
tail->next = createDriMode(core, m, configs);
if (tail->next == NULL) {
/* no matching dri config for m */
continue;
}
tail = tail->next;
}
_gl_context_modes_destroy(modes);
return head.next;
}
_X_HIDDEN void
driBindExtensions(__GLXscreenConfigs *psc)
{
const __DRIextension **extensions;
int i;
extensions = psc->core->getExtensions(psc->__driScreen);
for (i = 0; extensions[i]; i++) {
#ifdef __DRI_COPY_SUB_BUFFER
if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
psc->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
__glXEnableDirectExtension(psc, "GLX_MESA_copy_sub_buffer_bit");
}
#endif
#ifdef __DRI_SWAP_CONTROL
if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
psc->swapControl = (__DRIswapControlExtension *) extensions[i];
__glXEnableDirectExtension(psc, "GLX_SGI_swap_control");
__glXEnableDirectExtension(psc, "GLX_MESA_swap_control");
}
#endif
#ifdef __DRI_ALLOCATE
if (strcmp(extensions[i]->name, __DRI_ALLOCATE) == 0) {
psc->allocate = (__DRIallocateExtension *) extensions[i];
__glXEnableDirectExtension(psc, "GLX_MESA_allocate_memory");
}
#endif
#ifdef __DRI_FRAME_TRACKING
if (strcmp(extensions[i]->name, __DRI_FRAME_TRACKING) == 0) {
psc->frameTracking = (__DRIframeTrackingExtension *) extensions[i];
__glXEnableDirectExtension(psc, "GLX_MESA_swap_frame_usage");
}
#endif
#ifdef __DRI_MEDIA_STREAM_COUNTER
if (strcmp(extensions[i]->name, __DRI_MEDIA_STREAM_COUNTER) == 0) {
psc->msc = (__DRImediaStreamCounterExtension *) extensions[i];
__glXEnableDirectExtension(psc, "GLX_SGI_video_sync");
}
#endif
#ifdef __DRI_SWAP_BUFFER_COUNTER
/* No driver supports this at this time and the extension is
* not defined in dri_interface.h. Will enable
* GLX_OML_sync_control if implemented. */
#endif
#ifdef __DRI_READ_DRAWABLE
if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
__glXEnableDirectExtension(psc, "GLX_SGI_make_current_read");
}
#endif
#ifdef __DRI_TEX_BUFFER
if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
psc->texBuffer = (__DRItexBufferExtension *) extensions[i];
__glXEnableDirectExtension(psc, "GLX_EXT_texture_from_pixmap");
}
#endif
/* Ignore unknown extensions */
}
}
#endif /* GLX_DIRECT_RENDERING */

60
src/glx/x11/dri_common.h Normal file
View File

@@ -0,0 +1,60 @@
/*
* Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
* Copyright © 2008 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Soft-
* ware"), to deal in the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distribute,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, provided that the above copyright
* notice(s) and this permission notice appear in all copies of the Soft-
* ware and that both the above copyright notice(s) and this permission
* notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
* RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
* THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
* QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
* MANCE OF THIS SOFTWARE.
*
* Except as contained in this notice, the name of a copyright holder shall
* not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization of
* the copyright holder.
*
* Authors:
* Kevin E. Martin <kevin@precisioninsight.com>
* Brian Paul <brian@precisioninsight.com>
* Kristian Høgsberg (krh@redhat.com)
*/
#ifndef _DRI_COMMON_H
#define _DRI_COMMON_H
typedef struct __GLXDRIconfigPrivateRec __GLXDRIconfigPrivate;
struct __GLXDRIconfigPrivateRec {
__GLcontextModes modes;
const __DRIconfig *driConfig;
};
extern __GLcontextModes *
driConvertConfigs(const __DRIcoreExtension *core,
__GLcontextModes *modes, const __DRIconfig **configs);
extern const __DRIsystemTimeExtension systemTimeExtension;
extern void InfoMessageF(const char *f, ...);
extern void ErrorMessageF(const char *f, ...);
extern void *driOpenDriver(const char *driverName);
extern void driBindExtensions(__GLXscreenConfigs *psc);
#endif /* _DRI_COMMON_H */

View File

@@ -34,7 +34,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifdef GLX_DIRECT_RENDERING
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/extensions/Xfixes.h>
#include <X11/extensions/Xdamage.h>
@@ -47,17 +46,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <sys/types.h>
#include <sys/mman.h>
#include "xf86drm.h"
#ifndef RTLD_NOW
#define RTLD_NOW 0
#endif
#ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif
#include "dri_common.h"
typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate;
typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate;
typedef struct __GLXDRIconfigPrivateRec __GLXDRIconfigPrivate;
struct __GLXDRIdisplayPrivateRec {
__GLXDRIdisplay base;
@@ -77,128 +69,12 @@ struct __GLXDRIcontextPrivateRec {
__GLXscreenConfigs *psc;
};
struct __GLXDRIconfigPrivateRec {
__GLcontextModes modes;
const __DRIconfig *driConfig;
};
#ifndef DEFAULT_DRIVER_DIR
/* this is normally defined in Mesa/configs/default with DRI_DRIVER_SEARCH_PATH */
#define DEFAULT_DRIVER_DIR "/usr/local/lib/dri"
#endif
static void InfoMessageF(const char *f, ...)
{
va_list args;
const char *env;
if ((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose")) {
fprintf(stderr, "libGL: ");
va_start(args, f);
vfprintf(stderr, f, args);
va_end(args);
}
}
extern void ErrorMessageF(const char *f, ...);
/**
* Print error to stderr, unless LIBGL_DEBUG=="quiet".
*/
_X_HIDDEN void ErrorMessageF(const char *f, ...)
{
va_list args;
const char *env;
if ((env = getenv("LIBGL_DEBUG")) && !strstr(env, "quiet")) {
fprintf(stderr, "libGL error: ");
va_start(args, f);
vfprintf(stderr, f, args);
va_end(args);
}
}
extern void *driOpenDriver(const char *driverName);
/**
* Try to \c dlopen the named driver.
*
* This function adds the "_dri.so" suffix to the driver name and searches the
* directories specified by the \c LIBGL_DRIVERS_PATH environment variable in
* order to find the driver.
*
* \param driverName - a name like "tdfx", "i810", "mga", etc.
*
* \returns
* A handle from \c dlopen, or \c NULL if driver file not found.
*/
_X_HIDDEN void *driOpenDriver(const char *driverName)
{
void *glhandle, *handle;
const char *libPaths, *p, *next;
char realDriverName[200];
int len;
/* Attempt to make sure libGL symbols will be visible to the driver */
glhandle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL);
libPaths = NULL;
if (geteuid() == getuid()) {
/* don't allow setuid apps to use LIBGL_DRIVERS_PATH */
libPaths = getenv("LIBGL_DRIVERS_PATH");
if (!libPaths)
libPaths = getenv("LIBGL_DRIVERS_DIR"); /* deprecated */
}
if (libPaths == NULL)
libPaths = DEFAULT_DRIVER_DIR;
handle = NULL;
for (p = libPaths; *p; p = next) {
next = strchr(p, ':');
if (next == NULL) {
len = strlen(p);
next = p + len;
} else {
len = next - p;
next++;
}
#ifdef GLX_USE_TLS
snprintf(realDriverName, sizeof realDriverName,
"%.*s/tls/%s_dri.so", len, p, driverName);
InfoMessageF("OpenDriver: trying %s\n", realDriverName);
handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL);
#endif
if ( handle == NULL ) {
snprintf(realDriverName, sizeof realDriverName,
"%.*s/%s_dri.so", len, p, driverName);
InfoMessageF("OpenDriver: trying %s\n", realDriverName);
handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL);
}
if ( handle != NULL )
break;
else
ErrorMessageF("dlopen %s failed (%s)\n", realDriverName, dlerror());
}
if (!handle)
ErrorMessageF("unable to load driver: %s_dri.so\n", driverName);
if (glhandle)
dlclose(glhandle);
return handle;
}
/*
* Given a display pointer and screen number, determine the name of
* the DRI driver for the screen. (I.e. "r128", "tdfx", etc).
* Return True for success, False for failure.
*/
static Bool GetDriverName(Display *dpy, int scrNum, char **driverName)
static Bool driGetDriverName(Display *dpy, int scrNum, char **driverName)
{
int directCapable;
Bool b;
@@ -228,25 +104,6 @@ static Bool GetDriverName(Display *dpy, int scrNum, char **driverName)
return True;
}
/*
* Given a display pointer and screen number, return a __DRIdriver handle.
* Return NULL if anything goes wrong.
*/
static void *driGetDriver(Display *dpy, int scrNum)
{
char *driverName;
void *ret;
if (GetDriverName(dpy, scrNum, &driverName)) {
ret = driOpenDriver(driverName);
if (driverName)
Xfree(driverName);
return ret;
}
return NULL;
}
/*
* Exported function for querying the DRI driver for a given screen.
*
@@ -256,7 +113,7 @@ static void *driGetDriver(Display *dpy, int scrNum)
PUBLIC const char *glXGetScreenDriver (Display *dpy, int scrNum) {
static char ret[32];
char *driverName;
if (GetDriverName(dpy, scrNum, &driverName)) {
if (driGetDriverName(dpy, scrNum, &driverName)) {
int len;
if (!driverName)
return NULL;
@@ -270,7 +127,6 @@ PUBLIC const char *glXGetScreenDriver (Display *dpy, int scrNum) {
return NULL;
}
/*
* Exported function for obtaining a driver's option list (UTF-8 encoded XML).
*
@@ -291,63 +147,6 @@ PUBLIC const char *glXGetDriverConfig (const char *driverName)
return NULL;
}
extern void
driFilterModes(__GLcontextModes ** server_modes,
const __GLcontextModes * driver_modes);
_X_HIDDEN void
driFilterModes(__GLcontextModes ** server_modes,
const __GLcontextModes * driver_modes)
{
__GLcontextModes * m;
__GLcontextModes ** prev_next;
const __GLcontextModes * check;
if (driver_modes == NULL) {
fprintf(stderr, "libGL warning: 3D driver returned no fbconfigs.\n");
return;
}
/* For each mode in server_modes, check to see if a matching mode exists
* in driver_modes. If not, then the mode is not available.
*/
prev_next = server_modes;
for ( m = *prev_next ; m != NULL ; m = *prev_next ) {
GLboolean do_delete = GL_TRUE;
for ( check = driver_modes ; check != NULL ; check = check->next ) {
if ( _gl_context_modes_are_same( m, check ) ) {
do_delete = GL_FALSE;
break;
}
}
/* The 3D has to support all the modes that match the GLX visuals
* sent from the X server.
*/
if ( do_delete && (m->visualID != 0) ) {
do_delete = GL_FALSE;
/* don't warn for this visual (Novell #247471 / X.Org #6689) */
if (m->visualRating != GLX_NON_CONFORMANT_CONFIG) {
fprintf(stderr, "libGL warning: 3D driver claims to not "
"support visual 0x%02x\n", m->visualID);
}
}
if ( do_delete ) {
*prev_next = m->next;
m->next = NULL;
_gl_context_modes_destroy( m );
}
else {
prev_next = & m->next;
}
}
}
#ifdef XDAMAGE_1_1_INTERFACE
static GLboolean has_damage_post(Display *dpy)
@@ -442,12 +241,6 @@ __glXDRIGetDrawableInfo(__DRIdrawable *drawable,
numBackClipRects, pBackClipRects);
}
_X_HIDDEN const __DRIsystemTimeExtension systemTimeExtension = {
{ __DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION },
__glXGetUST,
__driGetMscRateOML,
};
static const __DRIgetDrawableInfoExtension getDrawableInfoExtension = {
{ __DRI_GET_DRAWABLE_INFO, __DRI_GET_DRAWABLE_INFO_VERSION },
__glXDRIGetDrawableInfo
@@ -456,184 +249,13 @@ static const __DRIgetDrawableInfoExtension getDrawableInfoExtension = {
static const __DRIextension *loader_extensions[] = {
&systemTimeExtension.base,
&getDrawableInfoExtension.base,
#ifdef XDAMAGE_1_1_INTERFACE
&damageExtension.base,
#endif
NULL
};
#define __ATTRIB(attrib, field) \
{ attrib, offsetof(__GLcontextModes, field) }
static const struct { unsigned int attrib, offset; } attribMap[] = {
__ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits),
__ATTRIB(__DRI_ATTRIB_LEVEL, level),
__ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits),
__ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits),
__ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits),
__ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits),
__ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits),
__ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits),
__ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers),
__ATTRIB(__DRI_ATTRIB_SAMPLES, samples),
__ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode),
__ATTRIB(__DRI_ATTRIB_STEREO, stereoMode),
__ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers),
#if 0
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentIndex),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha),
__ATTRIB(__DRI_ATTRIB_RED_MASK, redMask),
__ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask),
__ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask),
__ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask),
#endif
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth),
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight),
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels),
__ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth),
__ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight),
#if 0
__ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod),
#endif
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb),
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba),
__ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture),
__ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),
};
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
static int
scalarEqual(__GLcontextModes *mode, unsigned int attrib, unsigned int value)
{
unsigned int glxValue;
int i;
for (i = 0; i < ARRAY_SIZE(attribMap); i++)
if (attribMap[i].attrib == attrib) {
glxValue = *(unsigned int *) ((char *) mode + attribMap[i].offset);
return glxValue == GLX_DONT_CARE || glxValue == value;
}
return GL_TRUE; /* Is a non-existing attribute equal to value? */
}
static int
driConfigEqual(const __DRIcoreExtension *core,
__GLcontextModes *modes, const __DRIconfig *driConfig)
{
unsigned int attrib, value, glxValue;
int i;
i = 0;
while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) {
switch (attrib) {
case __DRI_ATTRIB_RENDER_TYPE:
glxValue = 0;
if (value & __DRI_ATTRIB_RGBA_BIT) {
glxValue |= GLX_RGBA_BIT;
} else if (value & __DRI_ATTRIB_COLOR_INDEX_BIT) {
glxValue |= GLX_COLOR_INDEX_BIT;
}
if (glxValue != modes->renderType)
return GL_FALSE;
break;
case __DRI_ATTRIB_CONFIG_CAVEAT:
if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
glxValue = GLX_NON_CONFORMANT_CONFIG;
else if (value & __DRI_ATTRIB_SLOW_BIT)
glxValue = GLX_SLOW_CONFIG;
else
glxValue = GLX_NONE;
if (glxValue != modes->visualRating)
return GL_FALSE;
break;
case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS:
glxValue = 0;
if (value & __DRI_ATTRIB_TEXTURE_1D_BIT)
glxValue |= GLX_TEXTURE_1D_BIT_EXT;
if (value & __DRI_ATTRIB_TEXTURE_2D_BIT)
glxValue |= GLX_TEXTURE_2D_BIT_EXT;
if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT)
glxValue |= GLX_TEXTURE_RECTANGLE_BIT_EXT;
if (modes->bindToTextureTargets != GLX_DONT_CARE &&
glxValue != modes->bindToTextureTargets)
return GL_FALSE;
break;
default:
if (!scalarEqual(modes, attrib, value))
return GL_FALSE;
}
}
return GL_TRUE;
}
static __GLcontextModes *
createDriMode(const __DRIcoreExtension *core,
__GLcontextModes *modes, const __DRIconfig **driConfigs)
{
__GLXDRIconfigPrivate *config;
int i;
for (i = 0; driConfigs[i]; i++) {
if (driConfigEqual(core, modes, driConfigs[i]))
break;
}
if (driConfigs[i] == NULL)
return NULL;
config = Xmalloc(sizeof *config);
if (config == NULL)
return NULL;
config->modes = *modes;
config->driConfig = driConfigs[i];
return &config->modes;
}
extern __GLcontextModes *
driConvertConfigs(const __DRIcoreExtension *core,
__GLcontextModes *modes, const __DRIconfig **configs);
_X_HIDDEN __GLcontextModes *
driConvertConfigs(const __DRIcoreExtension *core,
__GLcontextModes *modes, const __DRIconfig **configs)
{
__GLcontextModes head, *tail, *m;
tail = &head;
head.next = NULL;
for (m = modes; m; m = m->next) {
tail->next = createDriMode(core, m, configs);
if (tail->next == NULL) {
/* no matching dri config for m */
continue;
}
tail = tail->next;
}
_gl_context_modes_destroy(modes);
return head.next;
}
#ifndef GLX_USE_APPLEGL
/**
* Perform the required libGL-side initialization and call the client-side
@@ -647,17 +269,12 @@ driConvertConfigs(const __DRIcoreExtension *core,
* \c __driCreateNewScreen function.
* \returns A pointer to the \c __DRIscreenPrivate structure returned by
* the client-side driver on success, or \c NULL on failure.
*
* \todo This function needs to be modified to remove context-modes from the
* list stored in the \c __GLXscreenConfigsRec to match the list
* returned by the client-side driver.
*/
static void *
CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc,
__GLXDRIdisplayPrivate * driDpy)
{
void *psp = NULL;
#ifndef GLX_USE_APPLEGL
drm_handle_t hSAREA;
drmAddress pSAREA = MAP_FAILED;
char *BusID;
@@ -667,175 +284,159 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc,
__DRIframebuffer framebuffer;
int fd = -1;
int status;
const char * err_msg;
const char * err_extra;
drm_magic_t magic;
drmVersionPtr version;
int newlyopened;
char *driverName;
drm_handle_t hFB;
int junk;
const __DRIconfig **driver_configs;
/* DRI protocol version. */
dri_version.major = driDpy->driMajor;
dri_version.minor = driDpy->driMinor;
dri_version.patch = driDpy->driPatch;
err_msg = "XF86DRIOpenConnection";
err_extra = NULL;
framebuffer.base = MAP_FAILED;
framebuffer.dev_priv = NULL;
if (XF86DRIOpenConnection(dpy, scrn, &hSAREA, &BusID)) {
int newlyopened;
fd = drmOpenOnce(NULL,BusID, &newlyopened);
Xfree(BusID); /* No longer needed */
err_msg = "open DRM";
err_extra = strerror( -fd );
if (fd >= 0) {
drm_magic_t magic;
err_msg = "drmGetMagic";
err_extra = NULL;
if (!drmGetMagic(fd, &magic)) {
drmVersionPtr version = drmGetVersion(fd);
if (version) {
drm_version.major = version->version_major;
drm_version.minor = version->version_minor;
drm_version.patch = version->version_patchlevel;
drmFreeVersion(version);
}
else {
drm_version.major = -1;
drm_version.minor = -1;
drm_version.patch = -1;
}
err_msg = "XF86DRIAuthConnection";
if (!newlyopened || XF86DRIAuthConnection(dpy, scrn, magic)) {
char *driverName;
/*
* Get device name (like "tdfx") and the ddx version
* numbers. We'll check the version in each DRI driver's
* "createNewScreen" function.
*/
err_msg = "XF86DRIGetClientDriverName";
if (XF86DRIGetClientDriverName(dpy, scrn,
&ddx_version.major,
&ddx_version.minor,
&ddx_version.patch,
&driverName)) {
drm_handle_t hFB;
int junk;
/* No longer needed. */
Xfree( driverName );
/*
* Get device-specific info. pDevPriv will point to a struct
* (such as DRIRADEONRec in xfree86/driver/ati/radeon_dri.h)
* that has information about the screen size, depth, pitch,
* ancilliary buffers, DRM mmap handles, etc.
*/
err_msg = "XF86DRIGetDeviceInfo";
if (XF86DRIGetDeviceInfo(dpy, scrn,
&hFB,
&junk,
&framebuffer.size,
&framebuffer.stride,
&framebuffer.dev_priv_size,
&framebuffer.dev_priv)) {
framebuffer.width = DisplayWidth(dpy, scrn);
framebuffer.height = DisplayHeight(dpy, scrn);
/*
* Map the framebuffer region.
*/
status = drmMap(fd, hFB, framebuffer.size,
(drmAddressPtr)&framebuffer.base);
err_msg = "drmMap of framebuffer";
err_extra = strerror( -status );
if ( status == 0 ) {
/*
* Map the SAREA region. Further mmap regions
* may be setup in each DRI driver's
* "createNewScreen" function.
*/
status = drmMap(fd, hSAREA, SAREA_MAX,
&pSAREA);
err_msg = "drmMap of sarea";
err_extra = strerror( -status );
if ( status == 0 ) {
err_msg = "InitDriver";
err_extra = NULL;
psp = (*psc->legacy->createNewScreen)(scrn,
& ddx_version,
& dri_version,
& drm_version,
& framebuffer,
pSAREA,
fd,
loader_extensions,
& driver_configs,
psc);
if (psp) {
psc->configs =
driConvertConfigs(psc->core,
psc->configs,
driver_configs);
psc->visuals =
driConvertConfigs(psc->core,
psc->visuals,
driver_configs);
}
}
}
}
}
}
}
}
if (!XF86DRIOpenConnection(dpy, scrn, &hSAREA, &BusID)) {
ErrorMessageF("XF86DRIOpenConnection failed\n");
goto handle_error;
}
if ( psp == NULL ) {
if ( pSAREA != MAP_FAILED ) {
(void)drmUnmap(pSAREA, SAREA_MAX);
}
fd = drmOpenOnce(NULL, BusID, &newlyopened);
if ( framebuffer.base != MAP_FAILED ) {
(void)drmUnmap((drmAddress)framebuffer.base, framebuffer.size);
}
Xfree(BusID); /* No longer needed */
if ( framebuffer.dev_priv != NULL ) {
Xfree(framebuffer.dev_priv);
}
if ( fd >= 0 ) {
(void)drmCloseOnce(fd);
}
(void)XF86DRICloseConnection(dpy, scrn);
if ( err_extra != NULL ) {
fprintf(stderr, "libGL error: %s failed (%s)\n", err_msg,
err_extra);
}
else {
fprintf(stderr, "libGL error: %s failed\n", err_msg );
}
fprintf(stderr, "libGL error: reverting to (slow) indirect rendering\n");
if (fd < 0) {
ErrorMessageF("drmOpenOnce failed (%s)\n", strerror(-fd));
goto handle_error;
}
#endif /* !GLX_USE_APPLEGL */
if (drmGetMagic(fd, &magic)) {
ErrorMessageF("drmGetMagic failed\n");
goto handle_error;
}
version = drmGetVersion(fd);
if (version) {
drm_version.major = version->version_major;
drm_version.minor = version->version_minor;
drm_version.patch = version->version_patchlevel;
drmFreeVersion(version);
}
else {
drm_version.major = -1;
drm_version.minor = -1;
drm_version.patch = -1;
}
if (newlyopened && !XF86DRIAuthConnection(dpy, scrn, magic)) {
ErrorMessageF("XF86DRIAuthConnection failed\n");
goto handle_error;
}
/* Get device name (like "tdfx") and the ddx version numbers.
* We'll check the version in each DRI driver's "createNewScreen"
* function. */
if (!XF86DRIGetClientDriverName(dpy, scrn,
&ddx_version.major,
&ddx_version.minor,
&ddx_version.patch,
&driverName)) {
ErrorMessageF("XF86DRIGetClientDriverName failed\n");
goto handle_error;
}
Xfree(driverName); /* No longer needed. */
/*
* Get device-specific info. pDevPriv will point to a struct
* (such as DRIRADEONRec in xfree86/driver/ati/radeon_dri.h) that
* has information about the screen size, depth, pitch, ancilliary
* buffers, DRM mmap handles, etc.
*/
if (!XF86DRIGetDeviceInfo(dpy, scrn, &hFB, &junk,
&framebuffer.size, &framebuffer.stride,
&framebuffer.dev_priv_size, &framebuffer.dev_priv)) {
ErrorMessageF("XF86DRIGetDeviceInfo failed");
goto handle_error;
}
framebuffer.width = DisplayWidth(dpy, scrn);
framebuffer.height = DisplayHeight(dpy, scrn);
/* Map the framebuffer region. */
status = drmMap(fd, hFB, framebuffer.size,
(drmAddressPtr)&framebuffer.base);
if (status != 0) {
ErrorMessageF("drmMap of framebuffer failed (%s)", strerror(-status));
goto handle_error;
}
/* Map the SAREA region. Further mmap regions may be setup in
* each DRI driver's "createNewScreen" function.
*/
status = drmMap(fd, hSAREA, SAREA_MAX, &pSAREA);
if (status != 0) {
ErrorMessageF("drmMap of SAREA failed (%s)", strerror(-status));
goto handle_error;
}
psp = (*psc->legacy->createNewScreen)(scrn,
&ddx_version,
&dri_version,
&drm_version,
&framebuffer,
pSAREA,
fd,
loader_extensions,
&driver_configs,
psc);
if (psp == NULL) {
ErrorMessageF("Calling driver entry point failed");
goto handle_error;
}
psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
return psp;
handle_error:
if (pSAREA != MAP_FAILED)
drmUnmap(pSAREA, SAREA_MAX);
if (framebuffer.base != MAP_FAILED)
drmUnmap((drmAddress)framebuffer.base, framebuffer.size);
if (framebuffer.dev_priv != NULL)
Xfree(framebuffer.dev_priv);
if (fd >= 0)
drmCloseOnce(fd);
XF86DRICloseConnection(dpy, scrn);
ErrorMessageF("reverting to software direct rendering\n");
return NULL;
}
#else /* !GLX_USE_APPLEGL */
static void *
CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc,
__GLXDRIdisplayPrivate * driDpy)
{
return NULL;
}
#endif /* !GLX_USE_APPLEGL */
static void driDestroyContext(__GLXDRIcontext *context,
__GLXscreenConfigs *psc, Display *dpy)
{
@@ -875,45 +476,44 @@ static __GLXDRIcontext *driCreateContext(__GLXscreenConfigs *psc,
__DRIcontext *shared = NULL;
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
if (psc && psc->driScreen) {
if (shareList) {
pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext;
shared = pcp_shared->driContext;
}
if (!psc || !psc->driScreen)
return NULL;
pcp = Xmalloc(sizeof *pcp);
if (pcp == NULL)
return NULL;
pcp->psc = psc;
if (!XF86DRICreateContextWithConfig(psc->dpy, psc->scr,
mode->visualID,
&pcp->hwContextID, &hwContext)) {
Xfree(pcp);
return NULL;
}
pcp->driContext =
(*psc->legacy->createNewContext)(psc->__driScreen,
config->driConfig,
renderType,
shared,
hwContext,
pcp);
if (pcp->driContext == NULL) {
XF86DRIDestroyContext(psc->dpy, psc->scr, pcp->hwContextID);
Xfree(pcp);
return NULL;
}
pcp->base.destroyContext = driDestroyContext;
pcp->base.bindContext = driBindContext;
pcp->base.unbindContext = driUnbindContext;
return &pcp->base;
if (shareList) {
pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext;
shared = pcp_shared->driContext;
}
return NULL;
pcp = Xmalloc(sizeof *pcp);
if (pcp == NULL)
return NULL;
pcp->psc = psc;
if (!XF86DRICreateContextWithConfig(psc->dpy, psc->scr,
mode->visualID,
&pcp->hwContextID, &hwContext)) {
Xfree(pcp);
return NULL;
}
pcp->driContext =
(*psc->legacy->createNewContext)(psc->__driScreen,
config->driConfig,
renderType,
shared,
hwContext,
pcp);
if (pcp->driContext == NULL) {
XF86DRIDestroyContext(psc->dpy, psc->scr, pcp->hwContextID);
Xfree(pcp);
return NULL;
}
pcp->base.destroyContext = driDestroyContext;
pcp->base.bindContext = driBindContext;
pcp->base.unbindContext = driUnbindContext;
return &pcp->base;
}
static void driDestroyDrawable(__GLXDRIdrawable *pdraw)
@@ -979,15 +579,13 @@ static void driDestroyScreen(__GLXscreenConfigs *psc)
dlclose(psc->driver);
}
void
driBindExtensions(__GLXscreenConfigs *psc);
static __GLXDRIscreen *driCreateScreen(__GLXscreenConfigs *psc, int screen,
__GLXdisplayPrivate *priv)
{
__GLXDRIdisplayPrivate *pdp;
__GLXDRIscreen *psp;
const __DRIextension **extensions;
char *driverName;
int i;
psp = Xmalloc(sizeof *psp);
@@ -997,7 +595,13 @@ static __GLXDRIscreen *driCreateScreen(__GLXscreenConfigs *psc, int screen,
/* Initialize per screen dynamic client GLX extensions */
psc->ext_list_first_time = GL_TRUE;
psc->driver = driGetDriver(priv->dpy, screen);
if (!driGetDriverName(priv->dpy, screen, &driverName)) {
Xfree(psp);
return NULL;
}
psc->driver = driOpenDriver(driverName);
Xfree(driverName);
if (psc->driver == NULL) {
Xfree(psp);
return NULL;

441
src/glx/x11/drisw_glx.c Normal file
View File

@@ -0,0 +1,441 @@
/*
* Copyright 2008 George Sapountzis
*
* 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 (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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
*/
#ifdef GLX_DIRECT_RENDERING
#include <X11/Xlib.h>
#include "glheader.h"
#include "glxclient.h"
#include "glcontextmodes.h"
#include <dlfcn.h>
#include "dri_common.h"
typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate;
typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate;
typedef struct __GLXDRIdrawablePrivateRec __GLXDRIdrawablePrivate;
struct __GLXDRIdisplayPrivateRec {
__GLXDRIdisplay base;
};
struct __GLXDRIcontextPrivateRec {
__GLXDRIcontext base;
__DRIcontext *driContext;
__GLXscreenConfigs *psc;
};
struct __GLXDRIdrawablePrivateRec {
__GLXDRIdrawable base;
GC gc;
GC swapgc;
XVisualInfo *visinfo;
XImage *ximage;
int bpp;
};
/**
* swrast loader functions
*/
static Bool XCreateDrawable(__GLXDRIdrawablePrivate *pdp,
Display *dpy, XID drawable, int visualid)
{
XGCValues gcvalues;
long visMask;
XVisualInfo visTemp;
int num_visuals;
/* create GC's */
pdp->gc = XCreateGC(dpy, drawable, 0, NULL);
pdp->swapgc = XCreateGC(dpy, drawable, 0, NULL);
gcvalues.function = GXcopy;
gcvalues.graphics_exposures = False;
XChangeGC(dpy, pdp->gc, GCFunction, &gcvalues);
XChangeGC(dpy, pdp->swapgc, GCFunction, &gcvalues);
XChangeGC(dpy, pdp->swapgc, GCGraphicsExposures, &gcvalues);
/* create XImage */
visTemp.screen = DefaultScreen(dpy);
visTemp.visualid = visualid;
visMask = (VisualScreenMask | VisualIDMask);
pdp->visinfo = XGetVisualInfo(dpy, visMask, &visTemp, &num_visuals);
pdp->ximage = XCreateImage(dpy,
pdp->visinfo->visual,
pdp->visinfo->depth,
ZPixmap, 0, /* format, offset */
NULL, /* data */
0, 0, /* size */
32, /* bitmap_pad */
0); /* bytes_per_line */
/* get the true number of bits per pixel */
pdp->bpp = pdp->ximage->bits_per_pixel;
return True;
}
static void XDestroyDrawable(__GLXDRIdrawablePrivate *pdp,
Display *dpy, XID drawable)
{
XDestroyImage(pdp->ximage);
XFree(pdp->visinfo);
XFreeGC(dpy, pdp->gc);
XFreeGC(dpy, pdp->swapgc);
}
static void
swrastGetDrawableInfo(__DRIdrawable *draw,
int *x, int *y, int *w, int *h,
void *loaderPrivate)
{
__GLXDRIdrawablePrivate *pdp = loaderPrivate;
__GLXDRIdrawable *pdraw = &(pdp->base);;
Display *dpy = pdraw->psc->dpy;
Drawable drawable;
Window root;
Status stat;
unsigned int bw, depth;
drawable = pdraw->xDrawable;
stat = XGetGeometry(dpy, drawable, &root,
x, y, (unsigned int *)w, (unsigned int *)h,
&bw, &depth);
}
static inline int
bytes_per_line(int w, int bpp, unsigned mul)
{
unsigned mask = mul - 1;
return ((w * bpp + mask) & ~mask) / 8;
}
static void
swrastPutImage(__DRIdrawable *draw, int op,
int x, int y, int w, int h, char *data,
void *loaderPrivate)
{
__GLXDRIdrawablePrivate *pdp = loaderPrivate;
__GLXDRIdrawable *pdraw = &(pdp->base);;
Display *dpy = pdraw->psc->dpy;
Drawable drawable;
XImage *ximage;
GC gc;
switch (op) {
case __DRI_SWRAST_IMAGE_OP_DRAW:
gc = pdp->gc;
break;
case __DRI_SWRAST_IMAGE_OP_SWAP:
gc = pdp->swapgc;
break;
default:
return;
}
drawable = pdraw->xDrawable;
ximage = pdp->ximage;
ximage->data = data;
ximage->width = w;
ximage->height = h;
ximage->bytes_per_line = bytes_per_line(w, pdp->bpp, 32);
XPutImage(dpy, drawable, gc, ximage, 0, 0, x, y, w, h);
ximage->data = NULL;
}
static void
swrastGetImage(__DRIdrawable *draw,
int x, int y, int w, int h, char *data,
void *loaderPrivate)
{
__GLXDRIdrawablePrivate *pdp = loaderPrivate;
__GLXDRIdrawable *pdraw = &(pdp->base);;
Display *dpy = pdraw->psc->dpy;
Drawable drawable;
XImage *ximage;
drawable = pdraw->xDrawable;
ximage = pdp->ximage;
ximage->data = data;
ximage->width = w;
ximage->height = h;
ximage->bytes_per_line = bytes_per_line(w, pdp->bpp, 32);
XGetSubImage(dpy, drawable, x, y, w, h, ~0L, ZPixmap, ximage, 0, 0);
ximage->data = NULL;
}
static const __DRIswrastLoaderExtension swrastLoaderExtension = {
{ __DRI_SWRAST_LOADER, __DRI_SWRAST_LOADER_VERSION },
swrastGetDrawableInfo,
swrastPutImage,
swrastGetImage
};
static const __DRIextension *loader_extensions[] = {
&systemTimeExtension.base,
&swrastLoaderExtension.base,
NULL
};
/**
* GLXDRI functions
*/
static void driDestroyContext(__GLXDRIcontext *context,
__GLXscreenConfigs *psc, Display *dpy)
{
__GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
const __DRIcoreExtension *core = pcp->psc->core;
(*core->destroyContext)(pcp->driContext);
Xfree(pcp);
}
static Bool driBindContext(__GLXDRIcontext *context,
__GLXDRIdrawable *draw, __GLXDRIdrawable *read)
{
__GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
const __DRIcoreExtension *core = pcp->psc->core;
return (*core->bindContext)(pcp->driContext,
draw->driDrawable,
read->driDrawable);
}
static void driUnbindContext(__GLXDRIcontext *context)
{
__GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
const __DRIcoreExtension *core = pcp->psc->core;
(*core->unbindContext)(pcp->driContext);
}
static __GLXDRIcontext *driCreateContext(__GLXscreenConfigs *psc,
const __GLcontextModes *mode,
GLXContext gc,
GLXContext shareList, int renderType)
{
__GLXDRIcontextPrivate *pcp, *pcp_shared;
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
const __DRIcoreExtension *core = psc->core;
__DRIcontext *shared = NULL;
if (!psc || !psc->driScreen)
return NULL;
if (shareList) {
pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext;
shared = pcp_shared->driContext;
}
pcp = Xmalloc(sizeof *pcp);
if (pcp == NULL)
return NULL;
pcp->psc = psc;
pcp->driContext =
(*core->createNewContext)(psc->__driScreen,
config->driConfig, shared, pcp);
if (pcp->driContext == NULL) {
Xfree(pcp);
return NULL;
}
pcp->base.destroyContext = driDestroyContext;
pcp->base.bindContext = driBindContext;
pcp->base.unbindContext = driUnbindContext;
return &pcp->base;
}
static void driDestroyDrawable(__GLXDRIdrawable *pdraw)
{
__GLXDRIdrawablePrivate *pdp = (__GLXDRIdrawablePrivate *) pdraw;
const __DRIcoreExtension *core = pdraw->psc->core;
(*core->destroyDrawable)(pdraw->driDrawable);
XDestroyDrawable(pdp, pdraw->psc->dpy, pdraw->drawable);
Xfree(pdp);
}
static __GLXDRIdrawable *driCreateDrawable(__GLXscreenConfigs *psc,
XID xDrawable,
GLXDrawable drawable,
const __GLcontextModes *modes)
{
__GLXDRIdrawable *pdraw;
__GLXDRIdrawablePrivate *pdp;
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
const __DRIswrastExtension *swrast = psc->swrast;
/* Old dri can't handle GLX 1.3+ drawable constructors. */
if (xDrawable != drawable)
return NULL;
pdp = Xmalloc(sizeof(*pdp));
if (!pdp)
return NULL;
pdraw = &(pdp->base);
pdraw->xDrawable = xDrawable;
pdraw->drawable = drawable;
pdraw->psc = psc;
XCreateDrawable(pdp, psc->dpy, xDrawable, modes->visualID);
/* Create a new drawable */
pdraw->driDrawable =
(*swrast->createNewDrawable)(psc->__driScreen,
config->driConfig,
pdp);
if (!pdraw->driDrawable) {
XDestroyDrawable(pdp, psc->dpy, xDrawable);
Xfree(pdp);
return NULL;
}
pdraw->destroyDrawable = driDestroyDrawable;
return pdraw;
}
static void driDestroyScreen(__GLXscreenConfigs *psc)
{
/* Free the direct rendering per screen data */
(*psc->core->destroyScreen)(psc->__driScreen);
psc->__driScreen = NULL;
if (psc->driver)
dlclose(psc->driver);
}
static __GLXDRIscreen *driCreateScreen(__GLXscreenConfigs *psc, int screen,
__GLXdisplayPrivate *priv)
{
__GLXDRIscreen *psp;
const __DRIconfig **driver_configs;
const __DRIextension **extensions;
const char *driverName = "swrast";
int i;
psp = Xmalloc(sizeof *psp);
if (psp == NULL)
return NULL;
/* Initialize per screen dynamic client GLX extensions */
psc->ext_list_first_time = GL_TRUE;
psc->driver = driOpenDriver(driverName);
if (psc->driver == NULL)
goto handle_error;
extensions = dlsym(psc->driver, __DRI_DRIVER_EXTENSIONS);
if (extensions == NULL) {
ErrorMessageF("driver exports no extensions (%s)\n", dlerror());
goto handle_error;
}
for (i = 0; extensions[i]; i++) {
if (strcmp(extensions[i]->name, __DRI_CORE) == 0)
psc->core = (__DRIcoreExtension *) extensions[i];
if (strcmp(extensions[i]->name, __DRI_SWRAST) == 0)
psc->swrast = (__DRIswrastExtension *) extensions[i];
}
if (psc->core == NULL || psc->swrast == NULL) {
ErrorMessageF("core dri extension not found\n");
goto handle_error;
}
psc->__driScreen =
psc->swrast->createNewScreen(screen,
loader_extensions, &driver_configs, psc);
if (psc->__driScreen == NULL) {
ErrorMessageF("failed to create dri screen\n");
goto handle_error;
}
driBindExtensions(psc);
psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
psp->destroyScreen = driDestroyScreen;
psp->createContext = driCreateContext;
psp->createDrawable = driCreateDrawable;
return psp;
handle_error:
Xfree(psp);
if (psc->driver)
dlclose(psc->driver);
ErrorMessageF("reverting to indirect rendering\n");
return NULL;
}
/* Called from __glXFreeDisplayPrivate.
*/
static void driDestroyDisplay(__GLXDRIdisplay *dpy)
{
Xfree(dpy);
}
/*
* Allocate, initialize and return a __DRIdisplayPrivate object.
* This is called from __glXInitialize() when we are given a new
* display pointer.
*/
_X_HIDDEN __GLXDRIdisplay *driswCreateDisplay(Display *dpy)
{
__GLXDRIdisplayPrivate *pdpyp;
pdpyp = Xmalloc(sizeof *pdpyp);
if (pdpyp == NULL)
return NULL;
pdpyp->base.destroyDisplay = driDestroyDisplay;
pdpyp->base.createScreen = driCreateScreen;
return &pdpyp->base;
}
#endif /* GLX_DIRECT_RENDERING */

View File

@@ -118,7 +118,7 @@ _gl_convert_to_x_visual_type( int visualType )
* of the fields in \c config are copied to \c mode. Additional fields in
* \c mode that can be derrived from the fields of \c config (i.e.,
* \c haveDepthBuffer) are also filled in. The remaining fields in \c mode
* that cannot be derrived are set to default values.
* that cannot be derived are set to default values.
*
* \param mode Destination GL context mode.
* \param config Source GLX visual config.
@@ -184,6 +184,9 @@ _gl_copy_visual_to_context_mode( __GLcontextModes * mode,
mode->transparentBlue = config->transparentBlue;
mode->transparentAlpha = config->transparentAlpha;
mode->transparentIndex = config->transparentIndex;
mode->samples = config->multiSampleSize;
mode->sampleBuffers = config->nMultiSampleBuffers;
/* mode->visualSelectGroup = config->visualSelectGroup; ? */
mode->swapMethod = GLX_SWAP_UNDEFINED_OML;

View File

@@ -293,7 +293,7 @@ GetDrawableAttribute( Display *dpy, GLXDrawable drawable,
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
if (pdraw != NULL && !pdraw->textureTarget)
pdraw->textureTarget = determineTextureTarget(data,
pdraw->textureTarget = determineTextureTarget((const int *)data,
num_attributes);
}
#endif

View File

@@ -147,6 +147,7 @@ struct __GLXDRIdrawableRec {
** Function to create and DRI display data and initialize the display
** dependent methods.
*/
extern __GLXDRIdisplay *driswCreateDisplay(Display *dpy);
extern __GLXDRIdisplay *driCreateDisplay(Display *dpy);
extern __GLXDRIdisplay *dri2CreateDisplay(Display *dpy);
@@ -465,6 +466,7 @@ struct __GLXscreenConfigsRec {
__DRIscreen *__driScreen;
const __DRIcoreExtension *core;
const __DRIlegacyExtension *legacy;
const __DRIswrastExtension *swrast;
__glxHashTable *drawHash;
Display *dpy;
int scr, fd;
@@ -564,6 +566,7 @@ struct __GLXdisplayPrivateRec {
/**
* Per display direct rendering interface functions and data.
*/
__GLXDRIdisplay *driswDisplay;
__GLXDRIdisplay *driDisplay;
__GLXDRIdisplay *dri2Display;
#endif

View File

@@ -194,9 +194,14 @@ static int __glXFreeDisplayPrivate(XExtData *extension)
#ifdef GLX_DIRECT_RENDERING
/* Free the direct rendering per display data */
if (priv->driswDisplay)
(*priv->driswDisplay->destroyDisplay)(priv->driswDisplay);
priv->driswDisplay = NULL;
if (priv->driDisplay)
(*priv->driDisplay->destroyDisplay)(priv->driDisplay);
priv->driDisplay = NULL;
if (priv->dri2Display)
(*priv->dri2Display->destroyDisplay)(priv->dri2Display);
priv->dri2Display = NULL;
@@ -596,10 +601,16 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv)
psc->drawHash = __glxHashCreate();
if (psc->drawHash == NULL)
continue;
if (priv->dri2Display)
psc->driScreen = (*priv->dri2Display->createScreen)(psc, i, priv);
if (psc->driScreen == NULL && priv->driDisplay)
psc->driScreen = (*priv->driDisplay->createScreen)(psc, i, priv);
if (psc->driScreen == NULL && priv->driswDisplay)
psc->driScreen = (*priv->driswDisplay->createScreen)(psc, i, priv);
if (psc->driScreen == NULL) {
__glxHashDestroy(psc->drawHash);
psc->drawHash = NULL;
@@ -620,6 +631,9 @@ _X_HIDDEN __GLXdisplayPrivate *__glXInitialize(Display* dpy)
__GLXdisplayPrivate *dpyPriv;
XEDataObject dataObj;
int major, minor;
#ifdef GLX_DIRECT_RENDERING
Bool glx_direct, glx_accel;
#endif
#if defined(USE_XTHREADS)
{
@@ -687,15 +701,20 @@ _X_HIDDEN __GLXdisplayPrivate *__glXInitialize(Display* dpy)
dpyPriv->serverGLXversion = 0x0;
#ifdef GLX_DIRECT_RENDERING
glx_direct = (getenv("LIBGL_ALWAYS_INDIRECT") == NULL);
glx_accel = (getenv("LIBGL_ALWAYS_SOFTWARE") == NULL);
/*
** Initialize the direct rendering per display data and functions.
** Note: This _must_ be done before calling any other DRI routines
** (e.g., those called in AllocAndFetchScreenConfigs).
*/
if (getenv("LIBGL_ALWAYS_INDIRECT") == NULL) {
dpyPriv->dri2Display = dri2CreateDisplay(dpy);
if (glx_direct && glx_accel) {
dpyPriv->dri2Display = dri2CreateDisplay(dpy);
dpyPriv->driDisplay = driCreateDisplay(dpy);
}
if (glx_direct)
dpyPriv->driswDisplay = driswCreateDisplay(dpy);
#endif
if (!AllocAndFetchScreenConfigs(dpy, dpyPriv)) {

View File

@@ -23,6 +23,7 @@
* SOFTWARE.
*/
#include "glheader.h"
#include <inttypes.h>
#include <GL/gl.h>
#include "indirect.h"

View File

@@ -34,6 +34,7 @@
**
*/
#include "glheader.h"
#include "glxclient.h"
#include "indirect.h"

View File

@@ -34,6 +34,7 @@
**
*/
#include "glheader.h"
#include "packsingle.h"
#include "indirect.h"
#include "dispatch.h"

View File

@@ -6,11 +6,6 @@ include $(TOP)/configs/current
include sources
GL_MAJOR = 1
GL_MINOR = 5
GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
.SUFFIXES : .cpp
.c.o:
@@ -23,20 +18,62 @@ GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
# Figure out what to make here
default: depend
@for driver in $(DRIVER_DIRS) ; do \
case "$$driver" in \
x11) $(MAKE) stand-alone || exit 1 ;; \
dri) $(MAKE) linux-solo || exit 1 ;; \
osmesa) $(MAKE) osmesa-only || exit 1 ;; \
beos) $(MAKE) beos || exit 1 ;; \
directfb) $(MAKE) directfb || exit 1 ;; \
fbdev) $(MAKE) fbdev || exit 1 ;; \
*) echo "$$driver is invalid in DRIVER_DIRS" >&2; exit 1;; \
esac ; \
done
# Default: build dependencies, then asm_subdirs, then convenience
# libs (.a) and finally the device drivers:
default: depend asm_subdirs libmesa.a libglapi.a driver_subdirs
######################################################################
# Helper libraries used by many drivers:
# Make archive of core mesa object files
libmesa.a: $(MESA_OBJECTS)
@ $(TOP)/bin/mklib -o mesa -static $(MESA_OBJECTS)
# Make archive of gl* API dispatcher functions only
libglapi.a: $(GLAPI_OBJECTS)
@ $(TOP)/bin/mklib -o glapi -static $(GLAPI_OBJECTS)
######################################################################
# Device drivers
driver_subdirs: libmesa.a libglapi.a
(cd drivers && $(MAKE))
######################################################################
# Assembly subdirs
asm_subdirs:
@ if echo "$(ASM_FLAGS)" | grep -q USE_X86_ASM ; then \
(cd x86 && $(MAKE)) || exit 1 ; \
fi
@ if echo "$(ASM_FLAGS)" | grep -q USE_X86_64_ASM ; then \
(cd x86 && $(MAKE)) || exit 1 ; \
(cd x86-64 && $(MAKE)) || exit 1 ; \
fi
######################################################################
# Dependency generation
depend: $(ALL_SOURCES)
@ echo "running $(MKDEP)"
@ touch depend
@$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \
> /dev/null 2>/dev/null
######################################################################
# Installation rules
# this isn't fleshed out yet but is probably the way to go in the future
new_install:
(cd drivers && $(MAKE) install)
# XXX replace this with new_install above someday
install: default
@for driver in $(DRIVER_DIRS) ; do \
case "$$driver" in \
@@ -51,164 +88,50 @@ install: default
done
######################################################################
# BeOS driver target
beos: depend subdirs libmesa.a
cd drivers/beos && $(MAKE)
######################################################################
# Linux DRI drivers
# Make archive of core object files
libmesa.a: $(SOLO_OBJECTS)
@ $(TOP)/bin/mklib -o mesa -static $(SOLO_OBJECTS);
@if [ "${CONFIG_NAME}" = "beos" ] ; then \
mimeset -f "$@" ; \
fi
linux-solo: depend subdirs libmesa.a
cd drivers/dri && $(MAKE)
#####################################################################
# Stand-alone Mesa libGL, no built-in drivers (DirectFB)
libgl-core: $(CORE_OBJECTS)
@ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) $(CORE_OBJECTS) \
$(GL_LIB_DEPS)
directfb: depend subdirs libgl-core
cd drivers/directfb && $(MAKE)
#####################################################################
# fbdev Mesa driver (libGL.so)
fbdev: $(CORE_OBJECTS) $(FBDEV_DRIVER_OBJECTS) $(COMMON_DRIVER_OBJECTS)
@ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
$(CORE_OBJECTS) $(FBDEV_DRIVER_OBJECTS) \
$(COMMON_DRIVER_OBJECTS) $(GL_LIB_DEPS)
######################################################################
# Stand-alone Mesa libGL and libOSMesa
STAND_ALONE_DRIVER_SOURCES = \
$(COMMON_DRIVER_SOURCES) \
$(X11_DRIVER_SOURCES)
STAND_ALONE_DRIVER_OBJECTS = $(STAND_ALONE_DRIVER_SOURCES:.c=.o)
STAND_ALONE_OBJECTS = \
$(CORE_OBJECTS) \
$(STAND_ALONE_DRIVER_OBJECTS)
# For libOSMesa16 or libOSMesa32 we link _all_ the objects into the library,
# not just the osmesa.o object (i.e. we don't have a libGL).
OSMESA16_OBJECTS = \
$(CORE_OBJECTS) \
$(COMMON_DRIVER_OBJECTS) \
$(OSMESA_DRIVER_OBJECTS)
stand-alone: depend subdirs libmesa.a \
$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
osmesa-only: depend subdirs \
$(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)
# Make the GL library
$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS)
@ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \
-install $(TOP)/$(LIB_DIR) \
$(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(STAND_ALONE_OBJECTS)
# Make the OSMesa library
$(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OSMESA_DRIVER_OBJECTS) $(OSMESA16_OBJECTS)
@ if [ "${DRIVER_DIRS}" = "osmesa" ] ; then \
$(TOP)/bin/mklib -o $(OSMESA_LIB) -linker '$(CC)' \
-ldflags '$(LDFLAGS)' -major $(MESA_MAJOR) \
-minor $(MESA_MINOR) -patch $(MESA_TINY) \
-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
$(OSMESA_LIB_DEPS) $(OSMESA16_OBJECTS) ; \
else \
$(TOP)/bin/mklib -o $(OSMESA_LIB) -linker '$(CC)' \
-ldflags '$(LDFLAGS)' -major $(MESA_MAJOR) \
-minor $(MESA_MINOR) -patch $(GL_TINY) \
-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
$(OSMESA_LIB_DEPS) $(OSMESA_DRIVER_OBJECTS) ; \
fi
######################################################################
# Generic stuff
depend: $(ALL_SOURCES)
@ echo "running $(MKDEP)"
@ touch depend
@$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \
> /dev/null 2>/dev/null
subdirs:
@ if echo "$(ASM_FLAGS)" | grep -q USE_X86_ASM ; then \
(cd x86 && $(MAKE)) || exit 1 ; \
fi
@ if echo "$(ASM_FLAGS)" | grep -q USE_X86_64_ASM ; then \
(cd x86 && $(MAKE)) || exit 1 ; \
(cd x86-64 && $(MAKE)) || exit 1 ; \
fi
pcedit = sed \
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
-e 's,@LIB_DIR@,$(LIB_DIR),' \
-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
-e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),'
gl.pc: gl.pc.in
$(pcedit) $< > $@
install-headers:
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL
$(INSTALL) -m 644 $(TOP)/include/GL/*.h \
$(DESTDIR)$(INSTALL_DIR)/include/GL
$(DESTDIR)$(INSTALL_INC_DIR)/GL
install-libgl: default gl.pc install-headers
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
$(INSTALL) $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)* \
$(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
$(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
$(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
install-osmesa: default
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)* \
$(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
$(DESTDIR)$(INSTALL_LIB_DIR)
install-dri:
install-dri: default
cd drivers/dri && $(MAKE) install
## NOT INSTALLED YET:
## $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GLES
## $(INSTALL) -m 644 include/GLES/*.h $(DESTDIR)$(INSTALL_DIR)/include/GLES
# Emacs tags
tags:
etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
clean:
-rm -f */*.o
-rm -f */*/*.o
-rm -f depend depend.bak libmesa.a
-rm -f depend depend.bak libmesa.a libglapi.a
-rm -f drivers/*/*.o
-@cd drivers/dri && $(MAKE) clean
-@cd drivers/xorg && $(MAKE) clean
-@cd drivers/x11 && $(MAKE) clean
-@cd drivers/osmesa && $(MAKE) clean
-@cd x86 && $(MAKE) clean
-@cd x86-64 && $(MAKE) clean

29
src/mesa/drivers/Makefile Normal file
View File

@@ -0,0 +1,29 @@
# src/mesa/drivers/Makefile
TOP = ../../..
include $(TOP)/configs/current
default:
@for dir in $(DRIVER_DIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE)) || exit 1; \
fi \
done
clean:
@for dir in $(DRIVER_DIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE) clean) || exit 1; \
fi \
done
install:
@for dir in $(DRIVER_DIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE) install) || exit 1; \
fi \
done

View File

@@ -169,8 +169,10 @@ OBJECTS := $(DRIVER_OBJECTS:.cpp=.o)
default: depend $(TOP)/$(LIB_DIR) $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
# XXX FIXME: mesa.a might be libmesa.a now
$(MESA_MODULES):
cd $(TOP)/src/mesa && $(MAKE) mesa.a ;
mimeset -f "$@"
$(GLU_MODULES):
cd $(GLU_DIR) && $(MAKE) $(subst $(GLU_DIR)/,,$(GLU_MODULES)) ;

View File

@@ -25,11 +25,24 @@ DIRECTFBGL_MESA_OBJECTS = $(DIRECTFBGL_MESA_SOURCES:.c=.o)
DIRECTFBGL_MESA = libidirectfbgl_mesa.so
LIBS = $(TOP)/src/mesa/libmesa.a $(TOP)/src/mesa/libglapi.a
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(DFB_CFLAGS) $< -o $@
default: directfbgl_mesa
default: directfb-libgl directfbgl_mesa
# XXX this used to be in src/mesa/Makefile and is probably broken now
directfb-libgl: $(LIBS)
@ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) $(LIBS) \
$(GL_LIB_DEPS)
# Mesa DirectFBGL module
directfbgl_mesa: $(DIRECTFBGL_MESA_OBJECTS)

View File

@@ -102,7 +102,7 @@ typedef struct {
static pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER;
static unsigned int global_ref = 0;
static inline int directfbgl_init( void )
static INLINE int directfbgl_init( void )
{
pthread_mutexattr_t attr;
int ret;
@@ -118,7 +118,7 @@ static inline int directfbgl_init( void )
return ret;
}
static inline void directfbgl_finish( void )
static INLINE void directfbgl_finish( void )
{
if (--global_ref == 0)
pthread_mutex_destroy( &global_lock );

View File

@@ -20,16 +20,30 @@ subdirs:
fi \
done
pcedit = sed \
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
-e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
-e 's,@DRI_DRIVER_DIR@,$(DRI_DRIVER_SEARCH_DIR),'
install:
dri.pc: dri.pc.in
$(pcedit) $< > $@
install: dri.pc
@for dir in $(DRI_DIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE) install) || exit 1 ; \
fi \
done
$(TOP)/bin/minstall -d $(DESTDIR)$(INSTALL_DIR)/include/GL/internal
$(TOP)/bin/minstall -m 0644 $(TOP)/include/GL/internal/dri_interface.h $(DESTDIR)$(INSTALL_DIR)/include/GL/internal
$(TOP)/bin/minstall -m 0644 $(TOP)/include/GL/internal/dri_sarea.h $(DESTDIR)$(INSTALL_DIR)/include/GL/internal
$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL/internal
$(INSTALL) -m 0644 $(TOP)/include/GL/internal/dri_interface.h \
$(DESTDIR)$(INSTALL_INC_DIR)/GL/internal
$(INSTALL) -m 0644 $(TOP)/include/GL/internal/dri_sarea.h \
$(DESTDIR)$(INSTALL_INC_DIR)/GL/internal
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
$(INSTALL) -m 0644 dri.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
clean:

View File

@@ -3,7 +3,6 @@
MESA_MODULES = $(TOP)/src/mesa/libmesa.a
COMMON_SOURCES = \
../../common/driverfuncs.c \
../common/utils.c \
../common/texmem.c \
../common/vblank.c \

View File

@@ -40,11 +40,6 @@ dri_bo *
dri_bo_alloc(dri_bufmgr *bufmgr, const char *name, unsigned long size,
unsigned int alignment, uint64_t location_mask)
{
assert((location_mask & ~(DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_MEM_TT |
DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_MEM_PRIV0 |
DRM_BO_FLAG_MEM_PRIV1 | DRM_BO_FLAG_MEM_PRIV2 |
DRM_BO_FLAG_MEM_PRIV3 | DRM_BO_FLAG_MEM_PRIV4 |
DRM_BO_FLAG_CACHED | DRM_BO_FLAG_CACHED_MAPPED)) == 0);
return bufmgr->bo_alloc(bufmgr, name, size, alignment, location_mask);
}
@@ -53,12 +48,6 @@ dri_bo_alloc_static(dri_bufmgr *bufmgr, const char *name, unsigned long offset,
unsigned long size, void *virtual,
uint64_t location_mask)
{
assert((location_mask & ~(DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_MEM_TT |
DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_MEM_PRIV0 |
DRM_BO_FLAG_MEM_PRIV1 | DRM_BO_FLAG_MEM_PRIV2 |
DRM_BO_FLAG_MEM_PRIV3 |
DRM_BO_FLAG_MEM_PRIV4)) == 0);
return bufmgr->bo_alloc_static(bufmgr, name, offset, size, virtual,
location_mask);
}

View File

@@ -219,4 +219,42 @@ void dri_post_process_relocs(dri_bo *batch_buf);
void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence);
int dri_bufmgr_check_aperture_space(dri_bo *bo);
#ifndef TTM_API
/* reuse some TTM API */
#define DRM_BO_MEM_LOCAL 0
#define DRM_BO_MEM_TT 1
#define DRM_BO_MEM_VRAM 2
#define DRM_BO_MEM_PRIV0 3
#define DRM_BO_MEM_PRIV1 4
#define DRM_BO_MEM_PRIV2 5
#define DRM_BO_MEM_PRIV3 6
#define DRM_BO_MEM_PRIV4 7
#define DRM_BO_FLAG_READ (1ULL << 0)
#define DRM_BO_FLAG_WRITE (1ULL << 1)
#define DRM_BO_FLAG_EXE (1ULL << 2)
#define DRM_BO_MASK_ACCESS (DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_EXE)
#define DRM_BO_FLAG_NO_EVICT (1ULL << 4)
#define DRM_BO_FLAG_MAPPABLE (1ULL << 5)
#define DRM_BO_FLAG_SHAREABLE (1ULL << 6)
#define DRM_BO_FLAG_CACHED (1ULL << 7)
#define DRM_BO_FLAG_NO_MOVE (1ULL << 8)
#define DRM_BO_FLAG_CACHED_MAPPED (1ULL << 19)
#define DRM_BO_FLAG_FORCE_CACHING (1ULL << 13)
#define DRM_BO_FLAG_FORCE_MAPPABLE (1ULL << 14)
#define DRM_BO_FLAG_TILE (1ULL << 15)
#define DRM_BO_FLAG_MEM_LOCAL (1ULL << 24)
#define DRM_BO_FLAG_MEM_TT (1ULL << 25)
#define DRM_BO_FLAG_MEM_VRAM (1ULL << 26)
#define DRM_BO_MASK_MEM 0x00000000FF000000ULL
#define DRM_FENCE_TYPE_EXE 0x00000001
#endif
#endif

View File

@@ -277,13 +277,13 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp)
pdp->pStamp = &(psp->pSAREA->drawableTable[pdp->index].stamp);
DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
}
int
__driParseEvents(__DRIcontextPrivate *pcp, __DRIdrawablePrivate *pdp)
{
__DRIscreenPrivate *psp = pcp->driScreenPriv;
__DRIscreenPrivate *psp = pdp->driScreenPriv;
__DRIDrawableConfigEvent *dc, *last_dc;
__DRIBufferAttachEvent *ba, *last_ba;
unsigned int tail, mask, *p, end, total, size, changed;
@@ -291,7 +291,7 @@ __driParseEvents(__DRIcontextPrivate *pcp, __DRIdrawablePrivate *pdp)
size_t rect_size;
/* Check for wraparound. */
if (psp->dri2.buffer->prealloc - pdp->dri2.tail > psp->dri2.buffer->size) {
if (pcp && psp->dri2.buffer->prealloc - pdp->dri2.tail > psp->dri2.buffer->size) {
/* If prealloc overlaps into what we just parsed, the
* server overwrote it and we have to reset our tail
* pointer. */
@@ -460,6 +460,9 @@ static void driSwapBuffers(__DRIdrawable *dPriv)
if (!dPriv->numClipRects)
return;
if (psp->dri2.enabled)
__driParseEvents(NULL, dPriv);
psp->DriverAPI.SwapBuffers(dPriv);
driReportDamage(dPriv, dPriv->pClipRects, dPriv->numClipRects);
@@ -471,6 +474,7 @@ static int driDrawableGetMSC( __DRIscreen *sPriv, __DRIdrawable *dPriv,
return sPriv->DriverAPI.GetDrawableMSC(sPriv, dPriv, msc);
}
static int driWaitForMSC(__DRIdrawable *dPriv, int64_t target_msc,
int64_t divisor, int64_t remainder,
int64_t * msc, int64_t * sbc)
@@ -478,7 +482,6 @@ static int driWaitForMSC(__DRIdrawable *dPriv, int64_t target_msc,
__DRIswapInfo sInfo;
int status;
status = dPriv->driScreenPriv->DriverAPI.WaitForMSC( dPriv, target_msc,
divisor, remainder,
msc );
@@ -496,12 +499,14 @@ static int driWaitForMSC(__DRIdrawable *dPriv, int64_t target_msc,
return status;
}
const __DRImediaStreamCounterExtension driMediaStreamCounterExtension = {
{ __DRI_MEDIA_STREAM_COUNTER, __DRI_MEDIA_STREAM_COUNTER_VERSION },
driWaitForMSC,
driDrawableGetMSC,
};
static void driCopySubBuffer(__DRIdrawable *dPriv,
int x, int y, int w, int h)
{
@@ -510,9 +515,9 @@ static void driCopySubBuffer(__DRIdrawable *dPriv,
dPriv->driScreenPriv->DriverAPI.CopySubBuffer(dPriv, x, y, w, h);
rect.x1 = x;
rect.y1 = y;
rect.y1 = dPriv->h - y - h;
rect.x2 = x + w;
rect.y2 = y + w;
rect.y2 = rect.y1 + h;
driReportDamage(dPriv, &rect, 1);
}
@@ -595,6 +600,7 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config,
return pdp;
}
static __DRIdrawable *
dri2CreateNewDrawable(__DRIscreen *screen, const __DRIconfig *config,
unsigned int drawable_id, unsigned int head, void *data)
@@ -602,6 +608,8 @@ dri2CreateNewDrawable(__DRIscreen *screen, const __DRIconfig *config,
__DRIdrawable *pdraw;
pdraw = driCreateNewDrawable(screen, config, 0, 0, NULL, data);
if (!pdraw)
return NULL;
pdraw->dri2.drawable_id = drawable_id;
pdraw->dri2.tail = head;
@@ -642,8 +650,6 @@ driDestroyDrawable(__DRIdrawable *pdp)
/**
* Destroy the per-context private information.
*
* \param contextPrivate opaque pointer to the per-drawable private info.
*
* \internal
* This function calls __DriverAPIRec::DestroyContext on \p contextPrivate, calls
* drmDestroyContext(), and finally frees \p contextPrivate.
@@ -661,13 +667,9 @@ driDestroyContext(__DRIcontext *pcp)
/**
* Create the per-drawable private driver information.
*
* \param dpy The display handle.
* \param modes Mode used to create the new context.
* \param render_type Type of rendering target. \c GLX_RGBA is the only
* type likely to ever be supported for direct-rendering.
* \param shared The shared context dependent methods or \c NULL if
* non-existent.
* \param pctx DRI context to receive the context dependent methods.
* \param shared Context with which to share textures, etc. or NULL
*
* \returns An opaque pointer to the per-context private information on
* success, or \c NULL on failure.
@@ -716,6 +718,7 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config,
return pcp;
}
static __DRIcontext *
dri2CreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
__DRIcontext *shared, void *data)
@@ -734,6 +737,7 @@ dri2CreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
return driCreateNewContext(screen, config, 0, shared, hwContext, data);
}
static int
driCopyContext(__DRIcontext *dest, __DRIcontext *src, unsigned long mask)
{
@@ -751,10 +755,6 @@ driCopyContext(__DRIcontext *dest, __DRIcontext *src, unsigned long mask)
/**
* Destroy the per-screen private information.
*
* \param dpy the display handle.
* \param scrn the screen number.
* \param screenPrivate opaque pointer to the per-screen private information.
*
* \internal
* This function calls __DriverAPIRec::DestroyScreen on \p screenPrivate, calls
* drmClose(), and finally frees \p screenPrivate.
@@ -771,8 +771,10 @@ static void driDestroyScreen(__DRIscreen *psp)
(*psp->DriverAPI.DestroyScreen)(psp);
if (psp->dri2.enabled) {
#ifdef TTM_API
drmBOUnmap(psp->fd, &psp->dri2.sareaBO);
drmBOUnreference(psp->fd, &psp->dri2.sareaBO);
#endif
} else {
(void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX);
(void)drmUnmap((drmAddress)psp->pFB, psp->fbSize);
@@ -807,15 +809,10 @@ setupLoaderExtensions(__DRIscreen *psp,
* This routine also fills in the linked list pointed to by \c driver_modes
* with the \c __GLcontextModes that the driver can support for windows or
* pbuffers.
*
* For legacy DRI.
*
* \param scrn Index of the screen
* \param psc DRI screen data (not driver private)
* \param modes Linked list of known display modes. This list is, at a
* minimum, a list of modes based on the current display mode.
* These roughly match the set of available X11 visuals, but it
* need not be limited to X11! The calling libGL should create
* a list that will inform the driver of the current display
* mode (i.e., color buffer depth, depth buffer depth, etc.).
* \param ddx_version Version of the 2D DDX. This may not be meaningful for
* all drivers.
* \param dri_version Version of the "server-side" DRI.
@@ -824,9 +821,9 @@ setupLoaderExtensions(__DRIscreen *psp,
* framebuffer.
* \param pSAREA Pointer the the SAREA.
* \param fd Device handle for the DRM.
* \param internal_api_version Version of the internal interface between the
* driver and libGL.
* \param driverAPI Driver API functions used by other routines in dri_util.c.
* \param extensions ??
* \param driver_modes Returns modes suppoted by the driver
* \param loaderPrivate ??
*
* \note There is no need to check the minimum API version in this
* function. Since the name of this function is versioned, it is
@@ -899,11 +896,15 @@ driCreateNewScreen(int scrn,
}
/**
* DRI2
*/
static __DRIscreen *
dri2CreateNewScreen(int scrn, int fd, unsigned int sarea_handle,
const __DRIextension **extensions,
const __DRIconfig ***driver_configs, void *data)
{
#ifdef TTM_API
static const __DRIextension *emptyExtensionList[] = { NULL };
__DRIscreen *psp;
unsigned int *p;
@@ -971,6 +972,9 @@ dri2CreateNewScreen(int scrn, int fd, unsigned int sarea_handle,
psp->DriverAPI = driDriverAPI;
return psp;
#else
return NULL;
#endif
}
static const __DRIextension **driGetExtensions(__DRIscreen *psp)
@@ -978,6 +982,7 @@ static const __DRIextension **driGetExtensions(__DRIscreen *psp)
return psp->extensions;
}
/** Legacy DRI interface */
const __DRIlegacyExtension driLegacyExtension = {
{ __DRI_LEGACY, __DRI_LEGACY_VERSION },
driCreateNewScreen,
@@ -985,6 +990,7 @@ const __DRIlegacyExtension driLegacyExtension = {
driCreateNewContext
};
/** DRI2 interface */
const __DRIcoreExtension driCoreExtension = {
{ __DRI_CORE, __DRI_CORE_VERSION },
dri2CreateNewScreen,

View File

@@ -53,7 +53,7 @@
#include <drm.h>
#include <drm_sarea.h>
#include <xf86drm.h>
#include <xf86mm.h>
#include "glheader.h"
#include "GL/internal/glcore.h"
#include "GL/internal/dri_interface.h"
#include "GL/internal/dri_sarea.h"
@@ -524,7 +524,9 @@ struct __DRIscreenRec {
/* Flag to indicate that this is a DRI2 screen. Many of the above
* fields will not be valid or initializaed in that case. */
int enabled;
#ifdef TTM_API
drmBO sareaBO;
#endif
void *sarea;
__DRIEventBuffer *buffer;
__DRILock *lock;

View File

@@ -1077,13 +1077,6 @@ static const char AreTexturesResident_names[] =
"";
#endif
#if defined(need_GL_EXT_framebuffer_object)
static const char IsRenderbufferEXT_names[] =
"i\0" /* Parameter signature */
"glIsRenderbufferEXT\0"
"";
#endif
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ATI_separate_stencil)
static const char StencilOpSeparate_names[] =
"iiii\0" /* Parameter signature */
@@ -1763,13 +1756,6 @@ static const char DeleteFencesNV_names[] =
"";
#endif
#if defined(need_GL_SGIX_polynomial_ffd)
static const char DeformationMap3dSGIX_names[] =
"iddiiddiiddiip\0" /* Parameter signature */
"glDeformationMap3dSGIX\0"
"";
#endif
#if defined(need_GL_VERSION_2_0)
static const char IsShader_names[] =
"i\0" /* Parameter signature */
@@ -2015,6 +2001,13 @@ static const char WeightfvARB_names[] =
"";
#endif
#if defined(need_GL_EXT_framebuffer_object)
static const char IsRenderbufferEXT_names[] =
"i\0" /* Parameter signature */
"glIsRenderbufferEXT\0"
"";
#endif
#if defined(need_GL_MESA_window_pos)
static const char WindowPos4fMESA_names[] =
"ffff\0" /* Parameter signature */
@@ -4530,6 +4523,13 @@ static const char Minmax_names[] =
"";
#endif
#if defined(need_GL_SGIX_polynomial_ffd)
static const char DeformationMap3dSGIX_names[] =
"iddiiddiiddiip\0" /* Parameter signature */
"glDeformationMap3dSGIX\0"
"";
#endif
#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord)
static const char FogCoorddvEXT_names[] =
"p\0" /* Parameter signature */
@@ -5319,13 +5319,13 @@ static const struct dri_extension_function GL_EXT_framebuffer_blit_functions[] =
#if defined(need_GL_EXT_framebuffer_object)
static const struct dri_extension_function GL_EXT_framebuffer_object_functions[] = {
{ GenerateMipmapEXT_names, GenerateMipmapEXT_remap_index, -1 },
{ IsRenderbufferEXT_names, IsRenderbufferEXT_remap_index, -1 },
{ RenderbufferStorageEXT_names, RenderbufferStorageEXT_remap_index, -1 },
{ CheckFramebufferStatusEXT_names, CheckFramebufferStatusEXT_remap_index, -1 },
{ DeleteRenderbuffersEXT_names, DeleteRenderbuffersEXT_remap_index, -1 },
{ FramebufferTexture3DEXT_names, FramebufferTexture3DEXT_remap_index, -1 },
{ FramebufferRenderbufferEXT_names, FramebufferRenderbufferEXT_remap_index, -1 },
{ FramebufferTexture1DEXT_names, FramebufferTexture1DEXT_remap_index, -1 },
{ IsRenderbufferEXT_names, IsRenderbufferEXT_remap_index, -1 },
{ BindFramebufferEXT_names, BindFramebufferEXT_remap_index, -1 },
{ GenRenderbuffersEXT_names, GenRenderbuffersEXT_remap_index, -1 },
{ IsFramebufferEXT_names, IsFramebufferEXT_remap_index, -1 },
@@ -5965,9 +5965,9 @@ static const struct dri_extension_function GL_SGIX_pixel_texture_functions[] = {
#if defined(need_GL_SGIX_polynomial_ffd)
static const struct dri_extension_function GL_SGIX_polynomial_ffd_functions[] = {
{ LoadIdentityDeformationMapSGIX_names, LoadIdentityDeformationMapSGIX_remap_index, -1 },
{ DeformationMap3dSGIX_names, DeformationMap3dSGIX_remap_index, -1 },
{ DeformSGIX_names, DeformSGIX_remap_index, -1 },
{ DeformationMap3fSGIX_names, DeformationMap3fSGIX_remap_index, -1 },
{ DeformationMap3dSGIX_names, DeformationMap3dSGIX_remap_index, -1 },
{ NULL, 0, 0 }
};
#endif

View File

@@ -4,7 +4,7 @@
* memset an area in I/O space
* We need to be careful about this on some archs
*/
static __inline__ void drimemsetio(void* address, int c, int size)
static INLINE void drimemsetio(void* address, int c, int size)
{
#if defined(__powerpc__) || defined(__ia64__)
int i;

View File

@@ -37,7 +37,7 @@
#if defined( __powerpc__ )
static __inline__ u_int32_t
static INLINE u_int32_t
read_MMIO_LE32( volatile void * base, unsigned long offset )
{
u_int32_t val;
@@ -50,7 +50,7 @@ read_MMIO_LE32( volatile void * base, unsigned long offset )
#else
static __inline__ u_int32_t
static INLINE u_int32_t
read_MMIO_LE32( volatile void * base, unsigned long offset )
{
volatile u_int32_t * p = (volatile u_int32_t *) (((volatile char *) base) + offset);

View File

@@ -1278,6 +1278,7 @@ driCalculateTextureFirstLastLevel( driTextureObject * t )
else {
firstLevel = tObj->BaseLevel + (GLint)(tObj->MinLod + 0.5);
firstLevel = MAX2(firstLevel, tObj->BaseLevel);
firstLevel = MIN2(firstLevel, tObj->BaseLevel + baseImage->MaxLog2);
lastLevel = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5);
lastLevel = MAX2(lastLevel, t->tObj->BaseLevel);
lastLevel = MIN2(lastLevel, t->tObj->BaseLevel + baseImage->MaxLog2);

View File

@@ -63,6 +63,12 @@ extern char *program_invocation_name, *program_invocation_short_name;
#elif defined(__NetBSD__) && defined(__NetBSD_Version) && (__NetBSD_Version >= 106000100)
# include <stdlib.h>
# define GET_PROGRAM_NAME() getprogname()
#elif defined(__sun)
/* Solaris has getexecname() which returns the full path - return just
the basename to match BSD getprogname() */
# include <stdlib.h>
# include <libgen.h>
# define GET_PROGRAM_NAME() basename(getexecname())
#endif
#if !defined(GET_PROGRAM_NAME)

View File

@@ -0,0 +1,10 @@
prefix=@INSTALL_DIR@
exec_prefix=${prefix}
libdir=@INSTALL_LIB_DIR@
includedir=@INSTALL_INC_DIR@
dridriverdir=@DRI_DRIVER_DIR@
Name: dri
Description: Direct Rendering Infrastructure
Version: @VERSION@
Cflags: -I${includedir}

View File

@@ -79,7 +79,7 @@ struct ff_fixups {
/* Compute fixups of non-page aligned areas after a page fill.
* Return the number of fixups needed.
*/
static __inline__ int
static INLINE int
CreatorComputePageFillFixups(struct ff_fixups *fixups,
int x, int y, int w, int h,
int paligned_x, int paligned_y,

View File

@@ -1,6 +1,6 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_linetmp.h,v 1.2 2002/02/22 21:32:58 dawes Exp $ */
static __inline void TAG(ffb_line)(GLcontext *ctx, ffb_vertex *v0,
static INLINE void TAG(ffb_line)(GLcontext *ctx, ffb_vertex *v0,
ffb_vertex *v1 )
{
ffbContextPtr fmesa = FFB_CONTEXT(ctx);

View File

@@ -1,6 +1,6 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_pointtmp.h,v 1.3 2002/02/22 21:32:59 dawes Exp $ */
static __inline void TAG(ffb_draw_point)(GLcontext *ctx, ffb_vertex *tmp )
static INLINE void TAG(ffb_draw_point)(GLcontext *ctx, ffb_vertex *tmp )
{
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
ffb_fbcPtr ffb = fmesa->regs;

View File

@@ -42,10 +42,6 @@
#include "ffb_vtxfmt.h"
#ifndef __GNUC__
#define __inline /**/
#endif
#define TNL_VERTEX ffbTnlVertex
#define INTERP_RGBA(t, out, a, b) \
@@ -60,7 +56,7 @@ do { \
/* Color functions: */
static __inline void ffb_recalc_base_color(GLcontext *ctx)
static INLINE void ffb_recalc_base_color(GLcontext *ctx)
{
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
struct gl_light *light;

View File

@@ -384,7 +384,7 @@ struct gamma_context {
int TextureCount;
};
static __inline GLuint gammaPackColor( GLuint cpp,
static INLINE GLuint gammaPackColor( GLuint cpp,
GLubyte r, GLubyte g,
GLubyte b, GLubyte a )
{

View File

@@ -129,13 +129,13 @@ static const GLuint hw_prim[GL_POLYGON+1] = {
B_PrimType_Polygon
};
static __inline void gammaStartPrimitive( gammaContextPtr gmesa, GLenum prim )
static INLINE void gammaStartPrimitive( gammaContextPtr gmesa, GLenum prim )
{
CHECK_DMA_BUFFER(gmesa, 1);
WRITE(gmesa->buf, Begin, gmesa->Begin | hw_prim[prim]);
}
static __inline void gammaEndPrimitive( gammaContextPtr gmesa )
static INLINE void gammaEndPrimitive( gammaContextPtr gmesa )
{
GLcontext *ctx = gmesa->glCtx;

View File

@@ -34,7 +34,7 @@ do { \
} \
} while (0)
static __inline GLuint *i810AllocDmaLow( i810ContextPtr imesa, int bytes )
static INLINE GLuint *i810AllocDmaLow( i810ContextPtr imesa, int bytes )
{
if (imesa->vertex_low + bytes > imesa->vertex_high)
i810FlushPrimsGetBuffer( imesa );

View File

@@ -27,7 +27,7 @@
#include "tnl/t_pipeline.h"
static __inline__ GLuint i810PackColor(GLuint format,
static INLINE GLuint i810PackColor(GLuint format,
GLubyte r, GLubyte g,
GLubyte b, GLubyte a)
{

View File

@@ -64,7 +64,7 @@ void i810DestroyTexObj(i810ContextPtr imesa, i810TextureObjectPtr t)
/* From linux kernel i386 header files, copes with odd sizes better
* than COPY_DWORDS would:
*/
static __inline__ void * __memcpy(void * to, const void * from, size_t n)
static INLINE void * __memcpy(void * to, const void * from, size_t n)
{
int d0, d1, d2;
__asm__ __volatile__(

View File

@@ -75,7 +75,7 @@ do { \
} while (0)
#endif
static __inline__ void i810_draw_triangle( i810ContextPtr imesa,
static INLINE void i810_draw_triangle( i810ContextPtr imesa,
i810VertexPtr v0,
i810VertexPtr v1,
i810VertexPtr v2 )
@@ -90,7 +90,7 @@ static __inline__ void i810_draw_triangle( i810ContextPtr imesa,
}
static __inline__ void i810_draw_quad( i810ContextPtr imesa,
static INLINE void i810_draw_quad( i810ContextPtr imesa,
i810VertexPtr v0,
i810VertexPtr v1,
i810VertexPtr v2,
@@ -109,7 +109,7 @@ static __inline__ void i810_draw_quad( i810ContextPtr imesa,
}
static __inline__ void i810_draw_point( i810ContextPtr imesa,
static INLINE void i810_draw_point( i810ContextPtr imesa,
i810VertexPtr tmp )
{
GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size,
@@ -133,7 +133,7 @@ static __inline__ void i810_draw_point( i810ContextPtr imesa,
}
static __inline__ void i810_draw_line( i810ContextPtr imesa,
static INLINE void i810_draw_line( i810ContextPtr imesa,
i810VertexPtr v0,
i810VertexPtr v1 )
{

View File

@@ -28,6 +28,7 @@ DRIVER_SOURCES = \
intel_tex_format.c \
intel_tex.c \
intel_pixel.c \
intel_pixel_bitmap.c \
intel_pixel_copy.c \
intel_pixel_read.c \
intel_pixel_draw.c \

View File

@@ -52,7 +52,6 @@ static void
i830InitDriverFunctions(struct dd_function_table *functions)
{
intelInitDriverFunctions(functions);
intelInitPixelFuncs(functions);
i830InitStateFuncs(functions);
i830InitTextureFuncs(functions);
}

View File

@@ -94,7 +94,6 @@ static void
i915InitDriverFunctions(struct dd_function_table *functions)
{
intelInitDriverFunctions(functions);
intelInitPixelFuncs(functions);
i915InitStateFunctions(functions);
i915InitTextureFuncs(functions);
i915InitFragProgFuncs(functions);

View File

@@ -65,7 +65,12 @@ translate_texture_format(GLuint mesa_format, GLenum DepthMode)
case MESA_FORMAT_RGBA_FXT1:
return (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1);
case MESA_FORMAT_Z16:
return (MAPSURF_16BIT | (DepthMode==GL_ALPHA?MT_16BIT_A16:MT_16BIT_L16));
if (DepthMode == GL_ALPHA)
return (MAPSURF_16BIT | MT_16BIT_A16);
else if (DepthMode == GL_INTENSITY)
return (MAPSURF_16BIT | MT_16BIT_I16);
else
return (MAPSURF_16BIT | MT_16BIT_L16);
case MESA_FORMAT_RGBA_DXT1:
case MESA_FORMAT_RGB_DXT1:
return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1);

View File

@@ -1,349 +0,0 @@
/**************************************************************************
*
* Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portionsalloc
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#include "glheader.h"
#include "enums.h"
#include "image.h"
#include "colormac.h"
#include "mtypes.h"
#include "macros.h"
#include "bufferobj.h"
#include "swrast/swrast.h"
#include "intel_screen.h"
#include "intel_context.h"
#include "intel_ioctl.h"
#include "intel_batchbuffer.h"
#include "intel_blit.h"
#include "intel_regions.h"
#include "intel_buffer_objects.h"
#define FILE_DEBUG_FLAG DEBUG_PIXEL
/* Unlike the other intel_pixel_* functions, the expectation here is
* that the incoming data is not in a PBO. With the XY_TEXT blit
* method, there's no benefit haveing it in a PBO, but we could
* implement a path based on XY_MONO_SRC_COPY_BLIT which might benefit
* PBO bitmaps. I think they are probably pretty rare though - I
* wonder if Xgl uses them?
*/
static const GLubyte *map_pbo( GLcontext *ctx,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap )
{
GLubyte *buf;
if (!_mesa_validate_pbo_access(2, unpack, width, height, 1,
GL_COLOR_INDEX, GL_BITMAP,
(GLvoid *) bitmap)) {
_mesa_error(ctx, GL_INVALID_OPERATION,"glBitmap(invalid PBO access)");
return NULL;
}
buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,
GL_READ_ONLY_ARB,
unpack->BufferObj);
if (!buf) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap(PBO is mapped)");
return NULL;
}
return ADD_POINTERS(buf, bitmap);
}
static GLboolean test_bit( const GLubyte *src,
GLuint bit )
{
return (src[bit/8] & (1<<(bit % 8))) ? 1 : 0;
}
static void set_bit( GLubyte *dest,
GLuint bit )
{
dest[bit/8] |= 1 << (bit % 8);
}
static int align(int x, int align)
{
return (x + align - 1) & ~(align - 1);
}
/* Extract a rectangle's worth of data from the bitmap. Called
* per-cliprect.
*/
static GLuint get_bitmap_rect(GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap,
GLuint x, GLuint y,
GLuint w, GLuint h,
GLubyte *dest,
GLuint row_align,
GLboolean invert)
{
GLuint src_offset = (x + unpack->SkipPixels) & 0x7;
GLuint mask = unpack->LsbFirst ? 0 : 7;
GLuint bit = 0;
GLint row, col;
GLint first, last;
GLint incr;
GLuint count = 0;
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s %d,%d %dx%d bitmap %dx%d skip %d src_offset %d mask %d\n",
__FUNCTION__, x,y,w,h,width,height,unpack->SkipPixels, src_offset, mask);
if (invert) {
first = h-1;
last = 0;
incr = -1;
}
else {
first = 0;
last = h-1;
incr = 1;
}
/* Require that dest be pre-zero'd.
*/
for (row = first; row != (last+incr); row += incr) {
const GLubyte *rowsrc = _mesa_image_address2d(unpack, bitmap,
width, height,
GL_COLOR_INDEX, GL_BITMAP,
y + row, x);
for (col = 0; col < w; col++, bit++) {
if (test_bit(rowsrc, (col + src_offset) ^ mask)) {
set_bit(dest, bit ^ 7);
count++;
}
}
if (row_align)
bit = (bit + row_align - 1) & ~(row_align - 1);
}
return count;
}
/*
* Render a bitmap.
*/
static GLboolean
do_blit_bitmap( GLcontext *ctx,
GLint dstx, GLint dsty,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap )
{
struct intel_context *intel = intel_context(ctx);
struct intel_region *dst = intel_drawbuf_region(intel);
union {
GLuint ui;
GLubyte ub[4];
} color;
if (unpack->BufferObj->Name) {
bitmap = map_pbo(ctx, width, height, unpack, bitmap);
if (bitmap == NULL)
return GL_TRUE; /* even though this is an error, we're done */
}
UNCLAMPED_FLOAT_TO_CHAN(color.ub[0], ctx->Current.RasterColor[2]);
UNCLAMPED_FLOAT_TO_CHAN(color.ub[1], ctx->Current.RasterColor[1]);
UNCLAMPED_FLOAT_TO_CHAN(color.ub[2], ctx->Current.RasterColor[0]);
UNCLAMPED_FLOAT_TO_CHAN(color.ub[3], ctx->Current.RasterColor[3]);
/* Does zoom apply to bitmaps?
*/
if (!intel_check_blit_fragment_ops(ctx) ||
ctx->Pixel.ZoomX != 1.0F ||
ctx->Pixel.ZoomY != 1.0F)
return GL_FALSE;
LOCK_HARDWARE(intel);
if (intel->driDrawable->numClipRects) {
__DRIdrawablePrivate *dPriv = intel->driDrawable;
drm_clip_rect_t *box = dPriv->pClipRects;
drm_clip_rect_t dest_rect;
GLint nbox = dPriv->numClipRects;
GLint srcx = 0, srcy = 0;
GLint orig_screen_x1, orig_screen_y2;
GLuint i;
orig_screen_x1 = dPriv->x + dstx;
orig_screen_y2 = dPriv->y + (dPriv->h - dsty);
/* Do scissoring in GL coordinates:
*/
x if (ctx->Scissor.Enabled)
{
GLint x = ctx->Scissor.X;
GLint y = ctx->Scissor.Y;
GLuint w = ctx->Scissor.Width;
GLuint h = ctx->Scissor.Height;
if (!_mesa_clip_to_region(x, y, x+w-1, y+h-1, &dstx, &dsty, &width, &height))
goto out;
}
/* Convert from GL to hardware coordinates:
*/
dsty = dPriv->y + (dPriv->h - dsty - height);
dstx = dPriv->x + dstx;
dest_rect.x1 = dstx;
dest_rect.y1 = dsty;
dest_rect.x2 = dstx + width;
dest_rect.y2 = dsty + height;
for (i = 0; i < nbox; i++) {
drm_clip_rect_t rect;
int box_w, box_h;
GLint px, py;
GLuint stipple[32];
if (!intel_intersect_cliprects(&rect, &dest_rect, &box[i]))
continue;
/* Now go back to GL coordinates to figure out what subset of
* the bitmap we are uploading for this cliprect:
*/
box_w = rect.x2 - rect.x1;
box_h = rect.y2 - rect.y1;
srcx = rect.x1 - orig_screen_x1;
srcy = orig_screen_y2 - rect.y2;
#define DY 32
#define DX 32
/* Then, finally, chop it all into chunks that can be
* digested by hardware:
*/
for (py = 0; py < box_h; py += DY) {
for (px = 0; px < box_w; px += DX) {
int h = MIN2(DY, box_h - py);
int w = MIN2(DX, box_w - px);
GLuint sz = align(align(w,8) * h, 64)/8;
assert(sz <= sizeof(stipple));
memset(stipple, 0, sz);
/* May need to adjust this when padding has been introduced in
* sz above:
*/
if (get_bitmap_rect(width, height, unpack,
bitmap,
srcx + px, srcy + py, w, h,
(GLubyte *)stipple,
8,
GL_TRUE) == 0)
continue;
/*
*/
intelEmitImmediateColorExpandBlit( intel,
dst->cpp,
(GLubyte *)stipple,
sz,
color.ui,
dst->pitch,
dst->buffer,
0,
dst->tiled,
rect.x1 + px,
rect.y2 - (py + h),
w, h);
}
}
}
out:
intel_batchbuffer_flush(intel->batch);
}
UNLOCK_HARDWARE(intel);
if (unpack->BufferObj->Name) {
/* done with PBO so unmap it now */
ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,
unpack->BufferObj);
}
return GL_TRUE;
}
/* There are a large number of possible ways to implement bitmap on
* this hardware, most of them have some sort of drawback. Here are a
* few that spring to mind:
*
* Blit:
* - XY_MONO_SRC_BLT_CMD
* - use XY_SETUP_CLIP_BLT for cliprect clipping.
* - XY_TEXT_BLT
* - XY_TEXT_IMMEDIATE_BLT
* - blit per cliprect, subject to maximum immediate data size.
* - XY_COLOR_BLT
* - per pixel or run of pixels
* - XY_PIXEL_BLT
* - good for sparse bitmaps
*
* 3D engine:
* - Point per pixel
* - Translate bitmap to an alpha texture and render as a quad
* - Chop bitmap up into 32x32 squares and render w/polygon stipple.
*/
void
intelBitmap(GLcontext * ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte * pixels)
{
if (do_blit_bitmap(ctx, x, y, width, height,
unpack, pixels))
return;
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
_swrast_Bitmap(ctx, x, y, width, height, unpack, pixels);
}

View File

@@ -0,0 +1 @@
../intel/intel_pixel_bitmap.c

View File

@@ -19,6 +19,7 @@ DRIVER_SOURCES = \
intel_regions.c \
intel_screen.c \
intel_span.c \
intel_pixel.c \
intel_pixel_copy.c \
intel_pixel_bitmap.c \
intel_state.c \

View File

@@ -148,7 +148,7 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
brw_clip_init_clipmask(c);
/* -ve rhw workaround */
if (!BRW_IS_IGD(p->brw)) {
if (!(BRW_IS_GM45(p->brw) || BRW_IS_G4X(p->brw))) {
brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
brw_AND(p, brw_null_reg(), get_element_ud(c->reg.R0, 2),
brw_imm_ud(1<<20));

View File

@@ -102,7 +102,7 @@ clip_unit_create_from_key(struct brw_context *brw,
clip.clip5.api_mode = BRW_CLIP_API_OGL;
clip.clip5.clip_mode = key->clip_mode;
if (BRW_IS_IGD(brw))
if (BRW_IS_GM45(brw) || BRW_IS_G4X(brw))
clip.clip5.negative_w_clip_test = 1;
clip.clip6.clipper_viewport_state_ptr = 0;

View File

@@ -536,7 +536,7 @@ void brw_emit_tri_clip( struct brw_clip_compile *c )
/* if -ve rhw workaround bit is set,
do cliptest */
if (!BRW_IS_IGD(p->brw)) {
if (!(BRW_IS_GM45(p->brw) || BRW_IS_G4X(p->brw))) {
brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
brw_AND(p, brw_null_reg(), get_element_ud(c->reg.R0, 2),
brw_imm_ud(1<<20));

View File

@@ -65,14 +65,6 @@ static void brwInitDriverFunctions( struct dd_function_table *functions )
{
intelInitDriverFunctions( functions );
/* CopyPixels can be accelerated even with the current memory
* manager:
*/
if (!getenv("INTEL_NO_BLIT")) {
functions->CopyPixels = intelCopyPixels;
functions->Bitmap = intelBitmap;
}
brwInitFragProgFuncs( functions );
brwInitProgFuncs( functions );
}
@@ -133,7 +125,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
ctx->Const.MaxTextureUnits = BRW_MAX_TEX_UNIT;
ctx->Const.MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
ctx->Const.MaxTextureCoordUnits = BRW_MAX_TEX_UNIT;
ctx->Const.MaxVertexTextureImageUnits = 0; /* no vertex shader textures */
/* Advertise the full hardware capabilities. The new memory
* manager should cope much better with overload situations:

View File

@@ -685,7 +685,7 @@ void brw_upload_constant_buffer_state(struct brw_context *brw);
* Inline conversion functions. These are better-typed than the
* macros used previously:
*/
static inline struct brw_context *
static INLINE struct brw_context *
brw_context( GLcontext *ctx )
{
return (struct brw_context *)ctx;

View File

@@ -804,7 +804,7 @@
#define CMD_STATE_BASE_ADDRESS 0x6101
#define CMD_STATE_INSN_POINTER 0x6102
#define CMD_PIPELINE_SELECT_965 0x6104
#define CMD_PIPELINE_SELECT_IGD 0x6904
#define CMD_PIPELINE_SELECT_GM45 0x6904
#define CMD_PIPELINED_STATE_POINTERS 0x7800
#define CMD_BINDING_TABLE_PTRS 0x7801
@@ -836,7 +836,7 @@
#define CMD_INDEX_BUFFER 0x780a
#define CMD_VF_STATISTICS_965 0x780b
#define CMD_VF_STATISTICS_IGD 0x680b
#define CMD_VF_STATISTICS_GM45 0x680b
#define CMD_DRAW_RECT 0x7900
#define CMD_BLEND_CONSTANT_COLOR 0x7901
@@ -862,9 +862,10 @@
#include "intel_chipset.h"
#define BRW_IS_IGD(brw) (IS_IGD((brw)->intel.intelScreen->deviceID))
#define CMD_PIPELINE_SELECT(brw) ((BRW_IS_IGD(brw)) ? CMD_PIPELINE_SELECT_IGD : CMD_PIPELINE_SELECT_965)
#define CMD_VF_STATISTICS(brw) ((BRW_IS_IGD(brw)) ? CMD_VF_STATISTICS_IGD : CMD_VF_STATISTICS_965)
#define URB_SIZES(brw) ((BRW_IS_IGD(brw)) ? 384 : 256) /* 512 bit unit */
#define BRW_IS_GM45(brw) (IS_GM45_GM((brw)->intel.intelScreen->deviceID))
#define BRW_IS_G4X(brw) (IS_G4X((brw)->intel.intelScreen->deviceID))
#define CMD_PIPELINE_SELECT(brw) ((BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) ? CMD_PIPELINE_SELECT_GM45 : CMD_PIPELINE_SELECT_965)
#define CMD_VF_STATISTICS(brw) ((BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) ? CMD_VF_STATISTICS_GM45 : CMD_VF_STATISTICS_965)
#define URB_SIZES(brw) ((BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) ? 384 : 256) /* 512 bit unit */
#endif

View File

@@ -110,7 +110,7 @@ struct brw_compile {
static __inline int type_sz( GLuint type )
static INLINE int type_sz( GLuint type )
{
switch( type ) {
case BRW_REGISTER_TYPE_UD:
@@ -129,7 +129,7 @@ static __inline int type_sz( GLuint type )
}
}
static __inline struct brw_reg brw_reg( GLuint file,
static INLINE struct brw_reg brw_reg( GLuint file,
GLuint nr,
GLuint subnr,
GLuint type,
@@ -166,7 +166,7 @@ static __inline struct brw_reg brw_reg( GLuint file,
return reg;
}
static __inline struct brw_reg brw_vec16_reg( GLuint file,
static INLINE struct brw_reg brw_vec16_reg( GLuint file,
GLuint nr,
GLuint subnr )
{
@@ -181,7 +181,7 @@ static __inline struct brw_reg brw_vec16_reg( GLuint file,
WRITEMASK_XYZW);
}
static __inline struct brw_reg brw_vec8_reg( GLuint file,
static INLINE struct brw_reg brw_vec8_reg( GLuint file,
GLuint nr,
GLuint subnr )
{
@@ -197,7 +197,7 @@ static __inline struct brw_reg brw_vec8_reg( GLuint file,
}
static __inline struct brw_reg brw_vec4_reg( GLuint file,
static INLINE struct brw_reg brw_vec4_reg( GLuint file,
GLuint nr,
GLuint subnr )
{
@@ -213,7 +213,7 @@ static __inline struct brw_reg brw_vec4_reg( GLuint file,
}
static __inline struct brw_reg brw_vec2_reg( GLuint file,
static INLINE struct brw_reg brw_vec2_reg( GLuint file,
GLuint nr,
GLuint subnr )
{
@@ -228,7 +228,7 @@ static __inline struct brw_reg brw_vec2_reg( GLuint file,
WRITEMASK_XY);
}
static __inline struct brw_reg brw_vec1_reg( GLuint file,
static INLINE struct brw_reg brw_vec1_reg( GLuint file,
GLuint nr,
GLuint subnr )
{
@@ -244,14 +244,14 @@ static __inline struct brw_reg brw_vec1_reg( GLuint file,
}
static __inline struct brw_reg retype( struct brw_reg reg,
static INLINE struct brw_reg retype( struct brw_reg reg,
GLuint type )
{
reg.type = type;
return reg;
}
static __inline struct brw_reg suboffset( struct brw_reg reg,
static INLINE struct brw_reg suboffset( struct brw_reg reg,
GLuint delta )
{
reg.subnr += delta * type_sz(reg.type);
@@ -259,7 +259,7 @@ static __inline struct brw_reg suboffset( struct brw_reg reg,
}
static __inline struct brw_reg offset( struct brw_reg reg,
static INLINE struct brw_reg offset( struct brw_reg reg,
GLuint delta )
{
reg.nr += delta;
@@ -267,7 +267,7 @@ static __inline struct brw_reg offset( struct brw_reg reg,
}
static __inline struct brw_reg byte_offset( struct brw_reg reg,
static INLINE struct brw_reg byte_offset( struct brw_reg reg,
GLuint bytes )
{
GLuint newoffset = reg.nr * REG_SIZE + reg.subnr + bytes;
@@ -277,28 +277,28 @@ static __inline struct brw_reg byte_offset( struct brw_reg reg,
}
static __inline struct brw_reg brw_uw16_reg( GLuint file,
static INLINE struct brw_reg brw_uw16_reg( GLuint file,
GLuint nr,
GLuint subnr )
{
return suboffset(retype(brw_vec16_reg(file, nr, 0), BRW_REGISTER_TYPE_UW), subnr);
}
static __inline struct brw_reg brw_uw8_reg( GLuint file,
static INLINE struct brw_reg brw_uw8_reg( GLuint file,
GLuint nr,
GLuint subnr )
{
return suboffset(retype(brw_vec8_reg(file, nr, 0), BRW_REGISTER_TYPE_UW), subnr);
}
static __inline struct brw_reg brw_uw1_reg( GLuint file,
static INLINE struct brw_reg brw_uw1_reg( GLuint file,
GLuint nr,
GLuint subnr )
{
return suboffset(retype(brw_vec1_reg(file, nr, 0), BRW_REGISTER_TYPE_UW), subnr);
}
static __inline struct brw_reg brw_imm_reg( GLuint type )
static INLINE struct brw_reg brw_imm_reg( GLuint type )
{
return brw_reg( BRW_IMMEDIATE_VALUE,
0,
@@ -311,35 +311,35 @@ static __inline struct brw_reg brw_imm_reg( GLuint type )
0);
}
static __inline struct brw_reg brw_imm_f( GLfloat f )
static INLINE struct brw_reg brw_imm_f( GLfloat f )
{
struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_F);
imm.dw1.f = f;
return imm;
}
static __inline struct brw_reg brw_imm_d( GLint d )
static INLINE struct brw_reg brw_imm_d( GLint d )
{
struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_D);
imm.dw1.d = d;
return imm;
}
static __inline struct brw_reg brw_imm_ud( GLuint ud )
static INLINE struct brw_reg brw_imm_ud( GLuint ud )
{
struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_UD);
imm.dw1.ud = ud;
return imm;
}
static __inline struct brw_reg brw_imm_uw( GLushort uw )
static INLINE struct brw_reg brw_imm_uw( GLushort uw )
{
struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_UW);
imm.dw1.ud = uw | (uw << 16);
return imm;
}
static __inline struct brw_reg brw_imm_w( GLshort w )
static INLINE struct brw_reg brw_imm_w( GLshort w )
{
struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_W);
imm.dw1.d = w | (w << 16);
@@ -352,7 +352,7 @@ static __inline struct brw_reg brw_imm_w( GLshort w )
/* Vector of eight signed half-byte values:
*/
static __inline struct brw_reg brw_imm_v( GLuint v )
static INLINE struct brw_reg brw_imm_v( GLuint v )
{
struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_V);
imm.vstride = BRW_VERTICAL_STRIDE_0;
@@ -364,7 +364,7 @@ static __inline struct brw_reg brw_imm_v( GLuint v )
/* Vector of four 8-bit float values:
*/
static __inline struct brw_reg brw_imm_vf( GLuint v )
static INLINE struct brw_reg brw_imm_vf( GLuint v )
{
struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_VF);
imm.vstride = BRW_VERTICAL_STRIDE_0;
@@ -378,7 +378,7 @@ static __inline struct brw_reg brw_imm_vf( GLuint v )
#define VF_ONE 0x30
#define VF_NEG (1<<7)
static __inline struct brw_reg brw_imm_vf4( GLuint v0,
static INLINE struct brw_reg brw_imm_vf4( GLuint v0,
GLuint v1,
GLuint v2,
GLuint v3)
@@ -395,51 +395,51 @@ static __inline struct brw_reg brw_imm_vf4( GLuint v0,
}
static __inline struct brw_reg brw_address( struct brw_reg reg )
static INLINE struct brw_reg brw_address( struct brw_reg reg )
{
return brw_imm_uw(reg.nr * REG_SIZE + reg.subnr);
}
static __inline struct brw_reg brw_vec1_grf( GLuint nr,
static INLINE struct brw_reg brw_vec1_grf( GLuint nr,
GLuint subnr )
{
return brw_vec1_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr);
}
static __inline struct brw_reg brw_vec8_grf( GLuint nr,
static INLINE struct brw_reg brw_vec8_grf( GLuint nr,
GLuint subnr )
{
return brw_vec8_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr);
}
static __inline struct brw_reg brw_vec4_grf( GLuint nr,
static INLINE struct brw_reg brw_vec4_grf( GLuint nr,
GLuint subnr )
{
return brw_vec4_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr);
}
static __inline struct brw_reg brw_vec2_grf( GLuint nr,
static INLINE struct brw_reg brw_vec2_grf( GLuint nr,
GLuint subnr )
{
return brw_vec2_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr);
}
static __inline struct brw_reg brw_uw8_grf( GLuint nr,
static INLINE struct brw_reg brw_uw8_grf( GLuint nr,
GLuint subnr )
{
return brw_uw8_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr);
}
static __inline struct brw_reg brw_null_reg( void )
static INLINE struct brw_reg brw_null_reg( void )
{
return brw_vec8_reg(BRW_ARCHITECTURE_REGISTER_FILE,
BRW_ARF_NULL,
0);
}
static __inline struct brw_reg brw_address_reg( GLuint subnr )
static INLINE struct brw_reg brw_address_reg( GLuint subnr )
{
return brw_uw1_reg(BRW_ARCHITECTURE_REGISTER_FILE,
BRW_ARF_ADDRESS,
@@ -450,7 +450,7 @@ static __inline struct brw_reg brw_address_reg( GLuint subnr )
* aren't xyzw. This goes against the convention for other scalar
* regs:
*/
static __inline struct brw_reg brw_ip_reg( void )
static INLINE struct brw_reg brw_ip_reg( void )
{
return brw_reg(BRW_ARCHITECTURE_REGISTER_FILE,
BRW_ARF_IP,
@@ -463,7 +463,7 @@ static __inline struct brw_reg brw_ip_reg( void )
WRITEMASK_XYZW); /* NOTE! */
}
static __inline struct brw_reg brw_acc_reg( void )
static INLINE struct brw_reg brw_acc_reg( void )
{
return brw_vec8_reg(BRW_ARCHITECTURE_REGISTER_FILE,
BRW_ARF_ACCUMULATOR,
@@ -471,7 +471,7 @@ static __inline struct brw_reg brw_acc_reg( void )
}
static __inline struct brw_reg brw_flag_reg( void )
static INLINE struct brw_reg brw_flag_reg( void )
{
return brw_uw1_reg(BRW_ARCHITECTURE_REGISTER_FILE,
BRW_ARF_FLAG,
@@ -479,14 +479,14 @@ static __inline struct brw_reg brw_flag_reg( void )
}
static __inline struct brw_reg brw_mask_reg( GLuint subnr )
static INLINE struct brw_reg brw_mask_reg( GLuint subnr )
{
return brw_uw1_reg(BRW_ARCHITECTURE_REGISTER_FILE,
BRW_ARF_MASK,
subnr);
}
static __inline struct brw_reg brw_message_reg( GLuint nr )
static INLINE struct brw_reg brw_message_reg( GLuint nr )
{
return brw_vec8_reg(BRW_MESSAGE_REGISTER_FILE,
nr,
@@ -499,7 +499,7 @@ static __inline struct brw_reg brw_message_reg( GLuint nr )
/* This is almost always called with a numeric constant argument, so
* make things easy to evaluate at compile time:
*/
static __inline GLuint cvt( GLuint val )
static INLINE GLuint cvt( GLuint val )
{
switch (val) {
case 0: return 0;
@@ -513,7 +513,7 @@ static __inline GLuint cvt( GLuint val )
return 0;
}
static __inline struct brw_reg stride( struct brw_reg reg,
static INLINE struct brw_reg stride( struct brw_reg reg,
GLuint vstride,
GLuint width,
GLuint hstride )
@@ -525,43 +525,43 @@ static __inline struct brw_reg stride( struct brw_reg reg,
return reg;
}
static __inline struct brw_reg vec16( struct brw_reg reg )
static INLINE struct brw_reg vec16( struct brw_reg reg )
{
return stride(reg, 16,16,1);
}
static __inline struct brw_reg vec8( struct brw_reg reg )
static INLINE struct brw_reg vec8( struct brw_reg reg )
{
return stride(reg, 8,8,1);
}
static __inline struct brw_reg vec4( struct brw_reg reg )
static INLINE struct brw_reg vec4( struct brw_reg reg )
{
return stride(reg, 4,4,1);
}
static __inline struct brw_reg vec2( struct brw_reg reg )
static INLINE struct brw_reg vec2( struct brw_reg reg )
{
return stride(reg, 2,2,1);
}
static __inline struct brw_reg vec1( struct brw_reg reg )
static INLINE struct brw_reg vec1( struct brw_reg reg )
{
return stride(reg, 0,1,0);
}
static __inline struct brw_reg get_element( struct brw_reg reg, GLuint elt )
static INLINE struct brw_reg get_element( struct brw_reg reg, GLuint elt )
{
return vec1(suboffset(reg, elt));
}
static __inline struct brw_reg get_element_ud( struct brw_reg reg, GLuint elt )
static INLINE struct brw_reg get_element_ud( struct brw_reg reg, GLuint elt )
{
return vec1(suboffset(retype(reg, BRW_REGISTER_TYPE_UD), elt));
}
static __inline struct brw_reg brw_swizzle( struct brw_reg reg,
static INLINE struct brw_reg brw_swizzle( struct brw_reg reg,
GLuint x,
GLuint y,
GLuint z,
@@ -575,33 +575,33 @@ static __inline struct brw_reg brw_swizzle( struct brw_reg reg,
}
static __inline struct brw_reg brw_swizzle1( struct brw_reg reg,
static INLINE struct brw_reg brw_swizzle1( struct brw_reg reg,
GLuint x )
{
return brw_swizzle(reg, x, x, x, x);
}
static __inline struct brw_reg brw_writemask( struct brw_reg reg,
static INLINE struct brw_reg brw_writemask( struct brw_reg reg,
GLuint mask )
{
reg.dw1.bits.writemask &= mask;
return reg;
}
static __inline struct brw_reg brw_set_writemask( struct brw_reg reg,
static INLINE struct brw_reg brw_set_writemask( struct brw_reg reg,
GLuint mask )
{
reg.dw1.bits.writemask = mask;
return reg;
}
static __inline struct brw_reg negate( struct brw_reg reg )
static INLINE struct brw_reg negate( struct brw_reg reg )
{
reg.negate ^= 1;
return reg;
}
static __inline struct brw_reg brw_abs( struct brw_reg reg )
static INLINE struct brw_reg brw_abs( struct brw_reg reg )
{
reg.abs = 1;
return reg;
@@ -609,7 +609,7 @@ static __inline struct brw_reg brw_abs( struct brw_reg reg )
/***********************************************************************
*/
static __inline struct brw_reg brw_vec4_indirect( GLuint subnr,
static INLINE struct brw_reg brw_vec4_indirect( GLuint subnr,
GLint offset )
{
struct brw_reg reg = brw_vec4_grf(0, 0);
@@ -619,7 +619,7 @@ static __inline struct brw_reg brw_vec4_indirect( GLuint subnr,
return reg;
}
static __inline struct brw_reg brw_vec1_indirect( GLuint subnr,
static INLINE struct brw_reg brw_vec1_indirect( GLuint subnr,
GLint offset )
{
struct brw_reg reg = brw_vec1_grf(0, 0);
@@ -629,48 +629,48 @@ static __inline struct brw_reg brw_vec1_indirect( GLuint subnr,
return reg;
}
static __inline struct brw_reg deref_4f(struct brw_indirect ptr, GLint offset)
static INLINE struct brw_reg deref_4f(struct brw_indirect ptr, GLint offset)
{
return brw_vec4_indirect(ptr.addr_subnr, ptr.addr_offset + offset);
}
static __inline struct brw_reg deref_1f(struct brw_indirect ptr, GLint offset)
static INLINE struct brw_reg deref_1f(struct brw_indirect ptr, GLint offset)
{
return brw_vec1_indirect(ptr.addr_subnr, ptr.addr_offset + offset);
}
static __inline struct brw_reg deref_4b(struct brw_indirect ptr, GLint offset)
static INLINE struct brw_reg deref_4b(struct brw_indirect ptr, GLint offset)
{
return retype(deref_4f(ptr, offset), BRW_REGISTER_TYPE_B);
}
static __inline struct brw_reg deref_1uw(struct brw_indirect ptr, GLint offset)
static INLINE struct brw_reg deref_1uw(struct brw_indirect ptr, GLint offset)
{
return retype(deref_1f(ptr, offset), BRW_REGISTER_TYPE_UW);
}
static __inline struct brw_reg deref_1d(struct brw_indirect ptr, GLint offset)
static INLINE struct brw_reg deref_1d(struct brw_indirect ptr, GLint offset)
{
return retype(deref_1f(ptr, offset), BRW_REGISTER_TYPE_D);
}
static __inline struct brw_reg deref_1ud(struct brw_indirect ptr, GLint offset)
static INLINE struct brw_reg deref_1ud(struct brw_indirect ptr, GLint offset)
{
return retype(deref_1f(ptr, offset), BRW_REGISTER_TYPE_UD);
}
static __inline struct brw_reg get_addr_reg(struct brw_indirect ptr)
static INLINE struct brw_reg get_addr_reg(struct brw_indirect ptr)
{
return brw_address_reg(ptr.addr_subnr);
}
static __inline struct brw_indirect brw_indirect_offset( struct brw_indirect ptr, GLint offset )
static INLINE struct brw_indirect brw_indirect_offset( struct brw_indirect ptr, GLint offset )
{
ptr.addr_offset += offset;
return ptr;
}
static __inline struct brw_indirect brw_indirect( GLuint addr_subnr, GLint offset )
static INLINE struct brw_indirect brw_indirect( GLuint addr_subnr, GLint offset )
{
struct brw_indirect ptr;
ptr.addr_subnr = addr_subnr;
@@ -679,7 +679,7 @@ static __inline struct brw_indirect brw_indirect( GLuint addr_subnr, GLint offse
return ptr;
}
static __inline struct brw_instruction *current_insn( struct brw_compile *p)
static INLINE struct brw_instruction *current_insn( struct brw_compile *p)
{
return &p->store[p->nr_insn];
}

View File

@@ -329,14 +329,14 @@ static void brw_set_sampler_message(struct brw_context *brw,
{
brw_set_src1(insn, brw_imm_d(0));
if (BRW_IS_IGD(brw)) {
insn->bits3.sampler_igd.binding_table_index = binding_table_index;
insn->bits3.sampler_igd.sampler = sampler;
insn->bits3.sampler_igd.msg_type = msg_type;
insn->bits3.sampler_igd.response_length = response_length;
insn->bits3.sampler_igd.msg_length = msg_length;
insn->bits3.sampler_igd.end_of_thread = eot;
insn->bits3.sampler_igd.msg_target = BRW_MESSAGE_TARGET_SAMPLER;
if (BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) {
insn->bits3.sampler_gm45_g4x.binding_table_index = binding_table_index;
insn->bits3.sampler_gm45_g4x.sampler = sampler;
insn->bits3.sampler_gm45_g4x.msg_type = msg_type;
insn->bits3.sampler_gm45_g4x.response_length = response_length;
insn->bits3.sampler_gm45_g4x.msg_length = msg_length;
insn->bits3.sampler_gm45_g4x.end_of_thread = eot;
insn->bits3.sampler_gm45_g4x.msg_target = BRW_MESSAGE_TARGET_SAMPLER;
} else {
insn->bits3.sampler.binding_table_index = binding_table_index;
insn->bits3.sampler.sampler = sampler;

View File

@@ -192,7 +192,7 @@ static void emit_depthbuffer(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
struct intel_region *region = brw->state.depth_region;
unsigned int len = BRW_IS_IGD(brw) ? sizeof(struct brw_depthbuffer_igd) / 4 : sizeof(struct brw_depthbuffer) / 4;
unsigned int len = (BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) ? sizeof(struct brw_depthbuffer_gm45_g4x) / 4 : sizeof(struct brw_depthbuffer) / 4;
if (region == NULL) {
BEGIN_BATCH(len, IGNORE_CLIPRECTS);
@@ -203,7 +203,7 @@ static void emit_depthbuffer(struct brw_context *brw)
OUT_BATCH(0);
OUT_BATCH(0);
if (BRW_IS_IGD(brw))
if (BRW_IS_GM45(brw) || BRW_IS_G4X(brw))
OUT_BATCH(0);
ADVANCE_BATCH();
@@ -239,7 +239,7 @@ static void emit_depthbuffer(struct brw_context *brw)
((region->height - 1) << 19));
OUT_BATCH(0);
if (BRW_IS_IGD(brw))
if (BRW_IS_GM45(brw) || BRW_IS_G4X(brw))
OUT_BATCH(0);
ADVANCE_BATCH();
@@ -324,7 +324,7 @@ static void upload_aa_line_parameters(struct brw_context *brw)
{
struct brw_aa_line_parameters balp;
if (!BRW_IS_IGD(brw))
if (!(BRW_IS_GM45(brw) || BRW_IS_G4X(brw)))
return;
/* use legacy aa line coverage computation */

View File

@@ -175,7 +175,7 @@ struct brw_depthbuffer
} dword4;
};
struct brw_depthbuffer_igd
struct brw_depthbuffer_gm45_g4x
{
union header_union header;
@@ -1405,7 +1405,7 @@ struct brw_instruction
GLuint msg_target:4;
GLuint pad1:3;
GLuint end_of_thread:1;
} sampler_igd;
} sampler_gm45_g4x;
struct brw_urb_immediate urb;

View File

@@ -867,7 +867,7 @@ static void emit_vertex_write( struct brw_vs_compile *c)
* Later, clipping will detect ucp[6] and ensure the primitive is
* clipped against all fixed planes.
*/
if (!BRW_IS_IGD(p->brw) && !c->key.know_w_is_one) {
if (!(BRW_IS_GM45(p->brw) || BRW_IS_G4X(p->brw)) && !c->key.know_w_is_one) {
brw_CMP(p,
vec8(brw_null_reg()),
BRW_CONDITIONAL_L,

View File

@@ -39,7 +39,7 @@
/* Not quite sure how correct this is - need to understand horiz
* vs. vertical strides a little better.
*/
static __inline struct brw_reg sechalf( struct brw_reg reg )
static INLINE struct brw_reg sechalf( struct brw_reg reg )
{
if (reg.vstride)
reg.nr++;

View File

@@ -737,7 +737,8 @@ static void precalc_tex( struct brw_wm_compile *c,
release_temp(c, tmp);
}
if (inst->TexSrcTarget == GL_TEXTURE_RECTANGLE_NV)
if ((inst->TexSrcTarget == TEXTURE_RECT_INDEX) ||
(inst->TexSrcTarget == TEXTURE_CUBE_INDEX))
release_temp(c, tmpcoord);
}
@@ -1019,7 +1020,11 @@ void brw_wm_pass_fp( struct brw_wm_compile *c )
case OPCODE_LIT:
precalc_lit(c, inst);
break;
case OPCODE_TEX:
precalc_tex(c, inst);
break;
case OPCODE_TXP:
precalc_txp(c, inst);
break;

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