Compare commits

..

63 Commits

Author SHA1 Message Date
Chih-Wei Huang
559a79ff87 Merge remote-tracking branch 'x86/froyo-x86' into froyo-next 2011-04-07 16:50:48 +08:00
Chia-I Wu
e87d4d2e31 egl_android: assorted fixes 2011-03-29 06:31:15 +08:00
Chia-I Wu
0c1c261c2d gralloc: glFlush() should suffice for page flipping 2011-03-28 22:33:38 +08:00
Chia-I Wu
f27a8a3321 gralloc: improve page flip blocking
Use DRM_MODE_PAGE_FLIP_EVENT.
2011-03-28 22:20:29 +08:00
Chia-I Wu
98e1078d71 gralloc: boost radeon performance
Allocate buffer from GTT for 2D apps.
2011-03-26 15:59:05 +08:00
Chia-I Wu
1e21885cde gralloc: improve radeon sync issue 2011-03-26 15:46:32 +08:00
Chia-I Wu
7492794ef5 glsl: add missing generated files 2011-03-26 15:20:15 +08:00
Chia-I Wu
16ca82773e gralloc: kernel module name is i915 2011-03-25 16:50:37 +08:00
Chia-I Wu
f84d946322 android: fix building 2011-03-25 03:30:43 +08:00
Chia-I Wu
66c6b2520d st/egl: add support for loading radeon 2011-03-25 03:30:43 +08:00
Chia-I Wu
f3837c7094 egl_android: add support for loading radeon
For completeness.  Not used.
2011-03-25 03:30:43 +08:00
Chia-I Wu
d8ebb254c2 android: use __mmap2 for winsys/r600 2011-03-25 03:30:43 +08:00
Chia-I Wu
dd4929b30b gralloc: add radeon support 2011-03-25 03:30:43 +08:00
Chia-I Wu
0b9a9c408f gralloc: rename i915 to intel 2011-03-25 03:30:43 +08:00
Chia-I Wu
5dddfa8591 gralloc: add multiple driver support 2011-03-25 03:30:43 +08:00
Chia-I Wu
7baac8d734 mesa: fix glDrawTex*
As the case with _mesa_DrawPixels, the driver may install its vertex
shader and the vp override flag should be set.
2011-03-25 03:29:54 +08:00
Chia-I Wu
887b78bb5b auxiliary: disable SSE translate
It does not support FIXED.
2011-03-25 03:29:04 +08:00
Chia-I Wu
d175f38bc3 mesa: one more missing pre-generated file 2011-03-17 15:59:23 +08:00
Chia-I Wu
eeb3391bd5 mesa: add more pre-generated files 2011-03-17 14:46:57 +08:00
Chia-I Wu
06608674d0 egl_android: update surface geometry 2011-03-16 20:18:40 +08:00
Chia-I Wu
9f119b3c51 intel: advertise GL_OES_point_sprite 2011-03-16 20:18:40 +08:00
Chia-I Wu
c4d9c4f7f1 i965c: add MESA_FORMAT_RGBA8888_REV to brw_format_for_mesa_format
The framebuffer uses

  PIXEL_FORMAT_BGRA_8888 -> MESA_FORMAT_ARGB8888

while applications use

  PIXEL_FORMAT_RGBA_8888 -> MESA_FORMAT_RGBA8888_REV
  PIXEL_FORMAT_RGB_565   -> MESA_FORMAT_RGB565
2011-03-16 20:18:40 +08:00
Chia-I Wu
e4706d5cc8 mesa: advertise GL_ARB_texture_non_power_of_two
It maps to DisplayHardware::NPOT_EXTENSION in SurfaceFlinger.
2011-03-16 20:18:40 +08:00
Chia-I Wu
9a3759c3dd android: Add Android.mk's. 2011-03-16 20:18:40 +08:00
Chia-I Wu
f547fef2d0 android: Add pre-generated files.
make -C src/glsl builtin_function.cpp
  make -C src/es1api
  make -C src/es2api
  make -C src/shared-glapi
  make -C src/mesa/mai/api_exec_es{12}.c
2011-03-16 20:18:39 +08:00
Chia-I Wu
73d3113849 android: Add __DRI_IMAGE_FORMAT_RGBA8888_REV. 2011-03-16 20:18:39 +08:00
Chia-I Wu
2b1f1af17f android: Add DRM-based gralloc. 2011-03-16 20:18:39 +08:00
Chia-I Wu
8e698931d7 android: Make egl_android load DRI drivers. 2011-03-16 20:18:39 +08:00
Chia-I Wu
f60af24be7 android: Add new classic EGL driver for Android. 2011-03-16 20:18:39 +08:00
Chia-I Wu
17cd318e41 android: Add android backend for st/egl. 2011-03-16 20:18:39 +08:00
Chia-I Wu
f2d8241f01 android: Add Android EGL extensions. 2011-03-16 20:18:39 +08:00
Chia-I Wu
f9172081ca android: Add _EGL_PLATFORM_ANDROID. 2011-03-16 20:18:39 +08:00
Chia-I Wu
cb4afed922 android: Enable extensions required by ES1 for i915c. 2011-03-16 20:18:39 +08:00
Chia-I Wu
5d1e2165f7 android: Fix depth/stencil with i915c/i965c. 2011-03-16 20:18:39 +08:00
Chia-I Wu
39d1094301 android: Fix GL_OES_EGL_image with SurfaceFlinger. 2011-03-16 20:18:39 +08:00
Chia-I Wu
fb3c3f3079 android: Use __mmap2 in winsys/svga. 2011-03-16 20:18:39 +08:00
Chia-I Wu
c60978b2e0 android: Fix build with bionic. 2011-03-16 20:18:39 +08:00
Chia-I Wu
80a8e7d3d1 i965c: Fix a declaration in for loop. 2011-03-16 20:18:39 +08:00
Chia-I Wu
a0f0662e0c i965c: Add support for GL_FIXED.
Quick and dirty..
2011-03-16 20:18:29 +08:00
Chia-I Wu
d5d833a353 i915c: Add GL_OES_draw_texture support. 2011-03-16 14:17:52 +08:00
Chia-I Wu
32197c0094 i915: Free with FREE. 2011-03-16 14:17:43 +08:00
Chih-Wei Huang
f189dfe9e9 mesa: fix compiling issues with gcc 4.4.x
Gcc 4.4 requires a class with virtual functions has to
define the virtual destructor.
2010-12-29 17:35:47 +08:00
Chia-I Wu
d1ccafa5b7 android: Enable OpenGL ES 2.0. 2010-12-29 16:56:47 +08:00
Chia-I Wu
f7a0636329 i965: Add support for GL_FIXED. 2010-12-11 21:47:18 +08:00
Chih-Wei Huang
6269411b81 android: enable support of i965c 2010-12-09 20:01:35 -05:00
Chia-I Wu
88721c8555 android: Add Android.mk's. 2010-12-09 20:01:35 -05:00
Chia-I Wu
4128957d30 android: Add pre-generated files. 2010-12-09 20:01:35 -05:00
Chia-I Wu
07a8209c3f android: Add __DRI_IMAGE_FORMAT_RGBA8888_REV. 2010-12-09 20:01:35 -05:00
Chia-I Wu
b0a79b3512 android: Add DRM-based gralloc. 2010-12-09 20:01:35 -05:00
Chia-I Wu
121fc671f4 android: Add new classic EGL driver for Android. 2010-12-09 20:01:35 -05:00
Chia-I Wu
8148db591a android: Add android backend for st/egl. 2010-12-09 20:01:35 -05:00
Chia-I Wu
0d4dcb2584 android: Add Android EGL extensions. 2010-12-09 20:01:35 -05:00
Chia-I Wu
1337551451 android: Add _EGL_PLATFORM_ANDROID. 2010-12-09 20:01:35 -05:00
Chia-I Wu
6719d59a85 android: Enable extensions required by ES1 for i915c. 2010-12-09 20:01:35 -05:00
Chia-I Wu
3fe7753b70 android: Fix depth/stencil with i915c. 2010-12-09 20:01:34 -05:00
Chia-I Wu
017c563cff android: Fix GL_OES_EGL_image with SurfaceFlinger. 2010-12-09 20:01:34 -05:00
Chia-I Wu
bf21df37c6 android: Use __mmap2 in winsys/svga. 2010-12-09 20:01:34 -05:00
Chia-I Wu
17935c0191 android: Fix build with bionic. 2010-12-09 20:01:34 -05:00
Chia-I Wu
7aceb74db7 i915c: Add GL_OES_draw_texture support. 2010-12-09 20:01:34 -05:00
Chia-I Wu
88e9712a68 tnl: Add support for GL_FIXED. 2010-12-09 20:01:34 -05:00
Chia-I Wu
2e9e27c0f7 i915: Free with FREE. 2010-12-09 19:39:22 -05:00
Chia-I Wu
455a7585de targets/egl-gdi: Optional support for DRM screen. 2010-12-09 19:39:22 -05:00
Chia-I Wu
25ed79d830 Revert "egl: Drop broken _EGL_PLATFORM_NO_OS code"
This reverts commit 021a68b7e8.
2010-12-09 19:39:22 -05:00
612 changed files with 115967 additions and 22941 deletions

3
Android.mk Normal file
View File

@@ -0,0 +1,3 @@
ifneq ($(TARGET_SIMULATOR),true)
include $(call all-subdir-makefiles)
endif

View File

@@ -5,10 +5,7 @@ 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 ; \
@@ -202,7 +199,6 @@ 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 \

View File

@@ -1,10 +0,0 @@
#!/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

View File

@@ -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 r600 radeon \
DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon \
savage sis tdfx unichrome swrast
INTEL_LIBS = `pkg-config --libs libdrm_intel`

View File

@@ -729,27 +729,6 @@ 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
@@ -783,17 +762,12 @@ 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="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
GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED"
DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
# find the DRI deps for libGL
if test "$x11_pkgconfig" = yes; then
@@ -936,6 +910,12 @@ 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...@:>@],
@@ -1026,16 +1006,6 @@ 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

View File

@@ -1,4 +0,0 @@
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)

View File

@@ -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) DONE
Clamping controls (GL_ARB_color_buffer_float) BRANCH ~mareko/mesa floating2
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) DONE (gallium)
Signed normalized textures (GL_EXT_texture_snorm) ~50% done
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 DONE (gallium)
GL_ARB_sampler_objects not started
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)

View File

@@ -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
aperture. The function
aperature. The function
GLuint glXGetAGPOffsetMESA( const GLvoid *pointer )

View File

@@ -24,7 +24,7 @@ Number
Dependencies
Requires EGL 1.4 or later. This extension is written against the
Reguires 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 referencing an EGLImage in a client API, the
client APIs. By referenceing 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,

View File

@@ -48,7 +48,7 @@ IP Status
Issues
1. Should we also define UNPACK_INVERT_MESA for glDrawPixels, etc?
1. Should we also defined 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

View File

@@ -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 ancillary data associated with the window
destroyed in order to free any ancilliary 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 accumu-
lation buffer associated with a drawable can be freed.
when the back color buffer, depth buffer, stencil buffer, and/or accum-
ulation 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 ancillary buffers (back buffer, depth, stencil,
causes all software ancilliary 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

View File

@@ -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 response to window size
since most applications call glViewport in responce 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 glResizeBuffersMESA is called between
INVALID_OPERATION is generated if ResizeBuffersMESA is called betweeen
Begin and End.
New State

View File

@@ -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 synchro-
nized to a video frame. The <interval> value is silently clamped to
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
the maximum implementation-dependent value supported before being
stored.

View File

@@ -328,7 +328,7 @@ Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization)
-- Section 3.8.10 "Texture Completeness"
Change the second paragraph (page 177) to say (spec changes identical
Change the second paragaph (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-dimensional, rectangle, and
texture lookups from one- and two-dimesional, 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-dimensional array texture targets, let R be the interpolated
from two-dimesional 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 paragraph on page 242 to say (spec changes
Change the first paragraphi on page 242 to say (spec changes
identical to EXT_texture_array):
"TexImage3D, TexImage2D, TexImage1D, Histogram, and ColorTable are

View File

@@ -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 superseded by fragment
but also a lot of functionality which has been superceded 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. Particularly the mapping given in NV_texture_shader or
cannot do this. Particulary 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

View File

@@ -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
implicitly set to 0 and w implicitly set to 1).
implicititly 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 between
INVALID_OPERATION is generated if WindowPosMESA is called betweeen
Begin and End.
New State

View File

@@ -26,7 +26,7 @@ Number
Dependencies
OpenGL 1.0 or later is required
This extension is written against the OpenGL 1.4 Specification.
This extensions 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 field assignments):
add the following to Table 3.12 (Packed pixel fiedl assignments):
First Second Third Fourth
Format Element Element Element Element

View File

@@ -25,7 +25,7 @@ Number
Dependencies
Requires EGL 1.4 or later. This extension is written against the
Reguires 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 an implementation specific wayland interface, allows the
Adding a implementation specific wayland interface, allows the
EGL implementation to define specific wayland requests and events,
needed for buffer sharing in an EGL wayland platform.
needed for buffer sharing in a EGL wayland platform.
IP Status

View File

@@ -62,7 +62,6 @@ 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>

View File

@@ -21,52 +21,76 @@ When a new release is coming, release candidates (betas) may be found
<p>
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.
Mesa is distributed in several parts:
</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>
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.
If you're not interested in running the demos, you'll only need the first
package.
</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>
To unpack .tar.gz files:
All the packages should be in the same directory prior to unpacking.
</p>
<ul>
<li>To unpack .tar.gz files:
<pre>
tar zxf MesaLib-x.y.z.tar.gz
tar zxf MesaLib-X.Y.tar.gz
tar zxf MesaDemos-X.Y.tar.gz
tar zxf MesaGLUT-X.Y.tar.gz
</pre>
or
<pre>
gzcat MesaLib-x.y.z.tar.gz | tar xf -
gzcat MesaLib-X.Y.tar.gz | tar xf -
gzcat MesaDemos-X.Y.tar.gz | tar xf -
gzcat MesaGLUT-X.Y.tar.gz | tar xf -
</pre>
or
<pre>
gunzip MesaLib-x.y.z.tar.gz ; tar xf MesaLib-x.y.z.tar
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
</pre>
<p>
To unpack .tar.bz2 files:
</p>
<li>To unpack .tar.bz2 files:
<pre>
bunzip2 -c MesaLib-x.y.z.tar.gz | tar xf -
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 -
</pre>
<p>
To unpack .zip files:
</p>
<li>To unpack .zip files:
<pre>
unzip MesaLib-x.y.z.zip
unzip MesaLib-X.Y.zip
unzip MesaDemos-X.Y.zip
unzip MesaGLUT-X.Y.zip
</pre>
</ul>
<h1>Contents</h1>
@@ -82,13 +106,22 @@ 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 MesaGLUT.x.y.z package:
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:
<pre>
src/glut - GLUT library source code
</pre>

View File

@@ -49,15 +49,6 @@ 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>

View File

@@ -12,16 +12,16 @@
<ol>
<li><a href="#unix-x11">Unix / X11</a>
<ul>
<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="#prereq">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">Building with SCons</a>
<li><a href="#scons">SCons</a>
<li><a href="#other">Other</a>
</ol>
<br>
@@ -31,22 +31,8 @@
<H2>1. Unix/X11 Compilation and Installation</H1>
<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>
<a name="prereq">
<h3>1.1 Prerequisites for DRI and hardware acceleration</h3>
<p>
The following are required for DRI-based hardware acceleration with Mesa:
@@ -63,7 +49,7 @@ version 2.4.15 or later
<a name="autoconf">
<h3>1.3 Building with Autoconf</h3>
<h3>1.2 Building with Autoconf</h3>
<p>
Mesa may be <a href="autoconf.html">built using autoconf</a>.
@@ -73,7 +59,7 @@ If that fails the traditional Mesa build system is available.
<a name="traditional">
<h3>1.4 Building with traditional Makefiles</h3>
<h3>1.3 Building with traditional Makefiles</h3>
<p>
The traditional Mesa build system is based on a collection of pre-defined
@@ -140,7 +126,7 @@ Later, if you want to rebuild for a different configuration run
<a name="libs">
<h3>1.5 The libraries</h3>
<h3>1.4 The libraries</h3>
<p>
When compilation has finished, look in the top-level <code>lib/</code>
@@ -199,11 +185,81 @@ 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 built with Gallium support, look in lib/gallium/ for Gallium-based
versions of libGL and device drivers.
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.
</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">

View File

@@ -11,13 +11,6 @@
<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>

View File

@@ -1,206 +0,0 @@
<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&lt;5 &amp;&amp; i&lt;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-&gt;_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>

View File

@@ -41,7 +41,6 @@ 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>

View File

@@ -14,7 +14,6 @@ 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>

View File

@@ -390,6 +390,20 @@ 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
}

View File

@@ -84,6 +84,15 @@ 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

View File

@@ -655,8 +655,6 @@ 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
@@ -687,6 +685,8 @@ 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

View File

@@ -813,6 +813,7 @@ 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

72
scons/python.py Normal file
View File

@@ -0,0 +1,72 @@
"""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 Normal file
View File

@@ -0,0 +1,115 @@
# 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

111
src/egl/Android.mk Normal file
View File

@@ -0,0 +1,111 @@
# 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

View File

@@ -0,0 +1,762 @@
/*
* 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;
}

View File

@@ -0,0 +1,129 @@
/*
* 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_ */

View File

@@ -0,0 +1,347 @@
/*
* 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;
}

View File

@@ -0,0 +1,134 @@
/*
* 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;
}

View File

@@ -0,0 +1,42 @@
/*
* 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;
}

View File

@@ -462,12 +462,6 @@ 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:

View File

@@ -708,6 +708,11 @@ 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

View File

@@ -429,7 +429,7 @@ wayland_create_buffer(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer)
}
static void
wayland_frame_callback(struct wl_surface *surface, void *data, uint32_t time)
wayland_frame_callback(void *data, uint32_t time)
{
struct dri2_egl_surface *dri2_surf = data;
@@ -459,8 +459,7 @@ 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,
dri2_surf->wl_win->surface,
wayland_frame_callback, dri2_surf);
wayland_frame_callback, dri2_surf);
if (dri2_surf->type == DRI2_WINDOW_SURFACE) {
pointer_swap(
@@ -678,7 +677,11 @@ 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;

View File

@@ -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_BUFFER_SIZE));
swrastCreateDrawable(dri2_dpy, dri2_surf, _eglGetConfigKey(conf, EGL_DEPTH_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 | O_CLOEXEC);
dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR);
if (dri2_dpy->fd == -1) {
_eglLog(_EGL_WARNING,
"DRI2: could not open %s (%s)", dri2_dpy->device_name,
@@ -1030,7 +1030,11 @@ 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;

View File

@@ -917,6 +917,9 @@ 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 }
};
@@ -1535,3 +1538,25 @@ 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

View File

@@ -101,6 +101,10 @@ 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
*/
@@ -180,6 +184,10 @@ struct _egl_api
BindWaylandDisplayWL_t BindWaylandDisplayWL;
UnbindWaylandDisplayWL_t UnbindWaylandDisplayWL;
#endif
#ifdef EGL_ANDROID_swap_rectangle
SetSwapRectangleANDROID_t SetSwapRectangleANDROID;
#endif
};
#endif /* EGLAPI_INCLUDED */

View File

@@ -29,7 +29,8 @@ _eglGetNativePlatformFromEnv(void)
{ _EGL_PLATFORM_X11, "x11" },
{ _EGL_PLATFORM_WAYLAND, "wayland" },
{ _EGL_PLATFORM_DRM, "drm" },
{ _EGL_PLATFORM_FBDEV, "fbdev" }
{ _EGL_PLATFORM_FBDEV, "fbdev" },
{ _EGL_PLATFORM_ANDROID, "android" }
};
_EGLPlatformType plat = _EGL_INVALID_PLATFORM;
const char *plat_name;

View File

@@ -14,6 +14,7 @@ enum _egl_platform_type {
_EGL_PLATFORM_WAYLAND,
_EGL_PLATFORM_DRM,
_EGL_PLATFORM_FBDEV,
_EGL_PLATFORM_ANDROID,
_EGL_NUM_PLATFORMS,
_EGL_INVALID_PLATFORM = -1
@@ -77,6 +78,9 @@ struct _egl_extensions
EGLBoolean NOK_swap_region;
EGLBoolean NOK_texture_from_pixmap;
EGLBoolean ANDROID_image_native_buffer;
EGLBoolean ANDROID_swap_rectangle;
};

View File

@@ -40,6 +40,9 @@ 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

View File

@@ -58,6 +58,10 @@ extern _EGLDriver *
_eglBuiltInDriverGALLIUM(const char *args);
extern _EGLDriver *
_eglBuiltInDriverANDROID(const char *args);
extern _EGLDriver *
_eglBuiltInDriverDRI2(const char *args);

View File

@@ -111,6 +111,9 @@ _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
}

View File

@@ -12,8 +12,7 @@ wayland_drm_OBJECTS = $(wayland_drm_SOURCES:.c=.o)
wayland_drm_INCLUDES = \
$(WAYLAND_CFLAGS) \
-I$(TOP)/src/egl/main \
-I$(TOP)/include
-I$(TOP)/src/egl/main
# Generate protocol sources
prefix=$(shell pkg-config --variable=prefix wayland-server)

3
src/gallium/Android.mk Normal file
View File

@@ -0,0 +1,3 @@
ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
include $(call all-subdir-makefiles)
endif

View File

@@ -53,6 +53,7 @@ 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')

View File

@@ -0,0 +1,217 @@
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)

View File

@@ -107,7 +107,6 @@ 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 \

View File

@@ -154,7 +154,6 @@ 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',

View File

@@ -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 first_level, uint32_t last_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, first_level, last_level,
width, height, depth, last_level,
row_stride, img_stride, data);
#endif
}

View File

@@ -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 first_level, uint32_t last_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]);

View File

@@ -106,7 +106,6 @@ 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] =
@@ -137,9 +136,6 @@ 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);
@@ -442,8 +438,7 @@ 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,
boolean clamp_vertex_color)
struct lp_build_sampler_soa *draw_sampler)
{
const struct tgsi_token *tokens = llvm->draw->vs.vertex_shader->state.tokens;
struct lp_type vs_type;
@@ -479,30 +474,6 @@ 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
@@ -1264,8 +1235,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
ptr_aos,
system_values_array,
context_ptr,
sampler,
variant->key.clamp_vertex_color);
sampler);
/* store original positions in clip before further manipulation */
store_clip(gallivm, io, outputs);
@@ -1476,8 +1446,7 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian
ptr_aos,
system_values_array,
context_ptr,
sampler,
variant->key.clamp_vertex_color);
sampler);
/* store original positions in clip before further manipulation */
store_clip(gallivm, io, outputs);
@@ -1555,8 +1524,6 @@ 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.
*/
@@ -1599,7 +1566,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 first_level, uint32_t last_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])
@@ -1615,10 +1582,9 @@ 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 = first_level; j <= last_level; j++) {
for (j = 0; 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];

View File

@@ -50,7 +50,6 @@ 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];
@@ -65,7 +64,6 @@ 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,
@@ -164,7 +162,6 @@ 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;
@@ -172,7 +169,7 @@ struct draw_llvm_variant_key
unsigned bypass_viewport:1;
unsigned need_edgeflags:1;
unsigned nr_planes:4;
unsigned pad:5;
unsigned pad:6;
/* Variable number of vertex elements:
*/
@@ -298,7 +295,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 first_level, uint32_t last_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]);

View File

@@ -144,7 +144,6 @@ 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)
@@ -210,7 +209,6 @@ 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;

View File

@@ -146,14 +146,6 @@ 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;

View File

@@ -470,17 +470,6 @@ 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;

View File

@@ -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.max_index);
draw->pt.user.max_index);
}
translate->run_elts( translate,

View File

@@ -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.max_index);
draw->pt.user.max_index);
}
*max_vertices = (draw->render->max_vertex_buffer_bytes /

View File

@@ -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.max_index );
draw->pt.user.max_index );
}
*max_vertices = (draw->render->max_vertex_buffer_bytes /

View File

@@ -85,12 +85,7 @@ vsplit_flush_cache(struct vsplit_frontend *vsplit, unsigned flags)
static INLINE void
vsplit_add_cache(struct vsplit_frontend *vsplit, unsigned fetch)
{
struct draw_context *draw = vsplit->draw;
unsigned hash;
fetch = MIN2(fetch, draw->pt.max_index);
hash = fetch % MAP_SIZE;
unsigned hash = fetch % MAP_SIZE;
if (vsplit->cache.fetches[hash] != fetch) {
/* update cache */

View File

@@ -47,18 +47,14 @@ 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[i];
if (idx < min_index || idx > max_index) {
debug_printf("warning: index out of range\n");
}
ELT_TYPE idx = ib[istart + i];
assert(idx >= min_index && idx <= max_index);
}
draw_elts = (const ushort *) ib;
}
@@ -87,21 +83,17 @@ 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[i];
ELT_TYPE idx = ib[istart + i];
if (idx < min_index || idx > max_index) {
debug_printf("warning: index out of range\n");
}
assert(idx >= min_index && idx <= max_index);
vsplit->draw_elts[i] = (ushort) idx;
}
}
else {
for (i = 0; i < icount; i++) {
ELT_TYPE idx = ib[i];
ELT_TYPE idx = ib[istart + i];
if (idx < min_index || idx > max_index) {
debug_printf("warning: index out of range\n");
}
assert(idx >= min_index && idx <= max_index);
vsplit->draw_elts[i] = (ushort) (idx - min_index);
}
}

View File

@@ -104,17 +104,10 @@ 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

View File

@@ -95,7 +95,6 @@ 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);
@@ -152,22 +151,11 @@ 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++) {
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];
}
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

View File

@@ -32,12 +32,7 @@
#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>
@@ -207,17 +202,9 @@ 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();
#endif
#if HAVE_LLVM >= 0x0300
OwningPtr<MCInstPrinter> Printer(
T->createMCInstPrinter(*TM, AsmPrinterVariant, *AsmInfo));
#elif HAVE_LLVM >= 0x0208
#if HAVE_LLVM >= 0x0208
OwningPtr<MCInstPrinter> Printer(
T->createMCInstPrinter(AsmPrinterVariant, *AsmInfo));
#else
@@ -229,6 +216,8 @@ lp_disassemble(const void* func)
return;
}
TargetMachine *TM = T->createTargetMachine(Triple, "");
const TargetInstrInfo *TII = TM->getInstrInfo();
/*

View File

@@ -51,10 +51,6 @@
*/
#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?
@@ -188,11 +184,9 @@ 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;
@@ -204,9 +198,8 @@ 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 int_size, float_size;
LLVMValueRef float_size;
LLVMValueRef rho;
LLVMValueRef first_level, first_level_vec;
dsdx = ddx[0];
dsdy = ddy[0];
@@ -242,11 +235,7 @@ lp_build_rho(struct lp_build_sample_context *bld,
rho_vec = lp_build_max(float_size_bld, rho_x, rho_y);
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);
float_size = lp_build_int_to_float(float_size_bld, bld->int_size);
rho_vec = lp_build_mul(float_size_bld, rho_vec, float_size);
@@ -453,7 +442,7 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
else {
LLVMValueRef rho;
rho = lp_build_rho(bld, unit, ddx, ddy);
rho = lp_build_rho(bld, ddx, ddy);
/*
* Compute lod = log2(rho)
@@ -553,18 +542,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 first_level, last_level, level;
LLVMValueRef last_level, level;
LLVMValueRef zero = lp_build_const_int32(bld->gallivm, 0);
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 = lp_build_add(int_bld, lod_ipart, first_level);
level = lod_ipart;
/* clamp level to legal range of levels */
*level_out = lp_build_clamp(int_bld, level, first_level, last_level);
*level_out = lp_build_clamp(int_bld, level, zero, last_level);
}
@@ -584,42 +573,39 @@ 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 first_level, last_level;
LLVMValueRef last_level;
LLVMValueRef clamp_min;
LLVMValueRef clamp_max;
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);
*level0_out = lod_ipart;
*level1_out = lp_build_add(int_bld, lod_ipart, int_bld->one);
last_level = bld->dynamic_state->last_level(bld->dynamic_state,
bld->gallivm, unit);
/*
* 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
* 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
* ends in the process.
*/
/* *level0_out < first_level */
/* lod_ipart < 0 */
clamp_min = LLVMBuildICmp(builder, LLVMIntSLT,
*level0_out, first_level,
"clamp_lod_to_first");
lod_ipart, int_bld->zero,
"clamp_lod_to_zero");
*level0_out = LLVMBuildSelect(builder, clamp_min,
first_level, *level0_out, "");
int_bld->zero, *level0_out, "");
*level1_out = LLVMBuildSelect(builder, clamp_min,
first_level, *level1_out, "");
int_bld->zero, *level1_out, "");
*lod_fpart_inout = LLVMBuildSelect(builder, clamp_min,
float_bld->zero, *lod_fpart_inout, "");
/* *level0_out >= last_level */
/* lod_ipart >= last_level */
clamp_max = LLVMBuildICmp(builder, LLVMIntSGE,
*level0_out, last_level,
lod_ipart, last_level,
"clamp_lod_to_last");
*level0_out = LLVMBuildSelect(builder, clamp_max,

View File

@@ -120,12 +120,6 @@ 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,

View File

@@ -939,7 +939,6 @@ 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 */
@@ -1009,9 +1008,7 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0);
}
else {
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
bld->gallivm, unit);
ilevel0 = first_level;
ilevel0 = i32t_zero;
}
break;
case PIPE_TEX_MIPFILTER_NEAREST:
@@ -1068,7 +1065,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,
ilevel0, NULL, NULL,
i32t_zero, NULL, NULL,
packed_lo, packed_hi);
}
lp_build_endif(&if_ctx);

View File

@@ -943,7 +943,6 @@ 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;
@@ -1010,9 +1009,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0);
}
else {
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
bld->gallivm, unit);
ilevel0 = first_level;
ilevel0 = i32t_zero;
}
break;
case PIPE_TEX_MIPFILTER_NEAREST:
@@ -1071,7 +1068,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,
ilevel0, NULL, NULL,
i32t_zero, NULL, NULL,
texels);
}
lp_build_endif(&if_ctx);

View File

@@ -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)
#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)
typedef pthread_barrier_t pipe_barrier;

View File

@@ -726,16 +726,6 @@ 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 )

View File

@@ -309,7 +309,6 @@ 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 );

View File

@@ -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

View File

@@ -1067,8 +1067,6 @@ 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,
@@ -1102,17 +1100,14 @@ static boolean init_inputs( struct translate_sse *p,
x86_mov(p->func, tmp_EAX, elt);
}
/* Clamp to max_index
/*
* TODO: Respect translate_buffer::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.
@@ -1168,10 +1163,6 @@ 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:
@@ -1188,12 +1179,6 @@ 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);

View File

@@ -270,15 +270,13 @@ 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] >> 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_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_mmx2 = util_cpu_caps.has_sse; /* SSE cpus supports mmxext too */
cacheline = ((regs2[1] >> 8) & 0xFF) * 8;
@@ -292,10 +290,10 @@ util_cpu_detect(void)
cpuid(0x80000001, regs2);
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;
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;
}
if (regs[0] >= 0x80000006) {
@@ -331,8 +329,6 @@ 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);

View File

@@ -53,8 +53,6 @@ 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;

View File

@@ -39,7 +39,6 @@
#include <stddef.h>
#include "pipe/p_compiler.h"
struct list_head
@@ -48,56 +47,50 @@ struct list_head
struct list_head *next;
};
static INLINE void list_inithead(struct list_head *item)
{
item->prev = item;
item->next = item;
}
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_INITHEAD(__item) \
do { \
(__item)->prev = (__item); \
(__item)->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_ADD(__item, __list) \
do { \
(__item)->prev = (__list); \
(__item)->next = (__list)->next; \
(__list)->next->prev = (__item); \
(__list)->next = (__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_ADDTAIL(__item, __list) \
do { \
(__item)->next = (__list); \
(__item)->prev = (__list)->prev; \
(__list)->prev->next = (__item); \
(__list)->prev = (__item); \
} while(0)
static INLINE void list_del(struct list_head *item)
{
item->prev->next = item->next;
item->next->prev = item->prev;
}
#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_delinit(struct list_head *item)
{
item->prev->next = item->next;
item->next->prev = item->prev;
item->next = item;
item->prev = item;
}
#define LIST_DEL(__item) \
do { \
(__item)->prev->next = (__item)->next; \
(__item)->next->prev = (__item)->prev; \
} 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_DELINIT(__item) \
do { \
(__item)->prev->next = (__item)->next; \
(__item)->next->prev = (__item)->prev; \
(__item)->next = (__item); \
(__item)->prev = (__item); \
} while(0)
#define LIST_ENTRY(__type, __item, __field) \
((__type *)(((char *)(__item)) - offsetof(__type, __field)))
@@ -121,21 +114,4 @@ static INLINE void list_delinit(struct list_head *item)
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_*/

View File

@@ -1,99 +0,0 @@
/**************************************************************************
*
* 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;
}

View File

@@ -34,11 +34,6 @@
#include "pipe/p_state.h"
#ifdef __cplusplus
extern "C" {
#endif
static INLINE void
util_draw_init_info(struct pipe_draw_info *info)
{
@@ -141,18 +136,4 @@ 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 */

View File

@@ -88,14 +88,6 @@ 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.

View File

@@ -199,6 +199,16 @@ roundf(float x)
#endif /* _MSC_VER */
#ifdef PIPE_OS_ANDROID
static INLINE
double log2(double d)
{
return log(d) / M_LN2;
}
#endif

View File

@@ -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 - 1);
(vb->buffer->width0 - vb->buffer_offset) / vb->stride);
}
for (; i < mgr->b.nr_real_vertex_buffers; i++) {
@@ -572,11 +572,7 @@ void u_vbuf_mgr_draw_begin(struct u_vbuf_mgr *mgrb,
int min_index, max_index;
min_index = info->min_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);
}
max_index = info->max_index - info->index_bias;
/* Translate vertices with non-native layouts or formats. */
if (mgr->incompatible_vb_layout || mgr->ve->incompatible_layout) {

View File

@@ -53,7 +53,7 @@ struct u_vbuf_mgr {
int nr_real_vertex_buffers;
/* Precomputed max_index for hardware vertex buffers. */
unsigned max_index;
int max_index;
/* This uploader can optionally be used by the driver.
*

View File

@@ -7,30 +7,6 @@ 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
-------

View File

@@ -0,0 +1 @@
include $(call all-subdir-makefiles)

View File

@@ -0,0 +1,48 @@
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

View File

@@ -55,7 +55,7 @@ i915_buffer_destroy(struct pipe_screen *screen,
{
struct i915_buffer *buffer = i915_buffer(resource);
if (buffer->free_on_destroy)
align_free(buffer->data);
FREE(buffer->data);
FREE(buffer);
}

View File

@@ -1,116 +1,61 @@
<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>
LLVMPIPE -- a fork of softpipe that employs LLVM for code generation.
<h1>Requirements</h1>
Requirements
============
<dl>
<dt>An x86 or amd64 processor. 64-bit mode is preferred.</dt>
<dd>
<p>
- A x86 or amd64 processor. 64bit mode is preferred.
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.
</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>
- LLVM. Version 2.8 recommended. 2.6 or later required.
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>
<dt>scons (optional)</dt>
</dl>
- scons (optional)
<h1>Building</h1>
Building
========
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>
<h1>Using</h1>
Using
=====
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.
@@ -123,20 +68,19 @@ replacing the native ICD driver, but it's quite an advanced usage, so if you
need to ask, don't even try it.
<h1>Profiling</h1>
Profiling
=========
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 \
@@ -148,57 +92,43 @@ 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.
<h1>Unit testing</h1>
Unit testing
============
<p>
Building will also create several unit tests in
build/linux-???-debug/gallium/drivers/llvmpipe:
</p>
</ul>
<li> lp_test_blend: blending
<li> lp_test_conv: SIMD vector conversion
<li> lp_test_format: pixel unpacking/packing
</ul>
- lp_test_blend: blending
- lp_test_conv: SIMD vector conversion
- lp_test_format: pixel unpacking/packing
<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>
<h1>Development Notes</h1>
Development Notes
=================
<ul>
<li>
When looking to this code by the first time start in lp_state_fs.c, and
- 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.
</li>
<li>
The driver-independent parts of the LLVM / Gallium code are found in
- 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.
</li>
<li>
We use LLVM-C bindings for now. They are not documented, but follow the C++
- 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>

View File

@@ -54,7 +54,6 @@ 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] =
@@ -82,9 +81,6 @@ 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);

View File

@@ -50,7 +50,6 @@ 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];
@@ -67,7 +66,6 @@ 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,

View File

@@ -166,7 +166,6 @@ 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;

View File

@@ -653,7 +653,6 @@ 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
@@ -664,7 +663,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 = view->u.tex.first_level; j <= tex->last_level; j++) {
for (j = 0; 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);
@@ -678,7 +677,6 @@ 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;

View File

@@ -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 = view->u.tex.first_level; j <= tex->last_level; j++) {
for (j = 0; 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,
view->u.tex.first_level, tex->last_level,
tex->last_level,
row_stride, img_stride, data);
}
}

View File

@@ -149,7 +149,6 @@ 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)
@@ -220,7 +219,6 @@ 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;

View File

@@ -337,7 +337,6 @@ 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