Compare commits
293 Commits
android-x8
...
useful
Author | SHA1 | Date | |
---|---|---|---|
|
d6db9143b6 | ||
|
9c0b233c44 | ||
|
364aa72824 | ||
|
d290ec228b | ||
|
c0906e06ee | ||
|
b6c49104ce | ||
|
6a35cbb656 | ||
|
909bd476ca | ||
|
487debfda5 | ||
|
b9c8b2a1f1 | ||
|
32aab51df5 | ||
|
4cbb261eba | ||
|
032a7ef0a1 | ||
|
75d585e544 | ||
|
d3cc3901ab | ||
|
4d7c187167 | ||
|
05173c61c7 | ||
|
9949d2a251 | ||
|
3f7318c1b8 | ||
|
35b3f597bd | ||
|
f703ba8c42 | ||
|
f05751aa2a | ||
|
b27f206b0c | ||
|
16d42af618 | ||
|
b5829c0d64 | ||
|
6b95cfb0de | ||
|
e338a1b0ce | ||
|
847f991a87 | ||
|
482a64dcf1 | ||
|
155a9670e6 | ||
|
1ca5585459 | ||
|
2432ca1c2e | ||
|
a7fa203f0d | ||
|
7e809f0b8d | ||
|
03eade164d | ||
|
f2bda1b566 | ||
|
65b024d63a | ||
|
88022278f7 | ||
|
b1be5bd205 | ||
|
aaf188e3bb | ||
|
45920d2ecb | ||
|
5c477ab2de | ||
|
da8d0c965c | ||
|
34a5d3b9f4 | ||
|
f22d49de0f | ||
|
6bb4d807f7 | ||
|
0308beebc2 | ||
|
aebe16da53 | ||
|
ecfaab88b2 | ||
|
1cbd3a1cc7 | ||
|
d40ec9a884 | ||
|
a26121f375 | ||
|
a75de67c51 | ||
|
158d42c8b0 | ||
|
82cb6e6519 | ||
|
ae5776c41f | ||
|
74559abbef | ||
|
003224bd97 | ||
|
7b4e478496 | ||
|
d9ef976967 | ||
|
843d5391c3 | ||
|
d546df4d9c | ||
|
ee2a8ea7d9 | ||
|
d27ff8c5cd | ||
|
64ce3933f5 | ||
|
ee678895e9 | ||
|
69c71396c6 | ||
|
c6e33ca285 | ||
|
e7d18ed1ef | ||
|
758561786c | ||
|
aac4bae986 | ||
|
ff3d7ce201 | ||
|
9634318290 | ||
|
a0d154dc13 | ||
|
1329d94334 | ||
|
1bcdc1e319 | ||
|
08070cead0 | ||
|
9acdd7739b | ||
|
79db70bd8a | ||
|
2ecb73379e | ||
|
7984c2d42d | ||
|
10ea8567f4 | ||
|
9d5de0fcb6 | ||
|
6eff8479af | ||
|
55a629cee5 | ||
|
09eff39a58 | ||
|
3e15fa86d7 | ||
|
0da2a22ba6 | ||
|
06613b7b3a | ||
|
ef2c80f506 | ||
|
1e105741f1 | ||
|
6638b4a590 | ||
|
584d1e2309 | ||
|
0c501bacef | ||
|
204991bf5d | ||
|
23d75936a7 | ||
|
aa61b15351 | ||
|
66b66295d0 | ||
|
8800a798d1 | ||
|
95368f25c1 | ||
|
7b8830d81d | ||
|
de4cb19a1c | ||
|
130872a2a6 | ||
|
2c8ba760fa | ||
|
3f8455d07b | ||
|
122275760d | ||
|
53245fffc0 | ||
|
c1f4b2364f | ||
|
cd2857fae1 | ||
|
740282b417 | ||
|
dcbc9be38e | ||
|
c0f6bfd489 | ||
|
391f7147e7 | ||
|
afeaf1771d | ||
|
14b574433c | ||
|
874a2c0b7d | ||
|
9a77e285e8 | ||
|
13ba6b7369 | ||
|
622ee08e51 | ||
|
b4dfb7473e | ||
|
ce5d969adf | ||
|
5d9718f0db | ||
|
01e19fcf1f | ||
|
cb21fa91b8 | ||
|
fc6b4332c3 | ||
|
461273e910 | ||
|
0c2455031d | ||
|
de579a1629 | ||
|
0fe34b7bbc | ||
|
9996a86085 | ||
|
4af3fe857d | ||
|
d8361400b7 | ||
|
5d5db24a26 | ||
|
d863bd7d7b | ||
|
8778bf221e | ||
|
c7339d42c6 | ||
|
db0f9e701d | ||
|
e9375cd0e8 | ||
|
9ac64f7301 | ||
|
b3011ea60c | ||
|
20141d9efd | ||
|
c97234507a | ||
|
5d92596c56 | ||
|
ed9396782e | ||
|
6cab07685f | ||
|
e397b3a7c0 | ||
|
ad3fbac00b | ||
|
19d06b5c05 | ||
|
fdb04c0384 | ||
|
32a11e5324 | ||
|
48f696c793 | ||
|
0d96ae8fc7 | ||
|
2679760834 | ||
|
a0fc40f0d5 | ||
|
b0da65bd0e | ||
|
6caac3ecb8 | ||
|
9d881cbd5a | ||
|
f814dd7a81 | ||
|
652bf121f2 | ||
|
437c748bf5 | ||
|
c35572352e | ||
|
381d32af74 | ||
|
5d7fefb9af | ||
|
a019dd0d6e | ||
|
904b8ba1bb | ||
|
6586a3b287 | ||
|
3f68d4b058 | ||
|
17bbc1f042 | ||
|
3733da31e8 | ||
|
4a7f013f9d | ||
|
25f2699767 | ||
|
9f013a8233 | ||
|
18dcbd358f | ||
|
c3526585b7 | ||
|
3f625689ac | ||
|
3dedd39cdd | ||
|
c40b7910ee | ||
|
5f996e2b1d | ||
|
ebe304fa54 | ||
|
dcad6fb670 | ||
|
713230ff39 | ||
|
6584d0cd4f | ||
|
58f95f9d01 | ||
|
5eb9f68708 | ||
|
f5a9a0bc22 | ||
|
167d35c303 | ||
|
72e82418ef | ||
|
b082e04619 | ||
|
ee8d182426 | ||
|
8f060df60d | ||
|
d04ab396a5 | ||
|
948e1eb8e9 | ||
|
a99e80d795 | ||
|
89d81ab16c | ||
|
92e412e788 | ||
|
0420ae3d90 | ||
|
7d41857566 | ||
|
7bae1c3d85 | ||
|
252eaa765e | ||
|
b094dff50a | ||
|
8cbdfe1de4 | ||
|
2e6a69939c | ||
|
f037914670 | ||
|
8d4ec87d7f | ||
|
e28fe8fe5d | ||
|
b518f4d0ea | ||
|
2af1da1546 | ||
|
daa5242f9e | ||
|
0be369975f | ||
|
47e3896dfd | ||
|
e5c6a92a12 | ||
|
3bdd12ecb5 | ||
|
9d60a7ce08 | ||
|
9a21bc6401 | ||
|
4f94e0b76a | ||
|
e21beaeb10 | ||
|
92e29dc5b0 | ||
|
2737350157 | ||
|
0fbb64a529 | ||
|
40ae214067 | ||
|
5d7c27f5ec | ||
|
244a3bbf14 | ||
|
da5b4764b2 | ||
|
78037d95da | ||
|
8752824f27 | ||
|
0c8beb0ab5 | ||
|
62d5f7a04a | ||
|
a1bd012473 | ||
|
981e338611 | ||
|
56ef62d988 | ||
|
eb0dd37094 | ||
|
dfdff940b6 | ||
|
4e994e150f | ||
|
0d9d036004 | ||
|
bc83f6bd58 | ||
|
cf290344cc | ||
|
28f1d6ab49 | ||
|
a81828cb96 | ||
|
7fbe020bbc | ||
|
5858abec6e | ||
|
acd7ce57f7 | ||
|
226ae9d6c8 | ||
|
e1a9ef2304 | ||
|
e4852ae4d2 | ||
|
2911fa0cca | ||
|
4a101f9577 | ||
|
53d78be3bd | ||
|
82dd62fb22 | ||
|
4c75d5ae63 | ||
|
c22a7f9045 | ||
|
ff2950dd69 | ||
|
b5745429d7 | ||
|
7d40bf2566 | ||
|
f4e392bf8d | ||
|
81992010b5 | ||
|
12b9e07966 | ||
|
7ecb61c30c | ||
|
f6970872c0 | ||
|
8d7c12de1e | ||
|
e4b040c2b9 | ||
|
b881ea87f1 | ||
|
29288249e3 | ||
|
9b13c988ac | ||
|
cfc7ded3ff | ||
|
d0d767ad4c | ||
|
912c4ec6df | ||
|
933b99f113 | ||
|
ec4a21b0e2 | ||
|
957552fce0 | ||
|
aafcbd2cf7 | ||
|
9459cc593c | ||
|
630d925666 | ||
|
79f4281a52 | ||
|
83ff3809f1 | ||
|
9d2ef284bb | ||
|
8042d751de | ||
|
5b902a08c1 | ||
|
582570a04c | ||
|
147148fd50 | ||
|
5e9aa9926b | ||
|
cbadedb511 | ||
|
552f54bf04 | ||
|
dfda559b98 | ||
|
2279156fe7 | ||
|
f3a828c21f | ||
|
2baac48f39 | ||
|
cc48d663f7 | ||
|
b47d508412 | ||
|
74651f5738 | ||
|
8767fe2437 | ||
|
e08a3d674a | ||
|
6b3713f8b8 | ||
|
5fc5820cbc |
@@ -1,3 +0,0 @@
|
||||
ifneq ($(TARGET_SIMULATOR),true)
|
||||
include $(call all-subdir-makefiles)
|
||||
endif
|
4
Makefile
4
Makefile
@@ -5,7 +5,10 @@ TOP = .
|
||||
SUBDIRS = src
|
||||
|
||||
|
||||
# The git command below generates an empty string when we're not
|
||||
# building in a GIT tree (i.e., building from a release tarball).
|
||||
default: $(TOP)/configs/current
|
||||
@$(TOP)/bin/extract_git_sha1
|
||||
@for dir in $(SUBDIRS) ; do \
|
||||
if [ -d $$dir ] ; then \
|
||||
(cd $$dir && $(MAKE)) || exit 1 ; \
|
||||
@@ -199,6 +202,7 @@ MAIN_FILES = \
|
||||
$(DIRECTORY)/aclocal.m4 \
|
||||
$(DIRECTORY)/bin/config.guess \
|
||||
$(DIRECTORY)/bin/config.sub \
|
||||
$(DIRECTORY)/bin/extract_git_sha1 \
|
||||
$(DIRECTORY)/bin/install-sh \
|
||||
$(DIRECTORY)/bin/mklib \
|
||||
$(DIRECTORY)/bin/minstall \
|
||||
|
10
bin/extract_git_sha1
Executable file
10
bin/extract_git_sha1
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
touch src/mesa/main/git_sha1.h
|
||||
if which git > /dev/null; then
|
||||
# Extract the 7-digit "short" SHA1 for the current HEAD, convert
|
||||
# it to a string, and wrap it in a #define. This is used in
|
||||
# src/mesa/main/version.c to put the GIT SHA1 in the GL_VERSION string.
|
||||
git log -n 1 --oneline |\
|
||||
sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
|
||||
> src/mesa/main/git_sha1.h
|
||||
fi
|
@@ -63,7 +63,7 @@ GALLIUM_WINSYS_DIRS = sw sw/xlib drm/vmware drm/intel drm/i965
|
||||
GALLIUM_TARGET_DIRS =
|
||||
GALLIUM_STATE_TRACKERS_DIRS = egl
|
||||
|
||||
DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon \
|
||||
DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
|
||||
savage sis tdfx unichrome swrast
|
||||
|
||||
INTEL_LIBS = `pkg-config --libs libdrm_intel`
|
||||
|
52
configure.ac
52
configure.ac
@@ -729,6 +729,27 @@ else
|
||||
enable_xcb=no
|
||||
fi
|
||||
|
||||
dnl Direct rendering or just indirect rendering
|
||||
case "$host_os" in
|
||||
gnu*)
|
||||
dnl Disable by default on GNU/Hurd
|
||||
driglx_direct_default="no"
|
||||
;;
|
||||
cygwin*)
|
||||
dnl Disable by default on cygwin
|
||||
driglx_direct_default="no"
|
||||
;;
|
||||
*)
|
||||
driglx_direct_default="yes"
|
||||
;;
|
||||
esac
|
||||
AC_ARG_ENABLE([driglx-direct],
|
||||
[AS_HELP_STRING([--disable-driglx-direct],
|
||||
[enable direct rendering in GLX and EGL for DRI \
|
||||
@<:@default=auto@:>@])],
|
||||
[driglx_direct="$enableval"],
|
||||
[driglx_direct="$driglx_direct_default"])
|
||||
|
||||
dnl
|
||||
dnl libGL configuration per driver
|
||||
dnl
|
||||
@@ -762,12 +783,17 @@ dri|no) # these checks are still desired when there is no mesa_driver
|
||||
AC_MSG_ERROR([Can't use static libraries for DRI drivers])
|
||||
fi
|
||||
|
||||
# Check for libdrm
|
||||
PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
|
||||
PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
|
||||
PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
|
||||
GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED"
|
||||
DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
|
||||
GL_PC_REQ_PRIV="glproto >= $GLPROTO_REQUIRED"
|
||||
DRI_PC_REQ_PRIV=""
|
||||
|
||||
if test x"$driglx_direct" = xyes; then
|
||||
# Check for libdrm
|
||||
PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
|
||||
PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
|
||||
GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
|
||||
DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
|
||||
fi
|
||||
|
||||
# find the DRI deps for libGL
|
||||
if test "$x11_pkgconfig" = yes; then
|
||||
@@ -910,12 +936,6 @@ AC_ARG_WITH([dri-searchpath],
|
||||
[DRI_DRIVER_SEARCH_DIR="$withval"],
|
||||
[DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
|
||||
AC_SUBST([DRI_DRIVER_SEARCH_DIR])
|
||||
dnl Direct rendering or just indirect rendering
|
||||
AC_ARG_ENABLE([driglx-direct],
|
||||
[AS_HELP_STRING([--disable-driglx-direct],
|
||||
[enable direct rendering in GLX and EGL for DRI @<:@default=enabled@:>@])],
|
||||
[driglx_direct="$enableval"],
|
||||
[driglx_direct="yes"])
|
||||
dnl Which drivers to build - default is chosen by platform
|
||||
AC_ARG_WITH([dri-drivers],
|
||||
[AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
|
||||
@@ -1006,6 +1026,16 @@ if test "$mesa_driver" = dri -o "$mesa_driver" = no; then
|
||||
DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
|
||||
fi
|
||||
;;
|
||||
cygwin*)
|
||||
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
|
||||
if test "x$DRI_DIRS" = "xyes"; then
|
||||
DRI_DIRS="swrast"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# default drivers
|
||||
|
4
docs/ARB_color_buffer_float.txt
Normal file
4
docs/ARB_color_buffer_float.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
Known issues in the ARB_color_buffer_float implementation:
|
||||
- Rendering to multiple render targets, some fixed-point, some floating-point, with FIXED_ONLY fragment clamping and polygon smooth enabled may write incorrect values to the fixed point buffers (depends on spec interpretation)
|
||||
- For fragment programs with ARB_fog_* options, colors are clamped before fog application regardless of the fragment clamping setting (this depends on spec interpretation)
|
||||
|
@@ -15,7 +15,7 @@ GL 3.0:
|
||||
GLSL changes (GL_EXT_gpu_shader4, etc) not started
|
||||
Conditional rendering (GL_NV_conditional_render) DONE (swrast & softpipe)
|
||||
Map buffer subranges (GL_ARB_map_buffer_range) DONE
|
||||
Clamping controls (GL_ARB_color_buffer_float) BRANCH ~mareko/mesa floating2
|
||||
Clamping controls (GL_ARB_color_buffer_float) DONE
|
||||
Float textures, renderbuffers (GL_ARB_texture_float) BRANCH ~mareko/mesa floating2
|
||||
GL_EXT_packed_float not started
|
||||
GL_EXT_texture_shared_exponent not started
|
||||
@@ -53,7 +53,7 @@ Primitive restart (GL_NV_primitive_restart) DONE (gallium)
|
||||
Texture buffer objs (GL_ARB_texture_buffer_object) not started
|
||||
Rectangular textures (GL_ARB_texture_rectangle) DONE
|
||||
Uniform buffer objs (GL_ARB_uniform_buffer_object) not started
|
||||
Signed normalized textures (GL_EXT_texture_snorm) ~50% done
|
||||
Signed normalized textures (GL_EXT_texture_snorm) DONE (gallium)
|
||||
|
||||
|
||||
GL 3.2:
|
||||
@@ -77,7 +77,7 @@ GLSL 3.30 not started
|
||||
GL_ARB_blend_func_extended not started
|
||||
GL_ARB_explicit_attrib_location DONE (swrast, i915, i965)
|
||||
GL_ARB_occlusion_query2 DONE (swrast, gallium)
|
||||
GL_ARB_sampler_objects not started
|
||||
GL_ARB_sampler_objects DONE (gallium)
|
||||
GL_ARB_texture_rgb10_a2ui not started
|
||||
GL_ARB_texture_swizzle DONE (same as EXT version)
|
||||
GL_ARB_timer_query DONE (only Xlib sw driver)
|
||||
|
@@ -67,7 +67,7 @@ Additions to Chapter 3 the GLX 1.4 Specification (Functions and Errors)
|
||||
On "PC" computers, AGP memory can be allocated with glXAllocateMemoryNV
|
||||
and freed with glXFreeMemoryNV. Sometimes it's useful to know where a
|
||||
block of AGP memory is located with respect to the start of the AGP
|
||||
aperature. The function
|
||||
aperture. The function
|
||||
|
||||
GLuint glXGetAGPOffsetMESA( const GLvoid *pointer )
|
||||
|
||||
|
@@ -24,7 +24,7 @@ Number
|
||||
|
||||
Dependencies
|
||||
|
||||
Reguires EGL 1.4 or later. This extension is written against the
|
||||
Requires EGL 1.4 or later. This extension is written against the
|
||||
wording of the EGL 1.4 specification.
|
||||
|
||||
EGL_KHR_base_image is required.
|
||||
@@ -134,7 +134,7 @@ Issues
|
||||
RESOLVED: The eglQueryImage function has been proposed often,
|
||||
but it goes against the EGLImage design. EGLImages are opaque
|
||||
handles to a 2D array of pixels, which can be passed between
|
||||
client APIs. By referenceing an EGLImage in a client API, the
|
||||
client APIs. By referencing an EGLImage in a client API, the
|
||||
EGLImage target (a texture, a renderbuffer or such) can be
|
||||
used to query the attributes of the EGLImage. We don't have a
|
||||
full client API for creating and querying DRM buffers, though,
|
||||
|
@@ -48,7 +48,7 @@ IP Status
|
||||
|
||||
Issues
|
||||
|
||||
1. Should we also defined UNPACK_INVERT_MESA for glDrawPixels, etc?
|
||||
1. Should we also define UNPACK_INVERT_MESA for glDrawPixels, etc?
|
||||
|
||||
Resolved: No, we're only concerned with pixel packing. There are other
|
||||
solutions for inverting images when using glDrawPixels (negative Y pixel
|
||||
|
@@ -31,12 +31,12 @@ Overview
|
||||
|
||||
Mesa's implementation of GLX is entirely implemented on the client side.
|
||||
Therefore, Mesa cannot immediately detect when an X window or pixmap is
|
||||
destroyed in order to free any ancilliary data associated with the window
|
||||
destroyed in order to free any ancillary data associated with the window
|
||||
or pixmap.
|
||||
|
||||
The glxMesaReleaseBuffers() function can be used to explicitly indicate
|
||||
when the back color buffer, depth buffer, stencil buffer, and/or accum-
|
||||
ulation buffer associated with a drawable can be freed.
|
||||
when the back color buffer, depth buffer, stencil buffer, and/or accumu-
|
||||
lation buffer associated with a drawable can be freed.
|
||||
|
||||
IP Status
|
||||
|
||||
@@ -60,7 +60,7 @@ Additions to Chapter 3 of the GLX 1.3 Specification (Functions and Errors)
|
||||
|
||||
Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
|
||||
|
||||
causes all software ancilliary buffers (back buffer, depth, stencil,
|
||||
causes all software ancillary buffers (back buffer, depth, stencil,
|
||||
accum, etc) associated with the named drawable to be immediately
|
||||
deallocated. True is returned if <d> is a valid Mesa GLX drawable,
|
||||
else False is returned. After calling glXReleaseBuffersMESA, the
|
||||
|
@@ -35,7 +35,7 @@ Overview
|
||||
|
||||
Mesa's glViewport command queries the current window size and updates
|
||||
its internal data structors accordingly. This normally works fine
|
||||
since most applications call glViewport in responce to window size
|
||||
since most applications call glViewport in response to window size
|
||||
changes.
|
||||
|
||||
In some situations, however, the application may not call glViewport
|
||||
@@ -65,7 +65,7 @@ Additions to the AGL/GLX/WGL Specifications
|
||||
|
||||
Errors
|
||||
|
||||
INVALID_OPERATION is generated if ResizeBuffersMESA is called betweeen
|
||||
INVALID_OPERATION is generated if glResizeBuffersMESA is called between
|
||||
Begin and End.
|
||||
|
||||
New State
|
||||
|
@@ -88,8 +88,8 @@ Additions to the GLX 1.3 Specification
|
||||
this is typically the time required to display both the even and odd
|
||||
fields of a frame of video data.
|
||||
|
||||
If <interval> is set to a value of 0, buffer swaps are not synchron-
|
||||
ized to a video frame. The <interval> value is silently clamped to
|
||||
If <interval> is set to a value of 0, buffer swaps are not synchro-
|
||||
nized to a video frame. The <interval> value is silently clamped to
|
||||
the maximum implementation-dependent value supported before being
|
||||
stored.
|
||||
|
||||
|
@@ -328,7 +328,7 @@ Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization)
|
||||
|
||||
-- Section 3.8.10 "Texture Completeness"
|
||||
|
||||
Change the second paragaph (page 177) to say (spec changes identical
|
||||
Change the second paragraph (page 177) to say (spec changes identical
|
||||
to EXT_texture_array):
|
||||
|
||||
"For one-, two-, or three-dimensional textures and one- or
|
||||
@@ -443,10 +443,10 @@ Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization)
|
||||
Change second through fourth paragraphs (page 188) to say:
|
||||
|
||||
"Let D_t be the depth texture value, in the range [0, 1]. For
|
||||
texture lookups from one- and two-dimesional, rectangle, and
|
||||
texture lookups from one- and two-dimensional, rectangle, and
|
||||
one-dimensional array targets, let R be the interpolated <r>
|
||||
texture coordinate, clamped to the range [0, 1]. For texture lookups
|
||||
from two-dimesional array texture targets, let R be the interpolated
|
||||
from two-dimensional array texture targets, let R be the interpolated
|
||||
<q> texture coordinate, clamped to the range [0, 1]. Then the
|
||||
effective texture value L_t, I_t, or A_t is computed as follows:
|
||||
|
||||
@@ -604,7 +604,7 @@ Additions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions)
|
||||
|
||||
-- Section 5.4 "Display Lists"
|
||||
|
||||
Change the first paragraphi on page 242 to say (spec changes
|
||||
Change the first paragraph on page 242 to say (spec changes
|
||||
identical to EXT_texture_array):
|
||||
|
||||
"TexImage3D, TexImage2D, TexImage1D, Histogram, and ColorTable are
|
||||
|
@@ -44,7 +44,7 @@ Overview
|
||||
ARB_texture_compression_rgtc introduces some compressed red and
|
||||
red_green signed formats but no uncompressed ones, which might
|
||||
still be useful. NV_texture_shader adds signed texture formats,
|
||||
but also a lot of functionality which has been superceded by fragment
|
||||
but also a lot of functionality which has been superseded by fragment
|
||||
shaders.
|
||||
It is usually possible to get the same functionality
|
||||
using a unsigned format by doing scale and bias in a shader, but this
|
||||
@@ -105,7 +105,7 @@ Issues
|
||||
This is also different to what NV_texture_shader used.
|
||||
The above mapping should be considered the reference, but there
|
||||
is some leeway so other mappings are allowed for implementations which
|
||||
cannot do this. Particulary the mapping given in NV_texture_shader or
|
||||
cannot do this. Particularly the mapping given in NV_texture_shader or
|
||||
the standard OpenGL byte/float mapping is considered acceptable too, as
|
||||
might be a mapping which represents -1.0 by -128, 0.0 by 0 and 1.0 by
|
||||
127 (that is, uses different scale factors for negative and positive
|
||||
|
@@ -88,7 +88,7 @@ Additions to Chapter 2 of the OpenGL 1.2 Specification (OpenGL Operation)
|
||||
WindosPos4MESA takes four values indicating x, y, z, and w.
|
||||
WindowPos3MESA (or WindowPos2MESA) is analaguos, but sets only
|
||||
x, y, and z with w implicitly set to 1 (or only x and y with z
|
||||
implicititly set to 0 and w implicitly set to 1).
|
||||
implicitly set to 0 and w implicitly set to 1).
|
||||
|
||||
WindowPosMESA operates like RasterPos except that the current modelview
|
||||
matrix, projection matrix and viewport parameters are ignored and the
|
||||
@@ -108,7 +108,7 @@ GLX Protocol
|
||||
|
||||
Errors
|
||||
|
||||
INVALID_OPERATION is generated if WindowPosMESA is called betweeen
|
||||
INVALID_OPERATION is generated if WindowPosMESA is called between
|
||||
Begin and End.
|
||||
|
||||
New State
|
||||
|
@@ -26,7 +26,7 @@ Number
|
||||
Dependencies
|
||||
|
||||
OpenGL 1.0 or later is required
|
||||
This extensions is written against the OpenGL 1.4 Specification.
|
||||
This extension is written against the OpenGL 1.4 Specification.
|
||||
NV_texture_rectangle effects the definition of this extension.
|
||||
|
||||
Overview
|
||||
@@ -104,7 +104,7 @@ Additions to Chapter 3 of the OpenGL 1.4 Specification (Rasterization)
|
||||
|
||||
|
||||
In section 3.6.4, Rasterization of Pixel Rectangles, on page 104,
|
||||
add the following to Table 3.12 (Packed pixel fiedl assignments):
|
||||
add the following to Table 3.12 (Packed pixel field assignments):
|
||||
|
||||
First Second Third Fourth
|
||||
Format Element Element Element Element
|
||||
|
@@ -25,7 +25,7 @@ Number
|
||||
|
||||
Dependencies
|
||||
|
||||
Reguires EGL 1.4 or later. This extension is written against the
|
||||
Requires EGL 1.4 or later. This extension is written against the
|
||||
wording of the EGL 1.4 specification.
|
||||
|
||||
EGL_KHR_base_image is required.
|
||||
@@ -40,9 +40,9 @@ Overview
|
||||
provides a new target for eglCreateImageKHR, to create an EGLImage
|
||||
from a wl_buffer
|
||||
|
||||
Adding a implementation specific wayland interface, allows the
|
||||
Adding an implementation specific wayland interface, allows the
|
||||
EGL implementation to define specific wayland requests and events,
|
||||
needed for buffer sharing in a EGL wayland platform.
|
||||
needed for buffer sharing in an EGL wayland platform.
|
||||
|
||||
IP Status
|
||||
|
||||
|
@@ -62,6 +62,7 @@ a:visited {
|
||||
<LI><A HREF="perf.html" target="MainFrame">Performance Tips</A>
|
||||
<LI><A HREF="extensions.html" target="MainFrame">Mesa Extensions</A>
|
||||
<LI><A HREF="mangling.html" target="MainFrame">Function Name Mangling</A>
|
||||
<LI><A href="llvmpipe.html" target="MainFrame">Gallium llvmpipe driver</A>
|
||||
</ul>
|
||||
|
||||
<b>Developer Topics</b>
|
||||
|
@@ -21,76 +21,52 @@ When a new release is coming, release candidates (betas) may be found
|
||||
|
||||
|
||||
<p>
|
||||
Mesa is distributed in several parts:
|
||||
The Mesa package is named MesaLib-x.y.z.{tar.bz2, tar.gz, zip} where x.y.z
|
||||
is the version. There are three types of compressed archives.
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>MesaLib-x.y.z</b> - the main Mesa library source code, drivers
|
||||
and documentation.
|
||||
</li>
|
||||
<li><b>MesaDemos-x.y.z</b> - OpenGL demonstration and test programs.
|
||||
Most of the programs require GLUT (either the
|
||||
<a href="http://www.opengl.org/resources/libraries/glut"
|
||||
target="_parent">original GLUT by Mark Kilgard</a> or
|
||||
<a href="http://freeglut.sourceforge.net" target="_parent">freeglut</a> or
|
||||
<a href="http://openglut.sourceforge.net" target="_parent">OpenGLUT</a>).
|
||||
</li>
|
||||
<li><b>MesaGLUT-x.y.z</b> - Mark Kilgard's GLUT, easily compiled and used
|
||||
with Mesa. Plus, other implementation of GLUT for DOS, OS/2, BeOS, etc.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
If you're not interested in running the demos, you'll only need the first
|
||||
package.
|
||||
There's also the MesaGLUT-x.y.z.{tar.bz2, tar.gz, zip} packages which
|
||||
contain Mark Kilgard's GLUT library.
|
||||
This is optional.
|
||||
Most Linux distributions include an implementation of GLUT (such as freeglut).
|
||||
</p>
|
||||
<p>
|
||||
In the past, the Mesa demos collection was distributed as
|
||||
MesaDemos-x.y.z.{tar.bz2, tar.gz, zip}.
|
||||
Now, the
|
||||
<a href="ftp://ftp.freedesktop.org/pub/mesa/demos/" target="_parent">
|
||||
Mesa demos</a> are distributed separately.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you're new to this and not sure what you're doing, grab all three packages.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The packages are available in .tar.gz, .tar.bz2 and .zip formats.
|
||||
Other sites might offer additional package formats.
|
||||
</p>
|
||||
|
||||
<H1>Unpacking</H1>
|
||||
|
||||
<p>
|
||||
All the packages should be in the same directory prior to unpacking.
|
||||
To unpack .tar.gz files:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>To unpack .tar.gz files:
|
||||
<pre>
|
||||
tar zxf MesaLib-X.Y.tar.gz
|
||||
tar zxf MesaDemos-X.Y.tar.gz
|
||||
tar zxf MesaGLUT-X.Y.tar.gz
|
||||
tar zxf MesaLib-x.y.z.tar.gz
|
||||
</pre>
|
||||
or
|
||||
<pre>
|
||||
gzcat MesaLib-X.Y.tar.gz | tar xf -
|
||||
gzcat MesaDemos-X.Y.tar.gz | tar xf -
|
||||
gzcat MesaGLUT-X.Y.tar.gz | tar xf -
|
||||
gzcat MesaLib-x.y.z.tar.gz | tar xf -
|
||||
</pre>
|
||||
or
|
||||
<pre>
|
||||
gunzip MesaLib-X.Y.tar.gz ; tar xf MesaLib-X.Y.tar
|
||||
gunzip MesaDemos-X.Y.tar.gz ; tar xf MesaDemos-X.Y.tar
|
||||
gunzip MesaGLUT-X.Y.tar.gz ; tar xf MesaGLUT-X.Y.tar
|
||||
gunzip MesaLib-x.y.z.tar.gz ; tar xf MesaLib-x.y.z.tar
|
||||
</pre>
|
||||
<li>To unpack .tar.bz2 files:
|
||||
<p>
|
||||
To unpack .tar.bz2 files:
|
||||
</p>
|
||||
<pre>
|
||||
bunzip2 -c MesaLib-X.Y.tar.gz | tar xf -
|
||||
bunzip2 -c MesaDemos-X.Y.tar.gz | tar xf -
|
||||
bunzip2 -c MesaGLUT-X.Y.tar.gz | tar xf -
|
||||
bunzip2 -c MesaLib-x.y.z.tar.gz | tar xf -
|
||||
</pre>
|
||||
<li>To unpack .zip files:
|
||||
<p>
|
||||
To unpack .zip files:
|
||||
</p>
|
||||
<pre>
|
||||
unzip MesaLib-X.Y.zip
|
||||
unzip MesaDemos-X.Y.zip
|
||||
unzip MesaGLUT-X.Y.zip
|
||||
unzip MesaLib-x.y.z.zip
|
||||
</pre>
|
||||
</ul>
|
||||
|
||||
|
||||
<h1>Contents</h1>
|
||||
@@ -106,22 +82,13 @@ bin/ - shell scripts for making shared libraries, etc
|
||||
docs/ - documentation
|
||||
src/ - source code for libraries
|
||||
src/mesa - sources for the main Mesa library and device drivers
|
||||
src/gallium - sources for Gallium and Gallium drivers
|
||||
src/glu - libGLU source code
|
||||
src/glx - sources for building libGL with full GLX and DRI support
|
||||
src/glw - Xt/Motif/OpenGL widget code
|
||||
</pre>
|
||||
|
||||
If you downloaded and unpacked the MesaDemos.X.Y package:
|
||||
|
||||
<pre>
|
||||
progs/demos - original Mesa demos
|
||||
progs/xdemos - GLX OpenGL/Mesa demos
|
||||
progs/redbook - examples from the OpenGL Programming Guide
|
||||
progs/samples - examples from SGI
|
||||
progs/images/ - image files
|
||||
</pre>
|
||||
|
||||
If you downloaded and unpacked the MesaGLUT.X.Y package:
|
||||
If you downloaded and unpacked the MesaGLUT.x.y.z package:
|
||||
<pre>
|
||||
src/glut - GLUT library source code
|
||||
</pre>
|
||||
|
@@ -49,6 +49,15 @@ Setting this variable automatically sets the MESA_TEX_PROG variable as well.
|
||||
<li>MESA_EXTENSION_OVERRIDE - can be used to enable/disable extensions.
|
||||
A value such as "GL_EXT_foo -GL_EXT_bar" will enable the GL_EXT_foo extension
|
||||
and disable the GL_EXT_bar extension.
|
||||
<li>MESA_EXTENSION_MAX_YEAR - The GL_EXTENSIONS string returned by Mesa is sorted
|
||||
by extension year.
|
||||
If this variable is set to year X, only extensions defined on or before year
|
||||
X will be reported.
|
||||
This is to work-around a bug in some games where the extension string is
|
||||
copied into a fixed-size buffer without truncating.
|
||||
If the extension string is too long, the buffer overrun can cause the game
|
||||
to crash.
|
||||
This is a work-around for that.
|
||||
<li>MESA_GLSL - <a href="shading.html#envvars">shading language compiler options</a>
|
||||
</ul>
|
||||
|
||||
|
@@ -12,16 +12,16 @@
|
||||
<ol>
|
||||
<li><a href="#unix-x11">Unix / X11</a>
|
||||
<ul>
|
||||
<li><a href="#prereq">Prerequisites for DRI and hardware acceleration</a>
|
||||
<li><a href="#prereq-general">General prerequisites for building</a>
|
||||
<li><a href="#prereq-dri">Prerequisites for DRI and hardware acceleration</a>
|
||||
<li><a href="#autoconf">Building with autoconf</a>
|
||||
<li><a href="#traditional">Building with traditional Makefiles</a>
|
||||
<li><a href="#libs">The Libraries</a>
|
||||
<li><a href="#demos">Running the demos
|
||||
<li><a href="#install">Installing the header and library files
|
||||
<li><a href="#pkg-config">Building OpenGL programs with pkg-config
|
||||
</ul>
|
||||
<li><a href="#windows">Windows</a>
|
||||
<li><a href="#scons">SCons</a>
|
||||
<li><a href="#scons">Building with SCons</a>
|
||||
<li><a href="#other">Other</a>
|
||||
</ol>
|
||||
<br>
|
||||
@@ -31,8 +31,22 @@
|
||||
<H2>1. Unix/X11 Compilation and Installation</H1>
|
||||
|
||||
|
||||
<a name="prereq">
|
||||
<h3>1.1 Prerequisites for DRI and hardware acceleration</h3>
|
||||
<a name="prereq-general">
|
||||
<h3>1.1 General prerequisites for building</h3>
|
||||
|
||||
<ul>
|
||||
<li>lex / yacc - for building the GLSL compiler.
|
||||
On Linux systems, flex and bison are used.
|
||||
Versions 2.5.35 and 2.4.1, respectively, (or later) should work.
|
||||
</li>
|
||||
<li>python - Python is needed for building the Gallium components.
|
||||
Version 2.6.4 or later should work.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<a name="prereq-dri">
|
||||
<h3>1.2 Prerequisites for DRI and hardware acceleration</h3>
|
||||
|
||||
<p>
|
||||
The following are required for DRI-based hardware acceleration with Mesa:
|
||||
@@ -49,7 +63,7 @@ version 2.4.15 or later
|
||||
|
||||
|
||||
<a name="autoconf">
|
||||
<h3>1.2 Building with Autoconf</h3>
|
||||
<h3>1.3 Building with Autoconf</h3>
|
||||
|
||||
<p>
|
||||
Mesa may be <a href="autoconf.html">built using autoconf</a>.
|
||||
@@ -59,7 +73,7 @@ If that fails the traditional Mesa build system is available.
|
||||
|
||||
|
||||
<a name="traditional">
|
||||
<h3>1.3 Building with traditional Makefiles</h3>
|
||||
<h3>1.4 Building with traditional Makefiles</h3>
|
||||
|
||||
<p>
|
||||
The traditional Mesa build system is based on a collection of pre-defined
|
||||
@@ -126,7 +140,7 @@ Later, if you want to rebuild for a different configuration run
|
||||
|
||||
|
||||
<a name="libs">
|
||||
<h3>1.4 The libraries</h3>
|
||||
<h3>1.5 The libraries</h3>
|
||||
|
||||
<p>
|
||||
When compilation has finished, look in the top-level <code>lib/</code>
|
||||
@@ -185,81 +199,11 @@ If you built the DRI hardware drivers, you'll also see the DRI drivers:
|
||||
-rwxr-xr-x 1 brian users 10997120 Jul 21 12:13 unichrome_dri.so
|
||||
</pre>
|
||||
|
||||
|
||||
<a name="demos">
|
||||
<h3>1.5 Running the demos</h3>
|
||||
|
||||
<p>
|
||||
If you downloaded/unpacked the MesaDemos-x.y.z.tar.gz archive or
|
||||
obtained Mesa from CVS, the <b>progs/</b> directory will contain a
|
||||
bunch of demonstration programs.
|
||||
If you built with Gallium support, look in lib/gallium/ for Gallium-based
|
||||
versions of libGL and device drivers.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Before running a demo, you'll probably have to set two environment variables
|
||||
to indicate where the libraries are located. For example:
|
||||
<p>
|
||||
<blockquote>
|
||||
<b>cd lib/</b>
|
||||
<br>
|
||||
<b>export LD_LIBRARY_PATH=${PWD}</b>
|
||||
<br>
|
||||
<b>export LIBGL_DRIVERS_PATH=${PWD}</b> (if using DRI drivers)
|
||||
</blockquote>
|
||||
|
||||
<p>
|
||||
Next, change to the Mesa/demos/ directory:
|
||||
</p>
|
||||
<blockquote>
|
||||
<b>cd ../progs/demos</b>
|
||||
</blockquote>
|
||||
|
||||
<p>
|
||||
Run a demo such as gears:
|
||||
</p>
|
||||
<blockquote>
|
||||
<b>./gears</b>
|
||||
</blockquote>
|
||||
|
||||
<p>
|
||||
If this doesn't work, try the <b>Mesa/progs/xdemos/glxinfo</b> program
|
||||
and see that it prints the expected Mesa version number.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you're using Linux or a similar OS, verify that the demo program is
|
||||
being linked with the proper library files:
|
||||
</p>
|
||||
<blockquote>
|
||||
<b>ldd gears</b>
|
||||
</blockquote>
|
||||
|
||||
<p>
|
||||
You should see something like this:
|
||||
</p>
|
||||
<pre>
|
||||
libglut.so.3 => /home/brian/Mesa/lib/libglut.so.3 (0x40013000)
|
||||
libGLU.so.1 => /home/brian/Mesa/lib/libGLU.so.1 (0x40051000)
|
||||
libGL.so.1 => /home/brian/Mesa/lib/libGL.so.1 (0x400e0000)
|
||||
libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
|
||||
libm.so.6 => /lib/i686/libm.so.6 (0x403da000)
|
||||
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x403fc000)
|
||||
libXmu.so.6 => /usr/X11R6/lib/libXmu.so.6 (0x404da000)
|
||||
libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x404f1000)
|
||||
libXi.so.6 => /usr/X11R6/lib/libXi.so.6 (0x40543000)
|
||||
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x4054b000)
|
||||
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x405fd000)
|
||||
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x40605000)
|
||||
libpthread.so.0 => /lib/i686/libpthread.so.0 (0x40613000)
|
||||
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
|
||||
libdl.so.2 => /lib/libdl.so.2 (0x40644000)
|
||||
libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x40647000)
|
||||
libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x40650000)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Retrace your steps if this doesn't look right.
|
||||
</p>
|
||||
|
||||
|
||||
<a name="install">
|
||||
|
@@ -1,61 +1,116 @@
|
||||
LLVMPIPE -- a fork of softpipe that employs LLVM for code generation.
|
||||
<HTML>
|
||||
|
||||
<TITLE>llvmpipe</TITLE>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="mesa.css"></head>
|
||||
|
||||
<BODY>
|
||||
|
||||
<H1>Introduction</H1>
|
||||
|
||||
<p>
|
||||
The Gallium llvmpipe driver is a software rasterizer that uses LLVM to
|
||||
do runtime code generation.
|
||||
Shaders, point/line/triangle rasterization and vertex processing are
|
||||
implemented with LLVM IR which is translated to x86 or x86-64 machine
|
||||
code.
|
||||
Also, the driver is multithreaded to take advantage of multiple CPU cores
|
||||
(up to 8 at this time).
|
||||
It's the fastest software rasterizer for Mesa.
|
||||
</p>
|
||||
|
||||
|
||||
Requirements
|
||||
============
|
||||
<h1>Requirements</h1>
|
||||
|
||||
- A x86 or amd64 processor. 64bit mode is preferred.
|
||||
|
||||
<dl>
|
||||
<dt>An x86 or amd64 processor. 64-bit mode is preferred.</dt>
|
||||
<dd>
|
||||
<p>
|
||||
Support for sse2 is strongly encouraged. Support for ssse3, and sse4.1 will
|
||||
yield the most efficient code. The less features the CPU has the more
|
||||
likely is that you ran into underperforming, buggy, or incomplete code.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
See /proc/cpuinfo to know what your CPU supports.
|
||||
|
||||
- LLVM. Version 2.8 recommended. 2.6 or later required.
|
||||
|
||||
</p>
|
||||
</dd>
|
||||
<dt>LLVM. Version 2.8 recommended. 2.6 or later required.</dt>
|
||||
<dd>
|
||||
<p>
|
||||
<b>NOTE</b>: LLVM 2.8 and earlier will not work on systems that support the
|
||||
Intel AVX extensions (e.g. Sandybridge). LLVM's code generator will
|
||||
fail when trying to emit AVX instructions. This was fixed in LLVM 2.9.
|
||||
</p>
|
||||
<p>
|
||||
For Linux, on a recent Debian based distribution do:
|
||||
|
||||
</p>
|
||||
<pre>
|
||||
aptitude install llvm-dev
|
||||
</pre>
|
||||
For a RPM-based distribution do:
|
||||
</p>
|
||||
<pre>
|
||||
yum install llvm-devel
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
For Windows download pre-built MSVC 9.0 or MinGW binaries from
|
||||
http://people.freedesktop.org/~jrfonseca/llvm/ and set the LLVM environment
|
||||
variable to the extracted path.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For MSVC there are two set of binaries: llvm-x.x-msvc32mt.7z and
|
||||
llvm-x.x-msvc32mtd.7z .
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You have to set the LLVM=/path/to/llvm-x.x-msvc32mtd env var when passing
|
||||
debug=yes to scons, and LLVM=/path/to/llvm-x.x-msvc32mt when building with
|
||||
debug=no. This is necessary as LLVM builds as static library so the chosen
|
||||
MS CRT must match.
|
||||
</p>
|
||||
</dd>
|
||||
|
||||
- scons (optional)
|
||||
<dt>scons (optional)</dt>
|
||||
</dl>
|
||||
|
||||
|
||||
Building
|
||||
========
|
||||
|
||||
<h1>Building</h1>
|
||||
|
||||
To build everything on Linux invoke scons as:
|
||||
|
||||
<pre>
|
||||
scons build=debug libgl-xlib
|
||||
</pre>
|
||||
|
||||
Alternatively, you can build it with GNU make, if you prefer, by invoking it as
|
||||
|
||||
<pre>
|
||||
make linux-llvm
|
||||
</pre>
|
||||
|
||||
but the rest of these instructions assume that scons is used.
|
||||
|
||||
For windows is everything the except except the winsys:
|
||||
|
||||
<pre>
|
||||
scons build=debug libgl-gdi
|
||||
</pre>
|
||||
|
||||
Using
|
||||
=====
|
||||
|
||||
<h1>Using</h1>
|
||||
|
||||
On Linux, building will create a drop-in alternative for libGL.so into
|
||||
|
||||
<pre>
|
||||
build/foo/gallium/targets/libgl-xlib/libGL.so
|
||||
</pre>
|
||||
or
|
||||
<pre>
|
||||
lib/gallium/libGL.so
|
||||
</pre>
|
||||
|
||||
To use it set the LD_LIBRARY_PATH environment variable accordingly.
|
||||
|
||||
@@ -68,19 +123,20 @@ replacing the native ICD driver, but it's quite an advanced usage, so if you
|
||||
need to ask, don't even try it.
|
||||
|
||||
|
||||
Profiling
|
||||
=========
|
||||
<h1>Profiling</h1>
|
||||
|
||||
To profile llvmpipe you should pass the options
|
||||
|
||||
<pre>
|
||||
scons build=profile <same-as-before>
|
||||
</pre>
|
||||
|
||||
This will ensure that frame pointers are used both in C and JIT functions, and
|
||||
that no tail call optimizations are done by gcc.
|
||||
|
||||
|
||||
To better profile JIT code you'll need to build LLVM with oprofile integration.
|
||||
|
||||
<pre>
|
||||
./configure \
|
||||
--prefix=$install_dir \
|
||||
--enable-optimized \
|
||||
@@ -92,43 +148,57 @@ To better profile JIT code you'll need to build LLVM with oprofile integration.
|
||||
make -C "$build_dir" install
|
||||
|
||||
find "$install_dir/lib" -iname '*.a' -print0 | xargs -0 strip --strip-debug
|
||||
</pre>
|
||||
|
||||
The you should define
|
||||
|
||||
<pre>
|
||||
export LLVM=/path/to/llvm-2.6-profile
|
||||
</pre>
|
||||
|
||||
and rebuild.
|
||||
|
||||
|
||||
Unit testing
|
||||
============
|
||||
<h1>Unit testing</h1>
|
||||
|
||||
<p>
|
||||
Building will also create several unit tests in
|
||||
build/linux-???-debug/gallium/drivers/llvmpipe:
|
||||
</p>
|
||||
|
||||
- lp_test_blend: blending
|
||||
- lp_test_conv: SIMD vector conversion
|
||||
- lp_test_format: pixel unpacking/packing
|
||||
</ul>
|
||||
<li> lp_test_blend: blending
|
||||
<li> lp_test_conv: SIMD vector conversion
|
||||
<li> lp_test_format: pixel unpacking/packing
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Some of this tests can output results and benchmarks to a tab-separated-file
|
||||
for posterior analysis, e.g.:
|
||||
|
||||
</p>
|
||||
<pre>
|
||||
build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv
|
||||
</pre>
|
||||
|
||||
|
||||
Development Notes
|
||||
=================
|
||||
<h1>Development Notes</h1>
|
||||
|
||||
- When looking to this code by the first time start in lp_state_fs.c, and
|
||||
<ul>
|
||||
<li>
|
||||
When looking to this code by the first time start in lp_state_fs.c, and
|
||||
then skim through the lp_bld_* functions called in there, and the comments
|
||||
at the top of the lp_bld_*.c functions.
|
||||
|
||||
- The driver-independent parts of the LLVM / Gallium code are found in
|
||||
</li>
|
||||
<li>
|
||||
The driver-independent parts of the LLVM / Gallium code are found in
|
||||
src/gallium/auxiliary/gallivm/. The filenames and function prefixes
|
||||
need to be renamed from "lp_bld_" to something else though.
|
||||
|
||||
- We use LLVM-C bindings for now. They are not documented, but follow the C++
|
||||
</li>
|
||||
<li>
|
||||
We use LLVM-C bindings for now. They are not documented, but follow the C++
|
||||
interfaces very closely, and appear to be complete enough for code
|
||||
generation. See
|
||||
http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html
|
||||
for a stand-alone example. See the llvm-c/Core.h file for reference.
|
||||
</li>
|
||||
</ul>
|
@@ -11,6 +11,13 @@
|
||||
<H1>News</H1>
|
||||
|
||||
|
||||
<h2>April 6, 2011</h2>
|
||||
|
||||
<p>
|
||||
<a href="relnotes-7.10.2.html">Mesa 7.10.2</a> is released. This is a bug
|
||||
fix release release.
|
||||
</p>
|
||||
|
||||
<h2>March 2, 2011</h2>
|
||||
|
||||
<p>
|
||||
|
206
docs/relnotes-7.10.2.html
Normal file
206
docs/relnotes-7.10.2.html
Normal file
@@ -0,0 +1,206 @@
|
||||
<HTML>
|
||||
|
||||
<head>
|
||||
<TITLE>Mesa Release Notes</TITLE>
|
||||
<link rel="stylesheet" type="text/css" href="mesa.css">
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
</head>
|
||||
|
||||
<BODY>
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.10.2 Release Notes / April 6, 2011</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.10.2 is a bug fix release which fixes bugs found since the 7.10 release.
|
||||
</p>
|
||||
<p>
|
||||
Mesa 7.10.2 implements the OpenGL 2.1 API, but the version reported by
|
||||
glGetString(GL_VERSION) depends on the particular driver being used.
|
||||
Some drivers don't support all the features required in OpenGL 2.1.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
|
||||
for DRI hardware acceleration.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
2f9f444265534a2cfd9a99d1a8291089 MesaLib-7.10.2.tar.gz
|
||||
f5de82852f1243f42cc004039e10b771 MesaLib-7.10.2.tar.bz2
|
||||
47836e37bab6fcafe3ac90c9544ba0e9 MesaLib-7.10.2.zip
|
||||
175120325828f313621cc5bc6c504803 MesaGLUT-7.10.2.tar.gz
|
||||
8c71d273f5f8d6c5eda4ffc39e0fe03e MesaGLUT-7.10.2.tar.bz2
|
||||
03036c8efe7b791a90fa0f2c41b43f43 MesaGLUT-7.10.2.zip
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>New features</h2>
|
||||
<p>None.</p>
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<p>This list is likely incomplete.</p>
|
||||
<ul>
|
||||
|
||||
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29172">Bug 29172</a> - Arrandale - Pill Popper Pops Pills</li>
|
||||
|
||||
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31159">Bug 31159</a> - shadow problem in 0ad game</li>
|
||||
|
||||
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32688">Bug 32688</a> - [RADEON:KMS:R300G] some games have a wireframe or outline visible</li>
|
||||
|
||||
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32949">Bug 32949</a> - [glsl wine] Need for Speed renders incorrectly with GLSL enabled</li>
|
||||
|
||||
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34203">Bug 34203</a> - [GLSL] fail to call long chains across shaders</li>
|
||||
|
||||
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34376">Bug 34376</a> - [GLSL] allowing assignment to unsized array
|
||||
<ul>
|
||||
<li>The commit message incorrectly
|
||||
lists <a href="https://bugs.freedesktop.org/show_bug.cgi?id=34367">bug
|
||||
34367</a>.</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34370">Bug 34370</a> - [GLSL] "i<5 && i<4" in for loop fails</li>
|
||||
|
||||
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34374">Bug 34374</a> - [GLSL] fail to redeclare an array using initializer</li>
|
||||
|
||||
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=35073">Bug 35073</a> - [GM45] Alpha test is broken when rendering to FBO with no color attachment</li>
|
||||
|
||||
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=35483">Bug 35483</a> - util_blit_pixels_writemask: crash in line 322 of src/gallium/auxiliary/util/u_blit.c</li>
|
||||
|
||||
<!-- <li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=">Bug </a> - </li> -->
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Changes</h2>
|
||||
<p>The full set of changes can be viewed by using the following GIT command:</p>
|
||||
|
||||
<pre>
|
||||
git log mesa-7.10.1..mesa-7.10.2
|
||||
</pre>
|
||||
|
||||
<p><em>Note:</em> Reverted commits and the reverts are not included in this list.</p>
|
||||
|
||||
<p>Alex Deucher (2):
|
||||
<ul>
|
||||
<li>r600c: add new ontario pci ids</li>
|
||||
<li>r600g: add some additional ontario pci ids</li>
|
||||
</ul></p>
|
||||
|
||||
<p>Benjamin Franzke (1):
|
||||
<ul>
|
||||
<li>st/dri: Fix surfaceless gl using contexts with previous bound surfaces</li>
|
||||
</ul></p>
|
||||
|
||||
<p>Brian Paul (9):
|
||||
<ul>
|
||||
<li>docs: pull 7.9.2 release notes into 7.10 branch</li>
|
||||
<li>docs: update news.html with 7.10.1 and 7.9.2 releases</li>
|
||||
<li>docs: fill in 7.10.1 release data</li>
|
||||
<li>docs: add, fix release notes links</li>
|
||||
<li>docs: update info about Mesa packaging/contents</li>
|
||||
<li>docs: update prerequisites, remove old demo info</li>
|
||||
<li>mesa: Guard against null pointer deref in fbo validation</li>
|
||||
<li>st/mesa: Apply LOD bias from correct texture unit</li>
|
||||
<li>glsl: silence warning in printf() with a cast</li>
|
||||
</ul></p>
|
||||
|
||||
<p>Chad Versace (1):
|
||||
<ul>
|
||||
<li>i965: Fix tex_swizzle when depth mode is GL_RED</li>
|
||||
</ul></p>
|
||||
|
||||
<p>Dave Airlie (1):
|
||||
<ul>
|
||||
<li>r600: don't close fd on failed load</li>
|
||||
</ul></p>
|
||||
|
||||
<p>Eric Anholt (2):
|
||||
<ul>
|
||||
<li>i965: Apply a workaround for the Ironlake "vertex flashing".</li>
|
||||
<li>i965: Fix alpha testing when there is no color buffer in the FBO.</li>
|
||||
</ul></p>
|
||||
|
||||
<p>Fabian Bieler (1):
|
||||
<ul>
|
||||
<li>st/mesa: Apply LOD from texture object</li>
|
||||
</ul></p>
|
||||
|
||||
<p>Henri Verbeet (1):
|
||||
<ul>
|
||||
<li>st/mesa: Validate state before doing blits.</li>
|
||||
</ul></p>
|
||||
|
||||
<p>Ian Romanick (13):
|
||||
<ul>
|
||||
<li>docs: Add 7.10.1 md5sums</li>
|
||||
<li>glsl: Refactor AST-to-HIR code handling variable initializers</li>
|
||||
<li>glsl: Refactor AST-to-HIR code handling variable redeclarations</li>
|
||||
<li>glsl: Process redeclarations before initializers</li>
|
||||
<li>glsl: Function signatures cannot have NULL return type</li>
|
||||
<li>glsl: Add several function / call related validations</li>
|
||||
<li>linker: Add imported functions to the linked IR</li>
|
||||
<li>glsl: Use insert_before for lists instead of open coding it</li>
|
||||
<li>glsl: Only allow unsized array assignment in an initializer</li>
|
||||
<li>glcpp: Refresh autogenerated lexer files</li>
|
||||
<li>docs: Initial bits of 7.10.2 release notes</li>
|
||||
<li>mesa: set version string to 7.10.2</li>
|
||||
<li>mesa: Remove nonexistant files from _FILES lists</li>
|
||||
</ul></p>
|
||||
|
||||
<p>Jerome Glisse (1):
|
||||
<ul>
|
||||
<li>r600g: move user fence into base radeon structure</li>
|
||||
</ul></p>
|
||||
|
||||
<p>José Fonseca (2):
|
||||
<ul>
|
||||
<li>mesa: Fix typo glGet*v(GL_TEXTURE_COORD_ARRAY_*).</li>
|
||||
<li>mesa: More glGet* fixes.</li>
|
||||
</ul></p>
|
||||
|
||||
<p>Kenneth Graunke (4):
|
||||
<ul>
|
||||
<li>glcpp: Rework lexer to use a SKIP state rather than REJECT.</li>
|
||||
<li>glcpp: Remove trailing contexts from #if rules.</li>
|
||||
<li>i965/fs: Fix linear gl_Color interpolation on pre-gen6 hardware.</li>
|
||||
<li>glsl: Accept precision qualifiers on sampler types, but only in ES.</li>
|
||||
</ul></p>
|
||||
|
||||
<p>Marek Olšák (15):
|
||||
<ul>
|
||||
<li>st/mesa: fix crash when DrawBuffer->_ColorDrawBuffers[0] is NULL</li>
|
||||
<li>st/mesa: fail to alloc a renderbuffer if st_choose_renderbuffer_format fails</li>
|
||||
<li>r300/compiler: fix the saturate modifier when applied to TEX instructions</li>
|
||||
<li>r300/compiler: fix translating the src negate bits in pair_translate</li>
|
||||
<li>r300/compiler: Abs doesn't cancel Negate (in the conversion to native swizzles)</li>
|
||||
<li>r300/compiler: TEX instructions don't support negation on source arguments</li>
|
||||
<li>r300/compiler: do not set TEX_IGNORE_UNCOVERED on r500</li>
|
||||
<li>r300/compiler: saturate Z before the shadow comparison</li>
|
||||
<li>r300/compiler: fix equal and notequal shadow compare functions</li>
|
||||
<li>r300/compiler: remove unused variables</li>
|
||||
<li>st/mesa: fix crash when using both user and vbo buffers with the same stride</li>
|
||||
<li>r300g: fix alpha-test with no colorbuffer</li>
|
||||
<li>r300g: tell the GLSL compiler to lower the continue opcode</li>
|
||||
<li>r300/compiler: propagate SaturateMode down to the result of shadow comparison</li>
|
||||
<li>r300/compiler: apply the texture swizzle to shadow pass and fail values too</li>
|
||||
</ul></p>
|
||||
|
||||
<p>Michel Dänzer (1):
|
||||
<ul>
|
||||
<li>Use proper source row stride when getting depth/stencil texels.</li>
|
||||
</ul></p>
|
||||
|
||||
<p>Tom Stellard (4):
|
||||
<ul>
|
||||
<li>r300/compiler: Use a 4-bit writemask in pair instructions</li>
|
||||
<li>prog_optimize: Fix reallocating registers for shaders with loops</li>
|
||||
<li>r300/compiler: Fix vertex shader MAD instructions with constant swizzles</li>
|
||||
<li>r300/compiler: Don't try to convert RGB to Alpha in full instructions</li>
|
||||
</ul></p>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -41,6 +41,7 @@ tbd
|
||||
<li>GL_ARB_texture_compression_rgtc (gallium r600, swrast)
|
||||
<li>GL_ARB_draw_buffers_blend (gallium)
|
||||
<li>GL_EXT_texture_sRGB_decode (gallium drivers, swrast, i965)
|
||||
<li>GL_ARB_sampler_objects (gallium drivers)
|
||||
</ul>
|
||||
|
||||
|
||||
|
@@ -14,6 +14,7 @@ The release notes summarize what's new or changed in each Mesa release.
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="relnotes-7.11.html">7.11 release notes</A>
|
||||
<LI><A HREF="relnotes-7.10.2.html">7.10.2 release notes</A>
|
||||
<LI><A HREF="relnotes-7.10.1.html">7.10.1 release notes</A>
|
||||
<LI><A HREF="relnotes-7.10.html">7.10 release notes</A>
|
||||
<LI><A HREF="relnotes-7.9.2.html">7.9.2 release notes</A>
|
||||
|
@@ -390,20 +390,6 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOK) (EGLDisplay dpy, EG
|
||||
#define EGL_Y_INVERTED_NOK 0x307F
|
||||
#endif /* EGL_NOK_texture_from_pixmap */
|
||||
|
||||
#ifndef EGL_ANDROID_image_native_buffer
|
||||
#define EGL_ANDROID_image_native_buffer 1
|
||||
struct android_native_buffer_t;
|
||||
#define EGL_NATIVE_BUFFER_ANDROID 0x3140 /* eglCreateImageKHR target */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_ANDROID_swap_rectangle
|
||||
#define EGL_ANDROID_swap_rectangle 1
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSetSwapRectangleANDROID (EGLDisplay dpy, EGLSurface draw, EGLint left, EGLint top, EGLint width, EGLint height);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSWAPRECTANGLEANDROIDPROC) (EGLDisplay dpy, EGLSurface draw, EGLint left, EGLint top, EGLint width, EGLint height);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -84,15 +84,6 @@ typedef struct wl_egl_display *EGLNativeDisplayType;
|
||||
typedef struct wl_egl_pixmap *EGLNativePixmapType;
|
||||
typedef struct wl_egl_window *EGLNativeWindowType;
|
||||
|
||||
#elif defined(ANDROID) /* Android */
|
||||
|
||||
struct android_native_window_t;
|
||||
struct egl_native_pixmap_t;
|
||||
|
||||
typedef struct android_native_window_t* EGLNativeWindowType;
|
||||
typedef struct egl_native_pixmap_t* EGLNativePixmapType;
|
||||
typedef void* EGLNativeDisplayType;
|
||||
|
||||
#elif defined(__unix__) || defined(__unix)
|
||||
|
||||
#ifdef MESA_EGL_NO_X11_HEADERS
|
||||
|
@@ -655,6 +655,8 @@ typedef double GLclampd; /* double precision float in [0,1] */
|
||||
#define GL_TEXTURE_ENV_COLOR 0x2201
|
||||
#define GL_TEXTURE_GEN_S 0x0C60
|
||||
#define GL_TEXTURE_GEN_T 0x0C61
|
||||
#define GL_TEXTURE_GEN_R 0x0C62
|
||||
#define GL_TEXTURE_GEN_Q 0x0C63
|
||||
#define GL_TEXTURE_GEN_MODE 0x2500
|
||||
#define GL_TEXTURE_BORDER_COLOR 0x1004
|
||||
#define GL_TEXTURE_WIDTH 0x1000
|
||||
@@ -685,8 +687,6 @@ typedef double GLclampd; /* double precision float in [0,1] */
|
||||
#define GL_T 0x2001
|
||||
#define GL_R 0x2002
|
||||
#define GL_Q 0x2003
|
||||
#define GL_TEXTURE_GEN_R 0x0C62
|
||||
#define GL_TEXTURE_GEN_Q 0x0C63
|
||||
|
||||
/* Utility */
|
||||
#define GL_VENDOR 0x1F00
|
||||
|
@@ -813,7 +813,6 @@ struct __DRIdri2ExtensionRec {
|
||||
#define __DRI_IMAGE_FORMAT_RGB565 0x1001
|
||||
#define __DRI_IMAGE_FORMAT_XRGB8888 0x1002
|
||||
#define __DRI_IMAGE_FORMAT_ARGB8888 0x1003
|
||||
#define __DRI_IMAGE_FORMAT_RGBA8888_REV 0x1004
|
||||
|
||||
#define __DRI_IMAGE_USE_SHARE 0x0001
|
||||
#define __DRI_IMAGE_USE_SCANOUT 0x0002
|
||||
|
@@ -1,72 +0,0 @@
|
||||
"""gallium
|
||||
|
||||
Frontend-tool for Gallium3D architecture.
|
||||
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sub license, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice (including the
|
||||
# next paragraph) shall be included in all copies or substantial portions
|
||||
# of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
# IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
|
||||
import sys
|
||||
import distutils.sysconfig
|
||||
import os.path
|
||||
|
||||
|
||||
def generate(env):
|
||||
# See http://www.scons.org/wiki/PythonExtensions
|
||||
|
||||
if sys.platform in ['win32']:
|
||||
python_root = sys.prefix
|
||||
python_version = '%u%u' % sys.version_info[:2]
|
||||
python_include = os.path.join(python_root, 'include')
|
||||
python_libs = os.path.join(python_root, 'libs')
|
||||
python_lib = os.path.join(python_libs, 'python' + python_version + '.lib')
|
||||
|
||||
env.Append(CPPPATH = [python_include])
|
||||
env.Append(LIBPATH = [python_libs])
|
||||
env.Append(LIBS = ['python' + python_version + '.lib'])
|
||||
env.Replace(SHLIBPREFIX = '')
|
||||
env.Replace(SHLIBSUFFIX = '.pyd')
|
||||
|
||||
# XXX; python25_d.lib is not included in Python for windows, and
|
||||
# we'll get missing symbols unless we undefine _DEBUG
|
||||
cppdefines = env['CPPDEFINES']
|
||||
cppdefines = [define for define in cppdefines if define != '_DEBUG']
|
||||
env.Replace(CPPDEFINES = cppdefines)
|
||||
env.AppendUnique(CPPFLAGS = ['/U_DEBUG'])
|
||||
env.AppendUnique(LINKFLAGS = ['/nodefaultlib:python25_d.lib'])
|
||||
else:
|
||||
#env.ParseConfig('python-config --cflags --ldflags --libs')
|
||||
env.AppendUnique(CPPPATH = [distutils.sysconfig.get_python_inc()])
|
||||
env.Replace(SHLIBPREFIX = '')
|
||||
env.Replace(SHLIBSUFFIX = distutils.sysconfig.get_config_vars()['SO'])
|
||||
|
||||
# for debugging
|
||||
#print env.Dump()
|
||||
|
||||
|
||||
def exists(env):
|
||||
return 1
|
115
src/Android.mk
115
src/Android.mk
@@ -1,115 +0,0 @@
|
||||
# Either one of, or both of, MESA_BUILD_CLASSIC and MESA_BUILD_GALLIUM must be
|
||||
# set. When MESA_BUILD_GALLIUM is not set, EGL consists of
|
||||
#
|
||||
# libmesa_classic_egl
|
||||
# libmesa_egl
|
||||
#
|
||||
# and the rules for it can be found in egl/drivers/android/Android.mk.
|
||||
#
|
||||
# When MESA_BUILD_GALLIUM is set, EGL consists of
|
||||
#
|
||||
# libmesa_st_egl
|
||||
# libmesa_egl
|
||||
# libmesa_st_mesa
|
||||
# libmesa_pipe_<DRIVER>
|
||||
# libmesa_winsys_<DRIVER>
|
||||
# libmesa_gallium
|
||||
# <plus libmesa_classic_egl if MESA_BUILD_CLASSIC is also set>
|
||||
#
|
||||
# and the rules for it can be found in gallium/targets/Android.mk
|
||||
#
|
||||
# When MESA_BUILD_CLASSIC is set, DRI drivers are created. A DRI driver
|
||||
# consists of
|
||||
#
|
||||
# libmesa_classic_mesa
|
||||
# libmesa_glsl
|
||||
# <driver-specific objects>
|
||||
#
|
||||
# and the rules for it can be found in mesa/drivers/Android.mk.
|
||||
#
|
||||
# As for gralloc, the goal is to provide a single module that is able to
|
||||
# detect and support the hardware. This is not the case yet though.
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
# DRI drivers
|
||||
MESA_BUILD_CLASSIC := false
|
||||
MESA_BUILD_I915C := false
|
||||
MESA_BUILD_I965C := false
|
||||
|
||||
# Gallium drivers
|
||||
MESA_BUILD_GALLIUM := false
|
||||
MESA_BUILD_I915G := false
|
||||
MESA_BUILD_R600G := false
|
||||
MESA_BUILD_SWRAST := false
|
||||
|
||||
# gralloc modules
|
||||
MESA_BUILD_INTEL := false
|
||||
MESA_BUILD_RADEON := false
|
||||
MESA_BUILD_VMWGFX := false
|
||||
|
||||
MESA_DO_BUILD := false
|
||||
|
||||
ifeq ($(strip $(BOARD_USES_I915C)),true)
|
||||
MESA_BUILD_CLASSIC := true
|
||||
MESA_BUILD_I915C := true
|
||||
# gralloc
|
||||
MESA_BUILD_INTEL := true
|
||||
|
||||
MESA_DO_BUILD := true
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(BOARD_USES_I915G)),true)
|
||||
MESA_BUILD_GALLIUM := true
|
||||
MESA_BUILD_I915G := true
|
||||
# gralloc
|
||||
MESA_BUILD_INTEL := true
|
||||
|
||||
MESA_DO_BUILD := true
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(BOARD_USES_I965C)),true)
|
||||
MESA_BUILD_CLASSIC := true
|
||||
MESA_BUILD_I965C := true
|
||||
# gralloc
|
||||
MESA_BUILD_INTEL := true
|
||||
|
||||
MESA_DO_BUILD := true
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(BOARD_USES_R600G)),true)
|
||||
MESA_BUILD_GALLIUM := true
|
||||
MESA_BUILD_R600G := true
|
||||
# gralloc
|
||||
MESA_BUILD_RADEON := true
|
||||
|
||||
MESA_DO_BUILD := true
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(BOARD_USES_VMWGFX)),true)
|
||||
MESA_BUILD_GALLIUM := true
|
||||
MESA_BUILD_SWRAST := true
|
||||
# gralloc
|
||||
MESA_BUILD_VMWGFX := true
|
||||
|
||||
MESA_DO_BUILD := true
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(MESA_DO_BUILD)),true)
|
||||
|
||||
# build the real modules
|
||||
include $(call all-subdir-makefiles)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
symlink := $(TARGET_OUT_SHARED_LIBRARIES)/hw/gralloc.$(TARGET_PRODUCT)$(TARGET_SHLIB_SUFFIX)
|
||||
symlink_to := gralloc.mesa$(TARGET_SHLIB_SUFFIX)
|
||||
$(symlink): PRIVATE_TO := $(symlink_to)
|
||||
$(symlink): $(TARGET_OUT_SHARED_LIBRARIES)/hw/$(symlink_to)
|
||||
@echo "Symlink: $@ -> $(PRIVATE_TO)"
|
||||
@mkdir -p $(dir $@)
|
||||
@rm -rf $@
|
||||
$(hide) ln -sf $(PRIVATE_TO) $@
|
||||
ALL_PREBUILT += $(symlink)
|
||||
|
||||
endif # MESA_DO_BUILD
|
@@ -1,111 +0,0 @@
|
||||
# Android.mk for EGL
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
# from main/Makefile
|
||||
SOURCES = \
|
||||
eglapi.c \
|
||||
eglarray.c \
|
||||
eglconfig.c \
|
||||
eglcontext.c \
|
||||
eglcurrent.c \
|
||||
egldisplay.c \
|
||||
egldriver.c \
|
||||
eglfallbacks.c \
|
||||
eglglobals.c \
|
||||
eglimage.c \
|
||||
egllog.c \
|
||||
eglmisc.c \
|
||||
eglmode.c \
|
||||
eglscreen.c \
|
||||
eglstring.c \
|
||||
eglsurface.c \
|
||||
eglsync.c
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(addprefix main/, $(SOURCES))
|
||||
|
||||
LOCAL_CFLAGS := \
|
||||
-DPTHREADS \
|
||||
-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_ANDROID \
|
||||
-D_EGL_DRIVER_SEARCH_DIR=\"/system/lib/egl\" \
|
||||
-D_EGL_OS_UNIX=1 \
|
||||
-fvisibility=hidden \
|
||||
-Wno-sign-compare
|
||||
|
||||
ifeq ($(strip $(MESA_BUILD_CLASSIC)),true)
|
||||
LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_ANDROID
|
||||
endif
|
||||
ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
|
||||
LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_GALLIUM
|
||||
endif
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
external/mesa/include
|
||||
|
||||
LOCAL_MODULE := libmesa_egl
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
ifeq ($(strip $(MESA_BUILD_CLASSIC)),true)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
drivers/android/egl_android.c \
|
||||
drivers/android/droid.c \
|
||||
drivers/android/droid_core.c \
|
||||
drivers/android/droid_image.c
|
||||
|
||||
LOCAL_CFLAGS := \
|
||||
-D_EGL_MAIN=_eglBuiltInDriverANDROID \
|
||||
-DDEFAULT_DRIVER_DIR=\"/system/lib/dri\" \
|
||||
-DPTHREADS \
|
||||
-fvisibility=hidden \
|
||||
-Wno-sign-compare
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
external/mesa/include \
|
||||
external/mesa/src/mapi \
|
||||
external/mesa/src/egl/main \
|
||||
external/mesa/src/gralloc \
|
||||
external/drm \
|
||||
external/drm/include/drm \
|
||||
external/mesa/src/mesa/drivers \
|
||||
external/mesa/src/gallium/include \
|
||||
external/mesa/src/gallium/winsys
|
||||
|
||||
LOCAL_MODULE := libmesa_classic_egl
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
# build libGLES if gallium is not enabled
|
||||
ifneq ($(strip $(MESA_BUILD_GALLIUM)),true)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES :=
|
||||
LOCAL_CFLAGS :=
|
||||
LOCAL_C_INCLUDES :=
|
||||
|
||||
LOCAL_STATIC_LIBRARIES :=
|
||||
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := \
|
||||
libmesa_classic_egl \
|
||||
libmesa_egl
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libglapi \
|
||||
libdrm \
|
||||
libdl \
|
||||
libhardware \
|
||||
liblog \
|
||||
libcutils
|
||||
|
||||
LOCAL_MODULE := libGLES_mesa
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
endif # MESA_BUILD_GALLIUM
|
||||
|
||||
endif # MESA_BUILD_CLASSIC
|
@@ -1,762 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Kristian Høgsberg <krh@bitplanet.net>
|
||||
*/
|
||||
|
||||
#define LOG_TAG "MESA-EGL"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <dlfcn.h>
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include "droid.h"
|
||||
|
||||
static const __DRIuseInvalidateExtension use_invalidate = {
|
||||
{ __DRI_USE_INVALIDATE, 1 }
|
||||
};
|
||||
|
||||
static __DRIimage *
|
||||
droid_lookup_egl_image(__DRIscreen *screen, void *image, void *data)
|
||||
{
|
||||
_EGLDisplay *disp = data;
|
||||
struct droid_egl_image *dimg;
|
||||
_EGLImage *img;
|
||||
|
||||
(void) screen;
|
||||
|
||||
img = _eglLookupImage(image, disp);
|
||||
if (img == NULL) {
|
||||
_eglError(EGL_BAD_PARAMETER, "droid_lookup_egl_image");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dimg = droid_egl_image(image);
|
||||
|
||||
return dimg->dri_image;
|
||||
}
|
||||
|
||||
static const __DRIimageLookupExtension image_lookup_extension = {
|
||||
{ __DRI_IMAGE_LOOKUP, 1 },
|
||||
droid_lookup_egl_image
|
||||
};
|
||||
|
||||
static int
|
||||
get_format_bpp(int native)
|
||||
{
|
||||
int bpp;
|
||||
|
||||
/* see libpixelflinger/format.cpp */
|
||||
switch (native) {
|
||||
case GGL_PIXEL_FORMAT_RGBA_8888:
|
||||
case GGL_PIXEL_FORMAT_RGBX_8888:
|
||||
case GGL_PIXEL_FORMAT_BGRA_8888:
|
||||
bpp = 4;
|
||||
break;
|
||||
case GGL_PIXEL_FORMAT_RGB_888:
|
||||
bpp = 3;
|
||||
break;
|
||||
case GGL_PIXEL_FORMAT_RGB_565:
|
||||
case GGL_PIXEL_FORMAT_RGBA_5551:
|
||||
case GGL_PIXEL_FORMAT_RGBA_4444:
|
||||
case GGL_PIXEL_FORMAT_LA_88:
|
||||
bpp = 2;
|
||||
break;
|
||||
case GGL_PIXEL_FORMAT_RGB_332:
|
||||
case GGL_PIXEL_FORMAT_A_8:
|
||||
case GGL_PIXEL_FORMAT_L_8:
|
||||
bpp = 1;
|
||||
break;
|
||||
default:
|
||||
bpp = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return bpp;
|
||||
}
|
||||
|
||||
#include <gralloc_gem.h>
|
||||
int
|
||||
get_native_buffer_name(struct android_native_buffer_t *buf)
|
||||
{
|
||||
struct drm_bo_t *bo;
|
||||
|
||||
bo = drm_gem_get(buf->handle);
|
||||
|
||||
return (bo) ? bo->name : 0;
|
||||
}
|
||||
|
||||
EGLBoolean
|
||||
droid_dequeue_buffer(struct droid_egl_surface *dsurf)
|
||||
{
|
||||
__DRIbuffer *buf = &dsurf->dri_buffer;
|
||||
|
||||
if (dsurf->window->dequeueBuffer(dsurf->window, &dsurf->buffer))
|
||||
return EGL_FALSE;
|
||||
|
||||
dsurf->buffer->common.incRef(&dsurf->buffer->common);
|
||||
dsurf->window->lockBuffer(dsurf->window, dsurf->buffer);
|
||||
|
||||
buf->attachment = __DRI_BUFFER_FAKE_FRONT_LEFT;
|
||||
buf->name = get_native_buffer_name(dsurf->buffer);
|
||||
buf->cpp = get_format_bpp(dsurf->buffer->format);
|
||||
buf->pitch = dsurf->buffer->stride * buf->cpp;
|
||||
buf->flags = 0;
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean
|
||||
droid_enqueue_buffer(struct droid_egl_surface *dsurf)
|
||||
{
|
||||
dsurf->window->queueBuffer(dsurf->window, dsurf->buffer);
|
||||
|
||||
dsurf->buffer->common.decRef(&dsurf->buffer->common);
|
||||
dsurf->buffer = NULL;
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
droid_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
|
||||
{
|
||||
}
|
||||
|
||||
static __DRIbuffer *
|
||||
droid_get_buffers_with_format(__DRIdrawable * driDrawable,
|
||||
int *width, int *height,
|
||||
unsigned int *attachments, int count,
|
||||
int *out_count, void *loaderPrivate)
|
||||
{
|
||||
struct droid_egl_surface *dsurf = loaderPrivate;
|
||||
struct droid_egl_display *ddpy =
|
||||
droid_egl_display(dsurf->base.Resource.Display);
|
||||
|
||||
if (!dsurf->buffer) {
|
||||
if (!droid_dequeue_buffer(dsurf))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dsurf->base.Width = dsurf->buffer->width;
|
||||
dsurf->base.Height = dsurf->buffer->height;
|
||||
|
||||
if (width)
|
||||
*width = dsurf->buffer->width;
|
||||
if (height)
|
||||
*height = dsurf->buffer->height;
|
||||
|
||||
*out_count = 1;
|
||||
|
||||
return &dsurf->dri_buffer;
|
||||
}
|
||||
|
||||
static const EGLint droid_to_egl_attribute_map[] = {
|
||||
0,
|
||||
EGL_BUFFER_SIZE, /* __DRI_ATTRIB_BUFFER_SIZE */
|
||||
EGL_LEVEL, /* __DRI_ATTRIB_LEVEL */
|
||||
EGL_RED_SIZE, /* __DRI_ATTRIB_RED_SIZE */
|
||||
EGL_GREEN_SIZE, /* __DRI_ATTRIB_GREEN_SIZE */
|
||||
EGL_BLUE_SIZE, /* __DRI_ATTRIB_BLUE_SIZE */
|
||||
EGL_LUMINANCE_SIZE, /* __DRI_ATTRIB_LUMINANCE_SIZE */
|
||||
EGL_ALPHA_SIZE, /* __DRI_ATTRIB_ALPHA_SIZE */
|
||||
0, /* __DRI_ATTRIB_ALPHA_MASK_SIZE */
|
||||
EGL_DEPTH_SIZE, /* __DRI_ATTRIB_DEPTH_SIZE */
|
||||
EGL_STENCIL_SIZE, /* __DRI_ATTRIB_STENCIL_SIZE */
|
||||
0, /* __DRI_ATTRIB_ACCUM_RED_SIZE */
|
||||
0, /* __DRI_ATTRIB_ACCUM_GREEN_SIZE */
|
||||
0, /* __DRI_ATTRIB_ACCUM_BLUE_SIZE */
|
||||
0, /* __DRI_ATTRIB_ACCUM_ALPHA_SIZE */
|
||||
EGL_SAMPLE_BUFFERS, /* __DRI_ATTRIB_SAMPLE_BUFFERS */
|
||||
EGL_SAMPLES, /* __DRI_ATTRIB_SAMPLES */
|
||||
0, /* __DRI_ATTRIB_RENDER_TYPE, */
|
||||
0, /* __DRI_ATTRIB_CONFIG_CAVEAT */
|
||||
0, /* __DRI_ATTRIB_CONFORMANT */
|
||||
0, /* __DRI_ATTRIB_DOUBLE_BUFFER */
|
||||
0, /* __DRI_ATTRIB_STEREO */
|
||||
0, /* __DRI_ATTRIB_AUX_BUFFERS */
|
||||
0, /* __DRI_ATTRIB_TRANSPARENT_TYPE */
|
||||
0, /* __DRI_ATTRIB_TRANSPARENT_INDEX_VALUE */
|
||||
0, /* __DRI_ATTRIB_TRANSPARENT_RED_VALUE */
|
||||
0, /* __DRI_ATTRIB_TRANSPARENT_GREEN_VALUE */
|
||||
0, /* __DRI_ATTRIB_TRANSPARENT_BLUE_VALUE */
|
||||
0, /* __DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE */
|
||||
0, /* __DRI_ATTRIB_FLOAT_MODE */
|
||||
0, /* __DRI_ATTRIB_RED_MASK */
|
||||
0, /* __DRI_ATTRIB_GREEN_MASK */
|
||||
0, /* __DRI_ATTRIB_BLUE_MASK */
|
||||
0, /* __DRI_ATTRIB_ALPHA_MASK */
|
||||
EGL_MAX_PBUFFER_WIDTH, /* __DRI_ATTRIB_MAX_PBUFFER_WIDTH */
|
||||
EGL_MAX_PBUFFER_HEIGHT, /* __DRI_ATTRIB_MAX_PBUFFER_HEIGHT */
|
||||
EGL_MAX_PBUFFER_PIXELS, /* __DRI_ATTRIB_MAX_PBUFFER_PIXELS */
|
||||
0, /* __DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH */
|
||||
0, /* __DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT */
|
||||
0, /* __DRI_ATTRIB_VISUAL_SELECT_GROUP */
|
||||
0, /* __DRI_ATTRIB_SWAP_METHOD */
|
||||
EGL_MAX_SWAP_INTERVAL, /* __DRI_ATTRIB_MAX_SWAP_INTERVAL */
|
||||
EGL_MIN_SWAP_INTERVAL, /* __DRI_ATTRIB_MIN_SWAP_INTERVAL */
|
||||
0, /* __DRI_ATTRIB_BIND_TO_TEXTURE_RGB */
|
||||
0, /* __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA */
|
||||
0, /* __DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE */
|
||||
0, /* __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS */
|
||||
EGL_Y_INVERTED_NOK, /* __DRI_ATTRIB_YINVERTED */
|
||||
0, /* __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE */
|
||||
};
|
||||
|
||||
static struct droid_egl_config *
|
||||
droid_add_config(_EGLDisplay *dpy, const __DRIconfig *dri_config, int id,
|
||||
int depth, EGLint surface_type, int rgba_masks[4])
|
||||
{
|
||||
struct droid_egl_config *conf;
|
||||
struct droid_egl_display *ddpy;
|
||||
_EGLConfig base;
|
||||
unsigned int attrib, value, double_buffer;
|
||||
EGLint key;
|
||||
int dri_masks[4] = { 0, 0, 0, 0 };
|
||||
int i;
|
||||
|
||||
ddpy = dpy->DriverData;
|
||||
_eglInitConfig(&base, dpy, id);
|
||||
|
||||
i = 0;
|
||||
double_buffer = 0;
|
||||
|
||||
while (ddpy->core->indexConfigAttrib(dri_config, i++, &attrib, &value)) {
|
||||
switch (attrib) {
|
||||
case __DRI_ATTRIB_RENDER_TYPE:
|
||||
if (value & __DRI_ATTRIB_RGBA_BIT)
|
||||
value = EGL_RGB_BUFFER;
|
||||
else if (value & __DRI_ATTRIB_LUMINANCE_BIT)
|
||||
value = EGL_LUMINANCE_BUFFER;
|
||||
else
|
||||
assert(0);
|
||||
_eglSetConfigKey(&base, EGL_COLOR_BUFFER_TYPE, value);
|
||||
break;
|
||||
|
||||
case __DRI_ATTRIB_CONFIG_CAVEAT:
|
||||
if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
|
||||
value = EGL_NON_CONFORMANT_CONFIG;
|
||||
else if (value & __DRI_ATTRIB_SLOW_BIT)
|
||||
value = EGL_SLOW_CONFIG;
|
||||
else
|
||||
value = EGL_NONE;
|
||||
_eglSetConfigKey(&base, EGL_CONFIG_CAVEAT, value);
|
||||
break;
|
||||
|
||||
case __DRI_ATTRIB_DOUBLE_BUFFER:
|
||||
double_buffer = value;
|
||||
break;
|
||||
|
||||
case __DRI_ATTRIB_RED_MASK:
|
||||
dri_masks[0] = value;
|
||||
break;
|
||||
|
||||
case __DRI_ATTRIB_GREEN_MASK:
|
||||
dri_masks[1] = value;
|
||||
break;
|
||||
|
||||
case __DRI_ATTRIB_BLUE_MASK:
|
||||
dri_masks[2] = value;
|
||||
break;
|
||||
|
||||
case __DRI_ATTRIB_ALPHA_MASK:
|
||||
dri_masks[3] = value;
|
||||
break;
|
||||
|
||||
default:
|
||||
key = droid_to_egl_attribute_map[attrib];
|
||||
if (key != 0)
|
||||
_eglSetConfigKey(&base, key, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* In EGL, double buffer or not isn't a config attribute. Pixmaps
|
||||
* surfaces are always single buffered, pbuffer surfaces are always
|
||||
* back buffers and windows can be either, selected by passing an
|
||||
* attribute at window surface construction time. To support this
|
||||
* we ignore all double buffer configs and manipulate the buffer we
|
||||
* return in the getBuffer callback to get the behaviour we want. */
|
||||
|
||||
if (double_buffer)
|
||||
return NULL;
|
||||
|
||||
if (depth > 0 && depth != _eglGetConfigKey(&base, EGL_BUFFER_SIZE))
|
||||
return NULL;
|
||||
|
||||
if (memcmp(dri_masks, rgba_masks, sizeof(rgba_masks)))
|
||||
return NULL;
|
||||
|
||||
_eglSetConfigKey(&base, EGL_NATIVE_RENDERABLE, EGL_TRUE);
|
||||
|
||||
_eglSetConfigKey(&base, EGL_SURFACE_TYPE, surface_type);
|
||||
|
||||
_eglSetConfigKey(&base, EGL_RENDERABLE_TYPE, dpy->ClientAPIs);
|
||||
_eglSetConfigKey(&base, EGL_CONFORMANT, dpy->ClientAPIs);
|
||||
|
||||
if (!_eglValidateConfig(&base, EGL_FALSE)) {
|
||||
_eglLog(_EGL_DEBUG, "DRI2: failed to validate config %d", id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
conf = calloc(1, sizeof(*conf));
|
||||
if (conf != NULL) {
|
||||
memcpy(&conf->base, &base, sizeof(base));
|
||||
conf->dri_config = dri_config;
|
||||
_eglLinkConfig(&conf->base);
|
||||
}
|
||||
|
||||
return conf;
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
|
||||
{
|
||||
struct droid_egl_display *ddpy = droid_egl_display(dpy);
|
||||
const struct {
|
||||
int format;
|
||||
int size;
|
||||
int rgba_masks[4];
|
||||
} visuals[] = {
|
||||
{ GGL_PIXEL_FORMAT_RGBA_8888, 32, { 0xff, 0xff00, 0xff0000, 0xff000000 } },
|
||||
{ GGL_PIXEL_FORMAT_RGBX_8888, 32, { 0xff, 0xff00, 0xff0000, 0x0 } },
|
||||
{ GGL_PIXEL_FORMAT_RGB_888, 24, { 0xff, 0xff00, 0xff0000, 0x0 } },
|
||||
{ GGL_PIXEL_FORMAT_RGB_565, 16, { 0xf800, 0x7e0, 0x1f, 0x0 } },
|
||||
{ GGL_PIXEL_FORMAT_BGRA_8888, 32, { 0xff0000, 0xff00, 0xff, 0xff000000 } },
|
||||
{ GGL_PIXEL_FORMAT_A_8, 8, { 0xf800, 0x7e0, 0x1f, 0x0 } },
|
||||
{ 0, 0, { 0, 0, 0, 0 } }
|
||||
};
|
||||
int count, i, j;
|
||||
|
||||
count = 0;
|
||||
for (i = 0; visuals[i].format; i++) {
|
||||
int format_count = 0;
|
||||
|
||||
for (j = 0; ddpy->dri_configs[j]; j++) {
|
||||
struct droid_egl_config *dconf;
|
||||
|
||||
dconf = droid_add_config(dpy, ddpy->dri_configs[j], count + 1,
|
||||
visuals[i].size, EGL_WINDOW_BIT, visuals[i].rgba_masks);
|
||||
if (dconf) {
|
||||
_eglSetConfigKey(&dconf->base,
|
||||
EGL_NATIVE_VISUAL_TYPE, visuals[i].format);
|
||||
count++;
|
||||
format_count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!format_count) {
|
||||
_eglLog(_EGL_DEBUG, "No DRI config supports native format 0x%x",
|
||||
visuals[i].format);
|
||||
}
|
||||
}
|
||||
|
||||
return (count != 0);
|
||||
}
|
||||
|
||||
struct droid_extension_match {
|
||||
const char *name;
|
||||
int version;
|
||||
int offset;
|
||||
};
|
||||
|
||||
static struct droid_extension_match droid_driver_extensions[] = {
|
||||
{ __DRI_CORE, 1, offsetof(struct droid_egl_display, core) },
|
||||
{ __DRI_DRI2, 1, offsetof(struct droid_egl_display, dri2) },
|
||||
{ NULL, 0, 0 }
|
||||
};
|
||||
|
||||
static struct droid_extension_match droid_core_extensions[] = {
|
||||
{ __DRI2_FLUSH, 1, offsetof(struct droid_egl_display, flush) },
|
||||
{ __DRI_IMAGE, 1, offsetof(struct droid_egl_display, image) },
|
||||
{ NULL, 0, 0 }
|
||||
};
|
||||
|
||||
extern const __DRIextension *__driDriverExtensions[];
|
||||
|
||||
static EGLBoolean
|
||||
droid_bind_extensions(struct droid_egl_display *ddpy,
|
||||
struct droid_extension_match *matches,
|
||||
const __DRIextension **extensions)
|
||||
{
|
||||
int i, j, ret = EGL_TRUE;
|
||||
void *field;
|
||||
|
||||
for (i = 0; extensions[i]; i++) {
|
||||
_eglLog(_EGL_DEBUG, "DRI2: found extension `%s'", extensions[i]->name);
|
||||
for (j = 0; matches[j].name; j++) {
|
||||
if (strcmp(extensions[i]->name, matches[j].name) == 0 &&
|
||||
extensions[i]->version >= matches[j].version) {
|
||||
field = ((char *) ddpy + matches[j].offset);
|
||||
*(const __DRIextension **) field = extensions[i];
|
||||
_eglLog(_EGL_INFO, "DRI2: found extension %s version %d",
|
||||
extensions[i]->name, extensions[i]->version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; matches[j].name; j++) {
|
||||
field = ((char *) ddpy + matches[j].offset);
|
||||
if (*(const __DRIextension **) field == NULL) {
|
||||
_eglLog(_EGL_FATAL, "DRI2: did not find extension %s version %d",
|
||||
matches[j].name, matches[j].version);
|
||||
ret = EGL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
droid_create_screen(_EGLDisplay *dpy)
|
||||
{
|
||||
struct droid_egl_display *ddpy = droid_egl_display(dpy);
|
||||
const __DRIextension **extensions;
|
||||
unsigned int api_mask;
|
||||
|
||||
ddpy->dri_screen =
|
||||
ddpy->dri2->createNewScreen(0, ddpy->fd, ddpy->extensions,
|
||||
&ddpy->dri_configs, dpy);
|
||||
if (ddpy->dri_screen == NULL) {
|
||||
_eglLog(_EGL_WARNING, "failed to create dri screen");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
extensions = ddpy->core->getExtensions(ddpy->dri_screen);
|
||||
if (!droid_bind_extensions(ddpy, droid_core_extensions, extensions)) {
|
||||
ddpy->core->destroyScreen(ddpy->dri_screen);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
if (ddpy->dri2->base.version >= 2)
|
||||
api_mask = ddpy->dri2->getAPIMask(ddpy->dri_screen);
|
||||
else
|
||||
api_mask = 1 << __DRI_API_OPENGL;
|
||||
|
||||
dpy->ClientAPIs = 0;
|
||||
if (api_mask & (1 <<__DRI_API_OPENGL))
|
||||
dpy->ClientAPIs |= EGL_OPENGL_BIT;
|
||||
if (api_mask & (1 <<__DRI_API_GLES))
|
||||
dpy->ClientAPIs |= EGL_OPENGL_ES_BIT;
|
||||
if (api_mask & (1 << __DRI_API_GLES2))
|
||||
dpy->ClientAPIs |= EGL_OPENGL_ES2_BIT;
|
||||
|
||||
if (ddpy->dri2->base.version >= 2) {
|
||||
dpy->Extensions.KHR_surfaceless_gles1 = EGL_TRUE;
|
||||
dpy->Extensions.KHR_surfaceless_gles2 = EGL_TRUE;
|
||||
dpy->Extensions.KHR_surfaceless_opengl = EGL_TRUE;
|
||||
}
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
droid_load_driver(_EGLDisplay *dpy, const char *driver_name)
|
||||
{
|
||||
struct droid_egl_display *ddpy = droid_egl_display(dpy);
|
||||
const __DRIextension **extensions;
|
||||
char path[PATH_MAX], *base = NULL;
|
||||
void *handle;
|
||||
|
||||
if (geteuid() == getuid()) {
|
||||
/* don't allow setuid apps to use LIBGL_DRIVERS_PATH */
|
||||
base = getenv("LIBGL_DRIVERS_PATH");
|
||||
}
|
||||
if (!base)
|
||||
base = DEFAULT_DRIVER_DIR;
|
||||
snprintf(path, sizeof(path), "%s/%s_dri.so", base, driver_name);
|
||||
|
||||
handle = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
|
||||
if (!handle) {
|
||||
_eglLog(_EGL_WARNING, "DRI2: failed to load %s: %s", path, dlerror());
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
_eglLog(_EGL_DEBUG, "DRI2: dlopen(%s)", path);
|
||||
extensions = dlsym(handle, __DRI_DRIVER_EXTENSIONS);
|
||||
if (!extensions) {
|
||||
_eglLog(_EGL_WARNING, "DRI2: driver exports no extensions");
|
||||
dlclose(handle);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
if (!droid_bind_extensions(ddpy, droid_driver_extensions, extensions)) {
|
||||
dlclose(handle);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
ddpy->dri_handle = handle;
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
#include <xf86drm.h>
|
||||
/* for i915 */
|
||||
#include <i915_drm.h>
|
||||
#include "dri/intel/intel_chipset.h"
|
||||
/* for radeon */
|
||||
#include <radeon_drm.h>
|
||||
#include "radeon/drm/radeon_drm_public.h"
|
||||
static const char *
|
||||
droid_get_driver_name(int fd)
|
||||
{
|
||||
drmVersionPtr version;
|
||||
char *name = NULL;
|
||||
|
||||
version = drmGetVersion(fd);
|
||||
if (!version) {
|
||||
_eglLog(_EGL_WARNING, "invalid drm fd");
|
||||
return NULL;
|
||||
}
|
||||
if (!version->name) {
|
||||
_eglLog(_EGL_WARNING, "unable to determine the driver name");
|
||||
drmFreeVersion(version);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (strcmp(version->name, "i915") == 0) {
|
||||
struct drm_i915_getparam gp;
|
||||
int id, ret;
|
||||
|
||||
memset(&gp, 0, sizeof(gp));
|
||||
gp.param = I915_PARAM_CHIPSET_ID;
|
||||
gp.value = &id;
|
||||
ret = drmCommandWriteRead(fd, DRM_I915_GETPARAM, &gp, sizeof(gp));
|
||||
if (ret) {
|
||||
_eglLog(_EGL_WARNING, "failed to get param for i915");
|
||||
}
|
||||
else {
|
||||
name = (IS_965(id)) ? "i965" : "i915";
|
||||
}
|
||||
}
|
||||
else if (strcmp(version->name, "radeon") == 0) {
|
||||
struct drm_radeon_info info;
|
||||
int id, ret;
|
||||
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.request = RADEON_INFO_DEVICE_ID;
|
||||
info.value = (long) &id;
|
||||
ret = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info));
|
||||
if (ret) {
|
||||
_eglLog(_EGL_WARNING, "failed to get info for radeon");
|
||||
}
|
||||
else {
|
||||
name = (is_r3xx(id)) ? "r300" : "r600";
|
||||
}
|
||||
}
|
||||
|
||||
drmFreeVersion(version);
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
static int
|
||||
droid_open_device(void)
|
||||
{
|
||||
const hw_module_t *mod;
|
||||
int fd = -1, err;
|
||||
|
||||
err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &mod);
|
||||
if (!err) {
|
||||
const gralloc_module_t *gr = (gralloc_module_t *) mod;
|
||||
|
||||
err = -EINVAL;
|
||||
if (gr->perform)
|
||||
err = gr->perform(gr, GRALLOC_MODULE_PERFORM_GET_DRM_FD, &fd);
|
||||
}
|
||||
if (err || fd < 0) {
|
||||
_eglLog(_EGL_WARNING, "fail to get drm fd");
|
||||
fd = -1;
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
droid_initialize_android(_EGLDriver *drv, _EGLDisplay *dpy)
|
||||
{
|
||||
struct droid_egl_display *ddpy;
|
||||
const char *driver_name;
|
||||
int fd;
|
||||
|
||||
fd = droid_open_device();
|
||||
if (fd < 0)
|
||||
return EGL_FALSE;
|
||||
driver_name = droid_get_driver_name(fd);
|
||||
if (!driver_name)
|
||||
return EGL_FALSE;
|
||||
|
||||
ddpy = calloc(1, sizeof(*ddpy));
|
||||
if (!ddpy)
|
||||
return _eglError(EGL_BAD_ALLOC, "eglInitialize");
|
||||
|
||||
ddpy->fd = fd;
|
||||
dpy->DriverData = (void *) ddpy;
|
||||
|
||||
if (!droid_load_driver(dpy, driver_name))
|
||||
return EGL_FALSE;
|
||||
|
||||
ddpy->loader_extension.base.name = __DRI_DRI2_LOADER;
|
||||
ddpy->loader_extension.base.version = 3;
|
||||
ddpy->loader_extension.getBuffers = NULL;
|
||||
ddpy->loader_extension.flushFrontBuffer = droid_flush_front_buffer;
|
||||
ddpy->loader_extension.getBuffersWithFormat =
|
||||
droid_get_buffers_with_format;
|
||||
|
||||
ddpy->extensions[0] = &ddpy->loader_extension.base;
|
||||
ddpy->extensions[1] = &image_lookup_extension.base;
|
||||
ddpy->extensions[2] = &use_invalidate.base;
|
||||
ddpy->extensions[3] = NULL;
|
||||
|
||||
if (!droid_create_screen(dpy)) {
|
||||
free(ddpy);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
if (!droid_add_configs_for_visuals(drv, dpy)) {
|
||||
ddpy->core->destroyScreen(ddpy->dri_screen);
|
||||
free(ddpy);
|
||||
}
|
||||
|
||||
dpy->Extensions.ANDROID_image_native_buffer = EGL_TRUE;
|
||||
dpy->Extensions.KHR_image_base = EGL_TRUE;
|
||||
|
||||
/* we're supporting EGL 1.4 */
|
||||
dpy->VersionMajor = 1;
|
||||
dpy->VersionMinor = 4;
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
droid_terminate(_EGLDriver *drv, _EGLDisplay *dpy)
|
||||
{
|
||||
struct droid_egl_display *ddpy = droid_egl_display(dpy);
|
||||
|
||||
_eglReleaseDisplayResources(drv, dpy);
|
||||
_eglCleanupDisplay(dpy);
|
||||
|
||||
ddpy->core->destroyScreen(ddpy->dri_screen);
|
||||
dlclose(ddpy->dri_handle);
|
||||
free(ddpy);
|
||||
|
||||
dpy->DriverData = NULL;
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
droid_initialize(_EGLDriver *drv, _EGLDisplay *dpy)
|
||||
{
|
||||
/* not until swrast_dri is supported */
|
||||
if (dpy->Options.UseFallback)
|
||||
return EGL_FALSE;
|
||||
|
||||
switch (dpy->Platform) {
|
||||
case _EGL_PLATFORM_ANDROID:
|
||||
if (dpy->Options.TestOnly)
|
||||
return EGL_TRUE;
|
||||
return droid_initialize_android(drv, dpy);
|
||||
default:
|
||||
return EGL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static _EGLProc
|
||||
droid_get_proc_address(_EGLDriver *drv, const char *procname)
|
||||
{
|
||||
struct droid_egl_driver *ddrv = droid_egl_driver(drv);
|
||||
|
||||
return ddrv->get_proc_address(procname);
|
||||
}
|
||||
|
||||
static void
|
||||
droid_log(EGLint level, const char *msg)
|
||||
{
|
||||
switch (level) {
|
||||
case _EGL_DEBUG:
|
||||
LOGD(msg);
|
||||
break;
|
||||
case _EGL_INFO:
|
||||
LOGI(msg);
|
||||
break;
|
||||
case _EGL_WARNING:
|
||||
LOGW(msg);
|
||||
break;
|
||||
case _EGL_FATAL:
|
||||
LOG_FATAL(msg);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
droid_unload(_EGLDriver *drv)
|
||||
{
|
||||
struct droid_egl_driver *ddrv = droid_egl_driver(drv);
|
||||
|
||||
free(ddrv);
|
||||
}
|
||||
|
||||
#include "glapi/glapi.h" /* for _glapi_get_proc_address */
|
||||
static EGLBoolean
|
||||
droid_load(_EGLDriver *drv)
|
||||
{
|
||||
struct droid_egl_driver *ddrv = droid_egl_driver(drv);
|
||||
|
||||
ddrv->get_proc_address = (_EGLProc (*)(const char *)) _glapi_get_proc_address;
|
||||
|
||||
ddrv->glFlush = (void (*)(void))
|
||||
ddrv->get_proc_address("glFlush");
|
||||
ddrv->glFinish = (void (*)(void))
|
||||
ddrv->get_proc_address("glFinish");
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
_EGLDriver *
|
||||
droid_create_driver(void)
|
||||
{
|
||||
struct droid_egl_driver *ddrv;
|
||||
|
||||
ddrv = calloc(1, sizeof(*ddrv));
|
||||
if (!ddrv)
|
||||
return NULL;
|
||||
|
||||
if (!droid_load(&ddrv->base))
|
||||
return NULL;
|
||||
|
||||
_eglSetLogProc(droid_log);
|
||||
|
||||
ddrv->base.Name = "Droid";
|
||||
ddrv->base.Unload = droid_unload;
|
||||
|
||||
_eglInitDriverFallbacks(&ddrv->base);
|
||||
ddrv->base.API.Initialize = droid_initialize;
|
||||
ddrv->base.API.Terminate = droid_terminate;
|
||||
ddrv->base.API.GetProcAddress = droid_get_proc_address;
|
||||
|
||||
return &ddrv->base;
|
||||
}
|
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Kristian Høgsberg <krh@bitplanet.net>
|
||||
*/
|
||||
|
||||
#ifndef _DROID_H_
|
||||
#define _DROID_H_
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <ui/egl/android_natives.h>
|
||||
#include <ui/android_native_buffer.h>
|
||||
#include <pixelflinger/format.h>
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/internal/dri_interface.h>
|
||||
|
||||
#include "egldriver.h"
|
||||
#include "egldisplay.h"
|
||||
#include "eglcontext.h"
|
||||
#include "eglsurface.h"
|
||||
#include "eglconfig.h"
|
||||
#include "eglimage.h"
|
||||
#include "eglcurrent.h"
|
||||
#include "egllog.h"
|
||||
|
||||
struct droid_egl_driver
|
||||
{
|
||||
_EGLDriver base;
|
||||
|
||||
_EGLProc (*get_proc_address)(const char *procname);
|
||||
void (*glFlush)(void);
|
||||
void (*glFinish)(void);
|
||||
};
|
||||
|
||||
struct droid_egl_display
|
||||
{
|
||||
int fd;
|
||||
|
||||
void *dri_handle;
|
||||
|
||||
__DRIscreen *dri_screen;
|
||||
const __DRIconfig **dri_configs;
|
||||
__DRIcoreExtension *core;
|
||||
__DRIdri2Extension *dri2;
|
||||
__DRI2flushExtension *flush;
|
||||
__DRIimageExtension *image;
|
||||
|
||||
__DRIdri2LoaderExtension loader_extension;
|
||||
const __DRIextension *extensions[8];
|
||||
};
|
||||
|
||||
struct droid_egl_context
|
||||
{
|
||||
_EGLContext base;
|
||||
|
||||
__DRIcontext *dri_context;
|
||||
};
|
||||
|
||||
struct droid_egl_surface
|
||||
{
|
||||
_EGLSurface base;
|
||||
|
||||
__DRIdrawable *dri_drawable;
|
||||
__DRIbuffer dri_buffer;
|
||||
|
||||
android_native_window_t *window;
|
||||
android_native_buffer_t *buffer;
|
||||
};
|
||||
|
||||
struct droid_egl_config
|
||||
{
|
||||
_EGLConfig base;
|
||||
|
||||
const __DRIconfig *dri_config;
|
||||
};
|
||||
|
||||
struct droid_egl_image
|
||||
{
|
||||
_EGLImage base;
|
||||
|
||||
__DRIimage *dri_image;
|
||||
};
|
||||
|
||||
/* standard typecasts */
|
||||
_EGL_DRIVER_STANDARD_TYPECASTS(droid_egl)
|
||||
_EGL_DRIVER_TYPECAST(droid_egl_image, _EGLImage, obj)
|
||||
|
||||
_EGLDriver *
|
||||
droid_create_driver(void);
|
||||
|
||||
void
|
||||
droid_init_core_functions(_EGLDriver *drv);
|
||||
|
||||
void
|
||||
droid_init_image_functions(_EGLDriver *drv);
|
||||
|
||||
EGLBoolean
|
||||
droid_dequeue_buffer(struct droid_egl_surface *dsurf);
|
||||
|
||||
EGLBoolean
|
||||
droid_enqueue_buffer(struct droid_egl_surface *dsurf);
|
||||
|
||||
int
|
||||
get_native_buffer_name(struct android_native_buffer_t *buf);
|
||||
|
||||
#endif /* _DROID_H_ */
|
@@ -1,347 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Kristian Høgsberg <krh@bitplanet.net>
|
||||
*/
|
||||
|
||||
#include "droid.h"
|
||||
|
||||
static _EGLContext *
|
||||
droid_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
|
||||
_EGLContext *share_list, const EGLint *attrib_list)
|
||||
{
|
||||
struct droid_egl_context *dctx;
|
||||
struct droid_egl_display *ddpy = droid_egl_display(disp);
|
||||
struct droid_egl_context *dctx_shared = droid_egl_context(share_list);
|
||||
struct droid_egl_config *dconf = droid_egl_config(conf);
|
||||
const __DRIconfig *dri_config;
|
||||
int api;
|
||||
|
||||
(void) drv;
|
||||
|
||||
dctx = calloc(1, sizeof *dctx);
|
||||
if (!dctx) {
|
||||
_eglError(EGL_BAD_ALLOC, "eglCreateContext");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!_eglInitContext(&dctx->base, disp, conf, attrib_list))
|
||||
goto cleanup;
|
||||
|
||||
switch (dctx->base.ClientAPI) {
|
||||
case EGL_OPENGL_ES_API:
|
||||
switch (dctx->base.ClientVersion) {
|
||||
case 1:
|
||||
api = __DRI_API_GLES;
|
||||
break;
|
||||
case 2:
|
||||
api = __DRI_API_GLES2;
|
||||
break;
|
||||
default:
|
||||
_eglError(EGL_BAD_PARAMETER, "eglCreateContext");
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case EGL_OPENGL_API:
|
||||
api = __DRI_API_OPENGL;
|
||||
break;
|
||||
default:
|
||||
_eglError(EGL_BAD_PARAMETER, "eglCreateContext");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (conf != NULL)
|
||||
dri_config = dconf->dri_config;
|
||||
else
|
||||
dri_config = NULL;
|
||||
|
||||
if (ddpy->dri2->base.version >= 2) {
|
||||
dctx->dri_context =
|
||||
ddpy->dri2->createNewContextForAPI(ddpy->dri_screen,
|
||||
api,
|
||||
dri_config,
|
||||
dctx_shared ?
|
||||
dctx_shared->dri_context : NULL,
|
||||
dctx);
|
||||
} else if (api == __DRI_API_OPENGL) {
|
||||
dctx->dri_context =
|
||||
ddpy->dri2->createNewContext(ddpy->dri_screen,
|
||||
dconf->dri_config,
|
||||
dctx_shared ?
|
||||
dctx_shared->dri_context : NULL,
|
||||
dctx);
|
||||
} else {
|
||||
/* fail */
|
||||
}
|
||||
|
||||
if (!dctx->dri_context)
|
||||
goto cleanup;
|
||||
|
||||
return &dctx->base;
|
||||
|
||||
cleanup:
|
||||
free(dctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
droid_destroy_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx)
|
||||
{
|
||||
struct droid_egl_display *ddpy = droid_egl_display(disp);
|
||||
struct droid_egl_context *dctx = droid_egl_context(ctx);
|
||||
|
||||
(void) drv;
|
||||
|
||||
if (!_eglPutContext(ctx))
|
||||
return EGL_TRUE;
|
||||
|
||||
(*ddpy->core->destroyContext)(dctx->dri_context);
|
||||
|
||||
free(dctx);
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
static _EGLSurface *
|
||||
droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
|
||||
_EGLConfig *conf, EGLNativeWindowType window,
|
||||
const EGLint *attrib_list)
|
||||
{
|
||||
struct droid_egl_display *ddpy = droid_egl_display(disp);
|
||||
struct droid_egl_config *dconf = droid_egl_config(conf);
|
||||
struct droid_egl_surface *dsurf;
|
||||
int format, vis_type;
|
||||
|
||||
(void) drv;
|
||||
|
||||
if (!window || window->common.magic != ANDROID_NATIVE_WINDOW_MAGIC) {
|
||||
_eglError(EGL_BAD_NATIVE_WINDOW, "droid_create_surface");
|
||||
return NULL;
|
||||
}
|
||||
if (window->query(window, NATIVE_WINDOW_FORMAT, &format)) {
|
||||
_eglError(EGL_BAD_NATIVE_WINDOW, "droid_create_surface");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
vis_type = _eglGetConfigKey(&dconf->base, EGL_NATIVE_VISUAL_TYPE);
|
||||
if (format != vis_type) {
|
||||
_eglLog(_EGL_WARNING, "Native format mismatch: 0x%x != 0x%x",
|
||||
format, vis_type);
|
||||
}
|
||||
|
||||
dsurf = calloc(1, sizeof *dsurf);
|
||||
if (!dsurf) {
|
||||
_eglError(EGL_BAD_ALLOC, "droid_create_surface");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!_eglInitSurface(&dsurf->base, disp, type, conf, attrib_list))
|
||||
goto cleanup_surf;
|
||||
|
||||
dsurf->dri_drawable =
|
||||
(*ddpy->dri2->createNewDrawable) (ddpy->dri_screen,
|
||||
dconf->dri_config, dsurf);
|
||||
if (dsurf->dri_drawable == NULL) {
|
||||
_eglError(EGL_BAD_ALLOC, "dri2->createNewDrawable");
|
||||
goto cleanup_pixmap;
|
||||
}
|
||||
|
||||
window->common.incRef(&window->common);
|
||||
window->query(window, NATIVE_WINDOW_WIDTH, &dsurf->base.Width);
|
||||
window->query(window, NATIVE_WINDOW_HEIGHT, &dsurf->base.Height);
|
||||
|
||||
dsurf->window = window;
|
||||
|
||||
return &dsurf->base;
|
||||
|
||||
cleanup_dri_drawable:
|
||||
ddpy->core->destroyDrawable(dsurf->dri_drawable);
|
||||
cleanup_pixmap:
|
||||
cleanup_surf:
|
||||
free(dsurf);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static _EGLSurface *
|
||||
droid_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
|
||||
_EGLConfig *conf, EGLNativeWindowType window,
|
||||
const EGLint *attrib_list)
|
||||
{
|
||||
return droid_create_surface(drv, disp, EGL_WINDOW_BIT, conf,
|
||||
window, attrib_list);
|
||||
}
|
||||
|
||||
static _EGLSurface *
|
||||
droid_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *disp,
|
||||
_EGLConfig *conf, EGLNativePixmapType pixmap,
|
||||
const EGLint *attrib_list)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static _EGLSurface *
|
||||
droid_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *disp,
|
||||
_EGLConfig *conf, const EGLint *attrib_list)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
droid_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
|
||||
{
|
||||
struct droid_egl_display *ddpy = droid_egl_display(disp);
|
||||
struct droid_egl_surface *dsurf = droid_egl_surface(surf);
|
||||
|
||||
(void) drv;
|
||||
|
||||
if (!_eglPutSurface(surf))
|
||||
return EGL_TRUE;
|
||||
|
||||
(*ddpy->core->destroyDrawable)(dsurf->dri_drawable);
|
||||
|
||||
if (dsurf->buffer)
|
||||
droid_enqueue_buffer(dsurf);
|
||||
|
||||
dsurf->window->common.decRef(&dsurf->window->common);
|
||||
|
||||
free(surf);
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
droid_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
|
||||
_EGLSurface *rsurf, _EGLContext *ctx)
|
||||
{
|
||||
struct droid_egl_driver *ddrv = droid_egl_driver(drv);
|
||||
struct droid_egl_display *ddpy = droid_egl_display(disp);
|
||||
struct droid_egl_surface *droid_dsurf = droid_egl_surface(dsurf);
|
||||
struct droid_egl_surface *droid_rsurf = droid_egl_surface(rsurf);
|
||||
struct droid_egl_context *dctx = droid_egl_context(ctx);
|
||||
_EGLContext *old_ctx;
|
||||
_EGLSurface *old_dsurf, *old_rsurf;
|
||||
__DRIdrawable *ddraw, *rdraw;
|
||||
__DRIcontext *cctx;
|
||||
|
||||
/* make new bindings */
|
||||
if (!_eglBindContext(ctx, dsurf, rsurf, &old_ctx, &old_dsurf, &old_rsurf))
|
||||
return EGL_FALSE;
|
||||
|
||||
/* flush before context switch */
|
||||
if (old_ctx && ddrv->glFlush)
|
||||
ddrv->glFlush();
|
||||
|
||||
ddraw = (droid_dsurf) ? droid_dsurf->dri_drawable : NULL;
|
||||
rdraw = (droid_rsurf) ? droid_rsurf->dri_drawable : NULL;
|
||||
cctx = (dctx) ? dctx->dri_context : NULL;
|
||||
|
||||
if ((cctx == NULL && ddraw == NULL && rdraw == NULL) ||
|
||||
ddpy->core->bindContext(cctx, ddraw, rdraw)) {
|
||||
droid_destroy_surface(drv, disp, old_dsurf);
|
||||
droid_destroy_surface(drv, disp, old_rsurf);
|
||||
if (old_ctx) {
|
||||
/* unbind the old context only when there is no new context bound */
|
||||
if (!ctx) {
|
||||
__DRIcontext *old_cctx = droid_egl_context(old_ctx)->dri_context;
|
||||
ddpy->core->unbindContext(old_cctx);
|
||||
}
|
||||
droid_destroy_context(drv, disp, old_ctx);
|
||||
}
|
||||
|
||||
return EGL_TRUE;
|
||||
} else {
|
||||
/* undo the previous _eglBindContext */
|
||||
_eglBindContext(old_ctx, old_dsurf, old_rsurf, &ctx, &dsurf, &rsurf);
|
||||
assert(&dctx->base == ctx &&
|
||||
&droid_dsurf->base == dsurf &&
|
||||
&droid_rsurf->base == rsurf);
|
||||
|
||||
_eglPutSurface(dsurf);
|
||||
_eglPutSurface(rsurf);
|
||||
_eglPutContext(ctx);
|
||||
|
||||
_eglPutSurface(old_dsurf);
|
||||
_eglPutSurface(old_rsurf);
|
||||
_eglPutContext(old_ctx);
|
||||
|
||||
return EGL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
|
||||
{
|
||||
struct droid_egl_driver *ddrv = droid_egl_driver(drv);
|
||||
struct droid_egl_display *ddpy = droid_egl_display(disp);
|
||||
struct droid_egl_surface *dsurf = droid_egl_surface(draw);
|
||||
_EGLContext *ctx;
|
||||
|
||||
if (ddrv->glFlush) {
|
||||
ctx = _eglGetCurrentContext();
|
||||
if (ctx && ctx->DrawSurface == &dsurf->base)
|
||||
ddrv->glFlush();
|
||||
}
|
||||
|
||||
(*ddpy->flush->flush)(dsurf->dri_drawable);
|
||||
|
||||
if (dsurf->buffer)
|
||||
droid_enqueue_buffer(dsurf);
|
||||
|
||||
(*ddpy->flush->invalidate)(dsurf->dri_drawable);
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
droid_wait_client(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx)
|
||||
{
|
||||
struct droid_egl_driver *ddrv = droid_egl_driver(drv);
|
||||
struct droid_egl_display *ddpy = droid_egl_display(disp);
|
||||
struct droid_egl_surface *dsurf = droid_egl_surface(ctx->DrawSurface);
|
||||
|
||||
if (ddrv->glFinish)
|
||||
ddrv->glFinish();
|
||||
|
||||
if (dsurf)
|
||||
(*ddpy->flush->flush)(dsurf->dri_drawable);
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
droid_init_core_functions(_EGLDriver *drv)
|
||||
{
|
||||
struct droid_egl_driver *ddrv = droid_egl_driver(drv);
|
||||
|
||||
ddrv->base.API.CreateContext = droid_create_context;
|
||||
ddrv->base.API.DestroyContext = droid_destroy_context;
|
||||
ddrv->base.API.CreateWindowSurface = droid_create_window_surface;
|
||||
ddrv->base.API.CreatePixmapSurface = droid_create_pixmap_surface;
|
||||
ddrv->base.API.CreatePbufferSurface = droid_create_pbuffer_surface;
|
||||
ddrv->base.API.DestroySurface = droid_destroy_surface;
|
||||
ddrv->base.API.MakeCurrent = droid_make_current;
|
||||
ddrv->base.API.SwapBuffers = droid_swap_buffers;
|
||||
ddrv->base.API.WaitClient = droid_wait_client;
|
||||
}
|
@@ -1,134 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Kristian Høgsberg <krh@bitplanet.net>
|
||||
*/
|
||||
|
||||
#include "droid.h"
|
||||
|
||||
static _EGLImage *
|
||||
droid_create_image_android_native_buffer(_EGLDisplay *disp,
|
||||
EGLClientBuffer buffer)
|
||||
{
|
||||
struct droid_egl_display *ddpy = droid_egl_display(disp);
|
||||
struct android_native_buffer_t *buf =
|
||||
(struct android_native_buffer_t *) buffer;
|
||||
struct droid_egl_image *dimg;
|
||||
EGLint format, name;
|
||||
|
||||
if (!buf || buf->common.magic != ANDROID_NATIVE_BUFFER_MAGIC ||
|
||||
buf->common.version != sizeof(*buf)) {
|
||||
_eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
name = get_native_buffer_name(buf);
|
||||
if (!name) {
|
||||
_eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (buf->format) {
|
||||
case HAL_PIXEL_FORMAT_BGRA_8888:
|
||||
format = __DRI_IMAGE_FORMAT_ARGB8888;
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_RGB_565:
|
||||
format = __DRI_IMAGE_FORMAT_RGB565;
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
format = __DRI_IMAGE_FORMAT_RGBA8888_REV;
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_RGBX_8888:
|
||||
case HAL_PIXEL_FORMAT_RGB_888:
|
||||
case HAL_PIXEL_FORMAT_RGBA_5551:
|
||||
case HAL_PIXEL_FORMAT_RGBA_4444:
|
||||
/* unsupported */
|
||||
default:
|
||||
_eglLog(_EGL_WARNING, "unsupported native buffer format 0x%x", buf->format);
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
dimg = calloc(1, sizeof(*dimg));
|
||||
if (!dimg) {
|
||||
_eglError(EGL_BAD_ALLOC, "droid_create_image_mesa_drm");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!_eglInitImage(&dimg->base, disp)) {
|
||||
free(dimg);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dimg->dri_image =
|
||||
ddpy->image->createImageFromName(ddpy->dri_screen,
|
||||
buf->width,
|
||||
buf->height,
|
||||
format,
|
||||
name,
|
||||
buf->stride,
|
||||
dimg);
|
||||
if (!dimg->dri_image) {
|
||||
free(dimg);
|
||||
_eglError(EGL_BAD_ALLOC, "droid_create_image_mesa_drm");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &dimg->base;
|
||||
}
|
||||
|
||||
static _EGLImage *
|
||||
droid_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
|
||||
_EGLContext *ctx, EGLenum target,
|
||||
EGLClientBuffer buffer, const EGLint *attr_list)
|
||||
{
|
||||
switch (target) {
|
||||
case EGL_NATIVE_BUFFER_ANDROID:
|
||||
return droid_create_image_android_native_buffer(disp, buffer);
|
||||
default:
|
||||
_eglError(EGL_BAD_PARAMETER, "droid_create_image_khr");
|
||||
return EGL_NO_IMAGE_KHR;
|
||||
}
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
droid_destroy_image_khr(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *image)
|
||||
{
|
||||
struct droid_egl_display *ddpy = droid_egl_display(disp);
|
||||
struct droid_egl_image *dimg = droid_egl_image(image);
|
||||
|
||||
ddpy->image->destroyImage(dimg->dri_image);
|
||||
free(dimg);
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
droid_init_image_functions(_EGLDriver *drv)
|
||||
{
|
||||
struct droid_egl_driver *ddrv = droid_egl_driver(drv);
|
||||
|
||||
ddrv->base.API.CreateImageKHR = droid_create_image_khr;
|
||||
ddrv->base.API.DestroyImageKHR = droid_destroy_image_khr;
|
||||
}
|
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Kristian Høgsberg <krh@bitplanet.net>
|
||||
*/
|
||||
|
||||
#include "droid.h"
|
||||
|
||||
_EGLDriver *
|
||||
_EGL_MAIN(const char *args)
|
||||
{
|
||||
_EGLDriver *drv;
|
||||
|
||||
drv = droid_create_driver();
|
||||
if (drv) {
|
||||
droid_init_core_functions(drv);
|
||||
droid_init_image_functions(drv);
|
||||
}
|
||||
|
||||
return drv;
|
||||
}
|
@@ -462,6 +462,12 @@ dri2_create_screen(_EGLDisplay *disp)
|
||||
}
|
||||
}
|
||||
|
||||
if (dri2_dpy->image) {
|
||||
disp->Extensions.MESA_drm_image = EGL_TRUE;
|
||||
disp->Extensions.KHR_image_base = EGL_TRUE;
|
||||
disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;
|
||||
}
|
||||
|
||||
return EGL_TRUE;
|
||||
|
||||
cleanup_dri_screen:
|
||||
|
@@ -708,11 +708,6 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
|
||||
for (i = 0; dri2_dpy->driver_configs[i]; i++)
|
||||
dri2_add_config(disp, dri2_dpy->driver_configs[i], i + 1, 0, 0, NULL);
|
||||
|
||||
disp->Extensions.MESA_drm_image = EGL_TRUE;
|
||||
disp->Extensions.KHR_image_base = EGL_TRUE;
|
||||
disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;
|
||||
disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE;
|
||||
|
||||
#ifdef HAVE_WAYLAND_PLATFORM
|
||||
disp->Extensions.WL_bind_wayland_display = EGL_TRUE;
|
||||
#endif
|
||||
|
@@ -429,7 +429,7 @@ wayland_create_buffer(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer)
|
||||
}
|
||||
|
||||
static void
|
||||
wayland_frame_callback(void *data, uint32_t time)
|
||||
wayland_frame_callback(struct wl_surface *surface, void *data, uint32_t time)
|
||||
{
|
||||
struct dri2_egl_surface *dri2_surf = data;
|
||||
|
||||
@@ -459,7 +459,8 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
|
||||
|
||||
dri2_surf->block_swap_buffers = EGL_TRUE;
|
||||
wl_display_frame_callback(dri2_dpy->wl_dpy->display,
|
||||
wayland_frame_callback, dri2_surf);
|
||||
dri2_surf->wl_win->surface,
|
||||
wayland_frame_callback, dri2_surf);
|
||||
|
||||
if (dri2_surf->type == DRI2_WINDOW_SURFACE) {
|
||||
pointer_swap(
|
||||
@@ -677,11 +678,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
|
||||
EGL_WINDOW_BIT | EGL_PIXMAP_BIT, NULL);
|
||||
|
||||
|
||||
disp->Extensions.MESA_drm_image = EGL_TRUE;
|
||||
disp->Extensions.KHR_image_base = EGL_TRUE;
|
||||
disp->Extensions.KHR_image_pixmap = EGL_TRUE;
|
||||
disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;
|
||||
disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE;
|
||||
|
||||
disp->Extensions.WL_bind_wayland_display = EGL_TRUE;
|
||||
dri2_dpy->authenticate = dri2_wayland_authenticate;
|
||||
|
@@ -231,7 +231,7 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
|
||||
if (dri2_dpy->dri2) {
|
||||
xcb_dri2_create_drawable (dri2_dpy->conn, dri2_surf->drawable);
|
||||
} else {
|
||||
swrastCreateDrawable(dri2_dpy, dri2_surf, _eglGetConfigKey(conf, EGL_DEPTH_SIZE));
|
||||
swrastCreateDrawable(dri2_dpy, dri2_surf, _eglGetConfigKey(conf, EGL_BUFFER_SIZE));
|
||||
}
|
||||
|
||||
if (type != EGL_PBUFFER_BIT) {
|
||||
@@ -990,7 +990,7 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
|
||||
if (!dri2_load_driver(disp))
|
||||
goto cleanup_conn;
|
||||
|
||||
dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR);
|
||||
dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR | O_CLOEXEC);
|
||||
if (dri2_dpy->fd == -1) {
|
||||
_eglLog(_EGL_WARNING,
|
||||
"DRI2: could not open %s (%s)", dri2_dpy->device_name,
|
||||
@@ -1030,11 +1030,7 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
|
||||
goto cleanup_configs;
|
||||
}
|
||||
|
||||
disp->Extensions.MESA_drm_image = EGL_TRUE;
|
||||
disp->Extensions.KHR_image_base = EGL_TRUE;
|
||||
disp->Extensions.KHR_image_pixmap = EGL_TRUE;
|
||||
disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;
|
||||
disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE;
|
||||
disp->Extensions.NOK_swap_region = EGL_TRUE;
|
||||
disp->Extensions.NOK_texture_from_pixmap = EGL_TRUE;
|
||||
|
||||
|
@@ -917,9 +917,6 @@ eglGetProcAddress(const char *procname)
|
||||
#ifdef EGL_WL_bind_display
|
||||
{ "eglBindWaylandDisplayWL", (_EGLProc) eglBindWaylandDisplayWL },
|
||||
{ "eglUnbindWaylandDisplayWL", (_EGLProc) eglUnbindWaylandDisplayWL },
|
||||
#endif
|
||||
#ifdef EGL_ANDROID_swap_rectangle
|
||||
{ "eglSetSwapRectangleANDROID", (_EGLProc) eglSetSwapRectangleANDROID },
|
||||
#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
@@ -1538,25 +1535,3 @@ eglUnbindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display)
|
||||
RETURN_EGL_EVAL(disp, ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef EGL_ANDROID_swap_rectangle
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglSetSwapRectangleANDROID(EGLDisplay dpy, EGLSurface draw,
|
||||
EGLint left, EGLint top,
|
||||
EGLint width, EGLint height)
|
||||
{
|
||||
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
||||
_EGLSurface *surf = _eglLookupSurface(draw, disp);
|
||||
_EGLDriver *drv;
|
||||
EGLBoolean ret;
|
||||
|
||||
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
|
||||
|
||||
if (!disp->Extensions.ANDROID_swap_rectangle)
|
||||
RETURN_EGL_EVAL(disp, EGL_FALSE);
|
||||
|
||||
ret = drv->API.SetSwapRectangleANDROID(drv, disp, surf, left, top, width, height);
|
||||
|
||||
RETURN_EGL_EVAL(disp, ret);
|
||||
}
|
||||
#endif
|
||||
|
@@ -101,10 +101,6 @@ typedef EGLBoolean (*BindWaylandDisplayWL_t)(_EGLDriver *drv, _EGLDisplay *disp,
|
||||
typedef EGLBoolean (*UnbindWaylandDisplayWL_t)(_EGLDriver *drv, _EGLDisplay *disp, struct wl_display *display);
|
||||
#endif
|
||||
|
||||
#ifdef EGL_ANDROID_swap_rectangle
|
||||
typedef EGLBoolean (*SetSwapRectangleANDROID_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw, EGLint left, EGLint top, EGLint width, EGLint height);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The API dispatcher jumps through these functions
|
||||
*/
|
||||
@@ -184,10 +180,6 @@ struct _egl_api
|
||||
BindWaylandDisplayWL_t BindWaylandDisplayWL;
|
||||
UnbindWaylandDisplayWL_t UnbindWaylandDisplayWL;
|
||||
#endif
|
||||
|
||||
#ifdef EGL_ANDROID_swap_rectangle
|
||||
SetSwapRectangleANDROID_t SetSwapRectangleANDROID;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* EGLAPI_INCLUDED */
|
||||
|
@@ -29,8 +29,7 @@ _eglGetNativePlatformFromEnv(void)
|
||||
{ _EGL_PLATFORM_X11, "x11" },
|
||||
{ _EGL_PLATFORM_WAYLAND, "wayland" },
|
||||
{ _EGL_PLATFORM_DRM, "drm" },
|
||||
{ _EGL_PLATFORM_FBDEV, "fbdev" },
|
||||
{ _EGL_PLATFORM_ANDROID, "android" }
|
||||
{ _EGL_PLATFORM_FBDEV, "fbdev" }
|
||||
};
|
||||
_EGLPlatformType plat = _EGL_INVALID_PLATFORM;
|
||||
const char *plat_name;
|
||||
|
@@ -14,7 +14,6 @@ enum _egl_platform_type {
|
||||
_EGL_PLATFORM_WAYLAND,
|
||||
_EGL_PLATFORM_DRM,
|
||||
_EGL_PLATFORM_FBDEV,
|
||||
_EGL_PLATFORM_ANDROID,
|
||||
|
||||
_EGL_NUM_PLATFORMS,
|
||||
_EGL_INVALID_PLATFORM = -1
|
||||
@@ -78,9 +77,6 @@ struct _egl_extensions
|
||||
|
||||
EGLBoolean NOK_swap_region;
|
||||
EGLBoolean NOK_texture_from_pixmap;
|
||||
|
||||
EGLBoolean ANDROID_image_native_buffer;
|
||||
EGLBoolean ANDROID_swap_rectangle;
|
||||
};
|
||||
|
||||
|
||||
|
@@ -40,9 +40,6 @@ const struct {
|
||||
#ifdef _EGL_BUILT_IN_DRIVER_GALLIUM
|
||||
{ "egl_gallium", _eglBuiltInDriverGALLIUM },
|
||||
#endif
|
||||
#ifdef _EGL_BUILT_IN_DRIVER_ANDROID
|
||||
{ "egl_android", _eglBuiltInDriverANDROID },
|
||||
#endif
|
||||
#ifdef _EGL_BUILT_IN_DRIVER_DRI2
|
||||
{ "egl_dri2", _eglBuiltInDriverDRI2 },
|
||||
#endif
|
||||
|
@@ -58,10 +58,6 @@ extern _EGLDriver *
|
||||
_eglBuiltInDriverGALLIUM(const char *args);
|
||||
|
||||
|
||||
extern _EGLDriver *
|
||||
_eglBuiltInDriverANDROID(const char *args);
|
||||
|
||||
|
||||
extern _EGLDriver *
|
||||
_eglBuiltInDriverDRI2(const char *args);
|
||||
|
||||
|
@@ -111,9 +111,6 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy)
|
||||
|
||||
_EGL_CHECK_EXTENSION(NOK_swap_region);
|
||||
_EGL_CHECK_EXTENSION(NOK_texture_from_pixmap);
|
||||
|
||||
_EGL_CHECK_EXTENSION(ANDROID_image_native_buffer);
|
||||
_EGL_CHECK_EXTENSION(ANDROID_swap_rectangle);
|
||||
#undef _EGL_CHECK_EXTENSION
|
||||
}
|
||||
|
||||
|
@@ -12,7 +12,8 @@ wayland_drm_OBJECTS = $(wayland_drm_SOURCES:.c=.o)
|
||||
|
||||
wayland_drm_INCLUDES = \
|
||||
$(WAYLAND_CFLAGS) \
|
||||
-I$(TOP)/src/egl/main
|
||||
-I$(TOP)/src/egl/main \
|
||||
-I$(TOP)/include
|
||||
|
||||
# Generate protocol sources
|
||||
prefix=$(shell pkg-config --variable=prefix wayland-server)
|
||||
|
@@ -1,3 +0,0 @@
|
||||
ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
|
||||
include $(call all-subdir-makefiles)
|
||||
endif
|
@@ -53,7 +53,6 @@ if env['drm']:
|
||||
# Needed by some state trackers
|
||||
SConscript('winsys/sw/null/SConscript')
|
||||
|
||||
SConscript('state_trackers/python/SConscript')
|
||||
if env['platform'] != 'embedded':
|
||||
SConscript('state_trackers/vega/SConscript')
|
||||
SConscript('state_trackers/egl/SConscript')
|
||||
|
@@ -1,217 +0,0 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
# from Makefile
|
||||
C_SOURCES = \
|
||||
cso_cache/cso_cache.c \
|
||||
cso_cache/cso_context.c \
|
||||
cso_cache/cso_hash.c \
|
||||
draw/draw_context.c \
|
||||
draw/draw_fs.c \
|
||||
draw/draw_gs.c \
|
||||
draw/draw_pipe.c \
|
||||
draw/draw_pipe_aaline.c \
|
||||
draw/draw_pipe_aapoint.c \
|
||||
draw/draw_pipe_clip.c \
|
||||
draw/draw_pipe_cull.c \
|
||||
draw/draw_pipe_flatshade.c \
|
||||
draw/draw_pipe_offset.c \
|
||||
draw/draw_pipe_pstipple.c \
|
||||
draw/draw_pipe_stipple.c \
|
||||
draw/draw_pipe_twoside.c \
|
||||
draw/draw_pipe_unfilled.c \
|
||||
draw/draw_pipe_util.c \
|
||||
draw/draw_pipe_validate.c \
|
||||
draw/draw_pipe_vbuf.c \
|
||||
draw/draw_pipe_wide_line.c \
|
||||
draw/draw_pipe_wide_point.c \
|
||||
draw/draw_pt.c \
|
||||
draw/draw_pt_emit.c \
|
||||
draw/draw_pt_fetch.c \
|
||||
draw/draw_pt_fetch_emit.c \
|
||||
draw/draw_pt_fetch_shade_emit.c \
|
||||
draw/draw_pt_fetch_shade_pipeline.c \
|
||||
draw/draw_pt_post_vs.c \
|
||||
draw/draw_pt_so_emit.c \
|
||||
draw/draw_pt_util.c \
|
||||
draw/draw_pt_vsplit.c \
|
||||
draw/draw_vertex.c \
|
||||
draw/draw_vs.c \
|
||||
draw/draw_vs_aos.c \
|
||||
draw/draw_vs_aos_io.c \
|
||||
draw/draw_vs_aos_machine.c \
|
||||
draw/draw_vs_exec.c \
|
||||
draw/draw_vs_ppc.c \
|
||||
draw/draw_vs_sse.c \
|
||||
draw/draw_vs_varient.c \
|
||||
indices/u_indices_gen.c \
|
||||
indices/u_unfilled_gen.c \
|
||||
os/os_misc.c \
|
||||
os/os_stream.c \
|
||||
os/os_stream_log.c \
|
||||
os/os_stream_null.c \
|
||||
os/os_stream_stdc.c \
|
||||
os/os_stream_str.c \
|
||||
os/os_time.c \
|
||||
pipebuffer/pb_buffer_fenced.c \
|
||||
pipebuffer/pb_buffer_malloc.c \
|
||||
pipebuffer/pb_bufmgr_alt.c \
|
||||
pipebuffer/pb_bufmgr_cache.c \
|
||||
pipebuffer/pb_bufmgr_debug.c \
|
||||
pipebuffer/pb_bufmgr_mm.c \
|
||||
pipebuffer/pb_bufmgr_ondemand.c \
|
||||
pipebuffer/pb_bufmgr_pool.c \
|
||||
pipebuffer/pb_bufmgr_slab.c \
|
||||
pipebuffer/pb_validate.c \
|
||||
rbug/rbug_connection.c \
|
||||
rbug/rbug_context.c \
|
||||
rbug/rbug_core.c \
|
||||
rbug/rbug_demarshal.c \
|
||||
rbug/rbug_texture.c \
|
||||
rbug/rbug_shader.c \
|
||||
rtasm/rtasm_cpu.c \
|
||||
rtasm/rtasm_execmem.c \
|
||||
rtasm/rtasm_ppc.c \
|
||||
rtasm/rtasm_ppc_spe.c \
|
||||
rtasm/rtasm_x86sse.c \
|
||||
tgsi/tgsi_build.c \
|
||||
tgsi/tgsi_dump.c \
|
||||
tgsi/tgsi_exec.c \
|
||||
tgsi/tgsi_info.c \
|
||||
tgsi/tgsi_iterate.c \
|
||||
tgsi/tgsi_parse.c \
|
||||
tgsi/tgsi_ppc.c \
|
||||
tgsi/tgsi_sanity.c \
|
||||
tgsi/tgsi_scan.c \
|
||||
tgsi/tgsi_sse2.c \
|
||||
tgsi/tgsi_text.c \
|
||||
tgsi/tgsi_transform.c \
|
||||
tgsi/tgsi_ureg.c \
|
||||
tgsi/tgsi_util.c \
|
||||
translate/translate.c \
|
||||
translate/translate_cache.c \
|
||||
translate/translate_generic.c \
|
||||
translate/translate_sse.c \
|
||||
util/u_debug.c \
|
||||
util/u_debug_describe.c \
|
||||
util/u_debug_refcnt.c \
|
||||
util/u_debug_stack.c \
|
||||
util/u_debug_symbol.c \
|
||||
util/u_dump_defines.c \
|
||||
util/u_dump_state.c \
|
||||
util/u_bitmask.c \
|
||||
util/u_blit.c \
|
||||
util/u_blitter.c \
|
||||
util/u_cache.c \
|
||||
util/u_caps.c \
|
||||
util/u_cpu_detect.c \
|
||||
util/u_dl.c \
|
||||
util/u_draw_quad.c \
|
||||
util/u_format.c \
|
||||
util/u_format_other.c \
|
||||
util/u_format_latc.c \
|
||||
util/u_format_s3tc.c \
|
||||
util/u_format_rgtc.c \
|
||||
util/u_format_srgb.c \
|
||||
util/u_format_table.c \
|
||||
util/u_format_tests.c \
|
||||
util/u_format_yuv.c \
|
||||
util/u_format_zs.c \
|
||||
util/u_framebuffer.c \
|
||||
util/u_gen_mipmap.c \
|
||||
util/u_half.c \
|
||||
util/u_handle_table.c \
|
||||
util/u_hash.c \
|
||||
util/u_hash_table.c \
|
||||
util/u_index_modify.c \
|
||||
util/u_keymap.c \
|
||||
util/u_linear.c \
|
||||
util/u_linkage.c \
|
||||
util/u_network.c \
|
||||
util/u_math.c \
|
||||
util/u_mm.c \
|
||||
util/u_pstipple.c \
|
||||
util/u_rect.c \
|
||||
util/u_ringbuffer.c \
|
||||
util/u_sampler.c \
|
||||
util/u_simple_shaders.c \
|
||||
util/u_slab.c \
|
||||
util/u_snprintf.c \
|
||||
util/u_staging.c \
|
||||
util/u_surface.c \
|
||||
util/u_surfaces.c \
|
||||
util/u_texture.c \
|
||||
util/u_tile.c \
|
||||
util/u_transfer.c \
|
||||
util/u_resource.c \
|
||||
util/u_upload_mgr.c \
|
||||
util/u_vbuf_mgr.c
|
||||
|
||||
GENERATED_SOURCES = \
|
||||
indices/u_indices_gen.c \
|
||||
indices/u_unfilled_gen.c \
|
||||
util/u_format_srgb.c \
|
||||
util/u_format_table.c \
|
||||
util/u_half.c
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(filter-out $(GENERATED_SOURCES), $(C_SOURCES))
|
||||
|
||||
LOCAL_CFLAGS := \
|
||||
-fvisibility=hidden \
|
||||
-Wno-sign-compare
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
external/mesa/include \
|
||||
external/mesa/src/gallium/include \
|
||||
external/mesa/src/gallium/auxiliary \
|
||||
external/mesa/src/gallium/drivers \
|
||||
external/mesa/src/gallium/auxiliary/util
|
||||
|
||||
LOCAL_MODULE := libmesa_gallium
|
||||
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
|
||||
|
||||
intermediates := $(call local-intermediates-dir)
|
||||
|
||||
GEN_SCRIPT := $(LOCAL_PATH)/indices/u_indices_gen.py
|
||||
GEN := $(intermediates)/indices/u_indices_gen.c
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL = python $< > $@
|
||||
$(GEN): $(GEN_SCRIPT)
|
||||
$(transform-generated-source)
|
||||
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
|
||||
GEN_SCRIPT := $(LOCAL_PATH)/indices/u_unfilled_gen.py
|
||||
GEN := $(intermediates)/indices/u_unfilled_gen.c
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL = python $< > $@
|
||||
$(GEN): $(GEN_SCRIPT)
|
||||
$(transform-generated-source)
|
||||
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
|
||||
GEN_SCRIPT := $(LOCAL_PATH)/util/u_format_srgb.py
|
||||
GEN := $(intermediates)/util/u_format_srgb.c
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL = python $< > $@
|
||||
$(GEN): $(GEN_SCRIPT)
|
||||
$(transform-generated-source)
|
||||
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
|
||||
GEN_SCRIPT := $(LOCAL_PATH)/util/u_format_table.py
|
||||
GEN := $(intermediates)/util/u_format_table.c
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL := python $(GEN_SCRIPT) $(LOCAL_PATH)/util/u_format.csv > $(GEN)
|
||||
$(GEN): $(GEN_SCRIPT) $(LOCAL_PATH)/util/u_format.csv
|
||||
$(transform-generated-source)
|
||||
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
|
||||
GEN_SCRIPT := $(LOCAL_PATH)/util/u_half.py
|
||||
GEN := $(intermediates)/util/u_half.c
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL = python $< > $@
|
||||
$(GEN): $(GEN_SCRIPT)
|
||||
$(transform-generated-source)
|
||||
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
@@ -107,6 +107,7 @@ C_SOURCES = \
|
||||
util/u_caps.c \
|
||||
util/u_cpu_detect.c \
|
||||
util/u_dl.c \
|
||||
util/u_draw.c \
|
||||
util/u_draw_quad.c \
|
||||
util/u_format.c \
|
||||
util/u_format_other.c \
|
||||
|
@@ -154,6 +154,7 @@ source = [
|
||||
'util/u_dump_defines.c',
|
||||
'util/u_dump_state.c',
|
||||
'util/u_dl.c',
|
||||
'util/u_draw.c',
|
||||
'util/u_draw_quad.c',
|
||||
'util/u_format.c',
|
||||
'util/u_format_other.c',
|
||||
|
@@ -751,7 +751,7 @@ void
|
||||
draw_set_mapped_texture(struct draw_context *draw,
|
||||
unsigned sampler_idx,
|
||||
uint32_t width, uint32_t height, uint32_t depth,
|
||||
uint32_t last_level,
|
||||
uint32_t first_level, uint32_t last_level,
|
||||
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
|
||||
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
|
||||
const void *data[PIPE_MAX_TEXTURE_LEVELS])
|
||||
@@ -760,7 +760,7 @@ draw_set_mapped_texture(struct draw_context *draw,
|
||||
if(draw->llvm)
|
||||
draw_llvm_set_mapped_texture(draw,
|
||||
sampler_idx,
|
||||
width, height, depth, last_level,
|
||||
width, height, depth, first_level, last_level,
|
||||
row_stride, img_stride, data);
|
||||
#endif
|
||||
}
|
||||
|
@@ -123,7 +123,7 @@ void
|
||||
draw_set_mapped_texture(struct draw_context *draw,
|
||||
unsigned sampler_idx,
|
||||
uint32_t width, uint32_t height, uint32_t depth,
|
||||
uint32_t last_level,
|
||||
uint32_t first_level, uint32_t last_level,
|
||||
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
|
||||
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
|
||||
const void *data[PIPE_MAX_TEXTURE_LEVELS]);
|
||||
|
@@ -106,6 +106,7 @@ create_jit_texture_type(struct gallivm_state *gallivm)
|
||||
elem_types[DRAW_JIT_TEXTURE_WIDTH] =
|
||||
elem_types[DRAW_JIT_TEXTURE_HEIGHT] =
|
||||
elem_types[DRAW_JIT_TEXTURE_DEPTH] =
|
||||
elem_types[DRAW_JIT_TEXTURE_FIRST_LEVEL] =
|
||||
elem_types[DRAW_JIT_TEXTURE_LAST_LEVEL] = int32_type;
|
||||
elem_types[DRAW_JIT_TEXTURE_ROW_STRIDE] =
|
||||
elem_types[DRAW_JIT_TEXTURE_IMG_STRIDE] =
|
||||
@@ -136,6 +137,9 @@ create_jit_texture_type(struct gallivm_state *gallivm)
|
||||
LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, depth,
|
||||
target, texture_type,
|
||||
DRAW_JIT_TEXTURE_DEPTH);
|
||||
LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, first_level,
|
||||
target, texture_type,
|
||||
DRAW_JIT_TEXTURE_FIRST_LEVEL);
|
||||
LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, last_level,
|
||||
target, texture_type,
|
||||
DRAW_JIT_TEXTURE_LAST_LEVEL);
|
||||
@@ -438,7 +442,8 @@ generate_vs(struct draw_llvm *llvm,
|
||||
const LLVMValueRef (*inputs)[NUM_CHANNELS],
|
||||
LLVMValueRef system_values_array,
|
||||
LLVMValueRef context_ptr,
|
||||
struct lp_build_sampler_soa *draw_sampler)
|
||||
struct lp_build_sampler_soa *draw_sampler,
|
||||
boolean clamp_vertex_color)
|
||||
{
|
||||
const struct tgsi_token *tokens = llvm->draw->vs.vertex_shader->state.tokens;
|
||||
struct lp_type vs_type;
|
||||
@@ -474,6 +479,30 @@ generate_vs(struct draw_llvm *llvm,
|
||||
outputs,
|
||||
sampler,
|
||||
&llvm->draw->vs.vertex_shader->info);
|
||||
|
||||
if(clamp_vertex_color)
|
||||
{
|
||||
LLVMValueRef out;
|
||||
unsigned chan, attrib;
|
||||
struct lp_build_context bld;
|
||||
struct tgsi_shader_info* info = &llvm->draw->vs.vertex_shader->info;
|
||||
lp_build_context_init(&bld, llvm->gallivm, vs_type);
|
||||
|
||||
for (attrib = 0; attrib < info->num_outputs; ++attrib) {
|
||||
for(chan = 0; chan < NUM_CHANNELS; ++chan) {
|
||||
if(outputs[attrib][chan]) {
|
||||
switch (info->output_semantic_name[attrib]) {
|
||||
case TGSI_SEMANTIC_COLOR:
|
||||
case TGSI_SEMANTIC_BCOLOR:
|
||||
out = LLVMBuildLoad(builder, outputs[attrib][chan], "");
|
||||
out = lp_build_clamp(&bld, out, bld.zero, bld.one);
|
||||
LLVMBuildStore(builder, out, outputs[attrib][chan]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG_STORE
|
||||
@@ -1235,7 +1264,8 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
|
||||
ptr_aos,
|
||||
system_values_array,
|
||||
context_ptr,
|
||||
sampler);
|
||||
sampler,
|
||||
variant->key.clamp_vertex_color);
|
||||
|
||||
/* store original positions in clip before further manipulation */
|
||||
store_clip(gallivm, io, outputs);
|
||||
@@ -1446,7 +1476,8 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian
|
||||
ptr_aos,
|
||||
system_values_array,
|
||||
context_ptr,
|
||||
sampler);
|
||||
sampler,
|
||||
variant->key.clamp_vertex_color);
|
||||
|
||||
/* store original positions in clip before further manipulation */
|
||||
store_clip(gallivm, io, outputs);
|
||||
@@ -1524,6 +1555,8 @@ draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store)
|
||||
|
||||
key = (struct draw_llvm_variant_key *)store;
|
||||
|
||||
key->clamp_vertex_color = llvm->draw->rasterizer->clamp_vertex_color; /**/
|
||||
|
||||
/* Presumably all variants of the shader should have the same
|
||||
* number of vertex elements - ie the number of shader inputs.
|
||||
*/
|
||||
@@ -1566,7 +1599,7 @@ void
|
||||
draw_llvm_set_mapped_texture(struct draw_context *draw,
|
||||
unsigned sampler_idx,
|
||||
uint32_t width, uint32_t height, uint32_t depth,
|
||||
uint32_t last_level,
|
||||
uint32_t first_level, uint32_t last_level,
|
||||
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
|
||||
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
|
||||
const void *data[PIPE_MAX_TEXTURE_LEVELS])
|
||||
@@ -1582,9 +1615,10 @@ draw_llvm_set_mapped_texture(struct draw_context *draw,
|
||||
jit_tex->width = width;
|
||||
jit_tex->height = height;
|
||||
jit_tex->depth = depth;
|
||||
jit_tex->first_level = first_level;
|
||||
jit_tex->last_level = last_level;
|
||||
|
||||
for (j = 0; j <= last_level; j++) {
|
||||
for (j = first_level; j <= last_level; j++) {
|
||||
jit_tex->data[j] = data[j];
|
||||
jit_tex->row_stride[j] = row_stride[j];
|
||||
jit_tex->img_stride[j] = img_stride[j];
|
||||
|
@@ -50,6 +50,7 @@ struct draw_jit_texture
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t depth;
|
||||
uint32_t first_level;
|
||||
uint32_t last_level;
|
||||
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS];
|
||||
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS];
|
||||
@@ -64,6 +65,7 @@ enum {
|
||||
DRAW_JIT_TEXTURE_WIDTH = 0,
|
||||
DRAW_JIT_TEXTURE_HEIGHT,
|
||||
DRAW_JIT_TEXTURE_DEPTH,
|
||||
DRAW_JIT_TEXTURE_FIRST_LEVEL,
|
||||
DRAW_JIT_TEXTURE_LAST_LEVEL,
|
||||
DRAW_JIT_TEXTURE_ROW_STRIDE,
|
||||
DRAW_JIT_TEXTURE_IMG_STRIDE,
|
||||
@@ -162,6 +164,7 @@ struct draw_llvm_variant_key
|
||||
{
|
||||
unsigned nr_vertex_elements:8;
|
||||
unsigned nr_samplers:8;
|
||||
unsigned clamp_vertex_color:1;
|
||||
unsigned clip_xy:1;
|
||||
unsigned clip_z:1;
|
||||
unsigned clip_user:1;
|
||||
@@ -169,7 +172,7 @@ struct draw_llvm_variant_key
|
||||
unsigned bypass_viewport:1;
|
||||
unsigned need_edgeflags:1;
|
||||
unsigned nr_planes:4;
|
||||
unsigned pad:6;
|
||||
unsigned pad:5;
|
||||
|
||||
/* Variable number of vertex elements:
|
||||
*/
|
||||
@@ -295,7 +298,7 @@ void
|
||||
draw_llvm_set_mapped_texture(struct draw_context *draw,
|
||||
unsigned sampler_idx,
|
||||
uint32_t width, uint32_t height, uint32_t depth,
|
||||
uint32_t last_level,
|
||||
uint32_t first_level, uint32_t last_level,
|
||||
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
|
||||
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
|
||||
const void *data[PIPE_MAX_TEXTURE_LEVELS]);
|
||||
|
@@ -144,6 +144,7 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
|
||||
DRAW_LLVM_TEXTURE_MEMBER(width, DRAW_JIT_TEXTURE_WIDTH, TRUE)
|
||||
DRAW_LLVM_TEXTURE_MEMBER(height, DRAW_JIT_TEXTURE_HEIGHT, TRUE)
|
||||
DRAW_LLVM_TEXTURE_MEMBER(depth, DRAW_JIT_TEXTURE_DEPTH, TRUE)
|
||||
DRAW_LLVM_TEXTURE_MEMBER(first_level,DRAW_JIT_TEXTURE_FIRST_LEVEL, TRUE)
|
||||
DRAW_LLVM_TEXTURE_MEMBER(last_level, DRAW_JIT_TEXTURE_LAST_LEVEL, TRUE)
|
||||
DRAW_LLVM_TEXTURE_MEMBER(row_stride, DRAW_JIT_TEXTURE_ROW_STRIDE, FALSE)
|
||||
DRAW_LLVM_TEXTURE_MEMBER(img_stride, DRAW_JIT_TEXTURE_IMG_STRIDE, FALSE)
|
||||
@@ -209,6 +210,7 @@ draw_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
|
||||
sampler->dynamic_state.base.width = draw_llvm_texture_width;
|
||||
sampler->dynamic_state.base.height = draw_llvm_texture_height;
|
||||
sampler->dynamic_state.base.depth = draw_llvm_texture_depth;
|
||||
sampler->dynamic_state.base.first_level = draw_llvm_texture_first_level;
|
||||
sampler->dynamic_state.base.last_level = draw_llvm_texture_last_level;
|
||||
sampler->dynamic_state.base.row_stride = draw_llvm_texture_row_stride;
|
||||
sampler->dynamic_state.base.img_stride = draw_llvm_texture_img_stride;
|
||||
|
@@ -146,6 +146,14 @@ struct draw_context
|
||||
struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
|
||||
unsigned nr_vertex_buffers;
|
||||
|
||||
/*
|
||||
* This is the largest legal index value for the current set of
|
||||
* bound vertex buffers. Regardless of any other consideration,
|
||||
* all vertex lookups need to be clamped to 0..max_index to
|
||||
* prevent out-of-bound access.
|
||||
*/
|
||||
unsigned max_index;
|
||||
|
||||
struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
|
||||
unsigned nr_vertex_elements;
|
||||
|
||||
|
@@ -470,6 +470,17 @@ draw_vbo(struct draw_context *draw,
|
||||
if (0)
|
||||
draw_print_arrays(draw, info->mode, info->start, MIN2(info->count, 20));
|
||||
|
||||
draw->pt.max_index = util_draw_max_index(draw->pt.vertex_buffer,
|
||||
draw->pt.nr_vertex_buffers,
|
||||
draw->pt.vertex_element,
|
||||
draw->pt.nr_vertex_elements,
|
||||
info);
|
||||
|
||||
/*
|
||||
* TODO: We could use draw->pt.max_index to further narrow
|
||||
* the min_index/max_index hints given by the state tracker.
|
||||
*/
|
||||
|
||||
for (instance = 0; instance < info->instance_count; instance++) {
|
||||
draw->instance_id = instance + info->start_instance;
|
||||
|
||||
|
@@ -139,7 +139,7 @@ void draw_pt_fetch_run( struct pt_fetch *fetch,
|
||||
((char *)draw->pt.user.vbuffer[i] +
|
||||
draw->pt.vertex_buffer[i].buffer_offset),
|
||||
draw->pt.vertex_buffer[i].stride,
|
||||
draw->pt.user.max_index);
|
||||
draw->pt.max_index);
|
||||
}
|
||||
|
||||
translate->run_elts( translate,
|
||||
|
@@ -186,7 +186,7 @@ static void fetch_emit_prepare( struct draw_pt_middle_end *middle,
|
||||
((char *)draw->pt.user.vbuffer[i] +
|
||||
draw->pt.vertex_buffer[i].buffer_offset),
|
||||
draw->pt.vertex_buffer[i].stride,
|
||||
draw->pt.user.max_index);
|
||||
draw->pt.max_index);
|
||||
}
|
||||
|
||||
*max_vertices = (draw->render->max_vertex_buffer_bytes /
|
||||
|
@@ -169,7 +169,7 @@ static void fse_prepare( struct draw_pt_middle_end *middle,
|
||||
((const ubyte *) draw->pt.user.vbuffer[i] +
|
||||
draw->pt.vertex_buffer[i].buffer_offset),
|
||||
draw->pt.vertex_buffer[i].stride,
|
||||
draw->pt.user.max_index );
|
||||
draw->pt.max_index );
|
||||
}
|
||||
|
||||
*max_vertices = (draw->render->max_vertex_buffer_bytes /
|
||||
|
@@ -85,7 +85,12 @@ vsplit_flush_cache(struct vsplit_frontend *vsplit, unsigned flags)
|
||||
static INLINE void
|
||||
vsplit_add_cache(struct vsplit_frontend *vsplit, unsigned fetch)
|
||||
{
|
||||
unsigned hash = fetch % MAP_SIZE;
|
||||
struct draw_context *draw = vsplit->draw;
|
||||
unsigned hash;
|
||||
|
||||
fetch = MIN2(fetch, draw->pt.max_index);
|
||||
|
||||
hash = fetch % MAP_SIZE;
|
||||
|
||||
if (vsplit->cache.fetches[hash] != fetch) {
|
||||
/* update cache */
|
||||
|
@@ -47,14 +47,18 @@ CONCAT(vsplit_primitive_, ELT_TYPE)(struct vsplit_frontend *vsplit,
|
||||
const ushort *draw_elts = NULL;
|
||||
unsigned i;
|
||||
|
||||
ib += istart;
|
||||
|
||||
/* use the ib directly */
|
||||
if (min_index == 0 && sizeof(ib[0]) == sizeof(draw_elts[0])) {
|
||||
if (icount > vsplit->max_vertices)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < icount; i++) {
|
||||
ELT_TYPE idx = ib[istart + i];
|
||||
assert(idx >= min_index && idx <= max_index);
|
||||
ELT_TYPE idx = ib[i];
|
||||
if (idx < min_index || idx > max_index) {
|
||||
debug_printf("warning: index out of range\n");
|
||||
}
|
||||
}
|
||||
draw_elts = (const ushort *) ib;
|
||||
}
|
||||
@@ -83,17 +87,21 @@ CONCAT(vsplit_primitive_, ELT_TYPE)(struct vsplit_frontend *vsplit,
|
||||
if (!draw_elts) {
|
||||
if (min_index == 0) {
|
||||
for (i = 0; i < icount; i++) {
|
||||
ELT_TYPE idx = ib[istart + i];
|
||||
ELT_TYPE idx = ib[i];
|
||||
|
||||
assert(idx >= min_index && idx <= max_index);
|
||||
if (idx < min_index || idx > max_index) {
|
||||
debug_printf("warning: index out of range\n");
|
||||
}
|
||||
vsplit->draw_elts[i] = (ushort) idx;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < icount; i++) {
|
||||
ELT_TYPE idx = ib[istart + i];
|
||||
ELT_TYPE idx = ib[i];
|
||||
|
||||
assert(idx >= min_index && idx <= max_index);
|
||||
if (idx < min_index || idx > max_index) {
|
||||
debug_printf("warning: index out of range\n");
|
||||
}
|
||||
vsplit->draw_elts[i] = (ushort) (idx - min_index);
|
||||
}
|
||||
}
|
||||
|
@@ -104,10 +104,17 @@ draw_create_vertex_shader(struct draw_context *draw,
|
||||
}
|
||||
|
||||
if (!draw->pt.middle.llvm) {
|
||||
#if 0
|
||||
/* these paths don't support vertex clamping
|
||||
* TODO: either add it, or remove them completely
|
||||
* use LLVM instead if you want performance
|
||||
* use exec instead if you want debugging/more correctness
|
||||
*/
|
||||
#if defined(PIPE_ARCH_X86)
|
||||
vs = draw_create_vs_sse( draw, shader );
|
||||
#elif defined(PIPE_ARCH_PPC)
|
||||
vs = draw_create_vs_ppc( draw, shader );
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#if HAVE_LLVM
|
||||
|
@@ -95,6 +95,7 @@ vs_exec_run_linear( struct draw_vertex_shader *shader,
|
||||
struct tgsi_exec_machine *machine = evs->machine;
|
||||
unsigned int i, j;
|
||||
unsigned slot;
|
||||
boolean clamp_vertex_color = shader->draw->rasterizer->clamp_vertex_color;
|
||||
|
||||
tgsi_exec_set_constant_buffers(machine, PIPE_MAX_CONSTANT_BUFFERS,
|
||||
constants, const_size);
|
||||
@@ -151,11 +152,22 @@ vs_exec_run_linear( struct draw_vertex_shader *shader,
|
||||
*/
|
||||
for (j = 0; j < max_vertices; j++) {
|
||||
for (slot = 0; slot < shader->info.num_outputs; slot++) {
|
||||
output[slot][0] = machine->Outputs[slot].xyzw[0].f[j];
|
||||
output[slot][1] = machine->Outputs[slot].xyzw[1].f[j];
|
||||
output[slot][2] = machine->Outputs[slot].xyzw[2].f[j];
|
||||
output[slot][3] = machine->Outputs[slot].xyzw[3].f[j];
|
||||
|
||||
unsigned name = shader->info.output_semantic_name[slot];
|
||||
if(clamp_vertex_color &&
|
||||
(name == TGSI_SEMANTIC_COLOR || name == TGSI_SEMANTIC_BCOLOR))
|
||||
{
|
||||
output[slot][0] = CLAMP(machine->Outputs[slot].xyzw[0].f[j], 0.0f, 1.0f);
|
||||
output[slot][1] = CLAMP(machine->Outputs[slot].xyzw[1].f[j], 0.0f, 1.0f);
|
||||
output[slot][2] = CLAMP(machine->Outputs[slot].xyzw[2].f[j], 0.0f, 1.0f);
|
||||
output[slot][3] = CLAMP(machine->Outputs[slot].xyzw[3].f[j], 0.0f, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
output[slot][0] = machine->Outputs[slot].xyzw[0].f[j];
|
||||
output[slot][1] = machine->Outputs[slot].xyzw[1].f[j];
|
||||
output[slot][2] = machine->Outputs[slot].xyzw[2].f[j];
|
||||
output[slot][3] = machine->Outputs[slot].xyzw[3].f[j];
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@@ -32,7 +32,12 @@
|
||||
#include <llvm/Target/TargetInstrInfo.h>
|
||||
#include <llvm/Support/raw_ostream.h>
|
||||
#include <llvm/Support/MemoryObject.h>
|
||||
|
||||
#if HAVE_LLVM >= 0x0209
|
||||
#include <llvm/Support/Host.h>
|
||||
#else
|
||||
#include <llvm/System/Host.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LLVM >= 0x0207
|
||||
#include <llvm/MC/MCDisassembler.h>
|
||||
@@ -202,9 +207,17 @@ lp_disassemble(const void* func)
|
||||
}
|
||||
|
||||
raw_debug_ostream Out;
|
||||
TargetMachine *TM = T->createTargetMachine(Triple, "");
|
||||
|
||||
#if HAVE_LLVM >= 0x0300
|
||||
unsigned int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
|
||||
#else
|
||||
int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
|
||||
#if HAVE_LLVM >= 0x0208
|
||||
#endif
|
||||
#if HAVE_LLVM >= 0x0300
|
||||
OwningPtr<MCInstPrinter> Printer(
|
||||
T->createMCInstPrinter(*TM, AsmPrinterVariant, *AsmInfo));
|
||||
#elif HAVE_LLVM >= 0x0208
|
||||
OwningPtr<MCInstPrinter> Printer(
|
||||
T->createMCInstPrinter(AsmPrinterVariant, *AsmInfo));
|
||||
#else
|
||||
@@ -216,8 +229,6 @@ lp_disassemble(const void* func)
|
||||
return;
|
||||
}
|
||||
|
||||
TargetMachine *TM = T->createTargetMachine(Triple, "");
|
||||
|
||||
const TargetInstrInfo *TII = TM->getInstrInfo();
|
||||
|
||||
/*
|
||||
|
@@ -51,6 +51,10 @@
|
||||
*/
|
||||
#define BRILINEAR_FACTOR 2
|
||||
|
||||
static LLVMValueRef
|
||||
lp_build_minify(struct lp_build_context *bld,
|
||||
LLVMValueRef base_size,
|
||||
LLVMValueRef level);
|
||||
|
||||
/**
|
||||
* Does the given texture wrap mode allow sampling the texture border color?
|
||||
@@ -184,9 +188,11 @@ lp_sampler_static_state(struct lp_sampler_static_state *state,
|
||||
*/
|
||||
static LLVMValueRef
|
||||
lp_build_rho(struct lp_build_sample_context *bld,
|
||||
unsigned unit,
|
||||
const LLVMValueRef ddx[4],
|
||||
const LLVMValueRef ddy[4])
|
||||
{
|
||||
struct lp_build_context *int_size_bld = &bld->int_size_bld;
|
||||
struct lp_build_context *float_size_bld = &bld->float_size_bld;
|
||||
struct lp_build_context *float_bld = &bld->float_bld;
|
||||
const unsigned dims = bld->dims;
|
||||
@@ -198,8 +204,9 @@ lp_build_rho(struct lp_build_sample_context *bld,
|
||||
LLVMValueRef dsdx, dsdy, dtdx, dtdy, drdx, drdy;
|
||||
LLVMValueRef rho_x, rho_y;
|
||||
LLVMValueRef rho_vec;
|
||||
LLVMValueRef float_size;
|
||||
LLVMValueRef int_size, float_size;
|
||||
LLVMValueRef rho;
|
||||
LLVMValueRef first_level, first_level_vec;
|
||||
|
||||
dsdx = ddx[0];
|
||||
dsdy = ddy[0];
|
||||
@@ -235,7 +242,11 @@ lp_build_rho(struct lp_build_sample_context *bld,
|
||||
|
||||
rho_vec = lp_build_max(float_size_bld, rho_x, rho_y);
|
||||
|
||||
float_size = lp_build_int_to_float(float_size_bld, bld->int_size);
|
||||
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
|
||||
bld->gallivm, unit);
|
||||
first_level_vec = lp_build_broadcast_scalar(&bld->int_size_bld, first_level);
|
||||
int_size = lp_build_minify(int_size_bld, bld->int_size, first_level_vec);
|
||||
float_size = lp_build_int_to_float(float_size_bld, int_size);
|
||||
|
||||
rho_vec = lp_build_mul(float_size_bld, rho_vec, float_size);
|
||||
|
||||
@@ -442,7 +453,7 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
|
||||
else {
|
||||
LLVMValueRef rho;
|
||||
|
||||
rho = lp_build_rho(bld, ddx, ddy);
|
||||
rho = lp_build_rho(bld, unit, ddx, ddy);
|
||||
|
||||
/*
|
||||
* Compute lod = log2(rho)
|
||||
@@ -542,18 +553,18 @@ lp_build_nearest_mip_level(struct lp_build_sample_context *bld,
|
||||
LLVMValueRef *level_out)
|
||||
{
|
||||
struct lp_build_context *int_bld = &bld->int_bld;
|
||||
LLVMValueRef last_level, level;
|
||||
|
||||
LLVMValueRef zero = lp_build_const_int32(bld->gallivm, 0);
|
||||
LLVMValueRef first_level, last_level, level;
|
||||
|
||||
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
|
||||
bld->gallivm, unit);
|
||||
last_level = bld->dynamic_state->last_level(bld->dynamic_state,
|
||||
bld->gallivm, unit);
|
||||
|
||||
/* convert float lod to integer */
|
||||
level = lod_ipart;
|
||||
level = lp_build_add(int_bld, lod_ipart, first_level);
|
||||
|
||||
/* clamp level to legal range of levels */
|
||||
*level_out = lp_build_clamp(int_bld, level, zero, last_level);
|
||||
*level_out = lp_build_clamp(int_bld, level, first_level, last_level);
|
||||
}
|
||||
|
||||
|
||||
@@ -573,39 +584,42 @@ lp_build_linear_mip_levels(struct lp_build_sample_context *bld,
|
||||
LLVMBuilderRef builder = bld->gallivm->builder;
|
||||
struct lp_build_context *int_bld = &bld->int_bld;
|
||||
struct lp_build_context *float_bld = &bld->float_bld;
|
||||
LLVMValueRef last_level;
|
||||
LLVMValueRef first_level, last_level;
|
||||
LLVMValueRef clamp_min;
|
||||
LLVMValueRef clamp_max;
|
||||
|
||||
*level0_out = lod_ipart;
|
||||
*level1_out = lp_build_add(int_bld, lod_ipart, int_bld->one);
|
||||
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
|
||||
bld->gallivm, unit);
|
||||
|
||||
*level0_out = lp_build_add(int_bld, lod_ipart, first_level);
|
||||
*level1_out = lp_build_add(int_bld, *level0_out, int_bld->one);
|
||||
|
||||
last_level = bld->dynamic_state->last_level(bld->dynamic_state,
|
||||
bld->gallivm, unit);
|
||||
|
||||
/*
|
||||
* Clamp both lod_ipart and lod_ipart + 1 to [0, last_level], with the
|
||||
* minimum number of comparisons, and zeroing lod_fpart in the extreme
|
||||
* Clamp both *level0_out and *level1_out to [first_level, last_level], with
|
||||
* the minimum number of comparisons, and zeroing lod_fpart in the extreme
|
||||
* ends in the process.
|
||||
*/
|
||||
|
||||
/* lod_ipart < 0 */
|
||||
/* *level0_out < first_level */
|
||||
clamp_min = LLVMBuildICmp(builder, LLVMIntSLT,
|
||||
lod_ipart, int_bld->zero,
|
||||
"clamp_lod_to_zero");
|
||||
*level0_out, first_level,
|
||||
"clamp_lod_to_first");
|
||||
|
||||
*level0_out = LLVMBuildSelect(builder, clamp_min,
|
||||
int_bld->zero, *level0_out, "");
|
||||
first_level, *level0_out, "");
|
||||
|
||||
*level1_out = LLVMBuildSelect(builder, clamp_min,
|
||||
int_bld->zero, *level1_out, "");
|
||||
first_level, *level1_out, "");
|
||||
|
||||
*lod_fpart_inout = LLVMBuildSelect(builder, clamp_min,
|
||||
float_bld->zero, *lod_fpart_inout, "");
|
||||
|
||||
/* lod_ipart >= last_level */
|
||||
/* *level0_out >= last_level */
|
||||
clamp_max = LLVMBuildICmp(builder, LLVMIntSGE,
|
||||
lod_ipart, last_level,
|
||||
*level0_out, last_level,
|
||||
"clamp_lod_to_last");
|
||||
|
||||
*level0_out = LLVMBuildSelect(builder, clamp_max,
|
||||
|
@@ -120,6 +120,12 @@ struct lp_sampler_dynamic_state
|
||||
struct gallivm_state *gallivm,
|
||||
unsigned unit);
|
||||
|
||||
/** Obtain the first mipmap level (base level) (returns int32) */
|
||||
LLVMValueRef
|
||||
(*first_level)( const struct lp_sampler_dynamic_state *state,
|
||||
struct gallivm_state *gallivm,
|
||||
unsigned unit);
|
||||
|
||||
/** Obtain the number of mipmap levels minus one (returns int32) */
|
||||
LLVMValueRef
|
||||
(*last_level)( const struct lp_sampler_dynamic_state *state,
|
||||
|
@@ -939,6 +939,7 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
|
||||
LLVMValueRef unswizzled[4];
|
||||
LLVMValueRef face_ddx[4], face_ddy[4];
|
||||
struct lp_build_context h16_bld;
|
||||
LLVMValueRef first_level;
|
||||
LLVMValueRef i32t_zero = lp_build_const_int32(bld->gallivm, 0);
|
||||
|
||||
/* we only support the common/simple wrap modes at this time */
|
||||
@@ -1008,7 +1009,9 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
|
||||
lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0);
|
||||
}
|
||||
else {
|
||||
ilevel0 = i32t_zero;
|
||||
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
|
||||
bld->gallivm, unit);
|
||||
ilevel0 = first_level;
|
||||
}
|
||||
break;
|
||||
case PIPE_TEX_MIPFILTER_NEAREST:
|
||||
@@ -1065,7 +1068,7 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
|
||||
lp_build_sample_mipmap(bld,
|
||||
mag_filter, PIPE_TEX_MIPFILTER_NONE,
|
||||
s, t, r,
|
||||
i32t_zero, NULL, NULL,
|
||||
ilevel0, NULL, NULL,
|
||||
packed_lo, packed_hi);
|
||||
}
|
||||
lp_build_endif(&if_ctx);
|
||||
|
@@ -943,6 +943,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
|
||||
LLVMValueRef ilevel0, ilevel1 = NULL;
|
||||
LLVMValueRef face_ddx[4], face_ddy[4];
|
||||
LLVMValueRef texels[4];
|
||||
LLVMValueRef first_level;
|
||||
LLVMValueRef i32t_zero = lp_build_const_int32(bld->gallivm, 0);
|
||||
unsigned chan;
|
||||
|
||||
@@ -1009,7 +1010,9 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
|
||||
lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0);
|
||||
}
|
||||
else {
|
||||
ilevel0 = i32t_zero;
|
||||
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
|
||||
bld->gallivm, unit);
|
||||
ilevel0 = first_level;
|
||||
}
|
||||
break;
|
||||
case PIPE_TEX_MIPFILTER_NEAREST:
|
||||
@@ -1068,7 +1071,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
|
||||
lp_build_sample_mipmap(bld, unit,
|
||||
mag_filter, PIPE_TEX_MIPFILTER_NONE,
|
||||
s, t, r,
|
||||
i32t_zero, NULL, NULL,
|
||||
ilevel0, NULL, NULL,
|
||||
texels);
|
||||
}
|
||||
lp_build_endif(&if_ctx);
|
||||
|
@@ -307,7 +307,7 @@ typedef int64_t pipe_condvar;
|
||||
* pipe_barrier
|
||||
*/
|
||||
|
||||
#if (defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED)) && !defined(PIPE_OS_ANDROID)
|
||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED)
|
||||
|
||||
typedef pthread_barrier_t pipe_barrier;
|
||||
|
||||
|
@@ -726,6 +726,16 @@ void x86_movzx16(struct x86_function *p, struct x86_reg dst, struct x86_reg src
|
||||
emit_modrm(p, dst, src);
|
||||
}
|
||||
|
||||
void x86_cmovcc( struct x86_function *p,
|
||||
struct x86_reg dst,
|
||||
struct x86_reg src,
|
||||
enum x86_cc cc)
|
||||
{
|
||||
DUMP_RRI( dst, src, cc );
|
||||
emit_2ub( p, 0x0f, 0x40 + cc );
|
||||
emit_modrm( p, dst, src );
|
||||
}
|
||||
|
||||
void x86_xor( struct x86_function *p,
|
||||
struct x86_reg dst,
|
||||
struct x86_reg src )
|
||||
|
@@ -309,6 +309,7 @@ void sse_movmskps( struct x86_function *p, struct x86_reg dst, struct x86_reg sr
|
||||
|
||||
void x86_add( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
|
||||
void x86_and( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
|
||||
void x86_cmovcc( struct x86_function *p, struct x86_reg dst, struct x86_reg src, enum x86_cc cc );
|
||||
void x86_cmp( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
|
||||
void x86_dec( struct x86_function *p, struct x86_reg reg );
|
||||
void x86_inc( struct x86_function *p, struct x86_reg reg );
|
||||
|
@@ -39,7 +39,7 @@ struct translate *translate_create( const struct translate_key *key )
|
||||
struct translate *translate = NULL;
|
||||
|
||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
/*translate = translate_sse2_create( key );*/
|
||||
translate = translate_sse2_create( key );
|
||||
if (translate)
|
||||
return translate;
|
||||
#else
|
||||
|
@@ -1067,6 +1067,8 @@ static boolean init_inputs( struct translate_sse *p,
|
||||
struct translate_buffer *buffer = &p->buffer[varient->buffer_index];
|
||||
|
||||
if (!index_size || varient->instance_divisor) {
|
||||
struct x86_reg buf_max_index = x86_make_disp(p->machine_EDI,
|
||||
get_offset(p, &buffer->max_index));
|
||||
struct x86_reg buf_stride = x86_make_disp(p->machine_EDI,
|
||||
get_offset(p, &buffer->stride));
|
||||
struct x86_reg buf_ptr = x86_make_disp(p->machine_EDI,
|
||||
@@ -1100,14 +1102,17 @@ static boolean init_inputs( struct translate_sse *p,
|
||||
x86_mov(p->func, tmp_EAX, elt);
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: Respect translate_buffer::max_index.
|
||||
/* Clamp to max_index
|
||||
*/
|
||||
x86_cmp(p->func, tmp_EAX, buf_max_index);
|
||||
x86_cmovcc(p->func, tmp_EAX, buf_max_index, cc_AE);
|
||||
|
||||
x86_imul(p->func, tmp_EAX, buf_stride);
|
||||
x64_rexw(p->func);
|
||||
x86_add(p->func, tmp_EAX, buf_base_ptr);
|
||||
|
||||
x86_cmp(p->func, p->count_EBP, p->tmp_EAX);
|
||||
|
||||
|
||||
/* In the linear case, keep the buffer pointer instead of the
|
||||
* index number.
|
||||
@@ -1163,6 +1168,10 @@ static struct x86_reg get_buffer_ptr( struct translate_sse *p,
|
||||
x86_make_disp(p->machine_EDI,
|
||||
get_offset(p, &p->buffer[varient->buffer_index].base_ptr));
|
||||
|
||||
struct x86_reg buf_max_index =
|
||||
x86_make_disp(p->machine_EDI,
|
||||
get_offset(p, &p->buffer[varient->buffer_index].max_index));
|
||||
|
||||
|
||||
|
||||
/* Calculate pointer to current attrib:
|
||||
@@ -1179,6 +1188,12 @@ static struct x86_reg get_buffer_ptr( struct translate_sse *p,
|
||||
x86_mov(p->func, ptr, elt);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Clamp to max_index
|
||||
*/
|
||||
x86_cmp(p->func, ptr, buf_max_index);
|
||||
x86_cmovcc(p->func, ptr, buf_max_index, cc_AE);
|
||||
|
||||
x86_imul(p->func, ptr, buf_stride);
|
||||
x64_rexw(p->func);
|
||||
x86_add(p->func, ptr, buf_base_ptr);
|
||||
|
@@ -270,13 +270,15 @@ util_cpu_detect(void)
|
||||
util_cpu_caps.x86_cpu_type = 8 + ((regs2[0] >> 20) & 255); /* use extended family (P4, IA64) */
|
||||
|
||||
/* general feature flags */
|
||||
util_cpu_caps.has_tsc = (regs2[3] & (1 << 8 )) >> 8; /* 0x0000010 */
|
||||
util_cpu_caps.has_mmx = (regs2[3] & (1 << 23 )) >> 23; /* 0x0800000 */
|
||||
util_cpu_caps.has_sse = (regs2[3] & (1 << 25 )) >> 25; /* 0x2000000 */
|
||||
util_cpu_caps.has_sse2 = (regs2[3] & (1 << 26 )) >> 26; /* 0x4000000 */
|
||||
util_cpu_caps.has_sse3 = (regs2[2] & (1)); /* 0x0000001 */
|
||||
util_cpu_caps.has_ssse3 = (regs2[2] & (1 << 9 )) >> 9; /* 0x0000020 */
|
||||
util_cpu_caps.has_sse4_1 = (regs2[2] & (1 << 19)) >> 19;
|
||||
util_cpu_caps.has_tsc = (regs2[3] >> 8) & 1; /* 0x0000010 */
|
||||
util_cpu_caps.has_mmx = (regs2[3] >> 23) & 1; /* 0x0800000 */
|
||||
util_cpu_caps.has_sse = (regs2[3] >> 25) & 1; /* 0x2000000 */
|
||||
util_cpu_caps.has_sse2 = (regs2[3] >> 26) & 1; /* 0x4000000 */
|
||||
util_cpu_caps.has_sse3 = (regs2[2] >> 0) & 1; /* 0x0000001 */
|
||||
util_cpu_caps.has_ssse3 = (regs2[2] >> 9) & 1; /* 0x0000020 */
|
||||
util_cpu_caps.has_sse4_1 = (regs2[2] >> 19) & 1;
|
||||
util_cpu_caps.has_sse4_2 = (regs2[2] >> 20) & 1;
|
||||
util_cpu_caps.has_avx = (regs2[2] >> 28) & 1;
|
||||
util_cpu_caps.has_mmx2 = util_cpu_caps.has_sse; /* SSE cpus supports mmxext too */
|
||||
|
||||
cacheline = ((regs2[1] >> 8) & 0xFF) * 8;
|
||||
@@ -290,10 +292,10 @@ util_cpu_detect(void)
|
||||
|
||||
cpuid(0x80000001, regs2);
|
||||
|
||||
util_cpu_caps.has_mmx |= (regs2[3] & (1 << 23 )) >> 23; /* 0x0800000 */
|
||||
util_cpu_caps.has_mmx2 |= (regs2[3] & (1 << 22 )) >> 22; /* 0x400000 */
|
||||
util_cpu_caps.has_3dnow = (regs2[3] & (1 << 31 )) >> 31; /* 0x80000000 */
|
||||
util_cpu_caps.has_3dnow_ext = (regs2[3] & (1 << 30 )) >> 30;
|
||||
util_cpu_caps.has_mmx |= (regs2[3] >> 23) & 1;
|
||||
util_cpu_caps.has_mmx2 |= (regs2[3] >> 22) & 1;
|
||||
util_cpu_caps.has_3dnow = (regs2[3] >> 31) & 1;
|
||||
util_cpu_caps.has_3dnow_ext = (regs2[3] >> 30) & 1;
|
||||
}
|
||||
|
||||
if (regs[0] >= 0x80000006) {
|
||||
@@ -329,6 +331,8 @@ util_cpu_detect(void)
|
||||
debug_printf("util_cpu_caps.has_sse3 = %u\n", util_cpu_caps.has_sse3);
|
||||
debug_printf("util_cpu_caps.has_ssse3 = %u\n", util_cpu_caps.has_ssse3);
|
||||
debug_printf("util_cpu_caps.has_sse4_1 = %u\n", util_cpu_caps.has_sse4_1);
|
||||
debug_printf("util_cpu_caps.has_sse4_2 = %u\n", util_cpu_caps.has_sse4_2);
|
||||
debug_printf("util_cpu_caps.has_avx = %u\n", util_cpu_caps.has_avx);
|
||||
debug_printf("util_cpu_caps.has_3dnow = %u\n", util_cpu_caps.has_3dnow);
|
||||
debug_printf("util_cpu_caps.has_3dnow_ext = %u\n", util_cpu_caps.has_3dnow_ext);
|
||||
debug_printf("util_cpu_caps.has_altivec = %u\n", util_cpu_caps.has_altivec);
|
||||
|
@@ -53,6 +53,8 @@ struct util_cpu_caps {
|
||||
unsigned has_sse3:1;
|
||||
unsigned has_ssse3:1;
|
||||
unsigned has_sse4_1:1;
|
||||
unsigned has_sse4_2:1;
|
||||
unsigned has_avx:1;
|
||||
unsigned has_3dnow:1;
|
||||
unsigned has_3dnow_ext:1;
|
||||
unsigned has_altivec:1;
|
||||
|
@@ -39,6 +39,7 @@
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
#include "pipe/p_compiler.h"
|
||||
|
||||
|
||||
struct list_head
|
||||
@@ -47,50 +48,56 @@ struct list_head
|
||||
struct list_head *next;
|
||||
};
|
||||
|
||||
static INLINE void list_inithead(struct list_head *item)
|
||||
{
|
||||
item->prev = item;
|
||||
item->next = item;
|
||||
}
|
||||
|
||||
#define LIST_INITHEAD(__item) \
|
||||
do { \
|
||||
(__item)->prev = (__item); \
|
||||
(__item)->next = (__item); \
|
||||
} while (0)
|
||||
static INLINE void list_add(struct list_head *item, struct list_head *list)
|
||||
{
|
||||
item->prev = list;
|
||||
item->next = list->next;
|
||||
list->next->prev = item;
|
||||
list->next = item;
|
||||
}
|
||||
|
||||
#define LIST_ADD(__item, __list) \
|
||||
do { \
|
||||
(__item)->prev = (__list); \
|
||||
(__item)->next = (__list)->next; \
|
||||
(__list)->next->prev = (__item); \
|
||||
(__list)->next = (__item); \
|
||||
} while (0)
|
||||
static INLINE void list_addtail(struct list_head *item, struct list_head *list)
|
||||
{
|
||||
item->next = list;
|
||||
item->prev = list->prev;
|
||||
list->prev->next = item;
|
||||
list->prev = item;
|
||||
}
|
||||
|
||||
#define LIST_ADDTAIL(__item, __list) \
|
||||
do { \
|
||||
(__item)->next = (__list); \
|
||||
(__item)->prev = (__list)->prev; \
|
||||
(__list)->prev->next = (__item); \
|
||||
(__list)->prev = (__item); \
|
||||
} while(0)
|
||||
static INLINE void list_replace(struct list_head *from, struct list_head *to)
|
||||
{
|
||||
to->prev = from->prev;
|
||||
to->next = from->next;
|
||||
from->next->prev = to;
|
||||
from->prev->next = to;
|
||||
}
|
||||
|
||||
#define LIST_REPLACE(__from, __to) \
|
||||
do { \
|
||||
(__to)->prev = (__from)->prev; \
|
||||
(__to)->next = (__from)->next; \
|
||||
(__from)->next->prev = (__to); \
|
||||
(__from)->prev->next = (__to); \
|
||||
} while (0)
|
||||
static INLINE void list_del(struct list_head *item)
|
||||
{
|
||||
item->prev->next = item->next;
|
||||
item->next->prev = item->prev;
|
||||
}
|
||||
|
||||
#define LIST_DEL(__item) \
|
||||
do { \
|
||||
(__item)->prev->next = (__item)->next; \
|
||||
(__item)->next->prev = (__item)->prev; \
|
||||
} while(0)
|
||||
static INLINE void list_delinit(struct list_head *item)
|
||||
{
|
||||
item->prev->next = item->next;
|
||||
item->next->prev = item->prev;
|
||||
item->next = item;
|
||||
item->prev = item;
|
||||
}
|
||||
|
||||
#define LIST_DELINIT(__item) \
|
||||
do { \
|
||||
(__item)->prev->next = (__item)->next; \
|
||||
(__item)->next->prev = (__item)->prev; \
|
||||
(__item)->next = (__item); \
|
||||
(__item)->prev = (__item); \
|
||||
} while(0)
|
||||
#define LIST_INITHEAD(__item) list_inithead(__item)
|
||||
#define LIST_ADD(__item, __list) list_add(__item, __list)
|
||||
#define LIST_ADDTAIL(__item, __list) list_addtail(__item, __list)
|
||||
#define LIST_REPLACE(__from, __to) list_replace(__from, __to)
|
||||
#define LIST_DEL(__item) list_del(__item)
|
||||
#define LIST_DELINIT(__item) list_delinit(__item)
|
||||
|
||||
#define LIST_ENTRY(__type, __item, __field) \
|
||||
((__type *)(((char *)(__item)) - offsetof(__type, __field)))
|
||||
@@ -114,4 +121,21 @@ struct list_head
|
||||
storage = container_of(pos->member.next, pos, member); \
|
||||
&pos->member != (head); \
|
||||
pos = storage, storage = container_of(storage->member.next, storage, member))
|
||||
|
||||
#define LIST_FOR_EACH_ENTRY_SAFE_REV(pos, storage, head, member) \
|
||||
for (pos = container_of((head)->prev, pos, member), \
|
||||
storage = container_of(pos->member.prev, pos, member); \
|
||||
&pos->member != (head); \
|
||||
pos = storage, storage = container_of(storage->member.prev, storage, member))
|
||||
|
||||
#define LIST_FOR_EACH_ENTRY_FROM(pos, start, head, member) \
|
||||
for (pos = container_of((start), pos, member); \
|
||||
&pos->member != (head); \
|
||||
pos = container_of(pos->member.next, pos, member))
|
||||
|
||||
#define LIST_FOR_EACH_ENTRY_FROM_REV(pos, start, head, member) \
|
||||
for (pos = container_of((start), pos, member); \
|
||||
&pos->member != (head); \
|
||||
pos = container_of(pos->member.prev, pos, member))
|
||||
|
||||
#endif /*_U_DOUBLE_LIST_H_*/
|
||||
|
99
src/gallium/auxiliary/util/u_draw.c
Normal file
99
src/gallium/auxiliary/util/u_draw.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2011 VMware, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL VMWARE 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 "util/u_debug.h"
|
||||
#include "util/u_math.h"
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_draw.h"
|
||||
|
||||
|
||||
/**
|
||||
* Returns the largest legal index value for the current set of bound vertex
|
||||
* buffers. Regardless of any other consideration, all vertex lookups need to
|
||||
* be clamped to 0..max_index to prevent an out-of-bound access.
|
||||
*/
|
||||
unsigned
|
||||
util_draw_max_index(
|
||||
const struct pipe_vertex_buffer *vertex_buffers,
|
||||
unsigned nr_vertex_buffers,
|
||||
const struct pipe_vertex_element *vertex_elements,
|
||||
unsigned nr_vertex_elements,
|
||||
const struct pipe_draw_info *info)
|
||||
{
|
||||
unsigned max_index;
|
||||
unsigned i;
|
||||
|
||||
max_index = ~0;
|
||||
for (i = 0; i < nr_vertex_elements; i++) {
|
||||
const struct pipe_vertex_element *element =
|
||||
&vertex_elements[i];
|
||||
const struct pipe_vertex_buffer *buffer =
|
||||
&vertex_buffers[element->vertex_buffer_index];
|
||||
unsigned buffer_size;
|
||||
const struct util_format_description *format_desc;
|
||||
unsigned format_size;
|
||||
|
||||
assert(buffer->buffer->height0 == 1);
|
||||
assert(buffer->buffer->depth0 == 1);
|
||||
buffer_size = buffer->buffer->width0;
|
||||
|
||||
format_desc = util_format_description(element->src_format);
|
||||
assert(format_desc->block.width == 1);
|
||||
assert(format_desc->block.height == 1);
|
||||
assert(format_desc->block.bits % 8 == 0);
|
||||
format_size = format_desc->block.bits/8;
|
||||
|
||||
assert(buffer_size - buffer->buffer_offset <= buffer_size);
|
||||
buffer_size -= buffer->buffer_offset;
|
||||
|
||||
assert(buffer_size - element->src_offset <= buffer_size);
|
||||
buffer_size -= element->src_offset;
|
||||
|
||||
assert(buffer_size - format_size <= buffer_size);
|
||||
buffer_size -= format_size;
|
||||
|
||||
if (buffer->stride != 0) {
|
||||
unsigned buffer_max_index;
|
||||
|
||||
buffer_max_index = buffer_size / buffer->stride;
|
||||
|
||||
if (element->instance_divisor == 0) {
|
||||
/* Per-vertex data */
|
||||
max_index = MIN2(max_index, buffer_max_index);
|
||||
}
|
||||
else {
|
||||
/* Per-instance data. Simply make sure the state tracker didn't
|
||||
* request more instances than those that fit in the buffer */
|
||||
assert((info->start_instance + info->instance_count)/element->instance_divisor
|
||||
<= (buffer_max_index + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return max_index;
|
||||
}
|
@@ -34,6 +34,11 @@
|
||||
#include "pipe/p_state.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
static INLINE void
|
||||
util_draw_init_info(struct pipe_draw_info *info)
|
||||
{
|
||||
@@ -136,4 +141,18 @@ util_draw_range_elements(struct pipe_context *pipe,
|
||||
pipe->draw_vbo(pipe, &info);
|
||||
}
|
||||
|
||||
|
||||
unsigned
|
||||
util_draw_max_index(
|
||||
const struct pipe_vertex_buffer *vertex_buffers,
|
||||
unsigned nr_vertex_buffers,
|
||||
const struct pipe_vertex_element *vertex_elements,
|
||||
unsigned nr_vertex_elements,
|
||||
const struct pipe_draw_info *info);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !U_DRAW_H */
|
||||
|
@@ -88,6 +88,14 @@ PIPE_FORMAT_L16_UNORM , plain, 1, 1, un16, , , , xxx1, r
|
||||
PIPE_FORMAT_A16_UNORM , plain, 1, 1, un16, , , , 000x, rgb
|
||||
PIPE_FORMAT_I16_UNORM , plain, 1, 1, un16, , , , xxxx, rgb
|
||||
PIPE_FORMAT_L16A16_UNORM , plain, 1, 1, un16, un16, , , xxxy, rgb
|
||||
PIPE_FORMAT_A8_SNORM , plain, 1, 1, sn8 , , , , 000x, rgb
|
||||
PIPE_FORMAT_L8_SNORM , plain, 1, 1, sn8 , , , , xxx1, rgb
|
||||
PIPE_FORMAT_L8A8_SNORM , plain, 1, 1, sn8 , sn8 , , , xxxy, rgb
|
||||
PIPE_FORMAT_I8_SNORM , plain, 1, 1, sn8 , , , , xxxx, rgb
|
||||
PIPE_FORMAT_A16_SNORM , plain, 1, 1, sn16, , , , 000x, rgb
|
||||
PIPE_FORMAT_L16_SNORM , plain, 1, 1, sn16, , , , xxx1, rgb
|
||||
PIPE_FORMAT_L16A16_SNORM , plain, 1, 1, sn16, sn16, , , xxxy, rgb
|
||||
PIPE_FORMAT_I16_SNORM , plain, 1, 1, sn16, , , , xxxx, rgb
|
||||
|
||||
# SRGB formats
|
||||
PIPE_FORMAT_L8_SRGB , plain, 1, 1, un8 , , , , xxx1, srgb
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 3.
|
@@ -199,16 +199,6 @@ roundf(float x)
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
|
||||
#ifdef PIPE_OS_ANDROID
|
||||
|
||||
static INLINE
|
||||
double log2(double d)
|
||||
{
|
||||
return log(d) / M_LN2;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -499,7 +499,7 @@ void u_vbuf_mgr_set_vertex_buffers(struct u_vbuf_mgr *mgrb,
|
||||
/* Update the maximum index. */
|
||||
mgr->b.max_index =
|
||||
MIN2(mgr->b.max_index,
|
||||
(vb->buffer->width0 - vb->buffer_offset) / vb->stride);
|
||||
(vb->buffer->width0 - vb->buffer_offset) / vb->stride - 1);
|
||||
}
|
||||
|
||||
for (; i < mgr->b.nr_real_vertex_buffers; i++) {
|
||||
@@ -572,7 +572,11 @@ void u_vbuf_mgr_draw_begin(struct u_vbuf_mgr *mgrb,
|
||||
int min_index, max_index;
|
||||
|
||||
min_index = info->min_index - info->index_bias;
|
||||
max_index = info->max_index - info->index_bias;
|
||||
if (info->max_index == ~0) {
|
||||
max_index = mgr->b.max_index;
|
||||
} else {
|
||||
max_index = MIN2(info->max_index - info->index_bias, mgr->b.max_index);
|
||||
}
|
||||
|
||||
/* Translate vertices with non-native layouts or formats. */
|
||||
if (mgr->incompatible_vb_layout || mgr->ve->incompatible_layout) {
|
||||
|
@@ -53,7 +53,7 @@ struct u_vbuf_mgr {
|
||||
int nr_real_vertex_buffers;
|
||||
|
||||
/* Precomputed max_index for hardware vertex buffers. */
|
||||
int max_index;
|
||||
unsigned max_index;
|
||||
|
||||
/* This uploader can optionally be used by the driver.
|
||||
*
|
||||
|
@@ -7,6 +7,30 @@ The rasterizer state controls the rendering of points, lines and triangles.
|
||||
Attributes include polygon culling state, line width, line stipple,
|
||||
multisample state, scissoring and flat/smooth shading.
|
||||
|
||||
Linkage
|
||||
|
||||
clamp_vertex_color
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
If set, TGSI_SEMANTIC_COLOR registers are clamped to the [0, 1] range after
|
||||
the execution of the vertex shader, before being passed to the geometry
|
||||
shader or fragment shader.
|
||||
|
||||
OpenGL: glClampColor(GL_CLAMP_VERTEX_COLOR) in GL 3.0 or GL_ARB_color_buffer_float
|
||||
|
||||
D3D11: seems always disabled
|
||||
|
||||
clamp_fragment_color
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Controls whether TGSI_SEMANTIC_COLOR outputs of the fragment shader
|
||||
are clamped to [0, 1].
|
||||
|
||||
OpenGL: glClampColor(GL_CLAMP_FRAGMENT_COLOR) in GL 3.0 or ARB_color_buffer_float
|
||||
|
||||
D3D11: seems always disabled
|
||||
|
||||
|
||||
Shading
|
||||
-------
|
||||
|
||||
|
@@ -1 +0,0 @@
|
||||
include $(call all-subdir-makefiles)
|
@@ -1,48 +0,0 @@
|
||||
ifeq ($(strip $(MESA_BUILD_I915G)),true)
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
# from Makefile
|
||||
C_SOURCES = \
|
||||
i915_blit.c \
|
||||
i915_clear.c \
|
||||
i915_flush.c \
|
||||
i915_context.c \
|
||||
i915_debug.c \
|
||||
i915_debug_fp.c \
|
||||
i915_state.c \
|
||||
i915_state_immediate.c \
|
||||
i915_state_dynamic.c \
|
||||
i915_state_derived.c \
|
||||
i915_state_emit.c \
|
||||
i915_state_fpc.c \
|
||||
i915_state_sampler.c \
|
||||
i915_state_static.c \
|
||||
i915_screen.c \
|
||||
i915_prim_emit.c \
|
||||
i915_prim_vbuf.c \
|
||||
i915_resource.c \
|
||||
i915_resource_texture.c \
|
||||
i915_resource_buffer.c \
|
||||
i915_fpc_emit.c \
|
||||
i915_fpc_translate.c \
|
||||
i915_surface.c
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(C_SOURCES)
|
||||
|
||||
LOCAL_CFLAGS := \
|
||||
-fvisibility=hidden \
|
||||
-Wno-sign-compare
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
external/mesa/src/gallium/include \
|
||||
external/mesa/src/gallium/auxiliary
|
||||
|
||||
LOCAL_MODULE := libmesa_pipe_i915
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
endif # MESA_BUILD_I915G
|
@@ -55,7 +55,7 @@ i915_buffer_destroy(struct pipe_screen *screen,
|
||||
{
|
||||
struct i915_buffer *buffer = i915_buffer(resource);
|
||||
if (buffer->free_on_destroy)
|
||||
FREE(buffer->data);
|
||||
align_free(buffer->data);
|
||||
FREE(buffer);
|
||||
}
|
||||
|
||||
|
@@ -54,6 +54,7 @@ lp_jit_create_types(struct llvmpipe_context *lp)
|
||||
elem_types[LP_JIT_TEXTURE_WIDTH] =
|
||||
elem_types[LP_JIT_TEXTURE_HEIGHT] =
|
||||
elem_types[LP_JIT_TEXTURE_DEPTH] =
|
||||
elem_types[LP_JIT_TEXTURE_FIRST_LEVEL] =
|
||||
elem_types[LP_JIT_TEXTURE_LAST_LEVEL] = LLVMInt32TypeInContext(lc);
|
||||
elem_types[LP_JIT_TEXTURE_ROW_STRIDE] =
|
||||
elem_types[LP_JIT_TEXTURE_IMG_STRIDE] =
|
||||
@@ -81,6 +82,9 @@ lp_jit_create_types(struct llvmpipe_context *lp)
|
||||
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, depth,
|
||||
gallivm->target, texture_type,
|
||||
LP_JIT_TEXTURE_DEPTH);
|
||||
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, first_level,
|
||||
gallivm->target, texture_type,
|
||||
LP_JIT_TEXTURE_FIRST_LEVEL);
|
||||
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, last_level,
|
||||
gallivm->target, texture_type,
|
||||
LP_JIT_TEXTURE_LAST_LEVEL);
|
||||
|
@@ -50,6 +50,7 @@ struct lp_jit_texture
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t depth;
|
||||
uint32_t first_level;
|
||||
uint32_t last_level;
|
||||
uint32_t row_stride[LP_MAX_TEXTURE_LEVELS];
|
||||
uint32_t img_stride[LP_MAX_TEXTURE_LEVELS];
|
||||
@@ -66,6 +67,7 @@ enum {
|
||||
LP_JIT_TEXTURE_WIDTH = 0,
|
||||
LP_JIT_TEXTURE_HEIGHT,
|
||||
LP_JIT_TEXTURE_DEPTH,
|
||||
LP_JIT_TEXTURE_FIRST_LEVEL,
|
||||
LP_JIT_TEXTURE_LAST_LEVEL,
|
||||
LP_JIT_TEXTURE_ROW_STRIDE,
|
||||
LP_JIT_TEXTURE_IMG_STRIDE,
|
||||
|
@@ -166,6 +166,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
|
||||
return 0;
|
||||
case PIPE_CAP_TGSI_INSTANCEID:
|
||||
case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR:
|
||||
case PIPE_CAP_MIXED_COLORBUFFER_FORMATS:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
|
@@ -653,6 +653,7 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
|
||||
jit_tex->width = tex->width0;
|
||||
jit_tex->height = tex->height0;
|
||||
jit_tex->depth = tex->depth0;
|
||||
jit_tex->first_level = view->u.tex.first_level;
|
||||
jit_tex->last_level = tex->last_level;
|
||||
|
||||
/* We're referencing the texture's internal data, so save a
|
||||
@@ -663,7 +664,7 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
|
||||
if (!lp_tex->dt) {
|
||||
/* regular texture - setup array of mipmap level pointers */
|
||||
int j;
|
||||
for (j = 0; j <= tex->last_level; j++) {
|
||||
for (j = view->u.tex.first_level; j <= tex->last_level; j++) {
|
||||
jit_tex->data[j] =
|
||||
llvmpipe_get_texture_image_all(lp_tex, j, LP_TEX_USAGE_READ,
|
||||
LP_TEX_LAYOUT_LINEAR);
|
||||
@@ -677,6 +678,7 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
|
||||
jit_tex->width = TILE_SIZE/8;
|
||||
jit_tex->height = TILE_SIZE/8;
|
||||
jit_tex->depth = 1;
|
||||
jit_tex->first_level = 0;
|
||||
jit_tex->last_level = 0;
|
||||
jit_tex->row_stride[j] = 0;
|
||||
jit_tex->img_stride[j] = 0;
|
||||
|
@@ -269,7 +269,7 @@ llvmpipe_prepare_vertex_sampling(struct llvmpipe_context *lp,
|
||||
if (!lp_tex->dt) {
|
||||
/* regular texture - setup array of mipmap level pointers */
|
||||
int j;
|
||||
for (j = 0; j <= tex->last_level; j++) {
|
||||
for (j = view->u.tex.first_level; j <= tex->last_level; j++) {
|
||||
data[j] =
|
||||
llvmpipe_get_texture_image_all(lp_tex, j, LP_TEX_USAGE_READ,
|
||||
LP_TEX_LAYOUT_LINEAR);
|
||||
@@ -293,7 +293,7 @@ llvmpipe_prepare_vertex_sampling(struct llvmpipe_context *lp,
|
||||
draw_set_mapped_texture(lp->draw,
|
||||
i,
|
||||
tex->width0, tex->height0, tex->depth0,
|
||||
tex->last_level,
|
||||
view->u.tex.first_level, tex->last_level,
|
||||
row_stride, img_stride, data);
|
||||
}
|
||||
}
|
||||
|
@@ -149,6 +149,7 @@ lp_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
|
||||
LP_LLVM_TEXTURE_MEMBER(width, LP_JIT_TEXTURE_WIDTH, TRUE)
|
||||
LP_LLVM_TEXTURE_MEMBER(height, LP_JIT_TEXTURE_HEIGHT, TRUE)
|
||||
LP_LLVM_TEXTURE_MEMBER(depth, LP_JIT_TEXTURE_DEPTH, TRUE)
|
||||
LP_LLVM_TEXTURE_MEMBER(first_level, LP_JIT_TEXTURE_FIRST_LEVEL, TRUE)
|
||||
LP_LLVM_TEXTURE_MEMBER(last_level, LP_JIT_TEXTURE_LAST_LEVEL, TRUE)
|
||||
LP_LLVM_TEXTURE_MEMBER(row_stride, LP_JIT_TEXTURE_ROW_STRIDE, FALSE)
|
||||
LP_LLVM_TEXTURE_MEMBER(img_stride, LP_JIT_TEXTURE_IMG_STRIDE, FALSE)
|
||||
@@ -219,6 +220,7 @@ lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
|
||||
sampler->dynamic_state.base.width = lp_llvm_texture_width;
|
||||
sampler->dynamic_state.base.height = lp_llvm_texture_height;
|
||||
sampler->dynamic_state.base.depth = lp_llvm_texture_depth;
|
||||
sampler->dynamic_state.base.first_level = lp_llvm_texture_first_level;
|
||||
sampler->dynamic_state.base.last_level = lp_llvm_texture_last_level;
|
||||
sampler->dynamic_state.base.row_stride = lp_llvm_texture_row_stride;
|
||||
sampler->dynamic_state.base.img_stride = lp_llvm_texture_img_stride;
|
||||
|
@@ -337,6 +337,7 @@ static int noop_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
|
||||
case PIPE_CAP_TEXTURE_SHADOW_MAP:
|
||||
case PIPE_CAP_TEXTURE_SWIZZLE:
|
||||
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
|
||||
case PIPE_CAP_MIXED_COLORBUFFER_FORMATS:
|
||||
|
||||
return 1;
|
||||
case PIPE_CAP_DUAL_SOURCE_BLEND:
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user